From 44b3de91ddf76c3011d86c64711938d3f88dc5b4 Mon Sep 17 00:00:00 2001 From: Naman Date: Mon, 26 Mar 2018 16:43:15 -0500 Subject: [PATCH] adding new stuff --- .../java/com/massivecraft/factions/Conf.java | 10 +- .../com/massivecraft/factions/FPlayer.java | 15 +- .../com/massivecraft/factions/Faction.java | 31 ++ .../java/com/massivecraft/factions/P.java | 123 ++++- .../massivecraft/factions/cmd/CmdAdmin.java | 24 +- .../factions/cmd/CmdAnnounce.java | 3 +- .../com/massivecraft/factions/cmd/CmdBan.java | 1 + .../massivecraft/factions/cmd/CmdBanlist.java | 7 +- .../massivecraft/factions/cmd/CmdBoom.java | 3 +- .../massivecraft/factions/cmd/CmdBypass.java | 1 + .../massivecraft/factions/cmd/CmdChat.java | 11 +- .../massivecraft/factions/cmd/CmdChatSpy.java | 1 + .../massivecraft/factions/cmd/CmdClaim.java | 1 + .../massivecraft/factions/cmd/CmdClaimAt.java | 1 + .../factions/cmd/CmdClaimLine.java | 1 + .../massivecraft/factions/cmd/CmdConfig.java | 1 + .../massivecraft/factions/cmd/CmdCreate.java | 14 +- .../factions/cmd/CmdDeinvite.java | 1 + .../factions/cmd/CmdDescription.java | 3 +- .../massivecraft/factions/cmd/CmdDisband.java | 1 + .../com/massivecraft/factions/cmd/CmdFly.java | 249 ++++++++- .../massivecraft/factions/cmd/CmdHelp.java | 1 + .../massivecraft/factions/cmd/CmdHome.java | 1 + .../massivecraft/factions/cmd/CmdInvite.java | 1 + .../massivecraft/factions/cmd/CmdJoin.java | 1 + .../massivecraft/factions/cmd/CmdKick.java | 6 + .../massivecraft/factions/cmd/CmdLeave.java | 1 + .../massivecraft/factions/cmd/CmdList.java | 3 +- .../massivecraft/factions/cmd/CmdLock.java | 1 + .../com/massivecraft/factions/cmd/CmdMap.java | 1 + .../com/massivecraft/factions/cmd/CmdMod.java | 3 +- .../factions/cmd/CmdModifyPower.java | 1 + .../massivecraft/factions/cmd/CmdMoney.java | 1 + .../factions/cmd/CmdMoneyBalance.java | 7 +- .../factions/cmd/CmdMoneyDeposit.java | 1 + .../factions/cmd/CmdMoneyTransferFf.java | 1 + .../factions/cmd/CmdMoneyTransferFp.java | 1 + .../factions/cmd/CmdMoneyTransferPf.java | 1 + .../factions/cmd/CmdMoneyWithdraw.java | 1 + .../massivecraft/factions/cmd/CmdOpen.java | 3 +- .../massivecraft/factions/cmd/CmdOwner.java | 1 + .../factions/cmd/CmdOwnerList.java | 1 + .../factions/cmd/CmdPeaceful.java | 1 + .../massivecraft/factions/cmd/CmdPerm.java | 5 +- .../factions/cmd/CmdPermanent.java | 1 + .../factions/cmd/CmdPermanentPower.java | 1 + .../massivecraft/factions/cmd/CmdPower.java | 1 + .../factions/cmd/CmdPowerBoost.java | 1 + .../massivecraft/factions/cmd/CmdReload.java | 1 + .../factions/cmd/CmdSafeunclaimall.java | 1 + .../massivecraft/factions/cmd/CmdSaveAll.java | 1 + .../factions/cmd/CmdSeeChunk.java | 31 +- .../factions/cmd/CmdSetDefaultRole.java | 1 + .../factions/cmd/CmdSetMaxVaults.java | 1 + .../massivecraft/factions/cmd/CmdSethome.java | 3 +- .../massivecraft/factions/cmd/CmdShow.java | 78 ++- .../massivecraft/factions/cmd/CmdVault.java | 79 ++- .../massivecraft/factions/cmd/FCmdRoot.java | 47 +- .../massivecraft/factions/cmd/FCommand.java | 24 +- .../factions/cmd/FPromoteCommand.java | 19 +- .../factions/event/FactionCreateEvent.java | 28 +- .../factions/integration/Essentials.java | 5 +- .../listeners/FactionsChatListener.java | 42 +- .../listeners/FactionsEntityListener.java | 37 ++ .../listeners/FactionsPlayerListener.java | 310 +++++++++-- .../factions/struct/Permission.java | 10 + .../factions/struct/Relation.java | 2 - .../massivecraft/factions/struct/Role.java | 13 +- .../factions/util/AsciiCompass.java | 20 +- .../util/ClipPlaceholderAPIManager.java | 2 +- .../massivecraft/factions/util/MiscUtil.java | 6 + .../util/PermissionsMapTypeAdapter.java | 1 - .../factions/util/WarmUpUtil.java | 2 +- .../massivecraft/factions/util/WarpGUI.java | 12 +- .../massivecraft/factions/zcore/MPlugin.java | 1 + .../zcore/fperms/PermissableAction.java | 6 +- .../fperms/gui/PermissableActionGUI.java | 7 +- .../factions/zcore/persist/MemoryBoard.java | 3 +- .../factions/zcore/persist/MemoryFPlayer.java | 121 ++-- .../factions/zcore/persist/MemoryFaction.java | 90 ++- .../massivecraft/factions/zcore/util/TL.java | 209 +++++-- src/main/resources/config.yml | 516 +++++++++++++----- src/main/resources/lang.yml | 2 +- src/main/resources/plugin.yml | 30 +- 84 files changed, 1830 insertions(+), 481 deletions(-) diff --git a/src/main/java/com/massivecraft/factions/Conf.java b/src/main/java/com/massivecraft/factions/Conf.java index b364fd8d..9469a1a7 100644 --- a/src/main/java/com/massivecraft/factions/Conf.java +++ b/src/main/java/com/massivecraft/factions/Conf.java @@ -36,7 +36,8 @@ public class Conf { public static double powerOfflineLossLimit = 0.0; // players will no longer lose power from being offline once their power drops to this amount or less public static double powerFactionMax = 0.0; // if greater than 0, the cap on how much power a faction can have (additional power from players beyond that will act as a "buffer" of sorts) - public static String prefixAdmin = "**"; + public static String prefixAdmin = "***"; + public static String prefixCoLeader = "**"; public static String prefixMod = "*"; public static String prefixRecruit = "-"; public static String prefixNormal = "+"; @@ -73,7 +74,6 @@ public class Conf { public static boolean chatTagPadBefore = false; public static boolean chatTagPadAfter = true; public static String chatTagFormat = "%s" + ChatColor.WHITE; - public static boolean alwaysShowChatTag = true; public static String factionChatFormat = "%s:" + ChatColor.WHITE + " %s"; public static String allianceChatFormat = ChatColor.LIGHT_PURPLE + "%s:" + ChatColor.WHITE + " %s"; public static String truceChatFormat = ChatColor.DARK_PURPLE + "%s:" + ChatColor.WHITE + " %s"; @@ -160,12 +160,6 @@ public class Conf { public static Set warzoneDenyCommands = new LinkedHashSet<>(); public static Set wildernessDenyCommands = new LinkedHashSet<>(); - public static boolean defaultFlyPermEnemy = false; - public static boolean defaultFlyPermNeutral = false; - public static boolean defaultFlyPermTruce = false; - public static boolean defaultFlyPermAlly = true; - public static boolean defaultFlyPermMember = true; - public static boolean territoryDenyBuild = true; public static boolean territoryDenyBuildWhenOffline = true; public static boolean territoryPainBuild = false; diff --git a/src/main/java/com/massivecraft/factions/FPlayer.java b/src/main/java/com/massivecraft/factions/FPlayer.java index 3cfcd12d..552f908d 100644 --- a/src/main/java/com/massivecraft/factions/FPlayer.java +++ b/src/main/java/com/massivecraft/factions/FPlayer.java @@ -237,6 +237,10 @@ public interface FPlayer extends EconomyParticipator { public boolean attemptClaim(Faction forFaction, FLocation location, boolean notifyFailure); + public void setInVault(boolean status); + + public boolean isInVault(); + public void msg(String str, Object... args); public String getId(); @@ -275,6 +279,15 @@ public interface FPlayer extends EconomyParticipator { public boolean canFlyAtLocation(FLocation location); + public boolean isEnteringPassword(); + + public void setEnteringPassword(boolean toggle, String warp); + + public String getEnteringWarp(); + + public boolean checkIfNearbyEnemies(); + + // ------------------------------- // Warmups // ------------------------------- @@ -289,4 +302,4 @@ public interface FPlayer extends EconomyParticipator { public void clearWarmup(); -} +} \ No newline at end of file diff --git a/src/main/java/com/massivecraft/factions/Faction.java b/src/main/java/com/massivecraft/factions/Faction.java index 098e1f37..cd3062d4 100644 --- a/src/main/java/com/massivecraft/factions/Faction.java +++ b/src/main/java/com/massivecraft/factions/Faction.java @@ -12,6 +12,7 @@ import com.massivecraft.factions.zcore.fperms.PermissableAction; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; import java.util.*; import java.util.concurrent.ConcurrentHashMap; @@ -55,6 +56,10 @@ public interface Faction extends EconomyParticipator { public void deinvite(FPlayer fplayer); + public void setUpgrades(String key, int level); + + public int getUpgrade(String key); + public boolean isInvited(FPlayer fplayer); public void ban(FPlayer target, FPlayer banner); @@ -65,6 +70,32 @@ public interface Faction extends EconomyParticipator { public Set getBannedPlayers(); + public HashMap getRulesMap(); + + public void setRule(int index, String rule); + + public void addRule(String rule); + + public void removeRule(int index); + + public void clearRules(); + + public void setCheckpoint(Location location); + + public Location getCheckpoint(); + + public void addTnt(int amt); + + public void takeTnt(int amt); + + public Location getVault(); + + public void setVault(Location vaultLocation); + + public int getTnt(); + + public String getRule(int index); + public boolean getOpen(); public void setOpen(boolean isOpen); diff --git a/src/main/java/com/massivecraft/factions/P.java b/src/main/java/com/massivecraft/factions/P.java index 5018c130..b11743ca 100644 --- a/src/main/java/com/massivecraft/factions/P.java +++ b/src/main/java/com/massivecraft/factions/P.java @@ -1,6 +1,5 @@ package com.massivecraft.factions; -import com.earth2me.essentials.IEssentials; import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; import com.massivecraft.factions.cmd.CmdAutoHelp; @@ -16,25 +15,32 @@ import com.massivecraft.factions.zcore.MPlugin; import com.massivecraft.factions.zcore.fperms.Access; import com.massivecraft.factions.zcore.fperms.Permissable; import com.massivecraft.factions.zcore.fperms.PermissableAction; +import com.massivecraft.factions.zcore.fupgrades.CropUpgrades; +import com.massivecraft.factions.zcore.fupgrades.EXPUpgrade; +import com.massivecraft.factions.zcore.fupgrades.FUpgradesGUI; +import com.massivecraft.factions.zcore.fupgrades.SpawnerUpgrades; import com.massivecraft.factions.zcore.util.TextUtil; +import net.milkbowl.vault.economy.Economy; import net.milkbowl.vault.permission.Permission; -import org.bukkit.Bukkit; -import org.bukkit.OfflinePlayer; +import org.bukkit.*; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; +import org.bukkit.entity.ArmorStand; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.RegisteredServiceProvider; +import java.io.IOException; import java.lang.reflect.Modifier; import java.lang.reflect.Type; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; +import java.util.*; import java.util.logging.Level; + public class P extends MPlugin { // Our single plugin instance. @@ -55,7 +61,29 @@ public class P extends MPlugin { } private Integer AutoLeaveTask = null; + public void playSoundForAll(String sound) { + for (Player pl : Bukkit.getOnlinePlayers()) { + playSound(pl, sound); + } + } + public void playSoundForAll(List sounds) { + for (Player pl : Bukkit.getOnlinePlayers()) { + playSound(pl, sounds); + } + } + + public void playSound(Player p, List sounds) { + for (String sound : sounds) { + playSound(p, sound); + } + } + + public void playSound(Player p, String sound) { + float pitch = Float.valueOf(sound.split(":")[1]); + sound = sound.split(":")[0]; + p.playSound(p.getLocation(), Sound.valueOf(sound), pitch, 5.0F); + } // Commands public FCmdRoot cmdBase; public CmdAutoHelp cmdAutoHelp; @@ -68,6 +96,7 @@ public class P extends MPlugin { p = this; } + public boolean mc17 = false; @Override public void onEnable() { if (!preEnable()) { @@ -78,19 +107,8 @@ public class P extends MPlugin { // Load Conf from disk Conf.load(); - - // Check for Essentials - IEssentials ess = Essentials.setup(); - - // We set the option to TRUE by default in the config.yml for new users, - // BUT we leave it set to false for users updating that haven't added it to their config. - if (ess != null && getConfig().getBoolean("delete-ess-homes", false)) { - P.p.log(Level.INFO, "Found Essentials. We'll delete player homes in their old Faction's when kicked."); - getServer().getPluginManager().registerEvents(new EssentialsListener(ess), this); - } - + Essentials.setup(); hookedPlayervaults = setupPlayervaults(); - FPlayers.getInstance().load(); Factions.getInstance().load(); for (FPlayer fPlayer : FPlayers.getInstance().getAllFPlayers()) { @@ -122,13 +140,22 @@ public class P extends MPlugin { // start up task which runs the autoLeaveAfterDaysOfInactivity routine startAutoLeaveTask(false); + //Massive stats + MassiveStats update = new MassiveStats(this, 60); + + + mc17 = Bukkit.getServer().getClass().getPackage().getName().contains("1.7"); + // Register Event Handlers getServer().getPluginManager().registerEvents(new FactionsPlayerListener(this), this); getServer().getPluginManager().registerEvents(new FactionsChatListener(this), this); getServer().getPluginManager().registerEvents(new FactionsEntityListener(this), this); getServer().getPluginManager().registerEvents(new FactionsExploitListener(), this); getServer().getPluginManager().registerEvents(new FactionsBlockListener(this), this); - + getServer().getPluginManager().registerEvents(new FUpgradesGUI(), this); + getServer().getPluginManager().registerEvents(new EXPUpgrade(),this); + getServer().getPluginManager().registerEvents(new CropUpgrades(),this); + getServer().getPluginManager().registerEvents(new SpawnerUpgrades(),this); // since some other plugins execute commands directly through this command interface, provide it this.getCommand(this.refCommand).setExecutor(this); @@ -186,8 +213,7 @@ public class P extends MPlugin { Type accessTypeAdatper = new TypeToken>>() { }.getType(); - return new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().enableComplexMapKeySerialization().excludeFieldsWithModifiers(Modifier.TRANSIENT, Modifier.VOLATILE).registerTypeAdapter(accessTypeAdatper, new PermissionsMapTypeAdapter()).registerTypeAdapter(LazyLocation.class, new MyLocationTypeAdapter()).registerTypeAdapter(mapFLocToStringSetType, new MapFLocToStringSetTypeAdapter()).registerTypeAdapterFactory(EnumTypeAdapter.ENUM_FACTORY); - } + return new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().enableComplexMapKeySerialization().excludeFieldsWithModifiers(Modifier.TRANSIENT, Modifier.VOLATILE).registerTypeAdapter(accessTypeAdatper, new PermissionsMapTypeAdapter()).registerTypeAdapter(LazyLocation.class, new MyLocationTypeAdapter()).registerTypeAdapter(mapFLocToStringSetType, new MapFLocToStringSetTypeAdapter()).registerTypeAdapterFactory(EnumTypeAdapter.ENUM_FACTORY); } @Override public void onDisable() { @@ -222,7 +248,29 @@ public class P extends MPlugin { //Board.getInstance().forceSave(); Not sure why this was there as it's called after the board is already saved. Conf.save(); } + public ItemStack createItem(Material material, int amount, short datavalue, String name, List lore) { + ItemStack item = new ItemStack(material, amount, datavalue); + ItemMeta meta = item.getItemMeta(); + meta.setDisplayName(color(name)); + meta.setLore(colorList(lore)); + item.setItemMeta(meta); + return item; + } + public ItemStack createLazyItem(Material material, int amount, short datavalue, String name, String lore) { + ItemStack item = new ItemStack(material, amount, datavalue); + ItemMeta meta = item.getItemMeta(); + meta.setDisplayName(color(P.p.getConfig().getString(name))); + meta.setLore(colorList(P.p.getConfig().getStringList(lore))); + item.setItemMeta(meta); + return item; + } + + public Economy getEcon() { + RegisteredServiceProvider rsp = P.p.getServer().getServicesManager().getRegistration(Economy.class); + Economy econ = rsp.getProvider(); + return econ; + } @Override public boolean logPlayerCommands() { return Conf.logPlayerCommands; @@ -244,6 +292,24 @@ public class P extends MPlugin { return handleCommand(sender, cmd + " " + TextUtil.implode(Arrays.asList(split), " "), false); } + public void createTimedHologram(final Location location, String text, Long timeout){ + ArmorStand as = (ArmorStand) location.add(0.5,1,0.5).getWorld().spawnEntity(location, EntityType.ARMOR_STAND); //Spawn the ArmorStand + as.setVisible(false); //Makes the ArmorStand invisible + as.setGravity(false); //Make sure it doesn't fall + as.setCanPickupItems(false); //I'm not sure what happens if you leave this as it is, but you might as well disable it + as.setCustomName(P.p.color(text)); //Set this to the text you want + as.setCustomNameVisible(true); //This makes the text appear no matter if your looking at the entity or not + final ArmorStand armorStand = as; + Bukkit.getScheduler().scheduleSyncDelayedTask(P.p, new Runnable() { + @Override + public void run() { + Bukkit.broadcastMessage("removing stand"); + armorStand.remove(); + } + },timeout*20); + + } + // -------------------------------------------- // // Functions for other plugins to hook into @@ -336,6 +402,19 @@ public class P extends MPlugin { return me.getTitle().trim(); } + public String color(String line) { + line = ChatColor.translateAlternateColorCodes('&', line); + return line; + } + + //colors a string list + public List colorList(List lore) { + for (int i = 0; i <= lore.size()-1;i++){ + lore.set(i,color(lore.get(i))); + } + return lore; + } + // Get a list of all faction tags (names) public Set getFactionTags() { return Factions.getInstance().getFactionTags(); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdAdmin.java b/src/main/java/com/massivecraft/factions/cmd/CmdAdmin.java index 686a5c2c..212b9c45 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdAdmin.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdAdmin.java @@ -36,7 +36,10 @@ public class CmdAdmin extends FCommand { if (fyou == null) { return; } - + if (fme.getRole() == Role.ADMIN){ + fme.msg(TL.COMMAND_ADMIN_NOTADMIN); + return; + } boolean permAny = Permission.ADMIN_ANY.has(sender, false); Faction targetFaction = fyou.getFaction(); @@ -44,17 +47,20 @@ public class CmdAdmin extends FCommand { msg(TL.COMMAND_ADMIN_NOTMEMBER, fyou.describeTo(fme, true)); return; } - + if ((fyou == fme && fme.getRole() == Role.COLEADER) || (fme.getRole() == Role.COLEADER && fyou.getRole() == Role.ADMIN)){ + msg(TL.COMMAND_ADMIN_NOTADMIN); + return; + } if (fme != null && fme.getRole() != Role.ADMIN && !permAny) { msg(TL.COMMAND_ADMIN_NOTADMIN); return; } + if (fyou == fme && !permAny) { msg(TL.COMMAND_ADMIN_TARGETSELF); return; } - // only perform a FPlayerJoinEvent when newLeader isn't actually in the faction if (fyou.getFaction() != targetFaction) { FPlayerJoinEvent event = new FPlayerJoinEvent(FPlayers.getInstance().getByPlayer(me), targetFaction, FPlayerJoinEvent.PlayerJoinReason.LEADER); @@ -64,19 +70,23 @@ public class CmdAdmin extends FCommand { } } - FPlayer admin = targetFaction.getFPlayerAdmin(); + + FPlayer admin = targetFaction.getFPlayerAdmin(); // if target player is currently admin, demote and replace him + if (fyou == admin && fyou.getFaction().getSize() == 1){ + msg(TL.COMMAND_ADMIN_NOMEMBERS); + return; + } if (fyou == admin) { targetFaction.promoteNewLeader(); msg(TL.COMMAND_ADMIN_DEMOTES, fyou.describeTo(fme, true)); fyou.msg(TL.COMMAND_ADMIN_DEMOTED, senderIsConsole ? TL.GENERIC_SERVERADMIN.toString() : fme.describeTo(fyou, true)); return; } - // promote target player, and demote existing admin if one exists if (admin != null) { - admin.setRole(Role.MODERATOR); + admin.setRole(Role.COLEADER); } fyou.setRole(Role.ADMIN); msg(TL.COMMAND_ADMIN_PROMOTES, fyou.describeTo(fme, true)); @@ -91,4 +101,4 @@ public class CmdAdmin extends FCommand { return TL.COMMAND_ADMIN_DESCRIPTION; } -} +} \ No newline at end of file diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdAnnounce.java b/src/main/java/com/massivecraft/factions/cmd/CmdAnnounce.java index bc2c6bd4..296891d7 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdAnnounce.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdAnnounce.java @@ -22,7 +22,8 @@ public class CmdAnnounce extends FCommand { senderMustBePlayer = true; senderMustBeMember = true; - senderMustBeModerator = true; + senderMustBeModerator = false; + senderMustBeColeader = false; } @Override diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdBan.java b/src/main/java/com/massivecraft/factions/cmd/CmdBan.java index ff8d8350..e330e6c4 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdBan.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdBan.java @@ -27,6 +27,7 @@ public class CmdBan extends FCommand { senderMustBePlayer = true; senderMustBeMember = false; senderMustBeModerator = false; + senderMustBeColeader = false; senderMustBeAdmin = false; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdBanlist.java b/src/main/java/com/massivecraft/factions/cmd/CmdBanlist.java index cef2d57f..42d8c7e5 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdBanlist.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdBanlist.java @@ -42,6 +42,11 @@ public class CmdBanlist extends FCommand { return; } + if (target == null) { + sender.sendMessage(TL.COMMAND_BANLIST_INVALID.format(argAsString(0))); + return; + } + List lines = new ArrayList<>(); lines.add(TL.COMMAND_BANLIST_HEADER.format(target.getBannedPlayers().size(), target.getTag(myFaction))); int i = 1; @@ -64,4 +69,4 @@ public class CmdBanlist extends FCommand { public TL getUsageTranslation() { return TL.COMMAND_BANLIST_DESCRIPTION; } -} +} \ No newline at end of file diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdBoom.java b/src/main/java/com/massivecraft/factions/cmd/CmdBoom.java index 7a579bfd..fcbe859f 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdBoom.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdBoom.java @@ -20,7 +20,8 @@ public class CmdBoom extends FCommand { senderMustBePlayer = true; senderMustBeMember = false; - senderMustBeModerator = true; + senderMustBeModerator = false; + senderMustBeColeader = true; senderMustBeAdmin = false; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdBypass.java b/src/main/java/com/massivecraft/factions/cmd/CmdBypass.java index 01044129..6c7ea644 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdBypass.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdBypass.java @@ -19,6 +19,7 @@ public class CmdBypass extends FCommand { senderMustBePlayer = true; senderMustBeMember = false; senderMustBeModerator = false; + senderMustBeColeader = false; senderMustBeAdmin = false; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdChat.java b/src/main/java/com/massivecraft/factions/cmd/CmdChat.java index 9e4a27f9..6b169198 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdChat.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdChat.java @@ -4,6 +4,7 @@ import com.massivecraft.factions.Conf; import com.massivecraft.factions.struct.ChatMode; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.zcore.util.TL; +import org.bukkit.Bukkit; public class CmdChat extends FCommand { @@ -21,6 +22,7 @@ public class CmdChat extends FCommand { senderMustBePlayer = true; senderMustBeMember = true; senderMustBeModerator = false; + senderMustBeColeader = false; senderMustBeAdmin = false; } @@ -36,7 +38,7 @@ public class CmdChat extends FCommand { if (modeString != null) { modeString = modeString.toLowerCase(); - if (modeString.startsWith("m")) { + if (modeString.startsWith("m")){ modeTarget = ChatMode.MOD; } else if (modeString.startsWith("p")) { modeTarget = ChatMode.PUBLIC; @@ -54,9 +56,10 @@ public class CmdChat extends FCommand { fme.setChatMode(modeTarget); - if (fme.getChatMode() == ChatMode.MOD) { + if (fme.getChatMode() == ChatMode.MOD) + { msg(TL.COMMAND_CHAT_MODE_MOD); - } else if (fme.getChatMode() == ChatMode.PUBLIC) { + }else if (fme.getChatMode() == ChatMode.PUBLIC) { msg(TL.COMMAND_CHAT_MODE_PUBLIC); } else if (fme.getChatMode() == ChatMode.ALLIANCE) { msg(TL.COMMAND_CHAT_MODE_ALLIANCE); @@ -71,4 +74,4 @@ public class CmdChat extends FCommand { public TL getUsageTranslation() { return TL.COMMAND_CHAT_DESCRIPTION; } -} +} \ No newline at end of file diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdChatSpy.java b/src/main/java/com/massivecraft/factions/cmd/CmdChatSpy.java index c5e35fa1..97231e66 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdChatSpy.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdChatSpy.java @@ -18,6 +18,7 @@ public class CmdChatSpy extends FCommand { senderMustBePlayer = true; senderMustBeMember = false; senderMustBeModerator = false; + senderMustBeColeader = false; senderMustBeAdmin = false; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdClaim.java b/src/main/java/com/massivecraft/factions/cmd/CmdClaim.java index 5bcddf15..93e8da2e 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdClaim.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdClaim.java @@ -24,6 +24,7 @@ public class CmdClaim extends FCommand { senderMustBePlayer = true; senderMustBeMember = false; senderMustBeModerator = false; + senderMustBeColeader = false; senderMustBeAdmin = false; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdClaimAt.java b/src/main/java/com/massivecraft/factions/cmd/CmdClaimAt.java index eeba9054..e320cdde 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdClaimAt.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdClaimAt.java @@ -20,6 +20,7 @@ public class CmdClaimAt extends FCommand { senderMustBePlayer = true; senderMustBeMember = true; senderMustBeModerator = false; + senderMustBeColeader = false; senderMustBeAdmin = false; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdClaimLine.java b/src/main/java/com/massivecraft/factions/cmd/CmdClaimLine.java index 0f6112f0..025b05ba 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdClaimLine.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdClaimLine.java @@ -28,6 +28,7 @@ public class CmdClaimLine extends FCommand { senderMustBePlayer = true; senderMustBeMember = false; senderMustBeModerator = false; + senderMustBeColeader = false; senderMustBeAdmin = false; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdConfig.java b/src/main/java/com/massivecraft/factions/cmd/CmdConfig.java index aa1639c2..8cf6179e 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdConfig.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdConfig.java @@ -32,6 +32,7 @@ public class CmdConfig extends FCommand { senderMustBePlayer = false; senderMustBeMember = false; senderMustBeModerator = false; + senderMustBeColeader = false; senderMustBeAdmin = false; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdCreate.java b/src/main/java/com/massivecraft/factions/cmd/CmdCreate.java index fb106360..8820531d 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdCreate.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdCreate.java @@ -27,6 +27,7 @@ public class CmdCreate extends FCommand { senderMustBePlayer = true; senderMustBeMember = false; senderMustBeModerator = false; + senderMustBeColeader = false; senderMustBeAdmin = false; } @@ -55,6 +56,13 @@ public class CmdCreate extends FCommand { return; } + // trigger the faction creation event (cancellable) + FactionCreateEvent createEvent = new FactionCreateEvent(me, tag); + Bukkit.getServer().getPluginManager().callEvent(createEvent); + if (createEvent.isCancelled()) { + return; + } + // then make 'em pay (if applicable) if (!payForCommand(Conf.econCostCreate, TL.COMMAND_CREATE_TOCREATE, TL.COMMAND_CREATE_FORCREATE)) { return; @@ -80,10 +88,6 @@ public class CmdCreate extends FCommand { fme.setRole(Role.ADMIN); fme.setFaction(faction); - // trigger the faction creation event - FactionCreateEvent createEvent = new FactionCreateEvent(me, tag, faction); - Bukkit.getServer().getPluginManager().callEvent(createEvent); - for (FPlayer follower : FPlayers.getInstance().getOnlinePlayers()) { follower.msg(TL.COMMAND_CREATE_CREATED, fme.describeTo(follower, true), faction.getTag(follower)); } @@ -100,4 +104,4 @@ public class CmdCreate extends FCommand { return TL.COMMAND_CREATE_DESCRIPTION; } -} +} \ No newline at end of file diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdDeinvite.java b/src/main/java/com/massivecraft/factions/cmd/CmdDeinvite.java index 4b603913..d2fef309 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdDeinvite.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdDeinvite.java @@ -24,6 +24,7 @@ public class CmdDeinvite extends FCommand { senderMustBePlayer = true; senderMustBeMember = false; senderMustBeModerator = true; + senderMustBeColeader = false; senderMustBeAdmin = false; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdDescription.java b/src/main/java/com/massivecraft/factions/cmd/CmdDescription.java index 7395e43e..98dc3509 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdDescription.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdDescription.java @@ -23,7 +23,8 @@ public class CmdDescription extends FCommand { senderMustBePlayer = true; senderMustBeMember = false; - senderMustBeModerator = true; + senderMustBeModerator = false; + senderMustBeColeader = true; senderMustBeAdmin = false; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdDisband.java b/src/main/java/com/massivecraft/factions/cmd/CmdDisband.java index 429313ea..36a3eded 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdDisband.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdDisband.java @@ -26,6 +26,7 @@ public class CmdDisband extends FCommand { senderMustBePlayer = false; senderMustBeMember = false; senderMustBeModerator = false; + senderMustBeColeader = false; senderMustBeAdmin = false; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdFly.java b/src/main/java/com/massivecraft/factions/cmd/CmdFly.java index c9881ca8..3e4195d6 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdFly.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdFly.java @@ -1,14 +1,25 @@ package com.massivecraft.factions.cmd; -import com.massivecraft.factions.Board; -import com.massivecraft.factions.Faction; -import com.massivecraft.factions.P; +import com.massivecraft.factions.*; import com.massivecraft.factions.struct.Permission; +import com.massivecraft.factions.struct.Relation; +import com.massivecraft.factions.util.Particle.ParticleEffect; import com.massivecraft.factions.util.WarmUpUtil; import com.massivecraft.factions.zcore.util.TL; +import org.bukkit.Bukkit; +import org.bukkit.GameMode; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; + +import java.sql.BatchUpdateException; +import java.util.*; public class CmdFly extends FCommand { + + public static HashMap flyMap = new HashMap(); + public int id = -1; + public int flyid = -1; public CmdFly() { super(); this.aliases.add("fly"); @@ -22,28 +33,233 @@ public class CmdFly extends FCommand { @Override public void perform() { + // Disabled by default. + if (!P.p.getConfig().getBoolean("enable-faction-flight", false)) { + fme.msg(TL.COMMAND_FLY_DISABLED); + return; + } + + FLocation myfloc = new FLocation(me.getLocation()); + Faction toFac = Board.getInstance().getFactionAt(myfloc); + if (Board.getInstance().getFactionAt(myfloc) != fme.getFaction()){ + if (!me.hasPermission("factions.fly.wilderness") && toFac.isWilderness()) { + fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme)); + return; + } + if (!me.hasPermission("factions.fly.safezone") && toFac.isSafeZone()) { + fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme)); + return; + } + if (!me.hasPermission("factions.fly.warzone") && toFac.isWarZone()) { + fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme)); + return; + } + if (!me.hasPermission("factions.fly.enemy") && toFac.getRelationTo(myFaction)== Relation.ENEMY){ + fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme)); + return; + } + if (!me.hasPermission("factions.fly.ally") && toFac.getRelationTo(myFaction)== Relation.ALLY){ + fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme)); + return; + } + if (!me.hasPermission("factions.fly.truce") && toFac.getRelationTo(myFaction)== Relation.TRUCE){ + fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme)); + return; + } + if (!me.hasPermission("factions.fly.neutral") && toFac.getRelationTo(myFaction) == Relation.NEUTRAL) { + fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme)); + return; + } + } + + + List entities = me.getNearbyEntities(16,256,16); + for (int i = 0; i <= entities.size() -1;i++) + { + if (entities.get(i) instanceof Player) + { + Player eplayer = (Player) entities.get(i); + FPlayer efplayer = FPlayers.getInstance().getByPlayer(eplayer); + if (efplayer.getRelationTo(fme) == Relation.ENEMY) + { + fme.msg(TL.COMMAND_FLY_CHECK_ENEMY); + return; + } + } + } + + + if (args.size() == 0) { if (!fme.canFlyAtLocation() && !fme.isFlying()) { - Faction factionAtLocation = Board.getInstance().getFactionAt(fme.getLastStoodAt()); - fme.msg(TL.COMMAND_FLY_NO_ACCESS, factionAtLocation.getTag(fme)); - return; + if (!me.hasPermission("factions.fly.wilderness") && toFac.isWilderness()) { + fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme)); + return; + } else if (!me.hasPermission("factions.fly.safezone") && toFac.isSafeZone()) { + fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme)); + return; + } else if (!me.hasPermission("factions.fly.warzone") && toFac.isWarZone()) { + fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme)); + return; + } else if (!me.hasPermission("factions.fly.enemy") && toFac.getRelationTo(myFaction) == Relation.ENEMY) { + fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme)); + return; + } else if (!me.hasPermission("factions.fly.ally") && toFac.getRelationTo(myFaction) == Relation.ALLY) { + fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme)); + return; + } else if (!me.hasPermission("factions.fly.truce") && toFac.getRelationTo(myFaction) == Relation.TRUCE) { + fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme)); + } else if (!me.hasPermission("factions.fly.neutral") && toFac.getRelationTo(myFaction) == Relation.NEUTRAL) { + fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme)); + } + } - toggleFlight(!fme.isFlying()); + toggleFlight(!fme.isFlying(),me); } else if (args.size() == 1) { if (!fme.canFlyAtLocation() && argAsBool(0)) { - Faction factionAtLocation = Board.getInstance().getFactionAt(fme.getLastStoodAt()); - fme.msg(TL.COMMAND_FLY_NO_ACCESS, factionAtLocation.getTag(fme)); - return; + if (!me.hasPermission("factions.fly.wilderness") && toFac.isWilderness()) { + fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme)); + return; + } else if (!me.hasPermission("factions.fly.safezone") && toFac.isSafeZone()) { + fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme)); + return; + } else if (!me.hasPermission("factions.fly.warzone") && toFac.isWarZone()) { + fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme)); + return; + } else if (!me.hasPermission("factions.fly.enemy") && toFac.getRelationTo(myFaction) == Relation.ENEMY) { + fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme)); + return; + } else if (!me.hasPermission("factions.fly.ally") && toFac.getRelationTo(myFaction) == Relation.ALLY) { + fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme)); + return; + } else if (!me.hasPermission("factions.fly.truce") && toFac.getRelationTo(myFaction) == Relation.TRUCE) { + fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme)); + } else if (!me.hasPermission("factions.fly.neutral") && toFac.getRelationTo(myFaction) == Relation.NEUTRAL) { + fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme)); + } + } - toggleFlight(argAsBool(0)); + + toggleFlight(argAsBool(0),me); } } - private void toggleFlight(final boolean toggle) { + public boolean isInFlightChecker(Player player){ + if (flyMap.containsKey(player.getName())){ + return true; + } else { + return false; + } + } + + + public void startParticles(){ + id = Bukkit.getScheduler().scheduleSyncRepeatingTask(P.p, new Runnable() { + @Override + public void run() { + for(String name : flyMap.keySet()){ + Player player = Bukkit.getPlayer(name); + if (player == null){ + continue; + } + if (!player.isFlying()){ + continue; + } + ParticleEffect.CLOUD.display((float) 0.1,(float) 0.1,(float) 0.1,(float) 0.1,3,player.getLocation(),32); + + } + if (flyMap.keySet().size() == 0){ + Bukkit.getScheduler().cancelTask(id); + id = -1; + } + } + },20L,40L); + } + + public void startFlyCheck(){ + flyid = Bukkit.getScheduler().scheduleSyncRepeatingTask(P.p, new Runnable() { + @Override + public void run() { + for (String name : flyMap.keySet()) { + Player player = Bukkit.getPlayer(name); + if (player == null) { continue;} + FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player); + + if (fPlayer == null) { continue; } + if (player.getGameMode() == GameMode.CREATIVE || player.getGameMode() == GameMode.SPECTATOR){ + continue; + } + Faction myFaction = fPlayer.getFaction(); + if (myFaction.isWilderness()){ + fPlayer.setFlying(false); + flyMap.remove(name); + continue; + } + if(fPlayer.checkIfNearbyEnemies()){ + continue; + } + FLocation myFloc = new FLocation(player.getLocation()); + Faction toFac = Board.getInstance().getFactionAt(myFloc); + if (Board.getInstance().getFactionAt(myFloc) != myFaction) { + if (!checkBypassPerms(fPlayer,player,toFac)){ + fPlayer.setFlying(false); + flyMap.remove(name); + continue; + } + + } + + + checkTaskState(); + } + } + },20L,20L); + } + + + + private boolean checkBypassPerms(FPlayer fplayer, Player player,Faction toFac){ + if (player.hasPermission("factions.fly.wilderness") && toFac.isWilderness()){ + return true; + } + if (player.hasPermission("factions.fly.warzone") && toFac.isWarZone()){ + return true; + } + if (player.hasPermission("factions.fly.safezone") && toFac.isSafeZone()){ + return true; + } + if (player.hasPermission("factions.fly.enemy") && toFac.getRelationTo(fplayer.getFaction()) == Relation.ENEMY) { + return true; + } + if (player.hasPermission("factions.fly.ally") && toFac.getRelationTo(fplayer.getFaction()) == Relation.ALLY) { + return true; + } + if (player.hasPermission("factions.fly.truce") && toFac.getRelationTo(fplayer.getFaction()) == Relation.TRUCE) { + return true; + } + if (player.hasPermission("factions.fly.neutral") && toFac.getRelationTo(fplayer.getFaction()) == Relation.NEUTRAL) { + return true; + } + return false; + } + + public void checkTaskState(){ + if (flyMap.keySet().size() == 0) { + Bukkit.getScheduler().cancelTask(flyid); + flyid = -1; + } + } + + + + + + private void toggleFlight(final boolean toggle, final Player player) { if (!toggle) { fme.setFlying(false); + flyMap.remove(player.getName()); return; } @@ -51,6 +267,15 @@ public class CmdFly extends FCommand { @Override public void run() { fme.setFlying(true); + flyMap.put(player.getName(),true); + if (id == -1){ + if (P.p.getConfig().getBoolean("ffly.Particles.Enabled")){ + startParticles(); + } + } + if (flyid == -1){ + startFlyCheck(); + } } }, this.p.getConfig().getLong("warmups.f-fly", 0)); } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdHelp.java b/src/main/java/com/massivecraft/factions/cmd/CmdHelp.java index e239b831..5f2034f4 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdHelp.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdHelp.java @@ -28,6 +28,7 @@ public class CmdHelp extends FCommand { senderMustBePlayer = false; senderMustBeMember = false; senderMustBeModerator = false; + senderMustBeColeader = false; senderMustBeAdmin = false; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdHome.java b/src/main/java/com/massivecraft/factions/cmd/CmdHome.java index 2891d529..2d861b22 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdHome.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdHome.java @@ -31,6 +31,7 @@ public class CmdHome extends FCommand { senderMustBePlayer = true; senderMustBeMember = true; senderMustBeModerator = false; + senderMustBeColeader = false; senderMustBeAdmin = false; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdInvite.java b/src/main/java/com/massivecraft/factions/cmd/CmdInvite.java index f28c4c45..02fac6d2 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdInvite.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdInvite.java @@ -26,6 +26,7 @@ public class CmdInvite extends FCommand { senderMustBePlayer = true; senderMustBeMember = false; senderMustBeModerator = false; + senderMustBeColeader = false; senderMustBeAdmin = false; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdJoin.java b/src/main/java/com/massivecraft/factions/cmd/CmdJoin.java index 5d492084..6642fcc7 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdJoin.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdJoin.java @@ -21,6 +21,7 @@ public class CmdJoin extends FCommand { senderMustBePlayer = true; senderMustBeMember = false; senderMustBeModerator = false; + senderMustBeColeader = false; senderMustBeAdmin = false; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdKick.java b/src/main/java/com/massivecraft/factions/cmd/CmdKick.java index 6f242bcc..73bb031e 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdKick.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdKick.java @@ -29,6 +29,7 @@ public class CmdKick extends FCommand { senderMustBePlayer = true; senderMustBeMember = false; senderMustBeModerator = false; + senderMustBeColeader = false; senderMustBeAdmin = false; } @@ -65,6 +66,11 @@ public class CmdKick extends FCommand { return; } + if ((fme.getRole() == Role.MODERATOR || fme.getRole() == Role.COLEADER) && toKick.getRole() == Role.ADMIN){ + msg(TL.COMMAND_KICK_INSUFFICIENTRANK); + return; + } + // players with admin-level "disband" permission can bypass these requirements if (!Permission.KICK_ANY.has(sender)) { diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdLeave.java b/src/main/java/com/massivecraft/factions/cmd/CmdLeave.java index 635b1da4..f5b6b29e 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdLeave.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdLeave.java @@ -18,6 +18,7 @@ public class CmdLeave extends FCommand { senderMustBePlayer = true; senderMustBeMember = true; senderMustBeModerator = false; + senderMustBeColeader = false; senderMustBeAdmin = false; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdList.java b/src/main/java/com/massivecraft/factions/cmd/CmdList.java index ba1437af..d8dfec88 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdList.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdList.java @@ -34,6 +34,7 @@ public class CmdList extends FCommand { senderMustBePlayer = false; senderMustBeMember = false; senderMustBeModerator = false; + senderMustBeColeader = false; senderMustBeAdmin = false; } @@ -50,7 +51,7 @@ public class CmdList extends FCommand { factionList.remove(Factions.getInstance().getWarZone()); // remove exempt factions - if (!sender.hasPermission("factions.show.bypassexempt")) { + if (!fme.getPlayer().hasPermission("factions.show.bypassexempt")) { List exemptFactions = P.p.getConfig().getStringList("show-exempt"); Iterator factionIterator = factionList.iterator(); while (factionIterator.hasNext()) { diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdLock.java b/src/main/java/com/massivecraft/factions/cmd/CmdLock.java index 4b195baa..c27603bd 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdLock.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdLock.java @@ -25,6 +25,7 @@ public class CmdLock extends FCommand { senderMustBePlayer = false; senderMustBeMember = false; senderMustBeModerator = false; + senderMustBeColeader = false; senderMustBeAdmin = false; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdMap.java b/src/main/java/com/massivecraft/factions/cmd/CmdMap.java index fcc6ab7b..6b87bd66 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdMap.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdMap.java @@ -22,6 +22,7 @@ public class CmdMap extends FCommand { senderMustBePlayer = true; senderMustBeMember = false; senderMustBeModerator = false; + senderMustBeColeader = false; senderMustBeAdmin = false; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdMod.java b/src/main/java/com/massivecraft/factions/cmd/CmdMod.java index 488b53b3..cc119944 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdMod.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdMod.java @@ -27,7 +27,8 @@ public class CmdMod extends FCommand { senderMustBePlayer = false; senderMustBeMember = true; senderMustBeModerator = false; - senderMustBeAdmin = true; + senderMustBeColeader = true; + senderMustBeAdmin = false; } @Override diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdModifyPower.java b/src/main/java/com/massivecraft/factions/cmd/CmdModifyPower.java index 7c5f75d5..361e632f 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdModifyPower.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdModifyPower.java @@ -23,6 +23,7 @@ public class CmdModifyPower extends FCommand { this.senderMustBeAdmin = false; this.senderMustBePlayer = false; this.senderMustBeMember = false; + senderMustBeColeader = false; this.senderMustBeModerator = false; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdMoney.java b/src/main/java/com/massivecraft/factions/cmd/CmdMoney.java index a1a3d630..c26d1654 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdMoney.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdMoney.java @@ -24,6 +24,7 @@ public class CmdMoney extends FCommand { senderMustBePlayer = false; senderMustBeMember = false; senderMustBeModerator = false; + senderMustBeColeader = false; senderMustBeAdmin = false; this.helpLong.add(p.txt.parseTags(TL.COMMAND_MONEY_LONG.toString())); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdMoneyBalance.java b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyBalance.java index 3a79e91b..5459b429 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdMoneyBalance.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyBalance.java @@ -1,5 +1,6 @@ package com.massivecraft.factions.cmd; +import com.earth2me.essentials.Console; import com.massivecraft.factions.Faction; import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.struct.Permission; @@ -38,7 +39,9 @@ public class CmdMoneyBalance extends FCommand { return; } - Econ.sendBalanceInfo(fme, faction); + if (fme != null) { + Econ.sendBalanceInfo(fme, faction); + } } @Override @@ -46,4 +49,4 @@ public class CmdMoneyBalance extends FCommand { return TL.COMMAND_MONEYBALANCE_DESCRIPTION; } -} +} \ No newline at end of file diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdMoneyDeposit.java b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyDeposit.java index 3ab83bbe..c6b1ac4f 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdMoneyDeposit.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyDeposit.java @@ -24,6 +24,7 @@ public class CmdMoneyDeposit extends FCommand { senderMustBePlayer = true; senderMustBeMember = false; senderMustBeModerator = false; + senderMustBeColeader = false; senderMustBeAdmin = false; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferFf.java b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferFf.java index ad9d067b..39d96100 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferFf.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferFf.java @@ -26,6 +26,7 @@ public class CmdMoneyTransferFf extends FCommand { senderMustBePlayer = false; senderMustBeMember = false; senderMustBeModerator = false; + senderMustBeColeader = false; senderMustBeAdmin = false; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferFp.java b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferFp.java index f15e9274..4c7bae34 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferFp.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferFp.java @@ -25,6 +25,7 @@ public class CmdMoneyTransferFp extends FCommand { senderMustBePlayer = false; senderMustBeMember = false; senderMustBeModerator = false; + senderMustBeColeader = false; senderMustBeAdmin = false; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferPf.java b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferPf.java index 939e100d..a51f49e5 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferPf.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferPf.java @@ -25,6 +25,7 @@ public class CmdMoneyTransferPf extends FCommand { senderMustBePlayer = false; senderMustBeMember = false; senderMustBeModerator = false; + senderMustBeColeader = false; senderMustBeAdmin = false; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdMoneyWithdraw.java b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyWithdraw.java index d4f6d8f9..f078f4c3 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdMoneyWithdraw.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyWithdraw.java @@ -25,6 +25,7 @@ public class CmdMoneyWithdraw extends FCommand { senderMustBePlayer = true; senderMustBeMember = false; senderMustBeModerator = false; + senderMustBeColeader = false; senderMustBeAdmin = false; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdOpen.java b/src/main/java/com/massivecraft/factions/cmd/CmdOpen.java index 5f6239a3..460e594b 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdOpen.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdOpen.java @@ -20,7 +20,8 @@ public class CmdOpen extends FCommand { senderMustBePlayer = true; senderMustBeMember = false; - senderMustBeModerator = true; + senderMustBeModerator = false; + senderMustBeColeader = true; senderMustBeAdmin = false; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdOwner.java b/src/main/java/com/massivecraft/factions/cmd/CmdOwner.java index f4710c14..35038a13 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdOwner.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdOwner.java @@ -21,6 +21,7 @@ public class CmdOwner extends FCommand { senderMustBePlayer = true; senderMustBeMember = false; senderMustBeModerator = false; + senderMustBeColeader = false; senderMustBeAdmin = false; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdOwnerList.java b/src/main/java/com/massivecraft/factions/cmd/CmdOwnerList.java index ccf737f5..4bcb5e02 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdOwnerList.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdOwnerList.java @@ -22,6 +22,7 @@ public class CmdOwnerList extends FCommand { senderMustBePlayer = true; senderMustBeMember = false; senderMustBeModerator = false; + senderMustBeColeader = false; senderMustBeAdmin = false; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdPeaceful.java b/src/main/java/com/massivecraft/factions/cmd/CmdPeaceful.java index 10b82220..ca966050 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdPeaceful.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdPeaceful.java @@ -21,6 +21,7 @@ public class CmdPeaceful extends FCommand { senderMustBePlayer = false; senderMustBeMember = false; senderMustBeModerator = false; + senderMustBeColeader = false; senderMustBeAdmin = false; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdPerm.java b/src/main/java/com/massivecraft/factions/cmd/CmdPerm.java index b0e317cc..9ad44fa8 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdPerm.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdPerm.java @@ -28,12 +28,13 @@ public class CmdPerm extends FCommand { this.optionalArgs.put("action", "action"); this.optionalArgs.put("access", "access"); - this.permission = Permission.PERMISSIONS.node; + this.disableOnLock = true; senderMustBePlayer = true; senderMustBeMember = true; senderMustBeModerator = false; + senderMustBeColeader = false; senderMustBeAdmin = true; } @@ -122,4 +123,4 @@ public class CmdPerm extends FCommand { return TL.COMMAND_PERM_DESCRIPTION; } -} +} \ No newline at end of file diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdPermanent.java b/src/main/java/com/massivecraft/factions/cmd/CmdPermanent.java index 0652dd29..19be2914 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdPermanent.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdPermanent.java @@ -23,6 +23,7 @@ public class CmdPermanent extends FCommand { senderMustBePlayer = false; senderMustBeMember = false; senderMustBeModerator = false; + senderMustBeColeader = false; senderMustBeAdmin = false; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdPermanentPower.java b/src/main/java/com/massivecraft/factions/cmd/CmdPermanentPower.java index a6aa65bb..5e0018d5 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdPermanentPower.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdPermanentPower.java @@ -19,6 +19,7 @@ public class CmdPermanentPower extends FCommand { senderMustBePlayer = false; senderMustBeMember = false; senderMustBeModerator = false; + senderMustBeColeader = false; senderMustBeAdmin = false; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdPower.java b/src/main/java/com/massivecraft/factions/cmd/CmdPower.java index f8061d62..6bf5fb37 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdPower.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdPower.java @@ -21,6 +21,7 @@ public class CmdPower extends FCommand { senderMustBePlayer = false; senderMustBeMember = false; senderMustBeModerator = false; + senderMustBeColeader = false; senderMustBeAdmin = false; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdPowerBoost.java b/src/main/java/com/massivecraft/factions/cmd/CmdPowerBoost.java index c50c0de2..8cbe5939 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdPowerBoost.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdPowerBoost.java @@ -22,6 +22,7 @@ public class CmdPowerBoost extends FCommand { senderMustBePlayer = false; senderMustBeMember = false; senderMustBeModerator = false; + senderMustBeColeader = false; senderMustBeAdmin = false; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdReload.java b/src/main/java/com/massivecraft/factions/cmd/CmdReload.java index a3febb82..7c855b83 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdReload.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdReload.java @@ -17,6 +17,7 @@ public class CmdReload extends FCommand { senderMustBePlayer = false; senderMustBeMember = false; senderMustBeModerator = false; + senderMustBeColeader = false; senderMustBeAdmin = false; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdSafeunclaimall.java b/src/main/java/com/massivecraft/factions/cmd/CmdSafeunclaimall.java index 03ec2cd5..908a6529 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdSafeunclaimall.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdSafeunclaimall.java @@ -24,6 +24,7 @@ public class CmdSafeunclaimall extends FCommand { senderMustBePlayer = false; senderMustBeMember = false; senderMustBeModerator = false; + senderMustBeColeader = false; senderMustBeAdmin = false; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdSaveAll.java b/src/main/java/com/massivecraft/factions/cmd/CmdSaveAll.java index 6465daf1..98c23bb1 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdSaveAll.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdSaveAll.java @@ -23,6 +23,7 @@ public class CmdSaveAll extends FCommand { senderMustBePlayer = false; senderMustBeMember = false; senderMustBeModerator = false; + senderMustBeColeader = false; senderMustBeAdmin = false; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdSeeChunk.java b/src/main/java/com/massivecraft/factions/cmd/CmdSeeChunk.java index 87a5d701..4fd10652 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdSeeChunk.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdSeeChunk.java @@ -1,5 +1,6 @@ package com.massivecraft.factions.cmd; +import com.darkblade12.particleeffect.ParticleEffect; import com.massivecraft.factions.FLocation; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.util.VisualizeUtil; @@ -9,8 +10,14 @@ import org.bukkit.Material; import org.bukkit.World; import org.bukkit.entity.Player; +import java.util.logging.Level; + public class CmdSeeChunk extends FCommand { + private boolean useParticles; + private int length; + private ParticleEffect effect; + public CmdSeeChunk() { super(); aliases.add("seechunk"); @@ -22,6 +29,16 @@ public class CmdSeeChunk extends FCommand { senderMustBeMember = false; senderMustBeModerator = false; senderMustBeAdmin = false; + + this.useParticles = p.getConfig().getBoolean("see-chunk.particles", true); + this.length = p.getConfig().getInt("see-chunk.length", 10); + String effectName = p.getConfig().getString("see-chunk.particle", "BARRIER"); + this.effect = ParticleEffect.fromName(effectName.toUpperCase()); + if (this.effect == null) { + this.effect = ParticleEffect.BARRIER; + } + + p.log(Level.INFO, "Using %s as the ParticleEffect for /f sc", effect.getName()); } @Override @@ -51,15 +68,19 @@ public class CmdSeeChunk extends FCommand { showPillar(me, world, blockX, blockZ); } - @SuppressWarnings("deprecation") - public static void showPillar(Player player, World world, int blockX, int blockZ) { + private void showPillar(Player player, World world, int blockX, int blockZ) { for (int blockY = 0; blockY < player.getLocation().getBlockY() + 30; blockY++) { Location loc = new Location(world, blockX, blockY, blockZ); if (loc.getBlock().getType() != Material.AIR) { continue; } - int typeId = blockY % 5 == 0 ? Material.REDSTONE_LAMP_ON.getId() : Material.STAINED_GLASS.getId(); - VisualizeUtil.addLocation(player, loc, typeId); + + if (useParticles) { + this.effect.display(0, 0, 0, 10, 1, loc, player); + } else { + int typeId = blockY % 5 == 0 ? Material.REDSTONE_LAMP_ON.getId() : Material.STAINED_GLASS.getId(); + VisualizeUtil.addLocation(player, loc, typeId); + } } } @@ -68,4 +89,4 @@ public class CmdSeeChunk extends FCommand { return TL.GENERIC_PLACEHOLDER; } -} +} \ No newline at end of file diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdSetDefaultRole.java b/src/main/java/com/massivecraft/factions/cmd/CmdSetDefaultRole.java index dbc79678..1a4ae4ac 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdSetDefaultRole.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdSetDefaultRole.java @@ -17,6 +17,7 @@ public class CmdSetDefaultRole extends FCommand { this.senderMustBeAdmin = true; this.senderMustBePlayer = true; + senderMustBeColeader = false; this.permission = Permission.DEFAULTRANK.node; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdSetMaxVaults.java b/src/main/java/com/massivecraft/factions/cmd/CmdSetMaxVaults.java index ee1b9129..168e17b2 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdSetMaxVaults.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdSetMaxVaults.java @@ -20,6 +20,7 @@ public class CmdSetMaxVaults extends FCommand { senderMustBePlayer = false; senderMustBeMember = false; senderMustBeModerator = false; + senderMustBeColeader = false; senderMustBeAdmin = false; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdSethome.java b/src/main/java/com/massivecraft/factions/cmd/CmdSethome.java index eb574e39..f4289b66 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdSethome.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdSethome.java @@ -24,6 +24,7 @@ public class CmdSethome extends FCommand { senderMustBePlayer = true; senderMustBeMember = false; senderMustBeModerator = false; + senderMustBeColeader = false; senderMustBeAdmin = false; } @@ -85,4 +86,4 @@ public class CmdSethome extends FCommand { return TL.COMMAND_SETHOME_DESCRIPTION; } -} +} \ No newline at end of file diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdShow.java b/src/main/java/com/massivecraft/factions/cmd/CmdShow.java index 2e59332b..62809c11 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdShow.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdShow.java @@ -1,13 +1,13 @@ package com.massivecraft.factions.cmd; -import com.massivecraft.factions.Conf; -import com.massivecraft.factions.Faction; -import com.massivecraft.factions.P; +import com.massivecraft.factions.*; import com.massivecraft.factions.struct.Permission; +import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.zcore.util.TL; import com.massivecraft.factions.zcore.util.TagReplacer; import com.massivecraft.factions.zcore.util.TagUtil; import mkremins.fanciful.FancyMessage; +import org.bukkit.Bukkit; import java.util.ArrayList; import java.util.List; @@ -19,6 +19,7 @@ public class CmdShow extends FCommand { public CmdShow() { this.aliases.add("show"); this.aliases.add("who"); + this.aliases.add("f"); // add defaults to /f show in case config doesnt have it defaults.add("{header}"); @@ -47,6 +48,7 @@ public class CmdShow extends FCommand { @Override public void perform() { Faction faction = myFaction; + if (this.argIsSet(0)) { faction = this.argAsFaction(0); } @@ -54,6 +56,11 @@ public class CmdShow extends FCommand { return; } + if (!fme.hasFaction() && fme.getFaction() == faction){ + fme.msg(TL.COMMAND_SHOW_NEEDFACTION); + return; + } + if (fme != null && !fme.getPlayer().hasPermission("factions.show.bypassexempt") && P.p.getConfig().getStringList("show-exempt").contains(faction.getTag())) { msg(TL.COMMAND_SHOW_EXEMPT); @@ -69,6 +76,65 @@ public class CmdShow extends FCommand { if (show == null || show.isEmpty()) { show = defaults; } + /* for (int i = 0; i <= show.size()-1; i ++){ + if (show.get(i).contains("{description}")){ + show.set(i,show.get(i).replace("{description}",faction.getDescription())); + } + if (show.get(i).contains("{online-list}")){ + String message = ""; + StringBuilder string = new StringBuilder(message); + for (FPlayer fPlayer : faction.getFPlayers()){ + Bukkit.broadcastMessage(fPlayer.getTag()); + if (fPlayer.getPlayer().isOnline()){ + String prefix = ""; + if (fPlayer.getRole() == Role.ADMIN){ + prefix = Conf.prefixAdmin; + } + if (fPlayer.getRole() == Role.COLEADER){ + prefix = Conf.prefixCoLeader; + } + if (fPlayer.getRole() == Role.MODERATOR){ + prefix = Conf.prefixMod; + } + if (fPlayer.getRole() == Role.NORMAL){ + prefix = Conf.prefixNormal; + } + if (fPlayer.getRole() == Role.RECRUIT){ + prefix = Conf.prefixRecruit; + } + string.append(prefix + fPlayer.getName() + ","); + } + if (string.toString().equals("")) { continue; } + show.set(i,show.get(i).replace("{online-list}",string.toString())); + } + } + if (show.get(i).contains("{offline-list}")){ + String message = ""; + StringBuilder string = new StringBuilder(message); + for (FPlayer fPlayer : faction.getFPlayers()){ + if (!fPlayer.getPlayer().isOnline()){ + String prefix = ""; + if (fPlayer.getRole() == Role.ADMIN){ + prefix = Conf.prefixAdmin; + } + if (fPlayer.getRole() == Role.COLEADER){ + prefix = Conf.prefixCoLeader; + } + if (fPlayer.getRole() == Role.MODERATOR){ + prefix = Conf.prefixMod; + } + if (fPlayer.getRole() == Role.NORMAL){ + prefix = Conf.prefixNormal; + } + if (fPlayer.getRole() == Role.RECRUIT){ + prefix = Conf.prefixRecruit; + } + string.append(prefix + fPlayer.getName() + ","); + } + show.set(i,show.get(i).replace("{offline-list}",string.toString())); + } + } + }*/ if (!faction.isNormal()) { String tag = faction.getTag(fme); @@ -88,11 +154,9 @@ public class CmdShow extends FCommand { continue; // Due to minimal f show. } - if (fme != null) { - parsed = TagUtil.parsePlaceholders(fme.getPlayer(), parsed); - } + parsed = TagUtil.parsePlaceholders(fme.getPlayer(), parsed); - if (fme != null && TagUtil.hasFancy(parsed)) { + if (TagUtil.hasFancy(parsed)) { List fancy = TagUtil.parseFancy(faction, fme, parsed); if (fancy != null) { sendFancyMessage(fancy); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdVault.java b/src/main/java/com/massivecraft/factions/cmd/CmdVault.java index c0c70dc7..2f6032b1 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdVault.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdVault.java @@ -5,11 +5,20 @@ import com.drtshock.playervaults.translations.Lang; import com.drtshock.playervaults.vaultmanagement.UUIDVaultManager; import com.drtshock.playervaults.vaultmanagement.VaultOperations; import com.drtshock.playervaults.vaultmanagement.VaultViewInfo; +import com.massivecraft.factions.Board; import com.massivecraft.factions.Conf; +import com.massivecraft.factions.FLocation; +import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.zcore.util.TL; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Chest; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Player; +import org.bukkit.event.Listener; +import org.bukkit.inventory.Inventory; public class CmdVault extends FCommand { @@ -17,7 +26,7 @@ public class CmdVault extends FCommand { this.aliases.add("vault"); //this.requiredArgs.add(""); - this.optionalArgs.put("number", "number"); + this.permission = Permission.VAULT.node; this.disableOnLock = false; @@ -28,51 +37,41 @@ public class CmdVault extends FCommand { senderMustBeAdmin = false; } - @Override + @Override public void perform() { - /* - /f vault - */ - - int number = argAsInt(0, 0); // Default to 0 or show on 0 - - Player player = me; - - if (PlayerVaults.getInstance().getInVault().containsKey(player.getUniqueId().toString())) { - return; // Already in a vault so they must be trying to dupe. - } - - int max = myFaction.getMaxVaults(); - if (number > max) { - me.sendMessage(TL.COMMAND_VAULT_TOOHIGH.format(number, max)); + if (!P.p.getConfig().getBoolean("fvault.Enabled")){ + fme.sendMessage("This command is disabled!"); return; } - // Something like faction-id - String vaultName = String.format(Conf.vaultPrefix, myFaction.getId()); - - if (number < 1) { - // Message about which vaults that Faction has. - // List the target - YamlConfiguration file = UUIDVaultManager.getInstance().getPlayerVaultFile(vaultName); - if (file == null) { - sender.sendMessage(Lang.TITLE.toString() + Lang.VAULT_DOES_NOT_EXIST.toString()); - } else { - StringBuilder sb = new StringBuilder(); - for (String key : file.getKeys(false)) { - sb.append(key.replace("vault", "")).append(" "); - } - - sender.sendMessage(Lang.TITLE.toString() + Lang.EXISTING_VAULTS.toString().replaceAll("%p", fme.getTag()).replaceAll("%v", sb.toString().trim())); - } + if (fme.isInVault()){ + me.closeInventory(); return; - } // end listing vaults. - - // Attempt to open vault. - if (VaultOperations.openOtherVault(player, null, String.valueOf(number))) { - // Success - PlayerVaults.getInstance().getInVault().put(player.getUniqueId().toString(), new VaultViewInfo(vaultName, number)); } + fme.setInVault(true); + Location vaultLocation = fme.getFaction().getVault(); + if (vaultLocation == null){ + fme.msg(TL.COMMAND_VAULT_INVALID); + return; + } + FLocation vaultFLocation = new FLocation(vaultLocation); + if (Board.getInstance().getFactionAt(vaultFLocation) != fme.getFaction()){ + fme.getFaction().setVault(null); + fme.msg(TL.COMMAND_VAULT_INVALID); + return; + } + if (vaultLocation.getBlock().getType() != Material.CHEST){ + fme.getFaction().setVault(null); + fme.msg(TL.COMMAND_VAULT_INVALID); + return; + } + Chest chest = (Chest) vaultLocation.getBlock().getState(); + Inventory chestInv = chest.getBlockInventory(); + fme.msg(TL.COMMAND_VAULT_OPENING); + me.openInventory(chestInv); + + + } @Override diff --git a/src/main/java/com/massivecraft/factions/cmd/FCmdRoot.java b/src/main/java/com/massivecraft/factions/cmd/FCmdRoot.java index e4332263..7764e27f 100644 --- a/src/main/java/com/massivecraft/factions/cmd/FCmdRoot.java +++ b/src/main/java/com/massivecraft/factions/cmd/FCmdRoot.java @@ -22,7 +22,6 @@ public class FCmdRoot extends FCommand { public CmdDeinvite cmdDeinvite = new CmdDeinvite(); public CmdDescription cmdDescription = new CmdDescription(); public CmdDisband cmdDisband = new CmdDisband(); - public CmdFly cmdFly = new CmdFly(); public CmdHelp cmdHelp = new CmdHelp(); public CmdHome cmdHome = new CmdHome(); public CmdInvite cmdInvite = new CmdInvite(); @@ -82,7 +81,18 @@ public class FCmdRoot extends FCommand { public CmdBan cmdban = new CmdBan(); public CmdUnban cmdUnban = new CmdUnban(); public CmdBanlist cmdbanlist = new CmdBanlist(); - + public CmdRules cmdRules = new CmdRules(); + public CmdCheckpoint cmdCheckpoint = new CmdCheckpoint(); + public CmdTnt cmdTnt = new CmdTnt(); + public CmdNear cmdNear = new CmdNear(); + public CmdUpgrades cmdUpgrades = new CmdUpgrades(); + public CmdVault cmdVault = new CmdVault(); + public CmdGetVault cmdGetVault = new CmdGetVault(); + public CmdFly cmdFly = new CmdFly(); + public CmdColeader cmdColeader = new CmdColeader(); + public CmdBanner cmdBanner = new CmdBanner(); + public CmdTpBanner cmdTpBanner = new CmdTpBanner(); + public CmdKillHolograms cmdKillHolograms = new CmdKillHolograms(); public FCmdRoot() { super(); this.aliases.addAll(Conf.baseCommandAliases); @@ -117,6 +127,7 @@ public class FCmdRoot extends FCommand { this.addSubCommand(this.cmdDeinvite); this.addSubCommand(this.cmdDescription); this.addSubCommand(this.cmdDisband); + this.addSubCommand(this.cmdHelp); this.addSubCommand(this.cmdHome); this.addSubCommand(this.cmdInvite); @@ -174,6 +185,24 @@ public class FCmdRoot extends FCommand { this.addSubCommand(this.cmdban); this.addSubCommand(this.cmdUnban); this.addSubCommand(this.cmdbanlist); + this.addSubCommand(this.cmdRules); + this.addSubCommand(this.cmdCheckpoint); + this.addSubCommand(this.cmdTnt); + this.addSubCommand(this.cmdNear); + this.addSubCommand(this.cmdUpgrades); + this.addSubCommand(this.cmdVault); + this.addSubCommand(this.cmdGetVault); + this.addSubCommand(this.cmdColeader); + this.addSubCommand(this.cmdBanner); + this.addSubCommand(this.cmdTpBanner); + this.addSubCommand(this.cmdKillHolograms); + + + + if (P.p.getConfig().getBoolean("enable-faction-flight", false)) { + this.addSubCommand(this.cmdFly); + return; + } if (Bukkit.getServer().getPluginManager().isPluginEnabled("FactionsTop")) { P.p.log(Level.INFO, "Found FactionsTop plugin. Disabling our own /f top command."); } else { @@ -181,17 +210,11 @@ public class FCmdRoot extends FCommand { } if (P.p.isHookedPlayervaults()) { P.p.log("Found playervaults hook, adding /f vault and /f setmaxvault commands."); - this.addSubCommand(new CmdSetMaxVaults()); - this.addSubCommand(new CmdVault()); + // this.addSubCommand(new CmdSetMaxVaults()); + // this.addSubCommand(new CmdVault()); + }else{ + // this.addSubCommand(new CmdVault()); } - - if (P.p.getConfig().getBoolean("enable-faction-flight", false)) { - this.addSubCommand(this.cmdFly); - P.p.log(Level.INFO, "Enabling /f fly command"); - } else { - P.p.log(Level.WARNING, "Faction flight set to false in config.yml. Not enabling /f fly command."); - } - } @Override diff --git a/src/main/java/com/massivecraft/factions/cmd/FCommand.java b/src/main/java/com/massivecraft/factions/cmd/FCommand.java index 57402426..761994d2 100644 --- a/src/main/java/com/massivecraft/factions/cmd/FCommand.java +++ b/src/main/java/com/massivecraft/factions/cmd/FCommand.java @@ -24,6 +24,7 @@ public abstract class FCommand extends MCommand

{ public boolean senderMustBeMember; public boolean senderMustBeModerator; public boolean senderMustBeAdmin; + public boolean senderMustBeColeader; public boolean isMoneyCommand; @@ -38,6 +39,7 @@ public abstract class FCommand extends MCommand

{ senderMustBeMember = false; senderMustBeModerator = false; + senderMustBeColeader = false; senderMustBeAdmin = false; } @@ -80,7 +82,7 @@ public abstract class FCommand extends MCommand

{ return false; } - if (!(this.senderMustBeMember || this.senderMustBeModerator || this.senderMustBeAdmin)) { + if (!(this.senderMustBeMember || this.senderMustBeModerator || this.senderMustBeAdmin || this.senderMustBeColeader)) { return true; } @@ -98,11 +100,18 @@ public abstract class FCommand extends MCommand

{ return false; } + if (this.senderMustBeColeader && !fme.getRole().isAtLeast(Role.COLEADER)){ + sender.sendMessage(p.txt.parse("Only faction coleaders can %s.", this.getHelpShort())); + return false; + } + if (this.senderMustBeAdmin && !fme.getRole().isAtLeast(Role.ADMIN)) { sender.sendMessage(p.txt.parse("Only faction admins can %s.", this.getHelpShort())); return false; } + + return true; } @@ -257,8 +266,19 @@ public abstract class FCommand extends MCommand

{ return true; } - if (you.getRole().equals(Role.ADMIN)) { + if (you.getRole().equals(Role.ADMIN)) + { i.sendMessage(p.txt.parse("Only the faction admin can do that.")); + + } + else if ((you.getRole().equals(Role.COLEADER))) + { + if (i == you){ + return true; + } else { + i.sendMessage(p.txt.parse("Coleaders can't control each other...")); + } + } else if (i.getRole().equals(Role.MODERATOR)) { if (i == you) { return true; //Moderators can control themselves diff --git a/src/main/java/com/massivecraft/factions/cmd/FPromoteCommand.java b/src/main/java/com/massivecraft/factions/cmd/FPromoteCommand.java index 590767f5..777aff17 100644 --- a/src/main/java/com/massivecraft/factions/cmd/FPromoteCommand.java +++ b/src/main/java/com/massivecraft/factions/cmd/FPromoteCommand.java @@ -6,6 +6,7 @@ import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.zcore.fperms.Access; import com.massivecraft.factions.zcore.fperms.PermissableAction; import com.massivecraft.factions.zcore.util.TL; +import org.bukkit.Bukkit; public class FPromoteCommand extends FCommand { @@ -27,22 +28,30 @@ public class FPromoteCommand extends FCommand { @Override public void perform() { + FPlayer target = this.argAsBestFPlayerMatch(0); if (target == null) { msg(TL.GENERIC_NOPLAYERFOUND, this.argAsString(0)); return; } + if (!target.getFaction().equals(myFaction)) { msg(TL.COMMAND_PROMOTE_WRONGFACTION, target.getName()); return; } + Access access = myFaction.getAccess(fme.getRole(), PermissableAction.PROMOTE); + if (fme.getRole() == Role.COLEADER && target.getRole() == Role.ADMIN){ + fme.msg(TL.COMMAND_PROMOTE_COLEADER_ADMIN); + return; + } + // Well this is messy. if (access == null || access == Access.UNDEFINED) { - if (!assertMinRole(Role.MODERATOR)) { + if (!assertMinRole(Role.COLEADER)) { return; } } else if (access == Access.DENY) { @@ -50,6 +59,8 @@ public class FPromoteCommand extends FCommand { return; } + + Role current = target.getRole(); Role promotion = Role.getRelative(current, +relative); if (promotion == null) { @@ -57,8 +68,14 @@ public class FPromoteCommand extends FCommand { return; } + + if (fme == target && fme.getRole() == Role.COLEADER){ + fme.msg(TL.COMMAND_PROMOTE_COLEADER_ADMIN); + return; + } String action = relative > 0 ? TL.COMMAND_PROMOTE_PROMOTED.toString() : TL.COMMAND_PROMOTE_DEMOTED.toString(); + // Success! target.setRole(promotion); if (target.isOnline()) { diff --git a/src/main/java/com/massivecraft/factions/event/FactionCreateEvent.java b/src/main/java/com/massivecraft/factions/event/FactionCreateEvent.java index dc5dc3b2..0afc612c 100644 --- a/src/main/java/com/massivecraft/factions/event/FactionCreateEvent.java +++ b/src/main/java/com/massivecraft/factions/event/FactionCreateEvent.java @@ -2,7 +2,6 @@ package com.massivecraft.factions.event; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayers; -import com.massivecraft.factions.Faction; import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; import org.bukkit.event.Event; @@ -11,34 +10,28 @@ import org.bukkit.event.HandlerList; /** * Event called when a Faction is created. */ -public class FactionCreateEvent extends Event { +public class FactionCreateEvent extends Event implements Cancellable { private static final HandlerList handlers = new HandlerList(); - private final String factionTag; - private final Player sender; - private final Faction faction; + private String factionTag; + private Player sender; + private boolean cancelled; - public FactionCreateEvent(Player sender, String tag, Faction faction) { + public FactionCreateEvent(Player sender, String tag) { this.factionTag = tag; this.sender = sender; - this.faction = faction; + this.cancelled = false; } public FPlayer getFPlayer() { return FPlayers.getInstance().getByPlayer(sender); } - @Deprecated public String getFactionTag() { return factionTag; } - public Faction getFaction() { - return this.faction; - } - - @Override public HandlerList getHandlers() { return handlers; } @@ -47,4 +40,13 @@ public class FactionCreateEvent extends Event { return handlers; } + @Override + public boolean isCancelled() { + return cancelled; + } + + @Override + public void setCancelled(boolean c) { + this.cancelled = c; + } } \ No newline at end of file diff --git a/src/main/java/com/massivecraft/factions/integration/Essentials.java b/src/main/java/com/massivecraft/factions/integration/Essentials.java index 4871b435..0c9310ed 100644 --- a/src/main/java/com/massivecraft/factions/integration/Essentials.java +++ b/src/main/java/com/massivecraft/factions/integration/Essentials.java @@ -14,14 +14,11 @@ public class Essentials { private static IEssentials essentials; - public static IEssentials setup() { + public static void setup() { Plugin ess = Bukkit.getPluginManager().getPlugin("Essentials"); if (ess != null) { essentials = (IEssentials) ess; - return essentials; } - - return null; } // return false if feature is disabled or Essentials isn't available diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsChatListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsChatListener.java index d9410455..1691aeae 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsChatListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsChatListener.java @@ -4,6 +4,8 @@ import com.massivecraft.factions.*; import com.massivecraft.factions.struct.ChatMode; import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.struct.Role; +import com.massivecraft.factions.util.WarmUpUtil; +import com.massivecraft.factions.zcore.util.TL; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.entity.Player; @@ -30,6 +32,20 @@ public class FactionsChatListener implements Listener { String msg = event.getMessage(); FPlayer me = FPlayers.getInstance().getByPlayer(talkingPlayer); ChatMode chat = me.getChatMode(); + // Is the player entering a password for a warp? + if (me.isEnteringPassword()) { + event.setCancelled(true); + me.sendMessage(ChatColor.DARK_GRAY + event.getMessage().replaceAll("(?s).", "*")); + if (me.getFaction().isWarpPassword(me.getEnteringWarp(), event.getMessage())) { + doWarmup(me.getEnteringWarp(), me); + } else { + // Invalid Password + me.msg(TL.COMMAND_FWARP_INVALID_PASSWORD); + } + me.setEnteringPassword(false, ""); + return; + } + //Is it a MOD chat if (chat == ChatMode.MOD) { Faction myFaction = me.getFaction(); @@ -119,7 +135,7 @@ public class FactionsChatListener implements Listener { String msg = event.getMessage(); String eventFormat = event.getFormat(); FPlayer me = FPlayers.getInstance().getByPlayer(talkingPlayer); - int InsertIndex = Conf.chatTagInsertIndex; + int InsertIndex; if (!Conf.chatTagReplaceString.isEmpty() && eventFormat.contains(Conf.chatTagReplaceString)) { // we're using the "replace" method of inserting the faction tags @@ -136,8 +152,12 @@ public class FactionsChatListener implements Listener { } else if (!Conf.chatTagInsertBeforeString.isEmpty() && eventFormat.contains(Conf.chatTagInsertBeforeString)) { // we're using the "insert before string" method InsertIndex = eventFormat.indexOf(Conf.chatTagInsertBeforeString); - } else if (!Conf.alwaysShowChatTag){ - return; + } else { + // we'll fall back to using the index place method + InsertIndex = Conf.chatTagInsertIndex; + if (InsertIndex > eventFormat.length()) { + return; + } } String formatStart = eventFormat.substring(0, InsertIndex) + ((Conf.chatTagPadBefore && !me.getChatTag().isEmpty()) ? " " : ""); @@ -173,4 +193,18 @@ public class FactionsChatListener implements Listener { event.setFormat(nonColoredMsgFormat); } } -} + + private void doWarmup(final String warp, final FPlayer fme) { + WarmUpUtil.process(fme, WarmUpUtil.Warmup.WARP, TL.WARMUPS_NOTIFY_TELEPORT, warp, new Runnable() { + @Override + public void run() { + Player player = Bukkit.getPlayer(fme.getPlayer().getUniqueId()); + if (player != null) { + player.teleport(fme.getFaction().getWarp(warp).getLocation()); + fme.msg(TL.COMMAND_FWARP_WARPED, warp); + } + } + }, P.p.getConfig().getLong("warmups.f-warp", 0)); + } + +} \ No newline at end of file diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java index cd0254d9..2e5c9a6e 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java @@ -567,6 +567,43 @@ public class FactionsEntityListener implements Listener { } } + @EventHandler + public void onHit(EntityDamageByEntityEvent e) { + if (e.getDamager() instanceof Player) { + if (e.getEntity() instanceof Player) { + Player victim = (Player) e.getEntity(); + Player attacker = (Player) e.getDamager(); + FPlayer fvictim = FPlayers.getInstance().getByPlayer(victim); + FPlayer fattacker = FPlayers.getInstance().getByPlayer(attacker); + if (fattacker.getRelationTo(fvictim) == Relation.TRUCE) { + fattacker.msg(TL.PLAYER_PVP_CANTHURT, fvictim.describeTo(fattacker)); + e.setCancelled(true); + } + } + } + } + + @EventHandler + public void onBowHit(EntityDamageByEntityEvent e){ + if (e.getDamager() instanceof Projectile){ + if (e.getEntity() instanceof Player){ + Player damager = (Player) ((Projectile) e.getDamager()).getShooter(); + Player victim = (Player) e.getEntity(); + FPlayer fdamager = FPlayers.getInstance().getByPlayer(damager); + FPlayer fvictim = FPlayers.getInstance().getByPlayer(victim); + if (fvictim.getRelationTo(fdamager) == Relation.TRUCE){ + fdamager.msg(TL.PLAYER_PVP_CANTHURT, fvictim.describeTo(fdamager)); + e.setCancelled(true); + } + if (fvictim.getRelationTo(fdamager) == Relation.ENEMY) { + if (fvictim.isFlying()) { + fvictim.setFFlying(false, true); + } + } + } + } + } + private boolean stopEndermanBlockManipulation(Location loc) { if (loc == null) { return false; diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java index d60e76dd..fbd15411 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java @@ -1,6 +1,8 @@ package com.massivecraft.factions.listeners; import com.massivecraft.factions.*; +import com.massivecraft.factions.cmd.CmdFly; +import com.massivecraft.factions.event.FPlayerEnteredFactionEvent; import com.massivecraft.factions.event.FPlayerJoinEvent; import com.massivecraft.factions.event.FPlayerLeaveEvent; import com.massivecraft.factions.scoreboards.FScoreboard; @@ -9,31 +11,35 @@ import com.massivecraft.factions.scoreboards.sidebar.FDefaultSidebar; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.struct.Role; -import com.massivecraft.factions.util.FactionGUI; +import com.massivecraft.factions.util.Particle.ParticleEffect; import com.massivecraft.factions.util.VisualizeUtil; import com.massivecraft.factions.zcore.fperms.Access; import com.massivecraft.factions.zcore.fperms.PermissableAction; +import com.massivecraft.factions.util.FactionGUI; import com.massivecraft.factions.zcore.persist.MemoryFPlayer; import com.massivecraft.factions.zcore.util.TL; import com.massivecraft.factions.zcore.util.TextUtil; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.Material; +import com.sun.org.apache.xerces.internal.xs.StringList; +import org.bukkit.*; import org.bukkit.block.Block; -import org.bukkit.entity.Player; +import org.bukkit.entity.*; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.block.Action; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.inventory.InventoryCloseEvent; import org.bukkit.event.inventory.InventoryDragEvent; import org.bukkit.event.player.*; +import org.bukkit.inventory.ItemStack; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; import org.bukkit.util.NumberConversions; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.UUID; +import java.util.*; import java.util.logging.Level; public class FactionsPlayerListener implements Listener { @@ -47,6 +53,52 @@ public class FactionsPlayerListener implements Listener { } } + @EventHandler + public void onVaultPlace(BlockPlaceEvent e) { + if (e.getItemInHand().getType() == Material.CHEST) { + ItemStack vault = P.p.createItem(Material.CHEST, 1, (short) 0, P.p.color(P.p.getConfig().getString("fvault.Item.Name")), P.p.colorList(P.p.getConfig().getStringList("fvault.Item.Lore"))); + if (e.getItemInHand().equals(vault)) { + FPlayer fme = FPlayers.getInstance().getByPlayer(e.getPlayer()); + if (fme.getFaction().getVault() != null) { + fme.msg(TL.COMMAND_GETVAULT_ALREADYSET); + e.setCancelled(true); + return; + } + FLocation flocation = new FLocation(e.getBlockPlaced().getLocation()); + if (Board.getInstance().getFactionAt(flocation) != fme.getFaction()) { + fme.msg(TL.COMMAND_GETVAULT_INVALIDLOCATION); + e.setCancelled(true); + return; + } + Block start = e.getBlockPlaced(); + int radius = 1; + for (double x = start.getLocation().getX() - radius; x <= start.getLocation().getX() + radius; x++) { + for (double y = start.getLocation().getY() - radius; y <= start.getLocation().getY() + radius; y++) { + for (double z = start.getLocation().getZ() - radius; z <= start.getLocation().getZ() + radius; z++) { + Location blockLoc = new Location(e.getPlayer().getWorld(), x, y, z); + if (blockLoc.getX() == start.getLocation().getX() && blockLoc.getY() == start.getLocation().getY() && blockLoc.getZ() == start.getLocation().getZ()) { + continue; + } + + if (blockLoc.getBlock().getType() == Material.CHEST) { + e.setCancelled(true); + fme.msg(TL.COMMAND_GETVAULT_CHESTNEAR); + return; + } + } + } + } + + fme.msg(TL.COMMAND_GETVAULT_SUCCESS); + fme.getFaction().setVault(e.getBlockPlaced().getLocation()); + + } + } + } + + + HashMap fallMap = new HashMap<>(); + @EventHandler(priority = EventPriority.NORMAL) public void onPlayerJoin(PlayerJoinEvent event) { initPlayer(event.getPlayer()); @@ -90,6 +142,18 @@ public class FactionsPlayerListener implements Listener { } } + fallMap.put(me.getPlayer(), false); + Bukkit.getScheduler().scheduleSyncDelayedTask(P.p, new Runnable() { + @Override + public void run() { + if (fallMap.containsKey(me.getPlayer())) { + fallMap.remove(me.getPlayer()); + } + + } + }, 180L); + + if (me.isSpyingChat() && !player.hasPermission(Permission.CHATSPY.node)) { me.setSpyingChat(false); P.p.log(Level.INFO, "Found %s spying chat without permission on login. Disabled their chat spying.", player.getName()); @@ -100,11 +164,26 @@ public class FactionsPlayerListener implements Listener { P.p.log(Level.INFO, "Found %s on admin Bypass without permission on login. Disabled it for them.", player.getName()); } + // If they have the permission, don't let them autoleave. Bad inverted setter :\ me.setAutoLeave(!player.hasPermission(Permission.AUTO_LEAVE_BYPASS.node)); me.setTakeFallDamage(true); } + @EventHandler + public void onPlayerFall(EntityDamageEvent e) { + if (e.getEntity() instanceof Player) { + if (e.getCause() == EntityDamageEvent.DamageCause.FALL) { + Player player = (Player) e.getEntity(); + if (fallMap.containsKey(player)) { + e.setCancelled(true); + fallMap.remove(player); + } + } + } + } + + @EventHandler(priority = EventPriority.NORMAL) public void onPlayerQuit(PlayerQuitEvent event) { FPlayer me = FPlayers.getInstance().getByPlayer(event.getPlayer()); @@ -139,6 +218,18 @@ public class FactionsPlayerListener implements Listener { FScoreboard.remove(me); } + public String parseAllPlaceholders(String string, Faction faction) { + string = string.replace("{Faction}", faction.getTag()) + .replace("{online}", faction.getOnlinePlayers().size() + "") + .replace("{offline}", faction.getFPlayers().size() - faction.getOnlinePlayers().size() + "") + .replace("{chunks}", faction.getAllClaims().size() + "") + .replace("{power}", faction.getPower() + "") + .replace("{leader}", faction.getFPlayerAdmin() + ""); + + + return string; + } + // Holds the next time a player can have a map shown. private HashMap showTimes = new HashMap<>(); @@ -177,13 +268,37 @@ public class FactionsPlayerListener implements Listener { Faction factionFrom = Board.getInstance().getFactionAt(from); Faction factionTo = Board.getInstance().getFactionAt(to); boolean changedFaction = (factionFrom != factionTo); - - if (p.getConfig().getBoolean("enable-faction-flight", false) && changedFaction) { - if (!me.canFlyAtLocation() && me.isFlying()) { - me.setFlying(false); + if (changedFaction) { + Bukkit.getServer().getPluginManager().callEvent(new FPlayerEnteredFactionEvent(factionTo,factionFrom,me)); + if (P.p.getConfig().getBoolean("Title.Show-Title")) { + String title = P.p.getConfig().getString("Title.Format.Title"); + title = title.replace("{Faction}", factionTo.getColorTo(me) + factionTo.getTag()); + title = parseAllPlaceholders(title, factionTo); + String subTitle = P.p.getConfig().getString("Title.Format.Subtitle").replace("{Description}", factionTo.getDescription()).replace("{Faction}", factionTo.getColorTo(me) + factionTo.getTag()); + subTitle = parseAllPlaceholders(subTitle, factionTo); + me.getPlayer().sendTitle(P.p.color(title), P.p.color(subTitle)); + } + // enable fly :) + if (me.hasFaction()) { + if (factionTo == me.getFaction()) { + if (P.p.getConfig().getBoolean("ffly.AutoEnable")) { + CmdFly Fly = new CmdFly(); + me.setFlying(true); + Fly.flyMap.put(player.getName(), true); + if (Fly.id == -1) { + if (P.p.getConfig().getBoolean("ffly.Particles.Enabled")) { + Fly.startParticles(); + } + } + if (Fly.flyid == -1) { + Fly.startFlyCheck(); + } + } + } } } + if (me.isMapAutoUpdating()) { if (showTimes.containsKey(player.getUniqueId()) && (showTimes.get(player.getUniqueId()) > System.currentTimeMillis())) { if (P.p.getConfig().getBoolean("findfactionsexploit.log", false)) { @@ -237,6 +352,117 @@ public class FactionsPlayerListener implements Listener { } } + @EventHandler + public void onClose(InventoryCloseEvent e) { + FPlayer fme = FPlayers.getInstance().getById(e.getPlayer().getUniqueId().toString()); + if (fme.isInVault()) { + fme.setInVault(false); + } + + } + + HashMap bannerCooldownMap = new HashMap<>(); + public static HashMap bannerLocations = new HashMap<>(); + @EventHandler + public void onBannerPlace(BlockPlaceEvent e){ + if (e.getItemInHand().getType() == Material.BANNER){ + ItemStack bannerInHand = e.getItemInHand(); + ItemStack warBanner = P.p.createItem(bannerInHand.getType(),1,bannerInHand.getDurability(),P.p.getConfig().getString("fbanners.Item.Name"),P.p.getConfig().getStringList("fbanners.Item.Lore")); + if (warBanner.isSimilar(bannerInHand)){ + FPlayer fme = FPlayers.getInstance().getByPlayer(e.getPlayer()); + if (fme.getFaction().isWilderness()){ + fme.msg(TL.WARBANNER_NOFACTION); + e.setCancelled(true); + return; + } + int bannerTime = P.p.getConfig().getInt("fbanners.Banner-Time")*20; + + Location placedLoc = e.getBlockPlaced().getLocation(); + FLocation fplacedLoc = new FLocation(placedLoc); + if (Board.getInstance().getFactionAt(fplacedLoc).isWarZone() || fme.getFaction().getRelationTo(Board.getInstance().getFactionAt(fplacedLoc)) == Relation.ENEMY){ + if (bannerCooldownMap.containsKey(fme.getTag())){ + fme.msg(TL.WARBANNER_COOLDOWN); + e.setCancelled(true); + return; + } + for (FPlayer fplayer : fme.getFaction().getFPlayers()){ + // if (fplayer == fme) { continue; } //Idk if I wanna not send the title to the player + fplayer.getPlayer().sendTitle(P.p.color(fme.getTag() + " Placed A WarBanner!"),P.p.color("&7use &c/f tpbanner&7 to tp to the banner!")); + + } + bannerCooldownMap.put(fme.getTag(),true); + bannerLocations.put(fme.getTag(),e.getBlockPlaced().getLocation()); + int bannerCooldown = P.p.getConfig().getInt("fbanners.Banner-Place-Cooldown"); + final ArmorStand as = (ArmorStand) e.getBlockPlaced().getLocation().add(0.5,1,0.5).getWorld().spawnEntity(e.getBlockPlaced().getLocation().add(0.5,1,0.5), EntityType.ARMOR_STAND); //Spawn the ArmorStand + as.setVisible(false); //Makes the ArmorStand invisible + as.setGravity(false); //Make sure it doesn't fall + as.setCanPickupItems(false); //I'm not sure what happens if you leave this as it is, but you might as well disable it + as.setCustomName(P.p.color(P.p.getConfig().getString("fbanners.BannerHolo").replace("{Faction}",fme.getTag()))); //Set this to the text you want + as.setCustomNameVisible(true); //This makes the text appear no matter if your looking at the entity or not + final ArmorStand armorStand = as; + final String tag = fme.getTag(); + Bukkit.getScheduler().scheduleSyncDelayedTask(P.p, new Runnable() { + @Override + public void run() { + bannerCooldownMap.remove(tag); + } + }, Long.parseLong(bannerCooldown + "")); + final Block banner = e.getBlockPlaced(); + final Material bannerType = banner.getType(); + final Faction bannerFaction = fme.getFaction(); + banner.getWorld().strikeLightningEffect(banner.getLocation()); + // e.getPlayer().getWorld().playSound(e.getPlayer().getLocation(), Sound.ENTITY_LIGHTNING_IMPACT,2.0F,0.5F); + final int radius = P.p.getConfig().getInt("fbanners.Banner-Effect-Radius"); + final List effects = P.p.getConfig().getStringList("fbanners.Effects"); + final int affectorTask = Bukkit.getScheduler().scheduleSyncRepeatingTask(P.p, new Runnable() { + @Override + public void run() { + + for (Entity e : banner.getLocation().getWorld().getNearbyEntities(banner.getLocation(),radius,255,radius)){ + if (e instanceof Player){ + Player player = (Player) e; + FPlayer fplayer = FPlayers.getInstance().getByPlayer(player); + if (fplayer.getFaction() == bannerFaction){ + for (String effect : effects){ + String[] components = effect.split(":"); + player.addPotionEffect(new PotionEffect(PotionEffectType.getByName(components[0]),100,Integer.parseInt(components[1]))); + } + ParticleEffect.FLAME.display(1,1,1,1,10,banner.getLocation(),16); + ParticleEffect.LAVA.display(1,1,1,1,10,banner.getLocation(),16); + if (banner.getType() != bannerType){ + banner.setType(bannerType); + } + } + } + } + } + },0L,20L); + Bukkit.getScheduler().scheduleSyncDelayedTask(P.p, new Runnable() { + @Override + public void run() { + banner.setType(Material.AIR); + as.remove(); + banner.getWorld().strikeLightningEffect(banner.getLocation()); + Bukkit.getScheduler().cancelTask(affectorTask); + bannerLocations.remove(bannerFaction.getTag()); + } + },Long.parseLong(bannerTime + "")); + } + else { + fme.msg(TL.WARBANNER_INVALIDLOC); + e.setCancelled(true); + } + } + } + } + + + + + + + + @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) public void onPlayerInteract(PlayerInteractEvent event) { // only need to check right-clicks and physical as of MC 1.4+; good performance boost @@ -252,7 +478,6 @@ public class FactionsPlayerListener implements Listener { } if (!canPlayerUseBlock(player, block, false)) { - System.out.println("Cancelling " + player.getName() + " " + block.getType().name()); event.setCancelled(true); if (Conf.handleExploitInteractionSpam) { String name = player.getName(); @@ -362,14 +587,10 @@ public class FactionsPlayerListener implements Listener { return false; } - Access access = otherFaction.getAccess(me, PermissableAction.ITEM); - if (access != null && access != Access.UNDEFINED) { - return access == Access.ALLOW; - } - Faction myFaction = me.getFaction(); Relation rel = myFaction.getRelationTo(otherFaction); + // Cancel if we are not in our own territory if (rel.confDenyUseage()) { if (!justCheck) { @@ -378,6 +599,11 @@ public class FactionsPlayerListener implements Listener { return false; } + Access access = otherFaction.getAccess(me, PermissableAction.ITEM); + if (access != null && access != Access.UNDEFINED) { + // TODO: Update this once new access values are added other than just allow / deny. + return access == Access.ALLOW; + } // Also cancel if player doesn't have ownership rights for this claim if (Conf.ownedAreasEnabled && Conf.ownedAreaDenyUseage && !otherFaction.playerHasOwnershipRights(me, loc)) { @@ -414,6 +640,23 @@ public class FactionsPlayerListener implements Listener { return true; } + // Dupe fix. + Faction myFaction = me.getFaction(); + Relation rel = myFaction.getRelationTo(otherFaction); + if (!rel.isMember() || !otherFaction.playerHasOwnershipRights(me, loc) && player.getItemInHand() != null) { + switch (player.getItemInHand().getType()) { + case CHEST: + case SIGN_POST: + case TRAPPED_CHEST: + case SIGN: + case WOOD_DOOR: + case IRON_DOOR: + return false; + default: + break; + } + } + PermissableAction action = null; switch (block.getType()) { @@ -455,23 +698,6 @@ public class FactionsPlayerListener implements Listener { return false; } - // Dupe fix. - Faction myFaction = me.getFaction(); - Relation rel = myFaction.getRelationTo(otherFaction); - if (!rel.isMember() || !otherFaction.playerHasOwnershipRights(me, loc) && player.getItemInHand() != null) { - switch (player.getItemInHand().getType()) { - case CHEST: - case SIGN_POST: - case TRAPPED_CHEST: - case SIGN: - case WOOD_DOOR: - case IRON_DOOR: - return false; - default: - break; - } - } - // We only care about some material types. if (otherFaction.hasPlayersOnline()) { if (!Conf.territoryProtectedMaterials.contains(material)) { @@ -519,18 +745,6 @@ public class FactionsPlayerListener implements Listener { } } - @EventHandler - public void onTeleport(PlayerTeleportEvent event) { - FPlayer me = FPlayers.getInstance().getByPlayer(event.getPlayer()); - FLocation to = new FLocation(event.getTo()); - - // Check the location they're teleporting to and check if they can fly there. - if (!me.isAdminBypassing() && me.isFlying() && !me.canFlyAtLocation(to)) { - me.setFFlying(false, false); - } - - } - // For some reason onPlayerInteract() sometimes misses bucket events depending on distance (something like 2-3 blocks away isn't detected), // but these separate bucket events below always fire without fail @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) diff --git a/src/main/java/com/massivecraft/factions/struct/Permission.java b/src/main/java/com/massivecraft/factions/struct/Permission.java index 87c588cc..7b9d3b3f 100644 --- a/src/main/java/com/massivecraft/factions/struct/Permission.java +++ b/src/main/java/com/massivecraft/factions/struct/Permission.java @@ -43,7 +43,9 @@ public enum Permission { MAP("map"), MAPHEIGHT("mapheight"), MOD("mod"), + COLEADER("coleader"), MOD_ANY("mod.any"), + COLEADER_ANY("coleader.any"), MODIFY_POWER("modifypower"), MONEY_BALANCE("money.balance"), MONEY_BALANCE_ANY("money.balance.any"), @@ -76,6 +78,7 @@ public enum Permission { STATUS("status"), STUCK("stuck"), TAG("tag"), + TNT("tnt"), TITLE("title"), TITLE_COLOR("title.color"), TOGGLE_ALLIANCE_CHAT("togglealliancechat"), @@ -87,7 +90,14 @@ public enum Permission { SETWARP("setwarp"), TOP("top"), VAULT("vault"), + GETVAULT("getvault"), SETMAXVAULTS("setmaxvaults"), + RULES("rules"), + CHECKPOINT("checkpoint"), + UPGRADES("upgrades"), + BANNER("banner"), + TPBANNER("tpbanner"), + KILLHOLOS("killholos"), WARP("warp"); public final String node; diff --git a/src/main/java/com/massivecraft/factions/struct/Relation.java b/src/main/java/com/massivecraft/factions/struct/Relation.java index 9ef7722a..b37081d1 100644 --- a/src/main/java/com/massivecraft/factions/struct/Relation.java +++ b/src/main/java/com/massivecraft/factions/struct/Relation.java @@ -7,7 +7,6 @@ import com.massivecraft.factions.zcore.util.TL; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.configuration.ConfigurationSection; -import org.bukkit.inventory.ItemFlag; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; @@ -216,7 +215,6 @@ public enum Relation implements Permissable { itemMeta.setDisplayName(displayName); itemMeta.setLore(lore); - itemMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES); item.setItemMeta(itemMeta); return item; diff --git a/src/main/java/com/massivecraft/factions/struct/Role.java b/src/main/java/com/massivecraft/factions/struct/Role.java index 4119beb0..7b6a83d2 100644 --- a/src/main/java/com/massivecraft/factions/struct/Role.java +++ b/src/main/java/com/massivecraft/factions/struct/Role.java @@ -15,7 +15,8 @@ import java.util.ArrayList; import java.util.List; public enum Role implements Permissable { - ADMIN(3, TL.ROLE_ADMIN), + ADMIN(4, TL.ROLE_ADMIN), + COLEADER(3,TL.ROLE_COLEADER), MODERATOR(2, TL.ROLE_MODERATOR), NORMAL(1, TL.ROLE_NORMAL), RECRUIT(0, TL.ROLE_RECRUIT); @@ -52,6 +53,8 @@ public enum Role implements Permissable { case 2: return MODERATOR; case 3: + return COLEADER; + case 4: return ADMIN; } @@ -62,6 +65,8 @@ public enum Role implements Permissable { switch (check.toLowerCase()) { case "admin": return ADMIN; + case "coleader": + return COLEADER; case "mod": case "moderator": return MODERATOR; @@ -89,7 +94,9 @@ public enum Role implements Permissable { if (this == Role.ADMIN) { return Conf.prefixAdmin; } - + if (this == Role.COLEADER) { + return Conf.prefixCoLeader; + } if (this == Role.MODERATOR) { return Conf.prefixMod; } @@ -144,4 +151,4 @@ public enum Role implements Permissable { return string; } -} +} \ No newline at end of file diff --git a/src/main/java/com/massivecraft/factions/util/AsciiCompass.java b/src/main/java/com/massivecraft/factions/util/AsciiCompass.java index 348b0107..f2d53e8b 100644 --- a/src/main/java/com/massivecraft/factions/util/AsciiCompass.java +++ b/src/main/java/com/massivecraft/factions/util/AsciiCompass.java @@ -50,30 +50,30 @@ public class AsciiCompass { } } - public static AsciiCompass.Point getCompassPointForDirection(double inDegrees) { + public static Point getCompassPointForDirection(double inDegrees) { double degrees = (inDegrees - 180) % 360; if (degrees < 0) { degrees += 360; } if (0 <= degrees && degrees < 22.5) { - return AsciiCompass.Point.N; + return Point.N; } else if (22.5 <= degrees && degrees < 67.5) { - return AsciiCompass.Point.NE; + return Point.NE; } else if (67.5 <= degrees && degrees < 112.5) { - return AsciiCompass.Point.E; + return Point.E; } else if (112.5 <= degrees && degrees < 157.5) { - return AsciiCompass.Point.SE; + return Point.SE; } else if (157.5 <= degrees && degrees < 202.5) { - return AsciiCompass.Point.S; + return Point.S; } else if (202.5 <= degrees && degrees < 247.5) { - return AsciiCompass.Point.SW; + return Point.SW; } else if (247.5 <= degrees && degrees < 292.5) { - return AsciiCompass.Point.W; + return Point.W; } else if (292.5 <= degrees && degrees < 337.5) { - return AsciiCompass.Point.NW; + return Point.NW; } else if (337.5 <= degrees && degrees < 360.0) { - return AsciiCompass.Point.N; + return Point.N; } else { return null; } diff --git a/src/main/java/com/massivecraft/factions/util/ClipPlaceholderAPIManager.java b/src/main/java/com/massivecraft/factions/util/ClipPlaceholderAPIManager.java index 1da6c32b..492211b1 100644 --- a/src/main/java/com/massivecraft/factions/util/ClipPlaceholderAPIManager.java +++ b/src/main/java/com/massivecraft/factions/util/ClipPlaceholderAPIManager.java @@ -156,4 +156,4 @@ public class ClipPlaceholderAPIManager extends PlaceholderExpansion implements R return null; } -} +} \ No newline at end of file diff --git a/src/main/java/com/massivecraft/factions/util/MiscUtil.java b/src/main/java/com/massivecraft/factions/util/MiscUtil.java index 91112c71..f20c94b2 100644 --- a/src/main/java/com/massivecraft/factions/util/MiscUtil.java +++ b/src/main/java/com/massivecraft/factions/util/MiscUtil.java @@ -85,6 +85,7 @@ public class MiscUtil { public static Iterable rankOrder(Iterable players) { List admins = new ArrayList<>(); + List coleaders = new ArrayList<>(); List moderators = new ArrayList<>(); List normal = new ArrayList<>(); List recruit = new ArrayList<>(); @@ -102,6 +103,10 @@ public class MiscUtil { admins.add(player); break; + case COLEADER: + admins.add(player); + break; + case MODERATOR: moderators.add(player); break; @@ -118,6 +123,7 @@ public class MiscUtil { List ret = new ArrayList<>(); ret.addAll(admins); + ret.addAll(coleaders); ret.addAll(moderators); ret.addAll(normal); ret.addAll(recruit); diff --git a/src/main/java/com/massivecraft/factions/util/PermissionsMapTypeAdapter.java b/src/main/java/com/massivecraft/factions/util/PermissionsMapTypeAdapter.java index 2b384688..080dd661 100644 --- a/src/main/java/com/massivecraft/factions/util/PermissionsMapTypeAdapter.java +++ b/src/main/java/com/massivecraft/factions/util/PermissionsMapTypeAdapter.java @@ -98,4 +98,3 @@ public class PermissionsMapTypeAdapter implements JsonDeserializer lore = new ArrayList<>(); if (section.getString("materials." + name().toLowerCase().replace('_', '-')) == null) { @@ -111,7 +111,7 @@ public enum PermissableAction { } for (String loreLine : section.getStringList("placeholder-item.lore")) { - lore.add(replacePlaceholers(loreLine, fme, permissable)); + lore.add(replacePlaceholders(loreLine, fme, permissable)); } itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_ATTRIBUTES); @@ -122,7 +122,7 @@ public enum PermissableAction { return item; } - public String replacePlaceholers(String string, FPlayer fme, Permissable permissable) { + public String replacePlaceholders(String string, FPlayer fme, Permissable permissable) { // Run Permissable placeholders string = permissable.replacePlaceholders(string); diff --git a/src/main/java/com/massivecraft/factions/zcore/fperms/gui/PermissableActionGUI.java b/src/main/java/com/massivecraft/factions/zcore/fperms/gui/PermissableActionGUI.java index 43e02894..311b575f 100644 --- a/src/main/java/com/massivecraft/factions/zcore/fperms/gui/PermissableActionGUI.java +++ b/src/main/java/com/massivecraft/factions/zcore/fperms/gui/PermissableActionGUI.java @@ -62,6 +62,9 @@ public class PermissableActionGUI implements InventoryHolder, FactionGUI { for (String key : section.getConfigurationSection("slots").getKeys(false)) { int slot = section.getInt("slots." + key); + if (slot == -1) { + continue; + } if (slot + 1 > guiSize || slot < 0) { P.p.log(Level.WARNING, "Invalid slot for: " + key.toUpperCase()); continue; @@ -191,7 +194,9 @@ public class PermissableActionGUI implements InventoryHolder, FactionGUI { } backButtonMeta.setLore(lore); - backButtonMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_ATTRIBUTES); + if (!P.p.mc17){ + backButtonMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_ATTRIBUTES); + } backButton.setItemMeta(backButtonMeta); diff --git a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryBoard.java b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryBoard.java index bce8a94b..4aed75df 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryBoard.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryBoard.java @@ -285,8 +285,7 @@ public abstract class MemoryBoard extends Board { Relation relation = fplayer.getRelationTo(factionHere); if (factionHere.isWilderness()) { row.then("-").color(Conf.colorWilderness); - // Check for claimat permission and if so, let them claim at ;D - // TODO: TEMP DISABLED UNTIL FIXED PROPERLY :( + // Check for claimat position and if so, let them claim at ;D //TODO: Fix this if (false) { //fplayer.getPlayer().hasPermission(Permission.CLAIMAT.node)) { row.tooltip(TL.CLAIM_CLICK_TO_CLAIM.format(dx, dz)) .command(String.format("/f claimat %s %d %d", flocation.getWorldName(), dx, dz)); diff --git a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java index 4473318f..987cbaa6 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFPlayer.java @@ -1,7 +1,9 @@ package com.massivecraft.factions.zcore.persist; import com.massivecraft.factions.*; +import com.massivecraft.factions.cmd.CmdFly; import com.massivecraft.factions.event.FPlayerLeaveEvent; +import com.massivecraft.factions.event.FPlayerStoppedFlying; import com.massivecraft.factions.event.LandClaimEvent; import com.massivecraft.factions.iface.EconomyParticipator; import com.massivecraft.factions.iface.RelationParticipator; @@ -22,12 +24,10 @@ import com.massivecraft.factions.zcore.util.TL; import mkremins.fanciful.FancyMessage; import org.bukkit.*; import org.bukkit.command.CommandSender; +import org.bukkit.entity.Entity; import org.bukkit.entity.Player; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.UUID; +import java.util.*; /** @@ -64,6 +64,8 @@ public abstract class MemoryFPlayer implements FPlayer { protected boolean willAutoLeave = true; protected int mapHeight = 8; // default to old value protected boolean isFlying = false; + protected boolean enteringPassword = false; + protected String enteringPasswordWarp = ""; protected transient FLocation lastStoodAt = new FLocation(); // Where did this player stand the last time we checked? protected transient boolean mapAutoUpdating; @@ -594,24 +596,7 @@ public abstract class MemoryFPlayer implements FPlayer { public void sendFactionHereMessage(Faction from) { Faction toShow = Board.getInstance().getFactionAt(getLastStoodAt()); - boolean showTitle = P.p.getConfig().getBoolean("enter-titles.enabled", true); boolean showChat = true; - Player player = getPlayer(); - - if (showTitle && player != null) { - int in = P.p.getConfig().getInt("enter-titles.fade-in", 10); - int stay = P.p.getConfig().getInt("enter-titles.stay", 70); - int out = P.p.getConfig().getInt("enter-titles.fade-out", 20); - String title = TL.FACTION_ENTER_TITLE.format(this); - String sub = TL.FACTION_ENTER_SUBTITLE.format(toShow.getTag(this)); - - // We send null instead of empty because Spigot won't touch the title if it's null, but clears if empty. - // We're just trying to be as unintrusive as possible. - player.sendTitle(title, sub, in, stay, out); - - showChat = P.p.getConfig().getBoolean("enter-titles.also-show-chat", true); - } - if (showInfoBoard(toShow)) { FScoreboard.get(this).setTemporarySidebar(new FInfoSidebar(toShow)); showChat = P.p.getConfig().getBoolean("scoreboard.also-send-chat", true); @@ -924,6 +909,7 @@ public abstract class MemoryFPlayer implements FPlayer { // If leaving fly mode, don't let them take fall damage for x seconds. if (!fly) { int cooldown = P.p.getConfig().getInt("fly-falldamage-cooldown", 3); + CmdFly.flyMap.remove(player.getName()); // If the value is 0 or lower, make them take fall damage. // Otherwise, start a timer and have this cancel after a few seconds. @@ -942,45 +928,47 @@ public abstract class MemoryFPlayer implements FPlayer { isFlying = fly; } + + + + + + + + public boolean inVault = false; + + public boolean isInVault(){ + return inVault; + } + + public void setInVault(boolean status){ + inVault = status; + } + public boolean canFlyAtLocation() { return canFlyAtLocation(lastStoodAt); } public boolean canFlyAtLocation(FLocation location) { Faction faction = Board.getInstance().getFactionAt(location); - if (faction.isWilderness() || faction.isSafeZone() || faction.isWarZone()) { + if ((!faction.isWilderness() && getPlayer().hasPermission("factions.fly.wilderness")) || (faction.isSafeZone() && getPlayer().hasPermission("factions.fly.safezone") )|| (faction.isWarZone() && getPlayer().hasPermission("factions.fly.warzone"))) { return false; } - - // Admins can always fly in their territory. - // admin bypass (ops) can fly as well. - if (isAdminBypassing || (faction == getFaction() && getRole() == Role.ADMIN)) { + if (!getPlayer().hasPermission("factions.fly.ally") && getRelationToLocation() == Relation.ALLY) { + return false; + } + if (!getPlayer().hasPermission("factions.fly.truce") && getRelationToLocation() == Relation.TRUCE) { + return false; + } + if (!getPlayer().hasPermission("factions.fly.neutral") && getRelationToLocation() == Relation.NEUTRAL) { + return false; + } + if (faction == getFaction() && getRole() == Role.ADMIN) { return true; } Access access = faction.getAccess(this, PermissableAction.FLY); - - if (access == null || access == Access.UNDEFINED) { - - // If access is null or undefined, we'll default to the conf.json - switch (faction.getRelationTo(getFaction())) { - case ENEMY: - return Conf.defaultFlyPermEnemy; - case ALLY: - return Conf.defaultFlyPermAlly; - case NEUTRAL: - return Conf.defaultFlyPermNeutral; - case TRUCE: - return Conf.defaultFlyPermTruce; - case MEMBER: - return Conf.defaultFlyPermMember; - default: - return false; // should never reach. - } - - } - - return access == Access.ALLOW; + return access == null || access == Access.UNDEFINED || access == Access.ALLOW; } public boolean shouldTakeFallDamage() { @@ -991,6 +979,19 @@ public abstract class MemoryFPlayer implements FPlayer { this.shouldTakeFallDamage = fallDamage; } + public boolean isEnteringPassword() { + return enteringPassword; + } + + public void setEnteringPassword(boolean toggle, String warp) { + enteringPassword = toggle; + enteringPasswordWarp = warp; + } + + public String getEnteringWarp() { + return enteringPasswordWarp; + } + // -------------------------------------------- // // Message Sending Helpers // -------------------------------------------- // @@ -1102,4 +1103,26 @@ public abstract class MemoryFPlayer implements FPlayer { this.warmup = warmup; this.warmupTask = taskId; } -} + + @Override + public boolean checkIfNearbyEnemies(){ + Player me = this.getPlayer(); + for (Entity e : me.getNearbyEntities(16, 255, 16)) { + if (e == null) { continue; } + if (e instanceof Player) { + Player eplayer = (((Player) e).getPlayer()); + if (eplayer == null) { continue; } + FPlayer efplayer = FPlayers.getInstance().getByPlayer(eplayer); + if (efplayer == null) { continue; } + if (this.getRelationTo(efplayer).equals(Relation.ENEMY)) { + + this.setFlying(false); + this.msg(TL.COMMAND_FLY_ENEMY_NEAR); + Bukkit.getServer().getPluginManager().callEvent(new FPlayerStoppedFlying(this)); + return true; + } + } + } + return false; + } +} \ No newline at end of file diff --git a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFaction.java b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFaction.java index 066ef12b..a7d40824 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFaction.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFaction.java @@ -15,11 +15,11 @@ import com.massivecraft.factions.zcore.fperms.Access; import com.massivecraft.factions.zcore.fperms.Permissable; import com.massivecraft.factions.zcore.fperms.PermissableAction; import com.massivecraft.factions.zcore.util.TL; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.OfflinePlayer; +import org.bukkit.*; import org.bukkit.entity.Player; +import org.bukkit.event.inventory.InventoryType; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; import java.util.*; import java.util.Map.Entry; @@ -178,6 +178,84 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { return this.bans; } + public HashMap rules = new HashMap(); + + public String getRule(int index){ + if (rules.size() == 0) return null; + return rules.get(index); + } + + public HashMap getRulesMap(){ + return rules; + } + + public void setRule(int index,String rule) { + rules.put(index,rule); + } + + public void removeRule(int index){ + HashMap newRule = rules; + newRule.remove(index); + rules = newRule; + } + + public int tnt; + + public void addTnt(int amt){ + tnt += amt; + } + + public void takeTnt(int amt){ + tnt -=amt; + } + + public int getTnt() { return tnt; } + + public Location checkpoint; + + public LazyLocation vault; + + public Location getVault() { + if (vault == null){ + return null; + } + return vault.getLocation(); + } + public void setVault(Location vaultLocation){ + if (vaultLocation == null){ + vault = null; + return; + } + LazyLocation newlocation = new LazyLocation(vaultLocation); + vault = newlocation; + } + + public HashMap upgrades = new HashMap<>(); + + public int getUpgrade(String key){ + if (upgrades.keySet().contains(key)) { return upgrades.get(key);} + return 0; + } + + public void setUpgrades(String key,int level){ upgrades.put(key,level); } + + + public void setCheckpoint(Location location){ + checkpoint = location; + } + public Location getCheckpoint(){ + return checkpoint; + } + + + public void clearRules(){ + rules.clear(); + } + + public void addRule(String rule){ + rules.put(rules.size(),rule); + } + public boolean getOpen() { return open; } @@ -243,6 +321,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { this.tag = str; } + public String getComparisonTag() { return MiscUtil.getComparisonString(this.tag); } @@ -299,6 +378,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { return aid; } + public Integer getPermanentPower() { return this.permanentPower; } @@ -397,6 +477,8 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { return Access.UNDEFINED; } + + public void setPermission(Permissable permissable, PermissableAction permissableAction, Access access) { Map accessMap = permissions.get(permissable); if (accessMap == null) { diff --git a/src/main/java/com/massivecraft/factions/zcore/util/TL.java b/src/main/java/com/massivecraft/factions/zcore/util/TL.java index 058d3fc7..cf7f62fc 100644 --- a/src/main/java/com/massivecraft/factions/zcore/util/TL.java +++ b/src/main/java/com/massivecraft/factions/zcore/util/TL.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013 drtshock + * Copyright (C) 2018 ProSavage * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -50,7 +50,66 @@ public enum TL { /** * Command translations */ - COMMAND_ADMIN_NOTMEMBER("%1$s is not a member in your faction."), + + /** + * Messsges for /f help + */ + COMMAND_HELP_NEXTCREATE("Learn how to create a faction on the next page."), + COMMAND_HELP_INVITATIONS("command.help.invitations", "You might want to close it and use invitations:"), + COMMAND_HELP_HOME("And don't forget to set your home:"), + COMMAND_HELP_404("&c&l» &7This page does &cnot &7exist"), + COMMAND_HELP_BANK_1("Your faction has a bank which is used to pay for certain"), //Move to last /f help page + COMMAND_HELP_BANK_2("things, so it will need to have money deposited into it."), //Move to last /f help page + COMMAND_HELP_BANK_3("To learn more, use the money command."), //Move to last /f help page + COMMAND_HELP_PLAYERTITLES("Player titles are just for fun. No rules connected to them."), //Move to last /f help page + COMMAND_HELP_OWNERSHIP_1("Claimed land with ownership set is further protected so"), //Move to last /f help page + COMMAND_HELP_OWNERSHIP_2("that only the owner(s), faction admin, and possibly the"), //Move to last /f help page + COMMAND_HELP_OWNERSHIP_3("faction moderators have full access."), //Move to last /f help page + COMMAND_HELP_RELATIONS_1("Set the relation you WISH to have with another faction."), //Move to last /f help page + COMMAND_HELP_RELATIONS_2("Your default relation with other factions will be neutral."), //Move to last /f help page + COMMAND_HELP_RELATIONS_3("If BOTH factions choose \"ally\" you will be allies."), //Move to last /f help page + COMMAND_HELP_RELATIONS_4("If ONE faction chooses \"enemy\" you will be enemies."), //Move to last /f help page + COMMAND_HELP_RELATIONS_5("You can never hurt members or allies."), //Move to last /f help page + COMMAND_HELP_RELATIONS_6("You can not hurt neutrals in their own territory."), //Move to last /f help page + COMMAND_HELP_RELATIONS_7("You can always hurt enemies and players without faction."), //Move to last /f help page + COMMAND_HELP_RELATIONS_8(""), + COMMAND_HELP_RELATIONS_9("Damage from enemies is reduced in your own territory."), //Move to last /f help page + COMMAND_HELP_RELATIONS_10("When you die you lose power. It is restored over time."), //Move to last /f help page + COMMAND_HELP_RELATIONS_11("The power of a faction is the sum of all member power."), //Move to last /f help page + COMMAND_HELP_RELATIONS_12("The power of a faction determines how much land it can hold."), //Move to last /f help page + COMMAND_HELP_RELATIONS_13("You can claim land from factions with too little power."), //Move to last /f help page + COMMAND_HELP_PERMISSIONS_1("Only faction members can build and destroy in their own"), //Move to last /f help page + COMMAND_HELP_PERMISSIONS_2("territory. Usage of the following items is also restricted:"), //Move to last /f help page + COMMAND_HELP_PERMISSIONS_3("Door, Chest, Furnace, Dispenser, Diode."), //Move to last /f help page + COMMAND_HELP_PERMISSIONS_4(""), + COMMAND_HELP_PERMISSIONS_5("Make sure to put pressure plates in front of doors for your"), //Move to last /f help page + COMMAND_HELP_PERMISSIONS_6("guest visitors. Otherwise they can't get through. You can"), //Move to last /f help page + COMMAND_HELP_PERMISSIONS_7("also use this to create member only areas."), //Move to last /f help page + COMMAND_HELP_PERMISSIONS_8("As dispensers are protected, you can create traps without"), //Move to last /f help page + COMMAND_HELP_PERMISSIONS_9("worrying about those arrows getting stolen."), //Move to last /f help page + COMMAND_HELP_ADMIN_1("&a&l» &a/f claim safezone \n &7claim land for the Safe Zone"), + COMMAND_HELP_ADMIN_2("&a&l» &a/f claim warzone \n &7claim land for the War Zone"), + COMMAND_HELP_ADMIN_3("&a&l» &a/f autoclaim [safezone|warzone] \n &7take a guess"), + COMMAND_HELP_MOAR_1("Finally some commands for the server admins:"), + COMMAND_HELP_MOAR_2("More commands for server admins:"), + COMMAND_HELP_MOAR_3("Even more commands for server admins:"), + COMMAND_HELP_DESCRIPTION("\n &a&l» &7Display a &ahelp &7page"), + + COMMAND_NEAR_DESCRIPTION("Get nearby faction players in a radius."), + COMMAND_NEAR_DISABLED_MSG("&cThis command is disabled!"), + COMMAND_NEAR_FORMAT("{playername} &c({distance}m)"), + COMMAND_NEAR_USE_MSG("&cFaction members nearby"), + + /** + * Messsges for Faction Admins/Mods + */ + + COMMAND_UPGRADES_DESCRIPTION("&cOpen the Upgrades Menu"), + COMMAND_UPGRADES_MONEYTAKE("&c{amount} has been taken from your account."), + COMMAND_UPGRADES_NOTENOUGHMONEY("&cYou dont have enough money!"), + + + COMMAND_ADMIN_NOTMEMBER("%1$s is not a&c member in your faction."), COMMAND_ADMIN_NOTADMIN("You are not the faction admin."), COMMAND_ADMIN_TARGETSELF("The target player musn't be yourself."), COMMAND_ADMIN_DEMOTES("You have demoted %1$s from the position of faction admin."), @@ -58,6 +117,7 @@ public enum TL { COMMAND_ADMIN_PROMOTES("You have promoted %1$s to the position of faction admin."), COMMAND_ADMIN_PROMOTED("%1$s gave %2$s the leadership of %3$s."), COMMAND_ADMIN_DESCRIPTION("Hand over your admin rights"), + COMMAND_ADMIN_NOMEMBERS("No one else to promote, please disband faction."), COMMAND_AHOME_DESCRIPTION("Send a player to their f home no matter what."), COMMAND_AHOME_NOHOME("%1$s doesn't have an f home."), @@ -67,6 +127,13 @@ public enum TL { COMMAND_ANNOUNCE_DESCRIPTION("Announce a message to players in faction."), + COMMAND_FREECAM_ENEMYINRADIUS("Freecam disabled, An enemy is closeby!"), + COMMAND_FREECAM_OUTSIDEFLIGHT("Please dont leave the flight radius!"), + COMMAND_FREECAM_ENABLED("Freecam is now enabled!"), + COMMAND_FREECAM_DISABLED("Freecam is now disabled"), + COMMAND_FREECAM_DESCRIPTION("Go into spectator mode"), + + COMMAND_AUTOCLAIM_ENABLED("Now auto-claiming land for %1$s."), COMMAND_AUTOCLAIM_DISABLED("Auto-claiming of land disabled."), COMMAND_AUTOCLAIM_REQUIREDRANK("You must be %1$s to claim land."), @@ -85,6 +152,7 @@ public enum TL { COMMAND_BANLIST_HEADER("&6There are &c%d&6 bans for %s"), COMMAND_BANLIST_ENTRY("&7%d. &c%s &r- &a%s &r- &e%s"), COMMAND_BANLIST_NOFACTION("&4You are not in a Faction."), + COMMAND_BANLIST_INVALID("We couldn't find a Faction by the name %s"), COMMAND_BOOM_PEACEFULONLY("This command is only usable by factions which are specifically designated as peaceful."), COMMAND_BOOM_TOTOGGLE("to toggle explosions"), @@ -92,12 +160,24 @@ public enum TL { COMMAND_BOOM_ENABLED("%1$s has %2$s explosions in your faction's territory."), COMMAND_BOOM_DESCRIPTION("Toggle explosions (peaceful factions only)"), + COMMAND_BYPASS_ENABLE("You have enabled admin bypass mode. You will be able to build or destroy anywhere."), COMMAND_BYPASS_ENABLELOG(" has ENABLED admin bypass mode."), COMMAND_BYPASS_DISABLE("You have disabled admin bypass mode."), COMMAND_BYPASS_DISABLELOG(" has DISABLED admin bypass mode."), COMMAND_BYPASS_DESCRIPTION("Enable admin bypass mode"), + COMMAND_BANNER_DESCRIPTION("Turn a held banner into a war banner"), + COMMAND_BANNER_NOTENOUGHMONEY("&cYou do not have enough money"), + COMMAND_BANNER_MONEYTAKE("&c{amount} has been taken from your account."), + COMMAND_BANNER_WRONGITEM("&cYou need to be holding a banner to use this!"), + COMMAND_BANNER_SUCCESS("&cYou have created a war banner!"), + + COMMAND_TPBANNER_NOTSET("&cYour faction does not have a banner placed!"), + COMMAND_TPBANNER_SUCCESS("&cTeleporting to Faction Banner"), + COMMAND_TPBANNER_DESCRIPTION("Teleport to your faction banner"), + + COMMAND_CHAT_DISABLED("The built in chat channels are disabled on this server."), COMMAND_CHAT_INVALIDMODE("Unrecognised chat mode. Please enter either 'a','f' or 'p'"), COMMAND_CHAT_DESCRIPTION("Change chat mode"), @@ -151,6 +231,13 @@ public enum TL { COMMAND_CONVERT_BACKEND_INVALID("Invalid backend"), COMMAND_CONVERT_DESCRIPTION("Convert the plugin backend"), + COMMAND_CHECKPOINT_DISABLED("You cannot use checkpoint while disabled!"), + COMMAND_CHECKPOINT_SET("&cYou have set the faction checkpoint at your Location."), + COMMAND_CHECKPOINT_GO("&cTeleporting to faction checkpoint"), + COMMAND_CHECKPOINT_NOT_SET("&cYou have to set the faction checkpoint first."), + COMMAND_CHECKPOINT_CLAIMED("&cYour current faction checkpoint is claimed, set a new one!"), + COMMAND_CHECKPOINT_DESCRIPTION("Set or go to your faction checkpoint!"), + COMMAND_CREATE_MUSTLEAVE("You must leave your current faction first."), COMMAND_CREATE_INUSE("That tag is already in use."), COMMAND_CREATE_TOCREATE("to create a new faction"), @@ -193,6 +280,8 @@ public enum TL { COMMAND_FLY_CHANGE("&eFaction flight &d%1$s"), COMMAND_FLY_DAMAGE("&eFaction flight &ddisabled&e due to entering combat"), COMMAND_FLY_NO_ACCESS("&cCannot fly in territory of %1$s"), + COMMAND_FLY_ENEMY_NEAR("&cFlight has been disabled an enemy is nearby"), + COMMAND_FLY_CHECK_ENEMY("&cCannot fly here, an enemy is nearby"), COMMAND_FWARP_CLICKTOWARP("Click to warp!"), COMMAND_FWARP_COMMANDFORMAT("/f warp [password]"), @@ -203,48 +292,8 @@ public enum TL { COMMAND_FWARP_WARPS("Warps: "), COMMAND_FWARP_DESCRIPTION("Teleport to a faction warp"), COMMAND_FWARP_INVALID_PASSWORD("&4Invalid password!"), - COMMAND_FWARP_PASSWORD_REQUIRED("&cThis faction warp requires a password, use command instead"), - - COMMAND_HELP_404("This page does not exist"), - COMMAND_HELP_NEXTCREATE("Learn how to create a faction on the next page."), - COMMAND_HELP_INVITATIONS("command.help.invitations", "You might want to close it and use invitations:"), - COMMAND_HELP_HOME("And don't forget to set your home:"), - COMMAND_HELP_BANK_1("Your faction has a bank which is used to pay for certain"), - COMMAND_HELP_BANK_2("things, so it will need to have money deposited into it."), - COMMAND_HELP_BANK_3("To learn more, use the money command."), - COMMAND_HELP_PLAYERTITLES("Player titles are just for fun. No rules connected to them."), - COMMAND_HELP_OWNERSHIP_1("Claimed land with ownership set is further protected so"), - COMMAND_HELP_OWNERSHIP_2("that only the owner(s), faction admin, and possibly the"), - COMMAND_HELP_OWNERSHIP_3("faction moderators have full access."), - COMMAND_HELP_RELATIONS_1("Set the relation you WISH to have with another faction."), - COMMAND_HELP_RELATIONS_2("Your default relation with other factions will be neutral."), - COMMAND_HELP_RELATIONS_3("If BOTH factions choose \"ally\" you will be allies."), - COMMAND_HELP_RELATIONS_4("If ONE faction chooses \"enemy\" you will be enemies."), - COMMAND_HELP_RELATIONS_5("You can never hurt members or allies."), - COMMAND_HELP_RELATIONS_6("You can not hurt neutrals in their own territory."), - COMMAND_HELP_RELATIONS_7("You can always hurt enemies and players without faction."), - COMMAND_HELP_RELATIONS_8(""), - COMMAND_HELP_RELATIONS_9("Damage from enemies is reduced in your own territory."), - COMMAND_HELP_RELATIONS_10("When you die you lose power. It is restored over time."), - COMMAND_HELP_RELATIONS_11("The power of a faction is the sum of all member power."), - COMMAND_HELP_RELATIONS_12("The power of a faction determines how much land it can hold."), - COMMAND_HELP_RELATIONS_13("You can claim land from factions with too little power."), - COMMAND_HELP_PERMISSIONS_1("Only faction members can build and destroy in their own"), - COMMAND_HELP_PERMISSIONS_2("territory. Usage of the following items is also restricted:"), - COMMAND_HELP_PERMISSIONS_3("Door, Chest, Furnace, Dispenser, Diode."), - COMMAND_HELP_PERMISSIONS_4(""), - COMMAND_HELP_PERMISSIONS_5("Make sure to put pressure plates in front of doors for your"), - COMMAND_HELP_PERMISSIONS_6("guest visitors. Otherwise they can't get through. You can"), - COMMAND_HELP_PERMISSIONS_7("also use this to create member only areas."), - COMMAND_HELP_PERMISSIONS_8("As dispensers are protected, you can create traps without"), - COMMAND_HELP_PERMISSIONS_9("worrying about those arrows getting stolen."), - COMMAND_HELP_ADMIN_1("/f claim safezone claim land for the Safe Zone"), - COMMAND_HELP_ADMIN_2("/f claim warzone claim land for the War Zone"), - COMMAND_HELP_ADMIN_3("/f autoclaim [safezone|warzone] take a guess"), - COMMAND_HELP_MOAR_1("Finally some commands for the server admins:"), - COMMAND_HELP_MOAR_2("More commands for server admins:"), - COMMAND_HELP_MOAR_3("Even more commands for server admins:"), - COMMAND_HELP_DESCRIPTION("Display a help page"), + COMMAND_FWARP_PASSWORD_REQUIRED("&a&lWarp Password:"), + COMMAND_FWARP_PASSWORD_TIMEOUT("&cWarp password canceled"), COMMAND_HOME_DISABLED("Sorry, Faction homes are disabled on this server."), COMMAND_HOME_TELEPORTDISABLED("Sorry, the ability to teleport to Faction homes is disabled on this server."), @@ -280,7 +329,7 @@ public enum TL { COMMAND_JOIN_JOINED("%1$s joined your faction."), COMMAND_JOIN_JOINEDLOG("%1$s joined the faction %2$s."), COMMAND_JOIN_MOVEDLOG("%1$s moved the player %2$s into the faction %3$s."), - COMMAND_JOIN_DESCRIPTION("Join a faction"), + COMMAND_JOIN_DESCRIPTION("\\n &a&l» &7Join a faction"), COMMAND_JOIN_BANNED("&cYou are banned from %1$s &c:("), COMMAND_KICK_CANDIDATES("Players you can kick: "), @@ -301,7 +350,7 @@ public enum TL { COMMAND_LIST_TOLIST("to list the factions"), COMMAND_LIST_FORLIST("for listing the factions"), COMMAND_LIST_ONLINEFACTIONLESS("Online factionless: "), - COMMAND_LIST_DESCRIPTION("See a list of the factions"), + COMMAND_LIST_DESCRIPTION("\n &a&l» &7See a list of the factions"), COMMAND_LOCK_LOCKED("Factions is now locked"), COMMAND_LOCK_UNLOCKED("Factions in now unlocked"), @@ -332,6 +381,18 @@ public enum TL { COMMAND_MOD_PROMOTED("You have promoted %1$s to moderator."), COMMAND_MOD_DESCRIPTION("Give or revoke moderator rights"), + COMMAND_COLEADER_CANDIDATES("Players you can promote: "), + COMMAND_COLEADER_CLICKTOPROMOTE("Click to promote "), + COMMAND_COLEADER_NOTMEMBER("%1$s is not a member in your faction."), + COMMAND_COLEADER_NOTADMIN("You are not the faction admin."), + COMMAND_COLEADER_SELF("The target player musn't be yourself."), + COMMAND_COLEADER_TARGETISADMIN("The target player is a faction admin. Demote them first."), + COMMAND_COLEADER_REVOKES("You have removed coleader status from %1$s."), + COMMAND_COLEADER_REVOKED("%1$s is no longer coleader in your faction."), + COMMAND_COLEADER_PROMOTES("%1$s was promoted to coleader in your faction."), + COMMAND_COLEADER_PROMOTED("You have promoted %1$s to coleader."), + COMMAND_COLEADER_DESCRIPTION("Give or revoke coleader rights"), + COMMAND_MODIFYPOWER_ADDED("Added %1$f power to %2$s. New total rounded power: %3$d"), COMMAND_MODIFYPOWER_DESCRIPTION("Modify the power of a faction/player"), @@ -376,6 +437,8 @@ public enum TL { COMMAND_OWNER_ADDED("You have added %1$s to the owner list for this claimed land."), COMMAND_OWNER_DESCRIPTION("Set ownership of claimed land"), + COMMAND_KILLHOLOGRAMS_DESCRIPTION("Kill holograms in a radius, admin command"), + COMMAND_OWNERLIST_DISABLED("Sorry, but owned areas are disabled on this server."),//dup-> COMMAND_OWNERLIST_WRONGFACTION("This land is not claimed by your faction."),//eq COMMAND_OWNERLIST_NOTCLAIMED("This land is not claimed by any faction, thus no owners."),//eq @@ -393,7 +456,7 @@ public enum TL { COMMAND_PERM_INVALID_RELATION("Invalid relation defined. Try something like 'ally'"), COMMAND_PERM_INVALID_ACCESS("Invalid access defined. Try something like 'allow'"), COMMAND_PERM_INVALID_ACTION("Invalid action defined. Try something like 'build'"), - COMMAND_PERM_SET("&aSet permission &e%1$s &ato &b%2$s &afor relation &c%3$s"), + COMMAND_PERM_SET("Set permission %1$s to %2$s for relation %3$s"), COMMAND_PERM_TOP("RCT MEM OFF ALLY TRUCE NEUT ENEMY"), COMMAND_PERMANENT_DESCRIPTION("Toggles a faction's permanence"), //TODO: Real word? @@ -405,6 +468,7 @@ public enum TL { COMMAND_PROMOTE_SUCCESS("You successfully %1$s %2$s to %3$s"), COMMAND_PROMOTE_PROMOTED("promoted"), COMMAND_PROMOTE_DEMOTED("demoted"), + COMMAND_PROMOTE_COLEADER_ADMIN("&cColeaders cant promote players to Admin!"), COMMAND_PERMANENTPOWER_DESCRIPTION("Toggle faction power permanence"), //TODO: This a real word? COMMAND_PERMANENTPOWER_GRANT("added permanentpower status to"), @@ -420,10 +484,10 @@ public enum TL { COMMAND_POWER_TOSHOW("to show player power info"), COMMAND_POWER_FORSHOW("for showing player power info"), - COMMAND_POWER_POWER("%1$s - Power / Maxpower: %2$d / %3$d %4$s"), + COMMAND_POWER_POWER("%1$s &a&l» &7Power &a/ &7Maxpower&a: &a%2$d &7/&a%3$d %4$s"), COMMAND_POWER_BONUS(" (bonus: "), COMMAND_POWER_PENALTY(" (penalty: "), - COMMAND_POWER_DESCRIPTION("Show player power info"), + COMMAND_POWER_DESCRIPTION("\\n &a&l» &7Show player &apower &7info"), COMMAND_POWERBOOST_HELP_1("You must specify \"p\" or \"player\" to target a player or \"f\" or \"faction\" to target a faction."), COMMAND_POWERBOOST_HELP_2("ex. /f powerboost p SomePlayer 0.5 -or- /f powerboost f SomeFaction -5"), @@ -485,8 +549,17 @@ public enum TL { COMMAND_SETMAXVAULTS_DESCRIPTION("Set max vaults for a Faction."), COMMAND_SETMAXVAULTS_SUCCESS("&aSet max vaults for &e%s &ato &b%d"), - COMMAND_VAULT_DESCRIPTION("/f vault to open one of your Faction's vaults."), - COMMAND_VAULT_TOOHIGH("&cYou tried to open vault %d but your Faction only has %d vaults."), + COMMAND_VAULT_DESCRIPTION("Open your placed faction vault!"), + COMMAND_VAULT_INVALID("&cYour vault was either claimed, broken, or has not been placed yet."), + COMMAND_VAULT_OPENING("&cOpening faction vault."), + + COMMAND_GETVAULT_ALREADYSET("&cVault has already been set!"), + COMMAND_GETVAULT_ALREADYHAVE("&cYou already have a vault in your inventory!"), + COMMAND_GETVAULT_CHESTNEAR("&cThere is a chest nearby"), + COMMAND_GETVAULT_SUCCESS("&cSucessfully set vault."), + COMMAND_GETVAULT_INVALIDLOCATION("&cVault can only be placed in faction land!"), + COMMAND_GETVAULT_DESCRIPTION("Get the faction vault item!"), + COMMAND_GETVAULT_RECEIVE("&cYou have recieved a faction vault!"), COMMAND_SHOW_NOFACTION_SELF("You are not in a faction"), COMMAND_SHOW_NOFACTION_OTHER("That's not a faction"), @@ -512,6 +585,7 @@ public enum TL { COMMAND_SHOW_COMMANDDESCRIPTION("Show faction information"), COMMAND_SHOW_DEATHS_TIL_RAIDABLE("DTR: %1$d"), COMMAND_SHOW_EXEMPT("This faction is exempt and cannot be seen."), + COMMAND_SHOW_NEEDFACTION("&cYou need to join a faction to view your own!"), COMMAND_SHOWINVITES_PENDING("Players with pending invites: "), COMMAND_SHOWINVITES_CLICKTOREVOKE("Click to revoke invite for %1$s"), @@ -555,6 +629,16 @@ public enum TL { COMMAND_TOP_LINE("%d. &6%s: &c%s"), // Rank. Faction: Value COMMAND_TOP_INVALID("Could not sort by %s. Try balance, online, members, power or land."), + COMMAND_TNT_DISABLED_MSG("&cThis command is disabled!"), + COMMAND_TNT_INVALID_NUM("The amount needs to be a number!"), + COMMAND_TNT_DEPOSIT_SUCCESS("&cSuccessfully deposited tnt."), + COMMAND_TNT_WIDTHDRAW_SUCCESS("&cSuccessfully withdrew tnt."), + COMMAND_TNT_WIDTHDRAW_NOTENOUGH("&cNot enough tnt in inventory."), + COMMAND_TNT_DEPOSIT_NOTENOUGH("&cNot enough tnt in tnt bank."), + COMMAND_TNT_AMOUNT("&cYour faction has {amount} tnt in the tnt bank."), + COMMAND_TNT_POSITIVE("&cPlease use positive numbers!"), + COMMAND_TNT_DESCRIPTION("add/widthraw from faction's tnt bank"), + COMMAND_UNBAN_DESCRIPTION("Unban someone from your Faction"), COMMAND_UNBAN_NOTBANNED("&7%s &cisn't banned. Not doing anything."), COMMAND_UNBAN_UNBANNED("&e%1$s &cunbanned &7%2$s"), @@ -586,6 +670,17 @@ public enum TL { COMMAND_WARUNCLAIMALL_SUCCESS("You unclaimed ALL war zone land."), COMMAND_WARUNCLAIMALL_LOG("%1$s unclaimed all war zones."), + COMMAND_RULES_DISABLED_MSG("&cThis command is disabled!"), + COMMAND_RULES_DESCRIPTION("set/remove/add rules!"), + COMMAND_RULES_ADD_INVALIDARGS("Please include a rule!"), + COMMAND_RULES_SET_INVALIDARGS("Please include a line number & rule!"), + COMMAND_RULES_REMOVE_INVALIDARGS("Please include a line number!"), + COMMAND_RULES_ADD_SUCCESS("&cRule added successfully!"), + COMMAND_RULES_REMOVE_SUCCESS("&cRule removed successfully!"), + COMMAND_RULES_SET_SUCCESS("&cRule set successfully!"), + COMMAND_RULES_CLEAR_SUCCESS("&cRule cleared successfully!"), + + /** * Leaving - This is accessed through a command, and so it MAY need a COMMAND_* slug :s @@ -597,7 +692,7 @@ public enum TL { LEAVE_LEFT("%s left faction %s."), LEAVE_DISBANDED("%s was disbanded."), LEAVE_DISBANDEDLOG("The faction %s (%s) was disbanded due to the last player (%s) leaving."), - LEAVE_DESCRIPTION("Leave your faction"), + LEAVE_DESCRIPTION("\\n &a&l» &7Leave your faction"), /** * Claiming - Same as above basically. No COMMAND_* because it's not in a command class, but... @@ -650,7 +745,7 @@ public enum TL { GENERIC_SERVERADMIN("A server admin"), GENERIC_DISABLED("disabled"), GENERIC_ENABLED("enabled"), - GENERIC_INFINITY("∞"), + GENERIC_INFINITY("∞"), GENERIC_CONSOLEONLY("This command cannot be run as a player."), GENERIC_PLAYERONLY("This command can only be used by ingame players."), GENERIC_ASKYOURLEADER(" Ask your leader to:"), @@ -664,6 +759,11 @@ public enum TL { GENERIC_FACTIONTAG_ALPHANUMERIC("Faction tag must be alphanumeric. \"%s\" is not allowed."), GENERIC_PLACEHOLDER(""), + + + WARBANNER_NOFACTION("&cYou need a faction to use a warbanner!"), + WARBANNER_COOLDOWN("&cThe warbanner is on cooldown for your faction!"), + WARBANNER_INVALIDLOC("&cYou can only use warbanners in enemy land or the warzone"), /** * ASCII compass (for chat map) */ @@ -706,6 +806,7 @@ public enum TL { * Roles */ ROLE_ADMIN("admin"), + ROLE_COLEADER("coleader"), ROLE_MODERATOR("moderator"), ROLE_NORMAL("normal member"), ROLE_RECRUIT("recruit"), @@ -772,8 +873,6 @@ public enum TL { SAFEZONE_DESCRIPTION("safezone-description", "Free from pvp and monsters."), TOGGLE_SB("toggle-sb", "You now have scoreboards set to {value}"), FACTION_LEAVE("faction-leave", "Leaving %1$s, Entering %2$s"), - FACTION_ENTER_TITLE("faction-enter-title", ""), - FACTION_ENTER_SUBTITLE("faction-enter-subtitle", "%s"), FACTIONS_ANNOUNCEMENT_TOP("faction-announcement-top", "&d--Unread Faction Announcements--"), FACTIONS_ANNOUNCEMENT_BOTTOM("faction-announcement-bottom", "&d--Unread Faction Announcements--"), DEFAULT_PREFIX("default-prefix", "{relationcolor}[{faction}] &r"), diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index f692c110..55c93776 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -20,12 +20,6 @@ findfactionsexploit: cooldown: 2000 # in miliseconds. 2000 = 2 seconds. log: false - -# Essentials Hook -# Should we delete player homes that they set via Essentials when they leave a Faction if they have homes set in that -# Faction's territory? -delete-ess-homes: true - ### Hard Core Settings ### # Many of the features that are / are to come in this section have been requested by # people in relation to HCF servers. All settings are set to the normal Factions @@ -67,6 +61,13 @@ warp-cost: # Faction Fly # Enable Faction Fly: enable-faction-flight: true +fly-falldamage-cooldown: 10 +ffly: + Particles: + Enabled: true + AutoEnable: true #If set to true, fly will automatically enable when walking into your own chunk. + + # If a player leaves fly (out of territory or took damage) # how long should they not take fall damage for? @@ -78,18 +79,6 @@ fly-falldamage-cooldown: 3 # http://i.gyazo.com/6a1a31222e58a5d60ff341c13f6a8404.gif disable-pistons-in-territory: false -# Should we send titles when players enter Factions? -# This is the same as finfo.titles and can be shown in conjunction with scoreboard and chat if necessary. -# If you only want to show titles when entering territory, -# leave this true and set scoreboard.finfo.titles and scoreboard.alsosendchat to false. -enter-titles: - enabled: true - fade-in: 10 - stay: 70 - fade-out: 20 - also-show-chat: false - - # ToolTips # This section is to configure tooltips for things like /f list tooltips: @@ -99,12 +88,10 @@ tooltips: # It will not sure up for factionless of course, just actual factions. # You can use color codes here. list: - - "&6Leader: &f{leader}" - - "&6Claimed: &f{chunks}" - - "&6Raidable: &f{raidable}" - - "&6Warps: &f{warps}" - - "&6Power: &f{power}/{maxPower}" - - "&6Members: &f{online}/{members}" + - "&6&l* &eLeader: &7{leader}" + - "&6&l* &eClaims: &7{chunks}" + - "&6&l* &ePower: &7{power}/{maxPower}" + - "&6&l* &eMembers: &7{online}/{members}" # Show # This shows up when someone does /f show. @@ -113,10 +100,11 @@ tooltips: # {balance} will show their balance if you have vault installed. # {lastSeen} will show human readable info on when the player was last seen, or online. show: - - "&6Last Seen: &f{lastSeen}" - - "&6Power: &f{power}" - - "&6Rank: &f{group}" - - "&6Balance: &a${balance}" + - "&6&l* &eUsername: &7{name}" + - "&6&l* &eRank: &7{group}" + - "&6&l* &eBalance: &7${balance}" + - "&6&l* &eLast Seen:&7 {lastSeen}" + - "&6&l* &ePower: &7{power}/{maxPower}" # Configuration section for Scoreboards # This will allow you to completely customize how your scoreboards look. @@ -138,7 +126,7 @@ scoreboard: # {warps} - the number of warps that a faction has set. # The title of the scoreboard will be the Faction's tag and colored according to the relation with the player's Faction. # Commenting this section out will cause the info to appear in chat as the plugin originally did. - finfo-enabled: false # Default to false to keep original functionality. + finfo-enabled: false # SUPPORTS PLACEHOLDERS finfo: @@ -158,8 +146,8 @@ scoreboard: # {maxPower} - player's max power. # {powerBoost} - player's powerboost. - default-enabled: false # Default to false to keep original functionality. - default-title: "i love drt" # Can use any of the values from above but this won't update once it's set (so don't set {balance}). + default-enabled: true # Default to false to keep original functionality. + default-title: "&cSavageFactions" # Can use any of the values from above but this won't update once it's set (so don't set {balance}). default-update-interval: 2 # in seconds. # This will show faction prefixes colored based on relation on nametags and in the tab. @@ -167,28 +155,49 @@ scoreboard: default-prefixes: true # SUPPORTS PLACEHOLDERS - default: - - "&6Your Faction" - - "{faction}" - - "&3Your Power" - - "{power}" - - "&aBalance" - - "${balance}" - factionless-enabled: false + default: + - "&7&m--------------------------" + - "&4&lFaction Info &8»" + - " &8> &cLeader&7: &f{leader}" + - " &8> &cMembers&7: &f{online}&7/&f{members}" + - " &8> &cPower&7: &f{power}&7/&f{maxPower}" + - "&m" + - "&4&lFaction Stats &8»" + - " &8> &cKills&7: &f{faction-kills}" + - " &8> &cDeaths&7: &f{faction-deaths}" + - " &8> &cBalance&7: &f{faction-balance}" + - "" + - " &8> &cYour Balance&7: &f{balance}" + - "&7&m---------------------------" + + factionless-enabled: true factionless: - - "Make a new Faction" - - "Use /f create" + - "&7&m--------------------------" + - "&4&lInformation &8»" + - " &8> &cPlayer&7: &f{name}" + - " &8> &cRank&7: &f{group}" + - " &8> &cBalance&7: &f${balance}" + - "&m" + - "&4&lServer Info &8» " + - " &8» &cIFaction: &fN/A" + - " &8» &cOnline Players&7: &f{total-online}" + - "&7&m---------------------------" + # Configration section for warmups. # Warmup times are in seconds - if a value of 0 is set, there is no warmup. warmups: # Delay for /f home - f-home: 0 + f-home: 15 # Delay for /f warp - f-warp: 0 + f-warp: 10 # Delay for /f fly - f-fly: 0 + f-fly: 10 + #Delay for /f checkpoint's teleport + f-checkpoint: 10 + #Delay for /f tpbanner + f-banner: 10 ###################################################### #################### HCF Features #################### @@ -203,19 +212,19 @@ warmups: # It is advised that you set the default relation to -1 so they can always go back to that. # Otherwise Factions could be stuck with not being able to unenemy other Factions. max-relations: - enabled: false - ally: 10 - truce: 10 + enabled: true + ally: 1 + truce: 0 neutral: -1 - enemy: 10 + enemy: -1 -# WorldBorder support +# WorldBorder support # A buffer of 0 means faction claims can go right up to the border of the world. -# The buffer is in chunks, so 1 as a buffer means an entire chunk of buffer between +# The buffer is in chunks, so 1 as a buffer means an entire chunk of buffer between # the border of the world and what can be claimed to factions world-border: buffer: 0 - + # Raids # Allow a faction to be raided if they have more land than power. # This will make claimed territory lose all protections @@ -265,26 +274,25 @@ hcf: # SUPPORTS PLACEHOLDERS show: # First line can be {header} for default header, or any string (we recommend &m for smooth lines ;p) - - '{header}' - - 'Description: {description}' - - 'Joining: {joining} {peaceful}' - - 'Land / Power / Maxpower: {chunks}/{power}/{maxPower}' - - 'Founded: {create-date}' - - 'This faction is permanent, remaining even with no members.' # only shows if faction is permanent - - 'Land value: {land-value} {land-refund}' - - 'Balance: {faction-balance}' - - 'Bans: {faction-bancount}' - - 'Allies({allies}/{max-allies}): {allies-list} ' - - 'Online: ({online}/{members}): {online-list}' - - 'Offline: ({offline}/{members}): {offline-list}' - + - '&8&m--------------&7 &8<&e{faction}&8> &8&m--------------' + - '&6 * &eOwner &7{leader}' + - '&6 * &eDescription &7{description}' + - '&6 * &eLand / Power / Max Power: &7{chunks} &8/ &7{power} &8/ &7{maxPower}' + - '&6 * &eFounded &7{create-date}' + - '&6 * &eBalance &f{faction-balance}' + - '&6 * &eAllies &c{allies-list}' + - '&6 * &eEnemies &c{enemies-list}' + - '&6 * &eOnline Members &8(&7{online}/{members}&8) &7{online-list}' + - '&6 * &eOffline Members &8(&7{offline}/{members}&8) &7{offline-list}' + - '&6 * &eBans &7{faction-bancount}' + - '&8&m----------------------------------------' # For a /f show that does not display fancy messages that are essentially empty, use minimal-show minimal-show: false # Factions that should be exempt from /f show, case sensitive, useful for a # serverteam faction, since the command shows vanished players otherwise show-exempt: - - Put_faction_tag_here + - Wilderness # THIS IS FOR /f map tool tips. @@ -293,17 +301,13 @@ show-exempt: # Lines that arent defined wont be sent (home not set, faction not peaceful / permanent, dtr freeze) map: # First line can be {header} for default header, or any string (we recommend &m for smooth lines ;p) - - '{header}' - - 'Description: {description}' - - 'Joining: {joining} {peaceful}' - - 'Land / Power / Maxpower: {chunks}/{power}/{maxPower}' - - 'Founded: {create-date}' - - 'This faction is permanent, remaining even with no members.' # only shows if faction is permanent - - 'Land value: {land-value} {land-refund}' - - 'Balance: {balance}' - - 'Allies({allies}/{max-allies}): {allies-list} ' - - 'Online: ({online}/{members}): {online-list}' - - 'Offline: ({offline}/{members}): {offline-list}' + - '&6* &eFaction &7{faction}' + - '&6* &eOwner &7{leader}' + - '&6* &eLand / Power / Max Power: &7{chunks} &8/ &7{power} &8/ &7{maxPower}' + - '&6* &eAllies &c{allies-list}' + - '&6* &eEnemies &c{enemies-list}' + - '&6* &eOnline Members &8(&7{online}/{members}&8) {online-list}' + - '&6* &eOffline Members &7{offline-list}' ############################################################ # +------------------------------------------------------+ # @@ -313,11 +317,11 @@ map: list: # You can only use {pagenumber} and {pagecount} in the header - header: '&e&m----------&r&e[ &2Faction List &9{pagenumber}&e/&9{pagecount} &e]&m----------' + header: '&8&m-----------------&r &8< &eFaction List &8(&7{pagenumber}/{pagecount}&8) &8> &m-----------------' # You can use any variables here - factionless: 'Factionless {factionless} online' + factionless: '&7&o(( There are currently &f{total-online} &7&oPlayers online right now! ))' # You can use any variable here - entry: '{faction} {online} / {members} online, Land / Power / Maxpower: {chunks}/{power}/{maxPower}' + entry: '{faction} &8(&7{online}/{members}&8) &eLand / Power / Max Power &f{chunks}&7/&f{power}&7/&f{maxPower}' ############################################################ # +------------------------------------------------------+ # @@ -326,42 +330,50 @@ list: ############################################################ # set to true to use legacy factions help -use-old-help: true +use-old-help: false help: + + # You can change the page name to whatever you like # We use '1' to preserve default functionality of /f help 1 - '1': - - '&e&m----------------------------------------------' - - ' &c&lFactions Help ' - - '&e&m----------------------------------------------' - - '&3/f create &e>> &7Create your own faction' - - '&3/f who &e>> &7Show factions info' - - '&3/f tag &e>> &7Change faction tag' - - '&3/f join &e>> &7Join faction' - - '&3/f list &e>> &7List all factions' - - '&e&m--------------&r &2/f help 2 for more &e&m--------------' - '2': - - '&e&m------------------&r&c&l Page 2 &e&m--------------------' - - '&3/f home &e>> &7Teleport to faction home' - - '&3/f sethome &e>> &7Set your faction home' - - '&3/f leave &e>> &7Leave your faction' - - '&3/f invite &e>> &7Invite a player to your faction' - - '&3/f deinvite &e>> &7Revoke invitation to player' - - '&e&m--------------&r &2/f help 3 for more &e&m--------------' - '3': - - '&e&m------------------&r&c&l Page 3 &e&m--------------------' - - '&3/f claim &e>> &7Claim land' - - '&3/f unclaim &e>> &7Unclaim land' - - '&3/f kick &e>> &7Kick player from your faction' - - '&3/f mod &e>> &7Set player role in faction' - - '&3/f chat &e>> &7Switch to faction chat' - - '&e&m--------------&r &2/f help 4 for more &e&m--------------' - '4': - - '&e&m------------------&r&c&l Page 4 &e&m--------------------' - - '&3/f version &e>> &7Display version information' - - '&e&m--------------&r&2 End of /f help &e&m-----------------' - + '1': + - '&7&m----------------------------------------------------' + - '&6&lFactions Help &8- &f(1/2) ' + - '&7&m----------------------------------------------------' + - '&e/f create &f &8- &7Create your own faction.' + - '&e/f who &f &8- &7Show faction information.' + - '&e/f tag &f &8- &7Change your faction name.' + - '&e/f join &f &8- &7Join to the faction.' + - '&e/f list &8- &7List all factions.' + - '&e/f top &8- &7View the richest factions.' + - '&e/f map &8- &7Map of the surrounding area.' + - '&e/f sethome &8- &7Teleport to faction home.' + - '&e/f home &8- &7Set your faction home.' + - '&e/f ban &8- &7Ban a member from your faction.' + - '&e/f unban &8- &7Unban a member from your faction.' + - '&e/f banlist &8- &7List banned players from your faction.' + - '&7&m--------------------&r &e/f help 2 &7&m-----------------------' + '2': + - '&7&m----------------------------------------------------' + - '&6&lFactions Help &8- &f(2/2) ' + - '&7&m----------------------------------------------------' + - '&e/f leave &8- &7Leave your faction.' + - '&e/f invite &f &8- &7Invite a player to your faction.' + - '&e/f deinvite &f &8- &7Revoke invitation to player.' + - '&e/f claim &8- &7Claim a land for your faction.' + - '&e/f unclaim &8- &7Unclaim land from your faction.' + - '&e/f kick &f &8- &7Kick player from your faction.' + - '&e/f mod &f &8- &7Set player role in faction.' + - '&e/f chat &f &8- &7Switch to Faction/Ally/Public chat.' + - '&e/f warp &8- &7Opens the warp menu.' + - '&e/f setwarp &8- &7Set a warp.' + - '&e/f perms &8- &7Change what players can do in your claims.' + - '&e/f upgrades &8- &7Upgrade your factions core.' + - '&e/f checkpoint &8- &7Set a faction checkpoint.' + - '&e/f tnt add/take &8- &7Faction Based TNT Bank.' + - '&e/f version &8- &7Display current faction version.' + - '&7&m--------------------&r &e/f help 3 &7&m-----------------------' ############################################################ # +------------------------------------------------------+ # # | F Permission GUI | # @@ -389,29 +401,32 @@ help: fperm-gui: relation: # GUI Name - name: 'Factions Permissions' + name: 'Faction Permissions' # Amount of inventory rows, No larger than 5 - rows: 3 + rows: 4 # These are the slots where the relations are going to be placed on the first GUI # Note: Slots start at 0 and end at one less that GUI size + #Setting a slot to -1 will disable it slots: recruit: 10 normal: 11 moderator: 12 - truce: 13 - ally: 14 - enemy: 15 - neutral: 16 + coleader: 13 + truce: 21 + ally: 20 + enemy: 22 + neutral: 19 # Material to be displayed materials: recruit: WOOD_SWORD - normal: STONE_SWORD + normal: GOLD_SWORD moderator: IRON_SWORD + coleader: DIAMOND_SWORD truce: IRON_AXE - ally: DIAMOND_SWORD + ally: GOLD_AXE enemy: DIAMOND_AXE - neutral: STONE + neutral: WOOD_AXE # Dummy items using the Items lower down dummy-items: '0': @@ -428,13 +443,16 @@ fperm-gui: - 17 - 18 - 19 - - 20 - - 21 - - 22 - - 23 - - 24 - - 25 - 26 + - 27 + - 28 + - 29 + - 30 + - 31 + - 32 + - 33 + - 34 + - 35 # This is the item that all relation items are based off of # Replacing {relation} with relation name eg: Moderator, Ally # also replaces {relation-color} with relation color eg: Enemy;RED @@ -443,7 +461,7 @@ fperm-gui: lore: - action: - name: 'Factions Permissions' + name: 'Faction Permissions' rows: 4 # If this field exists colorable materials will be updated # https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/DyeColor.html @@ -523,20 +541,20 @@ fperm-gui: # {action-access} Access name eg: Allow, Deny # {action-access-color} Access color eg: Allow;GREEN placeholder-item: - name: '&8[&7{action}&8]' + name: '&e&l(!) &ePermission: &6&n{action}' lore: - - '&8Access:' - - '&8[{action-access-color}{action-access}&8]' - '' - - '&8Left click to &a&lAllow' - - '&8Right click to &c&lDeny' - - '&8Middle click to &lUndefine' + - '&6&l * &eStatus: &8[{action-access-color}{action-access}&8]' + - '' + - '&7Left click to &a&nAllow&7.' + - '&7Right click to &c&nDeny&7.' + - '&7Middle click to &7&nUndefine&7.' # Back item will be take you to the previous GUI back-item: - name: '&8&lBack' + name: '&c&l<- Back' material: ARROW lore: - - '&7Back button' + - '&7Click to return to previous menu.' # Dummy Items dummy-items: # Dummy Item id, used to set the slots above @@ -556,6 +574,7 @@ fperm-gui: fwarp-gui: name: "Faction Warps" rows: 3 + password-timeout: 5 warp-slots: - 11 - 12 @@ -588,12 +607,16 @@ fwarp-gui: - 26 warp-item: material: STONE - name: "&8[&5&l{warp}&8]" + name: "&e&l(!) &eFaction Warp: &6&n{warp}" # {warp-protected} Warp protection by password, Enabled & Disabled # {warp-cost} Warp cost lore: - - "&8Password: &l{warp-protected}" - - "&8Cost: &l{warp-cost}" + - "" + - "&6&l * &ePassword: &7{warp-protected}" + - "&6&l * &eCost: &7{warp-cost}" + - "" + - "&c&lNote: &7You need pay to teleport to" + - "&7a faction warp. Unless it's &nDisabled&7." # Dummy Items dummy-items: # Dummy Item id, used to set the slots above @@ -604,6 +627,223 @@ fwarp-gui: name: ' ' lore: - +############################################################ +# +------------------------------------------------------+ # +# | Faction Rules | # +# +------------------------------------------------------+ # +############################################################ +frules: + Enabled: true + default-rules: + - '&cDefault Faction Rules :(' + - '&cUse /f rules add to add a rule' +############################################################ +# +------------------------------------------------------+ # +# | Faction TNT Bank | # +# +------------------------------------------------------+ # +############################################################ +ftnt: + Enabled: true + +############################################################ +# +------------------------------------------------------+ # +# | Faction Checkpoints | # +# +------------------------------------------------------+ # +############################################################ +checkpoints: + Enabled: true + +############################################################ +# +------------------------------------------------------+ # +# | Faction Near | # +# +------------------------------------------------------+ # +############################################################ +fnear: + Enabled: true + Radius: 50 + + +############################################################ +# +------------------------------------------------------+ # +# | Faction Vault | # +# +------------------------------------------------------+ # +fvault: + Enabled: true + Item: + Name: '&e&l*&f&l*&e&l* &e&lFaction Vault &7(Place) &e&l*&f&l*&e&l*' + Lore: + - '&7Place this vault in your Faction claim, You will' + - '&7then be able to access it.' + - '' + - '&c&lNote: &7Once you have placed your' + - '&7faction vault, Access it by doing /f vault.' + +############################################################ +# +------------------------------------------------------+ # +# | Faction Upgrades | # +# +------------------------------------------------------+ # +############################################################ +fupgrades: + Enabled: true + MainMenu: + Title: '{faction}''s Upgrade Menu' + DummyItem: + Name: '&f' + Type: STAINED_GLASS_PANE + Amount: 1 + Damage: 7 + Lore: + - '' + rows: 3 + slots: + - 0 + - 1 + - 2 + - 3 + - 4 + - 5 + - 6 + - 7 + - 8 + - 9 + - 10 + - 11 + - 12 + - 13 + - 14 + - 15 + - 16 + - 17 + - 18 + - 19 + - 20 + - 21 + - 22 + - 23 + - 24 + - 25 + - 26 + Crops: + Crop-Boost: + level-1: 10 + level-2: 20 + level-3: 30 + Cost: + level-1: 250000 + level-2: 500000 + level-3: 750000 + CropItem: + Name: '&e&lUpgrade Growth Speed' + Type: WHEAT + Amount: 1 + Damage: 0 + Lore: + - '&7Increase growth speed of crops in claims.' + - '&7&o(Chance to Grow Two Levels)' + - '' + - '&e&lTier' + - '&f&l* &7Current Level: &n{level}' + - '' + - '&e&lPerks' + - '&f&l* &7Level 1 - &f10% Chance' + - '&7 - Cost: $250,000' + - '&f&l* &7Level 2 - &f20% Chance' + - '&7 - Cost: $500,000' + - '&f&l* &7Level 3 - &f30% Chance' + - '&7 - Cost: $750,000' + - '' + - '&e&lClick to &nUnlock' + slots: + - 10 + EXP: + EXP-Boost: + level-1: 1.5 + level-2: 2.0 + level-3: 2.5 + Cost: + level-1: 2000000 + level-2: 4000000 + level-3: 6000000 + EXPItem: + Name: '&e&lUpgrade EXP Drop Rate' + Type: EXP_BOTTLE + Amount: 1 + Damage: 0 + Lore: + - '&7Increased Vanilla XP gained from monsters.' + - '' + - '&e&lTier' + - '&f&l* &7Current Level: &n{level}' + - '' + - '&e&lPerks' + - '&f&l* &7Level 1 - &f1.5x Multiplier' + - '&7 - Cost: $2,000,000' + - '&f&l* &7Level 2 - &f2.0x Multiplier' + - '&7 - Cost: $4,000,000' + - '&f&l* &7Level 3 - &f2.5x Multiplier' + - '&7 - Cost: $6,000,000' + - '' + - '&e&lClick to &nUnlock' + slots: + - 13 + Spawners: + Spawner-Boost: + # This is a Percentage so .10 means 10% lowered spawner delay! + level-1: 0.10 + level-2: 0.20 + level-3: 0.30 + Cost: + level-1: 1000000 + level-2: 2000000 + level-3: 3000000 + SpawnerItem: + Name: '&e&lUpgrade Spawn Rate' + Type: MOB_SPAWNER + Amount: 1 + Damage: 0 + Lore: + - '&7Decreased mob spawner delay in claims.' + - '' + - '&e&lTier' + - '&f&l* &7Current Level: &n{level}' + - '' + - '&e&lPerks' + - '&f&l* &7Level 1 - &f10% Lower Delay' + - '&7 - Cost: $1,000,000' + - '&f&l* &7Level 2 - &f20% Lower Delay' + - '&7 - Cost: $2,000,000' + - '&f&l* &7Level 3 - &f30% Lower Delay' + - '&7 - Cost: $3,000,000' + - '' + - '&e&lClick to &nUnlock' + slots: + - 16 + +fbanners: + Item: + Name: '&e&l*&f&l*&e&l* &e&lWar Banner &7(Place) &e&l*&f&l*&e&l*' + Lore: + - '&7Place this banner in the &nWarzone.&7 This' + - '&7will create a &nWarp Point&7 for your faction members.' + - '' + - '&e&lEffects' + - '&e&l* &fStrength II' + - '&e&l* &fSpeed II' + Banner-Cost: 5000 #The amount charged to change a banner into a War Banner + Banner-Time: 60 #IN SECONDS - This is how long the banner will last. + Banner-Place-Cooldown: 300 + Banner-Effect-Radius: 16 + Effects: + - INCREASE_DAMAGE:2 + - SPEED:2 + BannerHolo: '&c{Faction}''s War Banner' + +#Title when moving between chunks +Title: + Show-Title: true + Format: + Title: '{Faction}' + Subtitle: '{Description}' ############################################################ # +------------------------------------------------------+ # diff --git a/src/main/resources/lang.yml b/src/main/resources/lang.yml index b889fd35..636d7d7d 100644 --- a/src/main/resources/lang.yml +++ b/src/main/resources/lang.yml @@ -1,4 +1,4 @@ -# Lang file for FactionsUUID by drtshock +# Lang file for FactionsUUID by drtshock & ProSavage # Use & for color codes. # Made with love <3 diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index d3482df8..0bdd37e0 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,7 +1,7 @@ name: Factions -version: ${project.version}-b${build.number} +version: ${project.version}-SF-1.0.17 main: com.massivecraft.factions.P -authors: [Olof Larsson, Brett Flannigan, drtshock] +authors: [Olof Larsson, Brett Flannigan, drtshock, ProSavage] softdepend: [PlayerVaults, PlaceholderAPI, MVdWPlaceholderAPI, PermissionsEx, Permissions, Essentials, EssentialsChat, HeroChat, iChat, LocalAreaChat, LWC, nChat, ChatManager, CAPI, AuthMe, Vault, Spout, WorldEdit, WorldGuard, AuthDB, CaptureThePoints, CombatTag, dynmap, FactionsTop] commands: factions: @@ -103,6 +103,10 @@ permissions: factions.mapheight: true factions.ban: true factions.fly: true + factions.tnt: true + factions.checkpoint: true + factions.rules: true + factions.setwarp: true factions.admin: description: hand over your admin rights factions.admin.any: @@ -286,3 +290,25 @@ permissions: description: Ban players from Factions factions.fly: description: Allow use of /f fly + factions.rules: + description: add/remove/set rules for your own faction. + factions.checkpoint: + description: set or go to faction checkpoint + factions.tnt: + description: add/take from faction bank + factions.near: + description: get nearby faction members + factions.upgrades: + description: open upgrade menu + factions.freecam: + description: enable/disable freecam + factions.getvault: + description: get faction vault item + factions.coleader: + description: promote member to co leader + factions.tpbanner: + description: teleport to banner + factions.banner: + description: create banner + factions.killholos: + description: kill invisible holograms