mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 22:56:45 +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
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
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.");
|
sender.sendMessage("This command requires permissions.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -55,8 +60,6 @@ public class AddxpCommand implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player player = (Player) sender;
|
|
||||||
|
|
||||||
if (!mcPermissions.getInstance().mmoedit(player)) {
|
if (!mcPermissions.getInstance().mmoedit(player)) {
|
||||||
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
|
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
|
||||||
return true;
|
return true;
|
||||||
|
@ -24,7 +24,7 @@ public class MmoeditCommand 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 (!mcPermissions.permissionsEnabled) {
|
if (!mcPermissions.getInstance().mmoedit((Player) sender)) {
|
||||||
sender.sendMessage("This command requires permissions.");
|
sender.sendMessage("This command requires permissions.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -33,8 +33,7 @@ public class StatsCommand implements CommandExecutor {
|
|||||||
|
|
||||||
player.sendMessage(mcLocale.getString("mcPlayerListener.YourStats"));
|
player.sendMessage(mcLocale.getString("mcPlayerListener.YourStats"));
|
||||||
|
|
||||||
if (mcPermissions.getEnabled())
|
player.sendMessage(mcLocale.getString("mcPlayerListener.NoSkillNote"));
|
||||||
player.sendMessage(mcLocale.getString("mcPlayerListener.NoSkillNote"));
|
|
||||||
|
|
||||||
ChatColor header = ChatColor.GOLD;
|
ChatColor header = ChatColor.GOLD;
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gmail.nossr50.Users;
|
import com.gmail.nossr50.Users;
|
||||||
import com.gmail.nossr50.mcPermissions;
|
|
||||||
import com.gmail.nossr50.config.LoadProperties;
|
import com.gmail.nossr50.config.LoadProperties;
|
||||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||||
import com.gmail.nossr50.locale.mcLocale;
|
import com.gmail.nossr50.locale.mcLocale;
|
||||||
@ -14,7 +13,12 @@ import com.gmail.nossr50.locale.mcLocale;
|
|||||||
public class McabilityCommand implements CommandExecutor {
|
public class McabilityCommand 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 (!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.");
|
sender.sendMessage("This command requires permissions.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -29,7 +33,6 @@ public class McabilityCommand implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player player = (Player) sender;
|
|
||||||
PlayerProfile PP = Users.getProfile(player);
|
PlayerProfile PP = Users.getProfile(player);
|
||||||
|
|
||||||
if (PP.getAbilityUse()) {
|
if (PP.getAbilityUse()) {
|
||||||
|
@ -28,12 +28,12 @@ public class McgodCommand implements CommandExecutor {
|
|||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
PlayerProfile PP = Users.getProfile(player);
|
PlayerProfile PP = Users.getProfile(player);
|
||||||
|
|
||||||
if (mcPermissions.permissionsEnabled) {
|
if (!mcPermissions.getInstance().mcgod(player)) {
|
||||||
if (!mcPermissions.getInstance().mcgod(player)) {
|
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
|
||||||
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
|
return true;
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
if (mcPermissions.getInstance().mcgod(player)) {
|
||||||
if (PP.getGodMode()) {
|
if (PP.getGodMode()) {
|
||||||
player.sendMessage(mcLocale.getString("mcPlayerListener.GodModeDisabled"));
|
player.sendMessage(mcLocale.getString("mcPlayerListener.GodModeDisabled"));
|
||||||
PP.toggleGodMode();
|
PP.toggleGodMode();
|
||||||
|
@ -31,7 +31,7 @@ public class XplockCommand implements CommandExecutor {
|
|||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
PlayerProfile PP = Users.getProfile(player);
|
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()) {
|
if (PP.getXpBarLocked()) {
|
||||||
PP.setSkillLock(Skills.getSkillType(args[0]));
|
PP.setSkillLock(Skills.getSkillType(args[0]));
|
||||||
player.sendMessage(mcLocale.getString("Commands.xplock.locked", new Object[] { m.getCapitalized(PP.getSkillLock().toString()) }));
|
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])) {
|
} else if (args.length >= 1 && !Skills.isSkill(args[0])) {
|
||||||
player.sendMessage("Commands.xplock.invalid");
|
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"));
|
player.sendMessage(ChatColor.YELLOW + "[mcMMO] " + ChatColor.DARK_RED + mcLocale.getString("mcPlayerListener.NoPermission"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -24,11 +24,9 @@ import org.bukkit.entity.Player;
|
|||||||
public class mcPermissions
|
public class mcPermissions
|
||||||
{
|
{
|
||||||
private static volatile mcPermissions instance;
|
private static volatile mcPermissions instance;
|
||||||
|
|
||||||
|
public boolean permission(Player player, String perm) {
|
||||||
public static void initialize(Server server)
|
return player.hasPermission(perm);
|
||||||
{
|
|
||||||
Logger log = Logger.getLogger("Minecraft");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean admin(Player player){
|
public boolean admin(Player player){
|
||||||
|
Loading…
Reference in New Issue
Block a user