net.sacredlabyrinth.phaed.simpleclans.ClanPlayer Java Examples
The following examples show how to use
net.sacredlabyrinth.phaed.simpleclans.ClanPlayer.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SimpleClansHook.java From RedProtect with GNU General Public License v3.0 | 5 votes |
public static boolean inWar(Region r, Player attack, Player defend) { if (!RedProtect.get().config.configRoot().hooks.clans.use_war) { return false; } if (!RedProtect.get().config.configRoot().hooks.clans.war_on_server_regions && r.isLeader(RedProtect.get().config.configRoot().region_settings.default_leader)) { return false; } ClanPlayer atClan = RedProtect.get().hooks.clanManager.getClanPlayer(attack); if (atClan == null) { return false; } ClanPlayer defCclan = RedProtect.get().hooks.clanManager.getClanPlayer(defend); return defCclan != null && atClan.getClan().isWarring(defCclan.getClan()); }
Example #2
Source File: FlagGui.java From RedProtect with GNU General Public License v3.0 | 4 votes |
private void applyFlag(String flag, ItemMeta itemMeta, InventoryClickEvent event) { Object flagValue = RedProtect.get().getUtil().parseObject(this.region.getFlagString(flag)); if (flag.equalsIgnoreCase("clan")) { ClanPlayer cp = RedProtect.get().hooks.clanManager.getClanPlayer(this.player); if (this.region.getFlagString(flag).equals("")) { if (this.region.setFlag(this.player, flag, cp.getTag())) { RedProtect.get().lang.sendMessage(this.player, RedProtect.get().lang.get("cmdmanager.region.flag.setclan").replace("{clan}", "'" + cp.getClan().getColorTag() + "'")); } } else { RedProtect.get().lang.sendMessage(this.player, RedProtect.get().lang.get("cmdmanager.region.flag.denyclan").replace("{clan}", "'" + this.region.getFlagString(flag) + "'")); } } else { if ((flag.equalsIgnoreCase("spawn-animals") || flag.equalsIgnoreCase("spawn-monsters")) && RedProtect.get().ph.hasPerm(this.player, "redprotect.flag.spawn-mob-gui")) { close(true); new MobFlagGui(this.player, this.region, flag).open(); return; } if ((flag.equalsIgnoreCase("deny-enter-items") || flag.equalsIgnoreCase("allow-enter-items") || flag.equalsIgnoreCase("allow-place") || flag.equalsIgnoreCase("allow-break")) && RedProtect.get().ph.hasPerm(this.player, "redprotect.flag.item-gui")) { close(true); new ItemFlagGui(this.player, this.region, flag).open(); return; } if (flagValue instanceof Boolean) { if (this.region.setFlag(this.player, flag, !this.region.getFlagBool(flag))) { RedProtect.get().lang.sendMessage(player, RedProtect.get().lang.get("cmdmanager.region.flag.set").replace("{flag}", "'" + flag + "'") + " " + this.region.getFlagBool(flag)); } } } if (allowEnchant) { if (this.region.getFlagBool(flag)) { itemMeta.addEnchant(Enchantment.DURABILITY, 0, true); } else { itemMeta.removeEnchant(Enchantment.DURABILITY); } itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS); } else { if (this.region.getFlagBool(flag)) { event.getCurrentItem().setAmount(2); } else { event.getCurrentItem().setAmount(1); } } String flagString = RedProtect.get().guiLang.getFlagString(this.region.getFlagString(flag)); List<String> lore = new ArrayList<>(Arrays.asList( translateAlternateColorCodes('&', RedProtect.get().guiLang.getFlagString("value") + " " + flagString), "ยง0" + flag)); lore.addAll(RedProtect.get().guiLang.getFlagDescription(flag)); itemMeta.setLore(lore); event.getCurrentItem().setItemMeta(itemMeta); RedProtect.get().logger.addLog("(World " + this.region.getWorld() + ") Player " + player.getName() + " CHANGED flag " + flag + " of region " + this.region.getName() + " to " + flagString); }
Example #3
Source File: SimpleClansHook.java From RedProtect with GNU General Public License v3.0 | 4 votes |
public static boolean getPlayerClan(Region r, Player p) { ClanPlayer clan = RedProtect.get().hooks.clanManager.getClanPlayer(p); return clan != null && clan.getTag().equalsIgnoreCase(r.getFlagString("clan")); }
Example #4
Source File: SimpleClansVariables.java From ScoreboardStats with MIT License | 4 votes |
@Override public void register() { register("kills").scoreSupply(player -> getClanPlayer(player) .map(clanPlayer -> clanPlayer.getCivilianKills() + clanPlayer.getNeutralKills() + clanPlayer.getRivalKills()) .orElse(-1)); register("deaths").scoreSupply(player -> getClanPlayer(player) .map(ClanPlayer::getDeaths) .orElse(-1)); register("kdr").scoreSupply(player -> getClanPlayer(player) .map(ClanPlayer::getKDR) .map(NumberConversions::round) .orElse(-1)); register("members").scoreSupply(player -> getClan(player) .map(Clan::getSize) .orElse(-1)); register("clan_kdr").scoreSupply(player -> getClan(player) .map(Clan::getTotalKDR) .map(NumberConversions::round) .orElse(-1)); register("clan_money").scoreSupply(player -> getClan(player) .map(Clan::getBalance) .map(NumberConversions::round) .orElse(-1)); register("rivals").scoreSupply(player -> getClan(player) .map(Clan::getRivals) .map(Collection::size) .orElse(-1)); register("allies").scoreSupply(player -> getClan(player) .map(Clan::getAllies) .map(Collection::size) .orElse(-1)); register("members_online").scoreSupply(player -> getClan(player) .map(Clan::getOnlineMembers) .map(Collection::size) .orElse(-1)); register("allies_total").scoreSupply(player -> getClan(player) .map(Clan::getAllAllyMembers) .map(Collection::size) .orElse(-1)); register("clan_kills").scoreSupply(player -> getClan(player) .map(clan -> clan.getTotalCivilian() + clan.getTotalNeutral() + clan.getTotalRival()) .orElse(-1)); }
Example #5
Source File: SimpleClansVariables.java From ScoreboardStats with MIT License | 4 votes |
private Optional<ClanPlayer> getClanPlayer(Player player) { return Optional.ofNullable(clanManager.getClanPlayer(player)); }
Example #6
Source File: SimpleClansVariables.java From ScoreboardStats with MIT License | 4 votes |
private Optional<Clan> getClan(Player player) { return getClanPlayer(player).map(ClanPlayer::getClan); }