use of com.magmaguy.elitemobs.utils.WarningMessage in project EliteMobs by MagmaGuy.
the class Wormhole method getDungeonLocation.
private Location getDungeonLocation(String dungeonFilename) {
Minidungeon minidungeon = Minidungeon.getMinidungeons().get(dungeonFilename);
if (minidungeon == null) {
new WarningMessage("Dungeon " + dungeonFilename + " is not a valid dungeon packager name! Wormhole " + getWormholeConfigFields().getFilename() + " will not lead anywhere.");
setPortalMissingMessage(WormholesConfig.getDefaultPortalMissingMessage());
return null;
}
if (!minidungeon.isDownloaded() || !minidungeon.isInstalled()) {
new InfoMessage("Wormhole " + getWormholeConfigFields().getFilename() + " will not lead anywhere because the dungeon " + dungeonFilename + " is not installed!");
setPortalMissingMessage(WormholesConfig.getDungeonNotInstalledMessage().replace("$dungeonID", minidungeon.getDungeonPackagerConfigFields().getName()));
this.opMessage = ChatColorConverter.convert("&8[EliteMobs - OP-only message] &fDownload links are available on &9https://magmaguy.itch.io/ &f" + "(free and premium) and &9https://www.patreon.com/magmaguy &f(premium). You can check the difference " + "between the two and get support here: " + DiscordLinks.mainLink);
return null;
}
Vector offsetVector = minidungeon.getTeleportLocation().getDirection().clone().setY(0).normalize().multiply(1.5 * getWormholeConfigFields().getSizeMultiplier()).setY(-1 * getWormholeConfigFields().getSizeMultiplier());
return minidungeon.getTeleportLocation().clone().subtract(offsetVector);
}
use of com.magmaguy.elitemobs.utils.WarningMessage in project EliteMobs by MagmaGuy.
the class TreasureChest method generateChest.
private void generateChest() {
try {
if (!location.getWorld().getBlockAt(location).getType().equals(customTreasureChestConfigFields.getChestMaterial()))
location.getWorld().getBlockAt(location).setType(customTreasureChestConfigFields.getChestMaterial());
} catch (Exception ex) {
new WarningMessage("Custom Treasure Chest " + customTreasureChestConfigFields.getFilename() + " has an invalid location and can not be placed.");
return;
}
if (location.getBlock().getBlockData() instanceof Directional) {
Directional chest = (Directional) location.getBlock().getBlockData();
chest.setFacing(customTreasureChestConfigFields.getFacing());
location.getBlock().setBlockData(chest);
} else {
new WarningMessage("Treasure chest " + customTreasureChestConfigFields.getFilename() + " does not have a directional block for the Treasure Chest material " + customTreasureChestConfigFields.getChestMaterial() + " ! Chest materials are directional, is your chest a chest?");
}
location.getBlock().getState().update();
}
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) {
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);
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 CustomConfigFields method processEnum.
public <T extends Enum<T>> T processEnum(String path, T value, T pluginDefault, Class<T> enumClass, boolean forceWriteDefault) {
if (!configHas(path)) {
if (forceWriteDefault || value != pluginDefault) {
String valueString = null;
if (value != null)
valueString = value.toString().toUpperCase();
String pluginDefaultString = null;
if (pluginDefault != null)
pluginDefaultString = pluginDefault.toString().toUpperCase();
processString(path, valueString, pluginDefaultString, forceWriteDefault);
}
return value;
}
try {
return (T) Enum.valueOf(enumClass, fileConfiguration.getString(path).toUpperCase());
} catch (Exception ex) {
new WarningMessage("File " + filename + " has an incorrect entry for " + path);
new WarningMessage("Entry: " + value);
}
return value;
}
use of com.magmaguy.elitemobs.utils.WarningMessage in project EliteMobs by MagmaGuy.
the class SetupMenu method dungeonStatuses.
private void dungeonStatuses() {
// continue counting from used inventory slots
int counter = 1;
for (Minidungeon minidungeon : Minidungeon.getMinidungeons().values()) {
if (!Bukkit.getPluginManager().isPluginEnabled("WorldGuard"))
inventory.setItem(validSlots.get(counter), ItemStackGenerator.generateItemStack(Material.RED_STAINED_GLASS_PANE, ChatColorConverter.convert("&4You need WorldGuard to install Minidungeons correctly!")));
else
switch(minidungeon.getDungeonPackagerConfigFields().getDungeonLocationType()) {
case WORLD:
addWorldDungeon(minidungeon, counter);
break;
case SCHEMATIC:
addSchematicDungeon(minidungeon, counter);
break;
default:
new WarningMessage("Dungeon " + minidungeon.getDungeonPackagerConfigFields().getFilename() + " does not have a valid location type and therefore can't be set up automatically!");
break;
}
minidungeonHashMap.put(validSlots.get(counter), minidungeon);
counter++;
}
}
Aggregations