Compare commits

..

6 Commits

Author SHA1 Message Date
f948b287f5 new event TabCompleteRequestEvent and deprecate TabCompleteEvent 2024-02-17 18:30:11 +01:00
85d372ae7e Add CommandsDeclareEvent to declare commands with brigadier API 2024-02-17 18:30:11 +01:00
f38c4a6e94 Server branding now includes the backend server name 2024-02-17 18:30:11 +01:00
aefd61943b 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.
2024-02-17 18:30:11 +01:00
f08fb3cdfe Change projet configuration and POM for Pandacube 2024-02-17 18:29:40 +01:00
c237bd3895 Remove modules and startup delay
We don’t need them for Pandacube
2024-02-17 13:40:26 +01:00
9 changed files with 12 additions and 112 deletions

View File

@ -52,7 +52,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>
<version>3.5.2</version> <version>3.5.1</version>
<executions> <executions>
<execution> <execution>
<phase>package</phase> <phase>package</phase>

View File

@ -1,6 +1,5 @@
package net.md_5.bungee.protocol; package net.md_5.bungee.protocol;
import java.util.function.Function;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
@ -32,26 +31,4 @@ public final class Either<L, R>
{ {
return new Either<>( null, right ); return new Either<>( null, right );
} }
public L getLeftOrCompute(Function<R, L> function)
{
if ( isLeft() )
{
return left;
} else
{
return function.apply( right );
}
}
public R getRightOrCompute(Function<L, R> function)
{
if ( isRight() )
{
return right;
} else
{
return function.apply( left );
}
}
} }

View File

@ -45,7 +45,7 @@ public class ProtocolConstants
public static final int MINECRAFT_1_20 = 763; public static final int MINECRAFT_1_20 = 763;
public static final int MINECRAFT_1_20_2 = 764; public static final int MINECRAFT_1_20_2 = 764;
public static final int MINECRAFT_1_20_3 = 765; public static final int MINECRAFT_1_20_3 = 765;
public static final int MINECRAFT_1_20_5 = 1073742003; public static final int MINECRAFT_1_20_5 = 1073742000;
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;

View File

@ -312,7 +312,6 @@ public class Commands extends DefinedPacket
private static final ArgumentSerializer[] IDS_1_19_3; private static final ArgumentSerializer[] IDS_1_19_3;
private static final ArgumentSerializer[] IDS_1_19_4; private static final ArgumentSerializer[] IDS_1_19_4;
private static final ArgumentSerializer[] IDS_1_20_3; private static final ArgumentSerializer[] IDS_1_20_3;
private static final ArgumentSerializer[] IDS_1_20_5;
private static final Map<Class<?>, ProperArgumentSerializer<?>> PROPER_PROVIDERS = new HashMap<>(); private static final Map<Class<?>, ProperArgumentSerializer<?>> PROPER_PROVIDERS = new HashMap<>();
// //
private static final ArgumentSerializer<Void> VOID = new ArgumentSerializer<Void>() private static final ArgumentSerializer<Void> VOID = new ArgumentSerializer<Void>()
@ -869,61 +868,6 @@ public class Commands extends DefinedPacket
get( "minecraft:uuid", VOID ), get( "minecraft:uuid", VOID ),
get( "minecraft:heightmap", VOID ) get( "minecraft:heightmap", VOID )
}; };
IDS_1_20_5 = new ArgumentSerializer[]
{
get( "brigadier:bool", VOID ),
get( "brigadier:float", FLOAT_RANGE ),
get( "brigadier:double", DOUBLE_RANGE ),
get( "brigadier:integer", INTEGER_RANGE ),
get( "brigadier:long", LONG_RANGE ),
get( "brigadier:string", STRING ),
get( "minecraft:entity", BYTE ),
get( "minecraft:game_profile", VOID ),
get( "minecraft:block_pos", VOID ),
get( "minecraft:column_pos", VOID ),
get( "minecraft:vec3", VOID ),
get( "minecraft:vec2", VOID ),
get( "minecraft:block_state", VOID ),
get( "minecraft:block_predicate", VOID ),
get( "minecraft:item_stack", VOID ),
get( "minecraft:item_predicate", VOID ),
get( "minecraft:color", VOID ),
get( "minecraft:component", VOID ),
get( "minecraft:style", VOID ),
get( "minecraft:message", VOID ),
get( "minecraft:nbt_compound_tag", VOID ),
get( "minecraft:nbt_tag", VOID ),
get( "minecraft:nbt_path", VOID ),
get( "minecraft:objective", VOID ),
get( "minecraft:objective_criteria", VOID ),
get( "minecraft:operation", VOID ),
get( "minecraft:particle", VOID ),
get( "minecraft:angle", VOID ),
get( "minecraft:rotation", VOID ),
get( "minecraft:scoreboard_slot", VOID ),
get( "minecraft:score_holder", BYTE ),
get( "minecraft:swizzle", VOID ),
get( "minecraft:team", VOID ),
get( "minecraft:item_slot", VOID ),
get( "minecraft:item_slots", VOID ),
get( "minecraft:resource_location", VOID ),
get( "minecraft:function", VOID ),
get( "minecraft:entity_anchor", VOID ),
get( "minecraft:int_range", VOID ),
get( "minecraft:float_range", VOID ),
get( "minecraft:dimension", VOID ),
get( "minecraft:gamemode", VOID ),
get( "minecraft:time", INTEGER ),
get( "minecraft:resource_or_tag", RAW_STRING ),
get( "minecraft:resource_or_tag_key", RAW_STRING ),
get( "minecraft:resource", RAW_STRING ),
get( "minecraft:resource_key", RAW_STRING ),
get( "minecraft:template_mirror", VOID ),
get( "minecraft:template_rotation", VOID ),
get( "minecraft:uuid", VOID ),
get( "minecraft:heightmap", VOID )
};
} }
private static void register(String name, ArgumentSerializer serializer) private static void register(String name, ArgumentSerializer serializer)
@ -1343,10 +1287,7 @@ public class Commands extends DefinedPacket
{ {
key = readVarInt( buf ); key = readVarInt( buf );
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_20_5 ) if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_20_3 )
{
reader = IDS_1_20_5[(Integer) key];
} else if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_20_3 )
{ {
reader = IDS_1_20_3[(Integer) key]; reader = IDS_1_20_3[(Integer) key];
} else if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_4 ) } else if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_4 )

View File

@ -133,13 +133,7 @@ public class Login extends DefinedPacket
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_20_2 ) if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_20_2 )
{ {
limitedCrafting = buf.readBoolean(); limitedCrafting = buf.readBoolean();
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_20_5 ) dimension = readString( buf );
{
dimension = readVarInt( buf );
} else
{
dimension = readString( buf );
}
worldName = readString( buf ); worldName = readString( buf );
seed = buf.readLong(); seed = buf.readLong();
gameMode = buf.readUnsignedByte(); gameMode = buf.readUnsignedByte();
@ -260,13 +254,7 @@ public class Login extends DefinedPacket
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_20_2 ) if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_20_2 )
{ {
buf.writeBoolean( limitedCrafting ); buf.writeBoolean( limitedCrafting );
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_20_5 ) writeString( (String) dimension, buf );
{
writeVarInt( (Integer) dimension, buf );
} else
{
writeString( (String) dimension, buf );
}
writeString( worldName, buf ); writeString( worldName, buf );
buf.writeLong( seed ); buf.writeLong( seed );
buf.writeByte( gameMode ); buf.writeByte( gameMode );

View File

@ -36,10 +36,7 @@ public class Respawn extends DefinedPacket
{ {
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_16 ) if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_16 )
{ {
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_20_5 ) if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_16_2 && protocolVersion < ProtocolConstants.MINECRAFT_1_19 )
{
dimension = readVarInt( buf );
} else if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_16_2 && protocolVersion < ProtocolConstants.MINECRAFT_1_19 )
{ {
dimension = readTag( buf, protocolVersion ); dimension = readTag( buf, protocolVersion );
} else } else
@ -95,10 +92,7 @@ public class Respawn extends DefinedPacket
{ {
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_16 ) if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_16 )
{ {
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_20_5 ) if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_16_2 && protocolVersion < ProtocolConstants.MINECRAFT_1_19 )
{
writeVarInt( (Integer) dimension, buf );
} else if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_16_2 && protocolVersion < ProtocolConstants.MINECRAFT_1_19 )
{ {
writeTag( (Tag) dimension, buf, protocolVersion ); writeTag( (Tag) dimension, buf, protocolVersion );
} else } else

View File

@ -243,7 +243,7 @@ public class ServerConnector extends PacketHandler
user.getForgeClientHandler().setHandshakeComplete(); user.getForgeClientHandler().setHandshakeComplete();
} }
if ( user.getServer() == null || user.getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_1_16 ) if ( user.getServer() == null || !( login.getDimension() instanceof Integer ) )
{ {
// Once again, first connection // Once again, first connection
user.setClientEntityId( login.getEntityId() ); user.setClientEntityId( login.getEntityId() );

View File

@ -272,9 +272,9 @@ public class DownstreamBridge extends PacketHandler
{ {
if ( team.getMode() == 0 || team.getMode() == 2 ) if ( team.getMode() == 0 || team.getMode() == 2 )
{ {
t.setDisplayName( team.getDisplayName().getLeftOrCompute( ComponentSerializer::toString ) ); t.setDisplayName( ComponentSerializer.toString( team.getDisplayName() ) );
t.setPrefix( team.getPrefix().getLeftOrCompute( ComponentSerializer::toString ) ); t.setPrefix( ComponentSerializer.toString( team.getPrefix() ) );
t.setSuffix( team.getSuffix().getLeftOrCompute( ComponentSerializer::toString ) ); t.setSuffix( ComponentSerializer.toString( team.getSuffix() ) );
t.setFriendlyFire( team.getFriendlyFire() ); t.setFriendlyFire( team.getFriendlyFire() );
t.setNameTagVisibility( team.getNameTagVisibility() ); t.setNameTagVisibility( team.getNameTagVisibility() );
t.setCollisionRule( team.getCollisionRule() ); t.setCollisionRule( team.getCollisionRule() );

View File

@ -17,7 +17,7 @@ public final class AllowedCharacters
{ {
if ( onlineMode ) if ( onlineMode )
{ {
return ( c >= 'a' && c <= 'z' ) || ( c >= '0' && c <= '9' ) || ( c >= 'A' && c <= 'Z' ) || c == '_'; return ( c >= 'a' && c <= 'z' ) || ( c >= '0' && c <= '9' ) || ( c >= 'A' && c <= 'Z' ) || c == '_' || c == '.' || c == '-';
} else } else
{ {
// Don't allow spaces, Yaml config doesn't support them // Don't allow spaces, Yaml config doesn't support them