mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-26 02:27:50 +01:00
commit
22619b39bb
6
pom.xml
6
pom.xml
@ -154,12 +154,6 @@
|
||||
<url>http://nexus.theyeticave.net/content/repositories/pub_releases</url>
|
||||
</repository>
|
||||
|
||||
<!-- Mcstats.org Metrics Repo -->
|
||||
<repository>
|
||||
<id>Plugin Metrics</id>
|
||||
<url>http://repo.mcstats.org/content/repositories/releases</url>
|
||||
</repository>
|
||||
|
||||
<!-- XAuth Repo -->
|
||||
<repository>
|
||||
<id>luricos-releases</id>
|
||||
|
@ -176,7 +176,7 @@ public class AdminCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
if (auth == null) {
|
||||
m.send(sender, "user_unknown");
|
||||
m.send(sender, "user_unknown");
|
||||
return true;
|
||||
}
|
||||
long lastLogin = auth.getLastLogin();
|
||||
@ -362,9 +362,9 @@ public class AdminCommand implements CommandExecutor {
|
||||
if (sender instanceof Player) {
|
||||
if (Spawn.getInstance().setSpawn(((Player) sender).getLocation())) {
|
||||
sender.sendMessage("[AuthMe] Correctly defined new spawn point");
|
||||
} else {
|
||||
} else {
|
||||
sender.sendMessage("[AuthMe] SetSpawn has failed, please retry");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage("[AuthMe] Please use that command in game");
|
||||
}
|
||||
@ -427,7 +427,8 @@ public class AdminCommand implements CommandExecutor {
|
||||
ConsoleLogger.showError(ex.getMessage());
|
||||
}
|
||||
return true;
|
||||
} else if (args[0].equalsIgnoreCase("changepassword") || args[0].equalsIgnoreCase("cp")) {
|
||||
} else
|
||||
if (args[0].equalsIgnoreCase("changepassword") || args[0].equalsIgnoreCase("cp")) {
|
||||
if (args.length != 3) {
|
||||
sender.sendMessage("Usage: /authme changepassword <playername> <newpassword>");
|
||||
return true;
|
||||
@ -512,7 +513,7 @@ public class AdminCommand implements CommandExecutor {
|
||||
int interval = Settings.getWarnMessageInterval;
|
||||
BukkitScheduler sched = sender.getServer().getScheduler();
|
||||
if (delay != 0) {
|
||||
BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name), delay);
|
||||
BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, target), delay);
|
||||
LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id);
|
||||
}
|
||||
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("reg_msg"), interval)));
|
||||
@ -528,7 +529,8 @@ public class AdminCommand implements CommandExecutor {
|
||||
m.send(sender, "unregistered");
|
||||
ConsoleLogger.info(args[1] + " unregistered");
|
||||
return true;
|
||||
} else if (args[0].equalsIgnoreCase("purgelastpos") || args[0].equalsIgnoreCase("resetposition")) {
|
||||
} else
|
||||
if (args[0].equalsIgnoreCase("purgelastpos") || args[0].equalsIgnoreCase("resetposition")) {
|
||||
if (args.length != 2) {
|
||||
sender.sendMessage("Usage: /authme purgelastpos <playername>");
|
||||
return true;
|
||||
@ -581,9 +583,9 @@ public class AdminCommand implements CommandExecutor {
|
||||
sender.sendMessage("Usage: /authme getip <onlineplayername>");
|
||||
return true;
|
||||
}
|
||||
sender.sendMessage(player.getName() + "'s actual IP is : " + player.getAddress().getAddress().getHostAddress() + ":" + player.getAddress().getPort());
|
||||
sender.sendMessage(player.getName() + "'s real IP is : " + plugin.getIP(player));
|
||||
return true;
|
||||
sender.sendMessage(player.getName() + "'s actual IP is : " + player.getAddress().getAddress().getHostAddress() + ":" + player.getAddress().getPort());
|
||||
sender.sendMessage(player.getName() + "'s real IP is : " + plugin.getIP(player));
|
||||
return true;
|
||||
} else if (args[0].equalsIgnoreCase("forcelogin")) {
|
||||
if (args.length < 2) {
|
||||
sender.sendMessage("Usage: /authme forcelogin <playername>");
|
||||
|
@ -88,7 +88,7 @@ public class UnregisterCommand implements CommandExecutor {
|
||||
int interval = Settings.getWarnMessageInterval;
|
||||
BukkitScheduler sched = sender.getServer().getScheduler();
|
||||
if (delay != 0) {
|
||||
BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name), delay);
|
||||
BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), delay);
|
||||
LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id);
|
||||
}
|
||||
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("reg_msg"), interval)));
|
||||
|
@ -200,7 +200,7 @@ public class AsyncronousJoin {
|
||||
int time = Settings.getRegistrationTimeout * 20;
|
||||
int msgInterval = Settings.getWarnMessageInterval;
|
||||
if (time != 0) {
|
||||
BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name), time);
|
||||
BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), time);
|
||||
if (!LimboCache.getInstance().hasLimboPlayer(name))
|
||||
LimboCache.getInstance().addLimboPlayer(player);
|
||||
LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id);
|
||||
|
@ -38,7 +38,7 @@ public class ProcessSyncronousPlayerLogout implements Runnable {
|
||||
int interval = Settings.getWarnMessageInterval;
|
||||
BukkitScheduler sched = player.getServer().getScheduler();
|
||||
if (delay != 0) {
|
||||
BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name), delay);
|
||||
BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), delay);
|
||||
LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id);
|
||||
}
|
||||
BukkitTask msgT = sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("login_msg"), interval));
|
||||
|
@ -36,7 +36,7 @@ public class ProcessSyncronousEmailRegister implements Runnable {
|
||||
int msgInterval = Settings.getWarnMessageInterval;
|
||||
if (time != 0) {
|
||||
LimboCache.getInstance().getLimboPlayer(name).getTimeoutTaskId().cancel();
|
||||
BukkitTask id = Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name), time);
|
||||
BukkitTask id = Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), time);
|
||||
LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id);
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ public class ProcessSyncronousPasswordRegister implements Runnable {
|
||||
int interval = Settings.getWarnMessageInterval;
|
||||
BukkitScheduler sched = plugin.getServer().getScheduler();
|
||||
if (delay != 0) {
|
||||
BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name), delay);
|
||||
BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name, player), delay);
|
||||
LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id);
|
||||
}
|
||||
BukkitTask msgT = sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("login_msg"), interval));
|
||||
|
@ -1,16 +1,10 @@
|
||||
package fr.xephi.authme.task;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
import fr.xephi.authme.cache.backup.FileCache;
|
||||
import fr.xephi.authme.cache.limbo.LimboCache;
|
||||
import fr.xephi.authme.cache.limbo.LimboPlayer;
|
||||
import fr.xephi.authme.listener.AuthMePlayerListener;
|
||||
import fr.xephi.authme.settings.Messages;
|
||||
|
||||
public class TimeoutTask implements Runnable {
|
||||
@ -18,12 +12,12 @@ public class TimeoutTask implements Runnable {
|
||||
private AuthMe plugin;
|
||||
private String name;
|
||||
private Messages m = Messages.getInstance();
|
||||
private FileCache playerCache;
|
||||
private Player player;
|
||||
|
||||
public TimeoutTask(AuthMe plugin, String name) {
|
||||
public TimeoutTask(AuthMe plugin, String name, Player player) {
|
||||
this.plugin = plugin;
|
||||
this.name = name;
|
||||
this.playerCache = new FileCache(plugin);
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
@ -35,38 +29,13 @@ public class TimeoutTask implements Runnable {
|
||||
if (PlayerCache.getInstance().isAuthenticated(name))
|
||||
return;
|
||||
|
||||
for (final Player player : plugin.getServer().getOnlinePlayers()) {
|
||||
if (player.getName().toLowerCase().equals(name)) {
|
||||
if (LimboCache.getInstance().hasLimboPlayer(name)) {
|
||||
LimboPlayer inv = LimboCache.getInstance().getLimboPlayer(name);
|
||||
inv.getMessageTaskId().cancel();
|
||||
inv.getTimeoutTaskId().cancel();
|
||||
if (playerCache.doesCacheExist(player)) {
|
||||
playerCache.removeCache(player);
|
||||
}
|
||||
}
|
||||
final GameMode gm = AuthMePlayerListener.gameMode.get(name);
|
||||
if (gm != null) {
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
player.setGameMode(gm);
|
||||
}
|
||||
|
||||
});
|
||||
ConsoleLogger.info("Set " + player.getName() + " to gamemode: " + gm.name());
|
||||
}
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (player.isOnline())
|
||||
player.kickPlayer(m.send("timeout")[0]);
|
||||
}
|
||||
});
|
||||
return;
|
||||
@Override
|
||||
public void run() {
|
||||
if (player.isOnline())
|
||||
player.kickPlayer(m.send("timeout")[0]);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user