Added Spout features, with Spout client required for all: relation-colored faction tags over players' heads via option "spoutFactionTagsOverNames", player's faction title over their head via option "spoutFactionTitlesOverNames", and relation-colored capes shown on faction admins and/or moderators via "spoutFactionAdminCapes" and "spoutFactionModeratorCapes" (all new settings default to true)
When a faction is disbanded or has peaceful status added or removed, all online players are now notified Added further debug output if an UnknownFormatConversionException is triggered during relational chat messages, to help track down cause
This commit is contained in:
parent
62f80a607b
commit
697e0cf466
BIN
lib/SpoutAPI.jar
Normal file
BIN
lib/SpoutAPI.jar
Normal file
Binary file not shown.
@ -151,6 +151,17 @@ public class Conf {
|
|||||||
|
|
||||||
public static transient Set<CreatureType> safeZoneNerfedCreatureTypes = EnumSet.noneOf(CreatureType.class);
|
public static transient Set<CreatureType> safeZoneNerfedCreatureTypes = EnumSet.noneOf(CreatureType.class);
|
||||||
|
|
||||||
|
// Spout features
|
||||||
|
public static boolean spoutFactionTagsOverNames = true;
|
||||||
|
public static boolean spoutFactionTitlesOverNames = true;
|
||||||
|
public static boolean spoutFactionAdminCapes = true;
|
||||||
|
public static boolean spoutFactionModeratorCapes = true;
|
||||||
|
public static String capeAlly = "http://www.wimbli.com/minecraft/factions_capes/capeAlly.png";
|
||||||
|
public static String capeEnemy = "http://www.wimbli.com/minecraft/factions_capes/capeEnemy.png";
|
||||||
|
public static String capeMember = "http://www.wimbli.com/minecraft/factions_capes/capeMember.png";
|
||||||
|
public static String capeNeutral = "http://www.wimbli.com/minecraft/factions_capes/capeNeutral.png";
|
||||||
|
public static String capePeaceful = "http://www.wimbli.com/minecraft/factions_capes/capePeaceful.png";
|
||||||
|
|
||||||
// Economy settings
|
// Economy settings
|
||||||
public static boolean econIConomyEnabled = false;
|
public static boolean econIConomyEnabled = false;
|
||||||
public static boolean econEssentialsEcoEnabled = false;
|
public static boolean econEssentialsEcoEnabled = false;
|
||||||
|
@ -78,6 +78,10 @@ public class FPlayer {
|
|||||||
this.factionChatting = false;
|
this.factionChatting = false;
|
||||||
this.role = Role.NORMAL;
|
this.role = Role.NORMAL;
|
||||||
this.title = "";
|
this.title = "";
|
||||||
|
|
||||||
|
if (playerName != null && !playerName.isEmpty()) {
|
||||||
|
SpoutFeatures.updateAppearances(this.getPlayer());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
@ -114,6 +118,7 @@ public class FPlayer {
|
|||||||
|
|
||||||
public void setFaction(Faction faction) {
|
public void setFaction(Faction faction) {
|
||||||
this.factionId = faction.getId();
|
this.factionId = faction.getId();
|
||||||
|
SpoutFeatures.updateAppearances(this.getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasFaction() {
|
public boolean hasFaction() {
|
||||||
@ -126,6 +131,7 @@ public class FPlayer {
|
|||||||
|
|
||||||
public void setRole(Role role) {
|
public void setRole(Role role) {
|
||||||
this.role = role;
|
this.role = role;
|
||||||
|
SpoutFeatures.updateAppearances(this.getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFactionChatting() {
|
public boolean isFactionChatting() {
|
||||||
@ -485,7 +491,7 @@ public class FPlayer {
|
|||||||
|
|
||||||
this.resetFactionData();
|
this.resetFactionData();
|
||||||
|
|
||||||
if (myFaction.isNormal() && myFaction.getFPlayers().size() == 0) {
|
if (myFaction.isNormal() && myFaction.getFPlayers().isEmpty()) {
|
||||||
// Remove this faction
|
// Remove this faction
|
||||||
for (FPlayer fplayer : FPlayer.getAllOnline()) {
|
for (FPlayer fplayer : FPlayer.getAllOnline()) {
|
||||||
fplayer.sendMessage("The faction "+myFaction.getTag(fplayer)+Conf.colorSystem+" was disbanded.");
|
fplayer.sendMessage("The faction "+myFaction.getTag(fplayer)+Conf.colorSystem+" was disbanded.");
|
||||||
|
@ -146,6 +146,7 @@ public class Factions extends JavaPlugin {
|
|||||||
|
|
||||||
setupPermissions();
|
setupPermissions();
|
||||||
integrateEssentialsChat();
|
integrateEssentialsChat();
|
||||||
|
SpoutFeatures.setup(this);
|
||||||
Econ.setup(this);
|
Econ.setup(this);
|
||||||
Econ.monitorPlugins();
|
Econ.monitorPlugins();
|
||||||
|
|
||||||
@ -207,7 +208,7 @@ public class Factions extends JavaPlugin {
|
|||||||
|
|
||||||
if (test != null) {
|
if (test != null) {
|
||||||
Permissions = ((Permissions)test).getHandler();
|
Permissions = ((Permissions)test).getHandler();
|
||||||
Factions.log("Found and will use plugin "+((Permissions)test).getDescription().getFullName());
|
Factions.log("Found and will use "+test.getDescription().getFullName()+" for permissions");
|
||||||
} else {
|
} else {
|
||||||
Factions.log("Permissions plugin not detected, defaulting to Bukkit superperms system");
|
Factions.log("Permissions plugin not detected, defaulting to Bukkit superperms system");
|
||||||
}
|
}
|
||||||
|
176
src/com/massivecraft/factions/SpoutFeatures.java
Normal file
176
src/com/massivecraft/factions/SpoutFeatures.java
Normal file
@ -0,0 +1,176 @@
|
|||||||
|
package com.massivecraft.factions;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.struct.Relation;
|
||||||
|
import com.massivecraft.factions.struct.Role;
|
||||||
|
|
||||||
|
import org.getspout.spoutapi.player.AppearanceManager;
|
||||||
|
import org.getspout.spoutapi.player.SpoutPlayer;
|
||||||
|
import org.getspout.spoutapi.SpoutManager;
|
||||||
|
|
||||||
|
|
||||||
|
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, "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// set integration availability
|
||||||
|
public static void setAvailable(boolean enable, String pluginName) {
|
||||||
|
spoutMe = enable;
|
||||||
|
if (spoutMe) {
|
||||||
|
spoutApp = SpoutManager.getAppearanceManager();
|
||||||
|
Factions.log("Found and will use features of "+pluginName);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
spoutApp = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If any Spout feature is enabled in conf.json, and we're successfully hooked into it
|
||||||
|
public static boolean enabled() {
|
||||||
|
return spoutMe && (
|
||||||
|
Conf.spoutFactionTagsOverNames
|
||||||
|
|| Conf.spoutFactionTitlesOverNames
|
||||||
|
|| Conf.spoutFactionAdminCapes
|
||||||
|
|| Conf.spoutFactionModeratorCapes
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// update all appearances between every player
|
||||||
|
public static void updateAppearances() {
|
||||||
|
if (!enabled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Set<FPlayer> players = FPlayer.getAllOnline();
|
||||||
|
Faction factionA;
|
||||||
|
|
||||||
|
for (FPlayer playerA : players) {
|
||||||
|
factionA = playerA.getFaction();
|
||||||
|
for (FPlayer playerB : players) {
|
||||||
|
updateSingle(playerB.getPlayer(), playerA.getPlayer(), factionA.getRelation(playerB), factionA, playerA.getTitle(), playerA.getRole());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// update all appearances related to a specific player
|
||||||
|
public static void updateAppearances(Player player) {
|
||||||
|
if (!enabled() || player == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Set<FPlayer> players = FPlayer.getAllOnline();
|
||||||
|
FPlayer playerA = FPlayer.get(player);
|
||||||
|
Faction factionA = playerA.getFaction();
|
||||||
|
|
||||||
|
for (FPlayer playerB : players) {
|
||||||
|
Player player2 = playerB.getPlayer();
|
||||||
|
Relation rel = factionA.getRelation(playerB);
|
||||||
|
updateSingle(player2, player, rel, factionA, playerA.getTitle(), playerA.getRole());
|
||||||
|
updateSingle(player, player2, rel, playerB.getFaction(), playerB.getTitle(), playerB.getRole());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// update all appearances related to a single faction
|
||||||
|
public static void updateAppearances(Faction faction) {
|
||||||
|
if (!enabled() || faction == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Set<FPlayer> players = FPlayer.getAllOnline();
|
||||||
|
Faction factionA, factionB;
|
||||||
|
|
||||||
|
for (FPlayer playerA : players) {
|
||||||
|
factionA = playerA.getFaction();
|
||||||
|
|
||||||
|
for (FPlayer playerB : players) {
|
||||||
|
factionB = playerB.getFaction();
|
||||||
|
if (factionA != faction && factionB != faction) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
updateSingle(playerB.getPlayer(), playerA.getPlayer(), factionA.getRelation(factionB), factionA, playerA.getTitle(), playerA.getRole());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// update all appearances between two factions
|
||||||
|
public static void updateAppearances(Faction factionA, Faction factionB) {
|
||||||
|
if (!enabled() || factionA == null || factionB == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (FPlayer playerA : factionA.getFPlayersWhereOnline(true)) {
|
||||||
|
for (FPlayer playerB : factionB.getFPlayersWhereOnline(true)) {
|
||||||
|
Player player1 = playerA.getPlayer();
|
||||||
|
Player player2 = playerB.getPlayer();
|
||||||
|
Relation rel = factionA.getRelation(factionB);
|
||||||
|
updateSingle(player2, player1, rel, factionA, playerA.getTitle(), playerA.getRole());
|
||||||
|
updateSingle(player1, player2, rel, factionB, playerB.getTitle(), playerB.getRole());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// update a single appearance; internal use only by above public methods
|
||||||
|
private static void updateSingle(Player viewer, Player viewed, Relation relation, Faction viewedFaction, String viewedTitle, Role viewedRole) {
|
||||||
|
if (viewer == null || viewed == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SpoutPlayer sPlayer = SpoutManager.getPlayer(viewer);
|
||||||
|
|
||||||
|
if (Conf.spoutFactionTagsOverNames || Conf.spoutFactionTitlesOverNames) {
|
||||||
|
String addTag = "";
|
||||||
|
if (Conf.spoutFactionTagsOverNames) {
|
||||||
|
addTag += !viewedFaction.isNormal() ? "Factionless" : viewedFaction.getTag(relation.getColor().toString() + "[") + "]";
|
||||||
|
}
|
||||||
|
String rolePrefix = viewedRole.getPrefix();
|
||||||
|
if (Conf.spoutFactionTitlesOverNames && (!viewedTitle.isEmpty() || !rolePrefix.isEmpty())) {
|
||||||
|
addTag += (addTag.isEmpty() ? "" : " ") + viewedRole.getPrefix() + viewedTitle;
|
||||||
|
}
|
||||||
|
spoutApp.setPlayerTitle(sPlayer, viewed, addTag + "\n" + viewed.getDisplayName());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
(Conf.spoutFactionAdminCapes && viewedRole.equals(Role.ADMIN))
|
||||||
|
|| (Conf.spoutFactionModeratorCapes && viewedRole.equals(Role.MODERATOR))
|
||||||
|
) {
|
||||||
|
String cape = "";
|
||||||
|
if (!viewedFaction.isNormal()) {
|
||||||
|
// yeah, no cape if no faction
|
||||||
|
}
|
||||||
|
else if (viewedFaction.isPeaceful()) {
|
||||||
|
cape = Conf.capePeaceful;
|
||||||
|
}
|
||||||
|
else if (relation.isNeutral()) {
|
||||||
|
cape = Conf.capeNeutral;
|
||||||
|
}
|
||||||
|
else if (relation.isMember()) {
|
||||||
|
cape = Conf.capeMember;
|
||||||
|
}
|
||||||
|
else if (relation.isEnemy()) {
|
||||||
|
cape = Conf.capeEnemy;
|
||||||
|
}
|
||||||
|
else if (relation.isAlly()) {
|
||||||
|
cape = Conf.capeAlly;
|
||||||
|
}
|
||||||
|
spoutApp.setPlayerCloak(sPlayer, viewed, cape);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -13,6 +13,7 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import com.massivecraft.factions.Conf;
|
import com.massivecraft.factions.Conf;
|
||||||
import com.massivecraft.factions.Factions;
|
import com.massivecraft.factions.Factions;
|
||||||
|
import com.massivecraft.factions.SpoutFeatures;
|
||||||
|
|
||||||
public class FCommandConfig extends FBaseCommand {
|
public class FCommandConfig extends FBaseCommand {
|
||||||
|
|
||||||
@ -226,6 +227,9 @@ public class FCommandConfig extends FBaseCommand {
|
|||||||
}
|
}
|
||||||
// save change to disk
|
// save change to disk
|
||||||
Conf.save();
|
Conf.save();
|
||||||
|
|
||||||
|
// in case some Spout related setting was changed
|
||||||
|
SpoutFeatures.updateAppearances();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,11 @@ package com.massivecraft.factions.commands;
|
|||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.Conf;
|
||||||
import com.massivecraft.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
import com.massivecraft.factions.Factions;
|
import com.massivecraft.factions.Factions;
|
||||||
|
import com.massivecraft.factions.FPlayer;
|
||||||
|
import com.massivecraft.factions.SpoutFeatures;
|
||||||
|
|
||||||
public class FCommandDisband extends FBaseCommand {
|
public class FCommandDisband extends FBaseCommand {
|
||||||
|
|
||||||
@ -27,12 +30,21 @@ public class FCommandDisband extends FBaseCommand {
|
|||||||
if( parameters.size() > 0) {
|
if( parameters.size() > 0) {
|
||||||
Faction faction = Faction.findByTag(parameters.get(0));
|
Faction faction = Faction.findByTag(parameters.get(0));
|
||||||
|
|
||||||
if( faction != null && faction.getId() > 0 ) {
|
if( faction == null || !faction.isNormal()) {
|
||||||
sendMessage("Faction " + faction.getTag() + " got disbanded");
|
|
||||||
Faction.delete( faction.getId() );
|
|
||||||
} else {
|
|
||||||
sendMessage("Faction " + parameters.get(0) + "not found");
|
sendMessage("Faction " + parameters.get(0) + "not found");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Inform all players
|
||||||
|
for (FPlayer fplayer : FPlayer.getAllOnline()) {
|
||||||
|
if (fplayer.getFaction() == faction) {
|
||||||
|
fplayer.sendMessage(me.getNameAndRelevant(fplayer)+Conf.colorSystem+" disbanded your faction.");
|
||||||
|
} else {
|
||||||
|
fplayer.sendMessage(me.getNameAndRelevant(fplayer)+Conf.colorSystem+" disbanded the faction "+faction.getTag(fplayer)+".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Faction.delete( faction.getId() );
|
||||||
|
SpoutFeatures.updateAppearances();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,8 +2,11 @@ package com.massivecraft.factions.commands;
|
|||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.Conf;
|
||||||
import com.massivecraft.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
import com.massivecraft.factions.Factions;
|
import com.massivecraft.factions.Factions;
|
||||||
|
import com.massivecraft.factions.FPlayer;
|
||||||
|
import com.massivecraft.factions.SpoutFeatures;
|
||||||
|
|
||||||
public class FCommandPeaceful extends FBaseCommand {
|
public class FCommandPeaceful extends FBaseCommand {
|
||||||
|
|
||||||
@ -32,13 +35,24 @@ public class FCommandPeaceful extends FBaseCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( faction != null && faction.isPeaceful() ) {
|
String change;
|
||||||
sendMessage("Faction \"" + parameters.get(0) + "\" peaceful designation removed");
|
if(faction.isPeaceful()) {
|
||||||
|
change = "removed peaceful status from";
|
||||||
faction.setPeaceful(false);
|
faction.setPeaceful(false);
|
||||||
} else {
|
} else {
|
||||||
sendMessage("Faction \"" + faction.getTag() + "\" has been designated as peaceful");
|
change = "granted peaceful status to";
|
||||||
faction.setPeaceful(true);
|
faction.setPeaceful(true);
|
||||||
}
|
}
|
||||||
|
// Inform all players
|
||||||
|
for (FPlayer fplayer : FPlayer.getAllOnline()) {
|
||||||
|
if (fplayer.getFaction() == faction) {
|
||||||
|
fplayer.sendMessage(me.getNameAndRelevant(fplayer)+Conf.colorSystem+" has "+change+" your faction.");
|
||||||
|
} else {
|
||||||
|
fplayer.sendMessage(me.getNameAndRelevant(fplayer)+Conf.colorSystem+" has "+change+" the faction \"" + faction.getTag(fplayer) + "\".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SpoutFeatures.updateAppearances(faction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||||||
|
|
||||||
import com.massivecraft.factions.Conf;
|
import com.massivecraft.factions.Conf;
|
||||||
import com.massivecraft.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
|
import com.massivecraft.factions.SpoutFeatures;
|
||||||
import com.massivecraft.factions.struct.Role;
|
import com.massivecraft.factions.struct.Role;
|
||||||
import com.massivecraft.factions.util.TextUtil;
|
import com.massivecraft.factions.util.TextUtil;
|
||||||
|
|
||||||
@ -66,6 +67,10 @@ public class FCommandTag extends FBaseCommand {
|
|||||||
}
|
}
|
||||||
faction.sendMessage(Conf.colorSystem+"The faction "+me.getRelationColor(faction)+oldtag+Conf.colorSystem+" changed their name to "+myFaction.getTag(faction));
|
faction.sendMessage(Conf.colorSystem+"The faction "+me.getRelationColor(faction)+oldtag+Conf.colorSystem+" changed their name to "+myFaction.getTag(faction));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Conf.spoutFactionTagsOverNames) {
|
||||||
|
SpoutFeatures.updateAppearances(myFaction);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package com.massivecraft.factions.commands;
|
|||||||
import com.massivecraft.factions.Conf;
|
import com.massivecraft.factions.Conf;
|
||||||
import com.massivecraft.factions.FPlayer;
|
import com.massivecraft.factions.FPlayer;
|
||||||
import com.massivecraft.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
|
import com.massivecraft.factions.SpoutFeatures;
|
||||||
import com.massivecraft.factions.util.TextUtil;
|
import com.massivecraft.factions.util.TextUtil;
|
||||||
|
|
||||||
public class FCommandTitle extends FBaseCommand {
|
public class FCommandTitle extends FBaseCommand {
|
||||||
@ -51,6 +52,10 @@ public class FCommandTitle extends FBaseCommand {
|
|||||||
// Inform
|
// Inform
|
||||||
Faction myFaction = me.getFaction();
|
Faction myFaction = me.getFaction();
|
||||||
myFaction.sendMessage(me.getNameAndRelevant(myFaction)+Conf.colorSystem+" changed a title: "+you.getNameAndRelevant(myFaction));
|
myFaction.sendMessage(me.getNameAndRelevant(myFaction)+Conf.colorSystem+" changed a title: "+you.getNameAndRelevant(myFaction));
|
||||||
|
|
||||||
|
if (Conf.spoutFactionTitlesOverNames) {
|
||||||
|
SpoutFeatures.updateAppearances(player);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import org.bukkit.ChatColor;
|
|||||||
import com.massivecraft.factions.Conf;
|
import com.massivecraft.factions.Conf;
|
||||||
import com.massivecraft.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
import com.massivecraft.factions.Factions;
|
import com.massivecraft.factions.Factions;
|
||||||
|
import com.massivecraft.factions.SpoutFeatures;
|
||||||
import com.massivecraft.factions.struct.Relation;
|
import com.massivecraft.factions.struct.Relation;
|
||||||
import com.massivecraft.factions.struct.Role;
|
import com.massivecraft.factions.struct.Role;
|
||||||
|
|
||||||
@ -72,5 +73,7 @@ public class FRelationCommand extends FBaseCommand {
|
|||||||
otherFaction.sendMessage(Conf.colorSystem+"This will have no effect while their faction is peaceful.");
|
otherFaction.sendMessage(Conf.colorSystem+"This will have no effect while their faction is peaceful.");
|
||||||
myFaction.sendMessage(Conf.colorSystem+"This will have no effect while your faction is peaceful.");
|
myFaction.sendMessage(Conf.colorSystem+"This will have no effect while your faction is peaceful.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SpoutFeatures.updateAppearances(myFaction, otherFaction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package com.massivecraft.factions.listeners;
|
|||||||
|
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.UnknownFormatConversionException;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -28,9 +29,11 @@ import com.massivecraft.factions.FLocation;
|
|||||||
import com.massivecraft.factions.FPlayer;
|
import com.massivecraft.factions.FPlayer;
|
||||||
import com.massivecraft.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
import com.massivecraft.factions.Factions;
|
import com.massivecraft.factions.Factions;
|
||||||
|
import com.massivecraft.factions.SpoutFeatures;
|
||||||
import com.massivecraft.factions.struct.Role;
|
import com.massivecraft.factions.struct.Role;
|
||||||
import com.massivecraft.factions.struct.Relation;
|
import com.massivecraft.factions.struct.Relation;
|
||||||
import com.massivecraft.factions.util.TextUtil;
|
import com.massivecraft.factions.util.TextUtil;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -97,8 +100,17 @@ public class FactionsPlayerListener extends PlayerListener{
|
|||||||
for (Player listeningPlayer : event.getRecipients()) {
|
for (Player listeningPlayer : event.getRecipients()) {
|
||||||
FPlayer you = FPlayer.get(listeningPlayer);
|
FPlayer you = FPlayer.get(listeningPlayer);
|
||||||
String yourFormat = formatStart + me.getChatTag(you).trim() + formatEnd;
|
String yourFormat = formatStart + me.getChatTag(you).trim() + formatEnd;
|
||||||
|
try {
|
||||||
listeningPlayer.sendMessage(String.format(yourFormat, talkingPlayer.getDisplayName(), msg));
|
listeningPlayer.sendMessage(String.format(yourFormat, talkingPlayer.getDisplayName(), msg));
|
||||||
}
|
}
|
||||||
|
catch (UnknownFormatConversionException ex) {
|
||||||
|
Factions.log(Level.SEVERE, "Critical error in chat message formatting! Complete format string: "+yourFormat);
|
||||||
|
Factions.log(Level.SEVERE, "First half of event.getFormat() string: "+formatStart);
|
||||||
|
Factions.log(Level.SEVERE, "Second half of event.getFormat() string: "+formatEnd);
|
||||||
|
ex.printStackTrace();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Write to the log... We will write the non colored message.
|
// Write to the log... We will write the non colored message.
|
||||||
String nonColoredMsg = ChatColor.stripColor(String.format(nonColoredMsgFormat, talkingPlayer.getDisplayName(), msg));
|
String nonColoredMsg = ChatColor.stripColor(String.format(nonColoredMsgFormat, talkingPlayer.getDisplayName(), msg));
|
||||||
@ -120,6 +132,8 @@ public class FactionsPlayerListener extends PlayerListener{
|
|||||||
// Run the member auto kick routine. Twice to get to the admins...
|
// Run the member auto kick routine. Twice to get to the admins...
|
||||||
FPlayer.autoLeaveOnInactivityRoutine();
|
FPlayer.autoLeaveOnInactivityRoutine();
|
||||||
FPlayer.autoLeaveOnInactivityRoutine();
|
FPlayer.autoLeaveOnInactivityRoutine();
|
||||||
|
|
||||||
|
SpoutFeatures.updateAppearances(event.getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -436,6 +450,7 @@ public class FactionsPlayerListener extends PlayerListener{
|
|||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
cmdCheck = iter.next();
|
cmdCheck = iter.next();
|
||||||
if (cmdCheck == null) {
|
if (cmdCheck == null) {
|
||||||
|
iter.remove();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -456,6 +471,7 @@ public class FactionsPlayerListener extends PlayerListener{
|
|||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
cmdCheck = iter.next();
|
cmdCheck = iter.next();
|
||||||
if (cmdCheck == null) {
|
if (cmdCheck == null) {
|
||||||
|
iter.remove();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import org.bukkit.event.server.PluginDisableEvent;
|
|||||||
import org.bukkit.event.server.PluginEnableEvent;
|
import org.bukkit.event.server.PluginEnableEvent;
|
||||||
|
|
||||||
import com.massivecraft.factions.Econ;
|
import com.massivecraft.factions.Econ;
|
||||||
|
import com.massivecraft.factions.SpoutFeatures;
|
||||||
|
|
||||||
|
|
||||||
public class FactionsServerListener extends ServerListener {
|
public class FactionsServerListener extends ServerListener {
|
||||||
@ -15,9 +16,12 @@ public class FactionsServerListener extends ServerListener {
|
|||||||
if (Econ.iConomyHooked() && name.equals("iConomy")) {
|
if (Econ.iConomyHooked() && name.equals("iConomy")) {
|
||||||
Econ.iConomySet(false);
|
Econ.iConomySet(false);
|
||||||
}
|
}
|
||||||
if (Econ.essentialsEcoHooked() && name.equals("Essentials")) {
|
else if (Econ.essentialsEcoHooked() && name.equals("Essentials")) {
|
||||||
Econ.essentialsEcoSet(false);
|
Econ.essentialsEcoSet(false);
|
||||||
}
|
}
|
||||||
|
else if (name.equals("Spout")) {
|
||||||
|
SpoutFeatures.setAvailable(false, "");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -30,5 +34,8 @@ public class FactionsServerListener extends ServerListener {
|
|||||||
else if (!Econ.essentialsEcoHooked() && name.equals("Essentials")) {
|
else if (!Econ.essentialsEcoHooked() && name.equals("Essentials")) {
|
||||||
Econ.essentialsEcoSet(true);
|
Econ.essentialsEcoSet(true);
|
||||||
}
|
}
|
||||||
|
else if (name.equals("Spout")) {
|
||||||
|
SpoutFeatures.setAvailable(true, plug.getDescription().getFullName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -8,7 +8,9 @@ softdepend:
|
|||||||
- HeroChat
|
- HeroChat
|
||||||
- iChat
|
- iChat
|
||||||
- LocalAreaChat
|
- LocalAreaChat
|
||||||
|
- nChat
|
||||||
- iConomy
|
- iConomy
|
||||||
|
- Spout
|
||||||
commands:
|
commands:
|
||||||
f:
|
f:
|
||||||
description: All of the Factions commands
|
description: All of the Factions commands
|
||||||
|
Loading…
Reference in New Issue
Block a user