geforkt von Mirrors/Paper
SPIGOT-1550, SPIGOT-2306: Custom payload / book + event fixes
Dieser Commit ist enthalten in:
Ursprung
6d3efa0634
Commit
3ae3ea08f2
@ -1597,16 +1597,93 @@
|
||||
ArrayList arraylist = Lists.newArrayList();
|
||||
Iterator iterator = this.minecraftServer.tabCompleteCommand(this.player, packetplayintabcomplete.a(), packetplayintabcomplete.b(), packetplayintabcomplete.c()).iterator();
|
||||
|
||||
@@ -1334,12 +2409,34 @@
|
||||
PlayerConnection.LOGGER.error("Couldn\'t pick item", exception7);
|
||||
}
|
||||
@@ -1040,10 +2115,13 @@
|
||||
}
|
||||
|
||||
if (itemstack.getItem() == Items.WRITABLE_BOOK && itemstack.getItem() == itemstack1.getItem()) {
|
||||
+ itemstack1 = new ItemStack(Items.WRITABLE_BOOK); // CraftBukkit
|
||||
itemstack1.a("pages", (NBTBase) itemstack.getTag().getList("pages", 8));
|
||||
+ CraftEventFactory.handleEditBookEvent(player, itemstack1); // CraftBukkit
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
PlayerConnection.LOGGER.error("Couldn\'t handle book info", exception);
|
||||
+ this.disconnect("Invalid book data!"); // CraftBukkit
|
||||
}
|
||||
} else {
|
||||
String s1;
|
||||
@@ -1067,6 +2145,7 @@
|
||||
}
|
||||
|
||||
if (itemstack.getItem() == Items.WRITABLE_BOOK && itemstack1.getItem() == Items.WRITABLE_BOOK) {
|
||||
+ itemstack1 = new ItemStack(Items.WRITABLE_BOOK); // CraftBukkit
|
||||
itemstack1.a("author", (NBTBase) (new NBTTagString(this.player.getName())));
|
||||
itemstack1.a("title", (NBTBase) (new NBTTagString(itemstack.getTag().getString("title"))));
|
||||
NBTTagList nbttaglist = itemstack.getTag().getList("pages", 8);
|
||||
@@ -1081,9 +2160,11 @@
|
||||
|
||||
itemstack1.a("pages", (NBTBase) nbttaglist);
|
||||
itemstack1.setItem(Items.WRITTEN_BOOK);
|
||||
+ CraftEventFactory.handleEditBookEvent(player, itemstack1); // CraftBukkit
|
||||
}
|
||||
} catch (Exception exception1) {
|
||||
PlayerConnection.LOGGER.error("Couldn\'t sign book", exception1);
|
||||
+ this.disconnect("Invalid book data!"); // CraftBukkit
|
||||
}
|
||||
} else if ("MC|TrSel".equals(s)) {
|
||||
try {
|
||||
@@ -1095,6 +2176,7 @@
|
||||
}
|
||||
} catch (Exception exception2) {
|
||||
PlayerConnection.LOGGER.error("Couldn\'t select trade", exception2);
|
||||
+ this.disconnect("Invalid trade data!"); // CraftBukkit
|
||||
}
|
||||
} else {
|
||||
TileEntity tileentity;
|
||||
@@ -1144,6 +2226,7 @@
|
||||
}
|
||||
} catch (Exception exception3) {
|
||||
PlayerConnection.LOGGER.error("Couldn\'t set command block", exception3);
|
||||
+ this.disconnect("Invalid command data!"); // CraftBukkit
|
||||
}
|
||||
} else if ("MC|AutoCmd".equals(s)) {
|
||||
if (!this.minecraftServer.getEnableCommandBlock()) {
|
||||
@@ -1211,6 +2294,7 @@
|
||||
}
|
||||
} catch (Exception exception4) {
|
||||
PlayerConnection.LOGGER.error("Couldn\'t set command block", exception4);
|
||||
+ this.disconnect("Invalid command data!"); // CraftBukkit
|
||||
}
|
||||
} else {
|
||||
int k;
|
||||
@@ -1234,6 +2318,7 @@
|
||||
}
|
||||
} catch (Exception exception5) {
|
||||
PlayerConnection.LOGGER.error("Couldn\'t set beacon", exception5);
|
||||
+ this.disconnect("Invalid beacon data!"); // CraftBukkit
|
||||
}
|
||||
}
|
||||
} else if ("MC|ItemName".equals(s)) {
|
||||
@@ -1320,6 +2405,7 @@
|
||||
}
|
||||
} catch (Exception exception6) {
|
||||
PlayerConnection.LOGGER.error("Couldn\'t set structure block", exception6);
|
||||
+ this.disconnect("Invalid structure data!"); // CraftBukkit
|
||||
}
|
||||
} else if ("MC|PickItem".equals(s)) {
|
||||
packetdataserializer = packetplayincustompayload.b();
|
||||
@@ -1332,14 +2418,37 @@
|
||||
this.player.playerConnection.sendPacket(new PacketPlayOutHeldItemSlot(this.player.inventory.itemInHandIndex));
|
||||
} catch (Exception exception7) {
|
||||
PlayerConnection.LOGGER.error("Couldn\'t pick item", exception7);
|
||||
+ this.disconnect("Invalid item data!"); // CraftBukkit
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit start
|
||||
+ else if (packetplayincustompayload.a().equals("REGISTER")) {
|
||||
+ String channels = packetplayincustompayload.b().toString(com.google.common.base.Charsets.UTF_8);
|
||||
+ for (String channel : channels.split("\0")) {
|
||||
+ getPlayer().addChannel(channel);
|
||||
+ }
|
||||
}
|
||||
+ } else if (packetplayincustompayload.a().equals("UNREGISTER")) {
|
||||
+ String channels = packetplayincustompayload.b().toString(com.google.common.base.Charsets.UTF_8);
|
||||
+ for (String channel : channels.split("\0")) {
|
||||
@ -1616,7 +1693,7 @@
|
||||
+ byte[] data = new byte[packetplayincustompayload.b().readableBytes()];
|
||||
+ packetplayincustompayload.b().readBytes(data);
|
||||
+ server.getMessenger().dispatchIncomingMessage(player.getBukkitEntity(), packetplayincustompayload.a(), data);
|
||||
+ }
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren