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
@@ -35,9 +35,8 @@ public class PublicHomeCommand extends CommandBase implements TabCompleter {
|
||||
// Updates the public home cache
|
||||
public static void updatePublicHomeTabCache() {
|
||||
publicHomeTabCache.clear();
|
||||
Connection connection = HuskHomes.getConnection();
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
||||
try {
|
||||
try (Connection connection = HuskHomes.getConnection()) {
|
||||
for (Home home : DataManager.getPublicHomes(connection)) {
|
||||
publicHomeTabCache.put(home.getName(), home.getOwnerUsername());
|
||||
}
|
||||
@@ -48,9 +47,8 @@ public class PublicHomeCommand extends CommandBase implements TabCompleter {
|
||||
}
|
||||
|
||||
public static void queueHomeTeleport(Player p, String publicHome) {
|
||||
Connection connection = HuskHomes.getConnection();
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
||||
try {
|
||||
try (Connection connection = HuskHomes.getConnection()) {
|
||||
String[] split = publicHome.split("\\.");
|
||||
String ownerName = split[0];
|
||||
String homeName = split[1];
|
||||
@@ -102,9 +100,8 @@ public class PublicHomeCommand extends CommandBase implements TabCompleter {
|
||||
String[] split = publicHomeName.split("\\.");
|
||||
String ownerName = split[0];
|
||||
String homeName = split[1];
|
||||
Connection connection = HuskHomes.getConnection();
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
||||
try {
|
||||
try (Connection connection = HuskHomes.getConnection()) {
|
||||
if (DataManager.homeExists(ownerName, homeName, connection)) {
|
||||
Home home = DataManager.getHome(ownerName, homeName, connection);
|
||||
assert home != null;
|
||||
|
||||
Reference in new issue
Block a user