Speed 0 when not logged!

This commit is contained in:
Gabriele C 2015-09-19 22:28:55 +02:00
parent dc35d768aa
commit b427d14bcb
6 changed files with 22 additions and 0 deletions

View File

@ -486,6 +486,10 @@ public class AdminCommand implements CommandExecutor {
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));
if (!Settings.isMovementAllowed) {
target.setWalkSpeed(0.0f);
target.setFlySpeed(0.0f);
}
m.send(target, "unregistered");
}
}

View File

@ -109,6 +109,10 @@ public class UnregisterCommand implements CommandExecutor {
}
if (Settings.applyBlindEffect)
player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2));
if (!Settings.isMovementAllowed) {
player.setWalkSpeed(0.0f);
player.setFlySpeed(0.0f);
}
m.send(player, "unregistered");
ConsoleLogger.info(player.getDisplayName() + " unregistered himself");
if (Settings.isTeleportToSpawnEnabled && !Settings.noTeleport) {

View File

@ -235,6 +235,10 @@ public class AsyncronousJoin {
player.performCommand("motd");
if (Settings.applyBlindEffect)
player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2));
if (!Settings.isMovementAllowed) {
player.setWalkSpeed(0.0f);
player.setFlySpeed(0.0f);
}
}
});

View File

@ -186,6 +186,10 @@ public class ProcessSyncronousPlayerLogin implements Runnable {
if (Settings.applyBlindEffect)
player.removePotionEffect(PotionEffectType.BLINDNESS);
if (!Settings.isMovementAllowed) {
player.setWalkSpeed(0.2f);
player.setFlySpeed(0.4f);
}
// The Loginevent now fires (as intended) after everything is processed
Bukkit.getServer().getPluginManager().callEvent(new LoginEvent(player, true));

View File

@ -54,6 +54,8 @@ public class ProcessSyncronousPlayerLogout implements Runnable {
if (!Settings.isMovementAllowed) {
player.setAllowFlight(true);
player.setFlying(true);
player.setFlySpeed(0.0f);
player.setWalkSpeed(0.0f);
}
// Player is now logout... Time to fire event !
Bukkit.getServer().getPluginManager().callEvent(new LogoutEvent(player));

View File

@ -119,6 +119,10 @@ public class ProcessSyncronousPasswordRegister implements Runnable {
}
if (Settings.applyBlindEffect)
player.removePotionEffect(PotionEffectType.BLINDNESS);
if (!Settings.isMovementAllowed) {
player.setWalkSpeed(0.2f);
player.setFlySpeed(0.4f);
}
// The Loginevent now fires (as intended) after everything is processed
Bukkit.getServer().getPluginManager().callEvent(new LoginEvent(player, true));
player.saveData();