mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-28 03:34:43 +02:00
Clean up some of our messes.
This commit is contained in:
@ -15,10 +15,6 @@ public class LogFilter implements Filter {
|
||||
|
||||
@Override
|
||||
public boolean isLoggable(LogRecord record) {
|
||||
if (record.getMessage().contains("[Debug]") && !debug) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return !(record.getMessage().contains("[Debug]") && !debug);
|
||||
}
|
||||
}
|
||||
|
@ -96,9 +96,9 @@ public final class MobHealthbarUtils {
|
||||
double currentHealth = Math.max(entity.getHealth() - damage, 0);
|
||||
double healthPercentage = (currentHealth / maxHealth) * 100.0D;
|
||||
|
||||
int fullDisplay = 0;
|
||||
int fullDisplay;
|
||||
ChatColor color = ChatColor.BLACK;
|
||||
String symbol = "";
|
||||
String symbol;
|
||||
|
||||
switch (profile.getMobHealthbarType()) {
|
||||
case HEARTS:
|
||||
|
@ -12,7 +12,7 @@ import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.skills.PerksUtils;
|
||||
|
||||
public final class Motd {
|
||||
private static final String perkPrefix = LocaleLoader.getString("MOTD.PerksPrefix");
|
||||
public static final String PERK_PREFIX = LocaleLoader.getString("MOTD.PerksPrefix") + " ";
|
||||
private static final PluginDescriptionFile pluginDescription = mcMMO.p.getDescription();
|
||||
|
||||
private Motd() {}
|
||||
@ -101,7 +101,7 @@ public final class Motd {
|
||||
|
||||
if (cooldownReduction > 0.0) {
|
||||
DecimalFormat percent = new DecimalFormat("##0.00%");
|
||||
player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Perks.Cooldowns.Name"), LocaleLoader.getString("Perks.Cooldowns.Desc", percent.format(cooldownReduction))));
|
||||
player.sendMessage(PERK_PREFIX + LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Perks.Cooldowns.Name"), LocaleLoader.getString("Perks.Cooldowns.Desc", percent.format(cooldownReduction))));
|
||||
}
|
||||
}
|
||||
|
||||
@ -114,7 +114,7 @@ public final class Motd {
|
||||
int perkAmount = PerksUtils.handleActivationPerks(player, 0, 0);
|
||||
|
||||
if (perkAmount > 0) {
|
||||
player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Perks.ActivationTime.Name"), LocaleLoader.getString("Perks.ActivationTime.Desc", perkAmount)));
|
||||
player.sendMessage(PERK_PREFIX + LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Perks.ActivationTime.Name"), LocaleLoader.getString("Perks.ActivationTime.Desc", perkAmount)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -126,7 +126,7 @@ public final class Motd {
|
||||
public static void displayLuckyPerks(Player player) {
|
||||
for (SkillType skill : SkillType.values()) {
|
||||
if (Permissions.lucky(player, skill)) {
|
||||
player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Perks.Lucky.Name"), LocaleLoader.getString("Perks.Lucky.Desc.Login")));
|
||||
player.sendMessage(PERK_PREFIX + LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Perks.Lucky.Name"), LocaleLoader.getString("Perks.Lucky.Desc.Login")));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -69,36 +69,6 @@ public class StringUtils {
|
||||
return prettyString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the int represented by this string.
|
||||
*
|
||||
* @param string The string to parse
|
||||
* @return the int represented by this string
|
||||
*/
|
||||
public static int getInt(String string) {
|
||||
try {
|
||||
return Integer.parseInt(string);
|
||||
}
|
||||
catch (NumberFormatException nFE) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the long represented by this string.
|
||||
*
|
||||
* @param string The string to parse
|
||||
* @return the long represented by this string
|
||||
*/
|
||||
public static long getLong(String string) {
|
||||
try {
|
||||
return Long.parseLong(string);
|
||||
}
|
||||
catch (NumberFormatException nFE) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a string represents an Integer
|
||||
*
|
||||
|
@ -233,17 +233,12 @@ public class HashChunkManager implements ChunkManager {
|
||||
for (String key : keys) {
|
||||
String[] info = key.split(",");
|
||||
if (worldName.equals(info[0])) {
|
||||
int cx = 0;
|
||||
int cz = 0;
|
||||
|
||||
try {
|
||||
cx = Integer.parseInt(info[1]);
|
||||
cz = Integer.parseInt(info[2]);
|
||||
saveChunk(Integer.parseInt(info[1]), Integer.parseInt(info[2]), world);
|
||||
}
|
||||
catch (Exception e) {
|
||||
continue;
|
||||
// Ignore
|
||||
}
|
||||
saveChunk(cx, cz, world);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -261,17 +256,12 @@ public class HashChunkManager implements ChunkManager {
|
||||
for (String key : keys) {
|
||||
String[] info = key.split(",");
|
||||
if (worldName.equals(info[0])) {
|
||||
int cx = 0;
|
||||
int cz = 0;
|
||||
|
||||
try {
|
||||
cx = Integer.parseInt(info[1]);
|
||||
cz = Integer.parseInt(info[2]);
|
||||
unloadChunk(Integer.parseInt(info[1]), Integer.parseInt(info[2]), world);
|
||||
}
|
||||
catch (Exception e) {
|
||||
continue;
|
||||
// Ignore
|
||||
}
|
||||
unloadChunk(cx, cz, world);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -58,11 +58,7 @@ public final class CommandUtils {
|
||||
}
|
||||
|
||||
public static boolean hidden(CommandSender sender, Player target, boolean hasPermission) {
|
||||
if (sender instanceof Player && !((Player)sender).canSee(target) && !hasPermission) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return sender instanceof Player && !((Player) sender).canSee(target) && !hasPermission;
|
||||
}
|
||||
|
||||
public static boolean noConsoleUsage(CommandSender sender) {
|
||||
@ -195,10 +191,10 @@ public final class CommandUtils {
|
||||
|
||||
public static String displaySkill(PlayerProfile profile, SkillType skill) {
|
||||
if (skill.isChildSkill()) {
|
||||
return LocaleLoader.getString("Skills.ChildStats", LocaleLoader.getString(StringUtils.getCapitalized(skill.toString()) + ".Listener"), profile.getSkillLevel(skill));
|
||||
return LocaleLoader.getString("Skills.ChildStats", LocaleLoader.getString(StringUtils.getCapitalized(skill.toString()) + ".Listener"), " ", profile.getSkillLevel(skill));
|
||||
}
|
||||
|
||||
return LocaleLoader.getString("Skills.Stats", LocaleLoader.getString(StringUtils.getCapitalized(skill.toString()) + ".Listener"), profile.getSkillLevel(skill), profile.getSkillXpLevel(skill), profile.getXpToLevel(skill));
|
||||
return LocaleLoader.getString("Skills.Stats", LocaleLoader.getString(StringUtils.getCapitalized(skill.toString()) + ".Listener"), " ", profile.getSkillLevel(skill), profile.getSkillXpLevel(skill), profile.getXpToLevel(skill));
|
||||
}
|
||||
|
||||
private static void printGroupedSkillData(Player inspect, CommandSender display, String header, List<SkillType> skillGroup) {
|
||||
|
@ -402,6 +402,6 @@ public class ScoreboardManager {
|
||||
}
|
||||
|
||||
public static void setRevertTimer(String playerName, int seconds) {
|
||||
PLAYER_SCOREBOARDS.get(playerName).showBoardAndScheduleRevert(seconds * Misc.TICK_CONVERSION_FACTOR);;
|
||||
PLAYER_SCOREBOARDS.get(playerName).showBoardAndScheduleRevert(seconds * Misc.TICK_CONVERSION_FACTOR);
|
||||
}
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ public class SkillUtils {
|
||||
return (event.getChance() * activationChance) > Misc.getRandom().nextInt(activationChance);
|
||||
}
|
||||
|
||||
public static boolean treasureDropSuccessful(Player player, double dropChance, int activationChance) {;
|
||||
public static boolean treasureDropSuccessful(Player player, double dropChance, int activationChance) {
|
||||
SecondaryAbilityWeightedActivationCheckEvent event = new SecondaryAbilityWeightedActivationCheckEvent(player, SecondaryAbility.EXCAVATION_TREASURE_HUNTER, dropChance / activationChance);
|
||||
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
||||
return (event.getChance() * activationChance) > (Misc.getRandom().nextDouble() * activationChance);
|
||||
|
Reference in New Issue
Block a user