diff --git a/build.gradle b/build.gradle index b4cdf1b..4911942 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,7 @@ import org.apache.tools.ant.filters.ReplaceTokens apply plugin: 'java' group = 'com.github.Mori01231' -version = '1.1.0' +version = '1.2.0' sourceCompatibility = '1.8' targetCompatibility = '1.8' diff --git a/src/main/java/com/github/mori01231/aziswitch/AziSwitch.java b/src/main/java/com/github/mori01231/aziswitch/AziSwitch.java index d63aa37..208fa77 100644 --- a/src/main/java/com/github/mori01231/aziswitch/AziSwitch.java +++ b/src/main/java/com/github/mori01231/aziswitch/AziSwitch.java @@ -23,7 +23,6 @@ public void onEnable() { configManager.loadConfig(); this.getCommand("switch").setExecutor(new SwitchCommandExecutor()); - this.getCommand("newswitchgroup").setExecutor(new NewSwitchGroupCommandExecutor()); getServer().getPluginManager().registerEvents(new PlayerJoinEventListener(),this); } diff --git a/src/main/java/com/github/mori01231/aziswitch/NewSwitchGroupCommandExecutor.java b/src/main/java/com/github/mori01231/aziswitch/NewSwitchGroupCommandExecutor.java deleted file mode 100644 index 1f9b51b..0000000 --- a/src/main/java/com/github/mori01231/aziswitch/NewSwitchGroupCommandExecutor.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.github.mori01231.aziswitch; - -import org.bukkit.ChatColor; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; - -import java.util.List; - -import static org.bukkit.Bukkit.getServer; - -public class NewSwitchGroupCommandExecutor implements CommandExecutor { - private final String pluginName = AziSwitch.getInstance().getDescription().getPrefix(); - - @Override - public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { - - // First argument is the group name. - String groupName = args[0]; - - // Initial variable to indicate mode. - String creationMode = "all"; - - // Determine mode - if(args.length >= 2){ - // Set creation mode to single if the second argument is "single" - if(args[1].equalsIgnoreCase("single")){ - creationMode = "single"; - } - - // if the second argument is invalid, give an error and return - else if(!args[1].equalsIgnoreCase("all")){ - sender.sendMessage(ChatColor.translateAlternateColorCodes('&',"&7[&b"+pluginName+"&7]&r &cモードはsingleもしくはallで設定してください。" )); - return true; - } - } - - // Make a group a switch group for a single server. - if(creationMode.equalsIgnoreCase("single")){ - // Add the group to the list of single server groups in config. - List singleServerGroups = AziSwitch.getInstance().getConfig().getStringList("SingleServerGroups"); - singleServerGroups.add(groupName); - configManager.setSingleServerGroups(singleServerGroups); - - createGroups(groupName); - } - - // Make a group a switch group for all servers. - else{ - // Add the group to the list of all server groups in config. - List allServerGroups = AziSwitch.getInstance().getConfig().getStringList("AllServerGroups"); - allServerGroups.add(groupName); - configManager.setAllServerGroups(allServerGroups); - - createGroups(groupName); - } - - return true; - } - - public void createGroups(String groupName){ - sendCommand("lp creategroup " + groupName); - sendCommand("lp g " + groupName + " permission set aziswitch.* false"); - sendCommand("lp g " + groupName + " permission set aziswitch.is" + groupName + " true"); - sendCommand("lp creategroup switch" + groupName); - sendCommand("lp g switch" + groupName + " permission set aziswitch.* false"); - sendCommand("lp g switch" + groupName + " permission set aziswitch.switch" + groupName + " true"); - } - - public void sendCommand(String command){ - getServer().dispatchCommand(getServer().getConsoleSender(), command); - } -} diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index b88189e..aa77b14 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -10,9 +10,6 @@ commands: switch: description: 運営モードとサバ民モードを行き来する。 usage: エラー。/switchで運営モードを変更できます。 - newswitchgroup: - description: Switch可能なグループを作成する。 - usage: エラー。/newswitchgroup グループ名 でグループの作成が可能です。 permissions: aziswitch.*: