3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-27 08:30:09 +01:00

Fix issue with Bukkit materials which aren't found by ID

Dieser Commit ist enthalten in:
Myles 2016-03-26 12:33:22 +00:00
Ursprung 71a9c90fe9
Commit f32d3211ed
2 geänderte Dateien mit 17 neuen und 14 gelöschten Zeilen

Datei anzeigen

@ -157,11 +157,13 @@ public class EntityPackets {
Item stack = wrapper.get(Type.ITEM, 0); Item stack = wrapper.get(Type.ITEM, 0);
if (stack != null) { if (stack != null) {
if(Material.getMaterial(stack.getId()) != null) {
if (Material.getMaterial(stack.getId()).name().endsWith("SWORD")) { if (Material.getMaterial(stack.getId()).name().endsWith("SWORD")) {
entityTracker.getValidBlocking().add(entityID); entityTracker.getValidBlocking().add(entityID);
return; return;
} }
} }
}
entityTracker.getValidBlocking().remove(entityID); entityTracker.getValidBlocking().remove(entityID);
} }
}); });

Datei anzeigen

@ -226,8 +226,8 @@ public class WorldPackets {
public void handle(PacketWrapper wrapper) throws Exception { public void handle(PacketWrapper wrapper) throws Exception {
EntityTracker tracker = wrapper.user().get(EntityTracker.class); EntityTracker tracker = wrapper.user().get(EntityTracker.class);
Long last = tracker.getLastPlaceBlock(); Long last = tracker.getLastPlaceBlock();
if(last != -1){ if (last != -1) {
if((wrapper.user().getReceivedPackets() - last) < 5) { if ((wrapper.user().getReceivedPackets() - last) < 5) {
wrapper.cancel(); wrapper.cancel();
} }
tracker.setLastPlaceBlock(-1L); tracker.setLastPlaceBlock(-1L);
@ -248,6 +248,7 @@ public class WorldPackets {
Item item = Item.getItem(Protocol1_9TO1_8.getHandItem(wrapper.user())); Item item = Item.getItem(Protocol1_9TO1_8.getHandItem(wrapper.user()));
// Blocking patch // Blocking patch
if (item != null) { if (item != null) {
if (Material.getMaterial(item.getId()) != null) {
if (Material.getMaterial(item.getId()).name().endsWith("SWORD")) { if (Material.getMaterial(item.getId()).name().endsWith("SWORD")) {
if (hand == 0) { if (hand == 0) {
EntityTracker tracker = wrapper.user().get(EntityTracker.class); EntityTracker tracker = wrapper.user().get(EntityTracker.class);
@ -258,7 +259,7 @@ public class WorldPackets {
} }
wrapper.cancel(); wrapper.cancel();
} }
}
} }
} }
wrapper.write(Type.ITEM, item); wrapper.write(Type.ITEM, item);