Use Optionals for nullable values
This commit is contained in:
13 files changed
+55
-55
No files matched your search
@@ -1,8 +1,8 @@
|
||||
package com.github.games647.fastlogin.bungee;
|
||||
|
||||
import com.github.games647.fastlogin.bungee.hooks.BungeeAuthHook;
|
||||
import com.github.games647.fastlogin.bungee.listener.ConnectionListener;
|
||||
import com.github.games647.fastlogin.bungee.listener.PluginMessageListener;
|
||||
import com.github.games647.fastlogin.bungee.listener.ConnectListener;
|
||||
import com.github.games647.fastlogin.bungee.listener.MessageListener;
|
||||
import com.github.games647.fastlogin.core.mojang.MojangApiConnector;
|
||||
import com.github.games647.fastlogin.core.shared.FastLoginCore;
|
||||
import com.github.games647.fastlogin.core.shared.PlatformPlugin;
|
||||
@@ -38,8 +38,8 @@ public class FastLoginBungee extends Plugin implements PlatformPlugin<CommandSen
|
||||
}
|
||||
|
||||
//events
|
||||
getProxy().getPluginManager().registerListener(this, new ConnectionListener(this));
|
||||
getProxy().getPluginManager().registerListener(this, new PluginMessageListener(this));
|
||||
getProxy().getPluginManager().registerListener(this, new ConnectListener(this));
|
||||
getProxy().getPluginManager().registerListener(this, new MessageListener(this));
|
||||
|
||||
//this is required to listen to messages from the server
|
||||
getProxy().registerChannel(getDescription().getName());
|
||||
|
||||
+3
-3
@@ -31,11 +31,11 @@ import net.md_5.bungee.event.EventPriority;
|
||||
* plugin message to the Bukkit version of this plugin in
|
||||
* order to clear that the connection is online mode.
|
||||
*/
|
||||
public class ConnectionListener implements Listener {
|
||||
public class ConnectListener implements Listener {
|
||||
|
||||
private final FastLoginBungee plugin;
|
||||
|
||||
public ConnectionListener(FastLoginBungee plugin) {
|
||||
public ConnectListener(FastLoginBungee plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public class ConnectionListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
//use the login event instead of the postlogin event in order to send the loginsuccess packet to the client
|
||||
//use the login event instead of the post login event in order to send the login success packet to the client
|
||||
//with the offline uuid this makes it possible to set the skin then
|
||||
PendingConnection connection = loginEvent.getConnection();
|
||||
InitialHandler initialHandler = (InitialHandler) connection;
|
||||
+6
-6
@@ -19,11 +19,11 @@ import net.md_5.bungee.api.event.PluginMessageEvent;
|
||||
import net.md_5.bungee.api.plugin.Listener;
|
||||
import net.md_5.bungee.event.EventHandler;
|
||||
|
||||
public class PluginMessageListener implements Listener {
|
||||
public class MessageListener implements Listener {
|
||||
|
||||
private final FastLoginBungee plugin;
|
||||
|
||||
public PluginMessageListener(FastLoginBungee plugin) {
|
||||
public MessageListener(FastLoginBungee plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@@ -52,10 +52,10 @@ public class PluginMessageListener implements Listener {
|
||||
FastLoginCore<ProxiedPlayer, CommandSender, FastLoginBungee> core = plugin.getCore();
|
||||
|
||||
ByteArrayDataInput dataInput = ByteStreams.newDataInput(data);
|
||||
String subchannel = dataInput.readUTF();
|
||||
if ("SUCCESS".equals(subchannel)) {
|
||||
String subChannel = dataInput.readUTF();
|
||||
if ("SUCCESS".equals(subChannel)) {
|
||||
onSuccessMessage(forPlayer);
|
||||
} else if ("ON".equals(subchannel)) {
|
||||
} else if ("ON".equals(subChannel)) {
|
||||
String playerName = dataInput.readUTF();
|
||||
boolean isPlayerSender = dataInput.readBoolean();
|
||||
|
||||
@@ -70,7 +70,7 @@ public class PluginMessageListener implements Listener {
|
||||
core.getPendingConfirms().remove(forPlayer.getUniqueId());
|
||||
Runnable task = new AsyncToggleMessage(core, forPlayer, playerName, true, isPlayerSender);
|
||||
ProxyServer.getInstance().getScheduler().runAsync(plugin, task);
|
||||
} else if ("OFF".equals(subchannel)) {
|
||||
} else if ("OFF".equals(subChannel)) {
|
||||
String playerName = dataInput.readUTF();
|
||||
boolean isPlayerSender = dataInput.readBoolean();
|
||||
|
||||
Reference in new issue
Block a user