Second Smelt makes use of its own section in Bonus Drops in config.yml

Co-authored-by: t00thpick1 <t00thpick1dirko@gmail.com>
This commit is contained in:
nossr50 2020-07-13 12:31:30 -07:00
parent 7eae59a0b3
commit fdd951f1f1
176 changed files with 642 additions and 604 deletions

View File

@ -1,5 +1,16 @@
Version 2.1.134
Minor code cleanup
Smelting now has a Bonus Drops section in config.yml
Smelting now only doubles smelting results for items which have bonus drop entries in the config
Fixed a bug where players could set each other on fire when partied or when PVP was disabled
Fixed a NPE that could happen with thrown potions
Fixed a potential NPE when damaging player armor with Axes
Fixed a potential NPE when damaging a player with Blast Mining
Fixed a potential NPE when checking tools related to Super Abilities
Fixed a potential NPE when checking the Chimaera Wing
Fixed a potential NPE when creating party member lists
Fixed a potential NPE when fishing
Fixed a potential NPE when players right click blocks
Fixed a locale mistake in locale hu_HU
Fixed a locale mistake in locale ru
Changed the UUID updater task to not catastrophically fail when requests failed

View File

@ -185,7 +185,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

@ -10,13 +10,14 @@ import com.google.common.collect.ImmutableList;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class MHDCommand implements TabExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (mcMMO.getDatabaseManager() instanceof SQLDatabaseManager) {
SQLDatabaseManager m = (SQLDatabaseManager) mcMMO.getDatabaseManager();
m.resetMobHealthSettings();
@ -39,7 +40,7 @@ public class MHDCommand implements TabExecutor {
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
return ImmutableList.of();
}
}

View File

@ -7,6 +7,7 @@ import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
import java.io.*;
import java.util.ArrayList;
@ -17,7 +18,7 @@ public class McImportCommand implements CommandExecutor {
int fileAmount;
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 0) {
importModConfig();
return true;
@ -31,7 +32,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;
@ -63,11 +64,10 @@ 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);
continue;
}
}
catch (FileNotFoundException e) {
@ -91,13 +91,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);
@ -167,16 +167,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++;
}
@ -199,7 +193,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)) {
@ -218,7 +212,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);
@ -238,7 +232,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)) {
@ -263,7 +257,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);
@ -278,7 +272,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)) {
@ -297,7 +291,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);
@ -323,14 +317,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

@ -12,6 +12,7 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.util.StringUtil;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Collections;
@ -26,8 +27,8 @@ public class McconvertCommand implements TabExecutor {
private final 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());
@ -53,7 +54,7 @@ public class McconvertCommand implements TabExecutor {
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 2) {
if (args[0].equalsIgnoreCase("database") || args[0].equalsIgnoreCase("db")) {
return databaseConvertCommand.onCommand(sender, command, label, args);
@ -67,17 +68,17 @@ public class McconvertCommand implements TabExecutor {
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull 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

@ -9,10 +9,11 @@ import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
public class McmmoCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
switch (args.length) {
case 0:
if (!Permissions.mcmmoDescription(sender)) {

View File

@ -9,12 +9,13 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class McnotifyCommand implements TabExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (CommandUtils.noConsoleUsage(sender)) {
return true;
}
@ -34,7 +35,7 @@ public class McnotifyCommand implements TabExecutor {
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
return ImmutableList.of();
}
}

View File

@ -9,6 +9,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.util.StringUtil;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
@ -17,7 +18,7 @@ public class McscoreboardCommand implements TabExecutor {
private static final List<String> FIRST_ARGS = ImmutableList.of("keep", "time", "clear");
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (CommandUtils.noConsoleUsage(sender)) {
return true;
}
@ -69,9 +70,9 @@ public class McscoreboardCommand implements TabExecutor {
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
if (args.length == 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()));
}
return ImmutableList.of();
}

View File

@ -8,13 +8,14 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.util.StringUtil;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
public abstract class ToggleCommand implements TabExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
switch (args.length) {
case 0:
if (CommandUtils.noConsoleUsage(sender)) {
@ -60,10 +61,10 @@ public abstract class ToggleCommand implements TabExecutor {
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
if (args.length == 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()));
}
return ImmutableList.of();
}

View File

@ -16,6 +16,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.util.StringUtil;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
@ -24,7 +25,7 @@ public class XprateCommand implements TabExecutor {
private final double ORIGINAL_XP_RATE = ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier();
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
switch (args.length) {
case 1:
if (!args[0].equalsIgnoreCase("reset") && !args[0].equalsIgnoreCase("clear")) {
@ -116,16 +117,16 @@ public class XprateCommand implements TabExecutor {
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
switch (args.length) {
case 1:
if (StringUtils.isInt(args[0])) {
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

@ -5,13 +5,14 @@ import com.gmail.nossr50.util.Permissions;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
/**
* @author Mark Vainomaa
*/
public final class McmmoReloadLocaleCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 0) {
if (!Permissions.reloadlocale(sender)) {
sender.sendMessage(command.getPermissionMessage());

View File

@ -7,11 +7,12 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class PlayerDebugCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if(sender instanceof Player) {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer((Player) sender);
mcMMOPlayer.toggleDebugMode(); //Toggle debug mode

View File

@ -16,6 +16,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.bukkit.util.StringUtil;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
@ -30,7 +31,7 @@ public abstract class ChatCommand implements TabExecutor {
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
McMMOPlayer mcMMOPlayer;
switch (args.length) {
@ -88,9 +89,9 @@ public abstract class ChatCommand implements TabExecutor {
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
if (args.length == 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()));
}
return ImmutableList.of();
}

View File

@ -13,10 +13,11 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class ConvertDatabaseCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 2) {
DatabaseType previousType = DatabaseType.getDatabaseType(args[1]);
DatabaseType newType = mcMMO.getDatabaseManager().getDatabaseType();

View File

@ -7,12 +7,13 @@ import com.google.common.collect.ImmutableList;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class McpurgeCommand implements TabExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 0) {
mcMMO.getDatabaseManager().purgePowerlessUsers();
@ -27,7 +28,7 @@ public class McpurgeCommand implements TabExecutor {
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
return ImmutableList.of();
}
}

View File

@ -10,6 +10,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.util.StringUtil;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
@ -17,7 +18,7 @@ import java.util.UUID;
public class McremoveCommand implements TabExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 1) {
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
@ -43,10 +44,10 @@ public class McremoveCommand implements TabExecutor {
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
if (args.length == 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()));
}
return ImmutableList.of();
}

View File

@ -7,12 +7,13 @@ import com.google.common.collect.ImmutableList;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class MmoshowdbCommand implements TabExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 0) {
Class<?> clazz = DatabaseManagerFactory.getCustomDatabaseManagerClass();
@ -28,7 +29,7 @@ public class MmoshowdbCommand implements TabExecutor {
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
return ImmutableList.of();
}
}

View File

@ -10,12 +10,13 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.Locale;
public class ConvertExperienceCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 2) {
FormulaType previousType = mcMMO.getFormulaManager().getPreviousFormulaType();
FormulaType newType = FormulaType.getFormulaType(args[1].toUpperCase(Locale.ENGLISH));

View File

@ -14,6 +14,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.bukkit.util.StringUtil;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
@ -21,7 +22,7 @@ import java.util.UUID;
public abstract class ExperienceCommand implements TabExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
PrimarySkillType skill;
switch (args.length) {
@ -119,13 +120,13 @@ public abstract class ExperienceCommand implements TabExecutor {
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
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

@ -17,6 +17,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.bukkit.util.StringUtil;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
@ -28,7 +29,7 @@ import java.util.UUID;
*/
public class SkillresetCommand implements TabExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
PrimarySkillType skill;
switch (args.length) {
case 1:
@ -103,13 +104,13 @@ public class SkillresetCommand implements TabExecutor {
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
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

@ -9,6 +9,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.util.StringUtil;
import org.jetbrains.annotations.NotNull;
import java.text.DecimalFormat;
import java.util.ArrayList;
@ -18,7 +19,7 @@ public abstract class HardcoreModeCommand implements TabExecutor {
protected final DecimalFormat percent = new DecimalFormat("##0.00%");
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
switch (args.length) {
case 0:
if (!checkTogglePermissions(sender)) {
@ -108,13 +109,13 @@ public abstract class HardcoreModeCommand implements TabExecutor {
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
if (args.length == 1) {
if (StringUtils.isDouble(args[0])) {
return ImmutableList.of();
}
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()));
}
return ImmutableList.of();
}

View File

@ -8,10 +8,11 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class PartyAcceptCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 1) {
Player player = (Player) sender;

View File

@ -11,10 +11,11 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class PartyChangeOwnerCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 2) {//Check if player profile is loaded
if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));

View File

@ -7,10 +7,11 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class PartyChangePasswordCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if(UserManager.getPlayer((Player) sender) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));

View File

@ -16,6 +16,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.bukkit.util.StringUtil;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Arrays;
@ -28,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());
@ -58,7 +59,7 @@ public class PartyCommand implements TabExecutor {
private final CommandExecutor partyAllianceCommand = new PartyAllianceCommand();
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (CommandUtils.noConsoleUsage(sender)) {
return true;
}
@ -171,10 +172,10 @@ public class PartyCommand implements TabExecutor {
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull 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]);
@ -188,18 +189,18 @@ 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;
@ -214,7 +215,7 @@ public class PartyCommand implements TabExecutor {
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;
@ -223,7 +224,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

@ -8,10 +8,11 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class PartyCreateCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
switch (args.length) {
case 2:
case 3:

View File

@ -9,10 +9,11 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class PartyDisbandCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 1) {
if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));

View File

@ -4,11 +4,12 @@ import com.gmail.nossr50.locale.LocaleLoader;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
public class PartyHelpCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 1) {
sender.sendMessage(LocaleLoader.getString("Party.Help.3", "/party join", "/party quit"));
sender.sendMessage(LocaleLoader.getString("Party.Help.1", "/party create"));

View File

@ -13,13 +13,14 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
public class PartyInfoCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
switch (args.length) {
case 0:
case 1:
@ -60,8 +61,8 @@ public class PartyInfoCommand implements CommandExecutor {
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

@ -11,10 +11,11 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class PartyInviteCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 2) {
String targetName = CommandUtils.getMatchedPlayerName(args[1]);
McMMOPlayer mcMMOTarget = UserManager.getOfflinePlayer(targetName);

View File

@ -13,12 +13,13 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.Locale;
public class PartyItemShareCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if(UserManager.getPlayer((Player) sender) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));

View File

@ -10,10 +10,11 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class PartyJoinCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
switch (args.length) {
case 2:
case 3:

View File

@ -12,10 +12,11 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class PartyKickCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 2) {
if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));

View File

@ -9,10 +9,11 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class PartyLockCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
switch (args.length) {
case 1:
if (args[0].equalsIgnoreCase("lock")) {

View File

@ -10,10 +10,11 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class PartyQuitCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 1) {
Player player = (Player) sender;

View File

@ -10,10 +10,11 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class PartyRenameCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 2) {
if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));

View File

@ -12,10 +12,11 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class PartyXpShareCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if(UserManager.getPlayer((Player) sender) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));

View File

@ -8,10 +8,11 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class PartyAllianceAcceptCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 2) {
if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));

View File

@ -16,6 +16,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.bukkit.util.StringUtil;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
@ -32,7 +33,7 @@ public class PartyAllianceCommand implements TabExecutor {
private final CommandExecutor partyAllianceDisbandCommand = new PartyAllianceDisbandCommand();
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (CommandUtils.noConsoleUsage(sender)) {
return true;
}
@ -108,13 +109,13 @@ public class PartyAllianceCommand implements TabExecutor {
}
@Override
public List<String> onTabComplete(CommandSender commandSender, Command command, String label, String[] args) {
public List<String> onTabComplete(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 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

@ -9,10 +9,11 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class PartyAllianceDisbandCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 2) {
if (UserManager.getPlayer((Player) sender) == null) {
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));

View File

@ -10,10 +10,11 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class PartyAllianceInviteCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 3) {
String targetName = CommandUtils.getMatchedPlayerName(args[2]);
McMMOPlayer mcMMOTarget = UserManager.getOfflinePlayer(targetName);

View File

@ -7,10 +7,11 @@ import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
public class PtpAcceptAnyCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (!Permissions.partyTeleportAcceptAll(sender)) {
sender.sendMessage(command.getPermissionMessage());
return true;

View File

@ -11,10 +11,11 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
public class PtpAcceptCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (!Permissions.partyTeleportAccept(sender)) {
sender.sendMessage(command.getPermissionMessage());
return true;

View File

@ -26,6 +26,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.bukkit.util.StringUtil;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
@ -38,7 +39,7 @@ public class PtpCommand implements TabExecutor {
private final CommandExecutor ptpAcceptCommand = new PtpAcceptCommand();
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (CommandUtils.noConsoleUsage(sender)) {
return true;
}
@ -129,9 +130,9 @@ public class PtpCommand implements TabExecutor {
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
if (args.length == 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) {
if (UserManager.getPlayer((Player) sender) == null) {
@ -147,7 +148,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

@ -7,10 +7,11 @@ import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
public class PtpToggleCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (!Permissions.partyTeleportToggle(sender)) {
sender.sendMessage(command.getPermissionMessage());
return true;

View File

@ -16,13 +16,14 @@ import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.bukkit.util.StringUtil;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
public class InspectCommand implements TabExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (args.length == 1) {
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
McMMOPlayer mcMMOPlayer = UserManager.getOfflinePlayer(playerName);
@ -91,10 +92,10 @@ public class InspectCommand implements TabExecutor {
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
if (args.length == 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()));
}
return ImmutableList.of();
}

View File

@ -12,12 +12,13 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class MccooldownCommand implements TabExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (CommandUtils.noConsoleUsage(sender)) {
return true;
}
@ -67,7 +68,7 @@ public class MccooldownCommand implements TabExecutor {
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
return ImmutableList.of();
}
}

View File

@ -15,13 +15,14 @@ import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.util.StringUtil;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
public class McrankCommand implements TabExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
switch (args.length) {
case 0:
if (CommandUtils.noConsoleUsage(sender)) {
@ -72,10 +73,10 @@ public class McrankCommand implements TabExecutor {
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
if (args.length == 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()));
}
return ImmutableList.of();
}

View File

@ -10,12 +10,13 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class McstatsCommand implements TabExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (CommandUtils.noConsoleUsage(sender)) {
return true;
}
@ -61,7 +62,7 @@ public class McstatsCommand implements TabExecutor {
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
return ImmutableList.of();
}
}

View File

@ -17,13 +17,14 @@ import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.util.StringUtil;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
public class MctopCommand implements TabExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
PrimarySkillType skill = null;
switch (args.length) {
@ -66,9 +67,9 @@ public class MctopCommand implements TabExecutor {
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
if (args.length == 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()));
}
return ImmutableList.of();
}
@ -88,7 +89,7 @@ public class MctopCommand implements TabExecutor {
long cooldownMillis = Math.max(Config.getInstance().getDatabasePlayerCooldown(), 1750);
if (mcMMOPlayer.getDatabaseATS() + cooldownMillis > System.currentTimeMillis()) {
double seconds = ((mcMMOPlayer.getDatabaseATS() + cooldownMillis) - System.currentTimeMillis()) / 1000;
double seconds = ((mcMMOPlayer.getDatabaseATS() + cooldownMillis) - System.currentTimeMillis()) / 1000.0D;
if (seconds < 1) {
seconds = 1;
}

View File

@ -103,7 +103,7 @@ public class XPBarCommand implements TabExecutor {
return StringUtil.copyPartialMatches(args[0], options, new ArrayList<>(ExperienceBarManager.XPBarSettingTarget.values().length));
case 2:
if(!args[0].equalsIgnoreCase(ExperienceBarManager.XPBarSettingTarget.RESET.toString()))
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

@ -3,13 +3,14 @@ package com.gmail.nossr50.commands.server;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
/**
* This command facilitates switching the skill system scale between classic and modern scale
*/
public class Mcmmoupgrade implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
return false;
}
}

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)

View File

@ -74,7 +74,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

@ -10,6 +10,7 @@ import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.text.DecimalFormat;
import java.util.ArrayList;
@ -22,7 +23,7 @@ public class AprilCommand implements TabExecutor {
protected DecimalFormat decimal = new DecimalFormat("##0.00");
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (CommandUtils.noConsoleUsage(sender)) {
return true;
}
@ -98,7 +99,7 @@ public class AprilCommand implements TabExecutor {
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
if (args.length == 1) {
return ImmutableList.of("?");
}
@ -106,7 +107,7 @@ public class AprilCommand implements TabExecutor {
}
private List<String> effectsDisplay(FakeSkillType fakeSkillType) {
List<String> messages = new ArrayList<String>();
List<String> messages = new ArrayList<>();
switch (fakeSkillType) {
case MACHO:
@ -152,7 +153,7 @@ public class AprilCommand implements TabExecutor {
}
private List<String> statsDisplay(FakeSkillType fakeSkillType) {
List<String> messages = new ArrayList<String>();
List<String> messages = new ArrayList<>();
switch (fakeSkillType) {
case MACHO:

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

@ -43,7 +43,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<>();
ExcavationManager excavationManager = UserManager.getPlayer(player).getExcavationManager();

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

@ -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

@ -13,6 +13,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.bukkit.util.StringUtil;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
@ -23,7 +24,7 @@ import java.util.List;
public class MmoInfoCommand implements TabExecutor {
@Override
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] args) {
public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s, String[] args) {
/*
* Only allow players to use this command
*/
@ -61,9 +62,9 @@ public class MmoInfoCommand implements TabExecutor {
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
if (args.length == 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()));
}
return ImmutableList.of();
}

View File

@ -91,7 +91,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 (canScrapCollector) {

View File

@ -26,6 +26,7 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import java.text.DecimalFormat;
import java.util.ArrayList;
@ -49,7 +50,7 @@ public abstract class SkillCommand implements TabExecutor {
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (CommandUtils.noConsoleUsage(sender)) {
return true;
}
@ -161,31 +162,28 @@ public abstract class SkillCommand implements TabExecutor {
Set<PrimarySkillType> parents = FamilyTree.getParents(skill);
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)))*/
}
ArrayList<PrimarySkillType> parentList = new ArrayList<>(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).append(", ");
} 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));
@ -211,7 +209,7 @@ public abstract class SkillCommand implements TabExecutor {
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
if (args.length == 1) {
return ImmutableList.of("?");
}

View File

@ -6,6 +6,7 @@ import com.gmail.nossr50.util.StringUtils;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Arrays;
@ -22,7 +23,7 @@ public class SkillGuideCommand implements CommandExecutor {
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
switch (args.length) {
case 1:
if (!args[0].equals("?")) {
@ -67,7 +68,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 +87,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

@ -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

@ -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

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

View File

@ -28,10 +28,10 @@ public abstract class AutoUpdateConfigLoader extends ConfigLoader {
boolean needSave = false;
Set<String> oldKeys = new HashSet<String>(configKeys);
Set<String> oldKeys = new HashSet<>(configKeys);
oldKeys.removeAll(internalConfigKeys);
Set<String> newKeys = new HashSet<String>(internalConfigKeys);
Set<String> newKeys = new HashSet<>(internalConfigKeys);
newKeys.removeAll(configKeys);
// Don't need a re-save if we have old keys sticking around?
@ -66,17 +66,17 @@ public abstract class AutoUpdateConfigLoader extends ConfigLoader {
try {
// Read internal
BufferedReader reader = new BufferedReader(new InputStreamReader(plugin.getResource(fileName)));
LinkedHashMap<String, String> comments = new LinkedHashMap<String, String>();
String temp = "";
LinkedHashMap<String, String> comments = new LinkedHashMap<>();
StringBuilder temp = new StringBuilder();
String line;
while ((line = reader.readLine()) != null) {
if (line.contains("#")) {
temp += line + "\n";
temp.append(line).append("\n");
}
else if (line.contains(":")) {
line = line.substring(0, line.indexOf(":") + 1);
if (!temp.isEmpty()) {
if (temp.length() > 0) {
if(comments.containsKey(line)) {
int index = 0;
while(comments.containsKey(line + index)) {
@ -86,14 +86,14 @@ public abstract class AutoUpdateConfigLoader extends ConfigLoader {
line = line + index;
}
comments.put(line, temp);
temp = "";
comments.put(line, temp.toString());
temp = new StringBuilder();
}
}
}
// Dump to the new one
HashMap<String, Integer> indexed = new HashMap<String, Integer>();
HashMap<String, Integer> indexed = new HashMap<>();
for (String key : comments.keySet()) {
String actualkey = key.substring(0, key.indexOf(":") + 1);

View File

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

View File

@ -31,7 +31,7 @@ public class RankConfig extends AutoUpdateConfigLoader {
@Override
protected boolean 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

@ -38,7 +38,7 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
@Override
protected boolean validateKeys() {
List<String> reason = new ArrayList<String>();
List<String> reason = new ArrayList<>();
/*
* FORMULA SETTINGS

View File

@ -15,12 +15,12 @@ import java.util.Set;
public class CustomArmorConfig extends ConfigLoader {
private boolean needsUpdate = false;
public List<Material> customBoots = new ArrayList<Material>();
public List<Material> customChestplates = new ArrayList<Material>();
public List<Material> customHelmets = new ArrayList<Material>();
public List<Material> customLeggings = new ArrayList<Material>();
public List<Material> customBoots = new ArrayList<>();
public List<Material> customChestplates = new ArrayList<>();
public List<Material> customHelmets = new ArrayList<>();
public List<Material> customLeggings = new ArrayList<>();
public List<Repairable> repairables = new ArrayList<Repairable>();
public List<Repairable> repairables = new ArrayList<>();
protected CustomArmorConfig(String fileName) {
super("mods", fileName);

View File

@ -9,8 +9,8 @@ import org.bukkit.inventory.ItemStack;
import java.util.HashMap;
public class CustomEntityConfig extends ConfigLoader {
public HashMap<String, CustomEntity> customEntityClassMap = new HashMap<String, CustomEntity>();
public HashMap<String, CustomEntity> customEntityTypeMap = new HashMap<String, CustomEntity>();
public HashMap<String, CustomEntity> customEntityClassMap = new HashMap<>();
public HashMap<String, CustomEntity> customEntityTypeMap = new HashMap<>();
protected CustomEntityConfig(String fileName) {
super("mods", fileName);

View File

@ -17,16 +17,16 @@ import java.util.Set;
public class CustomToolConfig extends ConfigLoader {
private boolean needsUpdate = false;
public List<Material> customAxes = new ArrayList<Material>();
public List<Material> customBows = new ArrayList<Material>();
public List<Material> customHoes = new ArrayList<Material>();
public List<Material> customPickaxes = new ArrayList<Material>();
public List<Material> customShovels = new ArrayList<Material>();
public List<Material> customSwords = new ArrayList<Material>();
public List<Material> customAxes = new ArrayList<>();
public List<Material> customBows = new ArrayList<>();
public List<Material> customHoes = new ArrayList<>();
public List<Material> customPickaxes = new ArrayList<>();
public List<Material> customShovels = new ArrayList<>();
public List<Material> customSwords = new ArrayList<>();
public HashMap<Material, CustomTool> customToolMap = new HashMap<Material, CustomTool>();
public HashMap<Material, CustomTool> customToolMap = new HashMap<>();
public List<Repairable> repairables = new ArrayList<Repairable>();
public List<Repairable> repairables = new ArrayList<>();
protected CustomToolConfig(String fileName) {
super("mods", fileName);

View File

@ -27,7 +27,7 @@ public class ItemWeightConfig extends ConfigLoader {
}
public HashSet<Material> getMiscItems() {
HashSet<Material> miscItems = new HashSet<Material>();
HashSet<Material> miscItems = new HashSet<>();
for (String item : config.getStringList("Party_Shareables.Misc_Items")) {
Material material = Material.getMaterial(item.toUpperCase(Locale.ENGLISH));

View File

@ -18,16 +18,16 @@ import java.util.Map;
public class PotionConfig extends ConfigLoader {
private static PotionConfig instance;
private final List<ItemStack> concoctionsIngredientsTierOne = new ArrayList<ItemStack>();
private final List<ItemStack> concoctionsIngredientsTierTwo = new ArrayList<ItemStack>();
private final List<ItemStack> concoctionsIngredientsTierThree = new ArrayList<ItemStack>();
private final List<ItemStack> concoctionsIngredientsTierFour = new ArrayList<ItemStack>();
private final List<ItemStack> concoctionsIngredientsTierFive = new ArrayList<ItemStack>();
private final List<ItemStack> concoctionsIngredientsTierSix = new ArrayList<ItemStack>();
private final List<ItemStack> concoctionsIngredientsTierSeven = new ArrayList<ItemStack>();
private final List<ItemStack> concoctionsIngredientsTierEight = new ArrayList<ItemStack>();
private final List<ItemStack> concoctionsIngredientsTierOne = new ArrayList<>();
private final List<ItemStack> concoctionsIngredientsTierTwo = new ArrayList<>();
private final List<ItemStack> concoctionsIngredientsTierThree = new ArrayList<>();
private final List<ItemStack> concoctionsIngredientsTierFour = new ArrayList<>();
private final List<ItemStack> concoctionsIngredientsTierFive = new ArrayList<>();
private final List<ItemStack> concoctionsIngredientsTierSix = new ArrayList<>();
private final List<ItemStack> concoctionsIngredientsTierSeven = new ArrayList<>();
private final List<ItemStack> concoctionsIngredientsTierEight = new ArrayList<>();
private final Map<String, AlchemyPotion> potionMap = new HashMap<String, AlchemyPotion>();
private final Map<String, AlchemyPotion> potionMap = new HashMap<>();
private PotionConfig() {
super("potions.yml");
@ -137,14 +137,14 @@ public class PotionConfig extends ConfigLoader {
material = Material.valueOf(mat);
}
List<String> lore = new ArrayList<String>();
List<String> lore = new ArrayList<>();
if (potion_section.contains("Lore")) {
for (String line : potion_section.getStringList("Lore")) {
lore.add(ChatColor.translateAlternateColorCodes('&', line));
}
}
List<PotionEffect> effects = new ArrayList<PotionEffect>();
List<PotionEffect> effects = new ArrayList<>();
if (potion_section.contains("Effects")) {
for (String effect : potion_section.getStringList("Effects")) {
String[] parts = effect.split(" ");
@ -162,7 +162,7 @@ public class PotionConfig extends ConfigLoader {
}
}
Color color = null;
Color color;
if (potion_section.contains("Color")) {
color = Color.fromRGB(potion_section.getInt("Color"));
}
@ -170,7 +170,7 @@ public class PotionConfig extends ConfigLoader {
color = this.generateColor(effects);
}
Map<ItemStack, String> children = new HashMap<ItemStack, String>();
Map<ItemStack, String> children = new HashMap<>();
if (potion_section.contains("Children")) {
for (String child : potion_section.getConfigurationSection("Children").getKeys(false)) {
ItemStack ingredient = loadIngredient(child);
@ -255,7 +255,7 @@ public class PotionConfig extends ConfigLoader {
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

@ -25,7 +25,7 @@ public class RepairConfig extends ConfigLoader {
@Override
protected void loadKeys() {
repairables = new ArrayList<Repairable>();
repairables = new ArrayList<>();
if (!config.isConfigurationSection("Repairables")) {
mcMMO.p.getLogger().severe("Could not find Repairables section in " + fileName);
@ -42,7 +42,7 @@ public class RepairConfig extends ConfigLoader {
}
// Validate all the things!
List<String> reason = new ArrayList<String>();
List<String> reason = new ArrayList<>();
// Item Material
Material itemMaterial = Material.matchMaterial(key);
@ -177,7 +177,7 @@ public class RepairConfig extends ConfigLoader {
}
protected List<Repairable> getLoadedRepairables() {
return repairables == null ? new ArrayList<Repairable>() : repairables;
return repairables == null ? new ArrayList<>() : repairables;
}
private boolean noErrorsInRepairable(List<String> issues) {

View File

@ -11,7 +11,7 @@ import java.util.List;
import java.util.regex.Pattern;
public class RepairConfigManager {
private final List<Repairable> repairables = new ArrayList<Repairable>();
private final List<Repairable> repairables = new ArrayList<>();
public RepairConfigManager(mcMMO plugin) {
Pattern pattern = Pattern.compile("repair\\.(?:.+)\\.yml");

View File

@ -28,7 +28,7 @@ public class SalvageConfig extends ConfigLoader {
@Override
protected void loadKeys() {
salvageables = new ArrayList<Salvageable>();
salvageables = new ArrayList<>();
if (!config.isConfigurationSection("Salvageables")) {
mcMMO.p.getLogger().severe("Could not find Salvageables section in " + fileName);
@ -59,7 +59,7 @@ public class SalvageConfig extends ConfigLoader {
for (String key : keys) {
// Validate all the things!
List<String> reason = new ArrayList<String>();
List<String> reason = new ArrayList<>();
// Item Material
Material itemMaterial = Material.matchMaterial(key);
@ -195,7 +195,7 @@ public class SalvageConfig extends ConfigLoader {
}
protected List<Salvageable> getLoadedSalvageables() {
return salvageables == null ? new ArrayList<Salvageable>() : salvageables;
return salvageables == null ? new ArrayList<>() : salvageables;
}
private boolean noErrorsInSalvageable(List<String> issues) {

View File

@ -11,7 +11,7 @@ import java.util.List;
import java.util.regex.Pattern;
public class SalvageConfigManager {
private final List<Salvageable> salvageables = new ArrayList<Salvageable>();
private final List<Salvageable> salvageables = new ArrayList<>();
public SalvageConfigManager(mcMMO plugin) {
Pattern pattern = Pattern.compile("salvage\\.(?:.+)\\.yml");

View File

@ -24,13 +24,13 @@ public class TreasureConfig extends ConfigLoader {
private static TreasureConfig instance;
public HashMap<String, List<ExcavationTreasure>> excavationMap = new HashMap<String, List<ExcavationTreasure>>();
public HashMap<String, List<ExcavationTreasure>> excavationMap = new HashMap<>();
public HashMap<EntityType, List<ShakeTreasure>> shakeMap = new HashMap<EntityType, List<ShakeTreasure>>();
public HashMap<String, List<HylianTreasure>> hylianMap = new HashMap<String, List<HylianTreasure>>();
public HashMap<EntityType, List<ShakeTreasure>> shakeMap = new HashMap<>();
public HashMap<String, List<HylianTreasure>> hylianMap = new HashMap<>();
public HashMap<Rarity, List<FishingTreasure>> fishingRewards = new HashMap<Rarity, List<FishingTreasure>>();
public HashMap<Rarity, List<EnchantmentTreasure>> fishingEnchantments = new HashMap<Rarity, List<EnchantmentTreasure>>();
public HashMap<Rarity, List<FishingTreasure>> fishingRewards = new HashMap<>();
public HashMap<Rarity, List<EnchantmentTreasure>> fishingEnchantments = new HashMap<>();
private TreasureConfig() {
super("treasures.yml");
@ -49,7 +49,7 @@ public class TreasureConfig extends ConfigLoader {
@Override
protected boolean validateKeys() {
// Validate all the settings!
List<String> reason = new ArrayList<String>();
List<String> reason = new ArrayList<>();
for (String tier : config.getConfigurationSection("Enchantment_Drop_Rates").getKeys(false)) {
double totalEnchantDropRate = 0;
double totalItemDropRate = 0;
@ -116,13 +116,13 @@ public class TreasureConfig extends ConfigLoader {
// Initialize fishing HashMap
for (Rarity rarity : Rarity.values()) {
if (!fishingRewards.containsKey(rarity)) {
fishingRewards.put(rarity, (new ArrayList<FishingTreasure>()));
fishingRewards.put(rarity, (new ArrayList<>()));
}
}
for (String treasureName : treasureSection.getKeys(false)) {
// Validate all the things!
List<String> reason = new ArrayList<String>();
List<String> reason = new ArrayList<>();
String[] treasureInfo = treasureName.split("[|]");
String materialName = treasureInfo[0];
@ -135,7 +135,7 @@ public class TreasureConfig extends ConfigLoader {
if (materialName.contains("INVENTORY")) {
// Use magic material BEDROCK to know that we're grabbing something from the inventory and not a normal treasure
if (!shakeMap.containsKey(EntityType.PLAYER))
shakeMap.put(EntityType.PLAYER, new ArrayList<ShakeTreasure>());
shakeMap.put(EntityType.PLAYER, new ArrayList<>());
shakeMap.get(EntityType.PLAYER).add(new ShakeTreasure(new ItemStack(Material.BEDROCK, 1, (byte) 0), 1, getInventoryStealDropChance(), getInventoryStealDropLevel()));
continue;
} else {
@ -218,7 +218,7 @@ public class TreasureConfig extends ConfigLoader {
}
if (config.contains(type + "." + treasureName + ".Lore")) {
List<String> lore = new ArrayList<String>();
List<String> lore = new ArrayList<>();
for (String s : config.getStringList(type + "." + treasureName + ".Lore")) {
lore.add(ChatColor.translateAlternateColorCodes('&', s));
}
@ -237,7 +237,7 @@ public class TreasureConfig extends ConfigLoader {
if (config.contains(type + "." + treasureName + ".Lore")) {
ItemMeta itemMeta = item.getItemMeta();
List<String> lore = new ArrayList<String>();
List<String> lore = new ArrayList<>();
for (String s : config.getStringList(type + "." + treasureName + ".Lore")) {
lore.add(ChatColor.translateAlternateColorCodes('&', s));
}
@ -254,7 +254,7 @@ public class TreasureConfig extends ConfigLoader {
EntityType entityType = EntityType.valueOf(type.substring(6));
if (!shakeMap.containsKey(entityType))
shakeMap.put(entityType, new ArrayList<ShakeTreasure>());
shakeMap.put(entityType, new ArrayList<>());
shakeMap.get(entityType).add(shakeTreasure);
} else if (isExcavation) {
ExcavationTreasure excavationTreasure = new ExcavationTreasure(item, xp, dropChance, dropLevel);
@ -262,7 +262,7 @@ public class TreasureConfig extends ConfigLoader {
for (String blockType : dropList) {
if (!excavationMap.containsKey(blockType))
excavationMap.put(blockType, new ArrayList<ExcavationTreasure>());
excavationMap.put(blockType, new ArrayList<>());
excavationMap.get(blockType).add(excavationTreasure);
}
} else if (isHylian) {
@ -305,7 +305,7 @@ public class TreasureConfig extends ConfigLoader {
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);
}
@ -316,7 +316,7 @@ public class TreasureConfig extends ConfigLoader {
}
if (!fishingEnchantments.containsKey(rarity)) {
fishingEnchantments.put(rarity, (new ArrayList<EnchantmentTreasure>()));
fishingEnchantments.put(rarity, (new ArrayList<>()));
}
ConfigurationSection enchantmentSection = config.getConfigurationSection("Enchantments_Rarity." + rarity.toString());

View File

@ -20,8 +20,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 final long UPDATE_WAIT_TIME = 600000L; // 10 minutes
@ -374,7 +374,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)));
@ -662,7 +662,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++;
@ -700,7 +700,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();
@ -746,19 +746,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;
@ -853,8 +853,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
@ -909,7 +909,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
continue;
}
int cap = Config.getInstance().getLevelCap(skill);
if (Integer.valueOf(character[index]) > cap) {
if (Integer.parseInt(character[index]) > cap) {
mcMMO.p.getLogger().warning("Truncating " + skill.getName() + " to configured max level for player " + character[USERNAME]);
character[index] = cap + "";
updated = true;
@ -1053,7 +1053,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");
@ -1130,7 +1130,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
return statValue;
}
private class SkillComparator implements Comparator<PlayerStat> {
private static class SkillComparator implements Comparator<PlayerStat> {
@Override
public int compare(PlayerStat o1, PlayerStat o2) {
return (o2.statVal - o1.statVal);
@ -1139,27 +1139,27 @@ 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;
// TODO on updates, put new values in a try{} ?
skillsXp.put(PrimarySkillType.TAMING, (float) Integer.valueOf(character[EXP_TAMING]));
skillsXp.put(PrimarySkillType.MINING, (float) Integer.valueOf(character[EXP_MINING]));
skillsXp.put(PrimarySkillType.REPAIR, (float) Integer.valueOf(character[EXP_REPAIR]));
skillsXp.put(PrimarySkillType.WOODCUTTING, (float) Integer.valueOf(character[EXP_WOODCUTTING]));
skillsXp.put(PrimarySkillType.UNARMED, (float) Integer.valueOf(character[EXP_UNARMED]));
skillsXp.put(PrimarySkillType.HERBALISM, (float) Integer.valueOf(character[EXP_HERBALISM]));
skillsXp.put(PrimarySkillType.EXCAVATION, (float) Integer.valueOf(character[EXP_EXCAVATION]));
skillsXp.put(PrimarySkillType.ARCHERY, (float) Integer.valueOf(character[EXP_ARCHERY]));
skillsXp.put(PrimarySkillType.SWORDS, (float) Integer.valueOf(character[EXP_SWORDS]));
skillsXp.put(PrimarySkillType.AXES, (float) Integer.valueOf(character[EXP_AXES]));
skillsXp.put(PrimarySkillType.ACROBATICS, (float) Integer.valueOf(character[EXP_ACROBATICS]));
skillsXp.put(PrimarySkillType.FISHING, (float) Integer.valueOf(character[EXP_FISHING]));
skillsXp.put(PrimarySkillType.ALCHEMY, (float) Integer.valueOf(character[EXP_ALCHEMY]));
skillsXp.put(PrimarySkillType.TAMING, (float) Integer.parseInt(character[EXP_TAMING]));
skillsXp.put(PrimarySkillType.MINING, (float) Integer.parseInt(character[EXP_MINING]));
skillsXp.put(PrimarySkillType.REPAIR, (float) Integer.parseInt(character[EXP_REPAIR]));
skillsXp.put(PrimarySkillType.WOODCUTTING, (float) Integer.parseInt(character[EXP_WOODCUTTING]));
skillsXp.put(PrimarySkillType.UNARMED, (float) Integer.parseInt(character[EXP_UNARMED]));
skillsXp.put(PrimarySkillType.HERBALISM, (float) Integer.parseInt(character[EXP_HERBALISM]));
skillsXp.put(PrimarySkillType.EXCAVATION, (float) Integer.parseInt(character[EXP_EXCAVATION]));
skillsXp.put(PrimarySkillType.ARCHERY, (float) Integer.parseInt(character[EXP_ARCHERY]));
skillsXp.put(PrimarySkillType.SWORDS, (float) Integer.parseInt(character[EXP_SWORDS]));
skillsXp.put(PrimarySkillType.AXES, (float) Integer.parseInt(character[EXP_AXES]));
skillsXp.put(PrimarySkillType.ACROBATICS, (float) Integer.parseInt(character[EXP_ACROBATICS]));
skillsXp.put(PrimarySkillType.FISHING, (float) Integer.parseInt(character[EXP_FISHING]));
skillsXp.put(PrimarySkillType.ALCHEMY, (float) Integer.parseInt(character[EXP_ALCHEMY]));
// Taming - Unused
skillsDATS.put(SuperAbilityType.SUPER_BREAKER, Integer.valueOf(character[COOLDOWN_SUPER_BREAKER]));
@ -1190,7 +1190,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
}
try {
scoreboardTipsShown = Integer.valueOf(character[SCOREBOARD_TIPS]);
scoreboardTipsShown = Integer.parseInt(character[SCOREBOARD_TIPS]);
}
catch (Exception e) {
scoreboardTipsShown = 0;
@ -1207,7 +1207,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]));
@ -1328,7 +1328,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
character[HEALTHBAR] = Config.getInstance().getMobHealthbarDefault().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

@ -25,7 +25,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
private static final String ALL_QUERY_VERSION = "total";
private final String tablePrefix = Config.getInstance().getMySQLTablePrefix();
private final Map<UUID, Integer> cachedUserIDs = new HashMap<UUID, Integer>();
private final Map<UUID, Integer> cachedUserIDs = new HashMap<>();
private DataSource miscPool;
private DataSource loadPool;
@ -214,7 +214,6 @@ public final class SQLDatabaseManager implements DatabaseManager {
}
public void cleanupUser(UUID uuid) {
if(cachedUserIDs.containsKey(uuid))
cachedUserIDs.remove(uuid);
}
@ -345,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(Locale.ENGLISH);
ResultSet resultSet = null;
@ -360,13 +359,13 @@ 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));
}
stats.add(new PlayerStat(column.get(1), Integer.valueOf(column.get(0))));
stats.add(new PlayerStat(column.get(1), Integer.parseInt(column.get(0))));
}
}
catch (SQLException ex) {
@ -382,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;
@ -752,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;
@ -1070,10 +1069,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;
@ -1316,7 +1315,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
private class GetUUIDUpdatesRequired extends BukkitRunnable {
public void run() {
massUpdateLock.lock();
List<String> names = new ArrayList<String>();
List<String> names = new ArrayList<>();
Connection connection = null;
Statement statement = null;
ResultSet resultSet = null;

View File

@ -2,6 +2,7 @@ package com.gmail.nossr50.datatypes.experience;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import org.jetbrains.annotations.NotNull;
import java.util.concurrent.Delayed;
import java.util.concurrent.TimeUnit;
@ -40,7 +41,7 @@ public class SkillXpGain implements Delayed {
}
@Override
public int compareTo(Delayed other) {
public int compareTo(@NotNull Delayed other) {
if (other instanceof SkillXpGain) {
// Use more efficient method if possible (private fields)
return this.compareTo((SkillXpGain) other);

View File

@ -31,8 +31,8 @@ public class Party {
// private static final String OFFLINE_PLAYER_PREFIX = "";
private static final String OFFLINE_PLAYER_PREFIX = "";
// private static final String OFFLINE_PLAYER_PREFIX = "" + ChatColor.RESET;
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;
@ -101,7 +101,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)) {
@ -141,7 +141,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)) {
@ -323,16 +323,15 @@ public class Party {
break;
default:
return;
}
}
public boolean hasMember(String memberName) {
return this.getMembers().values().contains(memberName);
return this.getMembers().containsValue(memberName);
}
public boolean hasMember(UUID uuid) {
return this.getMembers().keySet().contains(uuid);
return this.getMembers().containsKey(uuid);
}
/**
@ -361,7 +360,8 @@ public class Party {
{
Player onlinePlayer = Bukkit.getPlayer(onlineMember);
if(!isNotSamePerson(player.getUniqueId(), onlineMember) || player.canSee(onlinePlayer))
if(!isNotSamePerson(player.getUniqueId(), onlineMember)
|| onlinePlayer != null && player.canSee(onlinePlayer))
{
visiblePartyList.add(onlineMember);
} else {
@ -515,7 +515,7 @@ public class Party {
* @return the near party members
*/
public List<Player> getNearMembers(McMMOPlayer mcMMOPlayer) {
List<Player> nearMembers = new ArrayList<Player>();
List<Player> nearMembers = new ArrayList<>();
Party party = mcMMOPlayer.getParty();
if (party != null) {

View File

@ -45,7 +45,6 @@ import com.gmail.nossr50.util.experience.ExperienceBarManager;
import com.gmail.nossr50.util.player.NotificationManager;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
import com.gmail.nossr50.util.skills.PerksUtils;
import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.skills.SkillUtils;
@ -68,7 +67,7 @@ public class McMMOPlayer {
private final Player player;
private final PlayerProfile profile;
private final Map<PrimarySkillType, SkillManager> skillManagers = new HashMap<PrimarySkillType, SkillManager>();
private final Map<PrimarySkillType, SkillManager> skillManagers = new HashMap<>();
private final ExperienceBarManager experienceBarManager;
private Party party;
@ -87,10 +86,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;
@ -766,7 +765,6 @@ public class McMMOPlayer {
return;
default:
return;
}
}
@ -783,7 +781,6 @@ public class McMMOPlayer {
return;
default:
return;
}
}
@ -801,7 +798,6 @@ public class McMMOPlayer {
return;
default:
return;
}
}
@ -906,9 +902,6 @@ public class McMMOPlayer {
ticks = PerksUtils.handleActivationPerks(player, 2 + (getSkillLevel(skill) / abilityLengthVar), ability.getMaxLength());
}
// Notify people that ability has been activated
ParticleEffectUtils.playAbilityEnabledEffect(player);
if (useChatNotifications()) {
NotificationManager.sendPlayerInformation(player, NotificationType.SUPER_ABILITY, ability.getAbilityOn());
//player.sendMessage(ability.getAbilityOn());
@ -919,7 +912,6 @@ public class McMMOPlayer {
//Sounds
SoundManager.worldSendSound(player.getWorld(), player.getLocation(), SoundType.ABILITY_ACTIVATED_GENERIC);
// Enable the ability
profile.setAbilityDATS(ability, System.currentTimeMillis() + (ticks * Misc.TIME_CONVERSION_FACTOR));
setAbilityMode(ability, true);

View File

@ -32,14 +32,14 @@ public class PlayerProfile {
private int saveAttempts = 0;
/* 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 diminished returns
private final DelayQueue<SkillXpGain> gainedSkillsXp = new DelayQueue<SkillXpGain>();
private final HashMap<PrimarySkillType, Float> rollingSkillsXp = new HashMap<PrimarySkillType, Float>();
private final DelayQueue<SkillXpGain> gainedSkillsXp = new DelayQueue<>();
private final HashMap<PrimarySkillType, Float> rollingSkillsXp = new HashMap<>();
@Deprecated
public PlayerProfile(String playerName) {
@ -136,7 +136,6 @@ public class PlayerProfile {
else
scheduleAsyncSaveDelay();
return;
} else {
mcMMO.p.getLogger().severe("mcMMO has failed to save the profile for "
+getPlayerName()+" numerous times." +

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()) {

View File

@ -180,7 +180,7 @@ public enum SubSkillType {
/*
* Find where to begin our substring (after the prefix)
*/
String endResult = "";
StringBuilder endResult = new StringBuilder();
int subStringIndex = getSubStringIndex(subSkillName);
/*
@ -193,20 +193,20 @@ public enum SubSkillType {
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);
/*
@ -220,17 +220,17 @@ public enum SubSkillType {
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

@ -13,9 +13,9 @@ public interface Rank {
*/
boolean hasRanks();
/**
* An sequential collection of rank level requirements
* @return level requirements
/*
An sequential collection of rank level requirements
@return level requirements
*/
//Collection<Integer> getUnlockLevels();
}

View File

@ -4,6 +4,7 @@ import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
public abstract class McMMOChatEvent extends Event implements Cancellable {
private boolean cancelled;
@ -84,7 +85,7 @@ public abstract class McMMOChatEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList();
@Override
public HandlerList getHandlers() {
public @NotNull HandlerList getHandlers() {
return handlers;
}

View File

@ -7,6 +7,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
import org.jetbrains.annotations.NotNull;
/**
* Generic event for mcMMO experience events.
@ -67,7 +68,7 @@ public abstract class McMMOPlayerExperienceEvent extends PlayerEvent implements
private static final HandlerList handlers = new HandlerList();
@Override
public HandlerList getHandlers() {
public @NotNull HandlerList getHandlers() {
return handlers;
}

View File

@ -4,6 +4,7 @@ import com.gmail.nossr50.datatypes.experience.XPGainReason;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
/**
* Called when a user loses levels in a skill
@ -50,7 +51,7 @@ public class McMMOPlayerLevelDownEvent extends McMMOPlayerLevelChangeEvent {
private static final HandlerList handlers = new HandlerList();
@Override
public HandlerList getHandlers() {
public @NotNull HandlerList getHandlers() {
return handlers;
}

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