Robotia 9 years ago
parent
commit
df7756b769
  1. 310
      patches/net/minecraft/network/NetHandlerPlayServer.java.patch

310
patches/net/minecraft/network/NetHandlerPlayServer.java.patch

@ -125,8 +125,8 @@
p_i1530_3_.playerNetServerHandler = this; p_i1530_3_.playerNetServerHandler = this;
+ // CraftBukkit start + // CraftBukkit start
+ this.server = p_i1530_1_ == null ? null : p_i1530_1_.server; + this.server = p_i1530_1_ == null ? null : p_i1530_1_.server;
+ } }
+
+ private final org.bukkit.craftbukkit.CraftServer server; + private final org.bukkit.craftbukkit.CraftServer server;
+ private int lastTick = MinecraftServer.currentTick; + private int lastTick = MinecraftServer.currentTick;
+ private int lastDropTick = MinecraftServer.currentTick; + private int lastDropTick = MinecraftServer.currentTick;
@ -152,8 +152,8 @@
+ public CraftPlayer getPlayerB() + public CraftPlayer getPlayerB()
+ { + {
+ return (this.playerEntity == null) ? null : (CraftPlayer) this.playerEntity.getBukkitEntity(); + return (this.playerEntity == null) ? null : (CraftPlayer) this.playerEntity.getBukkitEntity();
} + }
+
+ private final static HashSet<Integer> invalidItems = new HashSet<Integer>(java.util.Arrays.asList(8, 9, 10, 11, 26, 34, 36, 43, 51, 52, 55, 59, 60, 62, 63, + private final static HashSet<Integer> invalidItems = new HashSet<Integer>(java.util.Arrays.asList(8, 9, 10, 11, 26, 34, 36, 43, 51, 52, 55, 59, 60, 62, 63,
+ 64, 68, 71, 74, 75, 83, 90, 92, 93, 94, 104, 105, 115, 117, 118, 119, 125, 127, 132, 140, 141, 142, 144)); // TODO: Check after every update. + 64, 68, 71, 74, 75, 83, 90, 92, 93, 94, 104, 105, 115, 117, 118, 119, 125, 127, 132, 140, 141, 142, 144)); // TODO: Check after every update.
+ // CraftBukkit end + // CraftBukkit end
@ -242,7 +242,7 @@
+ +
+ // If the packet contains movement information then we update the To location with the correct XYZ. + // If the packet contains movement information then we update the To location with the correct XYZ.
+ if (p_147347_1_.field_149480_h && !(p_147347_1_.field_149480_h && p_147347_1_.field_149477_b == -999.0D && p_147347_1_.field_149475_d == -999.0D)) + if (p_147347_1_.field_149480_h && !(p_147347_1_.field_149480_h && p_147347_1_.field_149477_b == -999.0D && p_147347_1_.field_149475_d == -999.0D))
+ { {
+ to.setX(p_147347_1_.field_149479_a); + to.setX(p_147347_1_.field_149479_a);
+ to.setY(p_147347_1_.field_149477_b); + to.setY(p_147347_1_.field_149477_b);
+ to.setZ(p_147347_1_.field_149478_c); + to.setZ(p_147347_1_.field_149478_c);
@ -298,7 +298,7 @@
+ } + }
+ +
+ if (this.hasMoved && !this.playerEntity.isDead) + if (this.hasMoved && !this.playerEntity.isDead)
{ + {
+ // CraftBukkit end + // CraftBukkit end
double d1; double d1;
double d2; double d2;
@ -633,7 +633,7 @@
{ {
ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("chat.cannotSend", new Object[0]); ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("chat.cannotSend", new Object[0]);
chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.RED); chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.RED);
@@ -708,123 +1056,520 @@ @@ -708,51 +1056,385 @@
{ {
if (!ChatAllowedCharacters.isAllowedCharacter(s.charAt(i))) if (!ChatAllowedCharacters.isAllowedCharacter(s.charAt(i)))
{ {
@ -676,7 +676,8 @@
- if (s.startsWith("/")) - if (s.startsWith("/"))
+ // CraftBukkit start + // CraftBukkit start
+ if (!p_147354_1_.hasPriority()) + if (!p_147354_1_.hasPriority())
+ { {
- this.handleSlashCommand(s);
+ try + try
+ { + {
+ this.serverController.server.playerCommandState = true; + this.serverController.server.playerCommandState = true;
@ -686,44 +687,33 @@
+ { + {
+ this.serverController.server.playerCommandState = false; + this.serverController.server.playerCommandState = false;
+ } + }
+ }
+ else if (s.isEmpty())
{
- this.handleSlashCommand(s);
+ logger.warn(this.playerEntity.getCommandSenderName() + " tried to send an empty message");
} }
- else - else
+ else if (s.isEmpty())
+ {
+ logger.warn(this.playerEntity.getCommandSenderName() + " tried to send an empty message");
+ }
+ else if (getPlayerB().isConversing()) + else if (getPlayerB().isConversing())
{ + {
- ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation("chat.type.text", new Object[] {this.playerEntity.func_145748_c_(), ForgeHooks.newChatWithLinks(s)}); // Fixes chat links
- chatcomponenttranslation1 = ForgeHooks.onServerChatEvent(this, s, chatcomponenttranslation1);
- if (chatcomponenttranslation1 == null) return;
- this.serverController.getConfigurationManager().sendChatMsgImpl(chatcomponenttranslation1, false);
+ getPlayerB().acceptConversationInput(s); + getPlayerB().acceptConversationInput(s);
} + }
-
- this.chatSpamThresholdCount += 20;
-
- if (this.chatSpamThresholdCount > 200 && !this.serverController.getConfigurationManager().func_152596_g(this.playerEntity.getGameProfile()))
+ else if (this.playerEntity.func_147096_v() == EntityPlayer.EnumChatVisibility.SYSTEM) // Re-add "Command Only" flag check + else if (this.playerEntity.func_147096_v() == EntityPlayer.EnumChatVisibility.SYSTEM) // Re-add "Command Only" flag check
{ + {
- this.kickPlayerFromServer("disconnect.spam");
+ ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("chat.cannotSend", new Object[0]); + ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("chat.cannotSend", new Object[0]);
+ chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.RED); + chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.RED);
+ this.sendPacket(new S02PacketChat(chatcomponenttranslation)); + this.sendPacket(new S02PacketChat(chatcomponenttranslation));
+ } + }
+ else if (true) + else if (true)
+ { {
- ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation("chat.type.text", new Object[] {this.playerEntity.func_145748_c_(), ForgeHooks.newChatWithLinks(s)}); // Fixes chat links
- chatcomponenttranslation1 = ForgeHooks.onServerChatEvent(this, s, chatcomponenttranslation1);
- if (chatcomponenttranslation1 == null) return;
- this.serverController.getConfigurationManager().sendChatMsgImpl(chatcomponenttranslation1, false);
+ this.chat(s, true); + this.chat(s, true);
+ // CraftBukkit end - the below is for reference. :) + // CraftBukkit end - the below is for reference. :)
} }
- }
- }
- private void handleSlashCommand(String p_147361_1_) - this.chatSpamThresholdCount += 20;
- {
- this.serverController.getCommandManager().executeCommand(this.playerEntity, p_147361_1_);
- }
+ // CraftBukkit start - replaced with thread safe throttle + // CraftBukkit start - replaced with thread safe throttle
+ // this.chatSpamThresholdCount += 20; + // this.chatSpamThresholdCount += 20;
+ if (chatSpamField.addAndGet(this, 20) > 200 && !this.serverController.getConfigurationManager().func_152596_g(this.playerEntity.getGameProfile())) + if (chatSpamField.addAndGet(this, 20) > 200 && !this.serverController.getConfigurationManager().func_152596_g(this.playerEntity.getGameProfile()))
@ -739,10 +729,7 @@
+ } + }
+ }; + };
+ this.serverController.processQueue.add(waitable); + this.serverController.processQueue.add(waitable);
+
- public void processAnimation(C0APacketAnimation p_147350_1_)
- {
- this.playerEntity.func_143004_u();
+ try + try
+ { + {
+ waitable.get(); + waitable.get();
@ -761,52 +748,30 @@
+ this.kickPlayerFromServer("disconnect.spam"); + this.kickPlayerFromServer("disconnect.spam");
+ } + }
- if (p_147350_1_.func_149421_d() == 1) - if (this.chatSpamThresholdCount > 200 && !this.serverController.getConfigurationManager().func_152596_g(this.playerEntity.getGameProfile()))
- {
- this.playerEntity.swingItem();
+ // CraftBukkit end + // CraftBukkit end
+ } + }
} + }
} + }
+
- public void processEntityAction(C0BPacketEntityAction p_147357_1_)
+ // CraftBukkit start + // CraftBukkit start
+ public void chat(String s, boolean async) + public void chat(String s, boolean async)
{ + {
- this.playerEntity.func_143004_u();
-
- if (p_147357_1_.func_149513_d() == 1)
- {
- this.playerEntity.setSneaking(true);
- }
- else if (p_147357_1_.func_149513_d() == 2)
- {
- this.playerEntity.setSneaking(false);
- }
- else if (p_147357_1_.func_149513_d() == 4)
+ if (s.isEmpty() || this.playerEntity.func_147096_v() == EntityPlayer.EnumChatVisibility.HIDDEN) + if (s.isEmpty() || this.playerEntity.func_147096_v() == EntityPlayer.EnumChatVisibility.HIDDEN)
{ + {
- this.playerEntity.setSprinting(true);
+ return; + return;
} + }
- else if (p_147357_1_.func_149513_d() == 5)
+ +
+ if (!async && s.startsWith("/")) + if (!async && s.startsWith("/"))
{ + {
- this.playerEntity.setSprinting(false);
+ this.handleSlashCommand(s); + this.handleSlashCommand(s);
} + }
- else if (p_147357_1_.func_149513_d() == 3)
+ else if (this.playerEntity.func_147096_v() == EntityPlayer.EnumChatVisibility.SYSTEM) + else if (this.playerEntity.func_147096_v() == EntityPlayer.EnumChatVisibility.SYSTEM)
{ + {
- this.playerEntity.wakeUpPlayer(false, true, true);
- this.hasMoved = false;
+ // Do nothing, this is coming from a plugin + // Do nothing, this is coming from a plugin
} + }
- else if (p_147357_1_.func_149513_d() == 6)
+ else + else
{ + {
- if (this.playerEntity.ridingEntity != null && this.playerEntity.ridingEntity instanceof EntityHorse)
+ // Cauldron start - handle Forge event + // Cauldron start - handle Forge event
+ ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation("chat.type.text", new Object[] { + ChatComponentTranslation chatcomponenttranslation1 = new ChatComponentTranslation("chat.type.text", new Object[] {
+ this.playerEntity.func_145748_c_(), s }); + this.playerEntity.func_145748_c_(), s });
@ -815,16 +780,10 @@
+ if (chatcomponenttranslation1 != null + if (chatcomponenttranslation1 != null
+ && chatcomponenttranslation1.getFormatArgs()[chatcomponenttranslation1.getFormatArgs().length - 1] instanceof String) + && chatcomponenttranslation1.getFormatArgs()[chatcomponenttranslation1.getFormatArgs().length - 1] instanceof String)
{ {
- ((EntityHorse)this.playerEntity.ridingEntity).setJumpPower(p_147357_1_.func_149512_e()); - this.kickPlayerFromServer("disconnect.spam");
+ // use event message from Forge + // use event message from Forge
+ s = (String) chatcomponenttranslation1.getFormatArgs()[chatcomponenttranslation1.getFormatArgs().length - 1]; + s = (String) chatcomponenttranslation1.getFormatArgs()[chatcomponenttranslation1.getFormatArgs().length - 1];
} + }
- }
- else if (p_147357_1_.func_149513_d() == 7 && this.playerEntity.ridingEntity != null && this.playerEntity.ridingEntity instanceof EntityHorse)
- {
- ((EntityHorse)this.playerEntity.ridingEntity).openGUI(this.playerEntity);
- }
- }
+ // Cauldron end + // Cauldron end
+ Player player = this.getPlayerB(); + Player player = this.getPlayerB();
+ AsyncPlayerChatEvent event = new AsyncPlayerChatEvent(async, player, s, new LazyPlayerSet()); // Cauldron - pass changed message if any from Forge + AsyncPlayerChatEvent event = new AsyncPlayerChatEvent(async, player, s, new LazyPlayerSet()); // Cauldron - pass changed message if any from Forge
@ -840,21 +799,12 @@
+ protected Object evaluate() + protected Object evaluate()
+ { + {
+ org.bukkit.Bukkit.getPluginManager().callEvent(queueEvent); + org.bukkit.Bukkit.getPluginManager().callEvent(queueEvent);
+
- public void processUseEntity(C02PacketUseEntity p_147340_1_)
- {
- WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension);
- Entity entity = p_147340_1_.func_149564_a(worldserver);
- this.playerEntity.func_143004_u();
+ if (queueEvent.isCancelled()) + if (queueEvent.isCancelled())
+ { + {
+ return null; + return null;
+ } + }
+
- if (entity != null)
- {
- boolean flag = this.playerEntity.canEntityBeSeen(entity);
- double d0 = 36.0D;
+ String message = String.format(queueEvent.getFormat(), queueEvent.getPlayer().getDisplayName(), queueEvent.getMessage()); + String message = String.format(queueEvent.getFormat(), queueEvent.getPlayer().getDisplayName(), queueEvent.getMessage());
+ NetHandlerPlayServer.this.serverController.console.sendMessage(message); + NetHandlerPlayServer.this.serverController.console.sendMessage(message);
+ if (((LazyPlayerSet) queueEvent.getRecipients()).isLazy()) + if (((LazyPlayerSet) queueEvent.getRecipients()).isLazy())
@ -871,16 +821,11 @@
+ player.sendMessage(message); + player.sendMessage(message);
+ } + }
+ } + }
+
- if (!flag)
- {
- d0 = 9.0D;
- }
+ return null; + return null;
+ } + }
+ }; + };
+
- if (this.playerEntity.getDistanceSqToEntity(entity) < d0)
+ if (async) + if (async)
+ { + {
+ serverController.processQueue.add(waitable); + serverController.processQueue.add(waitable);
@ -904,25 +849,18 @@
+ } + }
+ } + }
+ else + else
{ + {
- if (p_147340_1_.func_149565_c() == C02PacketUseEntity.Action.INTERACT)
+ if (event.isCancelled()) + if (event.isCancelled())
{ + {
- this.playerEntity.interactWith(entity);
+ return; + return;
} + }
- else if (p_147340_1_.func_149565_c() == C02PacketUseEntity.Action.ATTACK)
+ +
+ s = String.format(event.getFormat(), event.getPlayer().getDisplayName(), event.getMessage()); + s = String.format(event.getFormat(), event.getPlayer().getDisplayName(), event.getMessage());
+ serverController.console.sendMessage(s); + serverController.console.sendMessage(s);
+ if (((LazyPlayerSet) event.getRecipients()).isLazy()) + if (((LazyPlayerSet) event.getRecipients()).isLazy())
{ + {
- if (entity instanceof EntityItem || entity instanceof EntityXPOrb || entity instanceof EntityArrow || entity == this.playerEntity)
+ for (Object recipient : serverController.getConfigurationManager().playerEntityList) + for (Object recipient : serverController.getConfigurationManager().playerEntityList)
{ + {
- this.kickPlayerFromServer("Attempting to attack an invalid entity");
- this.serverController.logWarning("Player " + this.playerEntity.getCommandSenderName() + " tried to attack an invalid entity");
- return;
+ for (IChatComponent component : CraftChatMessage.fromString(s)) + for (IChatComponent component : CraftChatMessage.fromString(s))
+ { + {
+ ((EntityPlayerMP) recipient).sendMessage(CraftChatMessage.fromString(s)); + ((EntityPlayerMP) recipient).sendMessage(CraftChatMessage.fromString(s));
@ -934,18 +872,16 @@
+ for (Player recipient : event.getRecipients()) + for (Player recipient : event.getRecipients())
+ { + {
+ recipient.sendMessage(s); + recipient.sendMessage(s);
} + }
- + }
- this.playerEntity.attackTargetEntityWithCurrentItem(entity);
}
} }
} }
} }
+ // CraftBukkit end + // CraftBukkit end
- public void processClientStatus(C16PacketClientStatus p_147342_1_) private void handleSlashCommand(String p_147361_1_)
+ private void handleSlashCommand(String p_147361_1_) {
+ { - this.serverController.getCommandManager().executeCommand(this.playerEntity, p_147361_1_);
+ org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.startTiming(); // Spigot + org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.startTiming(); // Spigot
+ // CraftBukkit start + // CraftBukkit start
+ CraftPlayer player = this.getPlayerB(); + CraftPlayer player = this.getPlayerB();
@ -994,19 +930,19 @@
+ +
+ // this.serverController.getCommandManager().executeCommand(this.playerEntity, p_147361_1_); + // this.serverController.getCommandManager().executeCommand(this.playerEntity, p_147361_1_);
+ // CraftBukkit end + // CraftBukkit end
+ } }
+
+ public void processAnimation(C0APacketAnimation p_147350_1_) public void processAnimation(C0APacketAnimation p_147350_1_)
+ { {
+ if (this.playerEntity.isDead) + if (this.playerEntity.isDead)
+ { + {
+ return; // CraftBukkit + return; // CraftBukkit
+ } + }
+ +
+ this.playerEntity.func_143004_u(); this.playerEntity.func_143004_u();
+
+ if (p_147350_1_.func_149421_d() == 1) if (p_147350_1_.func_149421_d() == 1)
+ { {
+ // CraftBukkit start - Raytrace to look for 'rogue armswings' + // CraftBukkit start - Raytrace to look for 'rogue armswings'
+ float f = 1.0F; + float f = 1.0F;
+ float f1 = this.playerEntity.prevRotationPitch + (this.playerEntity.rotationPitch - this.playerEntity.prevRotationPitch) * f; + float f1 = this.playerEntity.prevRotationPitch + (this.playerEntity.rotationPitch - this.playerEntity.prevRotationPitch) * f;
@ -1022,7 +958,7 @@
+ float f6 = MathHelper.sin(-f1 * 0.017453292F); + float f6 = MathHelper.sin(-f1 * 0.017453292F);
+ float f7 = f4 * f5; + float f7 = f4 * f5;
+ float f8 = f3 * f5; + float f8 = f3 * f5;
+ double d3 = 5.0D; + double d3 = this.playerEntity.capabilities.isCreativeMode ? 5.0D : 4.5D;
+ Vec3 vec31 = vec3.addVector((double) f7 * d3, (double) f6 * d3, (double) f8 * d3); + Vec3 vec31 = vec3.addVector((double) f7 * d3, (double) f6 * d3, (double) f8 * d3);
+ MovingObjectPosition movingobjectposition = this.playerEntity.worldObj.rayTraceBlocks(vec3, vec31, true); + MovingObjectPosition movingobjectposition = this.playerEntity.worldObj.rayTraceBlocks(vec3, vec31, true);
+ boolean valid = false; + boolean valid = false;
@ -1055,20 +991,20 @@
+ return; + return;
+ } + }
+ // CraftBukkit end + // CraftBukkit end
+ this.playerEntity.swingItem(); this.playerEntity.swingItem();
+ } }
+ } }
+
+ public void processEntityAction(C0BPacketEntityAction p_147357_1_) public void processEntityAction(C0BPacketEntityAction p_147357_1_)
+ { {
+ // CraftBukkit start + // CraftBukkit start
+ if (this.playerEntity.isDead) + if (this.playerEntity.isDead)
+ { + {
+ return; + return;
+ } + }
+ +
+ this.playerEntity.func_143004_u(); this.playerEntity.func_143004_u();
+
+ if (p_147357_1_.func_149513_d() == 1 || p_147357_1_.func_149513_d() == 2) + if (p_147357_1_.func_149513_d() == 1 || p_147357_1_.func_149513_d() == 2)
+ { + {
+ PlayerToggleSneakEvent event = new PlayerToggleSneakEvent(this.getPlayerB(), p_147357_1_.func_149513_d() == 1); + PlayerToggleSneakEvent event = new PlayerToggleSneakEvent(this.getPlayerB(), p_147357_1_.func_149513_d() == 1);
@ -1092,48 +1028,29 @@
+ } + }
+ // CraftBukkit end + // CraftBukkit end
+ +
+ if (p_147357_1_.func_149513_d() == 1) if (p_147357_1_.func_149513_d() == 1)
+ { {
+ this.playerEntity.setSneaking(true); this.playerEntity.setSneaking(true);
+ } @@ -772,7 +1454,7 @@
+ else if (p_147357_1_.func_149513_d() == 2) else if (p_147357_1_.func_149513_d() == 3)
+ { {
+ this.playerEntity.setSneaking(false); this.playerEntity.wakeUpPlayer(false, true, true);
+ } - this.hasMoved = false;
+ else if (p_147357_1_.func_149513_d() == 4)
+ {
+ this.playerEntity.setSprinting(true);
+ }
+ else if (p_147357_1_.func_149513_d() == 5)
+ {
+ this.playerEntity.setSprinting(false);
+ }
+ else if (p_147357_1_.func_149513_d() == 3)
+ {
+ this.playerEntity.wakeUpPlayer(false, true, true);
+ // this.hasMoved = false; // CraftBukkit - this is handled in teleport + // this.hasMoved = false; // CraftBukkit - this is handled in teleport
+ } }
+ else if (p_147357_1_.func_149513_d() == 6) else if (p_147357_1_.func_149513_d() == 6)
+ { {
+ if (this.playerEntity.ridingEntity != null && this.playerEntity.ridingEntity instanceof EntityHorse) @@ -789,8 +1471,20 @@
+ {
+ ((EntityHorse)this.playerEntity.ridingEntity).setJumpPower(p_147357_1_.func_149512_e()); public void processUseEntity(C02PacketUseEntity p_147340_1_)
+ } {
+ }
+ else if (p_147357_1_.func_149513_d() == 7 && this.playerEntity.ridingEntity != null && this.playerEntity.ridingEntity instanceof EntityHorse)
+ {
+ ((EntityHorse)this.playerEntity.ridingEntity).openGUI(this.playerEntity);
+ }
+ }
+
+ public void processUseEntity(C02PacketUseEntity p_147340_1_)
+ {
+ if (this.playerEntity.isDead) + if (this.playerEntity.isDead)
+ { + {
+ return; // CraftBukkit + return; // CraftBukkit
+ } + }
+ +
+ WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension); WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension);
- Entity entity = p_147340_1_.func_149564_a(worldserver);
+ Entity entity = p_147340_1_.func_149564_a((World) worldserver); + Entity entity = p_147340_1_.func_149564_a((World) worldserver);
+ // Spigot Start + // Spigot Start
+ if (entity == playerEntity) + if (entity == playerEntity)
@ -1142,24 +1059,17 @@
+ return; + return;
+ } + }
+ // Spigot End + // Spigot End
+ this.playerEntity.func_143004_u(); this.playerEntity.func_143004_u();
+
+ if (entity != null) if (entity != null)
+ { @@ -805,9 +1499,53 @@
+ boolean flag = this.playerEntity.canEntityBeSeen(entity);
+ double d0 = 36.0D; if (this.playerEntity.getDistanceSqToEntity(entity) < d0)
+ {
+ if (!flag)
+ {
+ d0 = 9.0D;
+ }
+
+ if (this.playerEntity.getDistanceSqToEntity(entity) < d0)
+ {
+ ItemStack itemInHand = this.playerEntity.inventory.getCurrentItem(); // CraftBukkit + ItemStack itemInHand = this.playerEntity.inventory.getCurrentItem(); // CraftBukkit
+ +
+ if (p_147340_1_.func_149565_c() == C02PacketUseEntity.Action.INTERACT) if (p_147340_1_.func_149565_c() == C02PacketUseEntity.Action.INTERACT)
+ { {
+ // CraftBukkit start + // CraftBukkit start
+ boolean triggerTagUpdate = itemInHand != null && itemInHand.getItem() == Items.name_tag && entity instanceof EntityLiving; + boolean triggerTagUpdate = itemInHand != null && itemInHand.getItem() == Items.name_tag && entity instanceof EntityLiving;
+ boolean triggerChestUpdate = itemInHand != null && itemInHand.getItem() == Item.getItemFromBlock(Blocks.chest) + boolean triggerChestUpdate = itemInHand != null && itemInHand.getItem() == Item.getItemFromBlock(Blocks.chest)
@ -1196,24 +1106,20 @@
+ return; + return;
+ } + }
+ // CraftBukkit end + // CraftBukkit end
+ this.playerEntity.interactWith(entity); this.playerEntity.interactWith(entity);
+ // CraftBukkit start + // CraftBukkit start
+ if (itemInHand != null && itemInHand.stackSize <= -1) + if (itemInHand != null && itemInHand.stackSize <= -1)
+ { + {
+ this.playerEntity.sendContainerToPlayer(this.playerEntity.openContainer); + this.playerEntity.sendContainerToPlayer(this.playerEntity.openContainer);
+ } + }
+ // CraftBukkit end + // CraftBukkit end
+ } }
+ else if (p_147340_1_.func_149565_c() == C02PacketUseEntity.Action.ATTACK) else if (p_147340_1_.func_149565_c() == C02PacketUseEntity.Action.ATTACK)
+ { {
+ if (entity instanceof EntityItem || entity instanceof EntityXPOrb || entity instanceof EntityArrow || entity == this.playerEntity) @@ -819,6 +1557,13 @@
+ { }
+ this.kickPlayerFromServer("Attempting to attack an invalid entity");
+ this.serverController.logWarning("Player " + this.playerEntity.getCommandSenderName() + " tried to attack an invalid entity"); this.playerEntity.attackTargetEntityWithCurrentItem(entity);
+ return;
+ }
+
+ this.playerEntity.attackTargetEntityWithCurrentItem(entity);
+ +
+ // CraftBukkit start + // CraftBukkit start
+ if (itemInHand != null && itemInHand.stackSize <= -1) + if (itemInHand != null && itemInHand.stackSize <= -1)
@ -1221,15 +1127,9 @@
+ this.playerEntity.sendContainerToPlayer(this.playerEntity.openContainer); + this.playerEntity.sendContainerToPlayer(this.playerEntity.openContainer);
+ } + }
+ // CraftBukkit end + // CraftBukkit end
+ } }
+ } }
+ } }
+ }
+
+ public void processClientStatus(C16PacketClientStatus p_147342_1_)
{
this.playerEntity.func_143004_u();
C16PacketClientStatus.EnumState enumstate = p_147342_1_.func_149435_c();
@@ -834,7 +1579,18 @@ @@ -834,7 +1579,18 @@
case 1: case 1:
if (this.playerEntity.playerConqueredTheEnd) if (this.playerEntity.playerConqueredTheEnd)

Loading…
Cancel
Save