6 Commits

Author SHA1 Message Date
3aab2fa1e1 new event TabCompleteRequestEvent and deprecate TabCompleteEvent 2025-07-01 21:24:43 +02:00
8be54e72ed Add CommandsDeclareEvent to declare commands with brigadier API 2025-07-01 21:24:43 +02:00
3e1e95ff49 Server branding now includes the backend server name 2025-07-01 21:24:43 +02:00
b5794d87d9 Multi-session with same Minecraft account with specific permission
Players with permission bungeecord.multiple_connect can have multiple connections with the same Minecraft account.
The UUID and player name is altered to avoid collision with other player:
UUID : xxxxxxxx-xxxx-VIxx-xxxx-xxxxxxxxxxxx
- The UUID version (V above) is now the provided version + 8 (for online player, it is 4, so it becomes C).
- The I digit will follow the index of the duplicated player : first duplicated player is 1, second one is 2.
- The name of the player will be the real player name, followed by the character "." (dot) followed by the duplication index.

Bedrock accounts connected using the Floodgate plugin will not be able to connect multiple times due to the risk of xUID collision.
2025-07-01 21:24:43 +02:00
dc8d29a05b Change projet configuration and POM for Pandacube 2025-07-01 21:24:43 +02:00
43dab76bd5 Remove modules and startup delay
We don’t need them for Pandacube
2025-07-01 21:24:43 +02:00
79 changed files with 277 additions and 791 deletions

View File

@@ -9,7 +9,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
java: [8, 11, 17, 21, 25] java: [8, 11, 17, 21, 25-ea]
name: Java ${{ matrix.java }} name: Java ${{ matrix.java }}

View File

@@ -6,12 +6,12 @@
<parent> <parent>
<groupId>fr.pandacube.bungeecord</groupId> <groupId>fr.pandacube.bungeecord</groupId>
<artifactId>bungeecord-parent</artifactId> <artifactId>bungeecord-parent</artifactId>
<version>1.21-R0.5-SNAPSHOT</version> <version>1.21-R0.4-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<artifactId>bungeecord-api</artifactId> <artifactId>bungeecord-api</artifactId>
<version>1.21-R0.5-SNAPSHOT</version> <version>1.21-R0.4-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>BungeeCord-API</name> <name>BungeeCord-API</name>
@@ -74,12 +74,6 @@
<!-- not part of the API proper --> <!-- not part of the API proper -->
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm-commons</artifactId>
<version>9.8</version>
<scope>compile</scope>
</dependency>
<dependency> <dependency>
<groupId>org.yaml</groupId> <groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId> <artifactId>snakeyaml</artifactId>

View File

@@ -1,77 +0,0 @@
package net.md_5.bungee.api;
import lombok.AccessLevel;
import lombok.Data;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import net.md_5.bungee.api.chat.BaseComponent;
/**
* Represents a server link which may be sent to the client.
*/
@Data
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
public final class ServerLink
{
/**
* The links type.
*
* Note: This value is nullable, if null, label is non-null.
*/
private final LinkType type;
/**
* The label for the link.
*
* Note: This value is nullable, if null, type is non-null.
*/
private final BaseComponent label;
/**
* The URL that is displayed.
*/
@NonNull
private final String url;
/**
* Creates a link with a specified type and URL.
*
* @param type the type of the link
* @param url the URL to be displayed
*/
public ServerLink(@NonNull LinkType type, @NonNull String url)
{
this.type = type;
this.label = null;
this.url = url;
}
/**
* Creates a link with a label and URL.
*
* @param label the label to be displayed
* @param url the URL to be displayed
*/
public ServerLink(@NonNull BaseComponent label, @NonNull String url)
{
this.type = null;
this.label = label;
this.url = url;
}
public enum LinkType
{
REPORT_BUG,
COMMUNITY_GUIDELINES,
SUPPORT,
STATUS,
FEEDBACK,
COMMUNITY,
WEBSITE,
FORUMS,
NEWS,
ANNOUNCEMENTS;
}
}

View File

@@ -87,10 +87,8 @@ public interface Connection
/** /**
* Queue a packet to this connection. * Queue a packet to this connection.
* * If the packet is not registered for the connections current encoder protocol, it will be queued until it is,
* If the packet is not registered for the connections current encoder * otherwise it will be sent immediately.
* protocol, it will be queued until it is, otherwise it will be sent
* immediately.
* *
* @param packet the packet to be queued * @param packet the packet to be queued
* @throws UnsupportedOperationException if used for a PendingConnection * @throws UnsupportedOperationException if used for a PendingConnection

View File

@@ -1,6 +1,5 @@
package net.md_5.bungee.api.connection; package net.md_5.bungee.api.connection;
import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
@@ -9,7 +8,6 @@ import net.md_5.bungee.api.Callback;
import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ServerConnectRequest; import net.md_5.bungee.api.ServerConnectRequest;
import net.md_5.bungee.api.ServerLink;
import net.md_5.bungee.api.SkinConfiguration; import net.md_5.bungee.api.SkinConfiguration;
import net.md_5.bungee.api.Title; import net.md_5.bungee.api.Title;
import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.api.chat.BaseComponent;
@@ -388,7 +386,6 @@ public interface ProxiedPlayer extends Connection, CommandSender
/** /**
* Gets the client brand of this player. * Gets the client brand of this player.
*
* If the player has not sent a brand packet yet, it will return null. * If the player has not sent a brand packet yet, it will return null.
* *
* @return the brand of the client, or null if not received yet * @return the brand of the client, or null if not received yet
@@ -413,16 +410,4 @@ public interface ProxiedPlayer extends Connection, CommandSender
*/ */
@ApiStatus.Experimental @ApiStatus.Experimental
void showDialog(Dialog dialog); void showDialog(Dialog dialog);
/**
* Sends server links to the player.
*
* Note: The links already sent to the player will be overwritten. Also, the
* backend server is able to override links sent by the proxy.
*
* @param serverLinks the server links to send
* @throws IllegalStateException if the player's version is not at least
* 1.21
*/
void sendServerLinks(List<ServerLink> serverLinks);
} }

View File

@@ -11,7 +11,6 @@ import lombok.Getter;
import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.config.ConfigurationAdapter; import net.md_5.bungee.api.config.ConfigurationAdapter;
import net.md_5.bungee.api.scheduler.GroupedThreadFactory; import net.md_5.bungee.api.scheduler.GroupedThreadFactory;
import org.jetbrains.annotations.ApiStatus;
/** /**
* Represents any Plugin that may be loaded at runtime to enhance existing * Represents any Plugin that may be loaded at runtime to enhance existing
@@ -109,14 +108,7 @@ public class Plugin
// //
private ExecutorService service; private ExecutorService service;
/**
* Returns the executor service associated with this plugin.
*
* @return the executor service for this plugin
* @deprecated internal API. Use {@link ProxyServer#getScheduler()} instead
*/
@Deprecated @Deprecated
@ApiStatus.Internal
public ExecutorService getExecutorService() public ExecutorService getExecutorService()
{ {
if ( service == null ) if ( service == null )

View File

@@ -1,7 +1,6 @@
package net.md_5.bungee.api.plugin; package net.md_5.bungee.api.plugin;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableMap;
import com.google.common.io.ByteStreams; import com.google.common.io.ByteStreams;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@@ -10,20 +9,13 @@ import java.net.URL;
import java.net.URLClassLoader; import java.net.URLClassLoader;
import java.security.CodeSigner; import java.security.CodeSigner;
import java.security.CodeSource; import java.security.CodeSource;
import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet; import java.util.concurrent.CopyOnWriteArraySet;
import java.util.jar.JarEntry; import java.util.jar.JarEntry;
import java.util.jar.JarFile; import java.util.jar.JarFile;
import java.util.jar.Manifest; import java.util.jar.Manifest;
import java.util.logging.Level;
import java.util.logging.Logger;
import lombok.ToString; import lombok.ToString;
import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.ProxyServer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.commons.ClassRemapper;
import org.objectweb.asm.commons.SimpleRemapper;
@ToString(of = "desc") @ToString(of = "desc")
final class PluginClassloader extends URLClassLoader final class PluginClassloader extends URLClassLoader
@@ -129,15 +121,6 @@ final class PluginClassloader extends URLClassLoader
throw new ClassNotFoundException( name, ex ); throw new ClassNotFoundException( name, ex );
} }
try
{
classBytes = remap( classBytes );
} catch ( Exception ex )
{
Logger logger = ( plugin != null ) ? plugin.getLogger() : proxy.getLogger();
logger.log( Level.SEVERE, "Error trying to remap class " + path, ex );
}
int dot = name.lastIndexOf( '.' ); int dot = name.lastIndexOf( '.' );
if ( dot != -1 ) if ( dot != -1 )
{ {
@@ -172,27 +155,6 @@ final class PluginClassloader extends URLClassLoader
return super.findClass( name ); return super.findClass( name );
} }
private static final Map<String, String> MAPPINGS = ImmutableMap.of(
"net/md_5/bungee/protocol/ChatChain", "net/md_5/bungee/protocol/data/ChatChain",
"net/md_5/bungee/protocol/Location", "net/md_5/bungee/protocol/data/Location",
"net/md_5/bungee/protocol/NumberFormat", "net/md_5/bungee/protocol/data/NumberFormat",
"net/md_5/bungee/protocol/PlayerPublicKey", "net/md_5/bungee/protocol/data/PlayerPublicKey",
"net/md_5/bungee/protocol/Property", "net/md_5/bungee/protocol/data/Property",
"net/md_5/bungee/protocol/SeenMessages", "net/md_5/bungee/protocol/data/SeenMessages",
"net/md_5/bungee/protocol/Either", "net/md_5/bungee/protocol/util/Either",
"net/md_5/bungee/protocol/TagUtil", "net/md_5/bungee/protocol/util/TagUtil"
);
private static byte[] remap(byte[] b)
{
ClassReader cr = new ClassReader( b );
ClassWriter cw = new ClassWriter( cr, 0 );
cr.accept( new ClassRemapper( cw, new SimpleRemapper( MAPPINGS ) ), 0 );
return cw.toByteArray();
}
@Override @Override
public void close() throws IOException public void close() throws IOException
{ {

View File

@@ -30,7 +30,6 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.jar.JarEntry; import java.util.jar.JarEntry;
import java.util.jar.JarFile; import java.util.jar.JarFile;
import java.util.logging.Level; import java.util.logging.Level;
import lombok.Locked;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.CommandSender;
@@ -99,15 +98,21 @@ public final class PluginManager
* @param plugin the plugin owning this command * @param plugin the plugin owning this command
* @param command the command to register * @param command the command to register
*/ */
@Locked.Write("commandsLock")
public void registerCommand(Plugin plugin, Command command) public void registerCommand(Plugin plugin, Command command)
{ {
commandMap.put( command.getName().toLowerCase( Locale.ROOT ), command ); commandsLock.writeLock().lock();
for ( String alias : command.getAliases() ) try
{ {
commandMap.put( alias.toLowerCase( Locale.ROOT ), command ); commandMap.put( command.getName().toLowerCase( Locale.ROOT ), command );
for ( String alias : command.getAliases() )
{
commandMap.put( alias.toLowerCase( Locale.ROOT ), command );
}
commandsByPlugin.put( plugin, command );
} finally
{
commandsLock.writeLock().unlock();
} }
commandsByPlugin.put( plugin, command );
} }
/** /**
@@ -115,11 +120,17 @@ public final class PluginManager
* *
* @param command the command to unregister * @param command the command to unregister
*/ */
@Locked.Write("commandsLock")
public void unregisterCommand(Command command) public void unregisterCommand(Command command)
{ {
while ( commandMap.values().remove( command ) ); commandsLock.writeLock().lock();
commandsByPlugin.values().remove( command ); try
{
while ( commandMap.values().remove( command ) );
commandsByPlugin.values().remove( command );
} finally
{
commandsLock.writeLock().unlock();
}
} }
/** /**
@@ -127,14 +138,20 @@ public final class PluginManager
* *
* @param plugin the plugin to register the commands of * @param plugin the plugin to register the commands of
*/ */
@Locked.Write("commandsLock")
public void unregisterCommands(Plugin plugin) public void unregisterCommands(Plugin plugin)
{ {
for ( Iterator<Command> it = commandsByPlugin.get( plugin ).iterator(); it.hasNext(); ) commandsLock.writeLock().lock();
try
{ {
Command command = it.next(); for ( Iterator<Command> it = commandsByPlugin.get( plugin ).iterator(); it.hasNext(); )
while ( commandMap.values().remove( command ) ); {
it.remove(); Command command = it.next();
while ( commandMap.values().remove( command ) );
it.remove();
}
} finally
{
commandsLock.writeLock().unlock();
} }
} }
@@ -450,15 +467,22 @@ public final class PluginManager
* @param plugin the owning plugin * @param plugin the owning plugin
* @param listener the listener to register events for * @param listener the listener to register events for
*/ */
@Locked("listenersLock")
public void registerListener(Plugin plugin, Listener listener) public void registerListener(Plugin plugin, Listener listener)
{ {
for ( Method method : listener.getClass().getDeclaredMethods() ) listenersLock.lock();
try
{ {
Preconditions.checkArgument( !method.isAnnotationPresent( Subscribe.class ), "Listener %s has registered using deprecated subscribe annotation! Please update to @EventHandler.", listener ); for ( Method method : listener.getClass().getDeclaredMethods() )
{
Preconditions.checkArgument( !method.isAnnotationPresent( Subscribe.class ),
"Listener %s has registered using deprecated subscribe annotation! Please update to @EventHandler.", listener );
}
eventBus.register( listener );
listenersByPlugin.put( plugin, listener );
} finally
{
listenersLock.unlock();
} }
eventBus.register( listener );
listenersByPlugin.put( plugin, listener );
} }
/** /**
@@ -466,11 +490,17 @@ public final class PluginManager
* *
* @param listener the listener to unregister * @param listener the listener to unregister
*/ */
@Locked("listenersLock")
public void unregisterListener(Listener listener) public void unregisterListener(Listener listener)
{ {
eventBus.unregister( listener ); listenersLock.lock();
listenersByPlugin.values().remove( listener ); try
{
eventBus.unregister( listener );
listenersByPlugin.values().remove( listener );
} finally
{
listenersLock.unlock();
}
} }
/** /**
@@ -478,13 +508,19 @@ public final class PluginManager
* *
* @param plugin target plugin * @param plugin target plugin
*/ */
@Locked("listenersLock")
public void unregisterListeners(Plugin plugin) public void unregisterListeners(Plugin plugin)
{ {
for ( Iterator<Listener> it = listenersByPlugin.get( plugin ).iterator(); it.hasNext(); ) listenersLock.lock();
try
{ {
eventBus.unregister( it.next() ); for ( Iterator<Listener> it = listenersByPlugin.get( plugin ).iterator(); it.hasNext(); )
it.remove(); {
eventBus.unregister( it.next() );
it.remove();
}
} finally
{
listenersLock.unlock();
} }
} }
@@ -493,10 +529,16 @@ public final class PluginManager
* *
* @return commands * @return commands
*/ */
@Locked.Read("commandsLock")
public Collection<Map.Entry<String, Command>> getCommands() public Collection<Map.Entry<String, Command>> getCommands()
{ {
return Collections.unmodifiableCollection( commandMap.entrySet() ); commandsLock.readLock().lock();
try
{
return Collections.unmodifiableCollection( commandMap.entrySet() );
} finally
{
commandsLock.readLock().unlock();
}
} }
boolean isTransitiveDepend(PluginDescription plugin, PluginDescription depend) boolean isTransitiveDepend(PluginDescription plugin, PluginDescription depend)

View File

@@ -6,19 +6,18 @@
<parent> <parent>
<groupId>fr.pandacube.bungeecord</groupId> <groupId>fr.pandacube.bungeecord</groupId>
<artifactId>bungeecord-parent</artifactId> <artifactId>bungeecord-parent</artifactId>
<version>1.21-R0.5-SNAPSHOT</version> <version>1.21-R0.4-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<artifactId>bungeecord-bootstrap</artifactId> <artifactId>bungeecord-bootstrap</artifactId>
<version>1.21-R0.5-SNAPSHOT</version> <version>1.21-R0.4-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>BungeeCord-Bootstrap</name> <name>BungeeCord-Bootstrap</name>
<description>Java 1.6 loader for BungeeCord</description> <description>Java 1.6 loader for BungeeCord</description>
<properties> <properties>
<skipPublishing>true</skipPublishing>
<maven.deploy.skip>true</maven.deploy.skip> <maven.deploy.skip>true</maven.deploy.skip>
<maven.javadoc.skip>true</maven.javadoc.skip> <maven.javadoc.skip>true</maven.javadoc.skip>
<maven.build.timestamp.format>yyyyMMdd</maven.build.timestamp.format> <maven.build.timestamp.format>yyyyMMdd</maven.build.timestamp.format>

View File

@@ -6,12 +6,12 @@
<parent> <parent>
<groupId>fr.pandacube.bungeecord</groupId> <groupId>fr.pandacube.bungeecord</groupId>
<artifactId>bungeecord-parent</artifactId> <artifactId>bungeecord-parent</artifactId>
<version>1.21-R0.5-SNAPSHOT</version> <version>1.21-R0.4-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<artifactId>bungeecord-chat</artifactId> <artifactId>bungeecord-chat</artifactId>
<version>1.21-R0.5-SNAPSHOT</version> <version>1.21-R0.4-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>BungeeCord-Chat</name> <name>BungeeCord-Chat</name>

View File

@@ -313,9 +313,8 @@ public abstract class BaseComponent
} }
/** /**
* Returns the shadow color of this component. This uses the parent's shadow * Returns the shadow color of this component. This uses the parent's shadow color if this
* color if this component doesn't have one. null is returned if no shadow * component doesn't have one. null is returned if no shadow color is found.
* color is found.
* *
* @return the shadow color of this component * @return the shadow color of this component
*/ */

View File

@@ -1,7 +1,6 @@
package net.md_5.bungee.api.chat; package net.md_5.bungee.api.chat;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import java.awt.Color;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import lombok.Getter; import lombok.Getter;
@@ -352,19 +351,6 @@ public final class ComponentBuilder
return this; return this;
} }
/**
* Sets the shadow color of the current part.
*
* @param color the new shadow color
* @return this ComponentBuilder for chaining
* @since Minecraft 1.21.4-pre1
*/
public ComponentBuilder shadowColor(Color color)
{
getCurrentComponent().setShadowColor( color );
return this;
}
/** /**
* Sets the font of the current part. * Sets the font of the current part.
* *

View File

@@ -1,73 +0,0 @@
package net.md_5.bungee.api.chat;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
import net.md_5.bungee.api.chat.objects.ChatObject;
/**
* An object component that can be used to display objects.
* <p>
* It can either display a player's head or an object by a specific sprite and
* an atlas.
* <p>
* Note: this was added in Minecraft 1.21.9.
*/
@Getter
@Setter
@ToString
@EqualsAndHashCode(callSuper = true)
public final class ObjectComponent extends BaseComponent
{
private ChatObject object;
/**
* Creates a ObjectComponent from a given ChatObject.
*
* See {@link net.md_5.bungee.api.chat.objects.PlayerObject} and
* {@link net.md_5.bungee.api.chat.objects.SpriteObject}.
*
* @param object the ChatObject
*/
public ObjectComponent(@NonNull ChatObject object)
{
this.object = object;
}
/**
* Creates an object component from the original to clone it.
*
* @param original the original for the new score component
*/
public ObjectComponent(ObjectComponent original)
{
super( original );
setObject( original.object );
}
@Override
public ObjectComponent duplicate()
{
return new ObjectComponent( this );
}
@Override
protected void toPlainText(StringVisitor builder)
{
// I guess we cannot convert this to plain text
// builder.append( this.value );
super.toPlainText( builder );
}
@Override
protected void toLegacyText(StringVisitor builder)
{
addFormat( builder );
// Same here...
// builder.append( this.value );
super.toLegacyText( builder );
}
}

View File

@@ -170,7 +170,7 @@ public final class TextComponent extends BaseComponent
} }
continue; continue;
} }
int pos = indexOfSpecial( message, i ); int pos = message.indexOf( ' ', i );
if ( pos == -1 ) if ( pos == -1 )
{ {
pos = message.length(); pos = message.length();
@@ -205,20 +205,6 @@ public final class TextComponent extends BaseComponent
appender.accept( component ); appender.accept( component );
} }
private static int indexOfSpecial(String message, int pos)
{
for ( int i = pos; i < message.length(); i++ )
{
char c = message.charAt( i );
if ( c == ' ' || Character.isISOControl( c ) )
{
return i;
}
}
return -1;
}
/** /**
* Internal compatibility method to transform an array of components to a * Internal compatibility method to transform an array of components to a
* single component. * single component.

View File

@@ -1,5 +0,0 @@
package net.md_5.bungee.api.chat.objects;
public interface ChatObject
{
}

View File

@@ -1,39 +0,0 @@
package net.md_5.bungee.api.chat.objects;
import java.util.UUID;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NonNull;
import net.md_5.bungee.api.chat.player.Profile;
import net.md_5.bungee.api.chat.player.Property;
@Data
@AllArgsConstructor
public final class PlayerObject implements ChatObject
{
/**
* The profile of the player.
*/
@NonNull
private Profile profile;
/**
* If true, a hat layer will be rendered on the head. (default: true)
*/
private Boolean hat;
public PlayerObject(@NonNull String name)
{
this.profile = new Profile( name );
}
public PlayerObject(@NonNull UUID uuid)
{
this.profile = new Profile( uuid );
}
public PlayerObject(@NonNull Property[] properties)
{
this.profile = new Profile( properties );
}
}

View File

@@ -1,21 +0,0 @@
package net.md_5.bungee.api.chat.objects;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NonNull;
@Data
@AllArgsConstructor
public final class SpriteObject implements ChatObject
{
/**
* The namespaced ID of a sprite atlas, default value: minecraft:blocks.
*/
private String atlas;
/**
* The namespaced ID of a sprite in atlas, for example item/porkchop.
*/
@NonNull
private String sprite;
}

View File

@@ -1,40 +0,0 @@
package net.md_5.bungee.api.chat.player;
import java.util.UUID;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NonNull;
@Data
@AllArgsConstructor
public class Profile
{
/**
* The name of the profile. Can be null.
*/
private String name;
/**
* The UUID of the profile. Can be null.
*/
private UUID uuid;
/**
* The properties of the profile. Can be null.
*/
private Property[] properties;
public Profile(@NonNull String name)
{
this( name, null, null );
}
public Profile(@NonNull UUID uuid)
{
this( null, uuid, null );
}
public Profile(@NonNull Property[] properties)
{
this( null, null, properties );
}
}

View File

@@ -1,22 +0,0 @@
package net.md_5.bungee.api.chat.player;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NonNull;
@Data
@AllArgsConstructor
public class Property
{
@NonNull
private String name;
@NonNull
private String value;
private String signature;
public Property(@NonNull String name, @NonNull String value)
{
this( name, value, null );
}
}

View File

@@ -6,12 +6,12 @@
<parent> <parent>
<groupId>fr.pandacube.bungeecord</groupId> <groupId>fr.pandacube.bungeecord</groupId>
<artifactId>bungeecord-parent</artifactId> <artifactId>bungeecord-parent</artifactId>
<version>1.21-R0.5-SNAPSHOT</version> <version>1.21-R0.4-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<artifactId>bungeecord-config</artifactId> <artifactId>bungeecord-config</artifactId>
<version>1.21-R0.5-SNAPSHOT</version> <version>1.21-R0.4-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>BungeeCord-Config</name> <name>BungeeCord-Config</name>

View File

@@ -6,12 +6,12 @@
<parent> <parent>
<groupId>fr.pandacube.bungeecord</groupId> <groupId>fr.pandacube.bungeecord</groupId>
<artifactId>bungeecord-parent</artifactId> <artifactId>bungeecord-parent</artifactId>
<version>1.21-R0.5-SNAPSHOT</version> <version>1.21-R0.4-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<artifactId>bungeecord-dialog</artifactId> <artifactId>bungeecord-dialog</artifactId>
<version>1.21-R0.5-SNAPSHOT</version> <version>1.21-R0.4-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>BungeeCord-Dialog</name> <name>BungeeCord-Dialog</name>

View File

@@ -38,8 +38,7 @@ public final class DialogListDialog implements Dialog
*/ */
private Integer columns; private Integer columns;
/** /**
* The width of the dialog buttons (default: 150, minimum: 1, maximum: * The width of the dialog buttons (default: 150, minimum: 1, maximum: 1024).
* 1024).
*/ */
@SerializedName("button_width") @SerializedName("button_width")
private Integer buttonWidth; private Integer buttonWidth;

View File

@@ -37,8 +37,7 @@ public final class ServerLinksDialog implements Dialog
*/ */
private Integer columns; private Integer columns;
/** /**
* The width of the dialog buttons (default: 150, minimum: 1, maximum: * The width of the dialog buttons (default: 150, minimum: 1, maximum: 1024).
* 1024).
*/ */
@SerializedName("button_width") @SerializedName("button_width")
private Integer buttonWidth; private Integer buttonWidth;

View File

@@ -6,8 +6,8 @@ import lombok.ToString;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
/** /**
* Executes a command. If the command requires a permission higher than 0, a * Executes a command. If the command requires a permission
* confirmation dialog will be shown by the client. * higher than 0, a confirmation dialog will be shown by the client.
*/ */
@Data @Data
@Accessors(fluent = true) @Accessors(fluent = true)

View File

@@ -6,12 +6,12 @@
<parent> <parent>
<groupId>fr.pandacube.bungeecord</groupId> <groupId>fr.pandacube.bungeecord</groupId>
<artifactId>bungeecord-parent</artifactId> <artifactId>bungeecord-parent</artifactId>
<version>1.21-R0.5-SNAPSHOT</version> <version>1.21-R0.4-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<artifactId>bungeecord-event</artifactId> <artifactId>bungeecord-event</artifactId>
<version>1.21-R0.5-SNAPSHOT</version> <version>1.21-R0.4-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>BungeeCord-Event</name> <name>BungeeCord-Event</name>

View File

@@ -6,12 +6,12 @@
<parent> <parent>
<groupId>fr.pandacube.bungeecord</groupId> <groupId>fr.pandacube.bungeecord</groupId>
<artifactId>bungeecord-parent</artifactId> <artifactId>bungeecord-parent</artifactId>
<version>1.21-R0.5-SNAPSHOT</version> <version>1.21-R0.4-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<artifactId>bungeecord-log</artifactId> <artifactId>bungeecord-log</artifactId>
<version>1.21-R0.5-SNAPSHOT</version> <version>1.21-R0.4-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>BungeeCord-Log</name> <name>BungeeCord-Log</name>

View File

@@ -6,12 +6,12 @@
<parent> <parent>
<groupId>fr.pandacube.bungeecord</groupId> <groupId>fr.pandacube.bungeecord</groupId>
<artifactId>bungeecord-parent</artifactId> <artifactId>bungeecord-parent</artifactId>
<version>1.21-R0.5-SNAPSHOT</version> <version>1.21-R0.4-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<artifactId>bungeecord-native</artifactId> <artifactId>bungeecord-native</artifactId>
<version>1.21-R0.5-SNAPSHOT</version> <version>1.21-R0.4-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>BungeeCord-Native</name> <name>BungeeCord-Native</name>

View File

@@ -6,12 +6,12 @@
<parent> <parent>
<groupId>fr.pandacube.bungeecord</groupId> <groupId>fr.pandacube.bungeecord</groupId>
<artifactId>bungeecord-parent</artifactId> <artifactId>bungeecord-parent</artifactId>
<version>1.21-R0.5-SNAPSHOT</version> <version>1.21-R0.4-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<artifactId>bungeecord-nbt</artifactId> <artifactId>bungeecord-nbt</artifactId>
<version>1.21-R0.5-SNAPSHOT</version> <version>1.21-R0.4-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>BungeeCord-NBT</name> <name>BungeeCord-NBT</name>

View File

@@ -81,8 +81,9 @@ public interface Tag
void write(DataOutput output) throws IOException; void write(DataOutput output) throws IOException;
/** /**
* Reads a {@link Tag} from the given {@link DataInput}, based on the * Reads a {@link Tag} from the given {@link DataInput},
* specified tag type, with limitations of the {@link NBTLimiter}. * based on the specified tag type, with limitations of the
* {@link NBTLimiter}.
* *
* @param id the nbt type * @param id the nbt type
* @param input the input to read from * @param input the input to read from
@@ -103,8 +104,8 @@ public interface Tag
} }
/** /**
* Reads a {@link NamedTag} from the given {@link DataInput}, with * Reads a {@link NamedTag} from the given {@link DataInput},
* limitations of the {@link NBTLimiter}. * with limitations of the {@link NBTLimiter}.
* *
* @param input the data input to read from * @param input the data input to read from
* @param limiter the limiter for this read operation * @param limiter the limiter for this read operation
@@ -119,8 +120,8 @@ public interface Tag
} }
/** /**
* Serializes the given {@link TypedTag} into a byte array. This is the * Serializes the given {@link TypedTag} into a byte array.
* inverse operation of {@link #fromByteArray(byte[])}. * This is the inverse operation of {@link #fromByteArray(byte[])}.
* *
* @param tag the tag to convert * @param tag the tag to convert
* @return the serialized byte array * @return the serialized byte array
@@ -136,8 +137,8 @@ public interface Tag
} }
/** /**
* Deserializes the given byte array into a {@link TypedTag}. This is the * Deserializes the given byte array into a {@link TypedTag}.
* inverse operation of {@link #toByteArray(TypedTag)}. * This is the inverse operation of {@link #toByteArray(TypedTag)}.
* *
* @param data the byte array to read from * @param data the byte array to read from
* @return the deserialized {@link TypedTag} * @return the deserialized {@link TypedTag}
@@ -149,8 +150,8 @@ public interface Tag
} }
/** /**
* Deserializes the given byte array into a {@link TypedTag}, with * Deserializes the given byte array into a {@link TypedTag},
* limitations of the {@link NBTLimiter}. * with limitations of the {@link NBTLimiter}.
* *
* @param data the byte array to read from * @param data the byte array to read from
* @param limiter the limiter for this read operation * @param limiter the limiter for this read operation

18
pom.xml
View File

@@ -5,7 +5,7 @@
<groupId>fr.pandacube.bungeecord</groupId> <groupId>fr.pandacube.bungeecord</groupId>
<artifactId>bungeecord-parent</artifactId> <artifactId>bungeecord-parent</artifactId>
<version>1.21-R0.5-SNAPSHOT</version> <version>1.21-R0.4-SNAPSHOT</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>BungeeCord-Parent</name> <name>BungeeCord-Parent</name>
@@ -63,12 +63,12 @@
<distributionManagement> <distributionManagement>
<snapshotRepository> <snapshotRepository>
<id>central-portal-snapshots</id> <id>sonatype-nexus-snapshots</id>
<url>https://central.sonatype.com/repository/maven-snapshots/</url> <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</snapshotRepository> </snapshotRepository>
<repository> <repository>
<id>ossrh-staging-api</id> <id>sonatype-nexus-staging</id>
<url>https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/</url> <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository> </repository>
</distributionManagement> </distributionManagement>
@@ -85,7 +85,7 @@
<dependency> <dependency>
<groupId>io.netty</groupId> <groupId>io.netty</groupId>
<artifactId>netty-bom</artifactId> <artifactId>netty-bom</artifactId>
<version>4.2.3.Final</version> <version>4.2.1.Final</version>
<type>pom</type> <type>pom</type>
<scope>import</scope> <scope>import</scope>
</dependency> </dependency>
@@ -372,12 +372,6 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.9.0</version>
<extensions>true</extensions>
</plugin>
</plugins> </plugins>
</build> </build>
</profile> </profile>

View File

@@ -6,12 +6,12 @@
<parent> <parent>
<groupId>fr.pandacube.bungeecord</groupId> <groupId>fr.pandacube.bungeecord</groupId>
<artifactId>bungeecord-parent</artifactId> <artifactId>bungeecord-parent</artifactId>
<version>1.21-R0.5-SNAPSHOT</version> <version>1.21-R0.4-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<artifactId>bungeecord-protocol</artifactId> <artifactId>bungeecord-protocol</artifactId>
<version>1.21-R0.5-SNAPSHOT</version> <version>1.21-R0.4-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>BungeeCord-Protocol</name> <name>BungeeCord-Protocol</name>

View File

@@ -1,4 +1,4 @@
package net.md_5.bungee.protocol.data; package net.md_5.bungee.protocol;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
@@ -9,9 +9,6 @@ import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import net.md_5.bungee.protocol.AbstractPacketHandler;
import net.md_5.bungee.protocol.DefinedPacket;
import net.md_5.bungee.protocol.ProtocolConstants;
@Data @Data
@NoArgsConstructor @NoArgsConstructor

View File

@@ -26,22 +26,17 @@ import net.md_5.bungee.nbt.Tag;
import net.md_5.bungee.nbt.TypedTag; import net.md_5.bungee.nbt.TypedTag;
import net.md_5.bungee.nbt.limit.NBTLimiter; import net.md_5.bungee.nbt.limit.NBTLimiter;
import net.md_5.bungee.nbt.type.EndTag; import net.md_5.bungee.nbt.type.EndTag;
import net.md_5.bungee.protocol.data.NumberFormat;
import net.md_5.bungee.protocol.data.PlayerPublicKey;
import net.md_5.bungee.protocol.data.Property;
import net.md_5.bungee.protocol.util.Either;
import net.md_5.bungee.protocol.util.TagUtil;
@RequiredArgsConstructor @RequiredArgsConstructor
public abstract class DefinedPacket public abstract class DefinedPacket
{ {
public static <T> T readNullable(Function<ByteBuf, T> reader, ByteBuf buf) public <T> T readNullable(Function<ByteBuf, T> reader, ByteBuf buf)
{ {
return buf.readBoolean() ? reader.apply( buf ) : null; return buf.readBoolean() ? reader.apply( buf ) : null;
} }
public static <T> void writeNullable(T t0, BiConsumer<T, ByteBuf> writer, ByteBuf buf) public <T> void writeNullable(T t0, BiConsumer<T, ByteBuf> writer, ByteBuf buf)
{ {
if ( t0 != null ) if ( t0 != null )
{ {
@@ -53,7 +48,7 @@ public abstract class DefinedPacket
} }
} }
public static <T> T readLengthPrefixed(Function<ByteBuf, T> reader, ByteBuf buf, int maxSize) public <T> T readLengthPrefixed(Function<ByteBuf, T> reader, ByteBuf buf, int maxSize)
{ {
int size = readVarInt( buf ); int size = readVarInt( buf );
@@ -65,7 +60,7 @@ public abstract class DefinedPacket
return reader.apply( buf.readSlice( size ) ); return reader.apply( buf.readSlice( size ) );
} }
public static <T> void writeLengthPrefixed(T value, BiConsumer<T, ByteBuf> writer, ByteBuf buf, int maxSize) public <T> void writeLengthPrefixed(T value, BiConsumer<T, ByteBuf> writer, ByteBuf buf, int maxSize)
{ {
ByteBuf tempBuffer = buf.alloc().buffer(); ByteBuf tempBuffer = buf.alloc().buffer();
try try
@@ -129,7 +124,8 @@ public abstract class DefinedPacket
throw new OverflowPacketException( "Cannot receive string longer than " + maxLen * 3 + " (got " + len + " bytes)" ); throw new OverflowPacketException( "Cannot receive string longer than " + maxLen * 3 + " (got " + len + " bytes)" );
} }
String s = buf.readString( len, StandardCharsets.UTF_8 ); String s = buf.toString( buf.readerIndex(), len, StandardCharsets.UTF_8 );
buf.readerIndex( buf.readerIndex() + len );
if ( s.length() > maxLen ) if ( s.length() > maxLen )
{ {

View File

@@ -1,4 +1,4 @@
package net.md_5.bungee.protocol.util; package net.md_5.bungee.protocol;
import java.util.function.Function; import java.util.function.Function;
import lombok.AccessLevel; import lombok.AccessLevel;

View File

@@ -1,4 +1,4 @@
package net.md_5.bungee.protocol.data; package net.md_5.bungee.protocol;
import lombok.Data; import lombok.Data;

View File

@@ -1,4 +1,4 @@
package net.md_5.bungee.protocol.data; package net.md_5.bungee.protocol;
import lombok.Data; import lombok.Data;

View File

@@ -1,4 +1,4 @@
package net.md_5.bungee.protocol.data; package net.md_5.bungee.protocol;
import lombok.Data; import lombok.Data;

View File

@@ -1,4 +1,4 @@
package net.md_5.bungee.protocol.data; package net.md_5.bungee.protocol;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;

View File

@@ -110,8 +110,7 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_20_2, 0x24 ), map( ProtocolConstants.MINECRAFT_1_20_2, 0x24 ),
map( ProtocolConstants.MINECRAFT_1_20_5, 0x26 ), map( ProtocolConstants.MINECRAFT_1_20_5, 0x26 ),
map( ProtocolConstants.MINECRAFT_1_21_2, 0x27 ), map( ProtocolConstants.MINECRAFT_1_21_2, 0x27 ),
map( ProtocolConstants.MINECRAFT_1_21_5, 0x26 ), map( ProtocolConstants.MINECRAFT_1_21_5, 0x26 )
map( ProtocolConstants.MINECRAFT_1_21_9, 0x2B )
); );
TO_CLIENT.registerPacket( TO_CLIENT.registerPacket(
Login.class, Login.class,
@@ -130,13 +129,11 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_20_2, 0x29 ), map( ProtocolConstants.MINECRAFT_1_20_2, 0x29 ),
map( ProtocolConstants.MINECRAFT_1_20_5, 0x2B ), map( ProtocolConstants.MINECRAFT_1_20_5, 0x2B ),
map( ProtocolConstants.MINECRAFT_1_21_2, 0x2C ), map( ProtocolConstants.MINECRAFT_1_21_2, 0x2C ),
map( ProtocolConstants.MINECRAFT_1_21_5, 0x2B ), map( ProtocolConstants.MINECRAFT_1_21_5, 0x2B )
map( ProtocolConstants.MINECRAFT_1_21_9, 0x30 )
); );
TO_CLIENT.registerPacket( TO_CLIENT.registerPacket(
Chat.class, Chat.class,
Chat::new, Chat::new,
RegisterType.ENCODE,
map( ProtocolConstants.MINECRAFT_1_8, 0x02 ), map( ProtocolConstants.MINECRAFT_1_8, 0x02 ),
map( ProtocolConstants.MINECRAFT_1_9, 0x0F ), map( ProtocolConstants.MINECRAFT_1_9, 0x0F ),
map( ProtocolConstants.MINECRAFT_1_13, 0x0E ), map( ProtocolConstants.MINECRAFT_1_13, 0x0E ),
@@ -166,8 +163,7 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_20_3, 0x45 ), map( ProtocolConstants.MINECRAFT_1_20_3, 0x45 ),
map( ProtocolConstants.MINECRAFT_1_20_5, 0x47 ), map( ProtocolConstants.MINECRAFT_1_20_5, 0x47 ),
map( ProtocolConstants.MINECRAFT_1_21_2, 0x4C ), map( ProtocolConstants.MINECRAFT_1_21_2, 0x4C ),
map( ProtocolConstants.MINECRAFT_1_21_5, 0x4B ), map( ProtocolConstants.MINECRAFT_1_21_5, 0x4B )
map( ProtocolConstants.MINECRAFT_1_21_9, 0x50 )
); );
TO_CLIENT.registerPacket( TO_CLIENT.registerPacket(
BossBar.class, BossBar.class,
@@ -231,8 +227,7 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_20_3, 0x5C ), map( ProtocolConstants.MINECRAFT_1_20_3, 0x5C ),
map( ProtocolConstants.MINECRAFT_1_20_5, 0x5E ), map( ProtocolConstants.MINECRAFT_1_20_5, 0x5E ),
map( ProtocolConstants.MINECRAFT_1_21_2, 0x64 ), map( ProtocolConstants.MINECRAFT_1_21_2, 0x64 ),
map( ProtocolConstants.MINECRAFT_1_21_5, 0x63 ), map( ProtocolConstants.MINECRAFT_1_21_5, 0x63 )
map( ProtocolConstants.MINECRAFT_1_21_9, 0x68 )
); );
TO_CLIENT.registerPacket( TO_CLIENT.registerPacket(
ScoreboardScore.class, ScoreboardScore.class,
@@ -252,8 +247,7 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_20_3, 0x5F ), map( ProtocolConstants.MINECRAFT_1_20_3, 0x5F ),
map( ProtocolConstants.MINECRAFT_1_20_5, 0x61 ), map( ProtocolConstants.MINECRAFT_1_20_5, 0x61 ),
map( ProtocolConstants.MINECRAFT_1_21_2, 0x68 ), map( ProtocolConstants.MINECRAFT_1_21_2, 0x68 ),
map( ProtocolConstants.MINECRAFT_1_21_5, 0x67 ), map( ProtocolConstants.MINECRAFT_1_21_5, 0x67 )
map( ProtocolConstants.MINECRAFT_1_21_9, 0x6C )
); );
TO_CLIENT.registerPacket( TO_CLIENT.registerPacket(
ScoreboardScoreReset.class, ScoreboardScoreReset.class,
@@ -261,8 +255,7 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_20_3, 0x42 ), map( ProtocolConstants.MINECRAFT_1_20_3, 0x42 ),
map( ProtocolConstants.MINECRAFT_1_20_5, 0x44 ), map( ProtocolConstants.MINECRAFT_1_20_5, 0x44 ),
map( ProtocolConstants.MINECRAFT_1_21_2, 0x49 ), map( ProtocolConstants.MINECRAFT_1_21_2, 0x49 ),
map( ProtocolConstants.MINECRAFT_1_21_5, 0x48 ), map( ProtocolConstants.MINECRAFT_1_21_5, 0x48 )
map( ProtocolConstants.MINECRAFT_1_21_9, 0x4D )
); );
TO_CLIENT.registerPacket( TO_CLIENT.registerPacket(
ScoreboardDisplay.class, ScoreboardDisplay.class,
@@ -282,8 +275,7 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_20_3, 0x55 ), map( ProtocolConstants.MINECRAFT_1_20_3, 0x55 ),
map( ProtocolConstants.MINECRAFT_1_20_5, 0x57 ), map( ProtocolConstants.MINECRAFT_1_20_5, 0x57 ),
map( ProtocolConstants.MINECRAFT_1_21_2, 0x5C ), map( ProtocolConstants.MINECRAFT_1_21_2, 0x5C ),
map( ProtocolConstants.MINECRAFT_1_21_5, 0x5B ), map( ProtocolConstants.MINECRAFT_1_21_5, 0x5B )
map( ProtocolConstants.MINECRAFT_1_21_9, 0x60 )
); );
TO_CLIENT.registerPacket( TO_CLIENT.registerPacket(
Team.class, Team.class,
@@ -303,8 +295,7 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_20_3, 0x5E ), map( ProtocolConstants.MINECRAFT_1_20_3, 0x5E ),
map( ProtocolConstants.MINECRAFT_1_20_5, 0x60 ), map( ProtocolConstants.MINECRAFT_1_20_5, 0x60 ),
map( ProtocolConstants.MINECRAFT_1_21_2, 0x67 ), map( ProtocolConstants.MINECRAFT_1_21_2, 0x67 ),
map( ProtocolConstants.MINECRAFT_1_21_5, 0x66 ), map( ProtocolConstants.MINECRAFT_1_21_5, 0x66 )
map( ProtocolConstants.MINECRAFT_1_21_9, 0x6B )
); );
TO_CLIENT.registerPacket( TO_CLIENT.registerPacket(
PluginMessage.class, PluginMessage.class,
@@ -342,8 +333,7 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_19_4, 0x1A ), map( ProtocolConstants.MINECRAFT_1_19_4, 0x1A ),
map( ProtocolConstants.MINECRAFT_1_20_2, 0x1B ), map( ProtocolConstants.MINECRAFT_1_20_2, 0x1B ),
map( ProtocolConstants.MINECRAFT_1_20_5, 0x1D ), map( ProtocolConstants.MINECRAFT_1_20_5, 0x1D ),
map( ProtocolConstants.MINECRAFT_1_21_5, 0x1C ), map( ProtocolConstants.MINECRAFT_1_21_5, 0x1C )
map( ProtocolConstants.MINECRAFT_1_21_9, 0x20 )
); );
TO_CLIENT.registerPacket( TO_CLIENT.registerPacket(
Title.class, Title.class,
@@ -365,8 +355,7 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_20_3, 0x63 ), map( ProtocolConstants.MINECRAFT_1_20_3, 0x63 ),
map( ProtocolConstants.MINECRAFT_1_20_5, 0x65 ), map( ProtocolConstants.MINECRAFT_1_20_5, 0x65 ),
map( ProtocolConstants.MINECRAFT_1_21_2, 0x6C ), map( ProtocolConstants.MINECRAFT_1_21_2, 0x6C ),
map( ProtocolConstants.MINECRAFT_1_21_5, 0x6B ), map( ProtocolConstants.MINECRAFT_1_21_5, 0x6B )
map( ProtocolConstants.MINECRAFT_1_21_9, 0x70 )
); );
TO_CLIENT.registerPacket( TO_CLIENT.registerPacket(
ClearTitles.class, ClearTitles.class,
@@ -392,8 +381,7 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_20_3, 0x61 ), map( ProtocolConstants.MINECRAFT_1_20_3, 0x61 ),
map( ProtocolConstants.MINECRAFT_1_20_5, 0x63 ), map( ProtocolConstants.MINECRAFT_1_20_5, 0x63 ),
map( ProtocolConstants.MINECRAFT_1_21_2, 0x6A ), map( ProtocolConstants.MINECRAFT_1_21_2, 0x6A ),
map( ProtocolConstants.MINECRAFT_1_21_5, 0x69 ), map( ProtocolConstants.MINECRAFT_1_21_5, 0x69 )
map( ProtocolConstants.MINECRAFT_1_21_9, 0x6E )
); );
TO_CLIENT.registerPacket( TO_CLIENT.registerPacket(
TitleTimes.class, TitleTimes.class,
@@ -408,8 +396,7 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_20_3, 0x64 ), map( ProtocolConstants.MINECRAFT_1_20_3, 0x64 ),
map( ProtocolConstants.MINECRAFT_1_20_5, 0x66 ), map( ProtocolConstants.MINECRAFT_1_20_5, 0x66 ),
map( ProtocolConstants.MINECRAFT_1_21_2, 0x6D ), map( ProtocolConstants.MINECRAFT_1_21_2, 0x6D ),
map( ProtocolConstants.MINECRAFT_1_21_5, 0x6C ), map( ProtocolConstants.MINECRAFT_1_21_5, 0x6C )
map( ProtocolConstants.MINECRAFT_1_21_9, 0x71 )
); );
TO_CLIENT.registerPacket( TO_CLIENT.registerPacket(
SystemChat.class, SystemChat.class,
@@ -423,8 +410,7 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_20_3, 0x69 ), map( ProtocolConstants.MINECRAFT_1_20_3, 0x69 ),
map( ProtocolConstants.MINECRAFT_1_20_5, 0x6C ), map( ProtocolConstants.MINECRAFT_1_20_5, 0x6C ),
map( ProtocolConstants.MINECRAFT_1_21_2, 0x73 ), map( ProtocolConstants.MINECRAFT_1_21_2, 0x73 ),
map( ProtocolConstants.MINECRAFT_1_21_5, 0x72 ), map( ProtocolConstants.MINECRAFT_1_21_5, 0x72 )
map( ProtocolConstants.MINECRAFT_1_21_9, 0x77 )
); );
TO_CLIENT.registerPacket( TO_CLIENT.registerPacket(
PlayerListHeaderFooter.class, PlayerListHeaderFooter.class,
@@ -449,8 +435,7 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_20_3, 0x6A ), map( ProtocolConstants.MINECRAFT_1_20_3, 0x6A ),
map( ProtocolConstants.MINECRAFT_1_20_5, 0x6D ), map( ProtocolConstants.MINECRAFT_1_20_5, 0x6D ),
map( ProtocolConstants.MINECRAFT_1_21_2, 0x74 ), map( ProtocolConstants.MINECRAFT_1_21_2, 0x74 ),
map( ProtocolConstants.MINECRAFT_1_21_5, 0x73 ), map( ProtocolConstants.MINECRAFT_1_21_5, 0x73 )
map( ProtocolConstants.MINECRAFT_1_21_9, 0x78 )
); );
TO_CLIENT.registerPacket( TO_CLIENT.registerPacket(
EntityStatus.class, EntityStatus.class,
@@ -470,8 +455,7 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_19_4, 0x1C ), map( ProtocolConstants.MINECRAFT_1_19_4, 0x1C ),
map( ProtocolConstants.MINECRAFT_1_20_2, 0x1D ), map( ProtocolConstants.MINECRAFT_1_20_2, 0x1D ),
map( ProtocolConstants.MINECRAFT_1_20_5, 0x1F ), map( ProtocolConstants.MINECRAFT_1_20_5, 0x1F ),
map( ProtocolConstants.MINECRAFT_1_21_5, 0x1E ), map( ProtocolConstants.MINECRAFT_1_21_5, 0x1E )
map( ProtocolConstants.MINECRAFT_1_21_9, 0x22 )
); );
TO_CLIENT.registerPacket( TO_CLIENT.registerPacket(
Commands.class, Commands.class,
@@ -502,8 +486,7 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_20_2, 0x20 ), map( ProtocolConstants.MINECRAFT_1_20_2, 0x20 ),
map( ProtocolConstants.MINECRAFT_1_20_5, 0x22 ), map( ProtocolConstants.MINECRAFT_1_20_5, 0x22 ),
map( ProtocolConstants.MINECRAFT_1_21_2, 0x23 ), map( ProtocolConstants.MINECRAFT_1_21_2, 0x23 ),
map( ProtocolConstants.MINECRAFT_1_21_5, 0x22 ), map( ProtocolConstants.MINECRAFT_1_21_5, 0x22 )
map( ProtocolConstants.MINECRAFT_1_21_9, 0x26 )
); );
TO_CLIENT.registerPacket( TO_CLIENT.registerPacket(
ViewDistance.class, ViewDistance.class,
@@ -521,8 +504,7 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_20_3, 0x53 ), map( ProtocolConstants.MINECRAFT_1_20_3, 0x53 ),
map( ProtocolConstants.MINECRAFT_1_20_5, 0x55 ), map( ProtocolConstants.MINECRAFT_1_20_5, 0x55 ),
map( ProtocolConstants.MINECRAFT_1_21_2, 0x59 ), map( ProtocolConstants.MINECRAFT_1_21_2, 0x59 ),
map( ProtocolConstants.MINECRAFT_1_21_5, 0x58 ), map( ProtocolConstants.MINECRAFT_1_21_5, 0x58 )
map( ProtocolConstants.MINECRAFT_1_21_9, 0x5D )
); );
TO_CLIENT.registerPacket( TO_CLIENT.registerPacket(
ServerData.class, ServerData.class,
@@ -535,8 +517,7 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_20_3, 0x49 ), map( ProtocolConstants.MINECRAFT_1_20_3, 0x49 ),
map( ProtocolConstants.MINECRAFT_1_20_5, 0x4B ), map( ProtocolConstants.MINECRAFT_1_20_5, 0x4B ),
map( ProtocolConstants.MINECRAFT_1_21_2, 0x50 ), map( ProtocolConstants.MINECRAFT_1_21_2, 0x50 ),
map( ProtocolConstants.MINECRAFT_1_21_5, 0x4F ), map( ProtocolConstants.MINECRAFT_1_21_5, 0x4F )
map( ProtocolConstants.MINECRAFT_1_21_9, 0x54 )
); );
TO_CLIENT.registerPacket( TO_CLIENT.registerPacket(
PlayerListItemRemove.class, PlayerListItemRemove.class,
@@ -546,8 +527,7 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_20_2, 0x3B ), map( ProtocolConstants.MINECRAFT_1_20_2, 0x3B ),
map( ProtocolConstants.MINECRAFT_1_20_5, 0x3D ), map( ProtocolConstants.MINECRAFT_1_20_5, 0x3D ),
map( ProtocolConstants.MINECRAFT_1_21_2, 0x3F ), map( ProtocolConstants.MINECRAFT_1_21_2, 0x3F ),
map( ProtocolConstants.MINECRAFT_1_21_5, 0x3E ), map( ProtocolConstants.MINECRAFT_1_21_5, 0x3E )
map( ProtocolConstants.MINECRAFT_1_21_9, 0x43 )
); );
TO_CLIENT.registerPacket( TO_CLIENT.registerPacket(
PlayerListItemUpdate.class, PlayerListItemUpdate.class,
@@ -557,8 +537,7 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_20_2, 0x3C ), map( ProtocolConstants.MINECRAFT_1_20_2, 0x3C ),
map( ProtocolConstants.MINECRAFT_1_20_5, 0x3E ), map( ProtocolConstants.MINECRAFT_1_20_5, 0x3E ),
map( ProtocolConstants.MINECRAFT_1_21_2, 0x40 ), map( ProtocolConstants.MINECRAFT_1_21_2, 0x40 ),
map( ProtocolConstants.MINECRAFT_1_21_5, 0x3F ), map( ProtocolConstants.MINECRAFT_1_21_5, 0x3F )
map( ProtocolConstants.MINECRAFT_1_21_9, 0x44 )
); );
TO_CLIENT.registerPacket( TO_CLIENT.registerPacket(
StartConfiguration.class, StartConfiguration.class,
@@ -567,8 +546,7 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_20_3, 0x67 ), map( ProtocolConstants.MINECRAFT_1_20_3, 0x67 ),
map( ProtocolConstants.MINECRAFT_1_20_5, 0x69 ), map( ProtocolConstants.MINECRAFT_1_20_5, 0x69 ),
map( ProtocolConstants.MINECRAFT_1_21_2, 0x70 ), map( ProtocolConstants.MINECRAFT_1_21_2, 0x70 ),
map( ProtocolConstants.MINECRAFT_1_21_5, 0x6F ), map( ProtocolConstants.MINECRAFT_1_21_5, 0x6F )
map( ProtocolConstants.MINECRAFT_1_21_9, 0x74 )
); );
TO_CLIENT.registerPacket( TO_CLIENT.registerPacket(
CookieRequest.class, CookieRequest.class,
@@ -582,46 +560,40 @@ public enum Protocol
RegisterType.ENCODE, RegisterType.ENCODE,
map( ProtocolConstants.MINECRAFT_1_20_5, 0x6B ), map( ProtocolConstants.MINECRAFT_1_20_5, 0x6B ),
map( ProtocolConstants.MINECRAFT_1_21_2, 0x72 ), map( ProtocolConstants.MINECRAFT_1_21_2, 0x72 ),
map( ProtocolConstants.MINECRAFT_1_21_5, 0x71 ), map( ProtocolConstants.MINECRAFT_1_21_5, 0x71 )
map( ProtocolConstants.MINECRAFT_1_21_9, 0x76 )
); );
TO_CLIENT.registerPacket( TO_CLIENT.registerPacket(
Transfer.class, Transfer.class,
Transfer::new, Transfer::new,
RegisterType.ENCODE, RegisterType.ENCODE,
map( ProtocolConstants.MINECRAFT_1_20_5, 0x73 ), map( ProtocolConstants.MINECRAFT_1_20_5, 0x73 ),
map( ProtocolConstants.MINECRAFT_1_21_2, 0x7A ), map( ProtocolConstants.MINECRAFT_1_21_2, 0x7A )
map( ProtocolConstants.MINECRAFT_1_21_9, 0x7F )
); );
TO_CLIENT.registerPacket( TO_CLIENT.registerPacket(
DisconnectReportDetails.class, DisconnectReportDetails.class,
DisconnectReportDetails::new, DisconnectReportDetails::new,
RegisterType.ENCODE, RegisterType.ENCODE,
map( ProtocolConstants.MINECRAFT_1_21, 0x7A ), map( ProtocolConstants.MINECRAFT_1_21, 0x7A ),
map( ProtocolConstants.MINECRAFT_1_21_2, 0x81 ), map( ProtocolConstants.MINECRAFT_1_21_2, 0x81 )
map( ProtocolConstants.MINECRAFT_1_21_9, 0x86 )
); );
TO_CLIENT.registerPacket( TO_CLIENT.registerPacket(
ServerLinks.class, ServerLinks.class,
ServerLinks::new, ServerLinks::new,
RegisterType.ENCODE, RegisterType.ENCODE,
map( ProtocolConstants.MINECRAFT_1_21, 0x7B ), map( ProtocolConstants.MINECRAFT_1_21, 0x7B ),
map( ProtocolConstants.MINECRAFT_1_21_2, 0x82 ), map( ProtocolConstants.MINECRAFT_1_21_2, 0x82 )
map( ProtocolConstants.MINECRAFT_1_21_9, 0x87 )
); );
TO_CLIENT.registerPacket( TO_CLIENT.registerPacket(
ClearDialog.class, ClearDialog.class,
ClearDialog::new, ClearDialog::new,
RegisterType.ENCODE, RegisterType.ENCODE,
map( ProtocolConstants.MINECRAFT_1_21_6, 0x84 ), map( ProtocolConstants.MINECRAFT_1_21_6, 0x84 )
map( ProtocolConstants.MINECRAFT_1_21_9, 0x89 )
); );
TO_CLIENT.registerPacket( TO_CLIENT.registerPacket(
ShowDialog.class, ShowDialog.class,
ShowDialog::new, ShowDialog::new,
RegisterType.ENCODE, RegisterType.ENCODE,
map( ProtocolConstants.MINECRAFT_1_21_6, 0x85 ), map( ProtocolConstants.MINECRAFT_1_21_6, 0x85 )
map( ProtocolConstants.MINECRAFT_1_21_9, 0x8A )
); );
TO_SERVER.registerPacket( TO_SERVER.registerPacket(

View File

@@ -52,7 +52,6 @@ public class ProtocolConstants
public static final int MINECRAFT_1_21_5 = 770; public static final int MINECRAFT_1_21_5 = 770;
public static final int MINECRAFT_1_21_6 = 771; public static final int MINECRAFT_1_21_6 = 771;
public static final int MINECRAFT_1_21_7 = 772; public static final int MINECRAFT_1_21_7 = 772;
public static final int MINECRAFT_1_21_9 = 773;
public static final List<String> SUPPORTED_VERSIONS; public static final List<String> SUPPORTED_VERSIONS;
public static final List<Integer> SUPPORTED_VERSION_IDS; public static final List<Integer> SUPPORTED_VERSION_IDS;
@@ -119,14 +118,13 @@ public class ProtocolConstants
ProtocolConstants.MINECRAFT_1_21_4, ProtocolConstants.MINECRAFT_1_21_4,
ProtocolConstants.MINECRAFT_1_21_5, ProtocolConstants.MINECRAFT_1_21_5,
ProtocolConstants.MINECRAFT_1_21_6, ProtocolConstants.MINECRAFT_1_21_6,
ProtocolConstants.MINECRAFT_1_21_7, ProtocolConstants.MINECRAFT_1_21_7
ProtocolConstants.MINECRAFT_1_21_9
); );
if ( SNAPSHOT_SUPPORT ) if ( SNAPSHOT_SUPPORT )
{ {
// supportedVersions.add( "1.21.x" ); // supportedVersions.add( "1.21.x" );
// supportedVersionIds.add( ProtocolConstants.MINECRAFT_1_21_9 ); // supportedVersionIds.add( ProtocolConstants.MINECRAFT_1_21_6 );
} }
SUPPORTED_VERSIONS = supportedVersions.build(); SUPPORTED_VERSIONS = supportedVersions.build();

View File

@@ -1,4 +1,4 @@
package net.md_5.bungee.protocol.data; package net.md_5.bungee.protocol;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import java.util.BitSet; import java.util.BitSet;
@@ -6,9 +6,6 @@ import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import net.md_5.bungee.protocol.AbstractPacketHandler;
import net.md_5.bungee.protocol.DefinedPacket;
import net.md_5.bungee.protocol.ProtocolConstants;
@Data @Data
@NoArgsConstructor @NoArgsConstructor

View File

@@ -1,4 +1,4 @@
package net.md_5.bungee.protocol.util; package net.md_5.bungee.protocol;
import com.google.gson.JsonArray; import com.google.gson.JsonArray;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;

View File

@@ -7,11 +7,8 @@ import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
/** /**
* This class hold a netty channel initializer that calls the given * This class hold a netty channel initializer that calls the given {@link ChannelAcceptor}.
* {@link ChannelAcceptor}. * Use {@link BungeeChannelInitializer#create(ChannelAcceptor)} to create a new instance.
*
* Use {@link BungeeChannelInitializer#create(ChannelAcceptor)} to create a new
* instance.
* <p> * <p>
* Please note that this API is unsafe and doesn't provide any guarantees about * Please note that this API is unsafe and doesn't provide any guarantees about
* the stability of the channel pipeline or the API itself. Use at your own * the stability of the channel pipeline or the API itself. Use at your own

View File

@@ -6,10 +6,10 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import net.md_5.bungee.protocol.AbstractPacketHandler; import net.md_5.bungee.protocol.AbstractPacketHandler;
import net.md_5.bungee.protocol.ChatChain;
import net.md_5.bungee.protocol.DefinedPacket; import net.md_5.bungee.protocol.DefinedPacket;
import net.md_5.bungee.protocol.ProtocolConstants; import net.md_5.bungee.protocol.ProtocolConstants;
import net.md_5.bungee.protocol.data.ChatChain; import net.md_5.bungee.protocol.SeenMessages;
import net.md_5.bungee.protocol.data.SeenMessages;
@Data @Data
@NoArgsConstructor @NoArgsConstructor

View File

@@ -9,10 +9,10 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import net.md_5.bungee.protocol.AbstractPacketHandler; import net.md_5.bungee.protocol.AbstractPacketHandler;
import net.md_5.bungee.protocol.ChatChain;
import net.md_5.bungee.protocol.DefinedPacket; import net.md_5.bungee.protocol.DefinedPacket;
import net.md_5.bungee.protocol.ProtocolConstants; import net.md_5.bungee.protocol.ProtocolConstants;
import net.md_5.bungee.protocol.data.ChatChain; import net.md_5.bungee.protocol.SeenMessages;
import net.md_5.bungee.protocol.data.SeenMessages;
@Data @Data
@NoArgsConstructor @NoArgsConstructor

View File

@@ -10,8 +10,8 @@ import lombok.NoArgsConstructor;
import net.md_5.bungee.nbt.Tag; import net.md_5.bungee.nbt.Tag;
import net.md_5.bungee.protocol.AbstractPacketHandler; import net.md_5.bungee.protocol.AbstractPacketHandler;
import net.md_5.bungee.protocol.DefinedPacket; import net.md_5.bungee.protocol.DefinedPacket;
import net.md_5.bungee.protocol.Location;
import net.md_5.bungee.protocol.ProtocolConstants; import net.md_5.bungee.protocol.ProtocolConstants;
import net.md_5.bungee.protocol.data.Location;
@Data @Data
@NoArgsConstructor @NoArgsConstructor

View File

@@ -8,8 +8,8 @@ import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import net.md_5.bungee.protocol.AbstractPacketHandler; import net.md_5.bungee.protocol.AbstractPacketHandler;
import net.md_5.bungee.protocol.DefinedPacket; import net.md_5.bungee.protocol.DefinedPacket;
import net.md_5.bungee.protocol.PlayerPublicKey;
import net.md_5.bungee.protocol.ProtocolConstants; import net.md_5.bungee.protocol.ProtocolConstants;
import net.md_5.bungee.protocol.data.PlayerPublicKey;
@Data @Data
@NoArgsConstructor @NoArgsConstructor

View File

@@ -8,8 +8,8 @@ import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import net.md_5.bungee.protocol.AbstractPacketHandler; import net.md_5.bungee.protocol.AbstractPacketHandler;
import net.md_5.bungee.protocol.DefinedPacket; import net.md_5.bungee.protocol.DefinedPacket;
import net.md_5.bungee.protocol.Property;
import net.md_5.bungee.protocol.ProtocolConstants; import net.md_5.bungee.protocol.ProtocolConstants;
import net.md_5.bungee.protocol.data.Property;
@Data @Data
@NoArgsConstructor @NoArgsConstructor

View File

@@ -8,9 +8,9 @@ import lombok.NoArgsConstructor;
import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.protocol.AbstractPacketHandler; import net.md_5.bungee.protocol.AbstractPacketHandler;
import net.md_5.bungee.protocol.DefinedPacket; import net.md_5.bungee.protocol.DefinedPacket;
import net.md_5.bungee.protocol.PlayerPublicKey;
import net.md_5.bungee.protocol.Property;
import net.md_5.bungee.protocol.ProtocolConstants; import net.md_5.bungee.protocol.ProtocolConstants;
import net.md_5.bungee.protocol.data.PlayerPublicKey;
import net.md_5.bungee.protocol.data.Property;
@Data @Data
@NoArgsConstructor @NoArgsConstructor

View File

@@ -7,8 +7,8 @@ import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import net.md_5.bungee.protocol.AbstractPacketHandler; import net.md_5.bungee.protocol.AbstractPacketHandler;
import net.md_5.bungee.protocol.DefinedPacket; import net.md_5.bungee.protocol.DefinedPacket;
import net.md_5.bungee.protocol.PlayerPublicKey;
import net.md_5.bungee.protocol.ProtocolConstants; import net.md_5.bungee.protocol.ProtocolConstants;
import net.md_5.bungee.protocol.data.PlayerPublicKey;
import net.md_5.bungee.protocol.packet.PlayerListItem.Item; import net.md_5.bungee.protocol.packet.PlayerListItem.Item;
@Data @Data

View File

@@ -8,8 +8,8 @@ import lombok.NoArgsConstructor;
import net.md_5.bungee.nbt.Tag; import net.md_5.bungee.nbt.Tag;
import net.md_5.bungee.protocol.AbstractPacketHandler; import net.md_5.bungee.protocol.AbstractPacketHandler;
import net.md_5.bungee.protocol.DefinedPacket; import net.md_5.bungee.protocol.DefinedPacket;
import net.md_5.bungee.protocol.Location;
import net.md_5.bungee.protocol.ProtocolConstants; import net.md_5.bungee.protocol.ProtocolConstants;
import net.md_5.bungee.protocol.data.Location;
@Data @Data
@NoArgsConstructor @NoArgsConstructor

View File

@@ -9,9 +9,9 @@ import lombok.NoArgsConstructor;
import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.protocol.AbstractPacketHandler; import net.md_5.bungee.protocol.AbstractPacketHandler;
import net.md_5.bungee.protocol.DefinedPacket; import net.md_5.bungee.protocol.DefinedPacket;
import net.md_5.bungee.protocol.Either;
import net.md_5.bungee.protocol.NumberFormat;
import net.md_5.bungee.protocol.ProtocolConstants; import net.md_5.bungee.protocol.ProtocolConstants;
import net.md_5.bungee.protocol.data.NumberFormat;
import net.md_5.bungee.protocol.util.Either;
@Data @Data
@NoArgsConstructor @NoArgsConstructor

View File

@@ -8,8 +8,8 @@ import lombok.NoArgsConstructor;
import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.protocol.AbstractPacketHandler; import net.md_5.bungee.protocol.AbstractPacketHandler;
import net.md_5.bungee.protocol.DefinedPacket; import net.md_5.bungee.protocol.DefinedPacket;
import net.md_5.bungee.protocol.NumberFormat;
import net.md_5.bungee.protocol.ProtocolConstants; import net.md_5.bungee.protocol.ProtocolConstants;
import net.md_5.bungee.protocol.data.NumberFormat;
@Data @Data
@NoArgsConstructor @NoArgsConstructor

View File

@@ -8,8 +8,8 @@ import lombok.NoArgsConstructor;
import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.protocol.AbstractPacketHandler; import net.md_5.bungee.protocol.AbstractPacketHandler;
import net.md_5.bungee.protocol.DefinedPacket; import net.md_5.bungee.protocol.DefinedPacket;
import net.md_5.bungee.protocol.Either;
import net.md_5.bungee.protocol.ProtocolConstants; import net.md_5.bungee.protocol.ProtocolConstants;
import net.md_5.bungee.protocol.util.Either;
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@@ -27,10 +27,10 @@ public class ServerLinks extends DefinedPacket
links = new Link[ len ]; links = new Link[ len ];
for ( int i = 0; i < len; i++ ) for ( int i = 0; i < len; i++ )
{ {
Either<Integer, BaseComponent> type; Either<LinkType, BaseComponent> type;
if ( buf.readBoolean() ) if ( buf.readBoolean() )
{ {
type = Either.left( readVarInt( buf ) ); type = Either.left( LinkType.values()[readVarInt( buf )] );
} else } else
{ {
type = Either.right( readBaseComponent( buf, protocolVersion ) ); type = Either.right( readBaseComponent( buf, protocolVersion ) );
@@ -47,11 +47,11 @@ public class ServerLinks extends DefinedPacket
writeVarInt( links.length, buf ); writeVarInt( links.length, buf );
for ( Link link : links ) for ( Link link : links )
{ {
Either<Integer, BaseComponent> type = link.getType(); Either<LinkType, BaseComponent> type = link.getType();
if ( type.isLeft() ) if ( type.isLeft() )
{ {
buf.writeBoolean( true ); buf.writeBoolean( true );
writeVarInt( type.getLeft(), buf ); writeVarInt( type.getLeft().ordinal(), buf );
} else } else
{ {
buf.writeBoolean( false ); buf.writeBoolean( false );
@@ -67,11 +67,26 @@ public class ServerLinks extends DefinedPacket
handler.handle( this ); handler.handle( this );
} }
public enum LinkType
{
REPORT_BUG,
COMMUNITY_GUIDELINES,
SUPPORT,
STATUS,
FEEDBACK,
COMMUNITY,
WEBSITE,
FORUMS,
NEWS,
ANNOUNCEMENTS;
}
@Data @Data
public static class Link public static class Link
{ {
private final Either<Integer, BaseComponent> type; private final Either<LinkType, BaseComponent> type;
private final String url; private final String url;
} }
} }

View File

@@ -11,9 +11,9 @@ import net.md_5.bungee.nbt.TypedTag;
import net.md_5.bungee.protocol.AbstractPacketHandler; import net.md_5.bungee.protocol.AbstractPacketHandler;
import net.md_5.bungee.protocol.ChatSerializer; import net.md_5.bungee.protocol.ChatSerializer;
import net.md_5.bungee.protocol.DefinedPacket; import net.md_5.bungee.protocol.DefinedPacket;
import net.md_5.bungee.protocol.Either;
import net.md_5.bungee.protocol.ProtocolConstants; import net.md_5.bungee.protocol.ProtocolConstants;
import net.md_5.bungee.protocol.util.Either; import net.md_5.bungee.protocol.TagUtil;
import net.md_5.bungee.protocol.util.TagUtil;
@Data @Data
@NoArgsConstructor @NoArgsConstructor

View File

@@ -6,8 +6,8 @@ import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import net.md_5.bungee.api.dialog.Dialog; import net.md_5.bungee.api.dialog.Dialog;
import net.md_5.bungee.protocol.AbstractPacketHandler; import net.md_5.bungee.protocol.AbstractPacketHandler;
import net.md_5.bungee.protocol.Either;
import net.md_5.bungee.protocol.ProtocolConstants; import net.md_5.bungee.protocol.ProtocolConstants;
import net.md_5.bungee.protocol.util.Either;
@Data @Data
@NoArgsConstructor @NoArgsConstructor

View File

@@ -10,8 +10,8 @@ import lombok.RequiredArgsConstructor;
import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.protocol.AbstractPacketHandler; import net.md_5.bungee.protocol.AbstractPacketHandler;
import net.md_5.bungee.protocol.DefinedPacket; import net.md_5.bungee.protocol.DefinedPacket;
import net.md_5.bungee.protocol.Either;
import net.md_5.bungee.protocol.ProtocolConstants; import net.md_5.bungee.protocol.ProtocolConstants;
import net.md_5.bungee.protocol.util.Either;
@Data @Data
@NoArgsConstructor @NoArgsConstructor

View File

@@ -1,4 +1,4 @@
package net.md_5.bungee.protocol.util; package net.md_5.bungee.protocol;
import static org.junit.jupiter.api.Assertions.*; import static org.junit.jupiter.api.Assertions.*;
import com.google.gson.Gson; import com.google.gson.Gson;

View File

@@ -6,19 +6,18 @@
<parent> <parent>
<groupId>fr.pandacube.bungeecord</groupId> <groupId>fr.pandacube.bungeecord</groupId>
<artifactId>bungeecord-parent</artifactId> <artifactId>bungeecord-parent</artifactId>
<version>1.21-R0.5-SNAPSHOT</version> <version>1.21-R0.4-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<artifactId>bungeecord-proxy</artifactId> <artifactId>bungeecord-proxy</artifactId>
<version>1.21-R0.5-SNAPSHOT</version> <version>1.21-R0.4-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>BungeeCord-Proxy</name> <name>BungeeCord-Proxy</name>
<description>Proxy component of the Elastic Portal Suite</description> <description>Proxy component of the Elastic Portal Suite</description>
<properties> <properties>
<skipPublishing>true</skipPublishing>
<maven.deploy.skip>true</maven.deploy.skip> <maven.deploy.skip>true</maven.deploy.skip>
<maven.javadoc.skip>true</maven.javadoc.skip> <maven.javadoc.skip>true</maven.javadoc.skip>
</properties> </properties>

View File

@@ -45,7 +45,6 @@ import java.util.logging.Handler;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import lombok.Getter; import lombok.Getter;
import lombok.Locked;
import lombok.Setter; import lombok.Setter;
import lombok.Synchronized; import lombok.Synchronized;
import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.CommandSender;
@@ -520,12 +519,18 @@ public class BungeeCord extends ProxyServer
* *
* @param packet the packet to send * @param packet the packet to send
*/ */
@Locked.Read("connectionLock")
public void broadcast(DefinedPacket packet) public void broadcast(DefinedPacket packet)
{ {
for ( UserConnection con : connections.values() ) connectionLock.readLock().lock();
try
{ {
con.unsafe().sendPacket( packet ); for ( UserConnection con : connections.values() )
{
con.unsafe().sendPacket( packet );
}
} finally
{
connectionLock.readLock().unlock();
} }
} }
@@ -587,11 +592,17 @@ public class BungeeCord extends ProxyServer
} }
@Override @Override
@Locked.Read("connectionLock")
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public Collection<ProxiedPlayer> getPlayers() public Collection<ProxiedPlayer> getPlayers()
{ {
return Collections.unmodifiableCollection( new HashSet( connections.values() ) ); connectionLock.readLock().lock();
try
{
return Collections.unmodifiableCollection( new HashSet( connections.values() ) );
} finally
{
connectionLock.readLock().unlock();
}
} }
@Override @Override
@@ -601,10 +612,16 @@ public class BungeeCord extends ProxyServer
} }
@Override @Override
@Locked.Read("connectionLock")
public ProxiedPlayer getPlayer(String name) public ProxiedPlayer getPlayer(String name)
{ {
return connections.get( name ); connectionLock.readLock().lock();
try
{
return connections.get( name );
} finally
{
connectionLock.readLock().unlock();
}
} }
public UserConnection getPlayerByOfflineUUID(UUID uuid) public UserConnection getPlayerByOfflineUUID(UUID uuid)
@@ -624,10 +641,16 @@ public class BungeeCord extends ProxyServer
} }
@Override @Override
@Locked.Read("connectionLock")
public ProxiedPlayer getPlayer(UUID uuid) public ProxiedPlayer getPlayer(UUID uuid)
{ {
return connectionsByUUID.get( uuid ); connectionLock.readLock().lock();
try
{
return connectionsByUUID.get( uuid );
} finally
{
connectionLock.readLock().unlock();
}
} }
@Override @Override
@@ -753,15 +776,21 @@ public class BungeeCord extends ProxyServer
return true; return true;
} }
@Locked.Write("connectionLock")
public void removeConnection(UserConnection con) public void removeConnection(UserConnection con)
{ {
// TODO See #1218 connectionLock.writeLock().lock();
if ( connections.get( con.getName() ) == con ) try
{ {
connections.remove( con.getName() ); // TODO See #1218
connectionsByUUID.remove( con.getUniqueId() ); if ( connections.get( con.getName() ) == con )
connectionsByOfflineUUID.remove( con.getPendingConnection().getOfflineId() ); {
connections.remove( con.getName() );
connectionsByUUID.remove( con.getUniqueId() );
connectionsByOfflineUUID.remove( con.getPendingConnection().getOfflineId() );
}
} finally
{
connectionLock.writeLock().unlock();
} }
} }

View File

@@ -27,7 +27,7 @@ import net.md_5.bungee.jni.NativeCode;
import net.md_5.bungee.jni.cipher.BungeeCipher; import net.md_5.bungee.jni.cipher.BungeeCipher;
import net.md_5.bungee.jni.cipher.JavaCipher; import net.md_5.bungee.jni.cipher.JavaCipher;
import net.md_5.bungee.jni.cipher.NativeCipher; import net.md_5.bungee.jni.cipher.NativeCipher;
import net.md_5.bungee.protocol.data.PlayerPublicKey; import net.md_5.bungee.protocol.PlayerPublicKey;
import net.md_5.bungee.protocol.packet.EncryptionRequest; import net.md_5.bungee.protocol.packet.EncryptionRequest;
import net.md_5.bungee.protocol.packet.EncryptionResponse; import net.md_5.bungee.protocol.packet.EncryptionResponse;

View File

@@ -35,6 +35,7 @@ import net.md_5.bungee.netty.ChannelWrapper;
import net.md_5.bungee.netty.HandlerBoss; import net.md_5.bungee.netty.HandlerBoss;
import net.md_5.bungee.netty.PacketHandler; import net.md_5.bungee.netty.PacketHandler;
import net.md_5.bungee.protocol.DefinedPacket; import net.md_5.bungee.protocol.DefinedPacket;
import net.md_5.bungee.protocol.Either;
import net.md_5.bungee.protocol.PacketWrapper; import net.md_5.bungee.protocol.PacketWrapper;
import net.md_5.bungee.protocol.Protocol; import net.md_5.bungee.protocol.Protocol;
import net.md_5.bungee.protocol.ProtocolConstants; import net.md_5.bungee.protocol.ProtocolConstants;
@@ -59,7 +60,6 @@ import net.md_5.bungee.protocol.packet.ScoreboardScoreReset;
import net.md_5.bungee.protocol.packet.SetCompression; import net.md_5.bungee.protocol.packet.SetCompression;
import net.md_5.bungee.protocol.packet.StartConfiguration; import net.md_5.bungee.protocol.packet.StartConfiguration;
import net.md_5.bungee.protocol.packet.ViewDistance; import net.md_5.bungee.protocol.packet.ViewDistance;
import net.md_5.bungee.protocol.util.Either;
import net.md_5.bungee.util.AddressUtil; import net.md_5.bungee.util.AddressUtil;
import net.md_5.bungee.util.BufUtil; import net.md_5.bungee.util.BufUtil;
import net.md_5.bungee.util.QuietException; import net.md_5.bungee.util.QuietException;

View File

@@ -14,7 +14,6 @@ import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
@@ -30,7 +29,6 @@ import net.md_5.bungee.api.Callback;
import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.ServerConnectRequest; import net.md_5.bungee.api.ServerConnectRequest;
import net.md_5.bungee.api.ServerLink;
import net.md_5.bungee.api.SkinConfiguration; import net.md_5.bungee.api.SkinConfiguration;
import net.md_5.bungee.api.Title; import net.md_5.bungee.api.Title;
import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.api.chat.BaseComponent;
@@ -52,6 +50,7 @@ import net.md_5.bungee.netty.HandlerBoss;
import net.md_5.bungee.netty.PipelineUtils; import net.md_5.bungee.netty.PipelineUtils;
import net.md_5.bungee.protocol.ChatSerializer; import net.md_5.bungee.protocol.ChatSerializer;
import net.md_5.bungee.protocol.DefinedPacket; import net.md_5.bungee.protocol.DefinedPacket;
import net.md_5.bungee.protocol.Either;
import net.md_5.bungee.protocol.PacketWrapper; import net.md_5.bungee.protocol.PacketWrapper;
import net.md_5.bungee.protocol.Protocol; import net.md_5.bungee.protocol.Protocol;
import net.md_5.bungee.protocol.ProtocolConstants; import net.md_5.bungee.protocol.ProtocolConstants;
@@ -61,14 +60,12 @@ import net.md_5.bungee.protocol.packet.ClientSettings;
import net.md_5.bungee.protocol.packet.Kick; import net.md_5.bungee.protocol.packet.Kick;
import net.md_5.bungee.protocol.packet.PlayerListHeaderFooter; import net.md_5.bungee.protocol.packet.PlayerListHeaderFooter;
import net.md_5.bungee.protocol.packet.PluginMessage; import net.md_5.bungee.protocol.packet.PluginMessage;
import net.md_5.bungee.protocol.packet.ServerLinks;
import net.md_5.bungee.protocol.packet.SetCompression; import net.md_5.bungee.protocol.packet.SetCompression;
import net.md_5.bungee.protocol.packet.ShowDialog; import net.md_5.bungee.protocol.packet.ShowDialog;
import net.md_5.bungee.protocol.packet.ShowDialogDirect; import net.md_5.bungee.protocol.packet.ShowDialogDirect;
import net.md_5.bungee.protocol.packet.StoreCookie; import net.md_5.bungee.protocol.packet.StoreCookie;
import net.md_5.bungee.protocol.packet.SystemChat; import net.md_5.bungee.protocol.packet.SystemChat;
import net.md_5.bungee.protocol.packet.Transfer; import net.md_5.bungee.protocol.packet.Transfer;
import net.md_5.bungee.protocol.util.Either;
import net.md_5.bungee.tab.ServerUnique; import net.md_5.bungee.tab.ServerUnique;
import net.md_5.bungee.tab.TabList; import net.md_5.bungee.tab.TabList;
import net.md_5.bungee.util.CaseInsensitiveSet; import net.md_5.bungee.util.CaseInsensitiveSet;
@@ -863,16 +860,4 @@ public final class UserConnection implements ProxiedPlayer
unsafe.sendPacket( new ShowDialog( Either.right( dialog ) ) ); unsafe.sendPacket( new ShowDialog( Either.right( dialog ) ) );
} }
@Override
public void sendServerLinks(List<ServerLink> serverLinks)
{
Preconditions.checkState( getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_1_21, "Server links are only supported in 1.21 and above" );
ServerLinks.Link[] links = serverLinks.stream()
.map( link -> new ServerLinks.Link( link.getType() != null ? Either.left( link.getType().ordinal() ) : Either.right( link.getLabel() ), link.getUrl() ) )
.toArray( ServerLinks.Link[]::new );
unsafe.sendPacket( new ServerLinks( links ) );
}
} }

View File

@@ -12,7 +12,7 @@ public class CommandPerms extends Command
public CommandPerms() public CommandPerms()
{ {
super( "perms", "bungeecord.command.perms" ); super( "perms" );
} }
@Override @Override

View File

@@ -94,7 +94,7 @@ public class YamlConfig implements ConfigurationAdapter
} ) ); } ) );
set( "permissions.admin", Arrays.asList( new String[] set( "permissions.admin", Arrays.asList( new String[]
{ {
"bungeecord.command.alert", "bungeecord.command.alertraw", "bungeecord.command.end", "bungeecord.command.ip", "bungeecord.command.reload", "bungeecord.command.kick", "bungeecord.command.send", "bungeecord.command.find", "bungeecord.command.perms" "bungeecord.command.alert", "bungeecord.command.alertraw", "bungeecord.command.end", "bungeecord.command.ip", "bungeecord.command.reload", "bungeecord.command.kick", "bungeecord.command.send", "bungeecord.command.find"
} ) ); } ) );
} }

View File

@@ -58,9 +58,9 @@ import net.md_5.bungee.netty.cipher.CipherDecoder;
import net.md_5.bungee.netty.cipher.CipherEncoder; import net.md_5.bungee.netty.cipher.CipherEncoder;
import net.md_5.bungee.protocol.DefinedPacket; import net.md_5.bungee.protocol.DefinedPacket;
import net.md_5.bungee.protocol.PacketWrapper; import net.md_5.bungee.protocol.PacketWrapper;
import net.md_5.bungee.protocol.PlayerPublicKey;
import net.md_5.bungee.protocol.Protocol; import net.md_5.bungee.protocol.Protocol;
import net.md_5.bungee.protocol.ProtocolConstants; import net.md_5.bungee.protocol.ProtocolConstants;
import net.md_5.bungee.protocol.data.PlayerPublicKey;
import net.md_5.bungee.protocol.packet.CookieRequest; import net.md_5.bungee.protocol.packet.CookieRequest;
import net.md_5.bungee.protocol.packet.CookieResponse; import net.md_5.bungee.protocol.packet.CookieResponse;
import net.md_5.bungee.protocol.packet.EncryptionRequest; import net.md_5.bungee.protocol.packet.EncryptionRequest;

View File

@@ -3,7 +3,7 @@ package net.md_5.bungee.connection;
import com.google.gson.Gson; import com.google.gson.Gson;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import net.md_5.bungee.protocol.data.Property; import net.md_5.bungee.protocol.Property;
@Data @Data
@AllArgsConstructor @AllArgsConstructor

View File

@@ -29,6 +29,7 @@ import net.md_5.bungee.netty.PacketHandler;
import net.md_5.bungee.protocol.PacketWrapper; import net.md_5.bungee.protocol.PacketWrapper;
import net.md_5.bungee.protocol.Protocol; import net.md_5.bungee.protocol.Protocol;
import net.md_5.bungee.protocol.ProtocolConstants; import net.md_5.bungee.protocol.ProtocolConstants;
import net.md_5.bungee.protocol.TagUtil;
import net.md_5.bungee.protocol.packet.Chat; import net.md_5.bungee.protocol.packet.Chat;
import net.md_5.bungee.protocol.packet.ClientChat; import net.md_5.bungee.protocol.packet.ClientChat;
import net.md_5.bungee.protocol.packet.ClientCommand; import net.md_5.bungee.protocol.packet.ClientCommand;
@@ -45,7 +46,6 @@ import net.md_5.bungee.protocol.packet.StartConfiguration;
import net.md_5.bungee.protocol.packet.TabCompleteRequest; import net.md_5.bungee.protocol.packet.TabCompleteRequest;
import net.md_5.bungee.protocol.packet.TabCompleteResponse; import net.md_5.bungee.protocol.packet.TabCompleteResponse;
import net.md_5.bungee.protocol.packet.UnsignedClientCommand; import net.md_5.bungee.protocol.packet.UnsignedClientCommand;
import net.md_5.bungee.protocol.util.TagUtil;
import net.md_5.bungee.util.AllowedCharacters; import net.md_5.bungee.util.AllowedCharacters;
public class UpstreamBridge extends PacketHandler public class UpstreamBridge extends PacketHandler

View File

@@ -13,12 +13,10 @@ import net.md_5.bungee.protocol.DefinedPacket;
/** /**
* prepends length of message and optionally compresses message beforehand * prepends length of message and optionally compresses message beforehand
* <br> * <br>
* combining these operations allows to keep space infront of compressed data * combining these operations allows to keep space infront of compressed data for length varint
* for length varint
*/ */
public class LengthPrependerAndCompressor extends MessageToMessageEncoder<ByteBuf> public class LengthPrependerAndCompressor extends MessageToMessageEncoder<ByteBuf>
{ {
// reasonable to not support length varints > 4 byte (268435455 byte > 268MB) // reasonable to not support length varints > 4 byte (268435455 byte > 268MB)
// if ever changed to smaller than 4, also change varintSize method to check for that // if ever changed to smaller than 4, also change varintSize method to check for that
private static final byte MAX_SUPPORTED_VARINT_LENGTH_LEN = 4; private static final byte MAX_SUPPORTED_VARINT_LENGTH_LEN = 4;

View File

@@ -22,17 +22,12 @@ public class ServerUnique extends TabList
@Override @Override
public void onUpdate(PlayerListItem playerListItem) public void onUpdate(PlayerListItem playerListItem)
{ {
PlayerListItem.Action action = playerListItem.getAction(); for ( PlayerListItem.Item item : playerListItem.getItems() )
if ( action == PlayerListItem.Action.ADD_PLAYER )
{ {
for ( PlayerListItem.Item item : playerListItem.getItems() ) if ( playerListItem.getAction() == PlayerListItem.Action.ADD_PLAYER )
{ {
uuids.add( item.getUuid() ); uuids.add( item.getUuid() );
} } else if ( playerListItem.getAction() == PlayerListItem.Action.REMOVE_PLAYER )
} else if ( action == PlayerListItem.Action.REMOVE_PLAYER )
{
for ( PlayerListItem.Item item : playerListItem.getItems() )
{ {
uuids.remove( item.getUuid() ); uuids.remove( item.getUuid() );
} }
@@ -53,11 +48,14 @@ public class ServerUnique extends TabList
@Override @Override
public void onUpdate(PlayerListItemUpdate playerListItem) public void onUpdate(PlayerListItemUpdate playerListItem)
{ {
if ( playerListItem.getActions().contains( PlayerListItemUpdate.Action.ADD_PLAYER ) ) for ( PlayerListItem.Item item : playerListItem.getItems() )
{ {
for ( PlayerListItem.Item item : playerListItem.getItems() ) for ( PlayerListItemUpdate.Action action : playerListItem.getActions() )
{ {
uuids.add( item.getUuid() ); if ( action == PlayerListItemUpdate.Action.ADD_PLAYER )
{
uuids.add( item.getUuid() );
}
} }
} }
player.unsafe().sendPacket( playerListItem ); player.unsafe().sendPacket( playerListItem );
@@ -75,7 +73,7 @@ public class ServerUnique extends TabList
if ( player.getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_1_19_3 ) if ( player.getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_1_19_3 )
{ {
PlayerListItemRemove packet = new PlayerListItemRemove(); PlayerListItemRemove packet = new PlayerListItemRemove();
packet.setUuids( uuids.toArray( new UUID[ 0 ] ) ); packet.setUuids( uuids.stream().toArray( UUID[]::new ) );
player.unsafe().sendPacket( packet ); player.unsafe().sendPacket( packet );
} else } else
{ {

View File

@@ -5,7 +5,7 @@ import net.md_5.bungee.BungeeCord;
import net.md_5.bungee.UserConnection; import net.md_5.bungee.UserConnection;
import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.connection.LoginResult; import net.md_5.bungee.connection.LoginResult;
import net.md_5.bungee.protocol.data.Property; import net.md_5.bungee.protocol.Property;
import net.md_5.bungee.protocol.packet.PlayerListItem; import net.md_5.bungee.protocol.packet.PlayerListItem;
import net.md_5.bungee.protocol.packet.PlayerListItemRemove; import net.md_5.bungee.protocol.packet.PlayerListItemRemove;
import net.md_5.bungee.protocol.packet.PlayerListItemUpdate; import net.md_5.bungee.protocol.packet.PlayerListItemUpdate;

View File

@@ -6,12 +6,12 @@
<parent> <parent>
<groupId>fr.pandacube.bungeecord</groupId> <groupId>fr.pandacube.bungeecord</groupId>
<artifactId>bungeecord-parent</artifactId> <artifactId>bungeecord-parent</artifactId>
<version>1.21-R0.5-SNAPSHOT</version> <version>1.21-R0.4-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<artifactId>bungeecord-query</artifactId> <artifactId>bungeecord-query</artifactId>
<version>1.21-R0.5-SNAPSHOT</version> <version>1.21-R0.4-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>BungeeCord-Query</name> <name>BungeeCord-Query</name>

View File

@@ -6,12 +6,12 @@
<parent> <parent>
<groupId>fr.pandacube.bungeecord</groupId> <groupId>fr.pandacube.bungeecord</groupId>
<artifactId>bungeecord-parent</artifactId> <artifactId>bungeecord-parent</artifactId>
<version>1.21-R0.5-SNAPSHOT</version> <version>1.21-R0.4-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<artifactId>bungeecord-serializer</artifactId> <artifactId>bungeecord-serializer</artifactId>
<version>1.21-R0.5-SNAPSHOT</version> <version>1.21-R0.4-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>BungeeCord-Serializer</name> <name>BungeeCord-Serializer</name>

View File

@@ -20,12 +20,11 @@ public class ClickEventSerializer
public static final ClickEventSerializer NEW = new ClickEventSerializer( ClickType.NEW ); public static final ClickEventSerializer NEW = new ClickEventSerializer( ClickType.NEW );
public static final ClickEventSerializer DIALOG = new ClickEventSerializer( ClickType.DIALOG ); public static final ClickEventSerializer DIALOG = new ClickEventSerializer( ClickType.DIALOG );
// //
private final ClickType type;
public enum ClickType public enum ClickType
{ {
OLD, NEW, DIALOG; OLD, NEW, DIALOG;
} }
private final ClickType type;
public ClickEvent deserialize(JsonObject clickEvent, JsonDeserializationContext context) throws JsonParseException public ClickEvent deserialize(JsonObject clickEvent, JsonDeserializationContext context) throws JsonParseException
{ {

View File

@@ -1,138 +0,0 @@
package net.md_5.bungee.chat;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import java.lang.reflect.Type;
import java.util.UUID;
import net.md_5.bungee.api.chat.ObjectComponent;
import net.md_5.bungee.api.chat.objects.PlayerObject;
import net.md_5.bungee.api.chat.objects.SpriteObject;
import net.md_5.bungee.api.chat.player.Profile;
import net.md_5.bungee.api.chat.player.Property;
public class ObjectComponentSerializer extends BaseComponentSerializer implements JsonSerializer<ObjectComponent>, JsonDeserializer<ObjectComponent>
{
public ObjectComponentSerializer(VersionedComponentSerializer serializer)
{
super( serializer );
}
@Override
public ObjectComponent deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException
{
JsonObject object = json.getAsJsonObject();
String sprite = object.has( "sprite" ) ? object.get( "sprite" ).getAsString() : null;
String atlas = object.has( "atlas" ) ? object.get( "atlas" ).getAsString() : null;
if ( sprite != null )
{
ObjectComponent component = new ObjectComponent( new SpriteObject( atlas, sprite ) );
deserialize( object, component, context );
return component;
}
JsonElement player = object.get( "player" );
if ( player != null )
{
String name = null;
UUID uuid = null;
Property[] properties = null;
Boolean hat = object.has( "hat" ) ? object.get( "hat" ).getAsBoolean() : null;
if ( player.isJsonObject() )
{
JsonObject playerObj = player.getAsJsonObject();
validateName( name = playerObj.has( "name" ) ? playerObj.get( "name" ).getAsString() : null );
uuid = playerObj.has( "id" ) ? parseUUID( context.deserialize( playerObj.get( "id" ), int[].class ) ) : null;
properties = playerObj.has( "properties" ) ? context.deserialize( playerObj.get( "properties" ), Property[].class ) : null;
} else if ( player.isJsonPrimitive() )
{
validateName( name = player.getAsString() );
}
ObjectComponent component = new ObjectComponent( new PlayerObject( new Profile( name, uuid, properties ), hat ) );
deserialize( object, component, context );
return component;
}
throw new JsonParseException( "Could not parse JSON: missing 'player' or 'sprite' property" );
}
@Override
public JsonElement serialize(ObjectComponent src, Type typeOfSrc, JsonSerializationContext context)
{
JsonObject object = new JsonObject();
serialize( object, src, context );
if ( src.getObject() instanceof SpriteObject )
{
SpriteObject sprite = (SpriteObject) src.getObject();
object.addProperty( "sprite", sprite.getSprite() );
if ( sprite.getAtlas() != null )
{
object.addProperty( "atlas", sprite.getAtlas() );
}
return object;
}
if ( src.getObject() instanceof PlayerObject )
{
PlayerObject player = (PlayerObject) src.getObject();
if ( player.getHat() != null )
{
object.addProperty( "hat", player.getHat() );
}
JsonObject playerObj = new JsonObject();
Profile profile = player.getProfile();
if ( profile.getName() != null )
{
playerObj.addProperty( "name", profile.getName() );
}
if ( profile.getUuid() != null )
{
int[] uuidArray = new int[4];
long most = profile.getUuid().getMostSignificantBits();
long least = profile.getUuid().getLeastSignificantBits();
uuidArray[0] = (int) ( most >> 32 );
uuidArray[1] = (int) most;
uuidArray[2] = (int) ( least >> 32 );
uuidArray[3] = (int) least;
playerObj.add( "id", context.serialize( uuidArray ) );
}
if ( profile.getProperties() != null )
{
playerObj.add( "properties", context.serialize( profile.getProperties(), Property[].class ) );
}
object.add( "player", playerObj );
return object;
}
throw new JsonParseException( "Could not serialize ObjectComponent: unknown object type " + src.getObject().getClass() );
}
private static UUID parseUUID(int[] array)
{
if ( array.length != 4 )
{
throw new JsonParseException( "UUID integer array must be exactly 4 integers long" );
}
return new UUID( (long) array[0] << 32 | (long) array[1] & 0XFFFFFFFFL, (long) array[2] << 32 | (long) array[3] & 0XFFFFFFFFL );
}
private static void validateName(String name)
{
if ( name != null && ( name.length() > 16 || name.isEmpty() ) )
{
throw new JsonParseException( "Could not parse JSON: player name must be 16 characters or fewer and not empty" );
}
}
}

View File

@@ -17,7 +17,6 @@ import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.ComponentStyle; import net.md_5.bungee.api.chat.ComponentStyle;
import net.md_5.bungee.api.chat.ItemTag; import net.md_5.bungee.api.chat.ItemTag;
import net.md_5.bungee.api.chat.KeybindComponent; import net.md_5.bungee.api.chat.KeybindComponent;
import net.md_5.bungee.api.chat.ObjectComponent;
import net.md_5.bungee.api.chat.ScoreComponent; import net.md_5.bungee.api.chat.ScoreComponent;
import net.md_5.bungee.api.chat.SelectorComponent; import net.md_5.bungee.api.chat.SelectorComponent;
import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.chat.TextComponent;
@@ -62,7 +61,6 @@ public class VersionedComponentSerializer implements JsonDeserializer<BaseCompon
registerTypeAdapter( KeybindComponent.class, new KeybindComponentSerializer( this ) ). registerTypeAdapter( KeybindComponent.class, new KeybindComponentSerializer( this ) ).
registerTypeAdapter( ScoreComponent.class, new ScoreComponentSerializer( this ) ). registerTypeAdapter( ScoreComponent.class, new ScoreComponentSerializer( this ) ).
registerTypeAdapter( SelectorComponent.class, new SelectorComponentSerializer( this ) ). registerTypeAdapter( SelectorComponent.class, new SelectorComponentSerializer( this ) ).
registerTypeAdapter( ObjectComponent.class, new ObjectComponentSerializer( this ) ).
registerTypeAdapter( ComponentStyle.class, new ComponentStyleSerializer() ). registerTypeAdapter( ComponentStyle.class, new ComponentStyleSerializer() ).
registerTypeAdapter( Entity.class, new EntitySerializer( this ) ). registerTypeAdapter( Entity.class, new EntitySerializer( this ) ).
registerTypeAdapter( Text.class, new TextSerializer() ). registerTypeAdapter( Text.class, new TextSerializer() ).
@@ -267,7 +265,7 @@ public class VersionedComponentSerializer implements JsonDeserializer<BaseCompon
if ( json.isJsonArray() ) if ( json.isJsonArray() )
{ {
JsonArray arr = json.getAsJsonArray(); JsonArray arr = json.getAsJsonArray();
BaseComponent[] components = new BaseComponent[ arr.size() ]; BaseComponent[] components = new BaseComponent[arr.size()];
for ( int i = 0; i < arr.size(); i++ ) for ( int i = 0; i < arr.size(); i++ )
{ {
components[i] = deserialize( arr.get( i ), BaseComponent.class, context ); components[i] = deserialize( arr.get( i ), BaseComponent.class, context );
@@ -292,10 +290,6 @@ public class VersionedComponentSerializer implements JsonDeserializer<BaseCompon
{ {
return context.deserialize( json, SelectorComponent.class ); return context.deserialize( json, SelectorComponent.class );
} }
if ( object.has( "player" ) || object.has( "sprite" ) )
{
return context.deserialize( json, ObjectComponent.class );
}
return context.deserialize( json, TextComponent.class ); return context.deserialize( json, TextComponent.class );
} }
} }

View File

@@ -29,7 +29,6 @@ import net.md_5.bungee.chat.VersionedComponentSerializer;
@RequiredArgsConstructor @RequiredArgsConstructor
public class DialogSerializer implements JsonDeserializer<Dialog>, JsonSerializer<Dialog> public class DialogSerializer implements JsonDeserializer<Dialog>, JsonSerializer<Dialog>
{ {
private static final ThreadLocal<Set<Dialog>> serializedDialogs = new ThreadLocal<>(); private static final ThreadLocal<Set<Dialog>> serializedDialogs = new ThreadLocal<>();
private static final BiMap<String, Class<? extends Dialog>> TYPES; private static final BiMap<String, Class<? extends Dialog>> TYPES;
private final VersionedComponentSerializer serializer; private final VersionedComponentSerializer serializer;

View File

@@ -562,13 +562,6 @@ public class ComponentsTest
assertNotNull( url2 ); assertNotNull( url2 );
assertTrue( url2.getAction() == ClickEvent.Action.OPEN_URL ); assertTrue( url2.getAction() == ClickEvent.Action.OPEN_URL );
assertEquals( "http://google.com/test", url2.getValue() ); assertEquals( "http://google.com/test", url2.getValue() );
BaseComponent[] test3 = TextComponent.fromLegacyText( "Text\nhttp://google.com\n newline3" );
ClickEvent url3 = test3[1].getClickEvent();
assertNotNull( url3 );
assertTrue( url3.getAction() == ClickEvent.Action.OPEN_URL );
assertEquals( "http://google.com", url3.getValue() );
assertEquals( "\n newline3", BaseComponent.toPlainText( test3[2] ) );
} }
@Test @Test

View File

@@ -6,12 +6,12 @@
<parent> <parent>
<groupId>fr.pandacube.bungeecord</groupId> <groupId>fr.pandacube.bungeecord</groupId>
<artifactId>bungeecord-parent</artifactId> <artifactId>bungeecord-parent</artifactId>
<version>1.21-R0.5-SNAPSHOT</version> <version>1.21-R0.4-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
<artifactId>bungeecord-slf4j</artifactId> <artifactId>bungeecord-slf4j</artifactId>
<version>1.21-R0.5-SNAPSHOT</version> <version>1.21-R0.4-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>BungeeCord-SLF4J</name> <name>BungeeCord-SLF4J</name>
@@ -19,7 +19,6 @@
<properties> <properties>
<checkstyle.skip>true</checkstyle.skip> <checkstyle.skip>true</checkstyle.skip>
<skipPublishing>true</skipPublishing>
<maven.deploy.skip>true</maven.deploy.skip> <maven.deploy.skip>true</maven.deploy.skip>
<maven.javadoc.skip>true</maven.javadoc.skip> <maven.javadoc.skip>true</maven.javadoc.skip>
</properties> </properties>