mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2024-11-23 04:28:01 +00:00
new api functions
This commit is contained in:
parent
a8673c563b
commit
ac66899f98
@ -30,7 +30,7 @@ And use it in your pom file.
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.imaginarycode.minecraft</groupId>
|
<groupId>com.imaginarycode.minecraft</groupId>
|
||||||
<artifactId>RedisBungee</artifactId>
|
<artifactId>RedisBungee</artifactId>
|
||||||
<version>0.6.4-SNAPSHOT</version>
|
<version>0.6.5-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
@ -37,7 +37,13 @@ import static com.google.common.base.Preconditions.checkArgument;
|
|||||||
/**
|
/**
|
||||||
* The RedisBungee plugin.
|
* The RedisBungee plugin.
|
||||||
* <p>
|
* <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 {
|
public final class RedisBungee extends Plugin {
|
||||||
@Getter
|
@Getter
|
||||||
@ -70,10 +76,12 @@ public final class RedisBungee extends Plugin {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @deprecated
|
||||||
* Fetch the {@link RedisBungeeAPI} object created on plugin start.
|
* Fetch the {@link RedisBungeeAPI} object created on plugin start.
|
||||||
*
|
*
|
||||||
* @return the {@link RedisBungeeAPI} object
|
* @return the {@link RedisBungeeAPI} object
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public static RedisBungeeAPI getApi() {
|
public static RedisBungeeAPI getApi() {
|
||||||
return api;
|
return api;
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import com.google.common.collect.ImmutableSet;
|
|||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import net.md_5.bungee.api.config.ServerInfo;
|
import net.md_5.bungee.api.config.ServerInfo;
|
||||||
|
import redis.clients.jedis.JedisPool;
|
||||||
|
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -19,9 +20,11 @@ import java.util.*;
|
|||||||
public class RedisBungeeAPI {
|
public class RedisBungeeAPI {
|
||||||
private final RedisBungee plugin;
|
private final RedisBungee plugin;
|
||||||
private final List<String> reservedChannels;
|
private final List<String> reservedChannels;
|
||||||
|
private static RedisBungeeAPI redisBungeeApi;
|
||||||
|
|
||||||
RedisBungeeAPI(RedisBungee plugin) {
|
RedisBungeeAPI(RedisBungee plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
|
this.redisBungeeApi = this;
|
||||||
this.reservedChannels = ImmutableList.of(
|
this.reservedChannels = ImmutableList.of(
|
||||||
"redisbungee-allservers",
|
"redisbungee-allservers",
|
||||||
"redisbungee-" + RedisBungee.getConfiguration().getServerId(),
|
"redisbungee-" + RedisBungee.getConfiguration().getServerId(),
|
||||||
@ -296,4 +299,26 @@ public class RedisBungeeAPI {
|
|||||||
public final UUID getUuidFromName(@NonNull String name, boolean expensiveLookups) {
|
public final UUID getUuidFromName(@NonNull String name, boolean expensiveLookups) {
|
||||||
return plugin.getUuidTranslator().getTranslatedUuid(name, 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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user