geforkt von Mirrors/Velocity
Update for breaking Adventure boss bar changes
Dieser Commit ist enthalten in:
Ursprung
e3a95b4783
Commit
a6964bd31c
@ -40,7 +40,7 @@ import com.velocitypowered.proxy.server.ServerMap;
|
||||
import com.velocitypowered.proxy.util.AddressUtil;
|
||||
import com.velocitypowered.proxy.util.EncryptionUtils;
|
||||
import com.velocitypowered.proxy.util.VelocityChannelRegistrar;
|
||||
import com.velocitypowered.proxy.util.bossbar.BossBarManager;
|
||||
import com.velocitypowered.proxy.util.bossbar.AdventureBossBarManager;
|
||||
import com.velocitypowered.proxy.util.bossbar.VelocityBossBar;
|
||||
import com.velocitypowered.proxy.util.ratelimit.Ratelimiter;
|
||||
import com.velocitypowered.proxy.util.ratelimit.Ratelimiters;
|
||||
@ -112,7 +112,7 @@ public class VelocityServer implements ProxyServer, ForwardingAudience {
|
||||
private final AtomicBoolean shutdownInProgress = new AtomicBoolean(false);
|
||||
private boolean shutdown = false;
|
||||
private final VelocityPluginManager pluginManager;
|
||||
private final BossBarManager bossBarManager;
|
||||
private final AdventureBossBarManager bossBarManager;
|
||||
|
||||
private final Map<UUID, ConnectedPlayer> connectionsByUuid = new ConcurrentHashMap<>();
|
||||
private final Map<String, ConnectedPlayer> connectionsByName = new ConcurrentHashMap<>();
|
||||
@ -131,7 +131,7 @@ public class VelocityServer implements ProxyServer, ForwardingAudience {
|
||||
cm = new ConnectionManager(this);
|
||||
servers = new ServerMap(this);
|
||||
this.options = options;
|
||||
this.bossBarManager = new BossBarManager();
|
||||
this.bossBarManager = new AdventureBossBarManager();
|
||||
}
|
||||
|
||||
public KeyPair getServerKeyPair() {
|
||||
@ -626,7 +626,7 @@ public class VelocityServer implements ProxyServer, ForwardingAudience {
|
||||
return audiences;
|
||||
}
|
||||
|
||||
public BossBarManager getBossBarManager() {
|
||||
public AdventureBossBarManager getBossBarManager() {
|
||||
return bossBarManager;
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
/**
|
||||
* Manages all boss bars known to the proxy.
|
||||
*/
|
||||
public class BossBarManager implements BossBar.Listener {
|
||||
public class AdventureBossBarManager implements BossBar.Listener {
|
||||
private static final Enum2IntMap<Color> COLORS_TO_PROTOCOL =
|
||||
new Enum2IntMap.Builder<>(Color.class)
|
||||
.put(Color.PINK, 0)
|
||||
@ -48,7 +48,7 @@ public class BossBarManager implements BossBar.Listener {
|
||||
.build();
|
||||
private final Map<BossBar, BossBarHolder> bars;
|
||||
|
||||
public BossBarManager() {
|
||||
public AdventureBossBarManager() {
|
||||
this.bars = new MapMaker().weakKeys().makeMap();
|
||||
}
|
||||
|
||||
@ -160,13 +160,13 @@ public class BossBarManager implements BossBar.Listener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bossBarFlagsChanged(@NonNull BossBar bar, @NonNull Set<Flag> oldFlags,
|
||||
@NonNull Set<Flag> newFlags) {
|
||||
public void bossBarFlagsChanged(@NonNull BossBar bar, @NonNull Set<Flag> added,
|
||||
@NonNull Set<Flag> removed) {
|
||||
BossBarHolder holder = this.getHandler(bar);
|
||||
if (holder == null) {
|
||||
return;
|
||||
}
|
||||
com.velocitypowered.proxy.protocol.packet.BossBar packet = holder.createFlagsUpdate(newFlags);
|
||||
com.velocitypowered.proxy.protocol.packet.BossBar packet = holder.createFlagsUpdate();
|
||||
for (ConnectedPlayer player : holder.subscribers) {
|
||||
player.getConnection().write(packet);
|
||||
}
|
||||
@ -184,7 +184,7 @@ public class BossBarManager implements BossBar.Listener {
|
||||
}
|
||||
|
||||
void register() {
|
||||
registrationOnce.run(() -> this.bar.addListener(BossBarManager.this));
|
||||
registrationOnce.run(() -> this.bar.addListener(AdventureBossBarManager.this));
|
||||
}
|
||||
|
||||
com.velocitypowered.proxy.protocol.packet.BossBar createRemovePacket() {
|
||||
@ -233,6 +233,10 @@ public class BossBarManager implements BossBar.Listener {
|
||||
return packet;
|
||||
}
|
||||
|
||||
com.velocitypowered.proxy.protocol.packet.BossBar createFlagsUpdate() {
|
||||
return createFlagsUpdate(bar.flags());
|
||||
}
|
||||
|
||||
com.velocitypowered.proxy.protocol.packet.BossBar createFlagsUpdate(Set<Flag> newFlags) {
|
||||
com.velocitypowered.proxy.protocol.packet.BossBar packet = new com.velocitypowered
|
||||
.proxy.protocol.packet.BossBar();
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren