use of com.magmaguy.elitemobs.utils.WarningMessage in project EliteMobs by MagmaGuy.
the class MinidungeonWorldLoader method loadWorld.
public static World loadWorld(Minidungeon minidungeon, String worldName, World.Environment environment) {
File folder = new File(Bukkit.getWorldContainer().getAbsolutePath());
new InfoMessage("Trying to load Minidungeon world " + worldName);
if (!Files.exists(Paths.get(folder.getAbsolutePath() + "/" + worldName)))
return null;
new InfoMessage("Detected Minidungeon world " + worldName);
try {
WorldCreator worldCreator = new WorldCreator(worldName);
worldCreator.environment(environment);
World world = Bukkit.createWorld(worldCreator);
if (world != null)
world.setKeepSpawnInMemory(false);
new InfoMessage("Minidungeons world " + worldName + " was loaded successfully!");
minidungeon.setInstalled(true);
world.setDifficulty(Difficulty.HARD);
return world;
} catch (Exception exception) {
new WarningMessage("Failed to load Minidungeon world " + worldName + " !");
exception.printStackTrace();
}
return null;
}
use of com.magmaguy.elitemobs.utils.WarningMessage in project EliteMobs by MagmaGuy.
the class PlayerData method getDatabaseInteger.
private static Integer getDatabaseInteger(UUID uuid, String value) {
try {
Statement statement = getConnection().createStatement();
ResultSet resultSet = statement.executeQuery("SELECT * FROM " + PLAYER_DATA_TABLE_NAME + " WHERE PlayerUUID = '" + uuid.toString() + "';");
int reply = resultSet.getInt(value);
resultSet.close();
statement.close();
return reply;
} catch (Exception e) {
new WarningMessage("Failed to get integer value from database!");
e.printStackTrace();
return null;
}
}
use of com.magmaguy.elitemobs.utils.WarningMessage in project EliteMobs by MagmaGuy.
the class PlayerData method getDatabaseDouble.
private static Double getDatabaseDouble(UUID uuid, String value) {
try {
Statement statement = getConnection().createStatement();
ResultSet resultSet = statement.executeQuery("SELECT * FROM " + PLAYER_DATA_TABLE_NAME + " WHERE PlayerUUID = '" + uuid.toString() + "';");
double reply = resultSet.getDouble(value);
resultSet.close();
statement.close();
return reply;
} catch (Exception e) {
new WarningMessage("Failed to get double value from database!");
e.printStackTrace();
return null;
}
}
use of com.magmaguy.elitemobs.utils.WarningMessage in project EliteMobs by MagmaGuy.
the class PlayerData method initializeDatabaseConnection.
public static void initializeDatabaseConnection() {
new File(MetadataHandler.PLUGIN.getDataFolder().getPath() + "/data").mkdirs();
try {
new InfoMessage("Opened database successfully");
GenerateDatabase.generate();
for (Player player : Bukkit.getOnlinePlayers()) new PlayerData(player.getUniqueId());
} catch (Exception e) {
new WarningMessage(e.getClass().getName() + ": " + e.getMessage());
new WarningMessage("Failed to establish a connection to the SQLite database. This is not good.");
}
new PortOldData();
}
use of com.magmaguy.elitemobs.utils.WarningMessage in project EliteMobs by MagmaGuy.
the class PlayerData method getDatabaseBlob.
private static Object getDatabaseBlob(UUID uuid, String value) {
try {
Statement statement = getConnection().createStatement();
ResultSet resultSet = statement.executeQuery("SELECT * FROM " + PLAYER_DATA_TABLE_NAME + " WHERE PlayerUUID = '" + uuid.toString() + "';");
byte[] bytes = resultSet.getBytes(value);
resultSet.close();
statement.close();
if (bytes == null)
return null;
return new String(bytes);
} catch (Exception e) {
new WarningMessage("Failed to get blob value from database!");
new WarningMessage("UUID: " + uuid + " | Value: " + value);
e.printStackTrace();
return null;
}
}
Aggregations