mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-26 15:39:37 +00:00
Send system hint when a player joins/leaves a world in multiplayer
This commit is contained in:
parent
8870675dcd
commit
e8bfdc3c01
@ -1,20 +1,15 @@
|
|||||||
package emu.grasscutter.game.world;
|
package emu.grasscutter.game.world;
|
||||||
|
|
||||||
import static emu.grasscutter.server.event.player.PlayerTeleportEvent.TeleportType.SCRIPT;
|
|
||||||
|
|
||||||
import emu.grasscutter.data.GameData;
|
import emu.grasscutter.data.GameData;
|
||||||
import emu.grasscutter.data.excels.dungeon.DungeonData;
|
import emu.grasscutter.data.excels.dungeon.DungeonData;
|
||||||
import emu.grasscutter.game.entity.EntityTeam;
|
import emu.grasscutter.game.entity.*;
|
||||||
import emu.grasscutter.game.entity.EntityWorld;
|
|
||||||
import emu.grasscutter.game.player.Player;
|
import emu.grasscutter.game.player.Player;
|
||||||
import emu.grasscutter.game.player.Player.SceneLoadState;
|
import emu.grasscutter.game.player.Player.SceneLoadState;
|
||||||
import emu.grasscutter.game.props.EnterReason;
|
import emu.grasscutter.game.props.*;
|
||||||
import emu.grasscutter.game.props.EntityIdType;
|
|
||||||
import emu.grasscutter.game.props.PlayerProperty;
|
|
||||||
import emu.grasscutter.game.props.SceneType;
|
|
||||||
import emu.grasscutter.game.quest.enums.QuestContent;
|
import emu.grasscutter.game.quest.enums.QuestContent;
|
||||||
import emu.grasscutter.game.world.data.TeleportProperties;
|
import emu.grasscutter.game.world.data.TeleportProperties;
|
||||||
import emu.grasscutter.net.packet.BasePacket;
|
import emu.grasscutter.net.packet.BasePacket;
|
||||||
|
import emu.grasscutter.net.proto.ChatInfoOuterClass.ChatInfo.SystemHint;
|
||||||
import emu.grasscutter.net.proto.EnterTypeOuterClass.EnterType;
|
import emu.grasscutter.net.proto.EnterTypeOuterClass.EnterType;
|
||||||
import emu.grasscutter.scripts.data.SceneConfig;
|
import emu.grasscutter.scripts.data.SceneConfig;
|
||||||
import emu.grasscutter.server.event.player.PlayerTeleportEvent;
|
import emu.grasscutter.server.event.player.PlayerTeleportEvent;
|
||||||
@ -22,17 +17,14 @@ import emu.grasscutter.server.event.player.PlayerTeleportEvent.TeleportType;
|
|||||||
import emu.grasscutter.server.game.GameServer;
|
import emu.grasscutter.server.game.GameServer;
|
||||||
import emu.grasscutter.server.packet.send.*;
|
import emu.grasscutter.server.packet.send.*;
|
||||||
import emu.grasscutter.utils.ConversionUtils;
|
import emu.grasscutter.utils.ConversionUtils;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
import it.unimi.dsi.fastutil.ints.*;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMaps;
|
import lombok.*;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.val;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import static emu.grasscutter.server.event.player.PlayerTeleportEvent.TeleportType.SCRIPT;
|
||||||
|
|
||||||
public class World implements Iterable<Player> {
|
public class World implements Iterable<Player> {
|
||||||
@Getter private final GameServer server;
|
@Getter private final GameServer server;
|
||||||
@Getter private final Player host;
|
@Getter private final Player host;
|
||||||
@ -164,6 +156,14 @@ public class World implements Iterable<Player> {
|
|||||||
player.getTeamManager().getCurrentSinglePlayerTeamInfo(),
|
player.getTeamManager().getCurrentSinglePlayerTeamInfo(),
|
||||||
player.getTeamManager().getMaxTeamSize());
|
player.getTeamManager().getMaxTeamSize());
|
||||||
player.getTeamManager().setCurrentCharacterIndex(0);
|
player.getTeamManager().setCurrentCharacterIndex(0);
|
||||||
|
|
||||||
|
if (player != this.getHost()) {
|
||||||
|
this.broadcastPacket(new PacketPlayerChatNotify(
|
||||||
|
player, 0,
|
||||||
|
SystemHint.newBuilder()
|
||||||
|
.setType(1).build()
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add to scene
|
// Add to scene
|
||||||
@ -217,6 +217,12 @@ public class World implements Iterable<Player> {
|
|||||||
victim.getSceneId(),
|
victim.getSceneId(),
|
||||||
victim.getPosition()));
|
victim.getPosition()));
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
this.broadcastPacket(new PacketPlayerChatNotify(
|
||||||
|
player, 0,
|
||||||
|
SystemHint.newBuilder()
|
||||||
|
.setType(2).build()
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user