mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Check the perms for these commands in the commands, otherwise they don't
work in console because they don't default to OP. Fixes #715
This commit is contained in:
parent
886515400d
commit
213b4763e7
@ -253,7 +253,6 @@ public final class CommandRegistrationHelper {
|
|||||||
public static void registerMcpurgeCommand() {
|
public static void registerMcpurgeCommand() {
|
||||||
PluginCommand command = mcMMO.p.getCommand("mcpurge");
|
PluginCommand command = mcMMO.p.getCommand("mcpurge");
|
||||||
command.setDescription(LocaleLoader.getString("Commands.Description.mcpurge", Config.getInstance().getOldUsersCutoff()));
|
command.setDescription(LocaleLoader.getString("Commands.Description.mcpurge", Config.getInstance().getOldUsersCutoff()));
|
||||||
command.setPermission("mcmmo.commands.mcpurge");
|
|
||||||
command.setPermissionMessage(permissionsMessage);
|
command.setPermissionMessage(permissionsMessage);
|
||||||
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "mcpurge"));
|
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "mcpurge"));
|
||||||
command.setExecutor(new McpurgeCommand());
|
command.setExecutor(new McpurgeCommand());
|
||||||
@ -262,7 +261,6 @@ public final class CommandRegistrationHelper {
|
|||||||
public static void registerMcremoveCommand() {
|
public static void registerMcremoveCommand() {
|
||||||
PluginCommand command = mcMMO.p.getCommand("mcremove");
|
PluginCommand command = mcMMO.p.getCommand("mcremove");
|
||||||
command.setDescription(LocaleLoader.getString("Commands.Description.mcremove"));
|
command.setDescription(LocaleLoader.getString("Commands.Description.mcremove"));
|
||||||
command.setPermission("mcmmo.commands.mcremove");
|
|
||||||
command.setPermissionMessage(permissionsMessage);
|
command.setPermissionMessage(permissionsMessage);
|
||||||
command.setUsage(LocaleLoader.getString("Commands.Usage.1", "mcremove", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">"));
|
command.setUsage(LocaleLoader.getString("Commands.Usage.1", "mcremove", "<" + LocaleLoader.getString("Commands.Usage.Player") + ">"));
|
||||||
command.setExecutor(new McremoveCommand());
|
command.setExecutor(new McremoveCommand());
|
||||||
@ -271,7 +269,6 @@ public final class CommandRegistrationHelper {
|
|||||||
public static void registerMmoupdateCommand() {
|
public static void registerMmoupdateCommand() {
|
||||||
PluginCommand command = mcMMO.p.getCommand("mmoupdate");
|
PluginCommand command = mcMMO.p.getCommand("mmoupdate");
|
||||||
command.setDescription(LocaleLoader.getString("Commands.Description.mmoupdate"));
|
command.setDescription(LocaleLoader.getString("Commands.Description.mmoupdate"));
|
||||||
command.setPermission("mcmmo.commands.mmoupdate");
|
|
||||||
command.setPermissionMessage(permissionsMessage);
|
command.setPermissionMessage(permissionsMessage);
|
||||||
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "mmoupdate"));
|
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "mmoupdate"));
|
||||||
command.setExecutor(new MmoupdateCommand());
|
command.setExecutor(new MmoupdateCommand());
|
||||||
|
@ -8,10 +8,16 @@ import com.gmail.nossr50.config.Config;
|
|||||||
import com.gmail.nossr50.database.Database;
|
import com.gmail.nossr50.database.Database;
|
||||||
import com.gmail.nossr50.database.Leaderboard;
|
import com.gmail.nossr50.database.Leaderboard;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
|
import com.gmail.nossr50.util.Permissions;
|
||||||
|
|
||||||
public class McpurgeCommand implements CommandExecutor{
|
public class McpurgeCommand implements CommandExecutor{
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
|
if (!Permissions.mcpurge(sender)) {
|
||||||
|
sender.sendMessage(command.getPermissionMessage());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 0:
|
case 0:
|
||||||
if (Config.getInstance().getUseMySQL()) {
|
if (Config.getInstance().getUseMySQL()) {
|
||||||
|
@ -8,10 +8,16 @@ import com.gmail.nossr50.config.Config;
|
|||||||
import com.gmail.nossr50.database.Database;
|
import com.gmail.nossr50.database.Database;
|
||||||
import com.gmail.nossr50.database.Leaderboard;
|
import com.gmail.nossr50.database.Leaderboard;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
|
import com.gmail.nossr50.util.Permissions;
|
||||||
|
|
||||||
public class McremoveCommand implements CommandExecutor {
|
public class McremoveCommand implements CommandExecutor {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
|
if (!Permissions.mcremove(sender)) {
|
||||||
|
sender.sendMessage(command.getPermissionMessage());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 1:
|
case 1:
|
||||||
/* MySQL */
|
/* MySQL */
|
||||||
|
@ -9,11 +9,17 @@ import com.gmail.nossr50.mcMMO;
|
|||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.database.runnables.SQLConversionTask;
|
import com.gmail.nossr50.database.runnables.SQLConversionTask;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.Users;
|
import com.gmail.nossr50.util.Users;
|
||||||
|
|
||||||
public class MmoupdateCommand implements CommandExecutor {
|
public class MmoupdateCommand implements CommandExecutor {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
|
if (!Permissions.mmoupdate(sender)) {
|
||||||
|
sender.sendMessage(command.getPermissionMessage());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 0:
|
case 0:
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.mmoupdate.Start"));
|
sender.sendMessage(LocaleLoader.getString("Commands.mmoupdate.Start"));
|
||||||
|
@ -83,6 +83,10 @@ public final class Permissions {
|
|||||||
public static boolean vampirismModify(Permissible permissible) { return permissible.hasPermission("mcmmo.commands.vampirism.modify"); }
|
public static boolean vampirismModify(Permissible permissible) { return permissible.hasPermission("mcmmo.commands.vampirism.modify"); }
|
||||||
public static boolean vampirismToggle(Permissible permissible) { return permissible.hasPermission("mcmmo.commands.vampirism.toggle"); }
|
public static boolean vampirismToggle(Permissible permissible) { return permissible.hasPermission("mcmmo.commands.vampirism.toggle"); }
|
||||||
|
|
||||||
|
public static boolean mcpurge(Permissible permissible) { return permissible.hasPermission("mcmmo.commands.mcpurge"); }
|
||||||
|
public static boolean mcremove(Permissible permissible) { return permissible.hasPermission("mcmmo.commands.mcremove"); }
|
||||||
|
public static boolean mmoupdate(Permissible permissible) { return permissible.hasPermission("mcmmo.commands.mmoupdate"); }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* PERKS
|
* PERKS
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user