Added decimal support to time-between-players
This commit is contained in:
@@ -27,7 +27,7 @@ public class Main extends Plugin implements Listener {
|
|||||||
|
|
||||||
static Main plugin = null;
|
static Main plugin = null;
|
||||||
|
|
||||||
public int timeBetweenPlayers = 5;
|
public double timeBetweenPlayers = 5.0;
|
||||||
|
|
||||||
BungeeStats metrics;
|
BungeeStats metrics;
|
||||||
|
|
||||||
@@ -122,7 +122,7 @@ public class Main extends Plugin implements Listener {
|
|||||||
getProxy().registerChannel("ajqueue:tospigot");
|
getProxy().registerChannel("ajqueue:tospigot");
|
||||||
getProxy().registerChannel("ajqueue:tobungee");
|
getProxy().registerChannel("ajqueue:tobungee");
|
||||||
|
|
||||||
timeBetweenPlayers = config.getInt("wait-time");
|
timeBetweenPlayers = config.getDouble("wait-time");
|
||||||
|
|
||||||
isp = Logic.isp;
|
isp = Logic.isp;
|
||||||
|
|
||||||
|
|||||||
@@ -94,13 +94,13 @@ public class Manager {
|
|||||||
public void run() {
|
public void run() {
|
||||||
sendPlayers();
|
sendPlayers();
|
||||||
}
|
}
|
||||||
}, 2, pl.timeBetweenPlayers, TimeUnit.SECONDS).getId();
|
}, 2, Math.round(pl.timeBetweenPlayers*1000), TimeUnit.MILLISECONDS).getId();
|
||||||
|
|
||||||
updateId = pl.getProxy().getScheduler().schedule(pl, new Runnable() {
|
updateId = pl.getProxy().getScheduler().schedule(pl, new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
updateServers();
|
updateServers();
|
||||||
}
|
}
|
||||||
}, 0, Math.max(pl.timeBetweenPlayers, 2), TimeUnit.SECONDS).getId();
|
}, 0, Math.max(Math.round(pl.timeBetweenPlayers), 2), TimeUnit.SECONDS).getId();
|
||||||
//pl.getLogger().info("Time: "+pl.timeBetweenPlayers);
|
//pl.getLogger().info("Time: "+pl.timeBetweenPlayers);
|
||||||
|
|
||||||
messagerId = pl.getProxy().getScheduler().schedule(pl, new Runnable() {
|
messagerId = pl.getProxy().getScheduler().schedule(pl, new Runnable() {
|
||||||
@@ -220,7 +220,7 @@ public class Manager {
|
|||||||
.replaceAll("\\{SERVER\\}", pl.aliases.getAlias(s.getName()))
|
.replaceAll("\\{SERVER\\}", pl.aliases.getAlias(s.getName()))
|
||||||
.replaceAll("\\{STATUS\\}", status)+";time="+pl.timeBetweenPlayers);
|
.replaceAll("\\{STATUS\\}", status)+";time="+pl.timeBetweenPlayers);
|
||||||
} else {
|
} else {
|
||||||
int time = pos*pl.timeBetweenPlayers;
|
int time = (int) Math.round(pos*pl.timeBetweenPlayers);
|
||||||
int min = (int) Math.floor((time) / (60));
|
int min = (int) Math.floor((time) / (60));
|
||||||
int sec = (int) Math.floor((time % (60)));
|
int sec = (int) Math.floor((time % (60)));
|
||||||
String timeStr;
|
String timeStr;
|
||||||
@@ -339,7 +339,7 @@ public class Manager {
|
|||||||
.replaceAll("\\{SERVER\\}", pl.aliases.getAlias(s.getName()))
|
.replaceAll("\\{SERVER\\}", pl.aliases.getAlias(s.getName()))
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
int time = pos*pl.timeBetweenPlayers;
|
int time = (int) Math.round(pos*pl.timeBetweenPlayers);
|
||||||
int min = (int) Math.floor((time) / (60));
|
int min = (int) Math.floor((time) / (60));
|
||||||
int sec = (int) Math.floor((time % (60)));
|
int sec = (int) Math.floor((time % (60)));
|
||||||
String timeStr;
|
String timeStr;
|
||||||
|
|||||||
Reference in New Issue
Block a user