From 8bbb167e0c4cfb70565bda2febc6d0c5194afebf Mon Sep 17 00:00:00 2001 From: Piotr Zych <77621271+P1otrulla@users.noreply.github.com> Date: Tue, 19 Nov 2024 18:18:18 +0100 Subject: [PATCH 1/3] GH-13 Release 1.0.1 * 1.0.1 release --- newbieprotection-api/build.gradle.kts | 4 ++-- newbieprotection-core/build.gradle.kts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/newbieprotection-api/build.gradle.kts b/newbieprotection-api/build.gradle.kts index 7776e21..50c460e 100644 --- a/newbieprotection-api/build.gradle.kts +++ b/newbieprotection-api/build.gradle.kts @@ -4,7 +4,7 @@ plugins { } group = "dev.piotrulla.newbieprotection" -version = "1.0.0" +version = "1.0.1" repositories { mavenCentral() @@ -46,7 +46,7 @@ publishing { credentials { username = "admin" - password = "5k3Ss9txOjs3MH8ElyDOLYjgxNc3SxVzxDS+FzZL5YZ0Gpw1f3DZJm2vzPm7r2Dj" + password = "skibidibi_sigma" } } } diff --git a/newbieprotection-core/build.gradle.kts b/newbieprotection-core/build.gradle.kts index 8d91da6..4b5019c 100644 --- a/newbieprotection-core/build.gradle.kts +++ b/newbieprotection-core/build.gradle.kts @@ -8,7 +8,7 @@ plugins { } group = "dev.piotrulla.newbieprotection" -version = "1.0.0" +version = "1.0.1" repositories { mavenCentral() From 9011b4e97ac4352bcdf7289122aa584ddd39b5f0 Mon Sep 17 00:00:00 2001 From: Piotr Zych <77621271+P1otrulla@users.noreply.github.com> Date: Tue, 19 Nov 2024 20:37:43 +0100 Subject: [PATCH 2/3] GH-14 Implement packetevents (#14) * Implement packetevents --- newbieprotection-core/build.gradle.kts | 6 ++++-- .../newbieprotection/NewbieProtectionPlugin.java | 14 +++++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/newbieprotection-core/build.gradle.kts b/newbieprotection-core/build.gradle.kts index 4b5019c..8e59a84 100644 --- a/newbieprotection-core/build.gradle.kts +++ b/newbieprotection-core/build.gradle.kts @@ -54,7 +54,8 @@ dependencies { implementation("net.megavex:scoreboard-library-api:$scoreboardLibraryVersion") runtimeOnly("net.megavex:scoreboard-library-implementation:$scoreboardLibraryVersion") runtimeOnly("net.megavex:scoreboard-library-packetevents:$scoreboardLibraryVersion") - compileOnly("com.github.retrooper:packetevents-spigot:2.5.0") + + implementation("com.github.retrooper:packetevents-spigot:2.5.0") // bStats system implementation("org.bstats:bstats-bukkit:3.0.2") @@ -86,7 +87,6 @@ bukkit { name = "ptrlNewbieProtection" author = "Piotrulla" apiVersion = "1.13" - softDepend = listOf("PacketEvents") } tasks { @@ -109,6 +109,8 @@ tasks.withType { val prefix = "dev.piotrulla.newbieprotection.shared" listOf( + "com.github.retrooper", + "io.github.retrooper", "com.eternalcode", "dev.rollczi", "eu.okaeri", diff --git a/newbieprotection-core/src/main/java/dev/piotrulla/newbieprotection/NewbieProtectionPlugin.java b/newbieprotection-core/src/main/java/dev/piotrulla/newbieprotection/NewbieProtectionPlugin.java index b13b123..a5ac628 100644 --- a/newbieprotection-core/src/main/java/dev/piotrulla/newbieprotection/NewbieProtectionPlugin.java +++ b/newbieprotection-core/src/main/java/dev/piotrulla/newbieprotection/NewbieProtectionPlugin.java @@ -4,6 +4,7 @@ import com.eternalcode.commons.adventure.AdventureLegacyColorPreProcessor; import com.eternalcode.commons.adventure.AdventureUrlPostProcessor; import com.eternalcode.multification.shared.Formatter; +import com.github.retrooper.packetevents.PacketEvents; import dev.piotrulla.newbieprotection.configuration.ConfigService; import dev.piotrulla.newbieprotection.configuration.implementation.CommandConfiguration; import dev.piotrulla.newbieprotection.configuration.implementation.MessagesConfiguration; @@ -18,6 +19,7 @@ import dev.rollczi.litecommands.bukkit.LiteBukkitFactory; import dev.rollczi.litecommands.meta.Meta; import dev.rollczi.litecommands.schematic.Schematic; +import io.github.retrooper.packetevents.factory.spigot.SpigotPacketEventsBuilder; import net.kyori.adventure.platform.AudienceProvider; import net.kyori.adventure.platform.bukkit.BukkitAudiences; import net.kyori.adventure.text.minimessage.MiniMessage; @@ -42,6 +44,15 @@ public class NewbieProtectionPlugin extends JavaPlugin { private LiteCommands liteCommands; + @Override + public void onLoad() { + PacketEvents.setAPI(SpigotPacketEventsBuilder.build(this)); + PacketEvents.getAPI().getSettings().reEncodeByDefault(false) + .checkForUpdates(false) + .bStats(false); + PacketEvents.getAPI().load(); + } + @Override public void onEnable() { ConfigService configService = new ConfigService(); @@ -68,7 +79,7 @@ public void onEnable() { if (configuration.nameTag.enabled) { try { this.scoreboardLibrary = ScoreboardLibrary.loadScoreboardLibrary(this); - System.out.println("Scoreboard library loaded"); + this.getLogger().info("Scoreboard library loaded"); } catch (NoPacketAdapterAvailableException ignored) { this.scoreboardLibrary = new NoopScoreboardLibrary(); @@ -161,6 +172,7 @@ public void onEnable() { @Override public void onDisable() { + PacketEvents.getAPI().terminate(); this.scoreboardLibrary.close(); this.audienceProvider.close(); this.liteCommands.unregister(); From 04ac9f173187a2d0d25a55f3f28e0aa4b87793d8 Mon Sep 17 00:00:00 2001 From: Piotr Zych <77621271+P1otrulla@users.noreply.github.com> Date: Tue, 19 Nov 2024 21:19:25 +0100 Subject: [PATCH 3/3] GH-15 Update gitignore * Update .gitignore --- .gitignore | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 5911774..33b55c3 100644 --- a/.gitignore +++ b/.gitignore @@ -6,10 +6,7 @@ run/ !**/src/test/**/build/ ### IntelliJ IDEA ### -.idea/modules.xml -.idea/jarRepositories.xml -.idea/compiler.xml -.idea/libraries/ +.idea/ *.iws *.iml *.ipr