Skip to content

Commit

Permalink
0.7 updates:
Browse files Browse the repository at this point in the history
* Added lucky injector dependency
* Fixed imports
  • Loading branch information
Alviannn committed Jun 19, 2020
1 parent 5416042 commit d14645c
Show file tree
Hide file tree
Showing 14 changed files with 74 additions and 84 deletions.
51 changes: 22 additions & 29 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.imaginarycode.minecraft</groupId>
<artifactId>RedisBungee</artifactId>
<version>0.6</version>
<version>0.7</version>
<packaging>jar</packaging>

<developers>
Expand Down Expand Up @@ -77,22 +77,6 @@
<pattern>redis.clients.util</pattern>
<shadedPattern>${project.groupId}.redisbungee.internal.jedisutil</shadedPattern>
</relocation>
<relocation>
<pattern>okhttp</pattern>
<shadedPattern>${project.groupId}.redisbungee.internal.okhttp</shadedPattern>
</relocation>
<relocation>
<pattern>kotlin</pattern>
<shadedPattern>${project.groupId}.redisbungee.internal.kotlin</shadedPattern>
</relocation>
<relocation>
<pattern>okio</pattern>
<shadedPattern>${project.groupId}.redisbungee.internal.okio</shadedPattern>
</relocation>
<relocation>
<pattern>com.google</pattern>
<shadedPattern>${project.groupId}.redisbungee.internal.google</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
Expand All @@ -113,6 +97,11 @@
<id>sonatype-repo</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
<!-- jitpack repo -->
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>

<dependencies>
Expand All @@ -137,6 +126,17 @@
<version>1.14-SNAPSHOT</version>
<type>jar</type>
<scope>provided</scope>

<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Lombok -->
<dependency>
Expand All @@ -145,19 +145,12 @@
<version>1.18.12</version>
<scope>provided</scope>
</dependency>
<!-- OkHttp for http requests -->
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.7.2</version>
<scope>compile</scope>
</dependency>
<!-- Google Guava -->
<!-- LuckyInjector -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>29.0-jre</version>
<scope>compile</scope>
<groupId>com.github.Alviannn</groupId>
<artifactId>LuckyInjector</artifactId>
<version>1.6.0</version>
<scope>provided</scope>
</dependency>
<!-- test units -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package com.imaginarycode.minecraft.redisbungee;

import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.google.common.net.InetAddresses;
import com.google.common.util.concurrent.UncheckedExecutionException;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.reflect.TypeToken;
import com.imaginarycode.minecraft.redisbungee.events.PlayerChangedServerNetworkEvent;
import com.imaginarycode.minecraft.redisbungee.events.PlayerJoinedNetworkEvent;
import com.imaginarycode.minecraft.redisbungee.events.PlayerLeftNetworkEvent;
import com.imaginarycode.minecraft.redisbungee.events.PubSubMessageEvent;
import dev.luckynetwork.alviann.luckyinjector.lib.google.common.cache.Cache;
import dev.luckynetwork.alviann.luckyinjector.lib.google.common.cache.CacheBuilder;
import dev.luckynetwork.alviann.luckyinjector.lib.google.common.net.InetAddresses;
import dev.luckynetwork.alviann.luckyinjector.lib.google.common.util.concurrent.UncheckedExecutionException;
import dev.luckynetwork.alviann.luckyinjector.lib.google.gson.JsonObject;
import dev.luckynetwork.alviann.luckyinjector.lib.google.gson.JsonParser;
import dev.luckynetwork.alviann.luckyinjector.lib.google.gson.reflect.TypeToken;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import net.md_5.bungee.api.connection.ProxiedPlayer;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
package com.imaginarycode.minecraft.redisbungee;

import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Multimap;
import com.google.common.io.ByteStreams;
import com.google.gson.Gson;
import com.imaginarycode.minecraft.redisbungee.events.PubSubMessageEvent;
import com.imaginarycode.minecraft.redisbungee.util.IOUtil;
import com.imaginarycode.minecraft.redisbungee.util.LuaManager;
import com.imaginarycode.minecraft.redisbungee.util.uuid.NameFetcher;
import com.imaginarycode.minecraft.redisbungee.util.uuid.UUIDFetcher;
import com.imaginarycode.minecraft.redisbungee.util.uuid.UUIDTranslator;
import dev.luckynetwork.alviann.luckyinjector.lib.google.common.cache.Cache;
import dev.luckynetwork.alviann.luckyinjector.lib.google.common.cache.CacheBuilder;
import dev.luckynetwork.alviann.luckyinjector.lib.google.common.collect.ImmutableList;
import dev.luckynetwork.alviann.luckyinjector.lib.google.common.collect.ImmutableMultimap;
import dev.luckynetwork.alviann.luckyinjector.lib.google.common.collect.ImmutableSet;
import dev.luckynetwork.alviann.luckyinjector.lib.google.common.collect.Multimap;
import dev.luckynetwork.alviann.luckyinjector.lib.google.common.io.ByteStreams;
import dev.luckynetwork.alviann.luckyinjector.lib.google.gson.Gson;
import dev.luckynetwork.alviann.luckyinjector.lib.okhttp3.Dispatcher;
import dev.luckynetwork.alviann.luckyinjector.lib.okhttp3.OkHttpClient;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
Expand All @@ -24,8 +26,6 @@
import net.md_5.bungee.config.Configuration;
import net.md_5.bungee.config.ConfigurationProvider;
import net.md_5.bungee.config.YamlConfiguration;
import okhttp3.Dispatcher;
import okhttp3.OkHttpClient;
import redis.clients.jedis.*;
import redis.clients.jedis.exceptions.JedisConnectionException;

Expand All @@ -36,7 +36,7 @@
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;

import static com.google.common.base.Preconditions.checkArgument;
import static dev.luckynetwork.alviann.luckyinjector.lib.google.common.base.Preconditions.checkArgument;

/**
* The RedisBungee plugin.
Expand Down Expand Up @@ -385,7 +385,7 @@ public void onDisable() {
}
}

@SuppressWarnings("ResultOfMethodCallIgnored")
@SuppressWarnings({"ResultOfMethodCallIgnored", "deprecation"})
private void loadConfig() throws IOException, JedisConnectionException {
if (!getDataFolder().exists()) {
getDataFolder().mkdir();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.imaginarycode.minecraft.redisbungee;

import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Multimap;
import dev.luckynetwork.alviann.luckyinjector.lib.google.common.base.Preconditions;
import dev.luckynetwork.alviann.luckyinjector.lib.google.common.collect.ImmutableList;
import dev.luckynetwork.alviann.luckyinjector.lib.google.common.collect.ImmutableSet;
import dev.luckynetwork.alviann.luckyinjector.lib.google.common.collect.Multimap;
import lombok.NonNull;
import net.md_5.bungee.api.config.ServerInfo;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.imaginarycode.minecraft.redisbungee;

import com.google.common.base.Joiner;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import dev.luckynetwork.alviann.luckyinjector.lib.google.common.base.Joiner;
import dev.luckynetwork.alviann.luckyinjector.lib.google.common.collect.HashMultimap;
import dev.luckynetwork.alviann.luckyinjector.lib.google.common.collect.Multimap;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.chat.BaseComponent;
Expand Down Expand Up @@ -321,7 +321,7 @@ public void execute(final CommandSender sender, final String[] args) {
}

public static class DebugCommand extends Command {

private final RedisBungee plugin;

DebugCommand(RedisBungee plugin) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.imaginarycode.minecraft.redisbungee;

import com.google.common.collect.ImmutableList;
import com.google.common.net.InetAddresses;
import dev.luckynetwork.alviann.luckyinjector.lib.google.common.collect.ImmutableList;
import dev.luckynetwork.alviann.luckyinjector.lib.google.common.net.InetAddresses;
import lombok.Getter;
import net.md_5.bungee.config.Configuration;
import redis.clients.jedis.JedisPool;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.imaginarycode.minecraft.redisbungee;

import com.google.common.base.Joiner;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import com.google.common.collect.Multiset;
import com.google.common.io.ByteArrayDataInput;
import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams;
import com.imaginarycode.minecraft.redisbungee.events.PubSubMessageEvent;
import com.imaginarycode.minecraft.redisbungee.util.RedisCallable;
import dev.luckynetwork.alviann.luckyinjector.lib.google.common.base.Joiner;
import dev.luckynetwork.alviann.luckyinjector.lib.google.common.collect.HashMultimap;
import dev.luckynetwork.alviann.luckyinjector.lib.google.common.collect.Multimap;
import dev.luckynetwork.alviann.luckyinjector.lib.google.common.collect.Multiset;
import dev.luckynetwork.alviann.luckyinjector.lib.google.common.io.ByteArrayDataInput;
import dev.luckynetwork.alviann.luckyinjector.lib.google.common.io.ByteArrayDataOutput;
import dev.luckynetwork.alviann.luckyinjector.lib.google.common.io.ByteStreams;
import lombok.AllArgsConstructor;
import net.md_5.bungee.api.AbstractReconnectHandler;
import net.md_5.bungee.api.ChatColor;
Expand Down Expand Up @@ -144,7 +144,6 @@ public void onPing(final ProxyPingEvent event) {
event.getResponse().getPlayers().setOnline(plugin.getCount());
}

@SuppressWarnings("UnstableApiUsage")
@EventHandler
public void onPluginMessage(final PluginMessageEvent event) {
if ((event.getTag().equals("legacy:RedisBungee") || event.getTag().equals("RedisBungee")) && event.getSender() instanceof Server) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.imaginarycode.minecraft.redisbungee;

import com.google.common.annotations.VisibleForTesting;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import net.md_5.bungee.api.connection.PendingConnection;
Expand All @@ -12,7 +11,6 @@
import java.util.Map;
import java.util.UUID;

@VisibleForTesting
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class RedisUtil {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.imaginarycode.minecraft.redisbungee.util;

import com.google.common.io.ByteStreams;
import dev.luckynetwork.alviann.luckyinjector.lib.google.common.io.ByteStreams;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

Expand All @@ -10,8 +10,7 @@

@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class IOUtil {

@SuppressWarnings("UnstableApiUsage")

public static String readInputStreamAsString(InputStream is) {
String string;
try {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.imaginarycode.minecraft.redisbungee.util.uuid;

import com.google.gson.reflect.TypeToken;
import com.imaginarycode.minecraft.redisbungee.RedisBungee;
import com.imaginarycode.minecraft.redisbungee.util.closer.Closer;
import dev.luckynetwork.alviann.luckyinjector.lib.google.gson.reflect.TypeToken;
import dev.luckynetwork.alviann.luckyinjector.lib.okhttp3.OkHttpClient;
import dev.luckynetwork.alviann.luckyinjector.lib.okhttp3.Request;
import dev.luckynetwork.alviann.luckyinjector.lib.okhttp3.ResponseBody;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import lombok.Setter;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.ResponseBody;

import java.io.IOException;
import java.lang.reflect.Type;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.imaginarycode.minecraft.redisbungee.util.uuid;

import com.google.common.collect.ImmutableList;
import com.imaginarycode.minecraft.redisbungee.RedisBungee;
import com.imaginarycode.minecraft.redisbungee.util.closer.Closer;
import dev.luckynetwork.alviann.luckyinjector.lib.google.common.collect.ImmutableList;
import dev.luckynetwork.alviann.luckyinjector.lib.okhttp3.*;
import lombok.Setter;
import okhttp3.*;

import java.util.HashMap;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.imaginarycode.minecraft.redisbungee.util.uuid;

import com.google.common.base.Charsets;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
import com.imaginarycode.minecraft.redisbungee.RedisBungee;
import dev.luckynetwork.alviann.luckyinjector.lib.google.common.base.Charsets;
import dev.luckynetwork.alviann.luckyinjector.lib.google.common.collect.ImmutableMap;
import dev.luckynetwork.alviann.luckyinjector.lib.google.common.collect.Iterables;
import lombok.Getter;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ name: ${project.artifactId}
main: ${project.groupId}.redisbungee.${project.artifactId}
version: ${project.version}
author: chunkr, Alviann
depends: [LuckyInjector]
# This is used so that we can automatically override default BungeeCord behavior.
softDepends: ["cmd_find", "cmd_list"]
softDepends: ["cmd_find", "cmd_list"]
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.imaginarycode.minecraft.redisbungee.util.uuid.NameFetcher;
import com.imaginarycode.minecraft.redisbungee.util.uuid.UUIDFetcher;
import okhttp3.OkHttpClient;
import dev.luckynetwork.alviann.luckyinjector.lib.okhttp3.OkHttpClient;
import org.junit.Test;

import java.io.IOException;
Expand All @@ -13,8 +13,8 @@

public class UUIDNameTest {

private String[] uuidsToTest = {"68ec43f7234b41b48764dfb38b9ffe8c", "652a2bc4e8cd405db7b698156ee2dc09"};
private String[] namesToTest = {"vemacs"};
private final String[] uuidsToTest = {"68ec43f7234b41b48764dfb38b9ffe8c", "652a2bc4e8cd405db7b698156ee2dc09"};
private final String[] namesToTest = {"vemacs"};

@Test
public void testUuidToName() throws IOException {
Expand Down

0 comments on commit d14645c

Please sign in to comment.