diff --git a/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java b/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java index 6784666e..27296ec0 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java +++ b/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java @@ -34,8 +34,10 @@ import com.onarandombox.MultiverseCore.api.MultiverseMessaging; import com.onarandombox.MultiverseCore.api.SafeTTeleporter; import com.onarandombox.MultiverseCore.commands_acf.CoordCommand; import com.onarandombox.MultiverseCore.commands_acf.CreateCommand; +import com.onarandombox.MultiverseCore.commands_acf.ListCommand; import com.onarandombox.MultiverseCore.commands_acf.ReloadCommand; import com.onarandombox.MultiverseCore.commands_acf.RemoveCommand; +import com.onarandombox.MultiverseCore.commands_acf.ScriptCommand; import com.onarandombox.MultiverseCore.commands_acf.SpawnCommand; import com.onarandombox.MultiverseCore.commands_acf.UsageCommand; import com.onarandombox.MultiverseCore.commands_helper.CommandTools; @@ -740,6 +742,8 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core { this.commandHandler.registerCommand(new SpawnCommand(this)); this.commandHandler.registerCommand(new ReloadCommand(this)); this.commandHandler.registerCommand(new RemoveCommand(this)); + this.commandHandler.registerCommand(new ListCommand(this)); + this.commandHandler.registerCommand(new ScriptCommand(this)); } /** diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands_acf/GamerulesCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands_acf/GamerulesCommand.java new file mode 100644 index 00000000..5de46ec8 --- /dev/null +++ b/src/main/java/com/onarandombox/MultiverseCore/commands_acf/GamerulesCommand.java @@ -0,0 +1,51 @@ +package com.onarandombox.MultiverseCore.commands_acf; + +import co.aikar.commands.annotation.CommandAlias; +import co.aikar.commands.annotation.CommandCompletion; +import co.aikar.commands.annotation.CommandPermission; +import co.aikar.commands.annotation.Description; +import co.aikar.commands.annotation.Flags; +import co.aikar.commands.annotation.Subcommand; +import co.aikar.commands.annotation.Syntax; +import com.onarandombox.MultiverseCore.MultiverseCore; +import com.onarandombox.MultiverseCore.api.MultiverseWorld; +import org.bukkit.ChatColor; +import org.bukkit.GameRule; +import org.bukkit.World; +import org.bukkit.command.CommandSender; +import org.jetbrains.annotations.NotNull; + +@CommandAlias("mv") +public class GamerulesCommand extends MultiverseCommand { + + public GamerulesCommand(MultiverseCore plugin) { + super(plugin); + } + + @Subcommand("info") + @CommandPermission("multiverse.core.gamerule.list") + @Syntax("[world]") + @CommandCompletion("@MVWorlds") + @Description("See the list gamerules values for a given world.") + public void onGamerulesCommand(@NotNull CommandSender sender, + @NotNull @Flags("other|defaultself") MultiverseWorld world) { + + World CBWorld = world.getCBWorld(); + StringBuilder gameRules = new StringBuilder(); + + for (String gameRule : CBWorld.getGameRules()) { + if (gameRules.length() != 0) { + gameRules.append(ChatColor.WHITE).append(", "); + } + gameRules.append(ChatColor.AQUA) + .append(gameRule) + .append(ChatColor.WHITE) + .append(": ") + .append(ChatColor.GREEN) + .append(CBWorld.getGameRuleValue(GameRule.getByName(gameRule))); + } + + sender.sendMessage("=== Gamerules for " + ChatColor.AQUA + world.getName() + ChatColor.WHITE + " ==="); + sender.sendMessage(gameRules.toString()); + } +} diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands_acf/ListCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands_acf/ListCommand.java new file mode 100644 index 00000000..ad8e157e --- /dev/null +++ b/src/main/java/com/onarandombox/MultiverseCore/commands_acf/ListCommand.java @@ -0,0 +1,31 @@ +package com.onarandombox.MultiverseCore.commands_acf; + +import co.aikar.commands.annotation.CommandAlias; +import co.aikar.commands.annotation.CommandCompletion; +import co.aikar.commands.annotation.CommandPermission; +import co.aikar.commands.annotation.Default; +import co.aikar.commands.annotation.Description; +import co.aikar.commands.annotation.Subcommand; +import co.aikar.commands.annotation.Syntax; +import com.onarandombox.MultiverseCore.MultiverseCore; +import org.bukkit.command.CommandSender; +import org.jetbrains.annotations.NotNull; + +@CommandAlias("mv") +public class ListCommand extends MultiverseCommand { + + public ListCommand(MultiverseCore plugin) { + super(plugin); + } + + @Subcommand("list") + @CommandPermission("multiverse.core.list.worlds") + @Syntax("[page]") + @Description("Displays a listing of all worlds that you can enter.") + public void onListCommand(@NotNull CommandSender sender, + @Default("1") int page) { + + sender.sendMessage(this.plugin.getMVWorldManager().getMVWorlds().toString()); + sender.sendMessage("Page of: " + page); + } +} diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands_acf/ScriptCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands_acf/ScriptCommand.java new file mode 100644 index 00000000..f1c261bb --- /dev/null +++ b/src/main/java/com/onarandombox/MultiverseCore/commands_acf/ScriptCommand.java @@ -0,0 +1,50 @@ +package com.onarandombox.MultiverseCore.commands_acf; + +import buscript.Buscript; +import co.aikar.commands.annotation.CommandAlias; +import co.aikar.commands.annotation.CommandCompletion; +import co.aikar.commands.annotation.CommandPermission; +import co.aikar.commands.annotation.Description; +import co.aikar.commands.annotation.Flags; +import co.aikar.commands.annotation.Subcommand; +import co.aikar.commands.annotation.Syntax; +import com.onarandombox.MultiverseCore.MultiverseCore; +import org.bukkit.ChatColor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; + +import java.io.File; + +@CommandAlias("mv") +public class ScriptCommand extends MultiverseCommand { + + public ScriptCommand(MultiverseCore plugin) { + super(plugin); + } + + @Subcommand("script") + @CommandPermission("multiverse.core.script") + @CommandCompletion(" @players") + @Syntax("