diff --git a/dependency-reduced-pom.xml b/dependency-reduced-pom.xml
index 5779312a..3c5e91d4 100644
--- a/dependency-reduced-pom.xml
+++ b/dependency-reduced-pom.xml
@@ -43,6 +43,7 @@
mkremins:fanciful
+ com.google.code.gson:gson
@@ -50,6 +51,10 @@
mkremins.fanciful
com.massivecraft.factions.shade.mkremins.fanciful
+
+ com.google
+ com.massivecraft.factions.shade.com.google
+
@@ -84,12 +89,6 @@
1.7.10-R0.1-SNAPSHOT
compile
-
- org.bukkit
- craftbukkit
- 1.7.10-R0.1-SNAPSHOT
- compile
-
net.milkbowl.vault
VaultAPI
diff --git a/pom.xml b/pom.xml
index 58272ba5..47a051e4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -44,6 +44,7 @@
mkremins:fanciful
+ com.google.code.gson:gson
@@ -51,6 +52,10 @@
mkremins.fanciful
com.massivecraft.factions.shade.mkremins.fanciful
+
+ com.google
+ com.massivecraft.factions.shade.com.google
+
@@ -71,11 +76,6 @@
bukkit
1.7.10-R0.1-SNAPSHOT
-
- org.bukkit
- craftbukkit
- 1.7.10-R0.1-SNAPSHOT
-
net.milkbowl.vault
VaultAPI
@@ -109,6 +109,11 @@
fanciful
0.2.0-SNAPSHOT
+
+ com.google.code.gson
+ gson
+ 2.1
+
diff --git a/src/main/java/com/massivecraft/factions/Board.java b/src/main/java/com/massivecraft/factions/Board.java
index 30193138..a514b08a 100644
--- a/src/main/java/com/massivecraft/factions/Board.java
+++ b/src/main/java/com/massivecraft/factions/Board.java
@@ -1,10 +1,10 @@
package com.massivecraft.factions;
+import com.google.gson.reflect.TypeToken;
import com.massivecraft.factions.struct.Relation;
import com.massivecraft.factions.util.AsciiCompass;
import com.massivecraft.factions.zcore.util.DiscUtil;
import org.bukkit.ChatColor;
-import org.bukkit.craftbukkit.libs.com.google.gson.reflect.TypeToken;
import java.io.File;
import java.lang.reflect.Type;
diff --git a/src/main/java/com/massivecraft/factions/FPlayer.java b/src/main/java/com/massivecraft/factions/FPlayer.java
index dd57da9b..19a5b7bd 100644
--- a/src/main/java/com/massivecraft/factions/FPlayer.java
+++ b/src/main/java/com/massivecraft/factions/FPlayer.java
@@ -6,8 +6,8 @@ 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.sidebar.FInfoSidebar;
import com.massivecraft.factions.scoreboards.FScoreboard;
+import com.massivecraft.factions.scoreboards.sidebar.FInfoSidebar;
import com.massivecraft.factions.struct.ChatMode;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Relation;
@@ -781,4 +781,4 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator {
public void msg(String str, Object... args) {
this.sendMessage(P.p.txt.parse(str, args));
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/com/massivecraft/factions/FPlayers.java b/src/main/java/com/massivecraft/factions/FPlayers.java
index a0e8f0a4..3077633d 100644
--- a/src/main/java/com/massivecraft/factions/FPlayers.java
+++ b/src/main/java/com/massivecraft/factions/FPlayers.java
@@ -1,7 +1,7 @@
package com.massivecraft.factions;
+import com.google.gson.reflect.TypeToken;
import com.massivecraft.factions.zcore.persist.PlayerEntityCollection;
-import org.bukkit.craftbukkit.libs.com.google.gson.reflect.TypeToken;
import java.io.File;
import java.lang.reflect.Type;
diff --git a/src/main/java/com/massivecraft/factions/Factions.java b/src/main/java/com/massivecraft/factions/Factions.java
index f413b346..a00a2653 100644
--- a/src/main/java/com/massivecraft/factions/Factions.java
+++ b/src/main/java/com/massivecraft/factions/Factions.java
@@ -1,11 +1,11 @@
package com.massivecraft.factions;
+import com.google.gson.reflect.TypeToken;
import com.massivecraft.factions.util.MiscUtil;
import com.massivecraft.factions.zcore.persist.EntityCollection;
import com.massivecraft.factions.zcore.util.TL;
import com.massivecraft.factions.zcore.util.TextUtil;
import org.bukkit.ChatColor;
-import org.bukkit.craftbukkit.libs.com.google.gson.reflect.TypeToken;
import java.io.File;
import java.lang.reflect.Type;
diff --git a/src/main/java/com/massivecraft/factions/P.java b/src/main/java/com/massivecraft/factions/P.java
index da853226..5c9fbed2 100644
--- a/src/main/java/com/massivecraft/factions/P.java
+++ b/src/main/java/com/massivecraft/factions/P.java
@@ -1,5 +1,7 @@
package com.massivecraft.factions;
+import com.google.gson.GsonBuilder;
+import com.google.gson.reflect.TypeToken;
import com.massivecraft.factions.cmd.CmdAutoHelp;
import com.massivecraft.factions.cmd.FCmdRoot;
import com.massivecraft.factions.integration.Econ;
@@ -7,23 +9,20 @@ import com.massivecraft.factions.integration.Essentials;
import com.massivecraft.factions.integration.Worldguard;
import com.massivecraft.factions.listeners.*;
import com.massivecraft.factions.struct.ChatMode;
-import com.massivecraft.factions.util.AutoLeaveTask;
-import com.massivecraft.factions.util.EnumTypeAdapter;
-import com.massivecraft.factions.util.LazyLocation;
-import com.massivecraft.factions.util.MapFLocToStringSetTypeAdapter;
-import com.massivecraft.factions.util.MyLocationTypeAdapter;
+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.craftbukkit.libs.com.google.gson.GsonBuilder;
-import org.bukkit.craftbukkit.libs.com.google.gson.reflect.TypeToken;
import org.bukkit.entity.Player;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import java.lang.reflect.Modifier;
import java.lang.reflect.Type;
-import java.util.*;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
import java.util.logging.Level;
@@ -70,15 +69,6 @@ public class P extends MPlugin {
@Override
public void onEnable() {
- // bit of (apparently absolutely necessary) idiot-proofing for CB version support due to changed GSON lib package name
- try {
- Class.forName("org.bukkit.craftbukkit.libs.com.google.gson.reflect.TypeToken");
- } catch (ClassNotFoundException ex) {
- this.log(Level.SEVERE, "GSON lib not found. Your CraftBukkit build is too old (< 1.3.2) or otherwise not compatible.");
- this.suicide();
- return;
- }
-
if (!preEnable()) {
return;
}
diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdAnnounce.java b/src/main/java/com/massivecraft/factions/cmd/CmdAnnounce.java
index c40f35fc..a349cece 100644
--- a/src/main/java/com/massivecraft/factions/cmd/CmdAnnounce.java
+++ b/src/main/java/com/massivecraft/factions/cmd/CmdAnnounce.java
@@ -2,7 +2,7 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.struct.Permission;
-import net.minecraft.util.org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java
index da4af5ce..c612860b 100644
--- a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java
+++ b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java
@@ -80,7 +80,7 @@ public class FactionsPlayerListener implements Listener {
myFaction.memberLoggedOff();
}
- FScoreboard.remove(me);
+ //FScoreboard.remove(me);
}
// Holds the next time a player can have a map shown.
diff --git a/src/main/java/com/massivecraft/factions/scoreboards/FScoreboard.java b/src/main/java/com/massivecraft/factions/scoreboards/FScoreboard.java
index 61749e4e..f100200f 100644
--- a/src/main/java/com/massivecraft/factions/scoreboards/FScoreboard.java
+++ b/src/main/java/com/massivecraft/factions/scoreboards/FScoreboard.java
@@ -20,6 +20,13 @@ public class FScoreboard {
private FSidebarProvider temporaryProvider;
private boolean removed = false;
+ // Glowstone doesn't support scoreboards.
+ // All references to this and related workarounds can be safely
+ // removed when scoreboards are supported.
+ public static boolean isSupportedByServer() {
+ return Bukkit.getScoreboardManager() != null;
+ }
+
public static void init(FPlayer fplayer) {
FScoreboard fboard = new FScoreboard(fplayer);
fscoreboards.put(fplayer, fboard);
@@ -47,10 +54,16 @@ public class FScoreboard {
private FScoreboard(FPlayer fplayer) {
this.fplayer = fplayer;
- this.scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
- this.bufferedObjective = new BufferedObjective(scoreboard);
- fplayer.getPlayer().setScoreboard(scoreboard);
+ if (isSupportedByServer()) {
+ this.scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
+ this.bufferedObjective = new BufferedObjective(scoreboard);
+
+ fplayer.getPlayer().setScoreboard(scoreboard);
+ } else {
+ this.scoreboard = null;
+ this.bufferedObjective = null;
+ }
}
protected FPlayer getFPlayer() {
@@ -62,10 +75,18 @@ public class FScoreboard {
}
public void setSidebarVisibility(boolean visible) {
+ if (!isSupportedByServer()) {
+ return;
+ }
+
bufferedObjective.setDisplaySlot(visible ? DisplaySlot.SIDEBAR : null);
}
public void setDefaultSidebar(final FSidebarProvider provider, int updateInterval) {
+ if (!isSupportedByServer()) {
+ return;
+ }
+
defaultProvider = provider;
if (temporaryProvider == null) {
// We have no temporary provider; update the BufferedObjective!
@@ -88,6 +109,10 @@ public class FScoreboard {
}
public void setTemporarySidebar(final FSidebarProvider provider) {
+ if (!isSupportedByServer()) {
+ return;
+ }
+
temporaryProvider = provider;
updateObjective();
diff --git a/src/main/java/com/massivecraft/factions/scoreboards/FTeamWrapper.java b/src/main/java/com/massivecraft/factions/scoreboards/FTeamWrapper.java
index ae3606c9..23c19c96 100644
--- a/src/main/java/com/massivecraft/factions/scoreboards/FTeamWrapper.java
+++ b/src/main/java/com/massivecraft/factions/scoreboards/FTeamWrapper.java
@@ -20,6 +20,10 @@ public class FTeamWrapper {
private final Set members = new HashSet();
public static void applyUpdatesLater(final Faction faction) {
+ if (!FScoreboard.isSupportedByServer()) {
+ return;
+ }
+
Bukkit.getScheduler().runTask(P.p, new Runnable() {
@Override
public void run() {
@@ -29,6 +33,10 @@ public class FTeamWrapper {
}
public static void applyUpdates(Faction faction) {
+ if (!FScoreboard.isSupportedByServer()) {
+ return;
+ }
+
FTeamWrapper wrapper = wrappers.get(faction);
Set factionMembers = faction.getFPlayers();
@@ -64,10 +72,16 @@ public class FTeamWrapper {
}
public static void updatePrefixes(Faction faction) {
+ if (!FScoreboard.isSupportedByServer()) {
+ return;
+ }
wrappers.get(faction).updatePrefixes();
}
protected static void track(FScoreboard fboard) {
+ if (!FScoreboard.isSupportedByServer()) {
+ return;
+ }
tracking.add(fboard);
for (FTeamWrapper wrapper : wrappers.values()) {
wrapper.add(fboard);
@@ -75,6 +89,9 @@ public class FTeamWrapper {
}
protected static void untrack(FScoreboard fboard) {
+ if (!FScoreboard.isSupportedByServer()) {
+ return;
+ }
tracking.remove(fboard);
for (FTeamWrapper wrapper : wrappers.values()) {
wrapper.remove(fboard);
diff --git a/src/main/java/com/massivecraft/factions/util/EnumTypeAdapter.java b/src/main/java/com/massivecraft/factions/util/EnumTypeAdapter.java
index 8e22f3ab..6d33e67d 100644
--- a/src/main/java/com/massivecraft/factions/util/EnumTypeAdapter.java
+++ b/src/main/java/com/massivecraft/factions/util/EnumTypeAdapter.java
@@ -1,13 +1,13 @@
package com.massivecraft.factions.util;
-import org.bukkit.craftbukkit.libs.com.google.gson.Gson;
-import org.bukkit.craftbukkit.libs.com.google.gson.TypeAdapter;
-import org.bukkit.craftbukkit.libs.com.google.gson.TypeAdapterFactory;
-import org.bukkit.craftbukkit.libs.com.google.gson.annotations.SerializedName;
-import org.bukkit.craftbukkit.libs.com.google.gson.reflect.TypeToken;
-import org.bukkit.craftbukkit.libs.com.google.gson.stream.JsonReader;
-import org.bukkit.craftbukkit.libs.com.google.gson.stream.JsonToken;
-import org.bukkit.craftbukkit.libs.com.google.gson.stream.JsonWriter;
+import com.google.gson.Gson;
+import com.google.gson.TypeAdapter;
+import com.google.gson.TypeAdapterFactory;
+import com.google.gson.annotations.SerializedName;
+import com.google.gson.reflect.TypeToken;
+import com.google.gson.stream.JsonReader;
+import com.google.gson.stream.JsonToken;
+import com.google.gson.stream.JsonWriter;
import java.io.IOException;
import java.util.HashMap;
diff --git a/src/main/java/com/massivecraft/factions/util/MapFLocToStringSetTypeAdapter.java b/src/main/java/com/massivecraft/factions/util/MapFLocToStringSetTypeAdapter.java
index 5fd7ee85..eb9936a4 100644
--- a/src/main/java/com/massivecraft/factions/util/MapFLocToStringSetTypeAdapter.java
+++ b/src/main/java/com/massivecraft/factions/util/MapFLocToStringSetTypeAdapter.java
@@ -1,8 +1,8 @@
package com.massivecraft.factions.util;
+import com.google.gson.*;
import com.massivecraft.factions.FLocation;
import com.massivecraft.factions.P;
-import org.bukkit.craftbukkit.libs.com.google.gson.*;
import java.lang.reflect.Type;
import java.util.HashSet;
diff --git a/src/main/java/com/massivecraft/factions/util/MyLocationTypeAdapter.java b/src/main/java/com/massivecraft/factions/util/MyLocationTypeAdapter.java
index 46664baf..c68fca6b 100644
--- a/src/main/java/com/massivecraft/factions/util/MyLocationTypeAdapter.java
+++ b/src/main/java/com/massivecraft/factions/util/MyLocationTypeAdapter.java
@@ -1,7 +1,7 @@
package com.massivecraft.factions.util;
+import com.google.gson.*;
import com.massivecraft.factions.P;
-import org.bukkit.craftbukkit.libs.com.google.gson.*;
import java.lang.reflect.Type;
import java.util.logging.Level;
diff --git a/src/main/java/com/massivecraft/factions/zcore/MPlugin.java b/src/main/java/com/massivecraft/factions/zcore/MPlugin.java
index 2a650849..b5663052 100644
--- a/src/main/java/com/massivecraft/factions/zcore/MPlugin.java
+++ b/src/main/java/com/massivecraft/factions/zcore/MPlugin.java
@@ -1,5 +1,8 @@
package com.massivecraft.factions.zcore;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.gson.reflect.TypeToken;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.zcore.persist.EM;
import com.massivecraft.factions.zcore.persist.SaveTask;
@@ -10,9 +13,6 @@ import com.massivecraft.factions.zcore.util.TextUtil;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.YamlConfiguration;
-import org.bukkit.craftbukkit.libs.com.google.gson.Gson;
-import org.bukkit.craftbukkit.libs.com.google.gson.GsonBuilder;
-import org.bukkit.craftbukkit.libs.com.google.gson.reflect.TypeToken;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.*;
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 718d232e..d38167a1 100644
--- a/src/main/java/com/massivecraft/factions/zcore/persist/EntityCollection.java
+++ b/src/main/java/com/massivecraft/factions/zcore/persist/EntityCollection.java
@@ -1,5 +1,6 @@
package com.massivecraft.factions.zcore.persist;
+import com.google.gson.Gson;
import com.massivecraft.factions.FLocation;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Faction;
@@ -8,7 +9,6 @@ import com.massivecraft.factions.zcore.util.TextUtil;
import com.massivecraft.factions.zcore.util.UUIDFetcher;
import org.apache.commons.lang.StringUtils;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.libs.com.google.gson.Gson;
import java.io.File;
import java.io.IOException;
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 cf7c5316..adc349f0 100644
--- a/src/main/java/com/massivecraft/factions/zcore/persist/PlayerEntityCollection.java
+++ b/src/main/java/com/massivecraft/factions/zcore/persist/PlayerEntityCollection.java
@@ -1,8 +1,8 @@
package com.massivecraft.factions.zcore.persist;
+import com.google.gson.Gson;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
-import org.bukkit.craftbukkit.libs.com.google.gson.Gson;
import org.bukkit.entity.Player;
import java.io.File;