Merge 765-teleport-handling into jsoncache-fix
This commit is contained in:
@@ -106,6 +106,23 @@ public class BukkitService {
|
||||
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.
|
||||
*
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
package fr.xephi.authme.util;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.events.AuthMeTeleportEvent;
|
||||
import fr.xephi.authme.permission.PermissionsManager;
|
||||
import fr.xephi.authme.settings.Settings;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
@@ -17,41 +12,9 @@ import java.util.regex.Pattern;
|
||||
*/
|
||||
public final class Utils {
|
||||
|
||||
private static AuthMe plugin = AuthMe.getInstance();
|
||||
|
||||
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
|
||||
public static boolean isUnrestricted(Player player) {
|
||||
// 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());
|
||||
}
|
||||
|
||||
@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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user