SteamWar/BungeeCore
Archiviert
13
2

Update some stuff
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed

Dieser Commit ist enthalten in:
yoyosource 2022-10-28 10:33:29 +02:00
Ursprung 2805f2cff7
Commit d8fda4dd8e
5 geänderte Dateien mit 6 neuen und 56 gelöschten Zeilen

Datei anzeigen

@ -1,45 +0,0 @@
/*
* 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.bungeecore.commands;
import de.steamwar.bungeecore.Message;
import de.steamwar.bungeecore.sql.SteamwarUser;
import de.steamwar.bungeecore.sql.UserConfig;
import de.steamwar.command.SWCommand;
import net.md_5.bungee.api.connection.ProxiedPlayer;
public class SlimTablistToggleCommand extends SWCommand {
public SlimTablistToggleCommand() {
super("toggleslimtablist", null, "toggleslim", "toggletablist", "toggleslimtab", "toggletab");
}
@Register(description = "SLIMTABLIST_USAGE")
public void toggle(ProxiedPlayer player) {
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
boolean alwaysSlim = Boolean.parseBoolean(UserConfig.getConfig(user.getId(), "slimTablist"));
UserConfig.updateUserConfig(user.getId(), "slimTablist", String.valueOf(!alwaysSlim));
if (alwaysSlim) {
Message.send("SLIMTABLIST_DISABLED", player);
} else {
Message.send("SLIMTABLIST_ENABLED", player);
}
}
}

Datei anzeigen

@ -77,8 +77,7 @@ public class Tablist extends MessageToMessageDecoder<PacketWrapper> {
List<TablistPart.Item> tablist = new ArrayList<>();
List<TablistPart.Item> direct = new ArrayList<>();
boolean alwaysSlim = Boolean.parseBoolean(UserConfig.getConfig(viewer.user().getId(), "slimTablist"));
if (alwaysSlim || global.size(viewer, player) > 80) {
if (global.size(viewer, player) > 80) {
global.slimPrint(viewer, player, tablist, direct);
} else {
global.print(viewer, player, tablist, direct);

Datei anzeigen

@ -86,7 +86,7 @@ public class TablistBuild implements TablistPart {
if (toPrint.isEmpty()) return;
int all = toPrint.size();
toPrint = TablistServer.slimmify(viewer, toPrint);
toPrint = TablistServer.slimify(viewer, toPrint);
if (tablist.isEmpty() || tablist.get(tablist.size() - 1).getDisplayName().equals("")) {
tablist.add(new Item(null, "", TablistServer.GRAY));

Datei anzeigen

@ -38,11 +38,7 @@ public class TablistGroup implements TablistPart {
@Override
public int size(ChatSender viewer, ProxiedPlayer player) {
int size = 0;
for (TablistPart part : sublists) {
size += part.size(viewer, player);
}
return size;
return sublists.stream().mapToInt(sublist -> sublist.size(viewer, player)).sum();
}
@Override

Datei anzeigen

@ -68,7 +68,7 @@ public class TablistServer implements TablistPart {
@Override
public int size(ChatSender viewer, ProxiedPlayer player) {
return (player.getServer().getInfo() == server ? 2 : 0) + players.size();
return (player.getServer().getInfo() == server ? 0 : 2) + players.size();
}
@Override
@ -91,7 +91,7 @@ public class TablistServer implements TablistPart {
List<Item> toPrint = players;
if (!onServer) {
toPrint = TablistServer.slimmify(viewer, players);
toPrint = TablistServer.slimify(viewer, players);
if (tablist.isEmpty() || tablist.get(tablist.size() - 1).getDisplayName().equals("")) {
items.add(new Item(null, "", GRAY));
@ -128,7 +128,7 @@ public class TablistServer implements TablistPart {
});
}
public static List<Item> slimmify(ChatSender viewer, List<Item> items) {
public static List<Item> slimify(ChatSender viewer, List<Item> items) {
int team = viewer.user().getTeam();
return items.stream()
.map(Item::getUuid)