Fixed bug where players couldn't place regular blocks next to secured networks, fixes #1332

This commit is contained in:
raoulvdberge
2017-06-29 11:03:20 +02:00
parent 09bf16bebf
commit 7800184744
2 changed files with 18 additions and 13 deletions

View File

@@ -2,6 +2,7 @@
### 1.5.6
- Updated Forge to stable 2387 (raoulvdberge)
- Fixed bug where players couldn't place regular blocks next to secured networks (raoulvdberge)
- Removed Processing Pattern Encoder, that functionality is now available in the Pattern Grid (raoulvdberge)
### 1.5.5

View File

@@ -16,34 +16,38 @@ public class NetworkNodeListener {
@SubscribeEvent
public void onWorldTick(TickEvent.WorldTickEvent e) {
if (!e.world.isRemote) {
e.world.profiler.startSection("network node ticking");
if (e.phase == TickEvent.Phase.END) {
e.world.profiler.startSection("network node ticking");
for (INetworkNode node : API.instance().getNetworkNodeManager(e.world).all()) {
node.update();
}
}
e.world.profiler.endSection();
e.world.profiler.endSection();
}
}
}
@SubscribeEvent
public void onBlockPlace(BlockEvent.PlaceEvent e) {
if (!e.getWorld().isRemote) {
for (EnumFacing facing : EnumFacing.VALUES) {
TileEntity tile = e.getWorld().getTileEntity(e.getBlockSnapshot().getPos().offset(facing));
TileEntity placed = e.getWorld().getTileEntity(e.getPos());
if (tile != null && tile.hasCapability(CapabilityNetworkNodeProxy.NETWORK_NODE_PROXY_CAPABILITY, facing.getOpposite())) {
INetworkNodeProxy nodeProxy = tile.getCapability(CapabilityNetworkNodeProxy.NETWORK_NODE_PROXY_CAPABILITY, facing.getOpposite());
INetworkNode node = nodeProxy.getNode();
if (placed != null && placed.hasCapability(CapabilityNetworkNodeProxy.NETWORK_NODE_PROXY_CAPABILITY, null)) {
for (EnumFacing facing : EnumFacing.VALUES) {
TileEntity side = e.getWorld().getTileEntity(e.getBlockSnapshot().getPos().offset(facing));
if (node.getNetwork() != null && !node.getNetwork().getSecurityManager().hasPermission(Permission.BUILD, e.getPlayer())) {
RSUtils.sendNoPermissionMessage(e.getPlayer());
if (side != null && side.hasCapability(CapabilityNetworkNodeProxy.NETWORK_NODE_PROXY_CAPABILITY, facing.getOpposite())) {
INetworkNodeProxy nodeProxy = side.getCapability(CapabilityNetworkNodeProxy.NETWORK_NODE_PROXY_CAPABILITY, facing.getOpposite());
INetworkNode node = nodeProxy.getNode();
e.setCanceled(true);
if (node.getNetwork() != null && !node.getNetwork().getSecurityManager().hasPermission(Permission.BUILD, e.getPlayer())) {
RSUtils.sendNoPermissionMessage(e.getPlayer());
return;
e.setCanceled(true);
return;
}
}
}
}