mirror of
https://github.com/ProjectSWGCore/Holocore.git
synced 2026-10-07 22:13:40 -04:00
Changed CloseConnectionIntent to use Player instances
This commit is contained in:
+12
-16
@@ -27,36 +27,32 @@
|
||||
package com.projectswg.holocore.intents.support.global.network;
|
||||
|
||||
import com.projectswg.holocore.resources.support.global.network.DisconnectReason;
|
||||
import com.projectswg.holocore.resources.support.global.player.Player;
|
||||
import me.joshlarson.jlcommon.control.Intent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class CloseConnectionIntent extends Intent {
|
||||
|
||||
private long networkId;
|
||||
private DisconnectReason reason;
|
||||
private final Player player;
|
||||
private final DisconnectReason reason;
|
||||
|
||||
public CloseConnectionIntent(long networkId, DisconnectReason reason) {
|
||||
setNetworkId(networkId);
|
||||
setDisconnectReason(reason);
|
||||
}
|
||||
|
||||
public void setNetworkId(long networkId) {
|
||||
this.networkId = networkId;
|
||||
}
|
||||
|
||||
public void setDisconnectReason(DisconnectReason reason) {
|
||||
public CloseConnectionIntent(@NotNull Player player, @NotNull DisconnectReason reason) {
|
||||
this.player = player;
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
public long getNetworkId() {
|
||||
return networkId;
|
||||
@NotNull
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public DisconnectReason getDisconnectReason() {
|
||||
return reason;
|
||||
}
|
||||
|
||||
public static void broadcast(long networkId, DisconnectReason reason) {
|
||||
new CloseConnectionIntent(networkId, reason).broadcast();
|
||||
public static void broadcast(@NotNull Player player, @NotNull DisconnectReason reason) {
|
||||
new CloseConnectionIntent(player, reason).broadcast();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
package com.projectswg.holocore.resources.support.global.commands.callbacks;
|
||||
|
||||
import com.projectswg.holocore.resources.support.global.commands.ICmdCallback;
|
||||
import com.projectswg.holocore.resources.support.global.player.Player;
|
||||
import com.projectswg.holocore.resources.support.objects.swg.SWGObject;
|
||||
|
||||
public final class ACmdCallbackTemplate implements ICmdCallback {
|
||||
|
||||
@Override
|
||||
public void execute(Player player, SWGObject target, String args) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+2
-1
@@ -31,5 +31,6 @@ public enum DisconnectReason {
|
||||
OTHER_SIDE_TERMINATED,
|
||||
APPLICATION,
|
||||
NEW_CONNECTION_ATTEMPT,
|
||||
CONNECTION_REFUSED
|
||||
CONNECTION_REFUSED,
|
||||
SUSPECTED_HACK
|
||||
}
|
||||
|
||||
+1
-1
@@ -143,7 +143,7 @@ public class NetworkClientService extends Service {
|
||||
|
||||
@IntentHandler
|
||||
private void handleCloseConnectionIntent(CloseConnectionIntent ccii) {
|
||||
disconnect(ccii.getNetworkId());
|
||||
disconnect(ccii.getPlayer().getNetworkId());
|
||||
}
|
||||
|
||||
@IntentHandler
|
||||
|
||||
+1
-1
@@ -164,7 +164,7 @@ public class ConnectionService extends Service {
|
||||
IntentChain.broadcastChain(
|
||||
new PlayerEventIntent(p, PlayerEvent.PE_DISAPPEAR),
|
||||
new PlayerEventIntent(p, PlayerEvent.PE_DESTROYED),
|
||||
new CloseConnectionIntent(p.getNetworkId(), DisconnectReason.APPLICATION));
|
||||
new CloseConnectionIntent(p, DisconnectReason.APPLICATION));
|
||||
}
|
||||
|
||||
private void updatePlayTime(Player p) {
|
||||
|
||||
+1
-1
@@ -173,7 +173,7 @@ public class AwarenessService extends Service {
|
||||
PlayerState state = player.getPlayerState();
|
||||
boolean firstZone = (state == PlayerState.LOGGED_IN);
|
||||
if (!firstZone && state != PlayerState.ZONED_IN) {
|
||||
new CloseConnectionIntent(player.getNetworkId(), DisconnectReason.APPLICATION).broadcast();
|
||||
CloseConnectionIntent.broadcast(player, DisconnectReason.SUSPECTED_HACK);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user