Solved If player run /hub in 1vs1 match

Discussion in 'Development' started by MSG100PM, Jul 7, 2018.

  1. MSG100PM

    MSG100PM Slime

    Messages:
    95
    GitHub:
    MSG100TC
    Hello, I have a problem with the 1vs1 plugin by Minfiixo. https://github.com/Minifixio/pocketmine-1vs1-plugin (The author is inactive so I decided to ask here)

    Here's my problem:
    Players on my server are exploiting a bug, first they enter the 1vs1 match, and then do /hub to get back to spawn immediately, keeping the items which should be only get able in the 1vs1 match. This is very unfair since the 1vs1 match gives you full diamond armor, and they are abusing this bug. How I fix this?

    My idea is that, when they do /hub or /spawn, their inventories get cleared and loose the match, what code should I add for that though?
     
  2. MSG100PM

    MSG100PM Slime

    Messages:
    95
    GitHub:
    MSG100TC
  3. Michael Haufe

    Michael Haufe Silverfish

    Messages:
    16
    Yeah, i think you should try to clear the player's inventory by executing the /hub command.
    If you execute /hub you are teleported to another world and now you can code in, that if one player leaves the world in combat time, the second player wins, get rewarded and returned to lobby again.
     
  4. Darku

    Darku Spider Jockey

    Messages:
    49
    GitHub:
    DarkWav
    First, i would not modify Arena.php but rather EventsManager.php.
    You could add this code to the onPlayerQuit() event handler, but keep in mind you might need to link more classes (like ConsoleCommandSender)
    Code:
    $this->arenaManager->getServer()->dispatchCommand(new ConsoleCommandSender(), "clear $event->getPlayer()");
    
     
  5. MSG100PM

    MSG100PM Slime

    Messages:
    95
    GitHub:
    MSG100TC
    Hello, thanks for replying.

    But on what line should I add the code in EventsManager? (Sorry I'm a newbie)
     
  6. Darku

    Darku Spider Jockey

    Messages:
    49
    GitHub:
    DarkWav
    eventually on line 35. but remember you need to link ConsoleCommandSender and some other classes, too.
     
    MSG100PM likes this.
  7. MSG100PM

    MSG100PM Slime

    Messages:
    95
    GitHub:
    MSG100TC
    How do I link ConsoleCommandSender? And what are other classes to link besides that? (Again, sorry I'm a newbie)
     
  8. MSG100PM

    MSG100PM Slime

    Messages:
    95
    GitHub:
    MSG100TC
    Are you able to give me the full code? I really can't fix it...
     
  9. Darku

    Darku Spider Jockey

    Messages:
    49
    GitHub:
    DarkWav
    I will take a look at this. I will upload the EventsManager.php when im finished.
     
    MSG100PM likes this.
  10. Darku

    Darku Spider Jockey

    Messages:
    49
    GitHub:
    DarkWav
    Btw, are you using the original version from github???
    Because its API-1.0.0...
     
  11. MSG100PM

    MSG100PM Slime

    Messages:
    95
    GitHub:
    MSG100TC
    No, Im using this version: https://github.com/Vale914/1vs1
     
  12. MSG100PM

    MSG100PM Slime

    Messages:
    95
    GitHub:
    MSG100TC
    Thanks!! I'm really in need of a working one with no bugs :)
     
  13. Darku

    Darku Spider Jockey

    Messages:
    49
    GitHub:
    DarkWav
    MSG100PM likes this.
  14. MSG100PM

    MSG100PM Slime

    Messages:
    95
    GitHub:
    MSG100TC
  15. MSG100PM

    MSG100PM Slime

    Messages:
    95
    GitHub:
    MSG100TC
    Wait, but does it clear the players' inventories when they do /hub or /spawn? I want to prevent those too
     
  16. Darku

    Darku Spider Jockey

    Messages:
    49
    GitHub:
    DarkWav
    whenever they switch to a different gameserver, the inventory will be cleared.
    If your hub is at the same server as the 1v1 arena is, it wont be cleared.
     
  17. MSG100PM

    MSG100PM Slime

    Messages:
    95
    GitHub:
    MSG100TC
    Same server though, just diffrent worlds... Are you able to do another fix?
     
  18. Darku

    Darku Spider Jockey

    Messages:
    49
    GitHub:
    DarkWav
    Yes, but this would require editing the plugin that adds /spawn and /hub........
     
  19. MSG100PM

    MSG100PM Slime

    Messages:
    95
    GitHub:
    MSG100TC
  20. Darku

    Darku Spider Jockey

    Messages:
    49
    GitHub:
    DarkWav
    ok ima edit that, too brb
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.