#how to add a close chat at custom command script

1 messages · Page 1 of 1 (latest)

dark quartz
#

This is the script

#
import { world } from '@minecraft/server';
world.beforeEvents.chatSend.subscribe((eventData) => {
  const player = eventData.sender;
  switch (eventData.message) {
    case '+hub':
      eventData.cancel = true;
      player.runCommandAsync('tp 0 2 0');
      break;
    case '+fly':
      eventData.cancel = true;
      player.runCommandAsync('ability @s mayfly true');
      player.runCommandAsync('tellraw @s {"rawtext":[{"text":"successfully!!"}]}');
      break;    
    case '+unfly':
      eventData.cancel = true;
      player.runCommandAsync('ability @s mayfly false');
      break;
    case '!gmc':
      eventData.cancel = true;
      player.runCommandAsync('gamemode c');
      break;
    case '!gms':
      eventData.cancel = true;
      player.runCommandAsync('gamemode s');
      break;
    default: break;
  }
});
#

I just want add a close chat function between these scripts

dark quartz
#

how to add a close chat at custom command script

distant mason
#

Please do not ping mods for add-on support.

dark quartz
#

Sry

distant mason
#

Only ping us if something serious is happening

dark quartz
#

Ok

pallid prism
low plover
#

can use /damage command

dark quartz
#

@low plover but it doesn't work

#

It will still opening chat when get damage

#

Have another way plz?

lament sigil
#

can't force close the chat consistently. Damaging work once only.

#

If you're not opening any server form, it shouldn't be a problem.

dark quartz
bleak blade
#

I don't really see a need to close the chat window. The user can just close it willingly and it has no impact based on your code.

low plover
dark quartz