From fb05441f781b0df9f1ec39c5c6b534d7c6adcef7 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Wed, 21 Dec 2016 17:17:44 +1300 Subject: [PATCH] Fixed an error, now works for 1.11.1, no idea what the piggy is for --- .../disguise/disguisetypes/FlagType.java | 6 ++++-- .../watchers/FireworkWatcher.java | 8 +++++++ .../disguisetypes/watchers/PigWatcher.java | 21 ++++++++++++------- .../disguise/utilities/DisguiseUtilities.java | 2 +- 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/src/me/libraryaddict/disguise/disguisetypes/FlagType.java b/src/me/libraryaddict/disguise/disguisetypes/FlagType.java index d8067dc2..71782423 100644 --- a/src/me/libraryaddict/disguise/disguisetypes/FlagType.java +++ b/src/me/libraryaddict/disguise/disguisetypes/FlagType.java @@ -162,6 +162,8 @@ public class FlagType { public static FlagType FIREWORK_ITEM = new FlagType(FireworkWatcher.class, 0, new ItemStack(Material.AIR)); + public static FlagType FIREWORK_ATTACHED_ENTITY = new FlagType(FireworkWatcher.class, 1, 0); + public static FlagType FISHING_HOOK_HOOKED = new FlagType(FishingHookWatcher.class, 0, 0); public static FlagType GHAST_AGRESSIVE = new FlagType(GhastWatcher.class, 0, false); @@ -181,8 +183,6 @@ public class FlagType { public static FlagType> HORSE_OWNER = new FlagType>(AbstractHorseWatcher.class, 1, Optional. absent()); - // public static FlagType HORSE_VARIANT = new FlagType(HorseWatcher.class, 0, 0); - public static FlagType INSENTIENT_META = new FlagType(InsentientWatcher.class, 0, (byte) 0); public static FlagType IRON_GOLEM_PLAYER_CREATED = new FlagType(IronGolemWatcher.class, 0, (byte) 0); @@ -224,6 +224,8 @@ public class FlagType { public static FlagType PIG_SADDLED = new FlagType(PigWatcher.class, 0, false); + public static FlagType PIG_UNKNOWN = new FlagType(PigWatcher.class, 1, 0); + public static FlagType PLAYER_ABSORPTION = new FlagType(PlayerWatcher.class, 0, 0F); public static FlagType PLAYER_HAND = new FlagType(PlayerWatcher.class, 3, (byte) 0); diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/FireworkWatcher.java b/src/me/libraryaddict/disguise/disguisetypes/watchers/FireworkWatcher.java index 3641f6ef..22f60d21 100644 --- a/src/me/libraryaddict/disguise/disguisetypes/watchers/FireworkWatcher.java +++ b/src/me/libraryaddict/disguise/disguisetypes/watchers/FireworkWatcher.java @@ -32,4 +32,12 @@ public class FireworkWatcher extends FlagWatcher { sendData(FlagType.FIREWORK_ITEM); } + public void setAttachedEntity(int entityId) { + setData(FlagType.FIREWORK_ATTACHED_ENTITY, entityId); + sendData(FlagType.FIREWORK_ATTACHED_ENTITY); + } + + public int getAttachedEntity() { + return getData(FlagType.FIREWORK_ATTACHED_ENTITY); + } } diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/PigWatcher.java b/src/me/libraryaddict/disguise/disguisetypes/watchers/PigWatcher.java index 798bd19c..605089a3 100644 --- a/src/me/libraryaddict/disguise/disguisetypes/watchers/PigWatcher.java +++ b/src/me/libraryaddict/disguise/disguisetypes/watchers/PigWatcher.java @@ -3,22 +3,27 @@ package me.libraryaddict.disguise.disguisetypes.watchers; import me.libraryaddict.disguise.disguisetypes.Disguise; import me.libraryaddict.disguise.disguisetypes.FlagType; -public class PigWatcher extends AgeableWatcher -{ +public class PigWatcher extends AgeableWatcher { - public PigWatcher(Disguise disguise) - { + public PigWatcher(Disguise disguise) { super(disguise); } - public boolean isSaddled() - { + public boolean isSaddled() { return (boolean) getData(FlagType.PIG_SADDLED); } - public void setSaddled(boolean isSaddled) - { + public void setSaddled(boolean isSaddled) { setData(FlagType.PIG_SADDLED, isSaddled); sendData(FlagType.PIG_SADDLED); } + + public int getUnknown() { + return getData(FlagType.PIG_UNKNOWN); + } + + public void setUnknown(int unknown) { + setData(FlagType.PIG_UNKNOWN, unknown); + sendData(FlagType.PIG_UNKNOWN); + } } diff --git a/src/me/libraryaddict/disguise/utilities/DisguiseUtilities.java b/src/me/libraryaddict/disguise/utilities/DisguiseUtilities.java index 053ef14e..bc8af5ac 100644 --- a/src/me/libraryaddict/disguise/utilities/DisguiseUtilities.java +++ b/src/me/libraryaddict/disguise/utilities/DisguiseUtilities.java @@ -995,7 +995,7 @@ public class DisguiseUtilities { if (DisguiseConfig.getPushingOption() != DisguisePushing.IGNORE) { // Code to stop player pushing in 1.9 Scoreboard scoreboard = player.getScoreboard(); - Team team = scoreboard.getTeam(prevTeam); + Team team = prevTeam == null ? null : scoreboard.getTeam(prevTeam); Team ldTeam = scoreboard.getEntryTeam(player.getName()); if (ldTeam != null) {