Skip to content
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

GSON #49

Closed
drtshock opened this issue Nov 29, 2014 · 8 comments · Fixed by #50
Closed

GSON #49

drtshock opened this issue Nov 29, 2014 · 8 comments · Fixed by #50

Comments

@drtshock
Copy link
Contributor

Spigot no longer remaps nms libs which is where the GSON you used was. You'll either have to shade it yourself or use the one in craftbukkit (older version I think).

"The lack of remapping libs is intended. It was originally done, but having newer versions was a better idea. (Guava was ~2 years old). It was overlooked as it was assumed NMS plugins weren't going to use them, rather the CB ones" - spigot devs.

@MiniDigger
Copy link
Contributor

Duplicate of #48 ;D
but you explained it better

@anna-is-cute
Copy link

See #45, as it is related.

@drtshock
Copy link
Contributor Author

You could just shade it in yourself for now? Could also look at just hooking into the API.

@MiniDigger
Copy link
Contributor

Is should be fixed by changing the used Gson class here: https://github.com/mkremins/fanciful/blob/master/src/main/java/mkremins/fanciful/FancyMessage.java#L562-L575
removing the package of the class and just using the imported one should fix this issue. Can't submit a pr right now (don't have a development setup with me) so someone else could do and test it.

@FlashLight34
Copy link

hello, im new in github, im lost with this error, i added gson-2.2.4.jar to my plugin with fanciful and spigot 1.8 R 0.1 snapshot (all days i update him and i receve the new fix) on Eclipse no more error but in the game any where i use fancyful that not work and i got the error

[14:26:22] [Server thread/WARN]: [VisitorQuizz] Task #44 for VisitorQuizz v0.196 generated an exception
java.lang.NoClassDefFoundError: net/minecraft/util/com/google/gson/Gson
at mkremins.fanciful.FancyMessage.createChatPacket(FancyMessage.java:416) ~[?:?]
at mkremins.fanciful.FancyMessage.send(FancyMessage.java:403) ~[?:?]
at org.flash.VisitorQuizz.visitorquizz.fancymsg(visitorquizz.java:399) ~[?:?]
at org.flash.VisitorQuizz.EventChat$1.run(EventChat.java:110) ~[?:?]
at org.bukkit.craftbukkit.v1_8_R1.scheduler.CraftTask.run(CraftTask.java:71) ~[spigot-1.8.jar:git-Spigot-116e6fc-54888df]
at org.bukkit.craftbukkit.v1_8_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:350) [spigot-1.8.jar:git-Spigot-116e6fc-54888df]
at net.minecraft.server.v1_8_R1.MinecraftServer.z(MinecraftServer.java:694) [spigot-1.8.jar:git-Spigot-116e6fc-54888df]
at net.minecraft.server.v1_8_R1.DedicatedServer.z(DedicatedServer.java:316) [spigot-1.8.jar:git-Spigot-116e6fc-54888df]
at net.minecraft.server.v1_8_R1.MinecraftServer.y(MinecraftServer.java:623) [spigot-1.8.jar:git-Spigot-116e6fc-54888df]
at net.minecraft.server.v1_8_R1.MinecraftServer.run(MinecraftServer.java:526
[spigot-1.8.jar:git-Spigot-116e6fc-54888df]

so anyone can explain me how to fix this or we need to attempt a fix from the author?

thanx in advance
Flash

@bendem
Copy link

bendem commented Dec 13, 2014

This is fixed in the latest commit. Since the owner can't deploy (see #51) you'll have to clone the repo and mvn install it yourself.

@FlashLight34
Copy link

Hello bendem im already do this but i got the same error i dont know why :(
capture
capture

@FlashLight34
Copy link

to people who want an altarnative code

public void fancymsg(CommandSender sender, String Number, String Choix, String Cmd) {
if (sender instanceof Player) {
    Player pl = (Player) sender;
    String pn = pl.getName();

    String Hover= "Cliquez ici, si votre réponse est: "+ChatColor.GOLD+ Number+ChatColor.GRAY+". "+ChatColor.GREEN+Choix;
    Cmd = (Cmd.equals("")?"/tell <Player> Ceci est un exemple ;)":Cmd);

    String tellRaw = "tellraw <Player> {\"text\":\"\",\"extra\":[{\"text\":\" <number>\",\"color\":\"gold\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"<cmd>\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"<Hover>\"}},{\"text\":\". \",\"color\":\"gray\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"<cmd>\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"<Hover>\"}},{\"text\":\"<choix>\",\"color\":\"green\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"<cmd>\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"<Hover>\"}}]}";

    tellRaw = tellRaw.replace("<cmd>",Cmd).replace("<choix>",Choix).replace("<number>",Number).replace("<Hover>",Hover).replace("<Player>",pn); 

    getServer().dispatchCommand(getServer().getConsoleSender(), tellRaw);
    }  
}                       

this is mine, for my visitor quizz ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants