Remove gamemode and flying switching

Fixes Xephi/AuthMeReloaded#355
Fixes Xephi/AuthMeReloaded#320
Fixes Xephi/AuthMeReloaded#258
Fixes Xephi/AuthMeReloaded#246
This commit is contained in:
games647
2015-12-22 11:05:35 +01:00
parent 1ded09b5ab
commit 8c1eef3f59
16 changed files with 14 additions and 231 deletions
+2 -23
View File
@@ -4,11 +4,7 @@ import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.backup.DataFileCache;
import fr.xephi.authme.cache.backup.JsonCache;
import fr.xephi.authme.events.ResetInventoryEvent;
import fr.xephi.authme.permission.PermissionsManager;
import fr.xephi.authme.settings.Settings;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.entity.Player;
@@ -56,10 +52,8 @@ public class LimboCache {
public void addLimboPlayer(Player player) {
String name = player.getName().toLowerCase();
Location loc = player.getLocation();
GameMode gameMode = player.getGameMode();
boolean operator = false;
String playerGroup = "";
boolean flying = false;
// Get the permissions manager, and make sure it's valid
PermissionsManager permsMan = this.plugin.getPermissionsManager();
@@ -72,35 +66,20 @@ public class LimboCache {
if (cache != null) {
playerGroup = cache.getGroup();
operator = cache.getOperator();
flying = cache.isFlying();
}
} else {
operator = player.isOp();
flying = player.isFlying();
// Check whether groups are supported
if (permsMan.hasGroupSupport())
playerGroup = permsMan.getPrimaryGroup(player);
}
if (Settings.isForceSurvivalModeEnabled) {
if (Settings.isResetInventoryIfCreative && gameMode == GameMode.CREATIVE) {
ResetInventoryEvent event = new ResetInventoryEvent(player);
Bukkit.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
player.getInventory().clear();
player.sendMessage("Your inventory has been cleaned!");
}
}
if (gameMode == GameMode.CREATIVE) {
flying = false;
}
gameMode = GameMode.SURVIVAL;
}
if (player.isDead()) {
loc = plugin.getSpawnLocation(player);
}
cache.put(name, new LimboPlayer(name, loc, gameMode, operator, playerGroup, flying));
cache.put(name, new LimboPlayer(name, loc, operator, playerGroup));
}
/**
+2 -27
View File
@@ -1,6 +1,5 @@
package fr.xephi.authme.cache.limbo;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.scheduler.BukkitTask;
@@ -12,29 +11,23 @@ public class LimboPlayer {
private Location loc = null;
private BukkitTask timeoutTaskId = null;
private BukkitTask messageTaskId = null;
private GameMode gameMode = GameMode.SURVIVAL;
private boolean operator = false;
private String group = "";
private boolean flying = false;
/**
* Constructor for LimboPlayer.
*
* @param name String
* @param loc Location
* @param gameMode GameMode
* @param operator boolean
* @param group String
* @param flying boolean
*/
public LimboPlayer(String name, Location loc, GameMode gameMode,
boolean operator, String group, boolean flying) {
public LimboPlayer(String name, Location loc,
boolean operator, String group) {
this.name = name;
this.loc = loc;
this.gameMode = gameMode;
this.operator = operator;
this.group = group;
this.flying = flying;
}
/**
@@ -66,15 +59,6 @@ public class LimboPlayer {
return loc;
}
/**
* Method getGameMode.
*
* @return GameMode
*/
public GameMode getGameMode() {
return gameMode;
}
/**
* Method getOperator.
*
@@ -149,13 +133,4 @@ public class LimboPlayer {
}
timeoutTaskId = null;
}
/**
* Method isFlying.
*
* @return boolean
*/
public boolean isFlying() {
return flying;
}
}