From 8b88dbe15b8185fa7decd50d2ffcf7ad4f3a8e96 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Thu, 17 Mar 2016 20:26:55 +0100 Subject: [PATCH] Better Help Command Visibility --- .../massivecore/command/MassiveCommandHelp.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/com/massivecraft/massivecore/command/MassiveCommandHelp.java b/src/com/massivecraft/massivecore/command/MassiveCommandHelp.java index 17c2c045..24d1c1e8 100644 --- a/src/com/massivecraft/massivecore/command/MassiveCommandHelp.java +++ b/src/com/massivecraft/massivecore/command/MassiveCommandHelp.java @@ -68,12 +68,15 @@ public class MassiveCommandHelp extends MassiveCommand boolean visible = super.isVisibleTo(sender); if ( ! (this.hasParent() && visible)) return visible; + int visibleSiblingCount = 0; + for (MassiveCommand sibling : this.getParent().getChildren()) + { + if (sibling == this) continue; + if (sibling.isVisibleTo(sender)) visibleSiblingCount++; + } + int pageHeight = (sender instanceof Player) ? Txt.PAGEHEIGHT_PLAYER : Txt.PAGEHEIGHT_CONSOLE; - - // Minues one, don't count ourself. - int size = this.getParent().getChildren().size()-1; - - if (size <= pageHeight) + if (visibleSiblingCount <= pageHeight) { return false; }