summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server/PlayerConnection.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/net/minecraft/server/PlayerConnection.java')
-rw-r--r--src/main/java/net/minecraft/server/PlayerConnection.java49
1 files changed, 25 insertions, 24 deletions
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index ec45c30a..c2400201 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -143,8 +143,9 @@ public class PlayerConnection implements PacketPlayInListener {
--this.x;
}
- this.minecraftServer.methodProfiler.c("playerTick");
- this.minecraftServer.methodProfiler.b();
+ if (this.player.x() > 0L && this.minecraftServer.getIdleTimeout() > 0 && MinecraftServer.ar() - this.player.x() > (long) (this.minecraftServer.getIdleTimeout() * 1000 * 60)) {
+ this.disconnect("You have been idle for too long!");
+ }
}
public NetworkManager b() {
@@ -267,7 +268,7 @@ public class PlayerConnection implements PacketPlayInListener {
float f = this.player.yaw;
float f1 = this.player.pitch;
- this.player.vehicle.ab();
+ this.player.vehicle.ac();
d1 = this.player.locX;
d2 = this.player.locY;
d3 = this.player.locZ;
@@ -281,7 +282,7 @@ public class PlayerConnection implements PacketPlayInListener {
this.player.V = 0.0F;
this.player.setLocation(d1, d2, d3, f, f1);
if (this.player.vehicle != null) {
- this.player.vehicle.ab();
+ this.player.vehicle.ac();
}
this.minecraftServer.getPlayerList().d(this.player);
@@ -367,7 +368,7 @@ public class PlayerConnection implements PacketPlayInListener {
boolean flag = worldserver.getCubes(this.player, this.player.boundingBox.clone().shrink((double) f4, (double) f4, (double) f4)).isEmpty();
if (this.player.onGround && !packetplayinflying.i() && d5 > 0.0D) {
- this.player.bi();
+ this.player.bj();
}
this.player.move(d4, d5, d6);
@@ -496,7 +497,7 @@ public class PlayerConnection implements PacketPlayInListener {
} else if (packetplayinblockdig.g() == 3) {
this.player.a(true);
} else if (packetplayinblockdig.g() == 5) {
- this.player.bz();
+ this.player.bA();
} else {
boolean flag = false;
@@ -672,7 +673,7 @@ public class PlayerConnection implements PacketPlayInListener {
if (itemstack == null || itemstack.n() == 0) {
this.player.g = true;
this.player.inventory.items[this.player.inventory.itemInHandIndex] = ItemStack.b(this.player.inventory.items[this.player.inventory.itemInHandIndex]);
- Slot slot = this.player.activeContainer.a((IInventory) this.player.inventory, this.player.inventory.itemInHandIndex);
+ Slot slot = this.player.activeContainer.getSlot((IInventory) this.player.inventory, this.player.inventory.itemInHandIndex);
this.player.activeContainer.b();
this.player.g = false;
@@ -999,7 +1000,7 @@ public class PlayerConnection implements PacketPlayInListener {
if (event.isCancelled()) return;
// CraftBukkit end
- this.player.aZ();
+ this.player.ba();
}
}
@@ -1054,7 +1055,7 @@ public class PlayerConnection implements PacketPlayInListener {
this.player.v();
if (entity != null) {
- boolean flag = this.player.p(entity);
+ boolean flag = this.player.hasLineOfSight(entity);
double d0 = 36.0D;
if (!flag) {
@@ -1335,7 +1336,7 @@ public class PlayerConnection implements PacketPlayInListener {
ItemStack cursor = this.player.inventory.getCarried();
action = InventoryAction.NOTHING;
// Quick check for if we have any of the item
- if (inventory.getTopInventory().contains(org.bukkit.Material.getMaterial(Item.b(cursor.getItem()))) || inventory.getBottomInventory().contains(org.bukkit.Material.getMaterial(Item.b(cursor.getItem())))) {
+ if (inventory.getTopInventory().contains(org.bukkit.Material.getMaterial(Item.getId(cursor.getItem()))) || inventory.getBottomInventory().contains(org.bukkit.Material.getMaterial(Item.getId(cursor.getItem())))) {
action = InventoryAction.COLLECT_TO_CURSOR;
}
}
@@ -1451,7 +1452,7 @@ public class PlayerConnection implements PacketPlayInListener {
public void a(PacketPlayInEnchantItem packetplayinenchantitem) {
this.player.v();
if (this.player.activeContainer.windowId == packetplayinenchantitem.c() && this.player.activeContainer.c(this.player)) {
- this.player.activeContainer.a((EntityHuman) this.player, packetplayinenchantitem.d());
+ this.player.activeContainer.a(this.player, packetplayinenchantitem.d());
this.player.activeContainer.b();
}
}
@@ -1462,7 +1463,7 @@ public class PlayerConnection implements PacketPlayInListener {
ItemStack itemstack = packetplayinsetcreativeslot.getItemStack();
boolean flag1 = packetplayinsetcreativeslot.c() >= 1 && packetplayinsetcreativeslot.c() < 36 + PlayerInventory.getHotbarSize();
// CraftBukkit - Add invalidItems check
- boolean flag2 = itemstack == null || itemstack.getItem() != null && !invalidItems.contains(Item.b(itemstack.getItem()));
+ boolean flag2 = itemstack == null || itemstack.getItem() != null && !invalidItems.contains(Item.getId(itemstack.getItem()));
boolean flag3 = itemstack == null || itemstack.getData() >= 0 && itemstack.count <= 64 && itemstack.count > 0;
// CraftBukkit start - Call click event
@@ -1657,18 +1658,18 @@ public class PlayerConnection implements PacketPlayInListener {
try {
itemstack = packetdataserializer.c();
- if (itemstack == null) {
- return;
- }
+ if (itemstack != null) {
+ if (!ItemBookAndQuill.a(itemstack.getTag())) {
+ throw new IOException("Invalid book tag!");
+ }
- if (!ItemBookAndQuill.a(itemstack.getTag())) {
- throw new IOException("Invalid book tag!");
- }
+ itemstack1 = this.player.inventory.getItemInHand();
+ if (itemstack1 == null) {
+ return;
+ }
- itemstack1 = this.player.inventory.getItemInHand();
- if (itemstack1 != null) {
if (itemstack.getItem() == Items.BOOK_AND_QUILL && itemstack.getItem() == itemstack1.getItem()) {
- CraftEventFactory.handleEditBookEvent(player, itemstack); // CraftBukkit
+ CraftEventFactory.handleEditBookEvent(player, itemstack); // CraftBukkit
}
return;
@@ -1749,20 +1750,20 @@ public class PlayerConnection implements PacketPlayInListener {
TileEntity tileentity = this.player.world.getTileEntity(packetdataserializer.readInt(), packetdataserializer.readInt(), packetdataserializer.readInt());
if (tileentity instanceof TileEntityCommand) {
- commandblocklistenerabstract = ((TileEntityCommand) tileentity).a();
+ commandblocklistenerabstract = ((TileEntityCommand) tileentity).getCommandBlock();
}
} else if (b0 == 1) {
Entity entity = this.player.world.getEntity(packetdataserializer.readInt());
if (entity instanceof EntityMinecartCommandBlock) {
- commandblocklistenerabstract = ((EntityMinecartCommandBlock) entity).e();
+ commandblocklistenerabstract = ((EntityMinecartCommandBlock) entity).getCommandBlock();
}
}
String s = packetdataserializer.c(packetdataserializer.readableBytes());
if (commandblocklistenerabstract != null) {
- commandblocklistenerabstract.a(s);
+ commandblocklistenerabstract.setCommand(s);
commandblocklistenerabstract.e();
this.player.sendMessage(new ChatMessage("advMode.setCommand.success", new Object[] { s}));
}