mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 06:36:45 +01:00
Code Cleanup Pt 2
This commit is contained in:
parent
0e39656c88
commit
43037f8c13
@ -29,6 +29,7 @@ Version 2.2.0
|
|||||||
Note: Admins are players who are op or have adminchat permission.
|
Note: Admins are players who are op or have adminchat permission.
|
||||||
|
|
||||||
Bug Fixes
|
Bug Fixes
|
||||||
|
Fixed a bug where Blast Minings cooldown was not being displayed correctly
|
||||||
Fixed a bug where players who started at level 1 would not be purged from the DB for being "powerless"
|
Fixed a bug where players who started at level 1 would not be purged from the DB for being "powerless"
|
||||||
Fixed a potential bug where players could be awarded XP for cancelled tame events
|
Fixed a potential bug where players could be awarded XP for cancelled tame events
|
||||||
Fixed a bug where party size limits were only counting online players
|
Fixed a bug where party size limits were only counting online players
|
||||||
@ -117,6 +118,7 @@ Version 2.2.0
|
|||||||
Scoreboard.Misc.Ability locale entry renamed from "Ability" to "Super Ability", this is used only if scoreboards are enabled and super ability names are disabled in scoreboard.conf
|
Scoreboard.Misc.Ability locale entry renamed from "Ability" to "Super Ability", this is used only if scoreboards are enabled and super ability names are disabled in scoreboard.conf
|
||||||
|
|
||||||
MySQL and FlatFile Settings can now be found in "database_settings.conf"
|
MySQL and FlatFile Settings can now be found in "database_settings.conf"
|
||||||
|
Added new config setting for the update interval of FlatFile scoreboards
|
||||||
Added new config toggle for purging power-less users
|
Added new config toggle for purging power-less users
|
||||||
Added new config toggle for purging inactive users
|
Added new config toggle for purging inactive users
|
||||||
Database Purging's "Purge_Interval" renamed -> "Purge-Interval-In-Hours"
|
Database Purging's "Purge_Interval" renamed -> "Purge-Interval-In-Hours"
|
||||||
|
@ -176,7 +176,7 @@ public final class PartyAPI {
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static List<OfflinePlayer> getOnlineAndOfflineMembers(Player player) {
|
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()) {
|
for (UUID memberUniqueId : PartyManager.getAllMembers(player).keySet()) {
|
||||||
OfflinePlayer member = mcMMO.p.getServer().getOfflinePlayer(memberUniqueId);
|
OfflinePlayer member = mcMMO.p.getServer().getOfflinePlayer(memberUniqueId);
|
||||||
|
@ -82,7 +82,7 @@ public final class SkillAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static List<String> getListFromEnum(List<PrimarySkillType> skillsTypes) {
|
private static List<String> getListFromEnum(List<PrimarySkillType> skillsTypes) {
|
||||||
List<String> skills = new ArrayList<String>();
|
List<String> skills = new ArrayList<>();
|
||||||
|
|
||||||
for (PrimarySkillType primarySkillType : skillsTypes) {
|
for (PrimarySkillType primarySkillType : skillsTypes) {
|
||||||
skills.add(primarySkillType.name());
|
skills.add(primarySkillType.name());
|
||||||
|
@ -6,8 +6,8 @@ import org.bukkit.plugin.Plugin;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class ChatManagerFactory {
|
public class ChatManagerFactory {
|
||||||
private static final HashMap<Plugin, AdminChatManager> adminChatManagers = new HashMap<Plugin, AdminChatManager>();
|
private static final HashMap<Plugin, AdminChatManager> adminChatManagers = new HashMap<>();
|
||||||
private static final HashMap<Plugin, PartyChatManager> partyChatManagers = new HashMap<Plugin, PartyChatManager>();
|
private static final HashMap<Plugin, PartyChatManager> partyChatManagers = new HashMap<>();
|
||||||
|
|
||||||
public static ChatManager getChatManager(Plugin plugin, ChatMode mode) {
|
public static ChatManager getChatManager(Plugin plugin, ChatMode mode) {
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
|
@ -33,7 +33,7 @@ public class McImportCommand implements CommandExecutor {
|
|||||||
mcMMO.p.getLogger().info("Starting import of mod materials...");
|
mcMMO.p.getLogger().info("Starting import of mod materials...");
|
||||||
fileAmount = 0;
|
fileAmount = 0;
|
||||||
|
|
||||||
HashMap<ModConfigType, ArrayList<String>> materialNames = new HashMap<ModConfigType, ArrayList<String>>();
|
HashMap<ModConfigType, ArrayList<String>> materialNames = new HashMap<>();
|
||||||
|
|
||||||
BufferedReader in = null;
|
BufferedReader in = null;
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ public class McImportCommand implements CommandExecutor {
|
|||||||
ModConfigType type = ModConfigType.getModConfigType(materialName);
|
ModConfigType type = ModConfigType.getModConfigType(materialName);
|
||||||
|
|
||||||
if (!materialNames.containsKey(type)) {
|
if (!materialNames.containsKey(type)) {
|
||||||
materialNames.put(type, new ArrayList<String>());
|
materialNames.put(type, new ArrayList<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
materialNames.get(type).add(materialName);
|
materialNames.get(type).add(materialName);
|
||||||
@ -93,13 +93,13 @@ public class McImportCommand implements CommandExecutor {
|
|||||||
|
|
||||||
private void createOutput(HashMap<ModConfigType, ArrayList<String>> materialNames) {
|
private void createOutput(HashMap<ModConfigType, ArrayList<String>> materialNames) {
|
||||||
for (ModConfigType modConfigType : materialNames.keySet()) {
|
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)) {
|
for (String materialName : materialNames.get(modConfigType)) {
|
||||||
String modName = Misc.getModName(materialName);
|
String modName = Misc.getModName(materialName);
|
||||||
|
|
||||||
if (!materialNamesType.containsKey(modName)) {
|
if (!materialNamesType.containsKey(modName)) {
|
||||||
materialNamesType.put(modName, new ArrayList<String>());
|
materialNamesType.put(modName, new ArrayList<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
materialNamesType.get(modName).add(materialName);
|
materialNamesType.get(modName).add(materialName);
|
||||||
@ -169,16 +169,10 @@ public class McImportCommand implements CommandExecutor {
|
|||||||
|
|
||||||
out = new FileWriter(outputFile);
|
out = new FileWriter(outputFile);
|
||||||
out.write(writer.toString());
|
out.write(writer.toString());
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return;
|
return;
|
||||||
}
|
} finally {
|
||||||
catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
tryClose(out);
|
tryClose(out);
|
||||||
fileAmount++;
|
fileAmount++;
|
||||||
}
|
}
|
||||||
@ -201,7 +195,7 @@ public class McImportCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private HashMap<String, ArrayList<String>> getConfigSectionsBlocks(String modName, HashMap<String, ArrayList<String>> materialNames) {
|
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
|
// Go through all the materials and categorise them under a skill
|
||||||
for (String materialName : materialNames.get(modName)) {
|
for (String materialName : materialNames.get(modName)) {
|
||||||
@ -220,7 +214,7 @@ public class McImportCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!configSections.containsKey(skillName)) {
|
if (!configSections.containsKey(skillName)) {
|
||||||
configSections.put(skillName, new ArrayList<String>());
|
configSections.put(skillName, new ArrayList<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<String> skillContents = configSections.get(skillName);
|
ArrayList<String> skillContents = configSections.get(skillName);
|
||||||
@ -240,7 +234,7 @@ public class McImportCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private HashMap<String, ArrayList<String>> getConfigSectionsTools(String modName, HashMap<String, ArrayList<String>> materialNames) {
|
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
|
// Go through all the materials and categorise them under a tool type
|
||||||
for (String materialName : materialNames.get(modName)) {
|
for (String materialName : materialNames.get(modName)) {
|
||||||
@ -265,7 +259,7 @@ public class McImportCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!configSections.containsKey(toolType)) {
|
if (!configSections.containsKey(toolType)) {
|
||||||
configSections.put(toolType, new ArrayList<String>());
|
configSections.put(toolType, new ArrayList<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<String> skillContents = configSections.get(toolType);
|
ArrayList<String> skillContents = configSections.get(toolType);
|
||||||
@ -280,7 +274,7 @@ public class McImportCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private HashMap<String, ArrayList<String>> getConfigSectionsArmor(String modName, HashMap<String, ArrayList<String>> materialNames) {
|
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
|
// Go through all the materials and categorise them under an armor type
|
||||||
for (String materialName : materialNames.get(modName)) {
|
for (String materialName : materialNames.get(modName)) {
|
||||||
@ -299,7 +293,7 @@ public class McImportCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!configSections.containsKey(toolType)) {
|
if (!configSections.containsKey(toolType)) {
|
||||||
configSections.put(toolType, new ArrayList<String>());
|
configSections.put(toolType, new ArrayList<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<String> skillContents = configSections.get(toolType);
|
ArrayList<String> skillContents = configSections.get(toolType);
|
||||||
@ -325,14 +319,14 @@ public class McImportCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private HashMap<String, ArrayList<String>> getConfigSectionsUnknown(String modName, HashMap<String, ArrayList<String>> materialNames) {
|
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
|
// Go through all the materials and print them
|
||||||
for (String materialName : materialNames.get(modName)) {
|
for (String materialName : materialNames.get(modName)) {
|
||||||
String configKey = "UNIDENTIFIED";
|
String configKey = "UNIDENTIFIED";
|
||||||
|
|
||||||
if (!configSections.containsKey(configKey)) {
|
if (!configSections.containsKey(configKey)) {
|
||||||
configSections.put(configKey, new ArrayList<String>());
|
configSections.put(configKey, new ArrayList<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<String> skillContents = configSections.get(configKey);
|
ArrayList<String> skillContents = configSections.get(configKey);
|
||||||
|
@ -26,8 +26,8 @@ public class McconvertCommand implements TabExecutor {
|
|||||||
private CommandExecutor experienceConvertCommand = new ConvertExperienceCommand();
|
private CommandExecutor experienceConvertCommand = new ConvertExperienceCommand();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
ArrayList<String> formulaTypes = new ArrayList<String>();
|
ArrayList<String> formulaTypes = new ArrayList<>();
|
||||||
ArrayList<String> databaseTypes = new ArrayList<String>();
|
ArrayList<String> databaseTypes = new ArrayList<>();
|
||||||
|
|
||||||
for (FormulaType type : FormulaType.values()) {
|
for (FormulaType type : FormulaType.values()) {
|
||||||
formulaTypes.add(type.toString());
|
formulaTypes.add(type.toString());
|
||||||
@ -73,14 +73,14 @@ public class McconvertCommand implements TabExecutor {
|
|||||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 1:
|
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:
|
case 2:
|
||||||
if (args[0].equalsIgnoreCase("database") || args[0].equalsIgnoreCase("db")) {
|
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")) {
|
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();
|
return ImmutableList.of();
|
||||||
|
@ -72,7 +72,7 @@ public class McscoreboardCommand implements TabExecutor {
|
|||||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 1:
|
case 1:
|
||||||
return StringUtil.copyPartialMatches(args[0], FIRST_ARGS, new ArrayList<String>(FIRST_ARGS.size()));
|
return StringUtil.copyPartialMatches(args[0], FIRST_ARGS, new ArrayList<>(FIRST_ARGS.size()));
|
||||||
default:
|
default:
|
||||||
return ImmutableList.of();
|
return ImmutableList.of();
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ public abstract class ToggleCommand implements TabExecutor {
|
|||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 1:
|
case 1:
|
||||||
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
|
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
|
||||||
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
|
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<>(playerNames.size()));
|
||||||
default:
|
default:
|
||||||
return ImmutableList.of();
|
return ImmutableList.of();
|
||||||
}
|
}
|
||||||
|
@ -113,9 +113,9 @@ public class XprateCommand implements TabExecutor {
|
|||||||
return ImmutableList.of();
|
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:
|
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:
|
default:
|
||||||
return ImmutableList.of();
|
return ImmutableList.of();
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ public abstract class ChatCommand implements TabExecutor {
|
|||||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 1:
|
case 1:
|
||||||
return StringUtil.copyPartialMatches(args[0], CommandUtils.TRUE_FALSE_OPTIONS, new ArrayList<String>(CommandUtils.TRUE_FALSE_OPTIONS.size()));
|
return StringUtil.copyPartialMatches(args[0], CommandUtils.TRUE_FALSE_OPTIONS, new ArrayList<>(CommandUtils.TRUE_FALSE_OPTIONS.size()));
|
||||||
default:
|
default:
|
||||||
return ImmutableList.of();
|
return ImmutableList.of();
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ public class McremoveCommand implements TabExecutor {
|
|||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 1:
|
case 1:
|
||||||
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
|
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
|
||||||
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
|
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<>(playerNames.size()));
|
||||||
default:
|
default:
|
||||||
return ImmutableList.of();
|
return ImmutableList.of();
|
||||||
}
|
}
|
||||||
|
@ -113,9 +113,9 @@ public abstract class ExperienceCommand implements TabExecutor {
|
|||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 1:
|
case 1:
|
||||||
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
|
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:
|
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:
|
default:
|
||||||
return ImmutableList.of();
|
return ImmutableList.of();
|
||||||
}
|
}
|
||||||
|
@ -107,9 +107,9 @@ public class SkillresetCommand implements TabExecutor {
|
|||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 1:
|
case 1:
|
||||||
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
|
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:
|
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:
|
default:
|
||||||
return ImmutableList.of();
|
return ImmutableList.of();
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ public class PartyCommand implements TabExecutor {
|
|||||||
private static final List<String> ITEMSHARE_COMPLETIONS = ImmutableList.of("none", "equal", "random", "loot", "mining", "herbalism", "woodcutting", "misc");
|
private static final List<String> ITEMSHARE_COMPLETIONS = ImmutableList.of("none", "equal", "random", "loot", "mining", "herbalism", "woodcutting", "misc");
|
||||||
|
|
||||||
static {
|
static {
|
||||||
ArrayList<String> subcommands = new ArrayList<String>();
|
ArrayList<String> subcommands = new ArrayList<>();
|
||||||
|
|
||||||
for (PartySubcommandType subcommand : PartySubcommandType.values()) {
|
for (PartySubcommandType subcommand : PartySubcommandType.values()) {
|
||||||
subcommands.add(subcommand.toString());
|
subcommands.add(subcommand.toString());
|
||||||
@ -173,7 +173,7 @@ public class PartyCommand implements TabExecutor {
|
|||||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 1:
|
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:
|
case 2:
|
||||||
PartySubcommandType subcommand = PartySubcommandType.getSubcommand(args[0]);
|
PartySubcommandType subcommand = PartySubcommandType.getSubcommand(args[0]);
|
||||||
|
|
||||||
@ -187,25 +187,25 @@ public class PartyCommand implements TabExecutor {
|
|||||||
case KICK:
|
case KICK:
|
||||||
case OWNER:
|
case OWNER:
|
||||||
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
|
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:
|
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:
|
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 LOCK:
|
||||||
case CHAT:
|
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:
|
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:
|
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) {
|
if (matches.size() == 0) {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
Party party = UserManager.getPlayer(player).getParty();
|
Party party = UserManager.getPlayer(player).getParty();
|
||||||
|
|
||||||
playerNames = party.getOnlinePlayerNames(player);
|
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;
|
return matches;
|
||||||
@ -214,7 +214,7 @@ public class PartyCommand implements TabExecutor {
|
|||||||
}
|
}
|
||||||
case 3:
|
case 3:
|
||||||
if (PartySubcommandType.getSubcommand(args[0]) == PartySubcommandType.ITEMSHARE && isItemShareCategory(args[1])) {
|
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();
|
return ImmutableList.of();
|
||||||
|
@ -41,21 +41,21 @@ public class PartyInfoCommand implements CommandExecutor {
|
|||||||
private void displayPartyHeader(Player player, Party party) {
|
private void displayPartyHeader(Player player, Party party) {
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.Party.Header"));
|
player.sendMessage(LocaleLoader.getString("Commands.Party.Header"));
|
||||||
|
|
||||||
StringBuilder status = new StringBuilder();
|
|
||||||
status.append(LocaleLoader.getString("Commands.Party.Status", party.getName(), LocaleLoader.getString("Party.Status." + (party.isLocked() ? "Locked" : "Unlocked")), party.getLevel()));
|
|
||||||
|
|
||||||
/*if (!party.hasReachedLevelCap()) {
|
/*if (!party.hasReachedLevelCap()) {
|
||||||
status.append(" (").append(party.getXpToLevelPercentage()).append(")");
|
status.append(" (").append(party.getXpToLevelPercentage()).append(")");
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
player.sendMessage(status.toString());
|
player.sendMessage(LocaleLoader.getString("Commands.Party.Status", party.getName(), LocaleLoader.getString("Party.Status." + (party.isLocked() ? "Locked" : "Unlocked")), party.getLevel())
|
||||||
|
/*if (!party.hasReachedLevelCap()) {
|
||||||
|
status.append(" (").append(party.getXpToLevelPercentage()).append(")");
|
||||||
|
}*/);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displayPartyFeatures(Player player, Party party) {
|
private void displayPartyFeatures(Player player, Party party) {
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.Party.Features.Header"));
|
player.sendMessage(LocaleLoader.getString("Commands.Party.Features.Header"));
|
||||||
|
|
||||||
List<String> unlockedPartyFeatures = new ArrayList<String>();
|
List<String> unlockedPartyFeatures = new ArrayList<>();
|
||||||
List<String> lockedPartyFeatures = new ArrayList<String>();
|
List<String> lockedPartyFeatures = new ArrayList<>();
|
||||||
|
|
||||||
for (PartyFeature partyFeature : PartyFeature.values()) {
|
for (PartyFeature partyFeature : PartyFeature.values()) {
|
||||||
if (!partyFeature.hasPermission(player)) {
|
if (!partyFeature.hasPermission(player)) {
|
||||||
|
@ -104,11 +104,11 @@ public class PartyAllianceCommand implements TabExecutor {
|
|||||||
public List<String> onTabComplete(CommandSender commandSender, Command command, String label, String[] args) {
|
public List<String> onTabComplete(CommandSender commandSender, Command command, String label, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 1:
|
case 1:
|
||||||
List<String> matches = StringUtil.copyPartialMatches(args[0], ALLIANCE_SUBCOMMANDS, new ArrayList<String>(ALLIANCE_SUBCOMMANDS.size()));
|
List<String> matches = StringUtil.copyPartialMatches(args[0], ALLIANCE_SUBCOMMANDS, new ArrayList<>(ALLIANCE_SUBCOMMANDS.size()));
|
||||||
|
|
||||||
if (matches.size() == 0) {
|
if (matches.size() == 0) {
|
||||||
List<String> playerNames = CommandUtils.getOnlinePlayerNames(commandSender);
|
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;
|
return matches;
|
||||||
|
@ -127,7 +127,7 @@ public class PtpCommand implements TabExecutor {
|
|||||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 1:
|
case 1:
|
||||||
List<String> matches = StringUtil.copyPartialMatches(args[0], TELEPORT_SUBCOMMANDS, new ArrayList<String>(TELEPORT_SUBCOMMANDS.size()));
|
List<String> matches = StringUtil.copyPartialMatches(args[0], TELEPORT_SUBCOMMANDS, new ArrayList<>(TELEPORT_SUBCOMMANDS.size()));
|
||||||
|
|
||||||
if (matches.size() == 0) {
|
if (matches.size() == 0) {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
@ -138,7 +138,7 @@ public class PtpCommand implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<String> playerNames = mcMMOPlayer.getParty().getOnlinePlayerNames(player);
|
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;
|
return matches;
|
||||||
|
@ -106,7 +106,7 @@ public class InspectCommand implements TabExecutor {
|
|||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 1:
|
case 1:
|
||||||
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
|
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
|
||||||
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
|
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<>(playerNames.size()));
|
||||||
default:
|
default:
|
||||||
return ImmutableList.of();
|
return ImmutableList.of();
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ public class McrankCommand implements TabExecutor {
|
|||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 1:
|
case 1:
|
||||||
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
|
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
|
||||||
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
|
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<>(playerNames.size()));
|
||||||
default:
|
default:
|
||||||
return ImmutableList.of();
|
return ImmutableList.of();
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ public class MctopCommand implements TabExecutor {
|
|||||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 1:
|
case 1:
|
||||||
return StringUtil.copyPartialMatches(args[0], PrimarySkillType.SKILL_NAMES, new ArrayList<String>(PrimarySkillType.SKILL_NAMES.size()));
|
return StringUtil.copyPartialMatches(args[0], PrimarySkillType.SKILL_NAMES, new ArrayList<>(PrimarySkillType.SKILL_NAMES.size()));
|
||||||
default:
|
default:
|
||||||
return ImmutableList.of();
|
return ImmutableList.of();
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ public class AcrobaticsCommand extends SkillCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
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) {
|
if (canDodge) {
|
||||||
messages.add(getStatMessage(SubSkillType.ACROBATICS_DODGE, dodgeChance)
|
messages.add(getStatMessage(SubSkillType.ACROBATICS_DODGE, dodgeChance)
|
||||||
@ -71,7 +71,7 @@ public class AcrobaticsCommand extends SkillCommand {
|
|||||||
graceChance = RandomChanceUtil.getRandomChanceExecutionChance(grace_rcs);
|
graceChance = RandomChanceUtil.getRandomChanceExecutionChance(grace_rcs);
|
||||||
//damageThreshold = AdvancedConfig.getInstance().getRollDamageThreshold();
|
//damageThreshold = AdvancedConfig.getInstance().getRollDamageThreshold();
|
||||||
|
|
||||||
String rollStrings[] = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.ACROBATICS_ROLL);
|
String[] rollStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.ACROBATICS_ROLL);
|
||||||
|
|
||||||
//Format
|
//Format
|
||||||
double rollChanceLucky = rollChance * 1.333D;
|
double rollChanceLucky = rollChance * 1.333D;
|
||||||
|
@ -67,7 +67,7 @@ public class AlchemyCommand extends SkillCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
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) {
|
if (canCatalysis) {
|
||||||
messages.add(getStatMessage(SubSkillType.ALCHEMY_CATALYSIS, brewSpeed)
|
messages.add(getStatMessage(SubSkillType.ALCHEMY_CATALYSIS, brewSpeed)
|
||||||
|
@ -59,7 +59,7 @@ public class ArcheryCommand extends SkillCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
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) {
|
if (canRetrieve) {
|
||||||
messages.add(getStatMessage(SubSkillType.ARCHERY_ARROW_RETRIEVAL, retrieveChance)
|
messages.add(getStatMessage(SubSkillType.ARCHERY_ARROW_RETRIEVAL, retrieveChance)
|
||||||
|
@ -72,7 +72,7 @@ public class AxesCommand extends SkillCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
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) {
|
if (canImpact) {
|
||||||
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Axes.Ability.Bonus.2"), LocaleLoader.getString("Axes.Ability.Bonus.3", impactDamage)));
|
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Axes.Ability.Bonus.2"), LocaleLoader.getString("Axes.Ability.Bonus.3", impactDamage)));
|
||||||
|
@ -27,7 +27,7 @@ public class ExcavationCommand extends SkillCommand {
|
|||||||
protected void dataCalculations(Player player, float skillValue) {
|
protected void dataCalculations(Player player, float skillValue) {
|
||||||
// GIGA DRILL BREAKER
|
// GIGA DRILL BREAKER
|
||||||
if (canGigaDrill) {
|
if (canGigaDrill) {
|
||||||
String gigaDrillStrings[] = calculateLengthDisplayValues(player, skillValue);
|
String[] gigaDrillStrings = calculateLengthDisplayValues(player, skillValue);
|
||||||
gigaDrillBreakerLength = gigaDrillStrings[0];
|
gigaDrillBreakerLength = gigaDrillStrings[0];
|
||||||
gigaDrillBreakerLengthEndurance = gigaDrillStrings[1];
|
gigaDrillBreakerLengthEndurance = gigaDrillStrings[1];
|
||||||
}
|
}
|
||||||
@ -41,7 +41,7 @@ public class ExcavationCommand extends SkillCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||||
List<String> messages = new ArrayList<String>();
|
List<String> messages = new ArrayList<>();
|
||||||
|
|
||||||
if (canGigaDrill) {
|
if (canGigaDrill) {
|
||||||
messages.add(getStatMessage(SubSkillType.EXCAVATION_GIGA_DRILL_BREAKER, gigaDrillBreakerLength)
|
messages.add(getStatMessage(SubSkillType.EXCAVATION_GIGA_DRILL_BREAKER, gigaDrillBreakerLength)
|
||||||
|
@ -128,7 +128,7 @@ public class FishingCommand extends SkillCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
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) {
|
if (canFishermansDiet) {
|
||||||
messages.add(getStatMessage(false, true, SubSkillType.FISHING_FISHERMANS_DIET, String.valueOf(fishermansDietRank)));
|
messages.add(getStatMessage(false, true, SubSkillType.FISHING_FISHERMANS_DIET, String.valueOf(fishermansDietRank)));
|
||||||
|
@ -45,7 +45,7 @@ public class HerbalismCommand extends SkillCommand {
|
|||||||
|
|
||||||
// DOUBLE DROPS
|
// DOUBLE DROPS
|
||||||
if (canDoubleDrop) {
|
if (canDoubleDrop) {
|
||||||
String[] doubleDropStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.HERBALISM_DOUBLE_DROPS);;
|
String[] doubleDropStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.HERBALISM_DOUBLE_DROPS);
|
||||||
doubleDropChance = doubleDropStrings[0];
|
doubleDropChance = doubleDropStrings[0];
|
||||||
doubleDropChanceLucky = doubleDropStrings[1];
|
doubleDropChanceLucky = doubleDropStrings[1];
|
||||||
}
|
}
|
||||||
@ -99,7 +99,7 @@ public class HerbalismCommand extends SkillCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
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) {
|
if (canDoubleDrop) {
|
||||||
messages.add(getStatMessage(SubSkillType.HERBALISM_DOUBLE_DROPS, doubleDropChance)
|
messages.add(getStatMessage(SubSkillType.HERBALISM_DOUBLE_DROPS, doubleDropChance)
|
||||||
|
@ -78,7 +78,7 @@ public class MiningCommand extends SkillCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
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) {
|
if (canBiggerBombs) {
|
||||||
messages.add(getStatMessage(true, true, SubSkillType.MINING_BLAST_MINING, String.valueOf(blastRadiusIncrease)));
|
messages.add(getStatMessage(true, true, SubSkillType.MINING_BLAST_MINING, String.valueOf(blastRadiusIncrease)));
|
||||||
|
@ -64,7 +64,7 @@ public class MmoInfoCommand implements TabExecutor {
|
|||||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 1:
|
case 1:
|
||||||
return StringUtil.copyPartialMatches(args[0], PrimarySkillType.SUBSKILL_NAMES, new ArrayList<String>(PrimarySkillType.SUBSKILL_NAMES.size()));
|
return StringUtil.copyPartialMatches(args[0], PrimarySkillType.SUBSKILL_NAMES, new ArrayList<>(PrimarySkillType.SUBSKILL_NAMES.size()));
|
||||||
default:
|
default:
|
||||||
return ImmutableList.of();
|
return ImmutableList.of();
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ public class RepairCommand extends SkillCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
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) {
|
if (canArcaneForge) {
|
||||||
RepairManager repairManager = UserManager.getPlayer(player).getRepairManager();
|
RepairManager repairManager = UserManager.getPlayer(player).getRepairManager();
|
||||||
|
@ -36,7 +36,7 @@ public class SalvageCommand extends SkillCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
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();
|
SalvageManager salvageManager = UserManager.getPlayer(player).getSalvageManager();
|
||||||
|
|
||||||
if (canAdvancedSalvage) {
|
if (canAdvancedSalvage) {
|
||||||
|
@ -162,28 +162,26 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
ArrayList<PrimarySkillType> parentList = new ArrayList<>();
|
ArrayList<PrimarySkillType> parentList = new ArrayList<>();
|
||||||
|
|
||||||
//TODO: Add JSON here
|
//TODO: Add JSON here
|
||||||
for (PrimarySkillType parent : parents) {
|
/*player.sendMessage(parent.getName() + " - " + LocaleLoader.getString("Effects.Level.Overhaul", mcMMOPlayer.getSkillLevel(parent), mcMMOPlayer.getSkillXpLevel(parent), mcMMOPlayer.getXpToLevel(parent)))*/
|
||||||
parentList.add(parent);
|
parentList.addAll(parents);
|
||||||
/*player.sendMessage(parent.getName() + " - " + LocaleLoader.getString("Effects.Level.Overhaul", mcMMOPlayer.getSkillLevel(parent), mcMMOPlayer.getSkillXpLevel(parent), mcMMOPlayer.getXpToLevel(parent)))*/;
|
|
||||||
}
|
|
||||||
|
|
||||||
String parentMessage = "";
|
StringBuilder parentMessage = new StringBuilder();
|
||||||
|
|
||||||
for(int i = 0; i < parentList.size(); i++)
|
for(int i = 0; i < parentList.size(); i++)
|
||||||
{
|
{
|
||||||
if(i+1 < parentList.size())
|
if(i+1 < parentList.size())
|
||||||
{
|
{
|
||||||
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))));
|
||||||
parentMessage += ChatColor.GRAY+", ";
|
parentMessage.append(ChatColor.GRAY + ", ");
|
||||||
} else {
|
} 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
|
//XP GAIN METHOD
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.XPGain.Overhaul", LocaleLoader.getString("Commands.XPGain.Child")));
|
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
|
//LEVEL
|
||||||
//player.sendMessage(LocaleLoader.getString("Effects.Child.Overhaul", skillValue, skillValue));
|
//player.sendMessage(LocaleLoader.getString("Effects.Child.Overhaul", skillValue, skillValue));
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ public class SkillGuideCommand implements CommandExecutor {
|
|||||||
|
|
||||||
private ArrayList<String> grabPageContents(int page) {
|
private ArrayList<String> grabPageContents(int page) {
|
||||||
int pageIndexStart = 8 * (page - 1); // Determine what string to start at
|
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);
|
allStrings.add(header);
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ public class SkillGuideCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private ArrayList<String> getGuide(PrimarySkillType skill) {
|
private ArrayList<String> getGuide(PrimarySkillType skill) {
|
||||||
ArrayList<String> guide = new ArrayList<String>();
|
ArrayList<String> guide = new ArrayList<>();
|
||||||
|
|
||||||
for (int i = 0; i < 10; i++) {
|
for (int i = 0; i < 10; i++) {
|
||||||
String[] section = LocaleLoader.getString("Guides." + StringUtils.getCapitalized(skill.toString()) + ".Section." + i).split("\n");
|
String[] section = LocaleLoader.getString("Guides." + StringUtils.getCapitalized(skill.toString()) + ".Section." + i).split("\n");
|
||||||
|
@ -62,7 +62,7 @@ public class SmeltingCommand extends SkillCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
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) {
|
/*if (canFluxMine) {
|
||||||
messages.add(getStatMessage(SubSkillType.SMELTING_FLUX_MINING, str_fluxMiningChance)
|
messages.add(getStatMessage(SubSkillType.SMELTING_FLUX_MINING, str_fluxMiningChance)
|
||||||
|
@ -68,7 +68,7 @@ public class SwordsCommand extends SkillCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
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();
|
int ruptureTicks = UserManager.getPlayer(player).getSwordsManager().getRuptureBleedTicks();
|
||||||
double ruptureDamagePlayers = RankUtils.getRank(player, SubSkillType.SWORDS_RUPTURE) >= 3 ? AdvancedConfig.getInstance().getRuptureDamagePlayer() * 1.5D : AdvancedConfig.getInstance().getRuptureDamagePlayer();
|
double ruptureDamagePlayers = RankUtils.getRank(player, SubSkillType.SWORDS_RUPTURE) >= 3 ? AdvancedConfig.getInstance().getRuptureDamagePlayer() * 1.5D : AdvancedConfig.getInstance().getRuptureDamagePlayer();
|
||||||
|
@ -56,7 +56,7 @@ public class TamingCommand extends SkillCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
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) {
|
if (canEnvironmentallyAware) {
|
||||||
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Taming.Ability.Bonus.0"), LocaleLoader.getString("Taming.Ability.Bonus.1")));
|
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Taming.Ability.Bonus.0"), LocaleLoader.getString("Taming.Ability.Bonus.1")));
|
||||||
|
@ -40,7 +40,7 @@ public class UnarmedCommand extends SkillCommand {
|
|||||||
protected void dataCalculations(Player player, float skillValue) {
|
protected void dataCalculations(Player player, float skillValue) {
|
||||||
// UNARMED_ARROW_DEFLECT
|
// UNARMED_ARROW_DEFLECT
|
||||||
if (canDeflect) {
|
if (canDeflect) {
|
||||||
String[] deflectStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.UNARMED_ARROW_DEFLECT);;
|
String[] deflectStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.UNARMED_ARROW_DEFLECT);
|
||||||
deflectChance = deflectStrings[0];
|
deflectChance = deflectStrings[0];
|
||||||
deflectChanceLucky = deflectStrings[1];
|
deflectChanceLucky = deflectStrings[1];
|
||||||
}
|
}
|
||||||
@ -54,7 +54,7 @@ public class UnarmedCommand extends SkillCommand {
|
|||||||
|
|
||||||
// UNARMED_DISARM
|
// UNARMED_DISARM
|
||||||
if (canDisarm) {
|
if (canDisarm) {
|
||||||
String[] disarmStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.UNARMED_DISARM);;
|
String[] disarmStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.UNARMED_DISARM);
|
||||||
disarmChance = disarmStrings[0];
|
disarmChance = disarmStrings[0];
|
||||||
disarmChanceLucky = disarmStrings[1];
|
disarmChanceLucky = disarmStrings[1];
|
||||||
}
|
}
|
||||||
@ -84,7 +84,7 @@ public class UnarmedCommand extends SkillCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
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) {
|
if (canDeflect) {
|
||||||
messages.add(getStatMessage(SubSkillType.UNARMED_ARROW_DEFLECT, deflectChance)
|
messages.add(getStatMessage(SubSkillType.UNARMED_ARROW_DEFLECT, deflectChance)
|
||||||
|
@ -46,7 +46,7 @@ public class WoodcuttingCommand extends SkillCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setDoubleDropClassicChanceStrings(Player player) {
|
private void setDoubleDropClassicChanceStrings(Player player) {
|
||||||
String[] doubleDropStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.WOODCUTTING_HARVEST_LUMBER);;
|
String[] doubleDropStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.WOODCUTTING_HARVEST_LUMBER);
|
||||||
doubleDropChance = doubleDropStrings[0];
|
doubleDropChance = doubleDropStrings[0];
|
||||||
doubleDropChanceLucky = doubleDropStrings[1];
|
doubleDropChanceLucky = doubleDropStrings[1];
|
||||||
}
|
}
|
||||||
@ -63,7 +63,7 @@ public class WoodcuttingCommand extends SkillCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
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) {
|
if (canDoubleDrop) {
|
||||||
messages.add(getStatMessage(SubSkillType.WOODCUTTING_HARVEST_LUMBER, doubleDropChance)
|
messages.add(getStatMessage(SubSkillType.WOODCUTTING_HARVEST_LUMBER, doubleDropChance)
|
||||||
|
@ -160,7 +160,7 @@ public class AdvancedConfig extends ConfigValidated {
|
|||||||
@Override
|
@Override
|
||||||
public List<String> validateKeys() {
|
public List<String> validateKeys() {
|
||||||
// Validate all the settings!
|
// Validate all the settings!
|
||||||
List<String> reason = new ArrayList<String>();
|
List<String> reason = new ArrayList<>();
|
||||||
|
|
||||||
/* GENERAL */
|
/* GENERAL */
|
||||||
if (getAbilityLength() < 1) {
|
if (getAbilityLength() < 1) {
|
||||||
|
@ -235,7 +235,7 @@ public class MainConfig extends ConfigValidated {
|
|||||||
@Override
|
@Override
|
||||||
public List<String> validateKeys() {
|
public List<String> validateKeys() {
|
||||||
// Validate all the settings!
|
// Validate all the settings!
|
||||||
List<String> reason = new ArrayList<String>();
|
List<String> reason = new ArrayList<>();
|
||||||
|
|
||||||
/* General Settings */
|
/* General Settings */
|
||||||
/*if (getSaveInterval() <= 0) {
|
/*if (getSaveInterval() <= 0) {
|
||||||
|
@ -49,7 +49,7 @@ public class RankConfig extends ConfigValidated {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> validateKeys() {
|
public List<String> validateKeys() {
|
||||||
List<String> reason = new ArrayList<String>();
|
List<String> reason = new ArrayList<>();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* In the future this method will check keys for all skills, but for now it only checks overhauled skills
|
* In the future this method will check keys for all skills, but for now it only checks overhauled skills
|
||||||
|
@ -77,7 +77,6 @@ public class ExperienceConfig extends ConfigValidated {
|
|||||||
public static final String OCELOT = "Ocelot";
|
public static final String OCELOT = "Ocelot";
|
||||||
public static final String WOLF = "Wolf";
|
public static final String WOLF = "Wolf";
|
||||||
public static final String FEATHER_FALL_MULTIPLIER = "FeatherFall_Multiplier";
|
public static final String FEATHER_FALL_MULTIPLIER = "FeatherFall_Multiplier";
|
||||||
private static ExperienceConfig instance;
|
|
||||||
|
|
||||||
//TODO: Should merge be false? Seems okay to leave it as true..
|
//TODO: Should merge be false? Seems okay to leave it as true..
|
||||||
public ExperienceConfig() {
|
public ExperienceConfig() {
|
||||||
@ -109,12 +108,12 @@ public class ExperienceConfig extends ConfigValidated {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void unload() {
|
public void unload() {
|
||||||
instance = null; //TODO: this might be a bit problematic
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> validateKeys() {
|
public List<String> validateKeys() {
|
||||||
List<String> reason = new ArrayList<String>();
|
List<String> reason = new ArrayList<>();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* FORMULA SETTINGS
|
* FORMULA SETTINGS
|
||||||
|
@ -7,32 +7,32 @@ public final class HOCONUtil {
|
|||||||
public static String serializeENUMName(String hyphenedString)
|
public static String serializeENUMName(String hyphenedString)
|
||||||
{
|
{
|
||||||
String[] split = hyphenedString.split("_");
|
String[] split = hyphenedString.split("_");
|
||||||
String formattedString = "";
|
StringBuilder formattedString = new StringBuilder();
|
||||||
|
|
||||||
for(int x = 0; x < split.length; x++)
|
for(int x = 0; x < split.length; x++)
|
||||||
{
|
{
|
||||||
if(x + 1 >= split.length)
|
if(x + 1 >= split.length)
|
||||||
formattedString += StringUtils.getCapitalized(split[x]);
|
formattedString.append(StringUtils.getCapitalized(split[x]));
|
||||||
else
|
else
|
||||||
formattedString+= (StringUtils.getCapitalized(split[x]) + '-');
|
formattedString.append(StringUtils.getCapitalized(split[x])).append('-');
|
||||||
}
|
}
|
||||||
|
|
||||||
return formattedString;
|
return formattedString.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String deserializeENUMName(String serializedName)
|
public static String deserializeENUMName(String serializedName)
|
||||||
{
|
{
|
||||||
String[] split = serializedName.split("-");
|
String[] split = serializedName.split("-");
|
||||||
String formattedString = "";
|
StringBuilder formattedString = new StringBuilder();
|
||||||
|
|
||||||
for(int x = 0; x < split.length; x++)
|
for(int x = 0; x < split.length; x++)
|
||||||
{
|
{
|
||||||
if(x + 1 >= split.length)
|
if(x + 1 >= split.length)
|
||||||
formattedString += split[x].toUpperCase();
|
formattedString.append(split[x].toUpperCase());
|
||||||
else
|
else
|
||||||
formattedString+= (split[x] + '_');
|
formattedString.append(split[x]).append('_');
|
||||||
}
|
}
|
||||||
|
|
||||||
return formattedString;
|
return formattedString.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ public class PotionConfig extends ConfigCollection {
|
|||||||
private List<ItemStack> concoctionsIngredientsTierSeven;
|
private List<ItemStack> concoctionsIngredientsTierSeven;
|
||||||
private List<ItemStack> concoctionsIngredientsTierEight;
|
private List<ItemStack> concoctionsIngredientsTierEight;
|
||||||
|
|
||||||
private Map<String, AlchemyPotion> potionMap = new HashMap<String, AlchemyPotion>();
|
private Map<String, AlchemyPotion> potionMap = new HashMap<>();
|
||||||
|
|
||||||
public PotionConfig() {
|
public PotionConfig() {
|
||||||
super("skillranks", mcMMO.p.getDataFolder().getAbsoluteFile(), ConfigConstants.RELATIVE_PATH_CONFIG_DIR, true, true, true, true);
|
super("skillranks", mcMMO.p.getDataFolder().getAbsoluteFile(), ConfigConstants.RELATIVE_PATH_CONFIG_DIR, true, true, true, true);
|
||||||
@ -211,14 +211,14 @@ public class PotionConfig extends ConfigCollection {
|
|||||||
material = Material.valueOf(materialTypeString);
|
material = Material.valueOf(materialTypeString);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> lore = new ArrayList<String>();
|
List<String> lore = new ArrayList<>();
|
||||||
if (potion_section.getNode(LORE) != null) {
|
if (potion_section.getNode(LORE) != null) {
|
||||||
for (String line : potion_section.getNode(LORE).getList(TypeToken.of(String.class))) {
|
for (String line : potion_section.getNode(LORE).getList(TypeToken.of(String.class))) {
|
||||||
lore.add(ChatColor.translateAlternateColorCodes('&', line));
|
lore.add(ChatColor.translateAlternateColorCodes('&', line));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<PotionEffect> effects = new ArrayList<PotionEffect>();
|
List<PotionEffect> effects = new ArrayList<>();
|
||||||
if (potion_section.getNode(EFFECTS) != null) {
|
if (potion_section.getNode(EFFECTS) != null) {
|
||||||
for (String effect : potion_section.getNode(EFFECTS).getList(TypeToken.of(String.class))) {
|
for (String effect : potion_section.getNode(EFFECTS).getList(TypeToken.of(String.class))) {
|
||||||
String[] parts = effect.split(" ");
|
String[] parts = effect.split(" ");
|
||||||
@ -235,14 +235,14 @@ public class PotionConfig extends ConfigCollection {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Color color = null;
|
Color color;
|
||||||
if (potion_section.getNode(COLOR) != null) {
|
if (potion_section.getNode(COLOR) != null) {
|
||||||
color = Color.fromRGB(potion_section.getNode(COLOR).getInt());
|
color = Color.fromRGB(potion_section.getNode(COLOR).getInt());
|
||||||
} else {
|
} else {
|
||||||
color = this.generateColor(effects);
|
color = this.generateColor(effects);
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<ItemStack, String> children = new HashMap<ItemStack, String>();
|
Map<ItemStack, String> children = new HashMap<>();
|
||||||
if (potion_section.getNode(CHILDREN) != null) {
|
if (potion_section.getNode(CHILDREN) != null) {
|
||||||
for (String child : potion_section.getNode(CHILDREN).getList(TypeToken.of(String.class))) {
|
for (String child : potion_section.getNode(CHILDREN).getList(TypeToken.of(String.class))) {
|
||||||
ItemStack ingredient = loadIngredient(child);
|
ItemStack ingredient = loadIngredient(child);
|
||||||
@ -324,7 +324,7 @@ public class PotionConfig extends ConfigCollection {
|
|||||||
|
|
||||||
public Color generateColor(List<PotionEffect> effects) {
|
public Color generateColor(List<PotionEffect> effects) {
|
||||||
if (effects != null && !effects.isEmpty()) {
|
if (effects != null && !effects.isEmpty()) {
|
||||||
List<Color> colors = new ArrayList<Color>();
|
List<Color> colors = new ArrayList<>();
|
||||||
for (PotionEffect effect : effects) {
|
for (PotionEffect effect : effects) {
|
||||||
if (effect.getType().getColor() != null) {
|
if (effect.getType().getColor() != null) {
|
||||||
colors.add(effect.getType().getColor());
|
colors.add(effect.getType().getColor());
|
||||||
|
@ -23,7 +23,7 @@ public class ExcavationTreasureConfig extends Config implements UnsafeValueValid
|
|||||||
public static final String DROP_LEVEL = "Drop_Level";
|
public static final String DROP_LEVEL = "Drop_Level";
|
||||||
public static final String CUSTOM_NAME = "Custom_Name";
|
public static final String CUSTOM_NAME = "Custom_Name";
|
||||||
public static final String LORE = "Lore";
|
public static final String LORE = "Lore";
|
||||||
public HashMap<String, List<ExcavationTreasure>> excavationMap = new HashMap<String, List<ExcavationTreasure>>();
|
public HashMap<String, List<ExcavationTreasure>> excavationMap = new HashMap<>();
|
||||||
|
|
||||||
public ExcavationTreasureConfig() {
|
public ExcavationTreasureConfig() {
|
||||||
super("excavation_drops", mcMMO.p.getDataFolder().getAbsoluteFile(), ConfigConstants.RELATIVE_PATH_CONFIG_DIR, true, false, true, false);
|
super("excavation_drops", mcMMO.p.getDataFolder().getAbsoluteFile(), ConfigConstants.RELATIVE_PATH_CONFIG_DIR, true, false, true, false);
|
||||||
@ -141,8 +141,7 @@ public class ExcavationTreasureConfig extends Config implements UnsafeValueValid
|
|||||||
*/
|
*/
|
||||||
for(String dropBlock : dropsFrom)
|
for(String dropBlock : dropsFrom)
|
||||||
{
|
{
|
||||||
if(excavationMap.get(dropBlock) == null)
|
excavationMap.computeIfAbsent(dropBlock, k -> new ArrayList<>());
|
||||||
excavationMap.put(dropBlock, new ArrayList<>());
|
|
||||||
|
|
||||||
excavationMap.get(dropBlock).add(excavationTreasure);
|
excavationMap.get(dropBlock).add(excavationTreasure);
|
||||||
}
|
}
|
||||||
|
@ -40,9 +40,9 @@ public class FishingTreasureConfig extends Config implements UnsafeValueValidati
|
|||||||
public static final String RARITY = "Rarity";
|
public static final String RARITY = "Rarity";
|
||||||
public static final String DROPS_FROM = "Drops_From";
|
public static final String DROPS_FROM = "Drops_From";
|
||||||
|
|
||||||
public HashMap<EntityType, List<ShakeTreasure>> shakeMap = new HashMap<EntityType, List<ShakeTreasure>>();
|
public HashMap<EntityType, List<ShakeTreasure>> shakeMap = new HashMap<>();
|
||||||
public HashMap<Rarity, List<FishingTreasure>> fishingRewards = new HashMap<Rarity, List<FishingTreasure>>();
|
public HashMap<Rarity, List<FishingTreasure>> fishingRewards = new HashMap<>();
|
||||||
public HashMap<Rarity, List<EnchantmentTreasure>> fishingEnchantments = new HashMap<Rarity, List<EnchantmentTreasure>>();
|
public HashMap<Rarity, List<EnchantmentTreasure>> fishingEnchantments = new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This grabs an instance of this config class from the Config Manager
|
* This grabs an instance of this config class from the Config Manager
|
||||||
@ -81,7 +81,7 @@ public class FishingTreasureConfig extends Config implements UnsafeValueValidati
|
|||||||
// Initialize fishing HashMap
|
// Initialize fishing HashMap
|
||||||
for (Rarity rarity : Rarity.values()) {
|
for (Rarity rarity : Rarity.values()) {
|
||||||
if (!fishingRewards.containsKey(rarity)) {
|
if (!fishingRewards.containsKey(rarity)) {
|
||||||
fishingRewards.put(rarity, (new ArrayList<FishingTreasure>()));
|
fishingRewards.put(rarity, (new ArrayList<>()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -276,8 +276,7 @@ public class FishingTreasureConfig extends Config implements UnsafeValueValidati
|
|||||||
/*
|
/*
|
||||||
* Add to map
|
* Add to map
|
||||||
*/
|
*/
|
||||||
if(shakeMap.get(entityType) == null)
|
shakeMap.computeIfAbsent(entityType, k -> new ArrayList<>());
|
||||||
shakeMap.put(entityType, new ArrayList<>());
|
|
||||||
|
|
||||||
shakeMap.get(entityType).add(shakeTreasure);
|
shakeMap.get(entityType).add(shakeTreasure);
|
||||||
|
|
||||||
@ -297,7 +296,7 @@ public class FishingTreasureConfig extends Config implements UnsafeValueValidati
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!fishingEnchantments.containsKey(rarity)) {
|
if (!fishingEnchantments.containsKey(rarity)) {
|
||||||
fishingEnchantments.put(rarity, (new ArrayList<EnchantmentTreasure>()));
|
fishingEnchantments.put(rarity, (new ArrayList<>()));
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigurationNode enchantmentSection = getUserRootNode().getNode(ENCHANTMENTS_RARITY, rarity.toString());
|
ConfigurationNode enchantmentSection = getUserRootNode().getNode(ENCHANTMENTS_RARITY, rarity.toString());
|
||||||
@ -334,7 +333,7 @@ public class FishingTreasureConfig extends Config implements UnsafeValueValidati
|
|||||||
@Override
|
@Override
|
||||||
public List<String> validateKeys() {
|
public List<String> validateKeys() {
|
||||||
// Validate all the settings!
|
// Validate all the settings!
|
||||||
List<String> errorMessages = new ArrayList<String>();
|
List<String> errorMessages = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
for (String tier : getUserRootNode().getNode(ENCHANTMENT_DROP_RATES).getList(TypeToken.of(String.class))) {
|
for (String tier : getUserRootNode().getNode(ENCHANTMENT_DROP_RATES).getList(TypeToken.of(String.class))) {
|
||||||
/*double totalEnchantDropRate = 0;
|
/*double totalEnchantDropRate = 0;
|
||||||
|
@ -26,7 +26,7 @@ public class HerbalismTreasureConfig extends Config implements UnsafeValueValida
|
|||||||
public static final String CUSTOM_NAME = "Custom_Name";
|
public static final String CUSTOM_NAME = "Custom_Name";
|
||||||
public static final String LORE = "Lore";
|
public static final String LORE = "Lore";
|
||||||
|
|
||||||
public HashMap<String, List<HylianTreasure>> hylianMap = new HashMap<String, List<HylianTreasure>>();
|
public HashMap<String, List<HylianTreasure>> hylianMap = new HashMap<>();
|
||||||
|
|
||||||
public HerbalismTreasureConfig() {
|
public HerbalismTreasureConfig() {
|
||||||
super("hylian_luck_drops", mcMMO.p.getDataFolder().getAbsoluteFile(), ConfigConstants.RELATIVE_PATH_CONFIG_DIR, true, false, true, false);
|
super("hylian_luck_drops", mcMMO.p.getDataFolder().getAbsoluteFile(), ConfigConstants.RELATIVE_PATH_CONFIG_DIR, true, false, true, false);
|
||||||
@ -206,7 +206,7 @@ public class HerbalismTreasureConfig extends Config implements UnsafeValueValida
|
|||||||
|
|
||||||
private void addHylianTreasure(String dropper, HylianTreasure treasure) {
|
private void addHylianTreasure(String dropper, HylianTreasure treasure) {
|
||||||
if (!hylianMap.containsKey(dropper))
|
if (!hylianMap.containsKey(dropper))
|
||||||
hylianMap.put(dropper, new ArrayList<HylianTreasure>());
|
hylianMap.put(dropper, new ArrayList<>());
|
||||||
|
|
||||||
hylianMap.get(dropper).add(treasure);
|
hylianMap.get(dropper).add(treasure);
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ public class TreasureFactory {
|
|||||||
if(customLore != null && !customLore.getString().equalsIgnoreCase(CHANGE_ME))
|
if(customLore != null && !customLore.getString().equalsIgnoreCase(CHANGE_ME))
|
||||||
{
|
{
|
||||||
ItemMeta itemMeta = treasure.getItemMeta();
|
ItemMeta itemMeta = treasure.getItemMeta();
|
||||||
List<String> lore = new ArrayList<String>();
|
List<String> lore = new ArrayList<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
//TODO: Not sure how this will be handled by Configurate
|
//TODO: Not sure how this will be handled by Configurate
|
||||||
|
@ -16,8 +16,8 @@ import java.io.*;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public final class FlatfileDatabaseManager implements DatabaseManager {
|
public final class FlatfileDatabaseManager implements DatabaseManager {
|
||||||
private final HashMap<PrimarySkillType, List<PlayerStat>> playerStatHash = new HashMap<PrimarySkillType, List<PlayerStat>>();
|
private final HashMap<PrimarySkillType, List<PlayerStat>> playerStatHash = new HashMap<>();
|
||||||
private final List<PlayerStat> powerLevels = new ArrayList<PlayerStat>();
|
private final List<PlayerStat> powerLevels = new ArrayList<>();
|
||||||
private long lastUpdate = 0;
|
private long lastUpdate = 0;
|
||||||
private long updateWaitTime;
|
private long updateWaitTime;
|
||||||
private final File usersFile;
|
private final File usersFile;
|
||||||
@ -364,7 +364,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
|||||||
public Map<PrimarySkillType, Integer> readRank(String playerName) {
|
public Map<PrimarySkillType, Integer> readRank(String playerName) {
|
||||||
updateLeaderboards();
|
updateLeaderboards();
|
||||||
|
|
||||||
Map<PrimarySkillType, Integer> skills = new HashMap<PrimarySkillType, Integer>();
|
Map<PrimarySkillType, Integer> skills = new HashMap<>();
|
||||||
|
|
||||||
for (PrimarySkillType skill : PrimarySkillType.NON_CHILD_SKILLS) {
|
for (PrimarySkillType skill : PrimarySkillType.NON_CHILD_SKILLS) {
|
||||||
skills.put(skill, getPlayerRank(playerName, playerStatHash.get(skill)));
|
skills.put(skill, getPlayerRank(playerName, playerStatHash.get(skill)));
|
||||||
@ -652,7 +652,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
character[UUID_INDEX] = fetchedUUIDs.remove(character[USERNAME]).toString();
|
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++;
|
i++;
|
||||||
@ -690,7 +690,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getStoredUsers() {
|
public List<String> getStoredUsers() {
|
||||||
ArrayList<String> users = new ArrayList<String>();
|
ArrayList<String> users = new ArrayList<>();
|
||||||
BufferedReader in = null;
|
BufferedReader in = null;
|
||||||
String usersFilePath = mcMMO.getUsersFilePath();
|
String usersFilePath = mcMMO.getUsersFilePath();
|
||||||
|
|
||||||
@ -736,19 +736,19 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
|||||||
powerLevels.clear(); // Clear old values from the power levels
|
powerLevels.clear(); // Clear old values from the power levels
|
||||||
|
|
||||||
// Initialize lists
|
// Initialize lists
|
||||||
List<PlayerStat> mining = new ArrayList<PlayerStat>();
|
List<PlayerStat> mining = new ArrayList<>();
|
||||||
List<PlayerStat> woodcutting = new ArrayList<PlayerStat>();
|
List<PlayerStat> woodcutting = new ArrayList<>();
|
||||||
List<PlayerStat> herbalism = new ArrayList<PlayerStat>();
|
List<PlayerStat> herbalism = new ArrayList<>();
|
||||||
List<PlayerStat> excavation = new ArrayList<PlayerStat>();
|
List<PlayerStat> excavation = new ArrayList<>();
|
||||||
List<PlayerStat> acrobatics = new ArrayList<PlayerStat>();
|
List<PlayerStat> acrobatics = new ArrayList<>();
|
||||||
List<PlayerStat> repair = new ArrayList<PlayerStat>();
|
List<PlayerStat> repair = new ArrayList<>();
|
||||||
List<PlayerStat> swords = new ArrayList<PlayerStat>();
|
List<PlayerStat> swords = new ArrayList<>();
|
||||||
List<PlayerStat> axes = new ArrayList<PlayerStat>();
|
List<PlayerStat> axes = new ArrayList<>();
|
||||||
List<PlayerStat> archery = new ArrayList<PlayerStat>();
|
List<PlayerStat> archery = new ArrayList<>();
|
||||||
List<PlayerStat> unarmed = new ArrayList<PlayerStat>();
|
List<PlayerStat> unarmed = new ArrayList<>();
|
||||||
List<PlayerStat> taming = new ArrayList<PlayerStat>();
|
List<PlayerStat> taming = new ArrayList<>();
|
||||||
List<PlayerStat> fishing = new ArrayList<PlayerStat>();
|
List<PlayerStat> fishing = new ArrayList<>();
|
||||||
List<PlayerStat> alchemy = new ArrayList<PlayerStat>();
|
List<PlayerStat> alchemy = new ArrayList<>();
|
||||||
|
|
||||||
BufferedReader in = null;
|
BufferedReader in = null;
|
||||||
String playerName = null;
|
String playerName = null;
|
||||||
@ -843,8 +843,8 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
|||||||
in = new BufferedReader(new FileReader(usersFilePath));
|
in = new BufferedReader(new FileReader(usersFilePath));
|
||||||
StringBuilder writer = new StringBuilder();
|
StringBuilder writer = new StringBuilder();
|
||||||
String line;
|
String line;
|
||||||
HashSet<String> usernames = new HashSet<String>();
|
HashSet<String> usernames = new HashSet<>();
|
||||||
HashSet<String> players = new HashSet<String>();
|
HashSet<String> players = new HashSet<>();
|
||||||
|
|
||||||
while ((line = in.readLine()) != null) {
|
while ((line = in.readLine()) != null) {
|
||||||
// Remove empty lines from the file
|
// Remove empty lines from the file
|
||||||
@ -1047,7 +1047,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (updated) {
|
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");
|
writer.append(line).append("\r\n");
|
||||||
@ -1133,9 +1133,9 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
|||||||
|
|
||||||
private PlayerProfile loadFromLine(String[] character) {
|
private PlayerProfile loadFromLine(String[] character) {
|
||||||
Map<PrimarySkillType, Integer> skills = getSkillMapFromLine(character); // Skill levels
|
Map<PrimarySkillType, Integer> skills = getSkillMapFromLine(character); // Skill levels
|
||||||
Map<PrimarySkillType, Float> skillsXp = new EnumMap<PrimarySkillType, Float>(PrimarySkillType.class); // Skill & XP
|
Map<PrimarySkillType, Float> skillsXp = new EnumMap<>(PrimarySkillType.class); // Skill & XP
|
||||||
Map<SuperAbilityType, Integer> skillsDATS = new EnumMap<SuperAbilityType, Integer>(SuperAbilityType.class); // Ability & Cooldown
|
Map<SuperAbilityType, Integer> skillsDATS = new EnumMap<>(SuperAbilityType.class); // Ability & Cooldown
|
||||||
Map<UniqueDataType, Integer> uniquePlayerDataMap = new EnumMap<UniqueDataType, Integer>(UniqueDataType.class);
|
Map<UniqueDataType, Integer> uniquePlayerDataMap = new EnumMap<>(UniqueDataType.class);
|
||||||
MobHealthbarType mobHealthbarType;
|
MobHealthbarType mobHealthbarType;
|
||||||
int scoreboardTipsShown;
|
int scoreboardTipsShown;
|
||||||
|
|
||||||
@ -1201,7 +1201,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Map<PrimarySkillType, Integer> getSkillMapFromLine(String[] character) {
|
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.TAMING, Integer.valueOf(character[SKILLS_TAMING]));
|
||||||
skills.put(PrimarySkillType.MINING, Integer.valueOf(character[SKILLS_MINING]));
|
skills.put(PrimarySkillType.MINING, Integer.valueOf(character[SKILLS_MINING]));
|
||||||
@ -1322,7 +1322,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
|
|||||||
|
|
||||||
character[HEALTHBAR] = mcMMO.getConfigManager().getConfigMobs().getCombat().getHealthBars().getDisplayBarType().toString();
|
character[HEALTHBAR] = mcMMO.getConfigManager().getConfigMobs().getCombat().getHealthBars().getDisplayBarType().toString();
|
||||||
|
|
||||||
line = new StringBuilder(org.apache.commons.lang.StringUtils.join(character, ":")).append(":").toString();
|
line = org.apache.commons.lang.StringUtils.join(character, ":") + ":";
|
||||||
|
|
||||||
writer.append(line).append("\r\n");
|
writer.append(line).append("\r\n");
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
public static final String COM_MYSQL_JDBC_DRIVER = "com.mysql.jdbc.Driver";
|
public static final String COM_MYSQL_JDBC_DRIVER = "com.mysql.jdbc.Driver";
|
||||||
private String tablePrefix = mcMMO.getMySQLConfigSettings().getConfigSectionDatabase().getTablePrefix();
|
private String tablePrefix = mcMMO.getMySQLConfigSettings().getConfigSectionDatabase().getTablePrefix();
|
||||||
|
|
||||||
private final Map<UUID, Integer> cachedUserIDs = new HashMap<UUID, Integer>();
|
private final Map<UUID, Integer> cachedUserIDs = new HashMap<>();
|
||||||
|
|
||||||
private DataSource miscPool;
|
private DataSource miscPool;
|
||||||
private DataSource loadPool;
|
private DataSource loadPool;
|
||||||
@ -344,7 +344,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<PlayerStat> readLeaderboard(PrimarySkillType skill, int pageNumber, int statsPerPage) {
|
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();
|
String query = skill == null ? ALL_QUERY_VERSION : skill.name().toLowerCase();
|
||||||
ResultSet resultSet = null;
|
ResultSet resultSet = null;
|
||||||
@ -359,7 +359,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
resultSet = statement.executeQuery();
|
resultSet = statement.executeQuery();
|
||||||
|
|
||||||
while (resultSet.next()) {
|
while (resultSet.next()) {
|
||||||
ArrayList<String> column = new ArrayList<String>();
|
ArrayList<String> column = new ArrayList<>();
|
||||||
|
|
||||||
for (int i = 1; i <= resultSet.getMetaData().getColumnCount(); i++) {
|
for (int i = 1; i <= resultSet.getMetaData().getColumnCount(); i++) {
|
||||||
column.add(resultSet.getString(i));
|
column.add(resultSet.getString(i));
|
||||||
@ -381,7 +381,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Map<PrimarySkillType, Integer> readRank(String playerName) {
|
public Map<PrimarySkillType, Integer> readRank(String playerName) {
|
||||||
Map<PrimarySkillType, Integer> skills = new HashMap<PrimarySkillType, Integer>();
|
Map<PrimarySkillType, Integer> skills = new HashMap<>();
|
||||||
|
|
||||||
ResultSet resultSet = null;
|
ResultSet resultSet = null;
|
||||||
PreparedStatement statement = null;
|
PreparedStatement statement = null;
|
||||||
@ -751,7 +751,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getStoredUsers() {
|
public List<String> getStoredUsers() {
|
||||||
ArrayList<String> users = new ArrayList<String>();
|
ArrayList<String> users = new ArrayList<>();
|
||||||
|
|
||||||
Statement statement = null;
|
Statement statement = null;
|
||||||
Connection connection = null;
|
Connection connection = null;
|
||||||
@ -1077,10 +1077,10 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private PlayerProfile loadFromResult(String playerName, ResultSet result) throws SQLException {
|
private PlayerProfile loadFromResult(String playerName, ResultSet result) throws SQLException {
|
||||||
Map<PrimarySkillType, Integer> skills = new EnumMap<PrimarySkillType, Integer>(PrimarySkillType.class); // Skill & Level
|
Map<PrimarySkillType, Integer> skills = new EnumMap<>(PrimarySkillType.class); // Skill & Level
|
||||||
Map<PrimarySkillType, Float> skillsXp = new EnumMap<PrimarySkillType, Float>(PrimarySkillType.class); // Skill & XP
|
Map<PrimarySkillType, Float> skillsXp = new EnumMap<>(PrimarySkillType.class); // Skill & XP
|
||||||
Map<SuperAbilityType, Integer> skillsDATS = new EnumMap<SuperAbilityType, Integer>(SuperAbilityType.class); // Ability & Cooldown
|
Map<SuperAbilityType, Integer> skillsDATS = new EnumMap<>(SuperAbilityType.class); // Ability & Cooldown
|
||||||
Map<UniqueDataType, Integer> uniqueData = new EnumMap<UniqueDataType, Integer>(UniqueDataType.class); //Chimaera wing cooldown and other misc info
|
Map<UniqueDataType, Integer> uniqueData = new EnumMap<>(UniqueDataType.class); //Chimaera wing cooldown and other misc info
|
||||||
MobHealthbarType mobHealthbarType;
|
MobHealthbarType mobHealthbarType;
|
||||||
UUID uuid;
|
UUID uuid;
|
||||||
int scoreboardTipsShown;
|
int scoreboardTipsShown;
|
||||||
|
@ -9,7 +9,7 @@ public enum ChatMode {
|
|||||||
private String enabledMessage;
|
private String enabledMessage;
|
||||||
private String disabledMessage;
|
private String disabledMessage;
|
||||||
|
|
||||||
private ChatMode(String enabledMessage, String disabledMessage) {
|
ChatMode(String enabledMessage, String disabledMessage) {
|
||||||
this.enabledMessage = enabledMessage;
|
this.enabledMessage = enabledMessage;
|
||||||
this.disabledMessage = disabledMessage;
|
this.disabledMessage = disabledMessage;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.gmail.nossr50.datatypes.database;
|
|||||||
|
|
||||||
public class PlayerStat {
|
public class PlayerStat {
|
||||||
public String name;
|
public String name;
|
||||||
public int statVal = 0;
|
public int statVal;
|
||||||
|
|
||||||
public PlayerStat(String name, int value) {
|
public PlayerStat(String name, int value) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
package com.gmail.nossr50.datatypes.database;
|
package com.gmail.nossr50.datatypes.database;
|
||||||
|
|
||||||
public enum PoolIdentifier {
|
public enum PoolIdentifier {
|
||||||
|
MISC,
|
||||||
|
LOAD,
|
||||||
|
SAVE
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,8 @@ import java.util.List;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class Party {
|
public class Party {
|
||||||
private final LinkedHashMap<UUID, String> members = new LinkedHashMap<UUID, String>();
|
private final LinkedHashMap<UUID, String> members = new LinkedHashMap<>();
|
||||||
private final List<Player> onlineMembers = new ArrayList<Player>();
|
private final List<Player> onlineMembers = new ArrayList<>();
|
||||||
|
|
||||||
private PartyLeader leader;
|
private PartyLeader leader;
|
||||||
private String name;
|
private String name;
|
||||||
@ -90,7 +90,7 @@ public class Party {
|
|||||||
|
|
||||||
public List<String> getOnlinePlayerNames(CommandSender sender) {
|
public List<String> getOnlinePlayerNames(CommandSender sender) {
|
||||||
Player player = sender instanceof Player ? (Player) sender : null;
|
Player player = sender instanceof Player ? (Player) sender : null;
|
||||||
List<String> onlinePlayerNames = new ArrayList<String>();
|
List<String> onlinePlayerNames = new ArrayList<>();
|
||||||
|
|
||||||
for (Player onlinePlayer : getOnlineMembers()) {
|
for (Player onlinePlayer : getOnlineMembers()) {
|
||||||
if (player != null && player.canSee(onlinePlayer)) {
|
if (player != null && player.canSee(onlinePlayer)) {
|
||||||
@ -130,7 +130,7 @@ public class Party {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getItemShareCategories() {
|
public List<String> getItemShareCategories() {
|
||||||
List<String> shareCategories = new ArrayList<String>();
|
List<String> shareCategories = new ArrayList<>();
|
||||||
|
|
||||||
for (ItemShareType shareType : ItemShareType.values()) {
|
for (ItemShareType shareType : ItemShareType.values()) {
|
||||||
if (sharingDrops(shareType)) {
|
if (sharingDrops(shareType)) {
|
||||||
|
@ -67,7 +67,7 @@ public class McMMOPlayer {
|
|||||||
private Player player;
|
private Player player;
|
||||||
private PlayerProfile profile;
|
private PlayerProfile profile;
|
||||||
|
|
||||||
private final Map<PrimarySkillType, SkillManager> skillManagers = new HashMap<PrimarySkillType, SkillManager>();
|
private final Map<PrimarySkillType, SkillManager> skillManagers = new HashMap<>();
|
||||||
private ExperienceBarManager experienceBarManager;
|
private ExperienceBarManager experienceBarManager;
|
||||||
|
|
||||||
private Party party;
|
private Party party;
|
||||||
@ -85,10 +85,10 @@ public class McMMOPlayer {
|
|||||||
private boolean godMode;
|
private boolean godMode;
|
||||||
private boolean chatSpy = false; //Off by default
|
private boolean chatSpy = false; //Off by default
|
||||||
|
|
||||||
private final Map<SuperAbilityType, Boolean> abilityMode = new HashMap<SuperAbilityType, Boolean>();
|
private final Map<SuperAbilityType, Boolean> abilityMode = new HashMap<>();
|
||||||
private final Map<SuperAbilityType, Boolean> abilityInformed = new HashMap<SuperAbilityType, Boolean>();
|
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 recentlyHurt;
|
||||||
private int respawnATS;
|
private int respawnATS;
|
||||||
|
@ -29,14 +29,14 @@ public class PlayerProfile {
|
|||||||
private int scoreboardTipsShown;
|
private int scoreboardTipsShown;
|
||||||
|
|
||||||
/* Skill Data */
|
/* Skill Data */
|
||||||
private final Map<PrimarySkillType, Integer> skills = new HashMap<PrimarySkillType, Integer>(); // Skill & Level
|
private final Map<PrimarySkillType, Integer> skills = new HashMap<>(); // Skill & Level
|
||||||
private final Map<PrimarySkillType, Float> skillsXp = new HashMap<PrimarySkillType, Float>(); // Skill & XP
|
private final Map<PrimarySkillType, Float> skillsXp = new HashMap<>(); // Skill & XP
|
||||||
private final Map<SuperAbilityType, Integer> abilityDATS = new HashMap<SuperAbilityType, Integer>(); // Ability & Cooldown
|
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..)
|
private final Map<UniqueDataType, Integer> uniquePlayerData = new HashMap<>(); //Misc data that doesn't fit into other categories (chimaera wing, etc..)
|
||||||
|
|
||||||
// Store previous XP gains for deminished returns
|
// Store previous XP gains for deminished returns
|
||||||
private DelayQueue<SkillXpGain> gainedSkillsXp = new DelayQueue<SkillXpGain>();
|
private DelayQueue<SkillXpGain> gainedSkillsXp = new DelayQueue<>();
|
||||||
private HashMap<PrimarySkillType, Float> rollingSkillsXp = new HashMap<PrimarySkillType, Float>();
|
private HashMap<PrimarySkillType, Float> rollingSkillsXp = new HashMap<>();
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public PlayerProfile(String playerName) {
|
public PlayerProfile(String playerName) {
|
||||||
|
@ -3,5 +3,5 @@ package com.gmail.nossr50.datatypes.skills;
|
|||||||
public enum ItemType {
|
public enum ItemType {
|
||||||
ARMOR,
|
ARMOR,
|
||||||
TOOL,
|
TOOL,
|
||||||
OTHER;
|
OTHER
|
||||||
}
|
}
|
||||||
|
@ -82,9 +82,9 @@ public enum PrimarySkillType {
|
|||||||
public static final List<PrimarySkillType> MISC_SKILLS = ImmutableList.of(ACROBATICS, ALCHEMY, REPAIR, SALVAGE, SMELTING);
|
public static final List<PrimarySkillType> MISC_SKILLS = ImmutableList.of(ACROBATICS, ALCHEMY, REPAIR, SALVAGE, SMELTING);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
List<PrimarySkillType> childSkills = new ArrayList<PrimarySkillType>();
|
List<PrimarySkillType> childSkills = new ArrayList<>();
|
||||||
List<PrimarySkillType> nonChildSkills = new ArrayList<PrimarySkillType>();
|
List<PrimarySkillType> nonChildSkills = new ArrayList<>();
|
||||||
ArrayList<String> names = new ArrayList<String>();
|
ArrayList<String> names = new ArrayList<>();
|
||||||
ArrayList<String> subSkillNames = new ArrayList<>();
|
ArrayList<String> subSkillNames = new ArrayList<>();
|
||||||
|
|
||||||
for (PrimarySkillType skill : values()) {
|
for (PrimarySkillType skill : values()) {
|
||||||
@ -110,11 +110,11 @@ public enum PrimarySkillType {
|
|||||||
NON_CHILD_SKILLS = ImmutableList.copyOf(nonChildSkills);
|
NON_CHILD_SKILLS = ImmutableList.copyOf(nonChildSkills);
|
||||||
}
|
}
|
||||||
|
|
||||||
private PrimarySkillType(Class<? extends SkillManager> managerClass, Color runescapeColor, List<SubSkillType> subSkillTypes) {
|
PrimarySkillType(Class<? extends SkillManager> managerClass, Color runescapeColor, List<SubSkillType> subSkillTypes) {
|
||||||
this(managerClass, runescapeColor, null, null, subSkillTypes);
|
this(managerClass, runescapeColor, null, null, subSkillTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
private PrimarySkillType(Class<? extends SkillManager> managerClass, Color runescapeColor, SuperAbilityType ability, ToolType tool, List<SubSkillType> subSkillTypes) {
|
PrimarySkillType(Class<? extends SkillManager> managerClass, Color runescapeColor, SuperAbilityType ability, ToolType tool, List<SubSkillType> subSkillTypes) {
|
||||||
this.managerClass = managerClass;
|
this.managerClass = managerClass;
|
||||||
this.runescapeColor = runescapeColor;
|
this.runescapeColor = runescapeColor;
|
||||||
this.ability = ability;
|
this.ability = ability;
|
||||||
|
@ -182,7 +182,7 @@ public enum SubSkillType {
|
|||||||
/*
|
/*
|
||||||
* Find where to begin our substring (after the prefix)
|
* Find where to begin our substring (after the prefix)
|
||||||
*/
|
*/
|
||||||
String endResult = "";
|
StringBuilder endResult = new StringBuilder();
|
||||||
int subStringIndex = getSubStringIndex(subSkillName);
|
int subStringIndex = getSubStringIndex(subSkillName);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -191,24 +191,24 @@ public enum SubSkillType {
|
|||||||
String subskillNameWithoutPrefix = subSkillName.substring(subStringIndex);
|
String subskillNameWithoutPrefix = subSkillName.substring(subStringIndex);
|
||||||
if(subskillNameWithoutPrefix.contains("_"))
|
if(subskillNameWithoutPrefix.contains("_"))
|
||||||
{
|
{
|
||||||
String splitStrings[] = subskillNameWithoutPrefix.split("_");
|
String[] splitStrings = subskillNameWithoutPrefix.split("_");
|
||||||
|
|
||||||
for(String string : splitStrings)
|
for(String string : splitStrings)
|
||||||
{
|
{
|
||||||
endResult += StringUtils.getCapitalized(string);
|
endResult.append(StringUtils.getCapitalized(string));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
endResult += StringUtils.getCapitalized(subskillNameWithoutPrefix);
|
endResult.append(StringUtils.getCapitalized(subskillNameWithoutPrefix));
|
||||||
}
|
}
|
||||||
|
|
||||||
return endResult;
|
return endResult.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getWikiName(String subSkillName) {
|
public String getWikiName(String subSkillName) {
|
||||||
/*
|
/*
|
||||||
* Find where to begin our substring (after the prefix)
|
* Find where to begin our substring (after the prefix)
|
||||||
*/
|
*/
|
||||||
String endResult = "";
|
StringBuilder endResult = new StringBuilder();
|
||||||
int subStringIndex = getSubStringIndex(subSkillName);
|
int subStringIndex = getSubStringIndex(subSkillName);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -217,22 +217,22 @@ public enum SubSkillType {
|
|||||||
String subskillNameWithoutPrefix = subSkillName.substring(subStringIndex);
|
String subskillNameWithoutPrefix = subSkillName.substring(subStringIndex);
|
||||||
if(subskillNameWithoutPrefix.contains("_"))
|
if(subskillNameWithoutPrefix.contains("_"))
|
||||||
{
|
{
|
||||||
String splitStrings[] = subskillNameWithoutPrefix.split("_");
|
String[] splitStrings = subskillNameWithoutPrefix.split("_");
|
||||||
|
|
||||||
for(int i = 0; i < splitStrings.length; i++)
|
for(int i = 0; i < splitStrings.length; i++)
|
||||||
{
|
{
|
||||||
if(i+1 >= splitStrings.length)
|
if(i+1 >= splitStrings.length)
|
||||||
endResult+=StringUtils.getCapitalized(splitStrings[i]);
|
endResult.append(StringUtils.getCapitalized(splitStrings[i]));
|
||||||
else {
|
else {
|
||||||
endResult += StringUtils.getCapitalized(splitStrings[i]);
|
endResult.append(StringUtils.getCapitalized(splitStrings[i]));
|
||||||
endResult += "_";
|
endResult.append("_");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
endResult += StringUtils.getCapitalized(subskillNameWithoutPrefix);
|
endResult.append(StringUtils.getCapitalized(subskillNameWithoutPrefix));
|
||||||
}
|
}
|
||||||
|
|
||||||
return endResult;
|
return endResult.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -91,7 +91,7 @@ public enum SuperAbilityType {
|
|||||||
private String abilityPlayerOff;
|
private String abilityPlayerOff;
|
||||||
private SubSkillType subSkillTypeDefinition;
|
private SubSkillType subSkillTypeDefinition;
|
||||||
|
|
||||||
private SuperAbilityType(String abilityOn, String abilityOff, String abilityPlayer, String abilityRefresh, String abilityPlayerOff) {
|
SuperAbilityType(String abilityOn, String abilityOff, String abilityPlayer, String abilityRefresh, String abilityPlayerOff) {
|
||||||
this.abilityOn = abilityOn;
|
this.abilityOn = abilityOn;
|
||||||
this.abilityOff = abilityOff;
|
this.abilityOff = abilityOff;
|
||||||
this.abilityPlayer = abilityPlayer;
|
this.abilityPlayer = abilityPlayer;
|
||||||
|
@ -15,7 +15,7 @@ public enum ToolType {
|
|||||||
private String lowerTool;
|
private String lowerTool;
|
||||||
private String raiseTool;
|
private String raiseTool;
|
||||||
|
|
||||||
private ToolType(String lowerTool, String raiseTool) {
|
ToolType(String lowerTool, String raiseTool) {
|
||||||
this.lowerTool = lowerTool;
|
this.lowerTool = lowerTool;
|
||||||
this.raiseTool = raiseTool;
|
this.raiseTool = raiseTool;
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ public enum PotionStage {
|
|||||||
|
|
||||||
int numerical;
|
int numerical;
|
||||||
|
|
||||||
private PotionStage(int numerical) {
|
PotionStage(int numerical) {
|
||||||
this.numerical = numerical;
|
this.numerical = numerical;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ public class FakeEntityDamageByEntityEvent extends EntityDamageByEntityEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static EnumMap<DamageModifier, Function<? super Double, Double>> getFunctionModifiers(Map<DamageModifier, Double> modifiers) {
|
public static EnumMap<DamageModifier, Function<? super Double, Double>> getFunctionModifiers(Map<DamageModifier, Double> modifiers) {
|
||||||
EnumMap<DamageModifier, Function<? super Double, Double>> modifierFunctions = new EnumMap<DamageModifier, Function<? super Double, Double>>(DamageModifier.class);
|
EnumMap<DamageModifier, Function<? super Double, Double>> modifierFunctions = new EnumMap<>(DamageModifier.class);
|
||||||
Function<? super Double, Double> ZERO = Functions.constant(-0.0);
|
Function<? super Double, Double> ZERO = Functions.constant(-0.0);
|
||||||
|
|
||||||
for (DamageModifier modifier : modifiers.keySet()) {
|
for (DamageModifier modifier : modifiers.keySet()) {
|
||||||
|
@ -23,7 +23,7 @@ public class FakeEntityDamageEvent extends EntityDamageEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static EnumMap<DamageModifier, Function<? super Double, Double>> getFunctionModifiers(Map<DamageModifier, Double> modifiers) {
|
public static EnumMap<DamageModifier, Function<? super Double, Double>> getFunctionModifiers(Map<DamageModifier, Double> modifiers) {
|
||||||
EnumMap<DamageModifier, Function<? super Double, Double>> modifierFunctions = new EnumMap<DamageModifier, Function<? super Double, Double>>(DamageModifier.class);
|
EnumMap<DamageModifier, Function<? super Double, Double>> modifierFunctions = new EnumMap<>(DamageModifier.class);
|
||||||
Function<? super Double, Double> ZERO = Functions.constant(-0.0);
|
Function<? super Double, Double> ZERO = Functions.constant(-0.0);
|
||||||
|
|
||||||
for (DamageModifier modifier : modifiers.keySet()) {
|
for (DamageModifier modifier : modifiers.keySet()) {
|
||||||
|
@ -62,7 +62,7 @@ public class McMMOPartyAllianceChangeEvent extends PlayerEvent implements Cancel
|
|||||||
/**
|
/**
|
||||||
* Any reason that doesn't fit elsewhere.
|
* Any reason that doesn't fit elsewhere.
|
||||||
*/
|
*/
|
||||||
CUSTOM;
|
CUSTOM
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Following are required for Cancellable **/
|
/** Following are required for Cancellable **/
|
||||||
|
@ -75,7 +75,7 @@ public class McMMOPartyChangeEvent extends PlayerEvent implements Cancellable {
|
|||||||
/**
|
/**
|
||||||
* Any reason that doesn't fit elsewhere.
|
* Any reason that doesn't fit elsewhere.
|
||||||
*/
|
*/
|
||||||
CUSTOM;
|
CUSTOM
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Following are required for Cancellable **/
|
/** Following are required for Cancellable **/
|
||||||
|
@ -172,7 +172,7 @@ public class BlockListener implements Listener {
|
|||||||
|
|
||||||
BlockFace direction = event.getDirection();
|
BlockFace direction = event.getDirection();
|
||||||
Block movedBlock = event.getBlock();
|
Block movedBlock = event.getBlock();
|
||||||
movedBlock = movedBlock.getRelative(direction, 2);
|
// movedBlock = movedBlock.getRelative(direction, 2);
|
||||||
|
|
||||||
for (Block b : event.getBlocks()) {
|
for (Block b : event.getBlocks()) {
|
||||||
if (BlockUtils.shouldBeWatched(b.getState())) {
|
if (BlockUtils.shouldBeWatched(b.getState())) {
|
||||||
|
@ -36,8 +36,7 @@ public class InteractionManager {
|
|||||||
subSkillList.add(abstractSubSkill);
|
subSkillList.add(abstractSubSkill);
|
||||||
|
|
||||||
//Init ArrayList
|
//Init ArrayList
|
||||||
if(interactRegister.get(abstractSubSkill.getInteractType()) == null)
|
interactRegister.computeIfAbsent(abstractSubSkill.getInteractType(), k -> new ArrayList<>());
|
||||||
interactRegister.put(abstractSubSkill.getInteractType(), new ArrayList<>());
|
|
||||||
|
|
||||||
//Registration array reference
|
//Registration array reference
|
||||||
ArrayList<Interaction> arrayRef = interactRegister.get(abstractSubSkill.getInteractType());
|
ArrayList<Interaction> arrayRef = interactRegister.get(abstractSubSkill.getInteractType());
|
||||||
@ -48,8 +47,7 @@ public class InteractionManager {
|
|||||||
String lowerCaseName = abstractSubSkill.getConfigKeyName().toLowerCase();
|
String lowerCaseName = abstractSubSkill.getConfigKeyName().toLowerCase();
|
||||||
|
|
||||||
//Register in name map
|
//Register in name map
|
||||||
if(subSkillNameMap.get(lowerCaseName) == null)
|
subSkillNameMap.putIfAbsent(lowerCaseName, abstractSubSkill);
|
||||||
subSkillNameMap.put(lowerCaseName, abstractSubSkill);
|
|
||||||
|
|
||||||
System.out.println("[mcMMO] registered subskill: "+ abstractSubSkill.getConfigKeyName());
|
System.out.println("[mcMMO] registered subskill: "+ abstractSubSkill.getConfigKeyName());
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ public final class LocaleLoader {
|
|||||||
private static ResourceBundle bundle = null;
|
private static ResourceBundle bundle = null;
|
||||||
private static ResourceBundle enBundle = null;
|
private static ResourceBundle enBundle = null;
|
||||||
|
|
||||||
private LocaleLoader() {};
|
private LocaleLoader() {}
|
||||||
|
|
||||||
public static String getString(String key) {
|
public static String getString(String key) {
|
||||||
return getString(key, (Object[]) null);
|
return getString(key, (Object[]) null);
|
||||||
|
@ -554,7 +554,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
new CleanBackupsTask().runTaskAsynchronously(mcMMO.p);
|
new CleanBackupsTask().runTaskAsynchronously(mcMMO.p);
|
||||||
|
|
||||||
// Bleed timer (Runs every 0.5 seconds)
|
// Bleed timer (Runs every 0.5 seconds)
|
||||||
new BleedTimerTask().runTaskTimer(this, 1 * Misc.TICK_CONVERSION_FACTOR, 1 * (Misc.TICK_CONVERSION_FACTOR / 2));
|
new BleedTimerTask().runTaskTimer(this, Misc.TICK_CONVERSION_FACTOR, (Misc.TICK_CONVERSION_FACTOR / 2));
|
||||||
|
|
||||||
// Old & Powerless User remover
|
// Old & Powerless User remover
|
||||||
long purgeIntervalTicks = getConfigManager().getConfigDatabase().getConfigSectionCleaning().getPurgeInterval() * 60L * 60L * Misc.TICK_CONVERSION_FACTOR;
|
long purgeIntervalTicks = getConfigManager().getConfigDatabase().getConfigSectionCleaning().getPurgeInterval() * 60L * 60L * Misc.TICK_CONVERSION_FACTOR;
|
||||||
|
@ -29,7 +29,7 @@ import java.util.UUID;
|
|||||||
|
|
||||||
public final class PartyManager {
|
public final class PartyManager {
|
||||||
private static String partiesFilePath = mcMMO.getFlatFileDirectory() + "parties.yml";
|
private static String partiesFilePath = mcMMO.getFlatFileDirectory() + "parties.yml";
|
||||||
private static List<Party> parties = new ArrayList<Party>();
|
private static List<Party> parties = new ArrayList<>();
|
||||||
private static File partyFile = new File(partiesFilePath);
|
private static File partyFile = new File(partiesFilePath);
|
||||||
|
|
||||||
private PartyManager() {}
|
private PartyManager() {}
|
||||||
@ -145,7 +145,7 @@ public final class PartyManager {
|
|||||||
* @return the near party members
|
* @return the near party members
|
||||||
*/
|
*/
|
||||||
public static List<Player> getNearMembers(McMMOPlayer mcMMOPlayer) {
|
public static List<Player> getNearMembers(McMMOPlayer mcMMOPlayer) {
|
||||||
List<Player> nearMembers = new ArrayList<Player>();
|
List<Player> nearMembers = new ArrayList<>();
|
||||||
Party party = mcMMOPlayer.getParty();
|
Party party = mcMMOPlayer.getParty();
|
||||||
|
|
||||||
if (party != null) {
|
if (party != null) {
|
||||||
@ -163,7 +163,7 @@ public final class PartyManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static List<Player> getNearVisibleMembers(McMMOPlayer mcMMOPlayer) {
|
public static List<Player> getNearVisibleMembers(McMMOPlayer mcMMOPlayer) {
|
||||||
List<Player> nearMembers = new ArrayList<Player>();
|
List<Player> nearMembers = new ArrayList<>();
|
||||||
Party party = mcMMOPlayer.getParty();
|
Party party = mcMMOPlayer.getParty();
|
||||||
|
|
||||||
if (party != null) {
|
if (party != null) {
|
||||||
@ -192,7 +192,7 @@ public final class PartyManager {
|
|||||||
public static LinkedHashMap<UUID, String> getAllMembers(Player player) {
|
public static LinkedHashMap<UUID, String> getAllMembers(Player player) {
|
||||||
Party party = getParty(player);
|
Party party = getParty(player);
|
||||||
|
|
||||||
return party == null ? new LinkedHashMap<UUID, String>() : party.getMembers();
|
return party == null ? new LinkedHashMap<>() : party.getMembers();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -216,7 +216,7 @@ public final class PartyManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static List<Player> getOnlineMembers(Party party) {
|
private static List<Player> getOnlineMembers(Party party) {
|
||||||
return party == null ? new ArrayList<Player>() : party.getOnlineMembers();
|
return party == null ? new ArrayList<>() : party.getOnlineMembers();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -589,7 +589,7 @@ public final class PartyManager {
|
|||||||
|
|
||||||
YamlConfiguration partiesFile = YamlConfiguration.loadConfiguration(partyFile);
|
YamlConfiguration partiesFile = YamlConfiguration.loadConfiguration(partyFile);
|
||||||
|
|
||||||
ArrayList<Party> hasAlly = new ArrayList<Party>();
|
ArrayList<Party> hasAlly = new ArrayList<>();
|
||||||
|
|
||||||
for (String partyName : partiesFile.getConfigurationSection("").getKeys(false)) {
|
for (String partyName : partiesFile.getConfigurationSection("").getKeys(false)) {
|
||||||
Party party = new Party(partyName);
|
Party party = new Party(partyName);
|
||||||
@ -659,7 +659,7 @@ public final class PartyManager {
|
|||||||
partiesFile.set(partyName + ".ItemShareType." + itemShareType.toString(), party.sharingDrops(itemShareType));
|
partiesFile.set(partyName + ".ItemShareType." + itemShareType.toString(), party.sharingDrops(itemShareType));
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> members = new ArrayList<String>();
|
List<String> members = new ArrayList<>();
|
||||||
|
|
||||||
for (Entry<UUID, String> memberEntry : party.getMembers().entrySet()) {
|
for (Entry<UUID, String> memberEntry : party.getMembers().entrySet()) {
|
||||||
String memberUniqueId = memberEntry.getKey() == null ? "" : memberEntry.getKey().toString();
|
String memberUniqueId = memberEntry.getKey() == null ? "" : memberEntry.getKey().toString();
|
||||||
|
@ -1,23 +1,23 @@
|
|||||||
package com.gmail.nossr50.runnables;
|
//package com.gmail.nossr50.runnables;
|
||||||
|
//
|
||||||
import com.gmail.nossr50.mcMMO;
|
//import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.runnables.skills.AprilTask;
|
//import com.gmail.nossr50.runnables.skills.AprilTask;
|
||||||
import com.gmail.nossr50.util.Misc;
|
//import com.gmail.nossr50.util.Misc;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
//import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
//
|
||||||
public class CheckDateTask extends BukkitRunnable {
|
//public class CheckDateTask extends BukkitRunnable {
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void run() {
|
// public void run() {
|
||||||
if (!mcMMO.getHolidayManager().isAprilFirst()) {
|
// if (!mcMMO.getHolidayManager().isAprilFirst()) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
// Set up jokes
|
// // Set up jokes
|
||||||
new AprilTask().runTaskTimer(mcMMO.p, 1L * 60L * Misc.TICK_CONVERSION_FACTOR, 10L * 60L * Misc.TICK_CONVERSION_FACTOR);
|
// new AprilTask().runTaskTimer(mcMMO.p, 1L * 60L * Misc.TICK_CONVERSION_FACTOR, 10L * 60L * Misc.TICK_CONVERSION_FACTOR);
|
||||||
mcMMO.getHolidayManager().registerAprilCommand();
|
// mcMMO.getHolidayManager().registerAprilCommand();
|
||||||
|
//
|
||||||
// Jokes deployed.
|
// // Jokes deployed.
|
||||||
this.cancel();
|
// this.cancel();
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
@ -18,9 +18,9 @@ public class CleanBackupsTask extends BukkitRunnable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
List<Integer> savedDays = new ArrayList<Integer>();
|
List<Integer> savedDays = new ArrayList<>();
|
||||||
HashMap<Integer, List<Integer>> savedYearsWeeks = new HashMap<Integer, List<Integer>>();
|
HashMap<Integer, List<Integer>> savedYearsWeeks = new HashMap<>();
|
||||||
List<File> toDelete = new ArrayList<File>();
|
List<File> toDelete = new ArrayList<>();
|
||||||
int amountTotal = 0;
|
int amountTotal = 0;
|
||||||
int amountDeleted = 0;
|
int amountDeleted = 0;
|
||||||
int oldFileAgeLimit = mcMMO.getConfigManager().getConfigAutomatedBackups().getBackupDayLimit();
|
int oldFileAgeLimit = mcMMO.getConfigManager().getConfigAutomatedBackups().getBackupDayLimit();
|
||||||
|
@ -21,11 +21,6 @@ public class DatabaseConversionTask extends BukkitRunnable {
|
|||||||
public void run() {
|
public void run() {
|
||||||
sourceDatabase.convertUsers(mcMMO.getDatabaseManager());
|
sourceDatabase.convertUsers(mcMMO.getDatabaseManager());
|
||||||
|
|
||||||
mcMMO.p.getServer().getScheduler().runTask(mcMMO.p, new Runnable() {
|
mcMMO.p.getServer().getScheduler().runTask(mcMMO.p, () -> sender.sendMessage(message));
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
sender.sendMessage(message);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,8 +17,8 @@ public class PartyAutoKickTask extends BukkitRunnable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
HashMap<OfflinePlayer, Party> toRemove = new HashMap<OfflinePlayer, Party>();
|
HashMap<OfflinePlayer, Party> toRemove = new HashMap<>();
|
||||||
List<UUID> processedPlayers = new ArrayList<UUID>();
|
List<UUID> processedPlayers = new ArrayList<>();
|
||||||
|
|
||||||
long currentTime = System.currentTimeMillis();
|
long currentTime = System.currentTimeMillis();
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ public class PlayerProfileLoadingTask extends BukkitRunnable {
|
|||||||
|
|
||||||
if (mcMMO.getScoreboardSettings().getShowStatsAfterLogin()) {
|
if (mcMMO.getScoreboardSettings().getShowStatsAfterLogin()) {
|
||||||
ScoreboardManager.enablePlayerStatsScoreboard(player);
|
ScoreboardManager.enablePlayerStatsScoreboard(player);
|
||||||
new McScoreboardKeepTask(player).runTaskLater(mcMMO.p, 1 * Misc.TICK_CONVERSION_FACTOR);
|
new McScoreboardKeepTask(player).runTaskLater(mcMMO.p, Misc.TICK_CONVERSION_FACTOR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ import java.util.Map;
|
|||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
public class BleedTimerTask extends BukkitRunnable {
|
public class BleedTimerTask extends BukkitRunnable {
|
||||||
private static Map<LivingEntity, BleedContainer> bleedList = new HashMap<LivingEntity, BleedContainer>();
|
private static Map<LivingEntity, BleedContainer> bleedList = new HashMap<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -54,7 +54,7 @@ public final class Alchemy {
|
|||||||
public static double catalysisMinSpeed = AdvancedConfig.getInstance().getCatalysisMinSpeed();
|
public static double catalysisMinSpeed = AdvancedConfig.getInstance().getCatalysisMinSpeed();
|
||||||
public static double catalysisMaxSpeed = AdvancedConfig.getInstance().getCatalysisMaxSpeed();
|
public static double catalysisMaxSpeed = AdvancedConfig.getInstance().getCatalysisMaxSpeed();
|
||||||
|
|
||||||
public static Map<Location, AlchemyBrewTask> brewingStandMap = new HashMap<Location, AlchemyBrewTask>();
|
public static Map<Location, AlchemyBrewTask> brewingStandMap = new HashMap<>();
|
||||||
|
|
||||||
private Alchemy() {}
|
private Alchemy() {}
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ public final class Alchemy {
|
|||||||
public static void finishAllBrews() {
|
public static void finishAllBrews() {
|
||||||
mcMMO.p.debug("Completing " + brewingStandMap.size() + " unfinished Alchemy brews.");
|
mcMMO.p.debug("Completing " + brewingStandMap.size() + " unfinished Alchemy brews.");
|
||||||
|
|
||||||
List<AlchemyBrewTask> toFinish = new ArrayList<AlchemyBrewTask>();
|
List<AlchemyBrewTask> toFinish = new ArrayList<>();
|
||||||
|
|
||||||
toFinish.addAll(brewingStandMap.values());
|
toFinish.addAll(brewingStandMap.values());
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ public final class AlchemyPotionBrewer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<AlchemyPotion> inputList = new ArrayList<AlchemyPotion>();
|
List<AlchemyPotion> inputList = new ArrayList<>();
|
||||||
|
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
ItemStack item = inventory.getItem(i);
|
ItemStack item = inventory.getItem(i);
|
||||||
|
@ -25,7 +25,7 @@ public class Archery {
|
|||||||
|
|
||||||
public Archery()
|
public Archery()
|
||||||
{
|
{
|
||||||
List<TrackedEntity> trackedEntities = new ArrayList<TrackedEntity>();
|
List<TrackedEntity> trackedEntities = new ArrayList<>();
|
||||||
|
|
||||||
skillShotMaxBonusDamage = AdvancedConfig.getInstance().getSkillShotDamageMax();
|
skillShotMaxBonusDamage = AdvancedConfig.getInstance().getSkillShotDamageMax();
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ public class Excavation {
|
|||||||
String friendly = StringUtils.getFriendlyConfigBlockDataString(blockState.getBlockData());
|
String friendly = StringUtils.getFriendlyConfigBlockDataString(blockState.getBlockData());
|
||||||
if (ExcavationTreasureConfig.getInstance().excavationMap.containsKey(friendly))
|
if (ExcavationTreasureConfig.getInstance().excavationMap.containsKey(friendly))
|
||||||
return ExcavationTreasureConfig.getInstance().excavationMap.get(friendly);
|
return ExcavationTreasureConfig.getInstance().excavationMap.get(friendly);
|
||||||
return new ArrayList<ExcavationTreasure>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static int getBlockXP(BlockState blockState) {
|
protected static int getBlockXP(BlockState blockState) {
|
||||||
|
@ -16,7 +16,7 @@ import java.util.Set;
|
|||||||
|
|
||||||
public final class Fishing {
|
public final class Fishing {
|
||||||
|
|
||||||
protected static final HashMap<Material, List<Enchantment>> ENCHANTABLE_CACHE = new HashMap<Material, List<Enchantment>>();
|
protected static final HashMap<Material, List<Enchantment>> ENCHANTABLE_CACHE = new HashMap<>();
|
||||||
|
|
||||||
/*public static int fishermansDietRankLevel1 = AdvancedConfig.getInstance().getFishermanDietRankChange();
|
/*public static int fishermansDietRankLevel1 = AdvancedConfig.getInstance().getFishermanDietRankChange();
|
||||||
public static int fishermansDietRankLevel2 = fishermansDietRankLevel1 * 2;
|
public static int fishermansDietRankLevel2 = fishermansDietRankLevel1 * 2;
|
||||||
|
@ -53,7 +53,6 @@ public class FishingManager extends SkillManager {
|
|||||||
private long lastWarned = 0L;
|
private long lastWarned = 0L;
|
||||||
private long lastWarnedExhaust = 0L;
|
private long lastWarnedExhaust = 0L;
|
||||||
private BoundingBox lastFishingBoundingBox;
|
private BoundingBox lastFishingBoundingBox;
|
||||||
private Item fishingCatch;
|
|
||||||
private Location hookLocation;
|
private Location hookLocation;
|
||||||
private int fishCaughtCounter = 1;
|
private int fishCaughtCounter = 1;
|
||||||
private final float boundingBoxSize;
|
private final float boundingBoxSize;
|
||||||
@ -87,7 +86,7 @@ public class FishingManager extends SkillManager {
|
|||||||
getPlayer().getInventory().getItemInMainHand().setDurability((short) (getPlayer().getInventory().getItemInMainHand().getDurability() + 5));
|
getPlayer().getInventory().getItemInMainHand().setDurability((short) (getPlayer().getInventory().getItemInMainHand().getDurability() + 5));
|
||||||
getPlayer().updateInventory();
|
getPlayer().updateInventory();
|
||||||
|
|
||||||
if(lastWarnedExhaust + (1000 * 1) < currentTime)
|
if(lastWarnedExhaust + (1000) < currentTime)
|
||||||
{
|
{
|
||||||
getPlayer().sendMessage(LocaleLoader.getString("Fishing.Exhausting"));
|
getPlayer().sendMessage(LocaleLoader.getString("Fishing.Exhausting"));
|
||||||
lastWarnedExhaust = currentTime;
|
lastWarnedExhaust = currentTime;
|
||||||
@ -114,7 +113,7 @@ public class FishingManager extends SkillManager {
|
|||||||
long fishHookSpawnCD = fishHookSpawnTimestamp + 1000;
|
long fishHookSpawnCD = fishHookSpawnTimestamp + 1000;
|
||||||
boolean hasFished = (currentTime < fishHookSpawnCD);
|
boolean hasFished = (currentTime < fishHookSpawnCD);
|
||||||
|
|
||||||
if(hasFished && (lastWarned + (1000 * 1) < currentTime))
|
if(hasFished && (lastWarned + (1000) < currentTime))
|
||||||
{
|
{
|
||||||
getPlayer().sendMessage(LocaleLoader.getString("Fishing.Scared"));
|
getPlayer().sendMessage(LocaleLoader.getString("Fishing.Scared"));
|
||||||
lastWarned = System.currentTimeMillis();
|
lastWarned = System.currentTimeMillis();
|
||||||
@ -286,7 +285,6 @@ public class FishingManager extends SkillManager {
|
|||||||
* @param fishingCatch The {@link Item} initially caught
|
* @param fishingCatch The {@link Item} initially caught
|
||||||
*/
|
*/
|
||||||
public void handleFishing(Item fishingCatch) {
|
public void handleFishing(Item fishingCatch) {
|
||||||
this.fishingCatch = fishingCatch;
|
|
||||||
int fishXp = ExperienceConfig.getInstance().getXp(PrimarySkillType.FISHING, fishingCatch.getItemStack().getType());
|
int fishXp = ExperienceConfig.getInstance().getXp(PrimarySkillType.FISHING, fishingCatch.getItemStack().getType());
|
||||||
int treasureXp = 0;
|
int treasureXp = 0;
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
@ -294,12 +292,11 @@ public class FishingManager extends SkillManager {
|
|||||||
|
|
||||||
if (MainConfig.getInstance().getFishingDropsEnabled() && Permissions.isSubSkillEnabled(player, SubSkillType.FISHING_TREASURE_HUNTER)) {
|
if (MainConfig.getInstance().getFishingDropsEnabled() && Permissions.isSubSkillEnabled(player, SubSkillType.FISHING_TREASURE_HUNTER)) {
|
||||||
treasure = getFishingTreasure();
|
treasure = getFishingTreasure();
|
||||||
this.fishingCatch = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (treasure != null) {
|
if (treasure != null) {
|
||||||
ItemStack treasureDrop = treasure.getDrop().clone(); // Not cloning is bad, m'kay?
|
ItemStack treasureDrop = treasure.getDrop().clone(); // Not cloning is bad, m'kay?
|
||||||
Map<Enchantment, Integer> enchants = new HashMap<Enchantment, Integer>();
|
Map<Enchantment, Integer> enchants = new HashMap<>();
|
||||||
|
|
||||||
if (isMagicHunterEnabled()
|
if (isMagicHunterEnabled()
|
||||||
&& ItemUtils.isEnchantable(treasureDrop)) {
|
&& ItemUtils.isEnchantable(treasureDrop)) {
|
||||||
@ -517,7 +514,7 @@ public class FishingManager extends SkillManager {
|
|||||||
* @return true if the item has been enchanted
|
* @return true if the item has been enchanted
|
||||||
*/
|
*/
|
||||||
private Map<Enchantment, Integer> handleMagicHunter(ItemStack treasureDrop) {
|
private Map<Enchantment, Integer> handleMagicHunter(ItemStack treasureDrop) {
|
||||||
Map<Enchantment, Integer> enchants = new HashMap<Enchantment, Integer>();
|
Map<Enchantment, Integer> enchants = new HashMap<>();
|
||||||
List<EnchantmentTreasure> fishingEnchantments = null;
|
List<EnchantmentTreasure> fishingEnchantments = null;
|
||||||
|
|
||||||
double diceRoll = Misc.getRandom().nextDouble() * 100;
|
double diceRoll = Misc.getRandom().nextDouble() * 100;
|
||||||
@ -547,7 +544,7 @@ public class FishingManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<Enchantment> validEnchantments = getPossibleEnchantments(treasureDrop);
|
List<Enchantment> validEnchantments = getPossibleEnchantments(treasureDrop);
|
||||||
List<EnchantmentTreasure> possibleEnchants = new ArrayList<EnchantmentTreasure>();
|
List<EnchantmentTreasure> possibleEnchants = new ArrayList<>();
|
||||||
|
|
||||||
for (EnchantmentTreasure enchantmentTreasure : fishingEnchantments) {
|
for (EnchantmentTreasure enchantmentTreasure : fishingEnchantments) {
|
||||||
if (validEnchantments.contains(enchantmentTreasure.getEnchantment())) {
|
if (validEnchantments.contains(enchantmentTreasure.getEnchantment())) {
|
||||||
@ -586,7 +583,7 @@ public class FishingManager extends SkillManager {
|
|||||||
return Fishing.ENCHANTABLE_CACHE.get(dropType);
|
return Fishing.ENCHANTABLE_CACHE.get(dropType);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Enchantment> possibleEnchantments = new ArrayList<Enchantment>();
|
List<Enchantment> possibleEnchantments = new ArrayList<>();
|
||||||
|
|
||||||
for (Enchantment enchantment : Enchantment.values()) {
|
for (Enchantment enchantment : Enchantment.values()) {
|
||||||
if (enchantment.canEnchantItem(treasureDrop)) {
|
if (enchantment.canEnchantItem(treasureDrop)) {
|
||||||
|
@ -282,7 +282,7 @@ public class HerbalismManager extends SkillManager {
|
|||||||
|
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
PlayerInventory playerInventory = player.getInventory();
|
PlayerInventory playerInventory = player.getInventory();
|
||||||
Material seed = null;
|
Material seed;
|
||||||
|
|
||||||
switch (blockState.getType()) {
|
switch (blockState.getType()) {
|
||||||
case CARROTS:
|
case CARROTS:
|
||||||
|
@ -130,8 +130,8 @@ public class MiningManager extends SkillManager {
|
|||||||
* @param blockList The list of blocks to drop
|
* @param blockList The list of blocks to drop
|
||||||
*/
|
*/
|
||||||
public void blastMiningDropProcessing(float yield, List<Block> blockList) {
|
public void blastMiningDropProcessing(float yield, List<Block> blockList) {
|
||||||
List<BlockState> ores = new ArrayList<BlockState>();
|
List<BlockState> ores = new ArrayList<>();
|
||||||
List<BlockState> debris = new ArrayList<BlockState>();
|
List<BlockState> debris = new ArrayList<>();
|
||||||
int xp = 0;
|
int xp = 0;
|
||||||
|
|
||||||
float oreBonus = (float) (getOreBonus() / 100);
|
float oreBonus = (float) (getOreBonus() / 100);
|
||||||
@ -263,7 +263,7 @@ public class MiningManager extends SkillManager {
|
|||||||
|
|
||||||
if (timeRemaining > 0) {
|
if (timeRemaining > 0) {
|
||||||
//getPlayer().sendMessage(LocaleLoader.getString("Skills.TooTired", timeRemaining));
|
//getPlayer().sendMessage(LocaleLoader.getString("Skills.TooTired", timeRemaining));
|
||||||
NotificationManager.sendPlayerInformation(getPlayer(), NotificationType.ABILITY_COOLDOWN, "Skills.TooTired", String.valueOf("timeRemaining"));
|
NotificationManager.sendPlayerInformation(getPlayer(), NotificationType.ABILITY_COOLDOWN, "Skills.TooTired", String.valueOf(timeRemaining));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import com.gmail.nossr50.util.ItemUtils;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
@ -19,7 +20,7 @@ public class Repairable {
|
|||||||
private final double xpMultiplier;
|
private final double xpMultiplier;
|
||||||
|
|
||||||
public Repairable(Material itemMaterial, Material repairMaterial, int minimumQuantity, int minimumLevel, double xpMultiplier) {
|
public Repairable(Material itemMaterial, Material repairMaterial, int minimumQuantity, int minimumLevel, double xpMultiplier) {
|
||||||
this(itemMaterial.getKey().getKey(), ItemUtils.getRepairItemMaterials(Arrays.asList(repairMaterial)), minimumQuantity, minimumLevel, xpMultiplier);
|
this(itemMaterial.getKey().getKey(), ItemUtils.getRepairItemMaterials(Collections.singletonList(repairMaterial)), minimumQuantity, minimumLevel, xpMultiplier);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Repairable(Material itemMaterial, List<Material> repairMaterials, int minimumQuantity, int minimumLevel, double xpMultiplier) {
|
public Repairable(Material itemMaterial, List<Material> repairMaterials, int minimumQuantity, int minimumLevel, double xpMultiplier) {
|
||||||
|
@ -16,7 +16,7 @@ public class RepairableManager implements Unload {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public RepairableManager(List<Repairable> repairablesCollection) {
|
public RepairableManager(List<Repairable> repairablesCollection) {
|
||||||
this.repairables = new HashMap<Material, Repairable>(repairablesCollection.size());
|
this.repairables = new HashMap<>(repairablesCollection.size());
|
||||||
registerRepairables(repairablesCollection);
|
registerRepairables(repairablesCollection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ public class SalvageManager extends SkillManager {
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
public int getSalvageableAmount() {
|
public int getSalvageableAmount() {
|
||||||
return (RankUtils.getRank(getPlayer(), SubSkillType.SALVAGE_ARCANE_SALVAGE) * 1);
|
return (RankUtils.getRank(getPlayer(), SubSkillType.SALVAGE_ARCANE_SALVAGE));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -21,7 +21,7 @@ public class SalvageableManager implements Unload {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public SalvageableManager(List<Salvageable> salvageablesCollection) {
|
public SalvageableManager(List<Salvageable> salvageablesCollection) {
|
||||||
this.salvageables = new HashMap<Material, Salvageable>(salvageablesCollection.size());
|
this.salvageables = new HashMap<>(salvageablesCollection.size());
|
||||||
registerSalvageables(salvageablesCollection);
|
registerSalvageables(salvageablesCollection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ public class TamingManager extends SkillManager {
|
|||||||
super(mcMMOPlayer, PrimarySkillType.TAMING);
|
super(mcMMOPlayer, PrimarySkillType.TAMING);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static HashMap<EntityType, List<TrackedTamingEntity>> summonedEntities = new HashMap<EntityType, List<TrackedTamingEntity>>();
|
private static HashMap<EntityType, List<TrackedTamingEntity>> summonedEntities = new HashMap<>();
|
||||||
|
|
||||||
public boolean canUseThickFur() {
|
public boolean canUseThickFur() {
|
||||||
return RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_THICK_FUR)
|
return RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_THICK_FUR)
|
||||||
@ -384,7 +384,7 @@ public class TamingManager extends SkillManager {
|
|||||||
TrackedTamingEntity trackedEntity = new TrackedTamingEntity(livingEntity);
|
TrackedTamingEntity trackedEntity = new TrackedTamingEntity(livingEntity);
|
||||||
|
|
||||||
if (!summonedEntities.containsKey(livingEntity.getType())) {
|
if (!summonedEntities.containsKey(livingEntity.getType())) {
|
||||||
summonedEntities.put(livingEntity.getType(), new ArrayList<TrackedTamingEntity>());
|
summonedEntities.put(livingEntity.getType(), new ArrayList<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
summonedEntities.get(livingEntity.getType()).add(trackedEntity);
|
summonedEntities.get(livingEntity.getType()).add(trackedEntity);
|
||||||
|
@ -99,7 +99,7 @@ public final class Woodcutting {
|
|||||||
* before taking measurements).
|
* before taking measurements).
|
||||||
*/
|
*/
|
||||||
protected static void processTree(BlockState blockState, Set<BlockState> treeFellerBlocks) {
|
protected static void processTree(BlockState blockState, Set<BlockState> treeFellerBlocks) {
|
||||||
List<BlockState> futureCenterBlocks = new ArrayList<BlockState>();
|
List<BlockState> futureCenterBlocks = new ArrayList<>();
|
||||||
|
|
||||||
// Check the block up and take different behavior (smaller search) if it's a log
|
// Check the block up and take different behavior (smaller search) if it's a log
|
||||||
if (handleBlock(blockState.getBlock().getRelative(BlockFace.UP).getState(), futureCenterBlocks, treeFellerBlocks)) {
|
if (handleBlock(blockState.getBlock().getRelative(BlockFace.UP).getState(), futureCenterBlocks, treeFellerBlocks)) {
|
||||||
|
@ -75,7 +75,7 @@ public class WoodcuttingManager extends SkillManager {
|
|||||||
*/
|
*/
|
||||||
public void processTreeFeller(BlockState blockState) {
|
public void processTreeFeller(BlockState blockState) {
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
Set<BlockState> treeFellerBlocks = new HashSet<BlockState>();
|
Set<BlockState> treeFellerBlocks = new HashSet<>();
|
||||||
|
|
||||||
Woodcutting.treeFellerReachedThreshold = false;
|
Woodcutting.treeFellerReachedThreshold = false;
|
||||||
|
|
||||||
|
@ -581,7 +581,7 @@ public final class BlockUtils {
|
|||||||
* @return HashSet with the IDs of every transparent block
|
* @return HashSet with the IDs of every transparent block
|
||||||
*/
|
*/
|
||||||
public static HashSet<Material> getTransparentBlocks() {
|
public static HashSet<Material> getTransparentBlocks() {
|
||||||
HashSet<Material> transparentBlocks = new HashSet<Material>();
|
HashSet<Material> transparentBlocks = new HashSet<>();
|
||||||
|
|
||||||
for (Material material : Material.values()) {
|
for (Material material : Material.values()) {
|
||||||
if (material.isTransparent()) {
|
if (material.isTransparent()) {
|
||||||
|
@ -150,7 +150,7 @@ public final class ChimaeraWing {
|
|||||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||||
itemMeta.setDisplayName(ChatColor.GOLD + LocaleLoader.getString("Item.ChimaeraWing.Name"));
|
itemMeta.setDisplayName(ChatColor.GOLD + LocaleLoader.getString("Item.ChimaeraWing.Name"));
|
||||||
|
|
||||||
List<String> itemLore = new ArrayList<String>();
|
List<String> itemLore = new ArrayList<>();
|
||||||
itemLore.add("mcMMO Item");
|
itemLore.add("mcMMO Item");
|
||||||
itemLore.add(LocaleLoader.getString("Item.ChimaeraWing.Lore"));
|
itemLore.add(LocaleLoader.getString("Item.ChimaeraWing.Lore"));
|
||||||
itemMeta.setLore(itemLore);
|
itemMeta.setLore(itemLore);
|
||||||
|
@ -6,7 +6,7 @@ import java.util.HashMap;
|
|||||||
|
|
||||||
public class EnchantmentUtils {
|
public class EnchantmentUtils {
|
||||||
|
|
||||||
private static final HashMap<String, Enchantment> enchants = new HashMap<String, Enchantment>();
|
private static final HashMap<String, Enchantment> enchants = new HashMap<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
enchants.put("SHARPNESS", Enchantment.DAMAGE_ALL);
|
enchants.put("SHARPNESS", Enchantment.DAMAGE_ALL);
|
||||||
|
@ -20,8 +20,8 @@ public final class HardcoreManager {
|
|||||||
PlayerProfile playerProfile = UserManager.getPlayer(player).getProfile();
|
PlayerProfile playerProfile = UserManager.getPlayer(player).getProfile();
|
||||||
int totalLevelsLost = 0;
|
int totalLevelsLost = 0;
|
||||||
|
|
||||||
HashMap<String, Integer> levelChanged = new HashMap<String, Integer>();
|
HashMap<String, Integer> levelChanged = new HashMap<>();
|
||||||
HashMap<String, Float> experienceChanged = new HashMap<String, Float>();
|
HashMap<String, Float> experienceChanged = new HashMap<>();
|
||||||
|
|
||||||
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
|
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
|
||||||
if (!primarySkillType.getHardcoreStatLossEnabled()) {
|
if (!primarySkillType.getHardcoreStatLossEnabled()) {
|
||||||
@ -63,8 +63,8 @@ public final class HardcoreManager {
|
|||||||
PlayerProfile victimProfile = UserManager.getPlayer(victim).getProfile();
|
PlayerProfile victimProfile = UserManager.getPlayer(victim).getProfile();
|
||||||
int totalLevelsStolen = 0;
|
int totalLevelsStolen = 0;
|
||||||
|
|
||||||
HashMap<String, Integer> levelChanged = new HashMap<String, Integer>();
|
HashMap<String, Integer> levelChanged = new HashMap<>();
|
||||||
HashMap<String, Float> experienceChanged = new HashMap<String, Float>();
|
HashMap<String, Float> experienceChanged = new HashMap<>();
|
||||||
|
|
||||||
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
|
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
|
||||||
if (!primarySkillType.getHardcoreVampirismEnabled()) {
|
if (!primarySkillType.getHardcoreVampirismEnabled()) {
|
||||||
|
@ -40,7 +40,7 @@ public final class Misc {
|
|||||||
|
|
||||||
public static final Set<String> modNames = ImmutableSet.of("LOTR", "BUILDCRAFT", "ENDERIO", "ENHANCEDBIOMES", "IC2", "METALLURGY", "FORESTRY", "GALACTICRAFT", "RAILCRAFT", "TWILIGHTFOREST", "THAUMCRAFT", "GRAVESTONEMOD", "GROWTHCRAFT", "ARCTICMOBS", "DEMONMOBS", "INFERNOMOBS", "SWAMPMOBS", "MARICULTURE", "MINESTRAPPOLATION");
|
public static final Set<String> modNames = ImmutableSet.of("LOTR", "BUILDCRAFT", "ENDERIO", "ENHANCEDBIOMES", "IC2", "METALLURGY", "FORESTRY", "GALACTICRAFT", "RAILCRAFT", "TWILIGHTFOREST", "THAUMCRAFT", "GRAVESTONEMOD", "GROWTHCRAFT", "ARCTICMOBS", "DEMONMOBS", "INFERNOMOBS", "SWAMPMOBS", "MARICULTURE", "MINESTRAPPOLATION");
|
||||||
|
|
||||||
private Misc() {};
|
private Misc() {}
|
||||||
|
|
||||||
public static boolean isNPCEntity(Entity entity) {
|
public static boolean isNPCEntity(Entity entity) {
|
||||||
return (entity == null || entity.hasMetadata("NPC") || entity instanceof NPC || entity.getClass().getName().equalsIgnoreCase("cofh.entity.PlayerFake"));
|
return (entity == null || entity.hasMetadata("NPC") || entity instanceof NPC || entity.getClass().getName().equalsIgnoreCase("cofh.entity.PlayerFake"));
|
||||||
|
@ -127,19 +127,19 @@ public final class MobHealthbarUtils {
|
|||||||
int coloredDisplay = (int) Math.ceil(fullDisplay * (healthPercentage / 100.0D));
|
int coloredDisplay = (int) Math.ceil(fullDisplay * (healthPercentage / 100.0D));
|
||||||
int grayDisplay = fullDisplay - coloredDisplay;
|
int grayDisplay = fullDisplay - coloredDisplay;
|
||||||
|
|
||||||
String healthbar = color + "";
|
StringBuilder healthbar = new StringBuilder(color + "");
|
||||||
|
|
||||||
for (int i = 0; i < coloredDisplay; i++) {
|
for (int i = 0; i < coloredDisplay; i++) {
|
||||||
healthbar += symbol;
|
healthbar.append(symbol);
|
||||||
}
|
}
|
||||||
|
|
||||||
healthbar += ChatColor.GRAY;
|
healthbar.append(ChatColor.GRAY);
|
||||||
|
|
||||||
for (int i = 0; i < grayDisplay; i++) {
|
for (int i = 0; i < grayDisplay; i++) {
|
||||||
healthbar += symbol;
|
healthbar.append(symbol);
|
||||||
}
|
}
|
||||||
|
|
||||||
return healthbar;
|
return healthbar.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -10,8 +10,8 @@ public class BiomeAdapter {
|
|||||||
|
|
||||||
static {
|
static {
|
||||||
List<Biome> allBiomes = Arrays.asList(Biome.values());
|
List<Biome> allBiomes = Arrays.asList(Biome.values());
|
||||||
List<Biome> waterBiomes = new ArrayList<Biome>();
|
List<Biome> waterBiomes = new ArrayList<>();
|
||||||
List<Biome> iceBiomes = new ArrayList<Biome>();
|
List<Biome> iceBiomes = new ArrayList<>();
|
||||||
for (Biome biome : allBiomes) {
|
for (Biome biome : allBiomes) {
|
||||||
if (isWater(biome.name()) && !isCold(biome.name())) {
|
if (isWater(biome.name()) && !isCold(biome.name())) {
|
||||||
waterBiomes.add(biome);
|
waterBiomes.add(biome);
|
||||||
|
@ -12,7 +12,7 @@ public interface ChunkletManager {
|
|||||||
* @param cz Chunklet Z coordinate that needs to be loaded
|
* @param cz Chunklet Z coordinate that needs to be loaded
|
||||||
* @param world World that the chunklet needs to be loaded in
|
* @param world World that the chunklet needs to be loaded in
|
||||||
*/
|
*/
|
||||||
public void loadChunklet(int cx, int cy, int cz, World world);
|
void loadChunklet(int cx, int cy, int cz, World world);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unload a specific chunklet
|
* Unload a specific chunklet
|
||||||
@ -22,7 +22,7 @@ public interface ChunkletManager {
|
|||||||
* @param cz Chunklet Z coordinate that needs to be unloaded
|
* @param cz Chunklet Z coordinate that needs to be unloaded
|
||||||
* @param world World that the chunklet needs to be unloaded from
|
* @param world World that the chunklet needs to be unloaded from
|
||||||
*/
|
*/
|
||||||
public void unloadChunklet(int cx, int cy, int cz, World world);
|
void unloadChunklet(int cx, int cy, int cz, World world);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load a given Chunk's Chunklet data
|
* Load a given Chunk's Chunklet data
|
||||||
@ -31,7 +31,7 @@ public interface ChunkletManager {
|
|||||||
* @param cz Chunk Z coordinate that is to be loaded
|
* @param cz Chunk Z coordinate that is to be loaded
|
||||||
* @param world World that the Chunk is in
|
* @param world World that the Chunk is in
|
||||||
*/
|
*/
|
||||||
public void loadChunk(int cx, int cz, World world);
|
void loadChunk(int cx, int cz, World world);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unload a given Chunk's Chunklet data
|
* Unload a given Chunk's Chunklet data
|
||||||
@ -40,7 +40,7 @@ public interface ChunkletManager {
|
|||||||
* @param cz Chunk Z coordinate that is to be unloaded
|
* @param cz Chunk Z coordinate that is to be unloaded
|
||||||
* @param world World that the Chunk is in
|
* @param world World that the Chunk is in
|
||||||
*/
|
*/
|
||||||
public void unloadChunk(int cx, int cz, World world);
|
void unloadChunk(int cx, int cz, World world);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Informs the ChunkletManager a chunk is loaded
|
* Informs the ChunkletManager a chunk is loaded
|
||||||
@ -49,7 +49,7 @@ public interface ChunkletManager {
|
|||||||
* @param cz Chunk Z coordinate that is loaded
|
* @param cz Chunk Z coordinate that is loaded
|
||||||
* @param world World that the chunk was loaded in
|
* @param world World that the chunk was loaded in
|
||||||
*/
|
*/
|
||||||
public void chunkLoaded(int cx, int cz, World world);
|
void chunkLoaded(int cx, int cz, World world);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Informs the ChunkletManager a chunk is unloaded
|
* Informs the ChunkletManager a chunk is unloaded
|
||||||
@ -58,38 +58,38 @@ public interface ChunkletManager {
|
|||||||
* @param cz Chunk Z coordinate that is unloaded
|
* @param cz Chunk Z coordinate that is unloaded
|
||||||
* @param world World that the chunk was unloaded in
|
* @param world World that the chunk was unloaded in
|
||||||
*/
|
*/
|
||||||
public void chunkUnloaded(int cx, int cz, World world);
|
void chunkUnloaded(int cx, int cz, World world);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save all ChunkletStores related to the given world
|
* Save all ChunkletStores related to the given world
|
||||||
*
|
*
|
||||||
* @param world World to save
|
* @param world World to save
|
||||||
*/
|
*/
|
||||||
public void saveWorld(World world);
|
void saveWorld(World world);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unload all ChunkletStores from memory related to the given world after saving them
|
* Unload all ChunkletStores from memory related to the given world after saving them
|
||||||
*
|
*
|
||||||
* @param world World to unload
|
* @param world World to unload
|
||||||
*/
|
*/
|
||||||
public void unloadWorld(World world);
|
void unloadWorld(World world);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load all ChunkletStores from all loaded chunks from this world into memory
|
* Load all ChunkletStores from all loaded chunks from this world into memory
|
||||||
*
|
*
|
||||||
* @param world World to load
|
* @param world World to load
|
||||||
*/
|
*/
|
||||||
public void loadWorld(World world);
|
void loadWorld(World world);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save all ChunkletStores
|
* Save all ChunkletStores
|
||||||
*/
|
*/
|
||||||
public void saveAll();
|
void saveAll();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unload all ChunkletStores after saving them
|
* Unload all ChunkletStores after saving them
|
||||||
*/
|
*/
|
||||||
public void unloadAll();
|
void unloadAll();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check to see if a given location is set to true
|
* Check to see if a given location is set to true
|
||||||
@ -100,7 +100,7 @@ public interface ChunkletManager {
|
|||||||
* @param world World to check in
|
* @param world World to check in
|
||||||
* @return true if the given location is set to true, false if otherwise
|
* @return true if the given location is set to true, false if otherwise
|
||||||
*/
|
*/
|
||||||
public boolean isTrue(int x, int y, int z, World world);
|
boolean isTrue(int x, int y, int z, World world);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check to see if a given block location is set to true
|
* Check to see if a given block location is set to true
|
||||||
@ -108,7 +108,7 @@ public interface ChunkletManager {
|
|||||||
* @param block Block location to check
|
* @param block Block location to check
|
||||||
* @return true if the given block location is set to true, false if otherwise
|
* @return true if the given block location is set to true, false if otherwise
|
||||||
*/
|
*/
|
||||||
public boolean isTrue(Block block);
|
boolean isTrue(Block block);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a given location to true, should create stores as necessary if the location does not exist
|
* Set a given location to true, should create stores as necessary if the location does not exist
|
||||||
@ -118,14 +118,14 @@ public interface ChunkletManager {
|
|||||||
* @param z Z coordinate to set
|
* @param z Z coordinate to set
|
||||||
* @param world World to set in
|
* @param world World to set in
|
||||||
*/
|
*/
|
||||||
public void setTrue(int x, int y, int z, World world);
|
void setTrue(int x, int y, int z, World world);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a given block location to true, should create stores as necessary if the location does not exist
|
* Set a given block location to true, should create stores as necessary if the location does not exist
|
||||||
*
|
*
|
||||||
* @param block Block location to set
|
* @param block Block location to set
|
||||||
*/
|
*/
|
||||||
public void setTrue(Block block);
|
void setTrue(Block block);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a given location to false, should not create stores if one does not exist for the given location
|
* Set a given location to false, should not create stores if one does not exist for the given location
|
||||||
@ -135,17 +135,17 @@ public interface ChunkletManager {
|
|||||||
* @param z Z coordinate to set
|
* @param z Z coordinate to set
|
||||||
* @param world World to set in
|
* @param world World to set in
|
||||||
*/
|
*/
|
||||||
public void setFalse(int x, int y, int z, World world);
|
void setFalse(int x, int y, int z, World world);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a given block location to false, should not create stores if one does not exist for the given location
|
* Set a given block location to false, should not create stores if one does not exist for the given location
|
||||||
*
|
*
|
||||||
* @param block Block location to set
|
* @param block Block location to set
|
||||||
*/
|
*/
|
||||||
public void setFalse(Block block);
|
void setFalse(Block block);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete any ChunkletStores that are empty
|
* Delete any ChunkletStores that are empty
|
||||||
*/
|
*/
|
||||||
public void cleanUp();
|
void cleanUp();
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user