geforkt von SteamWar/BungeeCore
Fix 1.20.2+ Tablist order after server switch, Test fix commands
Signed-off-by: Lixfel <git-5w3l@lixfel.de>
Dieser Commit ist enthalten in:
Ursprung
7224428345
Commit
e2024a481b
@ -74,7 +74,7 @@ public class ChatListener extends BasicListener {
|
||||
public void logCommands(CommandExecuteEvent e) {
|
||||
String command = e.getCommand();
|
||||
int space = command.indexOf(' ');
|
||||
if(e.getResult().isAllowed() && VelocityCore.getProxy().getCommandManager().hasCommand(space != -1 ? command.substring(0, space) : command)) {
|
||||
if(VelocityCore.getProxy().getCommandManager().hasCommand(space != -1 ? command.substring(0, space) : command)) {
|
||||
CommandSource source = e.getCommandSource();
|
||||
String name;
|
||||
if(source instanceof Player player)
|
||||
@ -85,6 +85,9 @@ public class ChatListener extends BasicListener {
|
||||
name = source.toString();
|
||||
|
||||
cmdLogger.log(Level.INFO, "%s -> executed command /%s".formatted(name, command));
|
||||
} else if (e.getCommandSource() instanceof Player player) {
|
||||
player.spoofChatInput("/" + command);
|
||||
e.setResult(CommandExecuteEvent.CommandResult.denied());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,7 @@ import com.velocitypowered.proxy.network.Connections;
|
||||
import com.velocitypowered.proxy.protocol.MinecraftPacket;
|
||||
import com.velocitypowered.proxy.protocol.packet.LegacyPlayerListItemPacket;
|
||||
import com.velocitypowered.proxy.protocol.packet.RemovePlayerInfoPacket;
|
||||
import com.velocitypowered.proxy.protocol.packet.UpdateTeamsPacket;
|
||||
import com.velocitypowered.proxy.protocol.packet.UpsertPlayerInfoPacket;
|
||||
import com.velocitypowered.proxy.protocol.packet.chat.ComponentHolder;
|
||||
import de.steamwar.messages.Chatter;
|
||||
@ -48,8 +49,8 @@ import java.util.stream.IntStream;
|
||||
public class Tablist extends ChannelInboundHandlerAdapter {
|
||||
|
||||
private static final UUID[] swUuids = IntStream.range(0, 80).mapToObj(i -> UUID.randomUUID()).toArray(UUID[]::new);
|
||||
public static final String[] swNames = IntStream.range(0, 80).mapToObj(i -> " »SW« " + String.format("%02d", i)).toArray(String[]::new);
|
||||
public static final String TAB_TEAM = "zzzzzsw-tab";
|
||||
private static final String[] swNames = IntStream.range(0, 80).mapToObj(i -> " »SW« " + String.format("%02d", i)).toArray(String[]::new);
|
||||
public static final UpdateTeamsPacket createTeamPacket = new UpdateTeamsPacket("zzzzzsw-tab", UpdateTeamsPacket.Mode.CREATE, Component.empty(), Component.empty(), Component.empty(), UpdateTeamsPacket.NameTagVisibility.NEVER, UpdateTeamsPacket.CollisionRule.ALWAYS, 21, (byte)0x00, Arrays.stream(Tablist.swNames).toList());
|
||||
|
||||
private final Map<UUID, UpsertPlayerInfoPacket.Entry> directTabItems;
|
||||
private final List<UpsertPlayerInfoPacket.Entry> current = new ArrayList<>();
|
||||
@ -139,8 +140,10 @@ public class Tablist extends ChannelInboundHandlerAdapter {
|
||||
directTabItems.clear();
|
||||
}
|
||||
|
||||
if(player.getProtocolVersion().greaterThan(ProtocolVersion.MINECRAFT_1_20))
|
||||
if(player.getProtocolVersion().greaterThan(ProtocolVersion.MINECRAFT_1_20)) {
|
||||
current.clear();
|
||||
sendPacket(player, createTeamPacket);
|
||||
}
|
||||
}
|
||||
|
||||
private void injection() {
|
||||
|
@ -25,16 +25,17 @@ import com.velocitypowered.api.event.connection.PostLoginEvent;
|
||||
import com.velocitypowered.api.event.player.ServerPostConnectEvent;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||
import com.velocitypowered.proxy.protocol.packet.UpdateTeamsPacket;
|
||||
import de.steamwar.network.packets.common.FightInfoPacket;
|
||||
import de.steamwar.persistent.Servertype;
|
||||
import de.steamwar.persistent.Storage;
|
||||
import de.steamwar.persistent.Subserver;
|
||||
import de.steamwar.velocitycore.VelocityCore;
|
||||
import de.steamwar.velocitycore.listeners.BasicListener;
|
||||
import de.steamwar.network.packets.common.FightInfoPacket;
|
||||
import net.kyori.adventure.text.Component;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class TablistManager extends BasicListener {
|
||||
@ -46,8 +47,6 @@ public class TablistManager extends BasicListener {
|
||||
fightInfos.keySet().removeIf(serverInfo -> serverInfo.getPlayersConnected().isEmpty());
|
||||
}
|
||||
|
||||
private static final UpdateTeamsPacket createTeamPacket = new UpdateTeamsPacket(Tablist.TAB_TEAM, UpdateTeamsPacket.Mode.CREATE, Component.empty(), Component.empty(), Component.empty(), UpdateTeamsPacket.NameTagVisibility.NEVER, UpdateTeamsPacket.CollisionRule.ALWAYS, 21, (byte)0x00, Arrays.stream(Tablist.swNames).toList());
|
||||
|
||||
private final Map<Player, Tablist> tablists = new HashMap<>();
|
||||
|
||||
private int seconds = 0;
|
||||
@ -64,7 +63,7 @@ public class TablistManager extends BasicListener {
|
||||
synchronized (tablists) {
|
||||
tablists.put(event.getPlayer(), new Tablist(event.getPlayer()));
|
||||
}
|
||||
Tablist.sendPacket(event.getPlayer(), createTeamPacket);
|
||||
Tablist.sendPacket(event.getPlayer(), Tablist.createTeamPacket);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren