Triple chat in Minecraft

Discussion in 'Plugin Development' started by venkateshganu, Nov 19, 2019.

Thread Status:
Not open for further replies.
  1. Offline

    venkateshganu

    i am trying to create three chats in Minecraft with three keyboard keys which will direct the messages to three groups of people. I have added three keys R, G, B to open three chat boxes on the screen to type the messages. They work exactly as the regular chat. they print to the regular chat. I need to print them on their respective gui's above the input gui's. I have appended some coded messages in each chat to distinguish the messages to be sent to different groups i.e printing to different gui's.

    private KeyBinding keyBindingChat1;
    private KeyBinding keyBindingChat2;
    private KeyBinding keyBindingChat3;
    @Override
    public void preInit() {
    super.preInit();

    keyBindingChat1 = new KeyBinding("key.chat1.list", Keyboard.KEY_R, "key.categories.gameplay");
    keyBindingChat2 = new KeyBinding("key.chat2.list", Keyboard.KEY_G, "key.categories.gameplay");
    keyBindingChat3 = new KeyBinding("key.chat3.list", Keyboard.KEY_B, "key.categories.gameplay");
    }

    public void onClientTickOpenChat1Gui(EntityPlayer player, PlayerState state) {
    if(keyBindingChat1.isPressed()) {
    if(this.noScreenOverlay()) {
    if(player.isSneaking()) {
    client.displayGuiScreen(new GuiChat1());
    }
    else {
    client.displayGuiScreen(new GuiChat1());
    }
    }
    }
    }

    public void onClientTickOpenChat2Gui(EntityPlayer player, PlayerState state) {
    if(keyBindingChat2.isPressed()) {
    if(this.noScreenOverlay()) {
    if(player.isSneaking()) {
    client.displayGuiScreen(new GuiChat2());
    }
    else {
    client.displayGuiScreen(new GuiChat2());
    }
    }
    }
    }

    public void onClientTickOpenChat3Gui(EntityPlayer player, PlayerState state) {
    if(keyBindingChat3.isPressed()) {
    if(this.noScreenOverlay()) {
    if(player.isSneaking()) {
    client.displayGuiScreen(new GuiChat3());
    }
    else {
    client.displayGuiScreen(new GuiChat3());
    }
    }
    }
    }

    @EventHandler
    public void onServerChatEvent(ServerChatEvent e) {
    if(e.message.endsWith("Group1")) {
    e.setCanceled(true);
    for(EntityPlayerMP a:playerList1)
    a.addChatMessage(new ChatComponentText(e.message.substring(0, e.message.length()-6)));
    }
    else if(e.message.endsWith("Group2")) {
    e.setCanceled(true);
    for(EntityPlayerMP a:playerList2)
    a.addChatMessage(new ChatComponentText(e.message.substring(0, e.message.length()-6)));
    }
    else if(e.message.endsWith("Group3")) {
    e.setCanceled(true);
    for(EntityPlayerMP a:playerList3)
    a.addChatMessage(new ChatComponentText(e.message.substring(0, e.message.length()-6)));
    }
    else {
    e.setCanceled(true);
    }
    }


    The GUIChat1,GUIChat2,GUIChat3 are same as GUIChat but with smaller area to enter message.
    Is there a way to print the messages to individual GUI's above the respective GUIChats? Do i need to override GUIIngame/ GUINewChat and create three new classes? Any help is appreciated.
    upload_2019-11-19_11-6-41.png
    upload_2019-11-19_11-7-10.png
    upload_2019-11-19_11-7-30.png
     
  2. Offline

    timtower Administrator Administrator Moderator

    Locked
    Modded clients are not supported by Bukkit
     
Thread Status:
Not open for further replies.

Share This Page