diff --git a/pom.xml b/pom.xml
index b25adb4..b7a25f0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
com.glyart.authmevelocity
parent
pom
- 1.2.0
+ 1.3.0
16
diff --git a/proxy/pom.xml b/proxy/pom.xml
index 7235f11..b3a30b6 100644
--- a/proxy/pom.xml
+++ b/proxy/pom.xml
@@ -5,7 +5,7 @@
parent
com.glyart.authmevelocity
- 1.2.0
+ 1.3.0
4.0.0
diff --git a/proxy/src/main/java/com/glyart/authmevelocity/proxy/AuthmeVelocityAPI.java b/proxy/src/main/java/com/glyart/authmevelocity/proxy/AuthmeVelocityAPI.java
index 226fa0a..ee9f67b 100644
--- a/proxy/src/main/java/com/glyart/authmevelocity/proxy/AuthmeVelocityAPI.java
+++ b/proxy/src/main/java/com/glyart/authmevelocity/proxy/AuthmeVelocityAPI.java
@@ -31,12 +31,11 @@ public class AuthmeVelocityAPI {
/**
* Removes a player from the list of logged-in players
* @param player the unlogged player
+ * @return if the player was succesfully removed
*/
- public static void removePlayer(@NotNull Player player){
+ public static boolean removePlayer(@NotNull Player player){
final UUID playerUUID = player.getUniqueId();
- if(AuthmeVelocityAPI.isLogged(player)){
- AuthMeVelocityPlugin.loggedPlayers.remove(playerUUID);
- }
+ return AuthMeVelocityPlugin.loggedPlayers.remove(playerUUID);
}
/**
diff --git a/proxy/src/main/java/com/glyart/authmevelocity/proxy/listener/ProxyListener.java b/proxy/src/main/java/com/glyart/authmevelocity/proxy/listener/ProxyListener.java
index 320011f..4b561b8 100644
--- a/proxy/src/main/java/com/glyart/authmevelocity/proxy/listener/ProxyListener.java
+++ b/proxy/src/main/java/com/glyart/authmevelocity/proxy/listener/ProxyListener.java
@@ -4,6 +4,7 @@ import com.glyart.authmevelocity.proxy.AuthmeVelocityAPI;
import com.glyart.authmevelocity.proxy.config.AuthMeConfig;
import com.glyart.authmevelocity.proxy.event.ProxyLoginEvent;
import com.google.common.io.ByteArrayDataInput;
+import com.velocitypowered.api.event.EventTask;
import com.velocitypowered.api.event.Subscribe;
import com.velocitypowered.api.event.command.CommandExecuteEvent;
import com.velocitypowered.api.event.connection.DisconnectEvent;
@@ -121,10 +122,11 @@ public class ProxyListener {
}
@Subscribe
- public void onTabComplete(TabCompleteEvent event){
+ public EventTask onTabComplete(TabCompleteEvent event){
final Player player = event.getPlayer();
if (!AuthmeVelocityAPI.isLogged(player)){
- event.getSuggestions().clear();
+ return EventTask.async(() -> event.getSuggestions().clear());
}
+ return null;
}
}
diff --git a/spigot/pom.xml b/spigot/pom.xml
index 8810dda..40a8f1e 100644
--- a/spigot/pom.xml
+++ b/spigot/pom.xml
@@ -5,7 +5,7 @@
parent
com.glyart.authmevelocity
- 1.2.0
+ 1.3.0
4.0.0
diff --git a/spigot/src/main/java/com/glyart/authmevelocity/spigot/AuthMeVelocityPlugin.java b/spigot/src/main/java/com/glyart/authmevelocity/spigot/AuthMeVelocityPlugin.java
index 29acb78..fc05ac4 100644
--- a/spigot/src/main/java/com/glyart/authmevelocity/spigot/AuthMeVelocityPlugin.java
+++ b/spigot/src/main/java/com/glyart/authmevelocity/spigot/AuthMeVelocityPlugin.java
@@ -5,17 +5,18 @@ import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
+import org.jetbrains.annotations.NotNull;
public class AuthMeVelocityPlugin extends JavaPlugin {
@Override
public void onEnable() {
- getServer().getMessenger().registerOutgoingPluginChannel(this, "authmevelocity:main");
- getServer().getPluginManager().registerEvents(new AuthMeListener(this), this);
+ this.getServer().getMessenger().registerOutgoingPluginChannel(this, "authmevelocity:main");
+ this.getServer().getPluginManager().registerEvents(new AuthMeListener(this), this);
- getLogger().info("AuthMeVelocity enabled.");
+ this.getLogger().info("AuthMeVelocity enabled.");
}
- public void sendLoginToProxy(Player player) {
+ public void sendLoginToProxy(@NotNull final Player player) {
ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeUTF("LOGIN");
out.writeUTF(player.getUniqueId().toString());
diff --git a/spigot/src/main/java/com/glyart/authmevelocity/spigot/events/PreSendLoginEvent.java b/spigot/src/main/java/com/glyart/authmevelocity/spigot/events/PreSendLoginEvent.java
index 50d5af6..ae163cb 100644
--- a/spigot/src/main/java/com/glyart/authmevelocity/spigot/events/PreSendLoginEvent.java
+++ b/spigot/src/main/java/com/glyart/authmevelocity/spigot/events/PreSendLoginEvent.java
@@ -10,8 +10,8 @@ public class PreSendLoginEvent extends PlayerEvent implements Cancellable {
private static final HandlerList HANDLERS = new HandlerList();
private boolean isCancelled;
- public PreSendLoginEvent(@NotNull Player player) {
- super(player);
+ public PreSendLoginEvent(@NotNull final Player player, boolean async) {
+ super(player, async);
}
@Override
diff --git a/spigot/src/main/java/com/glyart/authmevelocity/spigot/listeners/AuthMeListener.java b/spigot/src/main/java/com/glyart/authmevelocity/spigot/listeners/AuthMeListener.java
index 0a0b864..ca6c10b 100644
--- a/spigot/src/main/java/com/glyart/authmevelocity/spigot/listeners/AuthMeListener.java
+++ b/spigot/src/main/java/com/glyart/authmevelocity/spigot/listeners/AuthMeListener.java
@@ -19,10 +19,10 @@ public class AuthMeListener implements Listener {
@EventHandler
public void onLogin(LoginEvent event) {
- Player player = event.getPlayer();
- PreSendLoginEvent sendloginevent = new PreSendLoginEvent(player);
- Bukkit.getPluginManager().callEvent(sendloginevent);
- if(!sendloginevent.isCancelled()){
+ final Player player = event.getPlayer();
+ PreSendLoginEvent preSendLoginEvent = new PreSendLoginEvent(player, false);
+ Bukkit.getPluginManager().callEvent(preSendLoginEvent);
+ if(!preSendLoginEvent.isCancelled()){
plugin.sendLoginToProxy(player);
}
}