diff --git a/pom.xml b/pom.xml index 0208d395..302244b0 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.massivecraft Factions - 1.6.9.5-U0.1.3 + 1.6.9.5-U0.1.4 jar Factions diff --git a/src/main/java/com/massivecraft/factions/Board.java b/src/main/java/com/massivecraft/factions/Board.java index 49362587..30193138 100644 --- a/src/main/java/com/massivecraft/factions/Board.java +++ b/src/main/java/com/massivecraft/factions/Board.java @@ -13,6 +13,7 @@ import java.util.Map.Entry; public class Board { + private static transient File file = new File(P.p.getDataFolder(), "board.json"); private static transient HashMap flocationIds = new HashMap(); diff --git a/src/main/java/com/massivecraft/factions/Conf.java b/src/main/java/com/massivecraft/factions/Conf.java index 3c321f4d..3aae25c2 100644 --- a/src/main/java/com/massivecraft/factions/Conf.java +++ b/src/main/java/com/massivecraft/factions/Conf.java @@ -7,6 +7,7 @@ import org.bukkit.entity.EntityType; import java.util.*; public class Conf { + public static List baseCommandAliases = new ArrayList(); public static boolean allowNoSlashCommand = true; diff --git a/src/main/java/com/massivecraft/factions/FPlayer.java b/src/main/java/com/massivecraft/factions/FPlayer.java index bff654bc..54afa5ee 100644 --- a/src/main/java/com/massivecraft/factions/FPlayer.java +++ b/src/main/java/com/massivecraft/factions/FPlayer.java @@ -6,6 +6,7 @@ import com.massivecraft.factions.iface.EconomyParticipator; import com.massivecraft.factions.iface.RelationParticipator; import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.Worldguard; +import com.massivecraft.factions.scoreboards.FInfoBoard; import com.massivecraft.factions.struct.ChatMode; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Relation; @@ -536,12 +537,18 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator { } public void sendFactionHereMessage() { - Faction factionHere = Board.getFactionAt(this.getLastStoodAt()); - String msg = P.p.txt.parse("") + " ~ " + factionHere.getTag(this); - if (factionHere.getDescription().length() > 0) { - msg += " - " + factionHere.getDescription(); + Faction toShow = Board.getFactionAt(getLastStoodAt()); + if (!toShow.isWarZone() && !toShow.isNone() && !toShow.isSafeZone() && P.p.getConfig().contains("scoreboard.finfo") && P.p.cmdBase.cmdSB.showBoard(this)) { + // Shows them the scoreboard instead of sending a message in chat. Will disappear after a few seconds. + new FInfoBoard(getPlayer(), toShow, true); + } else { + Faction factionHere = Board.getFactionAt(this.getLastStoodAt()); + String msg = P.p.txt.parse("") + " ~ " + factionHere.getTag(this); + if (factionHere.getDescription().length() > 0) { + msg += " - " + factionHere.getDescription(); + } + this.sendMessage(msg); } - this.sendMessage(msg); } // ------------------------------- @@ -676,6 +683,7 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator { error = P.p.txt.parse("You must start claiming land at the border of the territory."); } } + // TODO: Add more else if statements. if (notifyFailure && error != null) { msg(error); @@ -747,7 +755,7 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator { } // -------------------------------------------- // - // Persistance + // Persistence // -------------------------------------------- // @Override diff --git a/src/main/java/com/massivecraft/factions/FPlayers.java b/src/main/java/com/massivecraft/factions/FPlayers.java index 4cfbcce5..a0e8f0a4 100644 --- a/src/main/java/com/massivecraft/factions/FPlayers.java +++ b/src/main/java/com/massivecraft/factions/FPlayers.java @@ -10,6 +10,7 @@ import java.util.concurrent.ConcurrentSkipListMap; import java.util.concurrent.CopyOnWriteArrayList; public class FPlayers extends PlayerEntityCollection { + public static FPlayers i = new FPlayers(); P p = P.p; diff --git a/src/main/java/com/massivecraft/factions/Faction.java b/src/main/java/com/massivecraft/factions/Faction.java index ae46669f..73e8e5d8 100644 --- a/src/main/java/com/massivecraft/factions/Faction.java +++ b/src/main/java/com/massivecraft/factions/Faction.java @@ -22,6 +22,7 @@ import java.util.concurrent.ConcurrentHashMap; public class Faction extends Entity implements EconomyParticipator { + // FIELD: relationWish private Map relationWish; diff --git a/src/main/java/com/massivecraft/factions/Factions.java b/src/main/java/com/massivecraft/factions/Factions.java index 83ad1f2d..f413b346 100644 --- a/src/main/java/com/massivecraft/factions/Factions.java +++ b/src/main/java/com/massivecraft/factions/Factions.java @@ -17,6 +17,7 @@ import java.util.concurrent.CopyOnWriteArrayList; import java.util.logging.Level; public class Factions extends EntityCollection { + public static Factions i = new Factions(); P p = P.p; diff --git a/src/main/java/com/massivecraft/factions/P.java b/src/main/java/com/massivecraft/factions/P.java index 8fa9cb64..cb8dbaf4 100644 --- a/src/main/java/com/massivecraft/factions/P.java +++ b/src/main/java/com/massivecraft/factions/P.java @@ -30,7 +30,9 @@ import java.util.logging.Level; public class P extends MPlugin { - // Our single plugin instance + + // Our single plugin instance. + // Single 4 life. public static P p; // Listeners @@ -40,7 +42,7 @@ public class P extends MPlugin { public final FactionsExploitListener exploitListener; public final FactionsBlockListener blockListener; - // Persistance related + // Persistence related private boolean locked = false; public boolean getLocked() { @@ -112,6 +114,8 @@ public class P extends MPlugin { getServer().getPluginManager().registerEvents(exploitListener, this); getServer().getPluginManager().registerEvents(blockListener, this); + saveDefaultConfig(); + // since some other plugins execute commands directly through this command interface, provide it this.getCommand(this.refCommand).setExecutor(this); @@ -138,6 +142,8 @@ public class P extends MPlugin { this.getServer().getScheduler().cancelTask(AutoLeaveTask); AutoLeaveTask = null; } + + cmdBase.cmdSB.save(); super.onDisable(); } @@ -307,4 +313,14 @@ public class P extends MPlugin { } return players; } + + public void debug(Level level, String s) { + if (getConfig().getBoolean("debug", false)) { + getLogger().log(level, s); + } + } + + public void debug(String s) { + debug(Level.INFO, s); + } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdAdmin.java b/src/main/java/com/massivecraft/factions/cmd/CmdAdmin.java index fb971e93..aa5d4e9b 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdAdmin.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdAdmin.java @@ -9,6 +9,7 @@ import com.massivecraft.factions.struct.Role; import org.bukkit.Bukkit; public class CmdAdmin extends FCommand { + public CmdAdmin() { super(); this.aliases.add("admin"); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdAutoClaim.java b/src/main/java/com/massivecraft/factions/cmd/CmdAutoClaim.java index 13c36e5d..5fe0d2b5 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdAutoClaim.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdAutoClaim.java @@ -5,6 +5,7 @@ import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Role; public class CmdAutoClaim extends FCommand { + public CmdAutoClaim() { super(); this.aliases.add("autoclaim"); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdAutoHelp.java b/src/main/java/com/massivecraft/factions/cmd/CmdAutoHelp.java index 6df148db..ac77e296 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdAutoHelp.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdAutoHelp.java @@ -7,6 +7,7 @@ import com.massivecraft.factions.zcore.MCommand; import java.util.ArrayList; public class CmdAutoHelp extends MCommand

{ + public CmdAutoHelp() { super(P.p); this.aliases.add("?"); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdBoom.java b/src/main/java/com/massivecraft/factions/cmd/CmdBoom.java index 62e27956..65c34424 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdBoom.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdBoom.java @@ -4,6 +4,7 @@ import com.massivecraft.factions.Conf; import com.massivecraft.factions.struct.Permission; public class CmdBoom extends FCommand { + public CmdBoom() { super(); this.aliases.add("noboom"); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdBypass.java b/src/main/java/com/massivecraft/factions/cmd/CmdBypass.java index 1955501f..1fa470da 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdBypass.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdBypass.java @@ -4,6 +4,7 @@ import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; public class CmdBypass extends FCommand { + public CmdBypass() { super(); this.aliases.add("bypass"); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdChatSpy.java b/src/main/java/com/massivecraft/factions/cmd/CmdChatSpy.java index 2c1f8dc8..12b97523 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdChatSpy.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdChatSpy.java @@ -4,6 +4,7 @@ import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; public class CmdChatSpy extends FCommand { + public CmdChatSpy() { super(); this.aliases.add("chatspy"); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdConfig.java b/src/main/java/com/massivecraft/factions/cmd/CmdConfig.java index 75dae7b5..24050921 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdConfig.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdConfig.java @@ -14,6 +14,7 @@ import java.util.HashMap; import java.util.Set; public class CmdConfig extends FCommand { + private static HashMap properFieldNames = new HashMap(); public CmdConfig() { diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdCreate.java b/src/main/java/com/massivecraft/factions/cmd/CmdCreate.java index 9307e3cc..bf45f706 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdCreate.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdCreate.java @@ -11,6 +11,7 @@ import java.util.ArrayList; public class CmdCreate extends FCommand { + public CmdCreate() { super(); this.aliases.add("create"); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdDescription.java b/src/main/java/com/massivecraft/factions/cmd/CmdDescription.java index bdd815c1..4a0d29e5 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdDescription.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdDescription.java @@ -7,6 +7,7 @@ import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.zcore.util.TextUtil; public class CmdDescription extends FCommand { + public CmdDescription() { super(); this.aliases.add("desc"); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdDisband.java b/src/main/java/com/massivecraft/factions/cmd/CmdDisband.java index 8b16de82..33a86dc5 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdDisband.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdDisband.java @@ -10,6 +10,7 @@ import org.bukkit.Bukkit; public class CmdDisband extends FCommand { + public CmdDisband() { super(); this.aliases.add("disband"); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdInvite.java b/src/main/java/com/massivecraft/factions/cmd/CmdInvite.java index 3598d103..35b9b3f0 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdInvite.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdInvite.java @@ -5,6 +5,7 @@ import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.struct.Permission; public class CmdInvite extends FCommand { + public CmdInvite() { super(); this.aliases.add("invite"); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdJoin.java b/src/main/java/com/massivecraft/factions/cmd/CmdJoin.java index 231dbd38..67faa253 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdJoin.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdJoin.java @@ -6,6 +6,7 @@ import com.massivecraft.factions.struct.Permission; import org.bukkit.Bukkit; public class CmdJoin extends FCommand { + public CmdJoin() { super(); this.aliases.add("join"); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdMap.java b/src/main/java/com/massivecraft/factions/cmd/CmdMap.java index d1e902b3..5e19bd9b 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdMap.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdMap.java @@ -7,6 +7,7 @@ import com.massivecraft.factions.struct.Permission; public class CmdMap extends FCommand { + public CmdMap() { super(); this.aliases.add("map"); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdMoney.java b/src/main/java/com/massivecraft/factions/cmd/CmdMoney.java index ea7f81c3..ff01663f 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdMoney.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdMoney.java @@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.P; public class CmdMoney extends FCommand { + public CmdMoneyBalance cmdMoneyBalance = new CmdMoneyBalance(); public CmdMoneyDeposit cmdMoneyDeposit = new CmdMoneyDeposit(); public CmdMoneyWithdraw cmdMoneyWithdraw = new CmdMoneyWithdraw(); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdMoneyBalance.java b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyBalance.java index bd8d7bdd..a3f5b4d2 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdMoneyBalance.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyBalance.java @@ -5,6 +5,7 @@ import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.struct.Permission; public class CmdMoneyBalance extends FCommand { + public CmdMoneyBalance() { super(); this.aliases.add("b"); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferFf.java b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferFf.java index 4c54a8e8..8ff5b046 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferFf.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferFf.java @@ -9,6 +9,7 @@ import org.bukkit.ChatColor; public class CmdMoneyTransferFf extends FCommand { + public CmdMoneyTransferFf() { this.aliases.add("ff"); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferFp.java b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferFp.java index 2fbdea10..66bfb540 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferFp.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferFp.java @@ -9,6 +9,7 @@ import org.bukkit.ChatColor; public class CmdMoneyTransferFp extends FCommand { + public CmdMoneyTransferFp() { this.aliases.add("fp"); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferPf.java b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferPf.java index f6aa5238..fc9e856a 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferPf.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyTransferPf.java @@ -9,6 +9,7 @@ import org.bukkit.ChatColor; public class CmdMoneyTransferPf extends FCommand { + public CmdMoneyTransferPf() { this.aliases.add("pf"); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdMoneyWithdraw.java b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyWithdraw.java index 67c1408f..f1816a27 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdMoneyWithdraw.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdMoneyWithdraw.java @@ -9,6 +9,7 @@ import org.bukkit.ChatColor; public class CmdMoneyWithdraw extends FCommand { + public CmdMoneyWithdraw() { this.aliases.add("w"); this.aliases.add("withdraw"); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdOpen.java b/src/main/java/com/massivecraft/factions/cmd/CmdOpen.java index a71254fe..b8916c0a 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdOpen.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdOpen.java @@ -6,6 +6,7 @@ import com.massivecraft.factions.Factions; import com.massivecraft.factions.struct.Permission; public class CmdOpen extends FCommand { + public CmdOpen() { super(); this.aliases.add("open"); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdPermanent.java b/src/main/java/com/massivecraft/factions/cmd/CmdPermanent.java index a7939edb..847361c8 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdPermanent.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdPermanent.java @@ -8,6 +8,7 @@ import com.massivecraft.factions.struct.Permission; public class CmdPermanent extends FCommand { + public CmdPermanent() { super(); this.aliases.add("permanent"); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdPowerBoost.java b/src/main/java/com/massivecraft/factions/cmd/CmdPowerBoost.java index 027a7d74..19c8211c 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdPowerBoost.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdPowerBoost.java @@ -6,6 +6,7 @@ import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; public class CmdPowerBoost extends FCommand { + public CmdPowerBoost() { super(); this.aliases.add("powerboost"); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdRelationAlly.java b/src/main/java/com/massivecraft/factions/cmd/CmdRelationAlly.java index fa597730..2520994f 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdRelationAlly.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdRelationAlly.java @@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.struct.Relation; public class CmdRelationAlly extends FRelationCommand { + public CmdRelationAlly() { aliases.add("ally"); targetRelation = Relation.ALLY; diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdRelationEnemy.java b/src/main/java/com/massivecraft/factions/cmd/CmdRelationEnemy.java index 4a22aa00..720f0efe 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdRelationEnemy.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdRelationEnemy.java @@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.struct.Relation; public class CmdRelationEnemy extends FRelationCommand { + public CmdRelationEnemy() { aliases.add("enemy"); targetRelation = Relation.ENEMY; diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdRelationNeutral.java b/src/main/java/com/massivecraft/factions/cmd/CmdRelationNeutral.java index db340ed6..4dba5c03 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdRelationNeutral.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdRelationNeutral.java @@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.struct.Relation; public class CmdRelationNeutral extends FRelationCommand { + public CmdRelationNeutral() { aliases.add("neutral"); targetRelation = Relation.NEUTRAL; diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdSB.java b/src/main/java/com/massivecraft/factions/cmd/CmdSB.java new file mode 100644 index 00000000..73ace79b --- /dev/null +++ b/src/main/java/com/massivecraft/factions/cmd/CmdSB.java @@ -0,0 +1,91 @@ +package com.massivecraft.factions.cmd; + +import com.massivecraft.factions.FPlayer; +import com.massivecraft.factions.P; +import com.massivecraft.factions.struct.Permission; +import com.massivecraft.factions.zcore.util.TL; +import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.entity.Player; + +import java.io.File; +import java.io.IOException; +import java.util.UUID; + +public class CmdSB extends FCommand { + + private YamlConfiguration settings; + private File file; + + public CmdSB() { + this.aliases.add("sb"); + this.permission = Permission.SCOREBOARD.node; + this.senderMustBePlayer = true; + // Hope I didn't miss anything. + + file = new File(P.p.getDataFolder(), "playerBoardToggle.yml"); + if (!file.exists()) { + try { + file.createNewFile(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + settings = YamlConfiguration.loadConfiguration(file); + } + + @Override + public void perform() { + boolean toggle = toggle(me.getPlayer().getUniqueId()); + me.sendMessage(TL.TOGGLE_SB.toString().replace("{value}", String.valueOf(toggle))); + } + + /** + * Toggle a player seeing scoreboards or not. + * + * @param uuid - uuid of player. + * + * @return - true if now set to seeing scoreboards, otherwise false. + */ + public boolean toggle(UUID uuid) { + if (settings.getStringList("off").contains(uuid.toString())) { + settings.getStringList("off").remove(uuid.toString()); + save(); + return true; + } else { + settings.getStringList("off").add(uuid.toString()); + save(); + return false; + } + } + + public void save() { + try { + settings.save(file); + } catch (IOException e) { + e.printStackTrace(); + } + } + + /** + * Determines whether or not to show the player a scoreboard. + * + * @param player - FPlayer in question. + * + * @return - true if should show, otherwise false. + */ + public boolean showBoard(FPlayer player) { + return showBoard(player.getPlayer()); + } + + /** + * Determines whether or not to show the player a scoreboard. + * + * @param player - Player in question. + * + * @return - true if should show, otherwise false. + */ + public boolean showBoard(Player player) { + return !settings.getStringList("off").contains(player.getUniqueId().toString()); + } +} diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdSethome.java b/src/main/java/com/massivecraft/factions/cmd/CmdSethome.java index 3ca504b8..e7532838 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdSethome.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdSethome.java @@ -8,6 +8,7 @@ import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Role; public class CmdSethome extends FCommand { + public CmdSethome() { this.aliases.add("sethome"); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdTitle.java b/src/main/java/com/massivecraft/factions/cmd/CmdTitle.java index 03277268..0d43492c 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdTitle.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdTitle.java @@ -6,6 +6,7 @@ import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.zcore.util.TextUtil; public class CmdTitle extends FCommand { + public CmdTitle() { this.aliases.add("title"); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdUnclaim.java b/src/main/java/com/massivecraft/factions/cmd/CmdUnclaim.java index f70eb154..ba45115a 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdUnclaim.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdUnclaim.java @@ -8,6 +8,7 @@ import com.massivecraft.factions.struct.Role; import org.bukkit.Bukkit; public class CmdUnclaim extends FCommand { + public CmdUnclaim() { this.aliases.add("unclaim"); this.aliases.add("declaim"); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdUnclaimall.java b/src/main/java/com/massivecraft/factions/cmd/CmdUnclaimall.java index 354d1067..9ff4330e 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdUnclaimall.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdUnclaimall.java @@ -9,6 +9,7 @@ import com.massivecraft.factions.struct.Permission; import org.bukkit.Bukkit; public class CmdUnclaimall extends FCommand { + public CmdUnclaimall() { this.aliases.add("unclaimall"); this.aliases.add("declaimall"); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdVersion.java b/src/main/java/com/massivecraft/factions/cmd/CmdVersion.java index c1cdc8e6..ffa6e77b 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdVersion.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdVersion.java @@ -5,6 +5,7 @@ import com.massivecraft.factions.struct.Permission; public class CmdVersion extends FCommand { + public CmdVersion() { this.aliases.add("version"); diff --git a/src/main/java/com/massivecraft/factions/cmd/FCmdRoot.java b/src/main/java/com/massivecraft/factions/cmd/FCmdRoot.java index a26c06a8..ef0cb5e3 100644 --- a/src/main/java/com/massivecraft/factions/cmd/FCmdRoot.java +++ b/src/main/java/com/massivecraft/factions/cmd/FCmdRoot.java @@ -5,6 +5,7 @@ import com.massivecraft.factions.Conf; import java.util.Collections; public class FCmdRoot extends FCommand { + public CmdAdmin cmdAdmin = new CmdAdmin(); public CmdAutoClaim cmdAutoClaim = new CmdAutoClaim(); public CmdBoom cmdBoom = new CmdBoom(); @@ -50,6 +51,7 @@ public class FCmdRoot extends FCommand { public CmdUnclaimall cmdUnclaimall = new CmdUnclaimall(); public CmdVersion cmdVersion = new CmdVersion(); public CmdWarunclaimall cmdWarunclaimall = new CmdWarunclaimall(); + public CmdSB cmdSB = new CmdSB(); public FCmdRoot() { super(); @@ -117,6 +119,7 @@ public class FCmdRoot extends FCommand { this.addSubCommand(this.cmdUnclaimall); this.addSubCommand(this.cmdVersion); this.addSubCommand(this.cmdWarunclaimall); + this.addSubCommand(this.cmdSB); } @Override diff --git a/src/main/java/com/massivecraft/factions/cmd/FCommand.java b/src/main/java/com/massivecraft/factions/cmd/FCommand.java index d2e987c8..274f0ae4 100644 --- a/src/main/java/com/massivecraft/factions/cmd/FCommand.java +++ b/src/main/java/com/massivecraft/factions/cmd/FCommand.java @@ -13,6 +13,7 @@ import java.util.List; public abstract class FCommand extends MCommand

{ + public boolean disableOnLock; public FPlayer fme; diff --git a/src/main/java/com/massivecraft/factions/cmd/FRelationCommand.java b/src/main/java/com/massivecraft/factions/cmd/FRelationCommand.java index 05f14f27..d79338fe 100644 --- a/src/main/java/com/massivecraft/factions/cmd/FRelationCommand.java +++ b/src/main/java/com/massivecraft/factions/cmd/FRelationCommand.java @@ -9,6 +9,7 @@ import org.bukkit.Bukkit; import org.bukkit.ChatColor; public abstract class FRelationCommand extends FCommand { + public Relation targetRelation; public FRelationCommand() { diff --git a/src/main/java/com/massivecraft/factions/iface/EconomyParticipator.java b/src/main/java/com/massivecraft/factions/iface/EconomyParticipator.java index ba66a878..ed8e7cf9 100644 --- a/src/main/java/com/massivecraft/factions/iface/EconomyParticipator.java +++ b/src/main/java/com/massivecraft/factions/iface/EconomyParticipator.java @@ -1,6 +1,7 @@ package com.massivecraft.factions.iface; public interface EconomyParticipator extends RelationParticipator { + public String getAccountId(); public void msg(String str, Object... args); diff --git a/src/main/java/com/massivecraft/factions/iface/RelationParticipator.java b/src/main/java/com/massivecraft/factions/iface/RelationParticipator.java index d8d93a5d..3bc3f669 100644 --- a/src/main/java/com/massivecraft/factions/iface/RelationParticipator.java +++ b/src/main/java/com/massivecraft/factions/iface/RelationParticipator.java @@ -4,6 +4,7 @@ import com.massivecraft.factions.struct.Relation; import org.bukkit.ChatColor; public interface RelationParticipator { + public String describeTo(RelationParticipator that); public String describeTo(RelationParticipator that, boolean ucfirst); diff --git a/src/main/java/com/massivecraft/factions/integration/Econ.java b/src/main/java/com/massivecraft/factions/integration/Econ.java index 64cbfa69..4c77e024 100644 --- a/src/main/java/com/massivecraft/factions/integration/Econ.java +++ b/src/main/java/com/massivecraft/factions/integration/Econ.java @@ -16,6 +16,7 @@ import java.util.logging.Level; public class Econ { + private static Economy econ = null; public static void setup() { diff --git a/src/main/java/com/massivecraft/factions/integration/Worldguard.java b/src/main/java/com/massivecraft/factions/integration/Worldguard.java index 4eca6d28..caf05e2b 100644 --- a/src/main/java/com/massivecraft/factions/integration/Worldguard.java +++ b/src/main/java/com/massivecraft/factions/integration/Worldguard.java @@ -27,6 +27,7 @@ import static com.sk89q.worldguard.bukkit.BukkitUtil.toVector; */ public class Worldguard { + private static WorldGuardPlugin wg; private static boolean enabled = false; diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java index 2749d3be..e8155db0 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java @@ -15,6 +15,7 @@ import org.bukkit.event.block.*; public class FactionsBlockListener implements Listener { + public P p; public FactionsBlockListener(P p) { diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsChatListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsChatListener.java index 6e11ffe1..ebd7d242 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsChatListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsChatListener.java @@ -16,6 +16,7 @@ import java.util.logging.Level; public class FactionsChatListener implements Listener { + public P p; public FactionsChatListener(P p) { diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java index 1e3f4b6e..6774fd1d 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsEntityListener.java @@ -25,6 +25,7 @@ import java.util.*; public class FactionsEntityListener implements Listener { + public P p; public FactionsEntityListener(P p) { diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsExploitListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsExploitListener.java index 580111b1..66dcd2e2 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsExploitListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsExploitListener.java @@ -12,6 +12,7 @@ import org.bukkit.event.player.PlayerTeleportEvent; public class FactionsExploitListener implements Listener { + @EventHandler(priority = EventPriority.NORMAL) public void obsidianGenerator(BlockFromToEvent event) { if (event.isCancelled() == true || !Conf.handleExploitObsidianGenerators) { diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java index d38149cf..e8b256cd 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java @@ -22,6 +22,7 @@ import java.util.Map; public class FactionsPlayerListener implements Listener { + public P p; public FactionsPlayerListener(P p) { diff --git a/src/main/java/com/massivecraft/factions/scoreboards/FInfoBoard.java b/src/main/java/com/massivecraft/factions/scoreboards/FInfoBoard.java new file mode 100644 index 00000000..e012ae7c --- /dev/null +++ b/src/main/java/com/massivecraft/factions/scoreboards/FInfoBoard.java @@ -0,0 +1,72 @@ +package com.massivecraft.factions.scoreboards; + +import com.massivecraft.factions.FPlayer; +import com.massivecraft.factions.FPlayers; +import com.massivecraft.factions.Faction; +import com.massivecraft.factions.P; +import com.massivecraft.factions.scoreboards.tasks.ExpirationTask; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; +import org.bukkit.scoreboard.DisplaySlot; +import org.bukkit.scoreboard.Score; + +import java.util.List; +import java.util.logging.Level; + +public class FInfoBoard extends FScoreboard { + + private Faction faction; + + public FInfoBoard(Player player, Faction faction, boolean timed) { + this.faction = faction; + scoreboard = Bukkit.getScoreboardManager().getNewScoreboard(); + setup(player); + apply(player); + + if (timed) { + new ExpirationTask(player.getName(), scoreboard).runTaskLater(P.p, P.p.getConfig().getInt("scoreboard.expiration", 7) * 20L); // remove after 10 seconds. + } + } + + private void setup(Player player) { + FPlayer fPlayer = FPlayers.i.get(player); + objective = scoreboard.registerNewObjective("FBoard", "dummy"); + objective.setDisplaySlot(DisplaySlot.SIDEBAR); + objective.setDisplayName(faction.getRelationTo(fPlayer).getColor() + faction.getTag()); + + List list = P.p.getConfig().getStringList("scoreboard.finfo"); + int place = 16; // list.size(); + + if (list == null) { + P.p.debug(Level.WARNING, "scoreboard.finfo is null :("); + return; + } + + for (String s : list) { + String replaced = replace(s); + String awesome = replaced.length() > 16 ? replaced.substring(0, 15) : replaced; + Score score = objective.getScore(awesome); + score.setScore(place); + + place--; + if (place < 0) { + break; // Let's not let the scoreboard get too big. + } + } + } + + /** + * Filters lots of things in accordance with le config. + * + * @param s String to replace. + * + * @return new String with values instead of placeholders. + */ + private String replace(String s) { + FPlayer fLeader = faction.getFPlayerAdmin(); + String leader = fLeader == null ? "Server" : fLeader.getName().substring(0, fLeader.getName().length() > 14 ? 13 : fLeader.getName().length()); + return ChatColor.translateAlternateColorCodes('&', s.replace("{power}", String.valueOf(faction.getPowerRounded())).replace("{online}", String.valueOf(faction.getOnlinePlayers().size())).replace("{members}", String.valueOf(faction.getFPlayers().size())).replace("{leader}", leader).replace("{chunks}", String.valueOf(faction.getLandRounded()))); + } + +} diff --git a/src/main/java/com/massivecraft/factions/scoreboards/FScoreboard.java b/src/main/java/com/massivecraft/factions/scoreboards/FScoreboard.java new file mode 100644 index 00000000..9c8e1dfb --- /dev/null +++ b/src/main/java/com/massivecraft/factions/scoreboards/FScoreboard.java @@ -0,0 +1,23 @@ +package com.massivecraft.factions.scoreboards; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.scoreboard.Objective; +import org.bukkit.scoreboard.Scoreboard; + +/** + * Lazy attempt at abstraction off of 40 minutes of sleep. + */ +public abstract class FScoreboard { + + public Objective objective; + public Scoreboard scoreboard; + + public void apply(Player player) { + player.setScoreboard(scoreboard); + } + + public void remove(Player player) { + player.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard()); + } +} diff --git a/src/main/java/com/massivecraft/factions/scoreboards/tasks/ExpirationTask.java b/src/main/java/com/massivecraft/factions/scoreboards/tasks/ExpirationTask.java new file mode 100644 index 00000000..46511073 --- /dev/null +++ b/src/main/java/com/massivecraft/factions/scoreboards/tasks/ExpirationTask.java @@ -0,0 +1,32 @@ +package com.massivecraft.factions.scoreboards.tasks; + +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.scheduler.BukkitRunnable; +import org.bukkit.scoreboard.Scoreboard; + +/** + * Class that can be used to simply reset a Player's scoreboard in the future. + */ +public class ExpirationTask extends BukkitRunnable { + + private String name; + private Scoreboard board; + + public ExpirationTask(String name, Scoreboard scoreboard) { + this.board = scoreboard; + this.name = name; + } + + @Override + public void run() { + Player player = Bukkit.getPlayer(name); + if (player == null) { + return; + } + + if (player.getScoreboard().equals(board)) { // Incase someone else changed the board. + player.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard()); + } + } +} diff --git a/src/main/java/com/massivecraft/factions/struct/Permission.java b/src/main/java/com/massivecraft/factions/struct/Permission.java index 7b125f96..40c62ffc 100644 --- a/src/main/java/com/massivecraft/factions/struct/Permission.java +++ b/src/main/java/com/massivecraft/factions/struct/Permission.java @@ -63,7 +63,8 @@ public enum Permission { TITLE("title"), UNCLAIM("unclaim"), UNCLAIM_ALL("unclaimall"), - VERSION("version"),; + VERSION("version"), + SCOREBOARD("scoreboard"); public final String node; diff --git a/src/main/java/com/massivecraft/factions/util/AsciiCompass.java b/src/main/java/com/massivecraft/factions/util/AsciiCompass.java index 4b0ba1e9..fa16c6f3 100644 --- a/src/main/java/com/massivecraft/factions/util/AsciiCompass.java +++ b/src/main/java/com/massivecraft/factions/util/AsciiCompass.java @@ -5,6 +5,7 @@ import org.bukkit.ChatColor; import java.util.ArrayList; public class AsciiCompass { + public enum Point { N('N'), NE('/'), diff --git a/src/main/java/com/massivecraft/factions/util/AutoLeaveProcessTask.java b/src/main/java/com/massivecraft/factions/util/AutoLeaveProcessTask.java index d7cff66b..15393dcc 100644 --- a/src/main/java/com/massivecraft/factions/util/AutoLeaveProcessTask.java +++ b/src/main/java/com/massivecraft/factions/util/AutoLeaveProcessTask.java @@ -8,6 +8,7 @@ import java.util.ArrayList; import java.util.ListIterator; public class AutoLeaveProcessTask extends BukkitRunnable { + private transient boolean readyToGo = false; private transient boolean finished = false; private transient ListIterator iterator; diff --git a/src/main/java/com/massivecraft/factions/util/AutoLeaveTask.java b/src/main/java/com/massivecraft/factions/util/AutoLeaveTask.java index 7e24b8bb..6a1bda45 100644 --- a/src/main/java/com/massivecraft/factions/util/AutoLeaveTask.java +++ b/src/main/java/com/massivecraft/factions/util/AutoLeaveTask.java @@ -4,6 +4,7 @@ import com.massivecraft.factions.Conf; import com.massivecraft.factions.P; public class AutoLeaveTask implements Runnable { + private static AutoLeaveProcessTask task; double rate; diff --git a/src/main/java/com/massivecraft/factions/util/LazyLocation.java b/src/main/java/com/massivecraft/factions/util/LazyLocation.java index f1ad5576..3edecff7 100644 --- a/src/main/java/com/massivecraft/factions/util/LazyLocation.java +++ b/src/main/java/com/massivecraft/factions/util/LazyLocation.java @@ -10,6 +10,7 @@ import org.bukkit.World; */ public class LazyLocation { + private Location location = null; private String worldName; private double x; diff --git a/src/main/java/com/massivecraft/factions/util/MiscUtil.java b/src/main/java/com/massivecraft/factions/util/MiscUtil.java index 621f1fb9..7eb8a646 100644 --- a/src/main/java/com/massivecraft/factions/util/MiscUtil.java +++ b/src/main/java/com/massivecraft/factions/util/MiscUtil.java @@ -9,6 +9,7 @@ import java.util.Arrays; import java.util.HashSet; public class MiscUtil { + public static EntityType creatureTypeFromEntity(Entity entity) { if (!(entity instanceof Creature)) { return null; diff --git a/src/main/java/com/massivecraft/factions/util/MyLocationTypeAdapter.java b/src/main/java/com/massivecraft/factions/util/MyLocationTypeAdapter.java index e7792378..46664baf 100644 --- a/src/main/java/com/massivecraft/factions/util/MyLocationTypeAdapter.java +++ b/src/main/java/com/massivecraft/factions/util/MyLocationTypeAdapter.java @@ -8,6 +8,7 @@ import java.util.logging.Level; public class MyLocationTypeAdapter implements JsonDeserializer, JsonSerializer { + private static final String WORLD = "world"; private static final String X = "x"; private static final String Y = "y"; diff --git a/src/main/java/com/massivecraft/factions/util/RelationUtil.java b/src/main/java/com/massivecraft/factions/util/RelationUtil.java index 48f6f364..b84d5176 100644 --- a/src/main/java/com/massivecraft/factions/util/RelationUtil.java +++ b/src/main/java/com/massivecraft/factions/util/RelationUtil.java @@ -9,6 +9,7 @@ import com.massivecraft.factions.zcore.util.TextUtil; import org.bukkit.ChatColor; public class RelationUtil { + public static String describeThatToMe(RelationParticipator that, RelationParticipator me, boolean ucfirst) { String ret = ""; diff --git a/src/main/java/com/massivecraft/factions/util/SpiralTask.java b/src/main/java/com/massivecraft/factions/util/SpiralTask.java index f3588d52..85afa1d7 100644 --- a/src/main/java/com/massivecraft/factions/util/SpiralTask.java +++ b/src/main/java/com/massivecraft/factions/util/SpiralTask.java @@ -23,6 +23,7 @@ import java.util.logging.Level; */ public abstract class SpiralTask implements Runnable { + // general task-related reference data private transient World world = null; private transient boolean readyToGo = false; diff --git a/src/main/java/com/massivecraft/factions/zcore/CommandVisibility.java b/src/main/java/com/massivecraft/factions/zcore/CommandVisibility.java index 87d78688..911af70f 100644 --- a/src/main/java/com/massivecraft/factions/zcore/CommandVisibility.java +++ b/src/main/java/com/massivecraft/factions/zcore/CommandVisibility.java @@ -3,6 +3,5 @@ package com.massivecraft.factions.zcore; public enum CommandVisibility { VISIBLE, // Visible commands are visible to anyone. Even those who don't have permission to use it or is of invalid sender type. SECRET, // Secret commands are visible only to those who can use the command. These commands are usually some kind of admin commands. - INVISIBLE, // Invisible commands are invisible to everyone, even those who can use the command. - ; + INVISIBLE; // Invisible commands are invisible to everyone, even those who can use the command. } diff --git a/src/main/java/com/massivecraft/factions/zcore/MCommand.java b/src/main/java/com/massivecraft/factions/zcore/MCommand.java index 11488dac..4cdb2706 100644 --- a/src/main/java/com/massivecraft/factions/zcore/MCommand.java +++ b/src/main/java/com/massivecraft/factions/zcore/MCommand.java @@ -12,6 +12,7 @@ import java.util.Map.Entry; public abstract class MCommand { + public T p; // The sub-commands to this command diff --git a/src/main/java/com/massivecraft/factions/zcore/MPlugin.java b/src/main/java/com/massivecraft/factions/zcore/MPlugin.java index 598ab1e0..2a650849 100644 --- a/src/main/java/com/massivecraft/factions/zcore/MPlugin.java +++ b/src/main/java/com/massivecraft/factions/zcore/MPlugin.java @@ -24,6 +24,7 @@ import java.util.logging.Level; public abstract class MPlugin extends JavaPlugin { + // Some utils public Persist persist; public TextUtil txt; diff --git a/src/main/java/com/massivecraft/factions/zcore/MPluginSecretPlayerListener.java b/src/main/java/com/massivecraft/factions/zcore/MPluginSecretPlayerListener.java index 219e35de..cfae8c4e 100644 --- a/src/main/java/com/massivecraft/factions/zcore/MPluginSecretPlayerListener.java +++ b/src/main/java/com/massivecraft/factions/zcore/MPluginSecretPlayerListener.java @@ -1,14 +1,11 @@ package com.massivecraft.factions.zcore; -import com.massivecraft.factions.Conf; -import com.massivecraft.factions.P; import com.massivecraft.factions.listeners.FactionsPlayerListener; import com.massivecraft.factions.zcore.persist.EM; import com.massivecraft.factions.zcore.persist.Entity; import com.massivecraft.factions.zcore.persist.EntityCollection; import com.massivecraft.factions.zcore.persist.PlayerEntityCollection; import org.bukkit.Bukkit; -import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; @@ -17,6 +14,7 @@ import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerLoginEvent; public class MPluginSecretPlayerListener implements Listener { + private MPlugin p; public MPluginSecretPlayerListener(MPlugin p) { diff --git a/src/main/java/com/massivecraft/factions/zcore/MPluginSecretServerListener.java b/src/main/java/com/massivecraft/factions/zcore/MPluginSecretServerListener.java index a9c8eec6..c57209e7 100644 --- a/src/main/java/com/massivecraft/factions/zcore/MPluginSecretServerListener.java +++ b/src/main/java/com/massivecraft/factions/zcore/MPluginSecretServerListener.java @@ -6,6 +6,7 @@ import org.bukkit.event.Listener; import org.bukkit.event.server.ServerCommandEvent; public class MPluginSecretServerListener implements Listener { + private MPlugin p; public MPluginSecretServerListener(MPlugin p) { diff --git a/src/main/java/com/massivecraft/factions/zcore/persist/EM.java b/src/main/java/com/massivecraft/factions/zcore/persist/EM.java index 6f10687a..080b58fb 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/EM.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/EM.java @@ -4,6 +4,7 @@ import java.util.LinkedHashMap; import java.util.Map; public class EM { + public static Map, EntityCollection> class2Entities = new LinkedHashMap, EntityCollection>(); @SuppressWarnings("unchecked") diff --git a/src/main/java/com/massivecraft/factions/zcore/persist/Entity.java b/src/main/java/com/massivecraft/factions/zcore/persist/Entity.java index 7e5b1030..a39ff2d2 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/Entity.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/Entity.java @@ -1,8 +1,8 @@ package com.massivecraft.factions.zcore.persist; public abstract class Entity { - public Entity() { + public Entity() { } protected transient String id = null; diff --git a/src/main/java/com/massivecraft/factions/zcore/persist/EntityCollection.java b/src/main/java/com/massivecraft/factions/zcore/persist/EntityCollection.java index 243a5665..718d232e 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/EntityCollection.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/EntityCollection.java @@ -18,6 +18,7 @@ import java.util.Map.Entry; import java.util.logging.Level; public abstract class EntityCollection { + // -------------------------------------------- // // FIELDS // -------------------------------------------- // diff --git a/src/main/java/com/massivecraft/factions/zcore/persist/PlayerEntity.java b/src/main/java/com/massivecraft/factions/zcore/persist/PlayerEntity.java index 675635b6..1e967487 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/PlayerEntity.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/PlayerEntity.java @@ -6,6 +6,7 @@ import org.bukkit.entity.Player; import java.util.List; public class PlayerEntity extends Entity { + public Player getPlayer() { for (Player player : Bukkit.getServer().getOnlinePlayers()) { if (player.getUniqueId().toString().equals(this.getId())) { diff --git a/src/main/java/com/massivecraft/factions/zcore/persist/PlayerEntityCollection.java b/src/main/java/com/massivecraft/factions/zcore/persist/PlayerEntityCollection.java index 3945469f..cf7c5316 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/PlayerEntityCollection.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/PlayerEntityCollection.java @@ -21,6 +21,7 @@ import java.util.Set; * PlayerEntityCollection.getOnline() */ public abstract class PlayerEntityCollection extends EntityCollection { + public PlayerEntityCollection(Class entityClass, Collection entities, Map id2entity, File file, Gson gson) { super(entityClass, entities, id2entity, file, gson, true); } diff --git a/src/main/java/com/massivecraft/factions/zcore/persist/SaveTask.java b/src/main/java/com/massivecraft/factions/zcore/persist/SaveTask.java index c7c68178..c4167c0c 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/SaveTask.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/SaveTask.java @@ -3,7 +3,8 @@ package com.massivecraft.factions.zcore.persist; import com.massivecraft.factions.zcore.MPlugin; public class SaveTask implements Runnable { - static private boolean running = false; + + private static boolean running = false; MPlugin p; diff --git a/src/main/java/com/massivecraft/factions/zcore/util/DiscUtil.java b/src/main/java/com/massivecraft/factions/zcore/util/DiscUtil.java index de989f05..e618179f 100644 --- a/src/main/java/com/massivecraft/factions/zcore/util/DiscUtil.java +++ b/src/main/java/com/massivecraft/factions/zcore/util/DiscUtil.java @@ -3,6 +3,7 @@ package com.massivecraft.factions.zcore.util; import java.io.*; public class DiscUtil { + // -------------------------------------------- // // CONSTANTS // -------------------------------------------- // diff --git a/src/main/java/com/massivecraft/factions/zcore/util/PermUtil.java b/src/main/java/com/massivecraft/factions/zcore/util/PermUtil.java index d01b487b..6945b20a 100644 --- a/src/main/java/com/massivecraft/factions/zcore/util/PermUtil.java +++ b/src/main/java/com/massivecraft/factions/zcore/util/PermUtil.java @@ -12,6 +12,7 @@ import java.util.Map.Entry; public class PermUtil { + public Map permissionDescriptions = new HashMap(); protected MPlugin p; diff --git a/src/main/java/com/massivecraft/factions/zcore/util/Persist.java b/src/main/java/com/massivecraft/factions/zcore/util/Persist.java index 5d9133d6..42ff4370 100644 --- a/src/main/java/com/massivecraft/factions/zcore/util/Persist.java +++ b/src/main/java/com/massivecraft/factions/zcore/util/Persist.java @@ -6,7 +6,7 @@ import java.io.File; import java.lang.reflect.Type; import java.util.logging.Level; -// TODO: Give better name and place to differenciate from the entity-orm-ish system in "com.massivecraft.core.persist". +// TODO: Give better name and place to differentiate from the entity-orm-ish system in "com.massivecraft.core.persist". public class Persist { diff --git a/src/main/java/com/massivecraft/factions/zcore/util/SmokeUtil.java b/src/main/java/com/massivecraft/factions/zcore/util/SmokeUtil.java index fb095e64..1f9ffe84 100644 --- a/src/main/java/com/massivecraft/factions/zcore/util/SmokeUtil.java +++ b/src/main/java/com/massivecraft/factions/zcore/util/SmokeUtil.java @@ -23,6 +23,7 @@ import java.util.Random; //----------------------------- public class SmokeUtil { + public static Random random = new Random(); // -------------------------------------------- // 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 22603317..4d345374 100644 --- a/src/main/java/com/massivecraft/factions/zcore/util/TL.java +++ b/src/main/java/com/massivecraft/factions/zcore/util/TL.java @@ -29,7 +29,8 @@ public enum TL { WARZONE("warzone", "&4Warzone"), WARZONE_DESCRIPTION("warzone-description", "Not the safest place to be."), SAFEZONE("safezone", "&6Safezone"), - SAFEZONE_DESCRIPTION("safezone-description", "Free from pvp and monsters."); + SAFEZONE_DESCRIPTION("safezone-description", "Free from pvp and monsters."), + TOGGLE_SB("toggle-sb", "You now have scoreboards set to {value}"); private String path; private String def; diff --git a/src/main/java/com/massivecraft/factions/zcore/util/TextUtil.java b/src/main/java/com/massivecraft/factions/zcore/util/TextUtil.java index 3b8a8ac4..2338e27b 100644 --- a/src/main/java/com/massivecraft/factions/zcore/util/TextUtil.java +++ b/src/main/java/com/massivecraft/factions/zcore/util/TextUtil.java @@ -8,6 +8,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; public class TextUtil { + public Map tags; public TextUtil() { diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml new file mode 100644 index 00000000..dfd8201b --- /dev/null +++ b/src/main/resources/config.yml @@ -0,0 +1,38 @@ +# FactionsUUID by drtshock +# Report issues https://github.com/drtshock/Factions/issues?state=open +# Live support http://webchat.esper.net/?channels=drtshock&prompt=1 + +# Made with love <3 + +# Debug +# Turn this on if you are having issues with something and working on resolving them. +# This will spam your console with information that is useful if you know how to read the source. +# It's suggested that you only turn this on at the direction of a developer. +debug: false + + +# Configuration section for Scoreboards +# This will allow you to completely customize how your scoreboards look. +# Make sure that no lines are duplicates of each other otherwise only the first will display. +# Use &0-9a-f for colors and include messages in "quotes" +scoreboard: + +# How long do we want scoreboards to stay if set temporarily. + expiration: 7 + +# FInfo scoreboard is displayed when a player walks into a new Faction's territory. +# Scoreboard disappears after seconds. +# Things to be replaced in this: +# {power} - faction's power. {chunks} - total claimed chunks. {members} - total members. +# {online} - online members. {leader} - faction's leader. {open} - shows either true or false if open. +# 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: + - "&6Power" + - "{power}" + - "&3Members" + - "{online}/{members}" + - "&4Leader" + - "{leader}" + - "&bTerritory" + - "{chunks}" \ No newline at end of file diff --git a/src/main/resources/lang.yml b/src/main/resources/lang.yml index cd982c25..8fa0cda5 100644 --- a/src/main/resources/lang.yml +++ b/src/main/resources/lang.yml @@ -1,4 +1,4 @@ -# Lang file for FactionsUUID by Puzl Inc. +# Lang file for FactionsUUID by drtshock # Use & for color codes. # Made with love <3 @@ -8,4 +8,5 @@ wilderness-description: " " warzone: "&4Warzone" warzone-description: "Not the safest place to be." safezone: "&6Safezone" -safezone-description: "Free from pvp and monsters." \ No newline at end of file +safezone-description: "Free from pvp and monsters." +toggle-sb: "You now have scoreboards set to {value}" \ No newline at end of file diff --git a/src/main/resources/playerBoardToggle.yml b/src/main/resources/playerBoardToggle.yml new file mode 100644 index 00000000..06efeac0 --- /dev/null +++ b/src/main/resources/playerBoardToggle.yml @@ -0,0 +1,5 @@ +# This file is handled via the plugin. +# This is a list of players that DO NOT want to have ANY scoreboards shown to them via this plugin. +# It can be toggled with /f sb +off: + - someuuidhere \ No newline at end of file