Comments (8)
It would be easier if there was a tooltip method to pass in a String[] or List
from fanciful.
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.
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.
Taking another look at this – will get back to you once I've figured out a fix.
from fanciful.
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.
And updates on this little beastly issue?
from fanciful.
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.
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)
- Can't mvn deploy HOT 17
- Is it possible to use this library to align text in the 1.8 action bar? HOT 2
- itemTooltip(ItemStack) doesn't seem to respect damage values for items HOT 1
- Seems to be broken for latest 1.8.3 Spigot HOT 3
- Add replace function HOT 3
- GSON Missing? HOT 2
- Maven Repo down? HOT 4
- Can't load FancyMessage from String HOT 1
- Sending FancyMessage's HOT 3
- Spigot 1.7.10 - \n cartridge return? HOT 1
- Spigot 1.7.10 - \n cartridge return? HOT 2
- "NumberFormatException" HOT 10
- IllegalArgumentException when using fm.text() HOT 2
- Caused by: java.lang.IllegalArgumentException: The value must be specified. HOT 5
- Text alignment HOT 1
- .itemTooltip() no longer in fanciful? HOT 4
- Invalid Item shown in tooltip in chat with high item quantity
- Lack of Feature: Urls are not parsed into clickables
- Handling of Bukkit ChatColor HOT 1
- Shutting down Maven repo HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fanciful.