skRayFall

skRayFall

297k Downloads

Bossbar type conflicts

TheLimeGlass opened this issue ยท 1 comments

commented

Describe the bug

SkRayFall will disable itself because it's registering a type that already exists in Skellett and SkBee.

Since SkRayFall uses a custom object for it's class info at

Classes.registerClass(new ClassInfo<>(RayFallBarColor.class, "bossbarcolor")
.parser(new Parser<RayFallBarColor>() {
@Override
public String getVariableNamePattern() {
return ".+";
}
@Override
@Nullable
public RayFallBarColor parse(String value, ParseContext cont) {
try {
return RayFallBarColor.valueOf(value.replace(" ", "_").trim().toUpperCase());
} catch (IllegalArgumentException exception) {
return null;
}
}
@Override
public String toString(RayFallBarColor eff, int in) {
return eff.name().replace("_", " ").toLowerCase();
}
@Override
public String toVariableNameString(RayFallBarColor eff) {
return eff.name().replace("_", " ").toLowerCase();
}
})
.name("Bossbar Color")
.description("A data type to call the colors for the new 1.9 bossbars.")
.usage("blue, green, pink, purple, red, white or yellow")
);
Classes.registerClass(new ClassInfo<>(RayFallBarFlag.class, "bossbarflag")
.parser(new Parser<RayFallBarFlag>() {
@Override
public String getVariableNamePattern() {
return ".+";
}
@Override
@Nullable
public RayFallBarFlag parse(String value, ParseContext cont) {
try {
return RayFallBarFlag.valueOf(value.replace(" ", "_").trim().toUpperCase());
} catch (IllegalArgumentException exception) {
return null;
}
}
@Override
public String toString(RayFallBarFlag eff, int in) {
return eff.name().replace("_", " ").toLowerCase();
}
@Override
public String toVariableNameString(RayFallBarFlag eff) {
return eff.name().replace("_", " ").toLowerCase();
}
})
.name("Bossbar Flag")
.description("Bar Flags to support the new 1.9 bossbars.")
.usage("create fog, darken sky or play boss music")
);
Classes.registerClass(new ClassInfo<>(RayFallBarStyle.class, "bossbarstyle")
.parser(new Parser<RayFallBarStyle>() {
@Override
public String getVariableNamePattern() {
return ".+";
}
@Override
@Nullable
public RayFallBarStyle parse(String value, ParseContext cont) {
try {
return RayFallBarStyle.valueOf(value.replace(" ", "_").trim().toUpperCase());
} catch (IllegalArgumentException exception) {
return null;
}
}
@Override
public String toString(RayFallBarStyle eff, int in) {
return eff.name().replace("_", " ").toLowerCase();
}
@Override
public String toVariableNameString(RayFallBarStyle eff) {
return eff.name().replace("_", " ").toLowerCase();
}
})
.name("Bossbar Style")
.description("Bossbar styles to support the new 1.9 BossBar.")
.usage("segmented 10, segmented 12, segmented 20, segmented 6 and solid")
);
it would be best to name them something else to BossBar = bossbar, BarColor = bossbarcolor, BarStyle = bossbarstyle and BarFlag = bossbarflag. SkBee and Skellett copy these exact classinfo names for Spigot types so if either addon is installed, whichever loads first will be used, and they both implement the same classinfo. SkRayFall on the other hand doesn't, and has it's own custom object registered under these names, so it errors and disables itself. My suggestion for a fix would be a custom classinfo name like rayfallbarcolor if it's going to be a custom type.

Steps to Reproduce

Install SkBee or Skellett with SkRayFall

Expected Behavior

Handling the fact that there are multiple class infos. You can also add Classes.getExactClassInfo(BarStyle.class) == null condition like Skellett and SkBee

Screenshots / Errors

[Server thread/ERROR]: Error occurred while enabling skRayFall v1.9.27 (Is it up to date?)
java.lang.IllegalArgumentException: Can't register net.rayfall.eyesniper2.skrayfall.bossbar.RayFallBarColor with the code name bossbarcolor because that name is already used by bossbarcolors, bossbarcolours, bossbar colours, bar colours, bossbar colors, bar colors, barcolour
	at ch.njol.skript.registrations.Classes.registerClass(Classes.java:90) ~[Skript.jar:?]
	at net.rayfall.eyesniper2.skrayfall.TypeManager.registerV1_9Elements(TypeManager.java:33) ~[skRayFall+v1.9.27.jar:?]
	at net.rayfall.eyesniper2.skrayfall.TypeManager.registerSyntax(TypeManager.java:25) ~[skRayFall+v1.9.27.jar:?]
	at net.rayfall.eyesniper2.skrayfall.Core.onEnable(Core.java:69) ~[skRayFall+v1.9.27.jar:?]
	at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?]
	at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?]
	at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:536) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?]
	at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugin(CraftServer.java:554) ~[paper-1.19.jar:git-Paper-29]
	at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugins(CraftServer.java:468) ~[paper-1.19.jar:git-Paper-29]
	at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:633) ~[paper-1.19.jar:git-Paper-29]
	at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:419) ~[paper-1.19.jar:git-Paper-29]
	at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:306) ~[paper-1.19.jar:git-Paper-29]
	at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1121) ~[paper-1.19.jar:git-Paper-29]
	at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:302) ~[paper-1.19.jar:git-Paper-29]
	at java.lang.Thread.run(Thread.java:833) ~[?:?]

Server Information

  • Server Version and Type: 1.19 Paper
  • Skript Version: 2.6.2
  • skRayFall Version: 1.9.27
commented

Thanks for the heads up!

I have submitted a fix to bukkit and this will be fixed in skRayFall v1.9.28.