mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 06:28:49 +00:00
Restructure connection interfacing system
This commit is contained in:
1 parent
894b50ad0d
commit
7ef9159daf
33 files changed
+200
-256
No files matched your search
@@ -38,9 +38,8 @@ public class WarpCommand extends CommandBase {
|
||||
}
|
||||
if (args.length == 1) {
|
||||
String warpName = args[0];
|
||||
Connection connection = HuskHomes.getConnection();
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
||||
try {
|
||||
try (Connection connection = HuskHomes.getConnection()) {
|
||||
if (DataManager.warpExists(warpName, connection)) {
|
||||
if (Warp.getWarpCanUse(p, warpName)) {
|
||||
Warp warp = DataManager.getWarp(warpName, connection);
|
||||
@@ -74,9 +73,8 @@ public class WarpCommand extends CommandBase {
|
||||
targetPlayer = Bukkit.getPlayer(args[1]);
|
||||
if (targetPlayer != null) {
|
||||
|
||||
Connection connection = HuskHomes.getConnection();
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
||||
try {
|
||||
try (Connection connection = HuskHomes.getConnection()) {
|
||||
if (DataManager.warpExists(warpName, connection)) {
|
||||
Warp warp = DataManager.getWarp(warpName, connection);
|
||||
TeleportManager.teleportPlayer(targetPlayer, warp, connection);
|
||||
@@ -106,9 +104,8 @@ public class WarpCommand extends CommandBase {
|
||||
// Updates the public home cache
|
||||
public static void updateWarpsTabCache() {
|
||||
warpsTabCache.clear();
|
||||
Connection connection = HuskHomes.getConnection();
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
||||
try {
|
||||
try (Connection connection = HuskHomes.getConnection()) {
|
||||
for (Warp warp : DataManager.getWarps(connection)) {
|
||||
warpsTabCache.add(warp.getName());
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user