From b7f79527534c8edac418dee0791281ff784bec72 Mon Sep 17 00:00:00 2001 From: sowgro Date: Fri, 28 Jun 2024 01:45:24 -0400 Subject: Improve documentation, tweak commands --- OG_GUIDE.md | 108 +++++++++++++++++---- README.md | 94 ++++++++++++++---- src/main/java/com/MylesAndMore/Tumble/Main.java | 6 +- .../com/MylesAndMore/Tumble/commands/Create.java | 1 + .../MylesAndMore/Tumble/commands/ForceStart.java | 12 ++- .../MylesAndMore/Tumble/commands/ForceStop.java | 9 +- .../com/MylesAndMore/Tumble/commands/Remove.java | 1 + .../MylesAndMore/Tumble/commands/SetGameSpawn.java | 1 + .../Tumble/commands/SetKillYCordinate.java | 61 ------------ .../Tumble/commands/SetKillYLevel.java | 62 ++++++++++++ .../com/MylesAndMore/Tumble/commands/SetLobby.java | 1 + .../MylesAndMore/Tumble/commands/SetWaitArea.java | 1 + .../Tumble/commands/SetWinnerLobby.java | 1 + .../com/MylesAndMore/Tumble/commands/Tumble.java | 2 +- .../MylesAndMore/Tumble/config/ArenaManager.java | 4 +- .../MylesAndMore/Tumble/config/ConfigManager.java | 5 +- .../Tumble/config/LanguageManager.java | 3 +- src/main/resources/config.yml | 2 +- src/main/resources/language.yml | 2 +- 19 files changed, 260 insertions(+), 116 deletions(-) delete mode 100644 src/main/java/com/MylesAndMore/Tumble/commands/SetKillYCordinate.java create mode 100644 src/main/java/com/MylesAndMore/Tumble/commands/SetKillYLevel.java diff --git a/OG_GUIDE.md b/OG_GUIDE.md index bd041e0..91dab2e 100644 --- a/OG_GUIDE.md +++ b/OG_GUIDE.md @@ -6,30 +6,100 @@ In this guide, I'll go over how to set up the Tumble plugin with the original ga ## Steps -1. Download the worlds and unzip them into your server's main/root directory. **Ensure you download the Java and not the Bedrock versions**! -A huge thanks to *Catmanjoe* for porting these worlds! This game would not be the same without you! - - - [Lobby (2017)](https://www.theminecraftarchitect.com/mini-game-maps/2017-mini-game-lobby) - - [Lobby (2016)](https://www.theminecraftarchitect.com/mini-game-maps/2016-mini-game-lobby) - - [Normal Arena](https://www.planetminecraft.com/project/minecraft-classic-tumble-mode-arena-download-java/) - - [Festive Arena (Download coming soon)]() - - [Halloween Arena (Download coming soon)]() - - [Birthday Arena (Download coming soon)]() -2. Take note of the names of the world folders (you may rename them), we will need this in a moment. +1. Download the worlds and unzip them into your server's worlds directory. + - [Lobby]() + - [Normal Arena]() + - [Festive Arena]() + - [Halloween Arena]() + - [Birthday Arena]() + +2. Take note of the names of the world folders, we will need this in a moment. 3. Start and join your server. -4. Set your lobby spawn by going to the location and running `/tumble-config set lobbySpawn`. In the 2017 console lobby this is at `-341.5 58 -340.5` -5. If you want to have a separate lobby spawn for the winner, set it with `/tumble-config set winnerLobbySpawn`. In the 2017 console lobby this is at `-362.5 76 -340.5` -6. Import your arena world into Multiverse. You can do this by running the command `/mv import normal` -7. Teleport to the arena world. Use `/mvtp `. -8. Now you can create the arena! Do this by going to the spawn location and running `/tumble-config add `. In the console arena this is at `0 60 0` -9. Repeat steps 4, 5 and 6 for each arena -10. Join the game by using `/tumble-join Mixed`(or whichever game mode you want). +4. Import your arena worlds. This can be done with the multiverse command `/mv import normal` + +5. Paste the arena config below into `plugins/tumble/arenas.yml`: + ```yaml + arenas: + basic: + kill-at-y: 24 + game-spawn: + x: 0.5 + y: 60.0 + z: 0.5 + world: tmbl-basic + lobby: + x: -341.5 + y: 58 + z: -340.5 + world: lobby + winner-lobby: + x: -362.5 + y: 76 + Z: -340.5 + world: lobby + birthday: + kill-at-y: 27 + game-spawn: + x: 0.5 + y: 60 + z: 0.5 + world: tmbl-birthday + lobby: + x: -341.5 + y: 58 + z: -340.5 + world: lobby + winner-lobby: + x: -362.5 + y: 76 + Z: -340.5 + world: lobby + festive: + kill-at-y: 20 + game-spawn: + x: 0.5 + y: 60 + z: 0.5 + world: tmbl-festive + lobby: + x: -341.5 + y: 58 + z: -340.5 + world: lobby + winner-lobby: + x: -362.5 + y: 76 + Z: -340.5 + world: lobby + halloween: + kill-at-y: 23 + game-spawn: + x: 0.5 + y: 60 + z: -0.5 + world: tmbl-halloween + lobby: + x: -341.5 + y: 58 + z: -340.5 + world: lobby + winner-lobby: + x: -362.5 + y: 76 + Z: -340.5 + world: lobby + ``` +6. Reload the plugin with `/tmbl reload`. + +7. Join the game by using `/tmbl join basic Mixed` +(swap the arena and game type for whichever one you want to play). You're done! -## Continuation +## Suggestions -With this, the setup for this plugin is complete, but there still may be more for you to do. There are other plugins out there to fine-tune your experience even more. Plugins like [WorldGuard](https://dev.bukkit.org/projects/worldguard) and [CyberWorldReset](https://www.spigotmc.org/resources/cyberworldreset-standard-%E2%9C%A8-regenerate-worlds-scheduled-resets-lag-optimized%E3%80%8C1-8-1-19%E3%80%8D.96834/) can protect players from breaking blocks in the lobby and reset any redstone they activated, while others like [ViaVersion](https://www.spigotmc.org/resources/viaversion.19254/) can allow you to play Tumble from your favorite Minecraft version (yes, you, 1.8.9 players). +With this, the setup for this plugin is complete, but there still may be more for you to do. +There are other plugins out there to fine-tune your experience even more. Plugins like [WorldGuard](https://dev.bukkit.org/projects/worldguard) and [CyberWorldReset](https://www.spigotmc.org/resources/cyberworldreset-standard-%E2%9C%A8-regenerate-worlds-scheduled-resets-lag-optimized%E3%80%8C1-8-1-19%E3%80%8D.96834/) can protect players from breaking blocks in the lobby and reset any redstone they activated, while others like [ViaVersion](https://www.spigotmc.org/resources/viaversion.19254/) can allow you to play Tumble from your favorite Minecraft version (yes, you, 1.8.9 players). Whatever you choose, the experience is up to you. diff --git a/README.md b/README.md index 878e08f..2293d97 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,11 @@ ## temporary stuff (not ready for merge) ### known issues -- [ ] file writing not fully implemented (just need to call ArenaManager.write() somewhere) +- [x] file writing not fully implemented (just need to call ArenaManager.write() somewhere) - [ ] issues with join command - [ ] no config validation ### todo +- [ ] finish og-guide - [ ] improve inventory saving - [ ] improve Game.leave() method - [ ] perhaps replace spectator mode with survival flight @@ -20,7 +21,7 @@ Tumble is a Spigot/Paper plugin that aims to recreate the Tumble minigame from t ## What *is* Tumble? -If you've never heard of it, [Tumble](https://minecraft.wiki/w/tmbl) is a twist on the classic Minecraft minigame of spleef, where the objective is to break the blocks under your opponents. But in Tumble, you play on randomly generated layers of blocks, using shovels, snowballs, or both to try and eliminate your opponents. +If you've never heard of it, [Tumble](https://minecraft.wiki/w/tumble) is a twist on the classic Minecraft minigame of spleef, where the objective is to break the blocks under your opponents. But in Tumble, you play on randomly generated layers of blocks, using shovels, snowballs, or both to try and eliminate your opponents. ## Features @@ -32,37 +33,90 @@ If you've never heard of it, [Tumble](https://minecraft.wiki/w/tmbl) is a twist - Highly customizable - Open-source codebase - Multiple arenas and concurrent games +- Heavily configurable ## Setup -1. Simply [download](https://github.com/MylesAndMore/tmbl/releases) the plugin's JAR file and place it in your server's plugins directory. -2. Load the worlds for your lobby and arenas. - +1. [Download](https://github.com/MylesAndMore/tmbl/releases) the plugin's JAR file and place it in your server's plugins directory. +2. Place the worlds for your lobby and arenas in your plugins worlds directory. - If you would like an experience similar to the original game, see [my guide](https://github.com/MylesAndMore/tmbl/blob/main/OG-GUIDE.md) for using the original worlds. -3. Start your server. The plugin will generate a couple of warnings, these are normal. -4. Ensure that you have imported your worlds using a plugin like Multiverse. This can be done with the command ```/mv import normal```. -5. Now you need to tell Tumble where your lobby is and where your game arena is. You can do this by going to the center positions and running ```/tmbl-config set lobbyWorld``` and ```/tmbl-config add ``` respectively. -6. **VERY IMPORTANT:** The plugin will teleport players to the world and generate the game's blocks around the point you set. Ensure that your spawn points are clear of any obstructions, and that a 20x20x20 cube is cleared out **Any blocks in this area will be destroyed when the game begins.** -7. You're done! You can now start games with the command ```/tmbl start mixed```. +3. Start your server. +4. Import your worlds using a plugin like Multiverse. ```/mv import myWorld normal```. +5. Create your first arena `/tmbl create myArena` + - **Note**: The layers will generate relative to this location. Ensure that the area is clear, 20 blocks in each direction. + +7. You're done! You can now join the game ```/tmbl join myArena mixed```. Scroll down for more options to configure your game. ## Commands / Permissions -| Command | Description | Permission | -|------------------------------------------------|-----------------------------------|---------------------| -| `/tmbl join [gameType]` | Join a Tumble match. | `tumble.join` | -| `/tmbl leave` | Quit a Tumble match. | `tumble.leave` | -| `/tmbl forcestart [arenaName]` | Force start a Tumble match. | `tumble.forcestart` | -| `/tmbl forcestop [arenaName]` | Force stop a Tumble match. | `tumble.forcestop` | -| `/tmbl config ` | Modify arenas and worlds in game. | `tumble.config` | -| `/tmbl reload` | Reload the plugin's config. | `tumble.reload` | +| Command | Description | Permission | +|-------------------------------------|------------------------------------------------------------------------------------|-------------------------| +| `/tmbl join [gameType]` | Join a Tumble match. Can infer game type if a game is already started in the arena | `tumble.join` | +| `/tmbl leave` | Quit a Tumble match | `tumble.leave` | +| `/tmbl forcestart [arenaName]` | Force start a Tumble match. Can infer arena if you are in one | `tumble.forcestart` | +| `/tmbl forcestop [arenaName]` | Force stop a Tumble match. Can infer arena if you are in one | `tumble.forcestop` | +| `/tmbl reload` | Reload the plugin's configs. | `tumble.reload` | +| `/tmbl create ` | Create a new arena | `tumble.create` | +| `/tmbl remove ` | Remove an arena | `tumble.remove` | +| `/tmbl setGameSpawn ` | Set game spawn to your current position | `tumble.setGameSpawn` | +| `/tmbl setKillYLevel ` | Set the arena's Y-level to kill players at to current Y coordinate | `tumble.setKillYLevel` | +| `/tmbl setLobby ` | Set the arena's lobby to current location | `tumble.setLobby` | +| `/tmbl setWaitArea ` | Set the arena's wait area to the current location | `tumble.setWaitArea` | +| `/tmbl setWinnerLobby ` | Set the arena's lobby to the current location | `tumble.setWinnerLobby` | + ## Configuration -Use `/tmbl config` for modifying the config in-game. See available options with the tab auto complete feature +Configuration for this plugin is stored in three files. + +### config.yml +Stores common settings + +| Option | Type | Default value | +|----------------------------|-----------------|---------------| +| `hide-join-leave-messages` | `boolean` | `false` | +| `wait-duration` | `int` (seconds) | `15` | + + +### arenas.yml +Stores data for each arena. You may add and remove arenas as you wish. + +Each arena can contain the following locations: + +| Location | Description | +|--------------------------|-------------------------------------------------------------------------------------| +| `game-spawn` **Required* | The location where players will be teleported, and the layers will generate around. | +| `wait-area` | The location where players will be teleported to before the game begins | +| `lobby` | The location where players will be teleported to after the game | +| `winner-lobby` | The location where the winner will be teleported after the game | + +Locations are stored using the following format: +```yaml + location: + x: 0.5 + y: 100 + z: 0.5 + world: worldName +``` + +Each arena can also contain the following option: + +| Option | Type | Description | +|-------------|--------|-----------------------------------------------------------------| +| `kill-at-y` | double | When a player falls below this Y-level, they will be eliminated | + +### language.yml +Most of this plugin's strings are configurable through this file. (Excluding from some console errors) + +All plugin chat messages will have the `prefix` prepended to them. + +Colors can be added using alternate color codes: +``` +&cRed Text +``` -See the comments inside config,yml for manual editing ## Issues & Feedback diff --git a/src/main/java/com/MylesAndMore/Tumble/Main.java b/src/main/java/com/MylesAndMore/Tumble/Main.java index f098a12..6e2123c 100644 --- a/src/main/java/com/MylesAndMore/Tumble/Main.java +++ b/src/main/java/com/MylesAndMore/Tumble/Main.java @@ -18,9 +18,9 @@ public class Main extends JavaPlugin{ @Override public void onEnable() { plugin = this; - new ArenaManager(); - new ConfigManager(); - new LanguageManager(); + ArenaManager.loadConfig(); + ConfigManager.loadConfig(); + LanguageManager.loadConfig(); Objects.requireNonNull(this.getCommand("tumble")).setExecutor(new Tumble()); new Metrics(this, 16940); diff --git a/src/main/java/com/MylesAndMore/Tumble/commands/Create.java b/src/main/java/com/MylesAndMore/Tumble/commands/Create.java index 3340cc6..aa39db3 100644 --- a/src/main/java/com/MylesAndMore/Tumble/commands/Create.java +++ b/src/main/java/com/MylesAndMore/Tumble/commands/Create.java @@ -33,6 +33,7 @@ public class Create implements SubCommand, CommandExecutor, TabCompleter { String arenaName = args[0]; ArenaManager.arenas.put(arenaName, new Arena(arenaName)); + ArenaManager.WriteConfig(); sender.sendMessage(LanguageManager.fromKey("create-success")); return true; } diff --git a/src/main/java/com/MylesAndMore/Tumble/commands/ForceStart.java b/src/main/java/com/MylesAndMore/Tumble/commands/ForceStart.java index c8042bc..905e5da 100644 --- a/src/main/java/com/MylesAndMore/Tumble/commands/ForceStart.java +++ b/src/main/java/com/MylesAndMore/Tumble/commands/ForceStart.java @@ -38,7 +38,17 @@ public class ForceStart implements SubCommand, CommandExecutor, TabCompleter { } } else { - game = ArenaManager.arenas.get(args[0]).game; + String arenaName = args[0]; + if (!ArenaManager.arenas.containsKey(arenaName)) { + sender.sendMessage(LanguageManager.fromKey("invalid-arena").replace("%arena%",arenaName)); + return false; + } + game = ArenaManager.arenas.get(arenaName).game; + } + + if (game == null) { + sender.sendMessage(LanguageManager.fromKey("no-game-in-arena")); + return false; } game.gameStart(); diff --git a/src/main/java/com/MylesAndMore/Tumble/commands/ForceStop.java b/src/main/java/com/MylesAndMore/Tumble/commands/ForceStop.java index 96e8334..3d98d91 100644 --- a/src/main/java/com/MylesAndMore/Tumble/commands/ForceStop.java +++ b/src/main/java/com/MylesAndMore/Tumble/commands/ForceStop.java @@ -27,7 +27,7 @@ public class ForceStop implements SubCommand, CommandExecutor, TabCompleter { } @Override - public boolean onCommand(CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) { + public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) { Game game; if (args.length < 1 || args[0] == null) { @@ -38,7 +38,12 @@ public class ForceStop implements SubCommand, CommandExecutor, TabCompleter { } } else { - game = ArenaManager.arenas.get(args[0]).game; + String arenaName = args[0]; + if (!ArenaManager.arenas.containsKey(arenaName)) { + sender.sendMessage(LanguageManager.fromKey("invalid-arena").replace("%arena%",arenaName)); + return false; + } + game = ArenaManager.arenas.get(arenaName).game; } if (game == null) { diff --git a/src/main/java/com/MylesAndMore/Tumble/commands/Remove.java b/src/main/java/com/MylesAndMore/Tumble/commands/Remove.java index 118aa77..1d28993 100644 --- a/src/main/java/com/MylesAndMore/Tumble/commands/Remove.java +++ b/src/main/java/com/MylesAndMore/Tumble/commands/Remove.java @@ -38,6 +38,7 @@ public class Remove implements SubCommand, CommandExecutor, TabCompleter { } ArenaManager.arenas.remove(arenaName); + ArenaManager.WriteConfig(); sender.sendMessage(LanguageManager.fromKey("set-success")); return true; } diff --git a/src/main/java/com/MylesAndMore/Tumble/commands/SetGameSpawn.java b/src/main/java/com/MylesAndMore/Tumble/commands/SetGameSpawn.java index 62d22f8..783434c 100644 --- a/src/main/java/com/MylesAndMore/Tumble/commands/SetGameSpawn.java +++ b/src/main/java/com/MylesAndMore/Tumble/commands/SetGameSpawn.java @@ -45,6 +45,7 @@ public class SetGameSpawn implements SubCommand, CommandExecutor, TabCompleter { Arena arena = ArenaManager.arenas.get(arenaName); arena.gameSpawn = ((Player)sender).getLocation(); + ArenaManager.WriteConfig(); sender.sendMessage(LanguageManager.fromKey("set-success")); return true; } diff --git a/src/main/java/com/MylesAndMore/Tumble/commands/SetKillYCordinate.java b/src/main/java/com/MylesAndMore/Tumble/commands/SetKillYCordinate.java deleted file mode 100644 index 0be156f..0000000 --- a/src/main/java/com/MylesAndMore/Tumble/commands/SetKillYCordinate.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.MylesAndMore.Tumble.commands; - -import com.MylesAndMore.Tumble.game.Arena; -import com.MylesAndMore.Tumble.config.LanguageManager; -import com.MylesAndMore.Tumble.config.ArenaManager; -import com.MylesAndMore.Tumble.plugin.SubCommand; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.command.TabCompleter; -import org.bukkit.entity.Player; -import org.jetbrains.annotations.NotNull; - -import java.util.Collections; -import java.util.List; - -public class SetKillYCordinate implements SubCommand, CommandExecutor, TabCompleter { - - @Override - public String getCommandName() { - return "setKillYLevel"; - } - - @Override - public String getPermission() { - return "tumble.setKillYLevel"; - } - - @Override - public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) { - if (!(sender instanceof Player)) { - sender.sendMessage(LanguageManager.fromKey("not-for-console")); - return false; - } - - if (args.length == 0 || args[0] == null || args[0].isEmpty()) { - sender.sendMessage(LanguageManager.fromKey("missing-arena-parameter")); - return false; - } - String arenaName = args[0]; - - if (!ArenaManager.arenas.containsKey(arenaName)) { - sender.sendMessage(LanguageManager.fromKey("invalid-arena").replace("%arena%",arenaName)); - return false; - } - Arena arena = ArenaManager.arenas.get(arenaName); - - arena.killAtY = ((int) ((Player) sender).getLocation().getY()); - sender.sendMessage(LanguageManager.fromKey("set-success")); - return true; - } - - @Override - public List onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) { - if (args.length == 1) { - return ArenaManager.arenas.keySet().stream().toList(); - } - - return Collections.emptyList(); - } -} diff --git a/src/main/java/com/MylesAndMore/Tumble/commands/SetKillYLevel.java b/src/main/java/com/MylesAndMore/Tumble/commands/SetKillYLevel.java new file mode 100644 index 0000000..fec52ea --- /dev/null +++ b/src/main/java/com/MylesAndMore/Tumble/commands/SetKillYLevel.java @@ -0,0 +1,62 @@ +package com.MylesAndMore.Tumble.commands; + +import com.MylesAndMore.Tumble.game.Arena; +import com.MylesAndMore.Tumble.config.LanguageManager; +import com.MylesAndMore.Tumble.config.ArenaManager; +import com.MylesAndMore.Tumble.plugin.SubCommand; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.command.TabCompleter; +import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; + +import java.util.Collections; +import java.util.List; + +public class SetKillYLevel implements SubCommand, CommandExecutor, TabCompleter { + + @Override + public String getCommandName() { + return "setKillYLevel"; + } + + @Override + public String getPermission() { + return "tumble.setKillYLevel"; + } + + @Override + public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) { + if (!(sender instanceof Player)) { + sender.sendMessage(LanguageManager.fromKey("not-for-console")); + return false; + } + + if (args.length == 0 || args[0] == null || args[0].isEmpty()) { + sender.sendMessage(LanguageManager.fromKey("missing-arena-parameter")); + return false; + } + String arenaName = args[0]; + + if (!ArenaManager.arenas.containsKey(arenaName)) { + sender.sendMessage(LanguageManager.fromKey("invalid-arena").replace("%arena%",arenaName)); + return false; + } + Arena arena = ArenaManager.arenas.get(arenaName); + + arena.killAtY = ((int) ((Player) sender).getLocation().getY()); + ArenaManager.WriteConfig(); + sender.sendMessage(LanguageManager.fromKey("set-success")); + return true; + } + + @Override + public List onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) { + if (args.length == 1) { + return ArenaManager.arenas.keySet().stream().toList(); + } + + return Collections.emptyList(); + } +} diff --git a/src/main/java/com/MylesAndMore/Tumble/commands/SetLobby.java b/src/main/java/com/MylesAndMore/Tumble/commands/SetLobby.java index dbb6b53..e50b3e0 100644 --- a/src/main/java/com/MylesAndMore/Tumble/commands/SetLobby.java +++ b/src/main/java/com/MylesAndMore/Tumble/commands/SetLobby.java @@ -45,6 +45,7 @@ public class SetLobby implements SubCommand, CommandExecutor, TabCompleter { Arena arena = ArenaManager.arenas.get(arenaName); arena.lobby = ((Player)sender).getLocation(); + ArenaManager.WriteConfig(); sender.sendMessage(LanguageManager.fromKey("set-success")); return true; } diff --git a/src/main/java/com/MylesAndMore/Tumble/commands/SetWaitArea.java b/src/main/java/com/MylesAndMore/Tumble/commands/SetWaitArea.java index f789658..d251d3f 100644 --- a/src/main/java/com/MylesAndMore/Tumble/commands/SetWaitArea.java +++ b/src/main/java/com/MylesAndMore/Tumble/commands/SetWaitArea.java @@ -45,6 +45,7 @@ public class SetWaitArea implements SubCommand, CommandExecutor, TabCompleter { Arena arena = ArenaManager.arenas.get(arenaName); arena.waitArea = ((Player)sender).getLocation(); + ArenaManager.WriteConfig(); sender.sendMessage(LanguageManager.fromKey("set-success")); return true; } diff --git a/src/main/java/com/MylesAndMore/Tumble/commands/SetWinnerLobby.java b/src/main/java/com/MylesAndMore/Tumble/commands/SetWinnerLobby.java index 01817b0..64a0386 100644 --- a/src/main/java/com/MylesAndMore/Tumble/commands/SetWinnerLobby.java +++ b/src/main/java/com/MylesAndMore/Tumble/commands/SetWinnerLobby.java @@ -45,6 +45,7 @@ public class SetWinnerLobby implements SubCommand, CommandExecutor, TabCompleter Arena arena = ArenaManager.arenas.get(arenaName); arena.winnerLobby = ((Player)sender).getLocation(); + ArenaManager.WriteConfig(); sender.sendMessage(LanguageManager.fromKey("set-success")); return true; } diff --git a/src/main/java/com/MylesAndMore/Tumble/commands/Tumble.java b/src/main/java/com/MylesAndMore/Tumble/commands/Tumble.java index 6e44352..f1d2e38 100644 --- a/src/main/java/com/MylesAndMore/Tumble/commands/Tumble.java +++ b/src/main/java/com/MylesAndMore/Tumble/commands/Tumble.java @@ -21,7 +21,7 @@ public class Tumble implements CommandExecutor, TabCompleter { CmdNameAsKey(new Reload()), CmdNameAsKey(new Remove()), CmdNameAsKey(new SetGameSpawn()), - CmdNameAsKey(new SetKillYCordinate()), + CmdNameAsKey(new SetKillYLevel()), CmdNameAsKey(new SetLobby()), CmdNameAsKey(new SetWaitArea()), CmdNameAsKey(new SetWinnerLobby()) diff --git a/src/main/java/com/MylesAndMore/Tumble/config/ArenaManager.java b/src/main/java/com/MylesAndMore/Tumble/config/ArenaManager.java index 69a6c2c..4d5b782 100644 --- a/src/main/java/com/MylesAndMore/Tumble/config/ArenaManager.java +++ b/src/main/java/com/MylesAndMore/Tumble/config/ArenaManager.java @@ -24,7 +24,7 @@ public class ArenaManager { private static FileConfiguration config; public static HashMap arenas; - public ArenaManager() { + public static void loadConfig() { String fileName = "arenas.yml"; // create config File customConfigFile = new File(plugin.getDataFolder(), fileName); @@ -50,8 +50,6 @@ public class ArenaManager { * Reads config file and populates values above */ public static void readConfig() { - plugin.reloadConfig(); - // arenas ConfigurationSection arenasSection = config.getConfigurationSection("arenas"); if (arenasSection == null) { diff --git a/src/main/java/com/MylesAndMore/Tumble/config/ConfigManager.java b/src/main/java/com/MylesAndMore/Tumble/config/ConfigManager.java index ea7414a..9dfce99 100644 --- a/src/main/java/com/MylesAndMore/Tumble/config/ConfigManager.java +++ b/src/main/java/com/MylesAndMore/Tumble/config/ConfigManager.java @@ -10,12 +10,13 @@ public class ConfigManager { public static boolean HideLeaveJoin; public static int waitDuration; - public ConfigManager() { + public static void loadConfig() { config = plugin.getConfig(); + readConfig(); } public static void readConfig() { - HideLeaveJoin = config.getBoolean("hideJoinLeaveMessages", false); + HideLeaveJoin = config.getBoolean("hide-join-leave-messages", false); waitDuration = config.getInt("wait-duration", 15); } diff --git a/src/main/java/com/MylesAndMore/Tumble/config/LanguageManager.java b/src/main/java/com/MylesAndMore/Tumble/config/LanguageManager.java index c050d3c..dc49aa5 100644 --- a/src/main/java/com/MylesAndMore/Tumble/config/LanguageManager.java +++ b/src/main/java/com/MylesAndMore/Tumble/config/LanguageManager.java @@ -5,7 +5,6 @@ import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; -import java.awt.*; import java.io.File; import java.io.IOException; @@ -14,7 +13,7 @@ import static com.MylesAndMore.Tumble.Main.plugin; public class LanguageManager { private static FileConfiguration config; - public LanguageManager() { + public static void loadConfig() { String fileName = "language.yml"; // create config File customConfigFile = new File(plugin.getDataFolder(), fileName); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 97f0a12..ded50ef 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -1,5 +1,5 @@ # Hides player join/leave messages in public chat -hideJoinLeaveMessages: false +hide-join-leave-messages: false # Duration in seconds to wait for more players to join wait-duration: 15 diff --git a/src/main/resources/language.yml b/src/main/resources/language.yml index fa57b1c..e48023b 100644 --- a/src/main/resources/language.yml +++ b/src/main/resources/language.yml @@ -17,7 +17,7 @@ forcestart-success: "&aStarting game." forcestop-success: "&aGame stopped." join-success: "&aJoined game &d%arena% - %type%" leave-success: "&aLeft game &d%arena% - %type%" -reload-success: "&aConfiguration reloaded. &eCheck console for errors." +reload-success: "&aConfig files reloaded. &eCheck console for errors." remove-success: "&aArena removed." set-success: "&aLocation set." -- cgit v1.2.3