mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2026-05-03 11:40:29 +00:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5caabc8aa4 | ||
|
|
9b4a49f66a | ||
|
|
785b23ecfb | ||
|
|
d8e0ea71a2 | ||
|
|
ac66899f98 | ||
|
|
a8673c563b | ||
|
|
8a4dd53e58 | ||
|
|
85711c5688 | ||
|
|
86ebc9c0d2 | ||
|
|
49ac1ba9ef | ||
|
|
d29e51b4a6 |
16
README.md
16
README.md
@@ -7,15 +7,9 @@ The maintainer of RedisBungee has became inactive, so we have taken the developm
|
||||
|
||||
RedisBungee uses [Redis](https://redis.io) to Synchronize data between [BungeeCord](https://github.com/SpigotMC/BungeeCord) proxies
|
||||
|
||||
# 0.7 API BREAKING CHANGE:
|
||||
we do not advice using version (0.7) till we finish making it stable ,
|
||||
but if you plan to use redis-bungee 0.7 the api has breaking change.
|
||||
JedisPool was changed to Pool<Jedis> to support Redis Sentinel
|
||||
If ANYONE found a good way to fix this api breaking change
|
||||
pull requests are welcomed :)
|
||||
## Notice: about older versions of redis than redis 6.0
|
||||
|
||||
As of now Version 0.6.4-SNAPSHOT is only supporting redis 6.0 and above!
|
||||
As of now Version 0.6.4 is only supporting redis 6.0 and above!
|
||||
|
||||
## Compiling
|
||||
|
||||
@@ -36,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>
|
||||
|
||||
@@ -54,14 +48,16 @@ And use it in your pom file.
|
||||
<dependency>
|
||||
<groupId>com.github.limework</groupId>
|
||||
<artifactId>redisbungee</artifactId>
|
||||
<version>0.6.3</version>
|
||||
<version>0.6.4</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
## Javadocs
|
||||
Hosted on limework website. Version 0.6.0 (note: any version 0.6.* will not have API changes.)
|
||||
Hosted on limework website. Version 0.6.0 ~~(note: any version 0.6.* will not have API changes.)~~
|
||||
https://limework.net/JavaDocs/RedisBungee/
|
||||
|
||||
Note: we might add more api into RedisBungeeApi Class but we wont remove the old ones to
|
||||
keep old plugins working....
|
||||
## Configuration
|
||||
|
||||
**REDISBUNGEE REQUIRES A REDIS SERVER**, preferably with reasonably low latency. The default [config](https://github.com/limework/RedisBungee/blob/master/src/main/resources/example_config.yml) is saved when the plugin first starts.
|
||||
|
||||
10
pom.xml
10
pom.xml
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>com.imaginarycode.minecraft</groupId>
|
||||
<artifactId>RedisBungee</artifactId>
|
||||
<version>0.6.4</version>
|
||||
<version>0.6.5</version>
|
||||
|
||||
|
||||
<repositories>
|
||||
@@ -80,7 +80,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.9.1</version>
|
||||
<version>3.3.0</version>
|
||||
<configuration>
|
||||
<source>8</source>
|
||||
</configuration>
|
||||
@@ -92,13 +92,13 @@
|
||||
<dependency>
|
||||
<groupId>redis.clients</groupId>
|
||||
<artifactId>jedis</artifactId>
|
||||
<version>3.6.1</version>
|
||||
<version>3.6.3</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-pool2</artifactId>
|
||||
<version>2.6.2</version>
|
||||
<version>2.10.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -123,7 +123,7 @@
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.13.1</version>
|
||||
<version>4.13.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
@@ -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
|
||||
@@ -72,8 +78,11 @@ public final class RedisBungee extends Plugin {
|
||||
/**
|
||||
* Fetch the {@link RedisBungeeAPI} object created on plugin start.
|
||||
*
|
||||
* @return the {@link RedisBungeeAPI} object
|
||||
* @deprecated Please use {@link RedisBungeeAPI#getRedisBungeeApi()}
|
||||
*
|
||||
* @return the {@link RedisBungeeAPI} object instance.
|
||||
*/
|
||||
@Deprecated
|
||||
public static RedisBungeeAPI getApi() {
|
||||
return api;
|
||||
}
|
||||
@@ -230,8 +239,9 @@ public final class RedisBungee extends Plugin {
|
||||
ExecutorService builtinService = (ExecutorService) field.get(this);
|
||||
field.set(this, service);
|
||||
builtinService.shutdownNow();
|
||||
} catch (Exception e) {
|
||||
getLogger().log(Level.WARNING, "Can't replace BungeeCord thread pool with our own", e);
|
||||
} catch (IllegalAccessException | NoSuchFieldException e) {
|
||||
getLogger().log(Level.WARNING, "Can't replace BungeeCord thread pool with our own");
|
||||
getLogger().log(Level.INFO, "skipping replacement.....");
|
||||
}
|
||||
try {
|
||||
loadConfig();
|
||||
|
||||
@@ -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;
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -74,13 +74,6 @@ public class RedisBungeeListener implements Listener {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Pipeline pipeline = jedis.pipelined();
|
||||
plugin.getUuidTranslator().persistInfo(event.getConnection().getName(), event.getConnection().getUniqueId(), pipeline);
|
||||
RedisUtil.createPlayer(event.getConnection(), pipeline, false);
|
||||
// We're not publishing, the API says we only publish at PostLoginEvent time.
|
||||
pipeline.sync();
|
||||
|
||||
return null;
|
||||
} finally {
|
||||
event.completeIntent(plugin);
|
||||
@@ -94,6 +87,15 @@ public class RedisBungeeListener implements Listener {
|
||||
plugin.getProxy().getScheduler().runAsync(plugin, new RedisCallable<Void>(plugin) {
|
||||
@Override
|
||||
protected Void call(Jedis jedis) {
|
||||
// this code was moved out from login event due being async..
|
||||
// and it can be cancelled but it will show as false in redis-bungee
|
||||
// which will register the player into the redis database.
|
||||
Pipeline pipeline = jedis.pipelined();
|
||||
plugin.getUuidTranslator().persistInfo(event.getPlayer().getName(), event.getPlayer().getUniqueId(), pipeline);
|
||||
RedisUtil.createPlayer(event.getPlayer(), pipeline, false);
|
||||
pipeline.sync();
|
||||
// the end of moved code.
|
||||
|
||||
jedis.publish("redisbungee-data", RedisBungee.getGson().toJson(new DataManager.DataManagerMessage<>(
|
||||
event.getPlayer().getUniqueId(), DataManager.DataManagerMessage.Action.JOIN,
|
||||
new DataManager.LoginPayload(event.getPlayer().getAddress().getAddress()))));
|
||||
|
||||
Reference in New Issue
Block a user