mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-20 07:37:47 +01:00
cleanup
This commit is contained in:
parent
da6431b4fc
commit
740b44ca36
@ -26,7 +26,6 @@ import fr.xephi.authme.util.BukkitService;
|
||||
import fr.xephi.authme.util.Utils;
|
||||
import fr.xephi.authme.util.ValidationService;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -142,7 +141,7 @@ public class AuthMePlayerListener implements Listener {
|
||||
bukkitService.runTaskAsynchronously(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
m.send(player, MessageKey.DENIED_CHAT_MESSAGE);
|
||||
m.send(player, MessageKey.DENIED_CHAT);
|
||||
}
|
||||
});
|
||||
} else if (settings.getProperty(RestrictionSettings.HIDE_CHAT)) {
|
||||
@ -235,11 +234,6 @@ public class AuthMePlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (settings.getProperty(RestrictionSettings.FORCE_SURVIVAL_MODE)
|
||||
&& !player.hasPermission(PlayerStatePermission.BYPASS_FORCE_SURVIVAL.getNode())) {
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
}
|
||||
|
||||
// Schedule login task so works after the prelogin
|
||||
// (Fix found by Koolaid5000)
|
||||
bukkitService.runTask(new Runnable() {
|
||||
|
@ -5,7 +5,9 @@ package fr.xephi.authme.output;
|
||||
*/
|
||||
public enum MessageKey {
|
||||
|
||||
DENIED_CHAT_MESSAGE("denied_chat"),
|
||||
SAME_IP_ONLINE("same_ip_online"),
|
||||
|
||||
DENIED_CHAT("denied_chat"),
|
||||
|
||||
KICK_ANTIBOT("kick_antibot"),
|
||||
|
||||
|
@ -3,6 +3,7 @@ package fr.xephi.authme.process;
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.output.MessageKey;
|
||||
import fr.xephi.authme.output.Messages;
|
||||
import fr.xephi.authme.permission.PermissionNode;
|
||||
import fr.xephi.authme.settings.NewSetting;
|
||||
import fr.xephi.authme.settings.domain.Property;
|
||||
import fr.xephi.authme.util.BukkitService;
|
||||
@ -25,7 +26,7 @@ public class ProcessService {
|
||||
@Inject
|
||||
private Messages messages;
|
||||
@Inject
|
||||
private AuthMe authMe;
|
||||
private AuthMe plugin;
|
||||
@Inject
|
||||
private ValidationService validationService;
|
||||
@Inject
|
||||
@ -99,7 +100,7 @@ public class ProcessService {
|
||||
* @return the assigned task id
|
||||
*/
|
||||
public BukkitTask runTask(Runnable task) {
|
||||
return authMe.getServer().getScheduler().runTask(authMe, task);
|
||||
return plugin.getServer().getScheduler().runTask(plugin, task);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -110,7 +111,7 @@ public class ProcessService {
|
||||
* @return the assigned task id
|
||||
*/
|
||||
public BukkitTask runTaskLater(Runnable task, long delay) {
|
||||
return authMe.getServer().getScheduler().runTaskLater(authMe, task, delay);
|
||||
return plugin.getServer().getScheduler().runTaskLater(plugin, task, delay);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -120,7 +121,7 @@ public class ProcessService {
|
||||
* @return the task id
|
||||
*/
|
||||
public int scheduleSyncDelayedTask(Runnable task) {
|
||||
return authMe.getServer().getScheduler().scheduleSyncDelayedTask(authMe, task);
|
||||
return plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, task);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -129,7 +130,7 @@ public class ProcessService {
|
||||
* @param event the event to emit
|
||||
*/
|
||||
public void callEvent(Event event) {
|
||||
authMe.getServer().getPluginManager().callEvent(event);
|
||||
plugin.getServer().getPluginManager().callEvent(event);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -138,7 +139,7 @@ public class ProcessService {
|
||||
* @return AuthMe instance
|
||||
*/
|
||||
public AuthMe getAuthMe() {
|
||||
return authMe;
|
||||
return plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -168,4 +169,8 @@ public class ProcessService {
|
||||
return bukkitService;
|
||||
}
|
||||
|
||||
public boolean hasPermission(Player player, PermissionNode node) {
|
||||
return plugin.getPermissionsManager().hasPermission(player, node);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ import fr.xephi.authme.task.TimeoutTask;
|
||||
import fr.xephi.authme.util.Utils;
|
||||
import fr.xephi.authme.util.Utils.GroupType;
|
||||
import org.apache.commons.lang.reflect.MethodUtils;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
@ -73,13 +74,24 @@ public class AsynchronousJoin implements AsynchronousProcess {
|
||||
if (Utils.isUnrestricted(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
final String name = player.getName().toLowerCase();
|
||||
final String ip = Utils.getPlayerIp(player);
|
||||
|
||||
// Prevent player collisions in 1.9
|
||||
if (DISABLE_COLLISIONS) {
|
||||
((LivingEntity) player).setCollidable(false);
|
||||
}
|
||||
|
||||
if (service.getProperty(RestrictionSettings.FORCE_SURVIVAL_MODE)
|
||||
&& !service.hasPermission(player, PlayerStatePermission.BYPASS_FORCE_SURVIVAL)) {
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
}
|
||||
|
||||
if (service.getProperty(HooksSettings.DISABLE_SOCIAL_SPY)) {
|
||||
pluginHooks.setEssentialsSocialSpyStatus(player, false);
|
||||
}
|
||||
|
||||
final String ip = Utils.getPlayerIp(player);
|
||||
if (isNameRestricted(name, ip, player.getAddress().getHostName())) {
|
||||
service.scheduleSyncDelayedTask(new Runnable() {
|
||||
@Override
|
||||
@ -93,25 +105,27 @@ public class AsynchronousJoin implements AsynchronousProcess {
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (service.getProperty(RestrictionSettings.MAX_JOIN_PER_IP) > 0
|
||||
&& !plugin.getPermissionsManager().hasPermission(player, PlayerStatePermission.ALLOW_MULTIPLE_ACCOUNTS)
|
||||
&& !"127.0.0.1".equalsIgnoreCase(ip)
|
||||
&& !"localhost".equalsIgnoreCase(ip)
|
||||
&& hasJoinedIp(player.getName(), ip)) {
|
||||
&& !service.hasPermission(player, PlayerStatePermission.ALLOW_MULTIPLE_ACCOUNTS)
|
||||
&& !"127.0.0.1".equalsIgnoreCase(ip)
|
||||
&& !"localhost".equalsIgnoreCase(ip)
|
||||
&& hasJoinedIp(player.getName(), ip)) {
|
||||
|
||||
service.scheduleSyncDelayedTask(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.kickPlayer("A player with the same IP is already in game!");
|
||||
// TODO: Messages entry
|
||||
player.kickPlayer(service.retrieveSingleMessage(MessageKey.SAME_IP_ONLINE));
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
// Prevent player collisions in 1.9
|
||||
if (DISABLE_COLLISIONS) {
|
||||
((LivingEntity) player).setCollidable(false);
|
||||
}
|
||||
|
||||
final Location spawnLoc = spawnLoader.getSpawnLocation(player);
|
||||
final boolean isAuthAvailable = database.isAuthAvailable(name);
|
||||
|
||||
// TODO: continue cleanup from this -sgdc3
|
||||
if (isAuthAvailable) {
|
||||
if (!service.getProperty(RestrictionSettings.NO_TELEPORT)) {
|
||||
if (Settings.isTeleportToSpawnEnabled || (Settings.isForceSpawnLocOnJoinEnabled && Settings.getForcedWorlds.contains(player.getWorld().getName()))) {
|
||||
|
@ -1,3 +1,4 @@
|
||||
same_ip_online: 'A player with the same IP is already in game!'
|
||||
denied_chat: '&cIn order to be able to chat you must be authenticated!'
|
||||
kick_antibot: 'AntiBot protection mode is enabled! You have to wait some minutes before joining the server.'
|
||||
unknown_user: '&cCan''t find the requested user in the database!'
|
||||
|
Loading…
Reference in New Issue
Block a user