First implementation of scoreboards.

Boards can be toggled with /f sb. Toggles are persistent in a yml file.
Also fix some small spelling and format things that were really bugging me.
This commit is contained in:
drtshock 2014-08-05 10:17:27 -05:00
parent c735053bc3
commit ddf054330a
83 changed files with 375 additions and 21 deletions

View File

@ -4,7 +4,7 @@
<groupId>com.massivecraft</groupId>
<artifactId>Factions</artifactId>
<version>1.6.9.5-U0.1.3</version>
<version>1.6.9.5-U0.1.4</version>
<packaging>jar</packaging>
<name>Factions</name>

View File

@ -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<FLocation, String> flocationIds = new HashMap<FLocation, String>();

View File

@ -7,6 +7,7 @@ import org.bukkit.entity.EntityType;
import java.util.*;
public class Conf {
public static List<String> baseCommandAliases = new ArrayList<String>();
public static boolean allowNoSlashCommand = true;

View File

@ -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("<i>") + " ~ " + 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("<i>") + " ~ " + 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("<b>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

View File

@ -10,6 +10,7 @@ import java.util.concurrent.ConcurrentSkipListMap;
import java.util.concurrent.CopyOnWriteArrayList;
public class FPlayers extends PlayerEntityCollection<FPlayer> {
public static FPlayers i = new FPlayers();
P p = P.p;

View File

@ -22,6 +22,7 @@ import java.util.concurrent.ConcurrentHashMap;
public class Faction extends Entity implements EconomyParticipator {
// FIELD: relationWish
private Map<String, Relation> relationWish;

View File

@ -17,6 +17,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
import java.util.logging.Level;
public class Factions extends EntityCollection<Faction> {
public static Factions i = new Factions();
P p = P.p;

View File

@ -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);
}
}

View File

@ -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");

View File

@ -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");

View File

@ -7,6 +7,7 @@ import com.massivecraft.factions.zcore.MCommand;
import java.util.ArrayList;
public class CmdAutoHelp extends MCommand<P> {
public CmdAutoHelp() {
super(P.p);
this.aliases.add("?");

View File

@ -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");

View File

@ -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");

View File

@ -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");

View File

@ -14,6 +14,7 @@ import java.util.HashMap;
import java.util.Set;
public class CmdConfig extends FCommand {
private static HashMap<String, String> properFieldNames = new HashMap<String, String>();
public CmdConfig() {

View File

@ -11,6 +11,7 @@ import java.util.ArrayList;
public class CmdCreate extends FCommand {
public CmdCreate() {
super();
this.aliases.add("create");

View File

@ -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");

View File

@ -10,6 +10,7 @@ import org.bukkit.Bukkit;
public class CmdDisband extends FCommand {
public CmdDisband() {
super();
this.aliases.add("disband");

View File

@ -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");

View File

@ -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");

View File

@ -7,6 +7,7 @@ import com.massivecraft.factions.struct.Permission;
public class CmdMap extends FCommand {
public CmdMap() {
super();
this.aliases.add("map");

View File

@ -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();

View File

@ -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");

View File

@ -9,6 +9,7 @@ import org.bukkit.ChatColor;
public class CmdMoneyTransferFf extends FCommand {
public CmdMoneyTransferFf() {
this.aliases.add("ff");

View File

@ -9,6 +9,7 @@ import org.bukkit.ChatColor;
public class CmdMoneyTransferFp extends FCommand {
public CmdMoneyTransferFp() {
this.aliases.add("fp");

View File

@ -9,6 +9,7 @@ import org.bukkit.ChatColor;
public class CmdMoneyTransferPf extends FCommand {
public CmdMoneyTransferPf() {
this.aliases.add("pf");

View File

@ -9,6 +9,7 @@ import org.bukkit.ChatColor;
public class CmdMoneyWithdraw extends FCommand {
public CmdMoneyWithdraw() {
this.aliases.add("w");
this.aliases.add("withdraw");

View File

@ -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");

View File

@ -8,6 +8,7 @@ import com.massivecraft.factions.struct.Permission;
public class CmdPermanent extends FCommand {
public CmdPermanent() {
super();
this.aliases.add("permanent");

View File

@ -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");

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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());
}
}

View File

@ -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");

View File

@ -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");

View File

@ -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");

View File

@ -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");

View File

@ -5,6 +5,7 @@ import com.massivecraft.factions.struct.Permission;
public class CmdVersion extends FCommand {
public CmdVersion() {
this.aliases.add("version");

View File

@ -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

View File

@ -13,6 +13,7 @@ import java.util.List;
public abstract class FCommand extends MCommand<P> {
public boolean disableOnLock;
public FPlayer fme;

View File

@ -9,6 +9,7 @@ import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
public abstract class FRelationCommand extends FCommand {
public Relation targetRelation;
public FRelationCommand() {

View File

@ -1,6 +1,7 @@
package com.massivecraft.factions.iface;
public interface EconomyParticipator extends RelationParticipator {
public String getAccountId();
public void msg(String str, Object... args);

View File

@ -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);

View File

@ -16,6 +16,7 @@ import java.util.logging.Level;
public class Econ {
private static Economy econ = null;
public static void setup() {

View File

@ -27,6 +27,7 @@ import static com.sk89q.worldguard.bukkit.BukkitUtil.toVector;
*/
public class Worldguard {
private static WorldGuardPlugin wg;
private static boolean enabled = false;

View File

@ -15,6 +15,7 @@ import org.bukkit.event.block.*;
public class FactionsBlockListener implements Listener {
public P p;
public FactionsBlockListener(P p) {

View File

@ -16,6 +16,7 @@ import java.util.logging.Level;
public class FactionsChatListener implements Listener {
public P p;
public FactionsChatListener(P p) {

View File

@ -25,6 +25,7 @@ import java.util.*;
public class FactionsEntityListener implements Listener {
public P p;
public FactionsEntityListener(P p) {

View File

@ -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) {

View File

@ -22,6 +22,7 @@ import java.util.Map;
public class FactionsPlayerListener implements Listener {
public P p;
public FactionsPlayerListener(P p) {

View File

@ -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<String> 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())));
}
}

View File

@ -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());
}
}

View File

@ -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());
}
}
}

View File

@ -63,7 +63,8 @@ public enum Permission {
TITLE("title"),
UNCLAIM("unclaim"),
UNCLAIM_ALL("unclaimall"),
VERSION("version"),;
VERSION("version"),
SCOREBOARD("scoreboard");
public final String node;

View File

@ -5,6 +5,7 @@ import org.bukkit.ChatColor;
import java.util.ArrayList;
public class AsciiCompass {
public enum Point {
N('N'),
NE('/'),

View File

@ -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<FPlayer> iterator;

View File

@ -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;

View File

@ -10,6 +10,7 @@ import org.bukkit.World;
*/
public class LazyLocation {
private Location location = null;
private String worldName;
private double x;

View File

@ -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;

View File

@ -8,6 +8,7 @@ import java.util.logging.Level;
public class MyLocationTypeAdapter implements JsonDeserializer<LazyLocation>, JsonSerializer<LazyLocation> {
private static final String WORLD = "world";
private static final String X = "x";
private static final String Y = "y";

View File

@ -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 = "";

View File

@ -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;

View File

@ -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.
}

View File

@ -12,6 +12,7 @@ import java.util.Map.Entry;
public abstract class MCommand<T extends MPlugin> {
public T p;
// The sub-commands to this command

View File

@ -24,6 +24,7 @@ import java.util.logging.Level;
public abstract class MPlugin extends JavaPlugin {
// Some utils
public Persist persist;
public TextUtil txt;

View File

@ -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) {

View File

@ -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) {

View File

@ -4,6 +4,7 @@ import java.util.LinkedHashMap;
import java.util.Map;
public class EM {
public static Map<Class<? extends Entity>, EntityCollection<? extends Entity>> class2Entities = new LinkedHashMap<Class<? extends Entity>, EntityCollection<? extends Entity>>();
@SuppressWarnings("unchecked")

View File

@ -1,8 +1,8 @@
package com.massivecraft.factions.zcore.persist;
public abstract class Entity {
public Entity() {
public Entity() {
}
protected transient String id = null;

View File

@ -18,6 +18,7 @@ import java.util.Map.Entry;
import java.util.logging.Level;
public abstract class EntityCollection<E extends Entity> {
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //

View File

@ -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())) {

View File

@ -21,6 +21,7 @@ import java.util.Set;
* PlayerEntityCollection.getOnline()
*/
public abstract class PlayerEntityCollection<E extends Entity> extends EntityCollection<E> {
public PlayerEntityCollection(Class<E> entityClass, Collection<E> entities, Map<String, E> id2entity, File file, Gson gson) {
super(entityClass, entities, id2entity, file, gson, true);
}

View File

@ -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;

View File

@ -3,6 +3,7 @@ package com.massivecraft.factions.zcore.util;
import java.io.*;
public class DiscUtil {
// -------------------------------------------- //
// CONSTANTS
// -------------------------------------------- //

View File

@ -12,6 +12,7 @@ import java.util.Map.Entry;
public class PermUtil {
public Map<String, String> permissionDescriptions = new HashMap<String, String>();
protected MPlugin p;

View File

@ -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 {

View File

@ -23,6 +23,7 @@ import java.util.Random;
//-----------------------------
public class SmokeUtil {
public static Random random = new Random();
// -------------------------------------------- //

View File

@ -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;

View File

@ -8,6 +8,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class TextUtil {
public Map<String, String> tags;
public TextUtil() {

View File

@ -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 <expiration> 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}"

View File

@ -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."
safezone-description: "Free from pvp and monsters."
toggle-sb: "You now have scoreboards set to {value}"

View File

@ -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