use of com.magmaguy.elitemobs.utils.WarningMessage in project EliteMobs by MagmaGuy.
the class WorldGuardCompatibility method protectMinidungeonArea.
public static boolean protectMinidungeonArea(String regionName, Location location, Minidungeon minidungeon) {
try {
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
RegionManager regions = container.get(BukkitAdapter.adapt(location.getWorld()));
ProtectedRegion protectedRegion = regions.getRegion(regionName);
if (protectedRegion == null) {
new WarningMessage("The region name picked did not exist!");
return false;
}
protectMinidungeonArea(protectedRegion, minidungeon);
return true;
} catch (Exception ex) {
new WarningMessage("Failed to protect region " + regionName + " !");
return false;
}
}
use of com.magmaguy.elitemobs.utils.WarningMessage in project EliteMobs by MagmaGuy.
the class DisguiseEntity method customDisguise.
private static void customDisguise(String customDisguise, Entity entity, String customDisguiseData, String filename) {
Disguise disguise = DisguiseAPI.getCustomDisguise(customDisguise);
try {
if (disguise == null)
if (customDisguiseData != null) {
DisguiseAPI.addCustomDisguise(customDisguise, customDisguiseData);
disguise = DisguiseAPI.getCustomDisguise(customDisguise);
}
if (disguise == null)
throw new NullPointerException();
disguise.setEntity(entity);
disguise.setDisguiseName(entity.getCustomName());
disguise.setDynamicName(true);
disguise.startDisguise();
} catch (Exception ex) {
new WarningMessage("Failed to set custom disguise for " + filename + " !");
new WarningMessage("Does the disguise exist? Is LibsDisguises up-to-date?");
}
}
use of com.magmaguy.elitemobs.utils.WarningMessage in project EliteMobs by MagmaGuy.
the class DisguiseEntity method disguise.
/**
* This method disguises the entity based on a config entry. It should be invoked after checking if libsdisguises
* is in the server.
*
* @param disguiseName Raw name following config format
*/
public static void disguise(String disguiseName, Entity entity, String customDisguiseData, String filename) {
if (disguiseName.contains("player:")) {
playerDisguise(disguiseName.replace("player:", ""), entity);
return;
}
if (disguiseName.contains("custom")) {
try {
customDisguise(disguiseName.replace("custom:", ""), entity, customDisguiseData, filename);
} catch (Exception ex) {
new WarningMessage("Failed to assign custom disguise " + disguiseName + "! Did you configure the disguise correctly?");
}
return;
}
DisguiseType disguiseType;
try {
disguiseType = DisguiseType.valueOf(disguiseName);
} catch (Exception ex) {
new WarningMessage("Disguise " + disguiseName + " is not a valid disguise name! Entity " + entity.getCustomName() + " will not have a disguise.");
return;
}
if (disguiseType.isMob())
livingEntityDisguise(disguiseType, entity);
else if (disguiseType.isMisc())
miscEntityDisguise(disguiseType, entity);
else
new WarningMessage("Disguise " + disguiseName + " is not a valid disguise name! Entity " + entity.getCustomName() + " will not have a disguise.");
}
use of com.magmaguy.elitemobs.utils.WarningMessage in project EliteMobs by MagmaGuy.
the class ItemLootShower method dropFifty.
private void dropFifty(Location location) {
Item currencyItem;
try {
currencyItem = generateCurrencyItem(Material.getMaterial(EconomySettingsConfig.getLootShowerMaterial50()), location, 50);
} catch (Exception ex) {
new WarningMessage("Material for EliteMob shower 50 is invalid. Defaulting to emerald block.");
currencyItem = generateCurrencyItem(Material.EMERALD_BLOCK, location, 50);
}
currencyItem.setCustomName(ChatColorConverter.convert("&2" + 50 + " " + EconomySettingsConfig.getCurrencyName()));
currencyItem.setCustomNameVisible(true);
}
use of com.magmaguy.elitemobs.utils.WarningMessage in project EliteMobs by MagmaGuy.
the class ItemLootShower method dropOne.
private void dropOne(Location location) {
Item currencyItem;
try {
currencyItem = generateCurrencyItem(Material.getMaterial(EconomySettingsConfig.getLootShowerMaterial1()), location, 1);
} catch (Exception ex) {
new WarningMessage("Material for EliteMob shower 1 is invalid. Defaulting to gold nugget.");
currencyItem = generateCurrencyItem(Material.GOLD_NUGGET, location, 1);
}
currencyItem.setCustomName(ChatColorConverter.convert("&7" + 1 + " " + EconomySettingsConfig.getCurrencyName()));
currencyItem.setCustomNameVisible(true);
}
Aggregations