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

Addon development: creating a type with "gui" in its name causes a weird error. #5879

Closed
1 task done
DereWah opened this issue Aug 4, 2023 · 8 comments
Closed
1 task done
Labels
bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. completed The issue has been fully resolved and the change will be in the next Skript update.

Comments

@DereWah
Copy link

DereWah commented Aug 4, 2023

Skript/Server Version

Skript 2.6.4
Server version 1.20.1

Bug Description

Hello, I am working on updating my Addon Skript-AnvilGUI.

Whenever I try to rename the type codename to "anvilgui" or "virtualanvilgui", it prints an error in the console, and refers to the type as "virtualanvilguu"

Expected Behavior

It should find the class "virtualanvilgui"

Steps to Reproduce

Add the word "anvilgui" or "gui" to any classinfo in your addon.

Errors or Screenshots

: #!#! 
[15:28:54 ERROR]: #!#! [Skript] Severe Error:
[15:28:54 ERROR]: #!#! Could not load testanvil.sk
[15:28:54 ERROR]: #!#! 
[15:28:54 ERROR]: #!#! Something went horribly wrong with Skript.
[15:28:54 ERROR]: #!#! This issue is NOT your fault! You probably can't fix it yourself, either.
[15:28:54 ERROR]: #!#! It looks like you are using some plugin(s) that alter how Skript works (addons).
[15:28:54 ERROR]: #!#! Here is full list of them:
[15:28:54 ERROR]: #!#! Skript-AnvilGUI v1.2 
[15:28:54 ERROR]: #!#! We could not identify which of those are specially related, so this might also be Skript issue.
[15:28:54 ERROR]: #!#! You should try disabling those plugins one by one, trying to find which one causes it.
[15:28:54 ERROR]: #!#! If the error doesn't disappear even after disabling all listed plugins, it is probably Skript issue.
[15:28:54 ERROR]: #!#! In that case, you will be given instruction on how should you report it.
[15:28:54 ERROR]: #!#! On the other hand, if the error disappears when disabling some plugin, report it to author of that plugin.
[15:28:54 ERROR]: #!#! Only if the author tells you to do so, report it to Skript's issue tracker.
[15:28:54 ERROR]: #!#! 
[15:28:54 ERROR]: #!#! Stack trace:
[15:28:54 ERROR]: #!#! java.lang.RuntimeException: pattern compiling exception, element class: org.derewah.skriptanvilgui.effects.EffOpenAnvilGUI
[15:28:54 ERROR]: #!#!     at Skript-2.6.4.jar//ch.njol.skript.lang.SkriptParser.parse(SkriptParser.java:226)
[15:28:54 ERROR]: #!#!     at Skript-2.6.4.jar//ch.njol.skript.lang.SkriptParser.parse(SkriptParser.java:177)
[15:28:54 ERROR]: #!#!     at Skript-2.6.4.jar//ch.njol.skript.lang.Statement.parse(Statement.java:60)
[15:28:54 ERROR]: #!#!     at Skript-2.6.4.jar//ch.njol.skript.ScriptLoader.loadItems(ScriptLoader.java:1114)
[15:28:54 ERROR]: #!#!     at Skript-2.6.4.jar//ch.njol.skript.command.Commands.loadCommand(Commands.java:500)
[15:28:54 ERROR]: #!#!     at Skript-2.6.4.jar//ch.njol.skript.ScriptLoader.loadScript(ScriptLoader.java:708)
[15:28:54 ERROR]: #!#!     at Skript-2.6.4.jar//ch.njol.skript.ScriptLoader.lambda$loadScripts$4(ScriptLoader.java:526)
[15:28:54 ERROR]: #!#!     at Skript-2.6.4.jar//ch.njol.skript.ScriptLoader.lambda$makeFuture$2(ScriptLoader.java:418)
[15:28:54 ERROR]: #!#!     at Skript-2.6.4.jar//ch.njol.skript.ScriptLoader.makeFuture(ScriptLoader.java:434)
[15:28:54 ERROR]: #!#!     at Skript-2.6.4.jar//ch.njol.skript.ScriptLoader.loadScripts(ScriptLoader.java:525)
[15:28:54 ERROR]: #!#!     at Skript-2.6.4.jar//ch.njol.skript.ScriptLoader.loadScripts(ScriptLoader.java:469)
[15:28:54 ERROR]: #!#!     at Skript-2.6.4.jar//ch.njol.skript.Skript$1.run(Skript.java:786)
[15:28:54 ERROR]: #!#!     at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftTask.run(CraftTask.java:101)
[15:28:54 ERROR]: #!#!     at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:480)
[15:28:54 ERROR]: #!#!     at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1112)
[15:28:54 ERROR]: #!#!     at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:318)
[15:28:54 ERROR]: #!#!     at java.base/java.lang.Thread.run(Thread.java:833)
[15:28:54 ERROR]: #!#! Caused by: ch.njol.skript.patterns.MalformedPatternException: caught exception while compiling pattern [pattern: open (anvilgui|anvil gui) %virtualanvilgui% to %player%]
[15:28:54 ERROR]: #!#!     at Skript-2.6.4.jar//ch.njol.skript.patterns.PatternCompiler.compile(PatternCompiler.java:54)
[15:28:54 ERROR]: #!#!     at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1220)
[15:28:54 ERROR]: #!#!     at Skript-2.6.4.jar//ch.njol.skript.lang.SkriptParser.parse_i(SkriptParser.java:1254)
[15:28:54 ERROR]: #!#!     at Skript-2.6.4.jar//ch.njol.skript.lang.SkriptParser.parse(SkriptParser.java:224)
[15:28:54 ERROR]: #!#!     at Skript-2.6.4.jar//ch.njol.skript.lang.SkriptParser.parse(SkriptParser.java:177)
[15:28:54 ERROR]: #!#!     at Skript-2.6.4.jar//ch.njol.skript.lang.Statement.parse(Statement.java:60)
[15:28:54 ERROR]: #!#!     at Skript-2.6.4.jar//ch.njol.skript.ScriptLoader.loadItems(ScriptLoader.java:1114)
[15:28:54 ERROR]: #!#!     at Skript-2.6.4.jar//ch.njol.skript.command.Commands.loadCommand(Commands.java:500)
[15:28:54 ERROR]: #!#!     at Skript-2.6.4.jar//ch.njol.skript.ScriptLoader.loadScript(ScriptLoader.java:708)
[15:28:54 ERROR]: #!#!     at Skript-2.6.4.jar//ch.njol.skript.ScriptLoader.lambda$loadScripts$4(ScriptLoader.java:526)
[15:28:54 ERROR]: #!#!     at Skript-2.6.4.jar//ch.njol.skript.ScriptLoader.lambda$makeFuture$2(ScriptLoader.java:418)
[15:28:54 ERROR]: #!#!     at Skript-2.6.4.jar//ch.njol.skript.ScriptLoader.makeFuture(ScriptLoader.java:434)
[15:28:54 ERROR]: #!#!     at Skript-2.6.4.jar//ch.njol.skript.ScriptLoader.loadScripts(ScriptLoader.java:525)
[15:28:54 ERROR]: #!#!     at Skript-2.6.4.jar//ch.njol.skript.ScriptLoader.loadScripts(ScriptLoader.java:469)
[15:28:54 ERROR]: #!#!     at Skript-2.6.4.jar//ch.njol.skript.Skript$1.run(Skript.java:786)
[15:28:54 ERROR]: #!#!     at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftTask.run(CraftTask.java:101)
[15:28:54 ERROR]: #!#!     at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:480)
[15:28:54 ERROR]: #!#!     at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1112)
[15:28:54 ERROR]: #!#!     at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:318)
[15:28:54 ERROR]: #!#!     at java.base/java.lang.Thread.run(Thread.java:833)
[15:28:54 ERROR]: #!#! Caused by: ch.njol.skript.SkriptAPIException: No class info found for virtualanvilguus
[15:28:54 ERROR]: #!#!     at Skript-2.6.4.jar//ch.njol.skript.registrations.Classes.getClassInfo(Classes.java:264)
[15:28:54 ERROR]: #!#!     at Skript-2.6.4.jar//ch.njol.skript.patterns.TypePatternElement.fromString(TypePatternElement.java:92)
[15:28:54 ERROR]: #!#!     at Skript-2.6.4.jar//ch.njol.skript.patterns.PatternCompiler.compile(PatternCompiler.java:138)
[15:28:54 ERROR]: #!#!     at Skript-2.6.4.jar//ch.njol.skript.patterns.PatternCompiler.compile(PatternCompiler.java:49)
[15:28:54 ERROR]: #!#!     at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1220)
[15:28:54 ERROR]: #!#!     at Skript-2.6.4.jar//ch.njol.skript.lang.SkriptParser.parse_i(SkriptParser.java:1254)
[15:28:54 ERROR]: #!#!     at Skript-2.6.4.jar//ch.njol.skript.lang.SkriptParser.parse(SkriptParser.java:224)
[15:28:54 ERROR]: #!#!     at Skript-2.6.4.jar//ch.njol.skript.lang.SkriptParser.parse(SkriptParser.java:177)
[15:28:54 ERROR]: #!#!     at Skript-2.6.4.jar//ch.njol.skript.lang.Statement.parse(Statement.java:60)
[15:28:54 ERROR]: #!#!     at Skript-2.6.4.jar//ch.njol.skript.ScriptLoader.loadItems(ScriptLoader.java:1114)
[15:28:54 ERROR]: #!#!     at Skript-2.6.4.jar//ch.njol.skript.command.Commands.loadCommand(Commands.java:500)
[15:28:54 ERROR]: #!#!     at Skript-2.6.4.jar//ch.njol.skript.ScriptLoader.loadScript(ScriptLoader.java:708)
[15:28:54 ERROR]: #!#!     at Skript-2.6.4.jar//ch.njol.skript.ScriptLoader.lambda$loadScripts$4(ScriptLoader.java:526)
[15:28:54 ERROR]: #!#!     at Skript-2.6.4.jar//ch.njol.skript.ScriptLoader.lambda$makeFuture$2(ScriptLoader.java:418)
[15:28:54 ERROR]: #!#!     at Skript-2.6.4.jar//ch.njol.skript.ScriptLoader.makeFuture(ScriptLoader.java:434)
[15:28:54 ERROR]: #!#!     at Skript-2.6.4.jar//ch.njol.skript.ScriptLoader.loadScripts(ScriptLoader.java:525)
[15:28:54 ERROR]: #!#!     at Skript-2.6.4.jar//ch.njol.skript.ScriptLoader.loadScripts(ScriptLoader.java:469)
[15:28:54 ERROR]: #!#!     at Skript-2.6.4.jar//ch.njol.skript.Skript$1.run(Skript.java:786)
[15:28:54 ERROR]: #!#!     at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftTask.run(CraftTask.java:101)
[15:28:54 ERROR]: #!#!     at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:480)
[15:28:54 ERROR]: #!#!     at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1112)
[15:28:54 ERROR]: #!#!     at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:318)
[15:28:54 ERROR]: #!#!     at java.base/java.lang.Thread.run(Thread.java:833)
[15:28:54 ERROR]: #!#! 
[15:28:54 ERROR]: #!#! Version Information:
[15:28:54 ERROR]: #!#!   Skript: 2.6.4 (latest)
[15:28:54 ERROR]: #!#!     Flavor: skriptlang-github
[15:28:54 ERROR]: #!#!     Date: 17:14:25.041218900
[15:28:54 ERROR]: #!#!   Bukkit: 1.20.1-R0.1-SNAPSHOT
[15:28:54 ERROR]: #!#!   Minecraft: 1.20.1
[15:28:54 ERROR]: #!#!   Java: 17.0.7 (Java HotSpot(TM) 64-Bit Server VM 17.0.7+8-LTS-224)
[15:28:54 ERROR]: #!#!   OS: Windows 11 amd64 10.0
[15:28:54 ERROR]: #!#! 
[15:28:54 ERROR]: #!#! Server platform: Paper
[15:28:54 ERROR]: #!#! 
[15:28:54 ERROR]: #!#! Current node: open anvil gui {_x} to player (testanvil.sk, line 4)
[15:28:54 ERROR]: #!#! Current item: null
[15:28:54 ERROR]: #!#! 
[15:28:54 ERROR]: #!#! Thread: Server thread
[15:28:54 ERROR]: #!#! 
[15:28:54 ERROR]: #!#! Language: english
[15:28:54 ERROR]: #!#! Link parse mode: DISABLED
[15:28:54 ERROR]: #!#! 
[15:28:54 ERROR]: #!#! End of Error.
[15:28:54 ERROR]: #!#! 

Other

No response

Agreement

  • I have read the guidelines above and affirm I am following them with this report.
@APickledWalrus
Copy link
Member

Caused by it being interpreted as a plural, see

@DereWah
Copy link
Author

DereWah commented Aug 4, 2023

Ohh, yeah I see. Maybe some filtering for certain words? Or also check that the word "i" is alone and not in the end of another word.

@TheLimeGlass TheLimeGlass added the addon-related An issue that is related to an addon and not Skript. label Aug 5, 2023
@TheLimeGlass
Copy link
Collaborator

TheLimeGlass commented Aug 5, 2023

You're most likely not using a .lang file that defines the allowed plurals and genders. You need to tell Skript to allow virtualgui¦s @an the an can also be a or omitted entirely if you don't want a support. See the following for an example;

types:
# Java
object: object¦s @an
number: number¦s @a
integer: integer¦s @an
long: integer¦s @an
short: integer¦s @an
byte: integer¦s @an
double: number¦s @a
float: number¦s @a
boolean: boolean¦ (yes/no)¦s (yes/no) @a
string: text¦s @a
chunk: chunk¦s @a
# Bukkit
entity: entit¦y¦ies @an
livingentity: living entit¦y¦ies @a
projectile: projectile¦s @a
block: block¦s @a
location: location¦s @a
world: world¦s @a
inventory: inventor¦y¦ies @an
player: player¦s @a
offlineplayer: offline player¦s @a
commandsender: player¦¦s¦/console @a
inventoryholder: inventory holder¦s @an
gamemode: gamemode¦s @a
material: material¦s @a
itemstack: item stack¦s @an
itementity: dropped item¦s @a # same as entities.dropped item.name
biome: biome¦s @a
potioneffecttype: potion¦s @a
potioneffect: potion effect¦s @a
enchantment: enchantment¦s @an
damagecause: damage cause¦s @a
teleportcause: teleport cause¦s @a
inventoryaction: inventory action¦s @a
clicktype: click type¦s @a
vector: vector¦s @a
inventorytype: inventory type¦s @an
metadataholder: metadata holder¦s @a
spawnreason: spawn reason¦s @a
cachedservericon: server icon¦s @a
difficulty: difficult¦y¦ies @a
fireworkeffect: firework effect¦s @a
fireworktype: firework type¦s @a
soundcategory: sound categor¦y¦ies @a
blockdata: block data¦s @a
healreason: heal reason¦s @a
cattype: cat type¦s @a
gamerule: gamerule¦s @a
attributetype: attribute type¦s @a
enchantmentoffer: enchantment offer¦s @an
environment: environment¦s @an
moonphase: moonphase¦s @a
resourcepackstate: resource pack state¦s @a
gene: panda gene¦s @a
gamerulevalue: gamerule value¦s @a
quitreason: quit reason¦s @a
# Skript
weathertype: weather type¦s @a
entitytype: entity type¦s @an
entitydata: entity type¦s @an
itemtype: item type¦s @an
time: time¦s @a
timespan: time span¦s @a
timeperiod: time period¦s @a
date: date¦s @a
direction: direction¦s @a
slot: slot¦s @a
color: color¦s @a
structuretype: tree type¦s @a
enchantmenttype: enchantment type¦s @an
experience: experience point¦s @an
experience.pattern: (e?xp|experience( points?)?)
classinfo: type¦s @a
visualeffect: visual effect¦s @a
# Hooks
money: money
region: region¦s

You also set the user allowed input using the user method in a classinfo https://docs.skriptlang.org/javadocs/ch/njol/skript/classes/ClassInfo.html#user(java.lang.String...)

@TheLimeGlass TheLimeGlass added the waiting for reply The report needs a response from the reporter to determine course of action. label Aug 5, 2023
@AyhamAl-Ali
Copy link
Member

Any updates?

@DereWah
Copy link
Author

DereWah commented Oct 6, 2023

Any updates?

Nope. I initally opened this issue because in my addon I was trying to call my TypeInfo "AnvilGui". I ended up just calling it "anvil".

The issue came back when I was trying to update compatibility for 1.20.1, as the type info name "anvil" got taken by Skript I think(?) Or anyways was no longer available.

In the end I just called it "virtualanvil".

Adding a lang file didn't solve btw

@ShaneBeee
Copy link
Contributor

I came across a similar issue when trying to pluralize "objective" -> "objectives" in my addon, getting a similar error:
Caused by: ch.njol.skript.SkriptAPIException: No class info found for objectife

I have a lang file all setup correctly, and still a no go.

@APickledWalrus APickledWalrus added bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. and removed waiting for reply The report needs a response from the reporter to determine course of action. addon-related An issue that is related to an addon and not Skript. labels Feb 22, 2024
@TheLimeGlass
Copy link
Collaborator

TheLimeGlass commented Feb 22, 2024

I came across a similar issue when trying to pluralize "objective" -> "objectives" in my addon, getting a similar error: Caused by: ch.njol.skript.SkriptAPIException: No class info found for objectife

I have a lang file all setup correctly, and still a no go.

Error says objectife with an F. Did you mistype objective? Send code.

@APickledWalrus
Copy link
Member

Skript uses this method to get ClassInfo singular classinfo names when parsing type pattern elements. Frankly, this method is flawed and we should find ways to improve it OR just consider types in patterns plural when s is used at the end (may have its own implications!)

public static NonNullPair<String, Boolean> getEnglishPlural(final String s) {

@APickledWalrus APickledWalrus mentioned this issue Aug 18, 2024
1 task
@APickledWalrus APickledWalrus added the completed The issue has been fully resolved and the change will be in the next Skript update. label Sep 1, 2024
@sovdeeth sovdeeth closed this as completed Sep 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. completed The issue has been fully resolved and the change will be in the next Skript update.
Projects
None yet
Development

No branches or pull requests

6 participants