mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Fix slime-block-not-pushable setting issues
This commit is contained in:
@@ -1,42 +1,77 @@
|
||||
From 5d0c14864d709c29c6287a7a67a442ffcbb7d44d Mon Sep 17 00:00:00 2001
|
||||
From 2dc580a511b3496138c19e6ba1eae6700c102f8d Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Fri, 23 Aug 2019 21:56:31 -0500
|
||||
Subject: [PATCH] Option for slimes not pushable
|
||||
|
||||
---
|
||||
src/main/java/net/minecraft/server/BlockSlime.java | 5 +++++
|
||||
src/main/java/net/pl3x/purpur/PurpurConfig.java | 11 +++++++++++
|
||||
2 files changed, 16 insertions(+)
|
||||
src/main/java/net/minecraft/server/BlockPiston.java | 12 ++++++++++++
|
||||
src/main/java/net/minecraft/server/BlockSlime.java | 7 +++++++
|
||||
src/main/java/net/pl3x/purpur/PurpurConfig.java | 13 +++++++++++++
|
||||
3 files changed, 32 insertions(+)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockPiston.java b/src/main/java/net/minecraft/server/BlockPiston.java
|
||||
index de804348f..52cc35d0a 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockPiston.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockPiston.java
|
||||
@@ -9,6 +9,8 @@ import java.util.Set;
|
||||
// CraftBukkit start
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.util.AbstractList;
|
||||
+
|
||||
+import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
import org.bukkit.event.block.BlockPistonRetractEvent;
|
||||
import org.bukkit.event.block.BlockPistonExtendEvent;
|
||||
@@ -329,6 +331,16 @@ public class BlockPiston extends BlockDirectional {
|
||||
} else {
|
||||
event = new BlockPistonRetractEvent(bblock, blocks, CraftBlock.notchToBlockFace(enumdirection1));
|
||||
}
|
||||
+ // Purpur start
|
||||
+ if (net.pl3x.purpur.PurpurConfig.slimeBlocksNotPushable) {
|
||||
+ for (org.bukkit.block.Block block : blocks) {
|
||||
+ if (block.getType() == Material.SLIME_BLOCK) {
|
||||
+ event.setCancelled(true);
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockSlime.java b/src/main/java/net/minecraft/server/BlockSlime.java
|
||||
index fd54958f6..0f4cdd5ed 100644
|
||||
index fd54958f6..3ee8332c9 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockSlime.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockSlime.java
|
||||
@@ -49,4 +49,9 @@ public class BlockSlime extends BlockHalfTransparent {
|
||||
@@ -49,4 +49,11 @@ public class BlockSlime extends BlockHalfTransparent {
|
||||
|
||||
super.stepOn(world, blockposition, entity);
|
||||
}
|
||||
+
|
||||
+ // Purpur start
|
||||
+ @Override
|
||||
+ public EnumPistonReaction getPushReaction(IBlockData iblockdata) {
|
||||
+ return net.pl3x.purpur.PurpurConfig.slimeBlocksNotPushable ? EnumPistonReaction.BLOCK : super.getPushReaction(iblockdata);
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
index 4f6df3ba6..14930aea7 100644
|
||||
index 4f6df3ba6..ab17fc26f 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
@@ -281,6 +281,17 @@ public class PurpurConfig {
|
||||
@@ -281,6 +281,19 @@ public class PurpurConfig {
|
||||
InventoryType.BARREL.setDefaultSize(packedBarrels ? 54 : 27);
|
||||
}
|
||||
|
||||
+ public static boolean slimeBlocksNotPushable = false;
|
||||
+ private static void slimeBlocksNotPushable() {
|
||||
+ if (version < 2) {
|
||||
+ boolean oldValue = config.getBoolean("slimes-not-pushable", slimeBlocksNotPushable);
|
||||
+ oldValue = config.getBoolean("settings.slimes-not-pushable", oldValue);
|
||||
+
|
||||
+ set("settings.slime-blocks-not-pushable", oldValue);
|
||||
+ if (config.isSet("slimes-not-pushable")) {
|
||||
+ slimeBlocksNotPushable = config.getBoolean("slimes-not-pushable", slimeBlocksNotPushable);
|
||||
+ }
|
||||
+ if (config.isSet("settings.slimes-not-pushable")) {
|
||||
+ slimeBlocksNotPushable = config.getBoolean("settings.slimes-not-pushable", slimeBlocksNotPushable);
|
||||
+ }
|
||||
+ }
|
||||
+ slimeBlocksNotPushable = getBoolean("settings.slime-blocks-not-pushable", slimeBlocksNotPushable);
|
||||
+ }
|
||||
|
||||
Reference in New Issue
Block a user