mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2024-07-07 13:05:10 +00:00
Piston push blacklist
This commit is contained in:
parent
1ce6be5944
commit
81f0ad4d92
|
@ -305,7 +305,7 @@ protect:
|
||||||
on-placement: 10,11,46
|
on-placement: 10,11,46
|
||||||
on-use:
|
on-use:
|
||||||
# 46: TNT
|
# 46: TNT
|
||||||
on-break: 46
|
on-break:
|
||||||
|
|
||||||
# Users cannot PLACE these types of blocks/items.
|
# Users cannot PLACE these types of blocks/items.
|
||||||
# < 255 designates a BLOCK
|
# < 255 designates a BLOCK
|
||||||
|
@ -318,6 +318,8 @@ protect:
|
||||||
#break: 20,50
|
#break: 20,50
|
||||||
break:
|
break:
|
||||||
|
|
||||||
|
# Which blocks should not be pushed by pistons
|
||||||
|
piston:
|
||||||
|
|
||||||
# General physics/behavior modifications
|
# General physics/behavior modifications
|
||||||
prevent:
|
prevent:
|
||||||
|
|
|
@ -45,6 +45,8 @@ public class EssentialsProtect extends JavaPlugin implements IConf, IProtect
|
||||||
pm.registerEvent(Type.BLOCK_IGNITE, blockListener, Priority.Highest, this);
|
pm.registerEvent(Type.BLOCK_IGNITE, blockListener, Priority.Highest, this);
|
||||||
pm.registerEvent(Type.BLOCK_BURN, blockListener, Priority.Highest, this);
|
pm.registerEvent(Type.BLOCK_BURN, blockListener, Priority.Highest, this);
|
||||||
pm.registerEvent(Type.BLOCK_BREAK, blockListener, Priority.Highest, this);
|
pm.registerEvent(Type.BLOCK_BREAK, blockListener, Priority.Highest, this);
|
||||||
|
pm.registerEvent(Type.BLOCK_PISTON_EXTEND, blockListener, Priority.Highest, this);
|
||||||
|
pm.registerEvent(Type.BLOCK_PISTON_RETRACT, blockListener, Priority.Highest, this);
|
||||||
|
|
||||||
final EssentialsProtectEntityListener entityListener = new EssentialsProtectEntityListener(this);
|
final EssentialsProtectEntityListener entityListener = new EssentialsProtectEntityListener(this);
|
||||||
pm.registerEvent(Type.ENTITY_EXPLODE, entityListener, Priority.Highest, this);
|
pm.registerEvent(Type.ENTITY_EXPLODE, entityListener, Priority.Highest, this);
|
||||||
|
|
|
@ -14,6 +14,8 @@ import org.bukkit.event.block.BlockBurnEvent;
|
||||||
import org.bukkit.event.block.BlockFromToEvent;
|
import org.bukkit.event.block.BlockFromToEvent;
|
||||||
import org.bukkit.event.block.BlockIgniteEvent;
|
import org.bukkit.event.block.BlockIgniteEvent;
|
||||||
import org.bukkit.event.block.BlockListener;
|
import org.bukkit.event.block.BlockListener;
|
||||||
|
import org.bukkit.event.block.BlockPistonExtendEvent;
|
||||||
|
import org.bukkit.event.block.BlockPistonRetractEvent;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
|
|
||||||
|
|
||||||
|
@ -319,4 +321,35 @@ public class EssentialsProtectBlockListener extends BlockListener
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBlockPistonExtend(BlockPistonExtendEvent event)
|
||||||
|
{
|
||||||
|
if (event.isCancelled())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (Block block : event.getBlocks())
|
||||||
|
{
|
||||||
|
if (prot.checkProtectionItems(ProtectConfig.blacklist_piston, block.getTypeId()))
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBlockPistonRetract(BlockPistonRetractEvent event)
|
||||||
|
{
|
||||||
|
if (event.isCancelled() || !event.isSticky())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (prot.checkProtectionItems(ProtectConfig.blacklist_piston, event.getRetractLocation().getBlock().getTypeId()))
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,8 @@ public enum ProtectConfig
|
||||||
alert_on_break("protect.alert.on-break"),
|
alert_on_break("protect.alert.on-break"),
|
||||||
blacklist_placement("protect.blacklist.placement"),
|
blacklist_placement("protect.blacklist.placement"),
|
||||||
blacklist_usage("protect.blacklist.usage"),
|
blacklist_usage("protect.blacklist.usage"),
|
||||||
blacklist_break("protect.blacklist.break");
|
blacklist_break("protect.blacklist.break"),
|
||||||
|
blacklist_piston("protect.blacklist.piston");
|
||||||
private final String configName;
|
private final String configName;
|
||||||
private final String defValueString;
|
private final String defValueString;
|
||||||
private final boolean defValueBoolean;
|
private final boolean defValueBoolean;
|
||||||
|
|
Loading…
Reference in a new issue