Fix Fly and GameMode

This commit is contained in:
Xephi59
2015-07-09 18:04:43 +02:00
parent 1b9f4e7141
commit 7a4550246f
10 changed files with 59 additions and 63 deletions
@@ -53,7 +53,7 @@ public class AsyncronousJoin {
AuthMePlayerListener.gameMode.put(name, player.getGameMode());
BukkitScheduler sched = plugin.getServer().getScheduler();
if (plugin.getCitizensCommunicator().isNPC(player, plugin) || Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) {
if (plugin.getCitizensCommunicator().isNPC(player) || Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) {
return;
}
@@ -216,7 +216,7 @@ public class AsyncronousJoin {
public void run() {
if (player.isOp())
player.setOp(false);
if (!Settings.isMovementAllowed) {
if (player.getGameMode() != GameMode.CREATIVE && !Settings.isMovementAllowed) {
player.setAllowFlight(true);
player.setFlying(true);
}
@@ -10,7 +10,6 @@ import org.bukkit.potion.PotionEffectType;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.Utils;
import fr.xephi.authme.Utils.groupType;
import fr.xephi.authme.api.API;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.cache.backup.FileCache;
import fr.xephi.authme.cache.limbo.LimboCache;
@@ -53,8 +52,13 @@ public class ProcessSyncronousPlayerLogin implements Runnable {
protected void restoreOpState() {
player.setOp(limbo.getOperator());
if (player.getGameMode() != GameMode.CREATIVE && !Settings.isMovementAllowed) {
player.setAllowFlight(limbo.isFlying());
player.setFlying(limbo.isFlying());
if (limbo.getGameMode() != GameMode.CREATIVE) {
player.setAllowFlight(limbo.isFlying());
player.setFlying(limbo.isFlying());
} else {
player.setAllowFlight(false);
player.setFlying(false);
}
}
}
@@ -120,8 +124,8 @@ public class ProcessSyncronousPlayerLogin implements Runnable {
* ProtectInventoryEvent after Teleporting Also it's the current
* world inventory !
*/
player.setGameMode(limbo.getGameMode());
if (!Settings.forceOnlyAfterLogin) {
player.setGameMode(limbo.getGameMode());
// Inventory - Make it after restore GameMode , cause we need to
// restore the
// right inventory in the right gamemode
@@ -146,7 +150,8 @@ public class ProcessSyncronousPlayerLogin implements Runnable {
} else {
teleportBackFromSpawn();
}
} else if (Settings.isForceSpawnLocOnJoinEnabled && Settings.getForcedWorlds.contains(player.getWorld().getName())) {
} else
if (Settings.isForceSpawnLocOnJoinEnabled && Settings.getForcedWorlds.contains(player.getWorld().getName())) {
teleportToSpawn();
} else if (Settings.isSaveQuitLocationEnabled && auth.getQuitLocY() != 0) {
packQuitLocation();
@@ -51,8 +51,10 @@ public class ProcessSyncronousPlayerLogout implements Runnable {
if (Settings.applyBlindEffect)
player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, Settings.getRegistrationTimeout * 20, 2));
player.setOp(false);
player.setAllowFlight(true);
player.setFlying(true);
if (!Settings.isMovementAllowed) {
player.setAllowFlight(true);
player.setFlying(true);
}
// Player is now logout... Time to fire event !
sched.scheduleSyncDelayedTask(plugin, new Runnable() {
@@ -45,7 +45,7 @@ public class AsyncronousQuit {
public void process() {
final Player player = p;
if (plugin.getCitizensCommunicator().isNPC(player, plugin) || Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) {
if (plugin.getCitizensCommunicator().isNPC(player) || Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) {
return;
}