SteamWar/BauSystem
Archiviert
13
0

Merge branch 'master' into ChaosBauGUI

Dieser Commit ist enthalten in:
Chaoscaot 2021-02-13 09:29:36 +01:00
Commit 79aab75d18
17 geänderte Dateien mit 208 neuen und 104 gelöschten Zeilen

Datei anzeigen

@ -28,9 +28,7 @@ import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.TNTPrimed;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
class TPSLimit_12 {

Datei anzeigen

@ -29,7 +29,6 @@ import org.bukkit.entity.TNTPrimed;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
class TPSLimit_15 {

Datei anzeigen

@ -0,0 +1,33 @@
/*
*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2020 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.world;
import net.minecraft.server.v1_15_R1.SystemUtils;
import java.util.function.LongSupplier;
public class TPSUtils_15 {
public static void init(LongSupplier longSupplier) {
SystemUtils.a = () -> System.nanoTime() + longSupplier.getAsLong();
}
}

Datei anzeigen

@ -108,6 +108,7 @@ public class BauSystem extends JavaPlugin implements Listener {
new AFKStopper();
autoShutdown = Bukkit.getScheduler().runTaskLater(this, Bukkit::shutdown, 1200);
TPSUtils.init();
}
public static BauSystem getPlugin() {

Datei anzeigen

@ -22,7 +22,7 @@ package de.steamwar.bausystem.commands;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.world.Welt;
import de.steamwar.core.Core;
import de.steamwar.core.VersionedRunnable;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@ -42,14 +42,8 @@ public class CommandDebugStick implements CommandExecutor {
return false;
}
switch(Core.getVersion()){
case 15:
CommandDebugStick_15.giveStick(player);
break;
case 12:
default:
player.sendMessage(BauSystem.PREFIX + "§cDen Debugstick gibt es nicht in der 1.12.");
}
VersionedRunnable.call(new VersionedRunnable(() -> player.sendMessage(BauSystem.PREFIX + "§cDen Debugstick gibt es nicht in der 1.12."), 8),
new VersionedRunnable(() -> CommandDebugStick_15.giveStick(player), 15));
return false;
}
}

Datei anzeigen

@ -19,8 +19,12 @@
package de.steamwar.bausystem.commands;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.world.Region;
import de.steamwar.core.Core;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.*;
import org.bukkit.event.entity.EntityChangeBlockEvent;
@ -50,11 +54,18 @@ public class CommandFreeze extends RegionToggleCommand {
@EventHandler
public void onEntitySpawn(EntitySpawnEvent e) {
if (Region.getRegion(e.getLocation()).isFreeze()) e.setCancelled(true);
if (!Region.getRegion(e.getLocation()).isFreeze()) return;
e.setCancelled(true);
if (e.getEntityType() == EntityType.PRIMED_TNT) {
Bukkit.getScheduler().runTaskLater(BauSystem.getPlugin(), () -> {
e.getLocation().getBlock().setType(Material.TNT, false);
}, 1L);
}
}
@EventHandler
public void onBlockCanBuild(BlockCanBuildEvent e) {
if (Core.getVersion() == 12) return;
if (!e.isBuildable()) return;
if (!Region.getRegion(e.getBlock().getLocation()).isFreeze()) return;
if (e.getMaterial() == Material.TNT) {

Datei anzeigen

@ -21,6 +21,7 @@ package de.steamwar.bausystem.commands;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.world.Region;
import de.steamwar.bausystem.world.TPSUtils;
import de.steamwar.core.TPSWatcher;
import de.steamwar.sql.BauweltMember;
import de.steamwar.sql.SteamwarUser;
@ -31,6 +32,8 @@ import org.bukkit.entity.Player;
import java.util.List;
import static de.steamwar.bausystem.world.TPSUtils.getTps;
public class CommandInfo implements CommandExecutor {
@Override
@ -55,12 +58,17 @@ public class CommandInfo implements CommandExecutor {
}
sender.sendMessage(membermessage.toString());
sender.sendMessage(BauSystem.PREFIX + "TPS:§e" +
" " + TPSWatcher.getTPS(TPSWatcher.TPSType.ONE_SECOND) +
" " + TPSWatcher.getTPS(TPSWatcher.TPSType.TEN_SECONDS) +
" " + TPSWatcher.getTPS(TPSWatcher.TPSType.ONE_MINUTE) +
" " + TPSWatcher.getTPS(TPSWatcher.TPSType.FIVE_MINUTES) +
" " + TPSWatcher.getTPS(TPSWatcher.TPSType.TEN_MINUTES));
StringBuilder tpsMessage = new StringBuilder();
tpsMessage.append(BauSystem.PREFIX).append("TPS:§e");
tpsMessage.append(" ").append(getTps(TPSWatcher.TPSType.ONE_SECOND));
tpsMessage.append(" ").append(getTps(TPSWatcher.TPSType.TEN_SECONDS));
if (!TPSUtils.isWarping()) {
tpsMessage.append(" ").append(TPSWatcher.getTPS(TPSWatcher.TPSType.ONE_MINUTE));
tpsMessage.append(" ").append(TPSWatcher.getTPS(TPSWatcher.TPSType.FIVE_MINUTES));
tpsMessage.append(" ").append(TPSWatcher.getTPS(TPSWatcher.TPSType.TEN_MINUTES));
}
sender.sendMessage(tpsMessage.toString());
return false;
}
}

Datei anzeigen

@ -61,10 +61,6 @@ public class CommandTNT implements CommandExecutor, Listener {
Bukkit.getPluginManager().registerEvents(this, BauSystem.getPlugin());
}
private String getNoPermMessage() {
return "§cDu darfst hier nicht TNT-Schaden (de-)aktivieren";
}
private String getEnableMessage() {
return "§aTNT-Schaden aktiviert";
}
@ -77,17 +73,13 @@ public class CommandTNT implements CommandExecutor, Listener {
return "§aTNT-Schaden außerhalb Baurahmen aktiviert";
}
private String getDamageMessage() {
return "§cEine Explosion hätte Blöcke im Baubereich zerstört";
}
@Override
public boolean onCommand(CommandSender sender, Command command, String s, String[] args) {
if (!(sender instanceof Player)) return false;
Player player = (Player) sender;
if (Welt.noPermission(player, Permission.world)) {
player.sendMessage(BauSystem.PREFIX + getNoPermMessage());
player.sendMessage(BauSystem.PREFIX + "§cDu darfst hier nicht TNT-Schaden (de-)aktivieren");
return false;
}
@ -149,13 +141,16 @@ public class CommandTNT implements CommandExecutor, Listener {
public void onExplode(EntityExplodeEvent event) {
event.blockList().removeIf(block -> {
Region region = Region.getRegion(block.getLocation());
if (region.getTntMode() == TNTMode.OFF) return true;
if (region.getTntMode() == TNTMode.ON) return false;
if (region.hasBuildRegion() && region.inBuildRegion(block.getLocation())) {
RegionToggleCommand.actionBar(region, getDamageMessage());
RegionToggleCommand.actionBar(region, "§cEine Explosion hätte Blöcke im Baubereich zerstört");
return true;
}
return false;
if (region.hasBuildRegion() && region.inBuildRegionExtension(block.getLocation())) {
RegionToggleCommand.actionBar(region, "§cEine Explosion hätte Blöcke im Ausfahrbereich zerstört");
return true;
}
return region.getTntMode() == TNTMode.OFF;
});
}

Datei anzeigen

@ -21,6 +21,7 @@ package de.steamwar.bausystem.commands;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.world.TPSUtils;
import de.steamwar.bausystem.world.Welt;
import de.steamwar.core.VersionedRunnable;
import net.md_5.bungee.api.ChatMessageType;
@ -77,7 +78,7 @@ public class CommandTPSLimiter implements CommandExecutor {
try {
double tpsLimitDouble = Double.parseDouble(tpsLimit.replace(',', '.'));
if (tpsLimitDouble < 0.5 || tpsLimitDouble > 20) {
if (tpsLimitDouble < 0.5 || tpsLimitDouble > (TPSUtils.isWarpAllowed() ? 40 : 20)) {
sendInvalidArgumentMessage(player);
return false;
}
@ -96,7 +97,7 @@ public class CommandTPSLimiter implements CommandExecutor {
}
private void sendInvalidArgumentMessage(Player player) {
player.sendMessage(BauSystem.PREFIX + "§cNur Zahlen zwischen 0,5 und 20, und 'default' erlaubt.");
player.sendMessage(BauSystem.PREFIX + "§cNur Zahlen zwischen 0,5 und " + (TPSUtils.isWarpAllowed() ? 40 : 20) + ", und 'default' erlaubt.");
}
private void tpsLimiter() {
@ -104,7 +105,8 @@ public class CommandTPSLimiter implements CommandExecutor {
loops = (int)Math.ceil(delay);
sleepDelay = (long) (50 * delay) / loops;
if (currentTPSLimit == 20) {
TPSUtils.setTPS(currentTPSLimit);
if (currentTPSLimit >= 20) {
if (tpsLimiter == null) return;
tpsLimiter.cancel();
tpsLimiter = null;
@ -139,7 +141,7 @@ public class CommandTPSLimiter implements CommandExecutor {
}
public static double getCurrentTPSLimit() {
return currentTPSLimit;
return (double)Math.round(currentTPSLimit * 10.0D) / 10.0D;
}
}

Datei anzeigen

@ -19,6 +19,7 @@
package de.steamwar.bausystem.commands;
import de.steamwar.bausystem.world.TPSUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
@ -29,7 +30,11 @@ import java.util.List;
public class CommandTPSLimiterTabComplete implements TabCompleter {
private List<String> arguments = Arrays.asList("default", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20");
private List<String> arguments = new ArrayList<>(Arrays.asList("default", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20"));
public CommandTPSLimiterTabComplete() {
if (TPSUtils.isWarpAllowed()) arguments.addAll(Arrays.asList("21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40"));
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {

Datei anzeigen

@ -20,7 +20,6 @@
package de.steamwar.bausystem.world;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.core.Core;
import de.steamwar.core.VersionedCallable;
import org.bukkit.Bukkit;
import org.bukkit.Location;
@ -233,12 +232,8 @@ public class AutoLoader extends IAutoLoader implements Listener {
@Override
boolean setRedstone(Location location, boolean active){
switch(Core.getVersion()){
case 15:
return AutoLoader_15.setRedstone(location, active);
default:
return AutoLoader_12.setRedstone(location, active);
}
return VersionedCallable.call(new VersionedCallable<>(() -> AutoLoader_12.setRedstone(location, active), 8),
new VersionedCallable<>(() -> AutoLoader_15.setRedstone(location, active), 15));
}
@Override
@ -264,12 +259,8 @@ public class AutoLoader extends IAutoLoader implements Listener {
@Override
public boolean perform() {
switch(Core.getVersion()){
case 15:
return AutoLoader_15.tntPlaceActionPerform(location);
default:
return AutoLoader_12.tntPlaceActionPerform(location);
}
return VersionedCallable.call(new VersionedCallable<>(() -> AutoLoader_12.tntPlaceActionPerform(location), 8),
new VersionedCallable<>(() -> AutoLoader_15.tntPlaceActionPerform(location), 15));
}
@Override

Datei anzeigen

@ -73,7 +73,7 @@ public class BauScoreboard implements Listener {
}
strings.add("§4");
strings.add("§eTPS§8: " + tpsColor() + TPSWatcher.getTPS() + tpsLimit());
strings.add("§eTPS§8: " + tpsColor() + TPSUtils.getTps(TPSWatcher.TPSType.ONE_SECOND) + tpsLimit());
int i = strings.size();
HashMap<String, Integer> result = new HashMap<>();
@ -87,7 +87,7 @@ public class BauScoreboard implements Listener {
}
private String tpsColor() {
double tps = TPSWatcher.getTPS();
double tps = TPSUtils.getTps(TPSWatcher.TPSType.ONE_SECOND);
if (tps > CommandTPSLimiter.getCurrentTPSLimit() * 0.9) {
return "§a";
}

Datei anzeigen

@ -144,7 +144,7 @@ public class Detonator implements Listener {
} else {
locs.add(new Detoloader.DetonatorActivation(detoloader.getActivation(), event.getClickedBlock().getLocation()));
}
print(detoloader.addBack ? "§e" + detoloader.getBlock() + " getsetzt" :
print(detoloader.addBack ? "§e" + detoloader.getBlock() + " gesetzt" :
detoloader.getBlock(), detoloader.addBack);
}
break;

Datei anzeigen

@ -21,7 +21,7 @@ package de.steamwar.bausystem.world;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import de.steamwar.bausystem.commands.CommandTNT.TNTMode;
import de.steamwar.core.Core;
import de.steamwar.core.VersionedRunnable;
import de.steamwar.sql.NoClipboardException;
import de.steamwar.sql.Schematic;
import org.bukkit.Bukkit;
@ -162,6 +162,10 @@ public class Region {
return prototype.buildArea.inRegion(this, l);
}
public boolean inBuildRegionExtension(Location l) {
return prototype.buildArea.inRegionExtension(this, l);
}
public void fastreset(){
prototype.fastreset(this);
}
@ -212,11 +216,6 @@ public class Region {
return false;
}
@Override
public boolean inBuildRegion(Location l) {
return false;
}
@Override
public boolean hasTestblock() {
return false;
@ -240,6 +239,11 @@ public class Region {
private final int offsetY;
private final int offsetZ;
private final int extensionPositiveZ;
private final int extensionNegativeZ;
private final int extensionPositiveY;
private final int extensionAxisX;
private final String schematic;
private final boolean rotate;
@ -256,6 +260,10 @@ public class Region {
offsetX = config.getInt("offsetX", 0);
offsetY = config.getInt("offsetY", 0);
offsetZ = config.getInt("offsetZ", 0);
extensionPositiveZ = config.getInt("extensionPositiveZ", 0);
extensionNegativeZ = config.getInt("extensionNegativeZ", 0);
extensionPositiveY = config.getInt("extensionPositiveY", 0);
extensionAxisX = config.getInt("extensionAxisX", 0);
rotate = config.getBoolean("rotate", false);
ConfigurationSection testblockSection = config.getConfigurationSection("testblock");
@ -279,19 +287,19 @@ public class Region {
inRange(l.getZ(), region.minZ + offsetZ, sizeZ);
}
public boolean inRegionExtension(Region region, Location l) {
return inRange(l.getX(), region.minX + offsetX - extensionAxisX + 1, sizeX + extensionAxisX * 2 - 1) &&
inRange(l.getY(), region.minY + offsetY, sizeY + extensionPositiveY - 1) &&
inRange(l.getZ(), region.minZ + offsetZ - extensionNegativeZ + 1, sizeZ + extensionNegativeZ - 1 + extensionPositiveZ);
}
public void fastreset(Region region){
File file = new File(schematic);
int x = region.minX + offsetX + sizeX/2;
int y = region.minY + offsetY;
int z = region.minZ + offsetZ + sizeZ/2;
switch(Core.getVersion()){
case 12:
Region_12.paste(file, x, y, z, rotate);
break;
case 15:
default:
Region_15.fastpaste(file, x, y, z, rotate);
}
VersionedRunnable.call(new VersionedRunnable(() -> Region_12.paste(file, x, y, z, rotate), 8),
new VersionedRunnable(() -> Region_15.fastpaste(file, x, y, z, rotate), 15));
}
public void reset(Region region, Schematic schem) throws IOException, NoClipboardException {
@ -331,25 +339,13 @@ public class Region {
}
private static void paste(File file, int x, int y, int z, boolean rotate){ //Type of protect
switch(Core.getVersion()){
case 12:
Region_12.paste(file, x, y, z, rotate);
break;
case 15:
default:
Region_15.paste(file, x, y, z, rotate);
}
VersionedRunnable.call(new VersionedRunnable(() -> Region_12.paste(file, x, y, z, rotate), 8),
new VersionedRunnable(() -> Region_15.paste(file, x, y, z, rotate), 15));
}
private static void paste(Clipboard clipboard, int x, int y, int z, boolean rotate){
switch(Core.getVersion()){
case 12:
Region_12.paste(clipboard, x, y, z, rotate);
break;
case 15:
default:
Region_15.paste(clipboard, x, y, z, rotate);
}
VersionedRunnable.call(new VersionedRunnable(() -> Region_12.paste(clipboard, x, y, z, rotate), 8),
new VersionedRunnable(() -> Region_15.paste(clipboard, x, y, z, rotate), 15));
}
}
}

Datei anzeigen

@ -21,6 +21,7 @@ package de.steamwar.bausystem.world;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.events.PacketAdapter;
import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.events.PacketEvent;
@ -28,20 +29,18 @@ import com.comphenix.protocol.wrappers.BlockPosition;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.core.Core;
import de.steamwar.core.VersionedCallable;
import de.steamwar.core.VersionedRunnable;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import com.comphenix.protocol.ProtocolLibrary;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Sign;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockCanBuildEvent;
import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.event.block.*;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerInteractEvent;
@ -72,8 +71,9 @@ public class RegionListener implements Listener {
@EventHandler(priority = EventPriority.LOWEST)
public void onBlockCanBuild(BlockCanBuildEvent e) {
Player p = e.getPlayer();
if (Core.getVersion() == 12) return;
Player p = e.getPlayer();
try{
if (Welt.noPermission(p, Permission.build)){
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier keine Blöcke platzieren");
@ -84,6 +84,21 @@ public class RegionListener implements Listener {
}
}
@EventHandler(priority = EventPriority.LOWEST)
public void onBlockPlace(BlockPlaceEvent e) {
if (Core.getVersion() == 15) return;
Player p = e.getPlayer();
try{
if (Welt.noPermission(p, Permission.build)){
p.sendMessage(BauSystem.PREFIX + "§cDu darfst hier keine Blöcke platzieren");
e.setCancelled(true);
}
}catch(NullPointerException ex){
//ignored, caused by worldedit brushes
}
}
private static final String[] shortcutCommands = {"//1", "//2", "//90", "//-90", "//180", "//p", "//c", "//flopy", "//floppy", "//flopyp", "//floppyp", "//u", "//r"};
private boolean isWorldEditCommand(String command) {
@ -91,13 +106,8 @@ public class RegionListener implements Listener {
if(command.startsWith(shortcut))
return true;
switch(Core.getVersion()){
case 12:
return RegionListener_12.isWorldEditCommand(command);
case 15:
default:
return RegionListener_15.isWorldEditCommand(command);
}
return VersionedCallable.call(new VersionedCallable<>(() -> RegionListener_12.isWorldEditCommand(command), 8),
new VersionedCallable<>(() -> RegionListener_15.isWorldEditCommand(command), 15));
}
@EventHandler
@ -115,7 +125,8 @@ public class RegionListener implements Listener {
public void editSign(PlayerInteractEvent event) {
if(event.getAction() != Action.RIGHT_CLICK_BLOCK ||
!event.getClickedBlock().getType().name().contains("SIGN") ||
!event.getPlayer().isSneaking())
!event.getPlayer().isSneaking() ||
(event.getItem() != null && event.getItem().getType() != Material.AIR))
return;
Player player = event.getPlayer();

Datei anzeigen

@ -23,7 +23,7 @@ import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.commands.CommandScript;
import de.steamwar.bausystem.commands.CommandTNT;
import de.steamwar.bausystem.tracer.record.RecordStateMachine;
import de.steamwar.core.Core;
import de.steamwar.core.VersionedCallable;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
@ -72,13 +72,8 @@ public class ScriptListener implements Listener {
}
private boolean isNoBook(ItemStack item){
switch(Core.getVersion()){
case 12:
return ScriptListener_12.isNoBook(item);
case 15:
default:
return ScriptListener_15.isNoBook(item);
}
return VersionedCallable.call(new VersionedCallable<>(() -> ScriptListener_12.isNoBook(item), 8),
new VersionedCallable<>(() -> ScriptListener_15.isNoBook(item), 15));
}
private static class ScriptExecutor {

Datei anzeigen

@ -0,0 +1,65 @@
/*
*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2020 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.world;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.commands.CommandTPSLimiter;
import de.steamwar.core.TPSWatcher;
import de.steamwar.core.VersionedRunnable;
import org.bukkit.Bukkit;
public class TPSUtils {
private TPSUtils() {
throw new IllegalStateException("Utility Class");
}
private static boolean warp = true;
private static long nanoOffset = 0;
private static long nanoDOffset = 0;
public static void init() {
VersionedRunnable.call(new VersionedRunnable(() -> warp = false, 8),
new VersionedRunnable(() -> {
Bukkit.getScheduler().runTaskTimer(BauSystem.getPlugin(), () -> nanoOffset += nanoDOffset, 1, 1);
TPSUtils_15.init(() -> nanoOffset);
}, 15));
}
public static void setTPS(double tps) {
double d = 50 - (50 / (tps / 20.0));
nanoDOffset = Math.max(0, Math.min((long) (d * 1000000), 25000000));
}
public static boolean isWarpAllowed() {
return warp;
}
public static boolean isWarping() {
return nanoDOffset > 0;
}
public static double getTps(TPSWatcher.TPSType tpsType) {
if (TPSUtils.isWarping()) return TPSWatcher.getTPS(tpsType, Math.max(CommandTPSLimiter.getCurrentTPSLimit(), 20));
return TPSWatcher.getTPS(tpsType);
}
}