Giter Club home page Giter Club logo

Comments (8)

confuser avatar confuser commented on June 20, 2024

It would be easier if there was a tooltip method to pass in a String[] or List

from fanciful.

mkremins avatar mkremins commented on June 20, 2024

The invalid item JSON issue should be fixed in the just-released v0.1.3 – update your dependency info and tell me if the bug is still there.

v0.1.3 also adds overrides for FancyMessage.tooltip() to accept a String[] or a List<String> as argument. Note that the overridden versions of .tooltip() don't make any attempt to handle newlines within individual strings – if you want auto-splitting on \n you'll have to stick with the version that accepts a single String.

from fanciful.

confuser avatar confuser commented on June 20, 2024
String [] messages = new String[4];
            messages[0] = ChatColor.GREEN + "World: " + ChatColor.GOLD + arena.getWorldName();
            messages[1] = ChatColor.GREEN + "Type: " + ChatColor.GOLD + type;
            messages[2] = ChatColor.GREEN + "Status: " + ChatColor.GOLD + status;
            messages[3] = ChatColor.GREEN + "Players: " + ChatColor.GOLD + arena.getAlivePlayersSize() + "/" + (arena.getAlivePlayersSize() + arena.getDeadPlayers().size());

            FancyMessage message = new FancyMessage(ChatColor.GOLD + playerName + ChatColor.GREEN + " is in ").then(ChatColor.GOLD + "[Arena " + arena.getID() + "]")
                .tooltip(messages);

Still says Invalid Item on hover :(

from fanciful.

mkremins avatar mkremins commented on June 20, 2024

Taking another look at this – will get back to you once I've figured out a fix.

from fanciful.

mkremins avatar mkremins commented on June 20, 2024

As it turns out, this is a bug that I really should've seen coming – I was warned about it a long time ago, but apparently it fell off my radar and the fix never made it into the repo.

Unfortunately, even though I now understand the workaround that we need to use to fix the bug, there doesn't seem to be a friendly way to accomplish this via the GSON library we're using to generate JSON at the moment. In fact, since the workaround involves generating technically invalid JSON that's only understood by Mojang's buggy JSON parser, GSON actually deliberately tries to prevent us from doing anything that would fix the problem.

I'm now on to investigating possible solutions in the hopes of finding one that isn't terribly ugly. Whether or not I find one, a fix of some sort should be available in a few days at most.

from fanciful.

Cryptite avatar Cryptite commented on June 20, 2024

And updates on this little beastly issue?

from fanciful.

mkremins avatar mkremins commented on June 20, 2024

After spending some time poking at the GSON API looking for an escape hatch I can use to insert invalid JSON, I've concluded that there isn't any and we're going to have to do some sort of string munging by hand to get this under control. Unfortunately, beyond this investigative work I haven't even had a chance to throw together a hacky quickfix.

Any contributions to fix this would really be appreciated – I'm not sure when I'll next have the time to write a proper patch myself. Even if the code isn't brilliant, having it working would be great, and we can always improve whatever gets submitted over time.

from fanciful.

glen3b avatar glen3b commented on June 20, 2024

As you can see in my PR #30, I've fixed the issue. As @mkremins suggested, I would guess that the Minecraft client changed to support newlines in strings properly, which is exactly what my PR does.

from fanciful.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.