Compare commits
8 Commits
fcb01544e9
...
dc1b540470
Author | SHA1 | Date | |
---|---|---|---|
dc1b540470 | |||
d4af112fdd | |||
a09a19a9f0 | |||
3e5b1b2aa1 | |||
cd62426fe8 | |||
31dea191c9 | |||
|
e71767688d | ||
|
5467e3a842 |
11
api/pom.xml
11
api/pom.xml
@ -4,13 +4,12 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>fr.pandacube.bungeecord</groupId>
|
||||||
<artifactId>bungeecord-parent</artifactId>
|
<artifactId>bungeecord-parent</artifactId>
|
||||||
<version>1.19-R0.1-SNAPSHOT</version>
|
<version>1.19-R0.1-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>net.md-5</groupId>
|
|
||||||
<artifactId>bungeecord-api</artifactId>
|
<artifactId>bungeecord-api</artifactId>
|
||||||
<version>1.19-R0.1-SNAPSHOT</version>
|
<version>1.19-R0.1-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
@ -20,25 +19,25 @@
|
|||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>fr.pandacube.bungeecord</groupId>
|
||||||
<artifactId>bungeecord-chat</artifactId>
|
<artifactId>bungeecord-chat</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>fr.pandacube.bungeecord</groupId>
|
||||||
<artifactId>bungeecord-config</artifactId>
|
<artifactId>bungeecord-config</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>fr.pandacube.bungeecord</groupId>
|
||||||
<artifactId>bungeecord-event</artifactId>
|
<artifactId>bungeecord-event</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>fr.pandacube.bungeecord</groupId>
|
||||||
<artifactId>bungeecord-protocol</artifactId>
|
<artifactId>bungeecord-protocol</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
|
@ -0,0 +1,157 @@
|
|||||||
|
package net.md_5.bungee.api.event;
|
||||||
|
|
||||||
|
import com.mojang.brigadier.arguments.ArgumentType;
|
||||||
|
import com.mojang.brigadier.arguments.IntegerArgumentType;
|
||||||
|
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||||
|
import com.mojang.brigadier.builder.ArgumentBuilder;
|
||||||
|
import com.mojang.brigadier.builder.RequiredArgumentBuilder;
|
||||||
|
import com.mojang.brigadier.suggestion.SuggestionProvider;
|
||||||
|
import com.mojang.brigadier.tree.CommandNode;
|
||||||
|
import com.mojang.brigadier.tree.RootCommandNode;
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import net.md_5.bungee.api.CommandSender;
|
||||||
|
import net.md_5.bungee.api.connection.Connection;
|
||||||
|
import net.md_5.bungee.api.plugin.Command;
|
||||||
|
import net.md_5.bungee.api.plugin.Plugin;
|
||||||
|
import net.md_5.bungee.api.plugin.PluginManager;
|
||||||
|
import net.md_5.bungee.api.plugin.TabExecutor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event called when a downstream server (on 1.13+) sends the command structure
|
||||||
|
* to a player, but before BungeeCord adds the dummy command nodes of
|
||||||
|
* registered commands.
|
||||||
|
* <p>
|
||||||
|
* BungeeCord will not overwrite the modifications made by the listeners.
|
||||||
|
*
|
||||||
|
* <h2>Usage example</h2>
|
||||||
|
* Here is a usage example of this event, to declare a command structure.
|
||||||
|
* This illustrates the commands /server and /send of Bungee.
|
||||||
|
* <pre>
|
||||||
|
* event.getRoot().addChild( LiteralArgumentBuilder.<CommandSender>literal( "server" )
|
||||||
|
* .requires( sender -> sender.hasPermission( "bungeecord.command.server" ) )
|
||||||
|
* .executes( a -> 0 )
|
||||||
|
* .then( RequiredArgumentBuilder.argument( "serverName", StringArgumentType.greedyString() )
|
||||||
|
* .suggests( SuggestionRegistry.ASK_SERVER )
|
||||||
|
* )
|
||||||
|
* .build()
|
||||||
|
* );
|
||||||
|
* event.getRoot().addChild( LiteralArgumentBuilder.<CommandSender>literal( "send" )
|
||||||
|
* .requires( sender -> sender.hasPermission( "bungeecord.command.send" ) )
|
||||||
|
* .then( RequiredArgumentBuilder.argument( "playerName", StringArgumentType.word() )
|
||||||
|
* .suggests( SuggestionRegistry.ASK_SERVER )
|
||||||
|
* .then( RequiredArgumentBuilder.argument( "serverName", StringArgumentType.greedyString() )
|
||||||
|
* .suggests( SuggestionRegistry.ASK_SERVER )
|
||||||
|
* )
|
||||||
|
* )
|
||||||
|
* .build()
|
||||||
|
* );
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* <h2>Flag a {@link CommandNode} as executable or not</h2>
|
||||||
|
* The implementation of a {@link com.mojang.brigadier.Command Command} used in
|
||||||
|
* {@link ArgumentBuilder#executes(com.mojang.brigadier.Command)} will never be
|
||||||
|
* executed. This will only tell to the client if the current node is
|
||||||
|
* executable or not.
|
||||||
|
* <ul>
|
||||||
|
* <li>
|
||||||
|
* {@code builder.executes(null)} (default) to mark the node as not
|
||||||
|
* executable.
|
||||||
|
* </li>
|
||||||
|
* <li>
|
||||||
|
* {@code builder.executes(a -> 0)}, or any non null argument, to mark
|
||||||
|
* the node as executable (the child arguments are displayed as
|
||||||
|
* optional).
|
||||||
|
* </li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* <h2>{@link CommandNode}’s suggestions management</h2>
|
||||||
|
* The implementation of a SuggestionProvider used in
|
||||||
|
* {@link RequiredArgumentBuilder#suggests(SuggestionProvider)} will never be
|
||||||
|
* executed. This will only tell to the client how to deal with the
|
||||||
|
* auto-completion of the argument.
|
||||||
|
* <ul>
|
||||||
|
* <li>
|
||||||
|
* {@code builder.suggests(null)} (default) to disable auto-completion
|
||||||
|
* for this argument.
|
||||||
|
* </li>
|
||||||
|
* <li>
|
||||||
|
* {@code builder.suggests(SuggestionRegistry.ALL_RECIPES)} to suggest
|
||||||
|
* Minecraft’s recipes.
|
||||||
|
* </li>
|
||||||
|
* <li>
|
||||||
|
* {@code builder.suggests(SuggestionRegistry.AVAILABLE_SOUNDS)} to
|
||||||
|
* suggest Minecraft’s default sound identifiers.
|
||||||
|
* </li>
|
||||||
|
* <li>
|
||||||
|
* {@code builder.suggests(SuggestionRegistry.SUMMONABLE_ENTITIES)} to
|
||||||
|
* suggest Minecraft’s default summonable entities identifiers.
|
||||||
|
* </li>
|
||||||
|
* <li>
|
||||||
|
* {@code builder.suggests(SuggestionRegistry.ASK_SERVER)}, or any
|
||||||
|
* other non null argument, to make the Minecraft client ask
|
||||||
|
* auto-completion to the server. Any specified implementation of
|
||||||
|
* {@link SuggestionProvider} will never be executed.
|
||||||
|
* </li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* <h2>Argument types</h2>
|
||||||
|
* When building a new argument command node using
|
||||||
|
* {@link RequiredArgumentBuilder#argument(String, ArgumentType)}, you have to
|
||||||
|
* specify an {@link ArgumentType}. You can use all subclasses of
|
||||||
|
* {@link ArgumentType} provided with brigadier (for instance,
|
||||||
|
* {@link StringArgumentType} or {@link IntegerArgumentType}), or call any
|
||||||
|
* {@code ArgumentRegistry.minecraft*()} methods to use a {@code minecraft:*}
|
||||||
|
* argument type.
|
||||||
|
*
|
||||||
|
* <h2>Limitations with brigadier API</h2>
|
||||||
|
* This event is only used for the client to show command syntax, suggest
|
||||||
|
* sub-commands and color the arguments in the chat box. The command execution
|
||||||
|
* needs to be implemented using {@link PluginManager#registerCommand(Plugin,
|
||||||
|
* Command)} and the server-side tab-completion using {@link TabCompleteEvent}
|
||||||
|
* or {@link TabExecutor}.
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class CommandsDeclareEvent extends TargetedEvent
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Wether or not the command tree is modified by this event.
|
||||||
|
*
|
||||||
|
* If this value is set to true, BungeeCord will ensure that the
|
||||||
|
* modifications made in the command tree, will be sent to the player.
|
||||||
|
* If this is false, the modifications may not be taken into account.
|
||||||
|
*
|
||||||
|
* When calling {@link #getRoot()}, this value is automatically set
|
||||||
|
* to true.
|
||||||
|
*/
|
||||||
|
@Setter(value = AccessLevel.NONE)
|
||||||
|
private boolean modified = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The root command node of the command structure that will be send to the
|
||||||
|
* player.
|
||||||
|
*/
|
||||||
|
private final RootCommandNode<CommandSender> root;
|
||||||
|
|
||||||
|
public CommandsDeclareEvent(Connection sender, Connection receiver, RootCommandNode<CommandSender> root)
|
||||||
|
{
|
||||||
|
super( sender, receiver );
|
||||||
|
this.root = root;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The root command node of the command structure that will be send to the
|
||||||
|
* player.
|
||||||
|
* @return The root command node
|
||||||
|
*/
|
||||||
|
public RootCommandNode<CommandSender> getRoot()
|
||||||
|
{
|
||||||
|
modified = true;
|
||||||
|
return root;
|
||||||
|
}
|
||||||
|
}
|
@ -9,7 +9,9 @@ import net.md_5.bungee.api.plugin.Cancellable;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Event called when a player uses tab completion.
|
* Event called when a player uses tab completion.
|
||||||
|
* @deprecated please use {@link TabCompleteRequestEvent} to support 1.13+ suggestions.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
@Data
|
@Data
|
||||||
@ToString(callSuper = true)
|
@ToString(callSuper = true)
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ -0,0 +1,85 @@
|
|||||||
|
package net.md_5.bungee.api.event;
|
||||||
|
|
||||||
|
import com.google.common.base.Preconditions;
|
||||||
|
import com.mojang.brigadier.context.StringRange;
|
||||||
|
import com.mojang.brigadier.suggestion.Suggestions;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
import net.md_5.bungee.api.connection.Connection;
|
||||||
|
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||||
|
import net.md_5.bungee.api.plugin.Cancellable;
|
||||||
|
import net.md_5.bungee.protocol.ProtocolConstants;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event called when a player uses tab completion.
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class TabCompleteRequestEvent extends TargetedEvent implements Cancellable
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cancelled state.
|
||||||
|
*/
|
||||||
|
private boolean cancelled;
|
||||||
|
/**
|
||||||
|
* The message the player has already entered.
|
||||||
|
*/
|
||||||
|
private final String cursor;
|
||||||
|
/**
|
||||||
|
* Range corresponding to the last word of {@link #getCursor()}.
|
||||||
|
* If you want your suggestions to be compatible with 1.12 and older
|
||||||
|
* clients, you need to {@link #setSuggestions(Suggestions)} with
|
||||||
|
* a range equals to this one.
|
||||||
|
* For 1.13 and newer clients, any other range that cover any part of
|
||||||
|
* {@link #getCursor()} is fine.<br>
|
||||||
|
* To check if the client supports custom ranges, use
|
||||||
|
* {@link #supportsCustomRange()}.
|
||||||
|
*/
|
||||||
|
private final StringRange legacyCompatibleRange;
|
||||||
|
/**
|
||||||
|
* The suggestions that will be sent to the client. If this list is empty,
|
||||||
|
* the request will be forwarded to the server.
|
||||||
|
*/
|
||||||
|
private Suggestions suggestions;
|
||||||
|
|
||||||
|
public TabCompleteRequestEvent(Connection sender, Connection receiver, String cursor, StringRange legacyCompatibleRange, Suggestions suggestions)
|
||||||
|
{
|
||||||
|
super( sender, receiver );
|
||||||
|
this.cursor = cursor;
|
||||||
|
this.legacyCompatibleRange = legacyCompatibleRange;
|
||||||
|
this.suggestions = suggestions;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the suggestions that will be sent to the client.
|
||||||
|
* If this list is empty, the request will be forwarded to the server.
|
||||||
|
* @param suggestions the new Suggestions. Cannot be null.
|
||||||
|
* @throws IllegalArgumentException if the client is on 1.12 or lower and
|
||||||
|
* {@code suggestions.getRange()} is not equals to {@link #legacyCompatibleRange}.
|
||||||
|
*/
|
||||||
|
public void setSuggestions(Suggestions suggestions)
|
||||||
|
{
|
||||||
|
Preconditions.checkNotNull( suggestions );
|
||||||
|
Preconditions.checkArgument( supportsCustomRange() || legacyCompatibleRange.equals( suggestions.getRange() ),
|
||||||
|
"Clients on 1.12 or lower versions don't support the provided range for tab-completion: " + suggestions.getRange()
|
||||||
|
+ ". Please use TabCompleteRequestEvent.getLegacyCompatibleRange() for legacy clients." );
|
||||||
|
this.suggestions = suggestions;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convenient method to tell if the client supports custom range for
|
||||||
|
* suggestions.
|
||||||
|
* If the client is on 1.13 or above, this methods returns true, and any
|
||||||
|
* range can be used for {@link #setSuggestions(Suggestions)}. Otherwise,
|
||||||
|
* it returns false and the defined range must be equals to
|
||||||
|
* {@link #legacyCompatibleRange}.
|
||||||
|
* @return true if the client is on 1.13 or newer version, false otherwise.
|
||||||
|
*/
|
||||||
|
public boolean supportsCustomRange()
|
||||||
|
{
|
||||||
|
return ( (ProxiedPlayer) getSender() ).getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_1_13;
|
||||||
|
}
|
||||||
|
}
|
@ -4,13 +4,12 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>fr.pandacube.bungeecord</groupId>
|
||||||
<artifactId>bungeecord-parent</artifactId>
|
<artifactId>bungeecord-parent</artifactId>
|
||||||
<version>1.19-R0.1-SNAPSHOT</version>
|
<version>1.19-R0.1-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>net.md-5</groupId>
|
|
||||||
<artifactId>bungeecord-bootstrap</artifactId>
|
<artifactId>bungeecord-bootstrap</artifactId>
|
||||||
<version>1.19-R0.1-SNAPSHOT</version>
|
<version>1.19-R0.1-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
@ -21,14 +20,12 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<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.compiler.source>1.6</maven.compiler.source>
|
|
||||||
<maven.compiler.target>1.6</maven.compiler.target>
|
|
||||||
<maven.build.timestamp.format>yyyyMMdd</maven.build.timestamp.format>
|
<maven.build.timestamp.format>yyyyMMdd</maven.build.timestamp.format>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>fr.pandacube.bungeecord</groupId>
|
||||||
<artifactId>bungeecord-proxy</artifactId>
|
<artifactId>bungeecord-proxy</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
|
@ -4,13 +4,12 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>fr.pandacube.bungeecord</groupId>
|
||||||
<artifactId>bungeecord-parent</artifactId>
|
<artifactId>bungeecord-parent</artifactId>
|
||||||
<version>1.19-R0.1-SNAPSHOT</version>
|
<version>1.19-R0.1-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>net.md-5</groupId>
|
|
||||||
<artifactId>bungeecord-chat</artifactId>
|
<artifactId>bungeecord-chat</artifactId>
|
||||||
<version>1.19-R0.1-SNAPSHOT</version>
|
<version>1.19-R0.1-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
@ -22,7 +21,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.code.gson</groupId>
|
<groupId>com.google.code.gson</groupId>
|
||||||
<artifactId>gson</artifactId>
|
<artifactId>gson</artifactId>
|
||||||
<version>2.8.9</version>
|
<version>2.10</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -4,13 +4,12 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>fr.pandacube.bungeecord</groupId>
|
||||||
<artifactId>bungeecord-parent</artifactId>
|
<artifactId>bungeecord-parent</artifactId>
|
||||||
<version>1.19-R0.1-SNAPSHOT</version>
|
<version>1.19-R0.1-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>net.md-5</groupId>
|
|
||||||
<artifactId>bungeecord-config</artifactId>
|
<artifactId>bungeecord-config</artifactId>
|
||||||
<version>1.19-R0.1-SNAPSHOT</version>
|
<version>1.19-R0.1-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
@ -22,7 +21,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.code.gson</groupId>
|
<groupId>com.google.code.gson</groupId>
|
||||||
<artifactId>gson</artifactId>
|
<artifactId>gson</artifactId>
|
||||||
<version>2.8.9</version>
|
<version>2.10</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
@ -4,13 +4,12 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>fr.pandacube.bungeecord</groupId>
|
||||||
<artifactId>bungeecord-parent</artifactId>
|
<artifactId>bungeecord-parent</artifactId>
|
||||||
<version>1.19-R0.1-SNAPSHOT</version>
|
<version>1.19-R0.1-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>net.md-5</groupId>
|
|
||||||
<artifactId>bungeecord-event</artifactId>
|
<artifactId>bungeecord-event</artifactId>
|
||||||
<version>1.19-R0.1-SNAPSHOT</version>
|
<version>1.19-R0.1-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
@ -4,13 +4,12 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>fr.pandacube.bungeecord</groupId>
|
||||||
<artifactId>bungeecord-parent</artifactId>
|
<artifactId>bungeecord-parent</artifactId>
|
||||||
<version>1.19-R0.1-SNAPSHOT</version>
|
<version>1.19-R0.1-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>net.md-5</groupId>
|
|
||||||
<artifactId>bungeecord-log</artifactId>
|
<artifactId>bungeecord-log</artifactId>
|
||||||
<version>1.19-R0.1-SNAPSHOT</version>
|
<version>1.19-R0.1-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
@ -26,7 +25,7 @@
|
|||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>fr.pandacube.bungeecord</groupId>
|
||||||
<artifactId>bungeecord-chat</artifactId>
|
<artifactId>bungeecord-chat</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project-shared-configuration>
|
|
||||||
<!--
|
|
||||||
This file contains additional configuration written by modules in the NetBeans IDE.
|
|
||||||
The configuration is intended to be shared among all the users of project and
|
|
||||||
therefore it is assumed to be part of version control checkout.
|
|
||||||
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
|
|
||||||
-->
|
|
||||||
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
|
|
||||||
<!--
|
|
||||||
Properties that influence various parts of the IDE, especially code formatting and the like.
|
|
||||||
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
|
|
||||||
That way multiple projects can share the same settings (useful for formatting rules for example).
|
|
||||||
Any value defined here will override the pom.xml file value but is only applicable to the current project.
|
|
||||||
-->
|
|
||||||
<org-netbeans-modules-editor-indent.CodeStyle.usedProfile>project</org-netbeans-modules-editor-indent.CodeStyle.usedProfile>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.classDeclBracePlacement>NEW_LINE</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.classDeclBracePlacement>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.otherBracePlacement>NEW_LINE</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.otherBracePlacement>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.methodDeclBracePlacement>NEW_LINE</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.methodDeclBracePlacement>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinMethodCallParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinMethodCallParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinSwitchParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinSwitchParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinCatchParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinCatchParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinTryParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinTryParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinSynchronizedParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinSynchronizedParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinArrayInitBrackets>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinArrayInitBrackets>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinWhileParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinWhileParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinIfParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinIfParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinForParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinForParens>
|
|
||||||
</properties>
|
|
||||||
</project-shared-configuration>
|
|
@ -1,20 +0,0 @@
|
|||||||
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<groupId>net.md-5</groupId>
|
|
||||||
<artifactId>bungeecord-module</artifactId>
|
|
||||||
<version>1.19-R0.1-SNAPSHOT</version>
|
|
||||||
<relativePath>../pom.xml</relativePath>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<groupId>net.md-5</groupId>
|
|
||||||
<artifactId>bungeecord-module-cmd-alert</artifactId>
|
|
||||||
<version>1.19-R0.1-SNAPSHOT</version>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
|
|
||||||
<name>cmd_alert</name>
|
|
||||||
<description>Provides the alert and alertraw commands</description>
|
|
||||||
</project>
|
|
@ -1,46 +0,0 @@
|
|||||||
package net.md_5.bungee.module.cmd.alert;
|
|
||||||
|
|
||||||
import net.md_5.bungee.api.ChatColor;
|
|
||||||
import net.md_5.bungee.api.CommandSender;
|
|
||||||
import net.md_5.bungee.api.ProxyServer;
|
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
|
||||||
import net.md_5.bungee.api.plugin.Command;
|
|
||||||
|
|
||||||
public class CommandAlert extends Command
|
|
||||||
{
|
|
||||||
|
|
||||||
public CommandAlert()
|
|
||||||
{
|
|
||||||
super( "alert", "bungeecord.command.alert" );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void execute(CommandSender sender, String[] args)
|
|
||||||
{
|
|
||||||
if ( args.length == 0 )
|
|
||||||
{
|
|
||||||
sender.sendMessage( ProxyServer.getInstance().getTranslation( "message_needed" ) );
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
if ( args[0].startsWith( "&h" ) )
|
|
||||||
{
|
|
||||||
// Remove &h
|
|
||||||
args[0] = args[0].substring( 2, args[0].length() );
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
builder.append( ProxyServer.getInstance().getTranslation( "alert" ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
for ( String s : args )
|
|
||||||
{
|
|
||||||
builder.append( ChatColor.translateAlternateColorCodes( '&', s ) );
|
|
||||||
builder.append( " " );
|
|
||||||
}
|
|
||||||
|
|
||||||
String message = builder.substring( 0, builder.length() - 1 );
|
|
||||||
|
|
||||||
ProxyServer.getInstance().broadcast( TextComponent.fromLegacyText( message ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,56 +0,0 @@
|
|||||||
package net.md_5.bungee.module.cmd.alert;
|
|
||||||
|
|
||||||
import com.google.common.base.Joiner;
|
|
||||||
import net.md_5.bungee.api.ChatColor;
|
|
||||||
import net.md_5.bungee.api.CommandSender;
|
|
||||||
import net.md_5.bungee.api.ProxyServer;
|
|
||||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
|
||||||
import net.md_5.bungee.api.chat.HoverEvent;
|
|
||||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
|
||||||
import net.md_5.bungee.api.plugin.Command;
|
|
||||||
import net.md_5.bungee.chat.ComponentSerializer;
|
|
||||||
|
|
||||||
public class CommandAlertRaw extends Command
|
|
||||||
{
|
|
||||||
|
|
||||||
public CommandAlertRaw()
|
|
||||||
{
|
|
||||||
super( "alertraw", "bungeecord.command.alert" );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void execute(CommandSender sender, String[] args)
|
|
||||||
{
|
|
||||||
if ( args.length == 0 )
|
|
||||||
{
|
|
||||||
sender.sendMessage( ProxyServer.getInstance().getTranslation( "message_needed" ) );
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
String message = Joiner.on( ' ' ).join( args );
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
ProxyServer.getInstance().broadcast( ComponentSerializer.parse( message ) );
|
|
||||||
} catch ( Exception e )
|
|
||||||
{
|
|
||||||
Throwable error = e;
|
|
||||||
while ( error.getCause() != null )
|
|
||||||
{
|
|
||||||
error = error.getCause();
|
|
||||||
}
|
|
||||||
if ( sender instanceof ProxiedPlayer )
|
|
||||||
{
|
|
||||||
sender.sendMessage( new ComponentBuilder( ProxyServer.getInstance().getTranslation( "error_occurred_player" ) )
|
|
||||||
.event( new HoverEvent( HoverEvent.Action.SHOW_TEXT, new ComponentBuilder( error.getMessage() )
|
|
||||||
.color( ChatColor.RED )
|
|
||||||
.create() ) )
|
|
||||||
.create()
|
|
||||||
);
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
sender.sendMessage( ProxyServer.getInstance().getTranslation( "error_occurred_console", error.getMessage() ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
package net.md_5.bungee.module.cmd.alert;
|
|
||||||
|
|
||||||
import net.md_5.bungee.api.plugin.Plugin;
|
|
||||||
|
|
||||||
public class PluginAlert extends Plugin
|
|
||||||
{
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onEnable()
|
|
||||||
{
|
|
||||||
getProxy().getPluginManager().registerCommand( this, new CommandAlert() );
|
|
||||||
getProxy().getPluginManager().registerCommand( this, new CommandAlertRaw() );
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,5 +0,0 @@
|
|||||||
name: ${project.name}
|
|
||||||
main: net.md_5.bungee.module.cmd.alert.PluginAlert
|
|
||||||
version: ${describe}
|
|
||||||
description: ${project.description}
|
|
||||||
author: ${module.author}
|
|
@ -1,31 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project-shared-configuration>
|
|
||||||
<!--
|
|
||||||
This file contains additional configuration written by modules in the NetBeans IDE.
|
|
||||||
The configuration is intended to be shared among all the users of project and
|
|
||||||
therefore it is assumed to be part of version control checkout.
|
|
||||||
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
|
|
||||||
-->
|
|
||||||
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
|
|
||||||
<!--
|
|
||||||
Properties that influence various parts of the IDE, especially code formatting and the like.
|
|
||||||
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
|
|
||||||
That way multiple projects can share the same settings (useful for formatting rules for example).
|
|
||||||
Any value defined here will override the pom.xml file value but is only applicable to the current project.
|
|
||||||
-->
|
|
||||||
<org-netbeans-modules-editor-indent.CodeStyle.usedProfile>project</org-netbeans-modules-editor-indent.CodeStyle.usedProfile>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.classDeclBracePlacement>NEW_LINE</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.classDeclBracePlacement>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.otherBracePlacement>NEW_LINE</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.otherBracePlacement>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.methodDeclBracePlacement>NEW_LINE</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.methodDeclBracePlacement>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinMethodCallParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinMethodCallParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinSwitchParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinSwitchParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinCatchParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinCatchParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinTryParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinTryParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinSynchronizedParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinSynchronizedParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinArrayInitBrackets>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinArrayInitBrackets>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinWhileParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinWhileParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinIfParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinIfParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinForParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinForParens>
|
|
||||||
</properties>
|
|
||||||
</project-shared-configuration>
|
|
@ -1,20 +0,0 @@
|
|||||||
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<groupId>net.md-5</groupId>
|
|
||||||
<artifactId>bungeecord-module</artifactId>
|
|
||||||
<version>1.19-R0.1-SNAPSHOT</version>
|
|
||||||
<relativePath>../pom.xml</relativePath>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<groupId>net.md-5</groupId>
|
|
||||||
<artifactId>bungeecord-module-cmd-find</artifactId>
|
|
||||||
<version>1.19-R0.1-SNAPSHOT</version>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
|
|
||||||
<name>cmd_find</name>
|
|
||||||
<description>Provides the find command</description>
|
|
||||||
</project>
|
|
@ -1,34 +0,0 @@
|
|||||||
package net.md_5.bungee.module.cmd.find;
|
|
||||||
|
|
||||||
import net.md_5.bungee.api.CommandSender;
|
|
||||||
import net.md_5.bungee.api.ProxyServer;
|
|
||||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
|
||||||
import net.md_5.bungee.command.PlayerCommand;
|
|
||||||
|
|
||||||
public class CommandFind extends PlayerCommand
|
|
||||||
{
|
|
||||||
|
|
||||||
public CommandFind()
|
|
||||||
{
|
|
||||||
super( "find", "bungeecord.command.find" );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void execute(CommandSender sender, String[] args)
|
|
||||||
{
|
|
||||||
if ( args.length != 1 )
|
|
||||||
{
|
|
||||||
sender.sendMessage( ProxyServer.getInstance().getTranslation( "username_needed" ) );
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
ProxiedPlayer player = ProxyServer.getInstance().getPlayer( args[0] );
|
|
||||||
if ( player == null || player.getServer() == null )
|
|
||||||
{
|
|
||||||
sender.sendMessage( ProxyServer.getInstance().getTranslation( "user_not_online" ) );
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
sender.sendMessage( ProxyServer.getInstance().getTranslation( "user_online_at", player.getName(), player.getServer().getInfo().getName() ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
package net.md_5.bungee.module.cmd.find;
|
|
||||||
|
|
||||||
import net.md_5.bungee.api.plugin.Plugin;
|
|
||||||
|
|
||||||
public class PluginFind extends Plugin
|
|
||||||
{
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onEnable()
|
|
||||||
{
|
|
||||||
getProxy().getPluginManager().registerCommand( this, new CommandFind() );
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,5 +0,0 @@
|
|||||||
name: ${project.name}
|
|
||||||
main: net.md_5.bungee.module.cmd.find.PluginFind
|
|
||||||
version: ${describe}
|
|
||||||
description: ${project.description}
|
|
||||||
author: ${module.author}
|
|
@ -1,31 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project-shared-configuration>
|
|
||||||
<!--
|
|
||||||
This file contains additional configuration written by modules in the NetBeans IDE.
|
|
||||||
The configuration is intended to be shared among all the users of project and
|
|
||||||
therefore it is assumed to be part of version control checkout.
|
|
||||||
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
|
|
||||||
-->
|
|
||||||
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
|
|
||||||
<!--
|
|
||||||
Properties that influence various parts of the IDE, especially code formatting and the like.
|
|
||||||
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
|
|
||||||
That way multiple projects can share the same settings (useful for formatting rules for example).
|
|
||||||
Any value defined here will override the pom.xml file value but is only applicable to the current project.
|
|
||||||
-->
|
|
||||||
<org-netbeans-modules-editor-indent.CodeStyle.usedProfile>project</org-netbeans-modules-editor-indent.CodeStyle.usedProfile>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.classDeclBracePlacement>NEW_LINE</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.classDeclBracePlacement>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.otherBracePlacement>NEW_LINE</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.otherBracePlacement>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.methodDeclBracePlacement>NEW_LINE</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.methodDeclBracePlacement>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinMethodCallParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinMethodCallParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinSwitchParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinSwitchParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinCatchParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinCatchParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinTryParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinTryParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinSynchronizedParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinSynchronizedParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinArrayInitBrackets>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinArrayInitBrackets>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinWhileParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinWhileParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinIfParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinIfParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinForParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinForParens>
|
|
||||||
</properties>
|
|
||||||
</project-shared-configuration>
|
|
@ -1,20 +0,0 @@
|
|||||||
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<groupId>net.md-5</groupId>
|
|
||||||
<artifactId>bungeecord-module</artifactId>
|
|
||||||
<version>1.19-R0.1-SNAPSHOT</version>
|
|
||||||
<relativePath>../pom.xml</relativePath>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<groupId>net.md-5</groupId>
|
|
||||||
<artifactId>bungeecord-module-cmd-kick</artifactId>
|
|
||||||
<version>1.19-R0.1-SNAPSHOT</version>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
|
|
||||||
<name>cmd_kick</name>
|
|
||||||
<description>Provides the gkick command</description>
|
|
||||||
</project>
|
|
@ -1,72 +0,0 @@
|
|||||||
package net.md_5.bungee.module.cmd.kick;
|
|
||||||
|
|
||||||
import com.google.common.base.Joiner;
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Set;
|
|
||||||
import net.md_5.bungee.api.ChatColor;
|
|
||||||
import net.md_5.bungee.api.CommandSender;
|
|
||||||
import net.md_5.bungee.api.ProxyServer;
|
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
|
||||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
|
||||||
import net.md_5.bungee.api.plugin.Command;
|
|
||||||
import net.md_5.bungee.api.plugin.TabExecutor;
|
|
||||||
|
|
||||||
public class CommandKick extends Command implements TabExecutor
|
|
||||||
{
|
|
||||||
|
|
||||||
public CommandKick()
|
|
||||||
{
|
|
||||||
super( "gkick", "bungeecord.command.kick" );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void execute(CommandSender sender, String[] args)
|
|
||||||
{
|
|
||||||
if ( args.length == 0 )
|
|
||||||
{
|
|
||||||
sender.sendMessage( ProxyServer.getInstance().getTranslation( "username_needed" ) );
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
ProxiedPlayer player = ProxyServer.getInstance().getPlayer( args[0] );
|
|
||||||
|
|
||||||
if ( player == null )
|
|
||||||
{
|
|
||||||
sender.sendMessage( TextComponent.fromLegacyText( ProxyServer.getInstance().getTranslation( "user_not_online" ) ) );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( args.length == 1 )
|
|
||||||
{
|
|
||||||
player.disconnect( TextComponent.fromLegacyText( ProxyServer.getInstance().getTranslation( "kick_message" ) ) );
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
String[] reason = new String[ args.length - 1 ];
|
|
||||||
System.arraycopy( args, 1, reason, 0, reason.length );
|
|
||||||
player.disconnect( TextComponent.fromLegacyText( ChatColor.translateAlternateColorCodes( '&', Joiner.on( ' ' ).join( reason ) ) ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Iterable<String> onTabComplete(CommandSender sender, String[] args)
|
|
||||||
{
|
|
||||||
if ( args.length == 1 )
|
|
||||||
{
|
|
||||||
Set<String> matches = new HashSet<>();
|
|
||||||
String search = args[0].toLowerCase( Locale.ROOT );
|
|
||||||
for ( ProxiedPlayer player : ProxyServer.getInstance().getPlayers() )
|
|
||||||
{
|
|
||||||
if ( player.getName().toLowerCase( Locale.ROOT ).startsWith( search ) )
|
|
||||||
{
|
|
||||||
matches.add( player.getName() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return matches;
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
return ImmutableSet.of();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
package net.md_5.bungee.module.cmd.kick;
|
|
||||||
|
|
||||||
import net.md_5.bungee.api.plugin.Plugin;
|
|
||||||
|
|
||||||
public class PluginKick extends Plugin
|
|
||||||
{
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onEnable()
|
|
||||||
{
|
|
||||||
getProxy().getPluginManager().registerCommand( this, new CommandKick() );
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,5 +0,0 @@
|
|||||||
name: ${project.name}
|
|
||||||
main: net.md_5.bungee.module.cmd.kick.PluginKick
|
|
||||||
version: ${describe}
|
|
||||||
description: ${project.description}
|
|
||||||
author: ${module.author}
|
|
@ -1,31 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project-shared-configuration>
|
|
||||||
<!--
|
|
||||||
This file contains additional configuration written by modules in the NetBeans IDE.
|
|
||||||
The configuration is intended to be shared among all the users of project and
|
|
||||||
therefore it is assumed to be part of version control checkout.
|
|
||||||
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
|
|
||||||
-->
|
|
||||||
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
|
|
||||||
<!--
|
|
||||||
Properties that influence various parts of the IDE, especially code formatting and the like.
|
|
||||||
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
|
|
||||||
That way multiple projects can share the same settings (useful for formatting rules for example).
|
|
||||||
Any value defined here will override the pom.xml file value but is only applicable to the current project.
|
|
||||||
-->
|
|
||||||
<org-netbeans-modules-editor-indent.CodeStyle.usedProfile>project</org-netbeans-modules-editor-indent.CodeStyle.usedProfile>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.classDeclBracePlacement>NEW_LINE</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.classDeclBracePlacement>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.otherBracePlacement>NEW_LINE</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.otherBracePlacement>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.methodDeclBracePlacement>NEW_LINE</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.methodDeclBracePlacement>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinMethodCallParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinMethodCallParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinSwitchParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinSwitchParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinCatchParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinCatchParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinTryParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinTryParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinSynchronizedParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinSynchronizedParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinArrayInitBrackets>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinArrayInitBrackets>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinWhileParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinWhileParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinIfParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinIfParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinForParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinForParens>
|
|
||||||
</properties>
|
|
||||||
</project-shared-configuration>
|
|
@ -1,20 +0,0 @@
|
|||||||
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<groupId>net.md-5</groupId>
|
|
||||||
<artifactId>bungeecord-module</artifactId>
|
|
||||||
<version>1.19-R0.1-SNAPSHOT</version>
|
|
||||||
<relativePath>../pom.xml</relativePath>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<groupId>net.md-5</groupId>
|
|
||||||
<artifactId>bungeecord-module-cmd-list</artifactId>
|
|
||||||
<version>1.19-R0.1-SNAPSHOT</version>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
|
|
||||||
<name>cmd_list</name>
|
|
||||||
<description>Provides the glist command</description>
|
|
||||||
</project>
|
|
@ -1,47 +0,0 @@
|
|||||||
package net.md_5.bungee.module.cmd.list;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import net.md_5.bungee.Util;
|
|
||||||
import net.md_5.bungee.api.ChatColor;
|
|
||||||
import net.md_5.bungee.api.CommandSender;
|
|
||||||
import net.md_5.bungee.api.ProxyServer;
|
|
||||||
import net.md_5.bungee.api.config.ServerInfo;
|
|
||||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
|
||||||
import net.md_5.bungee.api.plugin.Command;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Command to list all players connected to the proxy.
|
|
||||||
*/
|
|
||||||
public class CommandList extends Command
|
|
||||||
{
|
|
||||||
|
|
||||||
public CommandList()
|
|
||||||
{
|
|
||||||
super( "glist", "bungeecord.command.list" );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void execute(CommandSender sender, String[] args)
|
|
||||||
{
|
|
||||||
for ( ServerInfo server : ProxyServer.getInstance().getServers().values() )
|
|
||||||
{
|
|
||||||
if ( !server.canAccess( sender ) )
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<String> players = new ArrayList<>();
|
|
||||||
for ( ProxiedPlayer player : server.getPlayers() )
|
|
||||||
{
|
|
||||||
players.add( player.getDisplayName() );
|
|
||||||
}
|
|
||||||
Collections.sort( players, String.CASE_INSENSITIVE_ORDER );
|
|
||||||
|
|
||||||
sender.sendMessage( ProxyServer.getInstance().getTranslation( "command_list", server.getName(), server.getPlayers().size(), Util.format( players, ChatColor.RESET + ", " ) ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
sender.sendMessage( ProxyServer.getInstance().getTranslation( "total_players", ProxyServer.getInstance().getOnlineCount() ) );
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
package net.md_5.bungee.module.cmd.list;
|
|
||||||
|
|
||||||
import net.md_5.bungee.api.plugin.Plugin;
|
|
||||||
|
|
||||||
public class PluginList extends Plugin
|
|
||||||
{
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onEnable()
|
|
||||||
{
|
|
||||||
getProxy().getPluginManager().registerCommand( this, new CommandList() );
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,5 +0,0 @@
|
|||||||
name: ${project.name}
|
|
||||||
main: net.md_5.bungee.module.cmd.list.PluginList
|
|
||||||
version: ${describe}
|
|
||||||
description: ${project.description}
|
|
||||||
author: ${module.author}
|
|
@ -1,31 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project-shared-configuration>
|
|
||||||
<!--
|
|
||||||
This file contains additional configuration written by modules in the NetBeans IDE.
|
|
||||||
The configuration is intended to be shared among all the users of project and
|
|
||||||
therefore it is assumed to be part of version control checkout.
|
|
||||||
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
|
|
||||||
-->
|
|
||||||
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
|
|
||||||
<!--
|
|
||||||
Properties that influence various parts of the IDE, especially code formatting and the like.
|
|
||||||
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
|
|
||||||
That way multiple projects can share the same settings (useful for formatting rules for example).
|
|
||||||
Any value defined here will override the pom.xml file value but is only applicable to the current project.
|
|
||||||
-->
|
|
||||||
<org-netbeans-modules-editor-indent.CodeStyle.usedProfile>project</org-netbeans-modules-editor-indent.CodeStyle.usedProfile>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.classDeclBracePlacement>NEW_LINE</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.classDeclBracePlacement>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.otherBracePlacement>NEW_LINE</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.otherBracePlacement>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.methodDeclBracePlacement>NEW_LINE</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.methodDeclBracePlacement>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinMethodCallParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinMethodCallParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinSwitchParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinSwitchParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinCatchParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinCatchParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinTryParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinTryParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinSynchronizedParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinSynchronizedParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinArrayInitBrackets>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinArrayInitBrackets>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinWhileParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinWhileParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinIfParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinIfParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinForParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinForParens>
|
|
||||||
</properties>
|
|
||||||
</project-shared-configuration>
|
|
@ -1,20 +0,0 @@
|
|||||||
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<groupId>net.md-5</groupId>
|
|
||||||
<artifactId>bungeecord-module</artifactId>
|
|
||||||
<version>1.19-R0.1-SNAPSHOT</version>
|
|
||||||
<relativePath>../pom.xml</relativePath>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<groupId>net.md-5</groupId>
|
|
||||||
<artifactId>bungeecord-module-cmd-send</artifactId>
|
|
||||||
<version>1.19-R0.1-SNAPSHOT</version>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
|
|
||||||
<name>cmd_send</name>
|
|
||||||
<description>Provides the gsend command</description>
|
|
||||||
</project>
|
|
@ -1,200 +0,0 @@
|
|||||||
package net.md_5.bungee.module.cmd.send;
|
|
||||||
|
|
||||||
import com.google.common.base.Joiner;
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
import net.md_5.bungee.api.Callback;
|
|
||||||
import net.md_5.bungee.api.ChatColor;
|
|
||||||
import net.md_5.bungee.api.CommandSender;
|
|
||||||
import net.md_5.bungee.api.ProxyServer;
|
|
||||||
import net.md_5.bungee.api.ServerConnectRequest;
|
|
||||||
import net.md_5.bungee.api.chat.ComponentBuilder;
|
|
||||||
import net.md_5.bungee.api.chat.HoverEvent;
|
|
||||||
import net.md_5.bungee.api.config.ServerInfo;
|
|
||||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
|
||||||
import net.md_5.bungee.api.event.ServerConnectEvent;
|
|
||||||
import net.md_5.bungee.api.plugin.Command;
|
|
||||||
import net.md_5.bungee.api.plugin.TabExecutor;
|
|
||||||
|
|
||||||
public class CommandSend extends Command implements TabExecutor
|
|
||||||
{
|
|
||||||
|
|
||||||
protected static class SendCallback
|
|
||||||
{
|
|
||||||
|
|
||||||
private final Map<ServerConnectRequest.Result, List<String>> results = new HashMap<>();
|
|
||||||
private final CommandSender sender;
|
|
||||||
private int count = 0;
|
|
||||||
|
|
||||||
public SendCallback(CommandSender sender)
|
|
||||||
{
|
|
||||||
this.sender = sender;
|
|
||||||
for ( ServerConnectRequest.Result result : ServerConnectRequest.Result.values() )
|
|
||||||
{
|
|
||||||
results.put( result, new ArrayList<String>() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void lastEntryDone()
|
|
||||||
{
|
|
||||||
sender.sendMessage( ChatColor.GREEN.toString() + ChatColor.BOLD + "Send Results:" );
|
|
||||||
for ( Map.Entry<ServerConnectRequest.Result, List<String>> entry : results.entrySet() )
|
|
||||||
{
|
|
||||||
ComponentBuilder builder = new ComponentBuilder( "" );
|
|
||||||
if ( !entry.getValue().isEmpty() )
|
|
||||||
{
|
|
||||||
builder.event( new HoverEvent( HoverEvent.Action.SHOW_TEXT,
|
|
||||||
new ComponentBuilder( Joiner.on( ", " ).join( entry.getValue() ) ).color( ChatColor.YELLOW ).create() ) );
|
|
||||||
}
|
|
||||||
builder.append( entry.getKey().name() + ": " ).color( ChatColor.GREEN );
|
|
||||||
builder.append( "" + entry.getValue().size() ).bold( true );
|
|
||||||
sender.sendMessage( builder.create() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Entry implements Callback<ServerConnectRequest.Result>
|
|
||||||
{
|
|
||||||
|
|
||||||
private final SendCallback callback;
|
|
||||||
private final ProxiedPlayer player;
|
|
||||||
private final ServerInfo target;
|
|
||||||
|
|
||||||
public Entry(SendCallback callback, ProxiedPlayer player, ServerInfo target)
|
|
||||||
{
|
|
||||||
this.callback = callback;
|
|
||||||
this.player = player;
|
|
||||||
this.target = target;
|
|
||||||
this.callback.count++;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void done(ServerConnectRequest.Result result, Throwable error)
|
|
||||||
{
|
|
||||||
callback.results.get( result ).add( player.getName() );
|
|
||||||
if ( result == ServerConnectRequest.Result.SUCCESS )
|
|
||||||
{
|
|
||||||
player.sendMessage( ProxyServer.getInstance().getTranslation( "you_got_summoned", target.getName(), callback.sender.getName() ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( --callback.count == 0 )
|
|
||||||
{
|
|
||||||
callback.lastEntryDone();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public CommandSend()
|
|
||||||
{
|
|
||||||
super( "send", "bungeecord.command.send" );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void execute(CommandSender sender, String[] args)
|
|
||||||
{
|
|
||||||
if ( args.length != 2 )
|
|
||||||
{
|
|
||||||
sender.sendMessage( ProxyServer.getInstance().getTranslation( "send_cmd_usage" ) );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ServerInfo server = ProxyServer.getInstance().getServerInfo( args[1] );
|
|
||||||
if ( server == null )
|
|
||||||
{
|
|
||||||
sender.sendMessage( ProxyServer.getInstance().getTranslation( "no_server" ) );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<ProxiedPlayer> targets;
|
|
||||||
if ( args[0].equalsIgnoreCase( "all" ) )
|
|
||||||
{
|
|
||||||
targets = new ArrayList<>( ProxyServer.getInstance().getPlayers() );
|
|
||||||
} else if ( args[0].equalsIgnoreCase( "current" ) )
|
|
||||||
{
|
|
||||||
if ( !( sender instanceof ProxiedPlayer ) )
|
|
||||||
{
|
|
||||||
sender.sendMessage( ProxyServer.getInstance().getTranslation( "player_only" ) );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ProxiedPlayer player = (ProxiedPlayer) sender;
|
|
||||||
targets = new ArrayList<>( player.getServer().getInfo().getPlayers() );
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
// If we use a server name, send the entire server. This takes priority over players.
|
|
||||||
ServerInfo serverTarget = ProxyServer.getInstance().getServerInfo( args[0] );
|
|
||||||
if ( serverTarget != null )
|
|
||||||
{
|
|
||||||
targets = new ArrayList<>( serverTarget.getPlayers() );
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
ProxiedPlayer player = ProxyServer.getInstance().getPlayer( args[0] );
|
|
||||||
if ( player == null )
|
|
||||||
{
|
|
||||||
sender.sendMessage( ProxyServer.getInstance().getTranslation( "user_not_online" ) );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
targets = Collections.singletonList( player );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
final SendCallback callback = new SendCallback( sender );
|
|
||||||
for ( ProxiedPlayer player : targets )
|
|
||||||
{
|
|
||||||
ServerConnectRequest request = ServerConnectRequest.builder()
|
|
||||||
.target( server )
|
|
||||||
.reason( ServerConnectEvent.Reason.COMMAND )
|
|
||||||
.callback( new SendCallback.Entry( callback, player, server ) )
|
|
||||||
.build();
|
|
||||||
player.connect( request );
|
|
||||||
}
|
|
||||||
|
|
||||||
sender.sendMessage( ChatColor.DARK_GREEN + "Attempting to send " + targets.size() + " players to " + server.getName() );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Iterable<String> onTabComplete(CommandSender sender, String[] args)
|
|
||||||
{
|
|
||||||
if ( args.length > 2 || args.length == 0 )
|
|
||||||
{
|
|
||||||
return ImmutableSet.of();
|
|
||||||
}
|
|
||||||
|
|
||||||
Set<String> matches = new HashSet<>();
|
|
||||||
if ( args.length == 1 )
|
|
||||||
{
|
|
||||||
String search = args[0].toLowerCase( Locale.ROOT );
|
|
||||||
for ( ProxiedPlayer player : ProxyServer.getInstance().getPlayers() )
|
|
||||||
{
|
|
||||||
if ( player.getName().toLowerCase( Locale.ROOT ).startsWith( search ) )
|
|
||||||
{
|
|
||||||
matches.add( player.getName() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( "all".startsWith( search ) )
|
|
||||||
{
|
|
||||||
matches.add( "all" );
|
|
||||||
}
|
|
||||||
if ( "current".startsWith( search ) )
|
|
||||||
{
|
|
||||||
matches.add( "current" );
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
String search = args[1].toLowerCase( Locale.ROOT );
|
|
||||||
for ( String server : ProxyServer.getInstance().getServers().keySet() )
|
|
||||||
{
|
|
||||||
if ( server.toLowerCase( Locale.ROOT ).startsWith( search ) )
|
|
||||||
{
|
|
||||||
matches.add( server );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return matches;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
package net.md_5.bungee.module.cmd.send;
|
|
||||||
|
|
||||||
import net.md_5.bungee.api.plugin.Plugin;
|
|
||||||
|
|
||||||
public class PluginSend extends Plugin
|
|
||||||
{
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onEnable()
|
|
||||||
{
|
|
||||||
getProxy().getPluginManager().registerCommand( this, new CommandSend() );
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,5 +0,0 @@
|
|||||||
name: ${project.name}
|
|
||||||
main: net.md_5.bungee.module.cmd.send.PluginSend
|
|
||||||
version: ${describe}
|
|
||||||
description: ${project.description}
|
|
||||||
author: ${module.author}
|
|
@ -1,31 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project-shared-configuration>
|
|
||||||
<!--
|
|
||||||
This file contains additional configuration written by modules in the NetBeans IDE.
|
|
||||||
The configuration is intended to be shared among all the users of project and
|
|
||||||
therefore it is assumed to be part of version control checkout.
|
|
||||||
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
|
|
||||||
-->
|
|
||||||
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
|
|
||||||
<!--
|
|
||||||
Properties that influence various parts of the IDE, especially code formatting and the like.
|
|
||||||
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
|
|
||||||
That way multiple projects can share the same settings (useful for formatting rules for example).
|
|
||||||
Any value defined here will override the pom.xml file value but is only applicable to the current project.
|
|
||||||
-->
|
|
||||||
<org-netbeans-modules-editor-indent.CodeStyle.usedProfile>project</org-netbeans-modules-editor-indent.CodeStyle.usedProfile>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.classDeclBracePlacement>NEW_LINE</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.classDeclBracePlacement>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.otherBracePlacement>NEW_LINE</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.otherBracePlacement>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.methodDeclBracePlacement>NEW_LINE</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.methodDeclBracePlacement>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinMethodCallParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinMethodCallParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinSwitchParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinSwitchParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinCatchParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinCatchParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinTryParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinTryParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinSynchronizedParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinSynchronizedParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinArrayInitBrackets>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinArrayInitBrackets>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinWhileParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinWhileParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinIfParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinIfParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinForParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinForParens>
|
|
||||||
</properties>
|
|
||||||
</project-shared-configuration>
|
|
@ -1,20 +0,0 @@
|
|||||||
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<groupId>net.md-5</groupId>
|
|
||||||
<artifactId>bungeecord-module</artifactId>
|
|
||||||
<version>1.19-R0.1-SNAPSHOT</version>
|
|
||||||
<relativePath>../pom.xml</relativePath>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<groupId>net.md-5</groupId>
|
|
||||||
<artifactId>bungeecord-module-cmd-server</artifactId>
|
|
||||||
<version>1.19-R0.1-SNAPSHOT</version>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
|
|
||||||
<name>cmd_server</name>
|
|
||||||
<description>Provides the server command</description>
|
|
||||||
</project>
|
|
@ -1,104 +0,0 @@
|
|||||||
package net.md_5.bungee.module.cmd.server;
|
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
|
||||||
import com.google.common.base.Predicate;
|
|
||||||
import com.google.common.collect.Iterables;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Map;
|
|
||||||
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.chat.HoverEvent;
|
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
|
||||||
import net.md_5.bungee.api.config.ServerInfo;
|
|
||||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
|
||||||
import net.md_5.bungee.api.event.ServerConnectEvent;
|
|
||||||
import net.md_5.bungee.api.plugin.Command;
|
|
||||||
import net.md_5.bungee.api.plugin.TabExecutor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Command to list and switch a player between available servers.
|
|
||||||
*/
|
|
||||||
public class CommandServer extends Command implements TabExecutor
|
|
||||||
{
|
|
||||||
|
|
||||||
public CommandServer()
|
|
||||||
{
|
|
||||||
super( "server", "bungeecord.command.server" );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void execute(CommandSender sender, String[] args)
|
|
||||||
{
|
|
||||||
Map<String, ServerInfo> servers = ProxyServer.getInstance().getServers();
|
|
||||||
if ( args.length == 0 )
|
|
||||||
{
|
|
||||||
if ( sender instanceof ProxiedPlayer )
|
|
||||||
{
|
|
||||||
sender.sendMessage( ProxyServer.getInstance().getTranslation( "current_server", ( (ProxiedPlayer) sender ).getServer().getInfo().getName() ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
ComponentBuilder serverList = new ComponentBuilder().appendLegacy( ProxyServer.getInstance().getTranslation( "server_list" ) );
|
|
||||||
boolean first = true;
|
|
||||||
for ( ServerInfo server : servers.values() )
|
|
||||||
{
|
|
||||||
if ( server.canAccess( sender ) )
|
|
||||||
{
|
|
||||||
TextComponent serverTextComponent = new TextComponent( first ? server.getName() : ", " + server.getName() );
|
|
||||||
int count = server.getPlayers().size();
|
|
||||||
serverTextComponent.setHoverEvent( new HoverEvent(
|
|
||||||
HoverEvent.Action.SHOW_TEXT,
|
|
||||||
new ComponentBuilder( count + ( count == 1 ? " player" : " players" ) + "\n" ).appendLegacy( ProxyServer.getInstance().getTranslation( "click_to_connect" ) ).create() )
|
|
||||||
);
|
|
||||||
serverTextComponent.setClickEvent( new ClickEvent( ClickEvent.Action.RUN_COMMAND, "/server " + server.getName() ) );
|
|
||||||
serverList.append( serverTextComponent );
|
|
||||||
first = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sender.sendMessage( serverList.create() );
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
if ( !( sender instanceof ProxiedPlayer ) )
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ProxiedPlayer player = (ProxiedPlayer) sender;
|
|
||||||
|
|
||||||
ServerInfo server = servers.get( args[0] );
|
|
||||||
if ( server == null )
|
|
||||||
{
|
|
||||||
player.sendMessage( ProxyServer.getInstance().getTranslation( "no_server" ) );
|
|
||||||
} else if ( !server.canAccess( player ) )
|
|
||||||
{
|
|
||||||
player.sendMessage( ProxyServer.getInstance().getTranslation( "no_server_permission" ) );
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
player.connect( server, ServerConnectEvent.Reason.COMMAND );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Iterable<String> onTabComplete(final CommandSender sender, final String[] args)
|
|
||||||
{
|
|
||||||
return ( args.length > 1 ) ? Collections.EMPTY_LIST : Iterables.transform( Iterables.filter( ProxyServer.getInstance().getServers().values(), new Predicate<ServerInfo>()
|
|
||||||
{
|
|
||||||
private final String lower = ( args.length == 0 ) ? "" : args[0].toLowerCase( Locale.ROOT );
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(ServerInfo input)
|
|
||||||
{
|
|
||||||
return input.getName().toLowerCase( Locale.ROOT ).startsWith( lower ) && input.canAccess( sender );
|
|
||||||
}
|
|
||||||
} ), new Function<ServerInfo, String>()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public String apply(ServerInfo input)
|
|
||||||
{
|
|
||||||
return input.getName();
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
package net.md_5.bungee.module.cmd.server;
|
|
||||||
|
|
||||||
import net.md_5.bungee.api.plugin.Plugin;
|
|
||||||
|
|
||||||
public class PluginServer extends Plugin
|
|
||||||
{
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onEnable()
|
|
||||||
{
|
|
||||||
getProxy().getPluginManager().registerCommand( this, new CommandServer() );
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,5 +0,0 @@
|
|||||||
name: ${project.name}
|
|
||||||
main: net.md_5.bungee.module.cmd.server.PluginServer
|
|
||||||
version: ${describe}
|
|
||||||
description: ${project.description}
|
|
||||||
author: ${module.author}
|
|
@ -1,55 +0,0 @@
|
|||||||
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<groupId>net.md-5</groupId>
|
|
||||||
<artifactId>bungeecord-parent</artifactId>
|
|
||||||
<version>1.19-R0.1-SNAPSHOT</version>
|
|
||||||
<relativePath>../pom.xml</relativePath>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<groupId>net.md-5</groupId>
|
|
||||||
<artifactId>bungeecord-module</artifactId>
|
|
||||||
<version>1.19-R0.1-SNAPSHOT</version>
|
|
||||||
<packaging>pom</packaging>
|
|
||||||
|
|
||||||
<name>BungeeCord Modules</name>
|
|
||||||
<description>Parent project for all BungeeCord modules.</description>
|
|
||||||
|
|
||||||
<modules>
|
|
||||||
<module>cmd-alert</module>
|
|
||||||
<module>cmd-find</module>
|
|
||||||
<module>cmd-kick</module>
|
|
||||||
<module>cmd-list</module>
|
|
||||||
<module>cmd-send</module>
|
|
||||||
<module>cmd-server</module>
|
|
||||||
<module>reconnect-yaml</module>
|
|
||||||
</modules>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<module.author>SpigotMC</module.author>
|
|
||||||
<maven.deploy.skip>true</maven.deploy.skip>
|
|
||||||
<maven.javadoc.skip>true</maven.javadoc.skip>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>net.md-5</groupId>
|
|
||||||
<artifactId>bungeecord-api</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<finalName>${project.name}</finalName>
|
|
||||||
<resources>
|
|
||||||
<resource>
|
|
||||||
<filtering>true</filtering>
|
|
||||||
<directory>${basedir}/src/main/resources</directory>
|
|
||||||
</resource>
|
|
||||||
</resources>
|
|
||||||
</build>
|
|
||||||
</project>
|
|
@ -1,31 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project-shared-configuration>
|
|
||||||
<!--
|
|
||||||
This file contains additional configuration written by modules in the NetBeans IDE.
|
|
||||||
The configuration is intended to be shared among all the users of project and
|
|
||||||
therefore it is assumed to be part of version control checkout.
|
|
||||||
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
|
|
||||||
-->
|
|
||||||
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
|
|
||||||
<!--
|
|
||||||
Properties that influence various parts of the IDE, especially code formatting and the like.
|
|
||||||
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
|
|
||||||
That way multiple projects can share the same settings (useful for formatting rules for example).
|
|
||||||
Any value defined here will override the pom.xml file value but is only applicable to the current project.
|
|
||||||
-->
|
|
||||||
<org-netbeans-modules-editor-indent.CodeStyle.usedProfile>project</org-netbeans-modules-editor-indent.CodeStyle.usedProfile>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.classDeclBracePlacement>NEW_LINE</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.classDeclBracePlacement>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.otherBracePlacement>NEW_LINE</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.otherBracePlacement>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.methodDeclBracePlacement>NEW_LINE</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.methodDeclBracePlacement>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinMethodCallParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinMethodCallParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinSwitchParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinSwitchParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinCatchParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinCatchParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinTryParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinTryParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinSynchronizedParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinSynchronizedParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinArrayInitBrackets>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinArrayInitBrackets>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinWhileParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinWhileParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinIfParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinIfParens>
|
|
||||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinForParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinForParens>
|
|
||||||
</properties>
|
|
||||||
</project-shared-configuration>
|
|
@ -1,20 +0,0 @@
|
|||||||
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<groupId>net.md-5</groupId>
|
|
||||||
<artifactId>bungeecord-module</artifactId>
|
|
||||||
<version>1.19-R0.1-SNAPSHOT</version>
|
|
||||||
<relativePath>../pom.xml</relativePath>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<groupId>net.md-5</groupId>
|
|
||||||
<artifactId>bungeecord-module-reconnect-yaml</artifactId>
|
|
||||||
<version>1.19-R0.1-SNAPSHOT</version>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
|
|
||||||
<name>reconnect_yaml</name>
|
|
||||||
<description>Provides reconnect location functionality in locations.yml</description>
|
|
||||||
</project>
|
|
@ -1,22 +0,0 @@
|
|||||||
package net.md_5.bungee.module.reconnect.yaml;
|
|
||||||
|
|
||||||
import net.md_5.bungee.api.config.ListenerInfo;
|
|
||||||
import net.md_5.bungee.api.plugin.Plugin;
|
|
||||||
|
|
||||||
public class PluginYaml extends Plugin
|
|
||||||
{
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onEnable()
|
|
||||||
{
|
|
||||||
// TODO: Abstract this for other reconnect modules
|
|
||||||
for ( ListenerInfo info : getProxy().getConfig().getListeners() )
|
|
||||||
{
|
|
||||||
if ( !info.isForceDefault() && getProxy().getReconnectHandler() == null )
|
|
||||||
{
|
|
||||||
getProxy().setReconnectHandler( new YamlReconnectHandler() );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,115 +0,0 @@
|
|||||||
package net.md_5.bungee.module.reconnect.yaml;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileReader;
|
|
||||||
import java.io.FileWriter;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.InetSocketAddress;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.locks.ReadWriteLock;
|
|
||||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import net.md_5.bungee.api.AbstractReconnectHandler;
|
|
||||||
import net.md_5.bungee.api.ProxyServer;
|
|
||||||
import net.md_5.bungee.api.config.ServerInfo;
|
|
||||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
|
||||||
import net.md_5.bungee.util.CaseInsensitiveMap;
|
|
||||||
import org.yaml.snakeyaml.Yaml;
|
|
||||||
|
|
||||||
public class YamlReconnectHandler extends AbstractReconnectHandler
|
|
||||||
{
|
|
||||||
|
|
||||||
private final Yaml yaml = new Yaml();
|
|
||||||
private final File file = new File( "locations.yml" );
|
|
||||||
private final ReadWriteLock lock = new ReentrantReadWriteLock();
|
|
||||||
/*========================================================================*/
|
|
||||||
private CaseInsensitiveMap<String> data;
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public YamlReconnectHandler()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
file.createNewFile();
|
|
||||||
try ( FileReader rd = new FileReader( file ) )
|
|
||||||
{
|
|
||||||
Map map = yaml.loadAs( rd, Map.class );
|
|
||||||
if ( map != null )
|
|
||||||
{
|
|
||||||
data = new CaseInsensitiveMap<>( map );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch ( Exception ex )
|
|
||||||
{
|
|
||||||
file.renameTo( new File( "locations.yml.old" ) );
|
|
||||||
ProxyServer.getInstance().getLogger().log( Level.WARNING, "Could not load reconnect locations, resetting them" );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( data == null )
|
|
||||||
{
|
|
||||||
data = new CaseInsensitiveMap<>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected ServerInfo getStoredServer(ProxiedPlayer player)
|
|
||||||
{
|
|
||||||
ServerInfo server = null;
|
|
||||||
lock.readLock().lock();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
server = ProxyServer.getInstance().getServerInfo( data.get( key( player ) ) );
|
|
||||||
} finally
|
|
||||||
{
|
|
||||||
lock.readLock().unlock();
|
|
||||||
}
|
|
||||||
return server;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setServer(ProxiedPlayer player)
|
|
||||||
{
|
|
||||||
lock.writeLock().lock();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
data.put( key( player ), ( player.getReconnectServer() != null ) ? player.getReconnectServer().getName() : player.getServer().getInfo().getName() );
|
|
||||||
} finally
|
|
||||||
{
|
|
||||||
lock.writeLock().unlock();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private String key(ProxiedPlayer player)
|
|
||||||
{
|
|
||||||
InetSocketAddress host = player.getPendingConnection().getVirtualHost();
|
|
||||||
return player.getName() + ";" + host.getHostString() + ":" + host.getPort();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void save()
|
|
||||||
{
|
|
||||||
Map<String, String> copy = new HashMap<>();
|
|
||||||
lock.readLock().lock();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
copy.putAll( data );
|
|
||||||
} finally
|
|
||||||
{
|
|
||||||
lock.readLock().unlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
try ( FileWriter wr = new FileWriter( file ) )
|
|
||||||
{
|
|
||||||
yaml.dump( copy, wr );
|
|
||||||
} catch ( IOException ex )
|
|
||||||
{
|
|
||||||
ProxyServer.getInstance().getLogger().log( Level.WARNING, "Could not save reconnect locations", ex );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void close()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,5 +0,0 @@
|
|||||||
name: ${project.name}
|
|
||||||
main: net.md_5.bungee.module.reconnect.yaml.PluginYaml
|
|
||||||
version: ${describe}
|
|
||||||
description: ${project.description}
|
|
||||||
author: ${module.author}
|
|
@ -4,13 +4,12 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>fr.pandacube.bungeecord</groupId>
|
||||||
<artifactId>bungeecord-parent</artifactId>
|
<artifactId>bungeecord-parent</artifactId>
|
||||||
<version>1.19-R0.1-SNAPSHOT</version>
|
<version>1.19-R0.1-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>net.md-5</groupId>
|
|
||||||
<artifactId>bungeecord-native</artifactId>
|
<artifactId>bungeecord-native</artifactId>
|
||||||
<version>1.19-R0.1-SNAPSHOT</version>
|
<version>1.19-R0.1-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
7
pom.xml
7
pom.xml
@ -3,7 +3,7 @@
|
|||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>fr.pandacube.bungeecord</groupId>
|
||||||
<artifactId>bungeecord-parent</artifactId>
|
<artifactId>bungeecord-parent</artifactId>
|
||||||
<version>1.19-R0.1-SNAPSHOT</version>
|
<version>1.19-R0.1-SNAPSHOT</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
@ -37,7 +37,6 @@
|
|||||||
<module>config</module>
|
<module>config</module>
|
||||||
<module>event</module>
|
<module>event</module>
|
||||||
<module>log</module>
|
<module>log</module>
|
||||||
<module>module</module>
|
|
||||||
<module>protocol</module>
|
<module>protocol</module>
|
||||||
<module>proxy</module>
|
<module>proxy</module>
|
||||||
<module>query</module>
|
<module>query</module>
|
||||||
@ -89,7 +88,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.guava</groupId>
|
<groupId>com.google.guava</groupId>
|
||||||
<artifactId>guava</artifactId>
|
<artifactId>guava</artifactId>
|
||||||
<version>31.0.1-jre</version>
|
<version>31.1-jre</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -113,7 +112,7 @@
|
|||||||
<artifactId>scriptus</artifactId>
|
<artifactId>scriptus</artifactId>
|
||||||
<version>0.4.1</version>
|
<version>0.4.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<format>git:${project.name}:${project.version}:%s:${build.number}</format>
|
<format>git:${project.name}-Pandacube:${project.version}:%s:${build.number}</format>
|
||||||
</configuration>
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
|
@ -4,13 +4,12 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>fr.pandacube.bungeecord</groupId>
|
||||||
<artifactId>bungeecord-parent</artifactId>
|
<artifactId>bungeecord-parent</artifactId>
|
||||||
<version>1.19-R0.1-SNAPSHOT</version>
|
<version>1.19-R0.1-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>net.md-5</groupId>
|
|
||||||
<artifactId>bungeecord-protocol</artifactId>
|
<artifactId>bungeecord-protocol</artifactId>
|
||||||
<version>1.19-R0.1-SNAPSHOT</version>
|
<version>1.19-R0.1-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
@ -41,7 +40,7 @@
|
|||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>fr.pandacube.bungeecord</groupId>
|
||||||
<artifactId>bungeecord-chat</artifactId>
|
<artifactId>bungeecord-chat</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
|
@ -25,6 +25,8 @@ import net.md_5.bungee.protocol.packet.LoginSuccess;
|
|||||||
import net.md_5.bungee.protocol.packet.PingPacket;
|
import net.md_5.bungee.protocol.packet.PingPacket;
|
||||||
import net.md_5.bungee.protocol.packet.PlayerListHeaderFooter;
|
import net.md_5.bungee.protocol.packet.PlayerListHeaderFooter;
|
||||||
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.PlayerListItemUpdate;
|
||||||
import net.md_5.bungee.protocol.packet.PluginMessage;
|
import net.md_5.bungee.protocol.packet.PluginMessage;
|
||||||
import net.md_5.bungee.protocol.packet.Respawn;
|
import net.md_5.bungee.protocol.packet.Respawn;
|
||||||
import net.md_5.bungee.protocol.packet.ScoreboardDisplay;
|
import net.md_5.bungee.protocol.packet.ScoreboardDisplay;
|
||||||
@ -114,6 +116,14 @@ public abstract class AbstractPacketHandler
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void handle(PlayerListItemRemove playerListItem) throws Exception
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handle(PlayerListItemUpdate playerListItem) throws Exception
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public void handle(PlayerListHeaderFooter playerListHeaderFooter) throws Exception
|
public void handle(PlayerListHeaderFooter playerListHeaderFooter) throws Exception
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,9 @@ import java.io.DataInputStream;
|
|||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.BitSet;
|
||||||
|
import java.util.EnumSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@ -308,6 +311,53 @@ public abstract class DefinedPacket
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static <E extends Enum<E>> void writeEnumSet(EnumSet<E> enumset, Class<E> oclass, ByteBuf buf)
|
||||||
|
{
|
||||||
|
E[] enums = oclass.getEnumConstants();
|
||||||
|
BitSet bits = new BitSet( enums.length );
|
||||||
|
|
||||||
|
for ( int i = 0; i < enums.length; ++i )
|
||||||
|
{
|
||||||
|
bits.set( i, enumset.contains( enums[i] ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
writeFixedBitSet( bits, enums.length, buf );
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <E extends Enum<E>> EnumSet<E> readEnumSet(Class<E> oclass, ByteBuf buf)
|
||||||
|
{
|
||||||
|
E[] enums = oclass.getEnumConstants();
|
||||||
|
BitSet bits = readFixedBitSet( enums.length, buf );
|
||||||
|
EnumSet<E> set = EnumSet.noneOf( oclass );
|
||||||
|
|
||||||
|
for ( int i = 0; i < enums.length; ++i )
|
||||||
|
{
|
||||||
|
if ( bits.get( i ) )
|
||||||
|
{
|
||||||
|
set.add( enums[i] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return set;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static BitSet readFixedBitSet(int i, ByteBuf buf)
|
||||||
|
{
|
||||||
|
byte[] bits = new byte[ ( i + 8 ) >> 3 ];
|
||||||
|
buf.readBytes( bits );
|
||||||
|
|
||||||
|
return BitSet.valueOf( bits );
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void writeFixedBitSet(BitSet bits, int size, ByteBuf buf)
|
||||||
|
{
|
||||||
|
if ( bits.length() > size )
|
||||||
|
{
|
||||||
|
throw new OverflowPacketException( "BitSet too large (expected " + size + " got " + bits.size() + ")" );
|
||||||
|
}
|
||||||
|
buf.writeBytes( Arrays.copyOf( bits.toByteArray(), ( size + 8 ) >> 3 ) );
|
||||||
|
}
|
||||||
|
|
||||||
public void read(ByteBuf buf)
|
public void read(ByteBuf buf)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException( "Packet must implement read method" );
|
throw new UnsupportedOperationException( "Packet must implement read method" );
|
||||||
|
@ -31,6 +31,8 @@ import net.md_5.bungee.protocol.packet.LoginSuccess;
|
|||||||
import net.md_5.bungee.protocol.packet.PingPacket;
|
import net.md_5.bungee.protocol.packet.PingPacket;
|
||||||
import net.md_5.bungee.protocol.packet.PlayerListHeaderFooter;
|
import net.md_5.bungee.protocol.packet.PlayerListHeaderFooter;
|
||||||
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.PlayerListItemUpdate;
|
||||||
import net.md_5.bungee.protocol.packet.PluginMessage;
|
import net.md_5.bungee.protocol.packet.PluginMessage;
|
||||||
import net.md_5.bungee.protocol.packet.Respawn;
|
import net.md_5.bungee.protocol.packet.Respawn;
|
||||||
import net.md_5.bungee.protocol.packet.ScoreboardDisplay;
|
import net.md_5.bungee.protocol.packet.ScoreboardDisplay;
|
||||||
@ -81,7 +83,8 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_16_2, 0x1F ),
|
map( ProtocolConstants.MINECRAFT_1_16_2, 0x1F ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x21 ),
|
map( ProtocolConstants.MINECRAFT_1_17, 0x21 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19, 0x1E ),
|
map( ProtocolConstants.MINECRAFT_1_19, 0x1E ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19_1, 0x20 )
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x20 ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_3, 0x1F )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
Login.class,
|
Login.class,
|
||||||
@ -94,7 +97,8 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_16_2, 0x24 ),
|
map( ProtocolConstants.MINECRAFT_1_16_2, 0x24 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x26 ),
|
map( ProtocolConstants.MINECRAFT_1_17, 0x26 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19, 0x23 ),
|
map( ProtocolConstants.MINECRAFT_1_19, 0x23 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19_1, 0x25 )
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x25 ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_3, 0x24 )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket( Chat.class,
|
TO_CLIENT.registerPacket( Chat.class,
|
||||||
Chat::new,
|
Chat::new,
|
||||||
@ -120,7 +124,8 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_16_2, 0x39 ),
|
map( ProtocolConstants.MINECRAFT_1_16_2, 0x39 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x3D ),
|
map( ProtocolConstants.MINECRAFT_1_17, 0x3D ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19, 0x3B ),
|
map( ProtocolConstants.MINECRAFT_1_19, 0x3B ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19_1, 0x3E )
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x3E ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_3, 0x3D )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
BossBar.class,
|
BossBar.class,
|
||||||
@ -144,7 +149,8 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_16_2, 0x32 ),
|
map( ProtocolConstants.MINECRAFT_1_16_2, 0x32 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x36 ),
|
map( ProtocolConstants.MINECRAFT_1_17, 0x36 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19, 0x34 ),
|
map( ProtocolConstants.MINECRAFT_1_19, 0x34 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19_1, 0x37 )
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x37 ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_3, -1 )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
TabCompleteResponse.class,
|
TabCompleteResponse.class,
|
||||||
@ -156,7 +162,8 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_16, 0x10 ),
|
map( ProtocolConstants.MINECRAFT_1_16, 0x10 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_16_2, 0x0F ),
|
map( ProtocolConstants.MINECRAFT_1_16_2, 0x0F ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x11 ),
|
map( ProtocolConstants.MINECRAFT_1_17, 0x11 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19, 0x0E )
|
map( ProtocolConstants.MINECRAFT_1_19, 0x0E ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_3, 0x0D )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
ScoreboardObjective.class,
|
ScoreboardObjective.class,
|
||||||
@ -169,7 +176,8 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_14, 0x49 ),
|
map( ProtocolConstants.MINECRAFT_1_14, 0x49 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_15, 0x4A ),
|
map( ProtocolConstants.MINECRAFT_1_15, 0x4A ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x53 ),
|
map( ProtocolConstants.MINECRAFT_1_17, 0x53 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19_1, 0x56 )
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x56 ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_3, 0x54 )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
ScoreboardScore.class,
|
ScoreboardScore.class,
|
||||||
@ -182,7 +190,8 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_14, 0x4C ),
|
map( ProtocolConstants.MINECRAFT_1_14, 0x4C ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_15, 0x4D ),
|
map( ProtocolConstants.MINECRAFT_1_15, 0x4D ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x56 ),
|
map( ProtocolConstants.MINECRAFT_1_17, 0x56 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19_1, 0x59 )
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x59 ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_3, 0x57 )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
ScoreboardDisplay.class,
|
ScoreboardDisplay.class,
|
||||||
@ -195,7 +204,8 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_14, 0x42 ),
|
map( ProtocolConstants.MINECRAFT_1_14, 0x42 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_15, 0x43 ),
|
map( ProtocolConstants.MINECRAFT_1_15, 0x43 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x4C ),
|
map( ProtocolConstants.MINECRAFT_1_17, 0x4C ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19_1, 0x4F )
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x4F ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_3, 0x4D )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
Team.class,
|
Team.class,
|
||||||
@ -208,7 +218,8 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_14, 0x4B ),
|
map( ProtocolConstants.MINECRAFT_1_14, 0x4B ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_15, 0x4C ),
|
map( ProtocolConstants.MINECRAFT_1_15, 0x4C ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x55 ),
|
map( ProtocolConstants.MINECRAFT_1_17, 0x55 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19_1, 0x58 )
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x58 ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_3, 0x56 )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
PluginMessage.class,
|
PluginMessage.class,
|
||||||
@ -222,7 +233,8 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_16_2, 0x17 ),
|
map( ProtocolConstants.MINECRAFT_1_16_2, 0x17 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x18 ),
|
map( ProtocolConstants.MINECRAFT_1_17, 0x18 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19, 0x15 ),
|
map( ProtocolConstants.MINECRAFT_1_19, 0x15 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19_1, 0x16 )
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x16 ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_3, 0x15 )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
Kick.class,
|
Kick.class,
|
||||||
@ -236,7 +248,8 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_16_2, 0x19 ),
|
map( ProtocolConstants.MINECRAFT_1_16_2, 0x19 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x1A ),
|
map( ProtocolConstants.MINECRAFT_1_17, 0x1A ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19, 0x17 ),
|
map( ProtocolConstants.MINECRAFT_1_19, 0x17 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19_1, 0x19 )
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x19 ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_3, 0x17 )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
Title.class,
|
Title.class,
|
||||||
@ -250,33 +263,38 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_16, 0x4F ),
|
map( ProtocolConstants.MINECRAFT_1_16, 0x4F ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x59 ),
|
map( ProtocolConstants.MINECRAFT_1_17, 0x59 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_18, 0x5A ),
|
map( ProtocolConstants.MINECRAFT_1_18, 0x5A ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19_1, 0x5D )
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x5D ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_3, 0x5B )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
ClearTitles.class,
|
ClearTitles.class,
|
||||||
ClearTitles::new,
|
ClearTitles::new,
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x10 ),
|
map( ProtocolConstants.MINECRAFT_1_17, 0x10 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19, 0x0D )
|
map( ProtocolConstants.MINECRAFT_1_19, 0x0D ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_3, 0x0C )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
Subtitle.class,
|
Subtitle.class,
|
||||||
Subtitle::new,
|
Subtitle::new,
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x57 ),
|
map( ProtocolConstants.MINECRAFT_1_17, 0x57 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_18, 0x58 ),
|
map( ProtocolConstants.MINECRAFT_1_18, 0x58 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19_1, 0x5B )
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x5B ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_3, 0x59 )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
TitleTimes.class,
|
TitleTimes.class,
|
||||||
TitleTimes::new,
|
TitleTimes::new,
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x5A ),
|
map( ProtocolConstants.MINECRAFT_1_17, 0x5A ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_18, 0x5B ),
|
map( ProtocolConstants.MINECRAFT_1_18, 0x5B ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19_1, 0x5E )
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x5E ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_3, 0x5C )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
SystemChat.class,
|
SystemChat.class,
|
||||||
SystemChat::new,
|
SystemChat::new,
|
||||||
map( ProtocolConstants.MINECRAFT_1_19, 0x5F ),
|
map( ProtocolConstants.MINECRAFT_1_19, 0x5F ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19_1, 0x62 )
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x62 ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_3, 0x60 )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
PlayerListHeaderFooter.class,
|
PlayerListHeaderFooter.class,
|
||||||
@ -293,7 +311,8 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x5E ),
|
map( ProtocolConstants.MINECRAFT_1_17, 0x5E ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_18, 0x5F ),
|
map( ProtocolConstants.MINECRAFT_1_18, 0x5F ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19, 0x60 ),
|
map( ProtocolConstants.MINECRAFT_1_19, 0x60 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19_1, 0x63 )
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x63 ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_3, 0x61 )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
EntityStatus.class,
|
EntityStatus.class,
|
||||||
@ -307,7 +326,8 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_16_2, 0x1A ),
|
map( ProtocolConstants.MINECRAFT_1_16_2, 0x1A ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x1B ),
|
map( ProtocolConstants.MINECRAFT_1_17, 0x1B ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19, 0x18 ),
|
map( ProtocolConstants.MINECRAFT_1_19, 0x18 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19_1, 0x1A )
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x1A ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_3, 0x19 )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
Commands.class,
|
Commands.class,
|
||||||
@ -317,7 +337,8 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_16, 0x11 ),
|
map( ProtocolConstants.MINECRAFT_1_16, 0x11 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_16_2, 0x10 ),
|
map( ProtocolConstants.MINECRAFT_1_16_2, 0x10 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x12 ),
|
map( ProtocolConstants.MINECRAFT_1_17, 0x12 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19, 0x0F )
|
map( ProtocolConstants.MINECRAFT_1_19, 0x0F ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_3, 0x0E )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
GameState.class,
|
GameState.class,
|
||||||
@ -327,7 +348,8 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_16_2, 0x1D ),
|
map( ProtocolConstants.MINECRAFT_1_16_2, 0x1D ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x1E ),
|
map( ProtocolConstants.MINECRAFT_1_17, 0x1E ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19, 0x1B ),
|
map( ProtocolConstants.MINECRAFT_1_19, 0x1B ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19_1, 0x1D )
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x1D ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_3, 0x1C )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
ViewDistance.class,
|
ViewDistance.class,
|
||||||
@ -337,13 +359,25 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_16, 0x41 ),
|
map( ProtocolConstants.MINECRAFT_1_16, 0x41 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x4A ),
|
map( ProtocolConstants.MINECRAFT_1_17, 0x4A ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19, 0x49 ),
|
map( ProtocolConstants.MINECRAFT_1_19, 0x49 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19_1, 0x4C )
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x4C ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_3, 0x4B )
|
||||||
);
|
);
|
||||||
TO_CLIENT.registerPacket(
|
TO_CLIENT.registerPacket(
|
||||||
ServerData.class,
|
ServerData.class,
|
||||||
ServerData::new,
|
ServerData::new,
|
||||||
map( ProtocolConstants.MINECRAFT_1_19, 0x3F ),
|
map( ProtocolConstants.MINECRAFT_1_19, 0x3F ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19_1, 0x42 )
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x42 ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_3, 0x41 )
|
||||||
|
);
|
||||||
|
TO_CLIENT.registerPacket(
|
||||||
|
PlayerListItemRemove.class,
|
||||||
|
PlayerListItemRemove::new,
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_3, 0x35 )
|
||||||
|
);
|
||||||
|
TO_CLIENT.registerPacket(
|
||||||
|
PlayerListItemUpdate.class,
|
||||||
|
PlayerListItemUpdate::new,
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_3, 0x36 )
|
||||||
);
|
);
|
||||||
|
|
||||||
TO_SERVER.registerPacket(
|
TO_SERVER.registerPacket(
|
||||||
@ -358,7 +392,8 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_16, 0x10 ),
|
map( ProtocolConstants.MINECRAFT_1_16, 0x10 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x0F ),
|
map( ProtocolConstants.MINECRAFT_1_17, 0x0F ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19, 0x11 ),
|
map( ProtocolConstants.MINECRAFT_1_19, 0x11 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19_1, 0x12 )
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x12 ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_3, 0x11 )
|
||||||
);
|
);
|
||||||
TO_SERVER.registerPacket( Chat.class,
|
TO_SERVER.registerPacket( Chat.class,
|
||||||
Chat::new,
|
Chat::new,
|
||||||
@ -391,7 +426,8 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_13, 0x05 ),
|
map( ProtocolConstants.MINECRAFT_1_13, 0x05 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_14, 0x06 ),
|
map( ProtocolConstants.MINECRAFT_1_14, 0x06 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19, 0x08 ),
|
map( ProtocolConstants.MINECRAFT_1_19, 0x08 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19_1, 0x09 )
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x09 ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_3, 0x08 )
|
||||||
);
|
);
|
||||||
TO_SERVER.registerPacket(
|
TO_SERVER.registerPacket(
|
||||||
ClientSettings.class,
|
ClientSettings.class,
|
||||||
@ -402,7 +438,8 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_12_1, 0x04 ),
|
map( ProtocolConstants.MINECRAFT_1_12_1, 0x04 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_14, 0x05 ),
|
map( ProtocolConstants.MINECRAFT_1_14, 0x05 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19, 0x07 ),
|
map( ProtocolConstants.MINECRAFT_1_19, 0x07 ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19_1, 0x08 )
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x08 ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_3, 0x07 )
|
||||||
);
|
);
|
||||||
TO_SERVER.registerPacket(
|
TO_SERVER.registerPacket(
|
||||||
PluginMessage.class,
|
PluginMessage.class,
|
||||||
@ -415,7 +452,8 @@ public enum Protocol
|
|||||||
map( ProtocolConstants.MINECRAFT_1_14, 0x0B ),
|
map( ProtocolConstants.MINECRAFT_1_14, 0x0B ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_17, 0x0A ),
|
map( ProtocolConstants.MINECRAFT_1_17, 0x0A ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19, 0x0C ),
|
map( ProtocolConstants.MINECRAFT_1_19, 0x0C ),
|
||||||
map( ProtocolConstants.MINECRAFT_1_19_1, 0x0D )
|
map( ProtocolConstants.MINECRAFT_1_19_1, 0x0D ),
|
||||||
|
map( ProtocolConstants.MINECRAFT_1_19_3, 0x0C )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -40,6 +40,7 @@ public class ProtocolConstants
|
|||||||
public static final int MINECRAFT_1_18_2 = 758;
|
public static final int MINECRAFT_1_18_2 = 758;
|
||||||
public static final int MINECRAFT_1_19 = 759;
|
public static final int MINECRAFT_1_19 = 759;
|
||||||
public static final int MINECRAFT_1_19_1 = 760;
|
public static final int MINECRAFT_1_19_1 = 760;
|
||||||
|
public static final int MINECRAFT_1_19_3 = 761;
|
||||||
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;
|
||||||
|
|
||||||
@ -92,7 +93,8 @@ public class ProtocolConstants
|
|||||||
ProtocolConstants.MINECRAFT_1_18,
|
ProtocolConstants.MINECRAFT_1_18,
|
||||||
ProtocolConstants.MINECRAFT_1_18_2,
|
ProtocolConstants.MINECRAFT_1_18_2,
|
||||||
ProtocolConstants.MINECRAFT_1_19,
|
ProtocolConstants.MINECRAFT_1_19,
|
||||||
ProtocolConstants.MINECRAFT_1_19_1
|
ProtocolConstants.MINECRAFT_1_19_1,
|
||||||
|
ProtocolConstants.MINECRAFT_1_19_3
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( SNAPSHOT_SUPPORT )
|
if ( SNAPSHOT_SUPPORT )
|
||||||
|
@ -0,0 +1,39 @@
|
|||||||
|
package net.md_5.bungee.protocol;
|
||||||
|
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import java.util.BitSet;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
public class SeenMessages extends DefinedPacket
|
||||||
|
{
|
||||||
|
|
||||||
|
private int offset;
|
||||||
|
private BitSet acknowledged;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||||
|
{
|
||||||
|
offset = DefinedPacket.readVarInt( buf );
|
||||||
|
acknowledged = DefinedPacket.readFixedBitSet( 20, buf );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||||
|
{
|
||||||
|
DefinedPacket.writeVarInt( offset, buf );
|
||||||
|
DefinedPacket.writeFixedBitSet( acknowledged, 20, buf );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handle(AbstractPacketHandler handler) throws Exception
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException( "Not supported." );
|
||||||
|
}
|
||||||
|
}
|
@ -9,6 +9,7 @@ import net.md_5.bungee.protocol.AbstractPacketHandler;
|
|||||||
import net.md_5.bungee.protocol.ChatChain;
|
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.SeenMessages;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@ -23,6 +24,7 @@ public class ClientChat extends DefinedPacket
|
|||||||
private byte[] signature;
|
private byte[] signature;
|
||||||
private boolean signedPreview;
|
private boolean signedPreview;
|
||||||
private ChatChain chain;
|
private ChatChain chain;
|
||||||
|
private SeenMessages seenMessages;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||||
@ -30,9 +32,27 @@ public class ClientChat extends DefinedPacket
|
|||||||
message = readString( buf, 256 );
|
message = readString( buf, 256 );
|
||||||
timestamp = buf.readLong();
|
timestamp = buf.readLong();
|
||||||
salt = buf.readLong();
|
salt = buf.readLong();
|
||||||
|
|
||||||
|
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_3 )
|
||||||
|
{
|
||||||
|
if ( buf.readBoolean() )
|
||||||
|
{
|
||||||
|
signature = new byte[ 256 ];
|
||||||
|
buf.readBytes( signature );
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
signature = readArray( buf );
|
signature = readArray( buf );
|
||||||
|
}
|
||||||
|
if ( protocolVersion < ProtocolConstants.MINECRAFT_1_19_3 )
|
||||||
|
{
|
||||||
signedPreview = buf.readBoolean();
|
signedPreview = buf.readBoolean();
|
||||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_1 )
|
}
|
||||||
|
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_3 )
|
||||||
|
{
|
||||||
|
seenMessages = new SeenMessages();
|
||||||
|
seenMessages.read( buf, direction, protocolVersion );
|
||||||
|
} else if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_1 )
|
||||||
{
|
{
|
||||||
chain = new ChatChain();
|
chain = new ChatChain();
|
||||||
chain.read( buf, direction, protocolVersion );
|
chain.read( buf, direction, protocolVersion );
|
||||||
@ -45,9 +65,25 @@ public class ClientChat extends DefinedPacket
|
|||||||
writeString( message, buf );
|
writeString( message, buf );
|
||||||
buf.writeLong( timestamp );
|
buf.writeLong( timestamp );
|
||||||
buf.writeLong( salt );
|
buf.writeLong( salt );
|
||||||
|
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_3 )
|
||||||
|
{
|
||||||
|
buf.writeBoolean( signature != null );
|
||||||
|
if ( signature != null )
|
||||||
|
{
|
||||||
|
buf.writeBytes( signature );
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
writeArray( signature, buf );
|
writeArray( signature, buf );
|
||||||
|
}
|
||||||
|
if ( protocolVersion < ProtocolConstants.MINECRAFT_1_19_3 )
|
||||||
|
{
|
||||||
buf.writeBoolean( signedPreview );
|
buf.writeBoolean( signedPreview );
|
||||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_1 )
|
}
|
||||||
|
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_3 )
|
||||||
|
{
|
||||||
|
seenMessages.write( buf, direction, protocolVersion );
|
||||||
|
} else if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_1 )
|
||||||
{
|
{
|
||||||
chain.write( buf, direction, protocolVersion );
|
chain.write( buf, direction, protocolVersion );
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ import net.md_5.bungee.protocol.AbstractPacketHandler;
|
|||||||
import net.md_5.bungee.protocol.ChatChain;
|
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.SeenMessages;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@ -26,6 +27,7 @@ public class ClientCommand extends DefinedPacket
|
|||||||
private Map<String, byte[]> signatures;
|
private Map<String, byte[]> signatures;
|
||||||
private boolean signedPreview;
|
private boolean signedPreview;
|
||||||
private ChatChain chain;
|
private ChatChain chain;
|
||||||
|
private SeenMessages seenMessages;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||||
@ -39,11 +41,29 @@ public class ClientCommand extends DefinedPacket
|
|||||||
signatures = new HashMap<>( cnt );
|
signatures = new HashMap<>( cnt );
|
||||||
for ( int i = 0; i < cnt; i++ )
|
for ( int i = 0; i < cnt; i++ )
|
||||||
{
|
{
|
||||||
signatures.put( readString( buf, 16 ), readArray( buf ) );
|
String name = readString( buf, 16 );
|
||||||
|
byte[] signature;
|
||||||
|
|
||||||
|
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_3 )
|
||||||
|
{
|
||||||
|
signature = new byte[ 256 ];
|
||||||
|
buf.readBytes( signature );
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
signature = readArray( buf );
|
||||||
|
}
|
||||||
|
signatures.put( name, signature );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( protocolVersion < ProtocolConstants.MINECRAFT_1_19_3 )
|
||||||
|
{
|
||||||
signedPreview = buf.readBoolean();
|
signedPreview = buf.readBoolean();
|
||||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_1 )
|
}
|
||||||
|
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_3 )
|
||||||
|
{
|
||||||
|
seenMessages = new SeenMessages();
|
||||||
|
seenMessages.read( buf, direction, protocolVersion );
|
||||||
|
} else if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_1 )
|
||||||
{
|
{
|
||||||
chain = new ChatChain();
|
chain = new ChatChain();
|
||||||
chain.read( buf, direction, protocolVersion );
|
chain.read( buf, direction, protocolVersion );
|
||||||
@ -61,11 +81,23 @@ public class ClientCommand extends DefinedPacket
|
|||||||
for ( Map.Entry<String, byte[]> entry : signatures.entrySet() )
|
for ( Map.Entry<String, byte[]> entry : signatures.entrySet() )
|
||||||
{
|
{
|
||||||
writeString( entry.getKey(), buf );
|
writeString( entry.getKey(), buf );
|
||||||
|
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_3 )
|
||||||
|
{
|
||||||
|
buf.writeBytes( entry.getValue() );
|
||||||
|
} else
|
||||||
|
{
|
||||||
writeArray( entry.getValue(), buf );
|
writeArray( entry.getValue(), buf );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( protocolVersion < ProtocolConstants.MINECRAFT_1_19_3 )
|
||||||
|
{
|
||||||
buf.writeBoolean( signedPreview );
|
buf.writeBoolean( signedPreview );
|
||||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_1 )
|
}
|
||||||
|
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_3 )
|
||||||
|
{
|
||||||
|
seenMessages.write( buf, direction, protocolVersion );
|
||||||
|
} else if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_1 )
|
||||||
{
|
{
|
||||||
chain.write( buf, direction, protocolVersion );
|
chain.write( buf, direction, protocolVersion );
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import com.google.common.base.Preconditions;
|
|||||||
import com.mojang.brigadier.Command;
|
import com.mojang.brigadier.Command;
|
||||||
import com.mojang.brigadier.StringReader;
|
import com.mojang.brigadier.StringReader;
|
||||||
import com.mojang.brigadier.arguments.ArgumentType;
|
import com.mojang.brigadier.arguments.ArgumentType;
|
||||||
|
import com.mojang.brigadier.arguments.BoolArgumentType;
|
||||||
import com.mojang.brigadier.arguments.DoubleArgumentType;
|
import com.mojang.brigadier.arguments.DoubleArgumentType;
|
||||||
import com.mojang.brigadier.arguments.FloatArgumentType;
|
import com.mojang.brigadier.arguments.FloatArgumentType;
|
||||||
import com.mojang.brigadier.arguments.IntegerArgumentType;
|
import com.mojang.brigadier.arguments.IntegerArgumentType;
|
||||||
@ -23,13 +24,11 @@ import com.mojang.brigadier.tree.LiteralCommandNode;
|
|||||||
import com.mojang.brigadier.tree.RootCommandNode;
|
import com.mojang.brigadier.tree.RootCommandNode;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import java.util.ArrayDeque;
|
import java.util.ArrayDeque;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Deque;
|
import java.util.Deque;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@ -305,11 +304,12 @@ public class Commands extends DefinedPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
private static class ArgumentRegistry
|
public static class ArgumentRegistry
|
||||||
{
|
{
|
||||||
|
|
||||||
private static final Map<String, ArgumentSerializer> PROVIDERS = new HashMap<>();
|
private static final Map<String, ArgumentSerializer> PROVIDERS = new HashMap<>();
|
||||||
private static final List<ArgumentSerializer> PROVIDER_LIST = new ArrayList<>();
|
private static final ArgumentSerializer[] IDS_1_19;
|
||||||
|
private static final ArgumentSerializer[] IDS_1_19_3;
|
||||||
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>()
|
||||||
@ -325,18 +325,29 @@ public class Commands extends DefinedPacket
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
private static final ArgumentSerializer<Boolean> BOOLEAN = new ArgumentSerializer<Boolean>()
|
private static final ProperArgumentSerializer<BoolArgumentType> BOOLEAN = new ProperArgumentSerializer<BoolArgumentType>()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
protected Boolean read(ByteBuf buf)
|
protected BoolArgumentType read(ByteBuf buf)
|
||||||
{
|
{
|
||||||
return buf.readBoolean();
|
return BoolArgumentType.bool();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void write(ByteBuf buf, Boolean t)
|
protected void write(ByteBuf buf, BoolArgumentType t)
|
||||||
{
|
{
|
||||||
buf.writeBoolean( t );
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getIntKey()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getKey()
|
||||||
|
{
|
||||||
|
return "brigadier:bool";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
private static final ArgumentSerializer<Byte> BYTE = new ArgumentSerializer<Byte>()
|
private static final ArgumentSerializer<Byte> BYTE = new ArgumentSerializer<Byte>()
|
||||||
@ -353,7 +364,7 @@ public class Commands extends DefinedPacket
|
|||||||
buf.writeByte( t );
|
buf.writeByte( t );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
private static final ArgumentSerializer<FloatArgumentType> FLOAT = new ArgumentSerializer<FloatArgumentType>()
|
private static final ProperArgumentSerializer<FloatArgumentType> FLOAT = new ProperArgumentSerializer<FloatArgumentType>()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
protected FloatArgumentType read(ByteBuf buf)
|
protected FloatArgumentType read(ByteBuf buf)
|
||||||
@ -381,8 +392,20 @@ public class Commands extends DefinedPacket
|
|||||||
buf.writeFloat( t.getMaximum() );
|
buf.writeFloat( t.getMaximum() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getIntKey()
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getKey()
|
||||||
|
{
|
||||||
|
return "brigadier:float";
|
||||||
|
}
|
||||||
};
|
};
|
||||||
private static final ArgumentSerializer<DoubleArgumentType> DOUBLE = new ArgumentSerializer<DoubleArgumentType>()
|
private static final ProperArgumentSerializer<DoubleArgumentType> DOUBLE = new ProperArgumentSerializer<DoubleArgumentType>()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
protected DoubleArgumentType read(ByteBuf buf)
|
protected DoubleArgumentType read(ByteBuf buf)
|
||||||
@ -410,8 +433,20 @@ public class Commands extends DefinedPacket
|
|||||||
buf.writeDouble( t.getMaximum() );
|
buf.writeDouble( t.getMaximum() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getIntKey()
|
||||||
|
{
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getKey()
|
||||||
|
{
|
||||||
|
return "brigadier:double";
|
||||||
|
}
|
||||||
};
|
};
|
||||||
private static final ArgumentSerializer<IntegerArgumentType> INTEGER = new ArgumentSerializer<IntegerArgumentType>()
|
private static final ProperArgumentSerializer<IntegerArgumentType> INTEGER = new ProperArgumentSerializer<IntegerArgumentType>()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
protected IntegerArgumentType read(ByteBuf buf)
|
protected IntegerArgumentType read(ByteBuf buf)
|
||||||
@ -439,8 +474,20 @@ public class Commands extends DefinedPacket
|
|||||||
buf.writeInt( t.getMaximum() );
|
buf.writeInt( t.getMaximum() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getIntKey()
|
||||||
|
{
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getKey()
|
||||||
|
{
|
||||||
|
return "brigadier:integer";
|
||||||
|
}
|
||||||
};
|
};
|
||||||
private static final ArgumentSerializer<LongArgumentType> LONG = new ArgumentSerializer<LongArgumentType>()
|
private static final ProperArgumentSerializer<LongArgumentType> LONG = new ProperArgumentSerializer<LongArgumentType>()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
protected LongArgumentType read(ByteBuf buf)
|
protected LongArgumentType read(ByteBuf buf)
|
||||||
@ -468,6 +515,18 @@ public class Commands extends DefinedPacket
|
|||||||
buf.writeLong( t.getMaximum() );
|
buf.writeLong( t.getMaximum() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getIntKey()
|
||||||
|
{
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getKey()
|
||||||
|
{
|
||||||
|
return "brigadier:long";
|
||||||
|
}
|
||||||
};
|
};
|
||||||
private static final ProperArgumentSerializer<StringArgumentType> STRING = new ProperArgumentSerializer<StringArgumentType>()
|
private static final ProperArgumentSerializer<StringArgumentType> STRING = new ProperArgumentSerializer<StringArgumentType>()
|
||||||
{
|
{
|
||||||
@ -523,11 +582,20 @@ public class Commands extends DefinedPacket
|
|||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
register( "brigadier:bool", VOID );
|
register( "brigadier:bool", BOOLEAN );
|
||||||
|
PROPER_PROVIDERS.put( BoolArgumentType.class, BOOLEAN );
|
||||||
|
|
||||||
register( "brigadier:float", FLOAT );
|
register( "brigadier:float", FLOAT );
|
||||||
|
PROPER_PROVIDERS.put( FloatArgumentType.class, FLOAT );
|
||||||
|
|
||||||
register( "brigadier:double", DOUBLE );
|
register( "brigadier:double", DOUBLE );
|
||||||
|
PROPER_PROVIDERS.put( DoubleArgumentType.class, DOUBLE );
|
||||||
|
|
||||||
register( "brigadier:integer", INTEGER );
|
register( "brigadier:integer", INTEGER );
|
||||||
register( "brigadier:long", LONG );
|
PROPER_PROVIDERS.put( IntegerArgumentType.class, INTEGER );
|
||||||
|
|
||||||
|
register( "brigadier:long", LONG ); // 1.14+
|
||||||
|
PROPER_PROVIDERS.put( LongArgumentType.class, LONG );
|
||||||
|
|
||||||
register( "brigadier:string", STRING );
|
register( "brigadier:string", STRING );
|
||||||
PROPER_PROVIDERS.put( StringArgumentType.class, STRING );
|
PROPER_PROVIDERS.put( StringArgumentType.class, STRING );
|
||||||
@ -575,13 +643,522 @@ public class Commands extends DefinedPacket
|
|||||||
register( "minecraft:template_rotation", VOID ); // 1.19
|
register( "minecraft:template_rotation", VOID ); // 1.19
|
||||||
register( "minecraft:uuid", VOID ); // 1.16
|
register( "minecraft:uuid", VOID ); // 1.16
|
||||||
|
|
||||||
|
register( "minecraft:gamemode", VOID ); // 1.19.3
|
||||||
|
register( "minecraft:resource_or_tag_key", RAW_STRING ); // 1.19.3
|
||||||
|
register( "minecraft:resource_key", RAW_STRING ); // 1.19.3
|
||||||
|
|
||||||
register( "minecraft:nbt", VOID ); // 1.13 // removed
|
register( "minecraft:nbt", VOID ); // 1.13 // removed
|
||||||
|
IDS_1_19 = 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:mob_effect" ),
|
||||||
|
get( "minecraft:function" ),
|
||||||
|
get( "minecraft:entity_anchor" ),
|
||||||
|
get( "minecraft:int_range" ),
|
||||||
|
get( "minecraft:float_range" ),
|
||||||
|
get( "minecraft:item_enchantment" ),
|
||||||
|
get( "minecraft:entity_summon" ),
|
||||||
|
get( "minecraft:dimension" ),
|
||||||
|
get( "minecraft:time" ),
|
||||||
|
get( "minecraft:resource_or_tag" ),
|
||||||
|
get( "minecraft:resource" ),
|
||||||
|
get( "minecraft:template_mirror" ),
|
||||||
|
get( "minecraft:template_rotation" ),
|
||||||
|
get( "minecraft:uuid" )
|
||||||
|
};
|
||||||
|
|
||||||
|
IDS_1_19_3 = 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" )
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void register(String name, ArgumentSerializer serializer)
|
private static void register(String name, ArgumentSerializer serializer)
|
||||||
{
|
{
|
||||||
PROVIDERS.put( name, serializer );
|
PROVIDERS.put( name, serializer );
|
||||||
PROVIDER_LIST.add( serializer );
|
}
|
||||||
|
|
||||||
|
private static ArgumentSerializer get(String name)
|
||||||
|
{
|
||||||
|
return PROVIDERS.get( name );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Minecraft ArgumentType {@code minecraft:entity}.
|
||||||
|
* @param singleEntity if the argument restrict to only one entity
|
||||||
|
* @param onlyPlayers if the argument restrict to players only
|
||||||
|
* @return an ArgumentType instance
|
||||||
|
*/
|
||||||
|
public static ArgumentType<?> minecraftEntity(boolean singleEntity, boolean onlyPlayers)
|
||||||
|
{
|
||||||
|
byte flags = 0;
|
||||||
|
if ( singleEntity )
|
||||||
|
{
|
||||||
|
flags |= 1;
|
||||||
|
}
|
||||||
|
if ( onlyPlayers )
|
||||||
|
{
|
||||||
|
flags |= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
return minecraftArgumentType( "minecraft:entity", flags );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Minecraft ArgumentType {@code minecraft:game_profile}.
|
||||||
|
* @return an ArgumentType instance
|
||||||
|
*/
|
||||||
|
public static ArgumentType<?> minecraftGameProfile()
|
||||||
|
{
|
||||||
|
return minecraftArgumentType( "minecraft:game_profile", null );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Minecraft ArgumentType {@code minecraft:block_pos}.
|
||||||
|
* @return an ArgumentType instance
|
||||||
|
*/
|
||||||
|
public static ArgumentType<?> minecraftBlockPos()
|
||||||
|
{
|
||||||
|
return minecraftArgumentType( "minecraft:block_pos", null );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Minecraft ArgumentType {@code minecraft:column_pos}.
|
||||||
|
* @return an ArgumentType instance
|
||||||
|
*/
|
||||||
|
public static ArgumentType<?> minecraftColumnPos()
|
||||||
|
{
|
||||||
|
return minecraftArgumentType( "minecraft:column_pos", null );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Minecraft ArgumentType {@code minecraft:vec3}.
|
||||||
|
* @return an ArgumentType instance
|
||||||
|
*/
|
||||||
|
public static ArgumentType<?> minecraftVec3()
|
||||||
|
{
|
||||||
|
return minecraftArgumentType( "minecraft:vec3", null );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Minecraft ArgumentType {@code minecraft:vec2}.
|
||||||
|
* @return an ArgumentType instance
|
||||||
|
*/
|
||||||
|
public static ArgumentType<?> minecraftVec2()
|
||||||
|
{
|
||||||
|
return minecraftArgumentType( "minecraft:vec2", null );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Minecraft ArgumentType {@code minecraft:block_state}.
|
||||||
|
* @return an ArgumentType instance
|
||||||
|
*/
|
||||||
|
public static ArgumentType<?> minecraftBlockState()
|
||||||
|
{
|
||||||
|
return minecraftArgumentType( "minecraft:block_state", null );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Minecraft ArgumentType {@code minecraft:block_predicate}.
|
||||||
|
* @return an ArgumentType instance
|
||||||
|
*/
|
||||||
|
public static ArgumentType<?> minecraftBlockPredicate()
|
||||||
|
{
|
||||||
|
return minecraftArgumentType( "minecraft:block_predicate", null );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Minecraft ArgumentType {@code minecraft:item_stack}.
|
||||||
|
* @return an ArgumentType instance
|
||||||
|
*/
|
||||||
|
public static ArgumentType<?> minecraftItemStack()
|
||||||
|
{
|
||||||
|
return minecraftArgumentType( "minecraft:item_stack", null );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Minecraft ArgumentType {@code minecraft:item_predicate}.
|
||||||
|
* @return an ArgumentType instance
|
||||||
|
*/
|
||||||
|
public static ArgumentType<?> minecraftItemPredicate()
|
||||||
|
{
|
||||||
|
return minecraftArgumentType( "minecraft:item_predicate", null );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Minecraft ArgumentType {@code minecraft:color}.
|
||||||
|
* @return an ArgumentType instance
|
||||||
|
*/
|
||||||
|
public static ArgumentType<?> minecraftColor()
|
||||||
|
{
|
||||||
|
return minecraftArgumentType( "minecraft:color", null );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Minecraft ArgumentType {@code minecraft:component}.
|
||||||
|
* @return an ArgumentType instance
|
||||||
|
*/
|
||||||
|
public static ArgumentType<?> minecraftComponent()
|
||||||
|
{
|
||||||
|
return minecraftArgumentType( "minecraft:component", null );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Minecraft ArgumentType {@code minecraft:message}.
|
||||||
|
* @return an ArgumentType instance
|
||||||
|
*/
|
||||||
|
public static ArgumentType<?> minecraftMessage()
|
||||||
|
{
|
||||||
|
return minecraftArgumentType( "minecraft:message", null );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Minecraft ArgumentType {@code minecraft:nbt_compound_tag}.
|
||||||
|
* @return an ArgumentType instance
|
||||||
|
*/
|
||||||
|
public static ArgumentType<?> minecraftNBTCompoundTag()
|
||||||
|
{
|
||||||
|
return minecraftArgumentType( "minecraft:nbt_compound_tag", null );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Minecraft ArgumentType {@code minecraft:nbt_tag}.
|
||||||
|
* @return an ArgumentType instance
|
||||||
|
*/
|
||||||
|
public static ArgumentType<?> minecraftNBTTag()
|
||||||
|
{
|
||||||
|
return minecraftArgumentType( "minecraft:nbt_tag", null );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Minecraft ArgumentType {@code minecraft:nbt}.
|
||||||
|
* @return an ArgumentType instance
|
||||||
|
*/
|
||||||
|
public static ArgumentType<?> minecraftNBT()
|
||||||
|
{
|
||||||
|
return minecraftArgumentType( "minecraft:nbt", null );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Minecraft ArgumentType {@code minecraft:nbt_path}.
|
||||||
|
* @return an ArgumentType instance
|
||||||
|
*/
|
||||||
|
public static ArgumentType<?> minecraftNBTPath()
|
||||||
|
{
|
||||||
|
return minecraftArgumentType( "minecraft:nbt_path", null );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Minecraft ArgumentType {@code minecraft:objective}.
|
||||||
|
* @return an ArgumentType instance
|
||||||
|
*/
|
||||||
|
public static ArgumentType<?> minecraftObjective()
|
||||||
|
{
|
||||||
|
return minecraftArgumentType( "minecraft:objective", null );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Minecraft ArgumentType {@code minecraft:objective_criteria}.
|
||||||
|
* @return an ArgumentType instance
|
||||||
|
*/
|
||||||
|
public static ArgumentType<?> minecraftObjectiveCriteria()
|
||||||
|
{
|
||||||
|
return minecraftArgumentType( "minecraft:objective_criteria", null );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Minecraft ArgumentType {@code minecraft:operation}.
|
||||||
|
* @return an ArgumentType instance
|
||||||
|
*/
|
||||||
|
public static ArgumentType<?> minecraftOperation()
|
||||||
|
{
|
||||||
|
return minecraftArgumentType( "minecraft:operation", null );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Minecraft ArgumentType {@code minecraft:particle}.
|
||||||
|
* @return an ArgumentType instance
|
||||||
|
*/
|
||||||
|
public static ArgumentType<?> minecraftParticle()
|
||||||
|
{
|
||||||
|
return minecraftArgumentType( "minecraft:particle", null );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Minecraft ArgumentType {@code minecraft:rotation}.
|
||||||
|
* @return an ArgumentType instance
|
||||||
|
*/
|
||||||
|
public static ArgumentType<?> minecraftRotation()
|
||||||
|
{
|
||||||
|
return minecraftArgumentType( "minecraft:rotation", null );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Minecraft ArgumentType {@code minecraft:scoreboard_slot}.
|
||||||
|
* @return an ArgumentType instance
|
||||||
|
*/
|
||||||
|
public static ArgumentType<?> minecraftScoreboardSlot()
|
||||||
|
{
|
||||||
|
return minecraftArgumentType( "minecraft:scoreboard_slot", null );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Minecraft ArgumentType {@code minecraft:score_holder}.
|
||||||
|
* @param allowMultiple if the argument allows multiple entities
|
||||||
|
* @return an ArgumentType instance
|
||||||
|
*/
|
||||||
|
public static ArgumentType<?> minecraftScoreHolder(boolean allowMultiple)
|
||||||
|
{
|
||||||
|
byte flags = 0;
|
||||||
|
if ( allowMultiple )
|
||||||
|
{
|
||||||
|
flags |= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return minecraftArgumentType( "minecraft:score_holder", flags );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Minecraft ArgumentType {@code minecraft:swizzle}.
|
||||||
|
* @return an ArgumentType instance
|
||||||
|
*/
|
||||||
|
public static ArgumentType<?> minecraftSwizzle()
|
||||||
|
{
|
||||||
|
return minecraftArgumentType( "minecraft:swizzle", null );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Minecraft ArgumentType {@code minecraft:team}.
|
||||||
|
* @return an ArgumentType instance
|
||||||
|
*/
|
||||||
|
public static ArgumentType<?> minecraftTeam()
|
||||||
|
{
|
||||||
|
return minecraftArgumentType( "minecraft:team", null );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Minecraft ArgumentType {@code minecraft:item_slot}.
|
||||||
|
* @return an ArgumentType instance
|
||||||
|
*/
|
||||||
|
public static ArgumentType<?> minecraftItemSlot()
|
||||||
|
{
|
||||||
|
return minecraftArgumentType( "minecraft:item_slot", null );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Minecraft ArgumentType {@code minecraft:resource_location}.
|
||||||
|
* @return an ArgumentType instance
|
||||||
|
*/
|
||||||
|
public static ArgumentType<?> minecraftResourceLocation()
|
||||||
|
{
|
||||||
|
return minecraftArgumentType( "minecraft:resource_location", null );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Minecraft ArgumentType {@code minecraft:mob_effect}.
|
||||||
|
* @return an ArgumentType instance
|
||||||
|
*/
|
||||||
|
public static ArgumentType<?> minecraftMobEffect()
|
||||||
|
{
|
||||||
|
return minecraftArgumentType( "minecraft:mob_effect", null );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Minecraft ArgumentType {@code minecraft:function}.
|
||||||
|
* @return an ArgumentType instance
|
||||||
|
*/
|
||||||
|
public static ArgumentType<?> minecraftFunction()
|
||||||
|
{
|
||||||
|
return minecraftArgumentType( "minecraft:function", null );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Minecraft ArgumentType {@code minecraft:entity_anchor}.
|
||||||
|
* @return an ArgumentType instance
|
||||||
|
*/
|
||||||
|
public static ArgumentType<?> minecraftEntityAnchor()
|
||||||
|
{
|
||||||
|
return minecraftArgumentType( "minecraft:entity_anchor", null );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Minecraft ArgumentType {@code minecraft:int_range}.
|
||||||
|
* @return an ArgumentType instance
|
||||||
|
*/
|
||||||
|
public static ArgumentType<?> minecraftIntRange()
|
||||||
|
{
|
||||||
|
return minecraftArgumentType( "minecraft:int_range", null );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Minecraft ArgumentType {@code minecraft:float_range}.
|
||||||
|
* @return an ArgumentType instance
|
||||||
|
*/
|
||||||
|
public static ArgumentType<?> minecraftFloatRange()
|
||||||
|
{
|
||||||
|
return minecraftArgumentType( "minecraft:float_range", null );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Minecraft ArgumentType {@code minecraft:item_enchantment}.
|
||||||
|
* @return an ArgumentType instance
|
||||||
|
*/
|
||||||
|
public static ArgumentType<?> minecraftItemEnchantment()
|
||||||
|
{
|
||||||
|
return minecraftArgumentType( "minecraft:item_enchantment", null );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Minecraft ArgumentType {@code minecraft:entity_summon}.
|
||||||
|
* @return an ArgumentType instance
|
||||||
|
*/
|
||||||
|
public static ArgumentType<?> minecraftEntitySummon()
|
||||||
|
{
|
||||||
|
return minecraftArgumentType( "minecraft:entity_summon", null );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Minecraft ArgumentType {@code minecraft:dimension}.
|
||||||
|
* @return an ArgumentType instance
|
||||||
|
*/
|
||||||
|
public static ArgumentType<?> minecraftDimension()
|
||||||
|
{
|
||||||
|
return minecraftArgumentType( "minecraft:dimension", null );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Minecraft ArgumentType {@code minecraft:time}.
|
||||||
|
* @return an ArgumentType instance
|
||||||
|
*/
|
||||||
|
public static ArgumentType<?> minecraftTime()
|
||||||
|
{
|
||||||
|
return minecraftArgumentType( "minecraft:time", null );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Minecraft ArgumentType {@code minecraft:uuid}.
|
||||||
|
* @return an ArgumentType instance
|
||||||
|
*/
|
||||||
|
public static ArgumentType<?> minecraftUUID()
|
||||||
|
{
|
||||||
|
return minecraftArgumentType( "minecraft:uuid", null );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Minecraft ArgumentType {@code minecraft:angle}.
|
||||||
|
* @return an ArgumentType instance
|
||||||
|
*/
|
||||||
|
public static ArgumentType<?> minecraftAngle()
|
||||||
|
{
|
||||||
|
return minecraftArgumentType( "minecraft:angle", null );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Minecraft ArgumentType {@code minecraft:resource}.
|
||||||
|
* @param rawString the raw string for the argument
|
||||||
|
* @return an ArgumentType instance
|
||||||
|
*/
|
||||||
|
public static ArgumentType<?> minecraftResource(String rawString)
|
||||||
|
{
|
||||||
|
return minecraftArgumentType( "minecraft:resource", rawString );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Minecraft ArgumentType {@code minecraft:resource_or_tag}.
|
||||||
|
* @param rawString the raw string for the argument
|
||||||
|
* @return an ArgumentType instance
|
||||||
|
*/
|
||||||
|
public static ArgumentType<?> minecraftResourceOrTag(String rawString)
|
||||||
|
{
|
||||||
|
return minecraftArgumentType( "minecraft:resource_or_tag", rawString );
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ArgumentType<?> minecraftArgumentType(String key, Object rawValue)
|
||||||
|
{
|
||||||
|
ArgumentSerializer reader = PROVIDERS.get( key );
|
||||||
|
Preconditions.checkArgument( reader != null, "No provider for argument " + key );
|
||||||
|
|
||||||
|
return new DummyType( key, reader, rawValue );
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ArgumentType<?> read(ByteBuf buf, int protocolVersion)
|
private static ArgumentType<?> read(ByteBuf buf, int protocolVersion)
|
||||||
@ -592,7 +1169,14 @@ public class Commands extends DefinedPacket
|
|||||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19 )
|
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19 )
|
||||||
{
|
{
|
||||||
key = readVarInt( buf );
|
key = readVarInt( buf );
|
||||||
reader = PROVIDER_LIST.get( (Integer) key );
|
|
||||||
|
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_3 )
|
||||||
|
{
|
||||||
|
reader = IDS_1_19_3[(Integer) key];
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
reader = IDS_1_19[(Integer) key];
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
key = readString( buf );
|
key = readString( buf );
|
||||||
@ -697,11 +1281,15 @@ public class Commands extends DefinedPacket
|
|||||||
|
|
||||||
private static String getKey(SuggestionProvider<DummyProvider> provider)
|
private static String getKey(SuggestionProvider<DummyProvider> provider)
|
||||||
{
|
{
|
||||||
Preconditions.checkArgument( provider instanceof DummyProvider, "Non dummy provider " + provider );
|
Preconditions.checkNotNull( provider );
|
||||||
|
if ( provider instanceof DummyProvider )
|
||||||
|
{
|
||||||
return ( (DummyProvider) provider ).key;
|
return ( (DummyProvider) provider ).key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return ( (DummyProvider) ASK_SERVER ).key;
|
||||||
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
private static final class DummyProvider implements SuggestionProvider<DummyProvider>
|
private static final class DummyProvider implements SuggestionProvider<DummyProvider>
|
||||||
{
|
{
|
||||||
|
@ -23,7 +23,7 @@ public class EncryptionResponse extends DefinedPacket
|
|||||||
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||||
{
|
{
|
||||||
sharedSecret = readArray( buf, 128 );
|
sharedSecret = readArray( buf, 128 );
|
||||||
if ( protocolVersion < ProtocolConstants.MINECRAFT_1_19 || buf.readBoolean() )
|
if ( protocolVersion < ProtocolConstants.MINECRAFT_1_19 || protocolVersion >= ProtocolConstants.MINECRAFT_1_19_3 || buf.readBoolean() )
|
||||||
{
|
{
|
||||||
verifyToken = readArray( buf, 128 );
|
verifyToken = readArray( buf, 128 );
|
||||||
} else
|
} else
|
||||||
@ -38,7 +38,7 @@ public class EncryptionResponse extends DefinedPacket
|
|||||||
writeArray( sharedSecret, buf );
|
writeArray( sharedSecret, buf );
|
||||||
if ( verifyToken != null )
|
if ( verifyToken != null )
|
||||||
{
|
{
|
||||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19 )
|
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19 && protocolVersion <= ProtocolConstants.MINECRAFT_1_19_3 )
|
||||||
{
|
{
|
||||||
buf.writeBoolean( true );
|
buf.writeBoolean( true );
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ public class LoginRequest extends DefinedPacket
|
|||||||
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||||
{
|
{
|
||||||
data = readString( buf, 16 );
|
data = readString( buf, 16 );
|
||||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19 )
|
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19 && protocolVersion < ProtocolConstants.MINECRAFT_1_19_3 )
|
||||||
{
|
{
|
||||||
publicKey = readPublicKey( buf );
|
publicKey = readPublicKey( buf );
|
||||||
}
|
}
|
||||||
@ -43,7 +43,7 @@ public class LoginRequest extends DefinedPacket
|
|||||||
public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||||
{
|
{
|
||||||
writeString( data, buf );
|
writeString( data, buf );
|
||||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19 )
|
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19 && protocolVersion < ProtocolConstants.MINECRAFT_1_19_3 )
|
||||||
{
|
{
|
||||||
writePublicKey( publicKey, buf );
|
writePublicKey( publicKey, buf );
|
||||||
}
|
}
|
||||||
|
@ -123,21 +123,26 @@ public class PlayerListItem extends DefinedPacket
|
|||||||
{
|
{
|
||||||
|
|
||||||
// ALL
|
// ALL
|
||||||
private UUID uuid;
|
UUID uuid;
|
||||||
|
|
||||||
// ADD_PLAYER
|
// ADD_PLAYER
|
||||||
private String username;
|
String username;
|
||||||
private Property[] properties;
|
Property[] properties;
|
||||||
private PlayerPublicKey publicKey;
|
|
||||||
|
UUID chatSessionId;
|
||||||
|
PlayerPublicKey publicKey;
|
||||||
|
|
||||||
|
// UPDATE_LISTED
|
||||||
|
Boolean listed;
|
||||||
|
|
||||||
// ADD_PLAYER & UPDATE_GAMEMODE
|
// ADD_PLAYER & UPDATE_GAMEMODE
|
||||||
private int gamemode;
|
Integer gamemode;
|
||||||
|
|
||||||
// ADD_PLAYER & UPDATE_LATENCY
|
// ADD_PLAYER & UPDATE_LATENCY
|
||||||
private int ping;
|
Integer ping;
|
||||||
|
|
||||||
// ADD_PLAYER & UPDATE_DISPLAY_NAME
|
// ADD_PLAYER & UPDATE_DISPLAY_NAME
|
||||||
private String displayName;
|
String displayName;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,45 @@
|
|||||||
|
package net.md_5.bungee.protocol.packet;
|
||||||
|
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import java.util.UUID;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
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
|
||||||
|
@NoArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
public class PlayerListItemRemove extends DefinedPacket
|
||||||
|
{
|
||||||
|
|
||||||
|
private UUID[] uuids;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||||
|
{
|
||||||
|
uuids = new UUID[ DefinedPacket.readVarInt( buf ) ];
|
||||||
|
for ( int i = 0; i < uuids.length; i++ )
|
||||||
|
{
|
||||||
|
uuids[i] = DefinedPacket.readUUID( buf );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||||
|
{
|
||||||
|
DefinedPacket.writeVarInt( uuids.length, buf );
|
||||||
|
for ( UUID uuid : uuids )
|
||||||
|
{
|
||||||
|
DefinedPacket.writeUUID( uuid, buf );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handle(AbstractPacketHandler handler) throws Exception
|
||||||
|
{
|
||||||
|
handler.handle( this );
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,133 @@
|
|||||||
|
package net.md_5.bungee.protocol.packet;
|
||||||
|
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import java.util.EnumSet;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import net.md_5.bungee.protocol.AbstractPacketHandler;
|
||||||
|
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.packet.PlayerListItem.Item;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
public class PlayerListItemUpdate extends DefinedPacket
|
||||||
|
{
|
||||||
|
|
||||||
|
private EnumSet<Action> actions;
|
||||||
|
private Item[] items;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void read(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||||
|
{
|
||||||
|
actions = readEnumSet( PlayerListItemUpdate.Action.class, buf );
|
||||||
|
|
||||||
|
items = new Item[ DefinedPacket.readVarInt( buf ) ];
|
||||||
|
for ( int i = 0; i < items.length; i++ )
|
||||||
|
{
|
||||||
|
Item item = items[i] = new Item();
|
||||||
|
item.setUuid( DefinedPacket.readUUID( buf ) );
|
||||||
|
|
||||||
|
for ( Action action : actions )
|
||||||
|
{
|
||||||
|
switch ( action )
|
||||||
|
{
|
||||||
|
case ADD_PLAYER:
|
||||||
|
item.username = DefinedPacket.readString( buf );
|
||||||
|
item.properties = DefinedPacket.readProperties( buf );
|
||||||
|
break;
|
||||||
|
case INITIALIZE_CHAT:
|
||||||
|
if ( buf.readBoolean() )
|
||||||
|
{
|
||||||
|
item.chatSessionId = readUUID( buf );
|
||||||
|
item.publicKey = new PlayerPublicKey( buf.readLong(), readArray( buf, 512 ), readArray( buf, 4096 ) );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case UPDATE_GAMEMODE:
|
||||||
|
item.gamemode = DefinedPacket.readVarInt( buf );
|
||||||
|
break;
|
||||||
|
case UPDATE_LISTED:
|
||||||
|
item.listed = buf.readBoolean();
|
||||||
|
break;
|
||||||
|
case UPDATE_LATENCY:
|
||||||
|
item.ping = DefinedPacket.readVarInt( buf );
|
||||||
|
break;
|
||||||
|
case UPDATE_DISPLAY_NAME:
|
||||||
|
if ( buf.readBoolean() )
|
||||||
|
{
|
||||||
|
item.displayName = DefinedPacket.readString( buf );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(ByteBuf buf, ProtocolConstants.Direction direction, int protocolVersion)
|
||||||
|
{
|
||||||
|
DefinedPacket.writeEnumSet( actions, PlayerListItemUpdate.Action.class, buf );
|
||||||
|
|
||||||
|
DefinedPacket.writeVarInt( items.length, buf );
|
||||||
|
for ( Item item : items )
|
||||||
|
{
|
||||||
|
DefinedPacket.writeUUID( item.uuid, buf );
|
||||||
|
for ( Action action : actions )
|
||||||
|
{
|
||||||
|
switch ( action )
|
||||||
|
{
|
||||||
|
case ADD_PLAYER:
|
||||||
|
DefinedPacket.writeString( item.username, buf );
|
||||||
|
DefinedPacket.writeProperties( item.properties, buf );
|
||||||
|
break;
|
||||||
|
case INITIALIZE_CHAT:
|
||||||
|
buf.writeBoolean( item.chatSessionId != null );
|
||||||
|
if ( item.chatSessionId != null )
|
||||||
|
{
|
||||||
|
writeUUID( item.chatSessionId, buf );
|
||||||
|
buf.writeLong( item.publicKey.getExpiry() );
|
||||||
|
writeArray( item.publicKey.getKey(), buf );
|
||||||
|
writeArray( item.publicKey.getSignature(), buf );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case UPDATE_GAMEMODE:
|
||||||
|
DefinedPacket.writeVarInt( item.gamemode, buf );
|
||||||
|
break;
|
||||||
|
case UPDATE_LISTED:
|
||||||
|
buf.writeBoolean( item.listed );
|
||||||
|
break;
|
||||||
|
case UPDATE_LATENCY:
|
||||||
|
DefinedPacket.writeVarInt( item.ping, buf );
|
||||||
|
break;
|
||||||
|
case UPDATE_DISPLAY_NAME:
|
||||||
|
buf.writeBoolean( item.displayName != null );
|
||||||
|
if ( item.displayName != null )
|
||||||
|
{
|
||||||
|
DefinedPacket.writeString( item.displayName, buf );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handle(AbstractPacketHandler handler) throws Exception
|
||||||
|
{
|
||||||
|
handler.handle( this );
|
||||||
|
}
|
||||||
|
|
||||||
|
public static enum Action
|
||||||
|
{
|
||||||
|
|
||||||
|
ADD_PLAYER,
|
||||||
|
INITIALIZE_CHAT,
|
||||||
|
UPDATE_GAMEMODE,
|
||||||
|
UPDATE_LISTED,
|
||||||
|
UPDATE_LATENCY,
|
||||||
|
UPDATE_DISPLAY_NAME;
|
||||||
|
}
|
||||||
|
}
|
@ -33,7 +33,10 @@ public class ServerData extends DefinedPacket
|
|||||||
icon = readString( buf );
|
icon = readString( buf );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( protocolVersion < ProtocolConstants.MINECRAFT_1_19_3 )
|
||||||
|
{
|
||||||
preview = buf.readBoolean();
|
preview = buf.readBoolean();
|
||||||
|
}
|
||||||
|
|
||||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_1 )
|
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_1 )
|
||||||
{
|
{
|
||||||
@ -62,7 +65,10 @@ public class ServerData extends DefinedPacket
|
|||||||
buf.writeBoolean( false );
|
buf.writeBoolean( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( protocolVersion < ProtocolConstants.MINECRAFT_1_19_3 )
|
||||||
|
{
|
||||||
buf.writeBoolean( preview );
|
buf.writeBoolean( preview );
|
||||||
|
}
|
||||||
|
|
||||||
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_1 )
|
if ( protocolVersion >= ProtocolConstants.MINECRAFT_1_19_1 )
|
||||||
{
|
{
|
||||||
|
@ -4,13 +4,12 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>fr.pandacube.bungeecord</groupId>
|
||||||
<artifactId>bungeecord-parent</artifactId>
|
<artifactId>bungeecord-parent</artifactId>
|
||||||
<version>1.19-R0.1-SNAPSHOT</version>
|
<version>1.19-R0.1-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>net.md-5</groupId>
|
|
||||||
<artifactId>bungeecord-proxy</artifactId>
|
<artifactId>bungeecord-proxy</artifactId>
|
||||||
<version>1.19-R0.1-SNAPSHOT</version>
|
<version>1.19-R0.1-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
@ -57,37 +56,37 @@
|
|||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>fr.pandacube.bungeecord</groupId>
|
||||||
<artifactId>bungeecord-api</artifactId>
|
<artifactId>bungeecord-api</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>fr.pandacube.bungeecord</groupId>
|
||||||
<artifactId>bungeecord-log</artifactId>
|
<artifactId>bungeecord-log</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>fr.pandacube.bungeecord</groupId>
|
||||||
<artifactId>bungeecord-native</artifactId>
|
<artifactId>bungeecord-native</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>fr.pandacube.bungeecord</groupId>
|
||||||
<artifactId>bungeecord-protocol</artifactId>
|
<artifactId>bungeecord-protocol</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>fr.pandacube.bungeecord</groupId>
|
||||||
<artifactId>bungeecord-query</artifactId>
|
<artifactId>bungeecord-query</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>fr.pandacube.bungeecord</groupId>
|
||||||
<artifactId>bungeecord-slf4j</artifactId>
|
<artifactId>bungeecord-slf4j</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
|
@ -89,7 +89,6 @@ import net.md_5.bungee.forge.ForgeConstants;
|
|||||||
import net.md_5.bungee.log.BungeeLogger;
|
import net.md_5.bungee.log.BungeeLogger;
|
||||||
import net.md_5.bungee.log.LoggingForwardHandler;
|
import net.md_5.bungee.log.LoggingForwardHandler;
|
||||||
import net.md_5.bungee.log.LoggingOutputStream;
|
import net.md_5.bungee.log.LoggingOutputStream;
|
||||||
import net.md_5.bungee.module.ModuleManager;
|
|
||||||
import net.md_5.bungee.netty.PipelineUtils;
|
import net.md_5.bungee.netty.PipelineUtils;
|
||||||
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;
|
||||||
@ -173,7 +172,6 @@ public class BungeeCord extends ProxyServer
|
|||||||
.registerTypeAdapter( Favicon.class, Favicon.getFaviconTypeAdapter() ).create();
|
.registerTypeAdapter( Favicon.class, Favicon.getFaviconTypeAdapter() ).create();
|
||||||
@Getter
|
@Getter
|
||||||
private ConnectionThrottle connectionThrottle;
|
private ConnectionThrottle connectionThrottle;
|
||||||
private final ModuleManager moduleManager = new ModuleManager();
|
|
||||||
|
|
||||||
{
|
{
|
||||||
// TODO: Proper fallback when we interface the manager
|
// TODO: Proper fallback when we interface the manager
|
||||||
@ -271,10 +269,6 @@ public class BungeeCord extends ProxyServer
|
|||||||
|
|
||||||
eventLoops = PipelineUtils.newEventLoopGroup( 0, new ThreadFactoryBuilder().setNameFormat( "Netty IO Thread #%1$d" ).build() );
|
eventLoops = PipelineUtils.newEventLoopGroup( 0, new ThreadFactoryBuilder().setNameFormat( "Netty IO Thread #%1$d" ).build() );
|
||||||
|
|
||||||
File moduleDirectory = new File( "modules" );
|
|
||||||
moduleManager.load( this, moduleDirectory );
|
|
||||||
pluginManager.detectPlugins( moduleDirectory );
|
|
||||||
|
|
||||||
pluginsFolder.mkdir();
|
pluginsFolder.mkdir();
|
||||||
pluginManager.detectPlugins( pluginsFolder );
|
pluginManager.detectPlugins( pluginsFolder );
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@ import java.text.SimpleDateFormat;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import joptsimple.OptionParser;
|
import joptsimple.OptionParser;
|
||||||
import joptsimple.OptionSet;
|
import joptsimple.OptionSet;
|
||||||
import net.md_5.bungee.api.ChatColor;
|
import net.md_5.bungee.api.ChatColor;
|
||||||
@ -56,8 +55,7 @@ public class BungeeCordLauncher
|
|||||||
System.err.println( "*** Warning, this build is outdated ***" );
|
System.err.println( "*** Warning, this build is outdated ***" );
|
||||||
System.err.println( "*** Please download a new build from http://ci.md-5.net/job/BungeeCord ***" );
|
System.err.println( "*** Please download a new build from http://ci.md-5.net/job/BungeeCord ***" );
|
||||||
System.err.println( "*** You will get NO support regarding this build ***" );
|
System.err.println( "*** You will get NO support regarding this build ***" );
|
||||||
System.err.println( "*** Server will start in 10 seconds ***" );
|
|
||||||
Thread.sleep( TimeUnit.SECONDS.toMillis( 10 ) );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import com.google.common.collect.Lists;
|
|||||||
import com.google.common.io.ByteArrayDataOutput;
|
import com.google.common.io.ByteArrayDataOutput;
|
||||||
import com.google.common.io.ByteStreams;
|
import com.google.common.io.ByteStreams;
|
||||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||||
|
import com.mojang.brigadier.builder.ArgumentBuilder;
|
||||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||||
import com.mojang.brigadier.builder.RequiredArgumentBuilder;
|
import com.mojang.brigadier.builder.RequiredArgumentBuilder;
|
||||||
import com.mojang.brigadier.context.StringRange;
|
import com.mojang.brigadier.context.StringRange;
|
||||||
@ -19,8 +20,11 @@ import io.netty.channel.unix.DomainSocketAddress;
|
|||||||
import java.io.DataInput;
|
import java.io.DataInput;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.IdentityHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.logging.Level;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import net.md_5.bungee.ServerConnection;
|
import net.md_5.bungee.ServerConnection;
|
||||||
import net.md_5.bungee.ServerConnection.KeepAliveData;
|
import net.md_5.bungee.ServerConnection.KeepAliveData;
|
||||||
@ -31,6 +35,7 @@ import net.md_5.bungee.api.chat.BaseComponent;
|
|||||||
import net.md_5.bungee.api.chat.TextComponent;
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
import net.md_5.bungee.api.config.ServerInfo;
|
import net.md_5.bungee.api.config.ServerInfo;
|
||||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||||
|
import net.md_5.bungee.api.event.CommandsDeclareEvent;
|
||||||
import net.md_5.bungee.api.event.PluginMessageEvent;
|
import net.md_5.bungee.api.event.PluginMessageEvent;
|
||||||
import net.md_5.bungee.api.event.ServerConnectEvent;
|
import net.md_5.bungee.api.event.ServerConnectEvent;
|
||||||
import net.md_5.bungee.api.event.ServerDisconnectEvent;
|
import net.md_5.bungee.api.event.ServerDisconnectEvent;
|
||||||
@ -54,6 +59,8 @@ import net.md_5.bungee.protocol.packet.Commands;
|
|||||||
import net.md_5.bungee.protocol.packet.KeepAlive;
|
import net.md_5.bungee.protocol.packet.KeepAlive;
|
||||||
import net.md_5.bungee.protocol.packet.Kick;
|
import net.md_5.bungee.protocol.packet.Kick;
|
||||||
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.PlayerListItemUpdate;
|
||||||
import net.md_5.bungee.protocol.packet.PluginMessage;
|
import net.md_5.bungee.protocol.packet.PluginMessage;
|
||||||
import net.md_5.bungee.protocol.packet.Respawn;
|
import net.md_5.bungee.protocol.packet.Respawn;
|
||||||
import net.md_5.bungee.protocol.packet.ScoreboardDisplay;
|
import net.md_5.bungee.protocol.packet.ScoreboardDisplay;
|
||||||
@ -153,6 +160,20 @@ public class DownstreamBridge extends PacketHandler
|
|||||||
throw CancelSendSignal.INSTANCE; // Always throw because of profile rewriting
|
throw CancelSendSignal.INSTANCE; // Always throw because of profile rewriting
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handle(PlayerListItemRemove playerList) throws Exception
|
||||||
|
{
|
||||||
|
con.getTabListHandler().onUpdate( TabList.rewrite( playerList ) );
|
||||||
|
throw CancelSendSignal.INSTANCE; // Always throw because of profile rewriting
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handle(PlayerListItemUpdate playerList) throws Exception
|
||||||
|
{
|
||||||
|
con.getTabListHandler().onUpdate( TabList.rewrite( playerList ) );
|
||||||
|
throw CancelSendSignal.INSTANCE; // Always throw because of profile rewriting
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handle(ScoreboardObjective objective) throws Exception
|
public void handle(ScoreboardObjective objective) throws Exception
|
||||||
{
|
{
|
||||||
@ -276,7 +297,7 @@ public class DownstreamBridge extends PacketHandler
|
|||||||
Preconditions.checkState( !serverBrand.contains( bungee.getName() ), "Cannot connect proxy to itself!" );
|
Preconditions.checkState( !serverBrand.contains( bungee.getName() ), "Cannot connect proxy to itself!" );
|
||||||
|
|
||||||
brand = ByteBufAllocator.DEFAULT.heapBuffer();
|
brand = ByteBufAllocator.DEFAULT.heapBuffer();
|
||||||
DefinedPacket.writeString( bungee.getName() + " (" + bungee.getVersion() + ")" + " <- " + serverBrand, brand );
|
DefinedPacket.writeString( bungee.getName() + " (" + bungee.getVersion() + ")" + " <- " + server.getInfo().getName() + " (" + serverBrand + ")", brand );
|
||||||
pluginMessage.setData( DefinedPacket.toArray( brand ) );
|
pluginMessage.setData( DefinedPacket.toArray( brand ) );
|
||||||
brand.release();
|
brand.release();
|
||||||
// changes in the packet are ignored so we need to send it manually
|
// changes in the packet are ignored so we need to send it manually
|
||||||
@ -658,6 +679,11 @@ public class DownstreamBridge extends PacketHandler
|
|||||||
{
|
{
|
||||||
boolean modified = false;
|
boolean modified = false;
|
||||||
|
|
||||||
|
CommandsDeclareEvent commandsDeclareEvent = new CommandsDeclareEvent( server, con, commands.getRoot() );
|
||||||
|
bungee.getPluginManager().callEvent( commandsDeclareEvent );
|
||||||
|
|
||||||
|
modified = commandsDeclareEvent.isModified();
|
||||||
|
|
||||||
for ( Map.Entry<String, Command> command : bungee.getPluginManager().getCommands() )
|
for ( Map.Entry<String, Command> command : bungee.getPluginManager().getCommands() )
|
||||||
{
|
{
|
||||||
if ( !bungee.getDisabledCommands().contains( command.getKey() ) && commands.getRoot().getChild( command.getKey() ) == null && command.getValue().hasPermission( con ) )
|
if ( !bungee.getDisabledCommands().contains( command.getKey() ) && commands.getRoot().getChild( command.getKey() ) == null && command.getValue().hasPermission( con ) )
|
||||||
@ -674,11 +700,65 @@ public class DownstreamBridge extends PacketHandler
|
|||||||
|
|
||||||
if ( modified )
|
if ( modified )
|
||||||
{
|
{
|
||||||
|
commands.setRoot( (com.mojang.brigadier.tree.RootCommandNode) filterCommandNode( commands.getRoot(), new IdentityHashMap<>() ) );
|
||||||
con.unsafe().sendPacket( commands );
|
con.unsafe().sendPacket( commands );
|
||||||
throw CancelSendSignal.INSTANCE;
|
throw CancelSendSignal.INSTANCE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create a deep copy of the provided command node but removes any node that are not accessible by the player
|
||||||
|
* (using {@link CommandNode#getRequirement()})
|
||||||
|
*/
|
||||||
|
private CommandNode filterCommandNode(CommandNode source, IdentityHashMap<CommandNode, CommandNode> commandNodeMapping)
|
||||||
|
{
|
||||||
|
CommandNode dest;
|
||||||
|
if ( source instanceof com.mojang.brigadier.tree.RootCommandNode )
|
||||||
|
{
|
||||||
|
dest = new com.mojang.brigadier.tree.RootCommandNode();
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
if ( source.getRequirement() != null )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if ( !source.getRequirement().test( con ) )
|
||||||
|
{
|
||||||
|
commandNodeMapping.put( source, null );
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} catch ( Throwable t )
|
||||||
|
{
|
||||||
|
ProxyServer.getInstance().getLogger().log( Level.SEVERE, "Requirement test for command node " + source + " encountered an exception", t );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ArgumentBuilder destChildBuilder = source.createBuilder();
|
||||||
|
destChildBuilder.requires( sender -> true );
|
||||||
|
if ( destChildBuilder.getRedirect() != null )
|
||||||
|
{
|
||||||
|
if ( commandNodeMapping.containsKey( destChildBuilder.getRedirect() ) )
|
||||||
|
destChildBuilder.redirect( commandNodeMapping.get( destChildBuilder.getRedirect() ) );
|
||||||
|
else
|
||||||
|
destChildBuilder.redirect( filterCommandNode( destChildBuilder.getRedirect(), commandNodeMapping ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
dest = destChildBuilder.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
commandNodeMapping.put( source, dest );
|
||||||
|
|
||||||
|
for ( CommandNode sourceChild : (Collection<CommandNode>) source.getChildren() )
|
||||||
|
{
|
||||||
|
CommandNode destChild = filterCommandNode( sourceChild, commandNodeMapping );
|
||||||
|
if ( destChild == null )
|
||||||
|
continue;
|
||||||
|
dest.addChild( destChild );
|
||||||
|
}
|
||||||
|
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handle(ServerData serverData) throws Exception
|
public void handle(ServerData serverData) throws Exception
|
||||||
{
|
{
|
||||||
|
@ -112,6 +112,15 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
|||||||
@Getter
|
@Getter
|
||||||
private String extraDataInHandshake = "";
|
private String extraDataInHandshake = "";
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private boolean duplication = false;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private String realName = null;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private UUID realId = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldHandle(PacketWrapper packet) throws Exception
|
public boolean shouldHandle(PacketWrapper packet) throws Exception
|
||||||
{
|
{
|
||||||
@ -383,7 +392,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( BungeeCord.getInstance().config.isEnforceSecureProfile() )
|
if ( BungeeCord.getInstance().config.isEnforceSecureProfile() && getVersion() < ProtocolConstants.MINECRAFT_1_19_3 )
|
||||||
{
|
{
|
||||||
PlayerPublicKey publicKey = loginRequest.getPublicKey();
|
PlayerPublicKey publicKey = loginRequest.getPublicKey();
|
||||||
if ( publicKey == null )
|
if ( publicKey == null )
|
||||||
@ -409,6 +418,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.loginRequest = loginRequest;
|
this.loginRequest = loginRequest;
|
||||||
|
setName( realName = loginRequest.getData() );
|
||||||
|
|
||||||
int limit = BungeeCord.getInstance().config.getPlayerLimit();
|
int limit = BungeeCord.getInstance().config.getPlayerLimit();
|
||||||
if ( limit > 0 && bungee.getOnlineCount() >= limit )
|
if ( limit > 0 && bungee.getOnlineCount() >= limit )
|
||||||
@ -417,14 +427,6 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If offline mode and they are already on, don't allow connect
|
|
||||||
// We can just check by UUID here as names are based on UUID
|
|
||||||
if ( !isOnlineMode() && bungee.getPlayer( getUniqueId() ) != null )
|
|
||||||
{
|
|
||||||
disconnect( bungee.getTranslation( "already_connected_proxy" ) );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Callback<PreLoginEvent> callback = new Callback<PreLoginEvent>()
|
Callback<PreLoginEvent> callback = new Callback<PreLoginEvent>()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -441,6 +443,16 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if ( !realName.equals( name ) )
|
||||||
|
{
|
||||||
|
// Floodgate changes the name attribute with reflexion
|
||||||
|
setName( realName = name );
|
||||||
|
}
|
||||||
|
if ( uniqueId != null )
|
||||||
|
{
|
||||||
|
// if plugin called setUniqueId()
|
||||||
|
realId = uniqueId;
|
||||||
|
}
|
||||||
if ( onlineMode )
|
if ( onlineMode )
|
||||||
{
|
{
|
||||||
thisState = State.ENCRYPT;
|
thisState = State.ENCRYPT;
|
||||||
@ -495,8 +507,8 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
|||||||
if ( obj != null && obj.getId() != null )
|
if ( obj != null && obj.getId() != null )
|
||||||
{
|
{
|
||||||
loginProfile = obj;
|
loginProfile = obj;
|
||||||
name = obj.getName();
|
setName( realName = obj.getName() );
|
||||||
uniqueId = Util.getUUID( obj.getId() );
|
uniqueId = realId = Util.getUUID( obj.getId() );
|
||||||
finish();
|
finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -514,15 +526,30 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
|||||||
|
|
||||||
private void finish()
|
private void finish()
|
||||||
{
|
{
|
||||||
offlineId = UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + getName() ).getBytes( Charsets.UTF_8 ) );
|
if ( uniqueId == null ) // offline mode and no plugin used setUniqueId()
|
||||||
if ( uniqueId == null )
|
|
||||||
{
|
{
|
||||||
uniqueId = offlineId;
|
uniqueId = realId = offlineId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* At this point, player is either authenticated by Mojang (online mode),
|
||||||
|
* by a plugin (Floodgate ?) or the offline id is set.
|
||||||
|
*/
|
||||||
|
ProxiedPlayer existingPlayer = bungee.getPlayer( uniqueId );
|
||||||
|
if ( existingPlayer != null && existingPlayer.hasPermission( "bungeecord.multiple_connect" ) )
|
||||||
|
{
|
||||||
|
UUID newId = generateDuplicatedId( uniqueId );
|
||||||
|
if ( !uniqueId.equals( newId ) )
|
||||||
|
{
|
||||||
|
uniqueId = newId;
|
||||||
|
setName( name + "." + getDuplicationIndex( newId ) );
|
||||||
|
duplication = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( BungeeCord.getInstance().config.isEnforceSecureProfile() )
|
if ( BungeeCord.getInstance().config.isEnforceSecureProfile() )
|
||||||
{
|
{
|
||||||
if ( getVersion() >= ProtocolConstants.MINECRAFT_1_19_1 )
|
if ( getVersion() >= ProtocolConstants.MINECRAFT_1_19_1 && getVersion() < ProtocolConstants.MINECRAFT_1_19_3 )
|
||||||
{
|
{
|
||||||
boolean secure = false;
|
boolean secure = false;
|
||||||
try
|
try
|
||||||
@ -671,6 +698,54 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
|||||||
return ( name != null ) ? name : ( loginRequest == null ) ? null : loginRequest.getData();
|
return ( name != null ) ? name : ( loginRequest == null ) ? null : loginRequest.getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setName(String name)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
if ( loginRequest != null )
|
||||||
|
{
|
||||||
|
loginRequest.setData( name ); // name transmitted to Spigot server
|
||||||
|
}
|
||||||
|
updateOfflineId();
|
||||||
|
}
|
||||||
|
|
||||||
|
private UUID generateDuplicatedId(UUID base)
|
||||||
|
{
|
||||||
|
// UUID version: offline = 3 ; Java online mode = 4 ; Floodgate xUID = 0 (and must be kept 0)
|
||||||
|
// UUID variant: offline = 0xx ; Java online mode = 10x ; Floodgate xUID = xxx
|
||||||
|
if ( base.version() == 0 )
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Floodgate’s xUID converted to UUID are not supported
|
||||||
|
* because it requires the 64 MSBs to be 0 (or Floodgate API would not
|
||||||
|
* recognize a Bedrock account) and we cannot modify the 64 LSBs
|
||||||
|
* without risking a collision with the xUID of another Bedrock account
|
||||||
|
*/
|
||||||
|
return base;
|
||||||
|
}
|
||||||
|
long MSB = base.getMostSignificantBits();
|
||||||
|
long LSB = base.getLeastSignificantBits();
|
||||||
|
|
||||||
|
MSB &= 0xFFFFFFFF_FFFF_70FFL; // reset bits we need
|
||||||
|
MSB |= 0x00000000_0000_8000L; // set version to + 8 the current version
|
||||||
|
|
||||||
|
for ( int i = 1; i <= 9; i++ )
|
||||||
|
{
|
||||||
|
long newMSB = MSB | i << 8;
|
||||||
|
UUID newUUID = new UUID( newMSB, LSB );
|
||||||
|
if ( bungee.getPlayer( newUUID ) != null )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
return newUUID;
|
||||||
|
}
|
||||||
|
return base; // there are too many duplicated connections for this player
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int getDuplicationIndex(UUID duplicatedId)
|
||||||
|
{
|
||||||
|
return (int) ( duplicatedId.getMostSignificantBits() >> 8 ) & 0xF;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getVersion()
|
public int getVersion()
|
||||||
{
|
{
|
||||||
@ -710,6 +785,11 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
|||||||
this.uniqueId = uuid;
|
this.uniqueId = uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateOfflineId()
|
||||||
|
{
|
||||||
|
offlineId = UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + getName() ).getBytes( Charsets.UTF_8 ) );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUUID()
|
public String getUUID()
|
||||||
{
|
{
|
||||||
|
@ -6,8 +6,8 @@ import com.mojang.brigadier.suggestion.Suggestion;
|
|||||||
import com.mojang.brigadier.suggestion.Suggestions;
|
import com.mojang.brigadier.suggestion.Suggestions;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
import net.md_5.bungee.BungeeCord;
|
import net.md_5.bungee.BungeeCord;
|
||||||
import net.md_5.bungee.ServerConnection.KeepAliveData;
|
import net.md_5.bungee.ServerConnection.KeepAliveData;
|
||||||
import net.md_5.bungee.UserConnection;
|
import net.md_5.bungee.UserConnection;
|
||||||
@ -19,6 +19,7 @@ import net.md_5.bungee.api.event.PlayerDisconnectEvent;
|
|||||||
import net.md_5.bungee.api.event.PluginMessageEvent;
|
import net.md_5.bungee.api.event.PluginMessageEvent;
|
||||||
import net.md_5.bungee.api.event.SettingsChangedEvent;
|
import net.md_5.bungee.api.event.SettingsChangedEvent;
|
||||||
import net.md_5.bungee.api.event.TabCompleteEvent;
|
import net.md_5.bungee.api.event.TabCompleteEvent;
|
||||||
|
import net.md_5.bungee.api.event.TabCompleteRequestEvent;
|
||||||
import net.md_5.bungee.entitymap.EntityMap;
|
import net.md_5.bungee.entitymap.EntityMap;
|
||||||
import net.md_5.bungee.forge.ForgeConstants;
|
import net.md_5.bungee.forge.ForgeConstants;
|
||||||
import net.md_5.bungee.netty.ChannelWrapper;
|
import net.md_5.bungee.netty.ChannelWrapper;
|
||||||
@ -31,6 +32,7 @@ import net.md_5.bungee.protocol.packet.ClientCommand;
|
|||||||
import net.md_5.bungee.protocol.packet.ClientSettings;
|
import net.md_5.bungee.protocol.packet.ClientSettings;
|
||||||
import net.md_5.bungee.protocol.packet.KeepAlive;
|
import net.md_5.bungee.protocol.packet.KeepAlive;
|
||||||
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.PluginMessage;
|
import net.md_5.bungee.protocol.packet.PluginMessage;
|
||||||
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;
|
||||||
@ -75,17 +77,30 @@ public class UpstreamBridge extends PacketHandler
|
|||||||
// TODO: This should only done with server_unique
|
// TODO: This should only done with server_unique
|
||||||
// tab list (which is the only one supported
|
// tab list (which is the only one supported
|
||||||
// currently)
|
// currently)
|
||||||
PlayerListItem packet = new PlayerListItem();
|
PlayerListItem oldPacket = new PlayerListItem();
|
||||||
packet.setAction( PlayerListItem.Action.REMOVE_PLAYER );
|
oldPacket.setAction( PlayerListItem.Action.REMOVE_PLAYER );
|
||||||
PlayerListItem.Item item = new PlayerListItem.Item();
|
PlayerListItem.Item item = new PlayerListItem.Item();
|
||||||
item.setUuid( con.getUniqueId() );
|
item.setUuid( con.getUniqueId() );
|
||||||
packet.setItems( new PlayerListItem.Item[]
|
oldPacket.setItems( new PlayerListItem.Item[]
|
||||||
{
|
{
|
||||||
item
|
item
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
PlayerListItemRemove newPacket = new PlayerListItemRemove();
|
||||||
|
newPacket.setUuids( new UUID[]
|
||||||
|
{
|
||||||
|
con.getUniqueId()
|
||||||
|
} );
|
||||||
|
|
||||||
for ( ProxiedPlayer player : con.getServer().getInfo().getPlayers() )
|
for ( ProxiedPlayer player : con.getServer().getInfo().getPlayers() )
|
||||||
{
|
{
|
||||||
player.unsafe().sendPacket( packet );
|
if ( player.getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_1_19_3 )
|
||||||
|
{
|
||||||
|
player.unsafe().sendPacket( newPacket );
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
player.unsafe().sendPacket( oldPacket );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
con.getServer().disconnect( "Quitting" );
|
con.getServer().disconnect( "Quitting" );
|
||||||
}
|
}
|
||||||
@ -207,32 +222,42 @@ public class UpstreamBridge extends PacketHandler
|
|||||||
TabCompleteEvent tabCompleteEvent = new TabCompleteEvent( con, con.getServer(), tabComplete.getCursor(), suggestions );
|
TabCompleteEvent tabCompleteEvent = new TabCompleteEvent( con, con.getServer(), tabComplete.getCursor(), suggestions );
|
||||||
bungee.getPluginManager().callEvent( tabCompleteEvent );
|
bungee.getPluginManager().callEvent( tabCompleteEvent );
|
||||||
|
|
||||||
if ( tabCompleteEvent.isCancelled() )
|
List<String> legacyResults = tabCompleteEvent.getSuggestions();
|
||||||
|
|
||||||
|
int start = tabComplete.getCursor().lastIndexOf( ' ' ) + 1;
|
||||||
|
int end = tabComplete.getCursor().length();
|
||||||
|
StringRange lastArgumentRange = StringRange.between( start, end );
|
||||||
|
|
||||||
|
List<Suggestion> brigadier = new ArrayList<>( legacyResults.size() );
|
||||||
|
for ( String s : legacyResults )
|
||||||
|
{
|
||||||
|
brigadier.add( new Suggestion( lastArgumentRange, s ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
TabCompleteRequestEvent tabCompleteRequestEvent = new TabCompleteRequestEvent( con, con.getServer(), tabComplete.getCursor(), lastArgumentRange, new Suggestions( lastArgumentRange, brigadier ) );
|
||||||
|
tabCompleteRequestEvent.setCancelled( tabCompleteEvent.isCancelled() );
|
||||||
|
bungee.getPluginManager().callEvent( tabCompleteRequestEvent );
|
||||||
|
|
||||||
|
if ( tabCompleteRequestEvent.isCancelled() )
|
||||||
{
|
{
|
||||||
throw CancelSendSignal.INSTANCE;
|
throw CancelSendSignal.INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> results = tabCompleteEvent.getSuggestions();
|
Suggestions brigadierResults = tabCompleteRequestEvent.getSuggestions();
|
||||||
if ( !results.isEmpty() )
|
|
||||||
|
if ( !brigadierResults.isEmpty() )
|
||||||
{
|
{
|
||||||
// Unclear how to handle 1.13 commands at this point. Because we don't inject into the command packets we are unlikely to get this far unless
|
|
||||||
// Bungee plugins are adding results for commands they don't own anyway
|
|
||||||
if ( con.getPendingConnection().getVersion() < ProtocolConstants.MINECRAFT_1_13 )
|
if ( con.getPendingConnection().getVersion() < ProtocolConstants.MINECRAFT_1_13 )
|
||||||
{
|
{
|
||||||
|
List<String> results = new ArrayList<>( brigadierResults.getList().size() );
|
||||||
|
for ( Suggestion s : brigadierResults.getList() )
|
||||||
|
{
|
||||||
|
results.add( s.getText() );
|
||||||
|
}
|
||||||
con.unsafe().sendPacket( new TabCompleteResponse( results ) );
|
con.unsafe().sendPacket( new TabCompleteResponse( results ) );
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
int start = tabComplete.getCursor().lastIndexOf( ' ' ) + 1;
|
con.unsafe().sendPacket( new TabCompleteResponse( tabComplete.getTransactionId(), brigadierResults ) );
|
||||||
int end = tabComplete.getCursor().length();
|
|
||||||
StringRange range = StringRange.between( start, end );
|
|
||||||
|
|
||||||
List<Suggestion> brigadier = new LinkedList<>();
|
|
||||||
for ( String s : results )
|
|
||||||
{
|
|
||||||
brigadier.add( new Suggestion( range, s ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
con.unsafe().sendPacket( new TabCompleteResponse( tabComplete.getTransactionId(), new Suggestions( range, brigadier ) ) );
|
|
||||||
}
|
}
|
||||||
throw CancelSendSignal.INSTANCE;
|
throw CancelSendSignal.INSTANCE;
|
||||||
}
|
}
|
||||||
|
@ -77,6 +77,7 @@ public abstract class EntityMap
|
|||||||
case ProtocolConstants.MINECRAFT_1_19:
|
case ProtocolConstants.MINECRAFT_1_19:
|
||||||
return EntityMap_1_16_2.INSTANCE_1_19;
|
return EntityMap_1_16_2.INSTANCE_1_19;
|
||||||
case ProtocolConstants.MINECRAFT_1_19_1:
|
case ProtocolConstants.MINECRAFT_1_19_1:
|
||||||
|
case ProtocolConstants.MINECRAFT_1_19_3:
|
||||||
return EntityMap_1_16_2.INSTANCE_1_19_1;
|
return EntityMap_1_16_2.INSTANCE_1_19_1;
|
||||||
}
|
}
|
||||||
throw new RuntimeException( "Version " + version + " has no entity map" );
|
throw new RuntimeException( "Version " + version + " has no entity map" );
|
||||||
|
@ -1,34 +0,0 @@
|
|||||||
package net.md_5.bungee.module;
|
|
||||||
|
|
||||||
import com.google.common.io.ByteStreams;
|
|
||||||
import com.google.common.io.Files;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.net.URLConnection;
|
|
||||||
import lombok.Data;
|
|
||||||
import net.md_5.bungee.Util;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class JenkinsModuleSource implements ModuleSource
|
|
||||||
{
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void retrieve(ModuleSpec module, ModuleVersion version)
|
|
||||||
{
|
|
||||||
System.out.println( "Attempting to Jenkins download module " + module.getName() + " v" + version.getBuild() );
|
|
||||||
try
|
|
||||||
{
|
|
||||||
URL website = new URL( "https://ci.md-5.net/job/BungeeCord/" + version.getBuild() + "/artifact/module/" + module.getName().replace( '_', '-' ) + "/target/" + module.getName() + ".jar" );
|
|
||||||
URLConnection con = website.openConnection();
|
|
||||||
// 15 second timeout at various stages
|
|
||||||
con.setConnectTimeout( 15000 );
|
|
||||||
con.setReadTimeout( 15000 );
|
|
||||||
|
|
||||||
Files.write( ByteStreams.toByteArray( con.getInputStream() ), module.getFile() );
|
|
||||||
System.out.println( "Download complete" );
|
|
||||||
} catch ( IOException ex )
|
|
||||||
{
|
|
||||||
System.out.println( "Failed to download: " + Util.exception( ex ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,155 +0,0 @@
|
|||||||
package net.md_5.bungee.module;
|
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
|
||||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileWriter;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.net.URI;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.jar.JarEntry;
|
|
||||||
import java.util.jar.JarFile;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import net.md_5.bungee.api.ProxyServer;
|
|
||||||
import net.md_5.bungee.api.plugin.PluginDescription;
|
|
||||||
import net.md_5.bungee.util.CaseInsensitiveMap;
|
|
||||||
import org.yaml.snakeyaml.DumperOptions;
|
|
||||||
import org.yaml.snakeyaml.Yaml;
|
|
||||||
|
|
||||||
public class ModuleManager
|
|
||||||
{
|
|
||||||
|
|
||||||
private final Map<String, ModuleSource> knownSources = new HashMap<>();
|
|
||||||
|
|
||||||
public ModuleManager()
|
|
||||||
{
|
|
||||||
knownSources.put( "jenkins", new JenkinsModuleSource() );
|
|
||||||
}
|
|
||||||
|
|
||||||
// CHECKSTYLE:OFF
|
|
||||||
@SuppressFBWarnings(
|
|
||||||
{
|
|
||||||
"SF_SWITCH_FALLTHROUGH", "SF_SWITCH_NO_DEFAULT"
|
|
||||||
})
|
|
||||||
// CHECKSTYLE:ON
|
|
||||||
public void load(ProxyServer proxy, File moduleDirectory) throws Exception
|
|
||||||
{
|
|
||||||
moduleDirectory.mkdir();
|
|
||||||
|
|
||||||
ModuleVersion bungeeVersion = ModuleVersion.parse( proxy.getVersion() );
|
|
||||||
if ( bungeeVersion == null )
|
|
||||||
{
|
|
||||||
System.out.println( "Couldn't detect bungee version. Custom build?" );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<ModuleSpec> modules = new ArrayList<>();
|
|
||||||
File configFile = new File( "modules.yml" );
|
|
||||||
// Start Yaml
|
|
||||||
DumperOptions options = new DumperOptions();
|
|
||||||
options.setDefaultFlowStyle( DumperOptions.FlowStyle.BLOCK );
|
|
||||||
Yaml yaml = new Yaml( options );
|
|
||||||
|
|
||||||
Map<String, Object> config;
|
|
||||||
|
|
||||||
configFile.createNewFile();
|
|
||||||
try ( InputStream is = new FileInputStream( configFile ) )
|
|
||||||
{
|
|
||||||
config = (Map) yaml.load( is );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( config == null )
|
|
||||||
{
|
|
||||||
config = new CaseInsensitiveMap<>();
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
config = new CaseInsensitiveMap<>( config );
|
|
||||||
}
|
|
||||||
// End yaml
|
|
||||||
|
|
||||||
List<String> defaults = new ArrayList<>();
|
|
||||||
Object readModules = config.get( "modules" );
|
|
||||||
if ( readModules != null )
|
|
||||||
{
|
|
||||||
defaults.addAll( (Collection) readModules );
|
|
||||||
}
|
|
||||||
int version = ( config.containsKey( "version" ) ) ? (int) config.get( "version" ) : 0;
|
|
||||||
switch ( version )
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
defaults.add( "jenkins://cmd_alert" );
|
|
||||||
defaults.add( "jenkins://cmd_find" );
|
|
||||||
defaults.add( "jenkins://cmd_list" );
|
|
||||||
defaults.add( "jenkins://cmd_send" );
|
|
||||||
defaults.add( "jenkins://cmd_server" );
|
|
||||||
case 1:
|
|
||||||
defaults.add( "jenkins://reconnect_yaml" );
|
|
||||||
}
|
|
||||||
config.put( "modules", defaults );
|
|
||||||
config.put( "version", 2 );
|
|
||||||
|
|
||||||
try ( FileWriter wr = new FileWriter( configFile ) )
|
|
||||||
{
|
|
||||||
yaml.dump( config, wr );
|
|
||||||
}
|
|
||||||
|
|
||||||
for ( String s : (List<String>) config.get( "modules" ) )
|
|
||||||
{
|
|
||||||
URI uri = new URI( s );
|
|
||||||
|
|
||||||
ModuleSource source = knownSources.get( uri.getScheme() );
|
|
||||||
if ( source == null )
|
|
||||||
{
|
|
||||||
System.out.println( "Unknown module source: " + s );
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
String name = uri.getAuthority();
|
|
||||||
if ( name == null )
|
|
||||||
{
|
|
||||||
System.out.println( "Unknown module host: " + s );
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
ModuleSpec spec = new ModuleSpec( name, new File( moduleDirectory, name + ".jar" ), source );
|
|
||||||
modules.add( spec );
|
|
||||||
System.out.println( "Discovered module: " + spec );
|
|
||||||
}
|
|
||||||
|
|
||||||
for ( ModuleSpec module : modules )
|
|
||||||
{
|
|
||||||
ModuleVersion moduleVersion = ( module.getFile().exists() ) ? getVersion( module.getFile() ) : null;
|
|
||||||
|
|
||||||
if ( !bungeeVersion.equals( moduleVersion ) )
|
|
||||||
{
|
|
||||||
System.out.println( "Attempting to update plugin from " + moduleVersion + " to " + bungeeVersion );
|
|
||||||
module.getProvider().retrieve( module, bungeeVersion );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressFBWarnings("REC_CATCH_EXCEPTION")
|
|
||||||
private ModuleVersion getVersion(File file)
|
|
||||||
{
|
|
||||||
try ( JarFile jar = new JarFile( file ) )
|
|
||||||
{
|
|
||||||
JarEntry pdf = jar.getJarEntry( "plugin.yml" );
|
|
||||||
Preconditions.checkNotNull( pdf, "Plugin must have a plugin.yml" );
|
|
||||||
|
|
||||||
try ( InputStream in = jar.getInputStream( pdf ) )
|
|
||||||
{
|
|
||||||
PluginDescription desc = new Yaml().loadAs( in, PluginDescription.class );
|
|
||||||
return ModuleVersion.parse( desc.getVersion() );
|
|
||||||
}
|
|
||||||
} catch ( Exception ex )
|
|
||||||
{
|
|
||||||
ProxyServer.getInstance().getLogger().log( Level.WARNING, "Could not check module from file " + file, ex );
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
package net.md_5.bungee.module;
|
|
||||||
|
|
||||||
interface ModuleSource
|
|
||||||
{
|
|
||||||
|
|
||||||
void retrieve(ModuleSpec module, ModuleVersion version);
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
package net.md_5.bungee.module;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class ModuleSpec
|
|
||||||
{
|
|
||||||
|
|
||||||
private final String name;
|
|
||||||
private final File file;
|
|
||||||
private final ModuleSource provider;
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
package net.md_5.bungee.module;
|
|
||||||
|
|
||||||
import lombok.AccessLevel;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
|
|
||||||
public class ModuleVersion
|
|
||||||
{
|
|
||||||
|
|
||||||
private final String build;
|
|
||||||
private final String git;
|
|
||||||
|
|
||||||
public static ModuleVersion parse(String version)
|
|
||||||
{
|
|
||||||
int lastColon = version.lastIndexOf( ':' );
|
|
||||||
int secondLastColon = version.lastIndexOf( ':', lastColon - 1 );
|
|
||||||
|
|
||||||
if ( lastColon == -1 || secondLastColon == -1 )
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
String buildNumber = version.substring( lastColon + 1, version.length() );
|
|
||||||
String gitCommit = version.substring( secondLastColon + 1, lastColon ).replaceAll( "\"", "" );
|
|
||||||
|
|
||||||
if ( "unknown".equals( buildNumber ) || "unknown".equals( gitCommit ) )
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new ModuleVersion( buildNumber, gitCommit );
|
|
||||||
}
|
|
||||||
}
|
|
@ -4,7 +4,10 @@ import java.util.Collection;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||||
|
import net.md_5.bungee.protocol.ProtocolConstants;
|
||||||
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.PlayerListItemUpdate;
|
||||||
|
|
||||||
public class ServerUnique extends TabList
|
public class ServerUnique extends TabList
|
||||||
{
|
{
|
||||||
@ -32,6 +35,32 @@ public class ServerUnique extends TabList
|
|||||||
player.unsafe().sendPacket( playerListItem );
|
player.unsafe().sendPacket( playerListItem );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpdate(PlayerListItemRemove playerListItem)
|
||||||
|
{
|
||||||
|
for ( UUID uuid : playerListItem.getUuids() )
|
||||||
|
{
|
||||||
|
uuids.remove( uuid );
|
||||||
|
}
|
||||||
|
player.unsafe().sendPacket( playerListItem );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpdate(PlayerListItemUpdate playerListItem)
|
||||||
|
{
|
||||||
|
for ( PlayerListItem.Item item : playerListItem.getItems() )
|
||||||
|
{
|
||||||
|
for ( PlayerListItemUpdate.Action action : playerListItem.getActions() )
|
||||||
|
{
|
||||||
|
if ( action == PlayerListItemUpdate.Action.ADD_PLAYER )
|
||||||
|
{
|
||||||
|
uuids.add( item.getUuid() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
player.unsafe().sendPacket( playerListItem );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPingChange(int ping)
|
public void onPingChange(int ping)
|
||||||
{
|
{
|
||||||
@ -40,6 +69,13 @@ public class ServerUnique extends TabList
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onServerChange()
|
public void onServerChange()
|
||||||
|
{
|
||||||
|
if ( player.getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_1_19_3 )
|
||||||
|
{
|
||||||
|
PlayerListItemRemove packet = new PlayerListItemRemove();
|
||||||
|
packet.setUuids( uuids.stream().toArray( UUID[]::new ) );
|
||||||
|
player.unsafe().sendPacket( packet );
|
||||||
|
} else
|
||||||
{
|
{
|
||||||
PlayerListItem packet = new PlayerListItem();
|
PlayerListItem packet = new PlayerListItem();
|
||||||
packet.setAction( PlayerListItem.Action.REMOVE_PLAYER );
|
packet.setAction( PlayerListItem.Action.REMOVE_PLAYER );
|
||||||
@ -52,6 +88,7 @@ public class ServerUnique extends TabList
|
|||||||
}
|
}
|
||||||
packet.setItems( items );
|
packet.setItems( items );
|
||||||
player.unsafe().sendPacket( packet );
|
player.unsafe().sendPacket( packet );
|
||||||
|
}
|
||||||
uuids.clear();
|
uuids.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,4 +103,5 @@ public class ServerUnique extends TabList
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,8 @@ 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.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.PlayerListItemUpdate;
|
||||||
|
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public abstract class TabList
|
public abstract class TabList
|
||||||
@ -16,6 +18,10 @@ public abstract class TabList
|
|||||||
|
|
||||||
public abstract void onUpdate(PlayerListItem playerListItem);
|
public abstract void onUpdate(PlayerListItem playerListItem);
|
||||||
|
|
||||||
|
public abstract void onUpdate(PlayerListItemRemove playerListItem);
|
||||||
|
|
||||||
|
public abstract void onUpdate(PlayerListItemUpdate playerListItem);
|
||||||
|
|
||||||
public abstract void onPingChange(int ping);
|
public abstract void onPingChange(int ping);
|
||||||
|
|
||||||
public abstract void onServerChange();
|
public abstract void onServerChange();
|
||||||
@ -27,15 +33,49 @@ public abstract class TabList
|
|||||||
public static PlayerListItem rewrite(PlayerListItem playerListItem)
|
public static PlayerListItem rewrite(PlayerListItem playerListItem)
|
||||||
{
|
{
|
||||||
for ( PlayerListItem.Item item : playerListItem.getItems() )
|
for ( PlayerListItem.Item item : playerListItem.getItems() )
|
||||||
|
{
|
||||||
|
rewrite( item );
|
||||||
|
}
|
||||||
|
return playerListItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PlayerListItemRemove rewrite(PlayerListItemRemove playerListItem)
|
||||||
|
{
|
||||||
|
for ( int i = 0; i < playerListItem.getUuids().length; i++ )
|
||||||
|
{
|
||||||
|
UserConnection player = BungeeCord.getInstance().getPlayerByOfflineUUID( playerListItem.getUuids()[i] );
|
||||||
|
if ( player != null )
|
||||||
|
{
|
||||||
|
playerListItem.getUuids()[i] = player.getUniqueId();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return playerListItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PlayerListItemUpdate rewrite(PlayerListItemUpdate playerListItem)
|
||||||
|
{
|
||||||
|
for ( PlayerListItem.Item item : playerListItem.getItems() )
|
||||||
|
{
|
||||||
|
rewrite( item );
|
||||||
|
}
|
||||||
|
return playerListItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void rewrite(PlayerListItem.Item item)
|
||||||
{
|
{
|
||||||
if ( item.getUuid() == null ) // Old style ping
|
if ( item.getUuid() == null ) // Old style ping
|
||||||
{
|
{
|
||||||
continue;
|
return;
|
||||||
}
|
}
|
||||||
UserConnection player = BungeeCord.getInstance().getPlayerByOfflineUUID( item.getUuid() );
|
UserConnection player = BungeeCord.getInstance().getPlayerByOfflineUUID( item.getUuid() );
|
||||||
if ( player != null )
|
if ( player != null )
|
||||||
{
|
{
|
||||||
item.setUuid( player.getUniqueId() );
|
item.setUuid( player.getUniqueId() );
|
||||||
|
|
||||||
|
if ( item.getProperties() != null )
|
||||||
|
{
|
||||||
LoginResult loginResult = player.getPendingConnection().getLoginProfile();
|
LoginResult loginResult = player.getPendingConnection().getLoginProfile();
|
||||||
if ( loginResult != null && loginResult.getProperties() != null )
|
if ( loginResult != null && loginResult.getProperties() != null )
|
||||||
{
|
{
|
||||||
@ -49,16 +89,15 @@ public abstract class TabList
|
|||||||
{
|
{
|
||||||
item.setProperties( new Property[ 0 ] );
|
item.setProperties( new Property[ 0 ] );
|
||||||
}
|
}
|
||||||
if ( playerListItem.getAction() == PlayerListItem.Action.ADD_PLAYER || playerListItem.getAction() == PlayerListItem.Action.UPDATE_GAMEMODE )
|
}
|
||||||
|
if ( item.getGamemode() != null )
|
||||||
{
|
{
|
||||||
player.setGamemode( item.getGamemode() );
|
player.setGamemode( item.getGamemode() );
|
||||||
}
|
}
|
||||||
if ( playerListItem.getAction() == PlayerListItem.Action.ADD_PLAYER || playerListItem.getAction() == PlayerListItem.Action.UPDATE_LATENCY )
|
if ( item.getPing() != null )
|
||||||
{
|
{
|
||||||
player.setPing( item.getPing() );
|
player.setPing( item.getPing() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return playerListItem;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -4,13 +4,12 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>fr.pandacube.bungeecord</groupId>
|
||||||
<artifactId>bungeecord-parent</artifactId>
|
<artifactId>bungeecord-parent</artifactId>
|
||||||
<version>1.19-R0.1-SNAPSHOT</version>
|
<version>1.19-R0.1-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>net.md-5</groupId>
|
|
||||||
<artifactId>bungeecord-query</artifactId>
|
<artifactId>bungeecord-query</artifactId>
|
||||||
<version>1.19-R0.1-SNAPSHOT</version>
|
<version>1.19-R0.1-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
@ -26,7 +25,7 @@
|
|||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>fr.pandacube.bungeecord</groupId>
|
||||||
<artifactId>bungeecord-api</artifactId>
|
<artifactId>bungeecord-api</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
|
@ -4,13 +4,12 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>net.md-5</groupId>
|
<groupId>fr.pandacube.bungeecord</groupId>
|
||||||
<artifactId>bungeecord-parent</artifactId>
|
<artifactId>bungeecord-parent</artifactId>
|
||||||
<version>1.19-R0.1-SNAPSHOT</version>
|
<version>1.19-R0.1-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>net.md-5</groupId>
|
|
||||||
<artifactId>bungeecord-slf4j</artifactId>
|
<artifactId>bungeecord-slf4j</artifactId>
|
||||||
<version>1.19-R0.1-SNAPSHOT</version>
|
<version>1.19-R0.1-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
Loading…
Reference in New Issue
Block a user