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:
Ursprung
71a9c90fe9
Commit
f32d3211ed
@ -157,9 +157,11 @@ 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()).name().endsWith("SWORD")) {
|
if(Material.getMaterial(stack.getId()) != null) {
|
||||||
entityTracker.getValidBlocking().add(entityID);
|
if (Material.getMaterial(stack.getId()).name().endsWith("SWORD")) {
|
||||||
return;
|
entityTracker.getValidBlocking().add(entityID);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
entityTracker.getValidBlocking().remove(entityID);
|
entityTracker.getValidBlocking().remove(entityID);
|
||||||
|
@ -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,17 +248,18 @@ 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()).name().endsWith("SWORD")) {
|
if (Material.getMaterial(item.getId()) != null) {
|
||||||
if (hand == 0) {
|
if (Material.getMaterial(item.getId()).name().endsWith("SWORD")) {
|
||||||
EntityTracker tracker = wrapper.user().get(EntityTracker.class);
|
if (hand == 0) {
|
||||||
if (!tracker.isBlocking()) {
|
EntityTracker tracker = wrapper.user().get(EntityTracker.class);
|
||||||
tracker.setBlocking(true);
|
if (!tracker.isBlocking()) {
|
||||||
Item shield = new Item((short) 442, (byte) 1, (short) 0, null);
|
tracker.setBlocking(true);
|
||||||
tracker.setSecondHand(shield);
|
Item shield = new Item((short) 442, (byte) 1, (short) 0, null);
|
||||||
|
tracker.setSecondHand(shield);
|
||||||
|
}
|
||||||
|
wrapper.cancel();
|
||||||
}
|
}
|
||||||
wrapper.cancel();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wrapper.write(Type.ITEM, item);
|
wrapper.write(Type.ITEM, item);
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren