From 2090cfbd62c86e75cdd56d520e68aa4fc89f5f33 Mon Sep 17 00:00:00 2001 From: Travis CI Date: Fri, 14 Jun 2019 08:43:40 +0200 Subject: [PATCH] Adding bauinfo command --- src/de/steamwar/bausystem/BauSystem.java | 1 + .../bausystem/commands/CommandInfo.java | 34 +++++++++++++++++++ src/plugin.yml | 1 + 3 files changed, 36 insertions(+) create mode 100644 src/de/steamwar/bausystem/commands/CommandInfo.java diff --git a/src/de/steamwar/bausystem/BauSystem.java b/src/de/steamwar/bausystem/BauSystem.java index e6757d5..ac7f444 100644 --- a/src/de/steamwar/bausystem/BauSystem.java +++ b/src/de/steamwar/bausystem/BauSystem.java @@ -74,6 +74,7 @@ public class BauSystem extends JavaPlugin implements Listener { getCommand("fire").setExecutor(new CommandFire()); getCommand("testblock").setExecutor(new CommandTestblock()); getCommand("bau").setExecutor(new CommandBau()); + getCommand("bauinfo").setExecutor(new CommandInfo()); Bukkit.getPluginManager().registerEvents(this, this); Bukkit.getPluginManager().registerEvents(new RegionListener(), this); diff --git a/src/de/steamwar/bausystem/commands/CommandInfo.java b/src/de/steamwar/bausystem/commands/CommandInfo.java new file mode 100644 index 0000000..515cb33 --- /dev/null +++ b/src/de/steamwar/bausystem/commands/CommandInfo.java @@ -0,0 +1,34 @@ +package de.steamwar.bausystem.commands; + +import de.steamwar.bausystem.BauSystem; +import de.steamwar.bausystem.sql.Bauwelt; +import de.steamwar.bausystem.sql.BauweltMember; +import de.warking.hunjy.MySQL.WarkingUser; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; + +import java.util.List; + +public class CommandInfo implements CommandExecutor { + + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + Bauwelt welt = BauSystem.getWelt(); + sender.sendMessage(BauSystem.PREFIX + "Besitzer: §e" + WarkingUser.get(welt.getUserID()).getUserName()); + sender.sendMessage(BauSystem.PREFIX + "TNT-Schaden: " + (welt.isTNTDmg() ? "§aAN" : "§cAUS")); + sender.sendMessage(BauSystem.PREFIX + "Feuerschaden: " + (welt.isFireDmg() ? "§aAN" : "§cAUS")); + + List members = BauweltMember.getMembers(welt.getUserID()); + StringBuilder membermessage = new StringBuilder().append(BauSystem.PREFIX).append("Mitglieder: "); + + for (BauweltMember member : members) { + membermessage.append("§e").append(WarkingUser.get(member.getMemberID()).getUserName()).append("§8["); + membermessage.append(member.isBuild() ? "§a" : "§c").append("B").append("§8,"); + membermessage.append(member.isWorldEdit() ? "§a" : "§c").append("WE").append("§8,"); + membermessage.append(member.isWorld() ? "§a" : "§c").append("W").append("§8]").append(" "); + } + sender.sendMessage(membermessage.toString()); + return false; + } +} diff --git a/src/plugin.yml b/src/plugin.yml index 07d5ff8..d150aba 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -11,6 +11,7 @@ commands: testblock: reset: bau: + bauinfo: speed: nightvision: aliases: nv \ No newline at end of file