use of com.magmaguy.elitemobs.utils.InfoMessage in project EliteMobs by MagmaGuy.
the class TimedEvent method queueEvent.
/**
* Queues an event to start when the start conditions are met
*/
public void queueEvent() {
this.primaryEliteMobs = customSpawn.getCustomBossEntities();
setEventStartLocation(customSpawn.getSpawnLocation());
for (CustomBossEntity customBossEntity : primaryEliteMobs) if (!customBossEntity.exists()) {
if (!silentRetry) {
new InfoMessage("Boss " + customBossEntity.getCustomBossesConfigFields().getFilename() + " for event " + getCustomEventsConfigFields().getFilename() + " wasn't considered to be valid. Trying spawn again .");
new InfoMessage("Note: further failures will be silent. EliteMobs can only predict WorldGuard protections," + " so it will keep trying to spawn things until plugins preventing spawning allow it to do so. This might take a while.");
silentRetry = true;
}
Bukkit.getScheduler().runTaskLater(MetadataHandler.PLUGIN, () -> {
customSpawn.setSpawnLocation(null);
customSpawn.queueSpawn();
}, 1);
return;
}
primaryEliteMobs.forEach(CustomBossEntity::announceSpawn);
start();
}
use of com.magmaguy.elitemobs.utils.InfoMessage in project EliteMobs by MagmaGuy.
the class TimedEvent method instantiateEvent.
/**
* Just because the event is instantiated, does not necessarily mean it started. If the spawn isn't instant, then
* it needs to be queued for a later date. If the spawn is instant but no valid location can be found, it should retry
* on a delay.
*/
public void instantiateEvent() {
new InfoMessage("Event " + getCustomEventsConfigFields().getFilename() + " has been queued!");
TimedEvent timedEvent = new TimedEvent(customEventsConfigFields);
CustomEventStartEvent customEventStartEvent = new CustomEventStartEvent(timedEvent);
if (customEventStartEvent.isCancelled())
return;
timedEvent.customSpawn = new CustomSpawn(customEventsConfigFields.getCustomSpawn(), customEventsConfigFields.getBossFilenames(), timedEvent);
// Failed to initialize event
if (timedEvent.customSpawn.getCustomSpawnConfigFields() == null)
return;
// This handles the elitemobs-events flag
timedEvent.customSpawn.setEvent(true);
// Note: this will finish running at an arbitrary time in the future
timedEvent.customSpawn.queueSpawn();
// global cooldown - 60 seconds right now
nextEventTrigger = System.currentTimeMillis() + globalCooldown * 60 * 1000;
timedEvents.add(timedEvent);
}
use of com.magmaguy.elitemobs.utils.InfoMessage 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.InfoMessage 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.InfoMessage in project EliteMobs by MagmaGuy.
the class GenerateDatabase method addEntryIfEmpty.
private static void addEntryIfEmpty(String columnName, ColumnValues columnValues) {
try {
DatabaseMetaData metaData = PlayerData.getConnection().getMetaData();
ResultSet resultSet = metaData.getColumns(null, null, PlayerData.getPLAYER_DATA_TABLE_NAME(), columnName);
if (resultSet.next()) {
// Developer.message("Database already had " + columnName);
} else {
new InfoMessage("Adding new database column " + columnName);
addColumn(columnName, columnValues);
}
resultSet.close();
} catch (Exception ex) {
new WarningMessage("Could not process column " + columnName);
ex.printStackTrace();
}
}
Aggregations