private List<String> getFancyAnchorList(Player p) { List<String> anchorList = new ArrayList<String>(); ChatColor color = ChatColor.GREEN; for (String anchor : this.plugin.getAnchorManager().getAnchors(p)) { anchorList.add(color + anchor); color = (color == ChatColor.GREEN) ? ChatColor.GOLD : ChatColor.GREEN; } return anchorList; }
/** * {@inheritDoc} */ @Override public void setDestination(JavaPlugin plugin, String destination) { if (!(plugin instanceof MultiverseCore)) { return; } this.plugin = (MultiverseCore) plugin; List<String> parsed = Arrays.asList(destination.split(":")); // Need at least: e:world:x,y,z // OR e:world:x,y,z:pitch:yaw // so basically 3 or 5 if (!(parsed.size() == 2)) { this.isValid = false; return; } this.name = parsed.get(1); this.location = this.plugin.getAnchorManager().getAnchorLocation(parsed.get(1)); if (this.location == null) { this.isValid = false; return; } if (!parsed.get(0).equalsIgnoreCase(this.getIdentifier())) { this.isValid = false; } this.isValid = true; }
sender.sendMessage(ChatColor.RED + "You don't have the permission to delete anchors!"); } else { if (this.plugin.getAnchorManager().deleteAnchor(args.get(0))) { sender.sendMessage("Anchor '" + args.get(0) + "' was successfully " + ChatColor.RED + "deleted!"); } else { } else { Player player = (Player) sender; if (this.plugin.getAnchorManager().saveAnchorLocation(args.get(0), player.getLocation())) { sender.sendMessage("Anchor '" + args.get(0) + "' was successfully " + ChatColor.GREEN + "created!"); } else {
@Override public void runCommand(CommandSender sender, List<String> args) { sender.sendMessage(ChatColor.GOLD + "Reloading all Multiverse Plugin configs..."); this.plugin.loadConfigs(); this.plugin.getAnchorManager().loadAnchors(); this.plugin.getMVWorldManager().loadWorlds(true); List<String> configsLoaded = new ArrayList<String>(); configsLoaded.add("Multiverse-Core - config.yml"); configsLoaded.add("Multiverse-Core - worlds.yml"); configsLoaded.add("Multiverse-Core - anchors.yml"); // Create the event MVConfigReloadEvent configReload = new MVConfigReloadEvent(configsLoaded); // Fire it off this.plugin.getServer().getPluginManager().callEvent(configReload); for (String s : configReload.getAllConfigsLoaded()) { sender.sendMessage(s); } sender.sendMessage(ChatColor.GREEN + "Reload Complete!"); }