Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
f3a6319e4a
Commit
b3d0dd0f96
@ -523,8 +523,14 @@ BLOCK_COUNTER_DISABLE = §7BlockCounter ausgemacht
|
||||
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_CANCEL_HELP = §8/§etick cancel §8- §7Cancelt den Tick Warp oder Step
|
||||
TICK_ERROR = §cDu kannst keinen weiteren §8'§e/tick step§8'§c oder §8'§e/tick warp§8'§c anmachen
|
||||
TICK_CANCEL_ERROR = §cDu hast keinen §8'§e/tick step§8'§c oder §8'§e/tick warp§8'§c aktiv
|
||||
TICK_STEP = §eSpult {0} Ticks vor
|
||||
TICK_STEP_LEFT = §eSpult noch {0} Ticks vor
|
||||
TICK_WARP = §eWarpe {0} Ticks vor
|
||||
TICK_WARP_LEFT = §eWarpe noch {0} Ticks vor
|
||||
TICK_CANCEL = §eWarps und Steps abgebrochen
|
||||
TPSLIMIT_GUI_ITEM_NAME = §eTPS Limiter
|
||||
TPSLIMIT_GUI_ITEM_LORE = §7Aktuell: §e{0}
|
||||
TPSLIMIT_ANVIL_GUI = Neues TPS Limit
|
||||
|
@ -29,12 +29,14 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@Linked(LinkageType.COMMAND)
|
||||
public class TickCommand extends SWCommand {
|
||||
|
||||
private AtomicInteger ticksLeft = null;
|
||||
private Runnable disableTask = null;
|
||||
private Consumer<Integer> ticksLeftActionBar = null;
|
||||
|
||||
public TickCommand() {
|
||||
super("tick");
|
||||
@ -55,19 +57,18 @@ public class TickCommand extends SWCommand {
|
||||
disableTask = null;
|
||||
ticksLeft = null;
|
||||
}
|
||||
if (ticksLeftActionBar != null && ticksLeft != null) {
|
||||
ticksLeftActionBar.accept(ticksLeft.get());
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(BauSystem.getInstance(), 0L, 1L);
|
||||
}
|
||||
|
||||
@Register(value = {"step"}, description = "TICK_STEP_SINGLE_HELP")
|
||||
public void stepCommand(Player p) {
|
||||
stepCommand(p, 1);
|
||||
}
|
||||
|
||||
@Register(value = {"step"}, description = "TICK_STEP_HELP")
|
||||
public void stepCommand(Player p, @OptionalValue("1") int ticks) { // TODO: Fix OptionalValue
|
||||
@Register(value = {"step"}, description = {"TICK_STEP_SINGLE_HELP", "TICK_STEP_HELP"})
|
||||
public void stepCommand(Player p, @OptionalValue("1") int ticks) {
|
||||
if (!TPSLimitCommand.permissionCheck(p)) return;
|
||||
if (ticksLeft != null) {
|
||||
BauSystem.MESSAGE.send("TICK_ERROR", p);
|
||||
return;
|
||||
}
|
||||
Bukkit.getOnlinePlayers().forEach(player -> {
|
||||
@ -76,12 +77,18 @@ public class TickCommand extends SWCommand {
|
||||
FreezeUtils.unfreeze();
|
||||
ticksLeft = new AtomicInteger(ticks);
|
||||
disableTask = FreezeUtils::freeze;
|
||||
ticksLeftActionBar = currentTicksLeft -> {
|
||||
Bukkit.getOnlinePlayers().forEach(player -> {
|
||||
SWUtils.sendToActionbar(player, BauSystem.MESSAGE.parse("TICK_STEP_LEFT", player, currentTicksLeft));
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
@Register(value = {"warp"}, description = "TICK_WARP_HELP")
|
||||
public void warpCommand(Player p, int ticks) {
|
||||
if (!TPSLimitCommand.permissionCheck(p)) return;
|
||||
if (ticksLeft != null) {
|
||||
BauSystem.MESSAGE.send("TICK_ERROR", p);
|
||||
return;
|
||||
}
|
||||
Bukkit.getOnlinePlayers().forEach(player -> {
|
||||
@ -101,5 +108,23 @@ public class TickCommand extends SWCommand {
|
||||
TPSLimitUtils.currentTPSLimit = currentTPSLimit;
|
||||
TPSLimitUtils.tpsLimiter();
|
||||
};
|
||||
ticksLeftActionBar = currentTicksLeft -> {
|
||||
Bukkit.getOnlinePlayers().forEach(player -> {
|
||||
SWUtils.sendToActionbar(player, BauSystem.MESSAGE.parse("TICK_WARP_LEFT", player, currentTicksLeft));
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
@Register(value = {"cancel"}, description = "TICK_CANCEL_HELP")
|
||||
public void cancelCommand(Player p) {
|
||||
if (!TPSLimitCommand.permissionCheck(p)) return;
|
||||
if (ticksLeft == null) {
|
||||
BauSystem.MESSAGE.send("TICK_CANCEL_ERROR", p);
|
||||
return;
|
||||
}
|
||||
ticksLeft.set(0);
|
||||
Bukkit.getOnlinePlayers().forEach(player -> {
|
||||
SWUtils.sendToActionbar(player, BauSystem.MESSAGE.parse("TICK_CANCEL", player));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren