mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-23 18:55:11 +01:00
Replaced code that used legacy deprecated permissions methods
This commit is contained in:
parent
33ca2691b2
commit
3500ee6fb7
@ -642,7 +642,7 @@ public class AuthMe extends JavaPlugin {
|
||||
public Player generateKickPlayer(Collection<? extends Player> collection) {
|
||||
Player player = null;
|
||||
for (Player p : collection) {
|
||||
if (!(authmePermissible(p, "authme.vip"))) {
|
||||
if (!getPermissionsManager().hasPermission(p, "authme.vip")) {
|
||||
player = p;
|
||||
break;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ public class ForceLoginCommand extends ExecutableCommand {
|
||||
sender.sendMessage("Player needs to be online!");
|
||||
return true;
|
||||
}
|
||||
if (!plugin.authmePermissible(player, "authme.canbeforced")) {
|
||||
if (!plugin.getPermissionsManager().hasPermission(player, "authme.canbeforced")) {
|
||||
sender.sendMessage("You cannot force login for the player " + playerName + "!");
|
||||
return true;
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ public class HelpPrinter {
|
||||
for(String node : permissions.getPermissionNodes()) {
|
||||
boolean nodePermission = true;
|
||||
if(sender instanceof Player)
|
||||
nodePermission = AuthMe.getInstance().authmePermissible((Player) sender, node);
|
||||
nodePermission = AuthMe.getInstance().getPermissionsManager().hasPermission((Player) sender, node);
|
||||
final String nodePermsString = ChatColor.GRAY + (nodePermission ? ChatColor.ITALIC + " (Permission!)" : ChatColor.ITALIC + " (No Permission!)");
|
||||
sender.sendMessage(" " + ChatColor.YELLOW + ChatColor.ITALIC + node + nodePermsString);
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
|
||||
import fr.xephi.authme.permission.PermissionsManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
@ -165,7 +166,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
private void checkAntiBotMod(final Player player) {
|
||||
if (plugin.delayedAntiBot || plugin.antibotMod)
|
||||
return;
|
||||
if (plugin.authmePermissible(player, "authme.bypassantibot"))
|
||||
if (plugin.getPermissionsManager().hasPermission(player, "authme.bypassantibot"))
|
||||
return;
|
||||
if (antibot.size() > Settings.antiBotSensibility) {
|
||||
plugin.switchAntiBotMod(true);
|
||||
@ -265,8 +266,11 @@ public class AuthMePlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the permissions manager
|
||||
PermissionsManager permsMan = plugin.getPermissionsManager();
|
||||
|
||||
boolean isAuthAvailable = plugin.database.isAuthAvailable(name);
|
||||
if (!Settings.countriesBlacklist.isEmpty() && !isAuthAvailable && !plugin.authmePermissible(player, "authme.bypassantibot")) {
|
||||
if (!Settings.countriesBlacklist.isEmpty() && !isAuthAvailable && !permsMan.hasPermission(player, "authme.bypassantibot")) {
|
||||
String code = Utils.getCountryCode(event.getAddress().getHostAddress());
|
||||
if (((code == null) || Settings.countriesBlacklist.contains(code))) {
|
||||
event.setKickMessage(m.send("country_banned")[0]);
|
||||
@ -274,7 +278,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (Settings.enableProtection && !Settings.countries.isEmpty() && !isAuthAvailable && !plugin.authmePermissible(player, "authme.bypassantibot")) {
|
||||
if (Settings.enableProtection && !Settings.countries.isEmpty() && !isAuthAvailable && !permsMan.hasPermission(player, "authme.bypassantibot")) {
|
||||
String code = Utils.getCountryCode(event.getAddress().getHostAddress());
|
||||
if (((code == null) || !Settings.countries.contains(code))) {
|
||||
event.setKickMessage(m.send("country_banned")[0]);
|
||||
@ -343,7 +347,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
}
|
||||
if (event.getResult() != PlayerLoginEvent.Result.KICK_FULL)
|
||||
return;
|
||||
if (!plugin.authmePermissible(player, "authme.vip")) {
|
||||
if (!permsMan.hasPermission(player, "authme.vip")) {
|
||||
event.setKickMessage(m.send("kick_fullserver")[0]);
|
||||
event.setResult(PlayerLoginEvent.Result.KICK_FULL);
|
||||
return;
|
||||
@ -510,7 +514,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
Player player = event.getPlayer();
|
||||
if (player == null)
|
||||
return;
|
||||
if (plugin.authmePermissible(player, "authme.bypassforcesurvival"))
|
||||
if (plugin.getPermissionsManager().hasPermission(player, "authme.bypassforcesurvival"))
|
||||
return;
|
||||
if (Utils.checkAuth(player))
|
||||
return;
|
||||
|
@ -38,7 +38,7 @@ public class AsyncChangeEmail {
|
||||
String playerName = player.getName().toLowerCase();
|
||||
|
||||
if (Settings.getmaxRegPerEmail > 0) {
|
||||
if (!plugin.authmePermissible(player, "authme.allow2accounts") && plugin.database.getAllAuthsByEmail(newEmail).size() >= Settings.getmaxRegPerEmail) {
|
||||
if (!plugin.getPermissionsManager().hasPermission(player, "authme.allow2accounts") && plugin.database.getAllAuthsByEmail(newEmail).size() >= Settings.getmaxRegPerEmail) {
|
||||
m.send(player, "max_reg");
|
||||
return;
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ public class AsyncronousJoin {
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (Settings.getMaxJoinPerIp > 0 && !plugin.authmePermissible(player, "authme.allow2accounts") && !ip.equalsIgnoreCase("127.0.0.1") && !ip.equalsIgnoreCase("localhost")) {
|
||||
if (Settings.getMaxJoinPerIp > 0 && !plugin.getPermissionsManager().hasPermission(player, "authme.allow2accounts") && !ip.equalsIgnoreCase("127.0.0.1") && !ip.equalsIgnoreCase("localhost")) {
|
||||
if (plugin.hasJoinedIp(player.getName(), ip)) {
|
||||
sched.scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||
|
||||
|
@ -96,7 +96,7 @@ public class AsyncronousLogin {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
if (Settings.getMaxLoginPerIp > 0 && !plugin.authmePermissible(player, "authme.allow2accounts") && !getIP().equalsIgnoreCase("127.0.0.1") && !getIP().equalsIgnoreCase("localhost")) {
|
||||
if (Settings.getMaxLoginPerIp > 0 && !plugin.getPermissionsManager().hasPermission(player, "authme.allow2accounts") && !getIP().equalsIgnoreCase("127.0.0.1") && !getIP().equalsIgnoreCase("localhost")) {
|
||||
if (plugin.isLoggedIp(name, getIP())) {
|
||||
m.send(player, "logged_in");
|
||||
return null;
|
||||
@ -236,7 +236,7 @@ public class AsyncronousLogin {
|
||||
* uuidaccounts + "."; } }
|
||||
*/
|
||||
for (Player player : Utils.getOnlinePlayers()) {
|
||||
if (plugin.authmePermissible(player, "authme.seeOtherAccounts")) {
|
||||
if (plugin.getPermissionsManager().hasPermission(player, "authme.seeOtherAccounts")) {
|
||||
player.sendMessage("[AuthMe] The player " + auth.getNickname() + " has " + auths.size() + " accounts");
|
||||
player.sendMessage(message.toString());
|
||||
// player.sendMessage(uuidaccounts.replace("%size%",
|
||||
|
@ -62,7 +62,7 @@ public class AsyncRegister {
|
||||
m.send(player, "user_regged");
|
||||
return false;
|
||||
} else if (Settings.getmaxRegPerIp > 0) {
|
||||
if (!plugin.authmePermissible(player, "authme.allow2accounts") && database.getAllAuthsByIp(getIp()).size() >= Settings.getmaxRegPerIp && !getIp().equalsIgnoreCase("127.0.0.1") && !getIp().equalsIgnoreCase("localhost")) {
|
||||
if (!plugin.getPermissionsManager().hasPermission(player, "authme.allow2accounts") && database.getAllAuthsByIp(getIp()).size() >= Settings.getmaxRegPerIp && !getIp().equalsIgnoreCase("127.0.0.1") && !getIp().equalsIgnoreCase("localhost")) {
|
||||
m.send(player, "max_reg");
|
||||
return false;
|
||||
}
|
||||
@ -76,7 +76,7 @@ public class AsyncRegister {
|
||||
return;
|
||||
if (!email.isEmpty() && !email.equals("")) {
|
||||
if (Settings.getmaxRegPerEmail > 0) {
|
||||
if (!plugin.authmePermissible(player, "authme.allow2accounts") && database.getAllAuthsByEmail(email).size() >= Settings.getmaxRegPerEmail) {
|
||||
if (!plugin.getPermissionsManager().hasPermission(player, "authme.allow2accounts") && database.getAllAuthsByEmail(email).size() >= Settings.getmaxRegPerEmail) {
|
||||
m.send(player, "max_reg");
|
||||
return;
|
||||
}
|
||||
@ -94,7 +94,7 @@ public class AsyncRegister {
|
||||
|
||||
protected void emailRegister() throws Exception {
|
||||
if (Settings.getmaxRegPerEmail > 0) {
|
||||
if (!plugin.authmePermissible(player, "authme.allow2accounts") && database.getAllAuthsByEmail(email).size() >= Settings.getmaxRegPerEmail) {
|
||||
if (!plugin.getPermissionsManager().hasPermission(player, "authme.allow2accounts") && database.getAllAuthsByEmail(email).size() >= Settings.getmaxRegPerEmail) {
|
||||
m.send(player, "max_reg");
|
||||
return;
|
||||
}
|
||||
|
@ -225,7 +225,7 @@ public class Utils {
|
||||
* Used for force player GameMode
|
||||
*/
|
||||
public static void forceGM(Player player) {
|
||||
if (!plugin.authmePermissible(player, "authme.bypassforcesurvival"))
|
||||
if (!plugin.getPermissionsManager().hasPermission(player, "authme.bypassforcesurvival"))
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user