#hex colors

1 messages ยท Page 1 of 1 (latest)

green prism
#

hi

#

please show an example of the text you'd like to translate to hex colors

hushed vector
#

&x&f&f&f&f&f&fO litterly translated orange

#

wtf

#

Using ur method

green prism
#

that cannot be

hushed vector
#

Somehow it did

green prism
#

if anything, it would translate to white

hushed vector
#

I mean

#

Yea

green prism
#

can you upload your whole thing to github pls

hushed vector
#

It did translate to white

hushed vector
#

&x&f&f&f&f&0&0O Should be yellow

#

Translated to black

green prism
green prism
#

...

#

I doubt that you copied the whole class

hushed vector
#

I did

green prism
#

upload your stuff to github, then send link pl

hushed vector
green prism
#

yes and how do you use it?

hushed vector
#

TextUtils.color()

green prism
#

...

#

sorry but

#

show the FULL CODE you use in your ping event

#

you always only give tiny fractions of your code

#

aint nobody can help with that

#

you have to show some context, i.e. your full ping event listener

hushed vector
#
package org.Dacaly.NetworkTools.Listeners;

import org.Dacaly.NetworkTools.NetworkTools;
import org.Dacaly.NetworkTools.Utils.Configs;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.ServerPing;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.event.ProxyPingEvent;
import net.md_5.bungee.api.plugin.Listener;
import net.md_5.bungee.event.EventHandler;
import org.Dacaly.NetworkTools.Utils.TextUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

public class ProxyPingListener implements Listener {

    @EventHandler
    public void onProxyPing(ProxyPingEvent e) {
        ServerPing serverPing = e.getResponse();

        if (Configs.modules.contains("motd")) {
            if (NetworkTools.maintenance && Configs.modules.contains("maintenance-mode")) {
                if (Configs.modules.contains("maintenance-motd")) {
                    serverPing.setDescriptionComponent(new TextComponent(TextUtils.color(String.join("\n", Configs.config.getStringList("modules.maintenance-mode.maintenance-motd.message")))));
                }
                if (Configs.modules.contains("maintenance-version")) {
                    ServerPing.Protocol protocol = new ServerPing.Protocol("Maintenance", 1);
                    serverPing.setVersion(protocol);
                }
            } else {
                String message = String.join("\n", Configs.config.getStringList("modules.motd.message"));
                NetworkTools.plugin.getLogger().info(message);
                NetworkTools.plugin.getLogger().info(TextUtils.color(message));
                serverPing.setDescriptionComponent(new TextComponent(TextUtils.color(message)));
            }
        }
        e.setResponse(serverPing);
    }

}
green prism
#

and please don't just copy paste it here without any formatting

#

ok thats better

#

one sec I'll copy it to my IDE

#

please for once lets debug it a bit

#

replace the whole method with this: (1 min pls

#
    @EventHandler
    public void onProxyPing(ProxyPingEvent e) {
        ServerPing serverPing = e.getResponse();
        
        serverPing.setDescriptionComponent(new TextComponent(TextUtils.color("&#ff0000RED TEXT")));
                
        e.setResponse(serverPing);
    }
#

please check out whether that works

#

if that doesn't work, there's a problem in my code

#

if it works, the problem is how you parse your stuff

hushed vector
#
<dependency>
        </dependency>
            <groupId>net.md-5</groupId>
            <artifactId>bungeecord-api</artifactId>
            <version>1.18-R0.1-SNAPSHOT</version>
            <type>jar</type>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>net.md-5</groupId>
            <artifactId>bungeecord-api</artifactId>
            <version>1.18-R0.1-SNAPSHOT</version>
            <type>javadoc</type>
            <scope>provided</scope>
        </dependency>
#

Server: Waterfall-1.18 475

#

Client: Vanilla 1.18.1

#

Plugin: java 16

#

Server: java 17

#

B

#

r

#

u

#

h

#

Old plugin does work

#

My actual brain just died

green prism
#

erm why do you even pass the string length to the buffer/builder?

#

that's unnecessary and only causes trouble ๐Ÿ˜›

hushed vector
#

I know but that's not rly the point rn

#

My old plugin works

#

THE EXACT SAME WAY

#

new one doesn't

#

Same methods

#

Even used java 8

#

And bungee api 1.17

hushed vector
#

Not only motd

#

@green prism it appeared new TextComponent("") is different then new TextComponent(TextComponent.fromLegacyText(""))

green prism
#

new TextComponent just takes the text as it is

#

fromLegacyText will translate the "legacy" color codes to the "new" json format

#

that's one of the reason why I kept nagging you to send the FULL code you're using ๐Ÿ˜›

#

so you got it working now @hushed vector ?

green prism
#

No problem, as long as you got it working now :3

hushed vector
#

Thx

#

I'm just very stupid

#

It somehow did work before

green prism
#

haha it can happen

hushed vector
#

But idk anymore

green prism
#

happens to everyone somtimes