Fix and performances improvements

This commit is contained in:
Xephi59
2015-06-30 00:47:25 +02:00
parent 761b1feadb
commit f4f1f76e25
11 changed files with 82 additions and 71 deletions
@@ -268,7 +268,8 @@ public class AdminCommand implements CommandExecutor {
});
return true;
}
} else if (args[0].equalsIgnoreCase("register") || args[0].equalsIgnoreCase("reg")) {
} else
if (args[0].equalsIgnoreCase("register") || args[0].equalsIgnoreCase("reg")) {
if (args.length != 3) {
sender.sendMessage("Usage: /authme register playername password");
return true;
@@ -394,7 +395,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;
@@ -460,10 +462,10 @@ public class AdminCommand implements CommandExecutor {
int interval = Settings.getWarnMessageInterval;
BukkitScheduler sched = sender.getServer().getScheduler();
if (delay != 0) {
BukkitTask id = sched.runTaskLater(plugin, new TimeoutTask(plugin, name), delay);
BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name), delay);
LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id);
}
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(sched.runTask(plugin, new MessageTask(plugin, name, m.send("reg_msg"), interval)));
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("reg_msg"), interval)));
if (Settings.applyBlindEffect)
target.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2));
m.send(target, "unregistered");
@@ -2,8 +2,6 @@ package fr.xephi.authme.commands;
import java.security.NoSuchAlgorithmException;
import me.muizers.Notifications.Notification;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
@@ -29,6 +27,7 @@ import fr.xephi.authme.settings.Messages;
import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.task.MessageTask;
import fr.xephi.authme.task.TimeoutTask;
import me.muizers.Notifications.Notification;
public class UnregisterCommand implements CommandExecutor {
@@ -93,10 +92,10 @@ public class UnregisterCommand implements CommandExecutor {
int interval = Settings.getWarnMessageInterval;
BukkitScheduler sched = sender.getServer().getScheduler();
if (delay != 0) {
BukkitTask id = sched.runTaskLater(plugin, new TimeoutTask(plugin, name), delay);
BukkitTask id = sched.runTaskLaterAsynchronously(plugin, new TimeoutTask(plugin, name), delay);
LimboCache.getInstance().getLimboPlayer(name).setTimeoutTaskId(id);
}
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(sched.runTask(plugin, new MessageTask(plugin, name, m.send("reg_msg"), interval)));
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(sched.runTaskAsynchronously(plugin, new MessageTask(plugin, name, m.send("reg_msg"), interval)));
m.send(player, "unregistered");
ConsoleLogger.info(player.getDisplayName() + " unregistered himself");
if (plugin.notifications != null) {