Truces.
Add chat channel functionality. Essentially the same as Allies except it's a different word.
This commit is contained in:
parent
a943f47abb
commit
8c2f08b694
@ -16,12 +16,12 @@ public class Conf {
|
||||
// Colors
|
||||
public static ChatColor colorMember = ChatColor.GREEN;
|
||||
public static ChatColor colorAlly = ChatColor.LIGHT_PURPLE;
|
||||
public static ChatColor colorTruce = ChatColor.DARK_PURPLE;
|
||||
public static ChatColor colorNeutral = ChatColor.WHITE;
|
||||
public static ChatColor colorEnemy = ChatColor.RED;
|
||||
|
||||
public static ChatColor colorPeaceful = ChatColor.GOLD;
|
||||
public static ChatColor colorWar = ChatColor.DARK_RED;
|
||||
//public static ChatColor colorWilderness = ChatColor.DARK_GREEN;
|
||||
|
||||
// Power
|
||||
public static double powerPlayerMax = 10.0;
|
||||
@ -71,6 +71,7 @@ public class Conf {
|
||||
public static String chatTagFormat = "%s" + ChatColor.WHITE;
|
||||
public static String factionChatFormat = "%s:" + ChatColor.WHITE + " %s";
|
||||
public static String allianceChatFormat = ChatColor.LIGHT_PURPLE + "%s:" + ChatColor.WHITE + " %s";
|
||||
public static String truceChatFormat = ChatColor.DARK_PURPLE + "%s:" + ChatColor.WHITE + " %s";
|
||||
|
||||
public static boolean broadcastDescriptionChanges = false;
|
||||
|
||||
@ -163,6 +164,12 @@ public class Conf {
|
||||
public static boolean territoryAllyPainBuildWhenOffline = false;
|
||||
public static boolean territoryAllyDenyUseage = true;
|
||||
public static boolean territoryAllyProtectMaterials = true;
|
||||
public static boolean territoryTruceDenyBuild = true;
|
||||
public static boolean territoryTruceDenyBuildWhenOffline = true;
|
||||
public static boolean territoryTrucePainBuild = false;
|
||||
public static boolean territoryTrucePainBuildWhenOffline = false;
|
||||
public static boolean territoryTruceDenyUseage = true;
|
||||
public static boolean territoryTruceProtectMaterials = true;
|
||||
public static boolean territoryBlockCreepers = false;
|
||||
public static boolean territoryBlockCreepersWhenOffline = false;
|
||||
public static boolean territoryBlockFireballs = false;
|
||||
@ -242,6 +249,7 @@ public class Conf {
|
||||
public static double econCostShow = 0.0;
|
||||
public static double econCostOpen = 0.0;
|
||||
public static double econCostAlly = 0.0;
|
||||
public static double econCostTruce = 0.0;
|
||||
public static double econCostEnemy = 0.0;
|
||||
public static double econCostNeutral = 0.0;
|
||||
public static double econCostNoBoom = 0.0;
|
||||
|
@ -42,6 +42,8 @@ public class CmdChat extends FCommand {
|
||||
modeTarget = ChatMode.ALLIANCE;
|
||||
} else if (modeString.startsWith("f")) {
|
||||
modeTarget = ChatMode.FACTION;
|
||||
} else if (modeString.startsWith("t")) {
|
||||
modeTarget = ChatMode.TRUCE;
|
||||
} else {
|
||||
msg(TL.COMMAND_CHAT_INVALIDMODE);
|
||||
return;
|
||||
@ -54,6 +56,8 @@ public class CmdChat extends FCommand {
|
||||
msg(TL.COMMAND_CHAT_MODE_PUBLIC);
|
||||
} else if (fme.getChatMode() == ChatMode.ALLIANCE) {
|
||||
msg(TL.COMMAND_CHAT_MODE_ALLIANCE);
|
||||
} else if (fme.getChatMode() == ChatMode.TRUCE) {
|
||||
msg(TL.COMMAND_CHAT_MODE_TRUCE);
|
||||
} else {
|
||||
msg(TL.COMMAND_CHAT_MODE_FACTION);
|
||||
}
|
||||
|
@ -77,10 +77,8 @@ public abstract class FRelationCommand extends FCommand {
|
||||
|
||||
them.msg(TL.COMMAND_RELATIONS_MUTUAL, currentRelationColor + targetRelation.getTranslation(), currentRelationColor + myFaction.getTag());
|
||||
myFaction.msg(TL.COMMAND_RELATIONS_MUTUAL, currentRelationColor + targetRelation.getTranslation(), currentRelationColor + them.getTag());
|
||||
}
|
||||
// inform the other faction of your request
|
||||
else {
|
||||
|
||||
} else {
|
||||
// inform the other faction of your request
|
||||
them.msg(TL.COMMAND_RELATIONS_PROPOSAL_1, currentRelationColor + myFaction.getTag(), targetRelation.getColor() + targetRelation.getTranslation());
|
||||
them.msg(TL.COMMAND_RELATIONS_PROPOSAL_2, Conf.baseCommandAliases.get(0), targetRelation, myFaction.getTag());
|
||||
myFaction.msg(TL.COMMAND_RELATIONS_PROPOSAL_SENT, currentRelationColor + them.getTag(), "" + targetRelation.getColor() + targetRelation);
|
||||
|
@ -74,6 +74,28 @@ public class FactionsChatListener implements Listener {
|
||||
|
||||
Bukkit.getLogger().log(Level.INFO, ChatColor.stripColor("AllianceChat: " + message));
|
||||
|
||||
event.setCancelled(true);
|
||||
} else if (chat == ChatMode.TRUCE) {
|
||||
Faction myFaction = me.getFaction();
|
||||
|
||||
String message = String.format(Conf.truceChatFormat, ChatColor.stripColor(me.getNameAndTag()), msg);
|
||||
|
||||
//Send message to our own faction
|
||||
myFaction.sendMessage(message);
|
||||
|
||||
//Send to all our truces
|
||||
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
|
||||
if (myFaction.getRelationTo(fplayer) == Relation.TRUCE) {
|
||||
fplayer.sendMessage(message);
|
||||
}
|
||||
|
||||
//Send to any players who are spying chat
|
||||
else if (fplayer.isSpyingChat()) {
|
||||
fplayer.sendMessage("[TCspy]: " + message);
|
||||
}
|
||||
}
|
||||
|
||||
Bukkit.getLogger().log(Level.INFO, ChatColor.stripColor("TruceChat: " + message));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
@ -398,7 +398,7 @@ public class FactionsPlayerListener implements Listener {
|
||||
}
|
||||
|
||||
// You may use any block unless it is another faction's territory...
|
||||
if (rel.isNeutral() || (rel.isEnemy() && Conf.territoryEnemyProtectMaterials) || (rel.isAlly() && Conf.territoryAllyProtectMaterials)) {
|
||||
if (rel.isNeutral() || (rel.isEnemy() && Conf.territoryEnemyProtectMaterials) || (rel.isAlly() && Conf.territoryAllyProtectMaterials) || (rel.isTruce() && Conf.territoryTruceProtectMaterials)) {
|
||||
if (!justCheck) {
|
||||
me.msg("<b>You can't %s <h>%s<b> in the territory of <h>%s<b>.", (material == Material.SOIL ? "trample" : "use"), TextUtil.getMaterialName(material), otherFaction.getTag(myFaction));
|
||||
}
|
||||
|
@ -3,8 +3,9 @@ package com.massivecraft.factions.struct;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
|
||||
public enum ChatMode {
|
||||
FACTION(2, TL.CHAT_FACTION),
|
||||
ALLIANCE(1, TL.CHAT_ALLIANCE),
|
||||
FACTION(3, TL.CHAT_FACTION),
|
||||
ALLIANCE(2, TL.CHAT_ALLIANCE),
|
||||
TRUCE(1, TL.CHAT_TRUCE),
|
||||
PUBLIC(0, TL.CHAT_PUBLIC);
|
||||
|
||||
public final int value;
|
||||
|
@ -6,8 +6,9 @@ import org.bukkit.ChatColor;
|
||||
|
||||
|
||||
public enum Relation {
|
||||
MEMBER(3, "member"),
|
||||
ALLY(2, "ally"),
|
||||
MEMBER(4, "member"),
|
||||
ALLY(3, "ally"),
|
||||
TRUCE(2, "truce"),
|
||||
NEUTRAL(1, "neutral"),
|
||||
ENEMY(0, "enemy");
|
||||
|
||||
@ -27,13 +28,15 @@ public enum Relation {
|
||||
public static Relation fromString(String s) {
|
||||
// Because Java 6 doesn't allow String switches :(
|
||||
if (s.equalsIgnoreCase("member")) {
|
||||
return Relation.MEMBER;
|
||||
return MEMBER;
|
||||
} else if (s.equalsIgnoreCase("ally")) {
|
||||
return Relation.ALLY;
|
||||
return ALLY;
|
||||
} else if(s.equalsIgnoreCase("truce")) {
|
||||
return TRUCE;
|
||||
} else if (s.equalsIgnoreCase("enemy")) {
|
||||
return Relation.ENEMY;
|
||||
return ENEMY;
|
||||
} else {
|
||||
return Relation.NEUTRAL; // If they somehow mess things up, go back to default behavior.
|
||||
return NEUTRAL; // If they somehow mess things up, go back to default behavior.
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,6 +57,10 @@ public enum Relation {
|
||||
return this == ALLY;
|
||||
}
|
||||
|
||||
public boolean isTruce() {
|
||||
return this == TRUCE;
|
||||
}
|
||||
|
||||
public boolean isNeutral() {
|
||||
return this == NEUTRAL;
|
||||
}
|
||||
@ -77,6 +84,8 @@ public enum Relation {
|
||||
return Conf.colorAlly;
|
||||
} else if (this == NEUTRAL) {
|
||||
return Conf.colorNeutral;
|
||||
} else if (this == TRUCE) {
|
||||
return Conf.colorTruce;
|
||||
} else {
|
||||
return Conf.colorEnemy;
|
||||
}
|
||||
@ -93,6 +102,8 @@ public enum Relation {
|
||||
return Conf.territoryEnemyDenyBuild;
|
||||
} else if (isAlly()) {
|
||||
return Conf.territoryAllyDenyBuild;
|
||||
} else if (isTruce()) {
|
||||
return Conf.territoryTruceDenyBuild;
|
||||
} else {
|
||||
return Conf.territoryDenyBuild;
|
||||
}
|
||||
@ -101,6 +112,8 @@ public enum Relation {
|
||||
return Conf.territoryEnemyDenyBuildWhenOffline;
|
||||
} else if (isAlly()) {
|
||||
return Conf.territoryAllyDenyBuildWhenOffline;
|
||||
} else if (isTruce()) {
|
||||
return Conf.territoryTruceDenyBuildWhenOffline;
|
||||
} else {
|
||||
return Conf.territoryDenyBuildWhenOffline;
|
||||
}
|
||||
@ -118,6 +131,8 @@ public enum Relation {
|
||||
return Conf.territoryEnemyPainBuild;
|
||||
} else if (isAlly()) {
|
||||
return Conf.territoryAllyPainBuild;
|
||||
} else if (isTruce()) {
|
||||
return Conf.territoryTrucePainBuild;
|
||||
} else {
|
||||
return Conf.territoryPainBuild;
|
||||
}
|
||||
@ -126,6 +141,8 @@ public enum Relation {
|
||||
return Conf.territoryEnemyPainBuildWhenOffline;
|
||||
} else if (isAlly()) {
|
||||
return Conf.territoryAllyPainBuildWhenOffline;
|
||||
} else if (isTruce()) {
|
||||
return Conf.territoryTrucePainBuildWhenOffline;
|
||||
} else {
|
||||
return Conf.territoryPainBuildWhenOffline;
|
||||
}
|
||||
@ -140,6 +157,8 @@ public enum Relation {
|
||||
return Conf.territoryEnemyDenyUseage;
|
||||
} else if (isAlly()) {
|
||||
return Conf.territoryAllyDenyUseage;
|
||||
} else if (isTruce()) {
|
||||
return Conf.territoryTruceDenyUseage;
|
||||
} else {
|
||||
return Conf.territoryDenyUseage;
|
||||
}
|
||||
@ -150,6 +169,8 @@ public enum Relation {
|
||||
return Conf.econCostEnemy;
|
||||
} else if (isAlly()) {
|
||||
return Conf.econCostAlly;
|
||||
} else if (isTruce()) {
|
||||
return Conf.econCostTruce;
|
||||
} else {
|
||||
return Conf.econCostNeutral;
|
||||
}
|
||||
|
@ -85,6 +85,7 @@ public enum TL {
|
||||
|
||||
COMMAND_CHAT_MODE_PUBLIC("<i>Public chat mode."),
|
||||
COMMAND_CHAT_MODE_ALLIANCE("<i>Alliance only chat mode."),
|
||||
COMMAND_CHAT_MODE_TRUCE("<i>Truce only chat mode."),
|
||||
COMMAND_CHAT_MODE_FACTION("<i>Faction only chat mode."),
|
||||
|
||||
COMMAND_CHATSPY_ENABLE("<i>You have enabled chat spying mode."),
|
||||
@ -564,6 +565,7 @@ public enum TL {
|
||||
*/
|
||||
CHAT_FACTION("faction chat"),
|
||||
CHAT_ALLIANCE("alliance chat"),
|
||||
CHAT_TRUCE("truce chat"),
|
||||
CHAT_PUBLIC("public chat"),
|
||||
|
||||
/**
|
||||
@ -571,6 +573,7 @@ public enum TL {
|
||||
*/
|
||||
RELATION_MEMBER("member"),
|
||||
RELATION_ALLY("ally"),
|
||||
RELATION_TRUCE("truce"),
|
||||
RELATION_NEUTRAL("neutral"),
|
||||
RELATION_ENEMY("enemy"),
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user