mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2026-05-03 11:40:29 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0f0f707ef7 | |||
| 441a12bb36 | |||
|
|
0534970368 |
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>RedisBungee</artifactId>
|
<artifactId>RedisBungee</artifactId>
|
||||||
<groupId>com.imaginarycode.minecraft</groupId>
|
<groupId>com.imaginarycode.minecraft</groupId>
|
||||||
<version>0.10.1-SNAPSHOT</version>
|
<version>0.10.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import com.imaginarycode.minecraft.redisbungee.api.summoners.JedisClusterSummone
|
|||||||
import com.imaginarycode.minecraft.redisbungee.api.summoners.JedisPooledSummoner;
|
import com.imaginarycode.minecraft.redisbungee.api.summoners.JedisPooledSummoner;
|
||||||
import com.imaginarycode.minecraft.redisbungee.api.summoners.Summoner;
|
import com.imaginarycode.minecraft.redisbungee.api.summoners.Summoner;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
import redis.clients.jedis.Jedis;
|
import redis.clients.jedis.Jedis;
|
||||||
import redis.clients.jedis.JedisCluster;
|
import redis.clients.jedis.JedisCluster;
|
||||||
import redis.clients.jedis.JedisPool;
|
import redis.clients.jedis.JedisPool;
|
||||||
@@ -81,8 +82,9 @@ public abstract class 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 a String name for the server the player is on.
|
* @return a String name for the server the player is on. Can be Null if plugins is doing weird stuff to the proxy internals
|
||||||
*/
|
*/
|
||||||
|
@Nullable
|
||||||
public final String getServerNameFor(@NonNull UUID player) {
|
public final String getServerNameFor(@NonNull UUID player) {
|
||||||
return plugin.getDataManager().getServer(player);
|
return plugin.getDataManager().getServer(player);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>RedisBungee</artifactId>
|
<artifactId>RedisBungee</artifactId>
|
||||||
<groupId>com.imaginarycode.minecraft</groupId>
|
<groupId>com.imaginarycode.minecraft</groupId>
|
||||||
<version>0.10.1-SNAPSHOT</version>
|
<version>0.10.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import com.imaginarycode.minecraft.redisbungee.api.RedisBungeePlugin;
|
|||||||
import net.md_5.bungee.api.config.ServerInfo;
|
import net.md_5.bungee.api.config.ServerInfo;
|
||||||
import net.md_5.bungee.api.plugin.Plugin;
|
import net.md_5.bungee.api.plugin.Plugin;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@@ -43,8 +44,11 @@ public class RedisBungeeAPI extends AbstractRedisBungeeAPI {
|
|||||||
* @return {@link ServerInfo} Can be null if proxy can't find it.
|
* @return {@link ServerInfo} Can be null if proxy can't find it.
|
||||||
* @see #getServerNameFor(UUID)
|
* @see #getServerNameFor(UUID)
|
||||||
*/
|
*/
|
||||||
|
@Nullable
|
||||||
public final ServerInfo getServerFor(@NonNull UUID player) {
|
public final ServerInfo getServerFor(@NonNull UUID player) {
|
||||||
return ((Plugin) this.plugin).getProxy().getServerInfo(this.getServerNameFor(player));
|
String serverName = this.getServerNameFor(player);
|
||||||
|
if (serverName == null) return null;
|
||||||
|
return ((Plugin) this.plugin).getProxy().getServerInfo(serverName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -156,6 +156,7 @@ public class RedisBungeeBungeeListener extends AbstractRedisBungeeListener<Login
|
|||||||
out.writeUTF("ALL");
|
out.writeUTF("ALL");
|
||||||
original = plugin.getPlayers();
|
original = plugin.getPlayers();
|
||||||
} else {
|
} else {
|
||||||
|
out.writeUTF(type);
|
||||||
try {
|
try {
|
||||||
original = plugin.getAbstractRedisBungeeApi().getPlayersOnServer(type);
|
original = plugin.getAbstractRedisBungeeApi().getPlayersOnServer(type);
|
||||||
} catch (IllegalArgumentException ignored) {
|
} catch (IllegalArgumentException ignored) {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>RedisBungee</artifactId>
|
<artifactId>RedisBungee</artifactId>
|
||||||
<groupId>com.imaginarycode.minecraft</groupId>
|
<groupId>com.imaginarycode.minecraft</groupId>
|
||||||
<version>0.10.1-SNAPSHOT</version>
|
<version>0.10.2-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import com.imaginarycode.minecraft.redisbungee.api.RedisBungeePlugin;
|
|||||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||||
import com.velocitypowered.api.proxy.server.ServerInfo;
|
import com.velocitypowered.api.proxy.server.ServerInfo;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@@ -44,8 +45,11 @@ public class RedisBungeeAPI extends AbstractRedisBungeeAPI {
|
|||||||
* @return {@link ServerInfo} Can be null if proxy can't find it.
|
* @return {@link ServerInfo} Can be null if proxy can't find it.
|
||||||
* @see #getServerNameFor(UUID)
|
* @see #getServerNameFor(UUID)
|
||||||
*/
|
*/
|
||||||
|
@Nullable
|
||||||
public final ServerInfo getServerFor(@NonNull UUID player) {
|
public final ServerInfo getServerFor(@NonNull UUID player) {
|
||||||
return ((RedisBungeeVelocityPlugin) this.plugin).getProxy().getServer(this.getServerNameFor(player)).map((RegisteredServer::getServerInfo)).orElse(null);
|
String serverName = this.getServerNameFor(player);
|
||||||
|
if (serverName == null) return null;
|
||||||
|
return ((RedisBungeeVelocityPlugin) this.plugin).getProxy().getServer(serverName).map((RegisteredServer::getServerInfo)).orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -165,6 +165,7 @@ public class RedisBungeeVelocityListener extends AbstractRedisBungeeListener<Log
|
|||||||
out.writeUTF("ALL");
|
out.writeUTF("ALL");
|
||||||
original = plugin.getPlayers();
|
original = plugin.getPlayers();
|
||||||
} else {
|
} else {
|
||||||
|
out.writeUTF(type);
|
||||||
try {
|
try {
|
||||||
original = plugin.getAbstractRedisBungeeApi().getPlayersOnServer(type);
|
original = plugin.getAbstractRedisBungeeApi().getPlayersOnServer(type);
|
||||||
} catch (IllegalArgumentException ignored) {
|
} catch (IllegalArgumentException ignored) {
|
||||||
|
|||||||
2
pom.xml
2
pom.xml
@@ -7,7 +7,7 @@
|
|||||||
<groupId>com.imaginarycode.minecraft</groupId>
|
<groupId>com.imaginarycode.minecraft</groupId>
|
||||||
<artifactId>RedisBungee</artifactId>
|
<artifactId>RedisBungee</artifactId>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<version>0.10.1-SNAPSHOT</version>
|
<version>0.10.2-SNAPSHOT</version>
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
|||||||
Reference in New Issue
Block a user