mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-01-18 16:35:25 +01:00
new config system pt 5
This commit is contained in:
parent
41b484b1c3
commit
f6a3084a47
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.commands;
|
package com.gmail.nossr50.commands;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.data.UserManager;
|
import com.gmail.nossr50.core.data.UserManager;
|
||||||
import com.gmail.nossr50.core.data.database.FlatfileDatabaseManager;
|
import com.gmail.nossr50.core.data.database.FlatfileDatabaseManager;
|
||||||
import com.gmail.nossr50.core.data.database.SQLDatabaseManager;
|
import com.gmail.nossr50.core.data.database.SQLDatabaseManager;
|
||||||
@ -21,7 +21,7 @@ public class MHDCommand implements TabExecutor {
|
|||||||
SQLDatabaseManager m = (SQLDatabaseManager) mcMMO.getDatabaseManager();
|
SQLDatabaseManager m = (SQLDatabaseManager) mcMMO.getDatabaseManager();
|
||||||
m.resetMobHealthSettings();
|
m.resetMobHealthSettings();
|
||||||
for (McMMOPlayer player : UserManager.getPlayers()) {
|
for (McMMOPlayer player : UserManager.getPlayers()) {
|
||||||
player.getProfile().setMobHealthbarType(Config.getInstance().getMobHealthbarDefault());
|
player.getProfile().setMobHealthbarType(MainConfig.getInstance().getMobHealthbarDefault());
|
||||||
}
|
}
|
||||||
sender.sendMessage("Mob health reset");
|
sender.sendMessage("Mob health reset");
|
||||||
return true;
|
return true;
|
||||||
@ -30,7 +30,7 @@ public class MHDCommand implements TabExecutor {
|
|||||||
FlatfileDatabaseManager m = (FlatfileDatabaseManager) mcMMO.getDatabaseManager();
|
FlatfileDatabaseManager m = (FlatfileDatabaseManager) mcMMO.getDatabaseManager();
|
||||||
m.resetMobHealthSettings();
|
m.resetMobHealthSettings();
|
||||||
for (McMMOPlayer player : UserManager.getPlayers()) {
|
for (McMMOPlayer player : UserManager.getPlayers()) {
|
||||||
player.getProfile().setMobHealthbarType(Config.getInstance().getMobHealthbarDefault());
|
player.getProfile().setMobHealthbarType(MainConfig.getInstance().getMobHealthbarDefault());
|
||||||
}
|
}
|
||||||
sender.sendMessage("Mob health reset");
|
sender.sendMessage("Mob health reset");
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.gmail.nossr50.commands;
|
package com.gmail.nossr50.commands;
|
||||||
|
|
||||||
import com.gmail.nossr50.commands.party.PartySubcommandType;
|
import com.gmail.nossr50.commands.party.PartySubcommandType;
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.core.util.Permissions;
|
import com.gmail.nossr50.core.util.Permissions;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
@ -24,7 +24,7 @@ public class McmmoCommand implements CommandExecutor {
|
|||||||
String[] mcSplit = description.split(",");
|
String[] mcSplit = description.split(",");
|
||||||
sender.sendMessage(mcSplit);
|
sender.sendMessage(mcSplit);
|
||||||
|
|
||||||
if (Config.getInstance().getDonateMessageEnabled()) {
|
if (MainConfig.getInstance().getDonateMessageEnabled()) {
|
||||||
sender.sendMessage(LocaleLoader.getString("MOTD.Donate"));
|
sender.sendMessage(LocaleLoader.getString("MOTD.Donate"));
|
||||||
sender.sendMessage(ChatColor.GOLD + " - " + ChatColor.GREEN + "com.gmail.nossr50@com.gmail.com" + ChatColor.GOLD + " Paypal");
|
sender.sendMessage(ChatColor.GOLD + " - " + ChatColor.GREEN + "com.gmail.nossr50@com.gmail.com" + ChatColor.GOLD + " Paypal");
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.commands;
|
package com.gmail.nossr50.commands;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.core.util.commands.CommandUtils;
|
import com.gmail.nossr50.core.util.commands.CommandUtils;
|
||||||
import com.gmail.nossr50.core.util.scoreboards.ScoreboardManager;
|
import com.gmail.nossr50.core.util.scoreboards.ScoreboardManager;
|
||||||
@ -31,7 +31,7 @@ public class McscoreboardCommand implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("keep")) {
|
if (args[0].equalsIgnoreCase("keep")) {
|
||||||
if (!Config.getInstance().getAllowKeepBoard() || !Config.getInstance().getScoreboardsEnabled()) {
|
if (!MainConfig.getInstance().getAllowKeepBoard() || !MainConfig.getInstance().getScoreboardsEnabled()) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.Disabled"));
|
sender.sendMessage(LocaleLoader.getString("Commands.Disabled"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.gmail.nossr50.commands.chat;
|
|||||||
|
|
||||||
import com.gmail.nossr50.core.chat.ChatManager;
|
import com.gmail.nossr50.core.chat.ChatManager;
|
||||||
import com.gmail.nossr50.core.chat.ChatManagerFactory;
|
import com.gmail.nossr50.core.chat.ChatManagerFactory;
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.data.UserManager;
|
import com.gmail.nossr50.core.data.UserManager;
|
||||||
import com.gmail.nossr50.core.datatypes.chat.ChatMode;
|
import com.gmail.nossr50.core.datatypes.chat.ChatMode;
|
||||||
import com.gmail.nossr50.core.datatypes.party.PartyFeature;
|
import com.gmail.nossr50.core.datatypes.party.PartyFeature;
|
||||||
@ -118,7 +118,7 @@ public abstract class ChatCommand implements TabExecutor {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chatMode == ChatMode.PARTY && (mcMMOPlayer.getParty().getLevel() < Config.getInstance().getPartyFeatureUnlockLevel(PartyFeature.CHAT))) {
|
if (chatMode == ChatMode.PARTY && (mcMMOPlayer.getParty().getLevel() < MainConfig.getInstance().getPartyFeatureUnlockLevel(PartyFeature.CHAT))) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.1"));
|
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.1"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.gmail.nossr50.commands.chat;
|
package com.gmail.nossr50.commands.chat;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.chat.PartyChatManager;
|
import com.gmail.nossr50.core.chat.PartyChatManager;
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.data.UserManager;
|
import com.gmail.nossr50.core.data.UserManager;
|
||||||
import com.gmail.nossr50.core.datatypes.chat.ChatMode;
|
import com.gmail.nossr50.core.datatypes.chat.ChatMode;
|
||||||
import com.gmail.nossr50.core.datatypes.party.Party;
|
import com.gmail.nossr50.core.datatypes.party.Party;
|
||||||
@ -29,7 +29,7 @@ public class PartyChatCommand extends ChatCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (party.getLevel() < Config.getInstance().getPartyFeatureUnlockLevel(PartyFeature.CHAT)) {
|
if (party.getLevel() < MainConfig.getInstance().getPartyFeatureUnlockLevel(PartyFeature.CHAT)) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.1"));
|
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.1"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.commands.database;
|
package com.gmail.nossr50.commands.database;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
@ -17,7 +17,7 @@ public class McpurgeCommand implements TabExecutor {
|
|||||||
case 0:
|
case 0:
|
||||||
mcMMO.getDatabaseManager().purgePowerlessUsers();
|
mcMMO.getDatabaseManager().purgePowerlessUsers();
|
||||||
|
|
||||||
if (Config.getInstance().getOldUsersCutoff() != -1) {
|
if (MainConfig.getInstance().getOldUsersCutoff() != -1) {
|
||||||
mcMMO.getDatabaseManager().purgeOldUsers();
|
mcMMO.getDatabaseManager().purgeOldUsers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.commands.database;
|
package com.gmail.nossr50.commands.database;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.data.database.DatabaseManagerFactory;
|
import com.gmail.nossr50.core.data.database.DatabaseManagerFactory;
|
||||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
@ -22,7 +22,7 @@ public class MmoshowdbCommand implements TabExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.mmoshowdb", (Config.getInstance().getUseMySQL() ? "sql" : "flatfile")));
|
sender.sendMessage(LocaleLoader.getString("Commands.mmoshowdb", (MainConfig.getInstance().getUseMySQL() ? "sql" : "flatfile")));
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.commands.hardcore;
|
package com.gmail.nossr50.commands.hardcore;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.core.util.Permissions;
|
import com.gmail.nossr50.core.util.Permissions;
|
||||||
@ -45,7 +45,7 @@ public class HardcoreCommand extends HardcoreModeCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void modify(CommandSender sender, double newPercentage) {
|
protected void modify(CommandSender sender, double newPercentage) {
|
||||||
Config.getInstance().setHardcoreDeathStatPenaltyPercentage(newPercentage);
|
MainConfig.getInstance().setHardcoreDeathStatPenaltyPercentage(newPercentage);
|
||||||
sender.sendMessage(LocaleLoader.getString("Hardcore.DeathStatLoss.PercentageChanged", percent.format(newPercentage / 100.0D)));
|
sender.sendMessage(LocaleLoader.getString("Hardcore.DeathStatLoss.PercentageChanged", percent.format(newPercentage / 100.0D)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.commands.hardcore;
|
package com.gmail.nossr50.commands.hardcore;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.core.util.Permissions;
|
import com.gmail.nossr50.core.util.Permissions;
|
||||||
@ -45,7 +45,7 @@ public class VampirismCommand extends HardcoreModeCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void modify(CommandSender sender, double newPercentage) {
|
protected void modify(CommandSender sender, double newPercentage) {
|
||||||
Config.getInstance().setHardcoreVampirismStatLeechPercentage(newPercentage);
|
MainConfig.getInstance().setHardcoreVampirismStatLeechPercentage(newPercentage);
|
||||||
sender.sendMessage(LocaleLoader.getString("Hardcore.Vampirism.PercentageChanged", percent.format(newPercentage / 100.0D)));
|
sender.sendMessage(LocaleLoader.getString("Hardcore.Vampirism.PercentageChanged", percent.format(newPercentage / 100.0D)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.commands.party;
|
package com.gmail.nossr50.commands.party;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.data.UserManager;
|
import com.gmail.nossr50.core.data.UserManager;
|
||||||
import com.gmail.nossr50.core.datatypes.party.Party;
|
import com.gmail.nossr50.core.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.core.datatypes.party.PartyFeature;
|
import com.gmail.nossr50.core.datatypes.party.PartyFeature;
|
||||||
@ -78,7 +78,7 @@ public class PartyInfoCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isUnlockedFeature(Party party, PartyFeature partyFeature) {
|
private boolean isUnlockedFeature(Party party, PartyFeature partyFeature) {
|
||||||
return party.getLevel() >= Config.getInstance().getPartyFeatureUnlockLevel(partyFeature);
|
return party.getLevel() >= MainConfig.getInstance().getPartyFeatureUnlockLevel(partyFeature);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displayShareModeInfo(Player player, Party party) {
|
private void displayShareModeInfo(Player player, Party party) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.commands.party;
|
package com.gmail.nossr50.commands.party;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.data.UserManager;
|
import com.gmail.nossr50.core.data.UserManager;
|
||||||
import com.gmail.nossr50.core.datatypes.party.Party;
|
import com.gmail.nossr50.core.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||||
@ -47,7 +47,7 @@ public class PartyInviteCommand implements CommandExecutor {
|
|||||||
Party playerParty = mcMMOPlayer.getParty();
|
Party playerParty = mcMMOPlayer.getParty();
|
||||||
|
|
||||||
if (PartyManager.isPartyFull(target, playerParty)) {
|
if (PartyManager.isPartyFull(target, playerParty)) {
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.Party.PartyFull.Invite", target.getName(), playerParty.toString(), Config.getInstance().getPartyMaxSize()));
|
player.sendMessage(LocaleLoader.getString("Commands.Party.PartyFull.Invite", target.getName(), playerParty.toString(), MainConfig.getInstance().getPartyMaxSize()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.commands.party;
|
package com.gmail.nossr50.commands.party;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.data.UserManager;
|
import com.gmail.nossr50.core.data.UserManager;
|
||||||
import com.gmail.nossr50.core.datatypes.party.ItemShareType;
|
import com.gmail.nossr50.core.datatypes.party.ItemShareType;
|
||||||
import com.gmail.nossr50.core.datatypes.party.Party;
|
import com.gmail.nossr50.core.datatypes.party.Party;
|
||||||
@ -19,7 +19,7 @@ public class PartyItemShareCommand implements CommandExecutor {
|
|||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
Party party = UserManager.getPlayer((Player) sender).getParty();
|
Party party = UserManager.getPlayer((Player) sender).getParty();
|
||||||
|
|
||||||
if (party.getLevel() < Config.getInstance().getPartyFeatureUnlockLevel(PartyFeature.ITEM_SHARE)) {
|
if (party.getLevel() < MainConfig.getInstance().getPartyFeatureUnlockLevel(PartyFeature.ITEM_SHARE)) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.4"));
|
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.4"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.commands.party;
|
package com.gmail.nossr50.commands.party;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.data.UserManager;
|
import com.gmail.nossr50.core.data.UserManager;
|
||||||
import com.gmail.nossr50.core.datatypes.party.Party;
|
import com.gmail.nossr50.core.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.core.datatypes.party.PartyFeature;
|
import com.gmail.nossr50.core.datatypes.party.PartyFeature;
|
||||||
@ -18,7 +18,7 @@ public class PartyXpShareCommand implements CommandExecutor {
|
|||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
Party party = UserManager.getPlayer((Player) sender).getParty();
|
Party party = UserManager.getPlayer((Player) sender).getParty();
|
||||||
|
|
||||||
if (party.getLevel() < Config.getInstance().getPartyFeatureUnlockLevel(PartyFeature.XP_SHARE)) {
|
if (party.getLevel() < MainConfig.getInstance().getPartyFeatureUnlockLevel(PartyFeature.XP_SHARE)) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.5"));
|
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.5"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.commands.party.alliance;
|
package com.gmail.nossr50.commands.party.alliance;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.data.UserManager;
|
import com.gmail.nossr50.core.data.UserManager;
|
||||||
import com.gmail.nossr50.core.datatypes.party.Party;
|
import com.gmail.nossr50.core.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.core.datatypes.party.PartyFeature;
|
import com.gmail.nossr50.core.datatypes.party.PartyFeature;
|
||||||
@ -42,7 +42,7 @@ public class PartyAllianceCommand implements TabExecutor {
|
|||||||
|
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 1:
|
case 1:
|
||||||
if (playerParty.getLevel() < Config.getInstance().getPartyFeatureUnlockLevel(PartyFeature.ALLIANCE)) {
|
if (playerParty.getLevel() < MainConfig.getInstance().getPartyFeatureUnlockLevel(PartyFeature.ALLIANCE)) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.3"));
|
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.3"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -60,7 +60,7 @@ public class PartyAllianceCommand implements TabExecutor {
|
|||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
case 3:
|
case 3:
|
||||||
if (playerParty.getLevel() < Config.getInstance().getPartyFeatureUnlockLevel(PartyFeature.ALLIANCE)) {
|
if (playerParty.getLevel() < MainConfig.getInstance().getPartyFeatureUnlockLevel(PartyFeature.ALLIANCE)) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.3"));
|
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.3"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.commands.party.teleport;
|
package com.gmail.nossr50.commands.party.teleport;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.data.UserManager;
|
import com.gmail.nossr50.core.data.UserManager;
|
||||||
import com.gmail.nossr50.core.datatypes.party.PartyTeleportRecord;
|
import com.gmail.nossr50.core.datatypes.party.PartyTeleportRecord;
|
||||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||||
@ -28,7 +28,7 @@ public class PtpAcceptCommand implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SkillUtils.cooldownExpired(ptpRecord.getTimeout(), Config.getInstance().getPTPCommandTimeout())) {
|
if (SkillUtils.cooldownExpired(ptpRecord.getTimeout(), MainConfig.getInstance().getPTPCommandTimeout())) {
|
||||||
ptpRecord.removeRequest();
|
ptpRecord.removeRequest();
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.ptp.RequestExpired"));
|
player.sendMessage(LocaleLoader.getString("Commands.ptp.RequestExpired"));
|
||||||
return true;
|
return true;
|
||||||
@ -41,7 +41,7 @@ public class PtpAcceptCommand implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getPTPCommandWorldPermissions()) {
|
if (MainConfig.getInstance().getPTPCommandWorldPermissions()) {
|
||||||
World targetWorld = target.getWorld();
|
World targetWorld = target.getWorld();
|
||||||
World playerWorld = player.getWorld();
|
World playerWorld = player.getWorld();
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.commands.party.teleport;
|
package com.gmail.nossr50.commands.party.teleport;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.config.WorldBlacklist;
|
import com.gmail.nossr50.core.config.WorldBlacklist;
|
||||||
import com.gmail.nossr50.core.data.UserManager;
|
import com.gmail.nossr50.core.data.UserManager;
|
||||||
import com.gmail.nossr50.core.datatypes.party.Party;
|
import com.gmail.nossr50.core.datatypes.party.Party;
|
||||||
@ -72,7 +72,7 @@ public class PtpCommand implements TabExecutor {
|
|||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(teleportingPlayer);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(teleportingPlayer);
|
||||||
McMMOPlayer mcMMOTarget = UserManager.getPlayer(targetPlayer);
|
McMMOPlayer mcMMOTarget = UserManager.getPlayer(targetPlayer);
|
||||||
|
|
||||||
long warmup = Config.getInstance().getPTPCommandWarmup();
|
long warmup = MainConfig.getInstance().getPTPCommandWarmup();
|
||||||
|
|
||||||
mcMMOPlayer.actualizeTeleportCommenceLocation(teleportingPlayer);
|
mcMMOPlayer.actualizeTeleportCommenceLocation(teleportingPlayer);
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ public class PtpCommand implements TabExecutor {
|
|||||||
|
|
||||||
Party party = mcMMOPlayer.getParty();
|
Party party = mcMMOPlayer.getParty();
|
||||||
|
|
||||||
if (party.getLevel() < Config.getInstance().getPartyFeatureUnlockLevel(PartyFeature.TELEPORT)) {
|
if (party.getLevel() < MainConfig.getInstance().getPartyFeatureUnlockLevel(PartyFeature.TELEPORT)) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.2"));
|
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.2"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -131,7 +131,7 @@ public class PtpCommand implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
long recentlyHurt = mcMMOPlayer.getRecentlyHurt();
|
long recentlyHurt = mcMMOPlayer.getRecentlyHurt();
|
||||||
int hurtCooldown = Config.getInstance().getPTPCommandRecentlyHurtCooldown();
|
int hurtCooldown = MainConfig.getInstance().getPTPCommandRecentlyHurtCooldown();
|
||||||
|
|
||||||
if (hurtCooldown > 0) {
|
if (hurtCooldown > 0) {
|
||||||
int timeRemaining = SkillUtils.calculateTimeLeft(recentlyHurt * Misc.TIME_CONVERSION_FACTOR, hurtCooldown, player);
|
int timeRemaining = SkillUtils.calculateTimeLeft(recentlyHurt * Misc.TIME_CONVERSION_FACTOR, hurtCooldown, player);
|
||||||
@ -151,7 +151,7 @@ public class PtpCommand implements TabExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ptpCooldown = Config.getInstance().getPTPCommandCooldown();
|
int ptpCooldown = MainConfig.getInstance().getPTPCommandCooldown();
|
||||||
long ptpLastUse = mcMMOPlayer.getPartyTeleportRecord().getLastUse();
|
long ptpLastUse = mcMMOPlayer.getPartyTeleportRecord().getLastUse();
|
||||||
|
|
||||||
if (ptpCooldown > 0) {
|
if (ptpCooldown > 0) {
|
||||||
@ -216,6 +216,6 @@ public class PtpCommand implements TabExecutor {
|
|||||||
player.sendMessage(LocaleLoader.getString("Commands.Invite.Success"));
|
player.sendMessage(LocaleLoader.getString("Commands.Invite.Success"));
|
||||||
|
|
||||||
target.sendMessage(LocaleLoader.getString("Commands.ptp.Request1", player.getName()));
|
target.sendMessage(LocaleLoader.getString("Commands.ptp.Request1", player.getName()));
|
||||||
target.sendMessage(LocaleLoader.getString("Commands.ptp.Request2", Config.getInstance().getPTPCommandTimeout()));
|
target.sendMessage(LocaleLoader.getString("Commands.ptp.Request2", MainConfig.getInstance().getPTPCommandTimeout()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.commands.player;
|
package com.gmail.nossr50.commands.player;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.data.UserManager;
|
import com.gmail.nossr50.core.data.UserManager;
|
||||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.core.datatypes.player.PlayerProfile;
|
import com.gmail.nossr50.core.datatypes.player.PlayerProfile;
|
||||||
@ -40,10 +40,10 @@ public class InspectCommand implements TabExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getScoreboardsEnabled() && sender instanceof Player && Config.getInstance().getInspectUseBoard()) {
|
if (MainConfig.getInstance().getScoreboardsEnabled() && sender instanceof Player && MainConfig.getInstance().getInspectUseBoard()) {
|
||||||
ScoreboardManager.enablePlayerInspectScoreboard((Player) sender, profile);
|
ScoreboardManager.enablePlayerInspectScoreboard((Player) sender, profile);
|
||||||
|
|
||||||
if (!Config.getInstance().getInspectUseChat()) {
|
if (!MainConfig.getInstance().getInspectUseChat()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -77,10 +77,10 @@ public class InspectCommand implements TabExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getScoreboardsEnabled() && sender instanceof Player && Config.getInstance().getInspectUseBoard()) {
|
if (MainConfig.getInstance().getScoreboardsEnabled() && sender instanceof Player && MainConfig.getInstance().getInspectUseBoard()) {
|
||||||
ScoreboardManager.enablePlayerInspectScoreboard((Player) sender, mcMMOPlayer.getProfile());
|
ScoreboardManager.enablePlayerInspectScoreboard((Player) sender, mcMMOPlayer.getProfile());
|
||||||
|
|
||||||
if (!Config.getInstance().getInspectUseChat()) {
|
if (!MainConfig.getInstance().getInspectUseChat()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.commands.player;
|
package com.gmail.nossr50.commands.player;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.data.UserManager;
|
import com.gmail.nossr50.core.data.UserManager;
|
||||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||||
@ -30,10 +30,10 @@ public class MccooldownCommand implements TabExecutor {
|
|||||||
case 0:
|
case 0:
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
if (Config.getInstance().getScoreboardsEnabled() && Config.getInstance().getCooldownUseBoard()) {
|
if (MainConfig.getInstance().getScoreboardsEnabled() && MainConfig.getInstance().getCooldownUseBoard()) {
|
||||||
ScoreboardManager.enablePlayerCooldownScoreboard(player);
|
ScoreboardManager.enablePlayerCooldownScoreboard(player);
|
||||||
|
|
||||||
if (!Config.getInstance().getCooldownUseChat()) {
|
if (!MainConfig.getInstance().getCooldownUseChat()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.commands.player;
|
package com.gmail.nossr50.commands.player;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.data.UserManager;
|
import com.gmail.nossr50.core.data.UserManager;
|
||||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||||
@ -87,7 +87,7 @@ public class McrankCommand implements TabExecutor {
|
|||||||
private void display(CommandSender sender, String playerName) {
|
private void display(CommandSender sender, String playerName) {
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
||||||
long cooldownMillis = Math.max(Config.getInstance().getDatabasePlayerCooldown(), 1750);
|
long cooldownMillis = Math.max(MainConfig.getInstance().getDatabasePlayerCooldown(), 1750);
|
||||||
|
|
||||||
if (mcMMOPlayer.getDatabaseATS() + cooldownMillis > System.currentTimeMillis()) {
|
if (mcMMOPlayer.getDatabaseATS() + cooldownMillis > System.currentTimeMillis()) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.Database.Cooldown"));
|
sender.sendMessage(LocaleLoader.getString("Commands.Database.Cooldown"));
|
||||||
@ -104,8 +104,8 @@ public class McrankCommand implements TabExecutor {
|
|||||||
mcMMOPlayer.actualizeDatabaseATS();
|
mcMMOPlayer.actualizeDatabaseATS();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean useBoard = Config.getInstance().getScoreboardsEnabled() && (sender instanceof Player) && (Config.getInstance().getRankUseBoard());
|
boolean useBoard = MainConfig.getInstance().getScoreboardsEnabled() && (sender instanceof Player) && (MainConfig.getInstance().getRankUseBoard());
|
||||||
boolean useChat = !useBoard || Config.getInstance().getRankUseChat();
|
boolean useChat = !useBoard || MainConfig.getInstance().getRankUseChat();
|
||||||
|
|
||||||
new McrankCommandAsyncTask(playerName, sender, useBoard, useChat).runTaskAsynchronously(mcMMO.p);
|
new McrankCommandAsyncTask(playerName, sender, useBoard, useChat).runTaskAsynchronously(mcMMO.p);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.commands.player;
|
package com.gmail.nossr50.commands.player;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.data.UserManager;
|
import com.gmail.nossr50.core.data.UserManager;
|
||||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.core.util.commands.CommandUtils;
|
import com.gmail.nossr50.core.util.commands.CommandUtils;
|
||||||
@ -28,10 +28,10 @@ public class McstatsCommand implements TabExecutor {
|
|||||||
case 0:
|
case 0:
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
if (Config.getInstance().getStatsUseBoard() && Config.getInstance().getScoreboardsEnabled()) {
|
if (MainConfig.getInstance().getStatsUseBoard() && MainConfig.getInstance().getScoreboardsEnabled()) {
|
||||||
ScoreboardManager.enablePlayerStatsScoreboard(player);
|
ScoreboardManager.enablePlayerStatsScoreboard(player);
|
||||||
|
|
||||||
if (!Config.getInstance().getStatsUseChat()) {
|
if (!MainConfig.getInstance().getStatsUseChat()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -43,7 +43,7 @@ public class McstatsCommand implements TabExecutor {
|
|||||||
CommandUtils.printCombatSkills(player);
|
CommandUtils.printCombatSkills(player);
|
||||||
CommandUtils.printMiscSkills(player);
|
CommandUtils.printMiscSkills(player);
|
||||||
|
|
||||||
int powerLevelCap = Config.getInstance().getPowerLevelCap();
|
int powerLevelCap = MainConfig.getInstance().getPowerLevelCap();
|
||||||
|
|
||||||
if (powerLevelCap != Integer.MAX_VALUE) {
|
if (powerLevelCap != Integer.MAX_VALUE) {
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Capped", UserManager.getPlayer(player).getPowerLevel(), powerLevelCap));
|
player.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Capped", UserManager.getPlayer(player).getPowerLevel(), powerLevelCap));
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.commands.player;
|
package com.gmail.nossr50.commands.player;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.data.UserManager;
|
import com.gmail.nossr50.core.data.UserManager;
|
||||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||||
@ -87,7 +87,7 @@ public class MctopCommand implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
||||||
long cooldownMillis = Math.max(Config.getInstance().getDatabasePlayerCooldown(), 1750);
|
long cooldownMillis = Math.max(MainConfig.getInstance().getDatabasePlayerCooldown(), 1750);
|
||||||
|
|
||||||
if (mcMMOPlayer.getDatabaseATS() + cooldownMillis > System.currentTimeMillis()) {
|
if (mcMMOPlayer.getDatabaseATS() + cooldownMillis > System.currentTimeMillis()) {
|
||||||
double seconds = ((mcMMOPlayer.getDatabaseATS() + cooldownMillis) - System.currentTimeMillis()) / 1000;
|
double seconds = ((mcMMOPlayer.getDatabaseATS() + cooldownMillis) - System.currentTimeMillis()) / 1000;
|
||||||
@ -113,8 +113,8 @@ public class MctopCommand implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void display(int page, PrimarySkillType skill, CommandSender sender) {
|
private void display(int page, PrimarySkillType skill, CommandSender sender) {
|
||||||
boolean useBoard = (sender instanceof Player) && (Config.getInstance().getTopUseBoard());
|
boolean useBoard = (sender instanceof Player) && (MainConfig.getInstance().getTopUseBoard());
|
||||||
boolean useChat = !useBoard || Config.getInstance().getTopUseChat();
|
boolean useChat = !useBoard || MainConfig.getInstance().getTopUseChat();
|
||||||
|
|
||||||
new MctopCommandAsyncTask(page, skill, sender, useBoard, useChat).runTaskAsynchronously(mcMMO.p);
|
new MctopCommandAsyncTask(page, skill, sender, useBoard, useChat).runTaskAsynchronously(mcMMO.p);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.gmail.nossr50.commands.skills;
|
package com.gmail.nossr50.commands.skills;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.AdvancedConfig;
|
import com.gmail.nossr50.core.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.data.UserManager;
|
import com.gmail.nossr50.core.data.UserManager;
|
||||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||||
@ -105,13 +105,13 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
|
|
||||||
|
|
||||||
//Link Header
|
//Link Header
|
||||||
if (Config.getInstance().getUrlLinksEnabled()) {
|
if (MainConfig.getInstance().getUrlLinksEnabled()) {
|
||||||
player.sendMessage(LocaleLoader.getString("Overhaul.mcMMO.Header"));
|
player.sendMessage(LocaleLoader.getString("Overhaul.mcMMO.Header"));
|
||||||
TextComponentFactory.sendPlayerUrlHeader(player);
|
TextComponentFactory.sendPlayerUrlHeader(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (Config.getInstance().getScoreboardsEnabled() && Config.getInstance().getSkillUseBoard()) {
|
if (MainConfig.getInstance().getScoreboardsEnabled() && MainConfig.getInstance().getSkillUseBoard()) {
|
||||||
ScoreboardManager.enablePlayerSkillScoreboard(player, skill);
|
ScoreboardManager.enablePlayerSkillScoreboard(player, skill);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.gmail.nossr50.listeners;
|
package com.gmail.nossr50.listeners;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.config.ChunkConversionOptions;
|
import com.gmail.nossr50.core.config.ChunkConversionOptions;
|
||||||
import com.gmail.nossr50.core.config.WorldBlacklist;
|
import com.gmail.nossr50.core.config.WorldBlacklist;
|
||||||
import com.gmail.nossr50.core.data.UserManager;
|
import com.gmail.nossr50.core.data.UserManager;
|
||||||
@ -429,7 +429,7 @@ public class BlockListener implements Listener {
|
|||||||
*
|
*
|
||||||
* We don't need to check permissions here because they've already been checked for the ability to even activate.
|
* We don't need to check permissions here because they've already been checked for the ability to even activate.
|
||||||
*/
|
*/
|
||||||
if (mcMMOPlayer.getAbilityMode(SuperAbilityType.TREE_FELLER) && BlockUtils.isLog(blockState) && Config.getInstance().getTreeFellerSoundsEnabled()) {
|
if (mcMMOPlayer.getAbilityMode(SuperAbilityType.TREE_FELLER) && BlockUtils.isLog(blockState) && MainConfig.getInstance().getTreeFellerSoundsEnabled()) {
|
||||||
SoundManager.sendSound(player, blockState.getLocation(), SoundType.FIZZ);
|
SoundManager.sendSound(player, blockState.getLocation(), SoundType.FIZZ);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.gmail.nossr50.listeners;
|
|||||||
|
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.core.config.AdvancedConfig;
|
import com.gmail.nossr50.core.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.config.WorldBlacklist;
|
import com.gmail.nossr50.core.config.WorldBlacklist;
|
||||||
import com.gmail.nossr50.core.data.UserManager;
|
import com.gmail.nossr50.core.data.UserManager;
|
||||||
import com.gmail.nossr50.core.datatypes.meta.OldName;
|
import com.gmail.nossr50.core.datatypes.meta.OldName;
|
||||||
@ -208,7 +208,7 @@ public class EntityListener implements Listener {
|
|||||||
Player attackingPlayer = (Player) attacker;
|
Player attackingPlayer = (Player) attacker;
|
||||||
if (event.getDamage(DamageModifier.ABSORPTION) > 0) {
|
if (event.getDamage(DamageModifier.ABSORPTION) > 0) {
|
||||||
//If friendly fire is off don't allow players to hurt one another
|
//If friendly fire is off don't allow players to hurt one another
|
||||||
if (!Config.getInstance().getPartyFriendlyFire())
|
if (!MainConfig.getInstance().getPartyFriendlyFire())
|
||||||
if ((PartyManager.inSameParty(defendingPlayer, attackingPlayer) || PartyManager.areAllies(defendingPlayer, attackingPlayer)) && !(Permissions.friendlyFire(attackingPlayer) && Permissions.friendlyFire(defendingPlayer))) {
|
if ((PartyManager.inSameParty(defendingPlayer, attackingPlayer) || PartyManager.areAllies(defendingPlayer, attackingPlayer)) && !(Permissions.friendlyFire(attackingPlayer) && Permissions.friendlyFire(defendingPlayer))) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
@ -276,7 +276,7 @@ public class EntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Party Friendly Fire
|
//Party Friendly Fire
|
||||||
if (!Config.getInstance().getPartyFriendlyFire())
|
if (!MainConfig.getInstance().getPartyFriendlyFire())
|
||||||
if ((PartyManager.inSameParty(defendingPlayer, attackingPlayer) || PartyManager.areAllies(defendingPlayer, attackingPlayer)) && !(Permissions.friendlyFire(attackingPlayer) && Permissions.friendlyFire(defendingPlayer))) {
|
if ((PartyManager.inSameParty(defendingPlayer, attackingPlayer) || PartyManager.areAllies(defendingPlayer, attackingPlayer)) && !(Permissions.friendlyFire(attackingPlayer) && Permissions.friendlyFire(defendingPlayer))) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.listeners;
|
package com.gmail.nossr50.listeners;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.config.WorldBlacklist;
|
import com.gmail.nossr50.core.config.WorldBlacklist;
|
||||||
import com.gmail.nossr50.core.data.UserManager;
|
import com.gmail.nossr50.core.data.UserManager;
|
||||||
import com.gmail.nossr50.core.runnables.player.PlayerUpdateInventoryTask;
|
import com.gmail.nossr50.core.runnables.player.PlayerUpdateInventoryTask;
|
||||||
@ -373,17 +373,17 @@ public class InventoryListener implements Listener {
|
|||||||
|
|
||||||
ItemStack item = event.getItem();
|
ItemStack item = event.getItem();
|
||||||
|
|
||||||
if (Config.getInstance().getPreventHopperTransferIngredients() && item.getType() != Material.POTION && item.getType() != Material.SPLASH_POTION && item.getType() != Material.LINGERING_POTION) {
|
if (MainConfig.getInstance().getPreventHopperTransferIngredients() && item.getType() != Material.POTION && item.getType() != Material.SPLASH_POTION && item.getType() != Material.LINGERING_POTION) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getPreventHopperTransferBottles() && (item.getType() == Material.POTION || item.getType() == Material.SPLASH_POTION || item.getType() == Material.LINGERING_POTION)) {
|
if (MainConfig.getInstance().getPreventHopperTransferBottles() && (item.getType() == Material.POTION || item.getType() == Material.SPLASH_POTION || item.getType() == Material.LINGERING_POTION)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getEnabledForHoppers() && AlchemyPotionBrewer.isValidIngredient(null, item)) {
|
if (MainConfig.getInstance().getEnabledForHoppers() && AlchemyPotionBrewer.isValidIngredient(null, item)) {
|
||||||
AlchemyPotionBrewer.scheduleCheck(null, (BrewingStand) holder);
|
AlchemyPotionBrewer.scheduleCheck(null, (BrewingStand) holder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ import com.gmail.nossr50.config.experience.ExperienceConfig;
|
|||||||
import com.gmail.nossr50.core.chat.ChatManager;
|
import com.gmail.nossr50.core.chat.ChatManager;
|
||||||
import com.gmail.nossr50.core.chat.ChatManagerFactory;
|
import com.gmail.nossr50.core.chat.ChatManagerFactory;
|
||||||
import com.gmail.nossr50.core.chat.PartyChatManager;
|
import com.gmail.nossr50.core.chat.PartyChatManager;
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.config.WorldBlacklist;
|
import com.gmail.nossr50.core.config.WorldBlacklist;
|
||||||
import com.gmail.nossr50.core.data.UserManager;
|
import com.gmail.nossr50.core.data.UserManager;
|
||||||
import com.gmail.nossr50.core.datatypes.chat.ChatMode;
|
import com.gmail.nossr50.core.datatypes.chat.ChatMode;
|
||||||
@ -74,7 +74,7 @@ public class PlayerListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!UserManager.hasPlayerDataKey(player) || Config.getInstance().getXPAfterTeleportCooldown() <= 0 || event.getFrom().equals(event.getTo())) {
|
if (!UserManager.hasPlayerDataKey(player) || MainConfig.getInstance().getXPAfterTeleportCooldown() <= 0 || event.getFrom().equals(event.getTo())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,7 +251,7 @@ public class PlayerListener implements Listener {
|
|||||||
//TODO Update to new API once available! Waiting for case CAUGHT_TREASURE:
|
//TODO Update to new API once available! Waiting for case CAUGHT_TREASURE:
|
||||||
Item fishingCatch = (Item) event.getCaught();
|
Item fishingCatch = (Item) event.getCaught();
|
||||||
|
|
||||||
if (Config.getInstance().getFishingOverrideTreasures() &&
|
if (MainConfig.getInstance().getFishingOverrideTreasures() &&
|
||||||
fishingCatch.getItemStack().getType() != Material.SALMON &&
|
fishingCatch.getItemStack().getType() != Material.SALMON &&
|
||||||
fishingCatch.getItemStack().getType() != Material.COD &&
|
fishingCatch.getItemStack().getType() != Material.COD &&
|
||||||
fishingCatch.getItemStack().getType() != Material.TROPICAL_FISH &&
|
fishingCatch.getItemStack().getType() != Material.TROPICAL_FISH &&
|
||||||
@ -397,7 +397,7 @@ public class PlayerListener implements Listener {
|
|||||||
|
|
||||||
/*if (player.getInventory().getItemInMainHand().getType() == Material.AIR) {
|
/*if (player.getInventory().getItemInMainHand().getType() == Material.AIR) {
|
||||||
Unarmed.handleItemPickup(player, event);
|
Unarmed.handleItemPickup(player, event);
|
||||||
*//*boolean cancel = Config.getInstance().getUnarmedItemPickupDisabled() || pickupSuccess;
|
*//*boolean cancel = MainConfig.getInstance().getUnarmedItemPickupDisabled() || pickupSuccess;
|
||||||
event.setCancelled(cancel);
|
event.setCancelled(cancel);
|
||||||
|
|
||||||
if (pickupSuccess) {
|
if (pickupSuccess) {
|
||||||
@ -448,7 +448,7 @@ public class PlayerListener implements Listener {
|
|||||||
|
|
||||||
new PlayerProfileLoadingTask(player).runTaskLaterAsynchronously(mcMMO.p, 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
|
new PlayerProfileLoadingTask(player).runTaskLaterAsynchronously(mcMMO.p, 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
|
||||||
|
|
||||||
if (Config.getInstance().getMOTDEnabled() && Permissions.motd(player)) {
|
if (MainConfig.getInstance().getMOTDEnabled() && Permissions.motd(player)) {
|
||||||
Motd.displayAll(player);
|
Motd.displayAll(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -509,7 +509,7 @@ public class PlayerListener implements Listener {
|
|||||||
case RIGHT_CLICK_BLOCK:
|
case RIGHT_CLICK_BLOCK:
|
||||||
Material type = block.getType();
|
Material type = block.getType();
|
||||||
|
|
||||||
if (!Config.getInstance().getAbilitiesOnlyActivateWhenSneaking() || player.isSneaking()) {
|
if (!MainConfig.getInstance().getAbilitiesOnlyActivateWhenSneaking() || player.isSneaking()) {
|
||||||
/* REPAIR CHECKS */
|
/* REPAIR CHECKS */
|
||||||
if (type == Repair.anvilMaterial && PrimarySkillType.REPAIR.getPermissions(player) && mcMMO.getRepairableManager().isRepairable(heldItem)) {
|
if (type == Repair.anvilMaterial && PrimarySkillType.REPAIR.getPermissions(player) && mcMMO.getRepairableManager().isRepairable(heldItem)) {
|
||||||
RepairManager repairManager = mcMMOPlayer.getRepairManager();
|
RepairManager repairManager = mcMMOPlayer.getRepairManager();
|
||||||
@ -548,7 +548,7 @@ public class PlayerListener implements Listener {
|
|||||||
case LEFT_CLICK_BLOCK:
|
case LEFT_CLICK_BLOCK:
|
||||||
type = block.getType();
|
type = block.getType();
|
||||||
|
|
||||||
if (!Config.getInstance().getAbilitiesOnlyActivateWhenSneaking() || player.isSneaking()) {
|
if (!MainConfig.getInstance().getAbilitiesOnlyActivateWhenSneaking() || player.isSneaking()) {
|
||||||
/* REPAIR CHECKS */
|
/* REPAIR CHECKS */
|
||||||
if (type == Repair.anvilMaterial && PrimarySkillType.REPAIR.getPermissions(player) && mcMMO.getRepairableManager().isRepairable(heldItem)) {
|
if (type == Repair.anvilMaterial && PrimarySkillType.REPAIR.getPermissions(player) && mcMMO.getRepairableManager().isRepairable(heldItem)) {
|
||||||
RepairManager repairManager = mcMMOPlayer.getRepairManager();
|
RepairManager repairManager = mcMMOPlayer.getRepairManager();
|
||||||
@ -615,7 +615,7 @@ public class PlayerListener implements Listener {
|
|||||||
|
|
||||||
/* ACTIVATION & ITEM CHECKS */
|
/* ACTIVATION & ITEM CHECKS */
|
||||||
if (BlockUtils.canActivateTools(blockState)) {
|
if (BlockUtils.canActivateTools(blockState)) {
|
||||||
if (Config.getInstance().getAbilitiesEnabled()) {
|
if (MainConfig.getInstance().getAbilitiesEnabled()) {
|
||||||
if (BlockUtils.canActivateHerbalism(blockState)) {
|
if (BlockUtils.canActivateHerbalism(blockState)) {
|
||||||
mcMMOPlayer.processAbilityActivation(PrimarySkillType.HERBALISM);
|
mcMMOPlayer.processAbilityActivation(PrimarySkillType.HERBALISM);
|
||||||
}
|
}
|
||||||
@ -669,7 +669,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ACTIVATION CHECKS */
|
/* ACTIVATION CHECKS */
|
||||||
if (Config.getInstance().getAbilitiesEnabled()) {
|
if (MainConfig.getInstance().getAbilitiesEnabled()) {
|
||||||
mcMMOPlayer.processAbilityActivation(PrimarySkillType.AXES);
|
mcMMOPlayer.processAbilityActivation(PrimarySkillType.AXES);
|
||||||
mcMMOPlayer.processAbilityActivation(PrimarySkillType.EXCAVATION);
|
mcMMOPlayer.processAbilityActivation(PrimarySkillType.EXCAVATION);
|
||||||
mcMMOPlayer.processAbilityActivation(PrimarySkillType.HERBALISM);
|
mcMMOPlayer.processAbilityActivation(PrimarySkillType.HERBALISM);
|
||||||
@ -701,11 +701,11 @@ public class PlayerListener implements Listener {
|
|||||||
Material type = heldItem.getType();
|
Material type = heldItem.getType();
|
||||||
TamingManager tamingManager = mcMMOPlayer.getTamingManager();
|
TamingManager tamingManager = mcMMOPlayer.getTamingManager();
|
||||||
|
|
||||||
if (type == Config.getInstance().getTamingCOTWMaterial(EntityType.WOLF)) {
|
if (type == MainConfig.getInstance().getTamingCOTWMaterial(EntityType.WOLF)) {
|
||||||
tamingManager.summonWolf();
|
tamingManager.summonWolf();
|
||||||
} else if (type == Config.getInstance().getTamingCOTWMaterial(EntityType.OCELOT)) {
|
} else if (type == MainConfig.getInstance().getTamingCOTWMaterial(EntityType.OCELOT)) {
|
||||||
tamingManager.summonOcelot();
|
tamingManager.summonOcelot();
|
||||||
} else if (type == Config.getInstance().getTamingCOTWMaterial(EntityType.HORSE)) {
|
} else if (type == MainConfig.getInstance().getTamingCOTWMaterial(EntityType.HORSE)) {
|
||||||
tamingManager.summonHorse();
|
tamingManager.summonHorse();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -767,7 +767,7 @@ public class PlayerListener implements Listener {
|
|||||||
*/
|
*/
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
||||||
if (!Config.getInstance().getLocale().equalsIgnoreCase("en_US")) {
|
if (!MainConfig.getInstance().getLocale().equalsIgnoreCase("en_US")) {
|
||||||
String message = event.getMessage();
|
String message = event.getMessage();
|
||||||
String command = message.substring(1).split(" ")[0];
|
String command = message.substring(1).split(" ")[0];
|
||||||
String lowerCaseCommand = command.toLowerCase();
|
String lowerCaseCommand = command.toLowerCase();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.gmail.nossr50.listeners;
|
package com.gmail.nossr50.listeners;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.data.UserManager;
|
import com.gmail.nossr50.core.data.UserManager;
|
||||||
import com.gmail.nossr50.core.datatypes.experience.XPGainReason;
|
import com.gmail.nossr50.core.datatypes.experience.XPGainReason;
|
||||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||||
@ -38,27 +38,27 @@ public class SelfListener implements Listener {
|
|||||||
UserManager.getPlayer(player).processUnlockNotifications(plugin, event.getSkill(), previousLevelGained);
|
UserManager.getPlayer(player).processUnlockNotifications(plugin, event.getSkill(), previousLevelGained);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getScoreboardsEnabled())
|
if (MainConfig.getInstance().getScoreboardsEnabled())
|
||||||
ScoreboardManager.handleLevelUp(player, skill);
|
ScoreboardManager.handleLevelUp(player, skill);
|
||||||
|
|
||||||
if (!Config.getInstance().getLevelUpEffectsEnabled()) {
|
if (!MainConfig.getInstance().getLevelUpEffectsEnabled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((event.getSkillLevel() % Config.getInstance().getLevelUpEffectsTier()) == 0) {
|
if ((event.getSkillLevel() % MainConfig.getInstance().getLevelUpEffectsTier()) == 0) {
|
||||||
skill.celebrateLevelUp(player);
|
skill.celebrateLevelUp(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onPlayerXp(McMMOPlayerXpGainEvent event) {
|
public void onPlayerXp(McMMOPlayerXpGainEvent event) {
|
||||||
if (Config.getInstance().getScoreboardsEnabled())
|
if (MainConfig.getInstance().getScoreboardsEnabled())
|
||||||
ScoreboardManager.handleXp(event.getPlayer(), event.getSkill());
|
ScoreboardManager.handleXp(event.getPlayer(), event.getSkill());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onAbility(McMMOPlayerAbilityActivateEvent event) {
|
public void onAbility(McMMOPlayerAbilityActivateEvent event) {
|
||||||
if (Config.getInstance().getScoreboardsEnabled())
|
if (MainConfig.getInstance().getScoreboardsEnabled())
|
||||||
ScoreboardManager.cooldownUpdate(event.getPlayer(), event.getSkill());
|
ScoreboardManager.cooldownUpdate(event.getPlayer(), event.getSkill());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
/* Plugin Checks */
|
/* Plugin Checks */
|
||||||
private static boolean healthBarPluginEnabled;
|
private static boolean healthBarPluginEnabled;
|
||||||
private static boolean isRetroModeEnabled;
|
private static boolean isRetroModeEnabled;
|
||||||
// Config Validation Check
|
// MainConfig Validation Check
|
||||||
public boolean noErrorsInConfigFiles = true;
|
public boolean noErrorsInConfigFiles = true;
|
||||||
// XP Event Check
|
// XP Event Check
|
||||||
private boolean xpEventEnabled;
|
private boolean xpEventEnabled;
|
||||||
@ -206,7 +206,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Store this value so other plugins can check it
|
//Store this value so other plugins can check it
|
||||||
isRetroModeEnabled = Config.getInstance().getIsRetroMode();
|
isRetroModeEnabled = MainConfig.getInstance().getIsRetroMode();
|
||||||
|
|
||||||
if (getServer().getName().equals("Cauldron") || getServer().getName().equals("MCPC+")) {
|
if (getServer().getName().equals("Cauldron") || getServer().getName().equals("MCPC+")) {
|
||||||
checkModConfigs();
|
checkModConfigs();
|
||||||
@ -243,7 +243,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
|
|
||||||
placeStore = ChunkManagerFactory.getChunkManager(); // Get our ChunkletManager
|
placeStore = ChunkManagerFactory.getChunkManager(); // Get our ChunkletManager
|
||||||
|
|
||||||
if (Config.getInstance().getPTPCommandWorldPermissions()) {
|
if (MainConfig.getInstance().getPTPCommandWorldPermissions()) {
|
||||||
Permissions.generateWorldTeleportPermissions();
|
Permissions.generateWorldTeleportPermissions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -254,11 +254,11 @@ public class mcMMO extends JavaPlugin {
|
|||||||
|
|
||||||
Metrics metrics;
|
Metrics metrics;
|
||||||
|
|
||||||
if (Config.getInstance().getIsMetricsEnabled()) {
|
if (MainConfig.getInstance().getIsMetricsEnabled()) {
|
||||||
metrics = new Metrics(this);
|
metrics = new Metrics(this);
|
||||||
metrics.addCustomChart(new Metrics.SimplePie("version", () -> getDescription().getVersion()));
|
metrics.addCustomChart(new Metrics.SimplePie("version", () -> getDescription().getVersion()));
|
||||||
|
|
||||||
if (Config.getInstance().getIsRetroMode())
|
if (MainConfig.getInstance().getIsRetroMode())
|
||||||
metrics.addCustomChart(new Metrics.SimplePie("scaling", () -> "Standard"));
|
metrics.addCustomChart(new Metrics.SimplePie("scaling", () -> "Standard"));
|
||||||
else
|
else
|
||||||
metrics.addCustomChart(new Metrics.SimplePie("scaling", () -> "Retro"));
|
metrics.addCustomChart(new Metrics.SimplePie("scaling", () -> "Retro"));
|
||||||
@ -297,7 +297,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
PartyManager.saveParties(); // Save our parties
|
PartyManager.saveParties(); // Save our parties
|
||||||
|
|
||||||
//TODO: Needed?
|
//TODO: Needed?
|
||||||
if (Config.getInstance().getScoreboardsEnabled())
|
if (MainConfig.getInstance().getScoreboardsEnabled())
|
||||||
ScoreboardManager.teardownAll();
|
ScoreboardManager.teardownAll();
|
||||||
|
|
||||||
formulaManager.saveFormula();
|
formulaManager.saveFormula();
|
||||||
@ -313,7 +313,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
debug("Unregister all events...");
|
debug("Unregister all events...");
|
||||||
HandlerList.unregisterAll(this); // Cancel event registrations
|
HandlerList.unregisterAll(this); // Cancel event registrations
|
||||||
|
|
||||||
if (Config.getInstance().getBackupsEnabled()) {
|
if (MainConfig.getInstance().getBackupsEnabled()) {
|
||||||
// Remove other tasks BEFORE starting the Backup, or we just cancel it straight away.
|
// Remove other tasks BEFORE starting the Backup, or we just cancel it straight away.
|
||||||
try {
|
try {
|
||||||
ZipLibrary.mcMMOBackup();
|
ZipLibrary.mcMMOBackup();
|
||||||
@ -425,19 +425,19 @@ public class mcMMO extends JavaPlugin {
|
|||||||
List<Repairable> repairables = new ArrayList<Repairable>();
|
List<Repairable> repairables = new ArrayList<Repairable>();
|
||||||
List<Salvageable> salvageables = new ArrayList<Salvageable>();
|
List<Salvageable> salvageables = new ArrayList<Salvageable>();
|
||||||
|
|
||||||
if (Config.getInstance().getToolModsEnabled()) {
|
if (MainConfig.getInstance().getToolModsEnabled()) {
|
||||||
new ToolConfigManager(this);
|
new ToolConfigManager(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getArmorModsEnabled()) {
|
if (MainConfig.getInstance().getArmorModsEnabled()) {
|
||||||
new ArmorConfigManager(this);
|
new ArmorConfigManager(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getBlockModsEnabled()) {
|
if (MainConfig.getInstance().getBlockModsEnabled()) {
|
||||||
new BlockConfigManager(this);
|
new BlockConfigManager(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getEntityModsEnabled()) {
|
if (MainConfig.getInstance().getEntityModsEnabled()) {
|
||||||
new EntityConfigManager(this);
|
new EntityConfigManager(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -487,7 +487,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
|
|
||||||
private void registerCustomRecipes() {
|
private void registerCustomRecipes() {
|
||||||
getServer().getScheduler().scheduleSyncDelayedTask(this, () -> {
|
getServer().getScheduler().scheduleSyncDelayedTask(this, () -> {
|
||||||
if (Config.getInstance().getChimaeraEnabled()) {
|
if (MainConfig.getInstance().getChimaeraEnabled()) {
|
||||||
getServer().addRecipe(ChimaeraWing.getChimaeraWingRecipe());
|
getServer().addRecipe(ChimaeraWing.getChimaeraWingRecipe());
|
||||||
}
|
}
|
||||||
}, 40);
|
}, 40);
|
||||||
@ -495,7 +495,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
|
|
||||||
private void scheduleTasks() {
|
private void scheduleTasks() {
|
||||||
// Periodic save timer (Saves every 10 minutes by default)
|
// Periodic save timer (Saves every 10 minutes by default)
|
||||||
long saveIntervalTicks = Config.getInstance().getSaveInterval() * 1200;
|
long saveIntervalTicks = MainConfig.getInstance().getSaveInterval() * 1200;
|
||||||
new SaveTimerTask().runTaskTimer(this, saveIntervalTicks, saveIntervalTicks);
|
new SaveTimerTask().runTaskTimer(this, saveIntervalTicks, saveIntervalTicks);
|
||||||
|
|
||||||
// Cleanup the backups folder
|
// Cleanup the backups folder
|
||||||
@ -505,7 +505,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
new BleedTimerTask().runTaskTimer(this, 1 * Misc.TICK_CONVERSION_FACTOR, 1 * (Misc.TICK_CONVERSION_FACTOR / 2));
|
new BleedTimerTask().runTaskTimer(this, 1 * Misc.TICK_CONVERSION_FACTOR, 1 * (Misc.TICK_CONVERSION_FACTOR / 2));
|
||||||
|
|
||||||
// Old & Powerless User remover
|
// Old & Powerless User remover
|
||||||
long purgeIntervalTicks = Config.getInstance().getPurgeInterval() * 60L * 60L * Misc.TICK_CONVERSION_FACTOR;
|
long purgeIntervalTicks = MainConfig.getInstance().getPurgeInterval() * 60L * 60L * Misc.TICK_CONVERSION_FACTOR;
|
||||||
|
|
||||||
if (purgeIntervalTicks == 0) {
|
if (purgeIntervalTicks == 0) {
|
||||||
new UserPurgeTask().runTaskLaterAsynchronously(this, 2 * Misc.TICK_CONVERSION_FACTOR); // Start 2 seconds after startup.
|
new UserPurgeTask().runTaskLaterAsynchronously(this, 2 * Misc.TICK_CONVERSION_FACTOR); // Start 2 seconds after startup.
|
||||||
@ -514,7 +514,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Automatically remove old members from parties
|
// Automatically remove old members from parties
|
||||||
long kickIntervalTicks = Config.getInstance().getAutoPartyKickInterval() * 60L * 60L * Misc.TICK_CONVERSION_FACTOR;
|
long kickIntervalTicks = MainConfig.getInstance().getAutoPartyKickInterval() * 60L * 60L * Misc.TICK_CONVERSION_FACTOR;
|
||||||
|
|
||||||
if (kickIntervalTicks == 0) {
|
if (kickIntervalTicks == 0) {
|
||||||
new PartyAutoKickTask().runTaskLater(this, 2 * Misc.TICK_CONVERSION_FACTOR); // Start 2 seconds after startup.
|
new PartyAutoKickTask().runTaskLater(this, 2 * Misc.TICK_CONVERSION_FACTOR); // Start 2 seconds after startup.
|
||||||
@ -536,22 +536,22 @@ public class mcMMO extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void checkModConfigs() {
|
private void checkModConfigs() {
|
||||||
if (!Config.getInstance().getToolModsEnabled()) {
|
if (!MainConfig.getInstance().getToolModsEnabled()) {
|
||||||
getLogger().warning("Cauldron implementation found, but the custom tool config for mcMMO is disabled!");
|
getLogger().warning("Cauldron implementation found, but the custom tool config for mcMMO is disabled!");
|
||||||
getLogger().info("To enable, set Mods.Tool_Mods_Enabled to TRUE in config.yml.");
|
getLogger().info("To enable, set Mods.Tool_Mods_Enabled to TRUE in config.yml.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Config.getInstance().getArmorModsEnabled()) {
|
if (!MainConfig.getInstance().getArmorModsEnabled()) {
|
||||||
getLogger().warning("Cauldron implementation found, but the custom armor config for mcMMO is disabled!");
|
getLogger().warning("Cauldron implementation found, but the custom armor config for mcMMO is disabled!");
|
||||||
getLogger().info("To enable, set Mods.Armor_Mods_Enabled to TRUE in config.yml.");
|
getLogger().info("To enable, set Mods.Armor_Mods_Enabled to TRUE in config.yml.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Config.getInstance().getBlockModsEnabled()) {
|
if (!MainConfig.getInstance().getBlockModsEnabled()) {
|
||||||
getLogger().warning("Cauldron implementation found, but the custom block config for mcMMO is disabled!");
|
getLogger().warning("Cauldron implementation found, but the custom block config for mcMMO is disabled!");
|
||||||
getLogger().info("To enable, set Mods.Block_Mods_Enabled to TRUE in config.yml.");
|
getLogger().info("To enable, set Mods.Block_Mods_Enabled to TRUE in config.yml.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Config.getInstance().getEntityModsEnabled()) {
|
if (!MainConfig.getInstance().getEntityModsEnabled()) {
|
||||||
getLogger().warning("Cauldron implementation found, but the custom entity config for mcMMO is disabled!");
|
getLogger().warning("Cauldron implementation found, but the custom entity config for mcMMO is disabled!");
|
||||||
getLogger().info("To enable, set Mods.Entity_Mods_Enabled to TRUE in config.yml.");
|
getLogger().info("To enable, set Mods.Entity_Mods_Enabled to TRUE in config.yml.");
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import com.gmail.nossr50.core.mcmmo.plugin.Plugin;
|
|||||||
import com.gmail.nossr50.core.mcmmo.server.Server;
|
import com.gmail.nossr50.core.mcmmo.server.Server;
|
||||||
import com.gmail.nossr50.core.mcmmo.tasks.TaskScheduler;
|
import com.gmail.nossr50.core.mcmmo.tasks.TaskScheduler;
|
||||||
import com.gmail.nossr50.core.platform.Platform;
|
import com.gmail.nossr50.core.platform.Platform;
|
||||||
|
import com.gmail.nossr50.core.util.ModManager;
|
||||||
import com.gmail.nossr50.core.util.experience.FormulaManager;
|
import com.gmail.nossr50.core.util.experience.FormulaManager;
|
||||||
import com.gmail.nossr50.core.util.upgrade.UpgradeManager;
|
import com.gmail.nossr50.core.util.upgrade.UpgradeManager;
|
||||||
|
|
||||||
@ -22,8 +23,9 @@ public class McmmoCore {
|
|||||||
|
|
||||||
//Why do all these things need to be here? Sigh...
|
//Why do all these things need to be here? Sigh...
|
||||||
private static DatabaseManager databaseManager;
|
private static DatabaseManager databaseManager;
|
||||||
private static UpgradeManager upgradeManager;
|
private static UpgradeManager upgradeManager; //TODO: I can't even remember what this one did
|
||||||
private static FormulaManager formulaManager;
|
private static FormulaManager formulaManager;
|
||||||
|
private static ModManager modManager; //TODO: Probably need to rewrite this
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns our Logger
|
* Returns our Logger
|
||||||
@ -64,4 +66,8 @@ public class McmmoCore {
|
|||||||
public static FormulaManager getFormulaManager() { return formulaManager; }
|
public static FormulaManager getFormulaManager() { return formulaManager; }
|
||||||
|
|
||||||
public static boolean isRetroModeEnabled() { return retroModeEnabled; }
|
public static boolean isRetroModeEnabled() { return retroModeEnabled; }
|
||||||
|
|
||||||
|
public static ModManager getModManager() { return modManager; }
|
||||||
|
|
||||||
|
public static String getModDataFolderPath() { return platform.getModDataFolderPath(); }
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.gmail.nossr50.core.api;
|
package com.gmail.nossr50.core.api;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.api.exceptions.*;
|
import com.gmail.nossr50.core.api.exceptions.*;
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.core.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.core.data.UserManager;
|
import com.gmail.nossr50.core.data.UserManager;
|
||||||
import com.gmail.nossr50.core.datatypes.experience.FormulaType;
|
import com.gmail.nossr50.core.datatypes.experience.FormulaType;
|
||||||
@ -716,7 +716,7 @@ public final class ExperienceAPI {
|
|||||||
* @throws InvalidSkillException if the given skill is not valid
|
* @throws InvalidSkillException if the given skill is not valid
|
||||||
*/
|
*/
|
||||||
public static int getLevelCap(String skillType) {
|
public static int getLevelCap(String skillType) {
|
||||||
return Config.getInstance().getLevelCap(getSkillType(skillType));
|
return MainConfig.getInstance().getLevelCap(getSkillType(skillType));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -727,7 +727,7 @@ public final class ExperienceAPI {
|
|||||||
* @return the overall power level cap
|
* @return the overall power level cap
|
||||||
*/
|
*/
|
||||||
public static int getPowerLevelCap() {
|
public static int getPowerLevelCap() {
|
||||||
return Config.getInstance().getPowerLevelCap();
|
return MainConfig.getInstance().getPowerLevelCap();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.core.api;
|
package com.gmail.nossr50.core.api;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.data.UserManager;
|
import com.gmail.nossr50.core.data.UserManager;
|
||||||
import com.gmail.nossr50.core.datatypes.interactions.NotificationType;
|
import com.gmail.nossr50.core.datatypes.interactions.NotificationType;
|
||||||
import com.gmail.nossr50.core.datatypes.party.Party;
|
import com.gmail.nossr50.core.datatypes.party.Party;
|
||||||
@ -101,7 +101,7 @@ public final class PartyAPI {
|
|||||||
* @return the max party size on this server
|
* @return the max party size on this server
|
||||||
*/
|
*/
|
||||||
public static int getMaxPartySize() {
|
public static int getMaxPartySize() {
|
||||||
return Config.getInstance().getPartyMaxSize();
|
return MainConfig.getInstance().getPartyMaxSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package com.gmail.nossr50.core.chat;
|
package com.gmail.nossr50.core.chat;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.McmmoCore;
|
import com.gmail.nossr50.core.McmmoCore;
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.events.chat.McMMOAdminChatEvent;
|
import com.gmail.nossr50.core.events.chat.McMMOAdminChatEvent;
|
||||||
|
|
||||||
public class AdminChatManager extends ChatManager {
|
public class AdminChatManager extends ChatManager {
|
||||||
protected AdminChatManager() {
|
protected AdminChatManager() {
|
||||||
super(Config.getInstance().getAdminDisplayNames(), Config.getInstance().getAdminChatPrefix());
|
super(MainConfig.getInstance().getAdminDisplayNames(), MainConfig.getInstance().getAdminChatPrefix());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.core.chat;
|
package com.gmail.nossr50.core.chat;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.datatypes.party.Party;
|
import com.gmail.nossr50.core.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.core.runnables.party.PartyChatTask;
|
import com.gmail.nossr50.core.runnables.party.PartyChatTask;
|
||||||
import com.gmail.nossr50.events.chat.McMMOPartyChatEvent;
|
import com.gmail.nossr50.events.chat.McMMOPartyChatEvent;
|
||||||
@ -10,7 +10,7 @@ public class PartyChatManager extends ChatManager {
|
|||||||
private Party party;
|
private Party party;
|
||||||
|
|
||||||
protected PartyChatManager(Plugin plugin) {
|
protected PartyChatManager(Plugin plugin) {
|
||||||
super(plugin, Config.getInstance().getPartyDisplayNames(), Config.getInstance().getPartyChatPrefix());
|
super(plugin, MainConfig.getInstance().getPartyDisplayNames(), MainConfig.getInstance().getPartyChatPrefix());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setParty(Party party) {
|
public void setParty(Party party) {
|
||||||
|
@ -5,13 +5,12 @@ import com.gmail.nossr50.core.datatypes.interactions.NotificationType;
|
|||||||
import com.gmail.nossr50.core.mcmmo.colors.ChatColor;
|
import com.gmail.nossr50.core.mcmmo.colors.ChatColor;
|
||||||
import com.gmail.nossr50.core.skills.SubSkillType;
|
import com.gmail.nossr50.core.skills.SubSkillType;
|
||||||
import com.gmail.nossr50.core.skills.subskills.AbstractSubSkill;
|
import com.gmail.nossr50.core.skills.subskills.AbstractSubSkill;
|
||||||
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
//@ConfigSerializable
|
//@ConfigSerializable
|
||||||
public class AdvancedConfig extends ConfigurableLoader {
|
public class AdvancedConfig extends ConfigValidated {
|
||||||
|
|
||||||
public static final String SKILLS = "Skills";
|
public static final String SKILLS = "Skills";
|
||||||
public static final String GENERAL = "General";
|
public static final String GENERAL = "General";
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,19 @@
|
|||||||
|
package com.gmail.nossr50.core.config;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a config file that registers keys after its initialized
|
||||||
|
*/
|
||||||
|
public abstract class ConfigKeyRegister extends Config implements RegistersKeys {
|
||||||
|
|
||||||
|
public ConfigKeyRegister(String pathToParentFolder, String relativePath) {
|
||||||
|
super(pathToParentFolder, relativePath);
|
||||||
|
loadKeys();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConfigKeyRegister(File pathToParentFolder, String relativePath) {
|
||||||
|
super(pathToParentFolder, relativePath);
|
||||||
|
loadKeys();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
package com.gmail.nossr50.core.config;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.core.McmmoCore;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class is used for config files that validate their entries
|
||||||
|
*/
|
||||||
|
public abstract class ConfigValidated extends Config implements DefaultKeys {
|
||||||
|
public ConfigValidated(String parentFolderPath, String relativePath)
|
||||||
|
{
|
||||||
|
super(parentFolderPath, relativePath);
|
||||||
|
validateEntries();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConfigValidated(File parentFolderFile, String relativePath)
|
||||||
|
{
|
||||||
|
super(parentFolderFile, relativePath);
|
||||||
|
validateEntries();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prints all errors found when validating the config
|
||||||
|
*/
|
||||||
|
private void validateEntries()
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Print Errors about Keys
|
||||||
|
*/
|
||||||
|
|
||||||
|
List<String> validKeyErrors = validateKeys(); // Validate Keys
|
||||||
|
|
||||||
|
if(validKeyErrors != null && validKeyErrors.size() > 0)
|
||||||
|
{
|
||||||
|
for(String error : validKeyErrors)
|
||||||
|
{
|
||||||
|
McmmoCore.getLogger().severe(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,315 +0,0 @@
|
|||||||
package com.gmail.nossr50.core.config;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.core.McmmoCore;
|
|
||||||
import com.google.common.io.Files;
|
|
||||||
import ninja.leaping.configurate.ConfigurationNode;
|
|
||||||
import ninja.leaping.configurate.commented.CommentedConfigurationNode;
|
|
||||||
import ninja.leaping.configurate.loader.ConfigurationLoader;
|
|
||||||
import ninja.leaping.configurate.yaml.YAMLConfigurationLoader;
|
|
||||||
import org.yaml.snakeyaml.DumperOptions;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handles loading and cacheing configuration settings from a configurable compatible config file
|
|
||||||
*/
|
|
||||||
//@ConfigSerializable
|
|
||||||
public abstract class ConfigurableLoader implements DefaultKeys, VersionedConfig {
|
|
||||||
|
|
||||||
/* PATH VARS */
|
|
||||||
|
|
||||||
public final File DIRECTORY_DATA_FOLDER; //Directory that the file is in
|
|
||||||
public final String FILE_RELATIVE_PATH; //Relative Path to the file
|
|
||||||
protected final String DIRECTORY_DEFAULTS = "defaults";
|
|
||||||
|
|
||||||
/* LOADERS */
|
|
||||||
|
|
||||||
private YAMLConfigurationLoader defaultCopyLoader;
|
|
||||||
private YAMLConfigurationLoader userCopyLoader;
|
|
||||||
|
|
||||||
/* CONFIG FILES */
|
|
||||||
|
|
||||||
private File resourceConfigCopy; //Copy of the default config from the JAR (file is copied so that admins can easily compare to defaults)
|
|
||||||
private File resourceUserCopy; //File in the /$MCMMO_ROOT/mcMMO/ directory that may contain user edited settings
|
|
||||||
|
|
||||||
/* ROOT NODES */
|
|
||||||
|
|
||||||
private ConfigurationNode userRootNode = null;
|
|
||||||
private ConfigurationNode defaultRootNode = null;
|
|
||||||
|
|
||||||
/* CONFIG MANAGER */
|
|
||||||
private ConfigurationLoader<CommentedConfigurationNode> configManager;
|
|
||||||
|
|
||||||
public ConfigurableLoader(String pathToParentFolder, String relativePath) {
|
|
||||||
//TODO: Check if this works...
|
|
||||||
this(new File(pathToParentFolder), relativePath);
|
|
||||||
System.out.println("mcMMO Debug: Don't forget to check if loading config file by string instead of File works...");
|
|
||||||
}
|
|
||||||
|
|
||||||
public ConfigurableLoader(File pathToParentFolder, String relativePath) {
|
|
||||||
/*
|
|
||||||
* These must be at the top
|
|
||||||
*/
|
|
||||||
mkdirDefaults(); // Make our default config dir
|
|
||||||
DIRECTORY_DATA_FOLDER = pathToParentFolder; //Data Folder for our plugin
|
|
||||||
FILE_RELATIVE_PATH = relativePath; //Relative path to config from a parent folder
|
|
||||||
|
|
||||||
//Attempt IO Operations
|
|
||||||
try {
|
|
||||||
//Makes sure we have valid Files corresponding to this config
|
|
||||||
initConfigFiles();
|
|
||||||
|
|
||||||
//Init Config Loaders
|
|
||||||
initConfigLoaders();
|
|
||||||
|
|
||||||
//Load Config Nodes
|
|
||||||
loadConfig();
|
|
||||||
|
|
||||||
//Attempt to update user file, and then load it into memory
|
|
||||||
readConfig();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Print Errors about Keys
|
|
||||||
*/
|
|
||||||
|
|
||||||
List<String> validKeyErrors = validateKeys(); // Validate Keys
|
|
||||||
|
|
||||||
if(validKeyErrors != null && validKeyErrors.size() > 0)
|
|
||||||
{
|
|
||||||
for(String error : validKeyErrors)
|
|
||||||
{
|
|
||||||
McmmoCore.getLogger().severe(error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initializes the default copy File and the user config File
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
|
||||||
private void initConfigFiles() throws IOException {
|
|
||||||
//Init our config copy
|
|
||||||
resourceConfigCopy = initDefaultConfig();
|
|
||||||
|
|
||||||
//Init the user file
|
|
||||||
resourceUserCopy = initUserConfig();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Loads the root node for the default config File and user config File
|
|
||||||
*/
|
|
||||||
private void loadConfig()
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
final ConfigurationNode defaultConfig = this.defaultCopyLoader.load();
|
|
||||||
defaultRootNode = defaultConfig;
|
|
||||||
|
|
||||||
final ConfigurationNode userConfig = this.userCopyLoader.load();
|
|
||||||
userRootNode = userConfig;
|
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initializes the YAMLConfigurationLoaders for this config
|
|
||||||
*/
|
|
||||||
private void initConfigLoaders()
|
|
||||||
{
|
|
||||||
this.defaultCopyLoader = YAMLConfigurationLoader.builder().setPath(resourceConfigCopy.toPath()).setFlowStyle(DumperOptions.FlowStyle.BLOCK).build();
|
|
||||||
this.userCopyLoader = YAMLConfigurationLoader.builder().setPath(resourceUserCopy.toPath()).setFlowStyle(DumperOptions.FlowStyle.FLOW).build();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Copies a new file from the JAR to the defaults directory and uses that new file to initialize our resourceConfigCopy
|
|
||||||
* @see ConfigurableLoader#resourceConfigCopy
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
|
||||||
private File initDefaultConfig() throws IOException {
|
|
||||||
return copyDefaultFromJar(getDefaultConfigCopyRelativePath(), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Attemps to load the config file if it exists, if it doesn't it copies a new one from within the JAR
|
|
||||||
* @return user config File
|
|
||||||
* @see ConfigurableLoader#resourceUserCopy
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
|
||||||
private File initUserConfig() throws IOException {
|
|
||||||
File userCopy = new File(DIRECTORY_DATA_FOLDER, FILE_RELATIVE_PATH); //Load the user file;
|
|
||||||
|
|
||||||
if(userCopy.exists())
|
|
||||||
{
|
|
||||||
// Yay
|
|
||||||
return userCopy;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//If it's gone we copy default files
|
|
||||||
//Note that we don't copy the values from the default copy put in /defaults/ that file exists only as a reference to admins and is unreliable
|
|
||||||
return copyDefaultFromJar(FILE_RELATIVE_PATH, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to make a new config file at a specified relative output path inside the data directory by copying the matching file found in that same relative path within the JAR
|
|
||||||
* @param relativeOutputPath the path to the output file
|
|
||||||
* @param deleteOld whether or not to delete the existing output file on disk
|
|
||||||
* @return a copy of the default config within the JAR
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
|
||||||
private File copyDefaultFromJar(String relativeOutputPath, boolean deleteOld) throws IOException
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* Gen a Default config from inside the JAR
|
|
||||||
*/
|
|
||||||
McmmoCore.getLogger().info("Preparing to copy internal resource file (in JAR) - "+FILE_RELATIVE_PATH);
|
|
||||||
InputStream inputStream = McmmoCore.getResource(FILE_RELATIVE_PATH);
|
|
||||||
|
|
||||||
byte[] buffer = new byte[inputStream.available()];
|
|
||||||
inputStream.read(buffer);
|
|
||||||
|
|
||||||
//This is a copy of the default file, which we will overwrite every time mcMMO loads
|
|
||||||
File targetFile = new File(DIRECTORY_DATA_FOLDER, relativeOutputPath);
|
|
||||||
|
|
||||||
//Wipe old default file on disk
|
|
||||||
if (targetFile.exists() && deleteOld)
|
|
||||||
{
|
|
||||||
McmmoCore.getLogger().info("Updating file " + relativeOutputPath);
|
|
||||||
targetFile.delete(); //Necessary?
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!targetFile.exists())
|
|
||||||
{
|
|
||||||
targetFile.getParentFile().mkdirs();
|
|
||||||
targetFile.createNewFile(); //New File Boys
|
|
||||||
}
|
|
||||||
|
|
||||||
Files.write(buffer, targetFile);
|
|
||||||
McmmoCore.getLogger().info("Created config file - " + relativeOutputPath);
|
|
||||||
|
|
||||||
inputStream.close(); //Close the input stream
|
|
||||||
|
|
||||||
return targetFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The path to the defaults directory
|
|
||||||
* @return the path to the defaults directory
|
|
||||||
*/
|
|
||||||
private String getDefaultConfigCopyRelativePath() {
|
|
||||||
return DIRECTORY_DEFAULTS + File.separator + FILE_RELATIVE_PATH;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates the defaults directory
|
|
||||||
*/
|
|
||||||
private void mkdirDefaults() {
|
|
||||||
//Make Default Subdirectory
|
|
||||||
File defaultsDir = new File (DIRECTORY_DATA_FOLDER, "defaults");
|
|
||||||
|
|
||||||
if(!defaultsDir.exists())
|
|
||||||
defaultsDir.mkdir();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Configs are versioned based on when they had significant changes to keys
|
|
||||||
* @return current Config Version String
|
|
||||||
*/
|
|
||||||
public String getVersion()
|
|
||||||
{
|
|
||||||
return String.valueOf(getConfigVersion());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Attempts to read the loaded config file
|
|
||||||
* Config will have any necessary updates applied
|
|
||||||
* Config will be compared to the default config to see if it is missing any nodes
|
|
||||||
* Config will have any missing nodes inserted with their default value
|
|
||||||
*/
|
|
||||||
public void readConfig() {
|
|
||||||
McmmoCore.getLogger().info("Attempting to read " + FILE_RELATIVE_PATH + ".");
|
|
||||||
|
|
||||||
int version = this.userRootNode.getNode("ConfigVersion").getInt();
|
|
||||||
McmmoCore.getLogger().info(FILE_RELATIVE_PATH + " version is " + version);
|
|
||||||
|
|
||||||
//Update our config
|
|
||||||
updateConfig();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Compares the users config file to the default and adds any missing nodes and applies any necessary updates
|
|
||||||
*/
|
|
||||||
private void updateConfig()
|
|
||||||
{
|
|
||||||
McmmoCore.getLogger().info(defaultRootNode.getChildrenMap().size() +" items in default children map");
|
|
||||||
McmmoCore.getLogger().info(userRootNode.getChildrenMap().size() +" items in default root map");
|
|
||||||
|
|
||||||
// Merge Values from default
|
|
||||||
userRootNode = userRootNode.mergeValuesFrom(defaultRootNode);
|
|
||||||
|
|
||||||
// Update config version
|
|
||||||
updateConfigVersion();
|
|
||||||
|
|
||||||
//Attempt to save
|
|
||||||
try {
|
|
||||||
saveUserCopy();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Saves the current state information of the config to the users copy (which they may edit)
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
|
||||||
private void saveUserCopy() throws IOException
|
|
||||||
{
|
|
||||||
McmmoCore.getLogger().info("Saving new node");
|
|
||||||
userCopyLoader.save(userRootNode);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Performs any necessary operations to update this config
|
|
||||||
*/
|
|
||||||
private void updateConfigVersion() {
|
|
||||||
// Set a version for our config
|
|
||||||
this.userRootNode.getNode("ConfigVersion").setValue(getConfigVersion());
|
|
||||||
McmmoCore.getLogger().info("Updated config to ["+getConfigVersion()+"] - " + FILE_RELATIVE_PATH);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the root node of this config
|
|
||||||
* @return the root node of this config
|
|
||||||
*/
|
|
||||||
protected ConfigurationNode getUserRootNode() {
|
|
||||||
return userRootNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
int getIntValue(String... path)
|
|
||||||
{
|
|
||||||
return userRootNode.getNode(path).getInt();
|
|
||||||
}
|
|
||||||
|
|
||||||
double getDoubleValue(String... path)
|
|
||||||
{
|
|
||||||
return userRootNode.getNode(path).getDouble();
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean getBooleanValue(String... path)
|
|
||||||
{
|
|
||||||
return userRootNode.getNode(path).getBoolean();
|
|
||||||
}
|
|
||||||
|
|
||||||
String getStringValue(String... path)
|
|
||||||
{
|
|
||||||
return userRootNode.getNode(path).getString();
|
|
||||||
}
|
|
||||||
}
|
|
@ -5,12 +5,11 @@ import com.gmail.nossr50.core.skills.PrimarySkillType;
|
|||||||
import com.gmail.nossr50.core.skills.subskills.AbstractSubSkill;
|
import com.gmail.nossr50.core.skills.subskills.AbstractSubSkill;
|
||||||
import com.gmail.nossr50.core.util.StringUtils;
|
import com.gmail.nossr50.core.util.StringUtils;
|
||||||
|
|
||||||
public class CoreSkillsConfig extends ConfigurableLoader {
|
public class CoreSkillsConfig extends Config {
|
||||||
private static CoreSkillsConfig instance;
|
private static CoreSkillsConfig instance;
|
||||||
|
|
||||||
public CoreSkillsConfig() {
|
public CoreSkillsConfig() {
|
||||||
super(McmmoCore.getDataFolderPath().getAbsoluteFile(),"coreskills.yml");
|
super(McmmoCore.getDataFolderPath().getAbsoluteFile(),"coreskills.yml");
|
||||||
validate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CoreSkillsConfig getInstance() {
|
public static CoreSkillsConfig getInstance() {
|
||||||
@ -20,15 +19,19 @@ public class CoreSkillsConfig extends ConfigurableLoader {
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The version of this config
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void loadKeys() {
|
public double getConfigVersion() {
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean validateKeys() {
|
public void unload() {
|
||||||
|
instance = null;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -43,7 +46,7 @@ public class CoreSkillsConfig extends ConfigurableLoader {
|
|||||||
* @return true if subskill is enabled
|
* @return true if subskill is enabled
|
||||||
*/
|
*/
|
||||||
public boolean isSkillEnabled(AbstractSubSkill abstractSubSkill) {
|
public boolean isSkillEnabled(AbstractSubSkill abstractSubSkill) {
|
||||||
return config.getBoolean(StringUtils.getCapitalized(abstractSubSkill.getPrimarySkill().toString()) + "." + abstractSubSkill.getConfigKeyName() + ".Enabled", true);
|
return getBooleanValue(StringUtils.getCapitalized(abstractSubSkill.getPrimarySkill().toString()) + "." + abstractSubSkill.getConfigKeyName() + ".Enabled", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -53,6 +56,6 @@ public class CoreSkillsConfig extends ConfigurableLoader {
|
|||||||
* @return true if enabled
|
* @return true if enabled
|
||||||
*/
|
*/
|
||||||
public boolean isPrimarySkillEnabled(PrimarySkillType primarySkillType) {
|
public boolean isPrimarySkillEnabled(PrimarySkillType primarySkillType) {
|
||||||
return config.getBoolean(StringUtils.getCapitalized(primarySkillType.toString()) + ".Enabled", true);
|
return getBooleanValue(StringUtils.getCapitalized(primarySkillType.toString()) + ".Enabled", true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
1041
core/src/main/java/com/gmail/nossr50/core/config/MainConfig.java
Normal file
1041
core/src/main/java/com/gmail/nossr50/core/config/MainConfig.java
Normal file
File diff suppressed because it is too large
Load Diff
@ -7,12 +7,11 @@ import com.gmail.nossr50.core.skills.subskills.AbstractSubSkill;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class RankConfig extends ConfigurableLoader {
|
public class RankConfig extends ConfigValidated {
|
||||||
private static RankConfig instance;
|
private static RankConfig instance;
|
||||||
|
|
||||||
public RankConfig() {
|
public RankConfig() {
|
||||||
super(McmmoCore.getDataFolderPath().getAbsoluteFile(),"skillranks.yml");
|
super(McmmoCore.getDataFolderPath().getAbsoluteFile(),"skillranks.yml");
|
||||||
validate();
|
|
||||||
this.instance = this;
|
this.instance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,12 +23,22 @@ public class RankConfig extends ConfigurableLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadKeys() {
|
public void unload() {
|
||||||
|
instance = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The version of this config
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public double getConfigVersion() {
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean validateKeys() {
|
public List<String> validateKeys() {
|
||||||
List<String> reason = new ArrayList<String>();
|
List<String> reason = new ArrayList<String>();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -37,7 +46,7 @@ public class RankConfig extends ConfigurableLoader {
|
|||||||
*/
|
*/
|
||||||
checkKeys(reason);
|
checkKeys(reason);
|
||||||
|
|
||||||
return noErrorsInConfig(reason);
|
return reason;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -74,14 +83,14 @@ public class RankConfig extends ConfigurableLoader {
|
|||||||
* @return the level requirement for a subskill at this particular rank
|
* @return the level requirement for a subskill at this particular rank
|
||||||
*/
|
*/
|
||||||
private int findRankByRootAddress(int rank, String key) {
|
private int findRankByRootAddress(int rank, String key) {
|
||||||
String scalingKey = Config.getInstance().getIsRetroMode() ? ".RetroMode." : ".Standard.";
|
String scalingKey = MainConfig.getInstance().getIsRetroMode() ? ".RetroMode." : ".Standard.";
|
||||||
|
|
||||||
String targetRank = "Rank_" + rank;
|
String targetRank = "Rank_" + rank;
|
||||||
|
|
||||||
key += scalingKey;
|
key += scalingKey;
|
||||||
key += targetRank;
|
key += targetRank;
|
||||||
|
|
||||||
return config.getInt(key);
|
return getIntValue(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.gmail.nossr50.core.config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A class that registers keys
|
||||||
|
*/
|
||||||
|
public interface RegistersKeys {
|
||||||
|
/**
|
||||||
|
* Loads up keys
|
||||||
|
*/
|
||||||
|
void loadKeys();
|
||||||
|
}
|
@ -3,12 +3,14 @@ package com.gmail.nossr50.core.config;
|
|||||||
import com.gmail.nossr50.core.McmmoCore;
|
import com.gmail.nossr50.core.McmmoCore;
|
||||||
import com.gmail.nossr50.core.util.sounds.SoundType;
|
import com.gmail.nossr50.core.util.sounds.SoundType;
|
||||||
|
|
||||||
public class SoundConfig extends ConfigurableLoader {
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class SoundConfig extends ConfigValidated {
|
||||||
private static SoundConfig instance;
|
private static SoundConfig instance;
|
||||||
|
|
||||||
public SoundConfig() {
|
public SoundConfig() {
|
||||||
super(McmmoCore.getDataFolderPath().getAbsoluteFile(), "sounds.yml");
|
super(McmmoCore.getDataFolderPath().getAbsoluteFile(), "sounds.yml");
|
||||||
validate();
|
|
||||||
this.instance = this;
|
this.instance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -20,45 +22,56 @@ public class SoundConfig extends ConfigurableLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadKeys() {
|
public void unload() {
|
||||||
|
instance = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The version of this config
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public double getConfigVersion() {
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean validateKeys() {
|
public List<String> validateKeys() {
|
||||||
|
ArrayList<String> reasons = new ArrayList<>();
|
||||||
|
|
||||||
for (SoundType soundType : SoundType.values()) {
|
for (SoundType soundType : SoundType.values()) {
|
||||||
if (config.getDouble("Sounds." + soundType.toString() + ".Volume") < 0) {
|
if (getDoubleValue("Sounds." + soundType.toString() + ".Volume") < 0) {
|
||||||
plugin.getLogger().info("[mcMMO] Sound volume cannot be below 0 for " + soundType.toString());
|
reasons.add("[mcMMO] Sound volume cannot be below 0 for " + soundType.toString());
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Sounds with custom pitching don't use pitch values
|
//Sounds with custom pitching don't use pitch values
|
||||||
if (!soundType.usesCustomPitch()) {
|
if (!soundType.usesCustomPitch()) {
|
||||||
if (config.getDouble("Sounds." + soundType.toString() + ".Pitch") < 0) {
|
if (getDoubleValue("Sounds." + soundType.toString() + ".Pitch") < 0) {
|
||||||
plugin.getLogger().info("[mcMMO] Sound pitch cannot be below 0 for " + soundType.toString());
|
reasons.add("[mcMMO] Sound pitch cannot be below 0 for " + soundType.toString());
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
|
return reasons;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getMasterVolume() {
|
public float getMasterVolume() {
|
||||||
return (float) config.getDouble("Sounds.MasterVolume", 1.0);
|
return (float) getDoubleValue("Sounds.MasterVolume", 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getVolume(SoundType soundType) {
|
public float getVolume(SoundType soundType) {
|
||||||
String key = "Sounds." + soundType.toString() + ".Volume";
|
String key = "Sounds." + soundType.toString() + ".Volume";
|
||||||
return (float) config.getDouble(key);
|
return (float) getDoubleValue(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getPitch(SoundType soundType) {
|
public float getPitch(SoundType soundType) {
|
||||||
String key = "Sounds." + soundType.toString() + ".Pitch";
|
String key = "Sounds." + soundType.toString() + ".Pitch";
|
||||||
return (float) config.getDouble(key);
|
return (float) getDoubleValue(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getIsEnabled(SoundType soundType) {
|
public boolean getIsEnabled(SoundType soundType) {
|
||||||
String key = "Sounds." + soundType.toString() + ".Enabled";
|
String key = "Sounds." + soundType.toString() + ".Enabled";
|
||||||
return config.getBoolean(key, true);
|
return getBooleanValue(key, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
package com.gmail.nossr50.core.config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unloads values, sort of like a constructor
|
||||||
|
*/
|
||||||
|
public interface Unload {
|
||||||
|
void unload();
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
package com.gmail.nossr50.core.config.experience;
|
package com.gmail.nossr50.core.config.experience;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.McmmoCore;
|
import com.gmail.nossr50.core.McmmoCore;
|
||||||
import com.gmail.nossr50.core.config.ConfigurableLoader;
|
import com.gmail.nossr50.core.config.ConfigValidated;
|
||||||
import com.gmail.nossr50.core.datatypes.experience.FormulaType;
|
import com.gmail.nossr50.core.datatypes.experience.FormulaType;
|
||||||
import com.gmail.nossr50.core.skills.MaterialType;
|
import com.gmail.nossr50.core.skills.MaterialType;
|
||||||
import com.gmail.nossr50.core.skills.PotionStage;
|
import com.gmail.nossr50.core.skills.PotionStage;
|
||||||
@ -11,12 +11,11 @@ import com.gmail.nossr50.core.util.StringUtils;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ExperienceConfig extends ConfigurableLoader {
|
public class ExperienceConfig extends ConfigValidated {
|
||||||
private static ExperienceConfig instance;
|
private static ExperienceConfig instance;
|
||||||
|
|
||||||
private ExperienceConfig() {
|
private ExperienceConfig() {
|
||||||
super(McmmoCore.getDataFolderPath().getAbsoluteFile(),"experience.yml");
|
super(McmmoCore.getDataFolderPath().getAbsoluteFile(), "experience.yml");
|
||||||
validate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ExperienceConfig getInstance() {
|
public static ExperienceConfig getInstance() {
|
||||||
@ -27,12 +26,23 @@ public class ExperienceConfig extends ConfigurableLoader {
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The version of this config
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void loadKeys() {
|
public double getConfigVersion() {
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean validateKeys() {
|
public void unload() {
|
||||||
|
instance = null; //TODO: this might be a bit problematic
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> validateKeys() {
|
||||||
List<String> reason = new ArrayList<String>();
|
List<String> reason = new ArrayList<String>();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -131,7 +141,7 @@ public class ExperienceConfig extends ConfigurableLoader {
|
|||||||
reason.add("Experience.Taming.Animal_Taming.Ocelot should be greater than 0!");
|
reason.add("Experience.Taming.Animal_Taming.Ocelot should be greater than 0!");
|
||||||
}
|
}
|
||||||
|
|
||||||
return noErrorsInConfig(reason);
|
return reason;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -140,34 +150,34 @@ public class ExperienceConfig extends ConfigurableLoader {
|
|||||||
|
|
||||||
/* EXPLOIT TOGGLES */
|
/* EXPLOIT TOGGLES */
|
||||||
public boolean isEndermanEndermiteFarmingPrevented() {
|
public boolean isEndermanEndermiteFarmingPrevented() {
|
||||||
return config.getBoolean("ExploitFix.EndermanEndermiteFarms", true);
|
return getBooleanValue("ExploitFix.EndermanEndermiteFarms", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Curve settings */
|
/* Curve settings */
|
||||||
public FormulaType getFormulaType() {
|
public FormulaType getFormulaType() {
|
||||||
return FormulaType.getFormulaType(config.getString("Experience_Formula.Curve"));
|
return FormulaType.getFormulaType(getStringValue("Experience_Formula.Curve"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getCumulativeCurveEnabled() {
|
public boolean getCumulativeCurveEnabled() {
|
||||||
return config.getBoolean("Experience_Formula.Cumulative_Curve", false);
|
return getBooleanValue("Experience_Formula.Cumulative_Curve", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Curve values */
|
/* Curve values */
|
||||||
public double getMultiplier(FormulaType type) {
|
public double getMultiplier(FormulaType type) {
|
||||||
return config.getDouble("Experience_Formula." + StringUtils.getCapitalized(type.toString()) + "_Values.multiplier");
|
return getDoubleValue("Experience_Formula." + StringUtils.getCapitalized(type.toString()) + "_Values.multiplier");
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getBase(FormulaType type) {
|
public int getBase(FormulaType type) {
|
||||||
return config.getInt("Experience_Formula." + StringUtils.getCapitalized(type.toString()) + "_Values.base");
|
return getIntValue("Experience_Formula." + StringUtils.getCapitalized(type.toString()) + "_Values.base");
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getExponent(FormulaType type) {
|
public double getExponent(FormulaType type) {
|
||||||
return config.getDouble("Experience_Formula." + StringUtils.getCapitalized(type.toString()) + "_Values.exponent");
|
return getDoubleValue("Experience_Formula." + StringUtils.getCapitalized(type.toString()) + "_Values.exponent");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Global modifier */
|
/* Global modifier */
|
||||||
public double getExperienceGainsGlobalMultiplier() {
|
public double getExperienceGainsGlobalMultiplier() {
|
||||||
return config.getDouble("Experience_Formula.Multiplier.Global", 1.0);
|
return getDoubleValue("Experience_Formula.Multiplier.Global", 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setExperienceGainsGlobalMultiplier(double value) {
|
public void setExperienceGainsGlobalMultiplier(double value) {
|
||||||
@ -176,48 +186,48 @@ public class ExperienceConfig extends ConfigurableLoader {
|
|||||||
|
|
||||||
/* PVP modifier */
|
/* PVP modifier */
|
||||||
public double getPlayerVersusPlayerXP() {
|
public double getPlayerVersusPlayerXP() {
|
||||||
return config.getDouble("Experience_Formula.Multiplier.PVP", 1.0);
|
return getDoubleValue("Experience_Formula.Multiplier.PVP", 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Spawned Mob modifier */
|
/* Spawned Mob modifier */
|
||||||
public double getSpawnedMobXpMultiplier() {
|
public double getSpawnedMobXpMultiplier() {
|
||||||
return config.getDouble("Experience_Formula.Mobspawners.Multiplier", 0.0);
|
return getDoubleValue("Experience_Formula.Mobspawners.Multiplier", 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getBredMobXpMultiplier() {
|
public double getBredMobXpMultiplier() {
|
||||||
return config.getDouble("Experience_Formula.Breeding.Multiplier", 1.0);
|
return getDoubleValue("Experience_Formula.Breeding.Multiplier", 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Skill modifiers */
|
/* Skill modifiers */
|
||||||
public double getFormulaSkillModifier(PrimarySkillType skill) {
|
public double getFormulaSkillModifier(PrimarySkillType skill) {
|
||||||
return config.getDouble("Experience_Formula.Modifier." + StringUtils.getCapitalized(skill.toString()));
|
return getDoubleValue("Experience_Formula.Modifier." + StringUtils.getCapitalized(skill.toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Custom XP perk */
|
/* Custom XP perk */
|
||||||
public double getCustomXpPerkBoost() {
|
public double getCustomXpPerkBoost() {
|
||||||
return config.getDouble("Experience_Formula.Custom_XP_Perk.Boost", 1.25);
|
return getDoubleValue("Experience_Formula.Custom_XP_Perk.Boost", 1.25);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Diminished Returns */
|
/* Diminished Returns */
|
||||||
public float getDiminishedReturnsCap() {
|
public float getDiminishedReturnsCap() {
|
||||||
return (float) config.getDouble("Dimished_Returns.Guaranteed_Minimum_Percentage", 0.05D);
|
return (float) getDoubleValue("Dimished_Returns.Guaranteed_Minimum_Percentage", 0.05D);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getDiminishedReturnsEnabled() {
|
public boolean getDiminishedReturnsEnabled() {
|
||||||
return config.getBoolean("Diminished_Returns.Enabled", false);
|
return getBooleanValue("Diminished_Returns.Enabled", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getDiminishedReturnsThreshold(PrimarySkillType skill) {
|
public int getDiminishedReturnsThreshold(PrimarySkillType skill) {
|
||||||
return config.getInt("Diminished_Returns.Threshold." + StringUtils.getCapitalized(skill.toString()), 20000);
|
return getIntValue("Diminished_Returns.Threshold." + StringUtils.getCapitalized(skill.toString()), 20000);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getDiminishedReturnsTimeInterval() {
|
public int getDiminishedReturnsTimeInterval() {
|
||||||
return config.getInt("Diminished_Returns.Time_Interval", 10);
|
return getIntValue("Diminished_Returns.Time_Interval", 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Conversion */
|
/* Conversion */
|
||||||
public double getExpModifier() {
|
public double getExpModifier() {
|
||||||
return config.getDouble("Conversion.Exp_Modifier", 1);
|
return getDoubleValue("Conversion.Exp_Modifier", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -226,20 +236,20 @@ public class ExperienceConfig extends ConfigurableLoader {
|
|||||||
|
|
||||||
/* General Settings */
|
/* General Settings */
|
||||||
public boolean getExperienceGainsPlayerVersusPlayerEnabled() {
|
public boolean getExperienceGainsPlayerVersusPlayerEnabled() {
|
||||||
return config.getBoolean("Experience.PVP.Rewards", true);
|
return getBooleanValue("Experience.PVP.Rewards", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Combat XP Multipliers */
|
/* Combat XP Multipliers */
|
||||||
public double getCombatXP(EntityType entity) {
|
public double getCombatXP(EntityType entity) {
|
||||||
return config.getDouble("Experience.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_"));
|
return getDoubleValue("Experience.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getAnimalsXP(EntityType entity) {
|
public double getAnimalsXP(EntityType entity) {
|
||||||
return config.getDouble("Experience.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_"), getAnimalsXP());
|
return getDoubleValue("Experience.Combat.Multiplier." + StringUtils.getPrettyEntityTypeString(entity).replace(" ", "_"), getAnimalsXP());
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getAnimalsXP() {
|
public double getAnimalsXP() {
|
||||||
return config.getDouble("Experience.Combat.Multiplier.Animals", 1.0);
|
return getDoubleValue("Experience.Combat.Multiplier.Animals", 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasCombatXP(EntityType entity) {
|
public boolean hasCombatXP(EntityType entity) {
|
||||||
@ -251,13 +261,13 @@ public class ExperienceConfig extends ConfigurableLoader {
|
|||||||
String baseString = "Experience." + StringUtils.getCapitalized(skill.toString()) + ".";
|
String baseString = "Experience." + StringUtils.getCapitalized(skill.toString()) + ".";
|
||||||
String explicitString = baseString + StringUtils.getExplicitConfigMaterialString(data);
|
String explicitString = baseString + StringUtils.getExplicitConfigMaterialString(data);
|
||||||
if (config.contains(explicitString))
|
if (config.contains(explicitString))
|
||||||
return config.getInt(explicitString);
|
return getIntValue(explicitString);
|
||||||
String friendlyString = baseString + StringUtils.getFriendlyConfigMaterialString(data);
|
String friendlyString = baseString + StringUtils.getFriendlyConfigMaterialString(data);
|
||||||
if (config.contains(friendlyString))
|
if (config.contains(friendlyString))
|
||||||
return config.getInt(friendlyString);
|
return getIntValue(friendlyString);
|
||||||
String wildcardString = baseString + StringUtils.getWildcardConfigMaterialString(data);
|
String wildcardString = baseString + StringUtils.getWildcardConfigMaterialString(data);
|
||||||
if (config.contains(wildcardString))
|
if (config.contains(wildcardString))
|
||||||
return config.getInt(wildcardString);
|
return getIntValue(wildcardString);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,13 +276,13 @@ public class ExperienceConfig extends ConfigurableLoader {
|
|||||||
String baseString = "Experience." + StringUtils.getCapitalized(skill.toString()) + ".";
|
String baseString = "Experience." + StringUtils.getCapitalized(skill.toString()) + ".";
|
||||||
String explicitString = baseString + StringUtils.getExplicitConfigBlockDataString(data);
|
String explicitString = baseString + StringUtils.getExplicitConfigBlockDataString(data);
|
||||||
if (config.contains(explicitString))
|
if (config.contains(explicitString))
|
||||||
return config.getInt(explicitString);
|
return getIntValue(explicitString);
|
||||||
String friendlyString = baseString + StringUtils.getFriendlyConfigBlockDataString(data);
|
String friendlyString = baseString + StringUtils.getFriendlyConfigBlockDataString(data);
|
||||||
if (config.contains(friendlyString))
|
if (config.contains(friendlyString))
|
||||||
return config.getInt(friendlyString);
|
return getIntValue(friendlyString);
|
||||||
String wildcardString = baseString + StringUtils.getWildcardConfigBlockDataString(data);
|
String wildcardString = baseString + StringUtils.getWildcardConfigBlockDataString(data);
|
||||||
if (config.contains(wildcardString))
|
if (config.contains(wildcardString))
|
||||||
return config.getInt(wildcardString);
|
return getIntValue(wildcardString);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -305,31 +315,31 @@ public class ExperienceConfig extends ConfigurableLoader {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public boolean isPartyExperienceBarsEnabled() {
|
public boolean isPartyExperienceBarsEnabled() {
|
||||||
return config.getBoolean("Experience_Bars.Update.Party", true);
|
return getBooleanValue("Experience_Bars.Update.Party", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPassiveGainsExperienceBarsEnabled() {
|
public boolean isPassiveGainsExperienceBarsEnabled() {
|
||||||
return config.getBoolean("Experience_Bars.Update.Passive", true);
|
return getBooleanValue("Experience_Bars.Update.Passive", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getDoExperienceBarsAlwaysUpdateTitle() {
|
public boolean getDoExperienceBarsAlwaysUpdateTitle() {
|
||||||
return config.getBoolean("Experience_Bars.ThisMayCauseLag.AlwaysUpdateTitlesWhenXPIsGained.Enable", false) || getAddExtraDetails();
|
return getBooleanValue("Experience_Bars.ThisMayCauseLag.AlwaysUpdateTitlesWhenXPIsGained.Enable", false) || getAddExtraDetails();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getAddExtraDetails() {
|
public boolean getAddExtraDetails() {
|
||||||
return config.getBoolean("Experience_Bars.ThisMayCauseLag.AlwaysUpdateTitlesWhenXPIsGained.ExtraDetails", false);
|
return getBooleanValue("Experience_Bars.ThisMayCauseLag.AlwaysUpdateTitlesWhenXPIsGained.ExtraDetails", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isExperienceBarsEnabled() {
|
public boolean isExperienceBarsEnabled() {
|
||||||
return config.getBoolean("Experience_Bars.Enable", true);
|
return getBooleanValue("Experience_Bars.Enable", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isExperienceBarEnabled(PrimarySkillType primarySkillType) {
|
public boolean isExperienceBarEnabled(PrimarySkillType primarySkillType) {
|
||||||
return config.getBoolean("Experience_Bars." + StringUtils.getCapitalized(primarySkillType.toString()) + ".Enable", true);
|
return getBooleanValue("Experience_Bars." + StringUtils.getCapitalized(primarySkillType.toString()) + ".Enable", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BarColor getExperienceBarColor(PrimarySkillType primarySkillType) {
|
public BarColor getExperienceBarColor(PrimarySkillType primarySkillType) {
|
||||||
String colorValueFromConfig = config.getString("Experience_Bars." + StringUtils.getCapitalized(primarySkillType.toString()) + ".Color");
|
String colorValueFromConfig = getStringValue("Experience_Bars." + StringUtils.getCapitalized(primarySkillType.toString()) + ".Color");
|
||||||
|
|
||||||
for (BarColor barColor : BarColor.values()) {
|
for (BarColor barColor : BarColor.values()) {
|
||||||
if (barColor.toString().equalsIgnoreCase(colorValueFromConfig))
|
if (barColor.toString().equalsIgnoreCase(colorValueFromConfig))
|
||||||
@ -341,7 +351,7 @@ public class ExperienceConfig extends ConfigurableLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public BarStyle getExperienceBarStyle(PrimarySkillType primarySkillType) {
|
public BarStyle getExperienceBarStyle(PrimarySkillType primarySkillType) {
|
||||||
String colorValueFromConfig = config.getString("Experience_Bars." + StringUtils.getCapitalized(primarySkillType.toString()) + ".BarStyle");
|
String colorValueFromConfig = getStringValue("Experience_Bars." + StringUtils.getCapitalized(primarySkillType.toString()) + ".BarStyle");
|
||||||
|
|
||||||
for (BarStyle barStyle : BarStyle.values()) {
|
for (BarStyle barStyle : BarStyle.values()) {
|
||||||
if (barStyle.toString().equalsIgnoreCase(colorValueFromConfig))
|
if (barStyle.toString().equalsIgnoreCase(colorValueFromConfig))
|
||||||
@ -354,46 +364,46 @@ public class ExperienceConfig extends ConfigurableLoader {
|
|||||||
|
|
||||||
/* Acrobatics */
|
/* Acrobatics */
|
||||||
public int getDodgeXPModifier() {
|
public int getDodgeXPModifier() {
|
||||||
return config.getInt("Experience.Acrobatics.Dodge", 120);
|
return getIntValue("Experience.Acrobatics.Dodge", 120);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRollXPModifier() {
|
public int getRollXPModifier() {
|
||||||
return config.getInt("Experience.Acrobatics.Roll", 80);
|
return getIntValue("Experience.Acrobatics.Roll", 80);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFallXPModifier() {
|
public int getFallXPModifier() {
|
||||||
return config.getInt("Experience.Acrobatics.Fall", 120);
|
return getIntValue("Experience.Acrobatics.Fall", 120);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getFeatherFallXPModifier() {
|
public double getFeatherFallXPModifier() {
|
||||||
return config.getDouble("Experience.Acrobatics.FeatherFall_Multiplier", 2.0);
|
return getDoubleValue("Experience.Acrobatics.FeatherFall_Multiplier", 2.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Alchemy */
|
/* Alchemy */
|
||||||
public double getPotionXP(PotionStage stage) {
|
public double getPotionXP(PotionStage stage) {
|
||||||
return config.getDouble("Experience.Alchemy.Potion_Stage_" + stage.toNumerical(), 10D);
|
return getDoubleValue("Experience.Alchemy.Potion_Stage_" + stage.toNumerical(), 10D);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Archery */
|
/* Archery */
|
||||||
public double getArcheryDistanceMultiplier() {
|
public double getArcheryDistanceMultiplier() {
|
||||||
return config.getDouble("Experience.Archery.Distance_Multiplier", 0.025);
|
return getDoubleValue("Experience.Archery.Distance_Multiplier", 0.025);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFishingShakeXP() {
|
public int getFishingShakeXP() {
|
||||||
return config.getInt("Experience.Fishing.Shake", 50);
|
return getIntValue("Experience.Fishing.Shake", 50);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Repair */
|
/* Repair */
|
||||||
public double getRepairXPBase() {
|
public double getRepairXPBase() {
|
||||||
return config.getDouble("Experience.Repair.Base", 1000.0);
|
return getDoubleValue("Experience.Repair.Base", 1000.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getRepairXP(MaterialType repairMaterialType) {
|
public double getRepairXP(MaterialType repairMaterialType) {
|
||||||
return config.getDouble("Experience.Repair." + StringUtils.getCapitalized(repairMaterialType.toString()));
|
return getDoubleValue("Experience.Repair." + StringUtils.getCapitalized(repairMaterialType.toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Taming */
|
/* Taming */
|
||||||
public int getTamingXP(EntityType type) {
|
public int getTamingXP(EntityType type) {
|
||||||
return config.getInt("Experience.Taming.Animal_Taming." + StringUtils.getPrettyEntityTypeString(type));
|
return getIntValue("Experience.Taming.Animal_Taming." + StringUtils.getPrettyEntityTypeString(type));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
package com.gmail.nossr50.core.config.mods;
|
package com.gmail.nossr50.core.config.mods;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.core.McmmoCore;
|
||||||
import com.gmail.nossr50.core.util.ModManager;
|
import com.gmail.nossr50.core.util.ModManager;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class ArmorConfigManager {
|
public class ArmorConfigManager {
|
||||||
public ArmorConfigManager(mcMMO plugin) {
|
public ArmorConfigManager() {
|
||||||
Pattern middlePattern = Pattern.compile("armor\\.(?:.+)\\.yml");
|
Pattern middlePattern = Pattern.compile("armor\\.(?:.+)\\.yml");
|
||||||
Pattern startPattern = Pattern.compile("(?:.+)\\.armor\\.yml");
|
Pattern startPattern = Pattern.compile("(?:.+)\\.armor\\.yml");
|
||||||
File dataFolder = new File(mcMMO.getModDirectory());
|
File dataFolder = new File(McmmoCore.getModDataFolderPath());
|
||||||
File vanilla = new File(dataFolder, "armor.default.yml");
|
File vanilla = new File(dataFolder, "armor.default.yml");
|
||||||
ModManager modManager = mcMMO.getModManager();
|
ModManager modManager = mcMMO.getModManager();
|
||||||
|
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
package com.gmail.nossr50.core.config.mods;
|
package com.gmail.nossr50.core.config.mods;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.core.McmmoCore;
|
||||||
import com.gmail.nossr50.util.ModManager;
|
import com.gmail.nossr50.core.util.ModManager;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class BlockConfigManager {
|
public class BlockConfigManager {
|
||||||
public BlockConfigManager(mcMMO plugin) {
|
public BlockConfigManager() {
|
||||||
Pattern middlePattern = Pattern.compile("blocks\\.(?:.+)\\.yml");
|
Pattern middlePattern = Pattern.compile("blocks\\.(?:.+)\\.yml");
|
||||||
Pattern startPattern = Pattern.compile("(?:.+)\\.blocks\\.yml");
|
Pattern startPattern = Pattern.compile("(?:.+)\\.blocks\\.yml");
|
||||||
File dataFolder = new File(mcMMO.getModDirectory());
|
File dataFolder = new File(McmmoCore.getModDataFolderPath());
|
||||||
File vanilla = new File(dataFolder, "blocks.default.yml");
|
File vanilla = new File(dataFolder, "blocks.default.yml");
|
||||||
ModManager modManager = mcMMO.getModManager();
|
ModManager modManager = McmmoCore.getModManager();
|
||||||
|
|
||||||
if (!vanilla.exists()) {
|
if (!vanilla.exists()) {
|
||||||
plugin.saveResource(vanilla.getParentFile().getName() + File.separator + "blocks.default.yml", false);
|
plugin.saveResource(vanilla.getParentFile().getName() + File.separator + "blocks.default.yml", false);
|
||||||
|
@ -1,22 +1,19 @@
|
|||||||
package com.gmail.nossr50.core.config.mods;
|
package com.gmail.nossr50.core.config.mods;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.McmmoCore;
|
import com.gmail.nossr50.core.McmmoCore;
|
||||||
import com.gmail.nossr50.core.config.ConfigLoader;
|
import com.gmail.nossr50.core.config.ConfigKeyRegister;
|
||||||
import com.gmail.nossr50.core.config.ConfigurableLoader;
|
import com.gmail.nossr50.core.mcmmo.item.ItemStack;
|
||||||
import com.gmail.nossr50.core.mcmmo.skills.ItemType;
|
import com.gmail.nossr50.core.skills.ItemType;
|
||||||
import com.gmail.nossr50.core.mcmmo.skills.MaterialType;
|
import com.gmail.nossr50.core.skills.MaterialType;
|
||||||
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
import com.gmail.nossr50.core.skills.primary.repair.repairables.Repairable;
|
||||||
import com.gmail.nossr50.skills.repair.repairables.RepairableFactory;
|
import com.gmail.nossr50.core.skills.primary.repair.repairables.RepairableFactory;
|
||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
import com.gmail.nossr50.core.util.skills.SkillUtils;
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class CustomArmorConfig extends ConfigurableLoader {
|
public class CustomArmorConfig extends ConfigKeyRegister {
|
||||||
public List<Material> customBoots = new ArrayList<Material>();
|
public List<Material> customBoots = new ArrayList<Material>();
|
||||||
public List<Material> customChestplates = new ArrayList<Material>();
|
public List<Material> customChestplates = new ArrayList<Material>();
|
||||||
public List<Material> customHelmets = new ArrayList<Material>();
|
public List<Material> customHelmets = new ArrayList<Material>();
|
||||||
@ -29,8 +26,18 @@ public class CustomArmorConfig extends ConfigurableLoader {
|
|||||||
loadKeys();
|
loadKeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The version of this config
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void loadKeys() {
|
public double getConfigVersion() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void loadKeys() {
|
||||||
loadArmor("Boots", customBoots);
|
loadArmor("Boots", customBoots);
|
||||||
loadArmor("Chestplates", customChestplates);
|
loadArmor("Chestplates", customChestplates);
|
||||||
loadArmor("Helmets", customHelmets);
|
loadArmor("Helmets", customHelmets);
|
||||||
@ -68,8 +75,8 @@ public class CustomArmorConfig extends ConfigurableLoader {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean repairable = config.getBoolean(armorType + "." + armorName + ".Repairable");
|
boolean repairable = getBooleanValue(armorType + "." + armorName + ".Repairable");
|
||||||
Material repairMaterial = Material.matchMaterial(config.getString(armorType + "." + armorName + ".Repair_Material", ""));
|
Material repairMaterial = Material.matchMaterial(getStringValue(armorType + "." + armorName + ".Repair_Material", ""));
|
||||||
|
|
||||||
if (repairable && (repairMaterial == null)) {
|
if (repairable && (repairMaterial == null)) {
|
||||||
plugin.getLogger().warning("Incomplete repair information. This item will be unrepairable. - " + armorName);
|
plugin.getLogger().warning("Incomplete repair information. This item will be unrepairable. - " + armorName);
|
||||||
@ -77,21 +84,21 @@ public class CustomArmorConfig extends ConfigurableLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (repairable) {
|
if (repairable) {
|
||||||
byte repairData = (byte) config.getInt(armorType + "." + armorName + ".Repair_Material_Data_Value", -1);
|
byte repairData = (byte) getIntValue(armorType + "." + armorName + ".Repair_Material_Data_Value", -1);
|
||||||
int repairQuantity = SkillUtils.getRepairAndSalvageQuantities(new ItemStack(armorMaterial), repairMaterial, repairData);
|
int repairQuantity = SkillUtils.getRepairAndSalvageQuantities(new ItemStack(armorMaterial), repairMaterial, repairData);
|
||||||
|
|
||||||
if (repairQuantity == 0) {
|
if (repairQuantity == 0) {
|
||||||
repairQuantity = config.getInt(armorType + "." + armorName + ".Repair_Material_Quantity", 2);
|
repairQuantity = getIntValue(armorType + "." + armorName + ".Repair_Material_Quantity", 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
String repairItemName = config.getString(armorType + "." + armorName + ".Repair_Material_Pretty_Name");
|
String repairItemName = getStringValue(armorType + "." + armorName + ".Repair_Material_Pretty_Name");
|
||||||
int repairMinimumLevel = config.getInt(armorType + "." + armorName + ".Repair_MinimumLevel", 0);
|
int repairMinimumLevel = getIntValue(armorType + "." + armorName + ".Repair_MinimumLevel", 0);
|
||||||
double repairXpMultiplier = config.getDouble(armorType + "." + armorName + ".Repair_XpMultiplier", 1);
|
double repairXpMultiplier = getDoubleValue(armorType + "." + armorName + ".Repair_XpMultiplier", 1);
|
||||||
|
|
||||||
short durability = armorMaterial.getMaxDurability();
|
short durability = armorMaterial.getMaxDurability();
|
||||||
|
|
||||||
if (durability == 0) {
|
if (durability == 0) {
|
||||||
durability = (short) config.getInt(armorType + "." + armorName + ".Durability", 70);
|
durability = (short) getIntValue(armorType + "." + armorName + ".Durability", 70);
|
||||||
}
|
}
|
||||||
|
|
||||||
repairables.add(RepairableFactory.getRepairable(armorMaterial, repairMaterial, repairData, repairItemName, repairMinimumLevel, repairQuantity, durability, ItemType.ARMOR, MaterialType.OTHER, repairXpMultiplier));
|
repairables.add(RepairableFactory.getRepairable(armorMaterial, repairMaterial, repairData, repairItemName, repairMinimumLevel, repairQuantity, durability, ItemType.ARMOR, MaterialType.OTHER, repairXpMultiplier));
|
||||||
|
@ -2,7 +2,7 @@ package com.gmail.nossr50.core.config.mods;
|
|||||||
|
|
||||||
import com.gmail.nossr50.core.McmmoCore;
|
import com.gmail.nossr50.core.McmmoCore;
|
||||||
import com.gmail.nossr50.core.config.ConfigLoader;
|
import com.gmail.nossr50.core.config.ConfigLoader;
|
||||||
import com.gmail.nossr50.core.config.ConfigurableLoader;
|
import com.gmail.nossr50.core.config.ConfigKeyRegister;
|
||||||
import com.gmail.nossr50.core.mcmmo.mods.CustomBlock;
|
import com.gmail.nossr50.core.mcmmo.mods.CustomBlock;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
@ -12,7 +12,7 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class CustomBlockConfig extends ConfigurableLoader {
|
public class CustomBlockConfig extends ConfigKeyRegister {
|
||||||
public List<Material> customExcavationBlocks = new ArrayList<>();
|
public List<Material> customExcavationBlocks = new ArrayList<>();
|
||||||
public List<Material> customHerbalismBlocks = new ArrayList<>();
|
public List<Material> customHerbalismBlocks = new ArrayList<>();
|
||||||
public List<Material> customMiningBlocks = new ArrayList<>();
|
public List<Material> customMiningBlocks = new ArrayList<>();
|
||||||
@ -78,14 +78,14 @@ public class CustomBlockConfig extends ConfigurableLoader {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
int xp = config.getInt(skillType + "." + blockName + ".XP_Gain");
|
int xp = getIntValue(skillType + "." + blockName + ".XP_Gain");
|
||||||
int smeltingXp = 0;
|
int smeltingXp = 0;
|
||||||
|
|
||||||
if (skillType.equals("Mining") && config.getBoolean(skillType + "." + blockName + ".Is_Ore")) {
|
if (skillType.equals("Mining") && getBooleanValue(skillType + "." + blockName + ".Is_Ore")) {
|
||||||
customOres.add(blockMaterial);
|
customOres.add(blockMaterial);
|
||||||
smeltingXp = config.getInt(skillType + "." + blockName + ".Smelting_XP_Gain", xp / 10);
|
smeltingXp = getIntValue(skillType + "." + blockName + ".Smelting_XP_Gain", xp / 10);
|
||||||
} else if (skillType.equals("Woodcutting")) {
|
} else if (skillType.equals("Woodcutting")) {
|
||||||
if (config.getBoolean(skillType + "." + blockName + ".Is_Log")) {
|
if (getBooleanValue(skillType + "." + blockName + ".Is_Log")) {
|
||||||
customLogs.add(blockMaterial);
|
customLogs.add(blockMaterial);
|
||||||
} else {
|
} else {
|
||||||
customLeaves.add(blockMaterial);
|
customLeaves.add(blockMaterial);
|
||||||
@ -93,7 +93,7 @@ public class CustomBlockConfig extends ConfigurableLoader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
customBlockMap.put(blockMaterial, new CustomBlock(xp, config.getBoolean(skillType + "." + blockName + ".Double_Drops_Enabled"), smeltingXp));
|
customBlockMap.put(blockMaterial, new CustomBlock(xp, getBooleanValue(skillType + "." + blockName + ".Double_Drops_Enabled"), smeltingXp));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.gmail.nossr50.core.config.mods;
|
|||||||
|
|
||||||
import com.gmail.nossr50.core.McmmoCore;
|
import com.gmail.nossr50.core.McmmoCore;
|
||||||
import com.gmail.nossr50.core.config.ConfigLoader;
|
import com.gmail.nossr50.core.config.ConfigLoader;
|
||||||
import com.gmail.nossr50.core.config.ConfigurableLoader;
|
import com.gmail.nossr50.core.config.Config;
|
||||||
import com.gmail.nossr50.core.mcmmo.mods.CustomEntity;
|
import com.gmail.nossr50.core.mcmmo.mods.CustomEntity;
|
||||||
import org.apache.commons.lang.ClassUtils;
|
import org.apache.commons.lang.ClassUtils;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -10,7 +10,7 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class CustomEntityConfig extends ConfigurableLoader {
|
public class CustomEntityConfig extends Config {
|
||||||
public HashMap<String, CustomEntity> customEntityClassMap = new HashMap<String, CustomEntity>();
|
public HashMap<String, CustomEntity> customEntityClassMap = new HashMap<String, CustomEntity>();
|
||||||
public HashMap<String, CustomEntity> customEntityTypeMap = new HashMap<String, CustomEntity>();
|
public HashMap<String, CustomEntity> customEntityTypeMap = new HashMap<String, CustomEntity>();
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ public class CustomEntityConfig extends ConfigurableLoader {
|
|||||||
|
|
||||||
for (String entityName : config.getKeys(false)) {
|
for (String entityName : config.getKeys(false)) {
|
||||||
Class<?> clazz = null;
|
Class<?> clazz = null;
|
||||||
String className = config.getString(entityName + ".Class", "");
|
String className = getStringValue(entityName + ".Class", "");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
clazz = ClassUtils.getClass(className);
|
clazz = ClassUtils.getClass(className);
|
||||||
@ -38,15 +38,15 @@ public class CustomEntityConfig extends ConfigurableLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String entityTypeName = entityName.replace("_", ".");
|
String entityTypeName = entityName.replace("_", ".");
|
||||||
double xpMultiplier = config.getDouble(entityName + ".XP_Multiplier", 1.0D);
|
double xpMultiplier = getDoubleValue(entityName + ".XP_Multiplier", 1.0D);
|
||||||
|
|
||||||
boolean canBeTamed = config.getBoolean(entityName + ".Tameable");
|
boolean canBeTamed = getBooleanValue(entityName + ".Tameable");
|
||||||
int tamingXp = config.getInt(entityName + ".Taming_XP");
|
int tamingXp = getIntValue(entityName + ".Taming_XP");
|
||||||
|
|
||||||
boolean canBeSummoned = config.getBoolean(entityName + ".CanBeSummoned");
|
boolean canBeSummoned = getBooleanValue(entityName + ".CanBeSummoned");
|
||||||
Material callOfTheWildMaterial = Material.matchMaterial(config.getString(entityName + ".COTW_Material", ""));
|
Material callOfTheWildMaterial = Material.matchMaterial(getStringValue(entityName + ".COTW_Material", ""));
|
||||||
byte callOfTheWildData = (byte) config.getInt(entityName + ".COTW_Material_Data");
|
byte callOfTheWildData = (byte) getIntValue(entityName + ".COTW_Material_Data");
|
||||||
int callOfTheWildAmount = config.getInt(entityName + ".COTW_Material_Amount");
|
int callOfTheWildAmount = getIntValue(entityName + ".COTW_Material_Amount");
|
||||||
|
|
||||||
if (canBeSummoned && (callOfTheWildMaterial == null || callOfTheWildAmount == 0)) {
|
if (canBeSummoned && (callOfTheWildMaterial == null || callOfTheWildAmount == 0)) {
|
||||||
plugin.getLogger().warning("Incomplete Call of the Wild information. This entity will not be able to be summoned by Call of the Wild.");
|
plugin.getLogger().warning("Incomplete Call of the Wild information. This entity will not be able to be summoned by Call of the Wild.");
|
||||||
|
@ -2,7 +2,7 @@ package com.gmail.nossr50.core.config.mods;
|
|||||||
|
|
||||||
import com.gmail.nossr50.core.McmmoCore;
|
import com.gmail.nossr50.core.McmmoCore;
|
||||||
import com.gmail.nossr50.core.config.ConfigLoader;
|
import com.gmail.nossr50.core.config.ConfigLoader;
|
||||||
import com.gmail.nossr50.core.config.ConfigurableLoader;
|
import com.gmail.nossr50.core.config.Config;
|
||||||
import com.gmail.nossr50.core.mcmmo.mods.CustomTool;
|
import com.gmail.nossr50.core.mcmmo.mods.CustomTool;
|
||||||
import com.gmail.nossr50.core.mcmmo.skills.ItemType;
|
import com.gmail.nossr50.core.mcmmo.skills.ItemType;
|
||||||
import com.gmail.nossr50.core.mcmmo.skills.MaterialType;
|
import com.gmail.nossr50.core.mcmmo.skills.MaterialType;
|
||||||
@ -18,7 +18,7 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class CustomToolConfig extends ConfigurableLoader {
|
public class CustomToolConfig extends Config {
|
||||||
public List<Material> customAxes = new ArrayList<Material>();
|
public List<Material> customAxes = new ArrayList<Material>();
|
||||||
public List<Material> customBows = new ArrayList<Material>();
|
public List<Material> customBows = new ArrayList<Material>();
|
||||||
public List<Material> customHoes = new ArrayList<Material>();
|
public List<Material> customHoes = new ArrayList<Material>();
|
||||||
@ -75,8 +75,8 @@ public class CustomToolConfig extends ConfigurableLoader {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean repairable = config.getBoolean(toolType + "." + toolName + ".Repairable");
|
boolean repairable = getBooleanValue(toolType + "." + toolName + ".Repairable");
|
||||||
Material repairMaterial = Material.matchMaterial(config.getString(toolType + "." + toolName + ".Repair_Material", ""));
|
Material repairMaterial = Material.matchMaterial(getStringValue(toolType + "." + toolName + ".Repair_Material", ""));
|
||||||
|
|
||||||
if (repairable && (repairMaterial == null)) {
|
if (repairable && (repairMaterial == null)) {
|
||||||
plugin.getLogger().warning("Incomplete repair information. This item will be unrepairable. - " + toolName);
|
plugin.getLogger().warning("Incomplete repair information. This item will be unrepairable. - " + toolName);
|
||||||
@ -84,29 +84,29 @@ public class CustomToolConfig extends ConfigurableLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (repairable) {
|
if (repairable) {
|
||||||
byte repairData = (byte) config.getInt(toolType + "." + toolName + ".Repair_Material_Data_Value", -1);
|
byte repairData = (byte) getIntValue(toolType + "." + toolName + ".Repair_Material_Data_Value", -1);
|
||||||
int repairQuantity = SkillUtils.getRepairAndSalvageQuantities(new ItemStack(toolMaterial), repairMaterial, repairData);
|
int repairQuantity = SkillUtils.getRepairAndSalvageQuantities(new ItemStack(toolMaterial), repairMaterial, repairData);
|
||||||
|
|
||||||
if (repairQuantity == 0) {
|
if (repairQuantity == 0) {
|
||||||
repairQuantity = config.getInt(toolType + "." + toolName + ".Repair_Material_Quantity", 2);
|
repairQuantity = getIntValue(toolType + "." + toolName + ".Repair_Material_Quantity", 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
String repairItemName = config.getString(toolType + "." + toolName + ".Repair_Material_Pretty_Name");
|
String repairItemName = getStringValue(toolType + "." + toolName + ".Repair_Material_Pretty_Name");
|
||||||
int repairMinimumLevel = config.getInt(toolType + "." + toolName + ".Repair_MinimumLevel", 0);
|
int repairMinimumLevel = getIntValue(toolType + "." + toolName + ".Repair_MinimumLevel", 0);
|
||||||
double repairXpMultiplier = config.getDouble(toolType + "." + toolName + ".Repair_XpMultiplier", 1);
|
double repairXpMultiplier = getDoubleValue(toolType + "." + toolName + ".Repair_XpMultiplier", 1);
|
||||||
|
|
||||||
short durability = toolMaterial.getMaxDurability();
|
short durability = toolMaterial.getMaxDurability();
|
||||||
|
|
||||||
if (durability == 0) {
|
if (durability == 0) {
|
||||||
durability = (short) config.getInt(toolType + "." + toolName + ".Durability", 60);
|
durability = (short) getIntValue(toolType + "." + toolName + ".Durability", 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
repairables.add(RepairableFactory.getRepairable(toolMaterial, repairMaterial, repairData, repairItemName, repairMinimumLevel, repairQuantity, durability, ItemType.TOOL, MaterialType.OTHER, repairXpMultiplier));
|
repairables.add(RepairableFactory.getRepairable(toolMaterial, repairMaterial, repairData, repairItemName, repairMinimumLevel, repairQuantity, durability, ItemType.TOOL, MaterialType.OTHER, repairXpMultiplier));
|
||||||
}
|
}
|
||||||
|
|
||||||
double multiplier = config.getDouble(toolType + "." + toolName + ".XP_Modifier", 1.0);
|
double multiplier = getDoubleValue(toolType + "." + toolName + ".XP_Modifier", 1.0);
|
||||||
boolean abilityEnabled = config.getBoolean(toolType + "." + toolName + ".Ability_Enabled", true);
|
boolean abilityEnabled = getBooleanValue(toolType + "." + toolName + ".Ability_Enabled", true);
|
||||||
int tier = config.getInt(toolType + "." + toolName + ".Tier", 1);
|
int tier = getIntValue(toolType + "." + toolName + ".Tier", 1);
|
||||||
|
|
||||||
CustomTool tool = new CustomTool(tier, abilityEnabled, multiplier);
|
CustomTool tool = new CustomTool(tier, abilityEnabled, multiplier);
|
||||||
|
|
||||||
|
@ -1,14 +1,10 @@
|
|||||||
package com.gmail.nossr50.core.config.party;
|
package com.gmail.nossr50.core.config.party;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.McmmoCore;
|
import com.gmail.nossr50.core.McmmoCore;
|
||||||
import com.gmail.nossr50.core.config.ConfigLoader;
|
import com.gmail.nossr50.core.config.Config;
|
||||||
import com.gmail.nossr50.core.config.ConfigurableLoader;
|
import com.gmail.nossr50.core.util.StringUtils;
|
||||||
import com.gmail.nossr50.util.StringUtils;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
|
|
||||||
import java.util.HashSet;
|
public class ItemWeightConfig extends Config {
|
||||||
|
|
||||||
public class ItemWeightConfig extends ConfigurableLoader {
|
|
||||||
private static ItemWeightConfig instance;
|
private static ItemWeightConfig instance;
|
||||||
|
|
||||||
private ItemWeightConfig() {
|
private ItemWeightConfig() {
|
||||||
@ -24,13 +20,13 @@ public class ItemWeightConfig extends ConfigurableLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getItemWeight(Material material) {
|
public int getItemWeight(Material material) {
|
||||||
return config.getInt("Item_Weights." + StringUtils.getPrettyItemString(material).replace(" ", "_"), config.getInt("Item_Weights.Default"));
|
return getIntValue("Item_Weights." + StringUtils.getPrettyItemString(material).replace(" ", "_"), getIntValue("Item_Weights.Default"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashSet<Material> getMiscItems() {
|
public HashSet<Material> getMiscItems() {
|
||||||
HashSet<Material> miscItems = new HashSet<Material>();
|
HashSet<Material> miscItems = new HashSet<Material>();
|
||||||
|
|
||||||
for (String item : config.getStringList("Party_Shareables.Misc_Items")) {
|
for (String item : getStringValueList("Party_Shareables.Misc_Items")) {
|
||||||
Material material = Material.getMaterial(item.toUpperCase());
|
Material material = Material.getMaterial(item.toUpperCase());
|
||||||
|
|
||||||
if (material != null) {
|
if (material != null) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.gmail.nossr50.core.config.skills.alchemy;
|
package com.gmail.nossr50.core.config.skills.alchemy;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.McmmoCore;
|
import com.gmail.nossr50.core.McmmoCore;
|
||||||
import com.gmail.nossr50.core.config.ConfigurableLoader;
|
import com.gmail.nossr50.core.config.Config;
|
||||||
import com.gmail.nossr50.core.mcmmo.colors.ChatColor;
|
import com.gmail.nossr50.core.mcmmo.colors.ChatColor;
|
||||||
import com.gmail.nossr50.core.mcmmo.item.ItemStack;
|
import com.gmail.nossr50.core.mcmmo.item.ItemStack;
|
||||||
import com.gmail.nossr50.core.skills.primary.alchemy.AlchemyPotion;
|
import com.gmail.nossr50.core.skills.primary.alchemy.AlchemyPotion;
|
||||||
@ -12,7 +12,7 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class PotionConfig extends ConfigurableLoader {
|
public class PotionConfig extends Config {
|
||||||
private static PotionConfig instance;
|
private static PotionConfig instance;
|
||||||
|
|
||||||
private List<ItemStack> concoctionsIngredientsTierOne = new ArrayList<ItemStack>();
|
private List<ItemStack> concoctionsIngredientsTierOne = new ArrayList<ItemStack>();
|
||||||
|
@ -1,22 +1,19 @@
|
|||||||
package com.gmail.nossr50.config.skills.repair;
|
package com.gmail.nossr50.core.config.skills.repair;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.ConfigLoader;
|
import com.gmail.nossr50.core.config.Config;
|
||||||
import com.gmail.nossr50.core.config.ConfigurableLoader;
|
import com.gmail.nossr50.core.mcmmo.item.ItemStack;
|
||||||
import com.gmail.nossr50.core.mcmmo.skills.ItemType;
|
import com.gmail.nossr50.core.skills.ItemType;
|
||||||
import com.gmail.nossr50.core.mcmmo.skills.MaterialType;
|
import com.gmail.nossr50.core.skills.MaterialType;
|
||||||
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
import com.gmail.nossr50.core.skills.primary.repair.repairables.Repairable;
|
||||||
import com.gmail.nossr50.skills.repair.repairables.RepairableFactory;
|
import com.gmail.nossr50.core.skills.primary.repair.repairables.RepairableFactory;
|
||||||
import com.gmail.nossr50.util.ItemUtils;
|
import com.gmail.nossr50.core.util.ItemUtils;
|
||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
import com.gmail.nossr50.core.util.skills.SkillUtils;
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class RepairConfig extends ConfigurableLoader {
|
public class RepairConfig extends Config {
|
||||||
private List<Repairable> repairables;
|
private List<Repairable> repairables;
|
||||||
|
|
||||||
public RepairConfig(String fileName) {
|
public RepairConfig(String fileName) {
|
||||||
@ -49,7 +46,7 @@ public class RepairConfig extends ConfigurableLoader {
|
|||||||
|
|
||||||
// Repair Material Type
|
// Repair Material Type
|
||||||
MaterialType repairMaterialType = MaterialType.OTHER;
|
MaterialType repairMaterialType = MaterialType.OTHER;
|
||||||
String repairMaterialTypeString = config.getString("Repairables." + key + ".MaterialType", "OTHER");
|
String repairMaterialTypeString = getStringValue("Repairables." + key + ".MaterialType", "OTHER");
|
||||||
|
|
||||||
if (!config.contains("Repairables." + key + ".MaterialType") && itemMaterial != null) {
|
if (!config.contains("Repairables." + key + ".MaterialType") && itemMaterial != null) {
|
||||||
ItemStack repairItem = new ItemStack(itemMaterial);
|
ItemStack repairItem = new ItemStack(itemMaterial);
|
||||||
@ -78,7 +75,7 @@ public class RepairConfig extends ConfigurableLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Repair Material
|
// Repair Material
|
||||||
String repairMaterialName = config.getString("Repairables." + key + ".RepairMaterial");
|
String repairMaterialName = getStringValue("Repairables." + key + ".RepairMaterial");
|
||||||
Material repairMaterial = (repairMaterialName == null ? repairMaterialType.getDefaultMaterial() : Material.matchMaterial(repairMaterialName));
|
Material repairMaterial = (repairMaterialName == null ? repairMaterialType.getDefaultMaterial() : Material.matchMaterial(repairMaterialName));
|
||||||
|
|
||||||
if (repairMaterial == null) {
|
if (repairMaterial == null) {
|
||||||
@ -86,10 +83,10 @@ public class RepairConfig extends ConfigurableLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Maximum Durability
|
// Maximum Durability
|
||||||
short maximumDurability = (itemMaterial != null ? itemMaterial.getMaxDurability() : (short) config.getInt("Repairables." + key + ".MaximumDurability"));
|
short maximumDurability = (itemMaterial != null ? itemMaterial.getMaxDurability() : (short) getIntValue("Repairables." + key + ".MaximumDurability"));
|
||||||
|
|
||||||
if (maximumDurability <= 0) {
|
if (maximumDurability <= 0) {
|
||||||
maximumDurability = (short) config.getInt("Repairables." + key + ".MaximumDurability");
|
maximumDurability = (short) getIntValue("Repairables." + key + ".MaximumDurability");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (maximumDurability <= 0) {
|
if (maximumDurability <= 0) {
|
||||||
@ -98,7 +95,7 @@ public class RepairConfig extends ConfigurableLoader {
|
|||||||
|
|
||||||
// ItemStack Type
|
// ItemStack Type
|
||||||
ItemType repairItemType = ItemType.OTHER;
|
ItemType repairItemType = ItemType.OTHER;
|
||||||
String repairItemTypeString = config.getString("Repairables." + key + ".ItemType", "OTHER");
|
String repairItemTypeString = getStringValue("Repairables." + key + ".ItemType", "OTHER");
|
||||||
|
|
||||||
if (!config.contains("Repairables." + key + ".ItemType") && itemMaterial != null) {
|
if (!config.contains("Repairables." + key + ".ItemType") && itemMaterial != null) {
|
||||||
ItemStack repairItem = new ItemStack(itemMaterial);
|
ItemStack repairItem = new ItemStack(itemMaterial);
|
||||||
@ -116,19 +113,19 @@ public class RepairConfig extends ConfigurableLoader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
byte repairMetadata = (byte) config.getInt("Repairables." + key + ".RepairMaterialMetadata", -1);
|
byte repairMetadata = (byte) getIntValue("Repairables." + key + ".RepairMaterialMetadata", -1);
|
||||||
int minimumLevel = config.getInt("Repairables." + key + ".MinimumLevel");
|
int minimumLevel = getIntValue("Repairables." + key + ".MinimumLevel");
|
||||||
double xpMultiplier = config.getDouble("Repairables." + key + ".XpMultiplier", 1);
|
double xpMultiplier = getDoubleValue("Repairables." + key + ".XpMultiplier", 1);
|
||||||
|
|
||||||
if (minimumLevel < 0) {
|
if (minimumLevel < 0) {
|
||||||
reason.add(key + " has an invalid MinimumLevel of " + minimumLevel);
|
reason.add(key + " has an invalid MinimumLevel of " + minimumLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Minimum Quantity
|
// Minimum Quantity
|
||||||
int minimumQuantity = (itemMaterial != null ? SkillUtils.getRepairAndSalvageQuantities(new ItemStack(itemMaterial), repairMaterial, repairMetadata) : config.getInt("Repairables." + key + ".MinimumQuantity", 2));
|
int minimumQuantity = (itemMaterial != null ? SkillUtils.getRepairAndSalvageQuantities(new ItemStack(itemMaterial), repairMaterial, repairMetadata) : getIntValue("Repairables." + key + ".MinimumQuantity", 2));
|
||||||
|
|
||||||
if (minimumQuantity <= 0 && itemMaterial != null) {
|
if (minimumQuantity <= 0 && itemMaterial != null) {
|
||||||
minimumQuantity = config.getInt("Repairables." + key + ".MinimumQuantity", 2);
|
minimumQuantity = getIntValue("Repairables." + key + ".MinimumQuantity", 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (minimumQuantity <= 0) {
|
if (minimumQuantity <= 0) {
|
||||||
|
@ -2,7 +2,7 @@ package com.gmail.nossr50.config.skills.salvage;
|
|||||||
|
|
||||||
import com.gmail.nossr50.config.ConfigLoader;
|
import com.gmail.nossr50.config.ConfigLoader;
|
||||||
import com.gmail.nossr50.core.McmmoCore;
|
import com.gmail.nossr50.core.McmmoCore;
|
||||||
import com.gmail.nossr50.core.config.ConfigurableLoader;
|
import com.gmail.nossr50.core.config.Config;
|
||||||
import com.gmail.nossr50.core.mcmmo.skills.ItemType;
|
import com.gmail.nossr50.core.mcmmo.skills.ItemType;
|
||||||
import com.gmail.nossr50.core.mcmmo.skills.MaterialType;
|
import com.gmail.nossr50.core.mcmmo.skills.MaterialType;
|
||||||
import com.gmail.nossr50.skills.salvage.salvageables.Salvageable;
|
import com.gmail.nossr50.skills.salvage.salvageables.Salvageable;
|
||||||
@ -17,7 +17,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class SalvageConfig extends ConfigurableLoader {
|
public class SalvageConfig extends Config {
|
||||||
private List<Salvageable> salvageables;
|
private List<Salvageable> salvageables;
|
||||||
|
|
||||||
public SalvageConfig(String fileName) {
|
public SalvageConfig(String fileName) {
|
||||||
@ -45,7 +45,7 @@ public class SalvageConfig extends ConfigurableLoader {
|
|||||||
|
|
||||||
// Salvage Material Type
|
// Salvage Material Type
|
||||||
MaterialType salvageMaterialType = MaterialType.OTHER;
|
MaterialType salvageMaterialType = MaterialType.OTHER;
|
||||||
String salvageMaterialTypeString = config.getString("Salvageables." + key + ".MaterialType", "OTHER");
|
String salvageMaterialTypeString = getStringValue("Salvageables." + key + ".MaterialType", "OTHER");
|
||||||
|
|
||||||
if (!config.contains("Salvageables." + key + ".MaterialType") && itemMaterial != null) {
|
if (!config.contains("Salvageables." + key + ".MaterialType") && itemMaterial != null) {
|
||||||
ItemStack salvageItem = new ItemStack(itemMaterial);
|
ItemStack salvageItem = new ItemStack(itemMaterial);
|
||||||
@ -74,7 +74,7 @@ public class SalvageConfig extends ConfigurableLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Salvage Material
|
// Salvage Material
|
||||||
String salvageMaterialName = config.getString("Salvageables." + key + ".SalvageMaterial");
|
String salvageMaterialName = getStringValue("Salvageables." + key + ".SalvageMaterial");
|
||||||
Material salvageMaterial = (salvageMaterialName == null ? salvageMaterialType.getDefaultMaterial() : Material.matchMaterial(salvageMaterialName));
|
Material salvageMaterial = (salvageMaterialName == null ? salvageMaterialType.getDefaultMaterial() : Material.matchMaterial(salvageMaterialName));
|
||||||
|
|
||||||
if (salvageMaterial == null) {
|
if (salvageMaterial == null) {
|
||||||
@ -82,11 +82,11 @@ public class SalvageConfig extends ConfigurableLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Maximum Durability
|
// Maximum Durability
|
||||||
short maximumDurability = (itemMaterial != null ? itemMaterial.getMaxDurability() : (short) config.getInt("Salvageables." + key + ".MaximumDurability"));
|
short maximumDurability = (itemMaterial != null ? itemMaterial.getMaxDurability() : (short) getIntValue("Salvageables." + key + ".MaximumDurability"));
|
||||||
|
|
||||||
// ItemStack Type
|
// ItemStack Type
|
||||||
ItemType salvageItemType = ItemType.OTHER;
|
ItemType salvageItemType = ItemType.OTHER;
|
||||||
String salvageItemTypeString = config.getString("Salvageables." + key + ".ItemType", "OTHER");
|
String salvageItemTypeString = getStringValue("Salvageables." + key + ".ItemType", "OTHER");
|
||||||
|
|
||||||
if (!config.contains("Salvageables." + key + ".ItemType") && itemMaterial != null) {
|
if (!config.contains("Salvageables." + key + ".ItemType") && itemMaterial != null) {
|
||||||
ItemStack salvageItem = new ItemStack(itemMaterial);
|
ItemStack salvageItem = new ItemStack(itemMaterial);
|
||||||
@ -104,22 +104,22 @@ public class SalvageConfig extends ConfigurableLoader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
byte salvageMetadata = (byte) config.getInt("Salvageables." + key + ".SalvageMaterialMetadata", -1);
|
byte salvageMetadata = (byte) getIntValue("Salvageables." + key + ".SalvageMaterialMetadata", -1);
|
||||||
int minimumLevel = config.getInt("Salvageables." + key + ".MinimumLevel");
|
int minimumLevel = getIntValue("Salvageables." + key + ".MinimumLevel");
|
||||||
double xpMultiplier = config.getDouble("Salvageables." + key + ".XpMultiplier", 1);
|
double xpMultiplier = getDoubleValue("Salvageables." + key + ".XpMultiplier", 1);
|
||||||
|
|
||||||
if (minimumLevel < 0) {
|
if (minimumLevel < 0) {
|
||||||
reason.add(key + " has an invalid MinimumLevel of " + minimumLevel);
|
reason.add(key + " has an invalid MinimumLevel of " + minimumLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Maximum Quantity
|
// Maximum Quantity
|
||||||
int maximumQuantity = (itemMaterial != null ? SkillUtils.getRepairAndSalvageQuantities(new ItemStack(itemMaterial), salvageMaterial, salvageMetadata) : config.getInt("Salvageables." + key + ".MaximumQuantity", 2));
|
int maximumQuantity = (itemMaterial != null ? SkillUtils.getRepairAndSalvageQuantities(new ItemStack(itemMaterial), salvageMaterial, salvageMetadata) : getIntValue("Salvageables." + key + ".MaximumQuantity", 2));
|
||||||
|
|
||||||
if (maximumQuantity <= 0 && itemMaterial != null) {
|
if (maximumQuantity <= 0 && itemMaterial != null) {
|
||||||
maximumQuantity = config.getInt("Salvageables." + key + ".MaximumQuantity", 1);
|
maximumQuantity = getIntValue("Salvageables." + key + ".MaximumQuantity", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int configMaximumQuantity = config.getInt("Salvageables." + key + ".MaximumQuantity", -1);
|
int configMaximumQuantity = getIntValue("Salvageables." + key + ".MaximumQuantity", -1);
|
||||||
|
|
||||||
if (configMaximumQuantity > 0) {
|
if (configMaximumQuantity > 0) {
|
||||||
maximumQuantity = configMaximumQuantity;
|
maximumQuantity = configMaximumQuantity;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.gmail.nossr50.core.config.treasure;
|
package com.gmail.nossr50.core.config.treasure;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.McmmoCore;
|
import com.gmail.nossr50.core.McmmoCore;
|
||||||
import com.gmail.nossr50.core.config.ConfigurableLoader;
|
import com.gmail.nossr50.core.config.Config;
|
||||||
import com.gmail.nossr50.core.mcmmo.colors.ChatColor;
|
import com.gmail.nossr50.core.mcmmo.colors.ChatColor;
|
||||||
import com.gmail.nossr50.core.mcmmo.item.ItemStack;
|
import com.gmail.nossr50.core.mcmmo.item.ItemStack;
|
||||||
import com.gmail.nossr50.core.skills.treasure.*;
|
import com.gmail.nossr50.core.skills.treasure.*;
|
||||||
@ -12,7 +12,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class TreasureConfig extends ConfigurableLoader {
|
public class TreasureConfig extends Config {
|
||||||
|
|
||||||
private static TreasureConfig instance;
|
private static TreasureConfig instance;
|
||||||
|
|
||||||
@ -47,8 +47,8 @@ public class TreasureConfig extends ConfigurableLoader {
|
|||||||
double totalItemDropRate = 0;
|
double totalItemDropRate = 0;
|
||||||
|
|
||||||
for (Rarity rarity : Rarity.values()) {
|
for (Rarity rarity : Rarity.values()) {
|
||||||
double enchantDropRate = config.getDouble("Enchantment_Drop_Rates." + tier + "." + rarity.toString());
|
double enchantDropRate = getDoubleValue("Enchantment_Drop_Rates." + tier + "." + rarity.toString());
|
||||||
double itemDropRate = config.getDouble("Item_Drop_Rates." + tier + "." + rarity.toString());
|
double itemDropRate = getDoubleValue("Item_Drop_Rates." + tier + "." + rarity.toString());
|
||||||
|
|
||||||
if ((enchantDropRate < 0.0 || enchantDropRate > 100.0) && rarity != Rarity.RECORD) {
|
if ((enchantDropRate < 0.0 || enchantDropRate > 100.0) && rarity != Rarity.RECORD) {
|
||||||
reason.add("The enchant drop rate for " + tier + " items that are " + rarity.toString() + "should be between 0.0 and 100.0!");
|
reason.add("The enchant drop rate for " + tier + " items that are " + rarity.toString() + "should be between 0.0 and 100.0!");
|
||||||
@ -134,8 +134,8 @@ public class TreasureConfig extends ConfigurableLoader {
|
|||||||
material = Material.matchMaterial(materialName);
|
material = Material.matchMaterial(materialName);
|
||||||
}
|
}
|
||||||
|
|
||||||
int amount = config.getInt(type + "." + treasureName + ".Amount");
|
int amount = getIntValue(type + "." + treasureName + ".Amount");
|
||||||
short data = (treasureInfo.length == 2) ? Short.parseShort(treasureInfo[1]) : (short) config.getInt(type + "." + treasureName + ".Data");
|
short data = (treasureInfo.length == 2) ? Short.parseShort(treasureInfo[1]) : (short) getIntValue(type + "." + treasureName + ".Data");
|
||||||
|
|
||||||
if (material == null) {
|
if (material == null) {
|
||||||
reason.add("Invalid material: " + materialName);
|
reason.add("Invalid material: " + materialName);
|
||||||
@ -153,9 +153,9 @@ public class TreasureConfig extends ConfigurableLoader {
|
|||||||
* XP, Drop Chance, and Drop Level
|
* XP, Drop Chance, and Drop Level
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int xp = config.getInt(type + "." + treasureName + ".XP");
|
int xp = getIntValue(type + "." + treasureName + ".XP");
|
||||||
double dropChance = config.getDouble(type + "." + treasureName + ".Drop_Chance");
|
double dropChance = getDoubleValue(type + "." + treasureName + ".Drop_Chance");
|
||||||
int dropLevel = config.getInt(type + "." + treasureName + ".Drop_Level");
|
int dropLevel = getIntValue(type + "." + treasureName + ".Drop_Level");
|
||||||
|
|
||||||
if (xp < 0) {
|
if (xp < 0) {
|
||||||
reason.add(treasureName + " has an invalid XP value: " + xp);
|
reason.add(treasureName + " has an invalid XP value: " + xp);
|
||||||
@ -175,7 +175,7 @@ public class TreasureConfig extends ConfigurableLoader {
|
|||||||
Rarity rarity = null;
|
Rarity rarity = null;
|
||||||
|
|
||||||
if (isFishing) {
|
if (isFishing) {
|
||||||
rarity = Rarity.getRarity(config.getString(type + "." + treasureName + ".Rarity"));
|
rarity = Rarity.getRarity(getStringValue(type + "." + treasureName + ".Rarity"));
|
||||||
|
|
||||||
if (rarity == null) {
|
if (rarity == null) {
|
||||||
reason.add("Invalid Rarity for item: " + treasureName);
|
reason.add("Invalid Rarity for item: " + treasureName);
|
||||||
@ -197,21 +197,21 @@ public class TreasureConfig extends ConfigurableLoader {
|
|||||||
|
|
||||||
PotionType potionType = null;
|
PotionType potionType = null;
|
||||||
try {
|
try {
|
||||||
potionType = PotionType.valueOf(config.getString(type + "." + treasureName + ".PotionData.PotionType", "WATER"));
|
potionType = PotionType.valueOf(getStringValue(type + "." + treasureName + ".PotionData.PotionType", "WATER"));
|
||||||
} catch (IllegalArgumentException ex) {
|
} catch (IllegalArgumentException ex) {
|
||||||
reason.add("Invalid Potion_Type: " + config.getString(type + "." + treasureName + ".PotionData.PotionType", "WATER"));
|
reason.add("Invalid Potion_Type: " + getStringValue(type + "." + treasureName + ".PotionData.PotionType", "WATER"));
|
||||||
}
|
}
|
||||||
boolean extended = config.getBoolean(type + "." + treasureName + ".PotionData.Extended", false);
|
boolean extended = getBooleanValue(type + "." + treasureName + ".PotionData.Extended", false);
|
||||||
boolean upgraded = config.getBoolean(type + "." + treasureName + ".PotionData.Upgraded", false);
|
boolean upgraded = getBooleanValue(type + "." + treasureName + ".PotionData.Upgraded", false);
|
||||||
itemMeta.setBasePotionData(new PotionData(potionType, extended, upgraded));
|
itemMeta.setBasePotionData(new PotionData(potionType, extended, upgraded));
|
||||||
|
|
||||||
if (config.contains(type + "." + treasureName + ".Custom_Name")) {
|
if (config.contains(type + "." + treasureName + ".Custom_Name")) {
|
||||||
itemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', config.getString(type + "." + treasureName + ".Custom_Name")));
|
itemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', getStringValue(type + "." + treasureName + ".Custom_Name")));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.contains(type + "." + treasureName + ".Lore")) {
|
if (config.contains(type + "." + treasureName + ".Lore")) {
|
||||||
List<String> lore = new ArrayList<String>();
|
List<String> lore = new ArrayList<String>();
|
||||||
for (String s : config.getStringList(type + "." + treasureName + ".Lore")) {
|
for (String s : getStringValueList(type + "." + treasureName + ".Lore")) {
|
||||||
lore.add(ChatColor.translateAlternateColorCodes('&', s));
|
lore.add(ChatColor.translateAlternateColorCodes('&', s));
|
||||||
}
|
}
|
||||||
itemMeta.setLore(lore);
|
itemMeta.setLore(lore);
|
||||||
@ -223,14 +223,14 @@ public class TreasureConfig extends ConfigurableLoader {
|
|||||||
|
|
||||||
if (config.contains(type + "." + treasureName + ".Custom_Name")) {
|
if (config.contains(type + "." + treasureName + ".Custom_Name")) {
|
||||||
ItemMeta itemMeta = item.getItemMeta();
|
ItemMeta itemMeta = item.getItemMeta();
|
||||||
itemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', config.getString(type + "." + treasureName + ".Custom_Name")));
|
itemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', getStringValue(type + "." + treasureName + ".Custom_Name")));
|
||||||
item.setItemMeta(itemMeta);
|
item.setItemMeta(itemMeta);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.contains(type + "." + treasureName + ".Lore")) {
|
if (config.contains(type + "." + treasureName + ".Lore")) {
|
||||||
ItemMeta itemMeta = item.getItemMeta();
|
ItemMeta itemMeta = item.getItemMeta();
|
||||||
List<String> lore = new ArrayList<String>();
|
List<String> lore = new ArrayList<String>();
|
||||||
for (String s : config.getStringList(type + "." + treasureName + ".Lore")) {
|
for (String s : getStringValueList(type + "." + treasureName + ".Lore")) {
|
||||||
lore.add(ChatColor.translateAlternateColorCodes('&', s));
|
lore.add(ChatColor.translateAlternateColorCodes('&', s));
|
||||||
}
|
}
|
||||||
itemMeta.setLore(lore);
|
itemMeta.setLore(lore);
|
||||||
@ -250,7 +250,7 @@ public class TreasureConfig extends ConfigurableLoader {
|
|||||||
shakeMap.get(entityType).add(shakeTreasure);
|
shakeMap.get(entityType).add(shakeTreasure);
|
||||||
} else if (isExcavation) {
|
} else if (isExcavation) {
|
||||||
ExcavationTreasure excavationTreasure = new ExcavationTreasure(item, xp, dropChance, dropLevel);
|
ExcavationTreasure excavationTreasure = new ExcavationTreasure(item, xp, dropChance, dropLevel);
|
||||||
List<String> dropList = config.getStringList(type + "." + treasureName + ".Drops_From");
|
List<String> dropList = getStringValueList(type + "." + treasureName + ".Drops_From");
|
||||||
|
|
||||||
for (String blockType : dropList) {
|
for (String blockType : dropList) {
|
||||||
if (!excavationMap.containsKey(blockType))
|
if (!excavationMap.containsKey(blockType))
|
||||||
@ -259,7 +259,7 @@ public class TreasureConfig extends ConfigurableLoader {
|
|||||||
}
|
}
|
||||||
} else if (isHylian) {
|
} else if (isHylian) {
|
||||||
HylianTreasure hylianTreasure = new HylianTreasure(item, xp, dropChance, dropLevel);
|
HylianTreasure hylianTreasure = new HylianTreasure(item, xp, dropChance, dropLevel);
|
||||||
List<String> dropList = config.getStringList(type + "." + treasureName + ".Drops_From");
|
List<String> dropList = getStringValueList(type + "." + treasureName + ".Drops_From");
|
||||||
|
|
||||||
for (String dropper : dropList) {
|
for (String dropper : dropList) {
|
||||||
if (dropper.equals("Bushes")) {
|
if (dropper.equals("Bushes")) {
|
||||||
@ -318,7 +318,7 @@ public class TreasureConfig extends ConfigurableLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (String enchantmentName : enchantmentSection.getKeys(false)) {
|
for (String enchantmentName : enchantmentSection.getKeys(false)) {
|
||||||
int level = config.getInt("Enchantments_Rarity." + rarity.toString() + "." + enchantmentName);
|
int level = getIntValue("Enchantments_Rarity." + rarity.toString() + "." + enchantmentName);
|
||||||
Enchantment enchantment = EnchantmentUtils.getByName(enchantmentName);
|
Enchantment enchantment = EnchantmentUtils.getByName(enchantmentName);
|
||||||
|
|
||||||
if (enchantment == null) {
|
if (enchantment == null) {
|
||||||
@ -336,22 +336,22 @@ public class TreasureConfig extends ConfigurableLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean getInventoryStealStacks() {
|
public boolean getInventoryStealStacks() {
|
||||||
return config.getBoolean("Shake.PLAYER.INVENTORY.Whole_Stacks");
|
return getBooleanValue("Shake.PLAYER.INVENTORY.Whole_Stacks");
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getInventoryStealDropChance() {
|
public double getInventoryStealDropChance() {
|
||||||
return config.getDouble("Shake.PLAYER.INVENTORY.Drop_Chance");
|
return getDoubleValue("Shake.PLAYER.INVENTORY.Drop_Chance");
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getInventoryStealDropLevel() {
|
public int getInventoryStealDropLevel() {
|
||||||
return config.getInt("Shake.PLAYER.INVENTORY.Drop_Level");
|
return getIntValue("Shake.PLAYER.INVENTORY.Drop_Level");
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getItemDropRate(int tier, Rarity rarity) {
|
public double getItemDropRate(int tier, Rarity rarity) {
|
||||||
return config.getDouble("Item_Drop_Rates.Tier_" + tier + "." + rarity.toString());
|
return getDoubleValue("Item_Drop_Rates.Tier_" + tier + "." + rarity.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getEnchantmentDropRate(int tier, Rarity rarity) {
|
public double getEnchantmentDropRate(int tier, Rarity rarity) {
|
||||||
return config.getDouble("Enchantment_Drop_Rates.Tier_" + tier + "." + rarity.toString());
|
return getDoubleValue("Enchantment_Drop_Rates.Tier_" + tier + "." + rarity.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.core.data.database;
|
package com.gmail.nossr50.core.data.database;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.datatypes.database.DatabaseType;
|
import com.gmail.nossr50.core.datatypes.database.DatabaseType;
|
||||||
import com.gmail.nossr50.core.datatypes.database.PlayerStat;
|
import com.gmail.nossr50.core.datatypes.database.PlayerStat;
|
||||||
import com.gmail.nossr50.core.datatypes.player.PlayerProfile;
|
import com.gmail.nossr50.core.datatypes.player.PlayerProfile;
|
||||||
@ -12,7 +12,7 @@ import java.util.UUID;
|
|||||||
|
|
||||||
public interface DatabaseManager {
|
public interface DatabaseManager {
|
||||||
// One month in milliseconds
|
// One month in milliseconds
|
||||||
public final long PURGE_TIME = 2630000000L * Config.getInstance().getOldUsersCutoff();
|
public final long PURGE_TIME = 2630000000L * MainConfig.getInstance().getOldUsersCutoff();
|
||||||
// During convertUsers, how often to output a status
|
// During convertUsers, how often to output a status
|
||||||
public final int progressInterval = 200;
|
public final int progressInterval = 200;
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.gmail.nossr50.core.datatypes.party;
|
package com.gmail.nossr50.core.datatypes.party;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.datatypes.experience.FormulaType;
|
import com.gmail.nossr50.core.datatypes.experience.FormulaType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
@ -190,7 +190,7 @@ public class Party {
|
|||||||
|
|
||||||
public int getXpToLevel() {
|
public int getXpToLevel() {
|
||||||
FormulaType formulaType = ExperienceConfig.getInstance().getFormulaType();
|
FormulaType formulaType = ExperienceConfig.getInstance().getFormulaType();
|
||||||
return (mcMMO.getFormulaManager().getCachedXpToLevel(level, formulaType)) * (getOnlineMembers().size() + Config.getInstance().getPartyXpCurveMultiplier());
|
return (mcMMO.getFormulaManager().getCachedXpToLevel(level, formulaType)) * (getOnlineMembers().size() + MainConfig.getInstance().getPartyXpCurveMultiplier());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getXpToLevelPercentage() {
|
public String getXpToLevelPercentage() {
|
||||||
@ -229,13 +229,13 @@ public class Party {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Config.getInstance().getPartyInformAllMembers()) {
|
if (!MainConfig.getInstance().getPartyInformAllMembers()) {
|
||||||
Player leader = mcMMO.p.getServer().getPlayer(this.leader.getUniqueId());
|
Player leader = mcMMO.p.getServer().getPlayer(this.leader.getUniqueId());
|
||||||
|
|
||||||
if (leader != null) {
|
if (leader != null) {
|
||||||
leader.sendMessage(LocaleLoader.getString("Party.LevelUp", levelsGained, getLevel()));
|
leader.sendMessage(LocaleLoader.getString("Party.LevelUp", levelsGained, getLevel()));
|
||||||
|
|
||||||
if (Config.getInstance().getLevelUpSoundsEnabled()) {
|
if (MainConfig.getInstance().getLevelUpSoundsEnabled()) {
|
||||||
SoundManager.sendSound(leader, leader.getLocation(), SoundType.LEVEL_UP);
|
SoundManager.sendSound(leader, leader.getLocation(), SoundType.LEVEL_UP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -246,7 +246,7 @@ public class Party {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasReachedLevelCap() {
|
public boolean hasReachedLevelCap() {
|
||||||
return Config.getInstance().getPartyLevelCap() < getLevel() + 1;
|
return MainConfig.getInstance().getPartyLevelCap() < getLevel() + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ShareMode getXpShareMode() {
|
public ShareMode getXpShareMode() {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.gmail.nossr50.core.datatypes.party;
|
package com.gmail.nossr50.core.datatypes.party;
|
||||||
|
|
||||||
import com.gmail.nossr50.commands.party.PartySubcommandType;
|
import com.gmail.nossr50.commands.party.PartySubcommandType;
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.StringUtils;
|
import com.gmail.nossr50.util.StringUtils;
|
||||||
@ -19,7 +19,7 @@ public enum PartyFeature {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getFeatureLockedLocaleString() {
|
public String getFeatureLockedLocaleString() {
|
||||||
return LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Party.Feature.Locked." + StringUtils.getPrettyPartyFeatureString(this).replace(" ", ""), Config.getInstance().getPartyFeatureUnlockLevel(this)));
|
return LocaleLoader.getString("Ability.Generic.Template.Lock", LocaleLoader.getString("Party.Feature.Locked." + StringUtils.getPrettyPartyFeatureString(this).replace(" ", ""), MainConfig.getInstance().getPartyFeatureUnlockLevel(this)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasPermission(Player player) {
|
public boolean hasPermission(Player player) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.core.datatypes.party;
|
package com.gmail.nossr50.core.datatypes.party;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -12,7 +12,7 @@ public class PartyTeleportRecord {
|
|||||||
public PartyTeleportRecord() {
|
public PartyTeleportRecord() {
|
||||||
requestor = null;
|
requestor = null;
|
||||||
enabled = true;
|
enabled = true;
|
||||||
confirmRequired = Config.getInstance().getPTPCommandConfirmRequired();
|
confirmRequired = MainConfig.getInstance().getPTPCommandConfirmRequired();
|
||||||
timeout = 0;
|
timeout = 0;
|
||||||
lastUse = 0;
|
lastUse = 0;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.gmail.nossr50.core.datatypes.player;
|
|||||||
|
|
||||||
import com.gmail.nossr50.core.McmmoCore;
|
import com.gmail.nossr50.core.McmmoCore;
|
||||||
import com.gmail.nossr50.core.config.AdvancedConfig;
|
import com.gmail.nossr50.core.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.config.WorldBlacklist;
|
import com.gmail.nossr50.core.config.WorldBlacklist;
|
||||||
import com.gmail.nossr50.core.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.core.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.core.data.UserManager;
|
import com.gmail.nossr50.core.data.UserManager;
|
||||||
@ -490,7 +490,7 @@ public class McMMOPlayer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Config.getInstance().getPartyXpNearMembersNeeded() || !PartyManager.getNearMembers(this).isEmpty()) {
|
if (!MainConfig.getInstance().getPartyXpNearMembersNeeded() || !PartyManager.getNearMembers(this).isEmpty()) {
|
||||||
party.applyXpGain(modifyXpGain(skill, xp));
|
party.applyXpGain(modifyXpGain(skill, xp));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -553,7 +553,7 @@ public class McMMOPlayer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getLevelUpSoundsEnabled()) {
|
if (MainConfig.getInstance().getLevelUpSoundsEnabled()) {
|
||||||
SoundManager.sendSound(player, player.getLocation(), SoundType.LEVEL_UP);
|
SoundManager.sendSound(player, player.getLocation(), SoundType.LEVEL_UP);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -739,13 +739,13 @@ public class McMMOPlayer {
|
|||||||
* @return Modified experience
|
* @return Modified experience
|
||||||
*/
|
*/
|
||||||
private float modifyXpGain(PrimarySkillType primarySkillType, float xp) {
|
private float modifyXpGain(PrimarySkillType primarySkillType, float xp) {
|
||||||
if (player.getGameMode() == GameMode.CREATIVE || (primarySkillType.getMaxLevel() <= getSkillLevel(primarySkillType)) || (Config.getInstance().getPowerLevelCap() <= getPowerLevel())) {
|
if (player.getGameMode() == GameMode.CREATIVE || (primarySkillType.getMaxLevel() <= getSkillLevel(primarySkillType)) || (MainConfig.getInstance().getPowerLevelCap() <= getPowerLevel())) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
xp = (float) (xp / primarySkillType.getXpModifier() * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier());
|
xp = (float) (xp / primarySkillType.getXpModifier() * ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier());
|
||||||
|
|
||||||
if (Config.getInstance().getToolModsEnabled()) {
|
if (MainConfig.getInstance().getToolModsEnabled()) {
|
||||||
CustomTool tool = mcMMO.getModManager().getTool(player.getInventory().getItemInMainHand());
|
CustomTool tool = mcMMO.getModManager().getTool(player.getInventory().getItemInMainHand());
|
||||||
|
|
||||||
if (tool != null) {
|
if (tool != null) {
|
||||||
@ -854,7 +854,7 @@ public class McMMOPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void processAbilityActivation(PrimarySkillType skill) {
|
public void processAbilityActivation(PrimarySkillType skill) {
|
||||||
if (Config.getInstance().getAbilitiesOnlyActivateWhenSneaking() && !player.isSneaking()) {
|
if (MainConfig.getInstance().getAbilitiesOnlyActivateWhenSneaking() && !player.isSneaking()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -891,7 +891,7 @@ public class McMMOPlayer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getAbilityMessagesEnabled()) {
|
if (MainConfig.getInstance().getAbilityMessagesEnabled()) {
|
||||||
NotificationManager.sendPlayerInformation(player, NotificationType.TOOL, tool.getRaiseTool());
|
NotificationManager.sendPlayerInformation(player, NotificationType.TOOL, tool.getRaiseTool());
|
||||||
SoundManager.sendSound(player, player.getLocation(), SoundType.TOOL_READY);
|
SoundManager.sendSound(player, player.getLocation(), SoundType.TOOL_READY);
|
||||||
}
|
}
|
||||||
@ -913,7 +913,7 @@ public class McMMOPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasReachedLevelCap(PrimarySkillType skill) {
|
private boolean hasReachedLevelCap(PrimarySkillType skill) {
|
||||||
return (skill.getMaxLevel() < getSkillLevel(skill) + 1) || (Config.getInstance().getPowerLevelCap() < getPowerLevel() + 1);
|
return (skill.getMaxLevel() < getSkillLevel(skill) + 1) || (MainConfig.getInstance().getPowerLevelCap() < getPowerLevel() + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -985,7 +985,7 @@ public class McMMOPlayer {
|
|||||||
|
|
||||||
UserManager.remove(thisPlayer);
|
UserManager.remove(thisPlayer);
|
||||||
|
|
||||||
if (Config.getInstance().getScoreboardsEnabled())
|
if (MainConfig.getInstance().getScoreboardsEnabled())
|
||||||
ScoreboardManager.teardownPlayer(thisPlayer);
|
ScoreboardManager.teardownPlayer(thisPlayer);
|
||||||
|
|
||||||
if (inParty()) {
|
if (inParty()) {
|
||||||
|
@ -2,7 +2,7 @@ package com.gmail.nossr50.core.datatypes.player;
|
|||||||
|
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.core.config.AdvancedConfig;
|
import com.gmail.nossr50.core.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.data.UserManager;
|
import com.gmail.nossr50.core.data.UserManager;
|
||||||
import com.gmail.nossr50.core.datatypes.experience.FormulaType;
|
import com.gmail.nossr50.core.datatypes.experience.FormulaType;
|
||||||
import com.gmail.nossr50.core.datatypes.experience.SkillXpGain;
|
import com.gmail.nossr50.core.datatypes.experience.SkillXpGain;
|
||||||
@ -46,7 +46,7 @@ public class PlayerProfile {
|
|||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
this.playerName = playerName;
|
this.playerName = playerName;
|
||||||
|
|
||||||
mobHealthbarType = Config.getInstance().getMobHealthbarDefault();
|
mobHealthbarType = MainConfig.getInstance().getMobHealthbarDefault();
|
||||||
scoreboardTipsShown = 0;
|
scoreboardTipsShown = 0;
|
||||||
|
|
||||||
for (SuperAbilityType superAbilityType : SuperAbilityType.values()) {
|
for (SuperAbilityType superAbilityType : SuperAbilityType.values()) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.core.locale;
|
package com.gmail.nossr50.core.locale;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ public final class LocaleLoader {
|
|||||||
if (bundle == null) {
|
if (bundle == null) {
|
||||||
Locale.setDefault(new Locale("en", "US"));
|
Locale.setDefault(new Locale("en", "US"));
|
||||||
Locale locale = null;
|
Locale locale = null;
|
||||||
String[] myLocale = Config.getInstance().getLocale().split("[-_ ]");
|
String[] myLocale = MainConfig.getInstance().getLocale().split("[-_ ]");
|
||||||
|
|
||||||
if (myLocale.length == 1) {
|
if (myLocale.length == 1) {
|
||||||
locale = new Locale(myLocale[0]);
|
locale = new Locale(myLocale[0]);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.core.party;
|
package com.gmail.nossr50.core.party;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.data.UserManager;
|
import com.gmail.nossr50.core.data.UserManager;
|
||||||
import com.gmail.nossr50.core.datatypes.chat.ChatMode;
|
import com.gmail.nossr50.core.datatypes.chat.ChatMode;
|
||||||
import com.gmail.nossr50.core.datatypes.database.UpgradeType;
|
import com.gmail.nossr50.core.datatypes.database.UpgradeType;
|
||||||
@ -63,7 +63,7 @@ public final class PartyManager {
|
|||||||
* @return true if party is full and cannot be joined
|
* @return true if party is full and cannot be joined
|
||||||
*/
|
*/
|
||||||
public static boolean isPartyFull(Player player, Party targetParty) {
|
public static boolean isPartyFull(Player player, Party targetParty) {
|
||||||
return !Permissions.partySizeBypass(player) && Config.getInstance().getPartyMaxSize() >= 1 && targetParty.getOnlineMembers().size() >= Config.getInstance().getPartyMaxSize();
|
return !Permissions.partySizeBypass(player) && MainConfig.getInstance().getPartyMaxSize() >= 1 && targetParty.getOnlineMembers().size() >= MainConfig.getInstance().getPartyMaxSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -131,7 +131,7 @@ public final class PartyManager {
|
|||||||
|
|
||||||
if (party != null) {
|
if (party != null) {
|
||||||
Player player = mcMMOPlayer.getPlayer();
|
Player player = mcMMOPlayer.getPlayer();
|
||||||
double range = Config.getInstance().getPartyShareRange();
|
double range = MainConfig.getInstance().getPartyShareRange();
|
||||||
|
|
||||||
for (Player member : party.getOnlineMembers()) {
|
for (Player member : party.getOnlineMembers()) {
|
||||||
if (!player.equals(member) && member.isValid() && Misc.isNear(player.getLocation(), member.getLocation(), range)) {
|
if (!player.equals(member) && member.isValid() && Misc.isNear(player.getLocation(), member.getLocation(), range)) {
|
||||||
@ -149,7 +149,7 @@ public final class PartyManager {
|
|||||||
|
|
||||||
if (party != null) {
|
if (party != null) {
|
||||||
Player player = mcMMOPlayer.getPlayer();
|
Player player = mcMMOPlayer.getPlayer();
|
||||||
double range = Config.getInstance().getPartyShareRange();
|
double range = MainConfig.getInstance().getPartyShareRange();
|
||||||
|
|
||||||
for (Player member : party.getVisibleMembers(player)) {
|
for (Player member : party.getVisibleMembers(player)) {
|
||||||
if (!player.equals(member)
|
if (!player.equals(member)
|
||||||
@ -403,8 +403,8 @@ public final class PartyManager {
|
|||||||
/*
|
/*
|
||||||
* Don't let players join a full party
|
* Don't let players join a full party
|
||||||
*/
|
*/
|
||||||
if (Config.getInstance().getPartyMaxSize() > 0 && invite.getMembers().size() >= Config.getInstance().getPartyMaxSize()) {
|
if (MainConfig.getInstance().getPartyMaxSize() > 0 && invite.getMembers().size() >= MainConfig.getInstance().getPartyMaxSize()) {
|
||||||
NotificationManager.sendPlayerInformation(mcMMOPlayer.getPlayer(), NotificationType.PARTY_MESSAGE, "Commands.Party.PartyFull.InviteAccept", invite.getName(), String.valueOf(Config.getInstance().getPartyMaxSize()));
|
NotificationManager.sendPlayerInformation(mcMMOPlayer.getPlayer(), NotificationType.PARTY_MESSAGE, "Commands.Party.PartyFull.InviteAccept", invite.getName(), String.valueOf(MainConfig.getInstance().getPartyMaxSize()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -761,7 +761,7 @@ public final class PartyManager {
|
|||||||
* @param level The current party level
|
* @param level The current party level
|
||||||
*/
|
*/
|
||||||
public static void informPartyMembersLevelUp(Party party, int levelsGained, int level) {
|
public static void informPartyMembersLevelUp(Party party, int levelsGained, int level) {
|
||||||
boolean levelUpSoundsEnabled = Config.getInstance().getLevelUpSoundsEnabled();
|
boolean levelUpSoundsEnabled = MainConfig.getInstance().getLevelUpSoundsEnabled();
|
||||||
for (Player member : party.getOnlineMembers()) {
|
for (Player member : party.getOnlineMembers()) {
|
||||||
member.sendMessage(LocaleLoader.getString("Party.LevelUp", levelsGained, level));
|
member.sendMessage(LocaleLoader.getString("Party.LevelUp", levelsGained, level));
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.gmail.nossr50.core.party;
|
package com.gmail.nossr50.core.party;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.party.ItemWeightConfig;
|
import com.gmail.nossr50.config.party.ItemWeightConfig;
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.data.UserManager;
|
import com.gmail.nossr50.core.data.UserManager;
|
||||||
import com.gmail.nossr50.core.datatypes.experience.XPGainReason;
|
import com.gmail.nossr50.core.datatypes.experience.XPGainReason;
|
||||||
import com.gmail.nossr50.core.datatypes.experience.XPGainSource;
|
import com.gmail.nossr50.core.datatypes.experience.XPGainSource;
|
||||||
@ -45,7 +45,7 @@ public final class ShareHandler {
|
|||||||
nearMembers.add(mcMMOPlayer.getPlayer());
|
nearMembers.add(mcMMOPlayer.getPlayer());
|
||||||
|
|
||||||
int partySize = nearMembers.size();
|
int partySize = nearMembers.size();
|
||||||
double shareBonus = Math.min(Config.getInstance().getPartyShareBonusBase() + (partySize * Config.getInstance().getPartyShareBonusIncrease()), Config.getInstance().getPartyShareBonusCap());
|
double shareBonus = Math.min(MainConfig.getInstance().getPartyShareBonusBase() + (partySize * MainConfig.getInstance().getPartyShareBonusIncrease()), MainConfig.getInstance().getPartyShareBonusCap());
|
||||||
float splitXp = (float) (xp / partySize * shareBonus);
|
float splitXp = (float) (xp / partySize * shareBonus);
|
||||||
|
|
||||||
for (Player member : nearMembers) {
|
for (Player member : nearMembers) {
|
||||||
|
@ -71,4 +71,10 @@ public interface Platform {
|
|||||||
* @return this platform's data folder
|
* @return this platform's data folder
|
||||||
*/
|
*/
|
||||||
File getDataFolderPath();
|
File getDataFolderPath();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the path of the mods config folder inside the Data folder for this platform
|
||||||
|
* @return this platform's mod config subdirectory
|
||||||
|
*/
|
||||||
|
String getModDataFolderPath();
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.core.runnables.backups;
|
package com.gmail.nossr50.core.runnables.backups;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
@ -48,10 +48,10 @@ public class CleanBackupsTask extends BukkitRunnable {
|
|||||||
int weekOfYear = cal.get(Calendar.WEEK_OF_YEAR);
|
int weekOfYear = cal.get(Calendar.WEEK_OF_YEAR);
|
||||||
int year = cal.get(Calendar.YEAR);
|
int year = cal.get(Calendar.YEAR);
|
||||||
|
|
||||||
if (isPast24Hours(date) && Config.getInstance().getKeepLast24Hours()) {
|
if (isPast24Hours(date) && MainConfig.getInstance().getKeepLast24Hours()) {
|
||||||
// Keep all files from the last 24 hours
|
// Keep all files from the last 24 hours
|
||||||
continue;
|
continue;
|
||||||
} else if (isLastWeek(date) && !savedDays.contains(dayOfWeek) && Config.getInstance().getKeepDailyLastWeek()) {
|
} else if (isLastWeek(date) && !savedDays.contains(dayOfWeek) && MainConfig.getInstance().getKeepDailyLastWeek()) {
|
||||||
// Keep daily backups of the past week
|
// Keep daily backups of the past week
|
||||||
savedDays.add(dayOfWeek);
|
savedDays.add(dayOfWeek);
|
||||||
continue;
|
continue;
|
||||||
@ -62,7 +62,7 @@ public class CleanBackupsTask extends BukkitRunnable {
|
|||||||
savedYearsWeeks.put(year, savedWeeks);
|
savedYearsWeeks.put(year, savedWeeks);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!savedWeeks.contains(weekOfYear) && Config.getInstance().getKeepWeeklyPastMonth()) {
|
if (!savedWeeks.contains(weekOfYear) && MainConfig.getInstance().getKeepWeeklyPastMonth()) {
|
||||||
// Keep one net.shatteredlands.shatt.backup of each week
|
// Keep one net.shatteredlands.shatt.backup of each week
|
||||||
savedWeeks.add(weekOfYear);
|
savedWeeks.add(weekOfYear);
|
||||||
continue;
|
continue;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.core.runnables.commands;
|
package com.gmail.nossr50.core.runnables.commands;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
@ -30,7 +30,7 @@ public class McrankCommandDisplayTask extends BukkitRunnable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (useBoard && Config.getInstance().getScoreboardsEnabled()) {
|
if (useBoard && MainConfig.getInstance().getScoreboardsEnabled()) {
|
||||||
displayBoard();
|
displayBoard();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.core.runnables.commands;
|
package com.gmail.nossr50.core.runnables.commands;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.datatypes.database.PlayerStat;
|
import com.gmail.nossr50.core.datatypes.database.PlayerStat;
|
||||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||||
@ -34,7 +34,7 @@ public class MctopCommandDisplayTask extends BukkitRunnable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (useBoard && Config.getInstance().getScoreboardsEnabled()) {
|
if (useBoard && MainConfig.getInstance().getScoreboardsEnabled()) {
|
||||||
displayBoard();
|
displayBoard();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.gmail.nossr50.core.runnables.database;
|
package com.gmail.nossr50.core.runnables.database;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.McmmoCore;
|
import com.gmail.nossr50.core.McmmoCore;
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
|
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
|
|
||||||
@ -13,7 +13,7 @@ public class UserPurgeTask implements Runnable {
|
|||||||
lock.lock();
|
lock.lock();
|
||||||
McmmoCore.getDatabaseManager().purgePowerlessUsers();
|
McmmoCore.getDatabaseManager().purgePowerlessUsers();
|
||||||
|
|
||||||
if (Config.getInstance().getOldUsersCutoff() != -1) {
|
if (MainConfig.getInstance().getOldUsersCutoff() != -1) {
|
||||||
McmmoCore.getDatabaseManager().purgeOldUsers();
|
McmmoCore.getDatabaseManager().purgeOldUsers();
|
||||||
}
|
}
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.core.runnables.items;
|
package com.gmail.nossr50.core.runnables.items;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.util.ChimaeraWing;
|
import com.gmail.nossr50.util.ChimaeraWing;
|
||||||
@ -36,13 +36,13 @@ public class ChimaeraWingWarmup extends BukkitRunnable {
|
|||||||
|
|
||||||
ItemStack inHand = player.getInventory().getItemInMainHand();
|
ItemStack inHand = player.getInventory().getItemInMainHand();
|
||||||
|
|
||||||
if (!ItemUtils.isChimaeraWing(inHand) || inHand.getAmount() < Config.getInstance().getChimaeraUseCost()) {
|
if (!ItemUtils.isChimaeraWing(inHand) || inHand.getAmount() < MainConfig.getInstance().getChimaeraUseCost()) {
|
||||||
player.sendMessage(LocaleLoader.getString("Skills.NeedMore", LocaleLoader.getString("Item.ChimaeraWing.Name")));
|
player.sendMessage(LocaleLoader.getString("Skills.NeedMore", LocaleLoader.getString("Item.ChimaeraWing.Name")));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
long recentlyHurt = mcMMOPlayer.getRecentlyHurt();
|
long recentlyHurt = mcMMOPlayer.getRecentlyHurt();
|
||||||
int hurtCooldown = Config.getInstance().getChimaeraRecentlyHurtCooldown();
|
int hurtCooldown = MainConfig.getInstance().getChimaeraRecentlyHurtCooldown();
|
||||||
|
|
||||||
if (hurtCooldown > 0) {
|
if (hurtCooldown > 0) {
|
||||||
int timeRemaining = SkillUtils.calculateTimeLeft(recentlyHurt * Misc.TIME_CONVERSION_FACTOR, hurtCooldown, player);
|
int timeRemaining = SkillUtils.calculateTimeLeft(recentlyHurt * Misc.TIME_CONVERSION_FACTOR, hurtCooldown, player);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.core.runnables.items;
|
package com.gmail.nossr50.core.runnables.items;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.party.PartyManager;
|
import com.gmail.nossr50.party.PartyManager;
|
||||||
@ -40,7 +40,7 @@ public class TeleportationWarmup extends BukkitRunnable {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int hurtCooldown = Config.getInstance().getPTPCommandRecentlyHurtCooldown();
|
int hurtCooldown = MainConfig.getInstance().getPTPCommandRecentlyHurtCooldown();
|
||||||
|
|
||||||
if (hurtCooldown > 0) {
|
if (hurtCooldown > 0) {
|
||||||
int timeRemaining = SkillUtils.calculateTimeLeft(recentlyHurt * Misc.TIME_CONVERSION_FACTOR, hurtCooldown, teleportingPlayer);
|
int timeRemaining = SkillUtils.calculateTimeLeft(recentlyHurt * Misc.TIME_CONVERSION_FACTOR, hurtCooldown, teleportingPlayer);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.core.runnables.party;
|
package com.gmail.nossr50.core.runnables.party;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.datatypes.party.Party;
|
import com.gmail.nossr50.core.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.party.PartyManager;
|
import com.gmail.nossr50.party.PartyManager;
|
||||||
@ -14,7 +14,7 @@ import java.util.Map.Entry;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class PartyAutoKickTask extends BukkitRunnable {
|
public class PartyAutoKickTask extends BukkitRunnable {
|
||||||
private final static long KICK_TIME = 24L * 60L * 60L * 1000L * Config.getInstance().getAutoPartyKickTime();
|
private final static long KICK_TIME = 24L * 60L * 60L * 1000L * MainConfig.getInstance().getAutoPartyKickTime();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.core.runnables.party;
|
package com.gmail.nossr50.core.runnables.party;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.datatypes.party.Party;
|
import com.gmail.nossr50.core.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -30,7 +30,7 @@ public class PartyChatTask extends BukkitRunnable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (Config.getInstance().getPartyChatColorLeaderName() && senderName.equalsIgnoreCase(party.getLeader().getPlayerName())) {
|
if (MainConfig.getInstance().getPartyChatColorLeaderName() && senderName.equalsIgnoreCase(party.getLeader().getPlayerName())) {
|
||||||
message = message.replaceFirst(Pattern.quote(displayName), ChatColor.GOLD + Matcher.quoteReplacement(displayName) + ChatColor.RESET);
|
message = message.replaceFirst(Pattern.quote(displayName), ChatColor.GOLD + Matcher.quoteReplacement(displayName) + ChatColor.RESET);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ public class PartyChatTask extends BukkitRunnable {
|
|||||||
|
|
||||||
if (party.getAlly() != null) {
|
if (party.getAlly() != null) {
|
||||||
for (Player member : party.getAlly().getOnlineMembers()) {
|
for (Player member : party.getAlly().getOnlineMembers()) {
|
||||||
String allyPrefix = LocaleLoader.formatString(Config.getInstance().getPartyChatPrefixAlly());
|
String allyPrefix = LocaleLoader.formatString(MainConfig.getInstance().getPartyChatPrefixAlly());
|
||||||
member.sendMessage(allyPrefix + message);
|
member.sendMessage(allyPrefix + message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.core.runnables.player;
|
package com.gmail.nossr50.core.runnables.player;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.data.UserManager;
|
import com.gmail.nossr50.core.data.UserManager;
|
||||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.core.datatypes.player.PlayerProfile;
|
import com.gmail.nossr50.core.datatypes.player.PlayerProfile;
|
||||||
@ -77,16 +77,16 @@ public class PlayerProfileLoadingTask extends BukkitRunnable {
|
|||||||
UserManager.track(mcMMOPlayer);
|
UserManager.track(mcMMOPlayer);
|
||||||
mcMMOPlayer.actualizeRespawnATS();
|
mcMMOPlayer.actualizeRespawnATS();
|
||||||
|
|
||||||
if (Config.getInstance().getScoreboardsEnabled()) {
|
if (MainConfig.getInstance().getScoreboardsEnabled()) {
|
||||||
ScoreboardManager.setupPlayer(player);
|
ScoreboardManager.setupPlayer(player);
|
||||||
|
|
||||||
if (Config.getInstance().getShowStatsAfterLogin()) {
|
if (MainConfig.getInstance().getShowStatsAfterLogin()) {
|
||||||
ScoreboardManager.enablePlayerStatsScoreboard(player);
|
ScoreboardManager.enablePlayerStatsScoreboard(player);
|
||||||
new McScoreboardKeepTask(player).runTaskLater(mcMMO.p, 1 * Misc.TICK_CONVERSION_FACTOR);
|
new McScoreboardKeepTask(player).runTaskLater(mcMMO.p, 1 * Misc.TICK_CONVERSION_FACTOR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getShowProfileLoadedMessage()) {
|
if (MainConfig.getInstance().getShowProfileLoadedMessage()) {
|
||||||
player.sendMessage(LocaleLoader.getString("Profile.Loading.Success"));
|
player.sendMessage(LocaleLoader.getString("Profile.Loading.Success"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.core.runnables.skills;
|
package com.gmail.nossr50.core.runnables.skills;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.datatypes.interactions.NotificationType;
|
import com.gmail.nossr50.core.datatypes.interactions.NotificationType;
|
||||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.core.skills.SuperAbilityType;
|
import com.gmail.nossr50.core.skills.SuperAbilityType;
|
||||||
@ -40,7 +40,7 @@ public class AbilityDisableTask extends BukkitRunnable {
|
|||||||
// Fallthrough
|
// Fallthrough
|
||||||
|
|
||||||
case BERSERK:
|
case BERSERK:
|
||||||
if (Config.getInstance().getRefreshChunksEnabled()) {
|
if (MainConfig.getInstance().getRefreshChunksEnabled()) {
|
||||||
resendChunkRadiusAt(player, 1);
|
resendChunkRadiusAt(player, 1);
|
||||||
}
|
}
|
||||||
// Fallthrough
|
// Fallthrough
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.core.runnables.skills;
|
package com.gmail.nossr50.core.runnables.skills;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.datatypes.interactions.NotificationType;
|
import com.gmail.nossr50.core.datatypes.interactions.NotificationType;
|
||||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.core.skills.ToolType;
|
import com.gmail.nossr50.core.skills.ToolType;
|
||||||
@ -24,7 +24,7 @@ public class ToolLowerTask extends BukkitRunnable {
|
|||||||
|
|
||||||
mcMMOPlayer.setToolPreparationMode(tool, false);
|
mcMMOPlayer.setToolPreparationMode(tool, false);
|
||||||
|
|
||||||
if (Config.getInstance().getAbilityMessagesEnabled()) {
|
if (MainConfig.getInstance().getAbilityMessagesEnabled()) {
|
||||||
NotificationManager.sendPlayerInformation(mcMMOPlayer.getPlayer(), NotificationType.TOOL, tool.getLowerTool());
|
NotificationManager.sendPlayerInformation(mcMMOPlayer.getPlayer(), NotificationType.TOOL, tool.getLowerTool());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.gmail.nossr50.core.skills;
|
package com.gmail.nossr50.core.skills;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.McmmoCore;
|
import com.gmail.nossr50.core.McmmoCore;
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.core.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.core.mcmmo.colors.Color;
|
import com.gmail.nossr50.core.mcmmo.colors.Color;
|
||||||
@ -104,7 +104,7 @@ public enum PrimarySkillType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static PrimarySkillType getSkill(String skillName) {
|
public static PrimarySkillType getSkill(String skillName) {
|
||||||
if (!Config.getInstance().getLocale().equalsIgnoreCase("en_US")) {
|
if (!MainConfig.getInstance().getLocale().equalsIgnoreCase("en_US")) {
|
||||||
for (PrimarySkillType type : values()) {
|
for (PrimarySkillType type : values()) {
|
||||||
if (skillName.equalsIgnoreCase(LocaleLoader.getString(StringUtils.getCapitalized(type.name()) + ".SkillName"))) {
|
if (skillName.equalsIgnoreCase(LocaleLoader.getString(StringUtils.getCapitalized(type.name()) + ".SkillName"))) {
|
||||||
return type;
|
return type;
|
||||||
@ -158,7 +158,7 @@ public enum PrimarySkillType {
|
|||||||
* @return the max level of this skill
|
* @return the max level of this skill
|
||||||
*/
|
*/
|
||||||
public int getMaxLevel() {
|
public int getMaxLevel() {
|
||||||
return Config.getInstance().getLevelCap(this);
|
return MainConfig.getInstance().getLevelCap(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSuperAbilityUnlocked(Player player) {
|
public boolean isSuperAbilityUnlocked(Player player) {
|
||||||
@ -166,31 +166,31 @@ public enum PrimarySkillType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean getPVPEnabled() {
|
public boolean getPVPEnabled() {
|
||||||
return Config.getInstance().getPVPEnabled(this);
|
return MainConfig.getInstance().getPVPEnabled(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getPVEEnabled() {
|
public boolean getPVEEnabled() {
|
||||||
return Config.getInstance().getPVEEnabled(this);
|
return MainConfig.getInstance().getPVEEnabled(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getDoubleDropsDisabled() {
|
public boolean getDoubleDropsDisabled() {
|
||||||
return Config.getInstance().getDoubleDropsDisabled(this);
|
return MainConfig.getInstance().getDoubleDropsDisabled(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getHardcoreStatLossEnabled() {
|
public boolean getHardcoreStatLossEnabled() {
|
||||||
return Config.getInstance().getHardcoreStatLossEnabled(this);
|
return MainConfig.getInstance().getHardcoreStatLossEnabled(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHardcoreStatLossEnabled(boolean enable) {
|
public void setHardcoreStatLossEnabled(boolean enable) {
|
||||||
Config.getInstance().setHardcoreStatLossEnabled(this, enable);
|
MainConfig.getInstance().setHardcoreStatLossEnabled(this, enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getHardcoreVampirismEnabled() {
|
public boolean getHardcoreVampirismEnabled() {
|
||||||
return Config.getInstance().getHardcoreVampirismEnabled(this);
|
return MainConfig.getInstance().getHardcoreVampirismEnabled(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHardcoreVampirismEnabled(boolean enable) {
|
public void setHardcoreVampirismEnabled(boolean enable) {
|
||||||
Config.getInstance().setHardcoreVampirismEnabled(this, enable);
|
MainConfig.getInstance().setHardcoreVampirismEnabled(this, enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ToolType getTool() {
|
public ToolType getTool() {
|
||||||
@ -218,7 +218,7 @@ public enum PrimarySkillType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return Config.getInstance().getLocale().equalsIgnoreCase("en_US") ? StringUtils.getCapitalized(this.toString()) : StringUtils.getCapitalized(LocaleLoader.getString(StringUtils.getCapitalized(this.toString()) + ".SkillName"));
|
return MainConfig.getInstance().getLocale().equalsIgnoreCase("en_US") ? StringUtils.getCapitalized(this.toString()) : StringUtils.getCapitalized(LocaleLoader.getString(StringUtils.getCapitalized(this.toString()) + ".SkillName"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getPermissions(Player player) {
|
public boolean getPermissions(Player player) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.core.skills;
|
package com.gmail.nossr50.core.skills;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.mcmmo.block.BlockState;
|
import com.gmail.nossr50.core.mcmmo.block.BlockState;
|
||||||
import com.gmail.nossr50.core.mcmmo.entity.Player;
|
import com.gmail.nossr50.core.mcmmo.entity.Player;
|
||||||
import com.gmail.nossr50.core.util.BlockUtils;
|
import com.gmail.nossr50.core.util.BlockUtils;
|
||||||
@ -99,11 +99,11 @@ public enum SuperAbilityType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getCooldown() {
|
public int getCooldown() {
|
||||||
return Config.getInstance().getCooldown(this);
|
return MainConfig.getInstance().getCooldown(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxLength() {
|
public int getMaxLength() {
|
||||||
return Config.getInstance().getMaxLength(this);
|
return MainConfig.getInstance().getMaxLength(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAbilityOn() {
|
public String getAbilityOn() {
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package com.gmail.nossr50.core.skills.child.salvage;
|
package com.gmail.nossr50.core.skills.child.salvage;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.AdvancedConfig;
|
import com.gmail.nossr50.core.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
|
||||||
public class Salvage {
|
public class Salvage {
|
||||||
public static Material anvilMaterial = Config.getInstance().getSalvageAnvilMaterial();
|
public static Material anvilMaterial = MainConfig.getInstance().getSalvageAnvilMaterial();
|
||||||
|
|
||||||
/*public static int salvageMaxPercentageLevel = AdvancedConfig.getInstance().getSalvageMaxPercentageLevel();
|
/*public static int salvageMaxPercentageLevel = AdvancedConfig.getInstance().getSalvageMaxPercentageLevel();
|
||||||
public static double salvageMaxPercentage = AdvancedConfig.getInstance().getSalvageMaxPercentage();
|
public static double salvageMaxPercentage = AdvancedConfig.getInstance().getSalvageMaxPercentage();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.gmail.nossr50.core.skills.child.salvage;
|
package com.gmail.nossr50.core.skills.child.salvage;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.AdvancedConfig;
|
import com.gmail.nossr50.core.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.datatypes.interactions.NotificationType;
|
import com.gmail.nossr50.core.datatypes.interactions.NotificationType;
|
||||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||||
@ -49,11 +49,11 @@ public class SalvageManager extends SkillManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getSalvageAnvilMessagesEnabled()) {
|
if (MainConfig.getInstance().getSalvageAnvilMessagesEnabled()) {
|
||||||
NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Salvage.Listener.Anvil");
|
NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Salvage.Listener.Anvil");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getSalvageAnvilPlaceSoundsEnabled()) {
|
if (MainConfig.getInstance().getSalvageAnvilPlaceSoundsEnabled()) {
|
||||||
SoundManager.sendSound(player, player.getLocation(), SoundType.ANVIL);
|
SoundManager.sendSound(player, player.getLocation(), SoundType.ANVIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,7 +130,7 @@ public class SalvageManager extends SkillManager {
|
|||||||
Misc.dropItems(location, salvageResults, 1);
|
Misc.dropItems(location, salvageResults, 1);
|
||||||
|
|
||||||
// BWONG BWONG BWONG - CLUNK!
|
// BWONG BWONG BWONG - CLUNK!
|
||||||
if (Config.getInstance().getSalvageAnvilUseSoundsEnabled()) {
|
if (MainConfig.getInstance().getSalvageAnvilUseSoundsEnabled()) {
|
||||||
SoundManager.sendSound(player, player.getLocation(), SoundType.ANVIL);
|
SoundManager.sendSound(player, player.getLocation(), SoundType.ANVIL);
|
||||||
SoundManager.sendSound(player, player.getLocation(), SoundType.ITEM_BREAK);
|
SoundManager.sendSound(player, player.getLocation(), SoundType.ITEM_BREAK);
|
||||||
|
|
||||||
@ -248,7 +248,7 @@ public class SalvageManager extends SkillManager {
|
|||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
long lastUse = getLastAnvilUse();
|
long lastUse = getLastAnvilUse();
|
||||||
|
|
||||||
if (!SkillUtils.cooldownExpired(lastUse, 3) || !Config.getInstance().getSalvageConfirmRequired()) {
|
if (!SkillUtils.cooldownExpired(lastUse, 3) || !MainConfig.getInstance().getSalvageConfirmRequired()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.core.skills.child.smelting;
|
package com.gmail.nossr50.core.skills.child.smelting;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.datatypes.experience.XPGainReason;
|
import com.gmail.nossr50.core.datatypes.experience.XPGainReason;
|
||||||
import com.gmail.nossr50.core.datatypes.experience.XPGainSource;
|
import com.gmail.nossr50.core.datatypes.experience.XPGainSource;
|
||||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||||
@ -79,13 +79,13 @@ public class SmeltingManager extends SkillManager {
|
|||||||
// We need to distribute Mining XP here, because the block break event gets cancelled
|
// We need to distribute Mining XP here, because the block break event gets cancelled
|
||||||
applyXpGain(Mining.getBlockXp(blockState), XPGainReason.PVE, XPGainSource.PASSIVE);
|
applyXpGain(Mining.getBlockXp(blockState), XPGainReason.PVE, XPGainSource.PASSIVE);
|
||||||
|
|
||||||
SkillUtils.handleDurabilityChange(getPlayer().getInventory().getItemInMainHand(), Config.getInstance().getAbilityToolDamage());
|
SkillUtils.handleDurabilityChange(getPlayer().getInventory().getItemInMainHand(), MainConfig.getInstance().getAbilityToolDamage());
|
||||||
|
|
||||||
Misc.dropItems(Misc.getBlockCenter(blockState), item, isSecondSmeltSuccessful() ? 2 : 1);
|
Misc.dropItems(Misc.getBlockCenter(blockState), item, isSecondSmeltSuccessful() ? 2 : 1);
|
||||||
|
|
||||||
blockState.setType(Material.AIR);
|
blockState.setType(Material.AIR);
|
||||||
|
|
||||||
if (Config.getInstance().getFluxPickaxeSoundEnabled()) {
|
if (MainConfig.getInstance().getFluxPickaxeSoundEnabled()) {
|
||||||
SoundManager.sendSound(player, blockState.getLocation(), SoundType.FIZZ);
|
SoundManager.sendSound(player, blockState.getLocation(), SoundType.FIZZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,12 +2,12 @@ package com.gmail.nossr50.core.skills.primary.acrobatics;
|
|||||||
|
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.core.config.AdvancedConfig;
|
import com.gmail.nossr50.core.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
|
|
||||||
public final class Acrobatics {
|
public final class Acrobatics {
|
||||||
public static double dodgeDamageModifier = AdvancedConfig.getInstance().getDodgeDamageModifier();
|
public static double dodgeDamageModifier = AdvancedConfig.getInstance().getDodgeDamageModifier();
|
||||||
public static int dodgeXpModifier = ExperienceConfig.getInstance().getDodgeXPModifier();
|
public static int dodgeXpModifier = ExperienceConfig.getInstance().getDodgeXPModifier();
|
||||||
public static boolean dodgeLightningDisabled = Config.getInstance().getDodgeLightningDisabled();
|
public static boolean dodgeLightningDisabled = MainConfig.getInstance().getDodgeLightningDisabled();
|
||||||
|
|
||||||
private Acrobatics() {
|
private Acrobatics() {
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.core.skills.primary.excavation;
|
package com.gmail.nossr50.core.skills.primary.excavation;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.datatypes.experience.XPGainReason;
|
import com.gmail.nossr50.core.datatypes.experience.XPGainReason;
|
||||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||||
@ -77,6 +77,6 @@ public class ExcavationManager extends SkillManager {
|
|||||||
excavationBlockCheck(blockState);
|
excavationBlockCheck(blockState);
|
||||||
excavationBlockCheck(blockState);
|
excavationBlockCheck(blockState);
|
||||||
|
|
||||||
SkillUtils.handleDurabilityChange(getPlayer().getInventory().getItemInMainHand(), Config.getInstance().getAbilityToolDamage());
|
SkillUtils.handleDurabilityChange(getPlayer().getInventory().getItemInMainHand(), MainConfig.getInstance().getAbilityToolDamage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.gmail.nossr50.core.skills.primary.fishing;
|
|||||||
|
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.core.config.AdvancedConfig;
|
import com.gmail.nossr50.core.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.config.treasure.TreasureConfig;
|
import com.gmail.nossr50.core.config.treasure.TreasureConfig;
|
||||||
import com.gmail.nossr50.core.datatypes.experience.XPGainReason;
|
import com.gmail.nossr50.core.datatypes.experience.XPGainReason;
|
||||||
import com.gmail.nossr50.core.datatypes.interactions.NotificationType;
|
import com.gmail.nossr50.core.datatypes.interactions.NotificationType;
|
||||||
@ -197,7 +197,7 @@ public class FishingManager extends SkillManager {
|
|||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
FishingTreasure treasure = null;
|
FishingTreasure treasure = null;
|
||||||
|
|
||||||
if (Config.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;
|
this.fishingCatch = null;
|
||||||
}
|
}
|
||||||
@ -234,7 +234,7 @@ public class FishingManager extends SkillManager {
|
|||||||
NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Fishing.Ability.TH.MagicFound");
|
NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Fishing.Ability.TH.MagicFound");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getFishingExtraFish()) {
|
if (MainConfig.getInstance().getFishingExtraFish()) {
|
||||||
Misc.dropItem(player.getEyeLocation(), fishingCatch.getItemStack());
|
Misc.dropItem(player.getEyeLocation(), fishingCatch.getItemStack());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -364,7 +364,7 @@ public class FishingManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Rather than subtracting luck (and causing a minimum 3% chance for every drop), scale by luck.
|
// Rather than subtracting luck (and causing a minimum 3% chance for every drop), scale by luck.
|
||||||
diceRoll *= (1.0 - luck * Config.getInstance().getFishingLureModifier() / 100);
|
diceRoll *= (1.0 - luck * MainConfig.getInstance().getFishingLureModifier() / 100);
|
||||||
|
|
||||||
FishingTreasure treasure = null;
|
FishingTreasure treasure = null;
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.gmail.nossr50.core.skills.primary.herbalism;
|
package com.gmail.nossr50.core.skills.primary.herbalism;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.config.treasure.TreasureConfig;
|
import com.gmail.nossr50.core.config.treasure.TreasureConfig;
|
||||||
import com.gmail.nossr50.core.datatypes.experience.XPGainReason;
|
import com.gmail.nossr50.core.datatypes.experience.XPGainReason;
|
||||||
import com.gmail.nossr50.core.datatypes.interactions.NotificationType;
|
import com.gmail.nossr50.core.datatypes.interactions.NotificationType;
|
||||||
@ -36,7 +36,7 @@ public class HerbalismManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean canBlockCheck() {
|
public boolean canBlockCheck() {
|
||||||
return !(Config.getInstance().getHerbalismPreventAFK() && getPlayer().isInsideVehicle());
|
return !(MainConfig.getInstance().getHerbalismPreventAFK() && getPlayer().isInsideVehicle());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canGreenThumbBlock(BlockState blockState) {
|
public boolean canGreenThumbBlock(BlockState blockState) {
|
||||||
@ -148,7 +148,7 @@ public class HerbalismManager extends SkillManager {
|
|||||||
} else {
|
} else {
|
||||||
xp = ExperienceConfig.getInstance().getXp(skill, blockState.getBlockData());
|
xp = ExperienceConfig.getInstance().getXp(skill, blockState.getBlockData());
|
||||||
|
|
||||||
if (Config.getInstance().getDoubleDropsEnabled(skill, material) && Permissions.isSubSkillEnabled(player, SubSkillType.HERBALISM_DOUBLE_DROPS)) {
|
if (MainConfig.getInstance().getDoubleDropsEnabled(skill, material) && Permissions.isSubSkillEnabled(player, SubSkillType.HERBALISM_DOUBLE_DROPS)) {
|
||||||
drops = blockState.getBlock().getDrops();
|
drops = blockState.getBlock().getDrops();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.gmail.nossr50.core.skills.primary.mining;
|
package com.gmail.nossr50.core.skills.primary.mining;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.AdvancedConfig;
|
import com.gmail.nossr50.core.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.data.UserManager;
|
import com.gmail.nossr50.core.data.UserManager;
|
||||||
import com.gmail.nossr50.core.skills.SubSkillType;
|
import com.gmail.nossr50.core.skills.SubSkillType;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
@ -42,7 +42,7 @@ public class BlastMining {
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
public final static int MAXIMUM_REMOTE_DETONATION_DISTANCE = 100;
|
public final static int MAXIMUM_REMOTE_DETONATION_DISTANCE = 100;
|
||||||
public static Material detonator = Config.getInstance().getDetonatorItem();
|
public static Material detonator = MainConfig.getInstance().getDetonatorItem();
|
||||||
|
|
||||||
public static double getBlastRadiusModifier(int rank) {
|
public static double getBlastRadiusModifier(int rank) {
|
||||||
return AdvancedConfig.getInstance().getBlastRadiusModifier(rank);
|
return AdvancedConfig.getInstance().getBlastRadiusModifier(rank);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.gmail.nossr50.core.skills.primary.mining;
|
package com.gmail.nossr50.core.skills.primary.mining;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.AdvancedConfig;
|
import com.gmail.nossr50.core.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.datatypes.experience.XPGainReason;
|
import com.gmail.nossr50.core.datatypes.experience.XPGainReason;
|
||||||
import com.gmail.nossr50.core.datatypes.interactions.NotificationType;
|
import com.gmail.nossr50.core.datatypes.interactions.NotificationType;
|
||||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||||
@ -85,10 +85,10 @@ public class MiningManager extends SkillManager {
|
|||||||
Material material = blockState.getType();
|
Material material = blockState.getType();
|
||||||
|
|
||||||
if (mcMMOPlayer.getAbilityMode(skill.getAbility())) {
|
if (mcMMOPlayer.getAbilityMode(skill.getAbility())) {
|
||||||
SkillUtils.handleDurabilityChange(getPlayer().getInventory().getItemInMainHand(), Config.getInstance().getAbilityToolDamage());
|
SkillUtils.handleDurabilityChange(getPlayer().getInventory().getItemInMainHand(), MainConfig.getInstance().getAbilityToolDamage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((mcMMO.getModManager().isCustomMiningBlock(blockState) && !mcMMO.getModManager().getBlock(blockState).isDoubleDropEnabled()) || !Config.getInstance().getDoubleDropsEnabled(skill, material)) {
|
if ((mcMMO.getModManager().isCustomMiningBlock(blockState) && !mcMMO.getModManager().getBlock(blockState).isDoubleDropEnabled()) || !MainConfig.getInstance().getDoubleDropsEnabled(skill, material)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package com.gmail.nossr50.core.skills.primary.repair;
|
package com.gmail.nossr50.core.skills.primary.repair;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.AdvancedConfig;
|
import com.gmail.nossr50.core.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
|
||||||
public class Repair {
|
public class Repair {
|
||||||
public static int repairMasteryMaxBonusLevel = AdvancedConfig.getInstance().getRepairMasteryMaxLevel();
|
public static int repairMasteryMaxBonusLevel = AdvancedConfig.getInstance().getRepairMasteryMaxLevel();
|
||||||
public static double repairMasteryMaxBonus = AdvancedConfig.getInstance().getRepairMasteryMaxBonus();
|
public static double repairMasteryMaxBonus = AdvancedConfig.getInstance().getRepairMasteryMaxBonus();
|
||||||
|
|
||||||
public static Material anvilMaterial = Config.getInstance().getRepairAnvilMaterial();
|
public static Material anvilMaterial = MainConfig.getInstance().getRepairAnvilMaterial();
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.gmail.nossr50.core.skills.primary.repair;
|
|||||||
|
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.core.config.AdvancedConfig;
|
import com.gmail.nossr50.core.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.datatypes.experience.XPGainReason;
|
import com.gmail.nossr50.core.datatypes.experience.XPGainReason;
|
||||||
import com.gmail.nossr50.core.datatypes.interactions.NotificationType;
|
import com.gmail.nossr50.core.datatypes.interactions.NotificationType;
|
||||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||||
@ -51,11 +51,11 @@ public class RepairManager extends SkillManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getRepairAnvilMessagesEnabled()) {
|
if (MainConfig.getInstance().getRepairAnvilMessagesEnabled()) {
|
||||||
NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Repair.Listener.Anvil");
|
NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Repair.Listener.Anvil");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getRepairAnvilPlaceSoundsEnabled()) {
|
if (MainConfig.getInstance().getRepairAnvilPlaceSoundsEnabled()) {
|
||||||
SoundManager.sendSound(player, player.getLocation(), SoundType.ANVIL);
|
SoundManager.sendSound(player, player.getLocation(), SoundType.ANVIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,7 +155,7 @@ public class RepairManager extends SkillManager {
|
|||||||
applyXpGain((float) ((getPercentageRepaired(startDurability, newDurability, repairable.getMaximumDurability()) * repairable.getXpMultiplier()) * ExperienceConfig.getInstance().getRepairXPBase() * ExperienceConfig.getInstance().getRepairXP(repairable.getRepairMaterialType())), XPGainReason.PVE);
|
applyXpGain((float) ((getPercentageRepaired(startDurability, newDurability, repairable.getMaximumDurability()) * repairable.getXpMultiplier()) * ExperienceConfig.getInstance().getRepairXPBase() * ExperienceConfig.getInstance().getRepairXP(repairable.getRepairMaterialType())), XPGainReason.PVE);
|
||||||
|
|
||||||
// BWONG BWONG BWONG
|
// BWONG BWONG BWONG
|
||||||
if (Config.getInstance().getRepairAnvilUseSoundsEnabled()) {
|
if (MainConfig.getInstance().getRepairAnvilUseSoundsEnabled()) {
|
||||||
SoundManager.sendSound(player, player.getLocation(), SoundType.ANVIL);
|
SoundManager.sendSound(player, player.getLocation(), SoundType.ANVIL);
|
||||||
SoundManager.sendSound(player, player.getLocation(), SoundType.ITEM_BREAK);
|
SoundManager.sendSound(player, player.getLocation(), SoundType.ITEM_BREAK);
|
||||||
}
|
}
|
||||||
@ -177,7 +177,7 @@ public class RepairManager extends SkillManager {
|
|||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
long lastUse = getLastAnvilUse();
|
long lastUse = getLastAnvilUse();
|
||||||
|
|
||||||
if (!SkillUtils.cooldownExpired(lastUse, 3) || !Config.getInstance().getRepairConfirmRequired()) {
|
if (!SkillUtils.cooldownExpired(lastUse, 3) || !MainConfig.getInstance().getRepairConfirmRequired()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ package com.gmail.nossr50.core.skills.primary.taming;
|
|||||||
|
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.core.config.AdvancedConfig;
|
import com.gmail.nossr50.core.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.data.UserManager;
|
import com.gmail.nossr50.core.data.UserManager;
|
||||||
import com.gmail.nossr50.core.datatypes.experience.XPGainReason;
|
import com.gmail.nossr50.core.datatypes.experience.XPGainReason;
|
||||||
import com.gmail.nossr50.core.datatypes.interactions.NotificationType;
|
import com.gmail.nossr50.core.datatypes.interactions.NotificationType;
|
||||||
@ -168,7 +168,7 @@ public class TamingManager extends SkillManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
callOfTheWild(EntityType.OCELOT, Config.getInstance().getTamingCOTWCost(EntityType.OCELOT));
|
callOfTheWild(EntityType.OCELOT, MainConfig.getInstance().getTamingCOTWCost(EntityType.OCELOT));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -182,7 +182,7 @@ public class TamingManager extends SkillManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
callOfTheWild(EntityType.WOLF, Config.getInstance().getTamingCOTWCost(EntityType.WOLF));
|
callOfTheWild(EntityType.WOLF, MainConfig.getInstance().getTamingCOTWCost(EntityType.WOLF));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -196,7 +196,7 @@ public class TamingManager extends SkillManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
callOfTheWild(EntityType.HORSE, Config.getInstance().getTamingCOTWCost(EntityType.HORSE));
|
callOfTheWild(EntityType.HORSE, MainConfig.getInstance().getTamingCOTWCost(EntityType.HORSE));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -290,8 +290,8 @@ public class TamingManager extends SkillManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int amount = Config.getInstance().getTamingCOTWAmount(type);
|
int amount = MainConfig.getInstance().getTamingCOTWAmount(type);
|
||||||
int tamingCOTWLength = Config.getInstance().getTamingCOTWLength(type);
|
int tamingCOTWLength = MainConfig.getInstance().getTamingCOTWLength(type);
|
||||||
|
|
||||||
for (int i = 0; i < amount; i++) {
|
for (int i = 0; i < amount; i++) {
|
||||||
if (!summonAmountCheck(type)) {
|
if (!summonAmountCheck(type)) {
|
||||||
@ -360,7 +360,7 @@ public class TamingManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean rangeCheck(EntityType type) {
|
private boolean rangeCheck(EntityType type) {
|
||||||
double range = Config.getInstance().getTamingCOTWRange();
|
double range = MainConfig.getInstance().getTamingCOTWRange();
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
|
|
||||||
if (range == 0) {
|
if (range == 0) {
|
||||||
@ -380,7 +380,7 @@ public class TamingManager extends SkillManager {
|
|||||||
private boolean summonAmountCheck(EntityType entityType) {
|
private boolean summonAmountCheck(EntityType entityType) {
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
|
|
||||||
int maxAmountSummons = Config.getInstance().getTamingCOTWMaxAmount(entityType);
|
int maxAmountSummons = MainConfig.getInstance().getTamingCOTWMaxAmount(entityType);
|
||||||
|
|
||||||
if (maxAmountSummons <= 0) {
|
if (maxAmountSummons <= 0) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.core.skills.primary.taming;
|
package com.gmail.nossr50.core.skills.primary.taming;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||||
@ -22,7 +22,7 @@ public class TrackedTamingEntity extends BukkitRunnable {
|
|||||||
this.livingEntity = livingEntity;
|
this.livingEntity = livingEntity;
|
||||||
this.id = livingEntity.getUniqueId();
|
this.id = livingEntity.getUniqueId();
|
||||||
|
|
||||||
int tamingCOTWLength = Config.getInstance().getTamingCOTWLength(livingEntity.getType());
|
int tamingCOTWLength = MainConfig.getInstance().getTamingCOTWLength(livingEntity.getType());
|
||||||
|
|
||||||
if (tamingCOTWLength > 0) {
|
if (tamingCOTWLength > 0) {
|
||||||
this.length = tamingCOTWLength * Misc.TICK_CONVERSION_FACTOR;
|
this.length = tamingCOTWLength * Misc.TICK_CONVERSION_FACTOR;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.core.skills.primary.unarmed;
|
package com.gmail.nossr50.core.skills.primary.unarmed;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||||
import com.gmail.nossr50.util.sounds.SoundType;
|
import com.gmail.nossr50.util.sounds.SoundType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -8,7 +8,7 @@ import org.bukkit.event.entity.EntityPickupItemEvent;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class Unarmed {
|
public class Unarmed {
|
||||||
public static boolean blockCrackerSmoothBrick = Config.getInstance().getUnarmedBlockCrackerSmoothbrickToCracked();
|
public static boolean blockCrackerSmoothBrick = MainConfig.getInstance().getUnarmedBlockCrackerSmoothbrickToCracked();
|
||||||
public static double berserkDamageModifier = 1.5;
|
public static double berserkDamageModifier = 1.5;
|
||||||
public static long lastAttacked = 0;
|
public static long lastAttacked = 0;
|
||||||
public static long attackInterval = 750;
|
public static long attackInterval = 750;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.gmail.nossr50.core.skills.primary.woodcutting;
|
package com.gmail.nossr50.core.skills.primary.woodcutting;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.BlockUtils;
|
import com.gmail.nossr50.util.BlockUtils;
|
||||||
@ -28,7 +28,7 @@ public final class Woodcutting {
|
|||||||
new int[]{1, -2}, new int[]{1, -1}, new int[]{1, 0}, new int[]{1, 1}, new int[]{1, 2},
|
new int[]{1, -2}, new int[]{1, -1}, new int[]{1, 0}, new int[]{1, 1}, new int[]{1, 2},
|
||||||
new int[]{2, -1}, new int[]{2, 0}, new int[]{2, 1},
|
new int[]{2, -1}, new int[]{2, 0}, new int[]{2, 1},
|
||||||
};
|
};
|
||||||
public static int treeFellerThreshold = Config.getInstance().getTreeFellerThreshold();
|
public static int treeFellerThreshold = MainConfig.getInstance().getTreeFellerThreshold();
|
||||||
protected static boolean treeFellerReachedThreshold = false;
|
protected static boolean treeFellerReachedThreshold = false;
|
||||||
|
|
||||||
private Woodcutting() {
|
private Woodcutting() {
|
||||||
@ -58,7 +58,7 @@ public final class Woodcutting {
|
|||||||
if (mcMMO.getModManager().isCustomLog(blockState) && mcMMO.getModManager().getBlock(blockState).isDoubleDropEnabled()) {
|
if (mcMMO.getModManager().isCustomLog(blockState) && mcMMO.getModManager().getBlock(blockState).isDoubleDropEnabled()) {
|
||||||
Misc.dropItems(Misc.getBlockCenter(blockState), blockState.getBlock().getDrops());
|
Misc.dropItems(Misc.getBlockCenter(blockState), blockState.getBlock().getDrops());
|
||||||
} else {
|
} else {
|
||||||
if (Config.getInstance().getWoodcuttingDoubleDropsEnabled(blockState.getBlockData())) {
|
if (MainConfig.getInstance().getWoodcuttingDoubleDropsEnabled(blockState.getBlockData())) {
|
||||||
Misc.dropItems(Misc.getBlockCenter(blockState), blockState.getBlock().getDrops());
|
Misc.dropItems(Misc.getBlockCenter(blockState), blockState.getBlock().getDrops());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -143,7 +143,7 @@ public final class Woodcutting {
|
|||||||
|
|
||||||
for (BlockState blockState : treeFellerBlocks) {
|
for (BlockState blockState : treeFellerBlocks) {
|
||||||
if (BlockUtils.isLog(blockState)) {
|
if (BlockUtils.isLog(blockState)) {
|
||||||
durabilityLoss += Config.getInstance().getAbilityToolDamage();
|
durabilityLoss += MainConfig.getInstance().getAbilityToolDamage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ package com.gmail.nossr50.core.skills.subskills.acrobatics;
|
|||||||
|
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.core.config.AdvancedConfig;
|
import com.gmail.nossr50.core.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.data.UserManager;
|
import com.gmail.nossr50.core.data.UserManager;
|
||||||
import com.gmail.nossr50.core.datatypes.LimitedSizeList;
|
import com.gmail.nossr50.core.datatypes.LimitedSizeList;
|
||||||
import com.gmail.nossr50.core.datatypes.experience.XPGainReason;
|
import com.gmail.nossr50.core.datatypes.experience.XPGainReason;
|
||||||
@ -212,7 +212,7 @@ public class Roll extends AcrobaticsSubSkill {
|
|||||||
SoundManager.sendCategorizedSound(player, player.getLocation(), SoundType.ROLL_ACTIVATED, SoundCategory.PLAYERS);
|
SoundManager.sendCategorizedSound(player, player.getLocation(), SoundType.ROLL_ACTIVATED, SoundCategory.PLAYERS);
|
||||||
//player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.Text"));
|
//player.sendMessage(LocaleLoader.getString("Acrobatics.Roll.Text"));
|
||||||
|
|
||||||
//if (!SkillUtils.cooldownExpired((long) mcMMOPlayer.getTeleportATS(), Config.getInstance().getXPAfterTeleportCooldown())) {
|
//if (!SkillUtils.cooldownExpired((long) mcMMOPlayer.getTeleportATS(), MainConfig.getInstance().getXPAfterTeleportCooldown())) {
|
||||||
if (!isExploiting(player))
|
if (!isExploiting(player))
|
||||||
SkillUtils.applyXpGain(mcMMOPlayer, getPrimarySkill(), calculateRollXP(player, damage, true), XPGainReason.PVE);
|
SkillUtils.applyXpGain(mcMMOPlayer, getPrimarySkill(), calculateRollXP(player, damage, true), XPGainReason.PVE);
|
||||||
//}
|
//}
|
||||||
@ -220,7 +220,7 @@ public class Roll extends AcrobaticsSubSkill {
|
|||||||
addFallLocation(player);
|
addFallLocation(player);
|
||||||
return modifiedDamage;
|
return modifiedDamage;
|
||||||
} else if (!isFatal(player, damage)) {
|
} else if (!isFatal(player, damage)) {
|
||||||
//if (!SkillUtils.cooldownExpired((long) mcMMOPlayer.getTeleportATS(), Config.getInstance().getXPAfterTeleportCooldown())) {
|
//if (!SkillUtils.cooldownExpired((long) mcMMOPlayer.getTeleportATS(), MainConfig.getInstance().getXPAfterTeleportCooldown())) {
|
||||||
if (!isExploiting(player))
|
if (!isExploiting(player))
|
||||||
SkillUtils.applyXpGain(mcMMOPlayer, getPrimarySkill(), calculateRollXP(player, damage, false), XPGainReason.PVE);
|
SkillUtils.applyXpGain(mcMMOPlayer, getPrimarySkill(), calculateRollXP(player, damage, false), XPGainReason.PVE);
|
||||||
//}
|
//}
|
||||||
@ -272,7 +272,7 @@ public class Roll extends AcrobaticsSubSkill {
|
|||||||
* @return true if exploits are detected, false otherwise
|
* @return true if exploits are detected, false otherwise
|
||||||
*/
|
*/
|
||||||
private boolean isExploiting(Player player) {
|
private boolean isExploiting(Player player) {
|
||||||
if (!Config.getInstance().getAcrobaticsPreventAFK()) {
|
if (!MainConfig.getInstance().getAcrobaticsPreventAFK()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -291,7 +291,7 @@ public class Roll extends AcrobaticsSubSkill {
|
|||||||
return false; //NOT EXPLOITING
|
return false; //NOT EXPLOITING
|
||||||
/*
|
/*
|
||||||
Location fallLocation = player.getLocation();
|
Location fallLocation = player.getLocation();
|
||||||
int maxTries = Config.getInstance().getAcrobaticsAFKMaxTries();
|
int maxTries = MainConfig.getInstance().getAcrobaticsAFKMaxTries();
|
||||||
|
|
||||||
boolean sameLocation = (lastFallLocation != null && Misc.isNear(lastFallLocation, fallLocation, 2));
|
boolean sameLocation = (lastFallLocation != null && Misc.isNear(lastFallLocation, fallLocation, 2));
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.core.skills.treasure;
|
package com.gmail.nossr50.core.skills.treasure;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public abstract class Treasure {
|
public abstract class Treasure {
|
||||||
@ -42,7 +42,7 @@ public abstract class Treasure {
|
|||||||
|
|
||||||
public int getDropLevel() {
|
public int getDropLevel() {
|
||||||
//If they are in retro mode all requirements are scaled up by 10
|
//If they are in retro mode all requirements are scaled up by 10
|
||||||
if (Config.getInstance().getIsRetroMode())
|
if (MainConfig.getInstance().getIsRetroMode())
|
||||||
return dropLevel * 10;
|
return dropLevel * 10;
|
||||||
|
|
||||||
return dropLevel;
|
return dropLevel;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.core.util;
|
package com.gmail.nossr50.core.util;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.data.UserManager;
|
import com.gmail.nossr50.core.data.UserManager;
|
||||||
import com.gmail.nossr50.core.datatypes.interactions.NotificationType;
|
import com.gmail.nossr50.core.datatypes.interactions.NotificationType;
|
||||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||||
@ -38,7 +38,7 @@ public final class ChimaeraWing {
|
|||||||
* @param player Player whose item usage to check
|
* @param player Player whose item usage to check
|
||||||
*/
|
*/
|
||||||
public static void activationCheck(Player player) {
|
public static void activationCheck(Player player) {
|
||||||
if (!Config.getInstance().getChimaeraEnabled()) {
|
if (!MainConfig.getInstance().getChimaeraEnabled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,13 +61,13 @@ public final class ChimaeraWing {
|
|||||||
|
|
||||||
int amount = inHand.getAmount();
|
int amount = inHand.getAmount();
|
||||||
|
|
||||||
if (amount < Config.getInstance().getChimaeraUseCost()) {
|
if (amount < MainConfig.getInstance().getChimaeraUseCost()) {
|
||||||
NotificationManager.sendPlayerInformation(player, NotificationType.REQUIREMENTS_NOT_MET, "Item.ChimaeraWing.NotEnough", String.valueOf(Config.getInstance().getChimaeraUseCost() - amount), "Item.ChimaeraWing.Name");
|
NotificationManager.sendPlayerInformation(player, NotificationType.REQUIREMENTS_NOT_MET, "Item.ChimaeraWing.NotEnough", String.valueOf(MainConfig.getInstance().getChimaeraUseCost() - amount), "Item.ChimaeraWing.Name");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
long lastTeleport = mcMMOPlayer.getChimeraWingLastUse();
|
long lastTeleport = mcMMOPlayer.getChimeraWingLastUse();
|
||||||
int cooldown = Config.getInstance().getChimaeraCooldown();
|
int cooldown = MainConfig.getInstance().getChimaeraCooldown();
|
||||||
|
|
||||||
if (cooldown > 0) {
|
if (cooldown > 0) {
|
||||||
int timeRemaining = SkillUtils.calculateTimeLeft(lastTeleport * Misc.TIME_CONVERSION_FACTOR, cooldown, player);
|
int timeRemaining = SkillUtils.calculateTimeLeft(lastTeleport * Misc.TIME_CONVERSION_FACTOR, cooldown, player);
|
||||||
@ -79,7 +79,7 @@ public final class ChimaeraWing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
long recentlyHurt = mcMMOPlayer.getRecentlyHurt();
|
long recentlyHurt = mcMMOPlayer.getRecentlyHurt();
|
||||||
int hurtCooldown = Config.getInstance().getChimaeraRecentlyHurtCooldown();
|
int hurtCooldown = MainConfig.getInstance().getChimaeraRecentlyHurtCooldown();
|
||||||
|
|
||||||
if (hurtCooldown > 0) {
|
if (hurtCooldown > 0) {
|
||||||
int timeRemaining = SkillUtils.calculateTimeLeft(recentlyHurt * Misc.TIME_CONVERSION_FACTOR, hurtCooldown, player);
|
int timeRemaining = SkillUtils.calculateTimeLeft(recentlyHurt * Misc.TIME_CONVERSION_FACTOR, hurtCooldown, player);
|
||||||
@ -92,9 +92,9 @@ public final class ChimaeraWing {
|
|||||||
|
|
||||||
location = player.getLocation();
|
location = player.getLocation();
|
||||||
|
|
||||||
if (Config.getInstance().getChimaeraPreventUseUnderground()) {
|
if (MainConfig.getInstance().getChimaeraPreventUseUnderground()) {
|
||||||
if (location.getY() < player.getWorld().getHighestBlockYAt(location)) {
|
if (location.getY() < player.getWorld().getHighestBlockYAt(location)) {
|
||||||
player.getInventory().setItemInMainHand(new ItemStack(getChimaeraWing(amount - Config.getInstance().getChimaeraUseCost())));
|
player.getInventory().setItemInMainHand(new ItemStack(getChimaeraWing(amount - MainConfig.getInstance().getChimaeraUseCost())));
|
||||||
NotificationManager.sendPlayerInformation(player, NotificationType.REQUIREMENTS_NOT_MET, "Item.ChimaeraWing.Fail");
|
NotificationManager.sendPlayerInformation(player, NotificationType.REQUIREMENTS_NOT_MET, "Item.ChimaeraWing.Fail");
|
||||||
player.updateInventory();
|
player.updateInventory();
|
||||||
player.setVelocity(new Vector(0, 0.5D, 0));
|
player.setVelocity(new Vector(0, 0.5D, 0));
|
||||||
@ -106,7 +106,7 @@ public final class ChimaeraWing {
|
|||||||
|
|
||||||
mcMMOPlayer.actualizeTeleportCommenceLocation(player);
|
mcMMOPlayer.actualizeTeleportCommenceLocation(player);
|
||||||
|
|
||||||
long warmup = Config.getInstance().getChimaeraWarmup();
|
long warmup = MainConfig.getInstance().getChimaeraWarmup();
|
||||||
|
|
||||||
if (warmup > 0) {
|
if (warmup > 0) {
|
||||||
NotificationManager.sendPlayerInformation(player, NotificationType.ITEM_MESSAGE, "Teleport.Commencing", String.valueOf(warmup));
|
NotificationManager.sendPlayerInformation(player, NotificationType.ITEM_MESSAGE, "Teleport.Commencing", String.valueOf(warmup));
|
||||||
@ -119,7 +119,7 @@ public final class ChimaeraWing {
|
|||||||
public static void chimaeraExecuteTeleport() {
|
public static void chimaeraExecuteTeleport() {
|
||||||
Player player = mcMMOPlayer.getPlayer();
|
Player player = mcMMOPlayer.getPlayer();
|
||||||
|
|
||||||
if (Config.getInstance().getChimaeraUseBedSpawn() && player.getBedSpawnLocation() != null) {
|
if (MainConfig.getInstance().getChimaeraUseBedSpawn() && player.getBedSpawnLocation() != null) {
|
||||||
player.teleport(player.getBedSpawnLocation());
|
player.teleport(player.getBedSpawnLocation());
|
||||||
} else {
|
} else {
|
||||||
Location spawnLocation = player.getWorld().getSpawnLocation();
|
Location spawnLocation = player.getWorld().getSpawnLocation();
|
||||||
@ -130,12 +130,12 @@ public final class ChimaeraWing {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
player.getInventory().setItemInMainHand(new ItemStack(getChimaeraWing(player.getInventory().getItemInMainHand().getAmount() - Config.getInstance().getChimaeraUseCost())));
|
player.getInventory().setItemInMainHand(new ItemStack(getChimaeraWing(player.getInventory().getItemInMainHand().getAmount() - MainConfig.getInstance().getChimaeraUseCost())));
|
||||||
player.updateInventory();
|
player.updateInventory();
|
||||||
mcMMOPlayer.actualizeChimeraWingLastUse();
|
mcMMOPlayer.actualizeChimeraWingLastUse();
|
||||||
mcMMOPlayer.setTeleportCommenceLocation(null);
|
mcMMOPlayer.setTeleportCommenceLocation(null);
|
||||||
|
|
||||||
if (Config.getInstance().getChimaeraSoundEnabled()) {
|
if (MainConfig.getInstance().getChimaeraSoundEnabled()) {
|
||||||
SoundManager.sendSound(player, location, SoundType.CHIMAERA_WING);
|
SoundManager.sendSound(player, location, SoundType.CHIMAERA_WING);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,7 +143,7 @@ public final class ChimaeraWing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack getChimaeraWing(int amount) {
|
public static ItemStack getChimaeraWing(int amount) {
|
||||||
ItemStack itemStack = new ItemStack(Config.getInstance().getChimaeraItem(), amount);
|
ItemStack itemStack = new ItemStack(MainConfig.getInstance().getChimaeraItem(), amount);
|
||||||
|
|
||||||
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"));
|
||||||
@ -158,8 +158,8 @@ public final class ChimaeraWing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static ShapelessRecipe getChimaeraWingRecipe() {
|
public static ShapelessRecipe getChimaeraWingRecipe() {
|
||||||
Material ingredient = Config.getInstance().getChimaeraItem();
|
Material ingredient = MainConfig.getInstance().getChimaeraItem();
|
||||||
int amount = Config.getInstance().getChimaeraRecipeCost();
|
int amount = MainConfig.getInstance().getChimaeraRecipeCost();
|
||||||
|
|
||||||
ShapelessRecipe chimeraWing = new ShapelessRecipe(new NamespacedKey(mcMMO.p, "Chimera"), getChimaeraWing(1));
|
ShapelessRecipe chimeraWing = new ShapelessRecipe(new NamespacedKey(mcMMO.p, "Chimera"), getChimaeraWing(1));
|
||||||
chimeraWing.addIngredient(amount, ingredient);
|
chimeraWing.addIngredient(amount, ingredient);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.core.util;
|
package com.gmail.nossr50.core.util;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.data.UserManager;
|
import com.gmail.nossr50.core.data.UserManager;
|
||||||
import com.gmail.nossr50.core.datatypes.interactions.NotificationType;
|
import com.gmail.nossr50.core.datatypes.interactions.NotificationType;
|
||||||
import com.gmail.nossr50.core.datatypes.player.PlayerProfile;
|
import com.gmail.nossr50.core.datatypes.player.PlayerProfile;
|
||||||
@ -15,8 +15,8 @@ public final class HardcoreManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void invokeStatPenalty(Player player) {
|
public static void invokeStatPenalty(Player player) {
|
||||||
double statLossPercentage = Config.getInstance().getHardcoreDeathStatPenaltyPercentage();
|
double statLossPercentage = MainConfig.getInstance().getHardcoreDeathStatPenaltyPercentage();
|
||||||
int levelThreshold = Config.getInstance().getHardcoreDeathStatPenaltyLevelThreshold();
|
int levelThreshold = MainConfig.getInstance().getHardcoreDeathStatPenaltyLevelThreshold();
|
||||||
|
|
||||||
PlayerProfile playerProfile = UserManager.getPlayer(player).getProfile();
|
PlayerProfile playerProfile = UserManager.getPlayer(player).getProfile();
|
||||||
int totalLevelsLost = 0;
|
int totalLevelsLost = 0;
|
||||||
@ -57,8 +57,8 @@ public final class HardcoreManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void invokeVampirism(Player killer, Player victim) {
|
public static void invokeVampirism(Player killer, Player victim) {
|
||||||
double vampirismStatLeechPercentage = Config.getInstance().getHardcoreVampirismStatLeechPercentage();
|
double vampirismStatLeechPercentage = MainConfig.getInstance().getHardcoreVampirismStatLeechPercentage();
|
||||||
int levelThreshold = Config.getInstance().getHardcoreVampirismLevelThreshold();
|
int levelThreshold = MainConfig.getInstance().getHardcoreVampirismLevelThreshold();
|
||||||
|
|
||||||
PlayerProfile killerProfile = UserManager.getPlayer(killer).getProfile();
|
PlayerProfile killerProfile = UserManager.getPlayer(killer).getProfile();
|
||||||
PlayerProfile victimProfile = UserManager.getPlayer(victim).getProfile();
|
PlayerProfile victimProfile = UserManager.getPlayer(victim).getProfile();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.gmail.nossr50.core.util;
|
package com.gmail.nossr50.core.util;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.party.ItemWeightConfig;
|
import com.gmail.nossr50.config.party.ItemWeightConfig;
|
||||||
import com.gmail.nossr50.core.config.Config;
|
import com.gmail.nossr50.core.config.MainConfig;
|
||||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -150,7 +150,7 @@ public final class ItemUtils {
|
|||||||
* @return true if the item counts as unarmed, false otherwise
|
* @return true if the item counts as unarmed, false otherwise
|
||||||
*/
|
*/
|
||||||
public static boolean isUnarmed(ItemStack item) {
|
public static boolean isUnarmed(ItemStack item) {
|
||||||
if (Config.getInstance().getUnarmedItemsAsUnarmed()) {
|
if (MainConfig.getInstance().getUnarmedItemsAsUnarmed()) {
|
||||||
return !isMinecraftTool(item);
|
return !isMinecraftTool(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,14 +27,14 @@ public final class Misc {
|
|||||||
|
|
||||||
// Sound Pitches & Volumes from CB
|
// Sound Pitches & Volumes from CB
|
||||||
/* public static final float ANVIL_USE_PITCH = 0.3F; // Not in CB directly, I went off the place sound values
|
/* public static final float ANVIL_USE_PITCH = 0.3F; // Not in CB directly, I went off the place sound values
|
||||||
public static final float ANVIL_USE_VOLUME = 1.0F * Config.getInstance().getMasterVolume(); // Not in CB directly, I went off the place sound values
|
public static final float ANVIL_USE_VOLUME = 1.0F * MainConfig.getInstance().getMasterVolume(); // Not in CB directly, I went off the place sound values
|
||||||
public static final float FIZZ_VOLUME = 0.5F * Config.getInstance().getMasterVolume();
|
public static final float FIZZ_VOLUME = 0.5F * MainConfig.getInstance().getMasterVolume();
|
||||||
public static final float POP_VOLUME = 0.2F * Config.getInstance().getMasterVolume();
|
public static final float POP_VOLUME = 0.2F * MainConfig.getInstance().getMasterVolume();
|
||||||
public static final float BAT_VOLUME = 1.0F * Config.getInstance().getMasterVolume();
|
public static final float BAT_VOLUME = 1.0F * MainConfig.getInstance().getMasterVolume();
|
||||||
public static final float BAT_PITCH = 0.6F;
|
public static final float BAT_PITCH = 0.6F;
|
||||||
public static final float GHAST_VOLUME = 1.0F * Config.getInstance().getMasterVolume();
|
public static final float GHAST_VOLUME = 1.0F * MainConfig.getInstance().getMasterVolume();
|
||||||
public static final float LEVELUP_PITCH = 0.5F; // Reduced to differentiate between vanilla level-up
|
public static final float LEVELUP_PITCH = 0.5F; // Reduced to differentiate between vanilla level-up
|
||||||
public static final float LEVELUP_VOLUME = 0.75F * Config.getInstance().getMasterVolume(); // Use max volume always*/
|
public static final float LEVELUP_VOLUME = 0.75F * MainConfig.getInstance().getMasterVolume(); // Use max volume always*/
|
||||||
private static Random random = new Random();
|
private static Random random = new Random();
|
||||||
|
|
||||||
private Misc() {
|
private Misc() {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user