From 34f0a13b39f7bbbe13b8ea87c56d9babfc105ab1 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Wed, 4 Jun 2014 13:58:16 +1200 Subject: [PATCH] Remove badly thought out and obselete feature that didn't work --- config.yml | 4 ---- .../disguise/DisguiseConfig.java | 13 +--------- .../disguise/DisguiseListener.java | 12 ---------- .../disguise/utilities/DisguiseUtilities.java | 24 ------------------- .../disguise/utilities/PacketsManager.java | 1 - 5 files changed, 1 insertion(+), 53 deletions(-) diff --git a/config.yml b/config.yml index df61000e..eb23d528 100644 --- a/config.yml +++ b/config.yml @@ -28,10 +28,6 @@ RemoveHeldItem: false # Set this to true if you want the disguise to get the animations of the disguised entity. Such as invisible, on fire, sprinting, sneaking, blocking # This is only valid if you set a animation on the disguise itself. Because the entitys animations are applied otherwise. AddEntityAnimations: true -# If all players who can see a targeted disguise (Only advalible to plugins) have quit. -# Does the plugin remove that disguise from valid disguises? If your plugin handles this. Then thats good. -# Else its a memory leak. This loops through all disguise to see if anyone else is online who can see that disguise. -RemoveUnusedDisguises: true # This is only called into action when the disguise is constructed using the commands. # And when the disguise supports that. This will not be used at all for plugins constructing the disguises for instance. # Such as prophunt. Its also false because its kind of a retarded feature. diff --git a/src/me/libraryaddict/disguise/DisguiseConfig.java b/src/me/libraryaddict/disguise/DisguiseConfig.java index b301e73e..f6284fcd 100644 --- a/src/me/libraryaddict/disguise/DisguiseConfig.java +++ b/src/me/libraryaddict/disguise/DisguiseConfig.java @@ -26,7 +26,6 @@ public class DisguiseConfig { private static boolean miscDisguisesForLivingEnabled; private static boolean modifyBoundingBox; private static boolean movementEnabled; - private static boolean removeUnseenDisguises; private static boolean ridingEnabled; private static boolean sendsEntityMetadata; private static boolean sendVelocity; @@ -64,8 +63,7 @@ public class DisguiseConfig { setModifyBoundingBox(config.getBoolean("ModifyBoundingBox")); setMonstersIgnoreDisguises(config.getBoolean("MonstersIgnoreDisguises")); setDisguiseBlownOnAttack(config.getBoolean("BlowDisguises")); - setDisguiseBlownMessage(ChatColor.translateAlternateColorCodes('&', - config.getString("BlownDisguiseMessage"))); + setDisguiseBlownMessage(ChatColor.translateAlternateColorCodes('&', config.getString("BlownDisguiseMessage"))); setKeepDisguiseOnPlayerDeath(config.getBoolean("KeepDisguises.PlayerDeath")); setKeepDisguiseOnPlayerLogout(config.getBoolean("KeepDisguises.PlayerLogout")); setKeepDisguiseOnEntityDespawn(config.getBoolean("KeepDisguises.EntityDespawn")); @@ -83,7 +81,6 @@ public class DisguiseConfig { setDisguiseEntityExpire(config.getInt("DisguiseEntityExpire")); setDisguiseCloneExpire(config.getInt("DisguiseCloneExpire")); setMaxClonedDisguises(config.getInt("DisguiseCloneSize")); - setUnusedDisguisesRemoved(config.getBoolean("RemoveUnusedDisguises")); } public static boolean isAnimationPacketsEnabled() { @@ -187,10 +184,6 @@ public class DisguiseConfig { return PacketsManager.isHearDisguisesEnabled(); } - public static boolean isUnusedDisguisesRemoved() { - return removeUnseenDisguises; - } - /** * Is the velocity packets sent */ @@ -361,10 +354,6 @@ public class DisguiseConfig { PacketsManager.setHearDisguisesListener(isSoundsEnabled); } - public static void setUnusedDisguisesRemoved(boolean remove) { - removeUnseenDisguises = remove; - } - /** * Disable velocity packets being sent for w/e reason. Maybe you want every ounce of performance you can get? */ diff --git a/src/me/libraryaddict/disguise/DisguiseListener.java b/src/me/libraryaddict/disguise/DisguiseListener.java index 00c9faa0..c4256101 100644 --- a/src/me/libraryaddict/disguise/DisguiseListener.java +++ b/src/me/libraryaddict/disguise/DisguiseListener.java @@ -5,7 +5,6 @@ import java.util.Random; import me.libraryaddict.disguise.disguisetypes.Disguise; import me.libraryaddict.disguise.disguisetypes.PlayerDisguise; -import me.libraryaddict.disguise.disguisetypes.TargetedDisguise; import me.libraryaddict.disguise.disguisetypes.watchers.LivingWatcher; import me.libraryaddict.disguise.utilities.DisguiseUtilities; import me.libraryaddict.disguise.utilities.UpdateChecker; @@ -22,7 +21,6 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.event.vehicle.VehicleEnterEvent; import org.bukkit.event.vehicle.VehicleExitEvent; @@ -101,16 +99,6 @@ public class DisguiseListener implements Listener { } } - @EventHandler - public void onQuit(PlayerQuitEvent event) { - if (DisguiseConfig.isUnusedDisguisesRemoved()) { - for (TargetedDisguise disguise : DisguiseUtilities.getSeenDisguises(event.getPlayer().getName())) { - // TODO fix - // disguise.removeDisguise(); - } - } - } - @EventHandler public void onRespawn(PlayerRespawnEvent event) { Disguise[] disguises = DisguiseAPI.getDisguises(event.getPlayer()); diff --git a/src/me/libraryaddict/disguise/utilities/DisguiseUtilities.java b/src/me/libraryaddict/disguise/utilities/DisguiseUtilities.java index 8997fc47..c6e6fd4e 100644 --- a/src/me/libraryaddict/disguise/utilities/DisguiseUtilities.java +++ b/src/me/libraryaddict/disguise/utilities/DisguiseUtilities.java @@ -8,7 +8,6 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashMap; -import java.util.List; import java.util.UUID; import me.libraryaddict.disguise.DisguiseAPI; @@ -407,29 +406,6 @@ public class DisguiseUtilities { return getProfileFromMojang(playerName, (Object) runnableIfCantReturn); } - public static List getSeenDisguises(String viewer) { - List dis = new ArrayList(); - for (HashSet disguises : getDisguises().values()) { - for (TargetedDisguise disguise : disguises) { - if (disguise.getDisguiseTarget() == TargetType.HIDE_DISGUISE_TO_EVERYONE_BUT_THESE_PLAYERS) { - if (disguise.canSee(viewer)) { - boolean add = true; - for (String observer : disguise.getObservers()) { - if (!observer.equals(viewer) && Bukkit.getPlayerExact(observer) != null) { - add = false; - break; - } - } - if (add) { - dis.add(disguise); - } - } - } - } - } - return dis; - } - public static HashMap getSelfDisguisesIds() { return selfDisguisesIds; } diff --git a/src/me/libraryaddict/disguise/utilities/PacketsManager.java b/src/me/libraryaddict/disguise/utilities/PacketsManager.java index f5a71ddf..0204d209 100644 --- a/src/me/libraryaddict/disguise/utilities/PacketsManager.java +++ b/src/me/libraryaddict/disguise/utilities/PacketsManager.java @@ -2,7 +2,6 @@ package me.libraryaddict.disguise.utilities; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; import java.util.Random;