Add support for Glowstone
Glowstone doesn't yet support PlayerMoveEvent nor Scoreboards, so functionality is unfortunately limited.
This commit is contained in:
parent
7f2ef4cbd5
commit
653f918a1b
@ -43,6 +43,7 @@
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>mkremins:fanciful</include>
|
||||
<include>com.google.code.gson:gson</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
<relocations>
|
||||
@ -50,6 +51,10 @@
|
||||
<pattern>mkremins.fanciful</pattern>
|
||||
<shadedPattern>com.massivecraft.factions.shade.mkremins.fanciful</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>com.google</pattern>
|
||||
<shadedPattern>com.massivecraft.factions.shade.com.google</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
</plugin>
|
||||
@ -84,12 +89,6 @@
|
||||
<version>1.7.10-R0.1-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.7.10-R0.1-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.milkbowl.vault</groupId>
|
||||
<artifactId>VaultAPI</artifactId>
|
||||
|
15
pom.xml
15
pom.xml
@ -44,6 +44,7 @@
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>mkremins:fanciful</include>
|
||||
<include>com.google.code.gson:gson</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
<relocations>
|
||||
@ -51,6 +52,10 @@
|
||||
<pattern>mkremins.fanciful</pattern>
|
||||
<shadedPattern>com.massivecraft.factions.shade.mkremins.fanciful</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>com.google</pattern>
|
||||
<shadedPattern>com.massivecraft.factions.shade.com.google</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
<executions>
|
||||
@ -71,11 +76,6 @@
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.7.10-R0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.7.10-R0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.milkbowl.vault</groupId>
|
||||
<artifactId>VaultAPI</artifactId>
|
||||
@ -109,6 +109,11 @@
|
||||
<artifactId>fanciful</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<repositories>
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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();
|
||||
|
||||
|
@ -20,6 +20,10 @@ public class FTeamWrapper {
|
||||
private final Set<UUID> members = new HashSet<UUID>();
|
||||
|
||||
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<FPlayer> 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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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.*;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user