Code Cleanup Pt 2

This commit is contained in:
nossr50 2019-04-03 19:25:14 -07:00
parent 0e39656c88
commit 43037f8c13
118 changed files with 372 additions and 400 deletions

View File

@ -29,6 +29,7 @@ Version 2.2.0
Note: Admins are players who are op or have adminchat permission.
Bug Fixes
Fixed a bug where Blast Minings cooldown was not being displayed correctly
Fixed a bug where players who started at level 1 would not be purged from the DB for being "powerless"
Fixed a potential bug where players could be awarded XP for cancelled tame events
Fixed a bug where party size limits were only counting online players
@ -117,6 +118,7 @@ Version 2.2.0
Scoreboard.Misc.Ability locale entry renamed from "Ability" to "Super Ability", this is used only if scoreboards are enabled and super ability names are disabled in scoreboard.conf
MySQL and FlatFile Settings can now be found in "database_settings.conf"
Added new config setting for the update interval of FlatFile scoreboards
Added new config toggle for purging power-less users
Added new config toggle for purging inactive users
Database Purging's "Purge_Interval" renamed -> "Purge-Interval-In-Hours"

View File

@ -176,7 +176,7 @@ public final class PartyAPI {
*/
@Deprecated
public static List<OfflinePlayer> getOnlineAndOfflineMembers(Player player) {
List<OfflinePlayer> members = new ArrayList<OfflinePlayer>();
List<OfflinePlayer> members = new ArrayList<>();
for (UUID memberUniqueId : PartyManager.getAllMembers(player).keySet()) {
OfflinePlayer member = mcMMO.p.getServer().getOfflinePlayer(memberUniqueId);

View File

@ -82,7 +82,7 @@ public final class SkillAPI {
}
private static List<String> getListFromEnum(List<PrimarySkillType> skillsTypes) {
List<String> skills = new ArrayList<String>();
List<String> skills = new ArrayList<>();
for (PrimarySkillType primarySkillType : skillsTypes) {
skills.add(primarySkillType.name());

View File

@ -6,8 +6,8 @@ import org.bukkit.plugin.Plugin;
import java.util.HashMap;
public class ChatManagerFactory {
private static final HashMap<Plugin, AdminChatManager> adminChatManagers = new HashMap<Plugin, AdminChatManager>();
private static final HashMap<Plugin, PartyChatManager> partyChatManagers = new HashMap<Plugin, PartyChatManager>();
private static final HashMap<Plugin, AdminChatManager> adminChatManagers = new HashMap<>();
private static final HashMap<Plugin, PartyChatManager> partyChatManagers = new HashMap<>();
public static ChatManager getChatManager(Plugin plugin, ChatMode mode) {
switch (mode) {

View File

@ -33,7 +33,7 @@ public class McImportCommand implements CommandExecutor {
mcMMO.p.getLogger().info("Starting import of mod materials...");
fileAmount = 0;
HashMap<ModConfigType, ArrayList<String>> materialNames = new HashMap<ModConfigType, ArrayList<String>>();
HashMap<ModConfigType, ArrayList<String>> materialNames = new HashMap<>();
BufferedReader in = null;
@ -65,7 +65,7 @@ public class McImportCommand implements CommandExecutor {
ModConfigType type = ModConfigType.getModConfigType(materialName);
if (!materialNames.containsKey(type)) {
materialNames.put(type, new ArrayList<String>());
materialNames.put(type, new ArrayList<>());
}
materialNames.get(type).add(materialName);
@ -93,13 +93,13 @@ public class McImportCommand implements CommandExecutor {
private void createOutput(HashMap<ModConfigType, ArrayList<String>> materialNames) {
for (ModConfigType modConfigType : materialNames.keySet()) {
HashMap<String, ArrayList<String>> materialNamesType = new HashMap<String, ArrayList<String>>();
HashMap<String, ArrayList<String>> materialNamesType = new HashMap<>();
for (String materialName : materialNames.get(modConfigType)) {
String modName = Misc.getModName(materialName);
if (!materialNamesType.containsKey(modName)) {
materialNamesType.put(modName, new ArrayList<String>());
materialNamesType.put(modName, new ArrayList<>());
}
materialNamesType.get(modName).add(materialName);
@ -169,16 +169,10 @@ public class McImportCommand implements CommandExecutor {
out = new FileWriter(outputFile);
out.write(writer.toString());
}
catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
return;
}
catch (Exception e) {
e.printStackTrace();
return;
}
finally {
} finally {
tryClose(out);
fileAmount++;
}
@ -201,7 +195,7 @@ public class McImportCommand implements CommandExecutor {
}
private HashMap<String, ArrayList<String>> getConfigSectionsBlocks(String modName, HashMap<String, ArrayList<String>> materialNames) {
HashMap<String, ArrayList<String>> configSections = new HashMap<String, ArrayList<String>>();
HashMap<String, ArrayList<String>> configSections = new HashMap<>();
// Go through all the materials and categorise them under a skill
for (String materialName : materialNames.get(modName)) {
@ -220,7 +214,7 @@ public class McImportCommand implements CommandExecutor {
}
if (!configSections.containsKey(skillName)) {
configSections.put(skillName, new ArrayList<String>());
configSections.put(skillName, new ArrayList<>());
}
ArrayList<String> skillContents = configSections.get(skillName);
@ -240,7 +234,7 @@ public class McImportCommand implements CommandExecutor {
}
private HashMap<String, ArrayList<String>> getConfigSectionsTools(String modName, HashMap<String, ArrayList<String>> materialNames) {
HashMap<String, ArrayList<String>> configSections = new HashMap<String, ArrayList<String>>();
HashMap<String, ArrayList<String>> configSections = new HashMap<>();
// Go through all the materials and categorise them under a tool type
for (String materialName : materialNames.get(modName)) {
@ -265,7 +259,7 @@ public class McImportCommand implements CommandExecutor {
}
if (!configSections.containsKey(toolType)) {
configSections.put(toolType, new ArrayList<String>());
configSections.put(toolType, new ArrayList<>());
}
ArrayList<String> skillContents = configSections.get(toolType);
@ -280,7 +274,7 @@ public class McImportCommand implements CommandExecutor {
}
private HashMap<String, ArrayList<String>> getConfigSectionsArmor(String modName, HashMap<String, ArrayList<String>> materialNames) {
HashMap<String, ArrayList<String>> configSections = new HashMap<String, ArrayList<String>>();
HashMap<String, ArrayList<String>> configSections = new HashMap<>();
// Go through all the materials and categorise them under an armor type
for (String materialName : materialNames.get(modName)) {
@ -299,7 +293,7 @@ public class McImportCommand implements CommandExecutor {
}
if (!configSections.containsKey(toolType)) {
configSections.put(toolType, new ArrayList<String>());
configSections.put(toolType, new ArrayList<>());
}
ArrayList<String> skillContents = configSections.get(toolType);
@ -325,14 +319,14 @@ public class McImportCommand implements CommandExecutor {
}
private HashMap<String, ArrayList<String>> getConfigSectionsUnknown(String modName, HashMap<String, ArrayList<String>> materialNames) {
HashMap<String, ArrayList<String>> configSections = new HashMap<String, ArrayList<String>>();
HashMap<String, ArrayList<String>> configSections = new HashMap<>();
// Go through all the materials and print them
for (String materialName : materialNames.get(modName)) {
String configKey = "UNIDENTIFIED";
if (!configSections.containsKey(configKey)) {
configSections.put(configKey, new ArrayList<String>());
configSections.put(configKey, new ArrayList<>());
}
ArrayList<String> skillContents = configSections.get(configKey);

View File

@ -26,8 +26,8 @@ public class McconvertCommand implements TabExecutor {
private CommandExecutor experienceConvertCommand = new ConvertExperienceCommand();
static {
ArrayList<String> formulaTypes = new ArrayList<String>();
ArrayList<String> databaseTypes = new ArrayList<String>();
ArrayList<String> formulaTypes = new ArrayList<>();
ArrayList<String> databaseTypes = new ArrayList<>();
for (FormulaType type : FormulaType.values()) {
formulaTypes.add(type.toString());
@ -73,14 +73,14 @@ public class McconvertCommand implements TabExecutor {
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
switch (args.length) {
case 1:
return StringUtil.copyPartialMatches(args[0], SUBCOMMANDS, new ArrayList<String>(SUBCOMMANDS.size()));
return StringUtil.copyPartialMatches(args[0], SUBCOMMANDS, new ArrayList<>(SUBCOMMANDS.size()));
case 2:
if (args[0].equalsIgnoreCase("database") || args[0].equalsIgnoreCase("db")) {
return StringUtil.copyPartialMatches(args[0], DATABASE_TYPES, new ArrayList<String>(DATABASE_TYPES.size()));
return StringUtil.copyPartialMatches(args[0], DATABASE_TYPES, new ArrayList<>(DATABASE_TYPES.size()));
}
if (args[0].equalsIgnoreCase("experience") || args[0].equalsIgnoreCase("xp") || args[0].equalsIgnoreCase("exp")) {
return StringUtil.copyPartialMatches(args[0], FORMULA_TYPES, new ArrayList<String>(FORMULA_TYPES.size()));
return StringUtil.copyPartialMatches(args[0], FORMULA_TYPES, new ArrayList<>(FORMULA_TYPES.size()));
}
return ImmutableList.of();

View File

@ -72,7 +72,7 @@ public class McscoreboardCommand implements TabExecutor {
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
switch (args.length) {
case 1:
return StringUtil.copyPartialMatches(args[0], FIRST_ARGS, new ArrayList<String>(FIRST_ARGS.size()));
return StringUtil.copyPartialMatches(args[0], FIRST_ARGS, new ArrayList<>(FIRST_ARGS.size()));
default:
return ImmutableList.of();
}

View File

@ -64,7 +64,7 @@ public abstract class ToggleCommand implements TabExecutor {
switch (args.length) {
case 1:
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<>(playerNames.size()));
default:
return ImmutableList.of();
}

View File

@ -113,9 +113,9 @@ public class XprateCommand implements TabExecutor {
return ImmutableList.of();
}
return StringUtil.copyPartialMatches(args[0], CommandUtils.RESET_OPTIONS, new ArrayList<String>(CommandUtils.RESET_OPTIONS.size()));
return StringUtil.copyPartialMatches(args[0], CommandUtils.RESET_OPTIONS, new ArrayList<>(CommandUtils.RESET_OPTIONS.size()));
case 2:
return StringUtil.copyPartialMatches(args[1], CommandUtils.TRUE_FALSE_OPTIONS, new ArrayList<String>(CommandUtils.TRUE_FALSE_OPTIONS.size()));
return StringUtil.copyPartialMatches(args[1], CommandUtils.TRUE_FALSE_OPTIONS, new ArrayList<>(CommandUtils.TRUE_FALSE_OPTIONS.size()));
default:
return ImmutableList.of();
}

View File

@ -89,7 +89,7 @@ public abstract class ChatCommand implements TabExecutor {
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
switch (args.length) {
case 1:
return StringUtil.copyPartialMatches(args[0], CommandUtils.TRUE_FALSE_OPTIONS, new ArrayList<String>(CommandUtils.TRUE_FALSE_OPTIONS.size()));
return StringUtil.copyPartialMatches(args[0], CommandUtils.TRUE_FALSE_OPTIONS, new ArrayList<>(CommandUtils.TRUE_FALSE_OPTIONS.size()));
default:
return ImmutableList.of();
}

View File

@ -43,7 +43,7 @@ public class McremoveCommand implements TabExecutor {
switch (args.length) {
case 1:
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<>(playerNames.size()));
default:
return ImmutableList.of();
}

View File

@ -113,9 +113,9 @@ public abstract class ExperienceCommand implements TabExecutor {
switch (args.length) {
case 1:
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<>(playerNames.size()));
case 2:
return StringUtil.copyPartialMatches(args[1], PrimarySkillType.SKILL_NAMES, new ArrayList<String>(PrimarySkillType.SKILL_NAMES.size()));
return StringUtil.copyPartialMatches(args[1], PrimarySkillType.SKILL_NAMES, new ArrayList<>(PrimarySkillType.SKILL_NAMES.size()));
default:
return ImmutableList.of();
}

View File

@ -107,9 +107,9 @@ public class SkillresetCommand implements TabExecutor {
switch (args.length) {
case 1:
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<>(playerNames.size()));
case 2:
return StringUtil.copyPartialMatches(args[1], PrimarySkillType.SKILL_NAMES, new ArrayList<String>(PrimarySkillType.SKILL_NAMES.size()));
return StringUtil.copyPartialMatches(args[1], PrimarySkillType.SKILL_NAMES, new ArrayList<>(PrimarySkillType.SKILL_NAMES.size()));
default:
return ImmutableList.of();
}

View File

@ -29,7 +29,7 @@ public class PartyCommand implements TabExecutor {
private static final List<String> ITEMSHARE_COMPLETIONS = ImmutableList.of("none", "equal", "random", "loot", "mining", "herbalism", "woodcutting", "misc");
static {
ArrayList<String> subcommands = new ArrayList<String>();
ArrayList<String> subcommands = new ArrayList<>();
for (PartySubcommandType subcommand : PartySubcommandType.values()) {
subcommands.add(subcommand.toString());
@ -173,7 +173,7 @@ public class PartyCommand implements TabExecutor {
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
switch (args.length) {
case 1:
return StringUtil.copyPartialMatches(args[0], PARTY_SUBCOMMANDS, new ArrayList<String>(PARTY_SUBCOMMANDS.size()));
return StringUtil.copyPartialMatches(args[0], PARTY_SUBCOMMANDS, new ArrayList<>(PARTY_SUBCOMMANDS.size()));
case 2:
PartySubcommandType subcommand = PartySubcommandType.getSubcommand(args[0]);
@ -187,25 +187,25 @@ public class PartyCommand implements TabExecutor {
case KICK:
case OWNER:
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
return StringUtil.copyPartialMatches(args[1], playerNames, new ArrayList<String>(playerNames.size()));
return StringUtil.copyPartialMatches(args[1], playerNames, new ArrayList<>(playerNames.size()));
case XPSHARE:
return StringUtil.copyPartialMatches(args[1], XPSHARE_COMPLETIONS, new ArrayList<String>(XPSHARE_COMPLETIONS.size()));
return StringUtil.copyPartialMatches(args[1], XPSHARE_COMPLETIONS, new ArrayList<>(XPSHARE_COMPLETIONS.size()));
case ITEMSHARE:
return StringUtil.copyPartialMatches(args[1], ITEMSHARE_COMPLETIONS, new ArrayList<String>(ITEMSHARE_COMPLETIONS.size()));
return StringUtil.copyPartialMatches(args[1], ITEMSHARE_COMPLETIONS, new ArrayList<>(ITEMSHARE_COMPLETIONS.size()));
case LOCK:
case CHAT:
return StringUtil.copyPartialMatches(args[1], CommandUtils.TRUE_FALSE_OPTIONS, new ArrayList<String>(CommandUtils.TRUE_FALSE_OPTIONS.size()));
return StringUtil.copyPartialMatches(args[1], CommandUtils.TRUE_FALSE_OPTIONS, new ArrayList<>(CommandUtils.TRUE_FALSE_OPTIONS.size()));
case PASSWORD:
return StringUtil.copyPartialMatches(args[1], CommandUtils.RESET_OPTIONS, new ArrayList<String>(CommandUtils.RESET_OPTIONS.size()));
return StringUtil.copyPartialMatches(args[1], CommandUtils.RESET_OPTIONS, new ArrayList<>(CommandUtils.RESET_OPTIONS.size()));
case TELEPORT:
List<String> matches = StringUtil.copyPartialMatches(args[1], PtpCommand.TELEPORT_SUBCOMMANDS, new ArrayList<String>(PtpCommand.TELEPORT_SUBCOMMANDS.size()));
List<String> matches = StringUtil.copyPartialMatches(args[1], PtpCommand.TELEPORT_SUBCOMMANDS, new ArrayList<>(PtpCommand.TELEPORT_SUBCOMMANDS.size()));
if (matches.size() == 0) {
Player player = (Player) sender;
Party party = UserManager.getPlayer(player).getParty();
playerNames = party.getOnlinePlayerNames(player);
return StringUtil.copyPartialMatches(args[1], playerNames, new ArrayList<String>(playerNames.size()));
return StringUtil.copyPartialMatches(args[1], playerNames, new ArrayList<>(playerNames.size()));
}
return matches;
@ -214,7 +214,7 @@ public class PartyCommand implements TabExecutor {
}
case 3:
if (PartySubcommandType.getSubcommand(args[0]) == PartySubcommandType.ITEMSHARE && isItemShareCategory(args[1])) {
return StringUtil.copyPartialMatches(args[2], CommandUtils.TRUE_FALSE_OPTIONS, new ArrayList<String>(CommandUtils.TRUE_FALSE_OPTIONS.size()));
return StringUtil.copyPartialMatches(args[2], CommandUtils.TRUE_FALSE_OPTIONS, new ArrayList<>(CommandUtils.TRUE_FALSE_OPTIONS.size()));
}
return ImmutableList.of();

View File

@ -41,21 +41,21 @@ public class PartyInfoCommand implements CommandExecutor {
private void displayPartyHeader(Player player, Party party) {
player.sendMessage(LocaleLoader.getString("Commands.Party.Header"));
StringBuilder status = new StringBuilder();
status.append(LocaleLoader.getString("Commands.Party.Status", party.getName(), LocaleLoader.getString("Party.Status." + (party.isLocked() ? "Locked" : "Unlocked")), party.getLevel()));
/*if (!party.hasReachedLevelCap()) {
status.append(" (").append(party.getXpToLevelPercentage()).append(")");
}*/
player.sendMessage(status.toString());
player.sendMessage(LocaleLoader.getString("Commands.Party.Status", party.getName(), LocaleLoader.getString("Party.Status." + (party.isLocked() ? "Locked" : "Unlocked")), party.getLevel())
/*if (!party.hasReachedLevelCap()) {
status.append(" (").append(party.getXpToLevelPercentage()).append(")");
}*/);
}
private void displayPartyFeatures(Player player, Party party) {
player.sendMessage(LocaleLoader.getString("Commands.Party.Features.Header"));
List<String> unlockedPartyFeatures = new ArrayList<String>();
List<String> lockedPartyFeatures = new ArrayList<String>();
List<String> unlockedPartyFeatures = new ArrayList<>();
List<String> lockedPartyFeatures = new ArrayList<>();
for (PartyFeature partyFeature : PartyFeature.values()) {
if (!partyFeature.hasPermission(player)) {

View File

@ -104,11 +104,11 @@ public class PartyAllianceCommand implements TabExecutor {
public List<String> onTabComplete(CommandSender commandSender, Command command, String label, String[] args) {
switch (args.length) {
case 1:
List<String> matches = StringUtil.copyPartialMatches(args[0], ALLIANCE_SUBCOMMANDS, new ArrayList<String>(ALLIANCE_SUBCOMMANDS.size()));
List<String> matches = StringUtil.copyPartialMatches(args[0], ALLIANCE_SUBCOMMANDS, new ArrayList<>(ALLIANCE_SUBCOMMANDS.size()));
if (matches.size() == 0) {
List<String> playerNames = CommandUtils.getOnlinePlayerNames(commandSender);
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<>(playerNames.size()));
}
return matches;

View File

@ -127,7 +127,7 @@ public class PtpCommand implements TabExecutor {
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
switch (args.length) {
case 1:
List<String> matches = StringUtil.copyPartialMatches(args[0], TELEPORT_SUBCOMMANDS, new ArrayList<String>(TELEPORT_SUBCOMMANDS.size()));
List<String> matches = StringUtil.copyPartialMatches(args[0], TELEPORT_SUBCOMMANDS, new ArrayList<>(TELEPORT_SUBCOMMANDS.size()));
if (matches.size() == 0) {
Player player = (Player) sender;
@ -138,7 +138,7 @@ public class PtpCommand implements TabExecutor {
}
List<String> playerNames = mcMMOPlayer.getParty().getOnlinePlayerNames(player);
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<>(playerNames.size()));
}
return matches;

View File

@ -106,7 +106,7 @@ public class InspectCommand implements TabExecutor {
switch (args.length) {
case 1:
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<>(playerNames.size()));
default:
return ImmutableList.of();
}

View File

@ -80,7 +80,7 @@ public class McrankCommand implements TabExecutor {
switch (args.length) {
case 1:
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<>(playerNames.size()));
default:
return ImmutableList.of();
}

View File

@ -70,7 +70,7 @@ public class MctopCommand implements TabExecutor {
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
switch (args.length) {
case 1:
return StringUtil.copyPartialMatches(args[0], PrimarySkillType.SKILL_NAMES, new ArrayList<String>(PrimarySkillType.SKILL_NAMES.size()));
return StringUtil.copyPartialMatches(args[0], PrimarySkillType.SKILL_NAMES, new ArrayList<>(PrimarySkillType.SKILL_NAMES.size()));
default:
return ImmutableList.of();
}

View File

@ -44,7 +44,7 @@ public class AcrobaticsCommand extends SkillCommand {
@Override
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<String>();
List<String> messages = new ArrayList<>();
if (canDodge) {
messages.add(getStatMessage(SubSkillType.ACROBATICS_DODGE, dodgeChance)
@ -71,7 +71,7 @@ public class AcrobaticsCommand extends SkillCommand {
graceChance = RandomChanceUtil.getRandomChanceExecutionChance(grace_rcs);
//damageThreshold = AdvancedConfig.getInstance().getRollDamageThreshold();
String rollStrings[] = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.ACROBATICS_ROLL);
String[] rollStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.ACROBATICS_ROLL);
//Format
double rollChanceLucky = rollChance * 1.333D;

View File

@ -67,7 +67,7 @@ public class AlchemyCommand extends SkillCommand {
@Override
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<String>();
List<String> messages = new ArrayList<>();
if (canCatalysis) {
messages.add(getStatMessage(SubSkillType.ALCHEMY_CATALYSIS, brewSpeed)

View File

@ -59,7 +59,7 @@ public class ArcheryCommand extends SkillCommand {
@Override
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<String>();
List<String> messages = new ArrayList<>();
if (canRetrieve) {
messages.add(getStatMessage(SubSkillType.ARCHERY_ARROW_RETRIEVAL, retrieveChance)

View File

@ -72,7 +72,7 @@ public class AxesCommand extends SkillCommand {
@Override
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<String>();
List<String> messages = new ArrayList<>();
if (canImpact) {
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Axes.Ability.Bonus.2"), LocaleLoader.getString("Axes.Ability.Bonus.3", impactDamage)));

View File

@ -27,7 +27,7 @@ public class ExcavationCommand extends SkillCommand {
protected void dataCalculations(Player player, float skillValue) {
// GIGA DRILL BREAKER
if (canGigaDrill) {
String gigaDrillStrings[] = calculateLengthDisplayValues(player, skillValue);
String[] gigaDrillStrings = calculateLengthDisplayValues(player, skillValue);
gigaDrillBreakerLength = gigaDrillStrings[0];
gigaDrillBreakerLengthEndurance = gigaDrillStrings[1];
}
@ -41,7 +41,7 @@ public class ExcavationCommand extends SkillCommand {
@Override
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<String>();
List<String> messages = new ArrayList<>();
if (canGigaDrill) {
messages.add(getStatMessage(SubSkillType.EXCAVATION_GIGA_DRILL_BREAKER, gigaDrillBreakerLength)

View File

@ -128,7 +128,7 @@ public class FishingCommand extends SkillCommand {
@Override
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<String>();
List<String> messages = new ArrayList<>();
if (canFishermansDiet) {
messages.add(getStatMessage(false, true, SubSkillType.FISHING_FISHERMANS_DIET, String.valueOf(fishermansDietRank)));

View File

@ -45,7 +45,7 @@ public class HerbalismCommand extends SkillCommand {
// DOUBLE DROPS
if (canDoubleDrop) {
String[] doubleDropStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.HERBALISM_DOUBLE_DROPS);;
String[] doubleDropStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.HERBALISM_DOUBLE_DROPS);
doubleDropChance = doubleDropStrings[0];
doubleDropChanceLucky = doubleDropStrings[1];
}
@ -99,7 +99,7 @@ public class HerbalismCommand extends SkillCommand {
@Override
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<String>();
List<String> messages = new ArrayList<>();
if (canDoubleDrop) {
messages.add(getStatMessage(SubSkillType.HERBALISM_DOUBLE_DROPS, doubleDropChance)

View File

@ -78,7 +78,7 @@ public class MiningCommand extends SkillCommand {
@Override
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<String>();
List<String> messages = new ArrayList<>();
if (canBiggerBombs) {
messages.add(getStatMessage(true, true, SubSkillType.MINING_BLAST_MINING, String.valueOf(blastRadiusIncrease)));

View File

@ -64,7 +64,7 @@ public class MmoInfoCommand implements TabExecutor {
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
switch (args.length) {
case 1:
return StringUtil.copyPartialMatches(args[0], PrimarySkillType.SUBSKILL_NAMES, new ArrayList<String>(PrimarySkillType.SUBSKILL_NAMES.size()));
return StringUtil.copyPartialMatches(args[0], PrimarySkillType.SUBSKILL_NAMES, new ArrayList<>(PrimarySkillType.SUBSKILL_NAMES.size()));
default:
return ImmutableList.of();
}

View File

@ -90,7 +90,7 @@ public class RepairCommand extends SkillCommand {
@Override
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<String>();
List<String> messages = new ArrayList<>();
if (canArcaneForge) {
RepairManager repairManager = UserManager.getPlayer(player).getRepairManager();

View File

@ -36,7 +36,7 @@ public class SalvageCommand extends SkillCommand {
@Override
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<String>();
List<String> messages = new ArrayList<>();
SalvageManager salvageManager = UserManager.getPlayer(player).getSalvageManager();
if (canAdvancedSalvage) {

View File

@ -162,28 +162,26 @@ public abstract class SkillCommand implements TabExecutor {
ArrayList<PrimarySkillType> parentList = new ArrayList<>();
//TODO: Add JSON here
for (PrimarySkillType parent : parents) {
parentList.add(parent);
/*player.sendMessage(parent.getName() + " - " + LocaleLoader.getString("Effects.Level.Overhaul", mcMMOPlayer.getSkillLevel(parent), mcMMOPlayer.getSkillXpLevel(parent), mcMMOPlayer.getXpToLevel(parent)))*/;
}
/*player.sendMessage(parent.getName() + " - " + LocaleLoader.getString("Effects.Level.Overhaul", mcMMOPlayer.getSkillLevel(parent), mcMMOPlayer.getSkillXpLevel(parent), mcMMOPlayer.getXpToLevel(parent)))*/
parentList.addAll(parents);
String parentMessage = "";
StringBuilder parentMessage = new StringBuilder();
for(int i = 0; i < parentList.size(); i++)
{
if(i+1 < parentList.size())
{
parentMessage += LocaleLoader.getString("Effects.Child.ParentList", parentList.get(i).getName(), mcMMOPlayer.getSkillLevel(parentList.get(i)));
parentMessage += ChatColor.GRAY+", ";
parentMessage.append(LocaleLoader.getString("Effects.Child.ParentList", parentList.get(i).getName(), mcMMOPlayer.getSkillLevel(parentList.get(i))));
parentMessage.append(ChatColor.GRAY + ", ");
} else {
parentMessage += LocaleLoader.getString("Effects.Child.ParentList", parentList.get(i).getName(), mcMMOPlayer.getSkillLevel(parentList.get(i)));
parentMessage.append(LocaleLoader.getString("Effects.Child.ParentList", parentList.get(i).getName(), mcMMOPlayer.getSkillLevel(parentList.get(i))));
}
}
//XP GAIN METHOD
player.sendMessage(LocaleLoader.getString("Commands.XPGain.Overhaul", LocaleLoader.getString("Commands.XPGain.Child")));
player.sendMessage(LocaleLoader.getString("Effects.Child.Overhaul", skillValue, parentMessage));
player.sendMessage(LocaleLoader.getString("Effects.Child.Overhaul", skillValue, parentMessage.toString()));
//LEVEL
//player.sendMessage(LocaleLoader.getString("Effects.Child.Overhaul", skillValue, skillValue));

View File

@ -67,7 +67,7 @@ public class SkillGuideCommand implements CommandExecutor {
private ArrayList<String> grabPageContents(int page) {
int pageIndexStart = 8 * (page - 1); // Determine what string to start at
ArrayList<String> allStrings = new ArrayList<String>();
ArrayList<String> allStrings = new ArrayList<>();
allStrings.add(header);
@ -86,7 +86,7 @@ public class SkillGuideCommand implements CommandExecutor {
}
private ArrayList<String> getGuide(PrimarySkillType skill) {
ArrayList<String> guide = new ArrayList<String>();
ArrayList<String> guide = new ArrayList<>();
for (int i = 0; i < 10; i++) {
String[] section = LocaleLoader.getString("Guides." + StringUtils.getCapitalized(skill.toString()) + ".Section." + i).split("\n");

View File

@ -62,7 +62,7 @@ public class SmeltingCommand extends SkillCommand {
@Override
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<String>();
List<String> messages = new ArrayList<>();
/*if (canFluxMine) {
messages.add(getStatMessage(SubSkillType.SMELTING_FLUX_MINING, str_fluxMiningChance)

View File

@ -68,7 +68,7 @@ public class SwordsCommand extends SkillCommand {
@Override
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<String>();
List<String> messages = new ArrayList<>();
int ruptureTicks = UserManager.getPlayer(player).getSwordsManager().getRuptureBleedTicks();
double ruptureDamagePlayers = RankUtils.getRank(player, SubSkillType.SWORDS_RUPTURE) >= 3 ? AdvancedConfig.getInstance().getRuptureDamagePlayer() * 1.5D : AdvancedConfig.getInstance().getRuptureDamagePlayer();

View File

@ -56,7 +56,7 @@ public class TamingCommand extends SkillCommand {
@Override
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<String>();
List<String> messages = new ArrayList<>();
if (canEnvironmentallyAware) {
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Taming.Ability.Bonus.0"), LocaleLoader.getString("Taming.Ability.Bonus.1")));

View File

@ -40,7 +40,7 @@ public class UnarmedCommand extends SkillCommand {
protected void dataCalculations(Player player, float skillValue) {
// UNARMED_ARROW_DEFLECT
if (canDeflect) {
String[] deflectStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.UNARMED_ARROW_DEFLECT);;
String[] deflectStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.UNARMED_ARROW_DEFLECT);
deflectChance = deflectStrings[0];
deflectChanceLucky = deflectStrings[1];
}
@ -54,7 +54,7 @@ public class UnarmedCommand extends SkillCommand {
// UNARMED_DISARM
if (canDisarm) {
String[] disarmStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.UNARMED_DISARM);;
String[] disarmStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.UNARMED_DISARM);
disarmChance = disarmStrings[0];
disarmChanceLucky = disarmStrings[1];
}
@ -84,7 +84,7 @@ public class UnarmedCommand extends SkillCommand {
@Override
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<String>();
List<String> messages = new ArrayList<>();
if (canDeflect) {
messages.add(getStatMessage(SubSkillType.UNARMED_ARROW_DEFLECT, deflectChance)

View File

@ -46,7 +46,7 @@ public class WoodcuttingCommand extends SkillCommand {
}
private void setDoubleDropClassicChanceStrings(Player player) {
String[] doubleDropStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.WOODCUTTING_HARVEST_LUMBER);;
String[] doubleDropStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.WOODCUTTING_HARVEST_LUMBER);
doubleDropChance = doubleDropStrings[0];
doubleDropChanceLucky = doubleDropStrings[1];
}
@ -63,7 +63,7 @@ public class WoodcuttingCommand extends SkillCommand {
@Override
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<String>();
List<String> messages = new ArrayList<>();
if (canDoubleDrop) {
messages.add(getStatMessage(SubSkillType.WOODCUTTING_HARVEST_LUMBER, doubleDropChance)

View File

@ -160,7 +160,7 @@ public class AdvancedConfig extends ConfigValidated {
@Override
public List<String> validateKeys() {
// Validate all the settings!
List<String> reason = new ArrayList<String>();
List<String> reason = new ArrayList<>();
/* GENERAL */
if (getAbilityLength() < 1) {

View File

@ -235,7 +235,7 @@ public class MainConfig extends ConfigValidated {
@Override
public List<String> validateKeys() {
// Validate all the settings!
List<String> reason = new ArrayList<String>();
List<String> reason = new ArrayList<>();
/* General Settings */
/*if (getSaveInterval() <= 0) {

View File

@ -49,7 +49,7 @@ public class RankConfig extends ConfigValidated {
@Override
public List<String> validateKeys() {
List<String> reason = new ArrayList<String>();
List<String> reason = new ArrayList<>();
/*
* In the future this method will check keys for all skills, but for now it only checks overhauled skills

View File

@ -77,7 +77,6 @@ public class ExperienceConfig extends ConfigValidated {
public static final String OCELOT = "Ocelot";
public static final String WOLF = "Wolf";
public static final String FEATHER_FALL_MULTIPLIER = "FeatherFall_Multiplier";
private static ExperienceConfig instance;
//TODO: Should merge be false? Seems okay to leave it as true..
public ExperienceConfig() {
@ -109,12 +108,12 @@ public class ExperienceConfig extends ConfigValidated {
@Override
public void unload() {
instance = null; //TODO: this might be a bit problematic
}
@Override
public List<String> validateKeys() {
List<String> reason = new ArrayList<String>();
List<String> reason = new ArrayList<>();
/*
* FORMULA SETTINGS

View File

@ -7,32 +7,32 @@ public final class HOCONUtil {
public static String serializeENUMName(String hyphenedString)
{
String[] split = hyphenedString.split("_");
String formattedString = "";
StringBuilder formattedString = new StringBuilder();
for(int x = 0; x < split.length; x++)
{
if(x + 1 >= split.length)
formattedString += StringUtils.getCapitalized(split[x]);
formattedString.append(StringUtils.getCapitalized(split[x]));
else
formattedString+= (StringUtils.getCapitalized(split[x]) + '-');
formattedString.append(StringUtils.getCapitalized(split[x])).append('-');
}
return formattedString;
return formattedString.toString();
}
public static String deserializeENUMName(String serializedName)
{
String[] split = serializedName.split("-");
String formattedString = "";
StringBuilder formattedString = new StringBuilder();
for(int x = 0; x < split.length; x++)
{
if(x + 1 >= split.length)
formattedString += split[x].toUpperCase();
formattedString.append(split[x].toUpperCase());
else
formattedString+= (split[x] + '_');
formattedString.append(split[x]).append('_');
}
return formattedString;
return formattedString.toString();
}
}

View File

@ -63,7 +63,7 @@ public class PotionConfig extends ConfigCollection {
private List<ItemStack> concoctionsIngredientsTierSeven;
private List<ItemStack> concoctionsIngredientsTierEight;
private Map<String, AlchemyPotion> potionMap = new HashMap<String, AlchemyPotion>();
private Map<String, AlchemyPotion> potionMap = new HashMap<>();
public PotionConfig() {
super("skillranks", mcMMO.p.getDataFolder().getAbsoluteFile(), ConfigConstants.RELATIVE_PATH_CONFIG_DIR, true, true, true, true);
@ -211,14 +211,14 @@ public class PotionConfig extends ConfigCollection {
material = Material.valueOf(materialTypeString);
}
List<String> lore = new ArrayList<String>();
List<String> lore = new ArrayList<>();
if (potion_section.getNode(LORE) != null) {
for (String line : potion_section.getNode(LORE).getList(TypeToken.of(String.class))) {
lore.add(ChatColor.translateAlternateColorCodes('&', line));
}
}
List<PotionEffect> effects = new ArrayList<PotionEffect>();
List<PotionEffect> effects = new ArrayList<>();
if (potion_section.getNode(EFFECTS) != null) {
for (String effect : potion_section.getNode(EFFECTS).getList(TypeToken.of(String.class))) {
String[] parts = effect.split(" ");
@ -235,14 +235,14 @@ public class PotionConfig extends ConfigCollection {
}
}
Color color = null;
Color color;
if (potion_section.getNode(COLOR) != null) {
color = Color.fromRGB(potion_section.getNode(COLOR).getInt());
} else {
color = this.generateColor(effects);
}
Map<ItemStack, String> children = new HashMap<ItemStack, String>();
Map<ItemStack, String> children = new HashMap<>();
if (potion_section.getNode(CHILDREN) != null) {
for (String child : potion_section.getNode(CHILDREN).getList(TypeToken.of(String.class))) {
ItemStack ingredient = loadIngredient(child);
@ -324,7 +324,7 @@ public class PotionConfig extends ConfigCollection {
public Color generateColor(List<PotionEffect> effects) {
if (effects != null && !effects.isEmpty()) {
List<Color> colors = new ArrayList<Color>();
List<Color> colors = new ArrayList<>();
for (PotionEffect effect : effects) {
if (effect.getType().getColor() != null) {
colors.add(effect.getType().getColor());

View File

@ -23,7 +23,7 @@ public class ExcavationTreasureConfig extends Config implements UnsafeValueValid
public static final String DROP_LEVEL = "Drop_Level";
public static final String CUSTOM_NAME = "Custom_Name";
public static final String LORE = "Lore";
public HashMap<String, List<ExcavationTreasure>> excavationMap = new HashMap<String, List<ExcavationTreasure>>();
public HashMap<String, List<ExcavationTreasure>> excavationMap = new HashMap<>();
public ExcavationTreasureConfig() {
super("excavation_drops", mcMMO.p.getDataFolder().getAbsoluteFile(), ConfigConstants.RELATIVE_PATH_CONFIG_DIR, true, false, true, false);
@ -141,8 +141,7 @@ public class ExcavationTreasureConfig extends Config implements UnsafeValueValid
*/
for(String dropBlock : dropsFrom)
{
if(excavationMap.get(dropBlock) == null)
excavationMap.put(dropBlock, new ArrayList<>());
excavationMap.computeIfAbsent(dropBlock, k -> new ArrayList<>());
excavationMap.get(dropBlock).add(excavationTreasure);
}

View File

@ -40,9 +40,9 @@ public class FishingTreasureConfig extends Config implements UnsafeValueValidati
public static final String RARITY = "Rarity";
public static final String DROPS_FROM = "Drops_From";
public HashMap<EntityType, List<ShakeTreasure>> shakeMap = new HashMap<EntityType, List<ShakeTreasure>>();
public HashMap<Rarity, List<FishingTreasure>> fishingRewards = new HashMap<Rarity, List<FishingTreasure>>();
public HashMap<Rarity, List<EnchantmentTreasure>> fishingEnchantments = new HashMap<Rarity, List<EnchantmentTreasure>>();
public HashMap<EntityType, List<ShakeTreasure>> shakeMap = new HashMap<>();
public HashMap<Rarity, List<FishingTreasure>> fishingRewards = new HashMap<>();
public HashMap<Rarity, List<EnchantmentTreasure>> fishingEnchantments = new HashMap<>();
/**
* This grabs an instance of this config class from the Config Manager
@ -81,7 +81,7 @@ public class FishingTreasureConfig extends Config implements UnsafeValueValidati
// Initialize fishing HashMap
for (Rarity rarity : Rarity.values()) {
if (!fishingRewards.containsKey(rarity)) {
fishingRewards.put(rarity, (new ArrayList<FishingTreasure>()));
fishingRewards.put(rarity, (new ArrayList<>()));
}
}
@ -276,8 +276,7 @@ public class FishingTreasureConfig extends Config implements UnsafeValueValidati
/*
* Add to map
*/
if(shakeMap.get(entityType) == null)
shakeMap.put(entityType, new ArrayList<>());
shakeMap.computeIfAbsent(entityType, k -> new ArrayList<>());
shakeMap.get(entityType).add(shakeTreasure);
@ -297,7 +296,7 @@ public class FishingTreasureConfig extends Config implements UnsafeValueValidati
}
if (!fishingEnchantments.containsKey(rarity)) {
fishingEnchantments.put(rarity, (new ArrayList<EnchantmentTreasure>()));
fishingEnchantments.put(rarity, (new ArrayList<>()));
}
ConfigurationNode enchantmentSection = getUserRootNode().getNode(ENCHANTMENTS_RARITY, rarity.toString());
@ -334,7 +333,7 @@ public class FishingTreasureConfig extends Config implements UnsafeValueValidati
@Override
public List<String> validateKeys() {
// Validate all the settings!
List<String> errorMessages = new ArrayList<String>();
List<String> errorMessages = new ArrayList<>();
try {
for (String tier : getUserRootNode().getNode(ENCHANTMENT_DROP_RATES).getList(TypeToken.of(String.class))) {
/*double totalEnchantDropRate = 0;

View File

@ -26,7 +26,7 @@ public class HerbalismTreasureConfig extends Config implements UnsafeValueValida
public static final String CUSTOM_NAME = "Custom_Name";
public static final String LORE = "Lore";
public HashMap<String, List<HylianTreasure>> hylianMap = new HashMap<String, List<HylianTreasure>>();
public HashMap<String, List<HylianTreasure>> hylianMap = new HashMap<>();
public HerbalismTreasureConfig() {
super("hylian_luck_drops", mcMMO.p.getDataFolder().getAbsoluteFile(), ConfigConstants.RELATIVE_PATH_CONFIG_DIR, true, false, true, false);
@ -206,7 +206,7 @@ public class HerbalismTreasureConfig extends Config implements UnsafeValueValida
private void addHylianTreasure(String dropper, HylianTreasure treasure) {
if (!hylianMap.containsKey(dropper))
hylianMap.put(dropper, new ArrayList<HylianTreasure>());
hylianMap.put(dropper, new ArrayList<>());
hylianMap.get(dropper).add(treasure);
}

View File

@ -81,7 +81,7 @@ public class TreasureFactory {
if(customLore != null && !customLore.getString().equalsIgnoreCase(CHANGE_ME))
{
ItemMeta itemMeta = treasure.getItemMeta();
List<String> lore = new ArrayList<String>();
List<String> lore = new ArrayList<>();
try {
//TODO: Not sure how this will be handled by Configurate

View File

@ -16,8 +16,8 @@ import java.io.*;
import java.util.*;
public final class FlatfileDatabaseManager implements DatabaseManager {
private final HashMap<PrimarySkillType, List<PlayerStat>> playerStatHash = new HashMap<PrimarySkillType, List<PlayerStat>>();
private final List<PlayerStat> powerLevels = new ArrayList<PlayerStat>();
private final HashMap<PrimarySkillType, List<PlayerStat>> playerStatHash = new HashMap<>();
private final List<PlayerStat> powerLevels = new ArrayList<>();
private long lastUpdate = 0;
private long updateWaitTime;
private final File usersFile;
@ -364,7 +364,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
public Map<PrimarySkillType, Integer> readRank(String playerName) {
updateLeaderboards();
Map<PrimarySkillType, Integer> skills = new HashMap<PrimarySkillType, Integer>();
Map<PrimarySkillType, Integer> skills = new HashMap<>();
for (PrimarySkillType skill : PrimarySkillType.NON_CHILD_SKILLS) {
skills.put(skill, getPlayerRank(playerName, playerStatHash.get(skill)));
@ -652,7 +652,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
}
character[UUID_INDEX] = fetchedUUIDs.remove(character[USERNAME]).toString();
line = new StringBuilder(org.apache.commons.lang.StringUtils.join(character, ":")).append(":").toString();
line = org.apache.commons.lang.StringUtils.join(character, ":") + ":";
}
i++;
@ -690,7 +690,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
}
public List<String> getStoredUsers() {
ArrayList<String> users = new ArrayList<String>();
ArrayList<String> users = new ArrayList<>();
BufferedReader in = null;
String usersFilePath = mcMMO.getUsersFilePath();
@ -736,19 +736,19 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
powerLevels.clear(); // Clear old values from the power levels
// Initialize lists
List<PlayerStat> mining = new ArrayList<PlayerStat>();
List<PlayerStat> woodcutting = new ArrayList<PlayerStat>();
List<PlayerStat> herbalism = new ArrayList<PlayerStat>();
List<PlayerStat> excavation = new ArrayList<PlayerStat>();
List<PlayerStat> acrobatics = new ArrayList<PlayerStat>();
List<PlayerStat> repair = new ArrayList<PlayerStat>();
List<PlayerStat> swords = new ArrayList<PlayerStat>();
List<PlayerStat> axes = new ArrayList<PlayerStat>();
List<PlayerStat> archery = new ArrayList<PlayerStat>();
List<PlayerStat> unarmed = new ArrayList<PlayerStat>();
List<PlayerStat> taming = new ArrayList<PlayerStat>();
List<PlayerStat> fishing = new ArrayList<PlayerStat>();
List<PlayerStat> alchemy = new ArrayList<PlayerStat>();
List<PlayerStat> mining = new ArrayList<>();
List<PlayerStat> woodcutting = new ArrayList<>();
List<PlayerStat> herbalism = new ArrayList<>();
List<PlayerStat> excavation = new ArrayList<>();
List<PlayerStat> acrobatics = new ArrayList<>();
List<PlayerStat> repair = new ArrayList<>();
List<PlayerStat> swords = new ArrayList<>();
List<PlayerStat> axes = new ArrayList<>();
List<PlayerStat> archery = new ArrayList<>();
List<PlayerStat> unarmed = new ArrayList<>();
List<PlayerStat> taming = new ArrayList<>();
List<PlayerStat> fishing = new ArrayList<>();
List<PlayerStat> alchemy = new ArrayList<>();
BufferedReader in = null;
String playerName = null;
@ -843,8 +843,8 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
in = new BufferedReader(new FileReader(usersFilePath));
StringBuilder writer = new StringBuilder();
String line;
HashSet<String> usernames = new HashSet<String>();
HashSet<String> players = new HashSet<String>();
HashSet<String> usernames = new HashSet<>();
HashSet<String> players = new HashSet<>();
while ((line = in.readLine()) != null) {
// Remove empty lines from the file
@ -1047,7 +1047,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
}
if (updated) {
line = new StringBuilder(org.apache.commons.lang.StringUtils.join(character, ":")).append(":").toString();
line = org.apache.commons.lang.StringUtils.join(character, ":") + ":";
}
writer.append(line).append("\r\n");
@ -1133,9 +1133,9 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
private PlayerProfile loadFromLine(String[] character) {
Map<PrimarySkillType, Integer> skills = getSkillMapFromLine(character); // Skill levels
Map<PrimarySkillType, Float> skillsXp = new EnumMap<PrimarySkillType, Float>(PrimarySkillType.class); // Skill & XP
Map<SuperAbilityType, Integer> skillsDATS = new EnumMap<SuperAbilityType, Integer>(SuperAbilityType.class); // Ability & Cooldown
Map<UniqueDataType, Integer> uniquePlayerDataMap = new EnumMap<UniqueDataType, Integer>(UniqueDataType.class);
Map<PrimarySkillType, Float> skillsXp = new EnumMap<>(PrimarySkillType.class); // Skill & XP
Map<SuperAbilityType, Integer> skillsDATS = new EnumMap<>(SuperAbilityType.class); // Ability & Cooldown
Map<UniqueDataType, Integer> uniquePlayerDataMap = new EnumMap<>(UniqueDataType.class);
MobHealthbarType mobHealthbarType;
int scoreboardTipsShown;
@ -1201,7 +1201,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
}
private Map<PrimarySkillType, Integer> getSkillMapFromLine(String[] character) {
Map<PrimarySkillType, Integer> skills = new EnumMap<PrimarySkillType, Integer>(PrimarySkillType.class); // Skill & Level
Map<PrimarySkillType, Integer> skills = new EnumMap<>(PrimarySkillType.class); // Skill & Level
skills.put(PrimarySkillType.TAMING, Integer.valueOf(character[SKILLS_TAMING]));
skills.put(PrimarySkillType.MINING, Integer.valueOf(character[SKILLS_MINING]));
@ -1322,7 +1322,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
character[HEALTHBAR] = mcMMO.getConfigManager().getConfigMobs().getCombat().getHealthBars().getDisplayBarType().toString();
line = new StringBuilder(org.apache.commons.lang.StringUtils.join(character, ":")).append(":").toString();
line = org.apache.commons.lang.StringUtils.join(character, ":") + ":";
writer.append(line).append("\r\n");
}

View File

@ -23,7 +23,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
public static final String COM_MYSQL_JDBC_DRIVER = "com.mysql.jdbc.Driver";
private String tablePrefix = mcMMO.getMySQLConfigSettings().getConfigSectionDatabase().getTablePrefix();
private final Map<UUID, Integer> cachedUserIDs = new HashMap<UUID, Integer>();
private final Map<UUID, Integer> cachedUserIDs = new HashMap<>();
private DataSource miscPool;
private DataSource loadPool;
@ -344,7 +344,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
}
public List<PlayerStat> readLeaderboard(PrimarySkillType skill, int pageNumber, int statsPerPage) {
List<PlayerStat> stats = new ArrayList<PlayerStat>();
List<PlayerStat> stats = new ArrayList<>();
String query = skill == null ? ALL_QUERY_VERSION : skill.name().toLowerCase();
ResultSet resultSet = null;
@ -359,7 +359,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
resultSet = statement.executeQuery();
while (resultSet.next()) {
ArrayList<String> column = new ArrayList<String>();
ArrayList<String> column = new ArrayList<>();
for (int i = 1; i <= resultSet.getMetaData().getColumnCount(); i++) {
column.add(resultSet.getString(i));
@ -381,7 +381,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
}
public Map<PrimarySkillType, Integer> readRank(String playerName) {
Map<PrimarySkillType, Integer> skills = new HashMap<PrimarySkillType, Integer>();
Map<PrimarySkillType, Integer> skills = new HashMap<>();
ResultSet resultSet = null;
PreparedStatement statement = null;
@ -751,7 +751,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
}
public List<String> getStoredUsers() {
ArrayList<String> users = new ArrayList<String>();
ArrayList<String> users = new ArrayList<>();
Statement statement = null;
Connection connection = null;
@ -1077,10 +1077,10 @@ public final class SQLDatabaseManager implements DatabaseManager {
}
private PlayerProfile loadFromResult(String playerName, ResultSet result) throws SQLException {
Map<PrimarySkillType, Integer> skills = new EnumMap<PrimarySkillType, Integer>(PrimarySkillType.class); // Skill & Level
Map<PrimarySkillType, Float> skillsXp = new EnumMap<PrimarySkillType, Float>(PrimarySkillType.class); // Skill & XP
Map<SuperAbilityType, Integer> skillsDATS = new EnumMap<SuperAbilityType, Integer>(SuperAbilityType.class); // Ability & Cooldown
Map<UniqueDataType, Integer> uniqueData = new EnumMap<UniqueDataType, Integer>(UniqueDataType.class); //Chimaera wing cooldown and other misc info
Map<PrimarySkillType, Integer> skills = new EnumMap<>(PrimarySkillType.class); // Skill & Level
Map<PrimarySkillType, Float> skillsXp = new EnumMap<>(PrimarySkillType.class); // Skill & XP
Map<SuperAbilityType, Integer> skillsDATS = new EnumMap<>(SuperAbilityType.class); // Ability & Cooldown
Map<UniqueDataType, Integer> uniqueData = new EnumMap<>(UniqueDataType.class); //Chimaera wing cooldown and other misc info
MobHealthbarType mobHealthbarType;
UUID uuid;
int scoreboardTipsShown;

View File

@ -9,7 +9,7 @@ public enum ChatMode {
private String enabledMessage;
private String disabledMessage;
private ChatMode(String enabledMessage, String disabledMessage) {
ChatMode(String enabledMessage, String disabledMessage) {
this.enabledMessage = enabledMessage;
this.disabledMessage = disabledMessage;
}

View File

@ -2,7 +2,7 @@ package com.gmail.nossr50.datatypes.database;
public class PlayerStat {
public String name;
public int statVal = 0;
public int statVal;
public PlayerStat(String name, int value) {
this.name = name;

View File

@ -1,4 +1,7 @@
package com.gmail.nossr50.datatypes.database;
public enum PoolIdentifier {
MISC,
LOAD,
SAVE
}

View File

@ -20,8 +20,8 @@ import java.util.List;
import java.util.UUID;
public class Party {
private final LinkedHashMap<UUID, String> members = new LinkedHashMap<UUID, String>();
private final List<Player> onlineMembers = new ArrayList<Player>();
private final LinkedHashMap<UUID, String> members = new LinkedHashMap<>();
private final List<Player> onlineMembers = new ArrayList<>();
private PartyLeader leader;
private String name;
@ -90,7 +90,7 @@ public class Party {
public List<String> getOnlinePlayerNames(CommandSender sender) {
Player player = sender instanceof Player ? (Player) sender : null;
List<String> onlinePlayerNames = new ArrayList<String>();
List<String> onlinePlayerNames = new ArrayList<>();
for (Player onlinePlayer : getOnlineMembers()) {
if (player != null && player.canSee(onlinePlayer)) {
@ -130,7 +130,7 @@ public class Party {
}
public List<String> getItemShareCategories() {
List<String> shareCategories = new ArrayList<String>();
List<String> shareCategories = new ArrayList<>();
for (ItemShareType shareType : ItemShareType.values()) {
if (sharingDrops(shareType)) {

View File

@ -67,7 +67,7 @@ public class McMMOPlayer {
private Player player;
private PlayerProfile profile;
private final Map<PrimarySkillType, SkillManager> skillManagers = new HashMap<PrimarySkillType, SkillManager>();
private final Map<PrimarySkillType, SkillManager> skillManagers = new HashMap<>();
private ExperienceBarManager experienceBarManager;
private Party party;
@ -85,10 +85,10 @@ public class McMMOPlayer {
private boolean godMode;
private boolean chatSpy = false; //Off by default
private final Map<SuperAbilityType, Boolean> abilityMode = new HashMap<SuperAbilityType, Boolean>();
private final Map<SuperAbilityType, Boolean> abilityInformed = new HashMap<SuperAbilityType, Boolean>();
private final Map<SuperAbilityType, Boolean> abilityMode = new HashMap<>();
private final Map<SuperAbilityType, Boolean> abilityInformed = new HashMap<>();
private final Map<ToolType, Boolean> toolMode = new HashMap<ToolType, Boolean>();
private final Map<ToolType, Boolean> toolMode = new HashMap<>();
private int recentlyHurt;
private int respawnATS;

View File

@ -29,14 +29,14 @@ public class PlayerProfile {
private int scoreboardTipsShown;
/* Skill Data */
private final Map<PrimarySkillType, Integer> skills = new HashMap<PrimarySkillType, Integer>(); // Skill & Level
private final Map<PrimarySkillType, Float> skillsXp = new HashMap<PrimarySkillType, Float>(); // Skill & XP
private final Map<SuperAbilityType, Integer> abilityDATS = new HashMap<SuperAbilityType, Integer>(); // Ability & Cooldown
private final Map<PrimarySkillType, Integer> skills = new HashMap<>(); // Skill & Level
private final Map<PrimarySkillType, Float> skillsXp = new HashMap<>(); // Skill & XP
private final Map<SuperAbilityType, Integer> abilityDATS = new HashMap<>(); // Ability & Cooldown
private final Map<UniqueDataType, Integer> uniquePlayerData = new HashMap<>(); //Misc data that doesn't fit into other categories (chimaera wing, etc..)
// Store previous XP gains for deminished returns
private DelayQueue<SkillXpGain> gainedSkillsXp = new DelayQueue<SkillXpGain>();
private HashMap<PrimarySkillType, Float> rollingSkillsXp = new HashMap<PrimarySkillType, Float>();
private DelayQueue<SkillXpGain> gainedSkillsXp = new DelayQueue<>();
private HashMap<PrimarySkillType, Float> rollingSkillsXp = new HashMap<>();
@Deprecated
public PlayerProfile(String playerName) {

View File

@ -3,5 +3,5 @@ package com.gmail.nossr50.datatypes.skills;
public enum ItemType {
ARMOR,
TOOL,
OTHER;
OTHER
}

View File

@ -82,9 +82,9 @@ public enum PrimarySkillType {
public static final List<PrimarySkillType> MISC_SKILLS = ImmutableList.of(ACROBATICS, ALCHEMY, REPAIR, SALVAGE, SMELTING);
static {
List<PrimarySkillType> childSkills = new ArrayList<PrimarySkillType>();
List<PrimarySkillType> nonChildSkills = new ArrayList<PrimarySkillType>();
ArrayList<String> names = new ArrayList<String>();
List<PrimarySkillType> childSkills = new ArrayList<>();
List<PrimarySkillType> nonChildSkills = new ArrayList<>();
ArrayList<String> names = new ArrayList<>();
ArrayList<String> subSkillNames = new ArrayList<>();
for (PrimarySkillType skill : values()) {
@ -110,11 +110,11 @@ public enum PrimarySkillType {
NON_CHILD_SKILLS = ImmutableList.copyOf(nonChildSkills);
}
private PrimarySkillType(Class<? extends SkillManager> managerClass, Color runescapeColor, List<SubSkillType> subSkillTypes) {
PrimarySkillType(Class<? extends SkillManager> managerClass, Color runescapeColor, List<SubSkillType> subSkillTypes) {
this(managerClass, runescapeColor, null, null, subSkillTypes);
}
private PrimarySkillType(Class<? extends SkillManager> managerClass, Color runescapeColor, SuperAbilityType ability, ToolType tool, List<SubSkillType> subSkillTypes) {
PrimarySkillType(Class<? extends SkillManager> managerClass, Color runescapeColor, SuperAbilityType ability, ToolType tool, List<SubSkillType> subSkillTypes) {
this.managerClass = managerClass;
this.runescapeColor = runescapeColor;
this.ability = ability;

View File

@ -182,7 +182,7 @@ public enum SubSkillType {
/*
* Find where to begin our substring (after the prefix)
*/
String endResult = "";
StringBuilder endResult = new StringBuilder();
int subStringIndex = getSubStringIndex(subSkillName);
/*
@ -191,24 +191,24 @@ public enum SubSkillType {
String subskillNameWithoutPrefix = subSkillName.substring(subStringIndex);
if(subskillNameWithoutPrefix.contains("_"))
{
String splitStrings[] = subskillNameWithoutPrefix.split("_");
String[] splitStrings = subskillNameWithoutPrefix.split("_");
for(String string : splitStrings)
{
endResult += StringUtils.getCapitalized(string);
endResult.append(StringUtils.getCapitalized(string));
}
} else {
endResult += StringUtils.getCapitalized(subskillNameWithoutPrefix);
endResult.append(StringUtils.getCapitalized(subskillNameWithoutPrefix));
}
return endResult;
return endResult.toString();
}
public String getWikiName(String subSkillName) {
/*
* Find where to begin our substring (after the prefix)
*/
String endResult = "";
StringBuilder endResult = new StringBuilder();
int subStringIndex = getSubStringIndex(subSkillName);
/*
@ -217,22 +217,22 @@ public enum SubSkillType {
String subskillNameWithoutPrefix = subSkillName.substring(subStringIndex);
if(subskillNameWithoutPrefix.contains("_"))
{
String splitStrings[] = subskillNameWithoutPrefix.split("_");
String[] splitStrings = subskillNameWithoutPrefix.split("_");
for(int i = 0; i < splitStrings.length; i++)
{
if(i+1 >= splitStrings.length)
endResult+=StringUtils.getCapitalized(splitStrings[i]);
endResult.append(StringUtils.getCapitalized(splitStrings[i]));
else {
endResult += StringUtils.getCapitalized(splitStrings[i]);
endResult += "_";
endResult.append(StringUtils.getCapitalized(splitStrings[i]));
endResult.append("_");
}
}
} else {
endResult += StringUtils.getCapitalized(subskillNameWithoutPrefix);
endResult.append(StringUtils.getCapitalized(subskillNameWithoutPrefix));
}
return endResult;
return endResult.toString();
}
/**

View File

@ -91,7 +91,7 @@ public enum SuperAbilityType {
private String abilityPlayerOff;
private SubSkillType subSkillTypeDefinition;
private SuperAbilityType(String abilityOn, String abilityOff, String abilityPlayer, String abilityRefresh, String abilityPlayerOff) {
SuperAbilityType(String abilityOn, String abilityOff, String abilityPlayer, String abilityRefresh, String abilityPlayerOff) {
this.abilityOn = abilityOn;
this.abilityOff = abilityOff;
this.abilityPlayer = abilityPlayer;

View File

@ -15,7 +15,7 @@ public enum ToolType {
private String lowerTool;
private String raiseTool;
private ToolType(String lowerTool, String raiseTool) {
ToolType(String lowerTool, String raiseTool) {
this.lowerTool = lowerTool;
this.raiseTool = raiseTool;
}

View File

@ -16,7 +16,7 @@ public enum PotionStage {
int numerical;
private PotionStage(int numerical) {
PotionStage(int numerical) {
this.numerical = numerical;
}

View File

@ -23,7 +23,7 @@ public class FakeEntityDamageByEntityEvent extends EntityDamageByEntityEvent {
}
public static EnumMap<DamageModifier, Function<? super Double, Double>> getFunctionModifiers(Map<DamageModifier, Double> modifiers) {
EnumMap<DamageModifier, Function<? super Double, Double>> modifierFunctions = new EnumMap<DamageModifier, Function<? super Double, Double>>(DamageModifier.class);
EnumMap<DamageModifier, Function<? super Double, Double>> modifierFunctions = new EnumMap<>(DamageModifier.class);
Function<? super Double, Double> ZERO = Functions.constant(-0.0);
for (DamageModifier modifier : modifiers.keySet()) {

View File

@ -23,7 +23,7 @@ public class FakeEntityDamageEvent extends EntityDamageEvent {
}
public static EnumMap<DamageModifier, Function<? super Double, Double>> getFunctionModifiers(Map<DamageModifier, Double> modifiers) {
EnumMap<DamageModifier, Function<? super Double, Double>> modifierFunctions = new EnumMap<DamageModifier, Function<? super Double, Double>>(DamageModifier.class);
EnumMap<DamageModifier, Function<? super Double, Double>> modifierFunctions = new EnumMap<>(DamageModifier.class);
Function<? super Double, Double> ZERO = Functions.constant(-0.0);
for (DamageModifier modifier : modifiers.keySet()) {

View File

@ -62,7 +62,7 @@ public class McMMOPartyAllianceChangeEvent extends PlayerEvent implements Cancel
/**
* Any reason that doesn't fit elsewhere.
*/
CUSTOM;
CUSTOM
}
/** Following are required for Cancellable **/

View File

@ -75,7 +75,7 @@ public class McMMOPartyChangeEvent extends PlayerEvent implements Cancellable {
/**
* Any reason that doesn't fit elsewhere.
*/
CUSTOM;
CUSTOM
}
/** Following are required for Cancellable **/

View File

@ -172,7 +172,7 @@ public class BlockListener implements Listener {
BlockFace direction = event.getDirection();
Block movedBlock = event.getBlock();
movedBlock = movedBlock.getRelative(direction, 2);
// movedBlock = movedBlock.getRelative(direction, 2);
for (Block b : event.getBlocks()) {
if (BlockUtils.shouldBeWatched(b.getState())) {

View File

@ -36,8 +36,7 @@ public class InteractionManager {
subSkillList.add(abstractSubSkill);
//Init ArrayList
if(interactRegister.get(abstractSubSkill.getInteractType()) == null)
interactRegister.put(abstractSubSkill.getInteractType(), new ArrayList<>());
interactRegister.computeIfAbsent(abstractSubSkill.getInteractType(), k -> new ArrayList<>());
//Registration array reference
ArrayList<Interaction> arrayRef = interactRegister.get(abstractSubSkill.getInteractType());
@ -48,8 +47,7 @@ public class InteractionManager {
String lowerCaseName = abstractSubSkill.getConfigKeyName().toLowerCase();
//Register in name map
if(subSkillNameMap.get(lowerCaseName) == null)
subSkillNameMap.put(lowerCaseName, abstractSubSkill);
subSkillNameMap.putIfAbsent(lowerCaseName, abstractSubSkill);
System.out.println("[mcMMO] registered subskill: "+ abstractSubSkill.getConfigKeyName());
}

View File

@ -13,7 +13,7 @@ public final class LocaleLoader {
private static ResourceBundle bundle = null;
private static ResourceBundle enBundle = null;
private LocaleLoader() {};
private LocaleLoader() {}
public static String getString(String key) {
return getString(key, (Object[]) null);

View File

@ -554,7 +554,7 @@ public class mcMMO extends JavaPlugin {
new CleanBackupsTask().runTaskAsynchronously(mcMMO.p);
// Bleed timer (Runs every 0.5 seconds)
new BleedTimerTask().runTaskTimer(this, 1 * Misc.TICK_CONVERSION_FACTOR, 1 * (Misc.TICK_CONVERSION_FACTOR / 2));
new BleedTimerTask().runTaskTimer(this, Misc.TICK_CONVERSION_FACTOR, (Misc.TICK_CONVERSION_FACTOR / 2));
// Old & Powerless User remover
long purgeIntervalTicks = getConfigManager().getConfigDatabase().getConfigSectionCleaning().getPurgeInterval() * 60L * 60L * Misc.TICK_CONVERSION_FACTOR;

View File

@ -29,7 +29,7 @@ import java.util.UUID;
public final class PartyManager {
private static String partiesFilePath = mcMMO.getFlatFileDirectory() + "parties.yml";
private static List<Party> parties = new ArrayList<Party>();
private static List<Party> parties = new ArrayList<>();
private static File partyFile = new File(partiesFilePath);
private PartyManager() {}
@ -145,7 +145,7 @@ public final class PartyManager {
* @return the near party members
*/
public static List<Player> getNearMembers(McMMOPlayer mcMMOPlayer) {
List<Player> nearMembers = new ArrayList<Player>();
List<Player> nearMembers = new ArrayList<>();
Party party = mcMMOPlayer.getParty();
if (party != null) {
@ -163,7 +163,7 @@ public final class PartyManager {
}
public static List<Player> getNearVisibleMembers(McMMOPlayer mcMMOPlayer) {
List<Player> nearMembers = new ArrayList<Player>();
List<Player> nearMembers = new ArrayList<>();
Party party = mcMMOPlayer.getParty();
if (party != null) {
@ -192,7 +192,7 @@ public final class PartyManager {
public static LinkedHashMap<UUID, String> getAllMembers(Player player) {
Party party = getParty(player);
return party == null ? new LinkedHashMap<UUID, String>() : party.getMembers();
return party == null ? new LinkedHashMap<>() : party.getMembers();
}
/**
@ -216,7 +216,7 @@ public final class PartyManager {
}
private static List<Player> getOnlineMembers(Party party) {
return party == null ? new ArrayList<Player>() : party.getOnlineMembers();
return party == null ? new ArrayList<>() : party.getOnlineMembers();
}
/**
@ -589,7 +589,7 @@ public final class PartyManager {
YamlConfiguration partiesFile = YamlConfiguration.loadConfiguration(partyFile);
ArrayList<Party> hasAlly = new ArrayList<Party>();
ArrayList<Party> hasAlly = new ArrayList<>();
for (String partyName : partiesFile.getConfigurationSection("").getKeys(false)) {
Party party = new Party(partyName);
@ -659,7 +659,7 @@ public final class PartyManager {
partiesFile.set(partyName + ".ItemShareType." + itemShareType.toString(), party.sharingDrops(itemShareType));
}
List<String> members = new ArrayList<String>();
List<String> members = new ArrayList<>();
for (Entry<UUID, String> memberEntry : party.getMembers().entrySet()) {
String memberUniqueId = memberEntry.getKey() == null ? "" : memberEntry.getKey().toString();

View File

@ -1,23 +1,23 @@
package com.gmail.nossr50.runnables;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.runnables.skills.AprilTask;
import com.gmail.nossr50.util.Misc;
import org.bukkit.scheduler.BukkitRunnable;
public class CheckDateTask extends BukkitRunnable {
@Override
public void run() {
if (!mcMMO.getHolidayManager().isAprilFirst()) {
return;
}
// Set up jokes
new AprilTask().runTaskTimer(mcMMO.p, 1L * 60L * Misc.TICK_CONVERSION_FACTOR, 10L * 60L * Misc.TICK_CONVERSION_FACTOR);
mcMMO.getHolidayManager().registerAprilCommand();
// Jokes deployed.
this.cancel();
}
}
//package com.gmail.nossr50.runnables;
//
//import com.gmail.nossr50.mcMMO;
//import com.gmail.nossr50.runnables.skills.AprilTask;
//import com.gmail.nossr50.util.Misc;
//import org.bukkit.scheduler.BukkitRunnable;
//
//public class CheckDateTask extends BukkitRunnable {
//
// @Override
// public void run() {
// if (!mcMMO.getHolidayManager().isAprilFirst()) {
// return;
// }
//
// // Set up jokes
// new AprilTask().runTaskTimer(mcMMO.p, 1L * 60L * Misc.TICK_CONVERSION_FACTOR, 10L * 60L * Misc.TICK_CONVERSION_FACTOR);
// mcMMO.getHolidayManager().registerAprilCommand();
//
// // Jokes deployed.
// this.cancel();
// }
//}

View File

@ -18,9 +18,9 @@ public class CleanBackupsTask extends BukkitRunnable {
@Override
public void run() {
List<Integer> savedDays = new ArrayList<Integer>();
HashMap<Integer, List<Integer>> savedYearsWeeks = new HashMap<Integer, List<Integer>>();
List<File> toDelete = new ArrayList<File>();
List<Integer> savedDays = new ArrayList<>();
HashMap<Integer, List<Integer>> savedYearsWeeks = new HashMap<>();
List<File> toDelete = new ArrayList<>();
int amountTotal = 0;
int amountDeleted = 0;
int oldFileAgeLimit = mcMMO.getConfigManager().getConfigAutomatedBackups().getBackupDayLimit();

View File

@ -21,11 +21,6 @@ public class DatabaseConversionTask extends BukkitRunnable {
public void run() {
sourceDatabase.convertUsers(mcMMO.getDatabaseManager());
mcMMO.p.getServer().getScheduler().runTask(mcMMO.p, new Runnable() {
@Override
public void run() {
sender.sendMessage(message);
}
});
mcMMO.p.getServer().getScheduler().runTask(mcMMO.p, () -> sender.sendMessage(message));
}
}

View File

@ -17,8 +17,8 @@ public class PartyAutoKickTask extends BukkitRunnable {
@Override
public void run() {
HashMap<OfflinePlayer, Party> toRemove = new HashMap<OfflinePlayer, Party>();
List<UUID> processedPlayers = new ArrayList<UUID>();
HashMap<OfflinePlayer, Party> toRemove = new HashMap<>();
List<UUID> processedPlayers = new ArrayList<>();
long currentTime = System.currentTimeMillis();

View File

@ -82,7 +82,7 @@ public class PlayerProfileLoadingTask extends BukkitRunnable {
if (mcMMO.getScoreboardSettings().getShowStatsAfterLogin()) {
ScoreboardManager.enablePlayerStatsScoreboard(player);
new McScoreboardKeepTask(player).runTaskLater(mcMMO.p, 1 * Misc.TICK_CONVERSION_FACTOR);
new McScoreboardKeepTask(player).runTaskLater(mcMMO.p, Misc.TICK_CONVERSION_FACTOR);
}
}

View File

@ -20,7 +20,7 @@ import java.util.Map;
import java.util.Map.Entry;
public class BleedTimerTask extends BukkitRunnable {
private static Map<LivingEntity, BleedContainer> bleedList = new HashMap<LivingEntity, BleedContainer>();
private static Map<LivingEntity, BleedContainer> bleedList = new HashMap<>();
@Override
public void run() {

View File

@ -54,7 +54,7 @@ public final class Alchemy {
public static double catalysisMinSpeed = AdvancedConfig.getInstance().getCatalysisMinSpeed();
public static double catalysisMaxSpeed = AdvancedConfig.getInstance().getCatalysisMaxSpeed();
public static Map<Location, AlchemyBrewTask> brewingStandMap = new HashMap<Location, AlchemyBrewTask>();
public static Map<Location, AlchemyBrewTask> brewingStandMap = new HashMap<>();
private Alchemy() {}
@ -64,7 +64,7 @@ public final class Alchemy {
public static void finishAllBrews() {
mcMMO.p.debug("Completing " + brewingStandMap.size() + " unfinished Alchemy brews.");
List<AlchemyBrewTask> toFinish = new ArrayList<AlchemyBrewTask>();
List<AlchemyBrewTask> toFinish = new ArrayList<>();
toFinish.addAll(brewingStandMap.values());

View File

@ -108,7 +108,7 @@ public final class AlchemyPotionBrewer {
return;
}
List<AlchemyPotion> inputList = new ArrayList<AlchemyPotion>();
List<AlchemyPotion> inputList = new ArrayList<>();
for (int i = 0; i < 3; i++) {
ItemStack item = inventory.getItem(i);

View File

@ -25,7 +25,7 @@ public class Archery {
public Archery()
{
List<TrackedEntity> trackedEntities = new ArrayList<TrackedEntity>();
List<TrackedEntity> trackedEntities = new ArrayList<>();
skillShotMaxBonusDamage = AdvancedConfig.getInstance().getSkillShotDamageMax();

View File

@ -21,7 +21,7 @@ public class Excavation {
String friendly = StringUtils.getFriendlyConfigBlockDataString(blockState.getBlockData());
if (ExcavationTreasureConfig.getInstance().excavationMap.containsKey(friendly))
return ExcavationTreasureConfig.getInstance().excavationMap.get(friendly);
return new ArrayList<ExcavationTreasure>();
return new ArrayList<>();
}
protected static int getBlockXP(BlockState blockState) {

View File

@ -16,7 +16,7 @@ import java.util.Set;
public final class Fishing {
protected static final HashMap<Material, List<Enchantment>> ENCHANTABLE_CACHE = new HashMap<Material, List<Enchantment>>();
protected static final HashMap<Material, List<Enchantment>> ENCHANTABLE_CACHE = new HashMap<>();
/*public static int fishermansDietRankLevel1 = AdvancedConfig.getInstance().getFishermanDietRankChange();
public static int fishermansDietRankLevel2 = fishermansDietRankLevel1 * 2;

View File

@ -53,7 +53,6 @@ public class FishingManager extends SkillManager {
private long lastWarned = 0L;
private long lastWarnedExhaust = 0L;
private BoundingBox lastFishingBoundingBox;
private Item fishingCatch;
private Location hookLocation;
private int fishCaughtCounter = 1;
private final float boundingBoxSize;
@ -87,7 +86,7 @@ public class FishingManager extends SkillManager {
getPlayer().getInventory().getItemInMainHand().setDurability((short) (getPlayer().getInventory().getItemInMainHand().getDurability() + 5));
getPlayer().updateInventory();
if(lastWarnedExhaust + (1000 * 1) < currentTime)
if(lastWarnedExhaust + (1000) < currentTime)
{
getPlayer().sendMessage(LocaleLoader.getString("Fishing.Exhausting"));
lastWarnedExhaust = currentTime;
@ -114,7 +113,7 @@ public class FishingManager extends SkillManager {
long fishHookSpawnCD = fishHookSpawnTimestamp + 1000;
boolean hasFished = (currentTime < fishHookSpawnCD);
if(hasFished && (lastWarned + (1000 * 1) < currentTime))
if(hasFished && (lastWarned + (1000) < currentTime))
{
getPlayer().sendMessage(LocaleLoader.getString("Fishing.Scared"));
lastWarned = System.currentTimeMillis();
@ -286,7 +285,6 @@ public class FishingManager extends SkillManager {
* @param fishingCatch The {@link Item} initially caught
*/
public void handleFishing(Item fishingCatch) {
this.fishingCatch = fishingCatch;
int fishXp = ExperienceConfig.getInstance().getXp(PrimarySkillType.FISHING, fishingCatch.getItemStack().getType());
int treasureXp = 0;
Player player = getPlayer();
@ -294,12 +292,11 @@ public class FishingManager extends SkillManager {
if (MainConfig.getInstance().getFishingDropsEnabled() && Permissions.isSubSkillEnabled(player, SubSkillType.FISHING_TREASURE_HUNTER)) {
treasure = getFishingTreasure();
this.fishingCatch = null;
}
if (treasure != null) {
ItemStack treasureDrop = treasure.getDrop().clone(); // Not cloning is bad, m'kay?
Map<Enchantment, Integer> enchants = new HashMap<Enchantment, Integer>();
Map<Enchantment, Integer> enchants = new HashMap<>();
if (isMagicHunterEnabled()
&& ItemUtils.isEnchantable(treasureDrop)) {
@ -517,7 +514,7 @@ public class FishingManager extends SkillManager {
* @return true if the item has been enchanted
*/
private Map<Enchantment, Integer> handleMagicHunter(ItemStack treasureDrop) {
Map<Enchantment, Integer> enchants = new HashMap<Enchantment, Integer>();
Map<Enchantment, Integer> enchants = new HashMap<>();
List<EnchantmentTreasure> fishingEnchantments = null;
double diceRoll = Misc.getRandom().nextDouble() * 100;
@ -547,7 +544,7 @@ public class FishingManager extends SkillManager {
}
List<Enchantment> validEnchantments = getPossibleEnchantments(treasureDrop);
List<EnchantmentTreasure> possibleEnchants = new ArrayList<EnchantmentTreasure>();
List<EnchantmentTreasure> possibleEnchants = new ArrayList<>();
for (EnchantmentTreasure enchantmentTreasure : fishingEnchantments) {
if (validEnchantments.contains(enchantmentTreasure.getEnchantment())) {
@ -586,7 +583,7 @@ public class FishingManager extends SkillManager {
return Fishing.ENCHANTABLE_CACHE.get(dropType);
}
List<Enchantment> possibleEnchantments = new ArrayList<Enchantment>();
List<Enchantment> possibleEnchantments = new ArrayList<>();
for (Enchantment enchantment : Enchantment.values()) {
if (enchantment.canEnchantItem(treasureDrop)) {

View File

@ -282,7 +282,7 @@ public class HerbalismManager extends SkillManager {
Player player = getPlayer();
PlayerInventory playerInventory = player.getInventory();
Material seed = null;
Material seed;
switch (blockState.getType()) {
case CARROTS:

View File

@ -130,8 +130,8 @@ public class MiningManager extends SkillManager {
* @param blockList The list of blocks to drop
*/
public void blastMiningDropProcessing(float yield, List<Block> blockList) {
List<BlockState> ores = new ArrayList<BlockState>();
List<BlockState> debris = new ArrayList<BlockState>();
List<BlockState> ores = new ArrayList<>();
List<BlockState> debris = new ArrayList<>();
int xp = 0;
float oreBonus = (float) (getOreBonus() / 100);
@ -263,7 +263,7 @@ public class MiningManager extends SkillManager {
if (timeRemaining > 0) {
//getPlayer().sendMessage(LocaleLoader.getString("Skills.TooTired", timeRemaining));
NotificationManager.sendPlayerInformation(getPlayer(), NotificationType.ABILITY_COOLDOWN, "Skills.TooTired", String.valueOf("timeRemaining"));
NotificationManager.sendPlayerInformation(getPlayer(), NotificationType.ABILITY_COOLDOWN, "Skills.TooTired", String.valueOf(timeRemaining));
return false;
}

View File

@ -6,6 +6,7 @@ import com.gmail.nossr50.util.ItemUtils;
import org.bukkit.Material;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@ -19,7 +20,7 @@ public class Repairable {
private final double xpMultiplier;
public Repairable(Material itemMaterial, Material repairMaterial, int minimumQuantity, int minimumLevel, double xpMultiplier) {
this(itemMaterial.getKey().getKey(), ItemUtils.getRepairItemMaterials(Arrays.asList(repairMaterial)), minimumQuantity, minimumLevel, xpMultiplier);
this(itemMaterial.getKey().getKey(), ItemUtils.getRepairItemMaterials(Collections.singletonList(repairMaterial)), minimumQuantity, minimumLevel, xpMultiplier);
}
public Repairable(Material itemMaterial, List<Material> repairMaterials, int minimumQuantity, int minimumLevel, double xpMultiplier) {

View File

@ -16,7 +16,7 @@ public class RepairableManager implements Unload {
}
public RepairableManager(List<Repairable> repairablesCollection) {
this.repairables = new HashMap<Material, Repairable>(repairablesCollection.size());
this.repairables = new HashMap<>(repairablesCollection.size());
registerRepairables(repairablesCollection);
}

View File

@ -143,7 +143,7 @@ public class SalvageManager extends SkillManager {
}*/
public int getSalvageableAmount() {
return (RankUtils.getRank(getPlayer(), SubSkillType.SALVAGE_ARCANE_SALVAGE) * 1);
return (RankUtils.getRank(getPlayer(), SubSkillType.SALVAGE_ARCANE_SALVAGE));
}
/**

View File

@ -21,7 +21,7 @@ public class SalvageableManager implements Unload {
}
public SalvageableManager(List<Salvageable> salvageablesCollection) {
this.salvageables = new HashMap<Material, Salvageable>(salvageablesCollection.size());
this.salvageables = new HashMap<>(salvageablesCollection.size());
registerSalvageables(salvageablesCollection);
}

View File

@ -37,7 +37,7 @@ public class TamingManager extends SkillManager {
super(mcMMOPlayer, PrimarySkillType.TAMING);
}
private static HashMap<EntityType, List<TrackedTamingEntity>> summonedEntities = new HashMap<EntityType, List<TrackedTamingEntity>>();
private static HashMap<EntityType, List<TrackedTamingEntity>> summonedEntities = new HashMap<>();
public boolean canUseThickFur() {
return RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_THICK_FUR)
@ -384,7 +384,7 @@ public class TamingManager extends SkillManager {
TrackedTamingEntity trackedEntity = new TrackedTamingEntity(livingEntity);
if (!summonedEntities.containsKey(livingEntity.getType())) {
summonedEntities.put(livingEntity.getType(), new ArrayList<TrackedTamingEntity>());
summonedEntities.put(livingEntity.getType(), new ArrayList<>());
}
summonedEntities.get(livingEntity.getType()).add(trackedEntity);

View File

@ -99,7 +99,7 @@ public final class Woodcutting {
* before taking measurements).
*/
protected static void processTree(BlockState blockState, Set<BlockState> treeFellerBlocks) {
List<BlockState> futureCenterBlocks = new ArrayList<BlockState>();
List<BlockState> futureCenterBlocks = new ArrayList<>();
// Check the block up and take different behavior (smaller search) if it's a log
if (handleBlock(blockState.getBlock().getRelative(BlockFace.UP).getState(), futureCenterBlocks, treeFellerBlocks)) {

View File

@ -75,7 +75,7 @@ public class WoodcuttingManager extends SkillManager {
*/
public void processTreeFeller(BlockState blockState) {
Player player = getPlayer();
Set<BlockState> treeFellerBlocks = new HashSet<BlockState>();
Set<BlockState> treeFellerBlocks = new HashSet<>();
Woodcutting.treeFellerReachedThreshold = false;

View File

@ -581,7 +581,7 @@ public final class BlockUtils {
* @return HashSet with the IDs of every transparent block
*/
public static HashSet<Material> getTransparentBlocks() {
HashSet<Material> transparentBlocks = new HashSet<Material>();
HashSet<Material> transparentBlocks = new HashSet<>();
for (Material material : Material.values()) {
if (material.isTransparent()) {

View File

@ -150,7 +150,7 @@ public final class ChimaeraWing {
ItemMeta itemMeta = itemStack.getItemMeta();
itemMeta.setDisplayName(ChatColor.GOLD + LocaleLoader.getString("Item.ChimaeraWing.Name"));
List<String> itemLore = new ArrayList<String>();
List<String> itemLore = new ArrayList<>();
itemLore.add("mcMMO Item");
itemLore.add(LocaleLoader.getString("Item.ChimaeraWing.Lore"));
itemMeta.setLore(itemLore);

View File

@ -6,7 +6,7 @@ import java.util.HashMap;
public class EnchantmentUtils {
private static final HashMap<String, Enchantment> enchants = new HashMap<String, Enchantment>();
private static final HashMap<String, Enchantment> enchants = new HashMap<>();
static {
enchants.put("SHARPNESS", Enchantment.DAMAGE_ALL);

View File

@ -20,8 +20,8 @@ public final class HardcoreManager {
PlayerProfile playerProfile = UserManager.getPlayer(player).getProfile();
int totalLevelsLost = 0;
HashMap<String, Integer> levelChanged = new HashMap<String, Integer>();
HashMap<String, Float> experienceChanged = new HashMap<String, Float>();
HashMap<String, Integer> levelChanged = new HashMap<>();
HashMap<String, Float> experienceChanged = new HashMap<>();
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
if (!primarySkillType.getHardcoreStatLossEnabled()) {
@ -63,8 +63,8 @@ public final class HardcoreManager {
PlayerProfile victimProfile = UserManager.getPlayer(victim).getProfile();
int totalLevelsStolen = 0;
HashMap<String, Integer> levelChanged = new HashMap<String, Integer>();
HashMap<String, Float> experienceChanged = new HashMap<String, Float>();
HashMap<String, Integer> levelChanged = new HashMap<>();
HashMap<String, Float> experienceChanged = new HashMap<>();
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
if (!primarySkillType.getHardcoreVampirismEnabled()) {

View File

@ -40,7 +40,7 @@ public final class Misc {
public static final Set<String> modNames = ImmutableSet.of("LOTR", "BUILDCRAFT", "ENDERIO", "ENHANCEDBIOMES", "IC2", "METALLURGY", "FORESTRY", "GALACTICRAFT", "RAILCRAFT", "TWILIGHTFOREST", "THAUMCRAFT", "GRAVESTONEMOD", "GROWTHCRAFT", "ARCTICMOBS", "DEMONMOBS", "INFERNOMOBS", "SWAMPMOBS", "MARICULTURE", "MINESTRAPPOLATION");
private Misc() {};
private Misc() {}
public static boolean isNPCEntity(Entity entity) {
return (entity == null || entity.hasMetadata("NPC") || entity instanceof NPC || entity.getClass().getName().equalsIgnoreCase("cofh.entity.PlayerFake"));

View File

@ -127,19 +127,19 @@ public final class MobHealthbarUtils {
int coloredDisplay = (int) Math.ceil(fullDisplay * (healthPercentage / 100.0D));
int grayDisplay = fullDisplay - coloredDisplay;
String healthbar = color + "";
StringBuilder healthbar = new StringBuilder(color + "");
for (int i = 0; i < coloredDisplay; i++) {
healthbar += symbol;
healthbar.append(symbol);
}
healthbar += ChatColor.GRAY;
healthbar.append(ChatColor.GRAY);
for (int i = 0; i < grayDisplay; i++) {
healthbar += symbol;
healthbar.append(symbol);
}
return healthbar;
return healthbar.toString();
}
/**

View File

@ -10,8 +10,8 @@ public class BiomeAdapter {
static {
List<Biome> allBiomes = Arrays.asList(Biome.values());
List<Biome> waterBiomes = new ArrayList<Biome>();
List<Biome> iceBiomes = new ArrayList<Biome>();
List<Biome> waterBiomes = new ArrayList<>();
List<Biome> iceBiomes = new ArrayList<>();
for (Biome biome : allBiomes) {
if (isWater(biome.name()) && !isCold(biome.name())) {
waterBiomes.add(biome);

View File

@ -12,7 +12,7 @@ public interface ChunkletManager {
* @param cz Chunklet Z coordinate that needs to be loaded
* @param world World that the chunklet needs to be loaded in
*/
public void loadChunklet(int cx, int cy, int cz, World world);
void loadChunklet(int cx, int cy, int cz, World world);
/**
* Unload a specific chunklet
@ -22,7 +22,7 @@ public interface ChunkletManager {
* @param cz Chunklet Z coordinate that needs to be unloaded
* @param world World that the chunklet needs to be unloaded from
*/
public void unloadChunklet(int cx, int cy, int cz, World world);
void unloadChunklet(int cx, int cy, int cz, World world);
/**
* Load a given Chunk's Chunklet data
@ -31,7 +31,7 @@ public interface ChunkletManager {
* @param cz Chunk Z coordinate that is to be loaded
* @param world World that the Chunk is in
*/
public void loadChunk(int cx, int cz, World world);
void loadChunk(int cx, int cz, World world);
/**
* Unload a given Chunk's Chunklet data
@ -40,7 +40,7 @@ public interface ChunkletManager {
* @param cz Chunk Z coordinate that is to be unloaded
* @param world World that the Chunk is in
*/
public void unloadChunk(int cx, int cz, World world);
void unloadChunk(int cx, int cz, World world);
/**
* Informs the ChunkletManager a chunk is loaded
@ -49,7 +49,7 @@ public interface ChunkletManager {
* @param cz Chunk Z coordinate that is loaded
* @param world World that the chunk was loaded in
*/
public void chunkLoaded(int cx, int cz, World world);
void chunkLoaded(int cx, int cz, World world);
/**
* Informs the ChunkletManager a chunk is unloaded
@ -58,38 +58,38 @@ public interface ChunkletManager {
* @param cz Chunk Z coordinate that is unloaded
* @param world World that the chunk was unloaded in
*/
public void chunkUnloaded(int cx, int cz, World world);
void chunkUnloaded(int cx, int cz, World world);
/**
* Save all ChunkletStores related to the given world
*
* @param world World to save
*/
public void saveWorld(World world);
void saveWorld(World world);
/**
* Unload all ChunkletStores from memory related to the given world after saving them
*
* @param world World to unload
*/
public void unloadWorld(World world);
void unloadWorld(World world);
/**
* Load all ChunkletStores from all loaded chunks from this world into memory
*
* @param world World to load
*/
public void loadWorld(World world);
void loadWorld(World world);
/**
* Save all ChunkletStores
*/
public void saveAll();
void saveAll();
/**
* Unload all ChunkletStores after saving them
*/
public void unloadAll();
void unloadAll();
/**
* Check to see if a given location is set to true
@ -100,7 +100,7 @@ public interface ChunkletManager {
* @param world World to check in
* @return true if the given location is set to true, false if otherwise
*/
public boolean isTrue(int x, int y, int z, World world);
boolean isTrue(int x, int y, int z, World world);
/**
* Check to see if a given block location is set to true
@ -108,7 +108,7 @@ public interface ChunkletManager {
* @param block Block location to check
* @return true if the given block location is set to true, false if otherwise
*/
public boolean isTrue(Block block);
boolean isTrue(Block block);
/**
* Set a given location to true, should create stores as necessary if the location does not exist
@ -118,14 +118,14 @@ public interface ChunkletManager {
* @param z Z coordinate to set
* @param world World to set in
*/
public void setTrue(int x, int y, int z, World world);
void setTrue(int x, int y, int z, World world);
/**
* Set a given block location to true, should create stores as necessary if the location does not exist
*
* @param block Block location to set
*/
public void setTrue(Block block);
void setTrue(Block block);
/**
* Set a given location to false, should not create stores if one does not exist for the given location
@ -135,17 +135,17 @@ public interface ChunkletManager {
* @param z Z coordinate to set
* @param world World to set in
*/
public void setFalse(int x, int y, int z, World world);
void setFalse(int x, int y, int z, World world);
/**
* Set a given block location to false, should not create stores if one does not exist for the given location
*
* @param block Block location to set
*/
public void setFalse(Block block);
void setFalse(Block block);
/**
* Delete any ChunkletStores that are empty
*/
public void cleanUp();
void cleanUp();
}

Some files were not shown because too many files have changed in this diff Show More