Added a way to add extra time when a player is afk in spawn
This commit is contained in:
parent
14f45d2d82
commit
d25e76dc48
|
|
@ -56,9 +56,17 @@ public class AFKPlayer {
|
|||
}
|
||||
|
||||
public int getafkTime() {
|
||||
if (isInSpawn())
|
||||
return this.afkTime + Config.EXTRA_MIN_IN_SPAWN;
|
||||
return this.afkTime;
|
||||
}
|
||||
|
||||
public boolean isInSpawn() {
|
||||
double x = getplayerToSphereCenter().getX();
|
||||
double z = getplayerToSphereCenter().getZ();
|
||||
return x < Config.SPAWN_MAX_X && x > Config.SPAWN_MIN_X && z < Config.SPAWN_MAX_Z && z > Config.SPAWN_MIN_Z;
|
||||
}
|
||||
|
||||
public void setafk(boolean bool) {
|
||||
isafk = bool;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import java.io.File;
|
|||
|
||||
@SuppressWarnings("unused")
|
||||
public class Config extends AbstractConfiguration {
|
||||
|
||||
private Config() {
|
||||
super(new File(System.getProperty("user.home") + File.separator + "share" + File.separator + "configs" + File.separator + AFKDetector.getInstance().getName()), "config");
|
||||
}
|
||||
|
|
@ -75,4 +76,17 @@ public class Config extends AbstractConfiguration {
|
|||
COMMANDWILLCANCEL = config.getBoolean("events.commands", COMMANDWILLCANCEL);
|
||||
}
|
||||
|
||||
public static int SPAWN_MAX_X = 250;
|
||||
public static int SPAWN_MIN_X = -250;
|
||||
public static int SPAWN_MAX_Z = 250;
|
||||
public static int SPAWN_MIN_Z = -250;
|
||||
public static int EXTRA_MIN_IN_SPAWN = 10;
|
||||
private static void spawnSettings() {
|
||||
SPAWN_MAX_X = config.getInt("spawn.max-x", SPAWN_MAX_X);
|
||||
SPAWN_MIN_X = config.getInt("spawn.min-x", SPAWN_MIN_X);
|
||||
SPAWN_MAX_Z = config.getInt("spawn.max-z", SPAWN_MAX_Z);
|
||||
SPAWN_MIN_Z = config.getInt("spawn.min-z", SPAWN_MIN_Z);
|
||||
EXTRA_MIN_IN_SPAWN = config.getInt("spawn.extra-time", EXTRA_MIN_IN_SPAWN);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user