diff options
author | Sowgro <69283684+Sowgro@users.noreply.github.com> | 2022-06-27 13:22:39 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-27 13:22:39 -0400 |
commit | 053fbd4887b7cb7d55f57038ca0929adac065f03 (patch) | |
tree | b91d592e5e75fdd9f11292ec118788b88d8d05f7 | |
parent | 9f584d084bc115128b2270464fccdf52a48957e5 (diff) | |
download | LeaveCmd-053fbd4887b7cb7d55f57038ca0929adac065f03.tar.gz LeaveCmd-053fbd4887b7cb7d55f57038ca0929adac065f03.tar.bz2 LeaveCmd-053fbd4887b7cb7d55f57038ca0929adac065f03.zip |
Add files via upload
-rw-r--r-- | LeaveCmd/bin/config.yml | 7 | ||||
-rw-r--r-- | LeaveCmd/bin/me/sowgro/LeaveCmd/Main.class | bin | 0 -> 2145 bytes | |||
-rw-r--r-- | LeaveCmd/bin/plugin.yml | 17 | ||||
-rw-r--r-- | LeaveCmd/src/config.yml | 7 | ||||
-rw-r--r-- | LeaveCmd/src/me/sowgro/LeaveCmd/Main.java | 57 | ||||
-rw-r--r-- | LeaveCmd/src/plugin.yml | 17 |
6 files changed, 105 insertions, 0 deletions
diff --git a/LeaveCmd/bin/config.yml b/LeaveCmd/bin/config.yml new file mode 100644 index 0000000..6b0b2e2 --- /dev/null +++ b/LeaveCmd/bin/config.yml @@ -0,0 +1,7 @@ +commands: + //ex: "command" + //hg: "hungergames leave" + +worlds: + //world: ex + //arena: hg
\ No newline at end of file diff --git a/LeaveCmd/bin/me/sowgro/LeaveCmd/Main.class b/LeaveCmd/bin/me/sowgro/LeaveCmd/Main.class Binary files differnew file mode 100644 index 0000000..38982ae --- /dev/null +++ b/LeaveCmd/bin/me/sowgro/LeaveCmd/Main.class diff --git a/LeaveCmd/bin/plugin.yml b/LeaveCmd/bin/plugin.yml new file mode 100644 index 0000000..3a2179e --- /dev/null +++ b/LeaveCmd/bin/plugin.yml @@ -0,0 +1,17 @@ +main: me.sowgro.LeaveCmd.Main +name: LeaveCmd +author: sowgro +version: 1.0 +api-version: 1.19 +commands: + leave: + description: test + permission: leaveCmd.leave + leaveCmd: + description: test2 + permission: leaveCmd.admin +permissions: + leaveCmd.leave: + default: true + leaveCmd.admin: + default: op
\ No newline at end of file diff --git a/LeaveCmd/src/config.yml b/LeaveCmd/src/config.yml new file mode 100644 index 0000000..6b0b2e2 --- /dev/null +++ b/LeaveCmd/src/config.yml @@ -0,0 +1,7 @@ +commands: + //ex: "command" + //hg: "hungergames leave" + +worlds: + //world: ex + //arena: hg
\ No newline at end of file diff --git a/LeaveCmd/src/me/sowgro/LeaveCmd/Main.java b/LeaveCmd/src/me/sowgro/LeaveCmd/Main.java new file mode 100644 index 0000000..016c633 --- /dev/null +++ b/LeaveCmd/src/me/sowgro/LeaveCmd/Main.java @@ -0,0 +1,57 @@ +package me.sowgro.LeaveCmd; + +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +public class Main extends JavaPlugin +{ + @Override + public void onEnable() + { + this.saveDefaultConfig(); + //startup, reloads, plugin reloads + } + + @Override + public void onDisable() + { + //shutdown, reloads + } + + // /leave + public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) + { + if (label.equalsIgnoreCase("leave")) + { + if (sender instanceof Player) + { + try + { + String world = ((Player) sender).getWorld().getName(); //gets world of player + String game = this.getConfig().getConfigurationSection("worlds").getString(world); //gets the game of that world + String command = this.getConfig().getConfigurationSection("commands").getString(game); //gets the command of that game + ((Player) sender).performCommand(command); //executes the command + } + catch(Exception e) + { + sender.sendMessage("The current game cannot be left."); + } + } + else + { + getLogger().info("This command cannot be used by the console"); + } + } + if (label.equalsIgnoreCase("leaveCmd")) + { + if (args[0].equalsIgnoreCase("reload")) + { + this.reloadConfig(); + sender.sendMessage("Reloaded."); + } + } + return false; + } +} diff --git a/LeaveCmd/src/plugin.yml b/LeaveCmd/src/plugin.yml new file mode 100644 index 0000000..3a2179e --- /dev/null +++ b/LeaveCmd/src/plugin.yml @@ -0,0 +1,17 @@ +main: me.sowgro.LeaveCmd.Main +name: LeaveCmd +author: sowgro +version: 1.0 +api-version: 1.19 +commands: + leave: + description: test + permission: leaveCmd.leave + leaveCmd: + description: test2 + permission: leaveCmd.admin +permissions: + leaveCmd.leave: + default: true + leaveCmd.admin: + default: op
\ No newline at end of file |