2
0
mirror of https://github.com/proxiodev/RedisBungee.git synced 2024-11-22 20:28:00 +00:00

fix javadocs again, add getServerFor in velocity

This commit is contained in:
mohammed jasem alaajel 2022-07-27 19:04:19 +04:00
parent 17897bc112
commit fdd537b276
5 changed files with 117 additions and 26 deletions

View File

@ -12,15 +12,38 @@
<artifactId>RedisBungee-API</artifactId> <artifactId>RedisBungee-API</artifactId>
<build> <build>
<plugins> <plugins>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<configuration>
</configuration>
<executions>
<execution>
<id>bundle-sources</id>
<phase>package</phase>
<goals>
<goal>jar-no-fork</goal>
<goal>test-jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId> <artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.2</version> <version>3.3.2</version>
<configuration> <executions>
<source>8</source> <execution>
<reportOutputDirectory>../javadoc</reportOutputDirectory> <id>attach-javadocs</id>
<destDir>${project.name}</destDir> <goals>
</configuration> <goal>jar</goal>
</goals>
<configuration>
<source>8</source>
<destDir>../javadoc/${project.name}</destDir>
</configuration>
</execution>
</executions>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>

View File

@ -43,11 +43,22 @@
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId> <artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.2</version> <version>3.3.2</version>
<configuration> <executions>
<source>8</source> <execution>
<reportOutputDirectory>../javadoc</reportOutputDirectory> <id>attach-javadocs</id>
<destDir>${project.name}</destDir> <goals>
</configuration> <goal>jar</goal>
</goals>
<configuration>
<source>8</source>
<includeDependencySources>true</includeDependencySources>
<dependencySourceExcludes>
<dependencySourceExclude>net.md-5:*</dependencySourceExclude>
</dependencySourceExcludes>
<destDir>../javadoc/${project.name}</destDir>
</configuration>
</execution>
</executions>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
@ -56,24 +67,30 @@
<executions> <executions>
<execution> <execution>
<phase>package</phase> <phase>package</phase>
<goals><goal>shade</goal></goals> <goals>
<goal>shade</goal>
</goals>
<configuration> <configuration>
<relocations> <relocations>
<relocation> <relocation>
<pattern>redis.clients.jedis</pattern> <pattern>redis.clients.jedis</pattern>
<shadedPattern>com.imaginarycode.minecraft.redisbungee.internal.jedis</shadedPattern> <shadedPattern>com.imaginarycode.minecraft.redisbungee.internal.jedis
</shadedPattern>
</relocation> </relocation>
<relocation> <relocation>
<pattern>redis.clients.util</pattern> <pattern>redis.clients.util</pattern>
<shadedPattern>com.imaginarycode.minecraft.redisbungee.internal.jedisutil</shadedPattern> <shadedPattern>com.imaginarycode.minecraft.redisbungee.internal.jedisutil
</shadedPattern>
</relocation> </relocation>
<relocation> <relocation>
<pattern>org.apache.commons.pool</pattern> <pattern>org.apache.commons.pool</pattern>
<shadedPattern>com.imaginarycode.minecraft.redisbungee.internal.commonspool</shadedPattern> <shadedPattern>com.imaginarycode.minecraft.redisbungee.internal.commonspool
</shadedPattern>
</relocation> </relocation>
<relocation> <relocation>
<pattern>com.squareup.okhttp</pattern> <pattern>com.squareup.okhttp</pattern>
<shadedPattern>com.imaginarycode.minecraft.redisbungee.internal.okhttp</shadedPattern> <shadedPattern>com.imaginarycode.minecraft.redisbungee.internal.okhttp
</shadedPattern>
</relocation> </relocation>
<relocation> <relocation>
<pattern>okio</pattern> <pattern>okio</pattern>
@ -81,7 +98,8 @@
</relocation> </relocation>
<relocation> <relocation>
<pattern>com.google</pattern> <pattern>com.google</pattern>
<shadedPattern>com.imaginarycode.minecraft.redisbungee.internal.google</shadedPattern> <shadedPattern>com.imaginarycode.minecraft.redisbungee.internal.google
</shadedPattern>
</relocation> </relocation>
<relocation> <relocation>
<pattern>org.json</pattern> <pattern>org.json</pattern>
@ -89,11 +107,13 @@
</relocation> </relocation>
<relocation> <relocation>
<pattern>org.checkerframework</pattern> <pattern>org.checkerframework</pattern>
<shadedPattern>com.imaginarycode.minecraft.redisbungee.internal.checkframework</shadedPattern> <shadedPattern>com.imaginarycode.minecraft.redisbungee.internal.checkframework
</shadedPattern>
</relocation> </relocation>
<relocation> <relocation>
<pattern>ninja.leaping.configurate</pattern> <pattern>ninja.leaping.configurate</pattern>
<shadedPattern>com.imaginarycode.minecraft.redisbungee.internal.configurate</shadedPattern> <shadedPattern>com.imaginarycode.minecraft.redisbungee.internal.configurate
</shadedPattern>
</relocation> </relocation>
</relocations> </relocations>
</configuration> </configuration>
@ -109,6 +129,12 @@
<artifactId>RedisBungee-API</artifactId> <artifactId>RedisBungee-API</artifactId>
<version>${project.parent.version}</version> <version>${project.parent.version}</version>
</dependency> </dependency>
<dependency>
<groupId>com.imaginarycode.minecraft</groupId>
<artifactId>RedisBungee-API</artifactId>
<version>${project.parent.version}</version>
<classifier>javadoc</classifier>
</dependency>
<dependency> <dependency>
<groupId>net.md-5</groupId> <groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId> <artifactId>bungeecord-api</artifactId>

View File

@ -28,11 +28,9 @@ public class RedisBungeeAPI extends AbstractRedisBungeeAPI {
* as well, and will return local information on them. * as well, and will return local information on them.
* *
* @param player a player uuid * @param player a player uuid
* @return {@link ServerInfo} * @return {@link ServerInfo} Can be null if proxy can't find it.
* @deprecated This does return null even if player is on a server if the server is not on the proxy
* @see #getServerNameFor(UUID) * @see #getServerNameFor(UUID)
*/ */
@Deprecated
public final ServerInfo getServerFor(@NonNull UUID player) { public final ServerInfo getServerFor(@NonNull UUID player) {
return ((Plugin) this.plugin).getProxy().getServerInfo(this.getServerNameFor(player)); return ((Plugin) this.plugin).getProxy().getServerInfo(this.getServerNameFor(player));
} }

View File

@ -56,11 +56,22 @@
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId> <artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.2</version> <version>3.3.2</version>
<configuration> <executions>
<source>8</source> <execution>
<reportOutputDirectory>../javadoc</reportOutputDirectory> <id>attach-javadocs</id>
<destDir>${project.name}</destDir> <goals>
</configuration> <goal>jar</goal>
</goals>
<configuration>
<includeDependencySources>true</includeDependencySources>
<dependencySourceExcludes>
<dependencySourceExclude>com.velocitypowered:*</dependencySourceExclude>
</dependencySourceExcludes>
<source>11</source>
<destDir>../javadoc/${project.name}</destDir>
</configuration>
</execution>
</executions>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
@ -131,6 +142,22 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency>
<groupId>com.imaginarycode.minecraft</groupId>
<artifactId>RedisBungee-API</artifactId>
<version>${project.parent.version}</version>
<classifier>javadoc</classifier>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
<exclusion>
<groupId>org.spongepowered</groupId>
<artifactId>configurate-yaml</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency> <dependency>
<groupId>com.velocitypowered</groupId> <groupId>com.velocitypowered</groupId>
<artifactId>velocity-api</artifactId> <artifactId>velocity-api</artifactId>

View File

@ -1,6 +1,11 @@
package com.imaginarycode.minecraft.redisbungee; package com.imaginarycode.minecraft.redisbungee;
import com.imaginarycode.minecraft.redisbungee.api.RedisBungeePlugin; import com.imaginarycode.minecraft.redisbungee.api.RedisBungeePlugin;
import com.velocitypowered.api.proxy.server.RegisteredServer;
import com.velocitypowered.api.proxy.server.ServerInfo;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.UUID;
/** /**
* This platform class exposes some internal RedisBungee functions. You obtain an instance of this object by invoking {@link RedisBungeeAPI#getRedisBungeeApi()} * This platform class exposes some internal RedisBungee functions. You obtain an instance of this object by invoking {@link RedisBungeeAPI#getRedisBungeeApi()}
@ -18,6 +23,18 @@ public class RedisBungeeAPI extends AbstractRedisBungeeAPI {
redisBungeeApi = this; redisBungeeApi = this;
} }
/**
* Get the server where the specified player is playing. This function also deals with the case of local players
* as well, and will return local information on them.
*
* @param player a player uuid
* @return {@link ServerInfo} Can be null if proxy can't find it.
* @see #getServerNameFor(UUID)
*/
public final ServerInfo getServerFor(@NonNull UUID player) {
return ((RedisBungeeVelocityPlugin) this.plugin).getProxy().getServer(this.getServerNameFor(player)).map((RegisteredServer::getServerInfo)).orElse(null);
}
/** /**
* Api instance * Api instance
* *