mirror of
https://github.com/SunNetservers/MiniGames.git
synced 2025-04-04 02:36:25 +02:00
Adds a reload command
This commit is contained in:
parent
592f53ec9e
commit
9a56f58f2f
@ -10,6 +10,7 @@ import net.knarcraft.dropper.command.JoinArenaCommand;
|
|||||||
import net.knarcraft.dropper.command.JoinArenaTabCompleter;
|
import net.knarcraft.dropper.command.JoinArenaTabCompleter;
|
||||||
import net.knarcraft.dropper.command.LeaveArenaCommand;
|
import net.knarcraft.dropper.command.LeaveArenaCommand;
|
||||||
import net.knarcraft.dropper.command.ListArenaCommand;
|
import net.knarcraft.dropper.command.ListArenaCommand;
|
||||||
|
import net.knarcraft.dropper.command.ReloadCommand;
|
||||||
import net.knarcraft.dropper.command.RemoveArenaCommand;
|
import net.knarcraft.dropper.command.RemoveArenaCommand;
|
||||||
import net.knarcraft.dropper.command.RemoveArenaTabCompleter;
|
import net.knarcraft.dropper.command.RemoveArenaTabCompleter;
|
||||||
import net.knarcraft.dropper.container.SerializableMaterial;
|
import net.knarcraft.dropper.container.SerializableMaterial;
|
||||||
@ -65,6 +66,14 @@ public final class Dropper extends JavaPlugin {
|
|||||||
return this.playerRegistry;
|
return this.playerRegistry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reloads all configurations and data from disk
|
||||||
|
*/
|
||||||
|
public void reload() {
|
||||||
|
// Load all arenas again
|
||||||
|
this.arenaHandler.loadArenas();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoad() {
|
public void onLoad() {
|
||||||
super.onLoad();
|
super.onLoad();
|
||||||
@ -97,6 +106,7 @@ public final class Dropper extends JavaPlugin {
|
|||||||
pluginManager.registerEvents(new MoveListener(), this);
|
pluginManager.registerEvents(new MoveListener(), this);
|
||||||
pluginManager.registerEvents(new PlayerLeaveListener(), this);
|
pluginManager.registerEvents(new PlayerLeaveListener(), this);
|
||||||
|
|
||||||
|
registerCommand("dropperreload", new ReloadCommand(), null);
|
||||||
registerCommand("droppercreate", new CreateArenaCommand(), null);
|
registerCommand("droppercreate", new CreateArenaCommand(), null);
|
||||||
registerCommand("dropperlist", new ListArenaCommand(), null);
|
registerCommand("dropperlist", new ListArenaCommand(), null);
|
||||||
registerCommand("dropperjoin", new JoinArenaCommand(), new JoinArenaTabCompleter());
|
registerCommand("dropperjoin", new JoinArenaCommand(), new JoinArenaTabCompleter());
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
package net.knarcraft.dropper.command;
|
||||||
|
|
||||||
|
import net.knarcraft.dropper.Dropper;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.command.TabExecutor;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The command for reloading the plugin
|
||||||
|
*/
|
||||||
|
public class ReloadCommand implements TabExecutor {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s,
|
||||||
|
@NotNull String[] arguments) {
|
||||||
|
Dropper.getInstance().reload();
|
||||||
|
commandSender.sendMessage("Plugin reloaded!");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public List<String> onTabComplete(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s,
|
||||||
|
@NotNull String[] arguments) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -5,6 +5,12 @@ api-version: 1.19
|
|||||||
description: A plugin for dropper mini-games
|
description: A plugin for dropper mini-games
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
|
dropperreload:
|
||||||
|
aliases:
|
||||||
|
- dreload
|
||||||
|
permission: dropper.admin
|
||||||
|
usage: /<command>
|
||||||
|
description: Reloads all data from disk
|
||||||
dropperlist:
|
dropperlist:
|
||||||
aliases:
|
aliases:
|
||||||
- dlist
|
- dlist
|
||||||
|
Loading…
x
Reference in New Issue
Block a user