Compare commits

...

13 Commits

Author SHA1 Message Date
HaHaWTH 69989fb99e B39 release 2023-12-30 14:06:36 +08:00
HaHaWTH 8cf794e303 Remove debug 2023-12-30 13:51:47 +08:00
HaHaWTH de9e74d616 Fix compatibility with Minecraft 1.16.x and lower 2023-12-30 13:13:58 +08:00
HaHaWTH e147a25076 Fix compatibility with Minecraft 1.16.x and lower 2023-12-30 11:08:27 +08:00
HaHaWTH b25d874122 Thread-safety 2023-12-30 09:20:16 +08:00
DGun Otto b322032757 Merge pull request #86 from HaHaWTH/dependabot/maven/org.apache.commons-commons-email-1.6.0
Bump org.apache.commons:commons-email from 1.6-SNAPSHOT to 1.6.0
2023-12-26 23:25:13 +08:00
DGun Otto d505601d33 Merge pull request #87 from HaHaWTH/dependabot/maven/org.apache.maven.plugins-maven-compiler-plugin-3.12.1
Bump org.apache.maven.plugins:maven-compiler-plugin from 3.12.0 to 3.12.1
2023-12-26 00:20:23 +08:00
dependabot[bot] 8580d57a12 Bump org.apache.maven.plugins:maven-compiler-plugin
Bumps [org.apache.maven.plugins:maven-compiler-plugin](https://github.com/apache/maven-compiler-plugin) from 3.12.0 to 3.12.1.
- [Release notes](https://github.com/apache/maven-compiler-plugin/releases)
- [Commits](https://github.com/apache/maven-compiler-plugin/compare/maven-compiler-plugin-3.12.0...maven-compiler-plugin-3.12.1)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-compiler-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-25 04:21:45 +00:00
dependabot[bot] b051f4feef Bump org.apache.commons:commons-email from 1.6-SNAPSHOT to 1.6.0
Bumps org.apache.commons:commons-email from 1.6-SNAPSHOT to 1.6.0.

---
updated-dependencies:
- dependency-name: org.apache.commons:commons-email
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-25 04:21:10 +00:00
HaHaWTH 96c886b93d Merge remote-tracking branch 'origin/master' 2023-12-20 21:00:52 +08:00
HaHaWTH f1d6df9a17 Fix LoginLocationFixListener 2023-12-20 21:00:31 +08:00
DGun Otto 6681075031 Merge pull request #84 from HaHaWTH/dependabot/maven/org.apache.maven.plugins-maven-compiler-plugin-3.12.0
Bump org.apache.maven.plugins:maven-compiler-plugin from 3.11.0 to 3.12.0
2023-12-19 13:16:58 +08:00
dependabot[bot] 1aae25f510 Bump org.apache.maven.plugins:maven-compiler-plugin
Bumps [org.apache.maven.plugins:maven-compiler-plugin](https://github.com/apache/maven-compiler-plugin) from 3.11.0 to 3.12.0.
- [Release notes](https://github.com/apache/maven-compiler-plugin/releases)
- [Commits](https://github.com/apache/maven-compiler-plugin/compare/maven-compiler-plugin-3.11.0...maven-compiler-plugin-3.12.0)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-compiler-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-19 04:46:16 +00:00
6 changed files with 68 additions and 19 deletions
+14 -2
View File
@@ -206,7 +206,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version> <version>3.12.1</version>
<configuration> <configuration>
<source>${java.source}</source> <source>${java.source}</source>
<target>${java.target}</target> <target>${java.target}</target>
@@ -346,6 +346,10 @@
<pattern>com.google.gson</pattern> <pattern>com.google.gson</pattern>
<shadedPattern>fr.xephi.authme.libs.com.google.gson</shadedPattern> <shadedPattern>fr.xephi.authme.libs.com.google.gson</shadedPattern>
</relocation> </relocation>
<!-- <relocation>-->
<!-- <pattern>com.cryptomorin.xseries</pattern>-->
<!-- <shadedPattern>fr.xephi.authme.libs.com.cryptomorin.xseries</shadedPattern>-->
<!-- </relocation>-->
</relocations> </relocations>
</configuration> </configuration>
</execution> </execution>
@@ -682,7 +686,7 @@
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-email</artifactId> <artifactId>commons-email</artifactId>
<version>1.6-SNAPSHOT</version> <version>1.6.0</version>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
@@ -865,6 +869,14 @@
</exclusions> </exclusions>
</dependency> </dependency>
<!-- &lt;!&ndash; XSeries &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>com.github.cryptomorin</groupId>-->
<!-- <artifactId>XSeries</artifactId>-->
<!-- <version>9.8.0</version>-->
<!-- <scope>compile</scope>-->
<!-- </dependency>-->
<!-- zPermissions plugin --> <!-- zPermissions plugin -->
<dependency> <dependency>
<groupId>org.tyrannyofheaven.bukkit</groupId> <groupId>org.tyrannyofheaven.bukkit</groupId>
+12 -2
View File
@@ -73,8 +73,8 @@ public class AuthMe extends JavaPlugin {
// Version and build number values // Version and build number values
private static String pluginVersion = "5.6.0-Fork"; private static String pluginVersion = "5.6.0-Fork";
public static final String pluginBuild = "b"; private static final String pluginBuild = "b";
private static String pluginBuildNumber = "38"; private static String pluginBuildNumber = "39";
// Private instances // Private instances
private EmailService emailService; private EmailService emailService;
private CommandHandler commandHandler; private CommandHandler commandHandler;
@@ -85,12 +85,22 @@ public class AuthMe extends JavaPlugin {
private Injector injector; private Injector injector;
private BackupService backupService; private BackupService backupService;
public static ConsoleLogger logger; public static ConsoleLogger logger;
/** /**
* Constructor. * Constructor.
*/ */
public AuthMe() { public AuthMe() {
} }
/**
* Get the plugin's build
*
* @return The plugin's build
*/
public static String getPluginBuild() {
return pluginBuild;
}
/** /**
* Get the plugin's name. * Get the plugin's name.
@@ -32,10 +32,10 @@ import org.bukkit.inventory.meta.ItemMeta;
import javax.inject.Inject; import javax.inject.Inject;
import java.io.File; import java.io.File;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level; import java.util.logging.Level;
@@ -70,12 +70,14 @@ public class GuiCaptchaHandler implements Listener {
private int timesLeft = 3; private int timesLeft = 3;
//Use ConcurrentHashMap to store player and their close reason //Use ConcurrentHashMap to store player and their close reason
/* We used many async tasks so there is concurrent**/ /* We used many async tasks so there is concurrent**/
public static HashMap<Player, String> closeReasonMap = new HashMap<>(); public static ConcurrentHashMap<Player, String> closeReasonMap = new ConcurrentHashMap<>();
//define randomStringSet //define randomStringSet
String randomSet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz!@#%&*()_+"; String randomSet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz!@#%&*()_+";
String randomString = ""; String randomString = "";
Random randomItemSet = new Random(); Random randomItemSet = new Random();
Random howManyRandom = new Random(); Random howManyRandom = new Random();
private boolean isPacketListenersActive = false; private boolean isPacketListenersActive = false;
public GuiCaptchaHandler() { public GuiCaptchaHandler() {
@@ -162,6 +164,7 @@ public class GuiCaptchaHandler implements Listener {
messages.send(playerunreg, MessageKey.GUI_CAPTCHA_VERIFIED_AUTO_BEDROCK); messages.send(playerunreg, MessageKey.GUI_CAPTCHA_VERIFIED_AUTO_BEDROCK);
return; return;
} }
bukkitService.runTaskAsynchronously(() -> { bukkitService.runTaskAsynchronously(() -> {
bukkitService.runTask(() -> { bukkitService.runTask(() -> {
randomString = sb.toString(); randomString = sb.toString();
@@ -233,14 +236,12 @@ public class GuiCaptchaHandler implements Listener {
timeOut = settings.getProperty(RestrictionSettings.TIMEOUT); timeOut = settings.getProperty(RestrictionSettings.TIMEOUT);
} }
long finalTimeOut = timeOut; long finalTimeOut = timeOut;
bukkitService.runTask(() -> {
bukkitService.runTaskLater(() -> { bukkitService.runTaskLater(() -> {
if (!closeReasonMap.containsKey(playerunreg) && !authmeApi.isRegistered(playerunreg.getName())) { if (!closeReasonMap.containsKey(playerunreg) && !authmeApi.isRegistered(playerunreg.getName())) {
playerunreg.kickPlayer(service.retrieveSingleMessage(playerunreg, MessageKey.GUI_CAPTCHA_KICK_TIMEOUT)); playerunreg.kickPlayer(service.retrieveSingleMessage(playerunreg, MessageKey.GUI_CAPTCHA_KICK_TIMEOUT));
timesLeft = 3; // Reset the attempt counter timesLeft = 3; // Reset the attempt counter
} }
}, finalTimeOut * 20L); }, finalTimeOut * 20L);
});
} }
}); });
}); });
@@ -18,6 +18,7 @@ import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import javax.inject.Inject; import javax.inject.Inject;
import java.lang.reflect.Method;
public class LoginLocationFixListener implements Listener { public class LoginLocationFixListener implements Listener {
@@ -33,6 +34,9 @@ public class LoginLocationFixListener implements Listener {
} }
private static Material materialPortal = Material.matchMaterial("PORTAL"); private static Material materialPortal = Material.matchMaterial("PORTAL");
private boolean isChecked = false;
private boolean isGetMinHeight = false;
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);
@@ -47,10 +51,31 @@ public class LoginLocationFixListener implements Listener {
} }
} }
private int getMinHeight(World world) {
//This keeps compatibility of 1.16.x and lower
try {
if (!isChecked) {
Method getMinHeightMethod = World.class.getMethod("getMinHeight");
getMinHeightMethod.setAccessible(true);
isChecked = true;
isGetMinHeight = true;
return world.getMinHeight();
} else if (isGetMinHeight) {
return world.getMinHeight();
} else {
return 0;
}
} catch (NoSuchMethodException e) {
isChecked = true;
return 0;
}
}
@EventHandler @EventHandler
public void onPlayerJoin(PlayerJoinEvent event) { public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
Location JoinLocation = player.getLocation().getBlock().getLocation().add(0.5, 0.1, 0.5); Location JoinLocation = player.getLocation();
if (isFixPortalStuck) { if (isFixPortalStuck) {
if (!JoinLocation.getBlock().getType().equals(materialPortal) && !JoinLocation.getBlock().getRelative(BlockFace.UP).getType().equals(materialPortal)) { if (!JoinLocation.getBlock().getType().equals(materialPortal) && !JoinLocation.getBlock().getRelative(BlockFace.UP).getType().equals(materialPortal)) {
return; return;
@@ -73,15 +98,15 @@ public class LoginLocationFixListener implements Listener {
JoinBlock.breakNaturally(); JoinBlock.breakNaturally();
} }
messages.send(player, MessageKey.LOCATION_FIX_PORTAL); messages.send(player, MessageKey.LOCATION_FIX_PORTAL);
} else if (isFixGroundStuck) { }
if (isFixGroundStuck) {
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 = world.getMinHeight();
if (!UpType.isOccluding() && !UpType.equals(Material.LAVA)) { if (!UpType.isOccluding() && !UpType.equals(Material.LAVA)) {
return; return;
} }
for (int i = MinHeight; i <= MaxHeight; i++) { for (int i = getMinHeight(world); 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())
@@ -108,5 +133,6 @@ public class LoginLocationFixListener implements Listener {
} }
} }
} }
} }
} }
Binary file not shown.
+1 -1
View File
@@ -3,7 +3,7 @@ authors: [${pluginDescription.authors}]
website: http://github.com/HaHaWTH/AuthMeReReloaded/ website: http://github.com/HaHaWTH/AuthMeReReloaded/
description: A fork of AuthMeReloaded that contains bug fixes description: A fork of AuthMeReloaded that contains bug fixes
main: ${pluginDescription.main} main: ${pluginDescription.main}
version: 5.6.0-FORK-b38 version: 5.6.0-FORK-b39
api-version: 1.13 api-version: 1.13
softdepend: softdepend:
- Vault - Vault