aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/world/anhgelus/molehunt/Molehunt.java13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/main/java/world/anhgelus/molehunt/Molehunt.java b/src/main/java/world/anhgelus/molehunt/Molehunt.java
index 79903e2..4a728a0 100644
--- a/src/main/java/world/anhgelus/molehunt/Molehunt.java
+++ b/src/main/java/world/anhgelus/molehunt/Molehunt.java
@@ -29,7 +29,7 @@ public class Molehunt implements ModInitializer {
public static final String MOD_ID = "molehunt";
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
- public static final Config CONFIG = new Config(MOD_ID);
+ public static Config CONFIG = new Config(MOD_ID);
public Game game;
@@ -81,6 +81,17 @@ public class Molehunt implements ModInitializer {
return Command.SINGLE_SUCCESS;
}));
+ command.then(literal("reload").requires(source -> source.hasPermissionLevel(1)).executes(context -> {
+ if (game != null && game.hasStarted()) {
+ game.end();
+ game = null;
+ }
+ CONFIG = new Config(MOD_ID);
+ context.getSource().getServer().getPlayerManager().getPlayerList().forEach(p -> {
+ ServerPlayNetworking.send(p, new ConfigPayload(CONFIG.showNametags, CONFIG.showSkins, CONFIG.showTab));
+ });
+ return Command.SINGLE_SUCCESS;
+ }));
CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> dispatcher.register(command));