mirror of
https://github.com/MassiveCraft/Factions.git
synced 2024-12-25 18:18:27 +01:00
New Spout feature, for Spoutcraft client users only: current territory info will now be permanently shown at top of screen, instead of being echoed out to chat as you move around
New conf.json setting "spoutTerritoryDisplayPosition" to set the screen position at which the current territory is shown. 0 = disabled, 1 = top left, 2 = top center, 3 (default) = top right. Moved all integration code to separate package, ofr better code organization. Also moved EssentialsChat integration code out to separate file in there, allowing us to safely remove our copy IEssentialsChatListener.java file (which is otherwise needed to prevent a nasty NoClassDefFoundError).
This commit is contained in:
parent
d64ed374f1
commit
77a7b2d85c
@ -1,12 +0,0 @@
|
||||
package com.earth2me.essentials.chat;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerChatEvent;
|
||||
|
||||
|
||||
public interface IEssentialsChatListener
|
||||
{
|
||||
boolean shouldHandleThisChat(PlayerChatEvent event);
|
||||
|
||||
String modifyMessage(PlayerChatEvent event, Player target, String message);
|
||||
}
|
@ -185,6 +185,7 @@ public class Conf {
|
||||
public static boolean spoutFactionTitlesOverNames = true;
|
||||
public static boolean spoutFactionAdminCapes = true;
|
||||
public static boolean spoutFactionModeratorCapes = true;
|
||||
public static int spoutTerritoryDisplayPosition = 3;
|
||||
public static String capeAlly = "https://github.com/MassiveCraft/Factions/raw/master/capes/ally.png";
|
||||
public static String capeEnemy = "https://github.com/MassiveCraft/Factions/raw/master/capes/enemy.png";
|
||||
public static String capeMember = "https://github.com/MassiveCraft/Factions/raw/master/capes/member.png";
|
||||
|
@ -11,6 +11,9 @@ import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
import com.massivecraft.factions.integration.SpoutFeatures;
|
||||
import com.massivecraft.factions.integration.Worldguard;
|
||||
import com.massivecraft.factions.struct.ChatMode;
|
||||
import com.massivecraft.factions.struct.Relation;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
@ -471,6 +474,9 @@ public class FPlayer {
|
||||
}
|
||||
|
||||
public void sendFactionHereMessage() {
|
||||
if (SpoutFeatures.updateTerritoryDisplay(this)) {
|
||||
return;
|
||||
}
|
||||
Faction factionHere = Board.getFactionAt(new FLocation(this));
|
||||
String msg = Conf.colorSystem+" ~ "+factionHere.getTag(this);
|
||||
if (factionHere.getDescription().length() > 0) {
|
||||
|
@ -25,6 +25,9 @@ import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import com.massivecraft.factions.commands.*;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
import com.massivecraft.factions.integration.SpoutFeatures;
|
||||
import com.massivecraft.factions.integration.Worldguard;
|
||||
import com.massivecraft.factions.listeners.FactionsBlockListener;
|
||||
import com.massivecraft.factions.listeners.FactionsChatEarlyListener;
|
||||
import com.massivecraft.factions.listeners.FactionsEntityListener;
|
||||
@ -37,10 +40,10 @@ import com.massivecraft.factions.util.MyLocationTypeAdapter;
|
||||
import com.nijiko.permissions.PermissionHandler;
|
||||
import com.nijikokun.bukkit.Permissions.Permissions;
|
||||
import com.earth2me.essentials.chat.EssentialsChat;
|
||||
import com.earth2me.essentials.chat.IEssentialsChatListener;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.massivecraft.factions.integration.EssentialsFeatures;
|
||||
|
||||
/**
|
||||
* The data is saved to disk every 30min and on plugin disable.
|
||||
@ -155,7 +158,7 @@ public class Factions extends JavaPlugin {
|
||||
|
||||
setupPermissions();
|
||||
integrateEssentialsChat();
|
||||
SpoutFeatures.setup(this);
|
||||
setupSpout(this);
|
||||
Econ.setup(this);
|
||||
Econ.monitorPlugins();
|
||||
|
||||
@ -230,6 +233,14 @@ public class Factions extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
private void setupSpout(Factions factions) {
|
||||
Plugin test = factions.getServer().getPluginManager().getPlugin("Spout");
|
||||
|
||||
if (test != null && test.isEnabled()) {
|
||||
SpoutFeatures.setAvailable(true, test.getDescription().getFullName());
|
||||
}
|
||||
}
|
||||
|
||||
private void integrateEssentialsChat() {
|
||||
if (essChat != null) {
|
||||
return;
|
||||
@ -237,29 +248,14 @@ public class Factions extends JavaPlugin {
|
||||
|
||||
Plugin test = this.getServer().getPluginManager().getPlugin("EssentialsChat");
|
||||
|
||||
if (test != null) {
|
||||
try {
|
||||
essChat = (EssentialsChat)test;
|
||||
essChat.addEssentialsChatListener("Factions", new IEssentialsChatListener() {
|
||||
public boolean shouldHandleThisChat(PlayerChatEvent event)
|
||||
{
|
||||
return shouldLetFactionsHandleThisChat(event);
|
||||
}
|
||||
public String modifyMessage(PlayerChatEvent event, Player target, String message)
|
||||
{
|
||||
return message.replace("{FACTION}", getPlayerFactionTagRelation(event.getPlayer(), target)).replace("{FACTION_TITLE}", getPlayerTitle(event.getPlayer()));
|
||||
}
|
||||
});
|
||||
Factions.log("Found and will integrate chat with "+test.getDescription().getFullName());
|
||||
}
|
||||
catch (NoSuchMethodError ex) {
|
||||
essChat = null;
|
||||
}
|
||||
if (test != null && test.isEnabled()) {
|
||||
essChat = (EssentialsChat)test;
|
||||
EssentialsFeatures.integrateChat(essChat);
|
||||
}
|
||||
}
|
||||
private void unhookEssentialsChat() {
|
||||
if (essChat != null) {
|
||||
essChat.removeEssentialsChatListener("Factions");
|
||||
EssentialsFeatures.unhookChat();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.Econ;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.Econ;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
|
||||
|
@ -13,7 +13,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.SpoutFeatures;
|
||||
import com.massivecraft.factions.integration.SpoutFeatures;
|
||||
|
||||
public class FCommandConfig extends FBaseCommand {
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.Econ;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
|
@ -1,11 +1,11 @@
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.Econ;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.SpoutFeatures;
|
||||
import com.massivecraft.factions.integration.SpoutFeatures;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
|
||||
|
||||
|
@ -5,7 +5,7 @@ import java.util.ArrayList;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.Econ;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
import com.massivecraft.factions.util.TextUtil;
|
||||
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.Econ;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
|
@ -6,7 +6,7 @@ import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.SpoutFeatures;
|
||||
import com.massivecraft.factions.integration.SpoutFeatures;
|
||||
|
||||
public class FCommandPeaceful extends FBaseCommand {
|
||||
|
||||
|
@ -6,7 +6,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.Econ;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
|
@ -4,7 +4,7 @@ import java.util.ArrayList;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.SpoutFeatures;
|
||||
import com.massivecraft.factions.integration.SpoutFeatures;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.util.TextUtil;
|
||||
|
||||
|
@ -3,7 +3,7 @@ package com.massivecraft.factions.commands;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.SpoutFeatures;
|
||||
import com.massivecraft.factions.integration.SpoutFeatures;
|
||||
import com.massivecraft.factions.util.TextUtil;
|
||||
|
||||
public class FCommandTitle extends FBaseCommand {
|
||||
|
@ -2,7 +2,7 @@ package com.massivecraft.factions.commands;
|
||||
|
||||
import com.massivecraft.factions.Board;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.Econ;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
import com.massivecraft.factions.FLocation;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
|
@ -2,7 +2,7 @@ package com.massivecraft.factions.commands;
|
||||
|
||||
import com.massivecraft.factions.Board;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.Econ;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.Econ;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
|
@ -5,7 +5,7 @@ import org.bukkit.ChatColor;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.SpoutFeatures;
|
||||
import com.massivecraft.factions.integration.SpoutFeatures;
|
||||
import com.massivecraft.factions.struct.Relation;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.factions;
|
||||
package com.massivecraft.factions.integration;
|
||||
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
@ -11,6 +11,8 @@ import com.nijikokun.register.payment.Methods;
|
||||
import com.nijikokun.register.payment.Method.MethodAccount;
|
||||
import com.iConomy.*;
|
||||
import com.iConomy.system.*;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.Factions;
|
||||
|
||||
|
||||
public class Econ {
|
@ -0,0 +1,41 @@
|
||||
package com.massivecraft.factions.integration;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerChatEvent;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import com.massivecraft.factions.Factions;
|
||||
|
||||
import com.earth2me.essentials.chat.EssentialsChat;
|
||||
import com.earth2me.essentials.chat.IEssentialsChatListener;
|
||||
|
||||
|
||||
public class EssentialsFeatures {
|
||||
private static EssentialsChat essChat;
|
||||
|
||||
public static void integrateChat(EssentialsChat instance) {
|
||||
essChat = instance;
|
||||
try {
|
||||
essChat.addEssentialsChatListener("Factions", new IEssentialsChatListener() {
|
||||
public boolean shouldHandleThisChat(PlayerChatEvent event)
|
||||
{
|
||||
return Factions.instance.shouldLetFactionsHandleThisChat(event);
|
||||
}
|
||||
public String modifyMessage(PlayerChatEvent event, Player target, String message)
|
||||
{
|
||||
return message.replace("{FACTION}", Factions.instance.getPlayerFactionTagRelation(event.getPlayer(), target)).replace("{FACTION_TITLE}", Factions.instance.getPlayerTitle(event.getPlayer()));
|
||||
}
|
||||
});
|
||||
Factions.log("Found and will integrate chat with "+essChat.getDescription().getFullName());
|
||||
}
|
||||
catch (NoSuchMethodError ex) {
|
||||
essChat = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void unhookChat() {
|
||||
if (essChat != null) {
|
||||
essChat.removeEssentialsChatListener("Factions");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,32 +1,33 @@
|
||||
package com.massivecraft.factions;
|
||||
package com.massivecraft.factions.integration;
|
||||
|
||||
import com.massivecraft.factions.Board;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FLocation;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.massivecraft.factions.struct.Relation;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
|
||||
import org.getspout.spoutapi.gui.Color;
|
||||
import org.getspout.spoutapi.gui.GenericLabel;
|
||||
import org.getspout.spoutapi.player.AppearanceManager;
|
||||
import org.getspout.spoutapi.player.SpoutPlayer;
|
||||
import org.getspout.spoutapi.SpoutManager;
|
||||
import org.getspout.spoutapi.gui.WidgetAnchor;
|
||||
|
||||
|
||||
public class SpoutFeatures {
|
||||
private transient static AppearanceManager spoutApp;
|
||||
private transient static boolean spoutMe = false;
|
||||
|
||||
public static void setup(Factions factions) {
|
||||
Plugin test = factions.getServer().getPluginManager().getPlugin("Spout");
|
||||
|
||||
if (test != null && test.isEnabled()) {
|
||||
setAvailable(true, test.getDescription().getFullName());
|
||||
}
|
||||
else {
|
||||
setAvailable(false, "");
|
||||
}
|
||||
}
|
||||
private transient static Map<String, GenericLabel> territoryLabels = new HashMap<String, GenericLabel>();
|
||||
|
||||
// set integration availability
|
||||
public static void setAvailable(boolean enable, String pluginName) {
|
||||
@ -47,10 +48,57 @@ public class SpoutFeatures {
|
||||
|| Conf.spoutFactionTitlesOverNames
|
||||
|| Conf.spoutFactionAdminCapes
|
||||
|| Conf.spoutFactionModeratorCapes
|
||||
|| Conf.spoutTerritoryDisplayPosition > 0
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// update displayed current territory for specified player; returns false if unsuccessful
|
||||
public static boolean updateTerritoryDisplay(FPlayer player) {
|
||||
if (!spoutMe || Conf.spoutTerritoryDisplayPosition == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
SpoutPlayer sPlayer = SpoutManager.getPlayer(player.getPlayer());
|
||||
if (!sPlayer.isSpoutCraftEnabled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
GenericLabel label;
|
||||
if (territoryLabels.containsKey(player.getName())) {
|
||||
label = territoryLabels.get(player.getName());
|
||||
}
|
||||
else {
|
||||
label = new GenericLabel();
|
||||
sPlayer.getMainScreen().attachWidget(Factions.instance, label);
|
||||
switch (Conf.spoutTerritoryDisplayPosition) {
|
||||
case 1: label.setAlign(WidgetAnchor.TOP_LEFT).setAnchor(WidgetAnchor.TOP_LEFT); break;
|
||||
case 2: label.setAlign(WidgetAnchor.TOP_CENTER).setAnchor(WidgetAnchor.TOP_CENTER); break;
|
||||
default: label.setAlign(WidgetAnchor.TOP_RIGHT).setAnchor(WidgetAnchor.TOP_RIGHT);
|
||||
}
|
||||
territoryLabels.put(player.getName(), label);
|
||||
}
|
||||
|
||||
Faction factionHere = Board.getFactionAt(new FLocation(player));
|
||||
String msg = factionHere.getTag();
|
||||
if (factionHere.getDescription().length() > 0) {
|
||||
msg += " - "+factionHere.getDescription();
|
||||
}
|
||||
label.setTextColor(getSpoutColor(player.getRelationColor(factionHere), 0));
|
||||
label.setText(msg);
|
||||
label.setDirty(true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void playerDisconnect(FPlayer player) {
|
||||
if (!enabled()) {
|
||||
return;
|
||||
}
|
||||
territoryLabels.remove(player.getName());
|
||||
}
|
||||
|
||||
|
||||
// update all appearances between every player
|
||||
public static void updateAppearances() {
|
||||
if (!enabled()) {
|
||||
@ -186,4 +234,28 @@ public class SpoutFeatures {
|
||||
}
|
||||
}
|
||||
|
||||
// method to convert a Bukkit ChatColor to a Spout Color
|
||||
private static Color getSpoutColor(ChatColor inColor, int alpha) {
|
||||
if (inColor == null) {
|
||||
return new Color(191, 191, 191, alpha);
|
||||
}
|
||||
switch (inColor.getCode()) {
|
||||
case 0x1: return new Color(0, 0, 191, alpha);
|
||||
case 0x2: return new Color(0, 191, 0, alpha);
|
||||
case 0x3: return new Color(0, 191, 191, alpha);
|
||||
case 0x4: return new Color(191, 0, 0, alpha);
|
||||
case 0x5: return new Color(191, 0, 191, alpha);
|
||||
case 0x6: return new Color(191, 191, 0, alpha);
|
||||
case 0x7: return new Color(191, 191, 191, alpha);
|
||||
case 0x8: return new Color(64, 64, 64, alpha);
|
||||
case 0x9: return new Color(64, 64, 255, alpha);
|
||||
case 0xA: return new Color(64, 255, 64, alpha);
|
||||
case 0xB: return new Color(64, 255, 255, alpha);
|
||||
case 0xC: return new Color(255, 64, 64, alpha);
|
||||
case 0xD: return new Color(255, 64, 255, alpha);
|
||||
case 0xE: return new Color(255, 255, 64, alpha);
|
||||
case 0xF: return new Color(255, 255, 255, alpha);
|
||||
default: return new Color(0, 0, 0, alpha);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package com.massivecraft.factions;
|
||||
package com.massivecraft.factions.integration;
|
||||
|
||||
import com.massivecraft.factions.Factions;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
@ -25,12 +25,12 @@ import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
|
||||
import com.massivecraft.factions.Board;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.Econ;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
import com.massivecraft.factions.FLocation;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.SpoutFeatures;
|
||||
import com.massivecraft.factions.integration.SpoutFeatures;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.struct.Relation;
|
||||
import com.massivecraft.factions.util.TextUtil;
|
||||
@ -126,10 +126,8 @@ public class FactionsPlayerListener extends PlayerListener{
|
||||
|
||||
@Override
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
|
||||
// Make sure that all online players do have a fplayer.
|
||||
FPlayer me = FPlayer.get(player);
|
||||
final FPlayer me = FPlayer.get(event.getPlayer());
|
||||
|
||||
// Update the lastLoginTime for this fplayer
|
||||
me.setLastLoginTime(System.currentTimeMillis());
|
||||
@ -138,12 +136,15 @@ public class FactionsPlayerListener extends PlayerListener{
|
||||
FPlayer.autoLeaveOnInactivityRoutine();
|
||||
FPlayer.autoLeaveOnInactivityRoutine();
|
||||
|
||||
SpoutFeatures.updateTerritoryDisplay(me);
|
||||
|
||||
// Appearance updates which are run when a player joins don't apply properly for other clients, so they need to be delayed slightly
|
||||
Factions.instance.getServer().getScheduler().scheduleSyncDelayedTask(Factions.instance, new Runnable() {
|
||||
public void run() {
|
||||
SpoutFeatures.updateAppearances(player);
|
||||
SpoutFeatures.updateAppearances(me.getPlayer());
|
||||
SpoutFeatures.updateTerritoryDisplay(me);
|
||||
}
|
||||
});
|
||||
}, 20);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -155,6 +156,7 @@ public class FactionsPlayerListener extends PlayerListener{
|
||||
if (myFaction != null) {
|
||||
myFaction.memberLoggedOff();
|
||||
}
|
||||
SpoutFeatures.playerDisconnect(me);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -517,13 +519,15 @@ public class FactionsPlayerListener extends PlayerListener{
|
||||
return;
|
||||
}
|
||||
|
||||
FPlayer badGuy = FPlayer.get(event.getPlayer());
|
||||
if (badGuy == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
SpoutFeatures.playerDisconnect(badGuy);
|
||||
|
||||
// if player was banned (not just kicked), get rid of their stored info
|
||||
if (event.getReason().equals("Banned by admin.")) {
|
||||
FPlayer badGuy = FPlayer.get(event.getPlayer());
|
||||
if (badGuy == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
badGuy.leave(false);
|
||||
badGuy.markForDeletion(true);
|
||||
}
|
||||
|
@ -5,8 +5,8 @@ import org.bukkit.event.server.ServerListener;
|
||||
import org.bukkit.event.server.PluginDisableEvent;
|
||||
import org.bukkit.event.server.PluginEnableEvent;
|
||||
|
||||
import com.massivecraft.factions.Econ;
|
||||
import com.massivecraft.factions.SpoutFeatures;
|
||||
import com.massivecraft.factions.integration.Econ;
|
||||
import com.massivecraft.factions.integration.SpoutFeatures;
|
||||
|
||||
|
||||
public class FactionsServerListener extends ServerListener {
|
||||
|
Loading…
Reference in New Issue
Block a user