diff --git a/src/main/java/serverutils/client/gui/GuiSidebarButtonConfig.java b/src/main/java/serverutils/client/gui/GuiSidebarButtonConfig.java index 874de9652..9175a058e 100644 --- a/src/main/java/serverutils/client/gui/GuiSidebarButtonConfig.java +++ b/src/main/java/serverutils/client/gui/GuiSidebarButtonConfig.java @@ -70,6 +70,7 @@ public GuiSidebarButtonConfig() { public void addButtons(Panel panel) { for (SidebarButtonGroup group : SidebarButtonManager.INSTANCE.groups) { for (SidebarButton button : group.getButtons()) { + if (!button.isVisible()) continue; panel.add(new ButtonConfigSidebarButton(panel, button)); } } diff --git a/src/main/java/serverutils/command/client/CommandPrintState.java b/src/main/java/serverutils/command/client/CommandPrintState.java index 3f51625c3..1df1c5fa7 100644 --- a/src/main/java/serverutils/command/client/CommandPrintState.java +++ b/src/main/java/serverutils/command/client/CommandPrintState.java @@ -4,6 +4,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.event.ClickEvent; import net.minecraft.util.ChatComponentText; import net.minecraft.util.IChatComponent; @@ -19,6 +20,9 @@ public CommandPrintState() { @Override public void processCommand(ICommandSender sender, final String[] args) throws CommandException { + if (!(sender instanceof EntityPlayer player)) { + return; + } MovingObjectPosition ray = Minecraft.getMinecraft().objectMouseOver; if (ray.typeOfHit != MovingObjectPosition.MovingObjectType.BLOCK) { return; @@ -27,13 +31,9 @@ public void processCommand(ICommandSender sender, final String[] args) throws Co Block block = sender.getEntityWorld().getBlock(ray.blockX, ray.blockY, ray.blockZ); IChatComponent component = new ChatComponentText( - block.getPickBlock( - ray, - sender.getEntityWorld(), - ray.blockX, - ray.blockY, - ray.blockZ, - getCommandSenderAsPlayer(sender)).getDisplayName() + " :: " + block.getUnlocalizedName()); + block.getPickBlock(ray, sender.getEntityWorld(), ray.blockX, ray.blockY, ray.blockZ, player) + .getDisplayName() + " :: " + + block.getUnlocalizedName()); component.getChatStyle() .setChatClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, block.getUnlocalizedName())); sender.addChatMessage(component); diff --git a/src/main/java/serverutils/command/tp/CmdSetHome.java b/src/main/java/serverutils/command/tp/CmdSetHome.java index f8f384cee..1f2c3506a 100644 --- a/src/main/java/serverutils/command/tp/CmdSetHome.java +++ b/src/main/java/serverutils/command/tp/CmdSetHome.java @@ -35,11 +35,6 @@ public List addTabCompletionOptions(ICommandSender sender, String[] args @Override public void processCommand(ICommandSender sender, String[] args) throws CommandException { EntityPlayerMP player = getCommandSenderAsPlayer(sender); - - // if (player.isSpectator()) { - // throw ServerUtilities.error(sender, "serverutilities.lang.homes.spectator"); - // } - ServerUtilitiesPlayerData data = ServerUtilitiesPlayerData.get(CommandUtils.getForgePlayer(player)); if (args.length == 0) { diff --git a/src/main/java/serverutils/command/tp/CmdSetWarp.java b/src/main/java/serverutils/command/tp/CmdSetWarp.java index 28ec13b10..6892f9b6e 100644 --- a/src/main/java/serverutils/command/tp/CmdSetWarp.java +++ b/src/main/java/serverutils/command/tp/CmdSetWarp.java @@ -4,6 +4,7 @@ import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; +import net.minecraft.entity.player.EntityPlayerMP; import serverutils.ServerUtilities; import serverutils.data.ServerUtilitiesUniverseData; @@ -35,7 +36,8 @@ public void processCommand(ICommandSender sender, String[] args) throws CommandE args[0] = args[0].toLowerCase(); if (args.length == 2) { - pos = new BlockDimPos(sender); + EntityPlayerMP targetPlayer = CommandUtils.getForgePlayer(sender, args[1]).getCommandPlayer(sender); + pos = new BlockDimPos(targetPlayer); } else if (args.length >= 4) { int x = parseInt(sender, args[1]); int y = parseInt(sender, args[2]); diff --git a/src/main/java/serverutils/command/tp/CmdTplast.java b/src/main/java/serverutils/command/tp/CmdTplast.java index a76f0c2cc..4212cfa08 100644 --- a/src/main/java/serverutils/command/tp/CmdTplast.java +++ b/src/main/java/serverutils/command/tp/CmdTplast.java @@ -51,7 +51,7 @@ public void processCommand(ICommandSender sender, String[] args) throws CommandE BlockDimPos p; if (to.isOnline()) { - p = new BlockDimPos(sender); + p = new BlockDimPos(to.getCommandPlayer(sender)); } else { NBTTagCompound nbt = to.getPlayerNBT(); NBTTagList posList = nbt.getTagList("Pos", Constants.NBT.TAG_DOUBLE); diff --git a/src/main/java/serverutils/lib/math/BlockDimPos.java b/src/main/java/serverutils/lib/math/BlockDimPos.java index e6f6159d3..04219496a 100644 --- a/src/main/java/serverutils/lib/math/BlockDimPos.java +++ b/src/main/java/serverutils/lib/math/BlockDimPos.java @@ -4,6 +4,7 @@ import net.minecraft.command.ICommandSender; import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ChunkCoordinates; import net.minecraft.util.MathHelper; import net.minecraft.util.Vec3; @@ -40,6 +41,10 @@ public BlockDimPos(ICommandSender sender) { this(sender.getPlayerCoordinates(), sender.getEntityWorld().provider.dimensionId); } + public BlockDimPos(EntityPlayer player) { + this(player.getPlayerCoordinates(), player.getEntityWorld().provider.dimensionId); + } + public int[] toIntArray() { return new int[] { posX, posY, posZ, dim }; }