diff --git a/README.md b/README.md
index 4b38d1f8..c2931684 100644
--- a/README.md
+++ b/README.md
@@ -24,7 +24,8 @@ MCBBS Link: [Click Here](https://www.mcbbs.net/forum.php?mod=viewthread&tid=1471
13. Offhand Menu compatibility(Thats amazing)
14. Automatically fix portal stuck issue
15. Automatically login for Bedrock players(configurable)
- 16. More......
+ 16. Fix shulker box crash bug on legacy versions(MC 1.13-)
+ 17. More......
**Download links:**
[Releases](https://github.com/HaHaWTH/AuthMeReReloaded/releases/latest)
diff --git a/pom.xml b/pom.xml
index 0a9c93a6..b19ca7fa 100644
--- a/pom.xml
+++ b/pom.xml
@@ -444,6 +444,14 @@
com.google.protobuf
fr.xephi.authme.libs.com.google.protobuf
+
+ io.netty
+ fr.xephi.authme.libs.io.netty
+
+
+ org.apache.commons.validator
+ fr.xephi.authme.libs.org.apache.commons.validator
+
@@ -511,6 +519,15 @@
+
+ opencollab-snapshot-main
+ https://repo.opencollab.dev/main/
+
+
+ opencollab-maven-snapshots
+ https://repo.opencollab.dev/maven-snapshots/
+
+
apache-snapshots
@@ -629,10 +646,6 @@
false
-
- opencollab-snapshot-main
- https://repo.opencollab.dev/main/
-
@@ -869,13 +882,19 @@
-
+
-
-
-
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java
index ce3dd4b5..f57ae0b7 100644
--- a/src/main/java/fr/xephi/authme/AuthMe.java
+++ b/src/main/java/fr/xephi/authme/AuthMe.java
@@ -11,6 +11,7 @@ import fr.xephi.authme.initialization.OnShutdownPlayerSaver;
import fr.xephi.authme.initialization.OnStartupTasks;
import fr.xephi.authme.initialization.SettingsProvider;
import fr.xephi.authme.initialization.TaskCloser;
+import fr.xephi.authme.listener.AdvancedShulkerFixListener;
import fr.xephi.authme.listener.BedrockAutoLoginListener;
import fr.xephi.authme.listener.BlockListener;
import fr.xephi.authme.listener.DoubleLoginFixListener;
@@ -359,6 +360,9 @@ public class AuthMe extends JavaPlugin {
if (settings.getProperty(SecuritySettings.ANTI_GHOST_PLAYERS)) {
pluginManager.registerEvents(injector.getSingleton(DoubleLoginFixListener.class), this);
}
+ if (settings.getProperty(SecuritySettings.ADVANCED_SHULKER_FIX)) {
+ pluginManager.registerEvents(injector.getSingleton(AdvancedShulkerFixListener.class), this);
+ }
}
/**
diff --git a/src/main/java/fr/xephi/authme/listener/AdvancedShulkerFixListener.java b/src/main/java/fr/xephi/authme/listener/AdvancedShulkerFixListener.java
new file mode 100644
index 00000000..eeff22ac
--- /dev/null
+++ b/src/main/java/fr/xephi/authme/listener/AdvancedShulkerFixListener.java
@@ -0,0 +1,43 @@
+package fr.xephi.authme.listener;
+
+import org.bukkit.block.Block;
+import org.bukkit.block.BlockFace;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.bukkit.event.block.BlockDispenseEvent;
+
+//This fix is only for Minecraft 1.13-
+public class AdvancedShulkerFixListener implements Listener {
+
+ @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
+ public void onDispenserActivate(BlockDispenseEvent event) {
+ Block block = event.getBlock();
+ if (block.getFace(block) == BlockFace.DOWN) {
+ //If the block is in y = 0
+ if (block.getY() == 0) {
+ event.setCancelled(true);
+ }
+ }
+ if (block.getFace(block) == BlockFace.UP) {
+ //If the block is in y = 255
+ if (block.getY() == 255) {
+ event.setCancelled(true);
+ }
+ }
+ }
+
+ //This implementation method will be available in my another plugin
+// @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
+// public void onDispenserBePlaced(BlockPlaceEvent event){
+// Block block = event.getBlock();
+// if (block.getType().equals(Material.DISPENSER)){
+// if (block.getFace(block) == BlockFace.DOWN && block.getY() == 0){
+// event.setCancelled(true);
+// }
+// if (block.getFace(block) == BlockFace.UP && block.getY() == 255){
+// event.setCancelled(true);
+// }
+// }
+// }
+}
diff --git a/src/main/java/fr/xephi/authme/listener/LoginLocationFixListener.java b/src/main/java/fr/xephi/authme/listener/LoginLocationFixListener.java
index c48652ec..0a046597 100644
--- a/src/main/java/fr/xephi/authme/listener/LoginLocationFixListener.java
+++ b/src/main/java/fr/xephi/authme/listener/LoginLocationFixListener.java
@@ -35,7 +35,7 @@ public class LoginLocationFixListener implements Listener {
private static Material materialPortal = Material.matchMaterial("PORTAL");
- private static boolean isChecked = false; // false: unchecked/method not available true: method is available
+ private static boolean isAvailable; // false: unchecked/method not available true: method is available
private final boolean isSmartAsyncTeleport = AuthMe.settings.getProperty(SecuritySettings.SMART_ASYNC_TELEPORT);
private final boolean isFixPortalStuck = AuthMe.settings.getProperty(SecuritySettings.LOGIN_LOC_FIX_SUB_PORTAL);
private final boolean isFixGroundStuck = AuthMe.settings.getProperty(SecuritySettings.LOGIN_LOC_FIX_SUB_UNDERGROUND);
@@ -50,15 +50,15 @@ public class LoginLocationFixListener implements Listener {
}
try {
Method getMinHeightMethod = World.class.getMethod("getMinHeight");
- isChecked = true;
+ isAvailable = true;
} catch (NoSuchMethodException e) {
- isChecked = false;
+ isAvailable = false;
}
}
private int getMinHeight(World world) {
//This keeps compatibility of 1.16.x and lower
- if (isChecked) {
+ if (isAvailable) {
return world.getMinHeight();
} else {
return 0;
@@ -97,10 +97,11 @@ public class LoginLocationFixListener implements Listener {
Material UpType = JoinLocation.getBlock().getRelative(BlockFace.UP).getType();
World world = player.getWorld();
int MaxHeight = world.getMaxHeight();
+ int MinHeight = getMinHeight(world);
if (!UpType.isOccluding() && !UpType.equals(Material.LAVA)) {
return;
}
- for (int i = getMinHeight(world); i <= MaxHeight; i++) {
+ for (int i = MinHeight; i <= MaxHeight; i++) {
JoinLocation.setY(i);
Block JoinBlock = JoinLocation.getBlock();
if ((JoinBlock.getRelative(BlockFace.DOWN).getType().isBlock())
diff --git a/src/main/java/fr/xephi/authme/settings/properties/SecuritySettings.java b/src/main/java/fr/xephi/authme/settings/properties/SecuritySettings.java
index d1eff916..682c50a8 100644
--- a/src/main/java/fr/xephi/authme/settings/properties/SecuritySettings.java
+++ b/src/main/java/fr/xephi/authme/settings/properties/SecuritySettings.java
@@ -35,6 +35,11 @@ public final class SecuritySettings implements SettingsHolder {
public static final Property ANTI_GHOST_PLAYERS =
newProperty("3rdPartyFeature.fixes.antiGhostPlayer", false);
+ @Comment({"(MC1.13- only)",
+ "Should we fix the shulker crash bug with advanced method?"})
+ public static final Property ADVANCED_SHULKER_FIX =
+ newProperty("3rdPartyFeature.fixes.advancedShulkerFix", true);
+
@Comment({"Choose the best teleport method by server brand?",
"(Enable this if you are using Paper)"})
public static final Property SMART_ASYNC_TELEPORT =