Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
dccae06a36
Commit
a04cc76bbe
@ -518,6 +518,23 @@ BLOCK_COUNTER_MESSAGE = §e{0} §7Blöcke §e{1} §7TNT §e{2} §7Blöcke/TNT
|
||||
BLOCK_COUNTER_ENABLE = §7BlockCounter angemacht
|
||||
BLOCK_COUNTER_DISABLE = §7BlockCounter ausgemacht
|
||||
|
||||
# TPSLimit
|
||||
TICK_STEP_HELP = §8/§etick step §8<§7Ticks§8> §8- §7Spule n Ticks vor
|
||||
TICK_STEP_SINGLE_HELP = §8/§etick step §8- §7Spule einen Ticks vor
|
||||
TICK_WARP_HELP = §8/§etick warp §8<§7Ticks§8> §8- §7Warpe n Ticks vor
|
||||
TICK_STEP = §eSpult {0} Ticks vor
|
||||
TICK_WARP = §eWarpe {0} Ticks vor
|
||||
TPSLIMIT_GUI_ITEM_NAME = §eTPS Limiter
|
||||
TPSLIMIT_GUI_ITEM_LORE = §7Aktuell: §e{0}
|
||||
TPSLIMIT_ANVIL_GUI = Neues TPS Limit
|
||||
TPSLIMIT_HELP = §8/§etpslimit §8[§7TPS§8|§edefault§8] §8- §7Setzte die TPS auf dem Bau
|
||||
TPSLIMIT_CURRENT = §7Jetziges TPS limit§8: §e{0}
|
||||
TPSLIMIT_NO_PERMS = §cDu darfst hier nicht den TPS-Limiter nutzen
|
||||
TPSLIMIT_SET = §eTPS limit auf {0} gesetzt.
|
||||
TPSLIMIT_FROZEN = §eTPS eingefroren.
|
||||
TPSLIMIT_INVALID = §cNur Zahlen zwischen 0,5 und {0}, und 'default'{1} erlaubt.
|
||||
TPSLIMIT_INVALID_FROZEN = §c und '0'
|
||||
|
||||
# Trace
|
||||
TRACE_RECORD=§aan
|
||||
TRACE_RECORD-AUTO=§aan
|
||||
@ -534,7 +551,6 @@ TRACE_MESSAGE_SINGLE = §aSingle-Tracer gestartet
|
||||
TRACE_MESSAGE_STOP = §cTNT-Tracer gestoppt
|
||||
TRACE_MESSAGE_DELETE = §cAlle TNT-Positionen gelöscht
|
||||
TRACE_MESSAGE_SHOW = §aAlle TNT-Positionen angezeigt
|
||||
TRACE_MESSAGE_SHOW_UNKNOWN = §cUnbekannter Show Mode
|
||||
TRACE_MESSAGE_HIDE = §cAlle TNT-Positionen ausgeblendet
|
||||
TRACE_MESSAGE_DISALLOWED = §cDu darfst hier nicht den TNT-Tracer nutzen
|
||||
|
||||
|
@ -19,11 +19,11 @@
|
||||
|
||||
package de.steamwar.bausystem.features.tpslimit;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.config.ColorConfig;
|
||||
import de.steamwar.bausystem.linkage.specific.BauGuiItem;
|
||||
import de.steamwar.bausystem.linkage.LinkageType;
|
||||
import de.steamwar.bausystem.linkage.Linked;
|
||||
import de.steamwar.bausystem.linkage.specific.BauGuiItem;
|
||||
import de.steamwar.inventory.SWAnvilInv;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
import org.bukkit.Material;
|
||||
@ -42,14 +42,14 @@ public class TPSLimitBauGuiItem extends BauGuiItem {
|
||||
|
||||
@Override
|
||||
public ItemStack getItem(Player player) {
|
||||
return new SWItem(Material.CLOCK, ColorConfig.HIGHLIGHT + "TPS Limiter", Arrays.asList(ColorConfig.BASE + "Aktuell: " + ColorConfig.HIGHLIGHT + TPSLimitUtils.getCurrentTPSLimit()), false, clickType -> {
|
||||
return new SWItem(Material.CLOCK, BauSystem.MESSAGE.parse("TPSLIMIT_GUI_ITEM_NAME", player), Arrays.asList(BauSystem.MESSAGE.parse("TPSLIMIT_GUI_ITEM_LORE", player, TPSLimitUtils.getCurrentTPSLimit())), false, clickType -> {
|
||||
}).getItemStack();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean click(ClickType click, Player p) {
|
||||
p.closeInventory();
|
||||
SWAnvilInv inv = new SWAnvilInv(p, "Neues TPS Limit");
|
||||
SWAnvilInv inv = new SWAnvilInv(p, BauSystem.MESSAGE.parse("TPSLIMIT_ANVIL_GUI", p));
|
||||
inv.setItem(Material.CLOCK);
|
||||
inv.setCallback(s -> p.performCommand("tpslimit " + s));
|
||||
inv.open();
|
||||
|
@ -21,15 +21,13 @@ package de.steamwar.bausystem.features.tpslimit;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.config.ColorConfig;
|
||||
import de.steamwar.bausystem.SWUtils;
|
||||
import de.steamwar.bausystem.linkage.Enable;
|
||||
import de.steamwar.bausystem.linkage.LinkageType;
|
||||
import de.steamwar.bausystem.linkage.Linked;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.SWCommandUtils;
|
||||
import de.steamwar.command.TypeMapper;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -53,6 +51,7 @@ public class TPSLimitCommand extends SWCommand implements Enable {
|
||||
if (FreezeUtils.freezeEnabled) {
|
||||
tabCompletions.add("0");
|
||||
}
|
||||
addDefaultHelpMessage("TPSLIMIT_HELP");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -60,18 +59,16 @@ public class TPSLimitCommand extends SWCommand implements Enable {
|
||||
TPSWarpUtils.init();
|
||||
}
|
||||
|
||||
@Register(help = true)
|
||||
public void genericHelp(Player p, String... args) {
|
||||
p.sendMessage(BauSystem.PREFIX + "Jetziges TPS limit: " + TPSLimitUtils.currentTPSLimit);
|
||||
p.sendMessage(ColorConfig.OTHER + "/" + ColorConfig.HIGHLIGHT + "tpslimit " + ColorConfig.OTHER + "[" + ColorConfig.BASE + "TPS" + ColorConfig.OTHER + "|" + ColorConfig.HIGHLIGHT + "default" + ColorConfig.OTHER + "] - " + ColorConfig.BASE + "Setzte die TPS auf dem Bau");
|
||||
@Register
|
||||
public void checkCommand(Player p) {
|
||||
if (!permissionCheck(p)) return;
|
||||
BauSystem.MESSAGE.send("TPSLIMIT_CURRENT", p, TPSLimitUtils.currentTPSLimit);
|
||||
}
|
||||
|
||||
@Register({"default"})
|
||||
public void defaultCommand(Player p) {
|
||||
if (!permissionCheck(p)) return;
|
||||
TPSLimitUtils.currentTPSLimit = 20;
|
||||
TPSLimitUtils.tpsLimiter();
|
||||
sendNewTPSLimitMessage();
|
||||
valueCommand(p, 20D);
|
||||
}
|
||||
|
||||
@Register
|
||||
@ -81,7 +78,7 @@ public class TPSLimitCommand extends SWCommand implements Enable {
|
||||
FreezeUtils.freeze(p.getWorld());
|
||||
TPSLimitUtils.currentTPSLimit = 20;
|
||||
TPSLimitUtils.tpsLimiter();
|
||||
sendNewTPSLimitMessage();
|
||||
sendNewTPSLimitMessage(true);
|
||||
return;
|
||||
}
|
||||
if (tpsLimitDouble < 0.5 || tpsLimitDouble > (TPSWarpUtils.isWarpAllowed() ? 60 : 20)) {
|
||||
@ -91,7 +88,7 @@ public class TPSLimitCommand extends SWCommand implements Enable {
|
||||
FreezeUtils.unfreeze(p.getWorld());
|
||||
TPSLimitUtils.currentTPSLimit = tpsLimitDouble;
|
||||
TPSLimitUtils.tpsLimiter();
|
||||
sendNewTPSLimitMessage();
|
||||
sendNewTPSLimitMessage(false);
|
||||
}
|
||||
|
||||
@ClassMapper(value = double.class, local = true)
|
||||
@ -109,17 +106,23 @@ public class TPSLimitCommand extends SWCommand implements Enable {
|
||||
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
|
||||
private boolean permissionCheck(Player player) {
|
||||
if (!Permission.hasPermission(player, Permission.WORLD)) {
|
||||
player.sendMessage(BauSystem.PREFIX + ColorConfig.DISABLE + "Du darfst hier nicht den TPS-Limiter nutzen");
|
||||
BauSystem.MESSAGE.send("TPSLIMIT_NO_PERMS", player);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void sendNewTPSLimitMessage() {
|
||||
Bukkit.getOnlinePlayers().forEach(p -> p.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(ColorConfig.HIGHLIGHT + "TPS limit auf " + TPSLimitUtils.currentTPSLimit + " gesetzt.")));
|
||||
private void sendNewTPSLimitMessage(boolean frozen) {
|
||||
Bukkit.getOnlinePlayers().forEach(player -> {
|
||||
if (frozen) {
|
||||
SWUtils.sendToActionbar(player, BauSystem.MESSAGE.parse("TPSLIMIT_FROZEN", player));
|
||||
} else {
|
||||
SWUtils.sendToActionbar(player, BauSystem.MESSAGE.parse("TPSLIMIT_SET", player, TPSLimitUtils.currentTPSLimit));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void sendInvalidArgumentMessage(Player player) {
|
||||
player.sendMessage(BauSystem.PREFIX + ColorConfig.DISABLE + "Nur Zahlen zwischen 0,5 und " + (TPSWarpUtils.isWarpAllowed() ? 60 : 20) + ", und 'default'" + (FreezeUtils.freezeEnabled ? " und '0'" : "") + " erlaubt.");
|
||||
BauSystem.MESSAGE.send("TPSLIMIT_INVALID", player, TPSWarpUtils.isWarpAllowed() ? 60 : 20, FreezeUtils.freezeEnabled ? BauSystem.MESSAGE.parse("TPSLIMIT_INVALID_FROZEN", player) : "");
|
||||
}
|
||||
}
|
@ -34,5 +34,4 @@ public class TPSUtils {
|
||||
static {
|
||||
Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), () -> ticksSinceServerStart++, 1, 1);
|
||||
}
|
||||
|
||||
}
|
@ -20,9 +20,11 @@
|
||||
package de.steamwar.bausystem.features.tpslimit;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.SWUtils;
|
||||
import de.steamwar.bausystem.linkage.LinkageType;
|
||||
import de.steamwar.bausystem.linkage.Linked;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
@ -48,7 +50,7 @@ public class TickCommand extends SWCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ticksLeft.getAndDecrement() < 0) {
|
||||
if (ticksLeft.getAndDecrement() <= 0) {
|
||||
disableTask.run();
|
||||
disableTask = null;
|
||||
ticksLeft = null;
|
||||
@ -57,16 +59,19 @@ public class TickCommand extends SWCommand {
|
||||
}.runTaskTimer(BauSystem.getInstance(), 0L, 1L);
|
||||
}
|
||||
|
||||
@Register({"step"})
|
||||
@Register(value = {"step"}, description = "TICK_STEP_SINGLE_HELP")
|
||||
public void stepCommand(Player p) {
|
||||
stepCommand(p, 1);
|
||||
}
|
||||
|
||||
@Register({"step"})
|
||||
public void stepCommand(Player p, @OptionalValue("1") int ticks) {
|
||||
@Register(value = {"step"}, description = "TICK_STEP_HELP")
|
||||
public void stepCommand(Player p, @OptionalValue("1") int ticks) { // TODO: Fix OptionalValue
|
||||
if (ticksLeft != null) {
|
||||
return;
|
||||
}
|
||||
Bukkit.getOnlinePlayers().forEach(player -> {
|
||||
SWUtils.sendToActionbar(player, BauSystem.MESSAGE.parse("TICK_STEP", player, ticks));
|
||||
});
|
||||
FreezeUtils.unfreeze(p.getWorld());
|
||||
ticksLeft = new AtomicInteger(ticks);
|
||||
disableTask = () -> {
|
||||
@ -74,11 +79,14 @@ public class TickCommand extends SWCommand {
|
||||
};
|
||||
}
|
||||
|
||||
@Register({"warp"})
|
||||
@Register(value = {"warp"}, description = "TICK_WARP_HELP")
|
||||
public void warpCommand(Player p, int ticks) {
|
||||
if (ticksLeft != null) {
|
||||
return;
|
||||
}
|
||||
Bukkit.getOnlinePlayers().forEach(player -> {
|
||||
SWUtils.sendToActionbar(player, BauSystem.MESSAGE.parse("TICK_WARP", player, ticks));
|
||||
});
|
||||
boolean frozen = FreezeUtils.frozen(p.getWorld());
|
||||
double currentTPSLimit = TPSLimitUtils.currentTPSLimit;
|
||||
TPSLimitUtils.currentTPSLimit = 120;
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren