Even moar TL

This commit is contained in:
korikisulda 2015-01-23 19:25:14 +00:00 committed by eueln
parent 0c2253ef73
commit 5ea8392fd5
3 changed files with 64 additions and 29 deletions

View File

@ -4,6 +4,8 @@ import com.massivecraft.factions.*;
import com.massivecraft.factions.event.PowerLossEvent; import com.massivecraft.factions.event.PowerLossEvent;
import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.struct.Relation;
import com.massivecraft.factions.util.MiscUtil; import com.massivecraft.factions.util.MiscUtil;
import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.TravelAgent; import org.bukkit.TravelAgent;
@ -50,23 +52,23 @@ public class FactionsEntityListener implements Listener {
if (faction.isWarZone()) { if (faction.isWarZone()) {
// war zones always override worldsNoPowerLoss either way, thus this layout // war zones always override worldsNoPowerLoss either way, thus this layout
if (!Conf.warZonePowerLoss) { if (!Conf.warZonePowerLoss) {
powerLossEvent.setMessage("<i>You didn't lose any power since you were in a war zone."); powerLossEvent.setMessage(TL.PLAYER_POWER_NOLOSS_WARZONE.toString());
powerLossEvent.setCancelled(true); powerLossEvent.setCancelled(true);
} }
if (Conf.worldsNoPowerLoss.contains(player.getWorld().getName())) { if (Conf.worldsNoPowerLoss.contains(player.getWorld().getName())) {
powerLossEvent.setMessage("<b>The world you are in has power loss normally disabled, but you still lost power since you were in a war zone.\n<i>Your power is now <h>%d / %d"); powerLossEvent.setMessage(TL.PLAYER_POWER_LOSS_WARZONE.toString());
} }
} else if (faction.isNone() && !Conf.wildernessPowerLoss && !Conf.worldsNoWildernessProtection.contains(player.getWorld().getName())) { } else if (faction.isNone() && !Conf.wildernessPowerLoss && !Conf.worldsNoWildernessProtection.contains(player.getWorld().getName())) {
powerLossEvent.setMessage("<i>You didn't lose any power since you were in the wilderness."); powerLossEvent.setMessage(TL.PLAYER_POWER_NOLOSS_WILDERNESS.toString());
powerLossEvent.setCancelled(true); powerLossEvent.setCancelled(true);
} else if (Conf.worldsNoPowerLoss.contains(player.getWorld().getName())) { } else if (Conf.worldsNoPowerLoss.contains(player.getWorld().getName())) {
powerLossEvent.setMessage("<i>You didn't lose any power due to the world you died in."); powerLossEvent.setMessage(TL.PLAYER_POWER_NOLOSS_WORLD.toString());
powerLossEvent.setCancelled(true); powerLossEvent.setCancelled(true);
} else if (Conf.peacefulMembersDisablePowerLoss && fplayer.hasFaction() && fplayer.getFaction().isPeaceful()) { } else if (Conf.peacefulMembersDisablePowerLoss && fplayer.hasFaction() && fplayer.getFaction().isPeaceful()) {
powerLossEvent.setMessage("<i>You didn't lose any power since you are in a peaceful faction."); powerLossEvent.setMessage(TL.PLAYER_POWER_NOLOSS_PEACEFUL.toString());
powerLossEvent.setCancelled(true); powerLossEvent.setCancelled(true);
} else { } else {
powerLossEvent.setMessage("<i>Your power is now <h>%d / %d"); powerLossEvent.setMessage(TL.PLAYER_POWER_NOW.toString());
} }
// call Event // call Event
@ -304,7 +306,7 @@ public class FactionsEntityListener implements Listener {
if (attacker.hasLoginPvpDisabled()) { if (attacker.hasLoginPvpDisabled()) {
if (notify) { if (notify) {
attacker.msg("<i>You can't hurt other players for " + Conf.noPVPDamageToOthersForXSecondsAfterLogin + " seconds after logging in."); attacker.msg(TL.PLAYER_PVP_LOGIN, Conf.noPVPDamageToOthersForXSecondsAfterLogin);
} }
return false; return false;
} }
@ -332,7 +334,7 @@ public class FactionsEntityListener implements Listener {
if (attackFaction.isNone() && Conf.disablePVPForFactionlessPlayers) { if (attackFaction.isNone() && Conf.disablePVPForFactionlessPlayers) {
if (notify) { if (notify) {
attacker.msg("<i>You can't hurt other players until you join a faction."); attacker.msg(TL.PLAYER_PVP_REQUIREFACTION);
} }
return false; return false;
} else if (defendFaction.isNone()) { } else if (defendFaction.isNone()) {
@ -341,7 +343,7 @@ public class FactionsEntityListener implements Listener {
return true; return true;
} else if (Conf.disablePVPForFactionlessPlayers) { } else if (Conf.disablePVPForFactionlessPlayers) {
if (notify) { if (notify) {
attacker.msg("<i>You can't hurt players who are not currently in a faction."); attacker.msg(TL.PLAYER_PVP_FACTIONLESS);
} }
return false; return false;
} }
@ -349,12 +351,12 @@ public class FactionsEntityListener implements Listener {
if (defendFaction.isPeaceful()) { if (defendFaction.isPeaceful()) {
if (notify) { if (notify) {
attacker.msg("<i>You can't hurt players who are in a peaceful faction."); attacker.msg(TL.PLAYER_PVP_PEACEFUL);
} }
return false; return false;
} else if (attackFaction.isPeaceful()) { } else if (attackFaction.isPeaceful()) {
if (notify) { if (notify) {
attacker.msg("<i>You can't hurt players while you are in a peaceful faction."); attacker.msg(TL.PLAYER_PVP_PEACEFUL);
} }
return false; return false;
} }
@ -364,7 +366,7 @@ public class FactionsEntityListener implements Listener {
// You can not hurt neutral factions // You can not hurt neutral factions
if (Conf.disablePVPBetweenNeutralFactions && relation.isNeutral()) { if (Conf.disablePVPBetweenNeutralFactions && relation.isNeutral()) {
if (notify) { if (notify) {
attacker.msg("<i>You can't hurt neutral factions. Declare them as an enemy."); attacker.msg(TL.PLAYER_PVP_NEUTRAL);
} }
return false; return false;
} }
@ -377,7 +379,7 @@ public class FactionsEntityListener implements Listener {
// You can never hurt faction members or allies // You can never hurt faction members or allies
if (relation.isMember() || relation.isAlly()) { if (relation.isMember() || relation.isAlly()) {
if (notify) { if (notify) {
attacker.msg("<i>You can't hurt %s<i>.", defender.describeTo(attacker)); attacker.msg(TL.PLAYER_PVP_CANTHURT, defender.describeTo(attacker));
} }
return false; return false;
} }
@ -387,8 +389,8 @@ public class FactionsEntityListener implements Listener {
// You can not hurt neutrals in their own territory. // You can not hurt neutrals in their own territory.
if (ownTerritory && relation.isNeutral()) { if (ownTerritory && relation.isNeutral()) {
if (notify) { if (notify) {
attacker.msg("<i>You can't hurt %s<i> in their own territory unless you declare them as an enemy.", defender.describeTo(attacker)); attacker.msg(TL.PLAYER_PVP_NEUTRALFAIL, defender.describeTo(attacker));
defender.msg("%s<i> tried to hurt you.", attacker.describeTo(defender, true)); defender.msg(TL.PLAYER_PVP_TRIED, attacker.describeTo(defender, true));
} }
return false; return false;
} }

View File

@ -187,7 +187,7 @@ public class FactionsPlayerListener implements Listener {
} else { } else {
if (!Board.getInstance().getFactionAt(to).isSafeZone()) { if (!Board.getInstance().getFactionAt(to).isSafeZone()) {
Board.getInstance().setFactionAt(Factions.getInstance().getSafeZone(), to); Board.getInstance().setFactionAt(Factions.getInstance().getSafeZone(), to);
me.msg("<i>This land is now a safe zone."); me.msg(TL.PLAYER_SAFEAUTO);
} }
} }
} else if (me.isAutoWarClaimEnabled()) { } else if (me.isAutoWarClaimEnabled()) {
@ -196,7 +196,7 @@ public class FactionsPlayerListener implements Listener {
} else { } else {
if (!Board.getInstance().getFactionAt(to).isWarZone()) { if (!Board.getInstance().getFactionAt(to).isWarZone()) {
Board.getInstance().setFactionAt(Factions.getInstance().getWarZone(), to); Board.getInstance().setFactionAt(Factions.getInstance().getWarZone(), to);
me.msg("<i>This land is now a war zone."); me.msg(TL.PLAYER_WARAUTO);
} }
} }
} }
@ -231,7 +231,7 @@ public class FactionsPlayerListener implements Listener {
int count = attempt.increment(); int count = attempt.increment();
if (count >= 10) { if (count >= 10) {
FPlayer me = FPlayers.getInstance().getByPlayer(player); FPlayer me = FPlayers.getInstance().getByPlayer(player);
me.msg("<b>Ouch, that is starting to hurt. You should give it a rest."); me.msg(TL.PLAYER_OUCH);
player.damage(NumberConversions.floor((double) count / 10)); player.damage(NumberConversions.floor((double) count / 10));
} }
} }
@ -300,7 +300,7 @@ public class FactionsPlayerListener implements Listener {
} }
if (!justCheck) { if (!justCheck) {
me.msg("<b>You can't use <h>%s<b> in the wilderness.", TextUtil.getMaterialName(material)); me.msg(TL.PLAYER_USE_WILDERNESS, TextUtil.getMaterialName(material));
} }
return false; return false;
@ -310,7 +310,7 @@ public class FactionsPlayerListener implements Listener {
} }
if (!justCheck) { if (!justCheck) {
me.msg("<b>You can't use <h>%s<b> in a safe zone.", TextUtil.getMaterialName(material)); me.msg(TL.PLAYER_USE_SAFEZONE, TextUtil.getMaterialName(material));
} }
return false; return false;
@ -320,7 +320,7 @@ public class FactionsPlayerListener implements Listener {
} }
if (!justCheck) { if (!justCheck) {
me.msg("<b>You can't use <h>%s<b> in a war zone.", TextUtil.getMaterialName(material)); me.msg(TL.PLAYER_USE_WARZONE, TextUtil.getMaterialName(material));
} }
return false; return false;
@ -332,7 +332,7 @@ public class FactionsPlayerListener implements Listener {
// Cancel if we are not in our own territory // Cancel if we are not in our own territory
if (rel.confDenyUseage()) { if (rel.confDenyUseage()) {
if (!justCheck) { if (!justCheck) {
me.msg("<b>You can't use <h>%s<b> in the territory of <h>%s<b>.", TextUtil.getMaterialName(material), otherFaction.getTag(myFaction)); me.msg(TL.PLAYER_USE_TERRITORY, TextUtil.getMaterialName(material), otherFaction.getTag(myFaction));
} }
return false; return false;
@ -341,7 +341,7 @@ public class FactionsPlayerListener implements Listener {
// Also cancel if player doesn't have ownership rights for this claim // Also cancel if player doesn't have ownership rights for this claim
if (Conf.ownedAreasEnabled && Conf.ownedAreaDenyUseage && !otherFaction.playerHasOwnershipRights(me, loc)) { if (Conf.ownedAreasEnabled && Conf.ownedAreaDenyUseage && !otherFaction.playerHasOwnershipRights(me, loc)) {
if (!justCheck) { if (!justCheck) {
me.msg("<b>You can't use <h>%s<b> in this territory, it is owned by: %s<b>.", TextUtil.getMaterialName(material), otherFaction.getOwnerListString(loc)); me.msg(TL.PLAYER_USE_OWNED, TextUtil.getMaterialName(material), otherFaction.getOwnerListString(loc));
} }
return false; return false;
@ -400,7 +400,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) || (rel.isTruce() && Conf.territoryTruceProtectMaterials)) { 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(TL.PLAYER_USE_TERRITORY, (material == Material.SOIL ? "trample" : "use"), TextUtil.getMaterialName(material), otherFaction.getTag(myFaction));
} }
return false; return false;
@ -409,7 +409,7 @@ public class FactionsPlayerListener implements Listener {
// Also cancel if player doesn't have ownership rights for this claim // Also cancel if player doesn't have ownership rights for this claim
if (Conf.ownedAreasEnabled && Conf.ownedAreaProtectMaterials && !otherFaction.playerHasOwnershipRights(me, loc)) { if (Conf.ownedAreasEnabled && Conf.ownedAreaProtectMaterials && !otherFaction.playerHasOwnershipRights(me, loc)) {
if (!justCheck) { if (!justCheck) {
me.msg("<b>You can't use <h>%s<b> in this territory, it is owned by: %s<b>.", TextUtil.getMaterialName(material), otherFaction.getOwnerListString(loc)); me.msg(TL.PLAYER_USE_OWNED, TextUtil.getMaterialName(material), otherFaction.getOwnerListString(loc));
} }
return false; return false;
@ -487,7 +487,7 @@ public class FactionsPlayerListener implements Listener {
!Conf.permanentFactionMemberDenyCommands.isEmpty() && !Conf.permanentFactionMemberDenyCommands.isEmpty() &&
me.getFaction().isPermanent() && me.getFaction().isPermanent() &&
isCommandInList(fullCmd, shortCmd, Conf.permanentFactionMemberDenyCommands.iterator())) { isCommandInList(fullCmd, shortCmd, Conf.permanentFactionMemberDenyCommands.iterator())) {
me.msg("<b>You can't use the command \"" + fullCmd + "\" because you are in a permanent faction."); me.msg(TL.PLAYER_COMMAND_PERMANENT, fullCmd);
return true; return true;
} }
@ -501,17 +501,17 @@ public class FactionsPlayerListener implements Listener {
} }
if (rel.isNeutral() && !Conf.territoryNeutralDenyCommands.isEmpty() && !me.isAdminBypassing() && isCommandInList(fullCmd, shortCmd, Conf.territoryNeutralDenyCommands.iterator())) { if (rel.isNeutral() && !Conf.territoryNeutralDenyCommands.isEmpty() && !me.isAdminBypassing() && isCommandInList(fullCmd, shortCmd, Conf.territoryNeutralDenyCommands.iterator())) {
me.msg("<b>You can't use the command \"" + fullCmd + "\" in neutral territory."); me.msg(TL.PLAYER_COMMAND_NEUTRAL, fullCmd);
return true; return true;
} }
if (rel.isEnemy() && !Conf.territoryEnemyDenyCommands.isEmpty() && !me.isAdminBypassing() && isCommandInList(fullCmd, shortCmd, Conf.territoryEnemyDenyCommands.iterator())) { if (rel.isEnemy() && !Conf.territoryEnemyDenyCommands.isEmpty() && !me.isAdminBypassing() && isCommandInList(fullCmd, shortCmd, Conf.territoryEnemyDenyCommands.iterator())) {
me.msg("<b>You can't use the command \"" + fullCmd + "\" in enemy territory."); me.msg(TL.PLAYER_COMMAND_ENEMY, fullCmd);
return true; return true;
} }
if(Board.getInstance().getFactionAt(new FLocation(me)).isWarZone() && !Conf.warzoneDenyCommands.isEmpty() && !me.isAdminBypassing() && isCommandInList(fullCmd, shortCmd, Conf.warzoneDenyCommands.iterator())) { if(Board.getInstance().getFactionAt(new FLocation(me)).isWarZone() && !Conf.warzoneDenyCommands.isEmpty() && !me.isAdminBypassing() && isCommandInList(fullCmd, shortCmd, Conf.warzoneDenyCommands.iterator())) {
me.msg("<b>You can't use the command \"" + fullCmd + "\" in warzone."); me.msg(TL.PLAYER_COMMAND_WARZONE, fullCmd);
return true; return true;
} }

View File

@ -595,6 +595,39 @@ public enum TL {
ROLE_MODERATOR("moderator"), ROLE_MODERATOR("moderator"),
ROLE_NORMAL("normal member"), ROLE_NORMAL("normal member"),
/**
* In the player and entity listeners
*/
PLAYER_SAFEAUTO("<i>This land is now a safe zone."),
PLAYER_WARAUTO("<i>This land is now a war zone."),
PLAYER_OUCH("<b>Ouch, that is starting to hurt. You should give it a rest."),
PLAYER_USE_WILDERNESS("<b>You can't use <h>%s<b> in the wilderness."),
PLAYER_USE_SAFEZONE("<b>You can't use <h>%s<b> in a safe zone."),
PLAYER_USE_WARZONE("<b>You can't use <h>%s<b> in a war zone."),
PLAYER_USE_TERRITORY("<b>You can't use <h>%s<b> in the territory of <h>%s<b>."),
PLAYER_USE_OWNED("<b>You can't use <h>%s<b> in this territory, it is owned by: %s<b>."),
PLAYER_COMMAND_WARZONE("<b>You can't use the command '%s' in warzone."),
PLAYER_COMMAND_NEUTRAL("<b>You can't use the command '%s' in neutral territory."),
PLAYER_COMMAND_ENEMY("<b>You can't use the command '%s' in enemy territory."),
PLAYER_COMMAND_PERMANENT("<b>You can't use the command '%s' because you are in a permanent faction."),
PLAYER_POWER_NOLOSS_PEACEFUL("<i>You didn't lose any power since you are in a peaceful faction."),
PLAYER_POWER_NOLOSS_WORLD("<i>You didn't lose any power due to the world you died in."),
PLAYER_POWER_NOLOSS_WILDERNESS("<i>You didn't lose any power since you were in the wilderness."),
PLAYER_POWER_NOLOSS_WARZONE("<i>You didn't lose any power since you were in a war zone."),
PLAYER_POWER_LOSS_WARZONE("<b>The world you are in has power loss normally disabled, but you still lost power since you were in a war zone.\n<i>Your power is now <h>%d / %d"),
PLAYER_POWER_NOW("<i>Your power is now <h>%d / %d"),
PLAYER_PVP_LOGIN("<i>You can't hurt other players for %d seconds after logging in."),
PLAYER_PVP_REQUIREFACTION("<i>You can't hurt other players until you join a faction."),
PLAYER_PVP_FACTIONLESS("<i>You can't hurt players who are not currently in a faction."),
PLAYER_PVP_PEACEFUL("<i>Peaceful players cannot participate in combat."),
PLAYER_PVP_NEUTRAL("<i>You can't hurt neutral factions. Declare them as an enemy."),
PLAYER_PVP_CANTHURT("<i>You can't hurt %s<i>."),
PLAYER_PVP_NEUTRALFAIL("<i>You can't hurt %s<i> in their own territory unless you declare them as an enemy."),
PLAYER_PVP_TRIED("%s<i> tried to hurt you."),
/** /**
* Strings lying around in other bits of the plugins * Strings lying around in other bits of the plugins
*/ */