Perf: Player interact event.
This commit is contained in:
parent
58ea48df06
commit
783c5a9844
|
|
@ -3,7 +3,7 @@ main: me.ryanhamshire.GriefPrevention.GriefPrevention
|
||||||
softdepend: [Vault, Multiverse-Core, My Worlds, MystCraft, Transporter, TheUnderground, WorldGuard, WorldEdit]
|
softdepend: [Vault, Multiverse-Core, My Worlds, MystCraft, Transporter, TheUnderground, WorldGuard, WorldEdit]
|
||||||
dev-url: http://dev.bukkit.org/server-mods/grief-prevention
|
dev-url: http://dev.bukkit.org/server-mods/grief-prevention
|
||||||
loadbefore: [TheUnderground]
|
loadbefore: [TheUnderground]
|
||||||
version: 10.5.3
|
version: 10.5.5
|
||||||
commands:
|
commands:
|
||||||
abandonclaim:
|
abandonclaim:
|
||||||
description: Deletes a claim.
|
description: Deletes a claim.
|
||||||
|
|
|
||||||
|
|
@ -107,6 +107,12 @@ class EntityEventHandler implements Listener
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//don't allow players to trample crops
|
||||||
|
else if(event.getEntityType() == EntityType.PLAYER && event.getBlock().getType() == Material.SOIL)
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
|
||||||
//sand cannon fix - when the falling block doesn't fall straight down, take additional anti-grief steps
|
//sand cannon fix - when the falling block doesn't fall straight down, take additional anti-grief steps
|
||||||
else if (event.getEntityType() == EntityType.FALLING_BLOCK)
|
else if (event.getEntityType() == EntityType.FALLING_BLOCK)
|
||||||
|
|
|
||||||
|
|
@ -1243,6 +1243,7 @@ class PlayerEventHandler implements Listener
|
||||||
//not interested in left-click-on-air actions
|
//not interested in left-click-on-air actions
|
||||||
Action action = event.getAction();
|
Action action = event.getAction();
|
||||||
if(action == Action.LEFT_CLICK_AIR) return;
|
if(action == Action.LEFT_CLICK_AIR) return;
|
||||||
|
if(action == Action.PHYSICAL) return;
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
Block clickedBlock = event.getClickedBlock(); //null returned here means interacting with air
|
Block clickedBlock = event.getClickedBlock(); //null returned here means interacting with air
|
||||||
|
|
@ -1257,20 +1258,7 @@ class PlayerEventHandler implements Listener
|
||||||
clickedBlockType = Material.AIR;
|
clickedBlockType = Material.AIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
//apply rule for players trampling tilled soil back to dirt (never allow it)
|
//don't care about left-clicking on most blocks, this is probably a break action
|
||||||
//NOTE: that this event applies only to players. monsters and animals can still trample.
|
|
||||||
if(action == Action.PHYSICAL)
|
|
||||||
{
|
|
||||||
if(clickedBlockType == Material.SOIL)
|
|
||||||
{
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
//not tracking any other "physical" interaction events right now
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//don't care about left-clicking on most blocks, this is probably a break action
|
|
||||||
PlayerData playerData = null;
|
PlayerData playerData = null;
|
||||||
if(action == Action.LEFT_CLICK_BLOCK && clickedBlock != null)
|
if(action == Action.LEFT_CLICK_BLOCK && clickedBlock != null)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user