From adc96bda27386bfb89e235cda4270b6ff8a1406c Mon Sep 17 00:00:00 2001 From: Ethan Date: Thu, 8 Feb 2024 18:34:31 -0500 Subject: [PATCH 01/12] cozy campfires --- .../modules/bitsandbobs/BitsAndBobs.java | 6 +++ .../minimodules/CozyCampfires.java | 46 +++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 modules/src/main/java/parallelmc/parallelutils/modules/bitsandbobs/minimodules/CozyCampfires.java diff --git a/modules/src/main/java/parallelmc/parallelutils/modules/bitsandbobs/BitsAndBobs.java b/modules/src/main/java/parallelmc/parallelutils/modules/bitsandbobs/BitsAndBobs.java index 90029bbb..9c8d9242 100644 --- a/modules/src/main/java/parallelmc/parallelutils/modules/bitsandbobs/BitsAndBobs.java +++ b/modules/src/main/java/parallelmc/parallelutils/modules/bitsandbobs/BitsAndBobs.java @@ -22,6 +22,8 @@ public class BitsAndBobs extends ParallelModule { private TogglePvpManager pvpManager; + private CozyCampfires cozyCampfires; + public BitsAndBobs(ParallelClassLoader classLoader, List dependents) { super(classLoader, dependents); } @@ -70,6 +72,10 @@ public void onEnable() { if (config.getBoolean("prevent-spawner-mining", false)) { manager.registerEvents(new PreventSpawnerMining(), plugin); } + + cozyCampfires = new CozyCampfires(); + plugin.getServer().getScheduler().runTaskTimer(plugin, () -> cozyCampfires.checkForCampfires(), 0, 80); + } @Override diff --git a/modules/src/main/java/parallelmc/parallelutils/modules/bitsandbobs/minimodules/CozyCampfires.java b/modules/src/main/java/parallelmc/parallelutils/modules/bitsandbobs/minimodules/CozyCampfires.java new file mode 100644 index 00000000..00543277 --- /dev/null +++ b/modules/src/main/java/parallelmc/parallelutils/modules/bitsandbobs/minimodules/CozyCampfires.java @@ -0,0 +1,46 @@ +package parallelmc.parallelutils.modules.bitsandbobs.minimodules; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.World; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +public class CozyCampfires { + + private static final int RADIUS = 3; + private static final PotionEffect ABSORPTION = new PotionEffect(PotionEffectType.ABSORPTION, 14400, 1, true, false); + + public void checkForCampfires() { + for (Player p : Bukkit.getServer().getOnlinePlayers()) { + if (isCampfireNearby(p.getLocation())) { + p.addPotionEffect(ABSORPTION); + } + } + } + + private boolean isCampfireNearby(Location location) { + World world = location.getWorld(); + for (int x = -RADIUS; x <= RADIUS; x++) { + for (int y = -RADIUS; y <= RADIUS; y++) { + for (int z = -RADIUS; z <= RADIUS; z++) { + Block block = world.getBlockAt(add(location, x, y ,z)); + if (block.getType() == Material.CAMPFIRE || block.getType() == Material.SOUL_CAMPFIRE) { + return true; + } + } + } + } + return false; + } + + // spigot add no make copy + // this function make copy + // :) + private Location add(Location old, double x, double y, double z) { + return old.clone().add(x, y ,z); + } +} From 2254703742a9c5dff3a270ae2fb7c3a150b56b83 Mon Sep 17 00:00:00 2001 From: Ethan Date: Sat, 10 Feb 2024 17:50:18 -0500 Subject: [PATCH 02/12] add config option for cozy campfires --- .../parallelutils/modules/bitsandbobs/BitsAndBobs.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/src/main/java/parallelmc/parallelutils/modules/bitsandbobs/BitsAndBobs.java b/modules/src/main/java/parallelmc/parallelutils/modules/bitsandbobs/BitsAndBobs.java index 9c8d9242..809a34c2 100644 --- a/modules/src/main/java/parallelmc/parallelutils/modules/bitsandbobs/BitsAndBobs.java +++ b/modules/src/main/java/parallelmc/parallelutils/modules/bitsandbobs/BitsAndBobs.java @@ -74,7 +74,9 @@ public void onEnable() { } cozyCampfires = new CozyCampfires(); - plugin.getServer().getScheduler().runTaskTimer(plugin, () -> cozyCampfires.checkForCampfires(), 0, 80); + if (config.getBoolean("enable-cozy-campfires", false)) { + plugin.getServer().getScheduler().runTaskTimer(plugin, () -> cozyCampfires.checkForCampfires(), 0, 80); + } } From 6517223f9d6f0a5529a9d6a27eba1550d66b5445 Mon Sep 17 00:00:00 2001 From: Diamondback88 <23108617+Diamondback88@users.noreply.github.com> Date: Wed, 23 Apr 2025 16:16:12 -0400 Subject: [PATCH 03/12] Initial 1.21.5 update code, update PaperVanillaGoal to PaperGoal --- api/build.gradle | 8 ++++---- api/src/main/java/parallelmc/parallelutils/Constants.java | 2 +- build.gradle | 6 +++--- gradle/wrapper/gradle-wrapper.properties | 2 +- modules/build.gradle | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/api/build.gradle b/api/build.gradle index 43e26219..58e1507b 100644 --- a/api/build.gradle +++ b/api/build.gradle @@ -8,7 +8,7 @@ plugins { group = 'org.parallelmc' -version = '4.6.0' +version = '4.7.0' description = 'A set of utilities and features for use on the Parallel Minecraft server' java { @@ -28,14 +28,14 @@ repositories { dependencies { //compileOnly 'io.papermc.paper:paper-api:1.20.6-R0.1-SNAPSHOT' - paperweightDevelopmentBundle("io.papermc.paper:dev-bundle:1.21.3-R0.1-SNAPSHOT") + paperweightDevelopmentBundle("io.papermc.paper:dev-bundle:1.21.5-R0.1-SNAPSHOT") implementation 'org.jetbrains:annotations:24.0.1' testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.9.2' implementation 'net.dv8tion:JDA:5.0.0-beta.24' compileOnly 'me.clip:placeholderapi:2.11.6' compileOnly fileTree('libs') { include '*.jar' } - compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.12' + compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.13' implementation 'com.mysql:mysql-connector-j:8.3.0' compileOnly 'com.comphenix.protocol:ProtocolLib:5.3.0' compileOnly 'dev.esophose:playerparticles:8.7' @@ -77,7 +77,7 @@ bukkit { main = 'parallelmc.parallelutils.ParallelUtils' - apiVersion = '1.20.5' + apiVersion = '1.21.5' depend = ['PlaceholderAPI', 'ProtocolLib'] softDepend = ['Multiverse-Core', 'FractalForest', 'WorldGuard', 'VoteParty', 'PlayerParticles', 'ProNouns'] diff --git a/api/src/main/java/parallelmc/parallelutils/Constants.java b/api/src/main/java/parallelmc/parallelutils/Constants.java index 045b473c..1c852886 100644 --- a/api/src/main/java/parallelmc/parallelutils/Constants.java +++ b/api/src/main/java/parallelmc/parallelutils/Constants.java @@ -5,7 +5,7 @@ public class Constants { - public static final Version VERSION = new Version(4, 6, 0); + public static final Version VERSION = new Version(4, 7, 0); public static final String PLUGIN_NAME = "ParallelUtils"; public static final Component PLUGIN_PREFIX = MiniMessage.miniMessage() .deserialize("[P] "); diff --git a/build.gradle b/build.gradle index 138e0598..34abc4a7 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,7 @@ import io.papermc.paperweight.userdev.ReobfArtifactConfiguration plugins { id 'java' id 'io.github.goooler.shadow' version '8.1.7' - id "io.papermc.paperweight.userdev" version "1.7.4" + id "io.papermc.paperweight.userdev" version "2.0.0-beta.16" id "xyz.jpenilla.run-paper" version "2.3.1" id 'net.minecrell.plugin-yml.bukkit' version '0.6.0' } @@ -15,7 +15,7 @@ java { paperweight.reobfArtifactConfiguration = ReobfArtifactConfiguration.getMOJANG_PRODUCTION() dependencies { - paperweightDevelopmentBundle("io.papermc.paper:dev-bundle:1.21.3-R0.1-SNAPSHOT") + paperweightDevelopmentBundle("io.papermc.paper:dev-bundle:1.21.5-R0.1-SNAPSHOT") } compileJava.options.encoding = "UTF-8" @@ -42,7 +42,7 @@ allprojects { } dependencies { - paperweightDevelopmentBundle("io.papermc.paper:dev-bundle:1.21.3-R0.1-SNAPSHOT") + paperweightDevelopmentBundle("io.papermc.paper:dev-bundle:1.21.5-R0.1-SNAPSHOT") //paperweight.paperDevBundle("1.20.6-R0.1-SNAPSHOT") //compileOnly "io.papermc.paper:paper-api:1.20.6-R0.1-SNAPSHOT" diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 48c0a02c..2733ed5d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/modules/build.gradle b/modules/build.gradle index 5ba7d3d2..f73516c8 100644 --- a/modules/build.gradle +++ b/modules/build.gradle @@ -25,11 +25,11 @@ dependencies { compileOnly 'net.dv8tion:JDA:5.0.0-beta.24' compileOnly 'me.clip:placeholderapi:2.11.6' compileOnly fileTree('libs') { include '*.jar' } - compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.12' + compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.13' compileOnly 'com.mysql:mysql-connector-j:8.3.0' compileOnly 'com.comphenix.protocol:ProtocolLib:5.3.0' compileOnly 'dev.esophose:playerparticles:8.7' - compileOnly "io.papermc.paper:paper-api:1.21.3-R0.1-SNAPSHOT" + compileOnly "io.papermc.paper:paper-api:1.21.5-R0.1-SNAPSHOT" } def names = [] From 4e09037a662f04994a86aefa8db50158ecfd7927 Mon Sep 17 00:00:00 2001 From: Diamondback88 <23108617+Diamondback88@users.noreply.github.com> Date: Wed, 23 Apr 2025 16:22:09 -0400 Subject: [PATCH 04/12] Fix updated abstract implementation for ContainerSynchronizer --- .../listeners/PlayerJoinContainerListenerOverwrite.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/src/main/java/parallelmc/parallelutils/modules/charms/listeners/PlayerJoinContainerListenerOverwrite.java b/modules/src/main/java/parallelmc/parallelutils/modules/charms/listeners/PlayerJoinContainerListenerOverwrite.java index f3de7410..0ce91ce0 100644 --- a/modules/src/main/java/parallelmc/parallelutils/modules/charms/listeners/PlayerJoinContainerListenerOverwrite.java +++ b/modules/src/main/java/parallelmc/parallelutils/modules/charms/listeners/PlayerJoinContainerListenerOverwrite.java @@ -16,6 +16,7 @@ import parallelmc.parallelutils.modules.charms.events.PlayerSlotChangedEvent; import java.lang.reflect.Field; +import java.util.List; public class PlayerJoinContainerListenerOverwrite implements Listener { @@ -55,7 +56,7 @@ public void onJoin(PlayerJoinEvent event) { if (oldSynchronizer != null) { containerSynchronizer.set(serverPlayer, new ContainerSynchronizer() { @Override - public void sendInitialData(@NotNull AbstractContainerMenu handler, @NotNull NonNullList stacks, @NotNull ItemStack cursorStack, @NotNull int[] properties) { + public void sendInitialData(@NotNull AbstractContainerMenu handler, @NotNull List stacks, @NotNull ItemStack cursorStack, @NotNull int[] properties) { handler.lastSlots = NonNullListRemember.of(handler.lastSlots); oldSynchronizer.sendInitialData(handler, stacks, cursorStack, properties); } @@ -74,6 +75,11 @@ public void sendCarriedChange(@NotNull AbstractContainerMenu handler, @NotNull I public void sendDataChange(@NotNull AbstractContainerMenu handler, int property, int value) { oldSynchronizer.sendDataChange(handler, property, value); } + + @Override + public RemoteSlot createSlot() { + return null; + } }); } From dd60eb4abc9f804fdde6f45a1ce54bfb9b4d0031 Mon Sep 17 00:00:00 2001 From: Diamondback88 <23108617+Diamondback88@users.noreply.github.com> Date: Tue, 27 May 2025 18:49:31 -0400 Subject: [PATCH 05/12] Add Pale Garden biome tweaks --- .../modules/biometweaks/BiomeTweaks.java | 63 +++++++++++++++++++ .../biometweaks/biomes/PaleGarden.java | 43 +++++++++++++ 2 files changed, 106 insertions(+) create mode 100644 modules/src/main/java/parallelmc/parallelutils/modules/biometweaks/BiomeTweaks.java create mode 100644 modules/src/main/java/parallelmc/parallelutils/modules/biometweaks/biomes/PaleGarden.java diff --git a/modules/src/main/java/parallelmc/parallelutils/modules/biometweaks/BiomeTweaks.java b/modules/src/main/java/parallelmc/parallelutils/modules/biometweaks/BiomeTweaks.java new file mode 100644 index 00000000..5ecac5f5 --- /dev/null +++ b/modules/src/main/java/parallelmc/parallelutils/modules/biometweaks/BiomeTweaks.java @@ -0,0 +1,63 @@ +package parallelmc.parallelutils.modules.biometweaks; + +import org.bukkit.Bukkit; +import org.bukkit.plugin.Plugin; +import org.bukkit.plugin.PluginManager; +import org.jetbrains.annotations.NotNull; +import parallelmc.parallelutils.Constants; +import parallelmc.parallelutils.ParallelClassLoader; +import parallelmc.parallelutils.ParallelModule; +import parallelmc.parallelutils.ParallelUtils; +import parallelmc.parallelutils.modules.biometweaks.biomes.PaleGarden; + +import java.util.List; +import java.util.logging.Level; + +public class BiomeTweaks extends ParallelModule { + + public BiomeTweaks(ParallelClassLoader classLoader, List dependents) { + super(classLoader, dependents); + } + + @Override + public void onLoad() { + + } + + @Override + public void onEnable() { + PluginManager manager = Bukkit.getPluginManager(); + Plugin plugin = manager.getPlugin(Constants.PLUGIN_NAME); + + if (plugin == null) { + ParallelUtils.log(Level.SEVERE, "Unable to enable BiomeTweaks. Plugin " + Constants.PLUGIN_NAME + " does not exist!"); + return; + } + + ParallelUtils puPlugin = (ParallelUtils) plugin; + + if (!puPlugin.registerModule(this)) { + ParallelUtils.log(Level.SEVERE, "Unable to register module BiomeTweaks! Module may already be registered. Quitting..."); + return; + } + + // Initialize individual biomes + PaleGarden paleGarden = new PaleGarden(); + } + + @Override + public void onDisable() { + + } + + @Override + public void onUnload() { + + } + + @Override + public @NotNull String getName() { + return "BiomeTweaks"; + } + +} diff --git a/modules/src/main/java/parallelmc/parallelutils/modules/biometweaks/biomes/PaleGarden.java b/modules/src/main/java/parallelmc/parallelutils/modules/biometweaks/biomes/PaleGarden.java new file mode 100644 index 00000000..5b11e13a --- /dev/null +++ b/modules/src/main/java/parallelmc/parallelutils/modules/biometweaks/biomes/PaleGarden.java @@ -0,0 +1,43 @@ +package parallelmc.parallelutils.modules.biometweaks.biomes; + +import org.bukkit.*; +import org.bukkit.block.Biome; +import org.bukkit.entity.Player; +import org.bukkit.plugin.Plugin; +import parallelmc.parallelutils.util.BukkitTools; +import parallelmc.parallelutils.util.RandomTools; + + +public class PaleGarden { + + public PaleGarden() { + Plugin plugin = BukkitTools.getPlugin(); + if (plugin == null) return; + + plugin.getServer().getScheduler().runTaskTimer(plugin, this::gardenEffects, 0L, 20L); + } + + public void gardenEffects() { + for (Player player : Bukkit.getOnlinePlayers()) { + Location location = player.getLocation(); + // Check that player is in pale garden and at y=60 at minimum + if (location.getBlock().getBiome() == Biome.PALE_GARDEN && location.getY() >= 60) { + // Sound effects + player.playSound(location, Sound.BLOCK_CONDUIT_AMBIENT, SoundCategory.PLAYERS, 1, 1); + // 1/20 chance of ambient cave sound + if (RandomTools.betweenTwoNumbers(1, 20) == 1) { + player.playSound(location, Sound.AMBIENT_CAVE, SoundCategory.AMBIENT, 1, 1); + } + // 1/100 chance of thunder sound + if (RandomTools.betweenTwoNumbers(1, 100) == 1) { + player.playSound(location, Sound.ENTITY_LIGHTNING_BOLT_THUNDER, SoundCategory.WEATHER, 1, 1); + } + + // Particle effects + player.spawnParticle(Particle.FALLING_WATER, location.getX(), location.getY() + 20, location.getZ(), + 200, 10, 10, 10, 4); + } + } + } + +} From 40dfef9f50da100b7797f38273224aca32cdd18f Mon Sep 17 00:00:00 2001 From: Diamondback88 <23108617+Diamondback88@users.noreply.github.com> Date: Wed, 28 May 2025 02:10:26 -0400 Subject: [PATCH 06/12] Update paperweight and gradle --- build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 34abc4a7..ac59864e 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,7 @@ import io.papermc.paperweight.userdev.ReobfArtifactConfiguration plugins { id 'java' id 'io.github.goooler.shadow' version '8.1.7' - id "io.papermc.paperweight.userdev" version "2.0.0-beta.16" + id "io.papermc.paperweight.userdev" version "2.0.0-beta.17" id "xyz.jpenilla.run-paper" version "2.3.1" id 'net.minecrell.plugin-yml.bukkit' version '0.6.0' } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2733ed5d..5c82cb03 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From a0c66bc00b600a05da99d669218dbc9291d6d46a Mon Sep 17 00:00:00 2001 From: Diamondback88 <23108617+Diamondback88@users.noreply.github.com> Date: Thu, 5 Jun 2025 21:09:41 -0400 Subject: [PATCH 07/12] Quick charms fix --- .../charms/listeners/PlayerJoinContainerListenerOverwrite.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/src/main/java/parallelmc/parallelutils/modules/charms/listeners/PlayerJoinContainerListenerOverwrite.java b/modules/src/main/java/parallelmc/parallelutils/modules/charms/listeners/PlayerJoinContainerListenerOverwrite.java index 0ce91ce0..5742a787 100644 --- a/modules/src/main/java/parallelmc/parallelutils/modules/charms/listeners/PlayerJoinContainerListenerOverwrite.java +++ b/modules/src/main/java/parallelmc/parallelutils/modules/charms/listeners/PlayerJoinContainerListenerOverwrite.java @@ -78,7 +78,7 @@ public void sendDataChange(@NotNull AbstractContainerMenu handler, int property, @Override public RemoteSlot createSlot() { - return null; + return oldSynchronizer.createSlot(); } }); } From 9696c87e9d8a493c2c408f238905cfaac063aee0 Mon Sep 17 00:00:00 2001 From: Diamondback88 <23108617+Diamondback88@users.noreply.github.com> Date: Fri, 6 Jun 2025 01:55:59 -0400 Subject: [PATCH 08/12] Bits & Bobs + Ziprails updates --- api/src/main/resources/config.yml | 2 ++ .../modules/bitsandbobs/BitsAndBobs.java | 18 +++++++++--------- .../bitsandbobs/minimodules/Ziprails.java | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/api/src/main/resources/config.yml b/api/src/main/resources/config.yml index 6a853a2a..e436d6dc 100644 --- a/api/src/main/resources/config.yml +++ b/api/src/main/resources/config.yml @@ -78,4 +78,6 @@ announcements: disable-ender-chests: false prevent-spawner-mining: false enable-calling-bell: true +enable-cozy-campfires: true enable-sweethearts: true +enable-ziprails: true diff --git a/modules/src/main/java/parallelmc/parallelutils/modules/bitsandbobs/BitsAndBobs.java b/modules/src/main/java/parallelmc/parallelutils/modules/bitsandbobs/BitsAndBobs.java index 2176483b..6b63030a 100644 --- a/modules/src/main/java/parallelmc/parallelutils/modules/bitsandbobs/BitsAndBobs.java +++ b/modules/src/main/java/parallelmc/parallelutils/modules/bitsandbobs/BitsAndBobs.java @@ -80,22 +80,22 @@ public void onEnable() { manager.registerEvents(new PreventSpawnerMining(), plugin); } - cozyCampfires = new CozyCampfires(); - if (config.getBoolean("enable-cozy-campfires", false)) { - plugin.getServer().getScheduler().runTaskTimer(plugin, () -> cozyCampfires.checkForCampfires(), 0, 80); - } - - if (config.getBoolean("enable-ziprails", true)) { - manager.registerEvents(new Ziprails(), plugin); - } - if (config.getBoolean("enable-calling-bell", true)) { manager.registerEvents(new CallingBell(), plugin); } + cozyCampfires = new CozyCampfires(); + if (config.getBoolean("enable-cozy-campfires", true)) { + plugin.getServer().getScheduler().runTaskTimer(plugin, () -> cozyCampfires.checkForCampfires(), 0, 80); + } + if (config.getBoolean("enable-sweethearts", true)) { manager.registerEvents(new Sweethearts(), plugin); } + + if (config.getBoolean("enable-ziprails", true)) { + manager.registerEvents(new Ziprails(), plugin); + } } @Override diff --git a/modules/src/main/java/parallelmc/parallelutils/modules/bitsandbobs/minimodules/Ziprails.java b/modules/src/main/java/parallelmc/parallelutils/modules/bitsandbobs/minimodules/Ziprails.java index 127c5a30..0a6de204 100644 --- a/modules/src/main/java/parallelmc/parallelutils/modules/bitsandbobs/minimodules/Ziprails.java +++ b/modules/src/main/java/parallelmc/parallelutils/modules/bitsandbobs/minimodules/Ziprails.java @@ -15,7 +15,7 @@ public class Ziprails implements Listener { - private static final double MINECART_DEFAULT_MAX_SPEED = 0.4d; + private static final double MINECART_DEFAULT_MAX_SPEED = 1.0d; // gamerule minecartMaxSpeed = 20 NamespacedKey key; public Ziprails() { From cddf37b73461d58a84987541629ab422c732606f Mon Sep 17 00:00:00 2001 From: Diamondback88 <23108617+Diamondback88@users.noreply.github.com> Date: Sat, 7 Jun 2025 00:16:43 -0400 Subject: [PATCH 09/12] Make ziprails check more frequent to prevent carts from falling off the tracks --- .../parallelutils/modules/bitsandbobs/minimodules/Ziprails.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/src/main/java/parallelmc/parallelutils/modules/bitsandbobs/minimodules/Ziprails.java b/modules/src/main/java/parallelmc/parallelutils/modules/bitsandbobs/minimodules/Ziprails.java index 0a6de204..3a8d78d1 100644 --- a/modules/src/main/java/parallelmc/parallelutils/modules/bitsandbobs/minimodules/Ziprails.java +++ b/modules/src/main/java/parallelmc/parallelutils/modules/bitsandbobs/minimodules/Ziprails.java @@ -29,7 +29,7 @@ public Ziprails() { key = new NamespacedKey(plugin, "isZipping"); - plugin.getServer().getScheduler().runTaskTimer(plugin, this::checkForZiprails, 0L, 4L); + plugin.getServer().getScheduler().runTaskTimer(plugin, this::checkForZiprails, 0L, 2L); } public void checkForZiprails() { From f1300da1bffd5b0f1d08caf227619aca10a53f5f Mon Sep 17 00:00:00 2001 From: Ethan Date: Sat, 7 Jun 2025 11:07:31 -0400 Subject: [PATCH 10/12] chestshop bandaid fix --- .../parallelutils/modules/chestshops/ChestShops.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/src/main/java/parallelmc/parallelutils/modules/chestshops/ChestShops.java b/modules/src/main/java/parallelmc/parallelutils/modules/chestshops/ChestShops.java index 388bd6cf..e3371112 100644 --- a/modules/src/main/java/parallelmc/parallelutils/modules/chestshops/ChestShops.java +++ b/modules/src/main/java/parallelmc/parallelutils/modules/chestshops/ChestShops.java @@ -172,14 +172,18 @@ public void onDisable() { conn.commit(); statement.close(); + // this logic below needs to be redone at some point + // ideally shifting to a full database driven setup + // remove old chestshop entries that no longer exist on the server // this helps fix conflicts where someone creates a shop where one recently existed (small edge case but good to patch) // since existing chestshops have their timestamp updated automatically above, they shouldn't be touched by this - PreparedStatement cleanup = conn.prepareStatement("DELETE FROM ChestShops WHERE Timestamp < DATE_SUB(NOW(), INTERVAL 15 MINUTE)"); + /* PreparedStatement cleanup = conn.prepareStatement("DELETE FROM ChestShops WHERE Timestamp < DATE_SUB(NOW(), INTERVAL 15 MINUTE)"); cleanup.setQueryTimeout(30); cleanup.execute(); conn.commit(); cleanup.close(); + */ } catch (SQLException e) { e.printStackTrace(); From b92594b11ebf8433659655989feb35b96c9e85b4 Mon Sep 17 00:00:00 2001 From: Ethan Date: Sat, 7 Jun 2025 15:12:01 -0400 Subject: [PATCH 11/12] skip loading invalid materials --- .../parallelutils/modules/chestshops/ChestShops.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/src/main/java/parallelmc/parallelutils/modules/chestshops/ChestShops.java b/modules/src/main/java/parallelmc/parallelutils/modules/chestshops/ChestShops.java index e3371112..155f6788 100644 --- a/modules/src/main/java/parallelmc/parallelutils/modules/chestshops/ChestShops.java +++ b/modules/src/main/java/parallelmc/parallelutils/modules/chestshops/ChestShops.java @@ -115,6 +115,10 @@ PRIMARY KEY (shopID) Location chestLoc = new Location(world, results.getInt("ChestX"), results.getInt("ChestY"), results.getInt("ChestZ")); Location signLoc = new Location(world, results.getInt("SignX"), results.getInt("SignY"), results.getInt("SignZ")); Material item = Material.getMaterial(results.getString("Item")); + if (item == null) { + ParallelUtils.log(Level.WARNING, "Skipping loading invalid ChestShop Material: " + results.getString("Item")); + continue; + } int sellAmt = results.getInt("SellAmt"); int buyAmt = results.getInt("BuyAmt"); addShop(uuid, id, chestLoc, signLoc, item, sellAmt, buyAmt); From 7bc68b6eed4d920e67f02e30f57066ee2a8497f3 Mon Sep 17 00:00:00 2001 From: Diamondback88 <23108617+Diamondback88@users.noreply.github.com> Date: Mon, 9 Jun 2025 02:45:51 -0400 Subject: [PATCH 12/12] Fix players being able to silence other players --- .../modules/bitsandbobs/minimodules/SilenceMobs.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/src/main/java/parallelmc/parallelutils/modules/bitsandbobs/minimodules/SilenceMobs.java b/modules/src/main/java/parallelmc/parallelutils/modules/bitsandbobs/minimodules/SilenceMobs.java index 9c25c775..1400f526 100644 --- a/modules/src/main/java/parallelmc/parallelutils/modules/bitsandbobs/minimodules/SilenceMobs.java +++ b/modules/src/main/java/parallelmc/parallelutils/modules/bitsandbobs/minimodules/SilenceMobs.java @@ -22,7 +22,9 @@ public void useSilenceNametag(PlayerInteractEntityEvent event) { if (!player.getEquipment().getItem(slot).getType().equals(Material.NAME_TAG)) { return; } - if (!(event.getRightClicked() instanceof LivingEntity entity)) { + // If the player right clicked a non-living entity or a player, return + // This is to prevent a player accidentally editing another player's playerdata + if (!(event.getRightClicked() instanceof LivingEntity entity) || event.getRightClicked() instanceof Player) { return; } TextComponent nametagName = (TextComponent) player.getEquipment().getItem(slot).getItemMeta().displayName();