//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
44 lines
1.3 KiB
Java
44 lines
1.3 KiB
Java
package fr.xephi.authme.task;
|
|
|
|
import org.bukkit.entity.Player;
|
|
import org.bukkit.scheduler.BukkitScheduler;
|
|
|
|
import fr.xephi.authme.AuthMe;
|
|
import fr.xephi.authme.cache.auth.PlayerCache;
|
|
import fr.xephi.authme.cache.limbo.LimboCache;
|
|
|
|
|
|
public class MessageTask implements Runnable {
|
|
|
|
private AuthMe plugin;
|
|
private String name;
|
|
private String msg;
|
|
private int interval;
|
|
|
|
public MessageTask(AuthMe plugin, String name, String msg, int interval) {
|
|
this.plugin = plugin;
|
|
this.name = name;
|
|
this.msg = msg;
|
|
this.interval = interval;
|
|
}
|
|
|
|
@Override
|
|
public void run() {
|
|
if (PlayerCache.getInstance().isAuthenticated(name))
|
|
return;
|
|
|
|
for (Player player : plugin.getServer().getOnlinePlayers()) {
|
|
if (player.getName().toLowerCase().equals(name)) {
|
|
for (String ms : msg.split("\u00a7n")) {
|
|
player.sendMessage(ms);
|
|
}
|
|
BukkitScheduler sched = plugin.getServer().getScheduler();
|
|
int late = sched.scheduleSyncDelayedTask(plugin, this, interval * 20);
|
|
if(LimboCache.getInstance().hasLimboPlayer(name)) {
|
|
LimboCache.getInstance().getLimboPlayer(name).setMessageTaskId(late);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|