Modify chat manager to give plugin ability to change it

This commit is contained in:
muhammadeko 2022-05-15 12:40:46 +07:00 committed by Melledy
parent 722d53c9c2
commit f1af23e8d6
3 changed files with 21 additions and 6 deletions

View File

@ -1,4 +1,4 @@
package emu.grasscutter.game.managers;
package emu.grasscutter.game.managers.ChatManager;
import emu.grasscutter.command.CommandMap;
import emu.grasscutter.game.player.Player;
@ -10,7 +10,7 @@ import emu.grasscutter.server.packet.send.PacketPrivateChatNotify;
import java.util.Arrays;
import java.util.List;
public class ChatManager {
public class ChatManager implements ChatManagerHandler {
static final List<Character> PREFIXES = Arrays.asList('/', '!');
private final GameServer server;

View File

@ -0,0 +1,12 @@
package emu.grasscutter.game.managers.ChatManager;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.server.game.GameServer;
public interface ChatManagerHandler {
GameServer getServer();
void sendPrivateMessage(Player player, int targetUid, String message);
void sendPrivateMessage(Player player, int targetUid, int emote);
void sendTeamMessage(Player player, int channel, String message);
void sendTeamMessage(Player player, int channel, int icon);
}

View File

@ -10,12 +10,12 @@ import emu.grasscutter.game.drop.DropManager;
import emu.grasscutter.game.dungeons.DungeonManager;
import emu.grasscutter.game.expedition.ExpeditionManager;
import emu.grasscutter.game.gacha.GachaManager;
import emu.grasscutter.game.managers.ChatManager;
import emu.grasscutter.game.managers.ChatManager.ChatManager;
import emu.grasscutter.game.managers.ChatManager.ChatManagerHandler;
import emu.grasscutter.game.managers.InventoryManager;
import emu.grasscutter.game.managers.MultiplayerManager;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.quest.ServerQuestHandler;
import emu.grasscutter.game.quest.handlers.QuestBaseHandler;
import emu.grasscutter.game.shop.ShopManager;
import emu.grasscutter.game.tower.TowerScheduleManager;
import emu.grasscutter.game.world.World;
@ -44,7 +44,7 @@ public final class GameServer extends KcpServer {
private final Map<Integer, Player> players;
private final Set<World> worlds;
private final ChatManager chatManager;
private ChatManagerHandler chatManager;
private final InventoryManager inventoryManager;
private final GachaManager gachaManager;
private final ShopManager shopManager;
@ -107,9 +107,12 @@ public final class GameServer extends KcpServer {
return worlds;
}
public ChatManager getChatManager() {
public ChatManagerHandler getChatManager() {
return chatManager;
}
public void setChatManager(ChatManagerHandler chatManager) {
this.chatManager = chatManager;
}
public InventoryManager getInventoryManager() {
return inventoryManager;