Fix kick during PlayerJoinEvent (#92)
This commit is contained in:
parent
1a6b7f9ebe
commit
dd5be5a46d
|
@ -154,11 +154,14 @@ public abstract class PlayerListMixin implements PlayerListBridge {
|
||||||
@Eject(method = "initializeConnectionToPlayer", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/management/PlayerList;func_232641_a_(Lnet/minecraft/util/text/ITextComponent;Lnet/minecraft/util/text/ChatType;Ljava/util/UUID;)V"))
|
@Eject(method = "initializeConnectionToPlayer", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/management/PlayerList;func_232641_a_(Lnet/minecraft/util/text/ITextComponent;Lnet/minecraft/util/text/ChatType;Ljava/util/UUID;)V"))
|
||||||
private void arclight$playerJoin(PlayerList playerList, ITextComponent component, ChatType chatType, UUID uuid, CallbackInfo ci, NetworkManager netManager, ServerPlayerEntity playerIn) {
|
private void arclight$playerJoin(PlayerList playerList, ITextComponent component, ChatType chatType, UUID uuid, CallbackInfo ci, NetworkManager netManager, ServerPlayerEntity playerIn) {
|
||||||
PlayerJoinEvent playerJoinEvent = new PlayerJoinEvent(this.cserver.getPlayer(playerIn), CraftChatMessage.fromComponent(component));
|
PlayerJoinEvent playerJoinEvent = new PlayerJoinEvent(this.cserver.getPlayer(playerIn), CraftChatMessage.fromComponent(component));
|
||||||
|
this.players.add(playerIn);
|
||||||
|
this.uuidToPlayerMap.put(playerIn.getUniqueID(), playerIn);
|
||||||
this.cserver.getPluginManager().callEvent(playerJoinEvent);
|
this.cserver.getPluginManager().callEvent(playerJoinEvent);
|
||||||
if (!playerIn.connection.netManager.isChannelOpen()) {
|
if (!playerIn.connection.netManager.isChannelOpen()) {
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
this.players.remove(playerIn);
|
||||||
String joinMessage = playerJoinEvent.getJoinMessage();
|
String joinMessage = playerJoinEvent.getJoinMessage();
|
||||||
if (joinMessage != null && joinMessage.length() > 0) {
|
if (joinMessage != null && joinMessage.length() > 0) {
|
||||||
for (ITextComponent line : CraftChatMessage.fromString(joinMessage)) {
|
for (ITextComponent line : CraftChatMessage.fromString(joinMessage)) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user