mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 15:16:45 +01:00
More command cleaning.
This commit is contained in:
parent
74ee210514
commit
bf361f6824
@ -1,44 +1,37 @@
|
||||
package com.gmail.nossr50.commands.mc;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.commands.CommandHelper;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
|
||||
public class McabilityCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
Player player = null;
|
||||
if (sender instanceof Player) {
|
||||
player = (Player) sender;
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (CommandHelper.noConsoleUsage(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (player != null && !mcPermissions.getInstance().mcAbility(player)) {
|
||||
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
|
||||
return true;
|
||||
}
|
||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.admin")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage("This command does not support console useage."); //TODO: Needs more locale.
|
||||
return true;
|
||||
}
|
||||
PlayerProfile PP = Users.getProfile((Player) sender);
|
||||
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
if (PP.getAbilityUse()) {
|
||||
sender.sendMessage(mcLocale.getString("mcPlayerListener.AbilitiesOff"));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(mcLocale.getString("mcPlayerListener.AbilitiesOn"));
|
||||
}
|
||||
|
||||
if (PP.getAbilityUse()) {
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.AbilitiesOff"));
|
||||
PP.toggleAbilityUse();
|
||||
} else {
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.AbilitiesOn"));
|
||||
PP.toggleAbilityUse();
|
||||
}
|
||||
PP.toggleAbilityUse();
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user