How to add words
Adding words ingame or via console
There are two ways of adding words to censor.
The first method is to use the ingame command. To add a word ingame or via console you have to use the command:
/censor add <word> <replace> <action> [method] [penalty-points:damage]
Parameter | Description | ||
<word> | The word to censor | required | |
<replace> | The word to replace the censored word with | required | |
<action> | The action to perform. Can be: NONE, KICK, BAN, TEMPBAN | required | |
[method] | The method to use to replace the word. There are several methods: default, alternative, compact. See below to find out which method to use. | optional (default method is default) | |
[penalty-points:damage] | The penalty-points to add to the player and the damage to deal to the player | optional (default is 0:0) |
These are some examples on how to use this command:
- /censor add word anotherword TEMPBAN
- /censor add word anotherword KICK compact
- /censor add word anotherword NONE alternative 1:0
- /censor add word anotherword NONE default 2:5
Adding words in server files
Words also can be added out of the game in the server files. To do that make sure your server is shut down! You can find all the files words are saved in via the path: root/plugins/CensorShip/words. Open one of the files and start adding a new word. The format for a new word is:
{ "word": "word", "replace_with": "anotherword", "action": "none", "method": "default", "damage": 0, "penalty_points": 0, "exceptions": [ . . . . ."wordy", . . . . ."wordery" . . . ], "commands": [ . . . . ."msg <player> don't do this again!", . . . . ."tp <player> 0 256 0" . . . ] }
Parameter | Description | |
word | The word to be censored | |
replace_with | The word to replace the word to censor with | |
action | The action to perform. Can be: NONE, KICK, BAN, TEMPBAN | |
method | The method to use to replace the word. There are several methods: default, alternative, compact. See below to find out which method to use. | |
damage | The damage to deal to the player for using that word | |
penalty_points | The penalty-points to add to the player for using that word | |
exceptions | A list of exceptions which contain the word but should not be replaced | |
commands | A list of commands to perform when using that word |
When there are multiple words in this file, seperate the blocks with a comma, like this:
{ "word": "word", "replace_with": "anotherword", "action": "none", "method": "default", "damage": 0, "penalty_points": 0, "exceptions": [], "commands": [] }, { "word": "anotherword", "replace_with": "word", "action": "ban", "method": "default", "damage": 5, "penalty_points": 1, "exceptions": [], "commands": [] }
If you want to create a new file for your words, you can add another json file in the same folder. Add this structure to your file:
{ "words": [] }
Add your new words inbetween the [] brackets.
Now that your file is created you have to let the plugin know that this file exists. To do that go to: root/plugins/CensorShip/ and open worlds-config.json. In there just add another line with your files name (without the .json expansion!).
Methods to censor
I implemented the methods to censor to add the possibility to censor the word in the way you want it to be censored. For example, for "who removed this?" there are several ways on how to replace the word "whore".
You could replace is so "<replaced word> moved this?" comes out but you also could use a method so the original phrase stays the same (what you probably want in this case). But using this also has some bad points. No word can be censored correctly all of the time, but using the correct methods they do most of the time. To test a word with a certain method, you can use following command:
/censor test <method> <word> <message>
This command searches for the all forms of the given word in the given message using the given method and replaces them like the plugin would to ingame. So you can test several situations with different methods and messages to find out, which one fits best for your needs.
How do the commands work? Is it run from the server or from the player.?
For example, if I wanted to jail a player for saying a bad word, how would I do that?
@Junit151
The commands are sent by the server. So you can write "jail <player>" (don't know the jail command). Make sure there is no slash at the beginning!
<player> will be automatically replaced with the current player