mirror of
https://github.com/bloodmc/GriefDefender.git
synced 2024-11-28 13:15:23 +01:00
Add tracking support for piston item spawns.
This will allow servers to stop piston farms spawning items. Ex. If you want to stop pistons from spawning items in all basic claims you would enter the following command '/cf item-spawn any false context[source=piston, override=basic]'
This commit is contained in:
parent
d6b2958580
commit
67e5641d40
@ -126,6 +126,7 @@ public void onBlockBurn(BlockBurnEvent event) {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onBlockPistonExtend(BlockPistonExtendEvent event) {
|
public void onBlockPistonExtend(BlockPistonExtendEvent event) {
|
||||||
|
GDCauseStackManager.getInstance().pushCause(event.getBlock());
|
||||||
if (lastBlockPreTick == NMSUtil.getInstance().getRunningServerTicks()) {
|
if (lastBlockPreTick == NMSUtil.getInstance().getRunningServerTicks()) {
|
||||||
// IGNORE
|
// IGNORE
|
||||||
event.setCancelled(lastBlockPreCancelled);
|
event.setCancelled(lastBlockPreCancelled);
|
||||||
|
@ -646,6 +646,9 @@ public void handleEntitySpawn(Event event, Object source, Entity entity) {
|
|||||||
user = CauseContextHelper.getEventUser(sourceLocation);
|
user = CauseContextHelper.getEventUser(sourceLocation);
|
||||||
} else if (source instanceof Player) {
|
} else if (source instanceof Player) {
|
||||||
user = PermissionHolderCache.getInstance().getOrCreateUser((Player) source);
|
user = PermissionHolderCache.getInstance().getOrCreateUser((Player) source);
|
||||||
|
} else if (source instanceof Block) {
|
||||||
|
sourceLocation = ((Block) source).getLocation();
|
||||||
|
user = CauseContextHelper.getEventUser(sourceLocation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user