Skip to content

Commit 554d6c3

Browse files
committed
2.8.0 - Bump required Java verison from 8 -> 17, warn 1.20.5/1.20.6 users about incompatible ProtocolLib versions, also disable prefer-protocollib by default in favor of Paper handler
1 parent 133cef0 commit 554d6c3

File tree

6 files changed

+37
-16
lines changed

6 files changed

+37
-16
lines changed

build.gradle

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ plugins {
2626
// --
2727
// Variables
2828
// --
29-
version = '2.7.0'
29+
version = '2.8.0'
3030
group = 'net.tcpshield.tcpshield'
3131
archivesBaseName = 'TCPShield'
3232

@@ -60,8 +60,8 @@ sourceSets {
6060
}
6161

6262
compileJava {
63-
sourceCompatibility = "8"
64-
targetCompatibility = "8"
63+
sourceCompatibility = 17
64+
targetCompatibility = 17
6565
options.encoding = 'UTF-8'
6666
}
6767

@@ -82,10 +82,7 @@ repositories {
8282
url = 'https://oss.sonatype.org/content/repositories/snapshots'
8383
}
8484
maven {
85-
url = 'https://papermc.io/repo/repository/maven-public/'
86-
}
87-
maven {
88-
url = 'https://repo.velocitypowered.com/snapshots/'
85+
url = 'https://repo.papermc.io/repository/maven-public/'
8986
}
9087
maven {
9188
url = "https://repo.opencollab.dev/maven-snapshots/"
@@ -94,17 +91,16 @@ repositories {
9491

9592
dependencies {
9693
// Bukkit
97-
compileOnly group: 'org.spigotmc', name: 'spigot-api', version: '1.11-R0.1-SNAPSHOT'
9894
compileOnly group: 'com.comphenix.protocol', name: 'ProtocolLib', version: '5.1.0'
9995

100-
// Paper
101-
compileOnly group: 'com.destroystokyo.paper', name: 'paper-api', version: '1.15.2-R0.1-SNAPSHOT'
96+
// Paper - 1.19.4 so we can bump from JDK 8 -> JDK 17, using 1.20.x as a dependency would require bumping from JDK 8 -> JDK 21
97+
compileOnly group: 'io.papermc.paper', name: 'paper-api', version: '1.19.4-R0.1-SNAPSHOT'
10298

10399
// BungeeCord
104100
compileOnly group: 'net.md-5', name: 'bungeecord-api', version: '1.14-SNAPSHOT'
105101

106102
// Velocity
107-
compileOnly group: 'com.velocitypowered', name: 'velocity-api', version: '1.0.0-SNAPSHOT'
103+
compileOnly group: 'com.velocitypowered', name: 'velocity-api', version: '3.3.0-SNAPSHOT'
108104

109105
// Testing
110106
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.7.0-M1'

src/main/java/net/tcpshield/tcpshield/bukkit/TCPShieldBukkit.java

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package net.tcpshield.tcpshield.bukkit;
22

3+
import java.util.logging.Logger;
34
import net.tcpshield.tcpshield.TCPShieldPacketHandler;
45
import net.tcpshield.tcpshield.TCPShieldPlugin;
56
import net.tcpshield.tcpshield.bukkit.paper.BukkitPaper;
@@ -9,6 +10,7 @@
910
import net.tcpshield.tcpshield.provider.ConfigProvider;
1011
import net.tcpshield.tcpshield.util.Debugger;
1112
import net.tcpshield.tcpshield.util.exception.phase.InitializationException;
13+
import org.bukkit.Bukkit;
1214
import org.bukkit.plugin.java.JavaPlugin;
1315

1416
/**
@@ -31,7 +33,25 @@ public void onEnable() {
3133

3234
// check force plib option -> paper -> plib -> error
3335
if (this.configProvider.preferProtocolLib() && getServer().getPluginManager().getPlugin("ProtocolLib") != null) {
34-
bukkitImpl = new BukkitProtocolLib(this);
36+
try {
37+
String[] protocolLibVersion = getServer().getPluginManager().getPlugin("ProtocolLib").getDescription().getVersion().split("-")[0].split("\\.");
38+
int major = Integer.parseInt(protocolLibVersion[0]);
39+
int minor = Integer.parseInt(protocolLibVersion[1]);
40+
int patch = Integer.parseInt(protocolLibVersion[2]);
41+
42+
String paperVersion = Bukkit.getServer().getMinecraftVersion();
43+
if (major <= 5 && minor <= 2 && patch <= 1 && (paperVersion.equals("1.20.5") || paperVersion.equals("1.20.6"))) {
44+
getLogger().severe("TCPShield is incompatible with ProtocolLib <= 5.2.1 on Paper 1.20.5/1.20.6 due to lack of support from ProtocolLib. Reverting to default Paper handler to prevent issues. This error can be avoided by disabling 'prefer-protocollib' in the config.");
45+
bukkitImpl = new BukkitPaper(this);
46+
} else {
47+
bukkitImpl = new BukkitProtocolLib(this);
48+
}
49+
} catch (Exception t) {
50+
getLogger().warning("Failed to check Paper or ProtocolLib version. This is not a critical error unless you are running Paper 1.20.5/1.20.6 with ProtocolLib version 5.2.1 or below.");
51+
getDebugger().exception(t);
52+
53+
bukkitImpl = new BukkitProtocolLib(this);
54+
}
3555
} else if (BukkitImplProvider.hasPaperEvent()) {
3656
bukkitImpl = new BukkitPaper(this);
3757
} else if (getServer().getPluginManager().getPlugin("ProtocolLib") != null) {
@@ -72,4 +92,9 @@ public ConfigProvider getConfigProvider() {
7292
return configProvider;
7393
}
7494

95+
@Override
96+
public Logger getLogger() {
97+
return super.getLogger();
98+
}
99+
75100
}

src/main/resources/bungee.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: TCPShield
2-
version: 2.7.0
2+
version: 2.8.0
33
main: net.tcpshield.tcpshield.bungee.TCPShieldBungee
44
author: https://tcpshield.com
55
softdepends:

src/main/resources/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ debug-mode: false
1111
enable-geyser-support: false
1212

1313
# Spigot/Paper option only, does not affect bungeecord
14-
prefer-protocollib: true
14+
prefer-protocollib: false

src/main/resources/plugin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: TCPShield
2-
version: 2.7.0
2+
version: 2.8.0
33
main: net.tcpshield.tcpshield.bukkit.TCPShieldBukkit
44
softdepend:
55
- ProtocolLib

src/main/resources/velocity-plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "tcpshield",
33
"name": "TCPShield",
4-
"version": "2.7.0",
4+
"version": "2.8.0",
55
"description": "TCPShield IP parsing capabilities for Velocity",
66
"authors": [
77
"TCPShield"

0 commit comments

Comments
 (0)