#Is it possible to change the join and leave messages in KubeJS?
85 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
what is a join message and a leave message?
i assume hes trying to pull a script from an older modpack that adds joining and leave messages into his newer pack
??code
🗒️**Send the code!**🗒️
You may have an issue with a KubeJS script and you explain it to the best of your ability yet without the actual code in question we have very little to go off of in trying to assist you.
also if you want a basic understanding of how to get started with using kubejs scripts then there are youtube tutorials out there for beginners
??tutorial
📼Youtube Tutorials📼
the first one shows you the absolute basics on getting started and youll probably understand why that error is telling you onEvent is outdated too😉
I barely have any experience with javascript too sadly 😦 The code I pulled from Bing AI but it is probably picking some info from an outdated wiki or something, so it is not working at all.
Basically, I want to change the "Player joined the game" and "Player left the game" for my roleplay server...
which message you want? maybe a simple lang entry is enough
Oh with a resource pack?
I want a simple message like "Someone joined the game" (because we hide the online player list to add surprise)
do you want it to be every time a player leaves/joins the world?
or like a welcome message type deal on first join
everytime, to replace those yellow messages on server when someome joins/leaves
like i said before #1179100908534120539 message
[Quote ➤](#1179100908534120539 message) 🗒️**Send the code!**🗒️
You may have an issue with a KubeJS script and you explain it to the best of your ability yet without the actual code in question we have very little to go off of in trying to assist you.
Well I don't really have any code right now or it is really scuffed 😅
on('player.logged_in', function (event) {
event.server.tellraw('@a', [
{
"text": "Someone joined the game",
"color": "yellow"
}
]);
});
on('player.logged_out', function (event) {
event.server.tellraw('@a', [
{
"text": "Someone left the game",
"color": "yellow"
}
]);
});
});
something like this, but there were multiple versions of it, this one does not even cancel the default messages
ah, good ol chat gpt code, love to see it
doesnt understand much of kubejs tbh unless you teach it
sec
yeah 😦 I think it pulls it from older versions
I told it to use v6 but it didnt work really well as you can see lol
heres an easy to understand way of giving player join and leave messages
// Event listener for player joining
PlayerEvents.loggedIn(event => {
// Define the player as well as the username to the event
const { player, server, player: { username } } = event
//Multiple colors version
let message = Text.of("Hello, ").green().bold()
.append(Text.of(`${username} `).yellow())
.append(Text.of(`and welcome to minecraft!`).green());
player.tell(message);
//Simple version
player.tell(`Hello, ${username} and welcome to minecraft!`)
//You can also tell the whole server the message if you wanted to
//Multiple colors version
let serverannouncement = Text.of(`${username} `).green().bold()
.append(Text.of(`just joined!`).green());
server.tell(serverannouncement);
//Simple version
server.tell(`${username} just joined!`)
});
// Event listener for player leaving
PlayerEvents.loggedOut(event => {
// Define the player as well as the username to the event
const { player, server, player: { username } } = event
//Multiple colors version
let message = Text.of(`${username} `).green().bold()
.append(Text.of(`just left.`).green());
player.tell(message);
//Simple version
player.tell(`${username} just left.`)
//You can also tell the whole server the message if you wanted to
//Multiple colors version
let serverannouncement = Text.of(`${username} `).green().bold()
.append(Text.of(`just left.`).green());
server.tell(serverannouncement);
//Simple version
server.tell(`${username} just left.`)
});``` this goes in your server_scripts folder in a .js file
ooh thank you! do you know how to cancel the regular messages too? so they are replaced entirely by these
uh what mod is prividing these messages?
if its kubejs there should be a script you can just delete
Why don't use lang entry for that? you just override the message lang entry
since his message is simple
@dense slate are you able to check lang file en_us if it have this entry about player join or left?
if there was one itd probably be in here though idk what to look for
https://mcasset.cloud/1.19.2/assets/minecraft/lang
@dense slate he just need to add this entries
multiplayer.player.joined
multiplayer.player.left
with the msg he wants
ah i see yeah he could also do that as well, he can overwrite that with the lang event right?
you probably want to edit the lang file like uncandango suggested to either have the messages be empty or add in your own language file to overwrite it
where do I add this? to a resource pack I provide?
yea
you could if you wanted to use the loggin/logout event set the entries to ""
(just deleting the text in it)
or input your messages with color codes

i must be misunderstanding what uncandangos getting at

ill let him take it from here lol
if only I could just use essentials lol
@dense slate 😐 have you never used lang event?
i have
i didnt realize thats what you meant
what? lol im syaing that since im here
tho you shouldnt be explaining it to me, you should be explaining it to the ticket OP
hes talking about something like thisjs /** Add language entries */ ClientEvents.lang('en_us', (e) => { // Effect / Radiation e.add("multiplayer.player.joined", "your welcome message"); })
ooooh you can do that with kubejs too 😮
ClientEvents.lang("en_us", event => {
event.addAll({
"multiplayer.player.joined": "Someone joined the game",
"multiplayer.player.left": "Someone left the game"
})
})
i think this is enough, but if people change language to something but english they will see like normal on their language.
you may want to override that at all languages, but still that is not something people can't cheat since it is client side, they can do anything
and me lol
but yeah
but alright i get it now tysm!
np
it says clientEvents are not defined 😦
??code
🗒️**Send the code!**🗒️
You may have an issue with a KubeJS script and you explain it to the best of your ability yet without the actual code in question we have very little to go off of in trying to assist you.
oh alright! i had put on server. code was the one you just sent lol
ooh i can just put json file in kubejs/assets/minecraft/lang it works too 😮
why not the lang event?
its basically same i guess
just was curious
json hurts my brain less and is more minecraft friendly too lol
