SteamWar/BauSystem2.0
Archiviert
12
0

Move and update things
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed

Dieser Commit ist enthalten in:
yoyosource 2024-05-31 10:16:38 +02:00
Ursprung 0822f877ef
Commit 861e83d527
17 geänderte Dateien mit 250 neuen und 182 gelöschten Zeilen

Datei anzeigen

@ -44,8 +44,9 @@ import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
@Linked
public class AutostartListener implements Listener {

Datei anzeigen

@ -44,7 +44,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
public class LoaderRecorder implements Listener {

Datei anzeigen

@ -21,7 +21,6 @@ package de.steamwar.bausystem.features.script.lua.libs;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.features.loader.Loader;
import de.steamwar.bausystem.features.loader.LoaderRecorder;
import de.steamwar.bausystem.features.tpslimit.TPSUtils;
import de.steamwar.inventory.SWItem;

Datei anzeigen

@ -24,7 +24,6 @@ import de.steamwar.bausystem.features.tpslimit.TPSUtils;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.region.RegionUtils;
import lombok.ToString;
import org.bukkit.Bukkit;
import org.bukkit.block.Block;
import org.bukkit.scheduler.BukkitTask;

Datei anzeigen

@ -1,41 +0,0 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2021 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.features.tpslimit;
import de.steamwar.bausystem.BauSystem;
import lombok.experimental.UtilityClass;
import org.bukkit.Bukkit;
import java.util.function.Supplier;
@UtilityClass
public class TPSUtils {
private static long ticksSinceServerStart = 0;
public static final Supplier<Long> currentTick = () -> ticksSinceServerStart; // This is intended as Supplier<Long>
private static long realTicksSinceServerStart = 0;
public static final Supplier<Long> currentRealTick = () -> realTicksSinceServerStart; // This is intended as Supplier<Long>
static {
Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), () -> ticksSinceServerStart++, 1, 1);
BauSystem.runTaskTimer(BauSystem.getInstance(), () -> realTicksSinceServerStart++, 1, 1);
}
}

Datei anzeigen

@ -44,6 +44,10 @@ sourceSets {
dependencies {
implementation project(":BauSystem_PluginBase")
implementation project(":BauSystem_GUI")
annotationProcessor project(":BauSystem_GUI")
implementation project(":BauSystem_Scoreboard")
annotationProcessor project(":BauSystem_Scoreboard")
compileOnly 'org.projectlombok:lombok:1.18.22'
annotationProcessor 'org.projectlombok:lombok:1.18.22'

Datei anzeigen

@ -1,7 +1,7 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2023 SteamWar.de-Serverteam
* Copyright (C) 2024 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
@ -17,7 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.features.tpslimit;
package de.stemawar.bausystem.tpslimit;
import com.comphenix.tinyprotocol.Reflection;
import com.comphenix.tinyprotocol.TinyProtocol;

Datei anzeigen

@ -1,7 +1,7 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2023 SteamWar.de-Serverteam
* Copyright (C) 2024 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
@ -17,9 +17,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.features.tpslimit;
package de.stemawar.bausystem.tpslimit;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.BauSystemPlugin;
import de.steamwar.command.SWCommand;
import de.steamwar.core.TPSWatcher;
import de.steamwar.linkage.Linked;
@ -40,8 +40,8 @@ public class TPSCommand extends SWCommand {
@Register
public void genericCommand(Player p, String... args) {
BauSystem.MESSAGE.sendPrefixless("OTHER_TPS_HEAD", p);
BauSystem.MESSAGE.sendPrefixless("OTHER_TPS_MESSAGE", p,
BauSystemPlugin.MESSAGE.sendPrefixless("OTHER_TPS_HEAD", p);
BauSystemPlugin.MESSAGE.sendPrefixless("OTHER_TPS_MESSAGE", p,
TPSWatcher.getTPS(TPSWatcher.TPSType.ONE_SECOND),
TPSWatcher.getTPS(TPSWatcher.TPSType.TEN_SECONDS),
TPSWatcher.getTPS(TPSWatcher.TPSType.ONE_MINUTE),
@ -52,6 +52,6 @@ public class TPSCommand extends SWCommand {
@Register
public void genericCommand(Player p, TPSWatcher.TPSType type) {
BauSystem.MESSAGE.sendPrefixless("OTHER_TPS_SINGLE", p, tpsSystem.getTPS(type));
BauSystemPlugin.MESSAGE.sendPrefixless("OTHER_TPS_SINGLE", p, tpsSystem.getTPS(type));
}
}

Datei anzeigen

@ -1,7 +1,7 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2023 SteamWar.de-Serverteam
* Copyright (C) 2024 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
@ -17,7 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.features.tpslimit;
package de.stemawar.bausystem.tpslimit;
import com.comphenix.tinyprotocol.Reflection;
import lombok.Getter;

Datei anzeigen

@ -1,23 +1,23 @@
/*
* This file is a part of the SteamWar software.
* This file is a part of the SteamWar software.
*
* Copyright (C) 2020 SteamWar.de-Serverteam
* Copyright (C) 2024 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 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.
* 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/>.
* 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.features.tpslimit;
package de.stemawar.bausystem.tpslimit;
import com.comphenix.tinyprotocol.Reflection;
import com.comphenix.tinyprotocol.TinyProtocol;

Datei anzeigen

@ -0,0 +1,85 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2024 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.stemawar.bausystem.tpslimit;
import de.steamwar.bausystem.BauSystemPlugin;
import de.steamwar.bausystem.linkage.specific.ScoreboardElement;
import de.steamwar.bausystem.region.Region;
import de.steamwar.core.TPSWatcher;
import de.steamwar.linkage.Linked;
import de.steamwar.linkage.LinkedInstance;
import de.steamwar.linkage.PluginCheck;
import org.bukkit.entity.Player;
@Linked
@PluginCheck("BauSystem_Scoreboard")
public class TPSScoreboardElement implements ScoreboardElement {
@LinkedInstance
public TPSSystem tpsSystem;
@Override
public ScoreboardGroup getGroup() {
return ScoreboardGroup.FOOTER;
}
@Override
public int order() {
return 0;
}
@Override
public String get(Region region, Player p) {
if (tpsSystem != null && tpsSystem.currentlyStepping) {
long time = System.currentTimeMillis() % 1000;
if (time < 250) {
return "§e" + BauSystemPlugin.MESSAGE.parse("SCOREBOARD_TPS", p) + "§8: §7•••";
} else if (time < 500) {
return "§e" + BauSystemPlugin.MESSAGE.parse("SCOREBOARD_TPS", p) + "§8: §e•§7••";
} else if (time < 750) {
return "§e" + BauSystemPlugin.MESSAGE.parse("SCOREBOARD_TPS", p) + "§8: §7•§e•§7•";
} else {
return "§e" + BauSystemPlugin.MESSAGE.parse("SCOREBOARD_TPS", p) + "§8: §7••§e•";
}
} else if (TPSFreezeUtils.frozen()) {
return "§e" + BauSystemPlugin.MESSAGE.parse("SCOREBOARD_TPS", p) + "§8: " + BauSystemPlugin.MESSAGE.parse("SCOREBOARD_TPS_FROZEN", p);
} else {
return "§e" + BauSystemPlugin.MESSAGE.parse("SCOREBOARD_TPS", p) + "§8: " + tpsColor() + tpsSystem.getTPS(TPSWatcher.TPSType.ONE_SECOND) + tpsLimit();
}
}
private String tpsColor() {
double tps = tpsSystem.getTPS(TPSWatcher.TPSType.ONE_SECOND);
if (tps > tpsSystem.getCurrentTPSLimit() * 0.9) {
return "§a";
}
if (tps > tpsSystem.getCurrentTPSLimit() * 0.5) {
return "§e";
}
return "§c";
}
private String tpsLimit() {
if (tpsSystem.getCurrentTPSLimit() == 20) {
return "";
}
return "§8/§7" + tpsSystem.getCurrentTPSLimit();
}
}

Datei anzeigen

@ -1,7 +1,7 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2023 SteamWar.de-Serverteam
* Copyright (C) 2024 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
@ -17,15 +17,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.bausystem.features.tpslimit;
package de.stemawar.bausystem.tpslimit;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.BauSystemPlugin;
import de.steamwar.bausystem.SWUtils;
import de.steamwar.bausystem.linkage.specific.BauGuiItem;
import de.steamwar.bausystem.region.GlobalRegion;
import de.steamwar.bausystem.region.Region;
import de.steamwar.bausystem.utils.ScoreboardElement;
import de.steamwar.bausystem.utils.TickEndEvent;
import de.steamwar.bausystem.utils.bossbar.BauSystemBossbar;
import de.steamwar.bausystem.utils.bossbar.BossBarService;
@ -34,27 +31,19 @@ import de.steamwar.command.SWCommand;
import de.steamwar.core.Core;
import de.steamwar.core.TPSWarpUtils;
import de.steamwar.core.TPSWatcher;
import de.steamwar.inventory.SWAnvilInv;
import de.steamwar.inventory.SWItem;
import de.steamwar.linkage.Linked;
import de.steamwar.linkage.LinkedInstance;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.boss.BarColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
import java.util.Arrays;
@Linked
public class TPSSystem implements Listener {
@Getter
private double currentTPSLimit = 20;
double currentTPSLimit = 20;
public double getTPS(TPSWatcher.TPSType tpsType) {
return TPSWatcher.getTPSUnlimited(tpsType);
@ -111,10 +100,10 @@ public class TPSSystem implements Listener {
});
}
private boolean currentlyStepping = false;
private double currentLimit;
private int stepsTotal;
private int stepsLeft;
boolean currentlyStepping = false;
double currentLimit;
int stepsTotal;
int stepsLeft;
private void setSkip(int steps, double tpsLimitToUse) {
currentLimit = tpsLimitToUse == 20 ? 0 : currentTPSLimit;
@ -145,7 +134,7 @@ public class TPSSystem implements Listener {
private TPSBaseCommand() {
super("tpslimit");
setMessage(BauSystem.MESSAGE);
setMessage(BauSystemPlugin.MESSAGE);
addDefaultHelpMessage("TPSLIMIT_HELP");
}
}
@ -198,7 +187,7 @@ public class TPSSystem implements Listener {
@Register(description = "TPSLIMIT_HELP")
public void currentLimit(Player player) {
BauSystem.MESSAGE.send("TPSLIMIT_CURRENT", player, currentTPSLimit);
BauSystemPlugin.MESSAGE.send("TPSLIMIT_CURRENT", player, currentTPSLimit);
}
@Register(value = "default", description = "TPSLIMIT_DEFAULT_HELP")
@ -211,7 +200,7 @@ public class TPSSystem implements Listener {
public TickBaseCommand() {
super("tick");
setMessage(BauSystem.MESSAGE);
setMessage(BauSystemPlugin.MESSAGE);
}
}
@ -295,7 +284,7 @@ public class TPSSystem implements Listener {
@Register(value = "rate", description = "TICK_HELP")
public void currentLimit(Player player) {
BauSystem.MESSAGE.send("TPSLIMIT_CURRENT", player, currentTPSLimit);
BauSystemPlugin.MESSAGE.send("TPSLIMIT_CURRENT", player, currentTPSLimit);
}
@Register(value = {"rate", "default"}, description = "TICK_DEFAULT_HELP")
@ -303,91 +292,4 @@ public class TPSSystem implements Listener {
setTPS(20);
}
}
@Linked
public static class TPSScoreboardElement implements ScoreboardElement {
@LinkedInstance
public TPSSystem tpsSystem;
@Override
public ScoreboardGroup getGroup() {
return ScoreboardGroup.FOOTER;
}
@Override
public int order() {
return 0;
}
@Override
public String get(Region region, Player p) {
if (tpsSystem != null && tpsSystem.currentlyStepping) {
long time = System.currentTimeMillis() % 1000;
if (time < 250) {
return "§e" + BauSystem.MESSAGE.parse("SCOREBOARD_TPS", p) + "§8: §7•••";
} else if (time < 500) {
return "§e" + BauSystem.MESSAGE.parse("SCOREBOARD_TPS", p) + "§8: §e•§7••";
} else if (time < 750) {
return "§e" + BauSystem.MESSAGE.parse("SCOREBOARD_TPS", p) + "§8: §7•§e•§7•";
} else {
return "§e" + BauSystem.MESSAGE.parse("SCOREBOARD_TPS", p) + "§8: §7••§e•";
}
} else if (TPSFreezeUtils.frozen()) {
return "§e" + BauSystem.MESSAGE.parse("SCOREBOARD_TPS", p) + "§8: " + BauSystem.MESSAGE.parse("SCOREBOARD_TPS_FROZEN", p);
} else {
return "§e" + BauSystem.MESSAGE.parse("SCOREBOARD_TPS", p) + "§8: " + tpsColor() + tpsSystem.getTPS(TPSWatcher.TPSType.ONE_SECOND) + tpsLimit();
}
}
private String tpsColor() {
double tps = tpsSystem.getTPS(TPSWatcher.TPSType.ONE_SECOND);
if (tps > tpsSystem.getCurrentTPSLimit() * 0.9) {
return "§a";
}
if (tps > tpsSystem.getCurrentTPSLimit() * 0.5) {
return "§e";
}
return "§c";
}
private String tpsLimit() {
if (tpsSystem.getCurrentTPSLimit() == 20) {
return "";
}
return "§8/§7" + tpsSystem.getCurrentTPSLimit();
}
}
@Linked
public static class TPSSystemBauGuiItem extends BauGuiItem {
@LinkedInstance
public TPSSystem tpsSystem;
public TPSSystemBauGuiItem() {
super(19);
}
@Override
public ItemStack getItem(Player player) {
return new SWItem(Material.CLOCK, BauSystem.MESSAGE.parse("TPSLIMIT_GUI_ITEM_NAME", player), Arrays.asList(BauSystem.MESSAGE.parse("TPSLIMIT_GUI_ITEM_LORE", player, tpsSystem.currentTPSLimit)), false, clickType -> {
}).getItemStack();
}
@Override
public boolean click(ClickType click, Player p) {
p.closeInventory();
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();
return false;
}
@Override
public Permission permission() {
return Permission.BUILD;
}
}
}

Datei anzeigen

@ -0,0 +1,68 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2024 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.stemawar.bausystem.tpslimit;
import de.steamwar.bausystem.BauSystemPlugin;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.linkage.specific.BauGuiItem;
import de.steamwar.inventory.SWAnvilInv;
import de.steamwar.inventory.SWItem;
import de.steamwar.linkage.Linked;
import de.steamwar.linkage.LinkedInstance;
import de.steamwar.linkage.PluginCheck;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
import java.util.Arrays;
@Linked
@PluginCheck("BauSystem_GUI")
public class TPSSystemBauGuiItem extends BauGuiItem {
@LinkedInstance
public TPSSystem tpsSystem;
public TPSSystemBauGuiItem() {
super(19);
}
@Override
public ItemStack getItem(Player player) {
return new SWItem(Material.CLOCK, BauSystemPlugin.MESSAGE.parse("TPSLIMIT_GUI_ITEM_NAME", player), Arrays.asList(BauSystemPlugin.MESSAGE.parse("TPSLIMIT_GUI_ITEM_LORE", player, tpsSystem.currentTPSLimit)), false, clickType -> {
}).getItemStack();
}
@Override
public boolean click(ClickType click, Player p) {
p.closeInventory();
SWAnvilInv inv = new SWAnvilInv(p, BauSystemPlugin.MESSAGE.parse("TPSLIMIT_ANVIL_GUI", p));
inv.setItem(Material.CLOCK);
inv.setCallback(s -> p.performCommand("tpslimit " + s));
inv.open();
return false;
}
@Override
public Permission permission() {
return Permission.BUILD;
}
}

Datei anzeigen

@ -0,0 +1,41 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2024 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.stemawar.bausystem.tpslimit;
import de.steamwar.bausystem.BauSystem;
import lombok.experimental.UtilityClass;
import org.bukkit.Bukkit;
import java.util.function.Supplier;
@UtilityClass
public class TPSUtils {
private static long ticksSinceServerStart = 0;
public static final Supplier<Long> currentTick = () -> ticksSinceServerStart; // This is intended as Supplier<Long>
private static long realTicksSinceServerStart = 0;
public static final Supplier<Long> currentRealTick = () -> realTicksSinceServerStart; // This is intended as Supplier<Long>
static {
Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), () -> ticksSinceServerStart++, 1, 1);
BauSystem.runTaskTimer(BauSystem.getInstance(), () -> realTicksSinceServerStart++, 1, 1);
}
}

Datei anzeigen

@ -1,7 +1,7 @@
name: BauSystem
name: BauSystem_TPSLimit
authors: [ Lixfel, YoyoNow, Chaoscaot, Zeanon, D4rkr34lm ]
version: "2.0"
depend: [ WorldEdit, SpigotCore ]
depend: [ WorldEdit, SpigotCore, BauSystem_GUI, BauSystem_Scoreboard ]
load: POSTWORLD
main: de.steamwar.bausystem.BauSystemPlugin
api-version: "1.13"

Datei anzeigen

@ -1,4 +1,4 @@
name: BauSystem
name: BauSystem_Tracer
authors: [ Lixfel, YoyoNow, Chaoscaot, Zeanon, D4rkr34lm ]
version: "2.0"
depend: [ WorldEdit, SpigotCore ]

Datei anzeigen

@ -0,0 +1,11 @@
name: BauSystem_Warp
authors: [ Lixfel, YoyoNow, Chaoscaot, Zeanon, D4rkr34lm ]
version: "2.0"
depend: [ WorldEdit, SpigotCore ]
load: POSTWORLD
main: de.steamwar.bausystem.BauSystemPlugin
api-version: "1.13"
website: "https://steamwar.de"
description: "So unseriös wie wir sind: BauSystem nur besser."
commands: