Compare commits

..

15 Commits

Author SHA1 Message Date
ab9955af93 new event TabCompleteRequestEvent and deprecate TabCompleteEvent 2023-03-15 10:42:07 +01:00
fc32fc3f83 Add CommandsDeclareEvent to declare commands with brigadier API 2023-03-15 10:42:04 +01:00
2d987260cd Server branding now includes the backend server name 2023-03-14 23:30:13 +01:00
6ed66d9af8 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.
2023-03-14 23:30:13 +01:00
31461d9d88 Change projet configuration and POM for Pandacube 2023-03-14 23:30:13 +01:00
9e84eb399c Remove modules and startup delay
We don’t need them for Pandacube
2023-03-14 23:30:07 +01:00
md_5
b47ae0944c
#3444: Use same duplicate player handling for online and offline modes 2023-03-15 07:41:50 +11:00
md_5
f9712cbc7c
Minecraft 1.19.4 support 2023-03-15 03:30:00 +11:00
md_5
1b6d845530
Update lombok and maven shade 2023-02-11 10:26:59 +11:00
Outfluencer
19424aba9d
#3430: Add new fallback field to TranslatableComponent 2023-01-28 11:32:59 +11:00
Outfluencer
71ac9b34fa
#3425: Make ip command output clickable to copy ip 2023-01-28 11:19:45 +11:00
Achsion
7651d4a249
#3423: Remove empty servers from glist by default 2023-01-28 11:15:40 +11:00
md_5
f8e0bccdf0
Update README date 2023-01-01 11:17:02 +11:00
Outfluencer
a5b6eb6afa
#3417: Support uppercase &h in Alert command 2022-12-23 10:54:57 +11:00
MrKeith
41471da9db
#3405: Fix typo in ProxiedPlayer docs and add docs to ServerDisconnectEvent 2022-12-21 18:41:55 +11:00
19 changed files with 243 additions and 76 deletions

View File

@ -23,4 +23,4 @@ Binaries
--------
Precompiled binaries are available for end users on [Jenkins](https://www.spigotmc.org/go/bungeecord-dl).
(c) 2012-2022 SpigotMC Pty. Ltd.
(c) 2012-2023 SpigotMC Pty. Ltd.

View File

@ -15,7 +15,7 @@ import net.md_5.bungee.api.event.ServerConnectEvent;
import net.md_5.bungee.api.score.Scoreboard;
/**
* Represents a player who's connection is being connected to somewhere else,
* Represents a player whose connection is being connected to somewhere else,
* whether it be a remote or embedded server.
*/
public interface ProxiedPlayer extends Connection, CommandSender

View File

@ -9,6 +9,13 @@ import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.plugin.Event;
/**
* Called when the player is disconnected from a server, for example during
* server switching.
*
* If the player is kicked from a server, {@link ServerKickEvent} will be called
* instead.
*/
@Data
@AllArgsConstructor
@ToString(callSuper = false)

View File

@ -33,6 +33,7 @@ import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.event.EventBus;
import net.md_5.bungee.event.EventHandler;
import org.yaml.snakeyaml.LoaderOptions;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.Constructor;
import org.yaml.snakeyaml.introspector.PropertyUtils;
@ -64,7 +65,7 @@ public final class PluginManager
this.proxy = proxy;
// Ignore unknown entries in the plugin descriptions
Constructor yamlConstructor = new Constructor();
Constructor yamlConstructor = new Constructor( new LoaderOptions() );
PropertyUtils propertyUtils = yamlConstructor.getPropertyUtils();
propertyUtils.setSkipMissingProperties( true );
yamlConstructor.setPropertyUtils( propertyUtils );

View File

@ -38,7 +38,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<version>3.3.0</version>
<configuration>
<archive>
<manifestEntries>
@ -52,7 +52,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.3</version>
<version>3.4.1</version>
<executions>
<execution>
<phase>package</phase>

View File

@ -30,6 +30,10 @@ public final class TranslatableComponent extends BaseComponent
* The components to substitute into the translation
*/
private List<BaseComponent> with;
/**
* The fallback, if the translation is not found
*/
private String fallback;
/**
* Creates a translatable component from the original to clone it.
@ -153,6 +157,11 @@ public final class TranslatableComponent extends BaseComponent
{
String trans = TranslationRegistry.INSTANCE.translate( translate );
if ( trans.equals( translate ) && fallback != null )
{
trans = fallback;
}
Matcher matcher = format.matcher( trans );
int position = 0;
int i = 0;

View File

@ -28,7 +28,11 @@ public class TranslatableComponentSerializer extends BaseComponentSerializer imp
component.setTranslate( object.get( "translate" ).getAsString() );
if ( object.has( "with" ) )
{
component.setWith( Arrays.asList( context.<BaseComponent[]>deserialize( object.get( "with" ), BaseComponent[].class ) ) );
component.setWith( Arrays.asList( context.deserialize( object.get( "with" ), BaseComponent[].class ) ) );
}
if ( object.has( "fallback" ) )
{
component.setFallback( object.get( "fallback" ).getAsString() );
}
return component;
}
@ -43,6 +47,10 @@ public class TranslatableComponentSerializer extends BaseComponentSerializer imp
{
object.add( "with", context.serialize( src.getWith() ) );
}
if ( src.getFallback() != null )
{
object.addProperty( "fallback", src.getFallback() );
}
return object;
}
}

View File

@ -14,6 +14,7 @@ import java.util.Map;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.LoaderOptions;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.Constructor;
import org.yaml.snakeyaml.nodes.Node;
@ -29,7 +30,10 @@ public class YamlConfiguration extends ConfigurationProvider
@Override
protected Yaml initialValue()
{
Representer representer = new Representer()
DumperOptions options = new DumperOptions();
options.setDefaultFlowStyle( DumperOptions.FlowStyle.BLOCK );
Representer representer = new Representer( options )
{
{
representers.put( Configuration.class, new Represent()
@ -43,10 +47,7 @@ public class YamlConfiguration extends ConfigurationProvider
}
};
DumperOptions options = new DumperOptions();
options.setDefaultFlowStyle( DumperOptions.FlowStyle.BLOCK );
return new Yaml( new Constructor(), representer, options );
return new Yaml( new Constructor( new LoaderOptions() ), representer, options );
}
};

12
pom.xml
View File

@ -71,7 +71,7 @@
<properties>
<build.number>unknown</build.number>
<lombok.version>1.18.22</lombok.version>
<lombok.version>1.18.26</lombok.version>
<netty.version>4.1.85.Final</netty.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
@ -126,12 +126,12 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<version>3.11.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.1.2</version>
<version>3.2.1</version>
<executions>
<execution>
<phase>process-classes</phase>
@ -156,7 +156,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<version>1.20</version>
<version>1.22</version>
<executions>
<execution>
<phase>process-classes</phase>
@ -269,7 +269,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.2.0</version>
<version>3.5.0</version>
<executions>
<!-- Execute Javadoc once normally to catch any warnings -->
<execution>
@ -307,7 +307,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<version>3.0.1</version>
<executions>
<execution>
<phase>verify</phase>

View File

@ -84,7 +84,8 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_17, 0x21 ),
map( ProtocolConstants.MINECRAFT_1_19, 0x1E ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x20 ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x1F )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x1F ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x23 )
);
TO_CLIENT.registerPacket(
Login.class,
@ -98,7 +99,8 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_17, 0x26 ),
map( ProtocolConstants.MINECRAFT_1_19, 0x23 ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x25 ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x24 )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x24 ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x28 )
);
TO_CLIENT.registerPacket( Chat.class,
Chat::new,
@ -125,7 +127,8 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_17, 0x3D ),
map( ProtocolConstants.MINECRAFT_1_19, 0x3B ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x3E ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x3D )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x3D ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x41 )
);
TO_CLIENT.registerPacket(
BossBar.class,
@ -134,7 +137,8 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_15, 0x0D ),
map( ProtocolConstants.MINECRAFT_1_16, 0x0C ),
map( ProtocolConstants.MINECRAFT_1_17, 0x0D ),
map( ProtocolConstants.MINECRAFT_1_19, 0x0A )
map( ProtocolConstants.MINECRAFT_1_19, 0x0A ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0xB )
);
TO_CLIENT.registerPacket(
PlayerListItem.class, // PlayerInfo
@ -163,7 +167,8 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_16_2, 0x0F ),
map( ProtocolConstants.MINECRAFT_1_17, 0x11 ),
map( ProtocolConstants.MINECRAFT_1_19, 0x0E ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x0D )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x0D ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0xF )
);
TO_CLIENT.registerPacket(
ScoreboardObjective.class,
@ -177,7 +182,8 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_15, 0x4A ),
map( ProtocolConstants.MINECRAFT_1_17, 0x53 ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x56 ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x54 )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x54 ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x58 )
);
TO_CLIENT.registerPacket(
ScoreboardScore.class,
@ -191,7 +197,8 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_15, 0x4D ),
map( ProtocolConstants.MINECRAFT_1_17, 0x56 ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x59 ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x57 )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x57 ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x5B )
);
TO_CLIENT.registerPacket(
ScoreboardDisplay.class,
@ -205,7 +212,8 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_15, 0x43 ),
map( ProtocolConstants.MINECRAFT_1_17, 0x4C ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x4F ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x4D )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x4D ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x51 )
);
TO_CLIENT.registerPacket(
Team.class,
@ -219,7 +227,8 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_15, 0x4C ),
map( ProtocolConstants.MINECRAFT_1_17, 0x55 ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x58 ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x56 )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x56 ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x5A )
);
TO_CLIENT.registerPacket(
PluginMessage.class,
@ -234,7 +243,8 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_17, 0x18 ),
map( ProtocolConstants.MINECRAFT_1_19, 0x15 ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x16 ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x15 )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x15 ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x17 )
);
TO_CLIENT.registerPacket(
Kick.class,
@ -249,7 +259,8 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_17, 0x1A ),
map( ProtocolConstants.MINECRAFT_1_19, 0x17 ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x19 ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x17 )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x17 ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x1A )
);
TO_CLIENT.registerPacket(
Title.class,
@ -264,14 +275,16 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_17, 0x59 ),
map( ProtocolConstants.MINECRAFT_1_18, 0x5A ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x5D ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x5B )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x5B ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x5F )
);
TO_CLIENT.registerPacket(
ClearTitles.class,
ClearTitles::new,
map( ProtocolConstants.MINECRAFT_1_17, 0x10 ),
map( ProtocolConstants.MINECRAFT_1_19, 0x0D ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x0C )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x0C ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0xE )
);
TO_CLIENT.registerPacket(
Subtitle.class,
@ -279,7 +292,8 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_17, 0x57 ),
map( ProtocolConstants.MINECRAFT_1_18, 0x58 ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x5B ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x59 )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x59 ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x5D )
);
TO_CLIENT.registerPacket(
TitleTimes.class,
@ -287,14 +301,16 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_17, 0x5A ),
map( ProtocolConstants.MINECRAFT_1_18, 0x5B ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x5E ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x5C )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x5C ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x60 )
);
TO_CLIENT.registerPacket(
SystemChat.class,
SystemChat::new,
map( ProtocolConstants.MINECRAFT_1_19, 0x5F ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x62 ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x60 )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x60 ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x64 )
);
TO_CLIENT.registerPacket(
PlayerListHeaderFooter.class,
@ -312,7 +328,8 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_18, 0x5F ),
map( ProtocolConstants.MINECRAFT_1_19, 0x60 ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x63 ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x61 )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x61 ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x65 )
);
TO_CLIENT.registerPacket(
EntityStatus.class,
@ -327,7 +344,8 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_17, 0x1B ),
map( ProtocolConstants.MINECRAFT_1_19, 0x18 ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x1A ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x19 )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x19 ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x1C )
);
TO_CLIENT.registerPacket(
Commands.class,
@ -338,7 +356,8 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_16_2, 0x10 ),
map( ProtocolConstants.MINECRAFT_1_17, 0x12 ),
map( ProtocolConstants.MINECRAFT_1_19, 0x0F ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x0E )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x0E ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x10 )
);
TO_CLIENT.registerPacket(
GameState.class,
@ -349,7 +368,8 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_17, 0x1E ),
map( ProtocolConstants.MINECRAFT_1_19, 0x1B ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x1D ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x1C )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x1C ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x1F )
);
TO_CLIENT.registerPacket(
ViewDistance.class,
@ -360,24 +380,28 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_17, 0x4A ),
map( ProtocolConstants.MINECRAFT_1_19, 0x49 ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x4C ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x4B )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x4B ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x4F )
);
TO_CLIENT.registerPacket(
ServerData.class,
ServerData::new,
map( ProtocolConstants.MINECRAFT_1_19, 0x3F ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x42 ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x41 )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x41 ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x45 )
);
TO_CLIENT.registerPacket(
PlayerListItemRemove.class,
PlayerListItemRemove::new,
map( ProtocolConstants.MINECRAFT_1_19_3, 0x35 )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x35 ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x39 )
);
TO_CLIENT.registerPacket(
PlayerListItemUpdate.class,
PlayerListItemUpdate::new,
map( ProtocolConstants.MINECRAFT_1_19_3, 0x36 )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x36 ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x3A )
);
TO_SERVER.registerPacket(
@ -393,7 +417,8 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_17, 0x0F ),
map( ProtocolConstants.MINECRAFT_1_19, 0x11 ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x12 ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x11 )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x11 ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x12 )
);
TO_SERVER.registerPacket( Chat.class,
Chat::new,
@ -427,7 +452,8 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_14, 0x06 ),
map( ProtocolConstants.MINECRAFT_1_19, 0x08 ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x09 ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x08 )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x08 ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x09 )
);
TO_SERVER.registerPacket(
ClientSettings.class,
@ -439,7 +465,8 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_14, 0x05 ),
map( ProtocolConstants.MINECRAFT_1_19, 0x07 ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x08 ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x07 )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x07 ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x08 )
);
TO_SERVER.registerPacket(
PluginMessage.class,
@ -453,7 +480,8 @@ public enum Protocol
map( ProtocolConstants.MINECRAFT_1_17, 0x0A ),
map( ProtocolConstants.MINECRAFT_1_19, 0x0C ),
map( ProtocolConstants.MINECRAFT_1_19_1, 0x0D ),
map( ProtocolConstants.MINECRAFT_1_19_3, 0x0C )
map( ProtocolConstants.MINECRAFT_1_19_3, 0x0C ),
map( ProtocolConstants.MINECRAFT_1_19_4, 0x0D )
);
}
},

View File

@ -41,6 +41,7 @@ public class ProtocolConstants
public static final int MINECRAFT_1_19 = 759;
public static final int MINECRAFT_1_19_1 = 760;
public static final int MINECRAFT_1_19_3 = 761;
public static final int MINECRAFT_1_19_4 = 762;
public static final List<String> SUPPORTED_VERSIONS;
public static final List<Integer> SUPPORTED_VERSION_IDS;
@ -94,7 +95,8 @@ public class ProtocolConstants
ProtocolConstants.MINECRAFT_1_18_2,
ProtocolConstants.MINECRAFT_1_19,
ProtocolConstants.MINECRAFT_1_19_1,
ProtocolConstants.MINECRAFT_1_19_3
ProtocolConstants.MINECRAFT_1_19_3,
ProtocolConstants.MINECRAFT_1_19_4
);
if ( SNAPSHOT_SUPPORT )

View File

@ -310,6 +310,7 @@ public class Commands extends DefinedPacket
private static final Map<String, ArgumentSerializer> PROVIDERS = new HashMap<>();
private static final ArgumentSerializer[] IDS_1_19;
private static final ArgumentSerializer[] IDS_1_19_3;
private static final ArgumentSerializer[] IDS_1_19_4;
private static final Map<Class<?>, ProperArgumentSerializer<?>> PROPER_PROVIDERS = new HashMap<>();
//
private static final ArgumentSerializer<Void> VOID = new ArgumentSerializer<Void>()
@ -364,7 +365,7 @@ public class Commands extends DefinedPacket
buf.writeByte( t );
}
};
private static final ProperArgumentSerializer<FloatArgumentType> FLOAT = new ProperArgumentSerializer<FloatArgumentType>()
private static final ProperArgumentSerializer<FloatArgumentType> FLOAT_RANGE = new ProperArgumentSerializer<FloatArgumentType>()
{
@Override
protected FloatArgumentType read(ByteBuf buf)
@ -405,7 +406,7 @@ public class Commands extends DefinedPacket
return "brigadier:float";
}
};
private static final ProperArgumentSerializer<DoubleArgumentType> DOUBLE = new ProperArgumentSerializer<DoubleArgumentType>()
private static final ProperArgumentSerializer<DoubleArgumentType> DOUBLE_RANGE = new ProperArgumentSerializer<DoubleArgumentType>()
{
@Override
protected DoubleArgumentType read(ByteBuf buf)
@ -446,7 +447,7 @@ public class Commands extends DefinedPacket
return "brigadier:double";
}
};
private static final ProperArgumentSerializer<IntegerArgumentType> INTEGER = new ProperArgumentSerializer<IntegerArgumentType>()
private static final ProperArgumentSerializer<IntegerArgumentType> INTEGER_RANGE = new ProperArgumentSerializer<IntegerArgumentType>()
{
@Override
protected IntegerArgumentType read(ByteBuf buf)
@ -487,7 +488,21 @@ public class Commands extends DefinedPacket
return "brigadier:integer";
}
};
private static final ProperArgumentSerializer<LongArgumentType> LONG = new ProperArgumentSerializer<LongArgumentType>()
private static final ArgumentSerializer<Integer> INTEGER = new ArgumentSerializer<Integer>()
{
@Override
protected Integer read(ByteBuf buf)
{
return buf.readInt();
}
@Override
protected void write(ByteBuf buf, Integer t)
{
buf.writeInt( t );
}
};
private static final ProperArgumentSerializer<LongArgumentType> LONG_RANGE = new ProperArgumentSerializer<LongArgumentType>()
{
@Override
protected LongArgumentType read(ByteBuf buf)
@ -585,17 +600,17 @@ public class Commands extends DefinedPacket
register( "brigadier:bool", BOOLEAN );
PROPER_PROVIDERS.put( BoolArgumentType.class, BOOLEAN );
register( "brigadier:float", FLOAT );
PROPER_PROVIDERS.put( FloatArgumentType.class, FLOAT );
register( "brigadier:float", FLOAT_RANGE );
PROPER_PROVIDERS.put( FloatArgumentType.class, FLOAT_RANGE );
register( "brigadier:double", DOUBLE );
PROPER_PROVIDERS.put( DoubleArgumentType.class, DOUBLE );
register( "brigadier:double", DOUBLE_RANGE );
PROPER_PROVIDERS.put( DoubleArgumentType.class, DOUBLE_RANGE );
register( "brigadier:integer", INTEGER );
PROPER_PROVIDERS.put( IntegerArgumentType.class, INTEGER );
register( "brigadier:integer", INTEGER_RANGE );
PROPER_PROVIDERS.put( IntegerArgumentType.class, INTEGER_RANGE );
register( "brigadier:long", LONG ); // 1.14+
PROPER_PROVIDERS.put( LongArgumentType.class, LONG );
register( "brigadier:long", LONG_RANGE ); // 1.14+
PROPER_PROVIDERS.put( LongArgumentType.class, LONG_RANGE );
register( "brigadier:string", STRING );
PROPER_PROVIDERS.put( StringArgumentType.class, STRING );
@ -636,7 +651,7 @@ public class Commands extends DefinedPacket
register( "minecraft:item_enchantment", VOID );
register( "minecraft:entity_summon", VOID );
register( "minecraft:dimension", VOID );
register( "minecraft:time", VOID ); // 1.14
register( "minecraft:time_legacy", VOID ); // 1.14
register( "minecraft:resource_or_tag", RAW_STRING ); // 1.18.2
register( "minecraft:resource", RAW_STRING ); // 1.18.2
register( "minecraft:template_mirror", VOID ); // 1.19
@ -647,6 +662,9 @@ public class Commands extends DefinedPacket
register( "minecraft:resource_or_tag_key", RAW_STRING ); // 1.19.3
register( "minecraft:resource_key", RAW_STRING ); // 1.19.3
register( "minecraft:heightmap", VOID ); // 1.19.4
register( "minecraft:time", INTEGER ); // 1.19.4
register( "minecraft:nbt", VOID ); // 1.13 // removed
IDS_1_19 = new ArgumentSerializer[]
{
@ -692,7 +710,7 @@ public class Commands extends DefinedPacket
get( "minecraft:item_enchantment" ),
get( "minecraft:entity_summon" ),
get( "minecraft:dimension" ),
get( "minecraft:time" ),
get( "minecraft:time_legacy" ),
get( "minecraft:resource_or_tag" ),
get( "minecraft:resource" ),
get( "minecraft:template_mirror" ),
@ -742,7 +760,7 @@ public class Commands extends DefinedPacket
get( "minecraft:float_range" ),
get( "minecraft:dimension" ),
get( "minecraft:gamemode" ),
get( "minecraft:time" ),
get( "minecraft:time_legacy" ),
get( "minecraft:resource_or_tag" ),
get( "minecraft:resource_or_tag_key" ),
get( "minecraft:resource" ),
@ -751,6 +769,59 @@ public class Commands extends DefinedPacket
get( "minecraft:template_rotation" ),
get( "minecraft:uuid" )
};
IDS_1_19_4 = new ArgumentSerializer[]
{
get( "brigadier:bool" ),
get( "brigadier:float" ),
get( "brigadier:double" ),
get( "brigadier:integer" ),
get( "brigadier:long" ),
get( "brigadier:string" ),
get( "minecraft:entity" ),
get( "minecraft:game_profile" ),
get( "minecraft:block_pos" ),
get( "minecraft:column_pos" ),
get( "minecraft:vec3" ),
get( "minecraft:vec2" ),
get( "minecraft:block_state" ),
get( "minecraft:block_predicate" ),
get( "minecraft:item_stack" ),
get( "minecraft:item_predicate" ),
get( "minecraft:color" ),
get( "minecraft:component" ),
get( "minecraft:message" ),
get( "minecraft:nbt_compound_tag" ),
get( "minecraft:nbt_tag" ),
get( "minecraft:nbt_path" ),
get( "minecraft:objective" ),
get( "minecraft:objective_criteria" ),
get( "minecraft:operation" ),
get( "minecraft:particle" ),
get( "minecraft:angle" ),
get( "minecraft:rotation" ),
get( "minecraft:scoreboard_slot" ),
get( "minecraft:score_holder" ),
get( "minecraft:swizzle" ),
get( "minecraft:team" ),
get( "minecraft:item_slot" ),
get( "minecraft:resource_location" ),
get( "minecraft:function" ),
get( "minecraft:entity_anchor" ),
get( "minecraft:int_range" ),
get( "minecraft:float_range" ),
get( "minecraft:dimension" ),
get( "minecraft:gamemode" ),
get( "minecraft:time" ),
get( "minecraft:resource_or_tag" ),
get( "minecraft:resource_or_tag_key" ),
get( "minecraft:resource" ),
get( "minecraft:resource_key" ),
get( "minecraft:template_mirror" ),
get( "minecraft:template_rotation" ),
get( "minecraft:uuid" ),
get( "minecraft:heightmap" )
};
}
private static void register(String name, ArgumentSerializer serializer)
@ -1170,7 +1241,10 @@ public class Commands extends DefinedPacket
{
key = readVarInt( buf );
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_3 )
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_4 )
{
reader = IDS_1_19_4[(Integer) key];
} else if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_3 )
{
reader = IDS_1_19_3[(Integer) key];
} else

View File

@ -17,21 +17,27 @@ public class ServerData extends DefinedPacket
{
private String motd;
private String icon;
private Object icon;
private boolean preview;
private boolean enforceSecure;
@Override
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
{
if ( buf.readBoolean() )
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_4 || buf.readBoolean() )
{
motd = readString( buf, 262144 );
}
if ( buf.readBoolean() )
{
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_4 )
{
icon = DefinedPacket.readArray( buf );
} else
{
icon = readString( buf );
}
}
if ( protocolVersion < ProtocolConstants.MINECRAFT_1_19_3 )
{
@ -48,18 +54,32 @@ public class ServerData extends DefinedPacket
public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
{
if ( motd != null )
{
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_4 )
{
buf.writeBoolean( true );
}
writeString( motd, buf, 262144 );
} else
{
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_4 )
{
throw new IllegalArgumentException( "MOTD required for this version" );
}
buf.writeBoolean( false );
}
if ( icon != null )
{
buf.writeBoolean( true );
writeString( icon, buf );
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_4 )
{
DefinedPacket.writeArray( (byte[]) icon, buf );
} else
{
writeString( (String) icon, buf );
}
} else
{
buf.writeBoolean( false );

View File

@ -98,9 +98,9 @@
<scope>compile</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.29</version>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version>8.0.32</version>
<scope>runtime</scope>
</dependency>
<!-- add these back in as they are not exposed by the API -->

View File

@ -1,7 +1,10 @@
package net.md_5.bungee.command;
import java.util.Collections;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.connection.ProxiedPlayer;
public class CommandIP extends PlayerCommand
@ -26,7 +29,17 @@ public class CommandIP extends PlayerCommand
sender.sendMessage( ProxyServer.getInstance().getTranslation( "user_not_online" ) );
} else
{
sender.sendMessage( ProxyServer.getInstance().getTranslation( "command_ip", args[0], user.getSocketAddress() ) );
sender.sendMessage( new ComponentBuilder()
.appendLegacy( ProxyServer.getInstance().getTranslation( "command_ip", user.getName(), user.getSocketAddress() ) )
.event( new ClickEvent( ClickEvent.Action.COPY_TO_CLIPBOARD, user.getSocketAddress().toString() ) )
.create()
);
}
}
@Override
public Iterable<String> onTabComplete(CommandSender sender, String[] args)
{
return ( args.length == 1 ) ? super.onTabComplete( sender, args ) : Collections.emptyList();
}
}

View File

@ -762,9 +762,10 @@ public class DownstreamBridge extends PacketHandler
@Override
public void handle(ServerData serverData) throws Exception
{
serverData.setMotd( null );
serverData.setIcon( null );
con.unsafe().sendPacket( serverData );
// 1.19.4 doesn't allow empty MOTD and we probably don't want to simulate a ping event to get the "correct" one
// serverData.setMotd( null );
// serverData.setIcon( null );
// con.unsafe().sendPacket( serverData );
throw CancelSendSignal.INSTANCE;
}

View File

@ -575,14 +575,14 @@ public class InitialHandler extends PacketHandler implements PendingConnection
if ( oldName != null )
{
// TODO See #1218
oldName.disconnect( bungee.getTranslation( "already_connected_proxy" ) );
disconnect( bungee.getTranslation( "already_connected_proxy" ) );
}
// And then also for their old UUID
ProxiedPlayer oldID = bungee.getPlayer( getUniqueId() );
if ( oldID != null )
{
// TODO See #1218
oldID.disconnect( bungee.getTranslation( "already_connected_proxy" ) );
disconnect( bungee.getTranslation( "already_connected_proxy" ) );
}
} else
{

View File

@ -79,6 +79,8 @@ public abstract class EntityMap
case ProtocolConstants.MINECRAFT_1_19_1:
case ProtocolConstants.MINECRAFT_1_19_3:
return EntityMap_1_16_2.INSTANCE_1_19_1;
case ProtocolConstants.MINECRAFT_1_19_4:
return EntityMap_1_16_2.INSTANCE_1_19_4;
}
throw new RuntimeException( "Version " + version + " has no entity map" );
}

View File

@ -19,6 +19,7 @@ class EntityMap_1_16_2 extends EntityMap
static final EntityMap_1_16_2 INSTANCE_1_18 = new EntityMap_1_16_2( 0x04, 0x2D );
static final EntityMap_1_16_2 INSTANCE_1_19 = new EntityMap_1_16_2( 0x02, 0x2F );
static final EntityMap_1_16_2 INSTANCE_1_19_1 = new EntityMap_1_16_2( 0x02, 0x30 );
static final EntityMap_1_16_2 INSTANCE_1_19_4 = new EntityMap_1_16_2( 0x03, 0x30 );
//
private final int spawnPlayerId;
private final int spectateId;