Merge 765-teleport-handling into jsoncache-fix
This commit is contained in:
commit
c040623739
@ -29,6 +29,7 @@ import fr.xephi.authme.output.ConsoleFilter;
|
|||||||
import fr.xephi.authme.output.Log4JFilter;
|
import fr.xephi.authme.output.Log4JFilter;
|
||||||
import fr.xephi.authme.output.MessageKey;
|
import fr.xephi.authme.output.MessageKey;
|
||||||
import fr.xephi.authme.output.Messages;
|
import fr.xephi.authme.output.Messages;
|
||||||
|
import fr.xephi.authme.permission.AuthGroupHandler;
|
||||||
import fr.xephi.authme.permission.PermissionsManager;
|
import fr.xephi.authme.permission.PermissionsManager;
|
||||||
import fr.xephi.authme.permission.PermissionsSystemType;
|
import fr.xephi.authme.permission.PermissionsSystemType;
|
||||||
import fr.xephi.authme.process.Management;
|
import fr.xephi.authme.process.Management;
|
||||||
@ -421,11 +422,12 @@ public class AuthMe extends JavaPlugin {
|
|||||||
// Save player data
|
// Save player data
|
||||||
BukkitService bukkitService = initializer.getIfAvailable(BukkitService.class);
|
BukkitService bukkitService = initializer.getIfAvailable(BukkitService.class);
|
||||||
LimboCache limboCache = initializer.getIfAvailable(LimboCache.class);
|
LimboCache limboCache = initializer.getIfAvailable(LimboCache.class);
|
||||||
|
AuthGroupHandler authGroupHandler = initializer.getIfAvailable(AuthGroupHandler.class);
|
||||||
|
|
||||||
if (bukkitService != null && limboCache != null) {
|
if (bukkitService != null && limboCache != null) {
|
||||||
Collection<? extends Player> players = bukkitService.getOnlinePlayers();
|
Collection<? extends Player> players = bukkitService.getOnlinePlayers();
|
||||||
for (Player player : players) {
|
for (Player player : players) {
|
||||||
savePlayer(player, limboCache);
|
savePlayer(player, limboCache, authGroupHandler);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -558,7 +560,7 @@ public class AuthMe extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Save Player Data
|
// Save Player Data
|
||||||
private void savePlayer(Player player, LimboCache limboCache) {
|
private void savePlayer(Player player, LimboCache limboCache, AuthGroupHandler authGroupHandler) {
|
||||||
if (safeIsNpc(player) || Utils.isUnrestricted(player)) {
|
if (safeIsNpc(player) || Utils.isUnrestricted(player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,21 +9,16 @@ import fr.xephi.authme.datasource.DataSource;
|
|||||||
import fr.xephi.authme.output.MessageKey;
|
import fr.xephi.authme.output.MessageKey;
|
||||||
import fr.xephi.authme.permission.AuthGroupHandler;
|
import fr.xephi.authme.permission.AuthGroupHandler;
|
||||||
import fr.xephi.authme.permission.AuthGroupType;
|
import fr.xephi.authme.permission.AuthGroupType;
|
||||||
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
import fr.xephi.authme.process.Management;
|
||||||
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
|
||||||
import fr.xephi.authme.task.PlayerDataTaskManager;
|
import fr.xephi.authme.task.PlayerDataTaskManager;
|
||||||
import fr.xephi.authme.util.BukkitService;
|
import fr.xephi.authme.util.BukkitService;
|
||||||
import fr.xephi.authme.util.Utils;
|
import fr.xephi.authme.util.TeleportationService;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.potion.PotionEffect;
|
|
||||||
import org.bukkit.potion.PotionEffectType;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static fr.xephi.authme.util.BukkitService.TICKS_PER_SECOND;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Admin command to unregister a player.
|
* Admin command to unregister a player.
|
||||||
*/
|
*/
|
||||||
@ -50,6 +45,12 @@ public class UnregisterAdminCommand implements ExecutableCommand {
|
|||||||
@Inject
|
@Inject
|
||||||
private AuthGroupHandler authGroupHandler;
|
private AuthGroupHandler authGroupHandler;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private TeleportationService teleportationService;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private Management management;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executeCommand(final CommandSender sender, List<String> arguments) {
|
public void executeCommand(final CommandSender sender, List<String> arguments) {
|
||||||
@ -74,35 +75,11 @@ public class UnregisterAdminCommand implements ExecutableCommand {
|
|||||||
playerCache.removePlayer(playerNameLowerCase);
|
playerCache.removePlayer(playerNameLowerCase);
|
||||||
authGroupHandler.setGroup(target, AuthGroupType.UNREGISTERED);
|
authGroupHandler.setGroup(target, AuthGroupType.UNREGISTERED);
|
||||||
if (target != null && target.isOnline()) {
|
if (target != null && target.isOnline()) {
|
||||||
if (commandService.getProperty(RegistrationSettings.FORCE)) {
|
management.performUnregister(target, "dontneed", true);
|
||||||
applyUnregisteredEffectsAndTasks(target);
|
|
||||||
}
|
|
||||||
commandService.send(target, MessageKey.UNREGISTERED_SUCCESS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show a status message
|
// Show a status message
|
||||||
commandService.send(sender, MessageKey.UNREGISTERED_SUCCESS);
|
commandService.send(sender, MessageKey.UNREGISTERED_SUCCESS);
|
||||||
ConsoleLogger.info(sender.getName() + " unregistered " + playerName);
|
ConsoleLogger.info(sender.getName() + " unregistered " + playerName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* When registration is forced, applies the configured "unregistered effects" to the player as he
|
|
||||||
* would encounter when joining the server before logging on - reminder task to log in,
|
|
||||||
* timeout kick, blindness.
|
|
||||||
*
|
|
||||||
* @param target the player that was unregistered
|
|
||||||
*/
|
|
||||||
private void applyUnregisteredEffectsAndTasks(Player target) {
|
|
||||||
// TODO #765: Remove use of Utils method and behave according to settings
|
|
||||||
Utils.teleportToSpawn(target);
|
|
||||||
|
|
||||||
limboCache.addPlayerData(target);
|
|
||||||
playerDataTaskManager.registerTimeoutTask(target);
|
|
||||||
playerDataTaskManager.registerMessageTask(target.getName(), false);
|
|
||||||
|
|
||||||
final int timeout = commandService.getProperty(RestrictionSettings.TIMEOUT) * TICKS_PER_SECOND;
|
|
||||||
if (commandService.getProperty(RegistrationSettings.APPLY_BLIND_EFFECT)) {
|
|
||||||
target.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, timeout, 2));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -85,4 +85,28 @@ public class AuthGroupHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: This method requires better explanation.
|
||||||
|
* <p>
|
||||||
|
* Set the normal group of a player.
|
||||||
|
*
|
||||||
|
* @param player The player.
|
||||||
|
* @param group The normal group.
|
||||||
|
*
|
||||||
|
* @return True on success, false on failure.
|
||||||
|
*/
|
||||||
|
public boolean addNormal(Player player, String group) {
|
||||||
|
// Check whether the permissions check is enabled
|
||||||
|
if (!settings.getProperty(PluginSettings.ENABLE_PERMISSION_CHECK)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove old groups
|
||||||
|
permissionsManager.removeGroups(player, Arrays.asList(Settings.unRegisteredGroup,
|
||||||
|
Settings.getRegisteredGroup, Settings.getUnloggedinGroup));
|
||||||
|
|
||||||
|
// Add the normal group, return the result
|
||||||
|
return permissionsManager.addGroup(player, group);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -52,6 +52,7 @@ public class AsynchronousLogout implements AsynchronousProcess {
|
|||||||
|
|
||||||
limboCache.addPlayerData(player);
|
limboCache.addPlayerData(player);
|
||||||
playerCache.removePlayer(name);
|
playerCache.removePlayer(name);
|
||||||
|
// TODO LJ: No more teleport here?
|
||||||
database.setUnlogged(name);
|
database.setUnlogged(name);
|
||||||
syncProcessManager.processSyncPlayerLogout(player);
|
syncProcessManager.processSyncPlayerLogout(player);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import fr.xephi.authme.process.SyncProcessManager;
|
|||||||
import fr.xephi.authme.settings.SpawnLoader;
|
import fr.xephi.authme.settings.SpawnLoader;
|
||||||
import fr.xephi.authme.settings.properties.PluginSettings;
|
import fr.xephi.authme.settings.properties.PluginSettings;
|
||||||
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
||||||
|
import fr.xephi.authme.util.BukkitService;
|
||||||
import fr.xephi.authme.util.Utils;
|
import fr.xephi.authme.util.Utils;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -44,6 +45,9 @@ public class AsynchronousQuit implements AsynchronousProcess {
|
|||||||
@Inject
|
@Inject
|
||||||
private SpawnLoader spawnLoader;
|
private SpawnLoader spawnLoader;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private BukkitService bukkitService;
|
||||||
|
|
||||||
AsynchronousQuit() {
|
AsynchronousQuit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,7 +80,7 @@ public class AsynchronousQuit implements AsynchronousProcess {
|
|||||||
playerCache.removePlayer(name);
|
playerCache.removePlayer(name);
|
||||||
|
|
||||||
if (plugin.isEnabled() && service.getProperty(PluginSettings.SESSIONS_ENABLED)) {
|
if (plugin.isEnabled() && service.getProperty(PluginSettings.SESSIONS_ENABLED)) {
|
||||||
BukkitTask task = plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
|
BukkitTask task = bukkitService.runTaskLaterAsynchronously(new Runnable() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package fr.xephi.authme.process.quit;
|
|||||||
|
|
||||||
import fr.xephi.authme.cache.backup.PlayerDataStorage;
|
import fr.xephi.authme.cache.backup.PlayerDataStorage;
|
||||||
import fr.xephi.authme.cache.limbo.LimboCache;
|
import fr.xephi.authme.cache.limbo.LimboCache;
|
||||||
|
import fr.xephi.authme.permission.AuthGroupHandler;
|
||||||
import fr.xephi.authme.process.ProcessService;
|
import fr.xephi.authme.process.ProcessService;
|
||||||
import fr.xephi.authme.process.SynchronousProcess;
|
import fr.xephi.authme.process.SynchronousProcess;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -20,6 +21,9 @@ public class ProcessSyncronousPlayerQuit implements SynchronousProcess {
|
|||||||
@Inject
|
@Inject
|
||||||
private LimboCache limboCache;
|
private LimboCache limboCache;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private AuthGroupHandler authGroupHandler;
|
||||||
|
|
||||||
public void processSyncQuit(Player player) {
|
public void processSyncQuit(Player player) {
|
||||||
if (limboCache.hasPlayerData(player.getName().toLowerCase())) { // it mean player is not authenticated
|
if (limboCache.hasPlayerData(player.getName().toLowerCase())) { // it mean player is not authenticated
|
||||||
limboCache.removeFromCache(player);
|
limboCache.removeFromCache(player);
|
||||||
|
|||||||
@ -78,8 +78,6 @@ public class ProcessSyncPasswordRegister implements SynchronousProcess {
|
|||||||
*/
|
*/
|
||||||
private void requestLogin(Player player) {
|
private void requestLogin(Player player) {
|
||||||
final String name = player.getName().toLowerCase();
|
final String name = player.getName().toLowerCase();
|
||||||
Utils.teleportToSpawn(player);
|
|
||||||
|
|
||||||
limboCache.updatePlayerData(player);
|
limboCache.updatePlayerData(player);
|
||||||
playerDataTaskManager.registerTimeoutTask(player);
|
playerDataTaskManager.registerTimeoutTask(player);
|
||||||
playerDataTaskManager.registerMessageTask(name, true);
|
playerDataTaskManager.registerMessageTask(name, true);
|
||||||
@ -92,7 +90,6 @@ public class ProcessSyncPasswordRegister implements SynchronousProcess {
|
|||||||
public void processPasswordRegister(Player player) {
|
public void processPasswordRegister(Player player) {
|
||||||
final String name = player.getName().toLowerCase();
|
final String name = player.getName().toLowerCase();
|
||||||
if (limboCache.hasPlayerData(name)) {
|
if (limboCache.hasPlayerData(name)) {
|
||||||
teleportationService.teleportOnJoin(player);
|
|
||||||
if (service.getProperty(PROTECT_INVENTORY_BEFORE_LOGIN)) {
|
if (service.getProperty(PROTECT_INVENTORY_BEFORE_LOGIN)) {
|
||||||
RestoreInventoryEvent event = new RestoreInventoryEvent(player);
|
RestoreInventoryEvent event = new RestoreInventoryEvent(player);
|
||||||
bukkitService.callEvent(event);
|
bukkitService.callEvent(event);
|
||||||
|
|||||||
@ -14,7 +14,7 @@ import fr.xephi.authme.settings.Settings;
|
|||||||
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
import fr.xephi.authme.settings.properties.RegistrationSettings;
|
||||||
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
import fr.xephi.authme.settings.properties.RestrictionSettings;
|
||||||
import fr.xephi.authme.task.PlayerDataTaskManager;
|
import fr.xephi.authme.task.PlayerDataTaskManager;
|
||||||
import fr.xephi.authme.util.Utils;
|
import fr.xephi.authme.util.TeleportationService;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
@ -43,6 +43,9 @@ public class AsynchronousUnregister implements AsynchronousProcess {
|
|||||||
@Inject
|
@Inject
|
||||||
private PlayerDataTaskManager playerDataTaskManager;
|
private PlayerDataTaskManager playerDataTaskManager;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private TeleportationService teleportationService;
|
||||||
|
|
||||||
AsynchronousUnregister() { }
|
AsynchronousUnregister() { }
|
||||||
|
|
||||||
|
|
||||||
@ -56,7 +59,7 @@ public class AsynchronousUnregister implements AsynchronousProcess {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (service.getProperty(RegistrationSettings.FORCE)) {
|
if (service.getProperty(RegistrationSettings.FORCE)) {
|
||||||
Utils.teleportToSpawn(player);
|
teleportationService.teleportOnJoin(player);
|
||||||
player.saveData();
|
player.saveData();
|
||||||
playerCache.removePlayer(player.getName().toLowerCase());
|
playerCache.removePlayer(player.getName().toLowerCase());
|
||||||
if (!Settings.getRegisteredGroup.isEmpty()) {
|
if (!Settings.getRegisteredGroup.isEmpty()) {
|
||||||
@ -68,7 +71,7 @@ public class AsynchronousUnregister implements AsynchronousProcess {
|
|||||||
playerDataTaskManager.registerMessageTask(name, false);
|
playerDataTaskManager.registerMessageTask(name, false);
|
||||||
|
|
||||||
service.send(player, MessageKey.UNREGISTERED_SUCCESS);
|
service.send(player, MessageKey.UNREGISTERED_SUCCESS);
|
||||||
ConsoleLogger.info(player.getDisplayName() + " unregistered himself");
|
ConsoleLogger.info(player.getName() + " unregistered himself");
|
||||||
return; // TODO ljacqu 20160612: Why return here? No blind effect? Player not removed from PlayerCache?
|
return; // TODO ljacqu 20160612: Why return here? No blind effect? Player not removed from PlayerCache?
|
||||||
}
|
}
|
||||||
if (!Settings.unRegisteredGroup.isEmpty()) {
|
if (!Settings.unRegisteredGroup.isEmpty()) {
|
||||||
@ -82,7 +85,7 @@ public class AsynchronousUnregister implements AsynchronousProcess {
|
|||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, timeout, 2));
|
player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, timeout, 2));
|
||||||
}
|
}
|
||||||
service.send(player, MessageKey.UNREGISTERED_SUCCESS);
|
service.send(player, MessageKey.UNREGISTERED_SUCCESS);
|
||||||
ConsoleLogger.info(player.getDisplayName() + " unregistered himself");
|
ConsoleLogger.info(player.getName() + " unregistered himself");
|
||||||
} else {
|
} else {
|
||||||
service.send(player, MessageKey.WRONG_PASSWORD);
|
service.send(player, MessageKey.WRONG_PASSWORD);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,9 +3,7 @@ package fr.xephi.authme.security.crypts;
|
|||||||
/**
|
/**
|
||||||
* Public interface for custom password encryption methods.
|
* Public interface for custom password encryption methods.
|
||||||
* <p>
|
* <p>
|
||||||
* Note that {@link fr.xephi.authme.security.PasswordSecurity} requires classes implementing this interface
|
* Instantiation of these methods is done via automatic dependency injection.
|
||||||
* to either have the default constructor or an accessible constructor with one parameter of type
|
|
||||||
* {@link fr.xephi.authme.settings.NewSetting}.
|
|
||||||
*/
|
*/
|
||||||
public interface EncryptionMethod {
|
public interface EncryptionMethod {
|
||||||
|
|
||||||
|
|||||||
@ -106,6 +106,23 @@ public class BukkitService {
|
|||||||
return Bukkit.getScheduler().runTaskAsynchronously(authMe, task);
|
return Bukkit.getScheduler().runTaskAsynchronously(authMe, task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <b>Asynchronous tasks should never access any API in Bukkit. Great care
|
||||||
|
* should be taken to assure the thread-safety of asynchronous tasks.</b>
|
||||||
|
* <p>
|
||||||
|
* Returns a task that will run asynchronously after the specified number
|
||||||
|
* of server ticks.
|
||||||
|
*
|
||||||
|
* @param task the task to be run
|
||||||
|
* @param delay the ticks to wait before running the task
|
||||||
|
* @return a BukkitTask that contains the id number
|
||||||
|
* @throws IllegalArgumentException if plugin is null
|
||||||
|
* @throws IllegalArgumentException if task is null
|
||||||
|
*/
|
||||||
|
public BukkitTask runTaskLaterAsynchronously(Runnable task, long delay) {
|
||||||
|
return Bukkit.getScheduler().runTaskLaterAsynchronously(authMe, task, delay);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Broadcast a message to all players.
|
* Broadcast a message to all players.
|
||||||
*
|
*
|
||||||
|
|||||||
@ -1,15 +1,10 @@
|
|||||||
package fr.xephi.authme.util;
|
package fr.xephi.authme.util;
|
||||||
|
|
||||||
import fr.xephi.authme.AuthMe;
|
|
||||||
import fr.xephi.authme.ConsoleLogger;
|
import fr.xephi.authme.ConsoleLogger;
|
||||||
import fr.xephi.authme.events.AuthMeTeleportEvent;
|
|
||||||
import fr.xephi.authme.permission.PermissionsManager;
|
|
||||||
import fr.xephi.authme.settings.Settings;
|
import fr.xephi.authme.settings.Settings;
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -17,41 +12,9 @@ import java.util.regex.Pattern;
|
|||||||
*/
|
*/
|
||||||
public final class Utils {
|
public final class Utils {
|
||||||
|
|
||||||
private static AuthMe plugin = AuthMe.getInstance();
|
|
||||||
|
|
||||||
private Utils() {
|
private Utils() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO: This method requires better explanation.
|
|
||||||
* <p>
|
|
||||||
* Set the normal group of a player.
|
|
||||||
*
|
|
||||||
* @param player The player.
|
|
||||||
* @param group The normal group.
|
|
||||||
*
|
|
||||||
* @return True on success, false on failure.
|
|
||||||
*/
|
|
||||||
public static boolean addNormal(Player player, String group) {
|
|
||||||
if (!Settings.isPermissionCheckEnabled) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the permissions manager, and make sure it's valid
|
|
||||||
PermissionsManager permsMan = plugin.getPermissionsManager();
|
|
||||||
if (permsMan == null) {
|
|
||||||
ConsoleLogger.showError("Failed to access permissions manager instance, aborting.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove old groups
|
|
||||||
permsMan.removeGroups(player, Arrays.asList(Settings.unRegisteredGroup,
|
|
||||||
Settings.getRegisteredGroup, Settings.getUnloggedinGroup));
|
|
||||||
|
|
||||||
// Add the normal group, return the result
|
|
||||||
return permsMan.addGroup(player, group);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static boolean isUnrestricted(Player player) {
|
public static boolean isUnrestricted(Player player) {
|
||||||
// TODO ljacqu 20160602: Checking for Settings.isAllowRestrictedIp is wrong! Nothing in the config suggests
|
// TODO ljacqu 20160602: Checking for Settings.isAllowRestrictedIp is wrong! Nothing in the config suggests
|
||||||
@ -60,18 +23,6 @@ public final class Utils {
|
|||||||
&& Settings.getUnrestrictedName.contains(player.getName().toLowerCase());
|
&& Settings.getUnrestrictedName.contains(player.getName().toLowerCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public static void teleportToSpawn(Player player) {
|
|
||||||
if (Settings.isTeleportToSpawnEnabled && !Settings.noTeleport) {
|
|
||||||
Location spawn = plugin.getSpawnLocation(player);
|
|
||||||
AuthMeTeleportEvent tpEvent = new AuthMeTeleportEvent(player, spawn);
|
|
||||||
plugin.getServer().getPluginManager().callEvent(tpEvent);
|
|
||||||
if (!tpEvent.isCancelled()) {
|
|
||||||
player.teleport(tpEvent.getTo());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get player's UUID if can, name otherwise.
|
* Get player's UUID if can, name otherwise.
|
||||||
*
|
*
|
||||||
|
|||||||
@ -90,4 +90,10 @@ public class UtilsTest {
|
|||||||
// then
|
// then
|
||||||
assertThat(result, equalTo(name));
|
assertThat(result, equalTo(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void shouldHavePrivateConstructorOnly() {
|
||||||
|
// given / when / then
|
||||||
|
TestHelper.validateHasOnlyPrivateEmptyConstructor(Utils.class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user