Merge upstream changes up to v1.18.0

Port bug fixes and features from SpraxDev/BetterChairs upstream while
preserving TrueOG Gradle build system and Essentials /back support.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
NotAlexNoyleandClaude Opus 4.6 committed 2026-03-30 03:47:56 -04:00
1 parent f0fc6226f4
commit 589e9f2e8c
5 files changed
+75 -8

No files matched your search

+15
View File
@@ -1,5 +1,20 @@
# Change Log
## Version 1.14-OG:
* Merged upstream changes up to v1.18.0
### Added
* Dismount players when chair blocks are affected by external changes (leaf decay, fire, ice melting, physics updates)
### Fixed
* Use `.equals()` instead of `==` for comparing Players, Blocks, and Entities in ChairManager
* Replace deprecated `XMaterial.parseMaterial()` with `XMaterial.get()`
* Improved error handling for NMS loading — now logs critical errors instead of silently falling back
### Changed
* Grammar fix in piston event JavaDoc comments
## Version 1.13-OG:
* Removed support for 1.20.6+
* Builds with gradle 8.14.2 instead of maven
+1 -1
View File
@@ -13,7 +13,7 @@ plugins {
}
group = "de.sprax2013"
version = "1.13-OG"
version = "1.14-OG"
val pluginName = "BetterChairs"
val selfMavenLocalRepo = System.getProperty("SELF_MAVEN_LOCAL_REPO")?.let(::file)?.takeIf { it.isDirectory }
@@ -231,7 +231,7 @@ public class ChairManager {
if (!Bukkit.isPrimaryThread()) throw new IllegalStateException(Messages.ERR_ASYNC_API_CALL);
for (Chair c : this.chairs.toArray(new Chair[0])) {
if (p == c.player && !c.destroyOnNoPassenger()) {
if (c.player.equals(p) && !c.destroyOnNoPassenger()) {
return c;
}
}
@@ -244,7 +244,7 @@ public class ChairManager {
if (!Bukkit.isPrimaryThread()) throw new IllegalStateException(Messages.ERR_ASYNC_API_CALL);
for (Chair c : this.chairs.toArray(new Chair[0])) {
if (b == c.block && !c.destroyOnNoPassenger()) {
if (c.block.equals(b) && !c.destroyOnNoPassenger()) {
return c;
}
}
@@ -257,7 +257,7 @@ public class ChairManager {
if (!Bukkit.isPrimaryThread()) throw new IllegalStateException(Messages.ERR_ASYNC_API_CALL);
for (Chair c : this.chairs.toArray(new Chair[0])) {
if (entity == c.chairEntity && !c.destroyOnNoPassenger()) {
if (c.chairEntity.equals(entity) && !c.destroyOnNoPassenger()) {
return c;
}
}
@@ -99,7 +99,17 @@ public class BetterChairsPlugin extends JavaPlugin {
return (ChairNMS) Class.forName("betterchairs.nms." + version + "." + version)
.getConstructors()[0]
.newInstance();
} catch (Exception ignore) {
} catch (Throwable throwable) {
if (throwable instanceof Error) {
getLogger()
.log(
Level.SEVERE,
"A critical error occurred while trying to load NMS support for version "
+ (version != null ? version : "UNKNOWN")
+ "!",
throwable);
}
getLogger()
.warning("Your server version (" + (version != null ? version : "UNKNOWN")
+ ") is not fully supported - Loading fallback...");
@@ -20,8 +20,12 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockBurnEvent;
import org.bukkit.event.block.BlockFadeEvent;
import org.bukkit.event.block.BlockPhysicsEvent;
import org.bukkit.event.block.BlockPistonExtendEvent;
import org.bukkit.event.block.BlockPistonRetractEvent;
import org.bukkit.event.block.LeavesDecayEvent;
import org.bukkit.event.entity.EntitySpawnEvent;
import org.bukkit.event.entity.EntityTeleportEvent;
import org.bukkit.event.player.PlayerInteractEvent;
@@ -73,7 +77,7 @@ public class EventListener implements Listener {
Material mat = null;
if (xMat.isPresent()) {
mat = xMat.get().parseMaterial();
mat = xMat.get().get();
}
if (mat != null) {
@@ -366,7 +370,7 @@ public class EventListener implements Listener {
}
/**
* Check if another plugin insists on a chair's block being moved by an piston<br>
* Check if another plugin insists on a chair's block being moved by a piston<br>
* if so, destroy the chair
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
@@ -394,7 +398,7 @@ public class EventListener implements Listener {
}
/**
* Check if another plugin insists on a chair's block being moved by an piston<br>
* Check if another plugin insists on a chair's block being moved by a piston<br>
* if so, destroy the chair
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
@@ -407,4 +411,42 @@ public class EventListener implements Listener {
}
}
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
private void onBlockFadeMonitor(BlockFadeEvent e) {
Chair chair = getManager().getChair(e.getBlock());
if (chair != null) {
getManager().destroy(chair, true);
}
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
private void onLeavesDecayMonitor(LeavesDecayEvent e) {
Chair chair = getManager().getChair(e.getBlock());
if (chair != null) {
getManager().destroy(chair, true);
}
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
private void onBlockBurnMonitor(BlockBurnEvent e) {
Chair chair = getManager().getChair(e.getBlock());
if (chair != null) {
getManager().destroy(chair, true);
}
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
private void onBlockPhysicsMonitor(BlockPhysicsEvent e) {
Chair chair = getManager().getChair(e.getBlock());
if (chair != null) {
if (e.getBlock().isEmpty()) {
getManager().destroy(chair, true);
}
}
}
}