Closed PsychoLynx closed 8 years ago
I'll try to check the code for it.
Hey! Any update on this yet?
@PsychoLynx Can't find the cause for this. Maybe its WorldEdit?
Updated Spigot, WorldEdit and SurvivalGames to their latest (dev) versions, still persists on a clean server with nothing else.
Would it be possible just to make a toggle the paper bandage off? (preferably backported to 1.9.4)
@PsychoLynx I think so, Try checking the configurations. There might be an option this this.
@ThunderGemios10 Well, I looked through all of the config files and didn't find one, hence why I'm asking.
@PsychoLynx Ok. This may be fixed in future updates. But if this really concerns you. You may disable bandages..
I would indeed love to disable the bandages if I could find the config option to do so! Newest build, fresh install - looked through all the files, nothing related to bandages I could see.
The bandage class is located here. You could simply add the entire event into an if statement to check if the player is active (aka in game), else return. The easiest way to achieve this is to use isPlayerActive(); from the GameManager class, since it already returns true and false for you.
@Rushnett Thanks for the explanation. I'll get working on bugfixes soon and possibly add a disable option for Bandages.
@PsychoLynx @Rushnett Ok, I made a first attempt at using if statements. You can check the class. It may be incorrect but hey, I'm a new on using if statements.
Oh, then I can help here. Looking at the current logic, it appears that bandages will always be used, since the if statement you put in doesnt get reached until after the whole bandage method is run through. It also prints your message when you are in an arena, because for some reason (I suppose the original author) made IsPlayerInactive() the exact same as IsPlayerActive() (basically it prints true if they are active, so it made your if statement loop into when someone was in game.
TL;DR: It still eats the papers no matter what, and the if statement you made doesnt stop anything, but loops while in game. Screenshot of what I meant when I tested:
Our (my friend and I) fix for when we handle this is the following:
public void onBandageUse(PlayerInteractEvent e) {
Player p = e.getPlayer();
Boolean active = GameManager.getInstance().isPlayerActive(p);
if (!active) {
return;
}
// rest of method here
}
This exits the event always if you arent in an arena.
@Rushnett Thanks again for the explanation. I'll try using your code.
@Rushnett Okay, I pushed the commit, I think it should work now.
@ThunderGemios10 Yup, just compiled it and tested. Works just how it should.
@Rushnett Ok, Thank you for confirming it. Really appreciate it! You should add your name on the contributors list. on the main class.
Hey!
So I found this out by accident that I can right-click a paper when just minding my own business and still get healed 5 hears (and the paper get consumed) even though I'm nowhere near an SG arena, let alone in-game (I'm OP/Admin, so will have to see if this is the case for regular players as well)
So yeah - a fix would be nice - or at least would it be possible to add an option to toggle bandages off (as I have no use for them in my SG setup). Love the plugin - best rendition of the original I've seen thus far!