diff --git a/Plugins/Mineplex.Core/src/mineplex/core/visibility/VisibilityData.java b/Plugins/Mineplex.Core/src/mineplex/core/visibility/VisibilityData.java index 491a79322..b5f08c4dd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/visibility/VisibilityData.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/visibility/VisibilityData.java @@ -16,10 +16,12 @@ public class VisibilityData public void updatePlayer(Player player, Player target, boolean hide) { + TimingManager.stopTotal("VisData updatePlayer"); + if (_lastState.containsKey(target) && _lastState.get(target) == hide) { //Already this state, do nothing - //System.out.println("REPEAT " + player.getName() + " ~ " + target.getName()); + TimingManager.stopTotal("VisData updatePlayer"); return; } @@ -33,11 +35,15 @@ public class VisibilityData //Store _shouldHide.put(target, hide); } + + TimingManager.stopTotal("VisData updatePlayer"); } //Process New private boolean attemptToProcess(Player player, Player target, boolean hide) { + TimingManager.startTotal("VisData attemptToProcess"); + if (Recharge.Instance.use(player, "VIS " + target.getName(), 250, false, false)) { //Use craftplayer because i recall jon added something where @@ -58,37 +64,47 @@ public class VisibilityData _lastState.put(target, hide); - //System.out.println("TRUE " + player.getName() + " ~ " + target.getName()); + TimingManager.stopTotal("VisData attemptToProcess"); return true; } - //System.out.println("FALSE " + player.getName() + " ~ " + target.getName()); + TimingManager.stopTotal("VisData attemptToProcess"); return false; } //Process Update public void attemptToProcessUpdate(Player player) { - for (Iterator targetIter = _shouldHide.keySet().iterator(); targetIter.hasNext();) + TimingManager.startTotal("VisData attemptToProcessUpdate shouldHide"); + if (!_shouldHide.isEmpty()) { - Player target = targetIter.next(); - boolean hide = _shouldHide.get(target); - - if (!target.isOnline() || !target.isValid() || attemptToProcess(player, target, hide)) + for (Iterator targetIter = _shouldHide.keySet().iterator(); targetIter.hasNext();) { - targetIter.remove(); + Player target = targetIter.next(); + boolean hide = _shouldHide.get(target); + + if (!target.isOnline() || !target.isValid() || attemptToProcess(player, target, hide)) + { + targetIter.remove(); + } } } + TimingManager.stopTotal("VisData attemptToProcessUpdate shouldHide"); - for (Iterator targetIter = _lastState.keySet().iterator(); targetIter.hasNext();) + TimingManager.startTotal("VisData attemptToProcessUpdate lastState"); + if (!_lastState.isEmpty()) { - Player target = targetIter.next(); - - if (!target.isOnline() || !target.isValid()) + for (Iterator targetIter = _lastState.keySet().iterator(); targetIter.hasNext();) { - targetIter.remove(); + Player target = targetIter.next(); + + if (!target.isOnline() || !target.isValid()) + { + targetIter.remove(); + } } } + TimingManager.stopTotal("VisData attemptToProcessUpdate lastState"); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/visibility/VisibilityManager.java b/Plugins/Mineplex.Core/src/mineplex/core/visibility/VisibilityManager.java index 2d7870d39..4336048d5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/visibility/VisibilityManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/visibility/VisibilityManager.java @@ -98,8 +98,12 @@ public class VisibilityManager extends MiniPlugin return; System.out.println(" "); - TimingManager.endTotal("VisMan Update", true); - TimingManager.endTotal("VisMan SetVis", true); + TimingManager.endTotal("VisMan update", true); + TimingManager.endTotal("VisMan setVis", true); + TimingManager.endTotal("VisData attemptToProcess", true); + TimingManager.endTotal("VisData updatePlayer", true); + TimingManager.endTotal("VisData attemptToProcessUpdate shouldHide", true); + TimingManager.endTotal("VisData attemptToProcessUpdate lastState", true); TimingManager.endTotal("Hide Player", true); TimingManager.endTotal("Show Player", true); System.out.println(" ");