geforkt von SteamWar/BungeeCore
Merge remote-tracking branch 'origin/master'
Dieser Commit ist enthalten in:
Commit
83e1a33af5
@ -1 +1 @@
|
||||
Subproject commit 20c22c47f940c4510de17594b28eb0a96cb9da0c
|
||||
Subproject commit d000b8687d93eb43520bbf6685281099055eab9f
|
@ -20,17 +20,16 @@
|
||||
package de.steamwar.command;
|
||||
|
||||
import com.velocitypowered.api.command.SimpleCommand;
|
||||
import de.steamwar.velocitycore.VelocityCore;
|
||||
import de.steamwar.velocitycore.discord.DiscordBot;
|
||||
import de.steamwar.messages.Chatter;
|
||||
import de.steamwar.messages.Message;
|
||||
import de.steamwar.sql.UserPerm;
|
||||
import de.steamwar.velocitycore.VelocityCore;
|
||||
import de.steamwar.velocitycore.discord.DiscordBot;
|
||||
import lombok.Getter;
|
||||
import net.kyori.adventure.text.event.ClickEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.Supplier;
|
||||
@ -84,10 +83,11 @@ public class SWCommand extends AbstractSWCommand<Chatter> {
|
||||
|
||||
@Override
|
||||
public List<String> suggest(Invocation invocation) {
|
||||
if(invocation.arguments().length == 0)
|
||||
return Collections.emptyList();
|
||||
String[] args = invocation.arguments();
|
||||
if(args.length == 0)
|
||||
args = new String[]{""};
|
||||
|
||||
return SWCommand.this.tabComplete(Chatter.of(invocation.source()), invocation.alias(), invocation.arguments());
|
||||
return SWCommand.this.tabComplete(Chatter.of(invocation.source()), invocation.alias(), args);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -104,8 +104,6 @@ public class SWCommand extends AbstractSWCommand<Chatter> {
|
||||
|
||||
VelocityCore.getProxy().getCommandManager().unregister(name);
|
||||
DiscordBot.getCommands().remove(name);
|
||||
for(String alias : aliases)
|
||||
DiscordBot.getCommands().remove(alias);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -115,8 +113,6 @@ public class SWCommand extends AbstractSWCommand<Chatter> {
|
||||
|
||||
VelocityCore.getProxy().getCommandManager().register(VelocityCore.getProxy().getCommandManager().metaBuilder(name).aliases(aliases).plugin(VelocityCore.get()).build(), command);
|
||||
DiscordBot.getCommands().put(name, this);
|
||||
for(String alias : aliases)
|
||||
DiscordBot.getCommands().put(alias, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -48,7 +48,6 @@ HELP_TESTBLOCK=§8/§7testblock §8- §7Resets the dummy
|
||||
HELP_RESET=§8/§7reset §8- §7Resets the current region
|
||||
HELP_SPEED=§8/§7speed §8- §7Changes flight and walking speed
|
||||
HELP_NV=§8/§7nv §8- §7(de)activates night vision
|
||||
HELP_WV=§8/§7wv §8- §7(de)activates underwater vision
|
||||
HELP_TRACE=§8/§7trace §8- §7Gives help regarding the tnt tracer
|
||||
HELP_TPSLIMIT=§8/§7tpslimit §8- §7Gives help regarding the TPS limiter
|
||||
HELP_LOADER=§8/§7loader §8- §7Use the automatic cannon loader
|
||||
@ -57,7 +56,7 @@ HELP_FREEZE=§8/§7freeze §8- §7Stops block updates
|
||||
HELP_SKULL=§8/§7skull §8- §7Gives you a player head
|
||||
HELP_DEBUGSTICK=§8/§7debugstick §8- §7Gives you a debugstick
|
||||
HELP_BAUINFO=§8/§7buildinfo §8- §7Information about the current build server
|
||||
HELP_SCHEMSUBMIT=§7For a Tutorial about unlocking your AirShip§8/§7MiniWarGear§8/§7WarGear§8/§7WarShip click §ehere§8!
|
||||
HELP_SCHEMSUBMIT=§7For a Tutorial about submitting your AirShip§8/§7MiniWarGear§8/§7WarGear§8/§7WarShip click §ehere§8!
|
||||
HELP_SCHEMSUBMIT_HOVER=§ehttps://www.youtube.com/watch?v=9QrQ3UBWveE
|
||||
|
||||
HELP_WE_POS1=§8//§71 §7» §8//§7pos1
|
||||
@ -186,7 +185,7 @@ UNNOTEAMSERVER=§e{0} §7may now set §e§lteam servers§7 again§8.
|
||||
NOTE_TEAM={0} §e{1} §7received a §e§lnote§7 from §e{2} {3}: §f{4}
|
||||
|
||||
#BugCommand
|
||||
BUG_MESSAGE=§7Your bugreport was saved.
|
||||
BUG_MESSAGE=§7Please describe the issue in a Discord ticket with the bug ID §e{0} §7further§8.
|
||||
|
||||
#IgnoreCommand
|
||||
IGNORE_YOURSELF=§cHow are you going to ignore yourself?
|
||||
@ -234,7 +233,7 @@ BAU_START_NOT_ALLOWED = §cYou are not allowed to start this build server.
|
||||
|
||||
#ChallengeCommand
|
||||
CHALLENGE_USAGE=§8/§7challenge §8[§eplayer§8]
|
||||
CHALLENGE_OFFLINE=§cThe challenged player isn't online.
|
||||
CHALLENGE_OFFLINE=§cThe challenged player isn\'t online.
|
||||
CHALLENGE_SELF=§cSchizophrenia?
|
||||
CHALLENGE_IGNORED=§cThe challenged player has blocked you.
|
||||
CHALLENGE_INARENA=§cThe challenged player is already in an arena.
|
||||
@ -540,16 +539,16 @@ CHAT_YOYONOW_2=I would like to recommend you the command "/bug <MESSAGE>"..
|
||||
CHAT_YOYONOW_3=Thank you.
|
||||
CHAT_YOYONOW_4=I wish you still a smooth gaming experience.
|
||||
CHAT_CHAOSCAOT_1=You called me!
|
||||
CHAT_CHAOSCAOT_2=If something is broken, just say it's a feature.
|
||||
CHAT_CHAOSCAOT_3=And if it is a feature, just then it can't be broken.
|
||||
CHAT_CHAOSCAOT_4=Broken is just a definition. So if you define it as a feature, it's not broken.
|
||||
CHAT_CHAOSCAOT_2=If something is broken, just say it\'s a feature.
|
||||
CHAT_CHAOSCAOT_3=And if it is a feature, just then it can\'t be broken.
|
||||
CHAT_CHAOSCAOT_4=Broken is just a definition. So if you define it as a feature, it\'s not broken.
|
||||
CHAT_CHAOSCAOT_5=And if you define it as broken, then tell us using the command "/bug <MESSAGE>".
|
||||
CHAT_CHAOSCAOT_6=Thank you and goodbye.
|
||||
CHAT_RECEIVE=§cTo be able to send chat messages, you must also receive them!
|
||||
CHAT_NO_LINKS=§cYou may not send links.
|
||||
CHAT_BC_USAGE=§8/§7bc §8[§emessage§8]
|
||||
CHAT_NO_RECEIVER=§cNobody receives your message
|
||||
CHAT_EMPTY=§cDon't write meaningless empty messages.
|
||||
CHAT_EMPTY=§cDon\'t write meaningless empty messages.
|
||||
|
||||
CHAT_SERVERTEAM=§8STC §e{0}§8» §f{2}
|
||||
CHAT_GLOBAL={3}{4}{5}{6}{0}§8» {7}{2}
|
||||
@ -713,11 +712,10 @@ DC_UNLINKED=For this action your Discord account has to be linked to your Minecr
|
||||
DC_TITLE_SCHEMINFO=Schematic Info
|
||||
DC_SCHEM_ACCEPT=Your schematic **{0}** has been accepted.
|
||||
DC_SCHEM_DECLINE=Your schematic **{0}** has been declined.\n**Reason:**{1}
|
||||
DC_AUTH_SUCCESS=:white_check_mark: You're Discord account has been linked with **{0}**.
|
||||
DC_ROLE_ADDED=:tada: You're getting {0} now.
|
||||
DC_ROLE_REMOVED=You're not getting {0} anymore.
|
||||
|
||||
DC_TICKET_CREATED=You're Ticket {0} has been created.
|
||||
DC_AUTH_SUCCESS=:white_check_mark: You\'re Discord account has been linked with **{0}**.
|
||||
DC_ROLE_ADDED=:tada: Your getting {0} now.
|
||||
DC_ROLE_REMOVED=Your not getting {0} anymore.
|
||||
DC_TICKET_CREATED=Your Ticket {0} has been created.
|
||||
DC_TICKET_TITLE=SteamWar Ticket
|
||||
DC_TICKETINTRO_REPORT=Please answer for the punishment of the misconduct the following questions as accurately as possible and attach evidence whenever possible:\n - Which player(s)?\n - On which Server?\n - At what time?\n - Type and nature of the misconduct?
|
||||
DC_TICKETINTRO_IDEA=Describe your idea as detailed as possible. Hereto belongs: What, Why, How, Where?
|
||||
@ -726,7 +724,7 @@ DC_TICKETINTRO_QUESTION=Please ask your question. A staff member will address th
|
||||
DC_TICKETINTRO_APPEAL=Asking creates wonders.
|
||||
DC_TICKET_CLOSE=Close
|
||||
|
||||
DC_SCHEMUPLOAD_NOPERM=You're not allowed to upload schematics.
|
||||
DC_SCHEMUPLOAD_NOPERM=You\'re not allowed to upload schematics.
|
||||
DC_SCHEMUPLOAD_IGNORED=Skipping `{0}`, not a schematic file.
|
||||
DC_SCHEMUPLOAD_INVCHAR=`{0}` has invalid characters in its name.
|
||||
DC_SCHEMUPLOAD_SUCCESS=`{0}` was uploaded successfully.
|
||||
|
@ -44,7 +44,6 @@ HELP_TESTBLOCK=§8/§7testblock §8- §7Erneuert den nächsten Testblock
|
||||
HELP_RESET=§8/§7reset §8- §7Setzt die derzeitige Region zurück
|
||||
HELP_SPEED=§8/§7speed §8- §7Ändert deine Fluggeschwindigkeit
|
||||
HELP_NV=§8/§7nv §8- §7(de)aktiviert Nachtsicht
|
||||
HELP_WV=§8/§7wv §8- §7(de)aktiviert Unterwassersicht
|
||||
HELP_TRACE=§8/§7trace §8- §7Gibt einen Überblick über den TNT-Tracer
|
||||
HELP_TPSLIMIT=§8/§7tpslimit §8- §7Gibt einen Überblick über den TPS-Limiter
|
||||
HELP_LOADER=§8/§7loader §8- §7Nutze den automatischen Kanonenlader
|
||||
@ -170,7 +169,7 @@ UNNOTEAMSERVER=§e{0} §7darf nun wieder §e§lTeamserver§7 setzen§8.
|
||||
NOTE_TEAM={0} §e{1} §7erhielt von §e{2} {3} §7die §e§lNotiz§7§8: §f{4}
|
||||
|
||||
#BugCommand
|
||||
BUG_MESSAGE=§7Dein Bugreport wurde gespeichert.
|
||||
BUG_MESSAGE=§7Bitte beschreibe das Problem in einem Discordticket genauer und gebe dabei die Bug-ID §e{0} §7an§8.
|
||||
|
||||
#IgnoreCommand
|
||||
IGNORE_YOURSELF=§cWie willst du dich selber ignorieren?
|
||||
|
@ -214,7 +214,7 @@ public class ServerStarter {
|
||||
directory = version.getServerDirectory("Builder");
|
||||
worldDir = version.getWorldFolder(BUILDER_BASE_PATH);
|
||||
worldName = map;
|
||||
serverNameProvider = port -> "⛏" + map;
|
||||
serverNameProvider = port -> "*" + map;
|
||||
checkpoint = true;
|
||||
constructor = (serverName, port, builder, shutdownCallback, failureCallback) -> new Builderserver(serverName, worldName, port, builder, shutdownCallback, failureCallback);
|
||||
|
||||
|
@ -93,17 +93,23 @@ public class BauCommand extends SWCommand {
|
||||
|
||||
@Validator(value = "teleportTarget", local = true)
|
||||
public TypeValidator<SteamwarUser> teleportTargetValidator() {
|
||||
return (sender, value, messageSender) -> {
|
||||
if (value == null) {
|
||||
return (sender, owner, messageSender) -> {
|
||||
if (owner == null) {
|
||||
messageSender.send("UNKNOWN_PLAYER");
|
||||
return false;
|
||||
}
|
||||
if (sender.user().getId() != value.getId() && BauweltMember.getBauMember(value.getId(), sender.user().getId()) == null) {
|
||||
SubserverSystem.sendDeniedMessage(sender, value.getUUID());
|
||||
if (sender.user().getId() != owner.getId() && BauweltMember.getBauMember(owner.getId(), sender.user().getId()) == null) {
|
||||
SubserverSystem.sendDeniedMessage(sender, owner.getUUID());
|
||||
messageSender.send("BAU_TP_NOALLOWED");
|
||||
return false;
|
||||
}
|
||||
return !BauLock.checkNotifyLocked(value, sender);
|
||||
|
||||
if (BauLock.isLocked(owner, sender.user())) {
|
||||
messageSender.send("BAU_LOCKED_NOALLOWED");
|
||||
Chatter.of(owner.getUUID()).system("BAU_LOCK_BLOCKED", sender);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -30,10 +30,10 @@ public class BugCommand extends SWCommand {
|
||||
|
||||
@Register
|
||||
public void bugMessage(Chatter sender, String... message) {
|
||||
SWException.log(
|
||||
int id = SWException.logGetId(
|
||||
String.join(" ", message),
|
||||
sender.withPlayerOrOffline(player -> player.getCurrentServer().map(connection -> connection.getServerInfo().getName()).orElse("offline"), () -> "offline") + " " + sender.user().getUserName() + " " + sender.user().getId()
|
||||
);
|
||||
sender.system("BUG_MESSAGE");
|
||||
sender.system("BUG_MESSAGE", id);
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ public class HelpCommand extends SWCommand {
|
||||
|
||||
@Register({"build","player"})
|
||||
public void buildPlayer(Chatter sender) {
|
||||
printPage(sender, "HELP_BAU_GROUP_PLAYER_TITLE", "HELP_SPEED", "HELP_NV", "HELP_WV", "HELP_DEBUGSTICK", "HELP_TRACE", "HELP_LOADER");
|
||||
printPage(sender, "HELP_BAU_GROUP_PLAYER_TITLE", "HELP_SPEED", "HELP_NV", "HELP_DEBUGSTICK", "HELP_TRACE", "HELP_LOADER");
|
||||
}
|
||||
|
||||
@Register({"build","worldedit"})
|
||||
|
@ -124,7 +124,9 @@ public class TpCommand extends SWCommand {
|
||||
sender.system("JOIN_PLAYER_BLOCK");
|
||||
return;
|
||||
}
|
||||
} else if (BauLock.checkNotifyLocked(SteamwarUser.get(bauserver.getOwner()), sender)) {
|
||||
} else if (BauLock.isLocked(SteamwarUser.get(bauserver.getOwner()), sender.user())) {
|
||||
sender.system("BAU_LOCKED_NOALLOWED");
|
||||
Chatter.of(bauserver.getOwner()).system("BAU_LOCK_BLOCKED", sender);
|
||||
return;
|
||||
} else if (!bauserver.getOwner().equals(sender.user().getUUID()) && BauweltMember.getBauMember(bauserver.getOwner(), sender.user().getUUID()) == null) {
|
||||
SubserverSystem.sendDeniedMessage(sender, bauserver.getOwner());
|
||||
|
@ -74,17 +74,17 @@ public class ChannelListener extends ListenerAdapter {
|
||||
if(sender.user().getDiscordId() == null)
|
||||
return;
|
||||
|
||||
VelocityCore.getLogger().log(Level.INFO, "%s -> executed Discord command /%s %s".formatted(sender.user().getUserName(), event.getName(), event.getOption(DiscordBot.ARGUMENT_NAME).getAsString()));
|
||||
SWCommand command = DiscordBot.getCommands().get(event.getName());
|
||||
UserPerm permission = command.getPermission();
|
||||
if(permission != null && !sender.user().perms().contains(permission))
|
||||
return;
|
||||
|
||||
OptionMapping option = event.getOption(DiscordBot.ARGUMENT_NAME);
|
||||
String args = "";
|
||||
if(option != null)
|
||||
args = option.getAsString();
|
||||
|
||||
VelocityCore.getLogger().log(Level.INFO, "%s -> executed Discord command /%s %s".formatted(sender.user().getUserName(), event.getName(), args));
|
||||
SWCommand command = DiscordBot.getCommands().get(event.getName());
|
||||
UserPerm permission = command.getPermission();
|
||||
if(permission != null && !sender.user().perms().contains(permission))
|
||||
return;
|
||||
|
||||
command.execute(sender, args.split(" "));
|
||||
});
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ import net.dv8tion.jda.api.EmbedBuilder;
|
||||
import net.dv8tion.jda.api.MessageBuilder;
|
||||
import net.dv8tion.jda.api.Permission;
|
||||
import net.dv8tion.jda.api.entities.Emoji;
|
||||
import net.dv8tion.jda.api.entities.MessageChannel;
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.User;
|
||||
import net.dv8tion.jda.api.events.interaction.GenericComponentInteractionCreateEvent;
|
||||
@ -83,8 +84,8 @@ public class DiscordTicketHandler extends ListenerAdapter {
|
||||
|
||||
@Override
|
||||
public void onGenericComponentInteractionCreate(@NotNull GenericComponentInteractionCreateEvent event) {
|
||||
TextChannel channel = event.getTextChannel();
|
||||
if(channel.getParent() != null && channel.getParent().getId().equals(TICKET_CATEGORY) && event.getComponentId().startsWith("close-")) {
|
||||
MessageChannel messageChannel = event.getChannel();
|
||||
if(messageChannel instanceof TextChannel channel && channel.getParent() != null && channel.getParent().getId().equals(TICKET_CATEGORY) && event.getComponentId().startsWith("close-")) {
|
||||
LinkedList<StringBuilder> messages = channel.getIterableHistory().complete().stream()
|
||||
.filter(message -> !message.getAuthor().isSystem() && !message.getAuthor().isBot())
|
||||
.map(message -> {
|
||||
@ -149,7 +150,7 @@ public class DiscordTicketHandler extends ListenerAdapter {
|
||||
if(event.getAuthor().isBot())
|
||||
return;
|
||||
|
||||
ChatterGroup receivers = Chatter.serverteam();
|
||||
ChatterGroup receivers = new ChatterGroup(Chatter.allStream().filter(player -> player.user().hasPerm(UserPerm.TICKET_LOG)));
|
||||
try {
|
||||
SteamwarUser user = SteamwarUser.get(Long.parseLong(channel.getTopic()));
|
||||
if(user != null && !user.perms().contains(UserPerm.TEAM))
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,13 +19,16 @@
|
||||
|
||||
package de.steamwar.velocitycore.tablist;
|
||||
|
||||
import com.velocitypowered.api.network.ProtocolVersion;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.util.GameProfile;
|
||||
import com.velocitypowered.proxy.connection.backend.VelocityServerConnection;
|
||||
import com.velocitypowered.proxy.connection.client.ConnectedPlayer;
|
||||
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;
|
||||
@ -46,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<>();
|
||||
@ -136,6 +139,11 @@ public class Tablist extends ChannelInboundHandlerAdapter {
|
||||
synchronized (directTabItems) {
|
||||
directTabItems.clear();
|
||||
}
|
||||
|
||||
if(player.getProtocolVersion().greaterThan(ProtocolVersion.MINECRAFT_1_20)) {
|
||||
current.clear();
|
||||
sendPacket(player, createTeamPacket);
|
||||
}
|
||||
}
|
||||
|
||||
private void injection() {
|
||||
@ -205,6 +213,40 @@ public class Tablist extends ChannelInboundHandlerAdapter {
|
||||
directTabItems.remove(uuid);
|
||||
}
|
||||
}
|
||||
} else if(msg instanceof LegacyPlayerListItemPacket packet) {
|
||||
if(packet.getAction() == LegacyPlayerListItemPacket.ADD_PLAYER) {
|
||||
for(LegacyPlayerListItemPacket.Item entry : packet.getItems()) {
|
||||
entry.setLatency(1).setPlayerKey(null);
|
||||
|
||||
if (!Storage.teamServers.containsValue(connection.getServerInfo())) {
|
||||
entry.setDisplayName(Component.empty());
|
||||
} else if (entry.getDisplayName() == null) {
|
||||
entry.setDisplayName(Component.text(entry.getName()).color(NamedTextColor.GRAY));
|
||||
}
|
||||
|
||||
UpsertPlayerInfoPacket.Entry newEntry = new UpsertPlayerInfoPacket.Entry(entry.getUuid());
|
||||
newEntry.setProfile(new GameProfile(entry.getUuid(), entry.getName(), entry.getProperties()));
|
||||
newEntry.setDisplayName(new ComponentHolder(player.getProtocolVersion(), entry.getDisplayName()));
|
||||
newEntry.setListed(true);
|
||||
synchronized (directTabItems) {
|
||||
directTabItems.put(entry.getUuid(), newEntry);
|
||||
}
|
||||
}
|
||||
} else if(packet.getAction() == LegacyPlayerListItemPacket.UPDATE_GAMEMODE) {
|
||||
for(LegacyPlayerListItemPacket.Item entry : packet.getItems()) {
|
||||
if(!player.getUniqueId().equals(entry.getUuid()) && entry.getGameMode() == 3)
|
||||
entry.setGameMode(1);
|
||||
}
|
||||
} else if(packet.getAction() == LegacyPlayerListItemPacket.REMOVE_PLAYER) {
|
||||
for(LegacyPlayerListItemPacket.Item entry : packet.getItems()) {
|
||||
synchronized (directTabItems) {
|
||||
directTabItems.remove(entry.getUuid());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ReferenceCountUtil.release(msg);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ctx.fireChannelRead(msg);
|
||||
@ -214,6 +256,23 @@ public class Tablist extends ChannelInboundHandlerAdapter {
|
||||
if(items.isEmpty())
|
||||
return;
|
||||
|
||||
if(player.getProtocolVersion().lessThan(ProtocolVersion.MINECRAFT_1_19_3)) {
|
||||
int legacyAction = LegacyPlayerListItemPacket.REMOVE_PLAYER;
|
||||
if(action == UpsertPlayerInfoPacket.Action.UPDATE_DISPLAY_NAME)
|
||||
legacyAction = LegacyPlayerListItemPacket.UPDATE_DISPLAY_NAME;
|
||||
else if (action == UpsertPlayerInfoPacket.Action.ADD_PLAYER)
|
||||
legacyAction = LegacyPlayerListItemPacket.ADD_PLAYER;
|
||||
|
||||
sendPacket(player, new LegacyPlayerListItemPacket(legacyAction, items.stream().map(item -> new LegacyPlayerListItemPacket
|
||||
.Item(item.getProfileId())
|
||||
.setName(item.getProfile().getName())
|
||||
.setProperties(item.getProfile().getProperties())
|
||||
.setDisplayName(item.getDisplayName().getComponent())
|
||||
.setLatency(item.getLatency())
|
||||
.setGameMode(item.getGameMode())).toList()));
|
||||
return;
|
||||
}
|
||||
|
||||
if(action == null) { //REMOVE
|
||||
sendPacket(player, new RemovePlayerInfoPacket(items.stream().map(item -> item.getProfile().getId()).toList()));
|
||||
return;
|
||||
@ -235,7 +294,9 @@ public class Tablist extends ChannelInboundHandlerAdapter {
|
||||
|
||||
private String ping() {
|
||||
long ping = player.getPing();
|
||||
if (ping < 50) {
|
||||
if (ping == -1) {
|
||||
return "§7?";
|
||||
} else if (ping < 50) {
|
||||
return "§a" + ping;
|
||||
} else if (ping < 150) {
|
||||
return "§e" + ping;
|
||||
|
@ -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;
|
||||
@ -61,10 +60,10 @@ public class TablistManager extends BasicListener {
|
||||
|
||||
@Subscribe
|
||||
public void onJoin(PostLoginEvent event) {
|
||||
Tablist.sendPacket(event.getPlayer(), createTeamPacket);
|
||||
synchronized (tablists) {
|
||||
tablists.put(event.getPlayer(), new Tablist(event.getPlayer()));
|
||||
}
|
||||
Tablist.sendPacket(event.getPlayer(), Tablist.createTeamPacket);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
@ -34,8 +34,7 @@ public class BauLock {
|
||||
owner.system("BAU_LOCKED_" + state.name());
|
||||
}
|
||||
|
||||
public static boolean checkNotifyLocked(SteamwarUser owner, Chatter sender) {
|
||||
SteamwarUser target = sender.user();
|
||||
public static boolean isLocked(SteamwarUser owner, SteamwarUser target) {
|
||||
if (owner.getId() == target.getId())
|
||||
return false;
|
||||
|
||||
@ -62,12 +61,6 @@ public class BauLock {
|
||||
locked = false;
|
||||
}
|
||||
|
||||
if(locked) {
|
||||
sender.system("BAU_LOCKED_NOALLOWED");
|
||||
Chatter.of(owner.getUUID()).system("BAU_LOCK_BLOCKED", sender);
|
||||
}
|
||||
|
||||
return locked;
|
||||
}
|
||||
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren