Reformatted Code
This commit is contained in:
@@ -34,25 +34,25 @@ public class CmdStuck extends FCommand {
|
||||
final Player player = fme.getPlayer();
|
||||
final Location sentAt = player.getLocation();
|
||||
final FLocation chunk = fme.getLastStoodAt();
|
||||
final long delay = SavageFactions.plugin.getConfig().getLong("hcf.stuck.delay", 30);
|
||||
final int radius = SavageFactions.plugin.getConfig().getInt("hcf.stuck.radius", 10);
|
||||
final long delay = SavageFactions.plugin.getConfig().getLong("hcf.stuck.delay", 30);
|
||||
final int radius = SavageFactions.plugin.getConfig().getInt("hcf.stuck.radius", 10);
|
||||
|
||||
if (SavageFactions.plugin.getStuckMap().containsKey(player.getUniqueId())) {
|
||||
long wait = SavageFactions.plugin.getTimers().get(player.getUniqueId()) - System.currentTimeMillis();
|
||||
if (SavageFactions.plugin.getStuckMap().containsKey(player.getUniqueId())) {
|
||||
long wait = SavageFactions.plugin.getTimers().get(player.getUniqueId()) - System.currentTimeMillis();
|
||||
String time = DurationFormatUtils.formatDuration(wait, TL.COMMAND_STUCK_TIMEFORMAT.toString(), true);
|
||||
msg(TL.COMMAND_STUCK_EXISTS, time);
|
||||
} else {
|
||||
|
||||
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
||||
if (!payForCommand(Conf.econCostStuck, TL.COMMAND_STUCK_TOSTUCK.format(fme.getName()), TL.COMMAND_STUCK_FORSTUCK.format(fme.getName()))) {
|
||||
if (! payForCommand(Conf.econCostStuck, TL.COMMAND_STUCK_TOSTUCK.format(fme.getName()), TL.COMMAND_STUCK_FORSTUCK.format(fme.getName()))) {
|
||||
return;
|
||||
}
|
||||
|
||||
final int id = Bukkit.getScheduler().runTaskLater(SavageFactions.plugin, new BukkitRunnable() {
|
||||
final int id = Bukkit.getScheduler().runTaskLater(SavageFactions.plugin, new BukkitRunnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (! SavageFactions.plugin.getStuckMap().containsKey(player.getUniqueId())) {
|
||||
if (! SavageFactions.plugin.getStuckMap().containsKey(player.getUniqueId())) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -60,8 +60,8 @@ public class CmdStuck extends FCommand {
|
||||
final World world = chunk.getWorld();
|
||||
if (world.getUID() != player.getWorld().getUID() || sentAt.distance(player.getLocation()) > radius) {
|
||||
msg(TL.COMMAND_STUCK_OUTSIDE.format(radius));
|
||||
SavageFactions.plugin.getTimers().remove(player.getUniqueId());
|
||||
SavageFactions.plugin.getStuckMap().remove(player.getUniqueId());
|
||||
SavageFactions.plugin.getTimers().remove(player.getUniqueId());
|
||||
SavageFactions.plugin.getStuckMap().remove(player.getUniqueId());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -73,18 +73,18 @@ public class CmdStuck extends FCommand {
|
||||
public boolean work() {
|
||||
FLocation chunk = currentFLocation();
|
||||
Faction faction = board.getFactionAt(chunk);
|
||||
int buffer = SavageFactions.plugin.getConfig().getInt("world-border.buffer", 0);
|
||||
if (faction.isWilderness() && !chunk.isOutsideWorldBorder(buffer)) {
|
||||
int buffer = SavageFactions.plugin.getConfig().getInt("world-border.buffer", 0);
|
||||
if (faction.isWilderness() && ! chunk.isOutsideWorldBorder(buffer)) {
|
||||
int cx = FLocation.chunkToBlock((int) chunk.getX());
|
||||
int cz = FLocation.chunkToBlock((int) chunk.getZ());
|
||||
int y = world.getHighestBlockYAt(cx, cz);
|
||||
Location tp = new Location(world, cx, y, cz);
|
||||
msg(TL.COMMAND_STUCK_TELEPORT, tp.getBlockX(), tp.getBlockY(), tp.getBlockZ());
|
||||
SavageFactions.plugin.getTimers().remove(player.getUniqueId());
|
||||
SavageFactions.plugin.getStuckMap().remove(player.getUniqueId());
|
||||
if (!Essentials.handleTeleport(player, tp)) {
|
||||
SavageFactions.plugin.getTimers().remove(player.getUniqueId());
|
||||
SavageFactions.plugin.getStuckMap().remove(player.getUniqueId());
|
||||
if (! Essentials.handleTeleport(player, tp)) {
|
||||
player.teleport(tp);
|
||||
SavageFactions.plugin.debug("/f stuck used regular teleport, not essentials!");
|
||||
SavageFactions.plugin.debug("/f stuck used regular teleport, not essentials!");
|
||||
}
|
||||
this.stop();
|
||||
return false;
|
||||
@@ -95,11 +95,11 @@ public class CmdStuck extends FCommand {
|
||||
}
|
||||
}, delay * 20).getTaskId();
|
||||
|
||||
SavageFactions.plugin.getTimers().put(player.getUniqueId(), System.currentTimeMillis() + (delay * 1000));
|
||||
long wait = SavageFactions.plugin.getTimers().get(player.getUniqueId()) - System.currentTimeMillis();
|
||||
SavageFactions.plugin.getTimers().put(player.getUniqueId(), System.currentTimeMillis() + (delay * 1000));
|
||||
long wait = SavageFactions.plugin.getTimers().get(player.getUniqueId()) - System.currentTimeMillis();
|
||||
String time = DurationFormatUtils.formatDuration(wait, TL.COMMAND_STUCK_TIMEFORMAT.toString(), true);
|
||||
msg(TL.COMMAND_STUCK_START, time);
|
||||
SavageFactions.plugin.getStuckMap().put(player.getUniqueId(), id);
|
||||
SavageFactions.plugin.getStuckMap().put(player.getUniqueId(), id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user