public static boolean canSetClass(AncientRPGClass newClass, final Player p) { PlayerData pd = PlayerData.getPlayerData(p.getName()); if (AncientRPGExperience.isEnabled() && AncientRPGExperience.isWorldEnabled(p)) { if (pd.getXpSystem().level < newClass.minlevel) { p.sendMessage( AncientRPG.brand2 + "You need to be level " + newClass.minlevel + " to join this class"); return false; } } if (!newClass.isWorldEnabled(p)) { return false; } if (newClass.preclass != null && !newClass.preclass.equals("") && !newClass.preclass.toLowerCase().equals(pd.getClassName().toLowerCase())) { return false; } AncientRPGRace race = AncientRPGRace.getRaceByName(PlayerData.getPlayerData(p.getName()).getRacename()); if (newClass.requiredraces.size() >= 0 && (race != null && !newClass.requiredraces.contains(race.name.toLowerCase()))) { return false; } if (!(newClass.permissionNode == null || newClass.permissionNode.equalsIgnoreCase("")) && !AncientRPG.hasPermissions(p, newClass.permissionNode)) { return false; } return AncientRPG.hasPermissions(p, AncientRPGClass.cNodeClass); }
public static boolean senderHasPermissions(CommandSender cs, String perm) { return ((cs instanceof ConsoleCommandSender || cs instanceof RemoteConsoleCommandSender) || (cs instanceof Player && AncientRPG.hasPermissions((Player) cs, perm))); }
public static boolean senderHasAdminPermissions(CommandSender cs) { return ((cs instanceof ConsoleCommandSender || cs instanceof RemoteConsoleCommandSender) || (cs instanceof Player && AncientRPG.hasPermissions((Player) cs, "AncientRPG.classes.admin"))); }