mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-11-09 20:41:23 +01:00
Implement event toggle.
This commit is contained in:
parent
a1b2773bf5
commit
cbc1aeacbe
@ -17,6 +17,7 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
public class EssentialsSign
|
public class EssentialsSign
|
||||||
{
|
{
|
||||||
private static final Set<Material> EMPTY_SET = new HashSet<Material>();
|
private static final Set<Material> EMPTY_SET = new HashSet<Material>();
|
||||||
|
|
||||||
protected transient final String signName;
|
protected transient final String signName;
|
||||||
|
|
||||||
public EssentialsSign(final String signName)
|
public EssentialsSign(final String signName)
|
||||||
@ -258,6 +259,11 @@ public class EssentialsSign
|
|||||||
{
|
{
|
||||||
return EMPTY_SET;
|
return EMPTY_SET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean areHeavyEventRequired()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
protected final void validateTrade(final ISign sign, final int index, final IEssentials ess) throws SignException
|
protected final void validateTrade(final ISign sign, final int index, final IEssentials ess) throws SignException
|
||||||
{
|
{
|
||||||
|
@ -65,7 +65,7 @@ public class SignBlockListener implements Listener
|
|||||||
}
|
}
|
||||||
for (EssentialsSign sign : ess.getSettings().enabledSigns())
|
for (EssentialsSign sign : ess.getSettings().enabledSigns())
|
||||||
{
|
{
|
||||||
if (sign.getBlocks().contains(block.getType())
|
if (sign.areHeavyEventRequired() && sign.getBlocks().contains(block.getType())
|
||||||
&& !sign.onBlockBreak(block, player, ess))
|
&& !sign.onBlockBreak(block, player, ess))
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.INFO, "A block was protected by a sign.");
|
LOGGER.log(Level.INFO, "A block was protected by a sign.");
|
||||||
@ -148,7 +148,7 @@ public class SignBlockListener implements Listener
|
|||||||
}
|
}
|
||||||
for (EssentialsSign sign : ess.getSettings().enabledSigns())
|
for (EssentialsSign sign : ess.getSettings().enabledSigns())
|
||||||
{
|
{
|
||||||
if (sign.getBlocks().contains(block.getType())
|
if (sign.areHeavyEventRequired() && sign.getBlocks().contains(block.getType())
|
||||||
&& !sign.onBlockPlace(block, event.getPlayer(), ess))
|
&& !sign.onBlockPlace(block, event.getPlayer(), ess))
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -176,7 +176,7 @@ public class SignBlockListener implements Listener
|
|||||||
}
|
}
|
||||||
for (EssentialsSign sign : ess.getSettings().enabledSigns())
|
for (EssentialsSign sign : ess.getSettings().enabledSigns())
|
||||||
{
|
{
|
||||||
if (sign.getBlocks().contains(block.getType())
|
if (sign.areHeavyEventRequired() && sign.getBlocks().contains(block.getType())
|
||||||
&& !sign.onBlockBurn(block, ess))
|
&& !sign.onBlockBurn(block, ess))
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -204,7 +204,7 @@ public class SignBlockListener implements Listener
|
|||||||
}
|
}
|
||||||
for (EssentialsSign sign : ess.getSettings().enabledSigns())
|
for (EssentialsSign sign : ess.getSettings().enabledSigns())
|
||||||
{
|
{
|
||||||
if (sign.getBlocks().contains(block.getType())
|
if (sign.areHeavyEventRequired() && sign.getBlocks().contains(block.getType())
|
||||||
&& !sign.onBlockIgnite(block, ess))
|
&& !sign.onBlockIgnite(block, ess))
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -233,7 +233,7 @@ public class SignBlockListener implements Listener
|
|||||||
}
|
}
|
||||||
for (EssentialsSign sign : ess.getSettings().enabledSigns())
|
for (EssentialsSign sign : ess.getSettings().enabledSigns())
|
||||||
{
|
{
|
||||||
if (sign.getBlocks().contains(block.getType())
|
if (sign.areHeavyEventRequired() && sign.getBlocks().contains(block.getType())
|
||||||
&& !sign.onBlockPush(block, ess))
|
&& !sign.onBlockPush(block, ess))
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -264,7 +264,7 @@ public class SignBlockListener implements Listener
|
|||||||
}
|
}
|
||||||
for (EssentialsSign sign : ess.getSettings().enabledSigns())
|
for (EssentialsSign sign : ess.getSettings().enabledSigns())
|
||||||
{
|
{
|
||||||
if (sign.getBlocks().contains(block.getType())
|
if (sign.areHeavyEventRequired() && sign.getBlocks().contains(block.getType())
|
||||||
&& !sign.onBlockPush(block, ess))
|
&& !sign.onBlockPush(block, ess))
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
@ -39,7 +39,7 @@ public class SignEntityListener implements Listener
|
|||||||
}
|
}
|
||||||
for (EssentialsSign sign : ess.getSettings().enabledSigns())
|
for (EssentialsSign sign : ess.getSettings().enabledSigns())
|
||||||
{
|
{
|
||||||
if (sign.getBlocks().contains(block.getType()))
|
if (sign.areHeavyEventRequired() && sign.getBlocks().contains(block.getType()))
|
||||||
{
|
{
|
||||||
event.setCancelled(!sign.onBlockExplode(block, ess));
|
event.setCancelled(!sign.onBlockExplode(block, ess));
|
||||||
return;
|
return;
|
||||||
@ -67,7 +67,7 @@ public class SignEntityListener implements Listener
|
|||||||
}
|
}
|
||||||
for (EssentialsSign sign : ess.getSettings().enabledSigns())
|
for (EssentialsSign sign : ess.getSettings().enabledSigns())
|
||||||
{
|
{
|
||||||
if (sign.getBlocks().contains(block.getType())
|
if (sign.areHeavyEventRequired() && sign.getBlocks().contains(block.getType())
|
||||||
&& !sign.onBlockBreak(block, ess))
|
&& !sign.onBlockBreak(block, ess))
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
@ -77,7 +77,7 @@ public class SignPlayerListener implements Listener
|
|||||||
{
|
{
|
||||||
for (EssentialsSign sign : ess.getSettings().enabledSigns())
|
for (EssentialsSign sign : ess.getSettings().enabledSigns())
|
||||||
{
|
{
|
||||||
if (sign.getBlocks().contains(block.getType())
|
if (sign.areHeavyEventRequired() && sign.getBlocks().contains(block.getType())
|
||||||
&& !sign.onBlockInteract(block, event.getPlayer(), ess))
|
&& !sign.onBlockInteract(block, event.getPlayer(), ess))
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
@ -241,6 +241,12 @@ public class SignProtection extends EssentialsSign
|
|||||||
{
|
{
|
||||||
return protectedBlocks;
|
return protectedBlocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean areHeavyEventRequired()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean onBlockPlace(final Block block, final User player, final String username, final IEssentials ess) throws SignException
|
protected boolean onBlockPlace(final Block block, final User player, final String username, final IEssentials ess) throws SignException
|
||||||
|
Loading…
Reference in New Issue
Block a user