Fix BauLock, 1.15 - 1.20.1 Tablist, Builderserver, BugCommand
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: Lixfel <git-5w3l@lixfel.de>
Dieser Commit ist enthalten in:
Ursprung
bacf366643
Commit
d09f8edfa2
@ -1 +1 @@
|
|||||||
Subproject commit e76473e0beffe3df5c6d1c3430f62332b7371579
|
Subproject commit 1237a699ba244ecfac65478df34e714afbe2366e
|
@ -184,7 +184,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}
|
NOTE_TEAM={0} §e{1} §7received a §e§lnote§7 from §e{2} {3}: §f{4}
|
||||||
|
|
||||||
#BugCommand
|
#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
|
#IgnoreCommand
|
||||||
IGNORE_YOURSELF=§cHow are you going to ignore yourself?
|
IGNORE_YOURSELF=§cHow are you going to ignore yourself?
|
||||||
|
@ -168,7 +168,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}
|
NOTE_TEAM={0} §e{1} §7erhielt von §e{2} {3} §7die §e§lNotiz§7§8: §f{4}
|
||||||
|
|
||||||
#BugCommand
|
#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
|
#IgnoreCommand
|
||||||
IGNORE_YOURSELF=§cWie willst du dich selber ignorieren?
|
IGNORE_YOURSELF=§cWie willst du dich selber ignorieren?
|
||||||
|
@ -214,7 +214,7 @@ public class ServerStarter {
|
|||||||
directory = version.getServerDirectory("Builder");
|
directory = version.getServerDirectory("Builder");
|
||||||
worldDir = version.getWorldFolder(BUILDER_BASE_PATH);
|
worldDir = version.getWorldFolder(BUILDER_BASE_PATH);
|
||||||
worldName = map;
|
worldName = map;
|
||||||
serverNameProvider = port -> map + "⛏";
|
serverNameProvider = port -> "*" + map;
|
||||||
checkpoint = true;
|
checkpoint = true;
|
||||||
constructor = (serverName, port, builder, shutdownCallback, failureCallback) -> new Builderserver(serverName, worldName, port, builder, shutdownCallback, failureCallback);
|
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)
|
@Validator(value = "teleportTarget", local = true)
|
||||||
public TypeValidator<SteamwarUser> teleportTargetValidator() {
|
public TypeValidator<SteamwarUser> teleportTargetValidator() {
|
||||||
return (sender, value, messageSender) -> {
|
return (sender, owner, messageSender) -> {
|
||||||
if (value == null) {
|
if (owner == null) {
|
||||||
messageSender.send("UNKNOWN_PLAYER");
|
messageSender.send("UNKNOWN_PLAYER");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (sender.user().getId() != value.getId() && BauweltMember.getBauMember(value.getId(), sender.user().getId()) == null) {
|
if (sender.user().getId() != owner.getId() && BauweltMember.getBauMember(owner.getId(), sender.user().getId()) == null) {
|
||||||
SubserverSystem.sendDeniedMessage(sender, value.getUUID());
|
SubserverSystem.sendDeniedMessage(sender, owner.getUUID());
|
||||||
messageSender.send("BAU_TP_NOALLOWED");
|
messageSender.send("BAU_TP_NOALLOWED");
|
||||||
return false;
|
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
|
@Register
|
||||||
public void bugMessage(Chatter sender, String... message) {
|
public void bugMessage(Chatter sender, String... message) {
|
||||||
SWException.log(
|
int id = SWException.logGetId(
|
||||||
String.join(" ", message),
|
String.join(" ", message),
|
||||||
sender.withPlayerOrOffline(player -> player.getCurrentServer().map(connection -> connection.getServerInfo().getName()).orElse("offline"), () -> "offline") + " " + sender.user().getUserName() + " " + sender.user().getId()
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,9 @@ public class TpCommand extends SWCommand {
|
|||||||
sender.system("JOIN_PLAYER_BLOCK");
|
sender.system("JOIN_PLAYER_BLOCK");
|
||||||
return;
|
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;
|
return;
|
||||||
} else if (!bauserver.getOwner().equals(sender.user().getUUID()) && BauweltMember.getBauMember(bauserver.getOwner(), sender.user().getUUID()) == null) {
|
} else if (!bauserver.getOwner().equals(sender.user().getUUID()) && BauweltMember.getBauMember(bauserver.getOwner(), sender.user().getUUID()) == null) {
|
||||||
SubserverSystem.sendDeniedMessage(sender, bauserver.getOwner());
|
SubserverSystem.sendDeniedMessage(sender, bauserver.getOwner());
|
||||||
|
@ -19,12 +19,14 @@
|
|||||||
|
|
||||||
package de.steamwar.velocitycore.tablist;
|
package de.steamwar.velocitycore.tablist;
|
||||||
|
|
||||||
|
import com.velocitypowered.api.network.ProtocolVersion;
|
||||||
import com.velocitypowered.api.proxy.Player;
|
import com.velocitypowered.api.proxy.Player;
|
||||||
import com.velocitypowered.api.util.GameProfile;
|
import com.velocitypowered.api.util.GameProfile;
|
||||||
import com.velocitypowered.proxy.connection.backend.VelocityServerConnection;
|
import com.velocitypowered.proxy.connection.backend.VelocityServerConnection;
|
||||||
import com.velocitypowered.proxy.connection.client.ConnectedPlayer;
|
import com.velocitypowered.proxy.connection.client.ConnectedPlayer;
|
||||||
import com.velocitypowered.proxy.network.Connections;
|
import com.velocitypowered.proxy.network.Connections;
|
||||||
import com.velocitypowered.proxy.protocol.MinecraftPacket;
|
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.RemovePlayerInfoPacket;
|
||||||
import com.velocitypowered.proxy.protocol.packet.UpsertPlayerInfoPacket;
|
import com.velocitypowered.proxy.protocol.packet.UpsertPlayerInfoPacket;
|
||||||
import com.velocitypowered.proxy.protocol.packet.chat.ComponentHolder;
|
import com.velocitypowered.proxy.protocol.packet.chat.ComponentHolder;
|
||||||
@ -205,6 +207,40 @@ public class Tablist extends ChannelInboundHandlerAdapter {
|
|||||||
directTabItems.remove(uuid);
|
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);
|
ctx.fireChannelRead(msg);
|
||||||
@ -214,6 +250,23 @@ public class Tablist extends ChannelInboundHandlerAdapter {
|
|||||||
if(items.isEmpty())
|
if(items.isEmpty())
|
||||||
return;
|
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
|
if(action == null) { //REMOVE
|
||||||
sendPacket(player, new RemovePlayerInfoPacket(items.stream().map(item -> item.getProfile().getId()).toList()));
|
sendPacket(player, new RemovePlayerInfoPacket(items.stream().map(item -> item.getProfile().getId()).toList()));
|
||||||
return;
|
return;
|
||||||
|
@ -61,10 +61,10 @@ public class TablistManager extends BasicListener {
|
|||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onJoin(PostLoginEvent event) {
|
public void onJoin(PostLoginEvent event) {
|
||||||
Tablist.sendPacket(event.getPlayer(), createTeamPacket);
|
|
||||||
synchronized (tablists) {
|
synchronized (tablists) {
|
||||||
tablists.put(event.getPlayer(), new Tablist(event.getPlayer()));
|
tablists.put(event.getPlayer(), new Tablist(event.getPlayer()));
|
||||||
}
|
}
|
||||||
|
Tablist.sendPacket(event.getPlayer(), createTeamPacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
|
@ -34,8 +34,7 @@ public class BauLock {
|
|||||||
owner.system("BAU_LOCKED_" + state.name());
|
owner.system("BAU_LOCKED_" + state.name());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean checkNotifyLocked(SteamwarUser owner, Chatter sender) {
|
public static boolean isLocked(SteamwarUser owner, SteamwarUser target) {
|
||||||
SteamwarUser target = sender.user();
|
|
||||||
if (owner.getId() == target.getId())
|
if (owner.getId() == target.getId())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -62,12 +61,6 @@ public class BauLock {
|
|||||||
locked = false;
|
locked = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(locked) {
|
|
||||||
sender.system("BAU_LOCKED_NOALLOWED");
|
|
||||||
Chatter.of(owner.getUUID()).system("BAU_LOCK_BLOCKED", sender);
|
|
||||||
}
|
|
||||||
|
|
||||||
return locked;
|
return locked;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren