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>
<build>
<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>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.2</version>
<configuration>
<source>8</source>
<reportOutputDirectory>../javadoc</reportOutputDirectory>
<destDir>${project.name}</destDir>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<source>8</source>
<destDir>../javadoc/${project.name}</destDir>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

View File

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

View File

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

View File

@ -56,11 +56,22 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.2</version>
<configuration>
<source>8</source>
<reportOutputDirectory>../javadoc</reportOutputDirectory>
<destDir>${project.name}</destDir>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<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>
<groupId>org.apache.maven.plugins</groupId>
@ -131,6 +142,22 @@
</exclusion>
</exclusions>
</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>
<groupId>com.velocitypowered</groupId>
<artifactId>velocity-api</artifactId>

View File

@ -1,6 +1,11 @@
package com.imaginarycode.minecraft.redisbungee;
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()}
@ -18,6 +23,18 @@ public class RedisBungeeAPI extends AbstractRedisBungeeAPI {
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
*