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
|
// Colors
|
||||||
public static ChatColor colorMember = ChatColor.GREEN;
|
public static ChatColor colorMember = ChatColor.GREEN;
|
||||||
public static ChatColor colorAlly = ChatColor.LIGHT_PURPLE;
|
public static ChatColor colorAlly = ChatColor.LIGHT_PURPLE;
|
||||||
|
public static ChatColor colorTruce = ChatColor.DARK_PURPLE;
|
||||||
public static ChatColor colorNeutral = ChatColor.WHITE;
|
public static ChatColor colorNeutral = ChatColor.WHITE;
|
||||||
public static ChatColor colorEnemy = ChatColor.RED;
|
public static ChatColor colorEnemy = ChatColor.RED;
|
||||||
|
|
||||||
public static ChatColor colorPeaceful = ChatColor.GOLD;
|
public static ChatColor colorPeaceful = ChatColor.GOLD;
|
||||||
public static ChatColor colorWar = ChatColor.DARK_RED;
|
public static ChatColor colorWar = ChatColor.DARK_RED;
|
||||||
//public static ChatColor colorWilderness = ChatColor.DARK_GREEN;
|
|
||||||
|
|
||||||
// Power
|
// Power
|
||||||
public static double powerPlayerMax = 10.0;
|
public static double powerPlayerMax = 10.0;
|
||||||
@ -71,6 +71,7 @@ public class Conf {
|
|||||||
public static String chatTagFormat = "%s" + ChatColor.WHITE;
|
public static String chatTagFormat = "%s" + ChatColor.WHITE;
|
||||||
public static String factionChatFormat = "%s:" + ChatColor.WHITE + " %s";
|
public static String factionChatFormat = "%s:" + ChatColor.WHITE + " %s";
|
||||||
public static String allianceChatFormat = ChatColor.LIGHT_PURPLE + "%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;
|
public static boolean broadcastDescriptionChanges = false;
|
||||||
|
|
||||||
@ -163,6 +164,12 @@ public class Conf {
|
|||||||
public static boolean territoryAllyPainBuildWhenOffline = false;
|
public static boolean territoryAllyPainBuildWhenOffline = false;
|
||||||
public static boolean territoryAllyDenyUseage = true;
|
public static boolean territoryAllyDenyUseage = true;
|
||||||
public static boolean territoryAllyProtectMaterials = 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 territoryBlockCreepers = false;
|
||||||
public static boolean territoryBlockCreepersWhenOffline = false;
|
public static boolean territoryBlockCreepersWhenOffline = false;
|
||||||
public static boolean territoryBlockFireballs = false;
|
public static boolean territoryBlockFireballs = false;
|
||||||
@ -242,6 +249,7 @@ public class Conf {
|
|||||||
public static double econCostShow = 0.0;
|
public static double econCostShow = 0.0;
|
||||||
public static double econCostOpen = 0.0;
|
public static double econCostOpen = 0.0;
|
||||||
public static double econCostAlly = 0.0;
|
public static double econCostAlly = 0.0;
|
||||||
|
public static double econCostTruce = 0.0;
|
||||||
public static double econCostEnemy = 0.0;
|
public static double econCostEnemy = 0.0;
|
||||||
public static double econCostNeutral = 0.0;
|
public static double econCostNeutral = 0.0;
|
||||||
public static double econCostNoBoom = 0.0;
|
public static double econCostNoBoom = 0.0;
|
||||||
|
@ -42,6 +42,8 @@ public class CmdChat extends FCommand {
|
|||||||
modeTarget = ChatMode.ALLIANCE;
|
modeTarget = ChatMode.ALLIANCE;
|
||||||
} else if (modeString.startsWith("f")) {
|
} else if (modeString.startsWith("f")) {
|
||||||
modeTarget = ChatMode.FACTION;
|
modeTarget = ChatMode.FACTION;
|
||||||
|
} else if (modeString.startsWith("t")) {
|
||||||
|
modeTarget = ChatMode.TRUCE;
|
||||||
} else {
|
} else {
|
||||||
msg(TL.COMMAND_CHAT_INVALIDMODE);
|
msg(TL.COMMAND_CHAT_INVALIDMODE);
|
||||||
return;
|
return;
|
||||||
@ -54,6 +56,8 @@ public class CmdChat extends FCommand {
|
|||||||
msg(TL.COMMAND_CHAT_MODE_PUBLIC);
|
msg(TL.COMMAND_CHAT_MODE_PUBLIC);
|
||||||
} else if (fme.getChatMode() == ChatMode.ALLIANCE) {
|
} else if (fme.getChatMode() == ChatMode.ALLIANCE) {
|
||||||
msg(TL.COMMAND_CHAT_MODE_ALLIANCE);
|
msg(TL.COMMAND_CHAT_MODE_ALLIANCE);
|
||||||
|
} else if (fme.getChatMode() == ChatMode.TRUCE) {
|
||||||
|
msg(TL.COMMAND_CHAT_MODE_TRUCE);
|
||||||
} else {
|
} else {
|
||||||
msg(TL.COMMAND_CHAT_MODE_FACTION);
|
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());
|
them.msg(TL.COMMAND_RELATIONS_MUTUAL, currentRelationColor + targetRelation.getTranslation(), currentRelationColor + myFaction.getTag());
|
||||||
myFaction.msg(TL.COMMAND_RELATIONS_MUTUAL, currentRelationColor + targetRelation.getTranslation(), currentRelationColor + them.getTag());
|
myFaction.msg(TL.COMMAND_RELATIONS_MUTUAL, currentRelationColor + targetRelation.getTranslation(), currentRelationColor + them.getTag());
|
||||||
}
|
} else {
|
||||||
// inform the other faction of your request
|
// inform the other faction of your request
|
||||||
else {
|
|
||||||
|
|
||||||
them.msg(TL.COMMAND_RELATIONS_PROPOSAL_1, currentRelationColor + myFaction.getTag(), targetRelation.getColor() + targetRelation.getTranslation());
|
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());
|
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);
|
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));
|
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);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -398,7 +398,7 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// You may use any block unless it is another faction's territory...
|
// 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) {
|
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));
|
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;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
|
|
||||||
public enum ChatMode {
|
public enum ChatMode {
|
||||||
FACTION(2, TL.CHAT_FACTION),
|
FACTION(3, TL.CHAT_FACTION),
|
||||||
ALLIANCE(1, TL.CHAT_ALLIANCE),
|
ALLIANCE(2, TL.CHAT_ALLIANCE),
|
||||||
|
TRUCE(1, TL.CHAT_TRUCE),
|
||||||
PUBLIC(0, TL.CHAT_PUBLIC);
|
PUBLIC(0, TL.CHAT_PUBLIC);
|
||||||
|
|
||||||
public final int value;
|
public final int value;
|
||||||
|
@ -6,8 +6,9 @@ import org.bukkit.ChatColor;
|
|||||||
|
|
||||||
|
|
||||||
public enum Relation {
|
public enum Relation {
|
||||||
MEMBER(3, "member"),
|
MEMBER(4, "member"),
|
||||||
ALLY(2, "ally"),
|
ALLY(3, "ally"),
|
||||||
|
TRUCE(2, "truce"),
|
||||||
NEUTRAL(1, "neutral"),
|
NEUTRAL(1, "neutral"),
|
||||||
ENEMY(0, "enemy");
|
ENEMY(0, "enemy");
|
||||||
|
|
||||||
@ -27,13 +28,15 @@ public enum Relation {
|
|||||||
public static Relation fromString(String s) {
|
public static Relation fromString(String s) {
|
||||||
// Because Java 6 doesn't allow String switches :(
|
// Because Java 6 doesn't allow String switches :(
|
||||||
if (s.equalsIgnoreCase("member")) {
|
if (s.equalsIgnoreCase("member")) {
|
||||||
return Relation.MEMBER;
|
return MEMBER;
|
||||||
} else if (s.equalsIgnoreCase("ally")) {
|
} else if (s.equalsIgnoreCase("ally")) {
|
||||||
return Relation.ALLY;
|
return ALLY;
|
||||||
|
} else if(s.equalsIgnoreCase("truce")) {
|
||||||
|
return TRUCE;
|
||||||
} else if (s.equalsIgnoreCase("enemy")) {
|
} else if (s.equalsIgnoreCase("enemy")) {
|
||||||
return Relation.ENEMY;
|
return ENEMY;
|
||||||
} else {
|
} 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;
|
return this == ALLY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isTruce() {
|
||||||
|
return this == TRUCE;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isNeutral() {
|
public boolean isNeutral() {
|
||||||
return this == NEUTRAL;
|
return this == NEUTRAL;
|
||||||
}
|
}
|
||||||
@ -77,6 +84,8 @@ public enum Relation {
|
|||||||
return Conf.colorAlly;
|
return Conf.colorAlly;
|
||||||
} else if (this == NEUTRAL) {
|
} else if (this == NEUTRAL) {
|
||||||
return Conf.colorNeutral;
|
return Conf.colorNeutral;
|
||||||
|
} else if (this == TRUCE) {
|
||||||
|
return Conf.colorTruce;
|
||||||
} else {
|
} else {
|
||||||
return Conf.colorEnemy;
|
return Conf.colorEnemy;
|
||||||
}
|
}
|
||||||
@ -93,6 +102,8 @@ public enum Relation {
|
|||||||
return Conf.territoryEnemyDenyBuild;
|
return Conf.territoryEnemyDenyBuild;
|
||||||
} else if (isAlly()) {
|
} else if (isAlly()) {
|
||||||
return Conf.territoryAllyDenyBuild;
|
return Conf.territoryAllyDenyBuild;
|
||||||
|
} else if (isTruce()) {
|
||||||
|
return Conf.territoryTruceDenyBuild;
|
||||||
} else {
|
} else {
|
||||||
return Conf.territoryDenyBuild;
|
return Conf.territoryDenyBuild;
|
||||||
}
|
}
|
||||||
@ -101,6 +112,8 @@ public enum Relation {
|
|||||||
return Conf.territoryEnemyDenyBuildWhenOffline;
|
return Conf.territoryEnemyDenyBuildWhenOffline;
|
||||||
} else if (isAlly()) {
|
} else if (isAlly()) {
|
||||||
return Conf.territoryAllyDenyBuildWhenOffline;
|
return Conf.territoryAllyDenyBuildWhenOffline;
|
||||||
|
} else if (isTruce()) {
|
||||||
|
return Conf.territoryTruceDenyBuildWhenOffline;
|
||||||
} else {
|
} else {
|
||||||
return Conf.territoryDenyBuildWhenOffline;
|
return Conf.territoryDenyBuildWhenOffline;
|
||||||
}
|
}
|
||||||
@ -118,6 +131,8 @@ public enum Relation {
|
|||||||
return Conf.territoryEnemyPainBuild;
|
return Conf.territoryEnemyPainBuild;
|
||||||
} else if (isAlly()) {
|
} else if (isAlly()) {
|
||||||
return Conf.territoryAllyPainBuild;
|
return Conf.territoryAllyPainBuild;
|
||||||
|
} else if (isTruce()) {
|
||||||
|
return Conf.territoryTrucePainBuild;
|
||||||
} else {
|
} else {
|
||||||
return Conf.territoryPainBuild;
|
return Conf.territoryPainBuild;
|
||||||
}
|
}
|
||||||
@ -126,6 +141,8 @@ public enum Relation {
|
|||||||
return Conf.territoryEnemyPainBuildWhenOffline;
|
return Conf.territoryEnemyPainBuildWhenOffline;
|
||||||
} else if (isAlly()) {
|
} else if (isAlly()) {
|
||||||
return Conf.territoryAllyPainBuildWhenOffline;
|
return Conf.territoryAllyPainBuildWhenOffline;
|
||||||
|
} else if (isTruce()) {
|
||||||
|
return Conf.territoryTrucePainBuildWhenOffline;
|
||||||
} else {
|
} else {
|
||||||
return Conf.territoryPainBuildWhenOffline;
|
return Conf.territoryPainBuildWhenOffline;
|
||||||
}
|
}
|
||||||
@ -140,6 +157,8 @@ public enum Relation {
|
|||||||
return Conf.territoryEnemyDenyUseage;
|
return Conf.territoryEnemyDenyUseage;
|
||||||
} else if (isAlly()) {
|
} else if (isAlly()) {
|
||||||
return Conf.territoryAllyDenyUseage;
|
return Conf.territoryAllyDenyUseage;
|
||||||
|
} else if (isTruce()) {
|
||||||
|
return Conf.territoryTruceDenyUseage;
|
||||||
} else {
|
} else {
|
||||||
return Conf.territoryDenyUseage;
|
return Conf.territoryDenyUseage;
|
||||||
}
|
}
|
||||||
@ -150,6 +169,8 @@ public enum Relation {
|
|||||||
return Conf.econCostEnemy;
|
return Conf.econCostEnemy;
|
||||||
} else if (isAlly()) {
|
} else if (isAlly()) {
|
||||||
return Conf.econCostAlly;
|
return Conf.econCostAlly;
|
||||||
|
} else if (isTruce()) {
|
||||||
|
return Conf.econCostTruce;
|
||||||
} else {
|
} else {
|
||||||
return Conf.econCostNeutral;
|
return Conf.econCostNeutral;
|
||||||
}
|
}
|
||||||
|
@ -85,6 +85,7 @@ public enum TL {
|
|||||||
|
|
||||||
COMMAND_CHAT_MODE_PUBLIC("<i>Public chat mode."),
|
COMMAND_CHAT_MODE_PUBLIC("<i>Public chat mode."),
|
||||||
COMMAND_CHAT_MODE_ALLIANCE("<i>Alliance only 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_CHAT_MODE_FACTION("<i>Faction only chat mode."),
|
||||||
|
|
||||||
COMMAND_CHATSPY_ENABLE("<i>You have enabled chat spying mode."),
|
COMMAND_CHATSPY_ENABLE("<i>You have enabled chat spying mode."),
|
||||||
@ -564,6 +565,7 @@ public enum TL {
|
|||||||
*/
|
*/
|
||||||
CHAT_FACTION("faction chat"),
|
CHAT_FACTION("faction chat"),
|
||||||
CHAT_ALLIANCE("alliance chat"),
|
CHAT_ALLIANCE("alliance chat"),
|
||||||
|
CHAT_TRUCE("truce chat"),
|
||||||
CHAT_PUBLIC("public chat"),
|
CHAT_PUBLIC("public chat"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -571,6 +573,7 @@ public enum TL {
|
|||||||
*/
|
*/
|
||||||
RELATION_MEMBER("member"),
|
RELATION_MEMBER("member"),
|
||||||
RELATION_ALLY("ally"),
|
RELATION_ALLY("ally"),
|
||||||
|
RELATION_TRUCE("truce"),
|
||||||
RELATION_NEUTRAL("neutral"),
|
RELATION_NEUTRAL("neutral"),
|
||||||
RELATION_ENEMY("enemy"),
|
RELATION_ENEMY("enemy"),
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user