mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-07-15 03:54:43 +02:00
Fix the issues with sticky pistons and slime blocks
This is a fix for issues #2419 and #2494
This commit is contained in:
@ -9,7 +9,6 @@ import org.bukkit.entity.Fish;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerFishEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
@ -280,26 +279,4 @@ public class EventUtils {
|
||||
|
||||
return event;
|
||||
}
|
||||
|
||||
/**
|
||||
* There is a bug in CraftBukkit that causes piston events to
|
||||
* fire multiple times. Check this method to see if the piston event
|
||||
* should be processed.
|
||||
*
|
||||
* @param block Block object of the piston block
|
||||
* @param isExtendEvent should be true when called from BlockPistonExtendEvent
|
||||
*
|
||||
* @return true if the PistonEvent should be processed, false otherwise
|
||||
*/
|
||||
public static boolean shouldProcessEvent(Block block, boolean isExtendEvent) {
|
||||
String pistonAction = isExtendEvent ? "EXTEND" : "RETRACT";
|
||||
String lastAction = block.hasMetadata(mcMMO.pistonDataKey) ? block.getMetadata(mcMMO.pistonDataKey).get(0).asString() : "";
|
||||
|
||||
if (!lastAction.equals(pistonAction)) {
|
||||
block.setMetadata(mcMMO.pistonDataKey, new FixedMetadataValue(mcMMO.p, pistonAction));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user