Skip to content

Detect unknown bukkit versions with the dataversion#53

Open
Joo200 wants to merge 1 commit intolmk02:masterfrom
Joo200:feature/bukkitforks
Open

Detect unknown bukkit versions with the dataversion#53
Joo200 wants to merge 1 commit intolmk02:masterfrom
Joo200:feature/bukkitforks

Conversation

@Joo200
Copy link

@Joo200 Joo200 commented Jan 21, 2022

I removed the duplicated MinecraftVersion class and added some code to detect the used Minecraft version based on the DataVersion of the server.

The DataVersion is accesible through Bukkit.getUnsafe().getDataVersion() since 1.13.x.
https://minecraft.fandom.com/wiki/Data_version#List_of_data_versions

Depending on your used server the version string might be malformed. The DataVersion should work but is not accessible in Bukkit =< 1.12

Copy link
Contributor

@syldium syldium left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Less duplication is a must 👍

return new Version(1, Integer.parseInt(split[1]),
split.length > 2 ? Integer.parseInt(split[2]) : 0, pack.substring(pack.lastIndexOf('.') + 1));
}
return v1_12;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason that 1.12 is the default version?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Short answer: No. Currently the plugin crashes with an exception when no valid version is found. This is not a good thing and there might be a better way to handle this.

Comment on lines +19 to +21
//public static final Version v1_18_1 = new Version(1, 18, 1, "v1_18_R1", 2865);
//public static final Version v1_18 = new Version(1, 18, "v1_18_R1", 2860);
//public static final Version v1_17_1 = new Version(1, 17, 1, "v1_17_R1", 2730);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be added.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I'm not too familiar with that Version stuff in BlockParty, I just had some problems getting it to work with my custom paper fork.

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 this pull request may close these issues.

2 participants