From d17457dbfa1c90fe0383582dadcfe7027febcde2 Mon Sep 17 00:00:00 2001 From: ZeroEpoch1969 <13510767+ZeroEpoch1969@users.noreply.github.com> Date: Sat, 11 Aug 2018 21:21:57 -0700 Subject: [PATCH] . --- .../bridge/WorldEditListener.java | 2 -- .../command/Command_gravity.java | 5 +++-- .../command/Command_togglepickup.java | 22 +++++++++++++++++++ 3 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 src/main/java/me/totalfreedom/totalfreedommod/command/Command_togglepickup.java diff --git a/src/main/java/me/totalfreedom/totalfreedommod/bridge/WorldEditListener.java b/src/main/java/me/totalfreedom/totalfreedommod/bridge/WorldEditListener.java index ce55d87e..62a8790d 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/bridge/WorldEditListener.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/bridge/WorldEditListener.java @@ -55,8 +55,6 @@ public class WorldEditListener extends PluginListener if (event.getLimit() < 0 || event.getLimit() > 200000) { - player.setOp(false); - FUtil.bcastMsg(event.getPlayer().getName() + " tried to set their WorldEdit limit to " + event.getLimit() + " and has been de-opped", ChatColor.RED); event.setCancelled(true); player.sendMessage(ChatColor.RED + "You cannot set your limit higher than 200000 or to -1!"); } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gravity.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gravity.java index 35e85071..1fc5126d 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gravity.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_gravity.java @@ -14,8 +14,9 @@ public class Command_gravity extends FreedomCommand @Override public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { - playerSender.setGravity(!playerSender.hasGravity()); - msg((playerSender.hasGravity() ? "En" : "Dis") + "abled gravity.", (playerSender.hasGravity() ? ChatColor.GREEN : ChatColor.RED)); + boolean enabled = !playerSender.hasGravity(); + playerSender.setGravity(enabled); + msg((enabled ? "En" : "Dis") + "abled gravity.", (enabled ? ChatColor.GREEN : ChatColor.RED)); return true; } } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_togglepickup.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_togglepickup.java new file mode 100644 index 00000000..df9c8294 --- /dev/null +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_togglepickup.java @@ -0,0 +1,22 @@ +package me.totalfreedom.totalfreedommod.command; + +import me.totalfreedom.totalfreedommod.rank.Rank; +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME) +@CommandParameters(description = "Toggle item pickup.", usage = "/") +public class Command_togglepickup extends FreedomCommand +{ + + @Override + public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) + { + boolean enabled = !playerSender.getCanPickupItems(); + playerSender.setCanPickupItems(enabled); + msg((enabled ? "En" : "Dis") + "abled item pickup.", (enabled ? ChatColor.GREEN : ChatColor.RED)); + return true; + } +}