mirror of
https://github.com/TuxCoding/FastLogin.git
synced 2025-07-30 02:37:34 +02:00
Remove session in ProtocolSupport directly without expiring
This commit is contained in:
@ -51,12 +51,16 @@ public class BukkitLoginSession extends LoginSession {
|
|||||||
return ArrayUtils.clone(verifyToken);
|
return ArrayUtils.clone(verifyToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return premium skin if available
|
||||||
|
*/
|
||||||
public synchronized Optional<SkinProperty> getSkin() {
|
public synchronized Optional<SkinProperty> getSkin() {
|
||||||
return Optional.ofNullable(skinProperty);
|
return Optional.ofNullable(skinProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the premium skin property which was retrieved by the session server
|
* Sets the premium skin property which was retrieved by the session server
|
||||||
|
* @param skinProperty premium skin
|
||||||
*/
|
*/
|
||||||
public synchronized void setSkinProperty(SkinProperty skinProperty) {
|
public synchronized void setSkinProperty(SkinProperty skinProperty) {
|
||||||
this.skinProperty = skinProperty;
|
this.skinProperty = skinProperty;
|
||||||
|
@ -152,7 +152,7 @@ public class FastLoginBukkit extends JavaPlugin implements PlatformPlugin<Comman
|
|||||||
* Wait before the server is fully started. This is workaround, because connections right on startup are not
|
* Wait before the server is fully started. This is workaround, because connections right on startup are not
|
||||||
* injected by ProtocolLib
|
* injected by ProtocolLib
|
||||||
*
|
*
|
||||||
* @return
|
* @return true if ProtocolLib can now intercept packets
|
||||||
*/
|
*/
|
||||||
public boolean isServerFullyStarted() {
|
public boolean isServerFullyStarted() {
|
||||||
return serverStarted;
|
return serverStarted;
|
||||||
|
@ -12,6 +12,7 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
import protocolsupport.api.events.ConnectionCloseEvent;
|
||||||
import protocolsupport.api.events.PlayerLoginStartEvent;
|
import protocolsupport.api.events.PlayerLoginStartEvent;
|
||||||
import protocolsupport.api.events.PlayerPropertiesResolveEvent;
|
import protocolsupport.api.events.PlayerPropertiesResolveEvent;
|
||||||
|
|
||||||
@ -41,6 +42,12 @@ public class ProtocolSupportListener extends JoinManagement<Player, CommandSende
|
|||||||
super.onLogin(username, new ProtocolLoginSource(loginStartEvent));
|
super.onLogin(username, new ProtocolLoginSource(loginStartEvent));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onConnectionClosed(ConnectionCloseEvent closeEvent) {
|
||||||
|
InetSocketAddress address = closeEvent.getConnection().getAddress();
|
||||||
|
plugin.getLoginSessions().remove(address.toString());
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPropertiesResolve(PlayerPropertiesResolveEvent propertiesResolveEvent) {
|
public void onPropertiesResolve(PlayerPropertiesResolveEvent propertiesResolveEvent) {
|
||||||
InetSocketAddress address = propertiesResolveEvent.getAddress();
|
InetSocketAddress address = propertiesResolveEvent.getAddress();
|
||||||
|
@ -64,7 +64,7 @@ public class MessageListener implements Listener {
|
|||||||
|
|
||||||
String playerName = changeMessage.getPlayerName();
|
String playerName = changeMessage.getPlayerName();
|
||||||
boolean isSourceInvoker = changeMessage.isSourceInvoker();
|
boolean isSourceInvoker = changeMessage.isSourceInvoker();
|
||||||
if (changeMessage.isWillEnable()) {
|
if (changeMessage.shouldEnable()) {
|
||||||
if (playerName.equals(forPlayer.getName()) && plugin.getCore().getConfig().get("premium-warning", true)
|
if (playerName.equals(forPlayer.getName()) && plugin.getCore().getConfig().get("premium-warning", true)
|
||||||
&& !core.getPendingConfirms().contains(forPlayer.getUniqueId())) {
|
&& !core.getPendingConfirms().contains(forPlayer.getUniqueId())) {
|
||||||
String message = core.getMessage("premium-warning");
|
String message = core.getMessage("premium-warning");
|
||||||
|
@ -23,7 +23,7 @@ public class ChangePremiumMessage implements ChannelMessage {
|
|||||||
return playerName;
|
return playerName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isWillEnable() {
|
public boolean shouldEnable() {
|
||||||
return willEnable;
|
return willEnable;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ public class ChangePremiumMessage implements ChannelMessage {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return this.getClass().getSimpleName() + '{' +
|
return this.getClass().getSimpleName() + '{' +
|
||||||
"playerName='" + playerName + '\'' +
|
"playerName='" + playerName + '\'' +
|
||||||
", willEnable=" + willEnable +
|
", shouldEnable=" + willEnable +
|
||||||
", isSourceInvoker=" + isSourceInvoker +
|
", isSourceInvoker=" + isSourceInvoker +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user