use of com.iridium.iridiumcore.Color in project IridiumSkyblock by Iridium-Development.
the class IridiumSkyblock method loadConfigs.
/**
* Loads the configurations required for this plugin.
*/
@Override
public void loadConfigs() {
loadConfigFiles();
for (Color color : Color.values()) {
if (!border.enabled.containsKey(color)) {
border.enabled.put(color, true);
}
}
int maxSize = upgrades.sizeUpgrade.upgrades.values().stream().max(Comparator.comparing(sizeUpgrade -> sizeUpgrade.size)).get().size;
if (configuration.distance <= maxSize) {
configuration.distance = maxSize + 1;
}
if (inventories.confirmationGUI.yes.slot == null || inventories.confirmationGUI.yes.slot == 0) {
inventories.confirmationGUI.yes.slot = 15;
}
if (inventories.confirmationGUI.no.slot == null || inventories.confirmationGUI.no.slot == 0) {
inventories.confirmationGUI.no.slot = 1;
}
initializePermissionList();
initializeSettingsList();
for (Permission permission : permissionList.values()) {
if (permission.getPage() == 0)
permission.setPage(1);
}
if (bankItems.crystalsBankItem.getDisplayName() == null)
bankItems.crystalsBankItem.setDisplayName("Crystal");
if (bankItems.experienceBankItem.getDisplayName() == null)
bankItems.experienceBankItem.setDisplayName("Experience");
if (bankItems.moneyBankItem.getDisplayName() == null)
bankItems.moneyBankItem.setDisplayName("Money");
if (boosters.experienceBooster.name == null)
boosters.experienceBooster.name = "Experience";
if (boosters.farmingBooster.name == null)
boosters.experienceBooster.name = "Farming";
if (boosters.flightBooster.name == null)
boosters.experienceBooster.name = "Flight";
if (boosters.spawnerBooster.name == null)
boosters.experienceBooster.name = "Spawner";
if (upgrades.warpsUpgrade.name == null)
upgrades.warpsUpgrade.name = "Warps";
if (upgrades.sizeUpgrade.name == null)
upgrades.sizeUpgrade.name = "Size";
if (upgrades.blockLimitUpgrade.name == null)
upgrades.blockLimitUpgrade.name = "Block Limit";
if (upgrades.memberUpgrade.name == null)
upgrades.memberUpgrade.name = "Members";
if (upgrades.oresUpgrade.name == null)
upgrades.oresUpgrade.name = "Ore Generator";
this.bankItemList = new ArrayList<>();
if (bankItems.crystalsBankItem.isEnabled()) {
this.bankItemList.add(bankItems.crystalsBankItem);
}
if (bankItems.experienceBankItem.isEnabled()) {
this.bankItemList.add(bankItems.experienceBankItem);
}
if (bankItems.moneyBankItem.isEnabled()) {
this.bankItemList.add(bankItems.moneyBankItem);
}
for (Map.Entry<String, Schematics.SchematicConfig> schematics : schematics.schematics.entrySet()) {
Schematics.SchematicConfig schematic = schematics.getValue();
if (schematic.overworld.islandHeight == null)
schematic.overworld.islandHeight = 90.0;
if (schematic.overworld.ignoreAirBlocks == null)
schematic.overworld.ignoreAirBlocks = true;
if (schematic.nether.islandHeight == null)
schematic.nether.islandHeight = 90.0;
if (schematic.nether.ignoreAirBlocks == null)
schematic.nether.ignoreAirBlocks = true;
if (schematic.end.islandHeight == null)
schematic.end.islandHeight = 90.0;
if (schematic.end.ignoreAirBlocks == null)
schematic.end.ignoreAirBlocks = true;
}
this.missionsList = new HashMap<>(missions.missions);
this.upgradesList = new HashMap<>();
if (upgrades.sizeUpgrade.enabled)
upgradesList.put("size", upgrades.sizeUpgrade);
if (upgrades.memberUpgrade.enabled)
upgradesList.put("member", upgrades.memberUpgrade);
if (upgrades.warpsUpgrade.enabled)
upgradesList.put("warp", upgrades.warpsUpgrade);
if (upgrades.blockLimitUpgrade.enabled)
upgradesList.put("blocklimit", upgrades.blockLimitUpgrade);
if (upgrades.oresUpgrade.enabled) {
upgradesList.put("generator", upgrades.oresUpgrade);
BlockFormListener.generateOrePossibilities();
}
this.boosterList = new HashMap<>();
if (boosters.experienceBooster.enabled)
boosterList.put("experience", boosters.experienceBooster);
if (boosters.flightBooster.enabled)
boosterList.put("flight", boosters.flightBooster);
if (boosters.farmingBooster.enabled)
boosterList.put("farming", boosters.farmingBooster);
if (boosters.spawnerBooster.enabled)
boosterList.put("spawner", boosters.spawnerBooster);
saveSchematics();
if (shopManager != null)
shopManager.reloadCategories();
if (commandManager != null)
commandManager.reloadCommands();
if (schematicManager != null)
schematicManager.schematicPaster.clearCache();
IridiumSkyblockReloadEvent reloadEvent = new IridiumSkyblockReloadEvent();
Bukkit.getPluginManager().callEvent(reloadEvent);
}
use of com.iridium.iridiumcore.Color in project IridiumSkyblock by Iridium-Development.
the class BorderCommand method execute.
/**
* Executes the command for the specified {@link CommandSender} with the provided arguments.
* Not called when the command execution was invalid (no permission, no player or command disabled).
* Changes the Island Border
*
* @param sender The CommandSender which executes this command
* @param args The arguments used with this command. They contain the sub-command
*/
@Override
public boolean execute(CommandSender sender, String[] args) {
Player player = (Player) sender;
User user = IridiumSkyblock.getInstance().getUserManager().getUser(player);
Optional<Island> island = user.getIsland();
if (!island.isPresent()) {
player.sendMessage(StringUtils.color(IridiumSkyblock.getInstance().getMessages().noIsland.replace("%prefix%", IridiumSkyblock.getInstance().getConfiguration().prefix)));
return false;
}
if (!IridiumSkyblock.getInstance().getIslandManager().getIslandPermission(island.get(), IridiumSkyblock.getInstance().getUserManager().getUser(player), PermissionType.BORDER)) {
player.sendMessage(StringUtils.color(IridiumSkyblock.getInstance().getMessages().cannotManageBorder.replace("%prefix%", IridiumSkyblock.getInstance().getConfiguration().prefix)));
return false;
}
if (args.length != 2) {
player.openInventory(new InventoryConfigGUI(IridiumSkyblock.getInstance().getInventories().islandBorder, player.getOpenInventory().getTopInventory()).getInventory());
return true;
}
Color color = Color.getColor(args[1]);
if (color == null) {
player.sendMessage(StringUtils.color(IridiumSkyblock.getInstance().getMessages().notAColor.replace("%prefix%", IridiumSkyblock.getInstance().getConfiguration().prefix)));
return false;
}
if (!IridiumSkyblock.getInstance().getBorder().enabled.getOrDefault(color, true)) {
player.sendMessage(StringUtils.color(IridiumSkyblock.getInstance().getMessages().borderColorDisabled.replace("%prefix%", IridiumSkyblock.getInstance().getConfiguration().prefix)));
return false;
}
island.get().setColor(color);
island.get().getMembers().stream().map(islandUser -> Bukkit.getPlayer(islandUser.getUuid())).filter(Objects::nonNull).forEach(islandPlayer -> islandPlayer.sendMessage(StringUtils.color(IridiumSkyblock.getInstance().getMessages().islandBorderChanged.replace("%player%", player.getName()).replace("%color%", color.toString()).replace("%prefix%", IridiumSkyblock.getInstance().getConfiguration().prefix))));
return true;
}
Aggregations