use of com.magmaguy.elitemobs.utils.WarningMessage in project EliteMobs by MagmaGuy.
the class ItemLootShower method dropTwenty.
private void dropTwenty(Location location) {
Item currencyItem;
try {
currencyItem = generateCurrencyItem(Material.getMaterial(EconomySettingsConfig.getLootShowerMaterial20()), location, 20);
} catch (Exception ex) {
new WarningMessage("Material for EliteMob shower 20 is invalid. Defaulting to emerald.");
currencyItem = generateCurrencyItem(Material.EMERALD, location, 20);
}
currencyItem.setCustomName(ChatColorConverter.convert("&2" + 20 + " " + EconomySettingsConfig.getCurrencyName()));
currencyItem.setCustomNameVisible(true);
}
use of com.magmaguy.elitemobs.utils.WarningMessage in project EliteMobs by MagmaGuy.
the class ActionEvent method instantiateEvent.
public void instantiateEvent(Location location, Player player) {
this.player = player;
ActionEvent actionEvent = new ActionEvent(customEventsConfigFields);
actionEvent.setEventStartLocation(location);
CustomEventStartEvent customEventStartEvent = new CustomEventStartEvent(actionEvent);
if (customEventStartEvent.isCancelled())
return;
if (!actionEvent.startConditions.areValid())
return;
for (String filename : primaryCustomBossFilenames) {
CustomBossEntity customBossEntity = CustomBossEntity.createCustomBossEntity(filename);
if (customBossEntity == null) {
new WarningMessage("Failed to generate custom boss " + filename + " ! This has cancelled action event " + customEventsConfigFields.getFilename() + " !");
return;
}
customBossEntity.spawn(actionEvent.getEventStartLocation(), false);
actionEvent.primaryEliteMobs.add(customBossEntity);
}
actionEvent.start();
}
use of com.magmaguy.elitemobs.utils.WarningMessage in project EliteMobs by MagmaGuy.
the class CustomTreasureChestConfigFields method processConfigFields.
@Override
public void processConfigFields() {
this.isEnabled = processBoolean("isEnabled", isEnabled, false, false);
this.chestMaterial = processEnum("chestType", chestMaterial, Material.CHEST, Material.class, true);
this.facing = processEnum("facing", facing, BlockFace.NORTH, BlockFace.class, true);
this.chestTier = processInt("chestTier", chestTier, 0, true);
this.worldName = processString("location", worldName, null, false);
if (worldName != null)
worldName = worldName.split(",")[0];
this.dropStyle = processEnum("dropStyle", dropStyle, TreasureChest.DropStyle.SINGLE, TreasureChest.DropStyle.class, true);
this.restockTimer = processInt("restockTimer", restockTimer, 0, true);
this.lootList = processStringList("lootList", lootList, new ArrayList<>(), true);
this.customLootTable = new CustomLootTable(this);
this.mimicChance = processDouble("mimicChance", mimicChance, 0, true);
this.mimicCustomBossesList = processStringList("mimicCustomBossesList", mimicCustomBossesList, new ArrayList<>(), true);
this.restockTime = processLong("restockTime", restockTimer, 0, false);
this.restockTimers = processStringList("restockTimers", restockTimers, new ArrayList<>(), false);
this.effects = processStringList("effects", effects, new ArrayList<>(), false);
this.locations = processStringList("locations", locations, new ArrayList<>(), false);
this.location = processLocation("location", location, null, false);
if (location == null && locations.isEmpty())
new InfoMessage("Custom Treasure Chest in file " + filename + " does not have a defined location(s)! It will not spawn.");
else
new TreasureChest(this, location, restockTime);
for (String string : locations) {
String[] strings = string.split(":");
Location location = ConfigurationLocation.serialize(strings[0]);
if (location == null) {
new WarningMessage("Bad location entry in locations for " + filename + " . Entry: " + strings[0]);
continue;
}
long timestamp = 0;
if (strings.length > 1) {
try {
timestamp = Long.parseLong(strings[1]);
} catch (Exception exception) {
new WarningMessage("Bad unix timestamp in locations for " + filename + " . Entry: " + strings[0]);
}
}
new TreasureChest(this, location, timestamp);
}
}
use of com.magmaguy.elitemobs.utils.WarningMessage in project EliteMobs by MagmaGuy.
the class CustomBossesConfigFields method setOnRemoveBlockStates.
public void setOnRemoveBlockStates(List<String> onRemoveBlockStates) {
this.onRemoveBlockStates = onRemoveBlockStates;
fileConfiguration.set("onRemoveBlockStates", onRemoveBlockStates);
try {
fileConfiguration.save(file);
} catch (Exception ex) {
new WarningMessage("Failed to save on remove block states!", true);
}
}
use of com.magmaguy.elitemobs.utils.WarningMessage in project EliteMobs by MagmaGuy.
the class EliteMobs method onEnable.
@Override
public void onEnable() {
Bukkit.getLogger().info(" _____ _ _____ _____ ________ ______________ _____");
Bukkit.getLogger().info("| ___| | |_ _|_ _| ___| \\/ | _ | ___ \\/ ___|");
Bukkit.getLogger().info("| |__ | | | | | | | |__ | . . | | | | |_/ /\\ `--.");
Bukkit.getLogger().info("| __|| | | | | | | __|| |\\/| | | | | ___ \\ `--. \\");
Bukkit.getLogger().info("| |___| |_____| |_ | | | |___| | | \\ \\_/ / |_/ //\\__/ /");
Bukkit.getLogger().info("\\____/\\_____/\\___/ \\_/ \\____/\\_| |_/\\___/\\____/ \\____/");
MetadataHandler.PLUGIN = this;
Bukkit.getLogger().info("By MagmaGuy - v. " + MetadataHandler.PLUGIN.getDescription().getVersion());
ServerTime.startTickCounter();
if (Bukkit.getServer().spigot().getConfig().getDouble("settings.attribute.maxHealth.max") < 100000000) {
Bukkit.getServer().spigot().getConfig().set("settings.attribute.maxHealth.max", 100000000);
try {
File spigotConfigContainer = new File(Paths.get(MetadataHandler.PLUGIN.getDataFolder().getParentFile().getCanonicalFile().getParentFile().toString() + "/spigot.yml").toString());
Bukkit.getServer().spigot().getConfig().save(spigotConfigContainer);
new InfoMessage("New default max health set correctly!");
} catch (IOException e) {
new WarningMessage("Failed to save max health value! For the plugin to work correctly, you should increase your max health on the spigot.yml config file to " + 100000000);
}
}
// Remove entities that should not exist
CrashFix.startupCheck();
/*
New config loading
*/
initializeConfigs();
if (Bukkit.getPluginManager().isPluginEnabled("LibsDisguises"))
DisguiseEntity.initialize();
if (worldGuardIsEnabled)
Bukkit.getLogger().info("[EliteMobs] WorldGuard compatibility is enabled!");
else
Bukkit.getLogger().warning("[EliteMobs] WorldGuard compatibility is not enabled!");
// Enable Vault
try {
VaultCompatibility.vaultSetup();
} catch (Exception e) {
Bukkit.getLogger().warning("[EliteMobs] Something went wrong with the vault configuration - your Vault " + "version is probably not compatible with this EliteMobs version. Please contact the dev about this error.");
VaultCompatibility.VAULT_ENABLED = false;
}
// Hook up all listeners, some depend on config
EventsRegistrer.registerEvents();
// Launch the local data cache
PlayerData.initializeDatabaseConnection();
ElitePlayerInventory.initialize();
// Get world list
worldScanner();
// Start the repeating tasks such as scanners
launchRunnables();
// launch events
ActionEvent.initializeBlueprintEvents();
TimedEvent.initializeBlueprintEvents();
// launch internal clock for attack cooldown
EliteMobDamagedByPlayerEvent.EliteMobDamagedByPlayerEventFilter.launchInternalClock();
/*
Initialize mob values
*/
PluginMobProperties.initializePluginMobValues();
/*
Cache animation vectors
*/
MinorPowerStanceMath.initializeVectorCache();
MajorPowerStanceMath.initializeVectorCache();
/*
Scan for loaded SuperMobs
*/
PassiveEliteMobDeathHandler.SuperMobScanner.scanSuperMobs();
// Small check to make sure that PlaceholderAPI is installed
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
Placeholders placeholders = new Placeholders();
placeholders.register();
this.placeholders = placeholders;
}
// Enable stats
metrics = new Metrics(this, 1081);
// Initialize custom charts
new CustomCharts();
// Imports custom configurations and mindungeons from the import folder
ConfigurationImporter.initializeConfigs();
ConfigurationExporter.initializeConfigs();
// Import custom items after potentially importing new items
new CustomItemsConfig();
CustomItem.initializeCustomItems();
LootTables.initialize();
// Load minidungeons, most of all load the worlds of minidungeons
new DungeonPackagerConfig();
// Load Adventurer's Guild
if (AdventurersGuildConfig.isGuildWorldIsEnabled()) {
try {
CustomWorldLoading.startupWorldInitialization();
AdventurersGuildCommand.defineTeleportLocation();
if (AdventurersGuildConfig.getGuildWorldLocation() == null)
AdventurersGuildConfig.toggleGuildInstall();
} catch (Exception e) {
AdventurersGuildConfig.toggleGuildInstall();
new WarningMessage("Failed to initialize the Adventurer's Guild Hub! It is now disabled. You can try to" + "reenable it in /em setup");
}
}
// Load all regional bosses
new CustomBossesConfig();
new CustomTreasureChestsConfig();
// Find the stats of bosses in minidungeons
for (Minidungeon minidungeon : Minidungeon.getMinidungeons().values()) {
if (minidungeon.getDungeonPackagerConfigFields().getDungeonLocationType() != null)
if (minidungeon.getDungeonPackagerConfigFields().getDungeonLocationType().equals(DungeonPackagerConfigFields.DungeonLocationType.WORLD))
minidungeon.quantifyWorldBosses();
else if (minidungeon.getDungeonPackagerConfigFields().getDungeonLocationType().equals(DungeonPackagerConfigFields.DungeonLocationType.SCHEMATIC))
minidungeon.quantifySchematicBosses(false);
}
// Initialize npcs
new NPCsConfig();
// Initialize custom spawn methods, this runs late because it compares loaded worlds against worlds listed in the config
try {
new CustomSpawnConfig();
} catch (Exception ex) {
new WarningMessage("You are using a version of Spigot or a branch thereof (Paper, Purpur, so on) that is (probably) HORRIBLY outdated!" + " This issue will probably be fixed if you update your server version to the latest patch of the version you are running.");
new WarningMessage(" This does not mean that you have to update your Minecraft version, but it does mean you must update your server version to the latest patch" + " available for that Minecraft version. Download from trustworthy sources, as if you download Spigot from some random website other than Spigot," + " you are probably not getting the latest version (and also there's a high chance you'll get a virus).");
}
new CustomQuestsConfig();
new WormholeConfig();
// Commands
new CommandHandler();
/*
Check for new plugin version or for dungeon updates
*/
VersionChecker.check();
}
Aggregations