Add AdvancedShulkerFix and optimize LoginLocationFix
This commit is contained in:
parent
c89a818696
commit
be976b6738
@ -24,7 +24,8 @@ MCBBS Link: [Click Here](https://www.mcbbs.net/forum.php?mod=viewthread&tid=1471
|
|||||||
13. Offhand Menu compatibility(Thats amazing)
|
13. Offhand Menu compatibility(Thats amazing)
|
||||||
14. Automatically fix portal stuck issue
|
14. Automatically fix portal stuck issue
|
||||||
15. Automatically login for Bedrock players(configurable)
|
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:**
|
**Download links:**
|
||||||
[Releases](https://github.com/HaHaWTH/AuthMeReReloaded/releases/latest)
|
[Releases](https://github.com/HaHaWTH/AuthMeReReloaded/releases/latest)
|
||||||
|
|||||||
35
pom.xml
35
pom.xml
@ -444,6 +444,14 @@
|
|||||||
<pattern>com.google.protobuf</pattern>
|
<pattern>com.google.protobuf</pattern>
|
||||||
<shadedPattern>fr.xephi.authme.libs.com.google.protobuf</shadedPattern>
|
<shadedPattern>fr.xephi.authme.libs.com.google.protobuf</shadedPattern>
|
||||||
</relocation>
|
</relocation>
|
||||||
|
<relocation>
|
||||||
|
<pattern>io.netty</pattern>
|
||||||
|
<shadedPattern>fr.xephi.authme.libs.io.netty</shadedPattern>
|
||||||
|
</relocation>
|
||||||
|
<relocation>
|
||||||
|
<pattern>org.apache.commons.validator</pattern>
|
||||||
|
<shadedPattern>fr.xephi.authme.libs.org.apache.commons.validator</shadedPattern>
|
||||||
|
</relocation>
|
||||||
</relocations>
|
</relocations>
|
||||||
|
|
||||||
<filters>
|
<filters>
|
||||||
@ -511,6 +519,15 @@
|
|||||||
</build>
|
</build>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>opencollab-snapshot-main</id>
|
||||||
|
<url>https://repo.opencollab.dev/main/</url>
|
||||||
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>opencollab-maven-snapshots</id>
|
||||||
|
<url>https://repo.opencollab.dev/maven-snapshots/</url>
|
||||||
|
</repository>
|
||||||
|
|
||||||
<!-- Apache snapshots repo -->
|
<!-- Apache snapshots repo -->
|
||||||
<repository>
|
<repository>
|
||||||
<id>apache-snapshots</id>
|
<id>apache-snapshots</id>
|
||||||
@ -629,10 +646,6 @@
|
|||||||
<enabled>false</enabled>
|
<enabled>false</enabled>
|
||||||
</snapshots>
|
</snapshots>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
|
||||||
<id>opencollab-snapshot-main</id>
|
|
||||||
<url>https://repo.opencollab.dev/main/</url>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@ -869,13 +882,19 @@
|
|||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- <!– XSeries –>-->
|
<!-- dependencies used by HAProxy feature -->
|
||||||
<!-- <dependency>-->
|
<!-- <dependency>-->
|
||||||
<!-- <groupId>com.github.cryptomorin</groupId>-->
|
<!-- <groupId>io.netty</groupId>-->
|
||||||
<!-- <artifactId>XSeries</artifactId>-->
|
<!-- <artifactId>netty-codec-haproxy</artifactId>-->
|
||||||
<!-- <version>9.8.0</version>-->
|
<!-- <version>4.1.104.Final</version>-->
|
||||||
<!-- <scope>compile</scope>-->
|
<!-- <scope>compile</scope>-->
|
||||||
<!-- </dependency>-->
|
<!-- </dependency>-->
|
||||||
|
<!-- <dependency>-->
|
||||||
|
<!-- <groupId>commons-validator</groupId>-->
|
||||||
|
<!-- <artifactId>commons-validator</artifactId>-->
|
||||||
|
<!-- <version>1.8.0</version>-->
|
||||||
|
<!-- <scope>provided</scope>-->
|
||||||
|
<!-- </dependency>-->
|
||||||
|
|
||||||
<!-- zPermissions plugin -->
|
<!-- zPermissions plugin -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import fr.xephi.authme.initialization.OnShutdownPlayerSaver;
|
|||||||
import fr.xephi.authme.initialization.OnStartupTasks;
|
import fr.xephi.authme.initialization.OnStartupTasks;
|
||||||
import fr.xephi.authme.initialization.SettingsProvider;
|
import fr.xephi.authme.initialization.SettingsProvider;
|
||||||
import fr.xephi.authme.initialization.TaskCloser;
|
import fr.xephi.authme.initialization.TaskCloser;
|
||||||
|
import fr.xephi.authme.listener.AdvancedShulkerFixListener;
|
||||||
import fr.xephi.authme.listener.BedrockAutoLoginListener;
|
import fr.xephi.authme.listener.BedrockAutoLoginListener;
|
||||||
import fr.xephi.authme.listener.BlockListener;
|
import fr.xephi.authme.listener.BlockListener;
|
||||||
import fr.xephi.authme.listener.DoubleLoginFixListener;
|
import fr.xephi.authme.listener.DoubleLoginFixListener;
|
||||||
@ -359,6 +360,9 @@ public class AuthMe extends JavaPlugin {
|
|||||||
if (settings.getProperty(SecuritySettings.ANTI_GHOST_PLAYERS)) {
|
if (settings.getProperty(SecuritySettings.ANTI_GHOST_PLAYERS)) {
|
||||||
pluginManager.registerEvents(injector.getSingleton(DoubleLoginFixListener.class), this);
|
pluginManager.registerEvents(injector.getSingleton(DoubleLoginFixListener.class), this);
|
||||||
}
|
}
|
||||||
|
if (settings.getProperty(SecuritySettings.ADVANCED_SHULKER_FIX)) {
|
||||||
|
pluginManager.registerEvents(injector.getSingleton(AdvancedShulkerFixListener.class), this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -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);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
@ -35,7 +35,7 @@ public class LoginLocationFixListener implements Listener {
|
|||||||
|
|
||||||
private static Material materialPortal = Material.matchMaterial("PORTAL");
|
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 isSmartAsyncTeleport = AuthMe.settings.getProperty(SecuritySettings.SMART_ASYNC_TELEPORT);
|
||||||
private final boolean isFixPortalStuck = AuthMe.settings.getProperty(SecuritySettings.LOGIN_LOC_FIX_SUB_PORTAL);
|
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);
|
private final boolean isFixGroundStuck = AuthMe.settings.getProperty(SecuritySettings.LOGIN_LOC_FIX_SUB_UNDERGROUND);
|
||||||
@ -50,15 +50,15 @@ public class LoginLocationFixListener implements Listener {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Method getMinHeightMethod = World.class.getMethod("getMinHeight");
|
Method getMinHeightMethod = World.class.getMethod("getMinHeight");
|
||||||
isChecked = true;
|
isAvailable = true;
|
||||||
} catch (NoSuchMethodException e) {
|
} catch (NoSuchMethodException e) {
|
||||||
isChecked = false;
|
isAvailable = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getMinHeight(World world) {
|
private int getMinHeight(World world) {
|
||||||
//This keeps compatibility of 1.16.x and lower
|
//This keeps compatibility of 1.16.x and lower
|
||||||
if (isChecked) {
|
if (isAvailable) {
|
||||||
return world.getMinHeight();
|
return world.getMinHeight();
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
@ -97,10 +97,11 @@ public class LoginLocationFixListener implements Listener {
|
|||||||
Material UpType = JoinLocation.getBlock().getRelative(BlockFace.UP).getType();
|
Material UpType = JoinLocation.getBlock().getRelative(BlockFace.UP).getType();
|
||||||
World world = player.getWorld();
|
World world = player.getWorld();
|
||||||
int MaxHeight = world.getMaxHeight();
|
int MaxHeight = world.getMaxHeight();
|
||||||
|
int MinHeight = getMinHeight(world);
|
||||||
if (!UpType.isOccluding() && !UpType.equals(Material.LAVA)) {
|
if (!UpType.isOccluding() && !UpType.equals(Material.LAVA)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (int i = getMinHeight(world); i <= MaxHeight; i++) {
|
for (int i = MinHeight; i <= MaxHeight; i++) {
|
||||||
JoinLocation.setY(i);
|
JoinLocation.setY(i);
|
||||||
Block JoinBlock = JoinLocation.getBlock();
|
Block JoinBlock = JoinLocation.getBlock();
|
||||||
if ((JoinBlock.getRelative(BlockFace.DOWN).getType().isBlock())
|
if ((JoinBlock.getRelative(BlockFace.DOWN).getType().isBlock())
|
||||||
|
|||||||
@ -35,6 +35,11 @@ public final class SecuritySettings implements SettingsHolder {
|
|||||||
public static final Property<Boolean> ANTI_GHOST_PLAYERS =
|
public static final Property<Boolean> ANTI_GHOST_PLAYERS =
|
||||||
newProperty("3rdPartyFeature.fixes.antiGhostPlayer", false);
|
newProperty("3rdPartyFeature.fixes.antiGhostPlayer", false);
|
||||||
|
|
||||||
|
@Comment({"(MC1.13- only)",
|
||||||
|
"Should we fix the shulker crash bug with advanced method?"})
|
||||||
|
public static final Property<Boolean> ADVANCED_SHULKER_FIX =
|
||||||
|
newProperty("3rdPartyFeature.fixes.advancedShulkerFix", true);
|
||||||
|
|
||||||
@Comment({"Choose the best teleport method by server brand?",
|
@Comment({"Choose the best teleport method by server brand?",
|
||||||
"(Enable this if you are using Paper)"})
|
"(Enable this if you are using Paper)"})
|
||||||
public static final Property<Boolean> SMART_ASYNC_TELEPORT =
|
public static final Property<Boolean> SMART_ASYNC_TELEPORT =
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user