mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-03 22:16:34 +00:00
Revert API refactoring changes
This commit is contained in:
1 parent
c0f3c7a6f5
commit
4e5f71f1a0
2 files changed
+15
-14
No files matched your search
@@ -77,7 +77,6 @@ public final class HuskHomes extends JavaPlugin {
|
|||||||
private static PlayerList playerList;
|
private static PlayerList playerList;
|
||||||
public static PlayerList getPlayerList() { return playerList; }
|
public static PlayerList getPlayerList() { return playerList; }
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the HuskHomes API
|
* Returns the HuskHomes API
|
||||||
* @return an instance of the HuskHomes API
|
* @return an instance of the HuskHomes API
|
||||||
@@ -87,6 +86,7 @@ public final class HuskHomes extends JavaPlugin {
|
|||||||
return new HuskHomesAPI();
|
return new HuskHomesAPI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void disablePlugin(String reason) {
|
public static void disablePlugin(String reason) {
|
||||||
instance.getLogger().severe("Disabling HuskHomes plugin because:\n" + reason);
|
instance.getLogger().severe("Disabling HuskHomes plugin because:\n" + reason);
|
||||||
Bukkit.getPluginManager().disablePlugin(instance);
|
Bukkit.getPluginManager().disablePlugin(instance);
|
||||||
|
|||||||
@@ -20,10 +20,11 @@ import java.util.logging.Level;
|
|||||||
*/
|
*/
|
||||||
public class HuskHomesAPI {
|
public class HuskHomesAPI {
|
||||||
|
|
||||||
private static final HuskHomes huskHomes = HuskHomes.getInstance();
|
private static final HuskHomes plugin = HuskHomes.getInstance();
|
||||||
private Connection getConnection() {
|
private Connection getConnection() {
|
||||||
return HuskHomes.getConnection();
|
return HuskHomes.getConnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
public HuskHomesAPI() { }
|
public HuskHomesAPI() { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -48,7 +49,7 @@ public class HuskHomesAPI {
|
|||||||
try {
|
try {
|
||||||
return DataManager.getHome(ownerUsername, homeName, getConnection());
|
return DataManager.getHome(ownerUsername, homeName, getConnection());
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
huskHomes.getLogger().log(Level.WARNING, "An SQL exception occurred retrieving data for API access", e);
|
plugin.getLogger().log(Level.WARNING, "An SQL exception occurred retrieving data for API access", e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -63,7 +64,7 @@ public class HuskHomesAPI {
|
|||||||
try {
|
try {
|
||||||
return DataManager.getWarp(warpName, getConnection());
|
return DataManager.getWarp(warpName, getConnection());
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
huskHomes.getLogger().log(Level.WARNING, "An SQL exception occurred retrieving data for API access", e);
|
plugin.getLogger().log(Level.WARNING, "An SQL exception occurred retrieving data for API access", e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -88,7 +89,7 @@ public class HuskHomesAPI {
|
|||||||
try {
|
try {
|
||||||
return DataManager.getPlayerHomes(ownerUsername, getConnection());
|
return DataManager.getPlayerHomes(ownerUsername, getConnection());
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
huskHomes.getLogger().log(Level.WARNING, "An SQL exception occurred retrieving data for API access", e);
|
plugin.getLogger().log(Level.WARNING, "An SQL exception occurred retrieving data for API access", e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -130,7 +131,7 @@ public class HuskHomesAPI {
|
|||||||
try {
|
try {
|
||||||
return DataManager.getPublicHomes(getConnection());
|
return DataManager.getPublicHomes(getConnection());
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
huskHomes.getLogger().log(Level.WARNING, "An SQL exception occurred retrieving data for API access", e);
|
plugin.getLogger().log(Level.WARNING, "An SQL exception occurred retrieving data for API access", e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -153,7 +154,7 @@ public class HuskHomesAPI {
|
|||||||
try {
|
try {
|
||||||
return DataManager.getWarps(getConnection());
|
return DataManager.getWarps(getConnection());
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
huskHomes.getLogger().log(Level.WARNING, "An SQL exception occurred retrieving data for API access", e);
|
plugin.getLogger().log(Level.WARNING, "An SQL exception occurred retrieving data for API access", e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -183,8 +184,8 @@ public class HuskHomesAPI {
|
|||||||
* @see TeleportationPoint
|
* @see TeleportationPoint
|
||||||
*/
|
*/
|
||||||
public void teleportPlayer(Player player, TeleportationPoint point, boolean timed) {
|
public void teleportPlayer(Player player, TeleportationPoint point, boolean timed) {
|
||||||
Connection connection = getConnection();
|
Connection connection = HuskHomes.getConnection();
|
||||||
Bukkit.getScheduler().runTask(huskHomes, () -> {
|
Bukkit.getScheduler().runTask(plugin, () -> {
|
||||||
try {
|
try {
|
||||||
if (timed) {
|
if (timed) {
|
||||||
TeleportManager.queueTimedTeleport(player, point, connection);
|
TeleportManager.queueTimedTeleport(player, point, connection);
|
||||||
@@ -192,7 +193,7 @@ public class HuskHomesAPI {
|
|||||||
TeleportManager.teleportPlayer(player, point, connection);
|
TeleportManager.teleportPlayer(player, point, connection);
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
huskHomes.getLogger().log(Level.WARNING, "An SQLException occurred timed-teleporting a player via API");
|
plugin.getLogger().log(Level.WARNING, "An SQLException occurred timed-teleporting a player via API");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -205,8 +206,8 @@ public class HuskHomesAPI {
|
|||||||
* @see TeleportationPoint
|
* @see TeleportationPoint
|
||||||
*/
|
*/
|
||||||
public void teleportPlayer(Player player, String targetPlayerName, boolean timed) {
|
public void teleportPlayer(Player player, String targetPlayerName, boolean timed) {
|
||||||
Connection connection = getConnection();
|
Connection connection = HuskHomes.getConnection();
|
||||||
Bukkit.getScheduler().runTask(huskHomes, () -> {
|
Bukkit.getScheduler().runTask(plugin, () -> {
|
||||||
try {
|
try {
|
||||||
if (timed) {
|
if (timed) {
|
||||||
TeleportManager.queueTimedTeleport(player, targetPlayerName, connection);
|
TeleportManager.queueTimedTeleport(player, targetPlayerName, connection);
|
||||||
@@ -214,9 +215,9 @@ public class HuskHomesAPI {
|
|||||||
TeleportManager.teleportPlayer(player, targetPlayerName, connection);
|
TeleportManager.teleportPlayer(player, targetPlayerName, connection);
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
huskHomes.getLogger().log(Level.WARNING, "An SQLException occurred teleporting a player via API");
|
plugin.getLogger().log(Level.WARNING, "An SQLException occurred teleporting a player via API");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user