cache player's flying enabled state.
This commit is contained in:
+5
-12
@@ -53,6 +53,7 @@ public class LimboCache {
|
||||
String name = player.getName().toLowerCase();
|
||||
Location loc = player.getLocation();
|
||||
boolean operator = false;
|
||||
boolean flyEnabled = false;
|
||||
String playerGroup = "";
|
||||
|
||||
// Get the permissions manager, and make sure it's valid
|
||||
@@ -66,30 +67,22 @@ public class LimboCache {
|
||||
if (cache != null) {
|
||||
playerGroup = cache.getGroup();
|
||||
operator = cache.getOperator();
|
||||
flyEnabled = cache.isFlyEnabled();
|
||||
}
|
||||
} else {
|
||||
operator = player.isOp();
|
||||
|
||||
// Check whether groups are supported
|
||||
if (permsMan.hasGroupSupport())
|
||||
if (permsMan.hasGroupSupport()) {
|
||||
playerGroup = permsMan.getPrimaryGroup(player);
|
||||
}
|
||||
}
|
||||
|
||||
if (player.isDead()) {
|
||||
loc = plugin.getSpawnLocation(player);
|
||||
}
|
||||
|
||||
cache.put(name, new LimboPlayer(name, loc, operator, playerGroup));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method addLimboPlayer.
|
||||
*
|
||||
* @param player Player
|
||||
* @param group String
|
||||
*/
|
||||
public void addLimboPlayer(Player player, String group) {
|
||||
cache.put(player.getName().toLowerCase(), new LimboPlayer(player.getName().toLowerCase(), group));
|
||||
cache.put(name, new LimboPlayer(name, loc, operator, playerGroup, flyEnabled));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+9
-28
@@ -8,37 +8,20 @@ import org.bukkit.scheduler.BukkitTask;
|
||||
public class LimboPlayer {
|
||||
|
||||
private final String name;
|
||||
private final boolean fly;
|
||||
private Location loc = null;
|
||||
private BukkitTask timeoutTaskId = null;
|
||||
private BukkitTask messageTaskId = null;
|
||||
private boolean operator = false;
|
||||
private String group = "";
|
||||
private String group;
|
||||
|
||||
/**
|
||||
* Constructor for LimboPlayer.
|
||||
*
|
||||
* @param name String
|
||||
* @param loc Location
|
||||
* @param operator boolean
|
||||
* @param group String
|
||||
*/
|
||||
public LimboPlayer(String name, Location loc,
|
||||
boolean operator, String group) {
|
||||
public LimboPlayer(String name, Location loc, boolean operator,
|
||||
String group, boolean fly) {
|
||||
this.name = name;
|
||||
this.loc = loc;
|
||||
this.operator = operator;
|
||||
this.group = group;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for LimboPlayer.
|
||||
*
|
||||
* @param name String
|
||||
* @param group String
|
||||
*/
|
||||
public LimboPlayer(String name, String group) {
|
||||
this.name = name;
|
||||
this.group = group;
|
||||
this.fly = fly;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -77,11 +60,10 @@ public class LimboPlayer {
|
||||
return group;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method getTimeoutTaskId.
|
||||
*
|
||||
* @return BukkitTask
|
||||
*/
|
||||
public boolean isFly() {
|
||||
return fly;
|
||||
}
|
||||
|
||||
public BukkitTask getTimeoutTaskId() {
|
||||
return timeoutTaskId;
|
||||
}
|
||||
@@ -121,7 +103,6 @@ public class LimboPlayer {
|
||||
|
||||
/**
|
||||
* Method clearTask.
|
||||
*
|
||||
*/
|
||||
public void clearTask() {
|
||||
if (messageTaskId != null) {
|
||||
|
||||
Reference in New Issue
Block a user