Makes a whole lot of changes
Adds some new tests Improves plugin command handling by using one class for each command Makes some changes to vehicle teleportation to support horses and pigs, but vehicle teleportation is still buggy and messy Adds some more missing comments Adds a wildcard permission and uses built-in permissions some places to avoid checking for three different permissions
This commit is contained in:
@ -0,0 +1,39 @@
|
||||
package net.knarcraft.stargate.command;
|
||||
|
||||
import net.knarcraft.stargate.Stargate;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* This command represents the plugin's reload command
|
||||
*/
|
||||
public class CommandReload implements CommandExecutor {
|
||||
|
||||
private Stargate plugin;
|
||||
|
||||
/**
|
||||
* Instantiates the reload command
|
||||
* @param plugin <p>A reference to the calling plugin object</p>
|
||||
*/
|
||||
public CommandReload(Stargate plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s,
|
||||
@NotNull String[] strings) {
|
||||
if (commandSender instanceof Player) {
|
||||
Player player = (Player) commandSender;
|
||||
if (!player.hasPermission("stargate.reload")) {
|
||||
Stargate.sendMessage(commandSender, "Permission Denied");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
plugin.reload(commandSender);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user