Update 3.2

//Changes 3.2://
* Fix Password showed in console ( support for Log4J )
* Quit Location will be more precise ( now double instead of int )
* Force command after the /register too
* Close inventory when player try to open one unlogged
* Fix old password supports
* Remove some Magic Values ( 1.7.2+ )
* Fix threads not start correctly
* Add a recall email adding message
* Fix catpcha messages
* Add multilines messages ( add &n )
* Fix some inventory problem
* Fix some events problem
* Call login event after /register
This commit is contained in:
Xephi
2014-01-07 02:59:08 +01:00
parent 93a320c8ae
commit 5127d5e70a
32 changed files with 329 additions and 193 deletions
@@ -64,9 +64,9 @@ public class LogoutCommand implements CommandExecutor {
PlayerAuth auth = PlayerCache.getInstance().getAuth(name);
auth.setIp("198.18.0.1");
database.updateSession(auth);
auth.setQuitLocX(player.getLocation().getBlockX());
auth.setQuitLocY(player.getLocation().getBlockY());
auth.setQuitLocZ(player.getLocation().getBlockZ());
auth.setQuitLocX(player.getLocation().getX());
auth.setQuitLocY(player.getLocation().getY());
auth.setQuitLocZ(player.getLocation().getZ());
auth.setWorld(player.getWorld().getName());
database.updateQuitLoc(auth);
@@ -23,6 +23,7 @@ import fr.xephi.authme.cache.auth.PlayerCache;
import fr.xephi.authme.cache.limbo.LimboCache;
import fr.xephi.authme.cache.limbo.LimboPlayer;
import fr.xephi.authme.datasource.DataSource;
import fr.xephi.authme.events.LoginEvent;
import fr.xephi.authme.events.RegisterTeleportEvent;
import fr.xephi.authme.security.PasswordSecurity;
import fr.xephi.authme.security.RandomString;
@@ -158,13 +159,13 @@ public class RegisterCommand implements CommandExecutor {
int msgInterval = Settings.getWarnMessageInterval;
if (time != 0) {
Bukkit.getScheduler().cancelTask(LimboCache.getInstance().getLimboPlayer(name).getTimeoutTaskId());
BukkitTask id = Bukkit.getScheduler().runTaskLater(plugin, new TimeoutTask(plugin, name), time);
LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id.getTaskId());
int id = Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new TimeoutTask(plugin, name), time);
LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id);
}
Bukkit.getScheduler().cancelTask(LimboCache.getInstance().getLimboPlayer(name).getMessageTaskId());
BukkitTask nwMsg = Bukkit.getScheduler().runTask(plugin, new MessageTask(plugin, name, msg, msgInterval));
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(nwMsg.getTaskId());
int nwMsg = Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new MessageTask(plugin, name, msg, msgInterval));
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(nwMsg);
LimboCache.getInstance().deleteLimboPlayer(name);
if (Settings.isTeleportToSpawnEnabled) {
@@ -256,7 +257,12 @@ public class RegisterCommand implements CommandExecutor {
player.setAllowFlight(false);
player.setFlying(false);
}
// The Loginevent now fires (as intended) after everything is processed
Bukkit.getServer().getPluginManager().callEvent(new LoginEvent(player, true));
player.saveData();
// Register is now finish , we can force all commands
forceCommands(player);
if (!Settings.noConsoleSpam)
ConsoleLogger.info(player.getName() + " registered "+player.getAddress().getAddress().getHostAddress());
if(plugin.notifications != null) {
@@ -268,4 +274,12 @@ public class RegisterCommand implements CommandExecutor {
}
return true;
}
protected void forceCommands(Player player) {
for (String command : Settings.forceCommands) {
try {
player.performCommand(command.replace("%p", player.getName()));
} catch (Exception e) {}
}
}
}