Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-26 16:12:42 +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);
|
||||
|
||||
if (stack != null) {
|
||||
if (Material.getMaterial(stack.getId()).name().endsWith("SWORD")) {
|
||||
entityTracker.getValidBlocking().add(entityID);
|
||||
return;
|
||||
if(Material.getMaterial(stack.getId()) != null) {
|
||||
if (Material.getMaterial(stack.getId()).name().endsWith("SWORD")) {
|
||||
entityTracker.getValidBlocking().add(entityID);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
entityTracker.getValidBlocking().remove(entityID);
|
||||
|
@ -226,8 +226,8 @@ public class WorldPackets {
|
||||
public void handle(PacketWrapper wrapper) throws Exception {
|
||||
EntityTracker tracker = wrapper.user().get(EntityTracker.class);
|
||||
Long last = tracker.getLastPlaceBlock();
|
||||
if(last != -1){
|
||||
if((wrapper.user().getReceivedPackets() - last) < 5) {
|
||||
if (last != -1) {
|
||||
if ((wrapper.user().getReceivedPackets() - last) < 5) {
|
||||
wrapper.cancel();
|
||||
}
|
||||
tracker.setLastPlaceBlock(-1L);
|
||||
@ -248,17 +248,18 @@ public class WorldPackets {
|
||||
Item item = Item.getItem(Protocol1_9TO1_8.getHandItem(wrapper.user()));
|
||||
// Blocking patch
|
||||
if (item != null) {
|
||||
if (Material.getMaterial(item.getId()).name().endsWith("SWORD")) {
|
||||
if (hand == 0) {
|
||||
EntityTracker tracker = wrapper.user().get(EntityTracker.class);
|
||||
if (!tracker.isBlocking()) {
|
||||
tracker.setBlocking(true);
|
||||
Item shield = new Item((short) 442, (byte) 1, (short) 0, null);
|
||||
tracker.setSecondHand(shield);
|
||||
if (Material.getMaterial(item.getId()) != null) {
|
||||
if (Material.getMaterial(item.getId()).name().endsWith("SWORD")) {
|
||||
if (hand == 0) {
|
||||
EntityTracker tracker = wrapper.user().get(EntityTracker.class);
|
||||
if (!tracker.isBlocking()) {
|
||||
tracker.setBlocking(true);
|
||||
Item shield = new Item((short) 442, (byte) 1, (short) 0, null);
|
||||
tracker.setSecondHand(shield);
|
||||
}
|
||||
wrapper.cancel();
|
||||
}
|
||||
wrapper.cancel();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
wrapper.write(Type.ITEM, item);
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren