-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Double join messages / question about death messages #133
Comments
In death messages: what placeholder do u need to use for the previously {killer_item} |
Thanks I will fix that error! Use [item] |
Hey, is there also a way to display the killer items name. Like if I name my sword Excalibur, rn it justs sends netherite sword |
Sure, but you'd need to code this in JavaScript, please ask people on Discord and someone may code this for you, you can paste it here and I will include it for everyone ;) |
|
Thanks! However, some items do not have itemmeta nor displayname, here is a safe version, also works for 1.8.8: # -------------------------------------------------------------------------------------------------
# ChatControl supports dynamic, high performance variables you create! They can be used across
# the plugin, for example in formatting your chat or death messages. Currently, the folder
# variables/ stores all custom variables in each separate yml file.
#
# Variables can not only be used to display information, but because you can write your own full
# code in JavaScript to display them, they can also do whatever you would wish for your
# players/server, such as sneaking in code to send sounds or spawn monsters.
#
# Coding this variable requires a little bit of JavaScript knowledge, see the link below.
#
# For documentation and help, please see this link:
# https://github.com/kangarko/ChatControl-Red/wiki/JavaScript-Variables
# -------------------------------------------------------------------------------------------------
# Where should this variable be used?
#
# FORMAT = used in your formats with {syntax}, players cannot use it
# MESSAGE = players can use it with [syntax] in their chat messages
Type: message
# The key we look for in the chat surrounded by [] brackets, example:
# chat message: "Hello everyone, I have an [item] in my hand" if your key is equal to "item"
Key: killer_item
# The value the key will be replaced to. This uses JavaScript.
Value: |-
itemDisplayName();
function itemDisplayName() {
var item = player.getInventory().getItemInHand();
var textColor = '&a';
var bracketColor = '&f';
var airName = 'fists';
if (item.hasItemMeta() && item.getItemMeta().hasDisplayName()) {
var itemName = player.getInventory().getItemInHand().getItemMeta().getDisplayName();
return bracketColor + '[' + textColor + itemName + bracketColor + ']';
} else {
var wordUtils = Java.type("org.apache.commons.lang.WordUtils");
var itemMaterial = player.getInventory().getItemInHand().getType().name();
var itemDefaultName = wordUtils.capitalizeFully(itemMaterial.contains("AIR") ? airName : itemMaterial.replaceAll('_', ' '));
return bracketColor + '[' + textColor + itemDefaultName + bracketColor + ']';
}
}
# What JavaScript condition must return true for this variable to show?
# You can put variables in here to get replaced.
Sender_Condition: ''
# What permission must the message sender have in order for this variable to display to him?
Sender_Permission: ''
# See Sender_Condition, except that we evaluate the JavaScript for each chat message receiver
# and only show the message to those receivers for which the condition returns true.
Receiver_Condition: ''
# What permission must the message receiver have in order for this variable to display to them?
Receiver_Permission: ''
# What texts should be displayed when we hover the mouse
# over this variable in the chat
Hover: []
# What ItemStack should be displayed when we hover the mouse over this variable in the chat
Hover_Item: player.getItemInHand()
# What website URL should be opened when we click with the mouse
# on this variable in the chat
Open_Url: ''
# What command should appear in the player command box on his screen
# if he clicks on this variable in the chat
Suggest_Command: ''
# What command should run as the sender when he clicks the mouse on this variable?
# Minecraft only supports 1 command!
Run_Command: ''
|
Hi, we're having trouble with the join messages. When a player it always sends 2 join messages. Nothing is seen in the console. (except this marriage error:) `
But that error is sent with every message. Do you know what it could be?
The text was updated successfully, but these errors were encountered: