Cleanup
This commit is contained in:
parent
0b11781329
commit
b9e2514556
17
README.md
17
README.md
@ -27,15 +27,14 @@
|
||||
10. Player login logic improvement to reduce lag
|
||||
11. Automatically purge bot data
|
||||
12. **Folia support (in active testing)**
|
||||
13. Offhand Menu compatibility(Thats amazing)
|
||||
14. **Velocity support (See [Velocity Support](./vc-support.md))**
|
||||
15. Support Virtual Threads caching
|
||||
16. Automatically fix portal stuck issue
|
||||
17. Automatically login for Bedrock players(configurable)
|
||||
18. Fix shulker box crash bug on legacy versions(MC 1.13-)
|
||||
19. **H2 database support**
|
||||
20. **100% compatibility with original authme and extensions**
|
||||
21. More......
|
||||
13. **Velocity support (See [Velocity Support](./vc-support.md))**
|
||||
14. Support Virtual Threads caching
|
||||
15. Automatically fix portal stuck issue
|
||||
16. Automatically login for Bedrock players(configurable)
|
||||
17. Fix shulker box crash bug on legacy versions(MC 1.13-)
|
||||
18. **H2 database support**
|
||||
19. **100% compatibility with original authme and extensions**
|
||||
20. More......
|
||||
|
||||
**Download links:**
|
||||
[Releases](https://github.com/HaHaWTH/AuthMeReReloaded/releases/latest)
|
||||
|
||||
@ -15,8 +15,6 @@ import fr.xephi.authme.util.PlayerUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryView;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.time.Instant;
|
||||
@ -26,8 +24,6 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Optional;
|
||||
|
||||
import static fr.xephi.authme.listener.PlayerListener.PENDING_INVENTORIES;
|
||||
|
||||
/**
|
||||
* The current API of AuthMe.
|
||||
*
|
||||
@ -261,18 +257,6 @@ public class AuthMeApi {
|
||||
return dataSource.saveAuth(auth);
|
||||
}
|
||||
|
||||
/**
|
||||
* Open an inventory for the given player at any time.
|
||||
*
|
||||
* @param player The player to open the inventory for
|
||||
* @param inventory The inventory to open
|
||||
* @return The inventory view
|
||||
*/
|
||||
public InventoryView openInventory(Player player, Inventory inventory) {
|
||||
PENDING_INVENTORIES.add(inventory);
|
||||
return player.openInventory(inventory);
|
||||
}
|
||||
|
||||
/**
|
||||
* Force a player to login, i.e. the player is logged in without needing his password.
|
||||
*
|
||||
|
||||
@ -52,12 +52,9 @@ import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
import org.bukkit.event.player.PlayerShearEntityEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryView;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
@ -98,8 +95,6 @@ public class PlayerListener implements Listener {
|
||||
@Inject
|
||||
private QuickCommandsProtectionManager quickCommandsProtectionManager;
|
||||
|
||||
public static List<Inventory> PENDING_INVENTORIES = new ArrayList<>();
|
||||
|
||||
// Lowest priority to apply fast protection checks
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onAsyncPlayerPreLoginEventLowest(AsyncPlayerPreLoginEvent event) {
|
||||
@ -500,17 +495,6 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isInventoryOpenedByApi(Inventory inventory) {
|
||||
if (inventory == null) {
|
||||
return false;
|
||||
}
|
||||
if (PENDING_INVENTORIES.contains(inventory)) {
|
||||
PENDING_INVENTORIES.remove(inventory);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@SuppressWarnings("all")
|
||||
private boolean isInventoryWhitelisted(InventoryView inventory) {
|
||||
if (inventory == null) {
|
||||
@ -537,8 +521,7 @@ public class PlayerListener implements Listener {
|
||||
public void onPlayerInventoryOpen(InventoryOpenEvent event) {
|
||||
final HumanEntity player = event.getPlayer();
|
||||
if (listenerService.shouldCancelEvent(player)
|
||||
&& !isInventoryWhitelisted(event.getView())
|
||||
&& !isInventoryOpenedByApi(event.getInventory())) {
|
||||
&& !isInventoryWhitelisted(event.getView())) {
|
||||
event.setCancelled(true);
|
||||
|
||||
/*
|
||||
@ -556,12 +539,4 @@ public class PlayerListener implements Listener {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
// @EventHandler(priority = EventPriority.LOWEST)
|
||||
// public void onSwitchHand(PlayerSwapHandItemsEvent event) {
|
||||
// Player player = event.getPlayer();
|
||||
// if (!player.isSneaking() || !player.hasPermission("keybindings.use"))
|
||||
// return;
|
||||
// event.setCancelled(true);
|
||||
// Bukkit.dispatchCommand(event.getPlayer(), "help");
|
||||
// }
|
||||
}
|
||||
|
||||
@ -1,10 +1,13 @@
|
||||
package fr.xephi.authme.task;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Updater {
|
||||
private final String currentVersion;
|
||||
@ -32,14 +35,16 @@ public class Updater {
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setConnectTimeout(10000);
|
||||
conn.setReadTimeout(10000);
|
||||
Scanner scanner = new Scanner(conn.getInputStream());
|
||||
String response = scanner.useDelimiter("\\Z").next();
|
||||
scanner.close();
|
||||
String latestVersion = response.substring(response.indexOf("tag_name") + 11);
|
||||
latestVersion = latestVersion.substring(0, latestVersion.indexOf("\""));
|
||||
this.latestVersion = latestVersion;
|
||||
isUpdateAvailable = !currentVersion.equals(latestVersion);
|
||||
return isUpdateAvailable;
|
||||
conn.setRequestMethod("GET");
|
||||
conn.setRequestProperty("Accept", "application/vnd.github+json");
|
||||
try (InputStreamReader reader = new InputStreamReader(conn.getInputStream())) {
|
||||
JsonObject jsonObject = new JsonParser().parse(reader).getAsJsonObject();
|
||||
String latest = jsonObject.get("tag_name").getAsString();
|
||||
latestVersion = latest;
|
||||
isUpdateAvailable = !currentVersion.equals(latest);
|
||||
reader.close();
|
||||
return isUpdateAvailable;
|
||||
}
|
||||
} catch (IOException ignored) {
|
||||
this.latestVersion = null;
|
||||
isUpdateAvailable = false;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user