Let disguised dogs be sittable

This commit is contained in:
libraryaddict 2020-11-30 03:19:57 +13:00
parent 6f9b2dfd6d
commit 251ca9b7e1
2 changed files with 19 additions and 0 deletions

View File

@ -134,6 +134,7 @@ public class DisguiseUtilities {
public static final Random random = new Random(); public static final Random random = new Random();
private static final LinkedHashMap<String, Disguise> clonedDisguises = new LinkedHashMap<>(); private static final LinkedHashMap<String, Disguise> clonedDisguises = new LinkedHashMap<>();
private static final List<Integer> isNoInteract = new ArrayList<>(); private static final List<Integer> isNoInteract = new ArrayList<>();
private static final List<Integer> isSpecialInteract = new ArrayList<>();
/** /**
* A hashmap of the uuid's of entitys, alive and dead. And their disguises in use * A hashmap of the uuid's of entitys, alive and dead. And their disguises in use
*/ */
@ -445,6 +446,12 @@ public class DisguiseUtilities {
} }
} }
public static boolean isSpecialInteract(int entityId) {
synchronized (isSpecialInteract) {
return isSpecialInteract.contains(entityId);
}
}
public static boolean isGrabSkinCommandUsed() { public static boolean isGrabSkinCommandUsed() {
return grabSkinCommandUsed; return grabSkinCommandUsed;
} }
@ -688,6 +695,12 @@ public class DisguiseUtilities {
break; break;
} }
} }
synchronized (isSpecialInteract) {
if (disguise.getEntity() instanceof Wolf && disguise.getType() != DisguiseType.WOLF) {
isSpecialInteract.add(entityId);
}
}
} }
if ("a%%__USER__%%a".equals("a12345a") || (LibsPremium.getUserID().matches("[0-9]+") && if ("a%%__USER__%%a".equals("a12345a") || (LibsPremium.getUserID().matches("[0-9]+") &&
@ -1543,6 +1556,10 @@ public class DisguiseUtilities {
synchronized (isNoInteract) { synchronized (isNoInteract) {
isNoInteract.remove((Object) disguise.getEntity().getEntityId()); isNoInteract.remove((Object) disguise.getEntity().getEntityId());
} }
synchronized (isSpecialInteract) {
isSpecialInteract.remove((Object) disguise.getEntity().getEntityId());
}
} }
} }

View File

@ -50,6 +50,8 @@ public class PacketListenerClientInteract extends PacketAdapter {
event.setCancelled(true); event.setCancelled(true);
} else if (DisguiseUtilities.isNotInteractable(packet.getIntegers().read(0))) { } else if (DisguiseUtilities.isNotInteractable(packet.getIntegers().read(0))) {
event.setCancelled(true); event.setCancelled(true);
}else if (DisguiseUtilities.isSpecialInteract(packet.getIntegers().read(0)) && packet.getHands().read(0) == EnumWrappers.Hand.OFF_HAND) {
event.setCancelled(true);
} }
if (event.isAsync()) { if (event.isAsync()) {