Reformat.
This commit is contained in:
parent
27bf2008f1
commit
35813c7210
@ -1,12 +1,13 @@
|
||||
package com.massivecraft.factions;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.massivecraft.factions.zcore.persist.json.JSONBoard;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
public abstract class Board {
|
||||
protected static Board instance = getBoardImpl();
|
||||
|
||||
//----------------------------------------------//
|
||||
// Get and Set
|
||||
//----------------------------------------------//
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.massivecraft.factions;
|
||||
|
||||
import com.massivecraft.factions.util.MiscUtil;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
|
@ -1,17 +1,16 @@
|
||||
package com.massivecraft.factions;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.massivecraft.factions.iface.EconomyParticipator;
|
||||
import com.massivecraft.factions.iface.RelationParticipator;
|
||||
import com.massivecraft.factions.struct.ChatMode;
|
||||
import com.massivecraft.factions.struct.Relation;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* Logged in players always have exactly one FPlayer instance. Logged out players may or may not have an FPlayer
|
||||
@ -24,7 +23,7 @@ import org.bukkit.entity.Player;
|
||||
* necessary.
|
||||
*/
|
||||
|
||||
public interface FPlayer extends EconomyParticipator {
|
||||
public interface FPlayer extends EconomyParticipator {
|
||||
public Faction getFaction();
|
||||
|
||||
public String getFactionId();
|
||||
|
@ -1,11 +1,10 @@
|
||||
package com.massivecraft.factions;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import com.massivecraft.factions.zcore.persist.json.JSONFPlayers;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.massivecraft.factions.zcore.persist.json.JSONFPlayers;
|
||||
import java.util.Collection;
|
||||
|
||||
public abstract class FPlayers {
|
||||
protected static FPlayers instance = getFPlayersImpl();
|
||||
|
@ -4,7 +4,6 @@ import com.massivecraft.factions.iface.EconomyParticipator;
|
||||
import com.massivecraft.factions.iface.RelationParticipator;
|
||||
import com.massivecraft.factions.struct.Relation;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -1,10 +1,10 @@
|
||||
package com.massivecraft.factions;
|
||||
|
||||
import com.massivecraft.factions.zcore.persist.json.JSONFactions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Set;
|
||||
|
||||
import com.massivecraft.factions.zcore.persist.json.JSONFactions;
|
||||
|
||||
public abstract class Factions {
|
||||
protected static Factions instance = getFactionsImpl();
|
||||
|
||||
|
@ -12,7 +12,6 @@ import com.massivecraft.factions.struct.ChatMode;
|
||||
import com.massivecraft.factions.util.*;
|
||||
import com.massivecraft.factions.zcore.MPlugin;
|
||||
import com.massivecraft.factions.zcore.util.TextUtil;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -123,7 +122,8 @@ public class P extends MPlugin {
|
||||
|
||||
@Override
|
||||
public GsonBuilder getGsonBuilder() {
|
||||
Type mapFLocToStringSetType = new TypeToken<Map<FLocation, Set<String>>>() {}.getType();
|
||||
Type mapFLocToStringSetType = new TypeToken<Map<FLocation, Set<String>>>() {
|
||||
}.getType();
|
||||
|
||||
return new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().excludeFieldsWithModifiers(Modifier.TRANSIENT, Modifier.VOLATILE).registerTypeAdapter(LazyLocation.class, new MyLocationTypeAdapter()).registerTypeAdapter(mapFLocToStringSetType, new MapFLocToStringSetTypeAdapter()).registerTypeAdapterFactory(EnumTypeAdapter.ENUM_FACTORY);
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ public class CmdAnnounce extends FCommand {
|
||||
|
||||
// Add for offline players.
|
||||
for (FPlayer fp : myFaction.getFPlayersWhereOnline(false)) {
|
||||
myFaction.addAnnouncement(fp, prefix + message);
|
||||
myFaction.addAnnouncement(fp, prefix + message);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,9 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.Conf.Backend;
|
||||
import com.massivecraft.factions.zcore.persist.json.FactionsJSON;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
|
||||
public class CmdConvert extends FCommand {
|
||||
|
||||
|
@ -6,7 +6,6 @@ import com.massivecraft.factions.event.FactionCreateEvent;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.util.MiscUtil;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -44,15 +44,12 @@ public class CmdInvite extends FCommand {
|
||||
}
|
||||
|
||||
myFaction.invite(you);
|
||||
if(!you.isOnline()) return;
|
||||
if (!you.isOnline()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Tooltips, colors, and commands only apply to the string immediately before it.
|
||||
FancyMessage message = new FancyMessage(fme.describeTo(you, true))
|
||||
.tooltip("Click to join!").command("f join " + myFaction.getTag())
|
||||
.then(" has invited you to join ").color(ChatColor.YELLOW)
|
||||
.tooltip("Click to join!").command("f join " + myFaction.getTag())
|
||||
.then(myFaction.describeTo(you))
|
||||
.tooltip("Click to join!").command("f join " + myFaction.getTag());
|
||||
FancyMessage message = new FancyMessage(fme.describeTo(you, true)).tooltip("Click to join!").command("f join " + myFaction.getTag()).then(" has invited you to join ").color(ChatColor.YELLOW).tooltip("Click to join!").command("f join " + myFaction.getTag()).then(myFaction.describeTo(you)).tooltip("Click to join!").command("f join " + myFaction.getTag());
|
||||
|
||||
message.send(you.getPlayer());
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.*;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
|
||||
public class CmdReload extends FCommand {
|
||||
|
@ -50,7 +50,7 @@ public class CmdSB extends FCommand {
|
||||
* @return - true if now set to seeing scoreboards, otherwise false.
|
||||
*/
|
||||
public boolean toggle(UUID uuid) {
|
||||
if(!yml.getBoolean(uuid.toString(), true)) { // check if it's false, if never been toggled, default to false.
|
||||
if (!yml.getBoolean(uuid.toString(), true)) { // check if it's false, if never been toggled, default to false.
|
||||
yml.set(uuid.toString(), true);
|
||||
save();
|
||||
return true;
|
||||
|
@ -33,20 +33,20 @@ public class CmdSeeChunk extends FCommand {
|
||||
int blockX;
|
||||
int blockZ;
|
||||
|
||||
blockX = chunkX*16;
|
||||
blockZ = chunkZ*16;
|
||||
blockX = chunkX * 16;
|
||||
blockZ = chunkZ * 16;
|
||||
showPillar(me, world, blockX, blockZ);
|
||||
|
||||
blockX = chunkX*16 + 15;
|
||||
blockZ = chunkZ*16;
|
||||
blockX = chunkX * 16 + 15;
|
||||
blockZ = chunkZ * 16;
|
||||
showPillar(me, world, blockX, blockZ);
|
||||
|
||||
blockX = chunkX*16;
|
||||
blockZ = chunkZ*16 + 15;
|
||||
blockX = chunkX * 16;
|
||||
blockZ = chunkZ * 16 + 15;
|
||||
showPillar(me, world, blockX, blockZ);
|
||||
|
||||
blockX = chunkX*16 + 15;
|
||||
blockZ = chunkZ*16 + 15;
|
||||
blockX = chunkX * 16 + 15;
|
||||
blockZ = chunkZ * 16 + 15;
|
||||
showPillar(me, world, blockX, blockZ);
|
||||
}
|
||||
|
||||
@ -54,7 +54,9 @@ public class CmdSeeChunk extends FCommand {
|
||||
public static 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;
|
||||
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);
|
||||
}
|
||||
|
@ -1,15 +1,10 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.*;
|
||||
import com.massivecraft.factions.event.FactionRenameEvent;
|
||||
import com.massivecraft.factions.scoreboards.FTeamWrapper;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.util.MiscUtil;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -1,6 +1,9 @@
|
||||
package com.massivecraft.factions.integration;
|
||||
|
||||
import com.massivecraft.factions.*;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.iface.EconomyParticipator;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
@ -148,20 +151,20 @@ public class Econ {
|
||||
return false;
|
||||
}
|
||||
|
||||
OfflinePlayer fromAcc;
|
||||
OfflinePlayer toAcc;
|
||||
OfflinePlayer fromAcc;
|
||||
OfflinePlayer toAcc;
|
||||
|
||||
if(isUUID(from.getAccountId())) {
|
||||
fromAcc = Bukkit.getOfflinePlayer(UUID.fromString(from.getAccountId()));
|
||||
} else {
|
||||
fromAcc = Bukkit.getOfflinePlayer(from.getAccountId());
|
||||
}
|
||||
if (isUUID(from.getAccountId())) {
|
||||
fromAcc = Bukkit.getOfflinePlayer(UUID.fromString(from.getAccountId()));
|
||||
} else {
|
||||
fromAcc = Bukkit.getOfflinePlayer(from.getAccountId());
|
||||
}
|
||||
|
||||
if(isUUID(to.getAccountId())) {
|
||||
toAcc = Bukkit.getOfflinePlayer(UUID.fromString(to.getAccountId()));
|
||||
} else {
|
||||
toAcc = Bukkit.getOfflinePlayer(to.getAccountId());
|
||||
}
|
||||
if (isUUID(to.getAccountId())) {
|
||||
toAcc = Bukkit.getOfflinePlayer(UUID.fromString(to.getAccountId()));
|
||||
} else {
|
||||
toAcc = Bukkit.getOfflinePlayer(to.getAccountId());
|
||||
}
|
||||
|
||||
// Is there enough money for the transaction to happen?
|
||||
if (!econ.has(fromAcc, amount)) {
|
||||
@ -201,11 +204,11 @@ public class Econ {
|
||||
Set<FPlayer> fplayers = new HashSet<FPlayer>();
|
||||
|
||||
if (ep != null) {
|
||||
if (ep instanceof FPlayer) {
|
||||
fplayers.add((FPlayer) ep);
|
||||
} else if (ep instanceof Faction) {
|
||||
fplayers.addAll(((Faction) ep).getFPlayers());
|
||||
}
|
||||
if (ep instanceof FPlayer) {
|
||||
fplayers.add((FPlayer) ep);
|
||||
} else if (ep instanceof Faction) {
|
||||
fplayers.addAll(((Faction) ep).getFPlayers());
|
||||
}
|
||||
}
|
||||
|
||||
return fplayers;
|
||||
@ -241,19 +244,19 @@ public class Econ {
|
||||
return true;
|
||||
}
|
||||
|
||||
// going the hard way round as econ.has refuses to work.
|
||||
boolean affordable = false;
|
||||
double currentBalance;
|
||||
// going the hard way round as econ.has refuses to work.
|
||||
boolean affordable = false;
|
||||
double currentBalance;
|
||||
|
||||
if(isUUID(ep.getAccountId())) {
|
||||
currentBalance = econ.getBalance(Bukkit.getOfflinePlayer(UUID.fromString(ep.getAccountId())));
|
||||
} else {
|
||||
currentBalance = econ.getBalance(Bukkit.getOfflinePlayer(ep.getAccountId()));
|
||||
}
|
||||
if (isUUID(ep.getAccountId())) {
|
||||
currentBalance = econ.getBalance(Bukkit.getOfflinePlayer(UUID.fromString(ep.getAccountId())));
|
||||
} else {
|
||||
currentBalance = econ.getBalance(Bukkit.getOfflinePlayer(ep.getAccountId()));
|
||||
}
|
||||
|
||||
if(currentBalance >= delta) {
|
||||
affordable = true;
|
||||
}
|
||||
if (currentBalance >= delta) {
|
||||
affordable = true;
|
||||
}
|
||||
|
||||
if (!affordable) {
|
||||
if (toDoThis != null && !toDoThis.isEmpty()) {
|
||||
@ -271,11 +274,11 @@ public class Econ {
|
||||
|
||||
OfflinePlayer acc;
|
||||
|
||||
if(isUUID(ep.getAccountId())) {
|
||||
acc = Bukkit.getOfflinePlayer(UUID.fromString(ep.getAccountId()));
|
||||
} else {
|
||||
acc = Bukkit.getOfflinePlayer(ep.getAccountId());
|
||||
}
|
||||
if (isUUID(ep.getAccountId())) {
|
||||
acc = Bukkit.getOfflinePlayer(UUID.fromString(ep.getAccountId()));
|
||||
} else {
|
||||
acc = Bukkit.getOfflinePlayer(ep.getAccountId());
|
||||
}
|
||||
|
||||
String You = ep.describeTo(ep, true);
|
||||
|
||||
@ -370,7 +373,7 @@ public class Econ {
|
||||
return econ.getBalance(Bukkit.getOfflinePlayer(account));
|
||||
}
|
||||
|
||||
private static final DecimalFormat format = new DecimalFormat("#,###");
|
||||
private static final DecimalFormat format = new DecimalFormat("#,###");
|
||||
|
||||
public static String getFriendlyBalance(UUID uuid) {
|
||||
return format.format(econ.getBalance(Bukkit.getOfflinePlayer(uuid)));
|
||||
@ -401,17 +404,17 @@ public class Econ {
|
||||
return econ.withdrawPlayer(Bukkit.getOfflinePlayer(account), amount).transactionSuccess();
|
||||
}
|
||||
|
||||
// ---------------------------------------
|
||||
// Helpful Utilities
|
||||
// ---------------------------------------
|
||||
// ---------------------------------------
|
||||
// Helpful Utilities
|
||||
// ---------------------------------------
|
||||
|
||||
public static boolean isUUID(String uuid) {
|
||||
try {
|
||||
UUID.fromString(uuid);
|
||||
} catch(IllegalArgumentException ex) {
|
||||
return false;
|
||||
}
|
||||
public static boolean isUUID(String uuid) {
|
||||
try {
|
||||
UUID.fromString(uuid);
|
||||
} catch (IllegalArgumentException ex) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -205,10 +205,10 @@ public class FactionsEntityListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if(thrower instanceof Player){
|
||||
if (thrower instanceof Player) {
|
||||
Player player = (Player) thrower;
|
||||
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
|
||||
if(badjuju && fPlayer.getFaction().isPeaceful()){
|
||||
if (badjuju && fPlayer.getFaction().isPeaceful()) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ public class BufferedObjective {
|
||||
}
|
||||
|
||||
public void setAllLines(List<String> lines) {
|
||||
if(lines.size() != contents.size()) {
|
||||
if (lines.size() != contents.size()) {
|
||||
contents.clear();
|
||||
}
|
||||
for (int i = 0; i < lines.size(); i++) {
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.massivecraft.factions.scoreboards;
|
||||
|
||||
import com.massivecraft.factions.*;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.P;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
@ -6,5 +6,6 @@ import java.util.List;
|
||||
|
||||
public abstract class FSidebarProvider {
|
||||
public abstract String getTitle(FPlayer fplayer);
|
||||
|
||||
public abstract List<String> getLines(FPlayer fplayer);
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ public class FTeamWrapper {
|
||||
if (!FScoreboard.isSupportedByServer()) {
|
||||
return;
|
||||
}
|
||||
if(!wrappers.containsKey(faction)) {
|
||||
if (!wrappers.containsKey(faction)) {
|
||||
P.p.log(Level.WARNING, "Something went wrong when updating the prefix for %s", faction.getTag());
|
||||
return;
|
||||
}
|
||||
|
@ -30,12 +30,7 @@ public class FDefaultSidebar extends FSidebarProvider {
|
||||
|
||||
private String replace(FPlayer fplayer, String s) {
|
||||
String faction = !fplayer.getFaction().isNone() ? fplayer.getFaction().getTag() : "factionless";
|
||||
s = s.replace("{name}", fplayer.getName())
|
||||
.replace("{power}", String.valueOf(fplayer.getPowerRounded()))
|
||||
.replace("{balance}", String.valueOf(Econ.getFriendlyBalance(fplayer.getPlayer().getUniqueId())))
|
||||
.replace("{faction}", faction)
|
||||
.replace("{maxPower}", String.valueOf(fplayer.getPowerMaxRounded()))
|
||||
.replace("{totalOnline}", String.valueOf(Bukkit.getServer().getOnlinePlayers().length));
|
||||
s = s.replace("{name}", fplayer.getName()).replace("{power}", String.valueOf(fplayer.getPowerRounded())).replace("{balance}", String.valueOf(Econ.getFriendlyBalance(fplayer.getPlayer().getUniqueId()))).replace("{faction}", faction).replace("{maxPower}", String.valueOf(fplayer.getPowerMaxRounded())).replace("{totalOnline}", String.valueOf(Bukkit.getServer().getOnlinePlayers().length));
|
||||
return ChatColor.translateAlternateColorCodes('&', s);
|
||||
}
|
||||
}
|
||||
|
@ -37,11 +37,6 @@ public class FInfoSidebar extends FSidebarProvider {
|
||||
boolean raidable = faction.getLandRounded() > faction.getPower();
|
||||
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()))
|
||||
.replace("{raidable}", String.valueOf(raidable)));
|
||||
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())).replace("{raidable}", String.valueOf(raidable)));
|
||||
}
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ public final class EnumTypeAdapter<T extends Enum<T>> extends TypeAdapter<T> {
|
||||
// ignore since it could be a modified enum
|
||||
}
|
||||
}
|
||||
|
||||
public T read(JsonReader in) throws IOException {
|
||||
if (in.peek() == JsonToken.NULL) {
|
||||
in.nextNull();
|
||||
|
@ -1,11 +1,11 @@
|
||||
package com.massivecraft.factions.util;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/*
|
||||
* This class provides a lazy-load Location, so that World doesn't need to be initialized
|
||||
* yet when an object of this class is created, only when the Location is first accessed.
|
||||
|
@ -1,13 +1,12 @@
|
||||
package com.massivecraft.factions.util;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.P;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Creature;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.P;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
|
@ -67,7 +67,9 @@ public class VisualizeUtil {
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void clear(Player player) {
|
||||
Set<Location> locations = getPlayerLocations(player);
|
||||
if (locations == null) return;
|
||||
if (locations == null) {
|
||||
return;
|
||||
}
|
||||
for (Location location : locations) {
|
||||
Block block = location.getWorld().getBlockAt(location);
|
||||
player.sendBlockChange(location, block.getTypeId(), block.getData());
|
||||
|
@ -12,7 +12,6 @@ import com.massivecraft.factions.zcore.util.PermUtil;
|
||||
import com.massivecraft.factions.zcore.util.Persist;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import com.massivecraft.factions.zcore.util.TextUtil;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
@ -1,17 +1,14 @@
|
||||
package com.massivecraft.factions.zcore.persist;
|
||||
|
||||
import com.massivecraft.factions.Board;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FLocation;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.*;
|
||||
import com.massivecraft.factions.struct.Relation;
|
||||
import com.massivecraft.factions.util.AsciiCompass;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
|
||||
|
@ -1,13 +1,6 @@
|
||||
package com.massivecraft.factions.zcore.persist;
|
||||
|
||||
import com.massivecraft.factions.Board;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FLocation;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.*;
|
||||
import com.massivecraft.factions.event.FPlayerLeaveEvent;
|
||||
import com.massivecraft.factions.event.LandClaimEvent;
|
||||
import com.massivecraft.factions.iface.EconomyParticipator;
|
||||
@ -21,7 +14,6 @@ import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Relation;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.util.RelationUtil;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
@ -204,7 +196,8 @@ public abstract class MemoryFPlayer implements FPlayer {
|
||||
return this.getId();
|
||||
}
|
||||
|
||||
public MemoryFPlayer() { }
|
||||
public MemoryFPlayer() {
|
||||
}
|
||||
|
||||
public MemoryFPlayer(String id) {
|
||||
this.id = id;
|
||||
@ -543,7 +536,9 @@ public abstract class MemoryFPlayer implements FPlayer {
|
||||
|
||||
/**
|
||||
* Check if the scoreboard should be shown. Simple method to be used by above method.
|
||||
*
|
||||
* @param toShow Faction to be shown.
|
||||
*
|
||||
* @return true if should show, otherwise false.
|
||||
*/
|
||||
public boolean shouldShowScoreboard(Faction toShow) {
|
||||
|
@ -1,20 +1,14 @@
|
||||
package com.massivecraft.factions.zcore.persist;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.P;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
|
||||
public abstract class MemoryFPlayers extends FPlayers {
|
||||
|
@ -1,13 +1,6 @@
|
||||
package com.massivecraft.factions.zcore.persist;
|
||||
|
||||
import com.massivecraft.factions.Board;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FLocation;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.*;
|
||||
import com.massivecraft.factions.iface.EconomyParticipator;
|
||||
import com.massivecraft.factions.iface.RelationParticipator;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
@ -17,7 +10,6 @@ import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.util.LazyLocation;
|
||||
import com.massivecraft.factions.util.MiscUtil;
|
||||
import com.massivecraft.factions.util.RelationUtil;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
@ -232,7 +224,8 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
||||
// -------------------------------------------- //
|
||||
// Construct
|
||||
// -------------------------------------------- //
|
||||
public MemoryFaction() { }
|
||||
public MemoryFaction() {
|
||||
}
|
||||
|
||||
public MemoryFaction(String id) {
|
||||
this.id = id;
|
||||
|
@ -122,6 +122,7 @@ public abstract class MemoryFactions extends Factions {
|
||||
public boolean isTagTaken(String str) {
|
||||
return this.getByTag(str) != null;
|
||||
}
|
||||
|
||||
public boolean isValidFactionId(String id) {
|
||||
return factions.containsKey(id);
|
||||
}
|
||||
|
@ -1,18 +1,12 @@
|
||||
package com.massivecraft.factions.zcore.persist.json;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.massivecraft.factions.Board;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.*;
|
||||
import com.massivecraft.factions.zcore.persist.MemoryBoard;
|
||||
import com.massivecraft.factions.zcore.persist.MemoryFPlayers;
|
||||
import com.massivecraft.factions.zcore.persist.MemoryFactions;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class FactionsJSON {
|
||||
|
||||
|
@ -1,17 +1,18 @@
|
||||
package com.massivecraft.factions.zcore.persist.json;
|
||||
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.massivecraft.factions.Board;
|
||||
import com.massivecraft.factions.FLocation;
|
||||
import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.zcore.persist.MemoryBoard;
|
||||
import com.massivecraft.factions.zcore.util.DiscUtil;
|
||||
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.TreeMap;
|
||||
|
||||
|
||||
public class JSONBoard extends MemoryBoard {
|
||||
|
@ -2,6 +2,8 @@ package com.massivecraft.factions.zcore.persist.json;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.P;
|
||||
@ -9,11 +11,8 @@ import com.massivecraft.factions.zcore.persist.MemoryFPlayer;
|
||||
import com.massivecraft.factions.zcore.persist.MemoryFPlayers;
|
||||
import com.massivecraft.factions.zcore.util.DiscUtil;
|
||||
import com.massivecraft.factions.zcore.util.UUIDFetcher;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@ -85,7 +84,8 @@ public class JSONFPlayers extends MemoryFPlayers {
|
||||
return null;
|
||||
}
|
||||
|
||||
Map<String, JSONFPlayer> data = this.gson.fromJson(content, new TypeToken<Map<String, JSONFPlayer>>(){}.getType());
|
||||
Map<String, JSONFPlayer> data = this.gson.fromJson(content, new TypeToken<Map<String, JSONFPlayer>>() {
|
||||
}.getType());
|
||||
Set<String> list = new HashSet<String>();
|
||||
Set<String> invalidList = new HashSet<String>();
|
||||
for (Entry<String, JSONFPlayer> entry : data.entrySet()) {
|
||||
@ -157,7 +157,7 @@ public class JSONFPlayers extends MemoryFPlayers {
|
||||
Bukkit.getLogger().log(Level.INFO, "The following names were detected as being invalid: " + StringUtils.join(invalidList, ", "));
|
||||
}
|
||||
saveCore(this.file, (Map<String, JSONFPlayer>) data); // Update the
|
||||
// flatfile
|
||||
// flatfile
|
||||
Bukkit.getLogger().log(Level.INFO, "Done converting players.json to UUID.");
|
||||
}
|
||||
return (Map<String, JSONFPlayer>) data;
|
||||
|
@ -8,7 +8,8 @@ public class JSONFaction extends MemoryFaction {
|
||||
super(arg0);
|
||||
}
|
||||
|
||||
public JSONFaction() {}
|
||||
public JSONFaction() {
|
||||
}
|
||||
|
||||
public JSONFaction(String id) {
|
||||
super(id);
|
||||
|
@ -2,6 +2,8 @@ package com.massivecraft.factions.zcore.persist.json;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.massivecraft.factions.FLocation;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
@ -10,10 +12,7 @@ import com.massivecraft.factions.zcore.persist.MemoryFaction;
|
||||
import com.massivecraft.factions.zcore.persist.MemoryFactions;
|
||||
import com.massivecraft.factions.zcore.util.DiscUtil;
|
||||
import com.massivecraft.factions.zcore.util.UUIDFetcher;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@ -70,7 +69,7 @@ public class JSONFactions extends MemoryFactions {
|
||||
super.load();
|
||||
Map<String, JSONFaction> factions = this.loadCore();
|
||||
if (factions == null) {
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
this.factions.putAll(factions);
|
||||
P.p.log("Loaded " + factions.size() + " Factions");
|
||||
@ -86,7 +85,8 @@ public class JSONFactions extends MemoryFactions {
|
||||
return null;
|
||||
}
|
||||
|
||||
Map<String, JSONFaction> data = this.gson.fromJson(content, new TypeToken<Map<String, JSONFaction>>(){}.getType());
|
||||
Map<String, JSONFaction> data = this.gson.fromJson(content, new TypeToken<Map<String, JSONFaction>>() {
|
||||
}.getType());
|
||||
|
||||
this.nextId = 1;
|
||||
// Do we have any names that need updating in claims or invites?
|
||||
@ -139,7 +139,7 @@ public class JSONFactions extends MemoryFactions {
|
||||
// UUID key
|
||||
String id = response.get(value).toString();
|
||||
set.remove(value.toLowerCase()); // Out with the
|
||||
// old...
|
||||
// old...
|
||||
set.add(id); // And in with the new
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@ -166,7 +166,7 @@ public class JSONFactions extends MemoryFactions {
|
||||
// key
|
||||
String id = response.get(value).toString();
|
||||
invites.remove(value.toLowerCase()); // Out with the
|
||||
// old...
|
||||
// old...
|
||||
invites.add(id); // And in with the new
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
Loading…
Reference in New Issue
Block a user