Reformat.
This commit is contained in:
parent
5f6e83872d
commit
f37e38b011
@ -84,7 +84,7 @@ public class CmdAdmin extends FCommand {
|
||||
}
|
||||
}
|
||||
|
||||
public TL getUsageTranslation(){
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_ADMIN_DESCRIPTION;
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,6 @@ package com.massivecraft.factions.cmd;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -42,7 +42,7 @@ public class CmdPeaceful extends FCommand {
|
||||
|
||||
// Inform all players
|
||||
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
|
||||
String blame=(fme == null ? TL.GENERIC_SERVERADMIN.toString() : fme.describeTo(fplayer, true));
|
||||
String blame = (fme == null ? TL.GENERIC_SERVERADMIN.toString() : fme.describeTo(fplayer, true));
|
||||
if (fplayer.getFaction() == faction) {
|
||||
fplayer.msg(TL.COMMAND_PEACEFUL_YOURS, blame, change);
|
||||
} else {
|
||||
|
@ -46,7 +46,7 @@ public class CmdPermanent extends FCommand {
|
||||
|
||||
// Inform all players
|
||||
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
|
||||
String blame=(fme == null ? TL.GENERIC_SERVERADMIN.toString() : fme.describeTo(fplayer, true));
|
||||
String blame = (fme == null ? TL.GENERIC_SERVERADMIN.toString() : fme.describeTo(fplayer, true));
|
||||
if (fplayer.getFaction() == faction) {
|
||||
fplayer.msg(TL.COMMAND_PERMANENT_YOURS, blame, change);
|
||||
} else {
|
||||
|
@ -43,7 +43,7 @@ public class CmdPermanentPower extends FCommand {
|
||||
|
||||
// Inform all other players
|
||||
for (FPlayer fplayer : targetFaction.getFPlayersWhereOnline(true)) {
|
||||
if(fplayer == fme) {
|
||||
if (fplayer == fme) {
|
||||
continue;
|
||||
}
|
||||
String blame = (fme == null ? TL.GENERIC_SERVERADMIN.toString() : fme.describeTo(fplayer, true));
|
||||
|
@ -61,7 +61,7 @@ public class CmdPowerBoost extends FCommand {
|
||||
target = TL.COMMAND_POWERBOOST_FACTION.format(targetFaction.getTag());
|
||||
}
|
||||
|
||||
int roundedPower = (int)Math.round(targetPower);
|
||||
int roundedPower = (int) Math.round(targetPower);
|
||||
msg(TL.COMMAND_POWERBOOST_BOOST, target, roundedPower);
|
||||
if (!senderIsConsole) {
|
||||
P.p.log(TL.COMMAND_POWERBOOST_BOOSTLOG.toString(), fme.getName(), target, roundedPower);
|
||||
|
@ -39,7 +39,7 @@ public class CmdSB extends FCommand {
|
||||
public void perform() {
|
||||
boolean toggle = toggle(me.getPlayer().getUniqueId());
|
||||
FScoreboard board = FScoreboard.get(fme);
|
||||
if(board == null) {
|
||||
if (board == null) {
|
||||
me.sendMessage(TL.COMMAND_TOGGLESB_DISABLED.toString());
|
||||
} else {
|
||||
me.sendMessage(TL.TOGGLE_SB.toString().replace("{value}", String.valueOf(toggle)));
|
||||
|
@ -4,7 +4,6 @@ import com.massivecraft.factions.FLocation;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.util.VisualizeUtil;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
|
@ -119,7 +119,9 @@ public class FactionsEntityListener implements Listener {
|
||||
}
|
||||
|
||||
public void cancelFStuckTeleport(Player player) {
|
||||
if (player == null) return;
|
||||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
UUID uuid = player.getUniqueId();
|
||||
if (P.p.getStuckMap().containsKey(uuid)) {
|
||||
FPlayers.getInstance().getByPlayer(player).msg(TL.COMMAND_STUCK_CANCELLED);
|
||||
|
@ -1,8 +1,7 @@
|
||||
package com.massivecraft.factions.util;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@ -30,11 +29,19 @@ public class AsciiCompass {
|
||||
return String.valueOf(this.asciiChar);
|
||||
}
|
||||
|
||||
public String getTranslation(){
|
||||
if(this==N) return TL.COMPASS_SHORT_NORTH.toString();
|
||||
if(this==E) return TL.COMPASS_SHORT_EAST.toString();
|
||||
if(this==S) return TL.COMPASS_SHORT_SOUTH.toString();
|
||||
if(this==W) return TL.COMPASS_SHORT_WEST.toString();
|
||||
public String getTranslation() {
|
||||
if (this == N) {
|
||||
return TL.COMPASS_SHORT_NORTH.toString();
|
||||
}
|
||||
if (this == E) {
|
||||
return TL.COMPASS_SHORT_EAST.toString();
|
||||
}
|
||||
if (this == S) {
|
||||
return TL.COMPASS_SHORT_SOUTH.toString();
|
||||
}
|
||||
if (this == W) {
|
||||
return TL.COMPASS_SHORT_WEST.toString();
|
||||
}
|
||||
return toString();
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ public class AutoLeaveProcessTask extends BukkitRunnable {
|
||||
|
||||
fplayer.leave(false);
|
||||
iterator.remove(); // go ahead and remove this list's link to the FPlayer object
|
||||
if(Conf.autoLeaveDeleteFPlayerData) {
|
||||
if (Conf.autoLeaveDeleteFPlayerData) {
|
||||
fplayer.remove();
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Creature;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
@ -7,7 +7,6 @@ import com.massivecraft.factions.iface.RelationParticipator;
|
||||
import com.massivecraft.factions.struct.Relation;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import com.massivecraft.factions.zcore.util.TextUtil;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
public class RelationUtil {
|
||||
|
@ -7,14 +7,13 @@ import com.massivecraft.factions.zcore.util.TL;
|
||||
public class WarmUpUtil {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param player The player to notify.
|
||||
* @param player The player to notify.
|
||||
* @param translationKey The translation key used for notifying.
|
||||
* @param action The action, inserted into the notification message.
|
||||
* @param runnable The task to run after the delay. If the delay is 0, the task is instantly ran.
|
||||
* @param delay The time used, in seconds, for the delay.
|
||||
*
|
||||
* note: for translations: %s = action, %d = delay
|
||||
* @param action The action, inserted into the notification message.
|
||||
* @param runnable The task to run after the delay. If the delay is 0, the task is instantly ran.
|
||||
* @param delay The time used, in seconds, for the delay.
|
||||
* <p/>
|
||||
* note: for translations: %s = action, %d = delay
|
||||
*/
|
||||
public static void process(FPlayer player, TL translationKey, String action, Runnable runnable, long delay) {
|
||||
if (delay > 0) {
|
||||
|
@ -708,10 +708,10 @@ public abstract class MemoryFPlayer implements FPlayer {
|
||||
} else if (factionBuffer > 0 && Board.getInstance().hasFactionWithin(flocation, myFaction, factionBuffer)) {
|
||||
error = P.p.txt.parse(TL.CLAIM_TOOCLOSETOOTHERFACTION.format(factionBuffer));
|
||||
} else if (flocation.isOutsideWorldBorder(worldBuffer)) {
|
||||
if(worldBuffer > 0) {
|
||||
error = P.p.txt.parse(TL.CLAIM_OUTSIDEBORDERBUFFER.format(worldBuffer));
|
||||
if (worldBuffer > 0) {
|
||||
error = P.p.txt.parse(TL.CLAIM_OUTSIDEBORDERBUFFER.format(worldBuffer));
|
||||
} else {
|
||||
error = P.p.txt.parse(TL.CLAIM_OUTSIDEWORLDBORDER.toString());
|
||||
error = P.p.txt.parse(TL.CLAIM_OUTSIDEWORLDBORDER.toString());
|
||||
}
|
||||
} else if (currentFaction.isNormal()) {
|
||||
if (myFaction.isPeaceful()) {
|
||||
|
@ -210,7 +210,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
||||
}
|
||||
|
||||
public long getFoundedDate() {
|
||||
if(this.foundedDate == 0) {
|
||||
if (this.foundedDate == 0) {
|
||||
setFoundedDate(System.currentTimeMillis());
|
||||
}
|
||||
return this.foundedDate;
|
||||
|
@ -12,9 +12,8 @@ import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Link between config and in-game messages<br>
|
||||
* Changes based on faction / player<br>
|
||||
* Interfaces the config lists with {} variables to plugin
|
||||
* Link between config and in-game messages<br> Changes based on faction / player<br> Interfaces the config lists with
|
||||
* {} variables to plugin
|
||||
*/
|
||||
public enum TagReplacer {
|
||||
|
||||
@ -123,6 +122,7 @@ public enum TagReplacer {
|
||||
*
|
||||
* @param fac Target faction
|
||||
* @param fp Target player (can be null)
|
||||
*
|
||||
* @return the value for this enum!
|
||||
*/
|
||||
protected String getValue(Faction fac, FPlayer fp) {
|
||||
@ -211,6 +211,7 @@ public enum TagReplacer {
|
||||
* Returns a list of all the variables we can use for this type<br>
|
||||
*
|
||||
* @param type the type we want
|
||||
*
|
||||
* @return a list of all the variables with this type
|
||||
*/
|
||||
protected static List<TagReplacer> getByType(TagType type) {
|
||||
@ -230,6 +231,7 @@ public enum TagReplacer {
|
||||
/**
|
||||
* @param original raw line with variables
|
||||
* @param value what to replace var in raw line with
|
||||
*
|
||||
* @return the string with the new value
|
||||
*/
|
||||
public String replace(String original, String value) {
|
||||
@ -238,6 +240,7 @@ public enum TagReplacer {
|
||||
|
||||
/**
|
||||
* @param toSearch raw line with variables
|
||||
*
|
||||
* @return if the raw line contains this enums variable
|
||||
*/
|
||||
public boolean contains(String toSearch) {
|
||||
|
@ -5,7 +5,6 @@ import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.struct.Relation;
|
||||
import com.massivecraft.factions.util.MiscUtil;
|
||||
import mkremins.fanciful.FancyMessage;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -24,6 +23,7 @@ public class TagUtil {
|
||||
*
|
||||
* @param faction for faction
|
||||
* @param line raw line from config with variables to replace for
|
||||
*
|
||||
* @return clean line
|
||||
*/
|
||||
public static String parsePlain(Faction faction, String line) {
|
||||
@ -40,13 +40,14 @@ public class TagUtil {
|
||||
*
|
||||
* @param fplayer for player
|
||||
* @param line raw line from config with variables to replace for
|
||||
*
|
||||
* @return clean line
|
||||
*/
|
||||
public static String parsePlain(FPlayer fplayer, String line) {
|
||||
for (TagReplacer tagReplacer : TagReplacer.getByType(TagType.PLAYER)) {
|
||||
if (tagReplacer.contains(line)) {
|
||||
String rep = tagReplacer.getValue(fplayer.getFaction(), fplayer);
|
||||
if(rep == null) {
|
||||
if (rep == null) {
|
||||
rep = ""; // this should work, but it's not a good way to handle whatever is going wrong
|
||||
}
|
||||
line = tagReplacer.replace(line, rep);
|
||||
@ -60,7 +61,8 @@ public class TagUtil {
|
||||
*
|
||||
* @param faction for faction
|
||||
* @param fplayer from player
|
||||
* @param line raw line from config with variables to replace for
|
||||
* @param line raw line from config with variables to replace for
|
||||
*
|
||||
* @return clean line
|
||||
*/
|
||||
public static String parsePlain(Faction faction, FPlayer fplayer, String line) {
|
||||
@ -78,6 +80,7 @@ public class TagUtil {
|
||||
* @param faction for faction (viewers faction)
|
||||
* @param fme for player (viewer)
|
||||
* @param line fancy message prefix
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static List<FancyMessage> parseFancy(Faction faction, FPlayer fme, String line) {
|
||||
@ -94,6 +97,7 @@ public class TagUtil {
|
||||
* Checks if a line has fancy variables
|
||||
*
|
||||
* @param line raw line from config with variables
|
||||
*
|
||||
* @return if the line has fancy variables
|
||||
*/
|
||||
public static boolean hasFancy(String line) {
|
||||
@ -111,6 +115,7 @@ public class TagUtil {
|
||||
* @param target Faction to get relate from
|
||||
* @param fme Player to relate to
|
||||
* @param prefix First part of the fancy message
|
||||
*
|
||||
* @return list of fancy messages to send
|
||||
*/
|
||||
protected static List<FancyMessage> getFancy(Faction target, FPlayer fme, TagReplacer type, String prefix) {
|
||||
@ -193,11 +198,10 @@ public class TagUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses tooltip variables from config
|
||||
* <br>
|
||||
* Supports variables for factions only (type 2)
|
||||
* Parses tooltip variables from config <br> Supports variables for factions only (type 2)
|
||||
*
|
||||
* @param faction faction to tooltip for
|
||||
*
|
||||
* @return list of tooltips for a fancy message
|
||||
*/
|
||||
private static List<String> tipFaction(Faction faction) {
|
||||
@ -209,11 +213,10 @@ public class TagUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses tooltip variables from config
|
||||
* <br>
|
||||
* Supports variables for players and factions (types 1 and 2)
|
||||
* Parses tooltip variables from config <br> Supports variables for players and factions (types 1 and 2)
|
||||
*
|
||||
* @param fplayer player to tooltip for
|
||||
*
|
||||
* @return list of tooltips for a fancy message
|
||||
*/
|
||||
private static List<String> tipPlayer(FPlayer fplayer) {
|
||||
|
@ -68,22 +68,22 @@ public class TextUtil {
|
||||
ChatColor color = null;
|
||||
char[] chars = first.toCharArray();
|
||||
|
||||
for(int i = 0; i < chars.length; i++){
|
||||
for (int i = 0; i < chars.length; i++) {
|
||||
if (chars[i] == '§') {
|
||||
if(color != null) {
|
||||
if (color != null) {
|
||||
message.then(text).color(color);
|
||||
text = "";
|
||||
color = ChatColor.getByChar(chars[i+1]);
|
||||
color = ChatColor.getByChar(chars[i + 1]);
|
||||
} else {
|
||||
color = ChatColor.getByChar(chars[i+1]);
|
||||
color = ChatColor.getByChar(chars[i + 1]);
|
||||
}
|
||||
i++; // skip color char
|
||||
} else {
|
||||
text += chars[i];
|
||||
}
|
||||
}
|
||||
if(text.length() > 0) {
|
||||
if(color != null) {
|
||||
if (text.length() > 0) {
|
||||
if (color != null) {
|
||||
message.then(text).color(color);
|
||||
} else {
|
||||
message.text(text);
|
||||
|
Loading…
Reference in New Issue
Block a user