SteamWar/BauSystem
Archiviert
13
0

Merge pull request 'Boost CommandTPSLimiter to 60' (#228) from TPSLimit into master

Reviewed-on: #228
Reviewed-by: Chaoscaot <chaoscaot444@gmail.com>
Dieser Commit ist enthalten in:
YoyoNow 2021-04-03 21:29:32 +02:00
Commit faba85d338
2 geänderte Dateien mit 7 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -63,7 +63,9 @@ public class CommandTPSLimiter extends SWCommand {
public CommandTPSLimiter() {
super("tpslimit");
if (TPSUtils.isWarpAllowed()) {
tabCompletions.addAll(Arrays.asList("21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40"));
for (int i = 20; i <= 60; i += 5) {
tabCompletions.add(i + "");
}
}
}
@ -84,7 +86,7 @@ public class CommandTPSLimiter extends SWCommand {
@Register
public void valueCommand(Player p, double tpsLimitDouble) {
if (!permissionCheck(p)) return;
if (tpsLimitDouble < 0.5 || tpsLimitDouble > (TPSUtils.isWarpAllowed() ? 40 : 20)) {
if (tpsLimitDouble < 0.5 || tpsLimitDouble > (TPSUtils.isWarpAllowed() ? 60 : 20)) {
sendInvalidArgumentMessage(p);
return;
}
@ -117,7 +119,7 @@ public class CommandTPSLimiter extends SWCommand {
}
private void sendInvalidArgumentMessage(Player player) {
player.sendMessage(BauSystem.PREFIX + "§cNur Zahlen zwischen 0,5 und " + (TPSUtils.isWarpAllowed() ? 40 : 20) + ", und 'default' erlaubt.");
player.sendMessage(BauSystem.PREFIX + "§cNur Zahlen zwischen 0,5 und " + (TPSUtils.isWarpAllowed() ? 60 : 20) + ", und 'default' erlaubt.");
}
private void tpsLimiter() {
@ -166,7 +168,7 @@ public class CommandTPSLimiter extends SWCommand {
public static void setTPS(double d) {
if (d < 0.5) d = 0.5;
if (d > (TPSUtils.isWarpAllowed() ? 40 : 20)) d = (TPSUtils.isWarpAllowed() ? 40 : 20);
if (d > (TPSUtils.isWarpAllowed() ? 60 : 20)) d = (TPSUtils.isWarpAllowed() ? 60 : 20);
if (instance != null) {
currentTPSLimit = d;
instance.tpsLimiter();

Datei anzeigen

@ -55,7 +55,7 @@ public class TPSUtils {
public static void setTPS(double tps) {
double d = 50 - (50 / (tps / 20.0));
nanoDOffset = Math.max(0, Math.min((long) (d * 1000000), 25000000));
nanoDOffset = Math.max(0, Math.min((long) (d * 1000000), 37500000));
}
public static boolean isWarpAllowed() {