📄 [WIP] ChatEditor - A text editor in minecraft

ChatEditor

ChatEditor is a plugin that gives you a text editor withing the minecraft chat. Copy, cut, paste, open files and save them. Lint JSON and HOCON and more. Just install the plugin and type /editor to get started. To se the position in the editor, click and shift click on the text.

ChatEditor requires requires KatLib 1.1.0.

Links

Source
Downloads
Issues (There are loads of bugs most likely, and I already know about some of them)

Commands

  • /editor Opens a new editor
  • /editor file <path> <createIfNotFound> Opens a new editor with the content of a file on the server

The editor

The majority of ChitChat is accessed through the editor. The editor itself is made up of many smaller behaviors that dictate what will happen when you use editor commands (more on that in a second) and when you enter text.

The Text behavior

A text behavior is something that affects what happens when you enter your text. Does your text have different lines, or is it all on one line? That’s what the text behavior decides. There currently exist two text behaviors.
The cursor behavior: The cursor behavior is very much like how you enter text in minecraft normally. You have one line where all the text is inserted. You can click on the around the text to set your position, and shift click to select text.
The line behavior: Unlike the cursor behavior, the line behavior allows you to have text on multiple lines. When in line behavior, the editor only cares about each line, not what’s on it. If you start writing something on a line where you already have some text, the new text will override the old text. You can hit space to get the content of your current line. As with the cursor behavior, you can select lines with clicking and shift clicking. New lines can be inserted by having \n in the message.

The end behavior

The end behavior is what decides what happens when you exit the editor. Here are some of the end behaviors currently implemented.
Chat: Just sends your text to the chat. This allows you to send messages longer than the chat limit.
Command: Sends the text as a command. This allows you to use commands with text longer than the chat limit.
Command block: Sends the text to a command block that you have specified. This can be though of as a safe way to allow non ops to edit command blocks as a permission check is made first before setting the command to make sure the player is allowed to use that command. This mode can also be started by shift clicking a command block.
NOOP/Cancel: Simply does nothing
Save: If you have a file open, this will save the file for you

Editor commands

When in an editor you normal commands won’t work. To do more interesting stuff than just adding or selecting text with your editor you can use editor commands. All editor commands begins with !. Editor commands have partial support for tab complete.

Core

  • !addLine Adds a new line if the text behavior is line
  • !end Ends the editor
  • !help Gets help about an editor command
  • !setEnd Allows you to set a new end behavior
  • !setText Allows you to set a new text behavior
  • !view Simply views the text

Extra

  • !copy Copies the selected text to the clipboard
  • !cut Cuts the selected text to the clipboard
  • !paste Pastes the selected text from the clipboard
  • !lintHocon Verifies that the text in the editor is valid HOCON
  • !lintJson Verifies that the text in the editor is valid JSON
  • !prettifyHocon Tries to prettify the text in the editor as HOCON
  • !prettifyJson Tries to prettify the text in the editor as JSON
  • !reload Reloads the currently open file
  • !save Saves the currently open file

Plannes features

  • Less bugs
  • Support for mojangson
  • More editor commands
  • More end behaviors
  • !chat Editor command to allow you to chat to the outside world while in an editor
  • !command Editor command to allow you to use a command while in an editor
3 Likes

Can this be used for editing text provided by a plugin?
I have the holograms plugin Holograms - Easily create floating texts! . Setting very long texts on holograms requires setting the text in a config file, which is annoying. I am looking for a way to enter longer text and edit them. This plugin seems to be a good match. Is there any API that I can use to integrate this plugin into mine?

I’d love to take a look at it. I haven’t done too much work on ChatEditor lately (been working on other projects), but it sounds like a fun thing to do. (Just ran out off stuff to do as well so this fits nicely for me.)

1 Like