diff --git a/paper-api/src/main/java/org/bukkit/Server.java b/paper-api/src/main/java/org/bukkit/Server.java index b980366549..be8da67181 100644 --- a/paper-api/src/main/java/org/bukkit/Server.java +++ b/paper-api/src/main/java/org/bukkit/Server.java @@ -88,4 +88,9 @@ public interface Server { * @param time The time to set the in-game time to (in hours*1000) */ public void setTime(long time); + + /** + * Reloads the server, refreshing settings and plugin information + */ + public void reload(); } diff --git a/paper-api/src/main/java/org/bukkit/command/SimpleCommandMap.java b/paper-api/src/main/java/org/bukkit/command/SimpleCommandMap.java index 3858408176..b83d110432 100644 --- a/paper-api/src/main/java/org/bukkit/command/SimpleCommandMap.java +++ b/paper-api/src/main/java/org/bukkit/command/SimpleCommandMap.java @@ -4,12 +4,39 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import org.bukkit.ChatColor; +import org.bukkit.Server; import org.bukkit.entity.Player; public final class SimpleCommandMap implements CommandMap { private final Map knownCommands = new HashMap(); + public SimpleCommandMap(final Server server) { + register("version", "bukkit", new Command("version") { + @Override + public boolean execute(Player player, String currentAlias, String[] args) { + player.sendMessage("This server is using some funky dev build of Bukkit!"); + return true; + } + }); + + register("reload", "bukkit", new Command("reload") { + @Override + public boolean execute(Player player, String currentAlias, String[] args) { + if (player.isOp()) { + server.reload(); + player.sendMessage(ChatColor.GREEN + "Reload complete."); + } else { + player.sendMessage(ChatColor.RED + "You do not have sufficient access" + + " to reload this server."); + } + + return true; + } + }); + } + /** * Registers multiple commands. Returns name of first command for which fallback had to be used if any. * @param plugin