Skip to content

Commit

Permalink
chore(spigot): bump minimum ProtocolLib version to 5.1.0 (#316)
Browse files Browse the repository at this point in the history
  • Loading branch information
diogotcorreia authored Jun 19, 2023
1 parent 56c705e commit e93ead1
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions core/src/main/java/com/rexcantor64/triton/SpigotMLP.java
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ protected void startConfigRefreshTask() {
/**
* Checks if ProtocolLib is enabled and if its version matches
* the expected version.
* Triton requires ProtocolLib 5.0.0 or later.
* Triton requires ProtocolLib 5.1.0 or later.
*
* @return Whether the plugin should continue loading
* @since 3.8.2
Expand All @@ -164,12 +164,17 @@ private boolean isProtocolLibAvailable() {
return false;
}

if (getConfig().isIKnowWhatIAmDoing()) {
return true;
}

val version = protocolLib.getDescription().getVersion();
val versionParts = version.split("\\.");
val majorVersion = Integer.parseInt(versionParts[0]);
if (!getConfig().isIKnowWhatIAmDoing() && majorVersion < 5) {
// Triton requires ProtocolLib 5.0.0 or later
getLogger().logError("ProtocolLib 5.0.0 or later is required! Older versions of ProtocolLib will only partially work, and are therefore not recommended.");
val minorVersion = Integer.parseInt(versionParts[1]);
if (majorVersion < 5 || (majorVersion == 5 && minorVersion < 1)) {
// Triton requires ProtocolLib 5.1.0 or later
getLogger().logError("ProtocolLib 5.1.0 or later is required! Older versions of ProtocolLib will only partially work, and are therefore not recommended.");
getLogger().logError("If you want to enable the plugin anyway, add `i-know-what-i-am-doing: true` to Triton's config.yml.");
return false;
}
Expand Down

0 comments on commit e93ead1

Please sign in to comment.