mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Refactoring code part 1 to prep for adding a bunch of unit tests
This commit is contained in:
parent
0636f578dd
commit
5080d86e44
@ -1,4 +1,5 @@
|
|||||||
Version 2.1.189
|
Version 2.1.189
|
||||||
|
Removed MHD command (it didn't do anything for a while now)
|
||||||
Removed UP warning
|
Removed UP warning
|
||||||
Updated pl locale (Thanks Mich3l3k)
|
Updated pl locale (Thanks Mich3l3k)
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.gmail.nossr50.api;
|
package com.gmail.nossr50.api;
|
||||||
|
|
||||||
import com.gmail.nossr50.api.exceptions.*;
|
import com.gmail.nossr50.api.exceptions.*;
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
||||||
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
||||||
@ -802,7 +801,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 mcMMO.p.getGeneralConfig().getLevelCap(getSkillType(skillType));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -813,7 +812,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 mcMMO.p.getGeneralConfig().getPowerLevelCap();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.api;
|
package com.gmail.nossr50.api;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.datatypes.party.PartyLeader;
|
import com.gmail.nossr50.datatypes.party.PartyLeader;
|
||||||
@ -108,7 +107,7 @@ public final class PartyAPI {
|
|||||||
*/
|
*/
|
||||||
public static int getMaxPartySize()
|
public static int getMaxPartySize()
|
||||||
{
|
{
|
||||||
return Config.getInstance().getPartyMaxSize();
|
return mcMMO.p.getGeneralConfig().getPartyMaxSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,46 +0,0 @@
|
|||||||
package com.gmail.nossr50.commands;
|
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.database.FlatFileDatabaseManager;
|
|
||||||
import com.gmail.nossr50.database.SQLDatabaseManager;
|
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.command.TabExecutor;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class MHDCommand implements TabExecutor {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
|
||||||
if (mcMMO.getDatabaseManager() instanceof SQLDatabaseManager) {
|
|
||||||
SQLDatabaseManager m = (SQLDatabaseManager) mcMMO.getDatabaseManager();
|
|
||||||
m.resetMobHealthSettings();
|
|
||||||
for (McMMOPlayer player : UserManager.getPlayers()) {
|
|
||||||
player.getProfile().setMobHealthbarType(Config.getInstance().getMobHealthbarDefault());
|
|
||||||
}
|
|
||||||
sender.sendMessage("Mob health reset");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (mcMMO.getDatabaseManager() instanceof FlatFileDatabaseManager) {
|
|
||||||
FlatFileDatabaseManager m = (FlatFileDatabaseManager) mcMMO.getDatabaseManager();
|
|
||||||
m.resetMobHealthSettings();
|
|
||||||
for (McMMOPlayer player : UserManager.getPlayers()) {
|
|
||||||
player.getProfile().setMobHealthbarType(Config.getInstance().getMobHealthbarDefault());
|
|
||||||
}
|
|
||||||
sender.sendMessage("Mob health reset");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
|
|
||||||
return ImmutableList.of();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,7 +1,6 @@
|
|||||||
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.config.Config;
|
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
@ -26,7 +25,7 @@ public class McmmoCommand implements CommandExecutor {
|
|||||||
sender.sendMessage(mcSplit);
|
sender.sendMessage(mcSplit);
|
||||||
sender.sendMessage(LocaleLoader.getString("mcMMO.Description.FormerDevs"));
|
sender.sendMessage(LocaleLoader.getString("mcMMO.Description.FormerDevs"));
|
||||||
|
|
||||||
if (Config.getInstance().getDonateMessageEnabled()) {
|
if (mcMMO.p.getGeneralConfig().getDonateMessageEnabled()) {
|
||||||
sender.sendMessage(LocaleLoader.getString("MOTD.Donate"));
|
sender.sendMessage(LocaleLoader.getString("MOTD.Donate"));
|
||||||
sender.sendMessage(ChatColor.GOLD + " - " + ChatColor.GREEN + "nossr50@gmail.com" + ChatColor.GOLD + " Paypal");
|
sender.sendMessage(ChatColor.GOLD + " - " + ChatColor.GREEN + "nossr50@gmail.com" + ChatColor.GOLD + " Paypal");
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.gmail.nossr50.commands;
|
package com.gmail.nossr50.commands;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
@ -32,7 +32,7 @@ public class McscoreboardCommand implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("keep")) {
|
if (args[0].equalsIgnoreCase("keep")) {
|
||||||
if (!Config.getInstance().getAllowKeepBoard() || !Config.getInstance().getScoreboardsEnabled()) {
|
if (!mcMMO.p.getGeneralConfig().getAllowKeepBoard() || !mcMMO.p.getGeneralConfig().getScoreboardsEnabled()) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.Disabled"));
|
sender.sendMessage(LocaleLoader.getString("Commands.Disabled"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package com.gmail.nossr50.commands;
|
package com.gmail.nossr50.commands;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.datatypes.notifications.SensitiveCommandType;
|
import com.gmail.nossr50.datatypes.notifications.SensitiveCommandType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
@ -39,7 +37,7 @@ public class XprateCommand implements TabExecutor {
|
|||||||
|
|
||||||
if (mcMMO.p.isXPEventEnabled()) {
|
if (mcMMO.p.isXPEventEnabled()) {
|
||||||
|
|
||||||
if(AdvancedConfig.getInstance().useTitlesForXPEvent())
|
if(mcMMO.p.getAdvancedConfig().useTitlesForXPEvent())
|
||||||
{
|
{
|
||||||
NotificationManager.broadcastTitle(mcMMO.p.getServer(),
|
NotificationManager.broadcastTitle(mcMMO.p.getServer(),
|
||||||
LocaleLoader.getString("Commands.Event.Stop"),
|
LocaleLoader.getString("Commands.Event.Stop"),
|
||||||
@ -47,7 +45,7 @@ public class XprateCommand implements TabExecutor {
|
|||||||
10, 10*20, 20);
|
10, 10*20, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Config.getInstance().broadcastEventMessages())
|
if(mcMMO.p.getGeneralConfig().broadcastEventMessages())
|
||||||
{
|
{
|
||||||
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop"));
|
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop"));
|
||||||
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop.Subtitle"));
|
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop.Subtitle"));
|
||||||
@ -92,7 +90,7 @@ public class XprateCommand implements TabExecutor {
|
|||||||
|
|
||||||
ExperienceConfig.getInstance().setExperienceGainsGlobalMultiplier(newXpRate);
|
ExperienceConfig.getInstance().setExperienceGainsGlobalMultiplier(newXpRate);
|
||||||
|
|
||||||
if(AdvancedConfig.getInstance().useTitlesForXPEvent())
|
if(mcMMO.p.getAdvancedConfig().useTitlesForXPEvent())
|
||||||
{
|
{
|
||||||
NotificationManager.broadcastTitle(mcMMO.p.getServer(),
|
NotificationManager.broadcastTitle(mcMMO.p.getServer(),
|
||||||
LocaleLoader.getString("Commands.Event.Start"),
|
LocaleLoader.getString("Commands.Event.Start"),
|
||||||
@ -100,7 +98,7 @@ public class XprateCommand implements TabExecutor {
|
|||||||
10, 10*20, 20);
|
10, 10*20, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Config.getInstance().broadcastEventMessages())
|
if(mcMMO.p.getGeneralConfig().broadcastEventMessages())
|
||||||
{
|
{
|
||||||
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Start"));
|
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Start"));
|
||||||
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.XP", newXpRate));
|
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.XP", newXpRate));
|
||||||
|
@ -27,7 +27,13 @@ public class ConvertDatabaseCommand implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
DatabaseManager oldDatabase = DatabaseManagerFactory.createDatabaseManager(previousType);
|
DatabaseManager oldDatabase = DatabaseManagerFactory.createDatabaseManager(previousType, mcMMO.getUsersFilePath(), mcMMO.p.getLogger(), mcMMO.p.getPurgeTime(), mcMMO.p.getAdvancedConfig().getStartingLevel());
|
||||||
|
if(oldDatabase == null) {
|
||||||
|
sender.sendMessage("Unable to load the old database! Check your log for errors.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
oldDatabase.init();
|
||||||
|
|
||||||
if (previousType == DatabaseType.CUSTOM) {
|
if (previousType == DatabaseType.CUSTOM) {
|
||||||
Class<?> clazz;
|
Class<?> clazz;
|
||||||
@ -41,6 +47,7 @@ public class ConvertDatabaseCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
oldDatabase = DatabaseManagerFactory.createCustomDatabaseManager((Class<? extends DatabaseManager>) clazz);
|
oldDatabase = DatabaseManagerFactory.createCustomDatabaseManager((Class<? extends DatabaseManager>) clazz);
|
||||||
|
oldDatabase.init();
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Database.InvalidType", args[1]));
|
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Database.InvalidType", args[1]));
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.commands.database;
|
package com.gmail.nossr50.commands.database;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.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 +16,7 @@ public class McpurgeCommand implements TabExecutor {
|
|||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
mcMMO.getDatabaseManager().purgePowerlessUsers();
|
mcMMO.getDatabaseManager().purgePowerlessUsers();
|
||||||
|
|
||||||
if (Config.getInstance().getOldUsersCutoff() != -1) {
|
if (mcMMO.p.getGeneralConfig().getOldUsersCutoff() != -1) {
|
||||||
mcMMO.getDatabaseManager().purgeOldUsers();
|
mcMMO.getDatabaseManager().purgeOldUsers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.gmail.nossr50.commands.database;
|
package com.gmail.nossr50.commands.database;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.database.DatabaseManagerFactory;
|
import com.gmail.nossr50.database.DatabaseManagerFactory;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -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", (mcMMO.p.getGeneralConfig().getUseMySQL() ? "sql" : "flatfile")));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package com.gmail.nossr50.commands.party;
|
package com.gmail.nossr50.commands.party;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
||||||
import com.gmail.nossr50.datatypes.party.ShareMode;
|
import com.gmail.nossr50.datatypes.party.ShareMode;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.party.PartyManager;
|
import com.gmail.nossr50.party.PartyManager;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -85,7 +85,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() >= mcMMO.p.getGeneralConfig().getPartyFeatureUnlockLevel(partyFeature);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displayShareModeInfo(Player player, Party party) {
|
private void displayShareModeInfo(Player player, Party party) {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package com.gmail.nossr50.commands.party;
|
package com.gmail.nossr50.commands.party;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.party.PartyManager;
|
import com.gmail.nossr50.party.PartyManager;
|
||||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
@ -53,7 +53,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(), mcMMO.p.getGeneralConfig().getPartyMaxSize()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package com.gmail.nossr50.commands.party;
|
package com.gmail.nossr50.commands.party;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.datatypes.party.ItemShareType;
|
import com.gmail.nossr50.datatypes.party.ItemShareType;
|
||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
||||||
import com.gmail.nossr50.datatypes.party.ShareMode;
|
import com.gmail.nossr50.datatypes.party.ShareMode;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import com.gmail.nossr50.util.text.StringUtils;
|
import com.gmail.nossr50.util.text.StringUtils;
|
||||||
@ -28,7 +28,7 @@ public class PartyItemShareCommand implements CommandExecutor {
|
|||||||
|
|
||||||
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() < mcMMO.p.getGeneralConfig().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,10 +1,10 @@
|
|||||||
package com.gmail.nossr50.commands.party;
|
package com.gmail.nossr50.commands.party;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
||||||
import com.gmail.nossr50.datatypes.party.ShareMode;
|
import com.gmail.nossr50.datatypes.party.ShareMode;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import com.gmail.nossr50.util.text.StringUtils;
|
import com.gmail.nossr50.util.text.StringUtils;
|
||||||
@ -25,7 +25,7 @@ public class PartyXpShareCommand implements CommandExecutor {
|
|||||||
|
|
||||||
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() < mcMMO.p.getGeneralConfig().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,10 +1,10 @@
|
|||||||
package com.gmail.nossr50.commands.party.alliance;
|
package com.gmail.nossr50.commands.party.alliance;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.party.PartyManager;
|
import com.gmail.nossr50.party.PartyManager;
|
||||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
@ -51,7 +51,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() < mcMMO.p.getGeneralConfig().getPartyFeatureUnlockLevel(PartyFeature.ALLIANCE)) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.3"));
|
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.3"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -69,7 +69,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() < mcMMO.p.getGeneralConfig().getPartyFeatureUnlockLevel(PartyFeature.ALLIANCE)) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.3"));
|
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.3"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.gmail.nossr50.commands.party.teleport;
|
package com.gmail.nossr50.commands.party.teleport;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
|
import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||||
@ -35,7 +35,7 @@ public class PtpAcceptCommand implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SkillUtils.cooldownExpired(ptpRecord.getTimeout(), Config.getInstance().getPTPCommandTimeout())) {
|
if (SkillUtils.cooldownExpired(ptpRecord.getTimeout(), mcMMO.p.getGeneralConfig().getPTPCommandTimeout())) {
|
||||||
ptpRecord.removeRequest();
|
ptpRecord.removeRequest();
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.ptp.RequestExpired"));
|
player.sendMessage(LocaleLoader.getString("Commands.ptp.RequestExpired"));
|
||||||
return true;
|
return true;
|
||||||
@ -48,7 +48,7 @@ public class PtpAcceptCommand implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getPTPCommandWorldPermissions()) {
|
if (mcMMO.p.getGeneralConfig().getPTPCommandWorldPermissions()) {
|
||||||
World targetWorld = target.getWorld();
|
World targetWorld = target.getWorld();
|
||||||
World playerWorld = player.getWorld();
|
World playerWorld = player.getWorld();
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.commands.party.teleport;
|
package com.gmail.nossr50.commands.party.teleport;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.config.WorldBlacklist;
|
import com.gmail.nossr50.config.WorldBlacklist;
|
||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
||||||
@ -76,7 +75,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() < mcMMO.p.getGeneralConfig().getPartyFeatureUnlockLevel(PartyFeature.TELEPORT)) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.2"));
|
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.2"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -91,7 +90,7 @@ public class PtpCommand implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
long recentlyHurt = mcMMOPlayer.getRecentlyHurt();
|
long recentlyHurt = mcMMOPlayer.getRecentlyHurt();
|
||||||
int hurtCooldown = Config.getInstance().getPTPCommandRecentlyHurtCooldown();
|
int hurtCooldown = mcMMO.p.getGeneralConfig().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);
|
||||||
@ -111,7 +110,7 @@ public class PtpCommand implements TabExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ptpCooldown = Config.getInstance().getPTPCommandCooldown();
|
int ptpCooldown = mcMMO.p.getGeneralConfig().getPTPCommandCooldown();
|
||||||
long ptpLastUse = mcMMOPlayer.getPartyTeleportRecord().getLastUse();
|
long ptpLastUse = mcMMOPlayer.getPartyTeleportRecord().getLastUse();
|
||||||
|
|
||||||
if (ptpCooldown > 0) {
|
if (ptpCooldown > 0) {
|
||||||
@ -165,7 +164,7 @@ public class PtpCommand implements TabExecutor {
|
|||||||
Player target = mcMMOTarget.getPlayer();
|
Player target = mcMMOTarget.getPlayer();
|
||||||
|
|
||||||
|
|
||||||
if (Config.getInstance().getPTPCommandWorldPermissions()) {
|
if (mcMMO.p.getGeneralConfig().getPTPCommandWorldPermissions()) {
|
||||||
World targetWorld = target.getWorld();
|
World targetWorld = target.getWorld();
|
||||||
World playerWorld = player.getWorld();
|
World playerWorld = player.getWorld();
|
||||||
|
|
||||||
@ -194,7 +193,7 @@ 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", mcMMO.p.getGeneralConfig().getPTPCommandTimeout()));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static boolean canTeleport(CommandSender sender, Player player, String targetName) {
|
protected static boolean canTeleport(CommandSender sender, Player player, String targetName) {
|
||||||
@ -245,7 +244,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 = mcMMO.p.getGeneralConfig().getPTPCommandWarmup();
|
||||||
|
|
||||||
mcMMOPlayer.actualizeTeleportCommenceLocation(teleportingPlayer);
|
mcMMOPlayer.actualizeTeleportCommenceLocation(teleportingPlayer);
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.commands.player;
|
package com.gmail.nossr50.commands.player;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
@ -36,12 +35,12 @@ public class InspectCommand implements TabExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getScoreboardsEnabled()
|
if (mcMMO.p.getGeneralConfig().getScoreboardsEnabled()
|
||||||
&& sender instanceof Player
|
&& sender instanceof Player
|
||||||
&& Config.getInstance().getInspectUseBoard()) {
|
&& mcMMO.p.getGeneralConfig().getInspectUseBoard()) {
|
||||||
ScoreboardManager.enablePlayerInspectScoreboard((Player) sender, profile);
|
ScoreboardManager.enablePlayerInspectScoreboard((Player) sender, profile);
|
||||||
|
|
||||||
if (!Config.getInstance().getInspectUseChat()) {
|
if (!mcMMO.p.getGeneralConfig().getInspectUseChat()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -76,12 +75,12 @@ public class InspectCommand implements TabExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getScoreboardsEnabled()
|
if (mcMMO.p.getGeneralConfig().getScoreboardsEnabled()
|
||||||
&& sender instanceof Player
|
&& sender instanceof Player
|
||||||
&& Config.getInstance().getInspectUseBoard()) {
|
&& mcMMO.p.getGeneralConfig().getInspectUseBoard()) {
|
||||||
ScoreboardManager.enablePlayerInspectScoreboard((Player) sender, mcMMOPlayer);
|
ScoreboardManager.enablePlayerInspectScoreboard((Player) sender, mcMMOPlayer);
|
||||||
|
|
||||||
if (!Config.getInstance().getInspectUseChat()) {
|
if (!mcMMO.p.getGeneralConfig().getInspectUseChat()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package com.gmail.nossr50.commands.player;
|
package com.gmail.nossr50.commands.player;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||||
@ -30,10 +30,10 @@ public class MccooldownCommand implements TabExecutor {
|
|||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
if (Config.getInstance().getScoreboardsEnabled() && Config.getInstance().getCooldownUseBoard()) {
|
if (mcMMO.p.getGeneralConfig().getScoreboardsEnabled() && mcMMO.p.getGeneralConfig().getCooldownUseBoard()) {
|
||||||
ScoreboardManager.enablePlayerCooldownScoreboard(player);
|
ScoreboardManager.enablePlayerCooldownScoreboard(player);
|
||||||
|
|
||||||
if (!Config.getInstance().getCooldownUseChat()) {
|
if (!mcMMO.p.getGeneralConfig().getCooldownUseChat()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.commands.player;
|
package com.gmail.nossr50.commands.player;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
@ -91,7 +90,7 @@ public class McrankCommand implements TabExecutor {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
long cooldownMillis = Math.min(Config.getInstance().getDatabasePlayerCooldown(), 1750);
|
long cooldownMillis = Math.min(mcMMO.p.getGeneralConfig().getDatabasePlayerCooldown(), 1750);
|
||||||
|
|
||||||
if (mcMMOPlayer.getDatabaseATS() + cooldownMillis > System.currentTimeMillis()) {
|
if (mcMMOPlayer.getDatabaseATS() + cooldownMillis > System.currentTimeMillis()) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.Database.CooldownMS", getCDSeconds(mcMMOPlayer, cooldownMillis)));
|
sender.sendMessage(LocaleLoader.getString("Commands.Database.CooldownMS", getCDSeconds(mcMMOPlayer, cooldownMillis)));
|
||||||
@ -108,8 +107,8 @@ public class McrankCommand implements TabExecutor {
|
|||||||
mcMMOPlayer.actualizeDatabaseATS();
|
mcMMOPlayer.actualizeDatabaseATS();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean useBoard = Config.getInstance().getScoreboardsEnabled() && (sender instanceof Player) && (Config.getInstance().getRankUseBoard());
|
boolean useBoard = mcMMO.p.getGeneralConfig().getScoreboardsEnabled() && (sender instanceof Player) && (mcMMO.p.getGeneralConfig().getRankUseBoard());
|
||||||
boolean useChat = !useBoard || Config.getInstance().getRankUseChat();
|
boolean useChat = !useBoard || mcMMO.p.getGeneralConfig().getRankUseChat();
|
||||||
|
|
||||||
new McrankCommandAsyncTask(playerName, sender, useBoard, useChat).runTaskAsynchronously(mcMMO.p);
|
new McrankCommandAsyncTask(playerName, sender, useBoard, useChat).runTaskAsynchronously(mcMMO.p);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.gmail.nossr50.commands.player;
|
package com.gmail.nossr50.commands.player;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||||
@ -33,10 +33,10 @@ public class McstatsCommand implements TabExecutor {
|
|||||||
|
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
if (Config.getInstance().getStatsUseBoard() && Config.getInstance().getScoreboardsEnabled()) {
|
if (mcMMO.p.getGeneralConfig().getStatsUseBoard() && mcMMO.p.getGeneralConfig().getScoreboardsEnabled()) {
|
||||||
ScoreboardManager.enablePlayerStatsScoreboard(player);
|
ScoreboardManager.enablePlayerStatsScoreboard(player);
|
||||||
|
|
||||||
if (!Config.getInstance().getStatsUseChat()) {
|
if (!mcMMO.p.getGeneralConfig().getStatsUseChat()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -48,7 +48,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 = mcMMO.p.getGeneralConfig().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,5 @@
|
|||||||
package com.gmail.nossr50.commands.player;
|
package com.gmail.nossr50.commands.player;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
@ -86,7 +85,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(mcMMO.p.getGeneralConfig().getDatabasePlayerCooldown(), 1750);
|
||||||
|
|
||||||
if (mcMMOPlayer.getDatabaseATS() + cooldownMillis > System.currentTimeMillis()) {
|
if (mcMMOPlayer.getDatabaseATS() + cooldownMillis > System.currentTimeMillis()) {
|
||||||
double seconds = ((mcMMOPlayer.getDatabaseATS() + cooldownMillis) - System.currentTimeMillis()) / 1000.0D;
|
double seconds = ((mcMMOPlayer.getDatabaseATS() + cooldownMillis) - System.currentTimeMillis()) / 1000.0D;
|
||||||
@ -112,8 +111,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) && (mcMMO.p.getGeneralConfig().getTopUseBoard());
|
||||||
boolean useChat = !useBoard || Config.getInstance().getTopUseChat();
|
boolean useChat = !useBoard || mcMMO.p.getGeneralConfig().getTopUseChat();
|
||||||
|
|
||||||
new MctopCommandAsyncTask(page, skill, sender, useBoard, useChat).runTaskAsynchronously(mcMMO.p);
|
new MctopCommandAsyncTask(page, skill, sender, useBoard, useChat).runTaskAsynchronously(mcMMO.p);
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ public class AcrobaticsCommand extends SkillCommand {
|
|||||||
//Chance Stat Calculations
|
//Chance Stat Calculations
|
||||||
rollChance = RandomChanceUtil.getRandomChanceExecutionChance(roll_rcs);
|
rollChance = RandomChanceUtil.getRandomChanceExecutionChance(roll_rcs);
|
||||||
graceChance = RandomChanceUtil.getRandomChanceExecutionChance(grace_rcs);
|
graceChance = RandomChanceUtil.getRandomChanceExecutionChance(grace_rcs);
|
||||||
//damageThreshold = AdvancedConfig.getInstance().getRollDamageThreshold();
|
//damageThreshold = mcMMO.p.getAdvancedConfig().getRollDamageThreshold();
|
||||||
|
|
||||||
String[] rollStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.ACROBATICS_ROLL);
|
String[] rollStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.ACROBATICS_ROLL);
|
||||||
|
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
package com.gmail.nossr50.commands.skills;
|
package com.gmail.nossr50.commands.skills;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.skills.child.FamilyTree;
|
import com.gmail.nossr50.skills.child.FamilyTree;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||||
@ -74,7 +73,7 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
float skillValue = mcMMOPlayer.getSkillLevel(skill);
|
float skillValue = mcMMOPlayer.getSkillLevel(skill);
|
||||||
|
|
||||||
//Send the players a few blank lines to make finding the top of the skill command easier
|
//Send the players a few blank lines to make finding the top of the skill command easier
|
||||||
if (AdvancedConfig.getInstance().doesSkillCommandSendBlankLines())
|
if (mcMMO.p.getAdvancedConfig().doesSkillCommandSendBlankLines())
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
player.sendMessage("");
|
player.sendMessage("");
|
||||||
}
|
}
|
||||||
@ -106,13 +105,13 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
|
|
||||||
|
|
||||||
//Link Header
|
//Link Header
|
||||||
if (Config.getInstance().getUrlLinksEnabled()) {
|
if (mcMMO.p.getGeneralConfig().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 (mcMMO.p.getGeneralConfig().getScoreboardsEnabled() && mcMMO.p.getGeneralConfig().getSkillUseBoard()) {
|
||||||
ScoreboardManager.enablePlayerSkillScoreboard(player, skill);
|
ScoreboardManager.enablePlayerSkillScoreboard(player, skill);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,8 +225,8 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
|
|
||||||
protected String[] calculateLengthDisplayValues(Player player, float skillValue) {
|
protected String[] calculateLengthDisplayValues(Player player, float skillValue) {
|
||||||
int maxLength = skill.getAbility().getMaxLength();
|
int maxLength = skill.getAbility().getMaxLength();
|
||||||
int abilityLengthVar = AdvancedConfig.getInstance().getAbilityLength();
|
int abilityLengthVar = mcMMO.p.getAdvancedConfig().getAbilityLength();
|
||||||
int abilityLengthCap = AdvancedConfig.getInstance().getAbilityLengthCap();
|
int abilityLengthCap = mcMMO.p.getAdvancedConfig().getAbilityLengthCap();
|
||||||
|
|
||||||
int length;
|
int length;
|
||||||
|
|
||||||
@ -268,7 +267,7 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected String getLimitBreakDescriptionParameter() {
|
protected String getLimitBreakDescriptionParameter() {
|
||||||
if(AdvancedConfig.getInstance().canApplyLimitBreakPVE()) {
|
if(mcMMO.p.getAdvancedConfig().canApplyLimitBreakPVE()) {
|
||||||
return "(PVP/PVE)";
|
return "(PVP/PVE)";
|
||||||
} else {
|
} else {
|
||||||
return "(PVP)";
|
return "(PVP)";
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package com.gmail.nossr50.commands.skills;
|
package com.gmail.nossr50.commands.skills;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||||
@ -46,17 +46,17 @@ public class SwordsCommand extends SkillCommand {
|
|||||||
// SWORDS_RUPTURE
|
// SWORDS_RUPTURE
|
||||||
if (canRupture) {
|
if (canRupture) {
|
||||||
int ruptureRank = RankUtils.getRank(player, SubSkillType.SWORDS_RUPTURE);
|
int ruptureRank = RankUtils.getRank(player, SubSkillType.SWORDS_RUPTURE);
|
||||||
ruptureLengthSecondsAgainstPlayers = String.valueOf(AdvancedConfig.getInstance().getRuptureDurationSeconds(true));
|
ruptureLengthSecondsAgainstPlayers = String.valueOf(mcMMO.p.getAdvancedConfig().getRuptureDurationSeconds(true));
|
||||||
ruptureLengthSecondsAgainstMobs = String.valueOf(AdvancedConfig.getInstance().getRuptureDurationSeconds(false));
|
ruptureLengthSecondsAgainstMobs = String.valueOf(mcMMO.p.getAdvancedConfig().getRuptureDurationSeconds(false));
|
||||||
|
|
||||||
rupturePureTickDamageAgainstPlayers = String.valueOf(AdvancedConfig.getInstance().getRuptureTickDamage(true, ruptureRank));
|
rupturePureTickDamageAgainstPlayers = String.valueOf(mcMMO.p.getAdvancedConfig().getRuptureTickDamage(true, ruptureRank));
|
||||||
rupturePureTickDamageAgainstMobs = String.valueOf(AdvancedConfig.getInstance().getRuptureTickDamage(false, ruptureRank));
|
rupturePureTickDamageAgainstMobs = String.valueOf(mcMMO.p.getAdvancedConfig().getRuptureTickDamage(false, ruptureRank));
|
||||||
|
|
||||||
ruptureExplosionDamageAgainstPlayers = String.valueOf(AdvancedConfig.getInstance().getRuptureExplosionDamage(true, ruptureRank));
|
ruptureExplosionDamageAgainstPlayers = String.valueOf(mcMMO.p.getAdvancedConfig().getRuptureExplosionDamage(true, ruptureRank));
|
||||||
ruptureExplosionDamageAgainstMobs = String.valueOf(AdvancedConfig.getInstance().getRuptureExplosionDamage(false, ruptureRank));
|
ruptureExplosionDamageAgainstMobs = String.valueOf(mcMMO.p.getAdvancedConfig().getRuptureExplosionDamage(false, ruptureRank));
|
||||||
|
|
||||||
ruptureChanceToApply = String.valueOf(AdvancedConfig.getInstance().getRuptureChanceToApplyOnHit(ruptureRank) + "%");
|
ruptureChanceToApply = String.valueOf(mcMMO.p.getAdvancedConfig().getRuptureChanceToApplyOnHit(ruptureRank) + "%");
|
||||||
ruptureChanceToApplyLucky = String.valueOf(AdvancedConfig.getInstance().getRuptureChanceToApplyOnHit(ruptureRank) * 1.33);
|
ruptureChanceToApplyLucky = String.valueOf(mcMMO.p.getAdvancedConfig().getRuptureChanceToApplyOnHit(ruptureRank) * 1.33);
|
||||||
}
|
}
|
||||||
|
|
||||||
// SERRATED STRIKES
|
// SERRATED STRIKES
|
||||||
|
@ -6,25 +6,17 @@ import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
|
|||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import net.md_5.bungee.api.ChatColor;
|
import net.md_5.bungee.api.ChatColor;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class AdvancedConfig extends AutoUpdateConfigLoader {
|
public class AdvancedConfig extends AutoUpdateConfigLoader {
|
||||||
private static AdvancedConfig instance;
|
|
||||||
|
|
||||||
private AdvancedConfig() {
|
public AdvancedConfig(File dataFolder) {
|
||||||
super("advanced.yml");
|
super("advanced.yml", dataFolder);
|
||||||
validate();
|
validate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AdvancedConfig getInstance() {
|
|
||||||
if (instance == null) {
|
|
||||||
instance = new AdvancedConfig();
|
|
||||||
}
|
|
||||||
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean validateKeys() {
|
protected boolean validateKeys() {
|
||||||
// Validate all the settings!
|
// Validate all the settings!
|
||||||
@ -68,15 +60,6 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
reason.add("Skills.Acrobatics.GracefulRoll.DamageThreshold should be at least 0!");
|
reason.add("Skills.Acrobatics.GracefulRoll.DamageThreshold should be at least 0!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ALCHEMY */
|
|
||||||
/*if (getCatalysisUnlockLevel() < 0) {
|
|
||||||
reason.add("Skills.Alchemy.Catalysis.UnlockLevel should be at least 0!");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getCatalysisMaxBonusLevel() <= getCatalysisUnlockLevel()) {
|
|
||||||
reason.add("Skills.Alchemy.Catalysis.MaxBonusLevel should be greater than Skills.Alchemy.Catalysis.UnlockLevel!");
|
|
||||||
}*/
|
|
||||||
|
|
||||||
if (getCatalysisMinSpeed() <= 0) {
|
if (getCatalysisMinSpeed() <= 0) {
|
||||||
reason.add("Skills.Alchemy.Catalysis.MinSpeed must be greater than 0!");
|
reason.add("Skills.Alchemy.Catalysis.MinSpeed must be greater than 0!");
|
||||||
}
|
}
|
||||||
@ -85,21 +68,6 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
|
|||||||
reason.add("Skills.Alchemy.Catalysis.MaxSpeed should be at least Skills.Alchemy.Catalysis.MinSpeed!");
|
reason.add("Skills.Alchemy.Catalysis.MaxSpeed should be at least Skills.Alchemy.Catalysis.MinSpeed!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*List<Alchemy.Tier> alchemyTierList = Arrays.asList(Alchemy.Tier.values());
|
|
||||||
for (Alchemy.Tier tier : alchemyTierList) {
|
|
||||||
if (getConcoctionsTierLevel(tier) < 0) {
|
|
||||||
reason.add("Skills.Alchemy.Rank_Levels.Rank_" + rank + " should be at least 0!");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tier != Alchemy.Tier.fromNumerical(Alchemy.Tier.values().length)) {
|
|
||||||
Alchemy.Tier nextTier = alchemyTierList.get(alchemyTierList.indexOf(tier) - 1);
|
|
||||||
|
|
||||||
if (getConcoctionsTierLevel(tier) > getConcoctionsTierLevel(nextTier)) {
|
|
||||||
reason.add("Skills.Alchemy.Rank_Levels.Rank_" + rank + " should be less than or equal to Skills.Alchemy.Rank_Levels.Rank_" + nextrank + "!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/* ARCHERY */
|
/* ARCHERY */
|
||||||
|
|
||||||
if (getSkillShotRankDamageMultiplier() <= 0) {
|
if (getSkillShotRankDamageMultiplier() <= 0) {
|
||||||
|
@ -11,10 +11,20 @@ import java.util.LinkedHashMap;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public abstract class AutoUpdateConfigLoader extends ConfigLoader {
|
public abstract class AutoUpdateConfigLoader extends ConfigLoader {
|
||||||
|
public AutoUpdateConfigLoader(String relativePath, String fileName, File dataFolder) {
|
||||||
|
super(relativePath, fileName, dataFolder);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AutoUpdateConfigLoader(String fileName, File dataFolder) {
|
||||||
|
super(fileName, dataFolder);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public AutoUpdateConfigLoader(String relativePath, String fileName) {
|
public AutoUpdateConfigLoader(String relativePath, String fileName) {
|
||||||
super(relativePath, fileName);
|
super(relativePath, fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public AutoUpdateConfigLoader(String fileName) {
|
public AutoUpdateConfigLoader(String fileName) {
|
||||||
super(fileName);
|
super(fileName);
|
||||||
}
|
}
|
||||||
@ -136,7 +146,7 @@ public abstract class AutoUpdateConfigLoader extends ConfigLoader {
|
|||||||
saveName += ".new";
|
saveName += ".new";
|
||||||
}
|
}
|
||||||
|
|
||||||
BufferedWriter writer = new BufferedWriter(new FileWriter(new File(plugin.getDataFolder(), saveName)));
|
BufferedWriter writer = new BufferedWriter(new FileWriter(new File(dataFolder, saveName)));
|
||||||
writer.write(output);
|
writer.write(output);
|
||||||
writer.flush();
|
writer.flush();
|
||||||
writer.close();
|
writer.close();
|
||||||
|
@ -3,6 +3,7 @@ package com.gmail.nossr50.config;
|
|||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -12,16 +13,33 @@ public abstract class ConfigLoader {
|
|||||||
protected String fileName;
|
protected String fileName;
|
||||||
protected final File configFile;
|
protected final File configFile;
|
||||||
protected FileConfiguration config;
|
protected FileConfiguration config;
|
||||||
|
protected @NotNull File dataFolder;
|
||||||
|
|
||||||
public ConfigLoader(String relativePath, String fileName) {
|
public ConfigLoader(String relativePath, String fileName, @NotNull File dataFolder) {
|
||||||
this.fileName = fileName;
|
this.fileName = fileName;
|
||||||
configFile = new File(plugin.getDataFolder(), relativePath + File.separator + fileName);
|
this.dataFolder = dataFolder;
|
||||||
|
configFile = new File(dataFolder, relativePath + File.separator + fileName);
|
||||||
loadFile();
|
loadFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ConfigLoader(String fileName, @NotNull File dataFolder) {
|
||||||
|
this.fileName = fileName;
|
||||||
|
this.dataFolder = dataFolder;
|
||||||
|
configFile = new File(dataFolder, fileName);
|
||||||
|
loadFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public ConfigLoader(String relativePath, String fileName) {
|
||||||
|
this.fileName = fileName;
|
||||||
|
configFile = new File(mcMMO.p.getDataFolder(), relativePath + File.separator + fileName);
|
||||||
|
loadFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public ConfigLoader(String fileName) {
|
public ConfigLoader(String fileName) {
|
||||||
this.fileName = fileName;
|
this.fileName = fileName;
|
||||||
configFile = new File(plugin.getDataFolder(), fileName);
|
configFile = new File(mcMMO.p.getDataFolder(), fileName);
|
||||||
loadFile();
|
loadFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,27 +12,19 @@ import org.bukkit.configuration.ConfigurationSection;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class Config extends AutoUpdateConfigLoader {
|
public class GeneralConfig extends AutoUpdateConfigLoader {
|
||||||
private static Config instance;
|
|
||||||
|
|
||||||
private Config() {
|
public GeneralConfig(@NotNull File dataFolder) {
|
||||||
super("config.yml");
|
super("config.yml", dataFolder);
|
||||||
validate();
|
validate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Config getInstance() {
|
|
||||||
if (instance == null) {
|
|
||||||
instance = new Config();
|
|
||||||
}
|
|
||||||
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadKeys() {
|
protected void loadKeys() {
|
||||||
|
|
||||||
@ -63,47 +55,6 @@ public class Config extends AutoUpdateConfigLoader {
|
|||||||
reason.add("Mob_Healthbar.Display_Time cannot be 0! Set to -1 to disable or set a valid value.");
|
reason.add("Mob_Healthbar.Display_Time cannot be 0! Set to -1 to disable or set a valid value.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Scoreboards */
|
|
||||||
/*if (getRankScoreboardTime() != -1 && getRankScoreboardTime() <= 0) {
|
|
||||||
reason.add("Scoreboard.Types.Rank.Display_Time should be greater than 0, or -1!");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getStatsScoreboardTime() != -1 && getStatsScoreboardTime() <= 0) {
|
|
||||||
reason.add("Scoreboard.Types.Stats.Display_Time should be greater than 0, or -1!");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getTopScoreboardTime() != -1 && getTopScoreboardTime() <= 0) {
|
|
||||||
reason.add("Scoreboard.Types.Top.Display_Time should be greater than 0, or -1!");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getInspectScoreboardTime() != -1 && getInspectScoreboardTime() <= 0) {
|
|
||||||
reason.add("Scoreboard.Types.Inspect.Display_Time should be greater than 0, or -1!");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getSkillScoreboardTime() != -1 && getSkillScoreboardTime() <= 0) {
|
|
||||||
reason.add("Scoreboard.Types.Skill.Display_Time should be greater than 0, or -1!");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getSkillLevelUpTime() != -1 && getSkillScoreboardTime() <= 0) {
|
|
||||||
reason.add("Scoreboard.Types.Skill.Display_Time should be greater than 0, or -1!");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(getRankUseChat() || getRankUseBoard())) {
|
|
||||||
reason.add("Either Board or Print in Scoreboard.Types.Rank must be true!");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(getTopUseChat() || getTopUseBoard())) {
|
|
||||||
reason.add("Either Board or Print in Scoreboard.Types.Top must be true!");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(getStatsUseChat() || getStatsUseBoard())) {
|
|
||||||
reason.add("Either Board or Print in Scoreboard.Types.Stats must be true!");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(getInspectUseChat() || getInspectUseBoard())) {
|
|
||||||
reason.add("Either Board or Print in Scoreboard.Types.Inspect must be true!");
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/* Database Purging */
|
/* Database Purging */
|
||||||
if (getPurgeInterval() < -1) {
|
if (getPurgeInterval() < -1) {
|
||||||
reason.add("Database_Purging.Purge_Interval should be greater than, or equal to -1!");
|
reason.add("Database_Purging.Purge_Interval should be greater than, or equal to -1!");
|
||||||
@ -200,42 +151,6 @@ public class Config extends AutoUpdateConfigLoader {
|
|||||||
reason.add("Cannot use the same item for Repair and Salvage anvils!");
|
reason.add("Cannot use the same item for Repair and Salvage anvils!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (getTamingCOTWMaterial(EntityType.WOLF) == null) {
|
|
||||||
// reason.add("Skills.Taming.Call_Of_The_Wild.Wolf.Item_Material is invalid!!");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (getTamingCOTWMaterial(EntityType.OCELOT) == null) {
|
|
||||||
// reason.add("Skills.Taming.Call_Of_The_Wild.Ocelot.Item_Material is invalid!!");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (getTamingCOTWMaterial(EntityType.HORSE) == null) {
|
|
||||||
// reason.add("Skills.Taming.Call_Of_The_Wild.Horse.Item_Material is invalid!!");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (getTamingCOTWCost(EntityType.WOLF) <= 0) {
|
|
||||||
// reason.add("Skills.Taming.Call_Of_The_Wild.Wolf.Item_Amount should be greater than 0!");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (getTamingCOTWCost(EntityType.OCELOT) <= 0) {
|
|
||||||
// reason.add("Skills.Taming.Call_Of_The_Wild.Ocelot.Item_Amount should be greater than 0!");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (getTamingCOTWCost(EntityType.HORSE) <= 0) {
|
|
||||||
// reason.add("Skills.Taming.Call_Of_The_Wild.Horse.Item_Amount should be greater than 0!");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (getTamingCOTWAmount(EntityType.WOLF) <= 0) {
|
|
||||||
// reason.add("Skills.Taming.Call_Of_The_Wild.Wolf.Summon_Amount should be greater than 0!");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (getTamingCOTWAmount(EntityType.OCELOT) <= 0) {
|
|
||||||
// reason.add("Skills.Taming.Call_Of_The_Wild.Ocelot.Summon_Amount should be greater than 0!");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (getTamingCOTWAmount(EntityType.HORSE) <= 0) {
|
|
||||||
// reason.add("Skills.Taming.Call_Of_The_Wild.Horse.Summon_Amount should be greater than 0!");
|
|
||||||
// }
|
|
||||||
|
|
||||||
return noErrorsInConfig(reason);
|
return noErrorsInConfig(reason);
|
||||||
}
|
}
|
||||||
|
|
@ -2,6 +2,7 @@ package com.gmail.nossr50.config;
|
|||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
|
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -88,7 +89,7 @@ public class RankConfig extends AutoUpdateConfigLoader {
|
|||||||
* @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 = mcMMO.p.getGeneralConfig().getIsRetroMode() ? ".RetroMode." : ".Standard.";
|
||||||
|
|
||||||
String targetRank = "Rank_" + rank;
|
String targetRank = "Rank_" + rank;
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.gmail.nossr50.database;
|
package com.gmail.nossr50.database;
|
||||||
|
|
||||||
import com.gmail.nossr50.api.exceptions.InvalidSkillException;
|
import com.gmail.nossr50.api.exceptions.InvalidSkillException;
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.datatypes.database.DatabaseType;
|
import com.gmail.nossr50.datatypes.database.DatabaseType;
|
||||||
import com.gmail.nossr50.datatypes.database.PlayerStat;
|
import com.gmail.nossr50.datatypes.database.PlayerStat;
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||||
@ -15,15 +14,13 @@ import java.util.Map;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public interface DatabaseManager {
|
public interface DatabaseManager {
|
||||||
// One month in milliseconds
|
|
||||||
long PURGE_TIME = 2630000000L * Config.getInstance().getOldUsersCutoff();
|
|
||||||
// During convertUsers, how often to output a status
|
// During convertUsers, how often to output a status
|
||||||
int progressInterval = 200;
|
int progressInterval = 200;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Purge users with 0 power level from the database.
|
* Purge users with 0 power level from the database.
|
||||||
*/
|
*/
|
||||||
void purgePowerlessUsers();
|
int purgePowerlessUsers();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Purge users who haven't logged on in over a certain time frame from the database.
|
* Purge users who haven't logged on in over a certain time frame from the database.
|
||||||
@ -76,6 +73,8 @@ public interface DatabaseManager {
|
|||||||
*/
|
*/
|
||||||
Map<PrimarySkillType, Integer> readRank(String playerName);
|
Map<PrimarySkillType, Integer> readRank(String playerName);
|
||||||
|
|
||||||
|
default void init() {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new user to the database.
|
* Add a new user to the database.
|
||||||
*
|
*
|
||||||
|
@ -1,13 +1,16 @@
|
|||||||
package com.gmail.nossr50.database;
|
package com.gmail.nossr50.database;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.datatypes.database.DatabaseType;
|
import com.gmail.nossr50.datatypes.database.DatabaseType;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
public class DatabaseManagerFactory {
|
public class DatabaseManagerFactory {
|
||||||
private static Class<? extends DatabaseManager> customManager = null;
|
private static Class<? extends DatabaseManager> customManager = null;
|
||||||
|
|
||||||
public static DatabaseManager getDatabaseManager() {
|
public static DatabaseManager getDatabaseManager(@NotNull String userFilePath, @NotNull Logger logger, long purgeTime, int startingLevel) {
|
||||||
if (customManager != null) {
|
if (customManager != null) {
|
||||||
try {
|
try {
|
||||||
return createDefaultCustomDatabaseManager();
|
return createDefaultCustomDatabaseManager();
|
||||||
@ -20,10 +23,10 @@ public class DatabaseManagerFactory {
|
|||||||
mcMMO.p.debug("Failed to create custom database manager");
|
mcMMO.p.debug("Failed to create custom database manager");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
mcMMO.p.debug("Falling back on " + (Config.getInstance().getUseMySQL() ? "SQL" : "Flatfile") + " database");
|
mcMMO.p.debug("Falling back on " + (mcMMO.p.getGeneralConfig().getUseMySQL() ? "SQL" : "Flatfile") + " database");
|
||||||
}
|
}
|
||||||
|
|
||||||
return Config.getInstance().getUseMySQL() ? new SQLDatabaseManager() : new FlatFileDatabaseManager();
|
return mcMMO.p.getGeneralConfig().getUseMySQL() ? new SQLDatabaseManager() : new FlatFileDatabaseManager(userFilePath, logger, purgeTime, startingLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -56,11 +59,11 @@ public class DatabaseManagerFactory {
|
|||||||
return customManager;
|
return customManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DatabaseManager createDatabaseManager(DatabaseType type) {
|
public static @Nullable DatabaseManager createDatabaseManager(@NotNull DatabaseType type, @NotNull String userFilePath, @NotNull Logger logger, long purgeTime, int startingLevel) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case FLATFILE:
|
case FLATFILE:
|
||||||
mcMMO.p.getLogger().info("Using FlatFile Database");
|
mcMMO.p.getLogger().info("Using FlatFile Database");
|
||||||
return new FlatFileDatabaseManager();
|
return new FlatFileDatabaseManager(userFilePath, logger, purgeTime, startingLevel);
|
||||||
|
|
||||||
case SQL:
|
case SQL:
|
||||||
mcMMO.p.getLogger().info("Using SQL Database");
|
mcMMO.p.getLogger().info("Using SQL Database");
|
||||||
@ -80,7 +83,7 @@ public class DatabaseManagerFactory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DatabaseManager createDefaultCustomDatabaseManager() throws Throwable {
|
private static DatabaseManager createDefaultCustomDatabaseManager() throws Throwable {
|
||||||
return customManager.getConstructor().newInstance();
|
return customManager.getConstructor().newInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,15 +1,13 @@
|
|||||||
package com.gmail.nossr50.database;
|
package com.gmail.nossr50.database;
|
||||||
|
|
||||||
import com.gmail.nossr50.api.exceptions.InvalidSkillException;
|
import com.gmail.nossr50.api.exceptions.InvalidSkillException;
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.datatypes.MobHealthbarType;
|
|
||||||
import com.gmail.nossr50.datatypes.database.DatabaseType;
|
import com.gmail.nossr50.datatypes.database.DatabaseType;
|
||||||
import com.gmail.nossr50.datatypes.database.PlayerStat;
|
import com.gmail.nossr50.datatypes.database.PlayerStat;
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||||
import com.gmail.nossr50.datatypes.player.UniqueDataType;
|
import com.gmail.nossr50.datatypes.player.UniqueDataType;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.interfaces.Skill;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
@ -19,14 +17,20 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
public final class FlatFileDatabaseManager implements DatabaseManager {
|
public final class FlatFileDatabaseManager implements DatabaseManager {
|
||||||
private final HashMap<PrimarySkillType, List<PlayerStat>> playerStatHash = new HashMap<>();
|
public static final String IGNORED = "IGNORED";
|
||||||
private final List<PlayerStat> powerLevels = new ArrayList<>();
|
private final @NotNull HashMap<PrimarySkillType, List<PlayerStat>> playerStatHash = new HashMap<>();
|
||||||
|
private final @NotNull List<PlayerStat> powerLevels = new ArrayList<>();
|
||||||
private long lastUpdate = 0;
|
private long lastUpdate = 0;
|
||||||
|
private final @NotNull String usersFilePath;
|
||||||
|
private final @NotNull Logger logger;
|
||||||
|
private final long purgeTime;
|
||||||
|
private final int startingLevel;
|
||||||
|
|
||||||
private final long UPDATE_WAIT_TIME = 600000L; // 10 minutes
|
private final long UPDATE_WAIT_TIME = 600000L; // 10 minutes
|
||||||
private final File usersFile;
|
private final @NotNull File usersFile;
|
||||||
private static final Object fileWritingLock = new Object();
|
private static final Object fileWritingLock = new Object();
|
||||||
|
|
||||||
public static int USERNAME_INDEX = 0;
|
public static int USERNAME_INDEX = 0;
|
||||||
@ -72,20 +76,26 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
|
|
||||||
public static int DATA_ENTRY_COUNT = COOLDOWN_CHIMAERA_WING + 1; //Update this everytime new data is added
|
public static int DATA_ENTRY_COUNT = COOLDOWN_CHIMAERA_WING + 1; //Update this everytime new data is added
|
||||||
|
|
||||||
protected FlatFileDatabaseManager() {
|
protected FlatFileDatabaseManager(@NotNull String usersFilePath, @NotNull Logger logger, long purgeTime, int startingLevel) {
|
||||||
usersFile = new File(mcMMO.getUsersFilePath());
|
usersFile = new File(usersFilePath);
|
||||||
|
this.usersFilePath = usersFilePath;
|
||||||
|
this.logger = logger;
|
||||||
|
this.purgeTime = purgeTime;
|
||||||
|
this.startingLevel = startingLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init() {
|
||||||
checkStructure();
|
checkStructure();
|
||||||
updateLeaderboards();
|
updateLeaderboards();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void purgePowerlessUsers() {
|
public int purgePowerlessUsers() {
|
||||||
int purgedUsers = 0;
|
int purgedUsers = 0;
|
||||||
|
|
||||||
mcMMO.p.getLogger().info("Purging powerless users...");
|
logger.info("Purging powerless users...");
|
||||||
|
|
||||||
BufferedReader in = null;
|
BufferedReader in = null;
|
||||||
FileWriter out = null;
|
FileWriter out = null;
|
||||||
String usersFilePath = mcMMO.getUsersFilePath();
|
|
||||||
|
|
||||||
// This code is O(n) instead of O(n²)
|
// This code is O(n) instead of O(n²)
|
||||||
synchronized (fileWritingLock) {
|
synchronized (fileWritingLock) {
|
||||||
@ -96,7 +106,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
|
|
||||||
while ((line = in.readLine()) != null) {
|
while ((line = in.readLine()) != null) {
|
||||||
String[] character = line.split(":");
|
String[] character = line.split(":");
|
||||||
Map<PrimarySkillType, Integer> skills = getSkillMapFromLine(character);
|
Map<Skill, Integer> skills = getSkillMapFromLine(character);
|
||||||
|
|
||||||
boolean powerless = true;
|
boolean powerless = true;
|
||||||
for (int skill : skills.values()) {
|
for (int skill : skills.values()) {
|
||||||
@ -120,7 +130,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
out.write(writer.toString());
|
out.write(writer.toString());
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
mcMMO.p.getLogger().severe("Exception while reading " + usersFilePath + " (Are you sure you formatted it correctly?)" + e.toString());
|
logger.severe("Exception while reading " + usersFilePath + " (Are you sure you formatted it correctly?)" + e);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
if (in != null) {
|
if (in != null) {
|
||||||
@ -142,18 +152,18 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mcMMO.p.getLogger().info("Purged " + purgedUsers + " users from the database.");
|
logger.info("Purged " + purgedUsers + " users from the database.");
|
||||||
|
return purgedUsers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void purgeOldUsers() {
|
public void purgeOldUsers() {
|
||||||
int removedPlayers = 0;
|
int removedPlayers = 0;
|
||||||
long currentTime = System.currentTimeMillis();
|
long currentTime = System.currentTimeMillis();
|
||||||
|
|
||||||
mcMMO.p.getLogger().info("Purging old users...");
|
logger.info("Purging old users...");
|
||||||
|
|
||||||
BufferedReader in = null;
|
BufferedReader in = null;
|
||||||
FileWriter out = null;
|
FileWriter out = null;
|
||||||
String usersFilePath = mcMMO.getUsersFilePath();
|
|
||||||
|
|
||||||
// This code is O(n) instead of O(n²)
|
// This code is O(n) instead of O(n²)
|
||||||
synchronized (fileWritingLock) {
|
synchronized (fileWritingLock) {
|
||||||
@ -179,7 +189,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
rewrite = true;
|
rewrite = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentTime - lastPlayed > PURGE_TIME) {
|
if (currentTime - lastPlayed > purgeTime) {
|
||||||
removedPlayers++;
|
removedPlayers++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -200,7 +210,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
out.write(writer.toString());
|
out.write(writer.toString());
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
mcMMO.p.getLogger().severe("Exception while reading " + usersFilePath + " (Are you sure you formatted it correctly?)" + e.toString());
|
logger.severe("Exception while reading " + usersFilePath + " (Are you sure you formatted it correctly?)" + e);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
if (in != null) {
|
if (in != null) {
|
||||||
@ -222,7 +232,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mcMMO.p.getLogger().info("Purged " + removedPlayers + " users from the database.");
|
logger.info("Purged " + removedPlayers + " users from the database.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean removeUser(String playerName, UUID uuid) {
|
public boolean removeUser(String playerName, UUID uuid) {
|
||||||
@ -231,7 +241,6 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
|
|
||||||
BufferedReader in = null;
|
BufferedReader in = null;
|
||||||
FileWriter out = null;
|
FileWriter out = null;
|
||||||
String usersFilePath = mcMMO.getUsersFilePath();
|
|
||||||
|
|
||||||
synchronized (fileWritingLock) {
|
synchronized (fileWritingLock) {
|
||||||
try {
|
try {
|
||||||
@ -242,7 +251,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
while ((line = in.readLine()) != null) {
|
while ((line = in.readLine()) != null) {
|
||||||
// Write out the same file but when we get to the player we want to remove, we skip his line.
|
// Write out the same file but when we get to the player we want to remove, we skip his line.
|
||||||
if (!worked && line.split(":")[USERNAME_INDEX].equalsIgnoreCase(playerName)) {
|
if (!worked && line.split(":")[USERNAME_INDEX].equalsIgnoreCase(playerName)) {
|
||||||
mcMMO.p.getLogger().info("User found, removing...");
|
logger.info("User found, removing...");
|
||||||
worked = true;
|
worked = true;
|
||||||
continue; // Skip the player
|
continue; // Skip the player
|
||||||
}
|
}
|
||||||
@ -254,7 +263,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
out.write(writer.toString());
|
out.write(writer.toString());
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
mcMMO.p.getLogger().severe("Exception while reading " + usersFilePath + " (Are you sure you formatted it correctly?)" + e.toString());
|
logger.severe("Exception while reading " + usersFilePath + " (Are you sure you formatted it correctly?)" + e);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
if (in != null) {
|
if (in != null) {
|
||||||
@ -286,13 +295,12 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
//Not used in FlatFile
|
//Not used in FlatFile
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean saveUser(PlayerProfile profile) {
|
public boolean saveUser(@NotNull PlayerProfile profile) {
|
||||||
String playerName = profile.getPlayerName();
|
String playerName = profile.getPlayerName();
|
||||||
UUID uuid = profile.getUniqueId();
|
UUID uuid = profile.getUniqueId();
|
||||||
|
|
||||||
BufferedReader in = null;
|
BufferedReader in = null;
|
||||||
FileWriter out = null;
|
FileWriter out = null;
|
||||||
String usersFilePath = mcMMO.getUsersFilePath();
|
|
||||||
boolean corruptDataFound = false;
|
boolean corruptDataFound = false;
|
||||||
|
|
||||||
synchronized (fileWritingLock) {
|
synchronized (fileWritingLock) {
|
||||||
@ -309,7 +317,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
if(!line.contains(":")) {
|
if(!line.contains(":")) {
|
||||||
|
|
||||||
if(!corruptDataFound) {
|
if(!corruptDataFound) {
|
||||||
mcMMO.p.getLogger().severe("mcMMO found some unexpected or corrupted data in mcmmo.users and is removing it, it is possible some data has been lost.");
|
logger.severe("mcMMO found some unexpected or corrupted data in mcmmo.users and is removing it, it is possible some data has been lost.");
|
||||||
corruptDataFound = true;
|
corruptDataFound = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,12 +326,11 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
|
|
||||||
String[] splitData = line.split(":");
|
String[] splitData = line.split(":");
|
||||||
|
|
||||||
//This would be rare, but check the splitData for having enough entries to contain a username
|
//This would be rare, but check the splitData for having enough entries to contain a UUID
|
||||||
if(splitData.length < USERNAME_INDEX) { //UUID have been in mcMMO DB for a very long time so any user without
|
if(splitData.length < UUID_INDEX) { //UUID have been in mcMMO DB for a very long time so any user without
|
||||||
//Something is wrong if we don't have enough split data to have an entry for a username
|
|
||||||
|
|
||||||
if(!corruptDataFound) {
|
if(!corruptDataFound) {
|
||||||
mcMMO.p.getLogger().severe("mcMMO found some unexpected or corrupted data in mcmmo.users and is removing it, it is possible some data has been lost.");
|
logger.severe("mcMMO found some unexpected or corrupted data in mcmmo.users and is removing it, it is possible some data has been lost.");
|
||||||
corruptDataFound = true;
|
corruptDataFound = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -378,7 +385,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void writeUserToLine(PlayerProfile profile, String playerName, @Nullable UUID uuid, StringBuilder writer) {
|
private void writeUserToLine(PlayerProfile profile, @NotNull String playerName, @Nullable UUID uuid, StringBuilder writer) {
|
||||||
writer.append(playerName).append(":");
|
writer.append(playerName).append(":");
|
||||||
writer.append(profile.getSkillLevel(PrimarySkillType.MINING)).append(":");
|
writer.append(profile.getSkillLevel(PrimarySkillType.MINING)).append(":");
|
||||||
writer.append(":");
|
writer.append(":");
|
||||||
@ -417,8 +424,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
writer.append(profile.getSkillXpLevel(PrimarySkillType.FISHING)).append(":");
|
writer.append(profile.getSkillXpLevel(PrimarySkillType.FISHING)).append(":");
|
||||||
writer.append((int) profile.getAbilityDATS(SuperAbilityType.BLAST_MINING)).append(":");
|
writer.append((int) profile.getAbilityDATS(SuperAbilityType.BLAST_MINING)).append(":");
|
||||||
writer.append(System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR).append(":");
|
writer.append(System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR).append(":");
|
||||||
MobHealthbarType mobHealthbarType = profile.getMobHealthbarType();
|
writer.append(IGNORED).append(":"); //mob health bar
|
||||||
writer.append(mobHealthbarType == null ? Config.getInstance().getMobHealthbarDefault().toString() : mobHealthbarType.toString()).append(":");
|
|
||||||
writer.append(profile.getSkillLevel(PrimarySkillType.ALCHEMY)).append(":");
|
writer.append(profile.getSkillLevel(PrimarySkillType.ALCHEMY)).append(":");
|
||||||
writer.append(profile.getSkillXpLevel(PrimarySkillType.ALCHEMY)).append(":");
|
writer.append(profile.getSkillXpLevel(PrimarySkillType.ALCHEMY)).append(":");
|
||||||
writer.append(uuid != null ? uuid.toString() : "NULL").append(":");
|
writer.append(uuid != null ? uuid.toString() : "NULL").append(":");
|
||||||
@ -430,7 +436,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
public @NotNull List<PlayerStat> readLeaderboard(@Nullable PrimarySkillType skill, int pageNumber, int statsPerPage) throws InvalidSkillException {
|
public @NotNull List<PlayerStat> readLeaderboard(@Nullable PrimarySkillType skill, int pageNumber, int statsPerPage) throws InvalidSkillException {
|
||||||
//Fix for a plugin that people are using that is throwing SQL errors
|
//Fix for a plugin that people are using that is throwing SQL errors
|
||||||
if(skill != null && skill.isChildSkill()) {
|
if(skill != null && skill.isChildSkill()) {
|
||||||
mcMMO.p.getLogger().severe("A plugin hooking into mcMMO is being naughty with our database commands, update all plugins that hook into mcMMO and contact their devs!");
|
logger.severe("A plugin hooking into mcMMO is being naughty with our database commands, update all plugins that hook into mcMMO and contact their devs!");
|
||||||
throw new InvalidSkillException("A plugin hooking into mcMMO that you are using is attempting to read leaderboard skills for child skills, child skills do not have leaderboards! This is NOT an mcMMO error!");
|
throw new InvalidSkillException("A plugin hooking into mcMMO that you are using is attempting to read leaderboard skills for child skills, child skills do not have leaderboards! This is NOT an mcMMO error!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -465,26 +471,26 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
synchronized (fileWritingLock) {
|
synchronized (fileWritingLock) {
|
||||||
try {
|
try {
|
||||||
// Open the file to write the player
|
// Open the file to write the player
|
||||||
out = new BufferedWriter(new FileWriter(mcMMO.getUsersFilePath(), true));
|
out = new BufferedWriter(new FileWriter(usersFilePath, true));
|
||||||
|
|
||||||
String startingLevel = AdvancedConfig.getInstance().getStartingLevel() + ":";
|
String startingLevelStr = startingLevel + ":";
|
||||||
|
|
||||||
// Add the player to the end
|
// Add the player to the end
|
||||||
out.append(playerName).append(":");
|
out.append(playerName).append(":");
|
||||||
out.append(startingLevel); // Mining
|
out.append(startingLevelStr); // Mining
|
||||||
out.append(":");
|
out.append(":");
|
||||||
out.append(":");
|
out.append(":");
|
||||||
out.append("0:"); // Xp
|
out.append("0:"); // Xp
|
||||||
out.append(startingLevel); // Woodcutting
|
out.append(startingLevelStr); // Woodcutting
|
||||||
out.append("0:"); // WoodCuttingXp
|
out.append("0:"); // WoodCuttingXp
|
||||||
out.append(startingLevel); // Repair
|
out.append(startingLevelStr); // Repair
|
||||||
out.append(startingLevel); // Unarmed
|
out.append(startingLevelStr); // Unarmed
|
||||||
out.append(startingLevel); // Herbalism
|
out.append(startingLevelStr); // Herbalism
|
||||||
out.append(startingLevel); // Excavation
|
out.append(startingLevelStr); // Excavation
|
||||||
out.append(startingLevel); // Archery
|
out.append(startingLevelStr); // Archery
|
||||||
out.append(startingLevel); // Swords
|
out.append(startingLevelStr); // Swords
|
||||||
out.append(startingLevel); // Axes
|
out.append(startingLevelStr); // Axes
|
||||||
out.append(startingLevel); // Acrobatics
|
out.append(startingLevelStr); // Acrobatics
|
||||||
out.append("0:"); // RepairXp
|
out.append("0:"); // RepairXp
|
||||||
out.append("0:"); // UnarmedXp
|
out.append("0:"); // UnarmedXp
|
||||||
out.append("0:"); // HerbalismXp
|
out.append("0:"); // HerbalismXp
|
||||||
@ -494,7 +500,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
out.append("0:"); // AxesXp
|
out.append("0:"); // AxesXp
|
||||||
out.append("0:"); // AcrobaticsXp
|
out.append("0:"); // AcrobaticsXp
|
||||||
out.append(":");
|
out.append(":");
|
||||||
out.append(startingLevel); // Taming
|
out.append(startingLevelStr); // Taming
|
||||||
out.append("0:"); // TamingXp
|
out.append("0:"); // TamingXp
|
||||||
out.append("0:"); // DATS
|
out.append("0:"); // DATS
|
||||||
out.append("0:"); // DATS
|
out.append("0:"); // DATS
|
||||||
@ -504,12 +510,12 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
out.append("0:"); // DATS
|
out.append("0:"); // DATS
|
||||||
out.append("0:"); // DATS
|
out.append("0:"); // DATS
|
||||||
out.append(":");
|
out.append(":");
|
||||||
out.append(startingLevel); // Fishing
|
out.append(startingLevelStr); // Fishing
|
||||||
out.append("0:"); // FishingXp
|
out.append("0:"); // FishingXp
|
||||||
out.append("0:"); // Blast Mining
|
out.append("0:"); // Blast Mining
|
||||||
out.append(String.valueOf(System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR)).append(":"); // LastLogin
|
out.append(String.valueOf(System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR)).append(":"); // LastLogin
|
||||||
out.append(Config.getInstance().getMobHealthbarDefault().toString()).append(":"); // Mob Healthbar HUD
|
out.append(IGNORED).append(":"); // Mob Healthbar HUD
|
||||||
out.append(startingLevel); // Alchemy
|
out.append(startingLevelStr); // Alchemy
|
||||||
out.append("0:"); // AlchemyXp
|
out.append("0:"); // AlchemyXp
|
||||||
out.append(uuid != null ? uuid.toString() : "NULL").append(":"); // UUID
|
out.append(uuid != null ? uuid.toString() : "NULL").append(":"); // UUID
|
||||||
out.append("0:"); // Scoreboard tips shown
|
out.append("0:"); // Scoreboard tips shown
|
||||||
@ -543,7 +549,6 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
|
|
||||||
private @NotNull PlayerProfile loadPlayerByUUID(@NotNull UUID uuid, @Nullable String playerName) {
|
private @NotNull PlayerProfile loadPlayerByUUID(@NotNull UUID uuid, @Nullable String playerName) {
|
||||||
BufferedReader in = null;
|
BufferedReader in = null;
|
||||||
String usersFilePath = mcMMO.getUsersFilePath();
|
|
||||||
|
|
||||||
synchronized (fileWritingLock) {
|
synchronized (fileWritingLock) {
|
||||||
try {
|
try {
|
||||||
@ -580,7 +585,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
|
|
||||||
/* Check for nickname changes and update since we are here anyways */
|
/* Check for nickname changes and update since we are here anyways */
|
||||||
if (!rawSplitData[USERNAME_INDEX].equalsIgnoreCase(playerName)) {
|
if (!rawSplitData[USERNAME_INDEX].equalsIgnoreCase(playerName)) {
|
||||||
//mcMMO.p.getLogger().info("Name updated for player: " + rawSplitData[USERNAME_INDEX] + " => " + playerName);
|
//logger.info("Name updated for player: " + rawSplitData[USERNAME_INDEX] + " => " + playerName);
|
||||||
rawSplitData[USERNAME_INDEX] = playerName;
|
rawSplitData[USERNAME_INDEX] = playerName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -610,7 +615,6 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
|
|
||||||
private @NotNull PlayerProfile loadPlayerByName(@NotNull String playerName) {
|
private @NotNull PlayerProfile loadPlayerByName(@NotNull String playerName) {
|
||||||
BufferedReader in = null;
|
BufferedReader in = null;
|
||||||
String usersFilePath = mcMMO.getUsersFilePath();
|
|
||||||
|
|
||||||
synchronized (fileWritingLock) {
|
synchronized (fileWritingLock) {
|
||||||
try {
|
try {
|
||||||
@ -661,7 +665,6 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
|
|
||||||
public void convertUsers(DatabaseManager destination) {
|
public void convertUsers(DatabaseManager destination) {
|
||||||
BufferedReader in = null;
|
BufferedReader in = null;
|
||||||
String usersFilePath = mcMMO.getUsersFilePath();
|
|
||||||
int convertedUsers = 0;
|
int convertedUsers = 0;
|
||||||
long startMillis = System.currentTimeMillis();
|
long startMillis = System.currentTimeMillis();
|
||||||
|
|
||||||
@ -706,7 +709,6 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
BufferedReader in = null;
|
BufferedReader in = null;
|
||||||
FileWriter out = null;
|
FileWriter out = null;
|
||||||
String usersFilePath = mcMMO.getUsersFilePath();
|
|
||||||
|
|
||||||
synchronized (fileWritingLock) {
|
synchronized (fileWritingLock) {
|
||||||
try {
|
try {
|
||||||
@ -718,8 +720,8 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
String[] character = line.split(":");
|
String[] character = line.split(":");
|
||||||
if (!worked && character[USERNAME_INDEX].equalsIgnoreCase(userName)) {
|
if (!worked && character[USERNAME_INDEX].equalsIgnoreCase(userName)) {
|
||||||
if (character.length < 42) {
|
if (character.length < 42) {
|
||||||
mcMMO.p.getLogger().severe("Could not update UUID for " + userName + "!");
|
logger.severe("Could not update UUID for " + userName + "!");
|
||||||
mcMMO.p.getLogger().severe("Database entry is invalid.");
|
logger.severe("Database entry is invalid.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -735,10 +737,10 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
out.write(writer.toString());
|
out.write(writer.toString());
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
mcMMO.p.getLogger().severe("Exception while reading " + usersFilePath + " (Are you sure you formatted it correctly?)" + e.toString());
|
logger.severe("Exception while reading " + usersFilePath + " (Are you sure you formatted it correctly?)" + e);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
mcMMO.p.getLogger().info(i + " entries written while saving UUID for " + userName);
|
logger.info(i + " entries written while saving UUID for " + userName);
|
||||||
if (in != null) {
|
if (in != null) {
|
||||||
try {
|
try {
|
||||||
in.close();
|
in.close();
|
||||||
@ -764,7 +766,6 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
public boolean saveUserUUIDs(Map<String, UUID> fetchedUUIDs) {
|
public boolean saveUserUUIDs(Map<String, UUID> fetchedUUIDs) {
|
||||||
BufferedReader in = null;
|
BufferedReader in = null;
|
||||||
FileWriter out = null;
|
FileWriter out = null;
|
||||||
String usersFilePath = mcMMO.getUsersFilePath();
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
synchronized (fileWritingLock) {
|
synchronized (fileWritingLock) {
|
||||||
@ -777,8 +778,8 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
String[] character = line.split(":");
|
String[] character = line.split(":");
|
||||||
if (!fetchedUUIDs.isEmpty() && fetchedUUIDs.containsKey(character[USERNAME_INDEX])) {
|
if (!fetchedUUIDs.isEmpty() && fetchedUUIDs.containsKey(character[USERNAME_INDEX])) {
|
||||||
if (character.length < 42) {
|
if (character.length < 42) {
|
||||||
mcMMO.p.getLogger().severe("Could not update UUID for " + character[USERNAME_INDEX] + "!");
|
logger.severe("Could not update UUID for " + character[USERNAME_INDEX] + "!");
|
||||||
mcMMO.p.getLogger().severe("Database entry is invalid.");
|
logger.severe("Database entry is invalid.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -794,10 +795,10 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
out.write(writer.toString());
|
out.write(writer.toString());
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
mcMMO.p.getLogger().severe("Exception while reading " + usersFilePath + " (Are you sure you formatted it correctly?)" + e.toString());
|
logger.severe("Exception while reading " + usersFilePath + " (Are you sure you formatted it correctly?)" + e);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
mcMMO.p.getLogger().info(i + " entries written while saving UUID batch");
|
logger.info(i + " entries written while saving UUID batch");
|
||||||
if (in != null) {
|
if (in != null) {
|
||||||
try {
|
try {
|
||||||
in.close();
|
in.close();
|
||||||
@ -823,7 +824,6 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
public List<String> getStoredUsers() {
|
public List<String> getStoredUsers() {
|
||||||
ArrayList<String> users = new ArrayList<>();
|
ArrayList<String> users = new ArrayList<>();
|
||||||
BufferedReader in = null;
|
BufferedReader in = null;
|
||||||
String usersFilePath = mcMMO.getUsersFilePath();
|
|
||||||
|
|
||||||
synchronized (fileWritingLock) {
|
synchronized (fileWritingLock) {
|
||||||
try {
|
try {
|
||||||
@ -862,7 +862,6 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String usersFilePath = mcMMO.getUsersFilePath();
|
|
||||||
lastUpdate = System.currentTimeMillis(); // Log when the last update was run
|
lastUpdate = System.currentTimeMillis(); // Log when the last update was run
|
||||||
powerLevels.clear(); // Clear old values from the power levels
|
powerLevels.clear(); // Clear old values from the power levels
|
||||||
|
|
||||||
@ -894,7 +893,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
playerName = data[USERNAME_INDEX];
|
playerName = data[USERNAME_INDEX];
|
||||||
int powerLevel = 0;
|
int powerLevel = 0;
|
||||||
|
|
||||||
Map<PrimarySkillType, Integer> skills = getSkillMapFromLine(data);
|
Map<Skill, Integer> skills = getSkillMapFromLine(data);
|
||||||
|
|
||||||
powerLevel += putStat(acrobatics, playerName, skills.get(PrimarySkillType.ACROBATICS));
|
powerLevel += putStat(acrobatics, playerName, skills.get(PrimarySkillType.ACROBATICS));
|
||||||
powerLevel += putStat(alchemy, playerName, skills.get(PrimarySkillType.ALCHEMY));
|
powerLevel += putStat(alchemy, playerName, skills.get(PrimarySkillType.ALCHEMY));
|
||||||
@ -914,7 +913,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
mcMMO.p.getLogger().severe("Exception while reading " + usersFilePath + " during user " + playerName + " (Are you sure you formatted it correctly?) " + e.toString());
|
logger.severe("Exception while reading " + usersFilePath + " during user " + playerName + " (Are you sure you formatted it correctly?) " + e);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
if (in != null) {
|
if (in != null) {
|
||||||
@ -969,7 +968,6 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
if (usersFile.exists()) {
|
if (usersFile.exists()) {
|
||||||
BufferedReader in = null;
|
BufferedReader in = null;
|
||||||
FileWriter out = null;
|
FileWriter out = null;
|
||||||
String usersFilePath = mcMMO.getUsersFilePath();
|
|
||||||
|
|
||||||
synchronized (fileWritingLock) {
|
synchronized (fileWritingLock) {
|
||||||
try {
|
try {
|
||||||
@ -996,14 +994,14 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
//Not enough data found to be considered a user reliably (NOTE: not foolproof)
|
//Not enough data found to be considered a user reliably (NOTE: not foolproof)
|
||||||
if(rawSplitData.length < (UUID_INDEX + 1)) {
|
if(rawSplitData.length < (UUID_INDEX + 1)) {
|
||||||
if(!corruptDataFound) {
|
if(!corruptDataFound) {
|
||||||
mcMMO.p.getLogger().severe("Some corrupt data was found in mcmmo.users and has been repaired, it is possible that some player data has been lost in this process.");
|
logger.severe("Some corrupt data was found in mcmmo.users and has been repaired, it is possible that some player data has been lost in this process.");
|
||||||
corruptDataFound = true;
|
corruptDataFound = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(rawSplitData.length >= 10 //The value here is kind of arbitrary, it shouldn't be too low to avoid false positives, but also we aren't really going to correctly identify when player data has been corrupted or not with 100% accuracy ever
|
if(rawSplitData.length >= 10 //The value here is kind of arbitrary, it shouldn't be too low to avoid false positives, but also we aren't really going to correctly identify when player data has been corrupted or not with 100% accuracy ever
|
||||||
&& rawSplitData[0] != null && !rawSplitData[0].isEmpty()) {
|
&& rawSplitData[0] != null && !rawSplitData[0].isEmpty()) {
|
||||||
if(rawSplitData[0].length() <= 16 && rawSplitData[0].length() >= 3) {
|
if(rawSplitData[0].length() <= 16 && rawSplitData[0].length() >= 3) {
|
||||||
mcMMO.p.getLogger().severe("Not enough data found to recover corrupted player data for user: "+rawSplitData[0]);
|
logger.severe("Not enough data found to recover corrupted player data for user: "+rawSplitData[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//This user may have had a name so declare it
|
//This user may have had a name so declare it
|
||||||
@ -1016,7 +1014,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
//TODO: Check if the commented out code was even necessary
|
//TODO: Check if the commented out code was even necessary
|
||||||
rawSplitData[USERNAME_INDEX] = "_INVALID_OLD_USERNAME_'";
|
rawSplitData[USERNAME_INDEX] = "_INVALID_OLD_USERNAME_'";
|
||||||
if (rawSplitData.length < UUID_INDEX + 1 || rawSplitData[UUID_INDEX].equals("NULL")) {
|
if (rawSplitData.length < UUID_INDEX + 1 || rawSplitData[UUID_INDEX].equals("NULL")) {
|
||||||
mcMMO.p.getLogger().severe("Fixing duplicate player names found in mcmmo.users");
|
logger.severe("Fixing duplicate player names found in mcmmo.users");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1026,8 +1024,8 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
&& (!rawSplitData[UUID_INDEX].isEmpty()
|
&& (!rawSplitData[UUID_INDEX].isEmpty()
|
||||||
&& !rawSplitData[UUID_INDEX].equals("NULL") && !players.add(rawSplitData[UUID_INDEX]))) {
|
&& !rawSplitData[UUID_INDEX].equals("NULL") && !players.add(rawSplitData[UUID_INDEX]))) {
|
||||||
|
|
||||||
mcMMO.p.getLogger().severe("Removing duplicate player data from mcmmo.users");
|
logger.severe("Removing duplicate player data from mcmmo.users");
|
||||||
mcMMO.p.getLogger().info("Duplicate Data: "+line);
|
logger.info("Duplicate Data: "+line);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1049,7 +1047,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
out.write(writer.toString());
|
out.write(writer.toString());
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
mcMMO.p.getLogger().severe("Exception while reading " + usersFilePath + " (Are you sure you formatted it correctly?)" + e.toString());
|
logger.severe("Exception while reading " + usersFilePath + " (Are you sure you formatted it correctly?)" + e);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
if (in != null) {
|
if (in != null) {
|
||||||
@ -1072,7 +1070,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(corruptDataFound)
|
if(corruptDataFound)
|
||||||
mcMMO.p.getLogger().info("Corrupt data was found and removed, everything should be working fine. It is possible some player data was lost.");
|
logger.info("Corrupt data was found and removed, everything should be working fine. It is possible some player data was lost.");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1080,8 +1078,8 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
usersFile.getParentFile().mkdir();
|
usersFile.getParentFile().mkdir();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mcMMO.p.debug("Creating mcmmo.users file...");
|
logger.info("Creating mcmmo.users file...");
|
||||||
new File(mcMMO.getUsersFilePath()).createNewFile();
|
new File(usersFilePath).createNewFile();
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -1119,11 +1117,10 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private PlayerProfile loadFromLine(@NotNull String[] character) {
|
private PlayerProfile loadFromLine(@NotNull String[] character) {
|
||||||
Map<PrimarySkillType, Integer> skills = getSkillMapFromLine(character); // Skill levels
|
Map<Skill, Integer> skills = getSkillMapFromLine(character); // Skill levels
|
||||||
Map<PrimarySkillType, Float> skillsXp = new EnumMap<>(PrimarySkillType.class); // Skill & XP
|
Map<Skill, Float> skillsXp = new HashMap<>(); // Skill & XP
|
||||||
Map<SuperAbilityType, Integer> skillsDATS = new EnumMap<>(SuperAbilityType.class); // Ability & Cooldown
|
Map<SuperAbilityType, Integer> skillsDATS = new EnumMap<>(SuperAbilityType.class); // Ability & Cooldown
|
||||||
Map<UniqueDataType, Integer> uniquePlayerDataMap = new EnumMap<>(UniqueDataType.class);
|
Map<UniqueDataType, Integer> uniquePlayerDataMap = new EnumMap<>(UniqueDataType.class);
|
||||||
MobHealthbarType mobHealthbarType;
|
|
||||||
int scoreboardTipsShown;
|
int scoreboardTipsShown;
|
||||||
|
|
||||||
String username = character[USERNAME_INDEX];
|
String username = character[USERNAME_INDEX];
|
||||||
@ -1155,12 +1152,12 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
// Acrobatics - Unused
|
// Acrobatics - Unused
|
||||||
tryLoadSkillCooldownFromRawData(skillsDATS, character, SuperAbilityType.BLAST_MINING, COOLDOWN_BLAST_MINING, username);
|
tryLoadSkillCooldownFromRawData(skillsDATS, character, SuperAbilityType.BLAST_MINING, COOLDOWN_BLAST_MINING, username);
|
||||||
|
|
||||||
try {
|
// try {
|
||||||
mobHealthbarType = MobHealthbarType.valueOf(character[HEALTHBAR]);
|
// mobHealthbarType = MobHealthbarType.valueOf(character[HEALTHBAR]);
|
||||||
}
|
// }
|
||||||
catch (Exception e) {
|
// catch (Exception e) {
|
||||||
mobHealthbarType = Config.getInstance().getMobHealthbarDefault();
|
// mobHealthbarType = Config.getInstance().getMobHealthbarDefault();
|
||||||
}
|
// }
|
||||||
|
|
||||||
UUID uuid;
|
UUID uuid;
|
||||||
try {
|
try {
|
||||||
@ -1184,44 +1181,45 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
uniquePlayerDataMap.put(UniqueDataType.CHIMAERA_WING_DATS, 0);
|
uniquePlayerDataMap.put(UniqueDataType.CHIMAERA_WING_DATS, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new PlayerProfile(character[USERNAME_INDEX], uuid, skills, skillsXp, skillsDATS, mobHealthbarType, scoreboardTipsShown, uniquePlayerDataMap);
|
return new PlayerProfile(character[USERNAME_INDEX], uuid, skills, skillsXp, skillsDATS, null, scoreboardTipsShown, uniquePlayerDataMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tryLoadSkillCooldownFromRawData(@NotNull Map<SuperAbilityType, Integer> cooldownMap, @NotNull String[] character, @NotNull SuperAbilityType superAbilityType, int cooldownSuperBreaker, @NotNull String userName) {
|
private void tryLoadSkillCooldownFromRawData(@NotNull Map<SuperAbilityType, Integer> cooldownMap, @NotNull String[] character, @NotNull SuperAbilityType superAbilityType, int cooldownSuperBreaker, @NotNull String userName) {
|
||||||
try {
|
try {
|
||||||
cooldownMap.put(superAbilityType, Integer.valueOf(character[cooldownSuperBreaker]));
|
cooldownMap.put(superAbilityType, Integer.valueOf(character[cooldownSuperBreaker]));
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
mcMMO.p.getLogger().severe("Data corruption when trying to load the value for skill "+superAbilityType.toString()+" for player named " + userName+ " setting value to zero");
|
logger.severe("Data corruption when trying to load the value for skill "+superAbilityType+" for player named " + userName+ " setting value to zero");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tryLoadSkillFloatValuesFromRawData(@NotNull Map<PrimarySkillType, Float> skillMap, @NotNull String[] character, @NotNull PrimarySkillType primarySkillType, int index, @NotNull String userName) {
|
private void tryLoadSkillFloatValuesFromRawData(@NotNull Map<Skill, Float> skillMap, @NotNull String[] character, @NotNull Skill primarySkillType, int index, @NotNull String userName) {
|
||||||
try {
|
try {
|
||||||
float valueFromString = Integer.parseInt(character[index]);
|
float valueFromString = Integer.parseInt(character[index]);
|
||||||
skillMap.put(primarySkillType, valueFromString);
|
skillMap.put(primarySkillType, valueFromString);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
skillMap.put(primarySkillType, 0F);
|
skillMap.put(primarySkillType, 0F);
|
||||||
mcMMO.p.getLogger().severe("Data corruption when trying to load the value for skill "+primarySkillType.toString()+" for player named " + userName+ " setting value to zero");
|
logger.severe("Data corruption when trying to load the value for skill "+primarySkillType+" for player named " + userName+ " setting value to zero");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tryLoadSkillIntValuesFromRawData(@NotNull Map<PrimarySkillType, Integer> skillMap, @NotNull String[] character, @NotNull PrimarySkillType primarySkillType, int index, @NotNull String userName) {
|
private void tryLoadSkillIntValuesFromRawData(@NotNull Map<Skill, Integer> skillMap, @NotNull String[] character, @NotNull Skill skill, int index, @NotNull String userName) {
|
||||||
try {
|
try {
|
||||||
int valueFromString = Integer.parseInt(character[index]);
|
int valueFromString = Integer.parseInt(character[index]);
|
||||||
skillMap.put(primarySkillType, valueFromString);
|
skillMap.put(skill, valueFromString);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
skillMap.put(primarySkillType, 0);
|
skillMap.put(skill, 0);
|
||||||
mcMMO.p.getLogger().severe("Data corruption when trying to load the value for skill "+primarySkillType.toString()+" for player named " + userName+ " setting value to zero");
|
logger.severe("Data corruption when trying to load the value for skill "+skill+" for player named " + userName+ " setting value to zero");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private @NotNull Map<PrimarySkillType, Integer> getSkillMapFromLine(@NotNull String[] character) {
|
private @NotNull Map<Skill, Integer> getSkillMapFromLine(@NotNull String[] character) {
|
||||||
Map<PrimarySkillType, Integer> skills = new EnumMap<>(PrimarySkillType.class); // Skill & Level
|
HashMap<Skill, Integer> skills = new HashMap<>(); // Skill & Level
|
||||||
String username = character[USERNAME_INDEX];
|
String username = character[USERNAME_INDEX];
|
||||||
|
|
||||||
|
tryLoadSkillIntValuesFromRawData(skills, character, PrimarySkillType.ACROBATICS, SKILLS_ACROBATICS, username);
|
||||||
tryLoadSkillIntValuesFromRawData(skills, character, PrimarySkillType.TAMING, SKILLS_TAMING, username);
|
tryLoadSkillIntValuesFromRawData(skills, character, PrimarySkillType.TAMING, SKILLS_TAMING, username);
|
||||||
tryLoadSkillIntValuesFromRawData(skills, character, PrimarySkillType.MINING, SKILLS_MINING, username);
|
tryLoadSkillIntValuesFromRawData(skills, character, PrimarySkillType.MINING, SKILLS_MINING, username);
|
||||||
tryLoadSkillIntValuesFromRawData(skills, character, PrimarySkillType.REPAIR, SKILLS_REPAIR, username);
|
tryLoadSkillIntValuesFromRawData(skills, character, PrimarySkillType.REPAIR, SKILLS_REPAIR, username);
|
||||||
@ -1232,7 +1230,6 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
tryLoadSkillIntValuesFromRawData(skills, character, PrimarySkillType.ARCHERY, SKILLS_ARCHERY, username);
|
tryLoadSkillIntValuesFromRawData(skills, character, PrimarySkillType.ARCHERY, SKILLS_ARCHERY, username);
|
||||||
tryLoadSkillIntValuesFromRawData(skills, character, PrimarySkillType.SWORDS, SKILLS_SWORDS, username);
|
tryLoadSkillIntValuesFromRawData(skills, character, PrimarySkillType.SWORDS, SKILLS_SWORDS, username);
|
||||||
tryLoadSkillIntValuesFromRawData(skills, character, PrimarySkillType.AXES, SKILLS_AXES, username);
|
tryLoadSkillIntValuesFromRawData(skills, character, PrimarySkillType.AXES, SKILLS_AXES, username);
|
||||||
tryLoadSkillIntValuesFromRawData(skills, character, PrimarySkillType.ACROBATICS, SKILLS_ACROBATICS, username);
|
|
||||||
tryLoadSkillIntValuesFromRawData(skills, character, PrimarySkillType.FISHING, SKILLS_FISHING, username);
|
tryLoadSkillIntValuesFromRawData(skills, character, PrimarySkillType.FISHING, SKILLS_FISHING, username);
|
||||||
tryLoadSkillIntValuesFromRawData(skills, character, PrimarySkillType.ALCHEMY, SKILLS_ALCHEMY, username);
|
tryLoadSkillIntValuesFromRawData(skills, character, PrimarySkillType.ALCHEMY, SKILLS_ALCHEMY, username);
|
||||||
|
|
||||||
@ -1243,93 +1240,10 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
return DatabaseType.FLATFILE;
|
return DatabaseType.FLATFILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public File getUsersFile() {
|
||||||
|
return usersFile;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() { }
|
public void onDisable() { }
|
||||||
|
|
||||||
private int getSkillIndex(PrimarySkillType skill) {
|
|
||||||
switch (skill) {
|
|
||||||
case ACROBATICS:
|
|
||||||
return SKILLS_ACROBATICS;
|
|
||||||
case ALCHEMY:
|
|
||||||
return SKILLS_ALCHEMY;
|
|
||||||
case ARCHERY:
|
|
||||||
return SKILLS_ARCHERY;
|
|
||||||
case AXES:
|
|
||||||
return SKILLS_AXES;
|
|
||||||
case EXCAVATION:
|
|
||||||
return SKILLS_EXCAVATION;
|
|
||||||
case FISHING:
|
|
||||||
return SKILLS_FISHING;
|
|
||||||
case HERBALISM:
|
|
||||||
return SKILLS_HERBALISM;
|
|
||||||
case MINING:
|
|
||||||
return SKILLS_MINING;
|
|
||||||
case REPAIR:
|
|
||||||
return SKILLS_REPAIR;
|
|
||||||
case SWORDS:
|
|
||||||
return SKILLS_SWORDS;
|
|
||||||
case TAMING:
|
|
||||||
return SKILLS_TAMING;
|
|
||||||
case UNARMED:
|
|
||||||
return SKILLS_UNARMED;
|
|
||||||
case WOODCUTTING:
|
|
||||||
return SKILLS_WOODCUTTING;
|
|
||||||
default:
|
|
||||||
throw new RuntimeException("Primary Skills only");
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void resetMobHealthSettings() {
|
|
||||||
BufferedReader in = null;
|
|
||||||
FileWriter out = null;
|
|
||||||
String usersFilePath = mcMMO.getUsersFilePath();
|
|
||||||
|
|
||||||
synchronized (fileWritingLock) {
|
|
||||||
try {
|
|
||||||
in = new BufferedReader(new FileReader(usersFilePath));
|
|
||||||
StringBuilder writer = new StringBuilder();
|
|
||||||
String line;
|
|
||||||
|
|
||||||
while ((line = in.readLine()) != null) {
|
|
||||||
// Remove empty lines from the file
|
|
||||||
if (line.isEmpty()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
String[] character = line.split(":");
|
|
||||||
|
|
||||||
character[HEALTHBAR] = Config.getInstance().getMobHealthbarDefault().toString();
|
|
||||||
|
|
||||||
line = org.apache.commons.lang.StringUtils.join(character, ":") + ":";
|
|
||||||
|
|
||||||
writer.append(line).append("\r\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write the new file
|
|
||||||
out = new FileWriter(usersFilePath);
|
|
||||||
out.write(writer.toString());
|
|
||||||
}
|
|
||||||
catch (IOException e) {
|
|
||||||
mcMMO.p.getLogger().severe("Exception while reading " + usersFilePath + " (Are you sure you formatted it correctly?)" + e.toString());
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
if (in != null) {
|
|
||||||
try {
|
|
||||||
in.close();
|
|
||||||
}
|
|
||||||
catch (IOException e) {
|
|
||||||
// Ignore
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (out != null) {
|
|
||||||
try {
|
|
||||||
out.close();
|
|
||||||
}
|
|
||||||
catch (IOException e) {
|
|
||||||
// Ignore
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
package com.gmail.nossr50.database;
|
package com.gmail.nossr50.database;
|
||||||
|
|
||||||
import com.gmail.nossr50.api.exceptions.InvalidSkillException;
|
import com.gmail.nossr50.api.exceptions.InvalidSkillException;
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.datatypes.MobHealthbarType;
|
import com.gmail.nossr50.datatypes.MobHealthbarType;
|
||||||
import com.gmail.nossr50.datatypes.database.DatabaseType;
|
import com.gmail.nossr50.datatypes.database.DatabaseType;
|
||||||
import com.gmail.nossr50.datatypes.database.PlayerStat;
|
import com.gmail.nossr50.datatypes.database.PlayerStat;
|
||||||
@ -11,6 +9,7 @@ import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
|||||||
import com.gmail.nossr50.datatypes.player.UniqueDataType;
|
import com.gmail.nossr50.datatypes.player.UniqueDataType;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.interfaces.Skill;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.runnables.database.UUIDUpdateAsyncTask;
|
import com.gmail.nossr50.runnables.database.UUIDUpdateAsyncTask;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
@ -30,7 +29,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
public static final String MOBHEALTHBAR_VARCHAR = "VARCHAR(50)";
|
public static final String MOBHEALTHBAR_VARCHAR = "VARCHAR(50)";
|
||||||
public static final String UUID_VARCHAR = "VARCHAR(36)";
|
public static final String UUID_VARCHAR = "VARCHAR(36)";
|
||||||
public static final String USER_VARCHAR = "VARCHAR(40)";
|
public static final String USER_VARCHAR = "VARCHAR(40)";
|
||||||
private final String tablePrefix = Config.getInstance().getMySQLTablePrefix();
|
private final String tablePrefix = mcMMO.p.getGeneralConfig().getMySQLTablePrefix();
|
||||||
|
|
||||||
private final Map<UUID, Integer> cachedUserIDs = new HashMap<>();
|
private final Map<UUID, Integer> cachedUserIDs = new HashMap<>();
|
||||||
|
|
||||||
@ -45,10 +44,10 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
private final String CHARSET_SQL = "utf8mb4"; //This is compliant with UTF-8 while "utf8" is not, confusing but this is how it is.
|
private final String CHARSET_SQL = "utf8mb4"; //This is compliant with UTF-8 while "utf8" is not, confusing but this is how it is.
|
||||||
|
|
||||||
protected SQLDatabaseManager() {
|
protected SQLDatabaseManager() {
|
||||||
String connectionString = "jdbc:mysql://" + Config.getInstance().getMySQLServerName()
|
String connectionString = "jdbc:mysql://" + mcMMO.p.getGeneralConfig().getMySQLServerName()
|
||||||
+ ":" + Config.getInstance().getMySQLServerPort() + "/" + Config.getInstance().getMySQLDatabaseName();
|
+ ":" + mcMMO.p.getGeneralConfig().getMySQLServerPort() + "/" + mcMMO.p.getGeneralConfig().getMySQLDatabaseName();
|
||||||
|
|
||||||
if(Config.getInstance().getMySQLSSL())
|
if(mcMMO.p.getGeneralConfig().getMySQLSSL())
|
||||||
connectionString +=
|
connectionString +=
|
||||||
"?verifyServerCertificate=false"+
|
"?verifyServerCertificate=false"+
|
||||||
"&useSSL=true"+
|
"&useSSL=true"+
|
||||||
@ -67,16 +66,15 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
//throw e; // aborts onEnable() Riking if you want to do this, fully implement it.
|
//throw e; // aborts onEnable() Riking if you want to do this, fully implement it.
|
||||||
}
|
}
|
||||||
|
|
||||||
debug = Config.getInstance().getMySQLDebug();
|
debug = mcMMO.p.getGeneralConfig().getMySQLDebug();
|
||||||
|
|
||||||
|
|
||||||
PoolProperties poolProperties = new PoolProperties();
|
PoolProperties poolProperties = new PoolProperties();
|
||||||
poolProperties.setDriverClassName("com.mysql.jdbc.Driver");
|
poolProperties.setDriverClassName("com.mysql.jdbc.Driver");
|
||||||
poolProperties.setUrl(connectionString);
|
poolProperties.setUrl(connectionString);
|
||||||
poolProperties.setUsername(Config.getInstance().getMySQLUserName());
|
poolProperties.setUsername(mcMMO.p.getGeneralConfig().getMySQLUserName());
|
||||||
poolProperties.setPassword(Config.getInstance().getMySQLUserPassword());
|
poolProperties.setPassword(mcMMO.p.getGeneralConfig().getMySQLUserPassword());
|
||||||
poolProperties.setMaxIdle(Config.getInstance().getMySQLMaxPoolSize(PoolIdentifier.MISC));
|
poolProperties.setMaxIdle(mcMMO.p.getGeneralConfig().getMySQLMaxPoolSize(PoolIdentifier.MISC));
|
||||||
poolProperties.setMaxActive(Config.getInstance().getMySQLMaxConnections(PoolIdentifier.MISC));
|
poolProperties.setMaxActive(mcMMO.p.getGeneralConfig().getMySQLMaxConnections(PoolIdentifier.MISC));
|
||||||
poolProperties.setInitialSize(0);
|
poolProperties.setInitialSize(0);
|
||||||
poolProperties.setMaxWait(-1);
|
poolProperties.setMaxWait(-1);
|
||||||
poolProperties.setRemoveAbandoned(true);
|
poolProperties.setRemoveAbandoned(true);
|
||||||
@ -88,11 +86,11 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
poolProperties = new PoolProperties();
|
poolProperties = new PoolProperties();
|
||||||
poolProperties.setDriverClassName("com.mysql.jdbc.Driver");
|
poolProperties.setDriverClassName("com.mysql.jdbc.Driver");
|
||||||
poolProperties.setUrl(connectionString);
|
poolProperties.setUrl(connectionString);
|
||||||
poolProperties.setUsername(Config.getInstance().getMySQLUserName());
|
poolProperties.setUsername(mcMMO.p.getGeneralConfig().getMySQLUserName());
|
||||||
poolProperties.setPassword(Config.getInstance().getMySQLUserPassword());
|
poolProperties.setPassword(mcMMO.p.getGeneralConfig().getMySQLUserPassword());
|
||||||
poolProperties.setInitialSize(0);
|
poolProperties.setInitialSize(0);
|
||||||
poolProperties.setMaxIdle(Config.getInstance().getMySQLMaxPoolSize(PoolIdentifier.SAVE));
|
poolProperties.setMaxIdle(mcMMO.p.getGeneralConfig().getMySQLMaxPoolSize(PoolIdentifier.SAVE));
|
||||||
poolProperties.setMaxActive(Config.getInstance().getMySQLMaxConnections(PoolIdentifier.SAVE));
|
poolProperties.setMaxActive(mcMMO.p.getGeneralConfig().getMySQLMaxConnections(PoolIdentifier.SAVE));
|
||||||
poolProperties.setMaxWait(-1);
|
poolProperties.setMaxWait(-1);
|
||||||
poolProperties.setRemoveAbandoned(true);
|
poolProperties.setRemoveAbandoned(true);
|
||||||
poolProperties.setRemoveAbandonedTimeout(60);
|
poolProperties.setRemoveAbandonedTimeout(60);
|
||||||
@ -103,11 +101,11 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
poolProperties = new PoolProperties();
|
poolProperties = new PoolProperties();
|
||||||
poolProperties.setDriverClassName("com.mysql.jdbc.Driver");
|
poolProperties.setDriverClassName("com.mysql.jdbc.Driver");
|
||||||
poolProperties.setUrl(connectionString);
|
poolProperties.setUrl(connectionString);
|
||||||
poolProperties.setUsername(Config.getInstance().getMySQLUserName());
|
poolProperties.setUsername(mcMMO.p.getGeneralConfig().getMySQLUserName());
|
||||||
poolProperties.setPassword(Config.getInstance().getMySQLUserPassword());
|
poolProperties.setPassword(mcMMO.p.getGeneralConfig().getMySQLUserPassword());
|
||||||
poolProperties.setInitialSize(0);
|
poolProperties.setInitialSize(0);
|
||||||
poolProperties.setMaxIdle(Config.getInstance().getMySQLMaxPoolSize(PoolIdentifier.LOAD));
|
poolProperties.setMaxIdle(mcMMO.p.getGeneralConfig().getMySQLMaxPoolSize(PoolIdentifier.LOAD));
|
||||||
poolProperties.setMaxActive(Config.getInstance().getMySQLMaxConnections(PoolIdentifier.LOAD));
|
poolProperties.setMaxActive(mcMMO.p.getGeneralConfig().getMySQLMaxConnections(PoolIdentifier.LOAD));
|
||||||
poolProperties.setMaxWait(-1);
|
poolProperties.setMaxWait(-1);
|
||||||
poolProperties.setRemoveAbandoned(true);
|
poolProperties.setRemoveAbandoned(true);
|
||||||
poolProperties.setRemoveAbandonedTimeout(60);
|
poolProperties.setRemoveAbandonedTimeout(60);
|
||||||
@ -115,11 +113,14 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
poolProperties.setValidationQuery("SELECT 1");
|
poolProperties.setValidationQuery("SELECT 1");
|
||||||
poolProperties.setValidationInterval(30000);
|
poolProperties.setValidationInterval(30000);
|
||||||
loadPool = new DataSource(poolProperties);
|
loadPool = new DataSource(poolProperties);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init() {
|
||||||
checkStructure();
|
checkStructure();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void purgePowerlessUsers() {
|
public int purgePowerlessUsers() {
|
||||||
massUpdateLock.lock();
|
massUpdateLock.lock();
|
||||||
mcMMO.p.getLogger().info("Purging powerless users...");
|
mcMMO.p.getLogger().info("Purging powerless users...");
|
||||||
|
|
||||||
@ -152,11 +153,12 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mcMMO.p.getLogger().info("Purged " + purged + " users from the database.");
|
mcMMO.p.getLogger().info("Purged " + purged + " users from the database.");
|
||||||
|
return purged;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void purgeOldUsers() {
|
public void purgeOldUsers() {
|
||||||
massUpdateLock.lock();
|
massUpdateLock.lock();
|
||||||
mcMMO.p.getLogger().info("Purging inactive users older than " + (PURGE_TIME / 2630000000L) + " months...");
|
mcMMO.p.getLogger().info("Purging inactive users older than " + (mcMMO.p.getPurgeTime() / 2630000000L) + " months...");
|
||||||
|
|
||||||
Connection connection = null;
|
Connection connection = null;
|
||||||
Statement statement = null;
|
Statement statement = null;
|
||||||
@ -171,7 +173,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
"JOIN " + tablePrefix + "huds h ON (u.id = h.user_id) " +
|
"JOIN " + tablePrefix + "huds h ON (u.id = h.user_id) " +
|
||||||
"JOIN " + tablePrefix + "skills s ON (u.id = s.user_id) " +
|
"JOIN " + tablePrefix + "skills s ON (u.id = s.user_id) " +
|
||||||
"JOIN " + tablePrefix + "cooldowns c ON (u.id = c.user_id) " +
|
"JOIN " + tablePrefix + "cooldowns c ON (u.id = c.user_id) " +
|
||||||
"WHERE ((UNIX_TIMESTAMP() - lastlogin) > " + PURGE_TIME + ")");
|
"WHERE ((UNIX_TIMESTAMP() - lastlogin) > " + mcMMO.p.getPurgeTime() + ")");
|
||||||
}
|
}
|
||||||
catch (SQLException ex) {
|
catch (SQLException ex) {
|
||||||
printErrors(ex);
|
printErrors(ex);
|
||||||
@ -331,7 +333,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
statement = connection.prepareStatement("UPDATE " + tablePrefix + "huds SET mobhealthbar = ?, scoreboardtips = ? WHERE user_id = ?");
|
statement = connection.prepareStatement("UPDATE " + tablePrefix + "huds SET mobhealthbar = ?, scoreboardtips = ? WHERE user_id = ?");
|
||||||
statement.setString(1, profile.getMobHealthbarType() == null ? Config.getInstance().getMobHealthbarDefault().name() : profile.getMobHealthbarType().name());
|
statement.setString(1, profile.getMobHealthbarType() == null ? mcMMO.p.getGeneralConfig().getMobHealthbarDefault().name() : profile.getMobHealthbarType().name());
|
||||||
statement.setInt(2, profile.getScoreboardTipsShown());
|
statement.setInt(2, profile.getScoreboardTipsShown());
|
||||||
statement.setInt(3, id);
|
statement.setInt(3, id);
|
||||||
success = (statement.executeUpdate() != 0);
|
success = (statement.executeUpdate() != 0);
|
||||||
@ -818,7 +820,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
statement = connection.prepareStatement("SELECT table_name FROM INFORMATION_SCHEMA.TABLES"
|
statement = connection.prepareStatement("SELECT table_name FROM INFORMATION_SCHEMA.TABLES"
|
||||||
+ " WHERE table_schema = ?"
|
+ " WHERE table_schema = ?"
|
||||||
+ " AND table_name = ?");
|
+ " AND table_name = ?");
|
||||||
statement.setString(1, Config.getInstance().getMySQLDatabaseName());
|
statement.setString(1, mcMMO.p.getGeneralConfig().getMySQLDatabaseName());
|
||||||
statement.setString(2, tablePrefix + "users");
|
statement.setString(2, tablePrefix + "users");
|
||||||
resultSet = statement.executeQuery();
|
resultSet = statement.executeQuery();
|
||||||
if (!resultSet.next()) {
|
if (!resultSet.next()) {
|
||||||
@ -834,21 +836,21 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
tryClose(createStatement);
|
tryClose(createStatement);
|
||||||
}
|
}
|
||||||
tryClose(resultSet);
|
tryClose(resultSet);
|
||||||
statement.setString(1, Config.getInstance().getMySQLDatabaseName());
|
statement.setString(1, mcMMO.p.getGeneralConfig().getMySQLDatabaseName());
|
||||||
statement.setString(2, tablePrefix + "huds");
|
statement.setString(2, tablePrefix + "huds");
|
||||||
resultSet = statement.executeQuery();
|
resultSet = statement.executeQuery();
|
||||||
if (!resultSet.next()) {
|
if (!resultSet.next()) {
|
||||||
createStatement = connection.createStatement();
|
createStatement = connection.createStatement();
|
||||||
createStatement.executeUpdate("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "huds` ("
|
createStatement.executeUpdate("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "huds` ("
|
||||||
+ "`user_id` int(10) unsigned NOT NULL,"
|
+ "`user_id` int(10) unsigned NOT NULL,"
|
||||||
+ "`mobhealthbar` varchar(50) NOT NULL DEFAULT '" + Config.getInstance().getMobHealthbarDefault() + "',"
|
+ "`mobhealthbar` varchar(50) NOT NULL DEFAULT '" + mcMMO.p.getGeneralConfig().getMobHealthbarDefault() + "',"
|
||||||
+ "`scoreboardtips` int(10) NOT NULL DEFAULT '0',"
|
+ "`scoreboardtips` int(10) NOT NULL DEFAULT '0',"
|
||||||
+ "PRIMARY KEY (`user_id`)) "
|
+ "PRIMARY KEY (`user_id`)) "
|
||||||
+ "DEFAULT CHARSET=" + CHARSET_SQL + ";");
|
+ "DEFAULT CHARSET=" + CHARSET_SQL + ";");
|
||||||
tryClose(createStatement);
|
tryClose(createStatement);
|
||||||
}
|
}
|
||||||
tryClose(resultSet);
|
tryClose(resultSet);
|
||||||
statement.setString(1, Config.getInstance().getMySQLDatabaseName());
|
statement.setString(1, mcMMO.p.getGeneralConfig().getMySQLDatabaseName());
|
||||||
statement.setString(2, tablePrefix + "cooldowns");
|
statement.setString(2, tablePrefix + "cooldowns");
|
||||||
resultSet = statement.executeQuery();
|
resultSet = statement.executeQuery();
|
||||||
if (!resultSet.next()) {
|
if (!resultSet.next()) {
|
||||||
@ -873,12 +875,12 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
tryClose(createStatement);
|
tryClose(createStatement);
|
||||||
}
|
}
|
||||||
tryClose(resultSet);
|
tryClose(resultSet);
|
||||||
statement.setString(1, Config.getInstance().getMySQLDatabaseName());
|
statement.setString(1, mcMMO.p.getGeneralConfig().getMySQLDatabaseName());
|
||||||
statement.setString(2, tablePrefix + "skills");
|
statement.setString(2, tablePrefix + "skills");
|
||||||
resultSet = statement.executeQuery();
|
resultSet = statement.executeQuery();
|
||||||
if (!resultSet.next()) {
|
if (!resultSet.next()) {
|
||||||
String startingLevel = "'" + AdvancedConfig.getInstance().getStartingLevel() + "'";
|
String startingLevel = "'" + mcMMO.p.getAdvancedConfig().getStartingLevel() + "'";
|
||||||
String totalLevel = "'" + (AdvancedConfig.getInstance().getStartingLevel() * (PrimarySkillType.values().length - PrimarySkillType.CHILD_SKILLS.size())) + "'";
|
String totalLevel = "'" + (mcMMO.p.getAdvancedConfig().getStartingLevel() * (PrimarySkillType.values().length - PrimarySkillType.CHILD_SKILLS.size())) + "'";
|
||||||
createStatement = connection.createStatement();
|
createStatement = connection.createStatement();
|
||||||
createStatement.executeUpdate("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "skills` ("
|
createStatement.executeUpdate("CREATE TABLE IF NOT EXISTS `" + tablePrefix + "skills` ("
|
||||||
+ "`user_id` int(10) unsigned NOT NULL,"
|
+ "`user_id` int(10) unsigned NOT NULL,"
|
||||||
@ -901,7 +903,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
tryClose(createStatement);
|
tryClose(createStatement);
|
||||||
}
|
}
|
||||||
tryClose(resultSet);
|
tryClose(resultSet);
|
||||||
statement.setString(1, Config.getInstance().getMySQLDatabaseName());
|
statement.setString(1, mcMMO.p.getGeneralConfig().getMySQLDatabaseName());
|
||||||
statement.setString(2, tablePrefix + "experience");
|
statement.setString(2, tablePrefix + "experience");
|
||||||
resultSet = statement.executeQuery();
|
resultSet = statement.executeQuery();
|
||||||
if (!resultSet.next()) {
|
if (!resultSet.next()) {
|
||||||
@ -932,9 +934,9 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
checkDatabaseStructure(connection, updateType);
|
checkDatabaseStructure(connection, updateType);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getTruncateSkills()) {
|
if (mcMMO.p.getGeneralConfig().getTruncateSkills()) {
|
||||||
for (PrimarySkillType skill : PrimarySkillType.NON_CHILD_SKILLS) {
|
for (PrimarySkillType skill : PrimarySkillType.NON_CHILD_SKILLS) {
|
||||||
int cap = Config.getInstance().getLevelCap(skill);
|
int cap = mcMMO.p.getGeneralConfig().getLevelCap(skill);
|
||||||
if (cap != Integer.MAX_VALUE) {
|
if (cap != Integer.MAX_VALUE) {
|
||||||
statement = connection.prepareStatement("UPDATE `" + tablePrefix + "skills` SET `" + skill.name().toLowerCase(Locale.ENGLISH) + "` = " + cap + " WHERE `" + skill.name().toLowerCase(Locale.ENGLISH) + "` > " + cap);
|
statement = connection.prepareStatement("UPDATE `" + tablePrefix + "skills` SET `" + skill.name().toLowerCase(Locale.ENGLISH) + "` = " + cap + " WHERE `" + skill.name().toLowerCase(Locale.ENGLISH) + "` > " + cap);
|
||||||
statement.executeUpdate();
|
statement.executeUpdate();
|
||||||
@ -1083,7 +1085,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
|
|
||||||
statement = connection.prepareStatement("INSERT IGNORE INTO " + tablePrefix + "huds (user_id, mobhealthbar, scoreboardtips) VALUES (?, ?, ?)");
|
statement = connection.prepareStatement("INSERT IGNORE INTO " + tablePrefix + "huds (user_id, mobhealthbar, scoreboardtips) VALUES (?, ?, ?)");
|
||||||
statement.setInt(1, id);
|
statement.setInt(1, id);
|
||||||
statement.setString(2, Config.getInstance().getMobHealthbarDefault().name());
|
statement.setString(2, mcMMO.p.getGeneralConfig().getMobHealthbarDefault().name());
|
||||||
statement.setInt(3, 0);
|
statement.setInt(3, 0);
|
||||||
statement.execute();
|
statement.execute();
|
||||||
statement.close();
|
statement.close();
|
||||||
@ -1097,8 +1099,8 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private PlayerProfile loadFromResult(String playerName, ResultSet result) throws SQLException {
|
private PlayerProfile loadFromResult(String playerName, ResultSet result) throws SQLException {
|
||||||
Map<PrimarySkillType, Integer> skills = new EnumMap<>(PrimarySkillType.class); // Skill & Level
|
Map<Skill, Integer> skills = new HashMap<>(); // Skill & Level
|
||||||
Map<PrimarySkillType, Float> skillsXp = new EnumMap<>(PrimarySkillType.class); // Skill & XP
|
Map<Skill, Float> skillsXp = new HashMap<>(); // Skill & XP
|
||||||
Map<SuperAbilityType, Integer> skillsDATS = new EnumMap<>(SuperAbilityType.class); // Ability & Cooldown
|
Map<SuperAbilityType, Integer> skillsDATS = new EnumMap<>(SuperAbilityType.class); // Ability & Cooldown
|
||||||
Map<UniqueDataType, Integer> uniqueData = new EnumMap<>(UniqueDataType.class); //Chimaera wing cooldown and other misc info
|
Map<UniqueDataType, Integer> uniqueData = new EnumMap<>(UniqueDataType.class); //Chimaera wing cooldown and other misc info
|
||||||
MobHealthbarType mobHealthbarType;
|
MobHealthbarType mobHealthbarType;
|
||||||
@ -1158,7 +1160,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
mobHealthbarType = MobHealthbarType.valueOf(result.getString(OFFSET_OTHER + 1));
|
mobHealthbarType = MobHealthbarType.valueOf(result.getString(OFFSET_OTHER + 1));
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
mobHealthbarType = Config.getInstance().getMobHealthbarDefault();
|
mobHealthbarType = mcMMO.p.getGeneralConfig().getMobHealthbarDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -1270,7 +1272,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
catch (SQLException ex) {
|
catch (SQLException ex) {
|
||||||
mcMMO.p.getLogger().info("Updating mcMMO MySQL tables for mob healthbars...");
|
mcMMO.p.getLogger().info("Updating mcMMO MySQL tables for mob healthbars...");
|
||||||
statement.executeUpdate("ALTER TABLE `" + tablePrefix + "huds` ADD `mobhealthbar` varchar(50) NOT NULL DEFAULT '" + Config.getInstance().getMobHealthbarDefault() + "'");
|
statement.executeUpdate("ALTER TABLE `" + tablePrefix + "huds` ADD `mobhealthbar` varchar(50) NOT NULL DEFAULT '" + mcMMO.p.getGeneralConfig().getMobHealthbarDefault() + "'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1579,7 +1581,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
try {
|
try {
|
||||||
connection = getConnection(PoolIdentifier.MISC);
|
connection = getConnection(PoolIdentifier.MISC);
|
||||||
statement = connection.prepareStatement("UPDATE " + tablePrefix + "huds SET mobhealthbar = ?");
|
statement = connection.prepareStatement("UPDATE " + tablePrefix + "huds SET mobhealthbar = ?");
|
||||||
statement.setString(1, Config.getInstance().getMobHealthbarDefault().toString());
|
statement.setString(1, mcMMO.p.getGeneralConfig().getMobHealthbarDefault().toString());
|
||||||
statement.executeUpdate();
|
statement.executeUpdate();
|
||||||
}
|
}
|
||||||
catch (SQLException ex) {
|
catch (SQLException ex) {
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.datatypes;
|
package com.gmail.nossr50.datatypes;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
@ -42,7 +41,7 @@ public class LevelUpBroadcastPredicate<T extends CommandSender> implements Predi
|
|||||||
Player listeningPlayer = (Player) t;
|
Player listeningPlayer = (Player) t;
|
||||||
|
|
||||||
//Party Member Check
|
//Party Member Check
|
||||||
if(Config.getInstance().isLevelUpBroadcastsPartyMembersOnly()) {
|
if(mcMMO.p.getGeneralConfig().isLevelUpBroadcastsPartyMembersOnly()) {
|
||||||
McMMOPlayer mmoListeningPlayer = UserManager.getPlayer(listeningPlayer);
|
McMMOPlayer mmoListeningPlayer = UserManager.getPlayer(listeningPlayer);
|
||||||
|
|
||||||
if(mmoListeningPlayer == null) {
|
if(mmoListeningPlayer == null) {
|
||||||
@ -68,8 +67,8 @@ public class LevelUpBroadcastPredicate<T extends CommandSender> implements Predi
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Distance checks
|
//Distance checks
|
||||||
if(Config.getInstance().shouldLevelUpBroadcastsRestrictDistance()) {
|
if(mcMMO.p.getGeneralConfig().shouldLevelUpBroadcastsRestrictDistance()) {
|
||||||
if(!Misc.isNear(mmoBroadcastingPlayer.getPlayer().getLocation(), listeningPlayer.getLocation(), Config.getInstance().getLevelUpBroadcastRadius())) {
|
if(!Misc.isNear(mmoBroadcastingPlayer.getPlayer().getLocation(), listeningPlayer.getLocation(), mcMMO.p.getGeneralConfig().getLevelUpBroadcastRadius())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -83,12 +82,12 @@ public class LevelUpBroadcastPredicate<T extends CommandSender> implements Predi
|
|||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
//Send out to console
|
//Send out to console
|
||||||
return Config.getInstance().shouldLevelUpBroadcastToConsole();
|
return mcMMO.p.getGeneralConfig().shouldLevelUpBroadcastToConsole();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isLevelUpBroadcastsSameWorldOnly() {
|
private static boolean isLevelUpBroadcastsSameWorldOnly() {
|
||||||
return Config.getInstance().isLevelUpBroadcastsSameWorldOnly();
|
return mcMMO.p.getGeneralConfig().isLevelUpBroadcastsSameWorldOnly();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.datatypes;
|
package com.gmail.nossr50.datatypes;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
@ -42,7 +41,7 @@ public class PowerLevelUpBroadcastPredicate<T extends CommandSender> implements
|
|||||||
Player listeningPlayer = (Player) t;
|
Player listeningPlayer = (Player) t;
|
||||||
|
|
||||||
//Party Member Check
|
//Party Member Check
|
||||||
if(Config.getInstance().isPowerLevelUpBroadcastsPartyMembersOnly()) {
|
if(mcMMO.p.getGeneralConfig().isPowerLevelUpBroadcastsPartyMembersOnly()) {
|
||||||
McMMOPlayer mmoListeningPlayer = UserManager.getPlayer(listeningPlayer);
|
McMMOPlayer mmoListeningPlayer = UserManager.getPlayer(listeningPlayer);
|
||||||
|
|
||||||
if(mmoListeningPlayer == null) {
|
if(mmoListeningPlayer == null) {
|
||||||
@ -68,8 +67,8 @@ public class PowerLevelUpBroadcastPredicate<T extends CommandSender> implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Distance checks
|
//Distance checks
|
||||||
if(Config.getInstance().shouldPowerLevelUpBroadcastsRestrictDistance()) {
|
if(mcMMO.p.getGeneralConfig().shouldPowerLevelUpBroadcastsRestrictDistance()) {
|
||||||
if(!Misc.isNear(mmoBroadcastingPlayer.getPlayer().getLocation(), listeningPlayer.getLocation(), Config.getInstance().getPowerLevelUpBroadcastRadius())) {
|
if(!Misc.isNear(mmoBroadcastingPlayer.getPlayer().getLocation(), listeningPlayer.getLocation(), mcMMO.p.getGeneralConfig().getPowerLevelUpBroadcastRadius())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -83,12 +82,12 @@ public class PowerLevelUpBroadcastPredicate<T extends CommandSender> implements
|
|||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
//Send out to console
|
//Send out to console
|
||||||
return Config.getInstance().shouldPowerLevelUpBroadcastToConsole();
|
return mcMMO.p.getGeneralConfig().shouldPowerLevelUpBroadcastToConsole();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isPowerLevelUpBroadcastsSameWorldOnly() {
|
private static boolean isPowerLevelUpBroadcastsSameWorldOnly() {
|
||||||
return Config.getInstance().isPowerLevelUpBroadcastsSameWorldOnly();
|
return mcMMO.p.getGeneralConfig().isPowerLevelUpBroadcastsSameWorldOnly();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.gmail.nossr50.datatypes.party;
|
package com.gmail.nossr50.datatypes.party;
|
||||||
|
|
||||||
import com.gmail.nossr50.chat.SamePartyPredicate;
|
import com.gmail.nossr50.chat.SamePartyPredicate;
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
@ -204,7 +203,7 @@ public class Party {
|
|||||||
|
|
||||||
public int getXpToLevel() {
|
public int getXpToLevel() {
|
||||||
FormulaType formulaType = ExperienceConfig.getInstance().getFormulaType();
|
FormulaType formulaType = ExperienceConfig.getInstance().getFormulaType();
|
||||||
return (mcMMO.getFormulaManager().getXPtoNextLevel(level, formulaType)) * (getOnlineMembers().size() + Config.getInstance().getPartyXpCurveMultiplier());
|
return (mcMMO.getFormulaManager().getXPtoNextLevel(level, formulaType)) * (getOnlineMembers().size() + mcMMO.p.getGeneralConfig().getPartyXpCurveMultiplier());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getXpToLevelPercentage() {
|
public String getXpToLevelPercentage() {
|
||||||
@ -243,13 +242,13 @@ public class Party {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Config.getInstance().getPartyInformAllMembers()) {
|
if (!mcMMO.p.getGeneralConfig().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 (mcMMO.p.getGeneralConfig().getLevelUpSoundsEnabled()) {
|
||||||
SoundManager.sendSound(leader, leader.getLocation(), SoundType.LEVEL_UP);
|
SoundManager.sendSound(leader, leader.getLocation(), SoundType.LEVEL_UP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -260,7 +259,7 @@ public class Party {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasReachedLevelCap() {
|
public boolean hasReachedLevelCap() {
|
||||||
return Config.getInstance().getPartyLevelCap() < getLevel() + 1;
|
return mcMMO.p.getGeneralConfig().getPartyLevelCap() < getLevel() + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setXpShareMode(ShareMode xpShareMode) {
|
public void setXpShareMode(ShareMode xpShareMode) {
|
||||||
@ -386,7 +385,7 @@ public class Party {
|
|||||||
|
|
||||||
if (party != null) {
|
if (party != null) {
|
||||||
Player player = mcMMOPlayer.getPlayer();
|
Player player = mcMMOPlayer.getPlayer();
|
||||||
double range = Config.getInstance().getPartyShareRange();
|
double range = mcMMO.p.getGeneralConfig().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)) {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.gmail.nossr50.datatypes.party;
|
package com.gmail.nossr50.datatypes.party;
|
||||||
|
|
||||||
import com.gmail.nossr50.commands.party.PartySubcommandType;
|
import com.gmail.nossr50.commands.party.PartySubcommandType;
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.text.StringUtils;
|
import com.gmail.nossr50.util.text.StringUtils;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -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(" ", ""), mcMMO.p.getGeneralConfig().getPartyFeatureUnlockLevel(this)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasPermission(Player player) {
|
public boolean hasPermission(Player player) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.datatypes.party;
|
package com.gmail.nossr50.datatypes.party;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.mcMMO;
|
||||||
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 = mcMMO.p.getGeneralConfig().getPTPCommandConfirmRequired();
|
||||||
timeout = 0;
|
timeout = 0;
|
||||||
lastUse = 0;
|
lastUse = 0;
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
package com.gmail.nossr50.datatypes.player;
|
package com.gmail.nossr50.datatypes.player;
|
||||||
|
|
||||||
import com.gmail.nossr50.chat.author.PlayerAuthor;
|
import com.gmail.nossr50.chat.author.PlayerAuthor;
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
|
||||||
import com.gmail.nossr50.config.ChatConfig;
|
import com.gmail.nossr50.config.ChatConfig;
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.config.WorldBlacklist;
|
import com.gmail.nossr50.config.WorldBlacklist;
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.datatypes.chat.ChatChannel;
|
import com.gmail.nossr50.datatypes.chat.ChatChannel;
|
||||||
@ -200,9 +198,9 @@ public class McMMOPlayer implements Identified {
|
|||||||
{
|
{
|
||||||
//Check if they've reached the power level cap just now
|
//Check if they've reached the power level cap just now
|
||||||
if(hasReachedPowerLevelCap()) {
|
if(hasReachedPowerLevelCap()) {
|
||||||
NotificationManager.sendPlayerInformationChatOnly(player, "LevelCap.PowerLevel", String.valueOf(Config.getInstance().getPowerLevelCap()));
|
NotificationManager.sendPlayerInformationChatOnly(player, "LevelCap.PowerLevel", String.valueOf(mcMMO.p.getGeneralConfig().getPowerLevelCap()));
|
||||||
} else if(hasReachedLevelCap(primarySkillType)) {
|
} else if(hasReachedLevelCap(primarySkillType)) {
|
||||||
NotificationManager.sendPlayerInformationChatOnly(player, "LevelCap.Skill", String.valueOf(Config.getInstance().getLevelCap(primarySkillType)), primarySkillType.getName());
|
NotificationManager.sendPlayerInformationChatOnly(player, "LevelCap.Skill", String.valueOf(mcMMO.p.getGeneralConfig().getLevelCap(primarySkillType)), primarySkillType.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
//Updates from Party sources
|
//Updates from Party sources
|
||||||
@ -537,7 +535,7 @@ public class McMMOPlayer implements Identified {
|
|||||||
if(hasReachedPowerLevelCap())
|
if(hasReachedPowerLevelCap())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return getSkillLevel(primarySkillType) >= Config.getInstance().getLevelCap(primarySkillType);
|
return getSkillLevel(primarySkillType) >= mcMMO.p.getGeneralConfig().getLevelCap(primarySkillType);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -546,7 +544,7 @@ public class McMMOPlayer implements Identified {
|
|||||||
* @return true if they have reached the power level cap
|
* @return true if they have reached the power level cap
|
||||||
*/
|
*/
|
||||||
public boolean hasReachedPowerLevelCap() {
|
public boolean hasReachedPowerLevelCap() {
|
||||||
return this.getPowerLevel() >= Config.getInstance().getPowerLevelCap();
|
return this.getPowerLevel() >= mcMMO.p.getGeneralConfig().getPowerLevelCap();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -597,7 +595,7 @@ public class McMMOPlayer implements Identified {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Config.getInstance().getPartyXpNearMembersNeeded() || !PartyManager.getNearMembers(this).isEmpty()) {
|
if (!mcMMO.p.getGeneralConfig().getPartyXpNearMembersNeeded() || !PartyManager.getNearMembers(this).isEmpty()) {
|
||||||
party.applyXpGain(modifyXpGain(skill, xp));
|
party.applyXpGain(modifyXpGain(skill, xp));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -666,7 +664,7 @@ public class McMMOPlayer implements Identified {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getLevelUpSoundsEnabled()) {
|
if (mcMMO.p.getGeneralConfig().getLevelUpSoundsEnabled()) {
|
||||||
SoundManager.sendSound(player, player.getLocation(), SoundType.LEVEL_UP);
|
SoundManager.sendSound(player, player.getLocation(), SoundType.LEVEL_UP);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -787,13 +785,13 @@ public class McMMOPlayer implements Identified {
|
|||||||
private float modifyXpGain(PrimarySkillType primarySkillType, float xp) {
|
private float modifyXpGain(PrimarySkillType primarySkillType, float xp) {
|
||||||
//TODO: A rare situation can occur where the default Power Level cap can prevent a player with one skill edited to something silly like Integer.MAX_VALUE from gaining XP in any skill, we may need to represent power level with another data type
|
//TODO: A rare situation can occur where the default Power Level cap can prevent a player with one skill edited to something silly like Integer.MAX_VALUE from gaining XP in any skill, we may need to represent power level with another data type
|
||||||
if ((primarySkillType.getMaxLevel() <= getSkillLevel(primarySkillType))
|
if ((primarySkillType.getMaxLevel() <= getSkillLevel(primarySkillType))
|
||||||
|| (Config.getInstance().getPowerLevelCap() <= getPowerLevel())) {
|
|| (mcMMO.p.getGeneralConfig().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 (mcMMO.p.getGeneralConfig().getToolModsEnabled()) {
|
||||||
CustomTool tool = mcMMO.getModManager().getTool(player.getInventory().getItemInMainHand());
|
CustomTool tool = mcMMO.getModManager().getTool(player.getInventory().getItemInMainHand());
|
||||||
|
|
||||||
if (tool != null) {
|
if (tool != null) {
|
||||||
@ -863,8 +861,8 @@ public class McMMOPlayer implements Identified {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//These values change depending on whether or not the server is in retro mode
|
//These values change depending on whether or not the server is in retro mode
|
||||||
int abilityLengthVar = AdvancedConfig.getInstance().getAbilityLength();
|
int abilityLengthVar = mcMMO.p.getAdvancedConfig().getAbilityLength();
|
||||||
int abilityLengthCap = AdvancedConfig.getInstance().getAbilityLengthCap();
|
int abilityLengthCap = mcMMO.p.getAdvancedConfig().getAbilityLengthCap();
|
||||||
|
|
||||||
int ticks;
|
int ticks;
|
||||||
|
|
||||||
@ -881,7 +879,7 @@ public class McMMOPlayer implements Identified {
|
|||||||
//player.sendMessage(ability.getAbilityOn());
|
//player.sendMessage(ability.getAbilityOn());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AdvancedConfig.getInstance().sendAbilityNotificationToOtherPlayers()) {
|
if (mcMMO.p.getAdvancedConfig().sendAbilityNotificationToOtherPlayers()) {
|
||||||
SkillUtils.sendSkillMessage(player, NotificationType.SUPER_ABILITY_ALERT_OTHERS, ability.getAbilityPlayer());
|
SkillUtils.sendSkillMessage(player, NotificationType.SUPER_ABILITY_ALERT_OTHERS, ability.getAbilityPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -905,7 +903,7 @@ public class McMMOPlayer implements Identified {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getAbilitiesOnlyActivateWhenSneaking() && !player.isSneaking()) {
|
if (mcMMO.p.getGeneralConfig().getAbilitiesOnlyActivateWhenSneaking() && !player.isSneaking()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -942,7 +940,7 @@ public class McMMOPlayer implements Identified {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getAbilityMessagesEnabled()) {
|
if (mcMMO.p.getGeneralConfig().getAbilityMessagesEnabled()) {
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* IF THE TOOL IS AN AXE
|
* IF THE TOOL IS AN AXE
|
||||||
@ -1099,7 +1097,7 @@ public class McMMOPlayer implements Identified {
|
|||||||
|
|
||||||
UserManager.remove(thisPlayer);
|
UserManager.remove(thisPlayer);
|
||||||
|
|
||||||
if(Config.getInstance().getScoreboardsEnabled())
|
if(mcMMO.p.getGeneralConfig().getScoreboardsEnabled())
|
||||||
ScoreboardManager.teardownPlayer(thisPlayer);
|
ScoreboardManager.teardownPlayer(thisPlayer);
|
||||||
|
|
||||||
if (inParty()) {
|
if (inParty()) {
|
||||||
|
@ -1,18 +1,19 @@
|
|||||||
package com.gmail.nossr50.datatypes.player;
|
package com.gmail.nossr50.datatypes.player;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.datatypes.MobHealthbarType;
|
import com.gmail.nossr50.datatypes.MobHealthbarType;
|
||||||
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
||||||
import com.gmail.nossr50.datatypes.experience.SkillXpGain;
|
import com.gmail.nossr50.datatypes.experience.SkillXpGain;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.interfaces.Skill;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.runnables.player.PlayerProfileSaveTask;
|
import com.gmail.nossr50.runnables.player.PlayerProfileSaveTask;
|
||||||
import com.gmail.nossr50.skills.child.FamilyTree;
|
import com.gmail.nossr50.skills.child.FamilyTree;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -32,14 +33,14 @@ public class PlayerProfile {
|
|||||||
private int saveAttempts = 0;
|
private int saveAttempts = 0;
|
||||||
|
|
||||||
/* Skill Data */
|
/* Skill Data */
|
||||||
private final Map<PrimarySkillType, Integer> skills = new HashMap<>(); // Skill & Level
|
private final Map<Skill, Integer> skills = new HashMap<>(); // Skill & Level
|
||||||
private final Map<PrimarySkillType, Float> skillsXp = new HashMap<>(); // Skill & XP
|
private final Map<Skill, Float> skillsXp = new HashMap<>(); // Skill & XP
|
||||||
private final Map<SuperAbilityType, Integer> abilityDATS = new HashMap<>(); // Ability & Cooldown
|
private final Map<SuperAbilityType, Integer> abilityDATS = new HashMap<>(); // Ability & Cooldown
|
||||||
private final Map<UniqueDataType, Integer> uniquePlayerData = new HashMap<>(); //Misc data that doesn't fit into other categories (chimaera wing, etc..)
|
private final Map<UniqueDataType, Integer> uniquePlayerData = new HashMap<>(); //Misc data that doesn't fit into other categories (chimaera wing, etc..)
|
||||||
|
|
||||||
// Store previous XP gains for diminished returns
|
// Store previous XP gains for diminished returns
|
||||||
private final DelayQueue<SkillXpGain> gainedSkillsXp = new DelayQueue<>();
|
private final DelayQueue<SkillXpGain> gainedSkillsXp = new DelayQueue<>();
|
||||||
private final HashMap<PrimarySkillType, Float> rollingSkillsXp = new HashMap<>();
|
private final HashMap<Skill, Float> rollingSkillsXp = new HashMap<>();
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public PlayerProfile(String playerName) {
|
public PlayerProfile(String playerName) {
|
||||||
@ -50,7 +51,7 @@ public class PlayerProfile {
|
|||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
this.playerName = playerName;
|
this.playerName = playerName;
|
||||||
|
|
||||||
mobHealthbarType = Config.getInstance().getMobHealthbarDefault();
|
mobHealthbarType = mcMMO.p.getGeneralConfig().getMobHealthbarDefault();
|
||||||
scoreboardTipsShown = 0;
|
scoreboardTipsShown = 0;
|
||||||
|
|
||||||
for (SuperAbilityType superAbilityType : SuperAbilityType.values()) {
|
for (SuperAbilityType superAbilityType : SuperAbilityType.values()) {
|
||||||
@ -58,7 +59,7 @@ public class PlayerProfile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
|
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
|
||||||
skills.put(primarySkillType, AdvancedConfig.getInstance().getStartingLevel());
|
skills.put(primarySkillType, mcMMO.p.getAdvancedConfig().getStartingLevel());
|
||||||
skillsXp.put(primarySkillType, 0F);
|
skillsXp.put(primarySkillType, 0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,20 +68,20 @@ public class PlayerProfile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public PlayerProfile(String playerName, boolean isLoaded) {
|
public PlayerProfile(@NotNull String playerName, boolean isLoaded) {
|
||||||
this(playerName);
|
this(playerName);
|
||||||
this.loaded = isLoaded;
|
this.loaded = isLoaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayerProfile(String playerName, UUID uuid, boolean isLoaded) {
|
public PlayerProfile(@NotNull String playerName, UUID uuid, boolean isLoaded) {
|
||||||
this(playerName, uuid);
|
this(playerName, uuid);
|
||||||
this.loaded = isLoaded;
|
this.loaded = isLoaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayerProfile(String playerName, UUID uuid, Map<PrimarySkillType, Integer> levelData, Map<PrimarySkillType, Float> xpData, Map<SuperAbilityType, Integer> cooldownData, MobHealthbarType mobHealthbarType, int scoreboardTipsShown, Map<UniqueDataType, Integer> uniqueProfileData) {
|
public PlayerProfile(@NotNull String playerName, UUID uuid, Map<Skill, Integer> levelData, Map<Skill, Float> xpData, Map<SuperAbilityType, Integer> cooldownData, @Nullable MobHealthbarType mobHealthbarType, int scoreboardTipsShown, Map<UniqueDataType, Integer> uniqueProfileData) {
|
||||||
this.playerName = playerName;
|
this.playerName = playerName;
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
this.mobHealthbarType = mobHealthbarType;
|
mobHealthbarType = mcMMO.p.getGeneralConfig().getMobHealthbarDefault();
|
||||||
this.scoreboardTipsShown = scoreboardTipsShown;
|
this.scoreboardTipsShown = scoreboardTipsShown;
|
||||||
|
|
||||||
skills.putAll(levelData);
|
skills.putAll(levelData);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.gmail.nossr50.datatypes.skills;
|
package com.gmail.nossr50.datatypes.skills;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.interfaces.Skill;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.skills.SkillManager;
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
@ -33,7 +33,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public enum PrimarySkillType {
|
public enum PrimarySkillType implements Skill {
|
||||||
ACROBATICS(AcrobaticsManager.class, Color.WHITE,
|
ACROBATICS(AcrobaticsManager.class, Color.WHITE,
|
||||||
ImmutableList.of(SubSkillType.ACROBATICS_DODGE, SubSkillType.ACROBATICS_ROLL)),
|
ImmutableList.of(SubSkillType.ACROBATICS_DODGE, SubSkillType.ACROBATICS_ROLL)),
|
||||||
ALCHEMY(AlchemyManager.class, Color.FUCHSIA,
|
ALCHEMY(AlchemyManager.class, Color.FUCHSIA,
|
||||||
@ -122,6 +122,14 @@ public enum PrimarySkillType {
|
|||||||
this.subSkillTypes = subSkillTypes;
|
this.subSkillTypes = subSkillTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PrimarySkillType getPrimarySkill() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPrimaryKeyName() {
|
||||||
|
return StringUtils.getCapitalized(this.toString());
|
||||||
|
}
|
||||||
|
|
||||||
public Class<? extends SkillManager> getManagerClass() {
|
public Class<? extends SkillManager> getManagerClass() {
|
||||||
return managerClass;
|
return managerClass;
|
||||||
}
|
}
|
||||||
@ -136,37 +144,37 @@ 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 mcMMO.p.getGeneralConfig().getLevelCap(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSuperAbilityUnlocked(Player player) { return RankUtils.getRank(player, getAbility().getSubSkillTypeDefinition()) >= 1; }
|
public boolean isSuperAbilityUnlocked(Player player) { return RankUtils.getRank(player, getAbility().getSubSkillTypeDefinition()) >= 1; }
|
||||||
|
|
||||||
public boolean getPVPEnabled() {
|
public boolean getPVPEnabled() {
|
||||||
return Config.getInstance().getPVPEnabled(this);
|
return mcMMO.p.getGeneralConfig().getPVPEnabled(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getPVEEnabled() {
|
public boolean getPVEEnabled() {
|
||||||
return Config.getInstance().getPVEEnabled(this);
|
return mcMMO.p.getGeneralConfig().getPVEEnabled(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getDoubleDropsDisabled() {
|
public boolean getDoubleDropsDisabled() {
|
||||||
return Config.getInstance().getDoubleDropsDisabled(this);
|
return mcMMO.p.getGeneralConfig().getDoubleDropsDisabled(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getHardcoreStatLossEnabled() {
|
public boolean getHardcoreStatLossEnabled() {
|
||||||
return Config.getInstance().getHardcoreStatLossEnabled(this);
|
return mcMMO.p.getGeneralConfig().getHardcoreStatLossEnabled(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHardcoreStatLossEnabled(boolean enable) {
|
public void setHardcoreStatLossEnabled(boolean enable) {
|
||||||
Config.getInstance().setHardcoreStatLossEnabled(this, enable);
|
mcMMO.p.getGeneralConfig().setHardcoreStatLossEnabled(this, enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getHardcoreVampirismEnabled() {
|
public boolean getHardcoreVampirismEnabled() {
|
||||||
return Config.getInstance().getHardcoreVampirismEnabled(this);
|
return mcMMO.p.getGeneralConfig().getHardcoreVampirismEnabled(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHardcoreVampirismEnabled(boolean enable) {
|
public void setHardcoreVampirismEnabled(boolean enable) {
|
||||||
Config.getInstance().setHardcoreVampirismEnabled(this, enable);
|
mcMMO.p.getGeneralConfig().setHardcoreVampirismEnabled(this, enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ToolType getTool() {
|
public ToolType getTool() {
|
||||||
@ -182,7 +190,7 @@ public enum PrimarySkillType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static PrimarySkillType getSkill(String skillName) {
|
public static PrimarySkillType getSkill(String skillName) {
|
||||||
if (!Config.getInstance().getLocale().equalsIgnoreCase("en_US")) {
|
if (!mcMMO.p.getGeneralConfig().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;
|
||||||
@ -215,42 +223,17 @@ public enum PrimarySkillType {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PrimarySkillType bySecondaryAbility(SubSkillType subSkillType) {
|
|
||||||
for (PrimarySkillType type : values()) {
|
|
||||||
if (type.getSkillAbilities().contains(subSkillType)) {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static PrimarySkillType byAbility(SuperAbilityType ability) {
|
|
||||||
for (PrimarySkillType type : values()) {
|
|
||||||
if (type.getAbility() == ability) {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return StringUtils.getCapitalized(LocaleLoader.getString(StringUtils.getCapitalized(this.toString()) + ".SkillName"));
|
return StringUtils.getCapitalized(LocaleLoader.getString(StringUtils.getCapitalized(this.toString()) + ".SkillName"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// public String getName() {
|
|
||||||
// return StringUtils.getCapitalized(StringUtils.getCapitalized(this.toString()));
|
|
||||||
// }
|
|
||||||
|
|
||||||
public boolean getPermissions(Player player) {
|
public boolean getPermissions(Player player) {
|
||||||
return Permissions.skillEnabled(player, this);
|
return Permissions.skillEnabled(player, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* public void celebrateLevelUp(Player player) {
|
|
||||||
ParticleEffectUtils.fireworkParticleShower(player, skillColor);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
public boolean shouldProcess(Entity target) {
|
public boolean shouldProcess(Entity target) {
|
||||||
return (target instanceof Player || (target instanceof Tameable && ((Tameable) target).isTamed())) ? getPVPEnabled() : getPVEEnabled();
|
return (target instanceof Player || (target instanceof Tameable && ((Tameable) target).isTamed())) ? getPVPEnabled() : getPVEEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.gmail.nossr50.datatypes.skills;
|
package com.gmail.nossr50.datatypes.skills;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.skills.interfaces.Skill;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.util.text.StringUtils;
|
import com.gmail.nossr50.util.text.StringUtils;
|
||||||
|
|
||||||
@ -135,7 +136,7 @@ public enum SubSkillType {
|
|||||||
* If we add skills, those immutable lists need to be updated
|
* If we add skills, those immutable lists need to be updated
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public PrimarySkillType getParentSkill() { return PrimarySkillType.bySecondaryAbility(this); }
|
public PrimarySkillType getParentSkill() { return Skill.bySecondaryAbility(this); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the root address for this skill in the advanced.yml file
|
* Returns the root address for this skill in the advanced.yml file
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.datatypes.skills;
|
package com.gmail.nossr50.datatypes.skills;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.BlockUtils;
|
import com.gmail.nossr50.util.BlockUtils;
|
||||||
@ -112,11 +111,11 @@ public enum SuperAbilityType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getCooldown() {
|
public int getCooldown() {
|
||||||
return Config.getInstance().getCooldown(this);
|
return mcMMO.p.getGeneralConfig().getCooldown(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxLength() {
|
public int getMaxLength() {
|
||||||
return Config.getInstance().getMaxLength(this);
|
return mcMMO.p.getGeneralConfig().getMaxLength(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAbilityOn() {
|
public String getAbilityOn() {
|
||||||
|
@ -1,6 +1,18 @@
|
|||||||
package com.gmail.nossr50.datatypes.skills.interfaces;
|
package com.gmail.nossr50.datatypes.skills.interfaces;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.ToolType;
|
||||||
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
|
import com.gmail.nossr50.util.text.StringUtils;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface Skill {
|
public interface Skill {
|
||||||
/**
|
/**
|
||||||
@ -14,4 +26,88 @@ public interface Skill {
|
|||||||
* @return config file key name
|
* @return config file key name
|
||||||
*/
|
*/
|
||||||
String getPrimaryKeyName();
|
String getPrimaryKeyName();
|
||||||
|
|
||||||
|
Class<? extends SkillManager> getManagerClass();
|
||||||
|
|
||||||
|
SuperAbilityType getAbility();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the max level of this skill.
|
||||||
|
*
|
||||||
|
* @return the max level of this skill
|
||||||
|
*/
|
||||||
|
int getMaxLevel();
|
||||||
|
|
||||||
|
boolean isSuperAbilityUnlocked(Player player);
|
||||||
|
|
||||||
|
boolean getPVPEnabled();
|
||||||
|
|
||||||
|
boolean getPVEEnabled();
|
||||||
|
|
||||||
|
boolean getDoubleDropsDisabled();
|
||||||
|
|
||||||
|
boolean getHardcoreStatLossEnabled();
|
||||||
|
|
||||||
|
void setHardcoreStatLossEnabled(boolean enable);
|
||||||
|
|
||||||
|
boolean getHardcoreVampirismEnabled();
|
||||||
|
|
||||||
|
void setHardcoreVampirismEnabled(boolean enable);
|
||||||
|
|
||||||
|
ToolType getTool();
|
||||||
|
|
||||||
|
List<SubSkillType> getSkillAbilities();
|
||||||
|
|
||||||
|
double getXpModifier();
|
||||||
|
|
||||||
|
// TODO: This is a little "hacky", we probably need to add something to distinguish child skills in the enum, or to use another enum for them
|
||||||
|
boolean isChildSkill();
|
||||||
|
|
||||||
|
static PrimarySkillType bySecondaryAbility(SubSkillType subSkillType) {
|
||||||
|
for (PrimarySkillType type : PrimarySkillType.values()) {
|
||||||
|
if (type.getSkillAbilities().contains(subSkillType)) {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PrimarySkillType byAbility(SuperAbilityType ability) {
|
||||||
|
for (PrimarySkillType type : PrimarySkillType.values()) {
|
||||||
|
if (type.getAbility() == ability) {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PrimarySkillType getSkill(@NotNull String skillName) {
|
||||||
|
if (!mcMMO.p.getGeneralConfig().getLocale().equalsIgnoreCase("en_US")) {
|
||||||
|
for (PrimarySkillType type : PrimarySkillType.values()) {
|
||||||
|
if (skillName.equalsIgnoreCase(LocaleLoader.getString(StringUtils.getCapitalized(type.name()) + ".SkillName"))) {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (PrimarySkillType type : PrimarySkillType.values()) {
|
||||||
|
if (type.name().equalsIgnoreCase(skillName)) {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!skillName.equalsIgnoreCase("all")) {
|
||||||
|
mcMMO.p.getLogger().warning("Invalid mcMMO skill (" + skillName + ")"); //TODO: Localize
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
String getName();
|
||||||
|
|
||||||
|
boolean getPermissions(Player player);
|
||||||
|
|
||||||
|
boolean shouldProcess(Entity target);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.datatypes.skills.subskills.acrobatics;
|
package com.gmail.nossr50.datatypes.skills.subskills.acrobatics;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
||||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||||
@ -8,8 +7,11 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
|||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.ToolType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
import com.gmail.nossr50.util.EventUtils;
|
import com.gmail.nossr50.util.EventUtils;
|
||||||
import com.gmail.nossr50.util.ItemUtils;
|
import com.gmail.nossr50.util.ItemUtils;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
@ -29,12 +31,14 @@ import org.bukkit.Location;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.SoundCategory;
|
import org.bukkit.SoundCategory;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
public class Roll extends AcrobaticsSubSkill {
|
public class Roll extends AcrobaticsSubSkill {
|
||||||
@ -200,7 +204,7 @@ public class Roll extends AcrobaticsSubSkill {
|
|||||||
return gracefulRollCheck(player, mcMMOPlayer, damage, skillLevel);
|
return gracefulRollCheck(player, mcMMOPlayer, damage, skillLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
double modifiedDamage = calculateModifiedRollDamage(damage, AdvancedConfig.getInstance().getRollDamageThreshold());
|
double modifiedDamage = calculateModifiedRollDamage(damage, mcMMO.p.getAdvancedConfig().getRollDamageThreshold());
|
||||||
|
|
||||||
if (!isFatal(player, modifiedDamage)
|
if (!isFatal(player, modifiedDamage)
|
||||||
&& RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkillType.ACROBATICS_ROLL, player)) {
|
&& RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkillType.ACROBATICS_ROLL, player)) {
|
||||||
@ -238,7 +242,7 @@ public class Roll extends AcrobaticsSubSkill {
|
|||||||
* @return the modified event damage if the ability was successful, the original event damage otherwise
|
* @return the modified event damage if the ability was successful, the original event damage otherwise
|
||||||
*/
|
*/
|
||||||
private double gracefulRollCheck(Player player, McMMOPlayer mcMMOPlayer, double damage, int skillLevel) {
|
private double gracefulRollCheck(Player player, McMMOPlayer mcMMOPlayer, double damage, int skillLevel) {
|
||||||
double modifiedDamage = calculateModifiedRollDamage(damage, AdvancedConfig.getInstance().getRollDamageThreshold() * 2);
|
double modifiedDamage = calculateModifiedRollDamage(damage, mcMMO.p.getAdvancedConfig().getRollDamageThreshold() * 2);
|
||||||
|
|
||||||
RandomChanceSkill rcs = new RandomChanceSkill(player, subSkillType);
|
RandomChanceSkill rcs = new RandomChanceSkill(player, subSkillType);
|
||||||
rcs.setSkillLevel(rcs.getSkillLevel() * 2); //Double the effective odds
|
rcs.setSkillLevel(rcs.getSkillLevel() * 2); //Double the effective odds
|
||||||
@ -381,7 +385,7 @@ public class Roll extends AcrobaticsSubSkill {
|
|||||||
//
|
//
|
||||||
// //Chance to roll at half max skill
|
// //Chance to roll at half max skill
|
||||||
// RandomChanceSkill rollHalfMaxSkill = new RandomChanceSkill(null, subSkillType);
|
// RandomChanceSkill rollHalfMaxSkill = new RandomChanceSkill(null, subSkillType);
|
||||||
// int halfMaxSkillValue = AdvancedConfig.getInstance().getMaxBonusLevel(SubSkillType.ACROBATICS_ROLL)/2;
|
// int halfMaxSkillValue = mcMMO.p.getAdvancedConfig().getMaxBonusLevel(SubSkillType.ACROBATICS_ROLL)/2;
|
||||||
// rollHalfMaxSkill.setSkillLevel(halfMaxSkillValue);
|
// rollHalfMaxSkill.setSkillLevel(halfMaxSkillValue);
|
||||||
//
|
//
|
||||||
// //Chance to graceful roll at full skill
|
// //Chance to graceful roll at full skill
|
||||||
@ -395,11 +399,11 @@ public class Roll extends AcrobaticsSubSkill {
|
|||||||
// //Chance Stat Calculations
|
// //Chance Stat Calculations
|
||||||
// rollChanceHalfMax = RandomChanceUtil.getRandomChanceExecutionChance(rollHalfMaxSkill);
|
// rollChanceHalfMax = RandomChanceUtil.getRandomChanceExecutionChance(rollHalfMaxSkill);
|
||||||
// graceChanceHalfMax = RandomChanceUtil.getRandomChanceExecutionChance(rollGraceHalfMaxSkill);
|
// graceChanceHalfMax = RandomChanceUtil.getRandomChanceExecutionChance(rollGraceHalfMaxSkill);
|
||||||
// damageThreshold = AdvancedConfig.getInstance().getRollDamageThreshold();
|
// damageThreshold = mcMMO.p.getAdvancedConfig().getRollDamageThreshold();
|
||||||
//
|
//
|
||||||
// chancePerLevel = RandomChanceUtil.getRandomChanceExecutionChance(rollOneSkillLevel);
|
// chancePerLevel = RandomChanceUtil.getRandomChanceExecutionChance(rollOneSkillLevel);
|
||||||
//
|
//
|
||||||
// double maxLevel = AdvancedConfig.getInstance().getMaxBonusLevel(SubSkillType.ACROBATICS_ROLL);
|
// double maxLevel = mcMMO.p.getAdvancedConfig().getMaxBonusLevel(SubSkillType.ACROBATICS_ROLL);
|
||||||
//
|
//
|
||||||
// return LocaleLoader.getString("Acrobatics.SubSkill.Roll.Mechanics", rollChanceHalfMax, graceChanceHalfMax, maxLevel, chancePerLevel, damageThreshold, damageThreshold * 2,halfMaxSkillValue);
|
// return LocaleLoader.getString("Acrobatics.SubSkill.Roll.Mechanics", rollChanceHalfMax, graceChanceHalfMax, maxLevel, chancePerLevel, damageThreshold, damageThreshold * 2,halfMaxSkillValue);
|
||||||
}
|
}
|
||||||
@ -436,4 +440,98 @@ public class Roll extends AcrobaticsSubSkill {
|
|||||||
{
|
{
|
||||||
return player.getLocation().getBlock().getLocation();
|
return player.getLocation().getBlock().getLocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getPrimaryKeyName() {
|
||||||
|
return getPrimarySkill().getPrimaryKeyName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends SkillManager> getManagerClass() {
|
||||||
|
return getPrimarySkill().getManagerClass();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SuperAbilityType getAbility() {
|
||||||
|
return getPrimarySkill().getAbility();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaxLevel() {
|
||||||
|
return getPrimarySkill().getMaxLevel();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSuperAbilityUnlocked(Player player) {
|
||||||
|
return getPrimarySkill().isSuperAbilityUnlocked(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean getPVPEnabled() {
|
||||||
|
return getPrimarySkill().getPVPEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean getPVEEnabled() {
|
||||||
|
return getPrimarySkill().getPVEEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean getDoubleDropsDisabled() {
|
||||||
|
return getPrimarySkill().getDoubleDropsDisabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean getHardcoreStatLossEnabled() {
|
||||||
|
return getPrimarySkill().getHardcoreStatLossEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setHardcoreStatLossEnabled(boolean enable) {
|
||||||
|
getPrimarySkill().setHardcoreStatLossEnabled(enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean getHardcoreVampirismEnabled() {
|
||||||
|
return getPrimarySkill().getHardcoreVampirismEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setHardcoreVampirismEnabled(boolean enable) {
|
||||||
|
getPrimarySkill().setHardcoreVampirismEnabled(enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ToolType getTool() {
|
||||||
|
return getPrimarySkill().getTool();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SubSkillType> getSkillAbilities() {
|
||||||
|
return getPrimarySkill().getSkillAbilities();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getXpModifier() {
|
||||||
|
return getPrimarySkill().getXpModifier();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isChildSkill() {
|
||||||
|
return getPrimarySkill().isChildSkill();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return getPrimarySkill().getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean getPermissions(Player player) {
|
||||||
|
return getPrimarySkill().getPermissions(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldProcess(Entity target) {
|
||||||
|
return getPrimarySkill().shouldProcess(target);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.gmail.nossr50.events.skills.secondaryabilities;
|
package com.gmail.nossr50.events.skills.secondaryabilities;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.interfaces.Skill;
|
||||||
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
|
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
|
||||||
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
|
import com.gmail.nossr50.events.skills.McMMOPlayerSkillEvent;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -20,7 +20,7 @@ public class SubSkillEvent extends McMMOPlayerSkillEvent implements Cancellable
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public SubSkillEvent(Player player, SubSkillType subSkillType) {
|
public SubSkillEvent(Player player, SubSkillType subSkillType) {
|
||||||
super(player, PrimarySkillType.bySecondaryAbility(subSkillType));
|
super(player, Skill.bySecondaryAbility(subSkillType));
|
||||||
this.subSkillType = subSkillType;
|
this.subSkillType = subSkillType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ public class SubSkillEvent extends McMMOPlayerSkillEvent implements Cancellable
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public SubSkillEvent(Player player, SubSkillType subSkillType, double resultModifier) {
|
public SubSkillEvent(Player player, SubSkillType subSkillType, double resultModifier) {
|
||||||
super(player, PrimarySkillType.bySecondaryAbility(subSkillType));
|
super(player, Skill.bySecondaryAbility(subSkillType));
|
||||||
this.subSkillType = subSkillType;
|
this.subSkillType = subSkillType;
|
||||||
this.resultModifier = resultModifier;
|
this.resultModifier = resultModifier;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.gmail.nossr50.listeners;
|
package com.gmail.nossr50.listeners;
|
||||||
|
|
||||||
import com.gmail.nossr50.api.ItemSpawnReason;
|
import com.gmail.nossr50.api.ItemSpawnReason;
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.config.HiddenConfig;
|
import com.gmail.nossr50.config.HiddenConfig;
|
||||||
import com.gmail.nossr50.config.WorldBlacklist;
|
import com.gmail.nossr50.config.WorldBlacklist;
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
@ -79,9 +78,9 @@ public class BlockListener implements Listener {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
//TODO: Ignore this abomination its rewritten in 2.2
|
//TODO: Ignore this abomination its rewritten in 2.2
|
||||||
if(!Config.getInstance().getDoubleDropsEnabled(PrimarySkillType.MINING, is.getType())
|
if(!mcMMO.p.getGeneralConfig().getDoubleDropsEnabled(PrimarySkillType.MINING, is.getType())
|
||||||
&& !Config.getInstance().getDoubleDropsEnabled(PrimarySkillType.HERBALISM, is.getType())
|
&& !mcMMO.p.getGeneralConfig().getDoubleDropsEnabled(PrimarySkillType.HERBALISM, is.getType())
|
||||||
&& !Config.getInstance().getDoubleDropsEnabled(PrimarySkillType.WOODCUTTING, is.getType()))
|
&& !mcMMO.p.getGeneralConfig().getDoubleDropsEnabled(PrimarySkillType.WOODCUTTING, is.getType()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
//If we suspect TEs might be duped only reward block
|
//If we suspect TEs might be duped only reward block
|
||||||
@ -524,7 +523,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.hasWoodcuttingXP(blockState) && Config.getInstance().getTreeFellerSoundsEnabled()) {
|
if (mcMMOPlayer.getAbilityMode(SuperAbilityType.TREE_FELLER) && BlockUtils.hasWoodcuttingXP(blockState) && mcMMO.p.getGeneralConfig().getTreeFellerSoundsEnabled()) {
|
||||||
SoundManager.sendSound(player, blockState.getLocation(), SoundType.FIZZ);
|
SoundManager.sendSound(player, blockState.getLocation(), SoundType.FIZZ);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -579,7 +578,7 @@ public class BlockListener implements Listener {
|
|||||||
blockState.update(true);
|
blockState.update(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (mcMMOPlayer.getAbilityMode(SuperAbilityType.BERSERK) && (heldItem.getType() == Material.AIR || Config.getInstance().getUnarmedItemsAsUnarmed())) {
|
else if (mcMMOPlayer.getAbilityMode(SuperAbilityType.BERSERK) && (heldItem.getType() == Material.AIR || mcMMO.p.getGeneralConfig().getUnarmedItemsAsUnarmed())) {
|
||||||
if (mcMMOPlayer.getUnarmedManager().canUseBlockCracker() && BlockUtils.affectedByBlockCracker(blockState)) {
|
if (mcMMOPlayer.getUnarmedManager().canUseBlockCracker() && BlockUtils.affectedByBlockCracker(blockState)) {
|
||||||
if (EventUtils.simulateBlockBreak(block, player, true) && mcMMOPlayer.getUnarmedManager().blockCrackerCheck(blockState)) {
|
if (EventUtils.simulateBlockBreak(block, player, true) && mcMMOPlayer.getUnarmedManager().blockCrackerCheck(blockState)) {
|
||||||
blockState.update();
|
blockState.update();
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package com.gmail.nossr50.listeners;
|
package com.gmail.nossr50.listeners;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.config.WorldBlacklist;
|
import com.gmail.nossr50.config.WorldBlacklist;
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
@ -163,7 +161,7 @@ public class EntityListener implements Listener {
|
|||||||
projectile.setMetadata(mcMMO.infiniteArrowKey, mcMMO.metadataValue);
|
projectile.setMetadata(mcMMO.infiniteArrowKey, mcMMO.metadataValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
projectile.setMetadata(mcMMO.bowForceKey, new FixedMetadataValue(pluginRef, Math.min(event.getForce() * AdvancedConfig.getInstance().getForceMultiplier(), 1.0)));
|
projectile.setMetadata(mcMMO.bowForceKey, new FixedMetadataValue(pluginRef, Math.min(event.getForce() * mcMMO.p.getAdvancedConfig().getForceMultiplier(), 1.0)));
|
||||||
projectile.setMetadata(mcMMO.arrowDistanceKey, new FixedMetadataValue(pluginRef, projectile.getLocation()));
|
projectile.setMetadata(mcMMO.arrowDistanceKey, new FixedMetadataValue(pluginRef, projectile.getLocation()));
|
||||||
//Cleanup metadata in 1 minute in case normal collection falls through
|
//Cleanup metadata in 1 minute in case normal collection falls through
|
||||||
CombatUtils.delayArrowMetaCleanup((Projectile) projectile);
|
CombatUtils.delayArrowMetaCleanup((Projectile) projectile);
|
||||||
@ -466,7 +464,7 @@ public class EntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Party Friendly Fire
|
//Party Friendly Fire
|
||||||
if(!Config.getInstance().getPartyFriendlyFire())
|
if(!mcMMO.p.getGeneralConfig().getPartyFriendlyFire())
|
||||||
if ((PartyManager.inSameParty(defendingPlayer, attackingPlayer)
|
if ((PartyManager.inSameParty(defendingPlayer, attackingPlayer)
|
||||||
|| PartyManager.areAllies(defendingPlayer, attackingPlayer))
|
|| PartyManager.areAllies(defendingPlayer, attackingPlayer))
|
||||||
&& !(Permissions.friendlyFire(attackingPlayer)
|
&& !(Permissions.friendlyFire(attackingPlayer)
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.listeners;
|
package com.gmail.nossr50.listeners;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.config.WorldBlacklist;
|
import com.gmail.nossr50.config.WorldBlacklist;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
@ -382,17 +381,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 (mcMMO.p.getGeneralConfig().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 (mcMMO.p.getGeneralConfig().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 (mcMMO.p.getGeneralConfig().getEnabledForHoppers() && AlchemyPotionBrewer.isValidIngredient(null, item)) {
|
||||||
AlchemyPotionBrewer.scheduleCheck(null, (BrewingStand) holder);
|
AlchemyPotionBrewer.scheduleCheck(null, (BrewingStand) holder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.listeners;
|
package com.gmail.nossr50.listeners;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.config.WorldBlacklist;
|
import com.gmail.nossr50.config.WorldBlacklist;
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.datatypes.chat.ChatChannel;
|
import com.gmail.nossr50.datatypes.chat.ChatChannel;
|
||||||
@ -73,11 +72,11 @@ public class PlayerListener implements Listener {
|
|||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld())) {
|
if(WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld())) {
|
||||||
//Remove scoreboards
|
//Remove scoreboards
|
||||||
if(Config.getInstance().getScoreboardsEnabled()) {
|
if(mcMMO.p.getGeneralConfig().getScoreboardsEnabled()) {
|
||||||
ScoreboardManager.teardownPlayer(event.getPlayer());
|
ScoreboardManager.teardownPlayer(event.getPlayer());
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} else if(WorldBlacklist.isWorldBlacklisted(event.getFrom().getWorld()) && Config.getInstance().getScoreboardsEnabled()) {
|
} else if(WorldBlacklist.isWorldBlacklisted(event.getFrom().getWorld()) && mcMMO.p.getGeneralConfig().getScoreboardsEnabled()) {
|
||||||
//This only fires if they are travelling to a non-blacklisted world from a blacklisted world
|
//This only fires if they are travelling to a non-blacklisted world from a blacklisted world
|
||||||
|
|
||||||
//Setup scoreboards
|
//Setup scoreboards
|
||||||
@ -93,7 +92,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) || mcMMO.p.getGeneralConfig().getXPAfterTeleportCooldown() <= 0 || event.getFrom().equals(event.getTo())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -292,7 +291,7 @@ public class PlayerListener implements Listener {
|
|||||||
if(event.getCaught() != null) {
|
if(event.getCaught() != null) {
|
||||||
Item fishingCatch = (Item) event.getCaught();
|
Item fishingCatch = (Item) event.getCaught();
|
||||||
|
|
||||||
if (Config.getInstance().getFishingOverrideTreasures() &&
|
if (mcMMO.p.getGeneralConfig().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 &&
|
||||||
@ -565,11 +564,11 @@ public class PlayerListener implements Listener {
|
|||||||
//Delay loading for 3 seconds in case the player has a save task running, its hacky but it should do the trick
|
//Delay loading for 3 seconds in case the player has a save task running, its hacky but it should do the trick
|
||||||
new PlayerProfileLoadingTask(player).runTaskLaterAsynchronously(mcMMO.p, 60);
|
new PlayerProfileLoadingTask(player).runTaskLaterAsynchronously(mcMMO.p, 60);
|
||||||
|
|
||||||
if (Config.getInstance().getMOTDEnabled() && Permissions.motd(player)) {
|
if (mcMMO.p.getGeneralConfig().getMOTDEnabled() && Permissions.motd(player)) {
|
||||||
Motd.displayAll(player);
|
Motd.displayAll(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plugin.isXPEventEnabled() && Config.getInstance().playerJoinEventInfo()) {
|
if (plugin.isXPEventEnabled() && mcMMO.p.getGeneralConfig().playerJoinEventInfo()) {
|
||||||
player.sendMessage(LocaleLoader.getString("XPRate.Event", ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier()));
|
player.sendMessage(LocaleLoader.getString("XPRate.Event", ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -652,7 +651,7 @@ public class PlayerListener implements Listener {
|
|||||||
case RIGHT_CLICK_BLOCK:
|
case RIGHT_CLICK_BLOCK:
|
||||||
Material type = clickedBlock.getType();
|
Material type = clickedBlock.getType();
|
||||||
|
|
||||||
if (!Config.getInstance().getAbilitiesOnlyActivateWhenSneaking() || player.isSneaking()) {
|
if (!mcMMO.p.getGeneralConfig().getAbilitiesOnlyActivateWhenSneaking() || player.isSneaking()) {
|
||||||
/* REPAIR CHECKS */
|
/* REPAIR CHECKS */
|
||||||
if (type == Repair.anvilMaterial
|
if (type == Repair.anvilMaterial
|
||||||
&& PrimarySkillType.REPAIR.getPermissions(player)
|
&& PrimarySkillType.REPAIR.getPermissions(player)
|
||||||
@ -700,7 +699,7 @@ public class PlayerListener implements Listener {
|
|||||||
case LEFT_CLICK_BLOCK:
|
case LEFT_CLICK_BLOCK:
|
||||||
type = clickedBlock.getType();
|
type = clickedBlock.getType();
|
||||||
|
|
||||||
if (!Config.getInstance().getAbilitiesOnlyActivateWhenSneaking() || player.isSneaking()) {
|
if (!mcMMO.p.getGeneralConfig().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();
|
||||||
@ -794,7 +793,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 (mcMMO.p.getGeneralConfig().getAbilitiesEnabled()) {
|
||||||
if (BlockUtils.canActivateHerbalism(blockState)) {
|
if (BlockUtils.canActivateHerbalism(blockState)) {
|
||||||
mcMMOPlayer.processAbilityActivation(PrimarySkillType.HERBALISM);
|
mcMMOPlayer.processAbilityActivation(PrimarySkillType.HERBALISM);
|
||||||
}
|
}
|
||||||
@ -860,7 +859,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ACTIVATION CHECKS */
|
/* ACTIVATION CHECKS */
|
||||||
if (Config.getInstance().getAbilitiesEnabled()) {
|
if (mcMMO.p.getGeneralConfig().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);
|
||||||
@ -892,13 +891,13 @@ 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(CallOfTheWildType.WOLF.getConfigEntityTypeEntry())) {
|
if (type == mcMMO.p.getGeneralConfig().getTamingCOTWMaterial(CallOfTheWildType.WOLF.getConfigEntityTypeEntry())) {
|
||||||
tamingManager.summonWolf();
|
tamingManager.summonWolf();
|
||||||
}
|
}
|
||||||
else if (type == Config.getInstance().getTamingCOTWMaterial(CallOfTheWildType.CAT.getConfigEntityTypeEntry())) {
|
else if (type == mcMMO.p.getGeneralConfig().getTamingCOTWMaterial(CallOfTheWildType.CAT.getConfigEntityTypeEntry())) {
|
||||||
tamingManager.summonOcelot();
|
tamingManager.summonOcelot();
|
||||||
}
|
}
|
||||||
else if (type == Config.getInstance().getTamingCOTWMaterial(CallOfTheWildType.HORSE.getConfigEntityTypeEntry())) {
|
else if (type == mcMMO.p.getGeneralConfig().getTamingCOTWMaterial(CallOfTheWildType.HORSE.getConfigEntityTypeEntry())) {
|
||||||
tamingManager.summonHorse();
|
tamingManager.summonHorse();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -951,7 +950,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 (!mcMMO.p.getGeneralConfig().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(Locale.ENGLISH);
|
String lowerCaseCommand = command.toLowerCase(Locale.ENGLISH);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.listeners;
|
package com.gmail.nossr50.listeners;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
@ -45,7 +44,7 @@ public class SelfListener implements Listener {
|
|||||||
//Reset the delay timer
|
//Reset the delay timer
|
||||||
RankUtils.resetUnlockDelayTimer();
|
RankUtils.resetUnlockDelayTimer();
|
||||||
|
|
||||||
if(Config.getInstance().getScoreboardsEnabled())
|
if(mcMMO.p.getGeneralConfig().getScoreboardsEnabled())
|
||||||
ScoreboardManager.handleLevelUp(player, skill);
|
ScoreboardManager.handleLevelUp(player, skill);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -55,7 +54,7 @@ public class SelfListener implements Listener {
|
|||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if(player.isOnline()) {
|
if(player.isOnline()) {
|
||||||
if(Config.getInstance().getScoreboardsEnabled())
|
if(mcMMO.p.getGeneralConfig().getScoreboardsEnabled())
|
||||||
ScoreboardManager.handleXp(player, event.getSkill());
|
ScoreboardManager.handleXp(player, event.getSkill());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -64,7 +63,7 @@ public class SelfListener implements Listener {
|
|||||||
public void onAbility(McMMOPlayerAbilityActivateEvent event) {
|
public void onAbility(McMMOPlayerAbilityActivateEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
if(player.isOnline()) {
|
if(player.isOnline()) {
|
||||||
if(Config.getInstance().getScoreboardsEnabled())
|
if(mcMMO.p.getGeneralConfig().getScoreboardsEnabled())
|
||||||
ScoreboardManager.cooldownUpdate(event.getPlayer(), event.getSkill());
|
ScoreboardManager.cooldownUpdate(event.getPlayer(), event.getSkill());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.locale;
|
package com.gmail.nossr50.locale;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.text.TextUtils;
|
import com.gmail.nossr50.util.text.TextUtils;
|
||||||
import net.kyori.adventure.text.TextComponent;
|
import net.kyori.adventure.text.TextComponent;
|
||||||
@ -130,7 +129,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 = mcMMO.p.getGeneralConfig().getLocale().split("[-_ ]");
|
||||||
|
|
||||||
if (myLocale.length == 1) {
|
if (myLocale.length == 1) {
|
||||||
locale = new Locale(myLocale[0]);
|
locale = new Locale(myLocale[0]);
|
||||||
@ -140,7 +139,7 @@ public final class LocaleLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (locale == null) {
|
if (locale == null) {
|
||||||
throw new IllegalStateException("Failed to parse locale string '" + Config.getInstance().getLocale() + "'");
|
throw new IllegalStateException("Failed to parse locale string '" + mcMMO.p.getGeneralConfig().getLocale() + "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
Path localePath = Paths.get(mcMMO.getLocalesDirectory() + "locale_" + locale.toString() + ".properties");
|
Path localePath = Paths.get(mcMMO.getLocalesDirectory() + "locale_" + locale.toString() + ".properties");
|
||||||
|
@ -9,7 +9,9 @@ import com.gmail.nossr50.config.mods.BlockConfigManager;
|
|||||||
import com.gmail.nossr50.config.mods.EntityConfigManager;
|
import com.gmail.nossr50.config.mods.EntityConfigManager;
|
||||||
import com.gmail.nossr50.config.mods.ToolConfigManager;
|
import com.gmail.nossr50.config.mods.ToolConfigManager;
|
||||||
import com.gmail.nossr50.config.skills.alchemy.PotionConfig;
|
import com.gmail.nossr50.config.skills.alchemy.PotionConfig;
|
||||||
|
import com.gmail.nossr50.config.skills.repair.RepairConfig;
|
||||||
import com.gmail.nossr50.config.skills.repair.RepairConfigManager;
|
import com.gmail.nossr50.config.skills.repair.RepairConfigManager;
|
||||||
|
import com.gmail.nossr50.config.skills.salvage.SalvageConfig;
|
||||||
import com.gmail.nossr50.config.skills.salvage.SalvageConfigManager;
|
import com.gmail.nossr50.config.skills.salvage.SalvageConfigManager;
|
||||||
import com.gmail.nossr50.config.treasure.FishingTreasureConfig;
|
import com.gmail.nossr50.config.treasure.FishingTreasureConfig;
|
||||||
import com.gmail.nossr50.config.treasure.TreasureConfig;
|
import com.gmail.nossr50.config.treasure.TreasureConfig;
|
||||||
@ -146,8 +148,19 @@ public class mcMMO extends JavaPlugin {
|
|||||||
public static final String databaseCommandKey = "mcMMO: Processing Database Command";
|
public static final String databaseCommandKey = "mcMMO: Processing Database Command";
|
||||||
|
|
||||||
public static FixedMetadataValue metadataValue;
|
public static FixedMetadataValue metadataValue;
|
||||||
|
private long purgeTime = 2630000000L;
|
||||||
|
|
||||||
public static final String ULTRA_PERMISSONS = "UltraPermissons";
|
private GeneralConfig generalConfig;
|
||||||
|
private AdvancedConfig advancedConfig;
|
||||||
|
private RepairConfig repairConfig;
|
||||||
|
private SalvageConfig salvageConfig;
|
||||||
|
private PersistentDataConfig persistentDataConfig;
|
||||||
|
private ChatConfig chatConfig;
|
||||||
|
private CoreSkillsConfig coreSkillsConfig;
|
||||||
|
private RankConfig rankConfig;
|
||||||
|
private TreasureConfig treasureConfig;
|
||||||
|
private FishingTreasureConfig fishingTreasureConfig;
|
||||||
|
private SoundConfig soundConfig;
|
||||||
|
|
||||||
public mcMMO() {
|
public mcMMO() {
|
||||||
p = this;
|
p = this;
|
||||||
@ -159,8 +172,12 @@ public class mcMMO extends JavaPlugin {
|
|||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
try {
|
try {
|
||||||
|
//Init configs
|
||||||
|
generalConfig = new GeneralConfig(getDataFolder());
|
||||||
|
advancedConfig = new AdvancedConfig(getDataFolder());
|
||||||
|
|
||||||
//Store this value so other plugins can check it
|
//Store this value so other plugins can check it
|
||||||
isRetroModeEnabled = Config.getInstance().getIsRetroMode();
|
isRetroModeEnabled = generalConfig.getIsRetroMode();
|
||||||
|
|
||||||
//Platform Manager
|
//Platform Manager
|
||||||
platformManager = new PlatformManager();
|
platformManager = new PlatformManager();
|
||||||
@ -206,7 +223,11 @@ public class mcMMO extends JavaPlugin {
|
|||||||
getLogger().warning("mcMMO will not work properly alongside NoCheatPlus without CompatNoCheatPlus");
|
getLogger().warning("mcMMO will not work properly alongside NoCheatPlus without CompatNoCheatPlus");
|
||||||
}
|
}
|
||||||
|
|
||||||
databaseManager = DatabaseManagerFactory.getDatabaseManager();
|
// One month in milliseconds
|
||||||
|
this.purgeTime = 2630000000L * generalConfig.getOldUsersCutoff();
|
||||||
|
|
||||||
|
databaseManager = DatabaseManagerFactory.getDatabaseManager(mcMMO.getUsersFilePath(), getLogger(), purgeTime, mcMMO.p.getAdvancedConfig().getStartingLevel());
|
||||||
|
databaseManager.init();
|
||||||
|
|
||||||
//Check for the newer API and tell them what to do if its missing
|
//Check for the newer API and tell them what to do if its missing
|
||||||
checkForOutdatedAPI();
|
checkForOutdatedAPI();
|
||||||
@ -246,7 +267,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
|
|
||||||
placeStore = ChunkManagerFactory.getChunkManager(); // Get our ChunkletManager
|
placeStore = ChunkManagerFactory.getChunkManager(); // Get our ChunkletManager
|
||||||
|
|
||||||
if (Config.getInstance().getPTPCommandWorldPermissions()) {
|
if (generalConfig.getPTPCommandWorldPermissions()) {
|
||||||
Permissions.generateWorldTeleportPermissions();
|
Permissions.generateWorldTeleportPermissions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,11 +278,11 @@ public class mcMMO extends JavaPlugin {
|
|||||||
//If anonymous statistics are enabled then use them
|
//If anonymous statistics are enabled then use them
|
||||||
Metrics metrics;
|
Metrics metrics;
|
||||||
|
|
||||||
if(Config.getInstance().getIsMetricsEnabled()) {
|
if(generalConfig.getIsMetricsEnabled()) {
|
||||||
metrics = new Metrics(this, 3894);
|
metrics = new Metrics(this, 3894);
|
||||||
metrics.addCustomChart(new SimplePie("version", () -> getDescription().getVersion()));
|
metrics.addCustomChart(new SimplePie("version", () -> getDescription().getVersion()));
|
||||||
|
|
||||||
if(Config.getInstance().getIsRetroMode())
|
if(generalConfig.getIsRetroMode())
|
||||||
metrics.addCustomChart(new SimplePie("leveling_system", () -> "Retro"));
|
metrics.addCustomChart(new SimplePie("leveling_system", () -> "Retro"));
|
||||||
else
|
else
|
||||||
metrics.addCustomChart(new SimplePie("leveling_system", () -> "Standard"));
|
metrics.addCustomChart(new SimplePie("leveling_system", () -> "Standard"));
|
||||||
@ -350,7 +371,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(generalConfig.getScoreboardsEnabled())
|
||||||
ScoreboardManager.teardownAll();
|
ScoreboardManager.teardownAll();
|
||||||
|
|
||||||
formulaManager.saveFormula();
|
formulaManager.saveFormula();
|
||||||
@ -360,7 +381,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getBackupsEnabled()) {
|
if (generalConfig.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();
|
||||||
@ -532,7 +553,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
TreasureConfig.getInstance();
|
TreasureConfig.getInstance();
|
||||||
FishingTreasureConfig.getInstance();
|
FishingTreasureConfig.getInstance();
|
||||||
HiddenConfig.getInstance();
|
HiddenConfig.getInstance();
|
||||||
AdvancedConfig.getInstance();
|
mcMMO.p.getAdvancedConfig();
|
||||||
PotionConfig.getInstance();
|
PotionConfig.getInstance();
|
||||||
CoreSkillsConfig.getInstance();
|
CoreSkillsConfig.getInstance();
|
||||||
SoundConfig.getInstance();
|
SoundConfig.getInstance();
|
||||||
@ -542,19 +563,19 @@ public class mcMMO extends JavaPlugin {
|
|||||||
|
|
||||||
List<Repairable> repairables = new ArrayList<>();
|
List<Repairable> repairables = new ArrayList<>();
|
||||||
|
|
||||||
if (Config.getInstance().getToolModsEnabled()) {
|
if (generalConfig.getToolModsEnabled()) {
|
||||||
new ToolConfigManager(this);
|
new ToolConfigManager(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getArmorModsEnabled()) {
|
if (generalConfig.getArmorModsEnabled()) {
|
||||||
new ArmorConfigManager(this);
|
new ArmorConfigManager(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getBlockModsEnabled()) {
|
if (generalConfig.getBlockModsEnabled()) {
|
||||||
new BlockConfigManager(this);
|
new BlockConfigManager(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getEntityModsEnabled()) {
|
if (generalConfig.getEntityModsEnabled()) {
|
||||||
new EntityConfigManager(this);
|
new EntityConfigManager(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -609,7 +630,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 (generalConfig.getChimaeraEnabled()) {
|
||||||
getServer().addRecipe(ChimaeraWing.getChimaeraWingRecipe());
|
getServer().addRecipe(ChimaeraWing.getChimaeraWingRecipe());
|
||||||
}
|
}
|
||||||
}, 40);
|
}, 40);
|
||||||
@ -620,7 +641,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
long second = 20;
|
long second = 20;
|
||||||
long minute = second * 60;
|
long minute = second * 60;
|
||||||
|
|
||||||
long saveIntervalTicks = Math.max(minute, Config.getInstance().getSaveInterval() * minute);
|
long saveIntervalTicks = Math.max(minute, generalConfig.getSaveInterval() * minute);
|
||||||
|
|
||||||
new SaveTimerTask().runTaskTimer(this, saveIntervalTicks, saveIntervalTicks);
|
new SaveTimerTask().runTaskTimer(this, saveIntervalTicks, saveIntervalTicks);
|
||||||
|
|
||||||
@ -628,7 +649,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
new CleanBackupsTask().runTaskAsynchronously(mcMMO.p);
|
new CleanBackupsTask().runTaskAsynchronously(mcMMO.p);
|
||||||
|
|
||||||
// Old & Powerless User remover
|
// Old & Powerless User remover
|
||||||
long purgeIntervalTicks = Config.getInstance().getPurgeInterval() * 60L * 60L * Misc.TICK_CONVERSION_FACTOR;
|
long purgeIntervalTicks = generalConfig.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.
|
||||||
@ -638,7 +659,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 = generalConfig.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.
|
||||||
@ -655,29 +676,29 @@ public class mcMMO extends JavaPlugin {
|
|||||||
new ClearRegisteredXPGainTask().runTaskTimer(this, 60, 60);
|
new ClearRegisteredXPGainTask().runTaskTimer(this, 60, 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(AdvancedConfig.getInstance().allowPlayerTips())
|
if(mcMMO.p.getAdvancedConfig().allowPlayerTips())
|
||||||
{
|
{
|
||||||
new NotifySquelchReminderTask().runTaskTimer(this, 60, ((20 * 60) * 60));
|
new NotifySquelchReminderTask().runTaskTimer(this, 60, ((20 * 60) * 60));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkModConfigs() {
|
private void checkModConfigs() {
|
||||||
if (!Config.getInstance().getToolModsEnabled()) {
|
if (!generalConfig.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 (!generalConfig.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 (!generalConfig.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 (!generalConfig.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.");
|
||||||
}
|
}
|
||||||
@ -742,4 +763,15 @@ public class mcMMO extends JavaPlugin {
|
|||||||
serverShutdownExecuted = bool;
|
serverShutdownExecuted = bool;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long getPurgeTime() {
|
||||||
|
return purgeTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public @NotNull GeneralConfig getGeneralConfig() {
|
||||||
|
return generalConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
public @NotNull AdvancedConfig getAdvancedConfig() {
|
||||||
|
return advancedConfig;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.party;
|
package com.gmail.nossr50.party;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.datatypes.chat.ChatChannel;
|
import com.gmail.nossr50.datatypes.chat.ChatChannel;
|
||||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||||
import com.gmail.nossr50.datatypes.party.ItemShareType;
|
import com.gmail.nossr50.datatypes.party.ItemShareType;
|
||||||
@ -61,7 +60,7 @@ public final class PartyManager {
|
|||||||
*/
|
*/
|
||||||
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) && mcMMO.p.getGeneralConfig().getPartyMaxSize() >= 1 && targetParty.getOnlineMembers().size() >= mcMMO.p.getGeneralConfig().getPartyMaxSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -153,7 +152,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 = mcMMO.p.getGeneralConfig().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)) {
|
||||||
@ -171,7 +170,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 = mcMMO.p.getGeneralConfig().getPartyShareRange();
|
||||||
|
|
||||||
for (Player member : party.getVisibleMembers(player)) {
|
for (Player member : party.getVisibleMembers(player)) {
|
||||||
if (!player.equals(member)
|
if (!player.equals(member)
|
||||||
@ -439,9 +438,9 @@ 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(mcMMO.p.getGeneralConfig().getPartyMaxSize() > 0 && invite.getMembers().size() >= mcMMO.p.getGeneralConfig().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(mcMMO.p.getGeneralConfig().getPartyMaxSize()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -810,7 +809,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 = mcMMO.p.getGeneralConfig().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,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.party;
|
package com.gmail.nossr50.party;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.config.party.ItemWeightConfig;
|
import com.gmail.nossr50.config.party.ItemWeightConfig;
|
||||||
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
||||||
import com.gmail.nossr50.datatypes.experience.XPGainSource;
|
import com.gmail.nossr50.datatypes.experience.XPGainSource;
|
||||||
@ -9,6 +8,7 @@ import com.gmail.nossr50.datatypes.party.Party;
|
|||||||
import com.gmail.nossr50.datatypes.party.ShareMode;
|
import com.gmail.nossr50.datatypes.party.ShareMode;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import org.bukkit.entity.Item;
|
import org.bukkit.entity.Item;
|
||||||
@ -44,7 +44,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(mcMMO.p.getGeneralConfig().getPartyShareBonusBase() + (partySize * mcMMO.p.getGeneralConfig().getPartyShareBonusIncrease()), mcMMO.p.getGeneralConfig().getPartyShareBonusCap());
|
||||||
float splitXp = (float) (xp / partySize * shareBonus);
|
float splitXp = (float) (xp / partySize * shareBonus);
|
||||||
|
|
||||||
for (Player member : nearMembers) {
|
for (Player member : nearMembers) {
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.runnables.backups;
|
package com.gmail.nossr50.runnables.backups;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
@ -48,11 +47,11 @@ 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) && mcMMO.p.getGeneralConfig().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) && mcMMO.p.getGeneralConfig().getKeepDailyLastWeek()) {
|
||||||
// Keep daily backups of the past week
|
// Keep daily backups of the past week
|
||||||
savedDays.add(dayOfWeek);
|
savedDays.add(dayOfWeek);
|
||||||
continue;
|
continue;
|
||||||
@ -60,7 +59,7 @@ public class CleanBackupsTask extends BukkitRunnable {
|
|||||||
else {
|
else {
|
||||||
List<Integer> savedWeeks = savedYearsWeeks.computeIfAbsent(year, k -> new ArrayList<>());
|
List<Integer> savedWeeks = savedYearsWeeks.computeIfAbsent(year, k -> new ArrayList<>());
|
||||||
|
|
||||||
if (!savedWeeks.contains(weekOfYear) && Config.getInstance().getKeepWeeklyPastMonth()) {
|
if (!savedWeeks.contains(weekOfYear) && mcMMO.p.getGeneralConfig().getKeepWeeklyPastMonth()) {
|
||||||
// Keep one backup of each week
|
// Keep one backup of each week
|
||||||
savedWeeks.add(weekOfYear);
|
savedWeeks.add(weekOfYear);
|
||||||
continue;
|
continue;
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.runnables.commands;
|
package com.gmail.nossr50.runnables.commands;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
@ -30,7 +29,7 @@ public class McrankCommandDisplayTask extends BukkitRunnable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (useBoard && Config.getInstance().getScoreboardsEnabled()) {
|
if (useBoard && mcMMO.p.getGeneralConfig().getScoreboardsEnabled()) {
|
||||||
displayBoard();
|
displayBoard();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.runnables.commands;
|
package com.gmail.nossr50.runnables.commands;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.datatypes.database.PlayerStat;
|
import com.gmail.nossr50.datatypes.database.PlayerStat;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
@ -34,7 +33,7 @@ public class MctopCommandDisplayTask extends BukkitRunnable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (useBoard && Config.getInstance().getScoreboardsEnabled()) {
|
if (useBoard && mcMMO.p.getGeneralConfig().getScoreboardsEnabled()) {
|
||||||
displayBoard();
|
displayBoard();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.runnables.database;
|
package com.gmail.nossr50.runnables.database;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
@ -13,7 +12,7 @@ public class UserPurgeTask extends BukkitRunnable {
|
|||||||
lock.lock();
|
lock.lock();
|
||||||
mcMMO.getDatabaseManager().purgePowerlessUsers();
|
mcMMO.getDatabaseManager().purgePowerlessUsers();
|
||||||
|
|
||||||
if (Config.getInstance().getOldUsersCutoff() != -1) {
|
if (mcMMO.p.getGeneralConfig().getOldUsersCutoff() != -1) {
|
||||||
mcMMO.getDatabaseManager().purgeOldUsers();
|
mcMMO.getDatabaseManager().purgeOldUsers();
|
||||||
}
|
}
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.gmail.nossr50.runnables.items;
|
package com.gmail.nossr50.runnables.items;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.ChimaeraWing;
|
import com.gmail.nossr50.util.ChimaeraWing;
|
||||||
import com.gmail.nossr50.util.ItemUtils;
|
import com.gmail.nossr50.util.ItemUtils;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
@ -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() < mcMMO.p.getGeneralConfig().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 = mcMMO.p.getGeneralConfig().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,8 +1,8 @@
|
|||||||
package com.gmail.nossr50.runnables.items;
|
package com.gmail.nossr50.runnables.items;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.party.PartyManager;
|
import com.gmail.nossr50.party.PartyManager;
|
||||||
import com.gmail.nossr50.util.EventUtils;
|
import com.gmail.nossr50.util.EventUtils;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
@ -42,7 +42,7 @@ public class TeleportationWarmup extends BukkitRunnable {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int hurtCooldown = Config.getInstance().getPTPCommandRecentlyHurtCooldown();
|
int hurtCooldown = mcMMO.p.getGeneralConfig().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);
|
||||||
@ -53,7 +53,7 @@ public class TeleportationWarmup extends BukkitRunnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getPTPCommandWorldPermissions()) {
|
if (mcMMO.p.getGeneralConfig().getPTPCommandWorldPermissions()) {
|
||||||
World targetWorld = targetPlayer.getWorld();
|
World targetWorld = targetPlayer.getWorld();
|
||||||
World playerWorld = teleportingPlayer.getWorld();
|
World playerWorld = teleportingPlayer.getWorld();
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.runnables.party;
|
package com.gmail.nossr50.runnables.party;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.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 +13,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 * mcMMO.p.getGeneralConfig().getAutoPartyKickTime();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.runnables.player;
|
package com.gmail.nossr50.runnables.player;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
@ -97,16 +96,16 @@ public class PlayerProfileLoadingTask extends BukkitRunnable {
|
|||||||
UserManager.track(mcMMOPlayer);
|
UserManager.track(mcMMOPlayer);
|
||||||
mcMMOPlayer.actualizeRespawnATS();
|
mcMMOPlayer.actualizeRespawnATS();
|
||||||
|
|
||||||
if (Config.getInstance().getScoreboardsEnabled()) {
|
if (mcMMO.p.getGeneralConfig().getScoreboardsEnabled()) {
|
||||||
ScoreboardManager.setupPlayer(player);
|
ScoreboardManager.setupPlayer(player);
|
||||||
|
|
||||||
if (Config.getInstance().getShowStatsAfterLogin()) {
|
if (mcMMO.p.getGeneralConfig().getShowStatsAfterLogin()) {
|
||||||
ScoreboardManager.enablePlayerStatsScoreboard(player);
|
ScoreboardManager.enablePlayerStatsScoreboard(player);
|
||||||
new McScoreboardKeepTask(player).runTaskLater(mcMMO.p, Misc.TICK_CONVERSION_FACTOR);
|
new McScoreboardKeepTask(player).runTaskLater(mcMMO.p, Misc.TICK_CONVERSION_FACTOR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getShowProfileLoadedMessage()) {
|
if (mcMMO.p.getGeneralConfig().getShowProfileLoadedMessage()) {
|
||||||
player.sendMessage(LocaleLoader.getString("Profile.Loading.Success"));
|
player.sendMessage(LocaleLoader.getString("Profile.Loading.Success"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package com.gmail.nossr50.runnables.skills;
|
package com.gmail.nossr50.runnables.skills;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
||||||
@ -41,7 +39,7 @@ public class AbilityDisableTask extends BukkitRunnable {
|
|||||||
// Fallthrough
|
// Fallthrough
|
||||||
|
|
||||||
case BERSERK:
|
case BERSERK:
|
||||||
if (Config.getInstance().getRefreshChunksEnabled()) {
|
if (mcMMO.p.getGeneralConfig().getRefreshChunksEnabled()) {
|
||||||
resendChunkRadiusAt(player);
|
resendChunkRadiusAt(player);
|
||||||
}
|
}
|
||||||
// Fallthrough
|
// Fallthrough
|
||||||
@ -62,7 +60,7 @@ public class AbilityDisableTask extends BukkitRunnable {
|
|||||||
NotificationManager.sendPlayerInformation(player, NotificationType.ABILITY_OFF, ability.getAbilityOff());
|
NotificationManager.sendPlayerInformation(player, NotificationType.ABILITY_OFF, ability.getAbilityOff());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AdvancedConfig.getInstance().sendAbilityNotificationToOtherPlayers()) {
|
if (mcMMO.p.getAdvancedConfig().sendAbilityNotificationToOtherPlayers()) {
|
||||||
SkillUtils.sendSkillMessage(player, NotificationType.SUPER_ABILITY_ALERT_OTHERS, ability.getAbilityPlayerOff());
|
SkillUtils.sendSkillMessage(player, NotificationType.SUPER_ABILITY_ALERT_OTHERS, ability.getAbilityPlayerOff());
|
||||||
}
|
}
|
||||||
new AbilityCooldownTask(mcMMOPlayer, ability).runTaskLater(mcMMO.p, PerksUtils.handleCooldownPerks(player, ability.getCooldown()) * Misc.TICK_CONVERSION_FACTOR);
|
new AbilityCooldownTask(mcMMOPlayer, ability).runTaskLater(mcMMO.p, PerksUtils.handleCooldownPerks(player, ability.getCooldown()) * Misc.TICK_CONVERSION_FACTOR);
|
||||||
|
@ -57,7 +57,7 @@
|
|||||||
// double damage;
|
// double damage;
|
||||||
//
|
//
|
||||||
// if (target instanceof Player) {
|
// if (target instanceof Player) {
|
||||||
// damage = AdvancedConfig.getInstance().getRuptureDamagePlayer();
|
// damage = mcMMO.p.getAdvancedConfig().getRuptureDamagePlayer();
|
||||||
//
|
//
|
||||||
// //Above Bleed Rank 3 deals 50% more damage
|
// //Above Bleed Rank 3 deals 50% more damage
|
||||||
// if (containerEntry.getValue().toolTier >= 4 && containerEntry.getValue().bleedRank >= 3)
|
// if (containerEntry.getValue().toolTier >= 4 && containerEntry.getValue().bleedRank >= 3)
|
||||||
@ -78,7 +78,7 @@
|
|||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// } else {
|
// } else {
|
||||||
// damage = AdvancedConfig.getInstance().getRuptureDamageMobs();
|
// damage = mcMMO.p.getAdvancedConfig().getRuptureDamageMobs();
|
||||||
//
|
//
|
||||||
//// debugMessage+="BaseDMG=["+damage+"], ";
|
//// debugMessage+="BaseDMG=["+damage+"], ";
|
||||||
//
|
//
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
package com.gmail.nossr50.runnables.skills;
|
package com.gmail.nossr50.runnables.skills;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.MobHealthbarUtils;
|
|
||||||
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
|
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
@ -28,7 +26,7 @@ public class RuptureTask extends BukkitRunnable {
|
|||||||
public RuptureTask(@NotNull McMMOPlayer ruptureSource, @NotNull LivingEntity targetEntity, double pureTickDamage, double explosionDamage) {
|
public RuptureTask(@NotNull McMMOPlayer ruptureSource, @NotNull LivingEntity targetEntity, double pureTickDamage, double explosionDamage) {
|
||||||
this.ruptureSource = ruptureSource;
|
this.ruptureSource = ruptureSource;
|
||||||
this.targetEntity = targetEntity;
|
this.targetEntity = targetEntity;
|
||||||
this.expireTick = AdvancedConfig.getInstance().getRuptureDurationSeconds(targetEntity instanceof Player) * 20;
|
this.expireTick = mcMMO.p.getAdvancedConfig().getRuptureDurationSeconds(targetEntity instanceof Player) * 20;
|
||||||
|
|
||||||
this.ruptureTick = 0;
|
this.ruptureTick = 0;
|
||||||
this.damageTickTracker = 0;
|
this.damageTickTracker = 0;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package com.gmail.nossr50.runnables.skills;
|
package com.gmail.nossr50.runnables.skills;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.ToolType;
|
import com.gmail.nossr50.datatypes.skills.ToolType;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.player.NotificationManager;
|
import com.gmail.nossr50.util.player.NotificationManager;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ public class ToolLowerTask extends BukkitRunnable {
|
|||||||
|
|
||||||
mcMMOPlayer.setToolPreparationMode(tool, false);
|
mcMMOPlayer.setToolPreparationMode(tool, false);
|
||||||
|
|
||||||
if (Config.getInstance().getAbilityMessagesEnabled()) {
|
if (mcMMO.p.getGeneralConfig().getAbilityMessagesEnabled()) {
|
||||||
NotificationManager.sendPlayerInformation(mcMMOPlayer.getPlayer(), NotificationType.TOOL, tool.getLowerTool());
|
NotificationManager.sendPlayerInformation(mcMMOPlayer.getPlayer(), NotificationType.TOOL, tool.getLowerTool());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
package com.gmail.nossr50.skills.acrobatics;
|
package com.gmail.nossr50.skills.acrobatics;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
|
||||||
public final class Acrobatics {
|
public final class Acrobatics {
|
||||||
public static double dodgeDamageModifier = AdvancedConfig.getInstance().getDodgeDamageModifier();
|
public static double dodgeDamageModifier = mcMMO.p.getAdvancedConfig().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 = mcMMO.p.getGeneralConfig().getDodgeLightningDisabled();
|
||||||
|
|
||||||
private Acrobatics() {}
|
private Acrobatics() {}
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.skills.alchemy;
|
package com.gmail.nossr50.skills.alchemy;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.runnables.skills.AlchemyBrewTask;
|
import com.gmail.nossr50.runnables.skills.AlchemyBrewTask;
|
||||||
@ -43,16 +42,16 @@ public final class Alchemy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected int getLevel() {
|
protected int getLevel() {
|
||||||
return AdvancedConfig.getInstance().getConcoctionsTierLevel(this);
|
return mcMMO.p.getAdvancedConfig().getConcoctionsTierLevel(this);
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
public static final int INGREDIENT_SLOT = 3;
|
public static final int INGREDIENT_SLOT = 3;
|
||||||
|
|
||||||
public static int catalysisUnlockLevel = RankUtils.getUnlockLevel(SubSkillType.ALCHEMY_CATALYSIS);
|
public static int catalysisUnlockLevel = RankUtils.getUnlockLevel(SubSkillType.ALCHEMY_CATALYSIS);
|
||||||
public static int catalysisMaxBonusLevel = AdvancedConfig.getInstance().getCatalysisMaxBonusLevel();
|
public static int catalysisMaxBonusLevel = mcMMO.p.getAdvancedConfig().getCatalysisMaxBonusLevel();
|
||||||
public static double catalysisMinSpeed = AdvancedConfig.getInstance().getCatalysisMinSpeed();
|
public static double catalysisMinSpeed = mcMMO.p.getAdvancedConfig().getCatalysisMinSpeed();
|
||||||
public static double catalysisMaxSpeed = AdvancedConfig.getInstance().getCatalysisMaxSpeed();
|
public static double catalysisMaxSpeed = mcMMO.p.getAdvancedConfig().getCatalysisMaxSpeed();
|
||||||
|
|
||||||
public static Map<Location, AlchemyBrewTask> brewingStandMap = new HashMap<>();
|
public static Map<Location, AlchemyBrewTask> brewingStandMap = new HashMap<>();
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package com.gmail.nossr50.skills.archery;
|
package com.gmail.nossr50.skills.archery;
|
||||||
|
|
||||||
import com.gmail.nossr50.api.ItemSpawnReason;
|
import com.gmail.nossr50.api.ItemSpawnReason;
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
import com.gmail.nossr50.util.skills.RankUtils;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -19,9 +19,9 @@ import java.util.List;
|
|||||||
public class Archery {
|
public class Archery {
|
||||||
private static final List<TrackedEntity> trackedEntities = new ArrayList<>();
|
private static final List<TrackedEntity> trackedEntities = new ArrayList<>();
|
||||||
|
|
||||||
public static double skillShotMaxBonusDamage = AdvancedConfig.getInstance().getSkillShotDamageMax();
|
public static double skillShotMaxBonusDamage = mcMMO.p.getAdvancedConfig().getSkillShotDamageMax();
|
||||||
|
|
||||||
public static double dazeBonusDamage = AdvancedConfig.getInstance().getDazeBonusDamage();
|
public static double dazeBonusDamage = mcMMO.p.getAdvancedConfig().getDazeBonusDamage();
|
||||||
|
|
||||||
public static final double DISTANCE_XP_MULTIPLIER = ExperienceConfig.getInstance().getArcheryDistanceMultiplier();
|
public static final double DISTANCE_XP_MULTIPLIER = ExperienceConfig.getInstance().getArcheryDistanceMultiplier();
|
||||||
|
|
||||||
@ -72,6 +72,6 @@ public class Archery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static double getDamageBonusPercent(Player player) {
|
public static double getDamageBonusPercent(Player player) {
|
||||||
return ((RankUtils.getRank(player, SubSkillType.ARCHERY_SKILL_SHOT)) * (AdvancedConfig.getInstance().getSkillShotRankDamageMultiplier()) / 100.0D);
|
return ((RankUtils.getRank(player, SubSkillType.ARCHERY_SKILL_SHOT)) * (mcMMO.p.getAdvancedConfig().getSkillShotRankDamageMultiplier()) / 100.0D);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.gmail.nossr50.skills.axes;
|
package com.gmail.nossr50.skills.axes;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.ItemUtils;
|
import com.gmail.nossr50.util.ItemUtils;
|
||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
import com.gmail.nossr50.util.skills.RankUtils;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
@ -9,18 +9,18 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class Axes {
|
public class Axes {
|
||||||
public static double axeMasteryRankDamageMultiplier = AdvancedConfig.getInstance().getAxeMasteryRankDamageMultiplier();
|
public static double axeMasteryRankDamageMultiplier = mcMMO.p.getAdvancedConfig().getAxeMasteryRankDamageMultiplier();
|
||||||
|
|
||||||
public static double criticalHitPVPModifier = AdvancedConfig.getInstance().getCriticalStrikesPVPModifier();
|
public static double criticalHitPVPModifier = mcMMO.p.getAdvancedConfig().getCriticalStrikesPVPModifier();
|
||||||
public static double criticalHitPVEModifier = AdvancedConfig.getInstance().getCriticalStrikesPVEModifier();
|
public static double criticalHitPVEModifier = mcMMO.p.getAdvancedConfig().getCriticalStrikesPVEModifier();
|
||||||
|
|
||||||
public static double impactChance = AdvancedConfig.getInstance().getImpactChance();
|
public static double impactChance = mcMMO.p.getAdvancedConfig().getImpactChance();
|
||||||
|
|
||||||
public static double greaterImpactBonusDamage = AdvancedConfig.getInstance().getGreaterImpactBonusDamage();
|
public static double greaterImpactBonusDamage = mcMMO.p.getAdvancedConfig().getGreaterImpactBonusDamage();
|
||||||
public static double greaterImpactChance = AdvancedConfig.getInstance().getGreaterImpactChance();
|
public static double greaterImpactChance = mcMMO.p.getAdvancedConfig().getGreaterImpactChance();
|
||||||
public static double greaterImpactKnockbackMultiplier = AdvancedConfig.getInstance().getGreaterImpactModifier();
|
public static double greaterImpactKnockbackMultiplier = mcMMO.p.getAdvancedConfig().getGreaterImpactModifier();
|
||||||
|
|
||||||
public static double skullSplitterModifier = AdvancedConfig.getInstance().getSkullSplitterModifier();
|
public static double skullSplitterModifier = mcMMO.p.getAdvancedConfig().getSkullSplitterModifier();
|
||||||
|
|
||||||
protected static boolean hasArmor(LivingEntity target) {
|
protected static boolean hasArmor(LivingEntity target) {
|
||||||
if(target == null || !target.isValid() || target.getEquipment() == null)
|
if(target == null || !target.isValid() || target.getEquipment() == null)
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package com.gmail.nossr50.skills.axes;
|
package com.gmail.nossr50.skills.axes;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
|
||||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
||||||
import com.gmail.nossr50.datatypes.skills.ToolType;
|
import com.gmail.nossr50.datatypes.skills.ToolType;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.skills.SkillManager;
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
import com.gmail.nossr50.util.ItemUtils;
|
import com.gmail.nossr50.util.ItemUtils;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
@ -127,7 +127,7 @@ public class AxesManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public double getImpactDurabilityDamage() {
|
public double getImpactDurabilityDamage() {
|
||||||
return AdvancedConfig.getInstance().getImpactDurabilityDamageMultiplier() * RankUtils.getRank(getPlayer(), SubSkillType.AXES_ARMOR_IMPACT);
|
return mcMMO.p.getAdvancedConfig().getImpactDurabilityDamageMultiplier() * RankUtils.getRank(getPlayer(), SubSkillType.AXES_ARMOR_IMPACT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package com.gmail.nossr50.skills.excavation;
|
package com.gmail.nossr50.skills.excavation;
|
||||||
|
|
||||||
import com.gmail.nossr50.api.ItemSpawnReason;
|
import com.gmail.nossr50.api.ItemSpawnReason;
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
|
import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.skills.SkillManager;
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
@ -98,6 +98,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(), mcMMO.p.getGeneralConfig().getAbilityToolDamage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
package com.gmail.nossr50.skills.fishing;
|
package com.gmail.nossr50.skills.fishing;
|
||||||
|
|
||||||
import com.gmail.nossr50.api.ItemSpawnReason;
|
import com.gmail.nossr50.api.ItemSpawnReason;
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.config.treasure.FishingTreasureConfig;
|
import com.gmail.nossr50.config.treasure.FishingTreasureConfig;
|
||||||
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
||||||
@ -198,11 +196,11 @@ public class FishingManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public double getShakeChance() {
|
public double getShakeChance() {
|
||||||
return AdvancedConfig.getInstance().getShakeChance(RankUtils.getRank(mmoPlayer.getPlayer(), SubSkillType.FISHING_SHAKE));
|
return mcMMO.p.getAdvancedConfig().getShakeChance(RankUtils.getRank(mmoPlayer.getPlayer(), SubSkillType.FISHING_SHAKE));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int getVanillaXPBoostModifier() {
|
protected int getVanillaXPBoostModifier() {
|
||||||
return AdvancedConfig.getInstance().getFishingVanillaXPModifier(getLootTier());
|
return mcMMO.p.getAdvancedConfig().getFishingVanillaXPModifier(getLootTier());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -273,8 +271,8 @@ public class FishingManager extends SkillManager {
|
|||||||
int maxWaitReduction = getMasterAnglerTickMaxWaitReduction(masterAnglerRank, boatBonus, convertedLureBonus);
|
int maxWaitReduction = getMasterAnglerTickMaxWaitReduction(masterAnglerRank, boatBonus, convertedLureBonus);
|
||||||
|
|
||||||
//Ticks for minWait and maxWait never go below this value
|
//Ticks for minWait and maxWait never go below this value
|
||||||
int bonusCapMin = AdvancedConfig.getInstance().getFishingReductionMinWaitCap();
|
int bonusCapMin = mcMMO.p.getAdvancedConfig().getFishingReductionMinWaitCap();
|
||||||
int bonusCapMax = AdvancedConfig.getInstance().getFishingReductionMaxWaitCap();
|
int bonusCapMax = mcMMO.p.getAdvancedConfig().getFishingReductionMaxWaitCap();
|
||||||
|
|
||||||
int reducedMinWaitTime = getReducedTicks(minWaitTicks, minWaitReduction, bonusCapMin);
|
int reducedMinWaitTime = getReducedTicks(minWaitTicks, minWaitReduction, bonusCapMin);
|
||||||
int reducedMaxWaitTime = getReducedTicks(maxWaitTicks, maxWaitReduction, bonusCapMax);
|
int reducedMaxWaitTime = getReducedTicks(maxWaitTicks, maxWaitReduction, bonusCapMax);
|
||||||
@ -337,7 +335,7 @@ public class FishingManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getMasterAnglerTickMaxWaitReduction(int masterAnglerRank, boolean boatBonus, int emulatedLureBonus) {
|
public int getMasterAnglerTickMaxWaitReduction(int masterAnglerRank, boolean boatBonus, int emulatedLureBonus) {
|
||||||
int totalBonus = AdvancedConfig.getInstance().getFishingReductionMaxWaitTicks() * masterAnglerRank;
|
int totalBonus = mcMMO.p.getAdvancedConfig().getFishingReductionMaxWaitTicks() * masterAnglerRank;
|
||||||
|
|
||||||
if(boatBonus) {
|
if(boatBonus) {
|
||||||
totalBonus += getFishingBoatMaxWaitReduction();
|
totalBonus += getFishingBoatMaxWaitReduction();
|
||||||
@ -349,7 +347,7 @@ public class FishingManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getMasterAnglerTickMinWaitReduction(int masterAnglerRank, boolean boatBonus) {
|
public int getMasterAnglerTickMinWaitReduction(int masterAnglerRank, boolean boatBonus) {
|
||||||
int totalBonus = AdvancedConfig.getInstance().getFishingReductionMinWaitTicks() * masterAnglerRank;
|
int totalBonus = mcMMO.p.getAdvancedConfig().getFishingReductionMinWaitTicks() * masterAnglerRank;
|
||||||
|
|
||||||
if(boatBonus) {
|
if(boatBonus) {
|
||||||
totalBonus += getFishingBoatMinWaitReduction();
|
totalBonus += getFishingBoatMinWaitReduction();
|
||||||
@ -359,11 +357,11 @@ public class FishingManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getFishingBoatMinWaitReduction() {
|
public int getFishingBoatMinWaitReduction() {
|
||||||
return AdvancedConfig.getInstance().getFishingBoatReductionMinWaitTicks();
|
return mcMMO.p.getAdvancedConfig().getFishingBoatReductionMinWaitTicks();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFishingBoatMaxWaitReduction() {
|
public int getFishingBoatMaxWaitReduction() {
|
||||||
return AdvancedConfig.getInstance().getFishingBoatReductionMaxWaitTicks();
|
return mcMMO.p.getAdvancedConfig().getFishingBoatReductionMaxWaitTicks();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMagicHunterEnabled() {
|
public boolean isMagicHunterEnabled() {
|
||||||
@ -386,7 +384,7 @@ public class FishingManager extends SkillManager {
|
|||||||
FishingTreasure treasure = null;
|
FishingTreasure treasure = null;
|
||||||
boolean fishingSucceeds = false;
|
boolean fishingSucceeds = false;
|
||||||
|
|
||||||
if (Config.getInstance().getFishingDropsEnabled() && Permissions.isSubSkillEnabled(player, SubSkillType.FISHING_TREASURE_HUNTER)) {
|
if (mcMMO.p.getGeneralConfig().getFishingDropsEnabled() && Permissions.isSubSkillEnabled(player, SubSkillType.FISHING_TREASURE_HUNTER)) {
|
||||||
treasure = getFishingTreasure();
|
treasure = getFishingTreasure();
|
||||||
this.fishingCatch = null;
|
this.fishingCatch = null;
|
||||||
}
|
}
|
||||||
@ -447,7 +445,7 @@ public class FishingManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(fishingSucceeds) {
|
if(fishingSucceeds) {
|
||||||
if (Config.getInstance().getFishingExtraFish()) {
|
if (mcMMO.p.getGeneralConfig().getFishingExtraFish()) {
|
||||||
Misc.spawnItem(player.getEyeLocation(), fishingCatch.getItemStack(), ItemSpawnReason.FISHING_EXTRA_FISH);
|
Misc.spawnItem(player.getEyeLocation(), fishingCatch.getItemStack(), ItemSpawnReason.FISHING_EXTRA_FISH);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -579,7 +577,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 * mcMMO.p.getGeneralConfig().getFishingLureModifier() / 100);
|
||||||
|
|
||||||
FishingTreasure treasure = null;
|
FishingTreasure treasure = null;
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.gmail.nossr50.skills.herbalism;
|
package com.gmail.nossr50.skills.herbalism;
|
||||||
|
|
||||||
import com.gmail.nossr50.api.ItemSpawnReason;
|
import com.gmail.nossr50.api.ItemSpawnReason;
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.config.treasure.TreasureConfig;
|
import com.gmail.nossr50.config.treasure.TreasureConfig;
|
||||||
import com.gmail.nossr50.datatypes.BlockSnapshot;
|
import com.gmail.nossr50.datatypes.BlockSnapshot;
|
||||||
@ -210,7 +209,7 @@ public class HerbalismManager extends SkillManager {
|
|||||||
public void processHerbalismBlockBreakEvent(BlockBreakEvent blockBreakEvent) {
|
public void processHerbalismBlockBreakEvent(BlockBreakEvent blockBreakEvent) {
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
|
|
||||||
if (Config.getInstance().getHerbalismPreventAFK() && player.isInsideVehicle()) {
|
if (mcMMO.p.getGeneralConfig().getHerbalismPreventAFK() && player.isInsideVehicle()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,7 +256,7 @@ public class HerbalismManager extends SkillManager {
|
|||||||
|
|
||||||
//TODO: The design of Green Terra needs to change, this is a mess
|
//TODO: The design of Green Terra needs to change, this is a mess
|
||||||
if(Permissions.greenThumbPlant(getPlayer(), originalBreak.getType())) {
|
if(Permissions.greenThumbPlant(getPlayer(), originalBreak.getType())) {
|
||||||
if(Config.getInstance().isGreenThumbReplantableCrop(originalBreak.getType())) {
|
if(mcMMO.p.getGeneralConfig().isGreenThumbReplantableCrop(originalBreak.getType())) {
|
||||||
if(!getPlayer().isSneaking()) {
|
if(!getPlayer().isSneaking()) {
|
||||||
greenThumbActivated = processGreenThumbPlants(originalBreak, blockBreakEvent, isGreenTerraActive());
|
greenThumbActivated = processGreenThumbPlants(originalBreak, blockBreakEvent, isGreenTerraActive());
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.skills.mining;
|
package com.gmail.nossr50.skills.mining;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
@ -33,7 +32,7 @@ public class BlastMining {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected int getLevel() {
|
protected int getLevel() {
|
||||||
return AdvancedConfig.getInstance().getBlastMiningRankLevel(this);
|
return mcMMO.p.getAdvancedConfig().getBlastMiningRankLevel(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -42,13 +41,13 @@ public class BlastMining {
|
|||||||
public final static int MAXIMUM_REMOTE_DETONATION_DISTANCE = 100;
|
public final static int MAXIMUM_REMOTE_DETONATION_DISTANCE = 100;
|
||||||
|
|
||||||
public static double getBlastRadiusModifier(int rank) {
|
public static double getBlastRadiusModifier(int rank) {
|
||||||
return AdvancedConfig.getInstance().getBlastRadiusModifier(rank);
|
return mcMMO.p.getAdvancedConfig().getBlastRadiusModifier(rank);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static double getBlastDamageDecrease(int rank) {
|
public static double getBlastDamageDecrease(int rank) {
|
||||||
return AdvancedConfig.getInstance().getBlastDamageDecrease(rank);
|
return mcMMO.p.getAdvancedConfig().getBlastDamageDecrease(rank);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
package com.gmail.nossr50.skills.mining;
|
package com.gmail.nossr50.skills.mining;
|
||||||
|
|
||||||
import com.gmail.nossr50.api.ItemSpawnReason;
|
import com.gmail.nossr50.api.ItemSpawnReason;
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
||||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||||
@ -48,7 +46,7 @@ public class MiningManager extends SkillManager {
|
|||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
|
|
||||||
return canUseBlastMining() && player.isSneaking()
|
return canUseBlastMining() && player.isSneaking()
|
||||||
&& (ItemUtils.isPickaxe(getPlayer().getInventory().getItemInMainHand()) || player.getInventory().getItemInMainHand().getType() == Config.getInstance().getDetonatorItem())
|
&& (ItemUtils.isPickaxe(getPlayer().getInventory().getItemInMainHand()) || player.getInventory().getItemInMainHand().getType() == mcMMO.p.getGeneralConfig().getDetonatorItem())
|
||||||
&& Permissions.remoteDetonation(player);
|
&& Permissions.remoteDetonation(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,20 +81,20 @@ public class MiningManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mmoPlayer.getAbilityMode(skill.getAbility())) {
|
if (mmoPlayer.getAbilityMode(skill.getAbility())) {
|
||||||
SkillUtils.handleDurabilityChange(getPlayer().getInventory().getItemInMainHand(), Config.getInstance().getAbilityToolDamage());
|
SkillUtils.handleDurabilityChange(getPlayer().getInventory().getItemInMainHand(), mcMMO.p.getGeneralConfig().getAbilityToolDamage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!Config.getInstance().getDoubleDropsEnabled(PrimarySkillType.MINING, blockState.getType()) || !canDoubleDrop())
|
if(!mcMMO.p.getGeneralConfig().getDoubleDropsEnabled(PrimarySkillType.MINING, blockState.getType()) || !canDoubleDrop())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
boolean silkTouch = player.getInventory().getItemInMainHand().containsEnchantment(Enchantment.SILK_TOUCH);
|
boolean silkTouch = player.getInventory().getItemInMainHand().containsEnchantment(Enchantment.SILK_TOUCH);
|
||||||
|
|
||||||
if(silkTouch && !AdvancedConfig.getInstance().getDoubleDropSilkTouchEnabled())
|
if(silkTouch && !mcMMO.p.getAdvancedConfig().getDoubleDropSilkTouchEnabled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//TODO: Make this readable
|
//TODO: Make this readable
|
||||||
if (RandomChanceUtil.checkRandomChanceExecutionSuccess(getPlayer(), SubSkillType.MINING_DOUBLE_DROPS, true)) {
|
if (RandomChanceUtil.checkRandomChanceExecutionSuccess(getPlayer(), SubSkillType.MINING_DOUBLE_DROPS, true)) {
|
||||||
boolean useTriple = mmoPlayer.getAbilityMode(skill.getAbility()) && AdvancedConfig.getInstance().getAllowMiningTripleDrops();
|
boolean useTriple = mmoPlayer.getAbilityMode(skill.getAbility()) && mcMMO.p.getAdvancedConfig().getAllowMiningTripleDrops();
|
||||||
BlockUtils.markDropsAsBonus(blockState, useTriple);
|
BlockUtils.markDropsAsBonus(blockState, useTriple);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -249,11 +247,11 @@ public class MiningManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static double getOreBonus(int rank) {
|
public static double getOreBonus(int rank) {
|
||||||
return AdvancedConfig.getInstance().getOreBonus(rank);
|
return mcMMO.p.getAdvancedConfig().getOreBonus(rank);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double getDebrisReduction(int rank) {
|
public static double getDebrisReduction(int rank) {
|
||||||
return AdvancedConfig.getInstance().getDebrisReduction(rank);
|
return mcMMO.p.getAdvancedConfig().getDebrisReduction(rank);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -266,7 +264,7 @@ public class MiningManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static int getDropMultiplier(int rank) {
|
public static int getDropMultiplier(int rank) {
|
||||||
return AdvancedConfig.getInstance().getDropMultiplier(rank);
|
return mcMMO.p.getAdvancedConfig().getDropMultiplier(rank);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package com.gmail.nossr50.skills.repair;
|
package com.gmail.nossr50.skills.repair;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
|
||||||
public class ArcaneForging {
|
public class ArcaneForging {
|
||||||
|
|
||||||
public static boolean arcaneForgingDowngrades = AdvancedConfig.getInstance().getArcaneForgingDowngradeEnabled();
|
public static boolean arcaneForgingDowngrades = mcMMO.p.getAdvancedConfig().getArcaneForgingDowngradeEnabled();
|
||||||
public static boolean arcaneForgingEnchantLoss = AdvancedConfig.getInstance().getArcaneForgingEnchantLossEnabled();
|
public static boolean arcaneForgingEnchantLoss = mcMMO.p.getAdvancedConfig().getArcaneForgingEnchantLossEnabled();
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
package com.gmail.nossr50.skills.repair;
|
package com.gmail.nossr50.skills.repair;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
|
||||||
public class Repair {
|
public class Repair {
|
||||||
public static int repairMasteryMaxBonusLevel = AdvancedConfig.getInstance().getMaxBonusLevel(SubSkillType.REPAIR_REPAIR_MASTERY);
|
public static int repairMasteryMaxBonusLevel = mcMMO.p.getAdvancedConfig().getMaxBonusLevel(SubSkillType.REPAIR_REPAIR_MASTERY);
|
||||||
public static double repairMasteryMaxBonus = AdvancedConfig.getInstance().getRepairMasteryMaxBonus();
|
public static double repairMasteryMaxBonus = mcMMO.p.getAdvancedConfig().getRepairMasteryMaxBonus();
|
||||||
|
|
||||||
public static Material anvilMaterial = Config.getInstance().getRepairAnvilMaterial();
|
public static Material anvilMaterial = mcMMO.p.getGeneralConfig().getRepairAnvilMaterial();
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package com.gmail.nossr50.skills.repair;
|
package com.gmail.nossr50.skills.repair;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
||||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||||
@ -51,11 +49,11 @@ public class RepairManager extends SkillManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getRepairAnvilMessagesEnabled()) {
|
if (mcMMO.p.getGeneralConfig().getRepairAnvilMessagesEnabled()) {
|
||||||
NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Repair.Listener.Anvil");
|
NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Repair.Listener.Anvil");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getRepairAnvilPlaceSoundsEnabled()) {
|
if (mcMMO.p.getGeneralConfig().getRepairAnvilPlaceSoundsEnabled()) {
|
||||||
SoundManager.sendSound(player, player.getLocation(), SoundType.ANVIL);
|
SoundManager.sendSound(player, player.getLocation(), SoundType.ANVIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,7 +151,7 @@ public class RepairManager extends SkillManager {
|
|||||||
* ExperienceConfig.getInstance().getRepairXP(repairable.getRepairMaterialType())), XPGainReason.PVE);
|
* ExperienceConfig.getInstance().getRepairXP(repairable.getRepairMaterialType())), XPGainReason.PVE);
|
||||||
|
|
||||||
// BWONG BWONG BWONG
|
// BWONG BWONG BWONG
|
||||||
if (Config.getInstance().getRepairAnvilUseSoundsEnabled()) {
|
if (mcMMO.p.getGeneralConfig().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);
|
||||||
}
|
}
|
||||||
@ -175,7 +173,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) || !mcMMO.p.getGeneralConfig().getRepairConfirmRequired()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,7 +202,7 @@ public class RepairManager extends SkillManager {
|
|||||||
* @return The chance of keeping the enchantment
|
* @return The chance of keeping the enchantment
|
||||||
*/
|
*/
|
||||||
public double getKeepEnchantChance() {
|
public double getKeepEnchantChance() {
|
||||||
return AdvancedConfig.getInstance().getArcaneForgingKeepEnchantsChance(getArcaneForgingRank());
|
return mcMMO.p.getAdvancedConfig().getArcaneForgingKeepEnchantsChance(getArcaneForgingRank());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -213,7 +211,7 @@ public class RepairManager extends SkillManager {
|
|||||||
* @return The chance of the enchantment being downgraded
|
* @return The chance of the enchantment being downgraded
|
||||||
*/
|
*/
|
||||||
public double getDowngradeEnchantChance() {
|
public double getDowngradeEnchantChance() {
|
||||||
return AdvancedConfig.getInstance().getArcaneForgingDowngradeChance(getArcaneForgingRank());
|
return mcMMO.p.getAdvancedConfig().getArcaneForgingDowngradeChance(getArcaneForgingRank());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.gmail.nossr50.skills.salvage;
|
package com.gmail.nossr50.skills.salvage;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
|
||||||
public final class Salvage {
|
public final class Salvage {
|
||||||
@ -12,15 +11,15 @@ public final class Salvage {
|
|||||||
*/
|
*/
|
||||||
private Salvage() {}
|
private Salvage() {}
|
||||||
|
|
||||||
public static Material anvilMaterial = Config.getInstance().getSalvageAnvilMaterial();
|
public static Material anvilMaterial = mcMMO.p.getGeneralConfig().getSalvageAnvilMaterial();
|
||||||
|
|
||||||
/*public static int salvageMaxPercentageLevel = AdvancedConfig.getInstance().getSalvageMaxPercentageLevel();
|
/*public static int salvageMaxPercentageLevel = mcMMO.p.getAdvancedConfig().getSalvageMaxPercentageLevel();
|
||||||
public static double salvageMaxPercentage = AdvancedConfig.getInstance().getSalvageMaxPercentage();
|
public static double salvageMaxPercentage = mcMMO.p.getAdvancedConfig().getSalvageMaxPercentage();
|
||||||
|
|
||||||
public static int advancedSalvageUnlockLevel = RankUtils.getRankUnlockLevel(SubSkillType.SALVAGE_SCRAP_COLLECTOR, 1);*/
|
public static int advancedSalvageUnlockLevel = RankUtils.getRankUnlockLevel(SubSkillType.SALVAGE_SCRAP_COLLECTOR, 1);*/
|
||||||
|
|
||||||
public static boolean arcaneSalvageDowngrades = AdvancedConfig.getInstance().getArcaneSalvageEnchantDowngradeEnabled();
|
public static boolean arcaneSalvageDowngrades = mcMMO.p.getAdvancedConfig().getArcaneSalvageEnchantDowngradeEnabled();
|
||||||
public static boolean arcaneSalvageEnchantLoss = AdvancedConfig.getInstance().getArcaneSalvageEnchantLossEnabled();
|
public static boolean arcaneSalvageEnchantLoss = mcMMO.p.getAdvancedConfig().getArcaneSalvageEnchantLossEnabled();
|
||||||
|
|
||||||
static int calculateSalvageableAmount(int currentDurability, short maxDurability, int baseAmount) {
|
static int calculateSalvageableAmount(int currentDurability, short maxDurability, int baseAmount) {
|
||||||
double percentDamaged = (maxDurability <= 0) ? 1D : (double) (maxDurability - currentDurability) / maxDurability;
|
double percentDamaged = (maxDurability <= 0) ? 1D : (double) (maxDurability - currentDurability) / maxDurability;
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
package com.gmail.nossr50.skills.salvage;
|
package com.gmail.nossr50.skills.salvage;
|
||||||
|
|
||||||
import com.gmail.nossr50.api.ItemSpawnReason;
|
import com.gmail.nossr50.api.ItemSpawnReason;
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
@ -53,11 +51,11 @@ public class SalvageManager extends SkillManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getSalvageAnvilMessagesEnabled()) {
|
if (mcMMO.p.getGeneralConfig().getSalvageAnvilMessagesEnabled()) {
|
||||||
NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Salvage.Listener.Anvil");
|
NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Salvage.Listener.Anvil");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.getInstance().getSalvageAnvilPlaceSoundsEnabled()) {
|
if (mcMMO.p.getGeneralConfig().getSalvageAnvilPlaceSoundsEnabled()) {
|
||||||
SoundManager.sendSound(player, player.getLocation(), SoundType.ANVIL);
|
SoundManager.sendSound(player, player.getLocation(), SoundType.ANVIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,7 +166,7 @@ public class SalvageManager extends SkillManager {
|
|||||||
Misc.spawnItemTowardsLocation(anvilLoc.clone(), playerLoc.clone(), salvageResults, vectorSpeed, ItemSpawnReason.SALVAGE_MATERIALS);
|
Misc.spawnItemTowardsLocation(anvilLoc.clone(), playerLoc.clone(), salvageResults, vectorSpeed, ItemSpawnReason.SALVAGE_MATERIALS);
|
||||||
|
|
||||||
// BWONG BWONG BWONG - CLUNK!
|
// BWONG BWONG BWONG - CLUNK!
|
||||||
if (Config.getInstance().getSalvageAnvilUseSoundsEnabled()) {
|
if (mcMMO.p.getGeneralConfig().getSalvageAnvilUseSoundsEnabled()) {
|
||||||
SoundManager.sendSound(player, player.getLocation(), SoundType.ITEM_BREAK);
|
SoundManager.sendSound(player, player.getLocation(), SoundType.ITEM_BREAK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,11 +218,11 @@ public class SalvageManager extends SkillManager {
|
|||||||
if(Permissions.hasSalvageEnchantBypassPerk(getPlayer()))
|
if(Permissions.hasSalvageEnchantBypassPerk(getPlayer()))
|
||||||
return 100.0D;
|
return 100.0D;
|
||||||
|
|
||||||
return AdvancedConfig.getInstance().getArcaneSalvageExtractFullEnchantsChance(getArcaneSalvageRank());
|
return mcMMO.p.getAdvancedConfig().getArcaneSalvageExtractFullEnchantsChance(getArcaneSalvageRank());
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getExtractPartialEnchantChance() {
|
public double getExtractPartialEnchantChance() {
|
||||||
return AdvancedConfig.getInstance().getArcaneSalvageExtractPartialEnchantsChance(getArcaneSalvageRank());
|
return mcMMO.p.getAdvancedConfig().getArcaneSalvageExtractPartialEnchantsChance(getArcaneSalvageRank());
|
||||||
}
|
}
|
||||||
|
|
||||||
private ItemStack arcaneSalvageCheck(Map<Enchantment, Integer> enchants) {
|
private ItemStack arcaneSalvageCheck(Map<Enchantment, Integer> enchants) {
|
||||||
@ -293,7 +291,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) || !mcMMO.p.getGeneralConfig().getSalvageConfirmRequired()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package com.gmail.nossr50.skills.smelting;
|
package com.gmail.nossr50.skills.smelting;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
||||||
import com.gmail.nossr50.datatypes.experience.XPGainSource;
|
import com.gmail.nossr50.datatypes.experience.XPGainSource;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.skills.SkillManager;
|
import com.gmail.nossr50.skills.SkillManager;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.random.RandomChanceUtil;
|
import com.gmail.nossr50.util.random.RandomChanceUtil;
|
||||||
@ -125,7 +125,7 @@ public class SmeltingManager extends SkillManager {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
//Process double smelt
|
//Process double smelt
|
||||||
if (Config.getInstance().getDoubleDropsEnabled(PrimarySkillType.SMELTING, resultItemStack.getType())
|
if (mcMMO.p.getGeneralConfig().getDoubleDropsEnabled(PrimarySkillType.SMELTING, resultItemStack.getType())
|
||||||
&& canDoubleSmeltItemStack(furnace) //Effectively two less than max stack size
|
&& canDoubleSmeltItemStack(furnace) //Effectively two less than max stack size
|
||||||
&& isSecondSmeltSuccessful()) {
|
&& isSecondSmeltSuccessful()) {
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package com.gmail.nossr50.skills.swords;
|
package com.gmail.nossr50.skills.swords;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
|
||||||
public class Swords {
|
public class Swords {
|
||||||
public static double counterAttackModifier = AdvancedConfig.getInstance().getCounterModifier();
|
public static double counterAttackModifier = mcMMO.p.getAdvancedConfig().getCounterModifier();
|
||||||
|
|
||||||
public static double serratedStrikesModifier = AdvancedConfig.getInstance().getSerratedStrikesModifier();
|
public static double serratedStrikesModifier = mcMMO.p.getAdvancedConfig().getSerratedStrikesModifier();
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.skills.swords;
|
package com.gmail.nossr50.skills.swords;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
|
||||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||||
import com.gmail.nossr50.datatypes.meta.RuptureTaskMeta;
|
import com.gmail.nossr50.datatypes.meta.RuptureTaskMeta;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
@ -76,7 +75,7 @@ public class SwordsManager extends SkillManager {
|
|||||||
return; //Don't apply bleed
|
return; //Don't apply bleed
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RandomChanceUtil.rollDice(AdvancedConfig.getInstance().getRuptureChanceToApplyOnHit(getRuptureRank()), 100)) {
|
if (RandomChanceUtil.rollDice(mcMMO.p.getAdvancedConfig().getRuptureChanceToApplyOnHit(getRuptureRank()), 100)) {
|
||||||
|
|
||||||
if (target instanceof Player) {
|
if (target instanceof Player) {
|
||||||
Player defender = (Player) target;
|
Player defender = (Player) target;
|
||||||
@ -91,8 +90,8 @@ public class SwordsManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
RuptureTask ruptureTask = new RuptureTask(mmoPlayer, target,
|
RuptureTask ruptureTask = new RuptureTask(mmoPlayer, target,
|
||||||
AdvancedConfig.getInstance().getRuptureTickDamage(target instanceof Player, getRuptureRank()),
|
mcMMO.p.getAdvancedConfig().getRuptureTickDamage(target instanceof Player, getRuptureRank()),
|
||||||
AdvancedConfig.getInstance().getRuptureExplosionDamage(target instanceof Player, getRuptureRank()));
|
mcMMO.p.getAdvancedConfig().getRuptureExplosionDamage(target instanceof Player, getRuptureRank()));
|
||||||
|
|
||||||
RuptureTaskMeta ruptureTaskMeta = new RuptureTaskMeta(mcMMO.p, ruptureTask);
|
RuptureTaskMeta ruptureTaskMeta = new RuptureTaskMeta(mcMMO.p, ruptureTask);
|
||||||
|
|
||||||
@ -136,7 +135,7 @@ public class SwordsManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getRuptureBleedTicks(boolean isTargetPlayer) {
|
public int getRuptureBleedTicks(boolean isTargetPlayer) {
|
||||||
return AdvancedConfig.getInstance().getRuptureDurationSeconds(isTargetPlayer) / RuptureTask.DAMAGE_TICK_INTERVAL;
|
return mcMMO.p.getAdvancedConfig().getRuptureDurationSeconds(isTargetPlayer) / RuptureTask.DAMAGE_TICK_INTERVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
package com.gmail.nossr50.skills.taming;
|
package com.gmail.nossr50.skills.taming;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import org.bukkit.EntityEffect;
|
import org.bukkit.EntityEffect;
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.*;
|
||||||
|
|
||||||
public class Taming {
|
public class Taming {
|
||||||
public static double fastFoodServiceActivationChance = AdvancedConfig.getInstance().getFastFoodChance();
|
public static double fastFoodServiceActivationChance = mcMMO.p.getAdvancedConfig().getFastFoodChance();
|
||||||
|
|
||||||
public static int goreBleedTicks = 2; //Equivalent to rank 1 in Rupture
|
public static int goreBleedTicks = 2; //Equivalent to rank 1 in Rupture
|
||||||
public static double goreModifier = AdvancedConfig.getInstance().getGoreModifier();
|
public static double goreModifier = mcMMO.p.getAdvancedConfig().getGoreModifier();
|
||||||
|
|
||||||
public static double sharpenedClawsBonusDamage = AdvancedConfig.getInstance().getSharpenedClawsBonus();
|
public static double sharpenedClawsBonusDamage = mcMMO.p.getAdvancedConfig().getSharpenedClawsBonus();
|
||||||
|
|
||||||
public static double shockProofModifier = AdvancedConfig.getInstance().getShockProofModifier();
|
public static double shockProofModifier = mcMMO.p.getAdvancedConfig().getShockProofModifier();
|
||||||
|
|
||||||
public static double thickFurModifier = AdvancedConfig.getInstance().getThickFurModifier();
|
public static double thickFurModifier = mcMMO.p.getAdvancedConfig().getThickFurModifier();
|
||||||
|
|
||||||
public static boolean canPreventDamage(Tameable pet, AnimalTamer owner) {
|
public static boolean canPreventDamage(Tameable pet, AnimalTamer owner) {
|
||||||
return pet.isTamed() && owner instanceof Player && pet instanceof Wolf;
|
return pet.isTamed() && owner instanceof Player && pet instanceof Wolf;
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package com.gmail.nossr50.skills.taming;
|
package com.gmail.nossr50.skills.taming;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
||||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||||
@ -64,9 +62,9 @@ public class TamingManager extends SkillManager {
|
|||||||
if(summoningItems == null) {
|
if(summoningItems == null) {
|
||||||
summoningItems = new HashMap<>();
|
summoningItems = new HashMap<>();
|
||||||
|
|
||||||
summoningItems.put(Config.getInstance().getTamingCOTWMaterial(CallOfTheWildType.CAT.getConfigEntityTypeEntry()), CallOfTheWildType.CAT);
|
summoningItems.put(mcMMO.p.getGeneralConfig().getTamingCOTWMaterial(CallOfTheWildType.CAT.getConfigEntityTypeEntry()), CallOfTheWildType.CAT);
|
||||||
summoningItems.put(Config.getInstance().getTamingCOTWMaterial(CallOfTheWildType.WOLF.getConfigEntityTypeEntry()), CallOfTheWildType.WOLF);
|
summoningItems.put(mcMMO.p.getGeneralConfig().getTamingCOTWMaterial(CallOfTheWildType.WOLF.getConfigEntityTypeEntry()), CallOfTheWildType.WOLF);
|
||||||
summoningItems.put(Config.getInstance().getTamingCOTWMaterial(CallOfTheWildType.HORSE.getConfigEntityTypeEntry()), CallOfTheWildType.HORSE);
|
summoningItems.put(mcMMO.p.getGeneralConfig().getTamingCOTWMaterial(CallOfTheWildType.HORSE.getConfigEntityTypeEntry()), CallOfTheWildType.HORSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: Temporary static cache, will be changed in 2.2
|
//TODO: Temporary static cache, will be changed in 2.2
|
||||||
@ -75,11 +73,11 @@ public class TamingManager extends SkillManager {
|
|||||||
cotwSummonDataProperties = new HashMap<>();
|
cotwSummonDataProperties = new HashMap<>();
|
||||||
|
|
||||||
for(CallOfTheWildType callOfTheWildType : CallOfTheWildType.values()) {
|
for(CallOfTheWildType callOfTheWildType : CallOfTheWildType.values()) {
|
||||||
Material itemSummonMaterial = Config.getInstance().getTamingCOTWMaterial(callOfTheWildType.getConfigEntityTypeEntry());
|
Material itemSummonMaterial = mcMMO.p.getGeneralConfig().getTamingCOTWMaterial(callOfTheWildType.getConfigEntityTypeEntry());
|
||||||
int itemAmountRequired = Config.getInstance().getTamingCOTWCost(callOfTheWildType.getConfigEntityTypeEntry());
|
int itemAmountRequired = mcMMO.p.getGeneralConfig().getTamingCOTWCost(callOfTheWildType.getConfigEntityTypeEntry());
|
||||||
int entitiesSummonedPerCOTW = Config.getInstance().getTamingCOTWAmount(callOfTheWildType.getConfigEntityTypeEntry());
|
int entitiesSummonedPerCOTW = mcMMO.p.getGeneralConfig().getTamingCOTWAmount(callOfTheWildType.getConfigEntityTypeEntry());
|
||||||
int summonLifespanSeconds = Config.getInstance().getTamingCOTWLength(callOfTheWildType.getConfigEntityTypeEntry());
|
int summonLifespanSeconds = mcMMO.p.getGeneralConfig().getTamingCOTWLength(callOfTheWildType.getConfigEntityTypeEntry());
|
||||||
int perPlayerMaxAmount = Config.getInstance().getTamingCOTWMaxAmount(callOfTheWildType.getConfigEntityTypeEntry());
|
int perPlayerMaxAmount = mcMMO.p.getGeneralConfig().getTamingCOTWMaxAmount(callOfTheWildType.getConfigEntityTypeEntry());
|
||||||
|
|
||||||
TamingSummon tamingSummon = new TamingSummon(callOfTheWildType, itemSummonMaterial, itemAmountRequired, entitiesSummonedPerCOTW, summonLifespanSeconds, perPlayerMaxAmount);
|
TamingSummon tamingSummon = new TamingSummon(callOfTheWildType, itemSummonMaterial, itemAmountRequired, entitiesSummonedPerCOTW, summonLifespanSeconds, perPlayerMaxAmount);
|
||||||
cotwSummonDataProperties.put(callOfTheWildType, tamingSummon);
|
cotwSummonDataProperties.put(callOfTheWildType, tamingSummon);
|
||||||
@ -273,7 +271,7 @@ public class TamingManager extends SkillManager {
|
|||||||
if(!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_PUMMEL))
|
if(!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.TAMING_PUMMEL))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(!RandomChanceUtil.checkRandomChanceExecutionSuccess(new RandomChanceSkillStatic(AdvancedConfig.getInstance().getPummelChance(), getPlayer(), SubSkillType.TAMING_PUMMEL)))
|
if(!RandomChanceUtil.checkRandomChanceExecutionSuccess(new RandomChanceSkillStatic(mcMMO.p.getAdvancedConfig().getPummelChance(), getPlayer(), SubSkillType.TAMING_PUMMEL)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ParticleEffectUtils.playGreaterImpactEffect(target);
|
ParticleEffectUtils.playGreaterImpactEffect(target);
|
||||||
@ -459,7 +457,7 @@ public class TamingManager extends SkillManager {
|
|||||||
callOfWildEntity.setHealth(callOfWildEntity.getMaxHealth());
|
callOfWildEntity.setHealth(callOfWildEntity.getMaxHealth());
|
||||||
horse.setColor(Horse.Color.values()[Misc.getRandom().nextInt(Horse.Color.values().length)]);
|
horse.setColor(Horse.Color.values()[Misc.getRandom().nextInt(Horse.Color.values().length)]);
|
||||||
horse.setStyle(Horse.Style.values()[Misc.getRandom().nextInt(Horse.Style.values().length)]);
|
horse.setStyle(Horse.Style.values()[Misc.getRandom().nextInt(Horse.Style.values().length)]);
|
||||||
horse.setJumpStrength(Math.max(AdvancedConfig.getInstance().getMinHorseJumpStrength(), Math.min(Math.min(Misc.getRandom().nextDouble(), Misc.getRandom().nextDouble()) * 2, AdvancedConfig.getInstance().getMaxHorseJumpStrength())));
|
horse.setJumpStrength(Math.max(mcMMO.p.getAdvancedConfig().getMinHorseJumpStrength(), Math.min(Math.min(Misc.getRandom().nextDouble(), Misc.getRandom().nextDouble()) * 2, mcMMO.p.getAdvancedConfig().getMaxHorseJumpStrength())));
|
||||||
horse.setAdult();
|
horse.setAdult();
|
||||||
|
|
||||||
//TODO: setSpeed, once available
|
//TODO: setSpeed, once available
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.skills.taming;
|
package com.gmail.nossr50.skills.taming;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.subskills.taming.CallOfTheWildType;
|
import com.gmail.nossr50.datatypes.skills.subskills.taming.CallOfTheWildType;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
@ -19,7 +18,7 @@ public class TrackedTamingEntity extends BukkitRunnable {
|
|||||||
this.callOfTheWildType = callOfTheWildType;
|
this.callOfTheWildType = callOfTheWildType;
|
||||||
this.livingEntity = livingEntity;
|
this.livingEntity = livingEntity;
|
||||||
|
|
||||||
int tamingCOTWLength = Config.getInstance().getTamingCOTWLength(callOfTheWildType.getConfigEntityTypeEntry());
|
int tamingCOTWLength = mcMMO.p.getGeneralConfig().getTamingCOTWLength(callOfTheWildType.getConfigEntityTypeEntry());
|
||||||
|
|
||||||
if (tamingCOTWLength > 0) {
|
if (tamingCOTWLength > 0) {
|
||||||
int length = tamingCOTWLength * Misc.TICK_CONVERSION_FACTOR;
|
int length = tamingCOTWLength * Misc.TICK_CONVERSION_FACTOR;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.skills.unarmed;
|
package com.gmail.nossr50.skills.unarmed;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.mcMMO;
|
||||||
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 = mcMMO.p.getGeneralConfig().getUnarmedBlockCrackerSmoothbrickToCracked();
|
||||||
public static double berserkDamageModifier = 1.5;
|
public static double berserkDamageModifier = 1.5;
|
||||||
|
|
||||||
public static void handleItemPickup(Player player, EntityPickupItemEvent event) {
|
public static void handleItemPickup(Player player, EntityPickupItemEvent event) {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.gmail.nossr50.skills.unarmed;
|
package com.gmail.nossr50.skills.unarmed;
|
||||||
|
|
||||||
import com.gmail.nossr50.api.ItemSpawnReason;
|
import com.gmail.nossr50.api.ItemSpawnReason;
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
|
||||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
@ -113,7 +112,7 @@ public class UnarmedManager extends SkillManager {
|
|||||||
|
|
||||||
Item item = Misc.spawnItem(defender.getLocation(), defender.getInventory().getItemInMainHand(), ItemSpawnReason.UNARMED_DISARMED_ITEM);
|
Item item = Misc.spawnItem(defender.getLocation(), defender.getInventory().getItemInMainHand(), ItemSpawnReason.UNARMED_DISARMED_ITEM);
|
||||||
|
|
||||||
if (item != null && AdvancedConfig.getInstance().getDisarmProtected()) {
|
if (item != null && mcMMO.p.getAdvancedConfig().getDisarmProtected()) {
|
||||||
item.setMetadata(mcMMO.disarmedItemKey, UserManager.getPlayer(defender).getPlayerMetadata());
|
item.setMetadata(mcMMO.disarmedItemKey, UserManager.getPlayer(defender).getPlayerMetadata());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,8 +166,8 @@ public class UnarmedManager extends SkillManager {
|
|||||||
double finalBonus = bonus + 0.5 + (rank / 2);
|
double finalBonus = bonus + 0.5 + (rank / 2);
|
||||||
|
|
||||||
|
|
||||||
if(AdvancedConfig.getInstance().isSteelArmDamageCustom()) {
|
if(mcMMO.p.getAdvancedConfig().isSteelArmDamageCustom()) {
|
||||||
return AdvancedConfig.getInstance().getSteelArmOverride(RankUtils.getRank(getPlayer(), SubSkillType.UNARMED_STEEL_ARM_STYLE), finalBonus);
|
return mcMMO.p.getAdvancedConfig().getSteelArmOverride(RankUtils.getRank(getPlayer(), SubSkillType.UNARMED_STEEL_ARM_STYLE), finalBonus);
|
||||||
} else {
|
} else {
|
||||||
return finalBonus;
|
return finalBonus;
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
package com.gmail.nossr50.skills.woodcutting;
|
package com.gmail.nossr50.skills.woodcutting;
|
||||||
|
|
||||||
import com.gmail.nossr50.api.ItemSpawnReason;
|
import com.gmail.nossr50.api.ItemSpawnReason;
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
||||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||||
@ -54,7 +52,7 @@ public class WoodcuttingManager extends SkillManager {
|
|||||||
|
|
||||||
public WoodcuttingManager(McMMOPlayer mcMMOPlayer) {
|
public WoodcuttingManager(McMMOPlayer mcMMOPlayer) {
|
||||||
super(mcMMOPlayer, PrimarySkillType.WOODCUTTING);
|
super(mcMMOPlayer, PrimarySkillType.WOODCUTTING);
|
||||||
treeFellerThreshold = Config.getInstance().getTreeFellerThreshold();
|
treeFellerThreshold = mcMMO.p.getGeneralConfig().getTreeFellerThreshold();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canUseLeafBlower(ItemStack heldItem) {
|
public boolean canUseLeafBlower(ItemStack heldItem) {
|
||||||
@ -72,7 +70,7 @@ public class WoodcuttingManager extends SkillManager {
|
|||||||
return Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.WOODCUTTING_HARVEST_LUMBER)
|
return Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.WOODCUTTING_HARVEST_LUMBER)
|
||||||
&& RankUtils.hasReachedRank(1, getPlayer(), SubSkillType.WOODCUTTING_HARVEST_LUMBER)
|
&& RankUtils.hasReachedRank(1, getPlayer(), SubSkillType.WOODCUTTING_HARVEST_LUMBER)
|
||||||
&& RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkillType.WOODCUTTING_HARVEST_LUMBER, getPlayer())
|
&& RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkillType.WOODCUTTING_HARVEST_LUMBER, getPlayer())
|
||||||
&& Config.getInstance().getDoubleDropsEnabled(PrimarySkillType.WOODCUTTING, material);
|
&& mcMMO.p.getGeneralConfig().getDoubleDropsEnabled(PrimarySkillType.WOODCUTTING, material);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -217,7 +215,7 @@ public class WoodcuttingManager extends SkillManager {
|
|||||||
|
|
||||||
for (BlockState blockState : treeFellerBlocks) {
|
for (BlockState blockState : treeFellerBlocks) {
|
||||||
if (BlockUtils.hasWoodcuttingXP(blockState)) {
|
if (BlockUtils.hasWoodcuttingXP(blockState)) {
|
||||||
durabilityLoss += Config.getInstance().getAbilityToolDamage();
|
durabilityLoss += mcMMO.p.getGeneralConfig().getAbilityToolDamage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -307,7 +305,7 @@ public class WoodcuttingManager extends SkillManager {
|
|||||||
Misc.spawnItemsFromCollection(Misc.getBlockCenter(blockState), block.getDrops(), ItemSpawnReason.TREE_FELLER_DISPLACED_BLOCK);
|
Misc.spawnItemsFromCollection(Misc.getBlockCenter(blockState), block.getDrops(), ItemSpawnReason.TREE_FELLER_DISPLACED_BLOCK);
|
||||||
|
|
||||||
if(RankUtils.hasReachedRank(2, player, SubSkillType.WOODCUTTING_KNOCK_ON_WOOD)) {
|
if(RankUtils.hasReachedRank(2, player, SubSkillType.WOODCUTTING_KNOCK_ON_WOOD)) {
|
||||||
if(AdvancedConfig.getInstance().isKnockOnWoodXPOrbEnabled()) {
|
if(mcMMO.p.getAdvancedConfig().isKnockOnWoodXPOrbEnabled()) {
|
||||||
if(RandomChanceUtil.rollDice(10, 100)) {
|
if(RandomChanceUtil.rollDice(10, 100)) {
|
||||||
int randOrbCount = Math.max(1, Misc.getRandom().nextInt(100));
|
int randOrbCount = Math.max(1, Misc.getRandom().nextInt(100));
|
||||||
Misc.spawnExperienceOrb(blockState.getLocation(), randOrbCount);
|
Misc.spawnExperienceOrb(blockState.getLocation(), randOrbCount);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.util;
|
package com.gmail.nossr50.util;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.datatypes.meta.BonusDropMeta;
|
import com.gmail.nossr50.datatypes.meta.BonusDropMeta;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
@ -53,7 +52,7 @@ public final class BlockUtils {
|
|||||||
* @return true if the player succeeded in the check
|
* @return true if the player succeeded in the check
|
||||||
*/
|
*/
|
||||||
public static boolean checkDoubleDrops(Player player, BlockState blockState, PrimarySkillType skillType, SubSkillType subSkillType) {
|
public static boolean checkDoubleDrops(Player player, BlockState blockState, PrimarySkillType skillType, SubSkillType subSkillType) {
|
||||||
if (Config.getInstance().getDoubleDropsEnabled(skillType, blockState.getType()) && Permissions.isSubSkillEnabled(player, subSkillType)) {
|
if (mcMMO.p.getGeneralConfig().getDoubleDropsEnabled(skillType, blockState.getType()) && Permissions.isSubSkillEnabled(player, subSkillType)) {
|
||||||
return RandomChanceUtil.checkRandomChanceExecutionSuccess(new RandomChanceSkill(player, subSkillType, true));
|
return RandomChanceUtil.checkRandomChanceExecutionSuccess(new RandomChanceSkill(player, subSkillType, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,10 +67,10 @@ public final class BlockUtils {
|
|||||||
*/
|
*/
|
||||||
public static boolean shouldBeWatched(BlockState blockState) {
|
public static boolean shouldBeWatched(BlockState blockState) {
|
||||||
return affectedByGigaDrillBreaker(blockState) || affectedByGreenTerra(blockState) || affectedBySuperBreaker(blockState) || hasWoodcuttingXP(blockState)
|
return affectedByGigaDrillBreaker(blockState) || affectedByGreenTerra(blockState) || affectedBySuperBreaker(blockState) || hasWoodcuttingXP(blockState)
|
||||||
|| Config.getInstance().getDoubleDropsEnabled(PrimarySkillType.MINING, blockState.getType())
|
|| mcMMO.p.getGeneralConfig().getDoubleDropsEnabled(PrimarySkillType.MINING, blockState.getType())
|
||||||
|| Config.getInstance().getDoubleDropsEnabled(PrimarySkillType.EXCAVATION, blockState.getType())
|
|| mcMMO.p.getGeneralConfig().getDoubleDropsEnabled(PrimarySkillType.EXCAVATION, blockState.getType())
|
||||||
|| Config.getInstance().getDoubleDropsEnabled(PrimarySkillType.WOODCUTTING, blockState.getType())
|
|| mcMMO.p.getGeneralConfig().getDoubleDropsEnabled(PrimarySkillType.WOODCUTTING, blockState.getType())
|
||||||
|| Config.getInstance().getDoubleDropsEnabled(PrimarySkillType.SMELTING, blockState.getType());
|
|| mcMMO.p.getGeneralConfig().getDoubleDropsEnabled(PrimarySkillType.SMELTING, blockState.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.util;
|
package com.gmail.nossr50.util;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
@ -37,7 +36,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 (!mcMMO.p.getGeneralConfig().getChimaeraEnabled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,13 +63,13 @@ public final class ChimaeraWing {
|
|||||||
|
|
||||||
int amount = inHand.getAmount();
|
int amount = inHand.getAmount();
|
||||||
|
|
||||||
if (amount < Config.getInstance().getChimaeraUseCost()) {
|
if (amount < mcMMO.p.getGeneralConfig().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(mcMMO.p.getGeneralConfig().getChimaeraUseCost() - amount), "Item.ChimaeraWing.Name");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
long lastTeleport = mcMMOPlayer.getChimeraWingLastUse();
|
long lastTeleport = mcMMOPlayer.getChimeraWingLastUse();
|
||||||
int cooldown = Config.getInstance().getChimaeraCooldown();
|
int cooldown = mcMMO.p.getGeneralConfig().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);
|
||||||
@ -82,7 +81,7 @@ public final class ChimaeraWing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
long recentlyHurt = mcMMOPlayer.getRecentlyHurt();
|
long recentlyHurt = mcMMOPlayer.getRecentlyHurt();
|
||||||
int hurtCooldown = Config.getInstance().getChimaeraRecentlyHurtCooldown();
|
int hurtCooldown = mcMMO.p.getGeneralConfig().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);
|
||||||
@ -95,9 +94,9 @@ public final class ChimaeraWing {
|
|||||||
|
|
||||||
location = player.getLocation();
|
location = player.getLocation();
|
||||||
|
|
||||||
if (Config.getInstance().getChimaeraPreventUseUnderground()) {
|
if (mcMMO.p.getGeneralConfig().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 - mcMMO.p.getGeneralConfig().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));
|
||||||
@ -109,7 +108,7 @@ public final class ChimaeraWing {
|
|||||||
|
|
||||||
mcMMOPlayer.actualizeTeleportCommenceLocation(player);
|
mcMMOPlayer.actualizeTeleportCommenceLocation(player);
|
||||||
|
|
||||||
long warmup = Config.getInstance().getChimaeraWarmup();
|
long warmup = mcMMO.p.getGeneralConfig().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));
|
||||||
@ -123,7 +122,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 (mcMMO.p.getGeneralConfig().getChimaeraUseBedSpawn() && player.getBedSpawnLocation() != null) {
|
||||||
player.teleport(player.getBedSpawnLocation());
|
player.teleport(player.getBedSpawnLocation());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -136,12 +135,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() - mcMMO.p.getGeneralConfig().getChimaeraUseCost())));
|
||||||
player.updateInventory();
|
player.updateInventory();
|
||||||
mcMMOPlayer.actualizeChimeraWingLastUse();
|
mcMMOPlayer.actualizeChimeraWingLastUse();
|
||||||
mcMMOPlayer.setTeleportCommenceLocation(null);
|
mcMMOPlayer.setTeleportCommenceLocation(null);
|
||||||
|
|
||||||
if (Config.getInstance().getChimaeraSoundEnabled()) {
|
if (mcMMO.p.getGeneralConfig().getChimaeraSoundEnabled()) {
|
||||||
SoundManager.sendSound(player, location, SoundType.CHIMAERA_WING);
|
SoundManager.sendSound(player, location, SoundType.CHIMAERA_WING);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,7 +148,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(mcMMO.p.getGeneralConfig().getChimaeraItem(), amount);
|
||||||
|
|
||||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||||
//noinspection ConstantConditions
|
//noinspection ConstantConditions
|
||||||
@ -165,8 +164,8 @@ public final class ChimaeraWing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static ShapelessRecipe getChimaeraWingRecipe() {
|
public static ShapelessRecipe getChimaeraWingRecipe() {
|
||||||
Material ingredient = Config.getInstance().getChimaeraItem();
|
Material ingredient = mcMMO.p.getGeneralConfig().getChimaeraItem();
|
||||||
int amount = Config.getInstance().getChimaeraRecipeCost();
|
int amount = mcMMO.p.getGeneralConfig().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,5 @@
|
|||||||
package com.gmail.nossr50.util;
|
package com.gmail.nossr50.util;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
||||||
import com.gmail.nossr50.datatypes.experience.XPGainSource;
|
import com.gmail.nossr50.datatypes.experience.XPGainSource;
|
||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
@ -9,6 +8,7 @@ import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
|||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
||||||
|
import com.gmail.nossr50.datatypes.skills.interfaces.Skill;
|
||||||
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
|
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
|
||||||
import com.gmail.nossr50.events.experience.McMMOPlayerLevelChangeEvent;
|
import com.gmail.nossr50.events.experience.McMMOPlayerLevelChangeEvent;
|
||||||
import com.gmail.nossr50.events.experience.McMMOPlayerLevelDownEvent;
|
import com.gmail.nossr50.events.experience.McMMOPlayerLevelDownEvent;
|
||||||
@ -409,7 +409,7 @@ public final class EventUtils {
|
|||||||
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
|
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
|
||||||
String skillName = primarySkillType.toString();
|
String skillName = primarySkillType.toString();
|
||||||
int playerSkillLevel = playerProfile.getSkillLevel(primarySkillType);
|
int playerSkillLevel = playerProfile.getSkillLevel(primarySkillType);
|
||||||
int threshold = Config.getInstance().getHardcoreDeathStatPenaltyLevelThreshold();
|
int threshold = mcMMO.p.getGeneralConfig().getHardcoreDeathStatPenaltyLevelThreshold();
|
||||||
if(playerSkillLevel > threshold) {
|
if(playerSkillLevel > threshold) {
|
||||||
playerProfile.modifySkill(primarySkillType, Math.max(threshold, playerSkillLevel - levelChanged.get(skillName)));
|
playerProfile.modifySkill(primarySkillType, Math.max(threshold, playerSkillLevel - levelChanged.get(skillName)));
|
||||||
playerProfile.removeXp(primarySkillType, experienceChanged.get(skillName));
|
playerProfile.removeXp(primarySkillType, experienceChanged.get(skillName));
|
||||||
@ -479,7 +479,7 @@ public final class EventUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static McMMOPlayerAbilityDeactivateEvent callAbilityDeactivateEvent(Player player, SuperAbilityType ability) {
|
public static McMMOPlayerAbilityDeactivateEvent callAbilityDeactivateEvent(Player player, SuperAbilityType ability) {
|
||||||
McMMOPlayerAbilityDeactivateEvent event = new McMMOPlayerAbilityDeactivateEvent(player, PrimarySkillType.byAbility(ability));
|
McMMOPlayerAbilityDeactivateEvent event = new McMMOPlayerAbilityDeactivateEvent(player, Skill.byAbility(ability));
|
||||||
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
return event;
|
return event;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package com.gmail.nossr50.util;
|
package com.gmail.nossr50.util;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.player.NotificationManager;
|
import com.gmail.nossr50.util.player.NotificationManager;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import com.gmail.nossr50.worldguard.WorldGuardManager;
|
import com.gmail.nossr50.worldguard.WorldGuardManager;
|
||||||
@ -22,8 +22,8 @@ public final class HardcoreManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
double statLossPercentage = Config.getInstance().getHardcoreDeathStatPenaltyPercentage();
|
double statLossPercentage = mcMMO.p.getGeneralConfig().getHardcoreDeathStatPenaltyPercentage();
|
||||||
int levelThreshold = Config.getInstance().getHardcoreDeathStatPenaltyLevelThreshold();
|
int levelThreshold = mcMMO.p.getGeneralConfig().getHardcoreDeathStatPenaltyLevelThreshold();
|
||||||
|
|
||||||
if(UserManager.getPlayer(player) == null)
|
if(UserManager.getPlayer(player) == null)
|
||||||
return;
|
return;
|
||||||
@ -73,8 +73,8 @@ public final class HardcoreManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
double vampirismStatLeechPercentage = Config.getInstance().getHardcoreVampirismStatLeechPercentage();
|
double vampirismStatLeechPercentage = mcMMO.p.getGeneralConfig().getHardcoreVampirismStatLeechPercentage();
|
||||||
int levelThreshold = Config.getInstance().getHardcoreVampirismLevelThreshold();
|
int levelThreshold = mcMMO.p.getGeneralConfig().getHardcoreVampirismLevelThreshold();
|
||||||
|
|
||||||
if(UserManager.getPlayer(killer) == null || UserManager.getPlayer(victim) == null)
|
if(UserManager.getPlayer(killer) == null || UserManager.getPlayer(victim) == null)
|
||||||
return;
|
return;
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package com.gmail.nossr50.util;
|
package com.gmail.nossr50.util;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.config.party.ItemWeightConfig;
|
import com.gmail.nossr50.config.party.ItemWeightConfig;
|
||||||
import com.gmail.nossr50.datatypes.treasure.EnchantmentWrapper;
|
import com.gmail.nossr50.datatypes.treasure.EnchantmentWrapper;
|
||||||
@ -186,7 +184,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 (mcMMO.p.getGeneralConfig().getUnarmedItemsAsUnarmed()) {
|
||||||
return !isMinecraftTool(item);
|
return !isMinecraftTool(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -622,7 +620,7 @@ public final class ItemUtils {
|
|||||||
if(itemMeta == null)
|
if(itemMeta == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
itemMeta.addEnchant(Enchantment.DIG_SPEED, existingEnchantLevel + AdvancedConfig.getInstance().getEnchantBuff(), true);
|
itemMeta.addEnchant(Enchantment.DIG_SPEED, existingEnchantLevel + mcMMO.p.getAdvancedConfig().getEnchantBuff(), true);
|
||||||
itemStack.setItemMeta(itemMeta);
|
itemStack.setItemMeta(itemMeta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.util;
|
package com.gmail.nossr50.util;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.datatypes.MobHealthbarType;
|
import com.gmail.nossr50.datatypes.MobHealthbarType;
|
||||||
import com.gmail.nossr50.datatypes.meta.OldName;
|
import com.gmail.nossr50.datatypes.meta.OldName;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
@ -36,7 +35,7 @@ public final class MobHealthbarUtils {
|
|||||||
* @param damage damage done by the attack triggering this
|
* @param damage damage done by the attack triggering this
|
||||||
*/
|
*/
|
||||||
public static void handleMobHealthbars(LivingEntity target, double damage, mcMMO plugin) {
|
public static void handleMobHealthbars(LivingEntity target, double damage, mcMMO plugin) {
|
||||||
if (mcMMO.isHealthBarPluginEnabled() || !Config.getInstance().getMobHealthbarEnabled()) {
|
if (mcMMO.isHealthBarPluginEnabled() || !mcMMO.p.getGeneralConfig().getMobHealthbarEnabled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,12 +62,12 @@ public final class MobHealthbarUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean oldNameVisible = target.isCustomNameVisible();
|
boolean oldNameVisible = target.isCustomNameVisible();
|
||||||
String newName = createHealthDisplay(Config.getInstance().getMobHealthbarDefault(), target, damage);
|
String newName = createHealthDisplay(mcMMO.p.getGeneralConfig().getMobHealthbarDefault(), target, damage);
|
||||||
|
|
||||||
target.setCustomName(newName);
|
target.setCustomName(newName);
|
||||||
target.setCustomNameVisible(true);
|
target.setCustomNameVisible(true);
|
||||||
|
|
||||||
int displayTime = Config.getInstance().getMobHealthbarTime();
|
int displayTime = mcMMO.p.getGeneralConfig().getMobHealthbarTime();
|
||||||
|
|
||||||
if (displayTime != -1) {
|
if (displayTime != -1) {
|
||||||
boolean updateName = !ChatColor.stripColor(oldName).equalsIgnoreCase(ChatColor.stripColor(newName));
|
boolean updateName = !ChatColor.stripColor(oldName).equalsIgnoreCase(ChatColor.stripColor(newName));
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.util;
|
package com.gmail.nossr50.util;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.config.mods.CustomArmorConfig;
|
import com.gmail.nossr50.config.mods.CustomArmorConfig;
|
||||||
import com.gmail.nossr50.config.mods.CustomBlockConfig;
|
import com.gmail.nossr50.config.mods.CustomBlockConfig;
|
||||||
import com.gmail.nossr50.config.mods.CustomEntityConfig;
|
import com.gmail.nossr50.config.mods.CustomEntityConfig;
|
||||||
@ -89,67 +88,67 @@ public class ModManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCustomBoots(Material material) {
|
public boolean isCustomBoots(Material material) {
|
||||||
return Config.getInstance().getArmorModsEnabled() && customBoots.contains(material);
|
return mcMMO.p.getGeneralConfig().getArmorModsEnabled() && customBoots.contains(material);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCustomChestplate(Material material) {
|
public boolean isCustomChestplate(Material material) {
|
||||||
return Config.getInstance().getArmorModsEnabled() && customChestplates.contains(material);
|
return mcMMO.p.getGeneralConfig().getArmorModsEnabled() && customChestplates.contains(material);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCustomHelmet(Material material) {
|
public boolean isCustomHelmet(Material material) {
|
||||||
return Config.getInstance().getArmorModsEnabled() && customHelmets.contains(material);
|
return mcMMO.p.getGeneralConfig().getArmorModsEnabled() && customHelmets.contains(material);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCustomLeggings(Material material) {
|
public boolean isCustomLeggings(Material material) {
|
||||||
return Config.getInstance().getArmorModsEnabled() && customLeggings.contains(material);
|
return mcMMO.p.getGeneralConfig().getArmorModsEnabled() && customLeggings.contains(material);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCustomAxe(Material material) {
|
public boolean isCustomAxe(Material material) {
|
||||||
return Config.getInstance().getToolModsEnabled() && customAxes.contains(material);
|
return mcMMO.p.getGeneralConfig().getToolModsEnabled() && customAxes.contains(material);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCustomBow(Material material) {
|
public boolean isCustomBow(Material material) {
|
||||||
return Config.getInstance().getToolModsEnabled() && customBows.contains(material);
|
return mcMMO.p.getGeneralConfig().getToolModsEnabled() && customBows.contains(material);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCustomHoe(Material material) {
|
public boolean isCustomHoe(Material material) {
|
||||||
return Config.getInstance().getToolModsEnabled() && customHoes.contains(material);
|
return mcMMO.p.getGeneralConfig().getToolModsEnabled() && customHoes.contains(material);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCustomPickaxe(Material material) {
|
public boolean isCustomPickaxe(Material material) {
|
||||||
return Config.getInstance().getToolModsEnabled() && customPickaxes.contains(material);
|
return mcMMO.p.getGeneralConfig().getToolModsEnabled() && customPickaxes.contains(material);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCustomShovel(Material material) {
|
public boolean isCustomShovel(Material material) {
|
||||||
return Config.getInstance().getToolModsEnabled() && customShovels.contains(material);
|
return mcMMO.p.getGeneralConfig().getToolModsEnabled() && customShovels.contains(material);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCustomSword(Material material) {
|
public boolean isCustomSword(Material material) {
|
||||||
return Config.getInstance().getToolModsEnabled() && customSwords.contains(material);
|
return mcMMO.p.getGeneralConfig().getToolModsEnabled() && customSwords.contains(material);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCustomOre(Material data) {
|
public boolean isCustomOre(Material data) {
|
||||||
return Config.getInstance().getBlockModsEnabled() && customOres.contains(data);
|
return mcMMO.p.getGeneralConfig().getBlockModsEnabled() && customOres.contains(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCustomLog(BlockState state) {
|
public boolean isCustomLog(BlockState state) {
|
||||||
return Config.getInstance().getBlockModsEnabled() && customLogs.contains(state.getType());
|
return mcMMO.p.getGeneralConfig().getBlockModsEnabled() && customLogs.contains(state.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCustomAbilityBlock(BlockState state) {
|
public boolean isCustomAbilityBlock(BlockState state) {
|
||||||
return Config.getInstance().getBlockModsEnabled() && customAbilityBlocks.contains(state.getType());
|
return mcMMO.p.getGeneralConfig().getBlockModsEnabled() && customAbilityBlocks.contains(state.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCustomExcavationBlock(BlockState state) {
|
public boolean isCustomExcavationBlock(BlockState state) {
|
||||||
return Config.getInstance().getBlockModsEnabled() && customExcavationBlocks.contains(state.getType());
|
return mcMMO.p.getGeneralConfig().getBlockModsEnabled() && customExcavationBlocks.contains(state.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCustomHerbalismBlock(BlockState state) {
|
public boolean isCustomHerbalismBlock(BlockState state) {
|
||||||
return Config.getInstance().getBlockModsEnabled() && customHerbalismBlocks.contains(state.getType());
|
return mcMMO.p.getGeneralConfig().getBlockModsEnabled() && customHerbalismBlocks.contains(state.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCustomMiningBlock(BlockState state) {
|
public boolean isCustomMiningBlock(BlockState state) {
|
||||||
return Config.getInstance().getBlockModsEnabled() && customMiningBlocks.contains(state.getType());
|
return mcMMO.p.getGeneralConfig().getBlockModsEnabled() && customMiningBlocks.contains(state.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
public CustomBlock getBlock(BlockState state) {
|
public CustomBlock getBlock(BlockState state) {
|
||||||
@ -167,7 +166,7 @@ public class ModManager {
|
|||||||
* @return true if the item is a custom tool, false otherwise
|
* @return true if the item is a custom tool, false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean isCustomTool(ItemStack item) {
|
public boolean isCustomTool(ItemStack item) {
|
||||||
return Config.getInstance().getToolModsEnabled() && item != null && customToolMap.containsKey(item.getType());
|
return mcMMO.p.getGeneralConfig().getToolModsEnabled() && item != null && customToolMap.containsKey(item.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -185,7 +184,7 @@ public class ModManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCustomEntity(Entity entity) {
|
public boolean isCustomEntity(Entity entity) {
|
||||||
if (!Config.getInstance().getEntityModsEnabled()) {
|
if (!mcMMO.p.getGeneralConfig().getEntityModsEnabled()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,7 +226,7 @@ public class ModManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void addCustomEntity(Entity entity) {
|
public void addCustomEntity(Entity entity) {
|
||||||
if (!Config.getInstance().getEntityModsEnabled()) {
|
if (!mcMMO.p.getGeneralConfig().getEntityModsEnabled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.util;
|
package com.gmail.nossr50.util;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
@ -70,11 +69,11 @@ public final class Motd {
|
|||||||
player.sendMessage(LocaleLoader.getString("MOTD.Hardcore.Enabled", statLossInfo + seperator + vampirismInfo));
|
player.sendMessage(LocaleLoader.getString("MOTD.Hardcore.Enabled", statLossInfo + seperator + vampirismInfo));
|
||||||
|
|
||||||
if (deathStatLossEnabled) {
|
if (deathStatLossEnabled) {
|
||||||
player.sendMessage(LocaleLoader.getString("MOTD.Hardcore.DeathStatLoss.Stats", Config.getInstance().getHardcoreDeathStatPenaltyPercentage()));
|
player.sendMessage(LocaleLoader.getString("MOTD.Hardcore.DeathStatLoss.Stats", mcMMO.p.getGeneralConfig().getHardcoreDeathStatPenaltyPercentage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vampirismEnabled) {
|
if (vampirismEnabled) {
|
||||||
player.sendMessage(LocaleLoader.getString("MOTD.Hardcore.Vampirism.Stats", Config.getInstance().getHardcoreVampirismStatLeechPercentage()));
|
player.sendMessage(LocaleLoader.getString("MOTD.Hardcore.Vampirism.Stats", mcMMO.p.getGeneralConfig().getHardcoreVampirismStatLeechPercentage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user