diff --git a/pom.xml b/pom.xml
index b82a88e3..dcc68090 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,13 +2,16 @@
4.0.0
de.erethon
dungeonsxl
- 0.17.4
+ 0.17.5-SNAPSHOT
jar
DungeonsXL
https://dre2n.github.io
Create custom dungeons and adventure maps with ease!
+ UTF-8
+ 1.8
+ 1.8
${project.artifactId}-${project.version}${buildNo}
@@ -24,18 +27,10 @@
-
- maven-compiler-plugin
- 3.8.0
-
-
- 1.8
-
-
org.apache.maven.plugins
maven-shade-plugin
- 3.1.1
+ 3.2.1
package
diff --git a/src/main/java/de/erethon/dungeonsxl/global/GameSign.java b/src/main/java/de/erethon/dungeonsxl/global/GameSign.java
index 1fcb2f35..d3605733 100644
--- a/src/main/java/de/erethon/dungeonsxl/global/GameSign.java
+++ b/src/main/java/de/erethon/dungeonsxl/global/GameSign.java
@@ -216,27 +216,10 @@ public class GameSign extends JoinSign {
return tryToCreate(plugin, event.getBlock(), identifier, maxGroupsPerGame, startIfElementsAtLeast);
}
- public static GameSign tryToCreate(DungeonsXL plugin, Block startSign, String identifier, int maxGroupsPerGame, int startIfElementsAtLeast) {
- World world = startSign.getWorld();
- BlockFace facing = ((Attachable) startSign.getState().getData()).getAttachedFace().getOppositeFace();
- int x = startSign.getX(), y = startSign.getY(), z = startSign.getZ();
-
- int verticalSigns = (int) Math.ceil((float) (1 + maxGroupsPerGame) / 4);
- while (verticalSigns > 1) {
- Block block = world.getBlockAt(x, y - verticalSigns + 1, z);
- block.setType(VanillaItem.WALL_SIGN.getMaterial(), false);
- org.bukkit.material.Sign signData = new org.bukkit.material.Sign(VanillaItem.WALL_SIGN.getMaterial());
- signData.setFacingDirection(facing);
- org.bukkit.block.Sign sign = (org.bukkit.block.Sign) block.getState();
- sign.setData(signData);
- sign.update(true, false);
-
- verticalSigns--;
- }
- GameSign sign = new GameSign(plugin, plugin.getGlobalProtectionCache().generateId(GameSign.class, world), startSign, identifier, maxGroupsPerGame, startIfElementsAtLeast);
-
- LWCUtil.removeProtection(startSign);
-
+ public static GameSign tryToCreate(DungeonsXL plugin, Block startSign, String identifier, int maxElements, int startIfElementsAtLeast) {
+ onCreation(plugin, startSign, identifier, maxElements, startIfElementsAtLeast);
+ GameSign sign = new GameSign(plugin, plugin.getGlobalProtectionCache().generateId(GameSign.class, startSign.getWorld()), startSign, identifier,
+ maxElements, startIfElementsAtLeast);
return sign;
}
diff --git a/src/main/java/de/erethon/dungeonsxl/global/GroupSign.java b/src/main/java/de/erethon/dungeonsxl/global/GroupSign.java
index b583d0a2..e1c46b23 100644
--- a/src/main/java/de/erethon/dungeonsxl/global/GroupSign.java
+++ b/src/main/java/de/erethon/dungeonsxl/global/GroupSign.java
@@ -19,6 +19,7 @@ package de.erethon.dungeonsxl.global;
import de.erethon.caliburn.category.Category;
import de.erethon.caliburn.item.VanillaItem;
import de.erethon.commons.chat.MessageUtil;
+import de.erethon.commons.compatibility.Version;
import de.erethon.commons.misc.NumberUtil;
import de.erethon.dungeonsxl.DungeonsXL;
import de.erethon.dungeonsxl.config.DMessage;
@@ -27,7 +28,9 @@ import de.erethon.dungeonsxl.util.LWCUtil;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
+import org.bukkit.block.BlockState;
import org.bukkit.block.Sign;
+import org.bukkit.block.data.Directional;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
@@ -212,28 +215,10 @@ public class GroupSign extends JoinSign {
return tryToCreate(plugin, event.getBlock(), identifier, maxPlayersPerGroup, startIfElementsAtLeast, groupName);
}
- public static GroupSign tryToCreate(DungeonsXL plugin, Block startSign, String identifier, int maxPlayersPerGroup, int startIfElementsAtLeast, String groupName) {
- World world = startSign.getWorld();
- BlockFace facing = ((Attachable) startSign.getState().getData()).getAttachedFace().getOppositeFace();
- int x = startSign.getX(), y = startSign.getY(), z = startSign.getZ();
-
- int verticalSigns = (int) Math.ceil((float) (1 + maxPlayersPerGroup) / 4);
- while (verticalSigns > 1) {
- Block block = world.getBlockAt(x, y - verticalSigns + 1, z);
- block.setType(VanillaItem.WALL_SIGN.getMaterial(), false);
- org.bukkit.material.Sign signData = new org.bukkit.material.Sign(VanillaItem.WALL_SIGN.getMaterial());
- signData.setFacingDirection(facing);
- org.bukkit.block.Sign sign = (org.bukkit.block.Sign) block.getState();
- sign.setData(signData);
- sign.update(true, false);
-
- verticalSigns--;
- }
- GroupSign sign = new GroupSign(plugin, plugin.getGlobalProtectionCache().generateId(GroupSign.class, world), startSign, identifier, maxPlayersPerGroup,
- startIfElementsAtLeast, groupName);
-
- LWCUtil.removeProtection(startSign);
-
+ public static GroupSign tryToCreate(DungeonsXL plugin, Block startSign, String identifier, int maxElements, int startIfElementsAtLeast, String groupName) {
+ onCreation(plugin, startSign, identifier, maxElements, startIfElementsAtLeast);
+ GroupSign sign = new GroupSign(plugin, plugin.getGlobalProtectionCache().generateId(GroupSign.class, startSign.getWorld()), startSign, identifier,
+ maxElements, startIfElementsAtLeast, groupName);
return sign;
}
diff --git a/src/main/java/de/erethon/dungeonsxl/global/JoinSign.java b/src/main/java/de/erethon/dungeonsxl/global/JoinSign.java
index 0810ab37..ca91a68c 100644
--- a/src/main/java/de/erethon/dungeonsxl/global/JoinSign.java
+++ b/src/main/java/de/erethon/dungeonsxl/global/JoinSign.java
@@ -16,17 +16,22 @@
*/
package de.erethon.dungeonsxl.global;
+import de.erethon.caliburn.item.VanillaItem;
import de.erethon.commons.misc.BlockUtil;
import de.erethon.dungeonsxl.DungeonsXL;
import de.erethon.dungeonsxl.dungeon.Dungeon;
+import de.erethon.dungeonsxl.util.LWCUtil;
import de.erethon.dungeonsxl.world.DResourceWorld;
import java.util.HashSet;
import java.util.Set;
import org.bukkit.World;
import org.bukkit.block.Block;
+import org.bukkit.block.BlockFace;
+import org.bukkit.block.BlockState;
import org.bukkit.block.Sign;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
+import org.bukkit.material.Attachable;
/**
* @author Daniel Saukel
@@ -206,4 +211,31 @@ public class JoinSign extends GlobalProtection {
}
}
+ protected static void onCreation(DungeonsXL plugin, Block startSign, String identifier, int maxElements, int startIfElementsAtLeast) {
+ // TODO: Replace as soon as versions older than 1.13 are dropped
+
+ World world = startSign.getWorld();
+ BlockFace facing = ((Attachable) startSign.getState().getData()).getAttachedFace().getOppositeFace();
+ //BlockFace facing = ((Directional) startSign.getBlockData()).getFacing().getOppositeFace();
+ int x = startSign.getX(), y = startSign.getY(), z = startSign.getZ();
+
+ int verticalSigns = (int) Math.ceil((float) (1 + maxElements) / 4);
+ while (verticalSigns > 1) {
+ Block block = world.getBlockAt(x, y - verticalSigns + 1, z);
+ block.setType(VanillaItem.WALL_SIGN.getMaterial(), false);
+ BlockState state = block.getState();
+ org.bukkit.material.Sign signData = (org.bukkit.material.Sign) state.getData();
+ signData.setFacingDirection(facing);
+ state.setData(signData);
+ state.update(true, false);
+ // Directional directional = (Directional) block.getBlockData();
+ // directional.setFacing(facing);
+ // block.setBlockData(directional, false);
+
+ verticalSigns--;
+ }
+
+ LWCUtil.removeProtection(startSign);
+ }
+
}