mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-26 14:52:58 +00:00
Packets should be thread safe now
This commit is contained in:
1 parent
542e806644
commit
e4aed3f7c1
25 files changed
+788
-624
No files matched your search
@@ -22,28 +22,34 @@ public class PacketSecurityMode implements IMessageHandler<SecurityModeMessage,
|
||||
{
|
||||
EntityPlayer player = PacketHandler.getPlayer(context);
|
||||
|
||||
if(message.packetType == SecurityPacketType.BLOCK)
|
||||
{
|
||||
TileEntity tileEntity = message.coord4D.getTileEntity(player.worldObj);
|
||||
|
||||
if(tileEntity instanceof ISecurityTile)
|
||||
PacketHandler.handlePacket(new Runnable() {
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
String owner = ((ISecurityTile)tileEntity).getSecurity().getOwner();
|
||||
|
||||
if(owner != null && player.getName().equals(owner))
|
||||
if(message.packetType == SecurityPacketType.BLOCK)
|
||||
{
|
||||
((ISecurityTile)tileEntity).getSecurity().setMode(message.value);
|
||||
TileEntity tileEntity = message.coord4D.getTileEntity(player.worldObj);
|
||||
|
||||
if(tileEntity instanceof ISecurityTile)
|
||||
{
|
||||
String owner = ((ISecurityTile)tileEntity).getSecurity().getOwner();
|
||||
|
||||
if(owner != null && player.getName().equals(owner))
|
||||
{
|
||||
((ISecurityTile)tileEntity).getSecurity().setMode(message.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
ItemStack stack = player.getHeldItem(message.currentHand);
|
||||
|
||||
if(stack.getItem() instanceof ISecurityItem)
|
||||
{
|
||||
((ISecurityItem)stack.getItem()).setSecurity(stack, message.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
ItemStack stack = player.getHeldItem(message.currentHand);
|
||||
|
||||
if(stack.getItem() instanceof ISecurityItem)
|
||||
{
|
||||
((ISecurityItem)stack.getItem()).setSecurity(stack, message.value);
|
||||
}
|
||||
}
|
||||
}, player.worldObj);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user