SteamWar/BauSystem2.0
Archiviert
12
0

Merge remote-tracking branch 'origin/master'

Dieser Commit ist enthalten in:
Chaoscaot 2021-04-26 20:08:22 +02:00
Commit d74102b66d
6 geänderte Dateien mit 10 neuen und 94 gelöschten Zeilen

Datei anzeigen

@ -46,8 +46,7 @@ public enum Permission {
OWNER(bauweltMember -> false); OWNER(bauweltMember -> false);
private final Predicate<BauweltMember> permissionPredicate; private final Predicate<BauweltMember> permissionPredicate;
private final BiConsumer<Player, BauweltMember> permissionChange = (player, bauweltMember) -> { private BiConsumer<Player, BauweltMember> permissionChange = (player, bauweltMember) -> {};
};
public boolean hasPermission(Player member) { public boolean hasPermission(Player member) {
if (member.getUniqueId().equals(BauServer.getInstance().getOwner())) { if (member.getUniqueId().equals(BauServer.getInstance().getOwner())) {

Datei anzeigen

@ -69,6 +69,9 @@ public class AutoShutdownListener implements Listener {
return; return;
} }
count++; count++;
if (count <= 120) {
return;
}
try { try {
if (RamUsage.getUsage() > 0.8) { if (RamUsage.getUsage() > 0.8) {
Bukkit.shutdown(); Bukkit.shutdown();

Datei anzeigen

@ -56,12 +56,12 @@ public class BauScoreboard implements Listener {
strings.add("§eTNT§8: " + region.get(Flag.TNT).getChatValue()); strings.add("§eTNT§8: " + region.get(Flag.TNT).getChatValue());
strings.add("§eFreeze§8: " + region.get(Flag.FREEZE).getChatValue()); strings.add("§eFreeze§8: " + region.get(Flag.FREEZE).getChatValue());
strings.add("§eFire§8: " + region.get(Flag.FIRE).getChatValue()); strings.add("§eFire§8: " + region.get(Flag.FIRE).getChatValue());
strings.add("§eTrace§8: " + RecordStateMachine.getRecordStatus().getName());
Loader loader = Loader.getLoader(p);
strings.add("§eLoader§8: " + (loader != null ? ("§a" + loader.getStage().getChatValue()) : "§caus"));
if (region.getFloorLevel() != 0) { if (region.getFloorLevel() != 0) {
strings.add("§eProtect§8: " + region.get(Flag.PROTECT).getChatValue()); strings.add("§eProtect§8: " + region.get(Flag.PROTECT).getChatValue());
} }
strings.add("§eTrace§8: " + RecordStateMachine.getRecordStatus().getName());
Loader loader = Loader.getLoader(p);
strings.add("§eLoader§8: " + (loader != null ? ("§a" + loader.getStage().getChatValue()) : "§caus"));
if (RecordStateMachine.getRecordStatus().isTracing()) { if (RecordStateMachine.getRecordStatus().isTracing()) {
strings.add("§3"); strings.add("§3");

Datei anzeigen

@ -29,7 +29,9 @@ public class RegionUtils {
} }
static void save(Region region) { static void save(Region region) {
region.regionData.add("prototype", region.getPrototype().getName()); if (region.getPrototype() != null) {
region.regionData.add("prototype", region.getPrototype().getName());
}
region.regionData.add("flagStorage", FlagStorage.toYAPION(region.getFlagStorage())); region.regionData.add("flagStorage", FlagStorage.toYAPION(region.getFlagStorage()));
RegionLoader.save(); RegionLoader.save();
} }

Datei anzeigen

@ -1,88 +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.utils;
import de.steamwar.bausystem.config.ColorConfig;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
public class ChatMessageBuilder {
private List<StringBuilder> messages = new ArrayList<>();
private String[] strings = new String[0];
public ChatMessageBuilder() {
messages.add(new StringBuilder());
}
public ChatMessageBuilder highlight(String s) {
messages.get(messages.size() - 1).append(ColorConfig.HIGHLIGHT).append(s);
return this;
}
public ChatMessageBuilder base(String s) {
messages.get(messages.size() - 1).append(ColorConfig.BASE).append(s);
return this;
}
public ChatMessageBuilder other(String s) {
messages.get(messages.size() - 1).append(ColorConfig.OTHER).append(s);
return this;
}
public ChatMessageBuilder enable(String s) {
messages.get(messages.size() - 1).append(ColorConfig.ENABLE).append(s);
return this;
}
public ChatMessageBuilder disable(String s) {
messages.get(messages.size() - 1).append(ColorConfig.DISABLE).append(s);
return this;
}
public ChatMessageBuilder error(String s) {
messages.get(messages.size() - 1).append(ColorConfig.ERROR).append(s);
return this;
}
public ChatMessageBuilder append(String s) {
messages.get(messages.size() - 1).append(s);
return this;
}
public ChatMessageBuilder newLine() {
messages.add(new StringBuilder());
return this;
}
public ChatMessageBuilder finish() {
strings = messages.stream().map(StringBuilder::toString).toArray(String[]::new);
return this;
}
public void send(Player player) {
for (String message : strings) {
player.sendMessage(message);
}
}
}