mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-02 00:30:07 +01:00
Okay, lets fix everything that depended on Permissions
This commit is contained in:
parent
5645c29dd8
commit
11e1dc7ec8
@ -23,7 +23,12 @@ public class AddxpCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (!mcPermissions.permissionsEnabled) {
|
||||
Player player = null;
|
||||
if (sender instanceof Player) {
|
||||
player = (Player) sender;
|
||||
}
|
||||
|
||||
if (player != null && !mcPermissions.getInstance().mmoedit(player)) {
|
||||
sender.sendMessage("This command requires permissions.");
|
||||
return true;
|
||||
}
|
||||
@ -55,8 +60,6 @@ public class AddxpCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
|
||||
if (!mcPermissions.getInstance().mmoedit(player)) {
|
||||
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
|
||||
return true;
|
||||
|
@ -24,7 +24,7 @@ public class MmoeditCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (!mcPermissions.permissionsEnabled) {
|
||||
if (!mcPermissions.getInstance().mmoedit((Player) sender)) {
|
||||
sender.sendMessage("This command requires permissions.");
|
||||
return true;
|
||||
}
|
||||
|
@ -33,7 +33,6 @@ public class StatsCommand implements CommandExecutor {
|
||||
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.YourStats"));
|
||||
|
||||
if (mcPermissions.getEnabled())
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.NoSkillNote"));
|
||||
|
||||
ChatColor header = ChatColor.GOLD;
|
||||
|
@ -6,7 +6,6 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.Users;
|
||||
import com.gmail.nossr50.mcPermissions;
|
||||
import com.gmail.nossr50.config.LoadProperties;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
@ -14,7 +13,12 @@ import com.gmail.nossr50.locale.mcLocale;
|
||||
public class McabilityCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (!mcPermissions.permissionsEnabled) {
|
||||
Player player = null;
|
||||
if (sender instanceof Player) {
|
||||
player = (Player) sender;
|
||||
}
|
||||
|
||||
if (player != null && player.hasPermission("mcmmo.commands.ability")) {
|
||||
sender.sendMessage("This command requires permissions.");
|
||||
return true;
|
||||
}
|
||||
@ -29,7 +33,6 @@ public class McabilityCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
if (PP.getAbilityUse()) {
|
||||
|
@ -28,12 +28,12 @@ public class McgodCommand implements CommandExecutor {
|
||||
Player player = (Player) sender;
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
if (mcPermissions.permissionsEnabled) {
|
||||
if (!mcPermissions.getInstance().mcgod(player)) {
|
||||
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mcPermissions.getInstance().mcgod(player)) {
|
||||
if (PP.getGodMode()) {
|
||||
player.sendMessage(mcLocale.getString("mcPlayerListener.GodModeDisabled"));
|
||||
PP.toggleGodMode();
|
||||
|
@ -31,7 +31,7 @@ public class XplockCommand implements CommandExecutor {
|
||||
Player player = (Player) sender;
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
|
||||
if (args.length >= 1 && Skills.isSkill(args[0]) && mcPermissions.permission(player, "mcmmo.skills." + Skills.getSkillType(args[0]).toString().toLowerCase())) {
|
||||
if (args.length >= 1 && Skills.isSkill(args[0]) && mcPermissions.getInstance().permission(player, "mcmmo.skills." + Skills.getSkillType(args[0]).toString().toLowerCase())) {
|
||||
if (PP.getXpBarLocked()) {
|
||||
PP.setSkillLock(Skills.getSkillType(args[0]));
|
||||
player.sendMessage(mcLocale.getString("Commands.xplock.locked", new Object[] { m.getCapitalized(PP.getSkillLock().toString()) }));
|
||||
@ -52,7 +52,7 @@ public class XplockCommand implements CommandExecutor {
|
||||
}
|
||||
} else if (args.length >= 1 && !Skills.isSkill(args[0])) {
|
||||
player.sendMessage("Commands.xplock.invalid");
|
||||
} else if (args.length >= 2 && Skills.isSkill(args[0]) && !mcPermissions.permission(player, "mcmmo.skills." + Skills.getSkillType(args[0]).toString().toLowerCase())) {
|
||||
} else if (args.length >= 2 && Skills.isSkill(args[0]) && !mcPermissions.getInstance().permission(player, "mcmmo.skills." + Skills.getSkillType(args[0]).toString().toLowerCase())) {
|
||||
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
|
||||
return true;
|
||||
}
|
||||
|
@ -25,10 +25,8 @@ public class mcPermissions
|
||||
{
|
||||
private static volatile mcPermissions instance;
|
||||
|
||||
|
||||
public static void initialize(Server server)
|
||||
{
|
||||
Logger log = Logger.getLogger("Minecraft");
|
||||
public boolean permission(Player player, String perm) {
|
||||
return player.hasPermission(perm);
|
||||
}
|
||||
|
||||
public boolean admin(Player player){
|
||||
|
Loading…
Reference in New Issue
Block a user