From 053fbd4887b7cb7d55f57038ca0929adac065f03 Mon Sep 17 00:00:00 2001 From: Sowgro <69283684+Sowgro@users.noreply.github.com> Date: Mon, 27 Jun 2022 13:22:39 -0400 Subject: Add files via upload --- LeaveCmd/bin/config.yml | 7 ++++ LeaveCmd/bin/me/sowgro/LeaveCmd/Main.class | Bin 0 -> 2145 bytes LeaveCmd/bin/plugin.yml | 17 +++++++++ LeaveCmd/src/config.yml | 7 ++++ LeaveCmd/src/me/sowgro/LeaveCmd/Main.java | 57 +++++++++++++++++++++++++++++ LeaveCmd/src/plugin.yml | 17 +++++++++ 6 files changed, 105 insertions(+) create mode 100644 LeaveCmd/bin/config.yml create mode 100644 LeaveCmd/bin/me/sowgro/LeaveCmd/Main.class create mode 100644 LeaveCmd/bin/plugin.yml create mode 100644 LeaveCmd/src/config.yml create mode 100644 LeaveCmd/src/me/sowgro/LeaveCmd/Main.java create mode 100644 LeaveCmd/src/plugin.yml 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 new file mode 100644 index 0000000..38982ae Binary files /dev/null and b/LeaveCmd/bin/me/sowgro/LeaveCmd/Main.class differ 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 -- cgit v1.2.3