2
0
mirror of https://github.com/proxiodev/RedisBungee.git synced 2024-12-23 10:38:01 +00:00

new api functions

This commit is contained in:
mohammed jasem alaajel 2021-07-30 02:12:01 +04:00
parent a8673c563b
commit ac66899f98
3 changed files with 35 additions and 2 deletions

View File

@ -30,7 +30,7 @@ And use it in your pom file.
<dependency>
<groupId>com.imaginarycode.minecraft</groupId>
<artifactId>RedisBungee</artifactId>
<version>0.6.4-SNAPSHOT</version>
<version>0.6.5-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

View File

@ -37,7 +37,13 @@ import static com.google.common.base.Preconditions.checkArgument;
/**
* The RedisBungee plugin.
* <p>
* The only function of interest is {@link #getApi()}, which exposes some functions in this class.
* The only function of interest is {@link #getApi()}, which deprecated now,
* Please check {@link RedisBungeeAPI#getRedisBungeeApi()},
*
* which exposes some functions in this class.
* but if you want old version support,
* then you can use old method {@link #getApi()}
*
*/
public final class RedisBungee extends Plugin {
@Getter
@ -70,10 +76,12 @@ public final class RedisBungee extends Plugin {
.build();
/**
* @deprecated
* Fetch the {@link RedisBungeeAPI} object created on plugin start.
*
* @return the {@link RedisBungeeAPI} object
*/
@Deprecated
public static RedisBungeeAPI getApi() {
return api;
}

View File

@ -6,6 +6,7 @@ import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Multimap;
import lombok.NonNull;
import net.md_5.bungee.api.config.ServerInfo;
import redis.clients.jedis.JedisPool;
import java.net.InetAddress;
import java.util.*;
@ -19,9 +20,11 @@ import java.util.*;
public class RedisBungeeAPI {
private final RedisBungee plugin;
private final List<String> reservedChannels;
private static RedisBungeeAPI redisBungeeApi;
RedisBungeeAPI(RedisBungee plugin) {
this.plugin = plugin;
this.redisBungeeApi = this;
this.reservedChannels = ImmutableList.of(
"redisbungee-allservers",
"redisbungee-" + RedisBungee.getConfiguration().getServerId(),
@ -296,4 +299,26 @@ public class RedisBungeeAPI {
public final UUID getUuidFromName(@NonNull String name, boolean expensiveLookups) {
return plugin.getUuidTranslator().getTranslatedUuid(name, expensiveLookups);
}
/**
* This gets Redis Bungee Jedis pool
*
* @return {@link JedisPool}
* @since 0.6.5
*/
public JedisPool getJedisPool() {
return this.plugin.getPool();
}
/**
* This alternative to {@link RedisBungee#getApi()}
* which now deprecated. but to maintain old plugins compatibility it won't be removed.
*
* @return the API instance.
* @since 0.6.5
*/
public static RedisBungeeAPI getRedisBungeeApi() {
return redisBungeeApi;
}
}