Merge 2.1.44

This commit is contained in:
nossr50 2019-04-15 10:40:57 -07:00
commit 7e039321e1
67 changed files with 655 additions and 65 deletions

View File

@ -162,6 +162,30 @@ Version 2.2.0
Added API method to check if player parties are size capped Added API method to check if player parties are size capped
Added API method to grab the level cap of a skill by its PrimarySkillType ENUM definition Added API method to grab the level cap of a skill by its PrimarySkillType ENUM definition
Added API method to check if a skill was being level capped Added API method to check if a skill was being level capped
Version 2.1.44
Fixed a NPE with Alchemy brewing
Version 2.1.43
Fixed a bug that would result in players being told they they failed to salvage enchantments when in reality they succeeded.
Version 2.1.42
Fixed McMMOPlayerNotFoundException being thrown instead of null
(API) UserManager.getPlayer() returns null again (oopsie)
Added new perk permission node `mcmmo.perks.bypass.salvageenchant` - guarantees full enchantment return for Salvage
Added alternative permission node `mcmmo.perks.bypass.repairenchant` - guarantees full enchantment return for Repair
Added new wildcard perk `mcmmo.perks.bypass.*` and `mcmmo.perks.bypass.all` (either of these will grant all new mcmmo.perks.bypass perk permissions)
NOTE: Sorry about that, when trying to improve Bungee Cord compatibility I made a big oopsie!
NOTE: Repair's new perk permission works in the exact same way as mcmmo.bypass.arcanebypass, bypass perk permissions will all eventually be moved to `mcmmo.perks.bypass`
NOTE: Expect perk permissions to all be moved to `mcmmo.perks.X` in the near future
Version 2.1.41
Fixed NullPointerException errors when trying to grab PlayerProfiles for players who have not loaded
Added new locale string Profile.PendingLoad
Added new locale string Commands.Database.CooldownMS
Fixed a display error preventing the remaining time on /mcrank from being shown if it was on cooldown
Version 2.1.40 Version 2.1.40
(API) mcMMO will now return null in all cases for UserManager.getPlayerProfile() if they have not been loaded yet (API) mcMMO will now return null in all cases for UserManager.getPlayerProfile() if they have not been loaded yet
(API) Roll stores exploit data in AcrobaticsManager now (API) Roll stores exploit data in AcrobaticsManager now

View File

@ -5,6 +5,7 @@
I'm working on a brand new website for mcMMO I'm working on a brand new website for mcMMO
You can check it out here http://www.mcmmo.org You can check it out here http://www.mcmmo.org
Spigot Resource: https://www.spigotmc.org/resources/official-mcmmo-original-author-returns.64348/
I plan to post links to our new wiki (its still under development), downloads, and dev blogs there. I plan to post links to our new wiki (its still under development), downloads, and dev blogs there.
@ -16,26 +17,31 @@ Currently, you can obtain our builds via the Spigot resource page: http://spigot
The goal of mcMMO is to take core Minecraft game mechanics and expand them into add an extensive and quality RPG experience. Everything in mcMMO has been carefully thought out and is constantly being improved upon. Currently, mcMMO adds fourteen unique skills to train and level in. Each of these skills is highly customizable through our configuration files, allowing server admins to tweak mcMMO to best suit the needs of his or her server. Know that the mcMMO team is dedicated to providing an ever-evolving experience, and that we carefully read all feedback and bug reports in order to evaluate and balance the mechanics of mcMMO in every update. The goal of mcMMO is to take core Minecraft game mechanics and expand them into add an extensive and quality RPG experience. Everything in mcMMO has been carefully thought out and is constantly being improved upon. Currently, mcMMO adds fourteen unique skills to train and level in. Each of these skills is highly customizable through our configuration files, allowing server admins to tweak mcMMO to best suit the needs of his or her server. Know that the mcMMO team is dedicated to providing an ever-evolving experience, and that we carefully read all feedback and bug reports in order to evaluate and balance the mechanics of mcMMO in every update.
## About the Team ## About the Team
mcMMO is currently developed by a team of individuals from all over the world. In December 2018 nossr50 returned as project lead for mcMMO once again to develop and improve mcMMO.
The mcMMO team currently has two members, nossr50 (lead) and t00thpick1 (classic maintainer).
mcMMO is currently developed almost entirely by nossr50, many thanks go out to the many developers who have worked on the project over the years.
### Project Lead & Founder ### Project Lead & Founder
[![nossr50](http://www.gravatar.com/avatar/f2ee41eedfd645fb4a3a2c8f6cb1b18c.png)](https://github.com/nossr50) [![nossr50](http://www.gravatar.com/avatar/f2ee41eedfd645fb4a3a2c8f6cb1b18c.png)](https://github.com/nossr50)
### Former Lead Other mcMMO Projects
### Classic Maintainer
[![t00thpick1](http://www.gravatar.com/avatar/ee23c7794a0c40120c3474287c7bce06.png)](https://github.com/t00thpick1)
## Former Team Members
### Former Lead & Awesome guy
[![gmcferrin](http://www.gravatar.com/avatar/b64c52daf25d206b27650788b5813b7b.png)](https://github.com/gmcferrin) [![gmcferrin](http://www.gravatar.com/avatar/b64c52daf25d206b27650788b5813b7b.png)](https://github.com/gmcferrin)
### Developers ### Former team members
[![bm01](http://www.gravatar.com/avatar/ec8146f5358177f12e9a252271bbc391.png)](https://github.com/bm01) [![bm01](http://www.gravatar.com/avatar/ec8146f5358177f12e9a252271bbc391.png)](https://github.com/bm01)
[![Glitchfinder](http://www.gravatar.com/avatar/5aa4cce22f72ae9c002ecec30f061d00.png)](https://github.com/Glitchfinder) [![Glitchfinder](http://www.gravatar.com/avatar/5aa4cce22f72ae9c002ecec30f061d00.png)](https://github.com/Glitchfinder)
[![NuclearW](http://www.gravatar.com/avatar/90926bdcf1c8a75918df5ea5fa801ce6.png)](https://github.com/NuclearW) [![NuclearW](http://www.gravatar.com/avatar/90926bdcf1c8a75918df5ea5fa801ce6.png)](https://github.com/NuclearW)
[![shatteredbeam](http://www.gravatar.com/avatar/cad3b5d7d39cf5387afb87f494389610.png)](https://github.com/shatteredbeam) [![shatteredbeam](http://www.gravatar.com/avatar/cad3b5d7d39cf5387afb87f494389610.png)](https://github.com/shatteredbeam)
[![TfT_02](http://www.gravatar.com/avatar/b8914f9970e1f6ffd5281ce4770e20a7.png)](https://github.com/TfT-02) [![TfT_02](http://www.gravatar.com/avatar/b8914f9970e1f6ffd5281ce4770e20a7.png)](https://github.com/TfT-02)
[![t00thpick1](http://www.gravatar.com/avatar/ee23c7794a0c40120c3474287c7bce06.png)](https://github.com/t00thpick1)
[![riking](https://1.gravatar.com/avatar/aca9f37e569ac3a63929920035a91ba4.png)](https://github.com/riking) [![riking](https://1.gravatar.com/avatar/aca9f37e569ac3a63929920035a91ba4.png)](https://github.com/riking)
[![TheYeti](https://i.imgur.com/tzFrxdo.png)](https://github.com/TheYeti)
### Special thanks
[![EasyMFnE](https://www.gravatar.com/avatar/99c9a1fa3bbf957791ceac7b45daadb0.png)](https://github.com/EasyMFnE)
Added the Alchemy skill
## Compiling ## Compiling
@ -46,5 +52,8 @@ The typical command used to build mcMMO is: `mvn clean package install`
Required Libraries: Required Libraries:
* Bukkit * Bukkit
* JUnit * JUnit
* WorldGuard 7
* bStats Bukkit
http://spigot.mcmmo.org for more up to date information. http://spigot.mcmmo.org for more up to date information.
https://www.spigotmc.org/resources/official-mcmmo-original-author-returns.64348/

View File

@ -1181,6 +1181,13 @@ public final class ExperienceAPI {
return formulaType; return formulaType;
} }
/**
* @deprecated Use UserManager::getPlayer(Player player) instead
* @param player target player
* @return McMMOPlayer for that player if the profile is loaded, otherwise null
* @throws McMMOPlayerNotFoundException
*/
@Deprecated
private static McMMOPlayer getPlayer(Player player) throws McMMOPlayerNotFoundException { private static McMMOPlayer getPlayer(Player player) throws McMMOPlayerNotFoundException {
if (!UserManager.hasPlayerDataKey(player)) { if (!UserManager.hasPlayerDataKey(player)) {
throw new McMMOPlayerNotFoundException(player); throw new McMMOPlayerNotFoundException(player);

View File

@ -40,6 +40,9 @@ public final class PartyAPI {
* @return true if the player is in a party, false otherwise * @return true if the player is in a party, false otherwise
*/ */
public static boolean inParty(Player player) { public static boolean inParty(Player player) {
if(UserManager.getPlayer(player) == null)
return false;
return UserManager.getPlayer(player).inParty(); return UserManager.getPlayer(player).inParty();
} }
@ -78,6 +81,10 @@ public final class PartyAPI {
*/ */
@Deprecated @Deprecated
public static void addToParty(Player player, String partyName) { public static void addToParty(Player player, String partyName) {
//Check if player profile is loaded
if(UserManager.getPlayer(player) == null)
return;
Party party = PartyManager.getParty(partyName); Party party = PartyManager.getParty(partyName);
if (party == null) { if (party == null) {
@ -120,7 +127,12 @@ public final class PartyAPI {
* @param partyName The party to add the player to * @param partyName The party to add the player to
* @param bypassLimit if true bypasses party size limits * @param bypassLimit if true bypasses party size limits
*/ */
//TODO: bypasslimit not used?
public static void addToParty(Player player, String partyName, boolean bypassLimit) { public static void addToParty(Player player, String partyName, boolean bypassLimit) {
//Check if player profile is loaded
if(UserManager.getPlayer(player) == null)
return;
Party party = PartyManager.getParty(partyName); Party party = PartyManager.getParty(partyName);
if (party == null) { if (party == null) {
@ -138,6 +150,10 @@ public final class PartyAPI {
* @param player The player to remove * @param player The player to remove
*/ */
public static void removeFromParty(Player player) { public static void removeFromParty(Player player) {
//Check if player profile is loaded
if(UserManager.getPlayer(player) == null)
return;
PartyManager.removeFromParty(UserManager.getPlayer(player)); PartyManager.removeFromParty(UserManager.getPlayer(player));
} }

View File

@ -6,6 +6,6 @@ public class McMMOPlayerNotFoundException extends RuntimeException {
private static final long serialVersionUID = 761917904993202836L; private static final long serialVersionUID = 761917904993202836L;
public McMMOPlayerNotFoundException(Player player) { public McMMOPlayerNotFoundException(Player player) {
super("McMMOPlayer object was not found for: " + player.getName() + " " + player.getUniqueId()); super("McMMOPlayer object was not found for [NOTE: This can mean the profile is not loaded yet!] : " + player.getName() + " " + player.getUniqueId());
} }
} }

View File

@ -18,6 +18,10 @@ public class McnotifyCommand implements TabExecutor {
case 0: case 0:
McMMOPlayer mcMMOPlayer = UserManager.getPlayer((Player) sender); McMMOPlayer mcMMOPlayer = UserManager.getPlayer((Player) sender);
//Not Loaded yet
if(mcMMOPlayer == null)
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
sender.sendMessage(LocaleLoader.getString("Commands.Notifications." + (mcMMOPlayer.useChatNotifications() ? "Off" : "On"))); sender.sendMessage(LocaleLoader.getString("Commands.Notifications." + (mcMMOPlayer.useChatNotifications() ? "Off" : "On")));
mcMMOPlayer.toggleChatNotifications(); mcMMOPlayer.toggleChatNotifications();
return true; return true;

View File

@ -21,6 +21,10 @@ public class PartyChatCommand extends ChatCommand {
String message; String message;
if (sender instanceof Player) { if (sender instanceof Player) {
//Check if player profile is loaded
if(UserManager.getPlayer((Player) sender) == null)
return;
party = UserManager.getPlayer((Player) sender).getParty(); party = UserManager.getPlayer((Player) sender).getParty();
if (party == null) { if (party == null) {

View File

@ -24,6 +24,10 @@ public class AddxpCommand extends ExperienceCommand {
@Override @Override
protected void handleCommand(Player player, PlayerProfile profile, PrimarySkillType skill, int value) { protected void handleCommand(Player player, PlayerProfile profile, PrimarySkillType skill, int value) {
if (player != null) { if (player != null) {
//Check if player profile is loaded
if(UserManager.getPlayer(player) == null)
return;
UserManager.getPlayer(player).applyXpGain(skill, value, XPGainReason.COMMAND, XPGainSource.COMMAND); UserManager.getPlayer(player).applyXpGain(skill, value, XPGainReason.COMMAND, XPGainSource.COMMAND);
} }
else { else {

View File

@ -51,6 +51,14 @@ public abstract class ExperienceCommand implements TabExecutor {
return true; return true;
} }
//Profile not loaded
if(UserManager.getPlayer(sender.getName()) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
editValues((Player) sender, UserManager.getPlayer(sender.getName()).getProfile(), skill, Integer.parseInt(args[1])); editValues((Player) sender, UserManager.getPlayer(sender.getName()).getProfile(), skill, Integer.parseInt(args[1]));
return true; return true;

View File

@ -15,8 +15,17 @@ public class PartyAcceptCommand implements CommandExecutor {
switch (args.length) { switch (args.length) {
case 1: case 1:
Player player = (Player) sender; Player player = (Player) sender;
//Check if player profile is loaded
if(UserManager.getPlayer(player) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if (!mcMMOPlayer.hasPartyInvite()) { if (!mcMMOPlayer.hasPartyInvite()) {
sender.sendMessage(LocaleLoader.getString("mcMMO.NoInvites")); sender.sendMessage(LocaleLoader.getString("mcMMO.NoInvites"));
return true; return true;

View File

@ -17,6 +17,13 @@ public class PartyChangeOwnerCommand implements CommandExecutor {
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) { switch (args.length) {
case 2: case 2:
//Check if player profile is loaded
if(UserManager.getPlayer((Player) sender) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
Party playerParty = UserManager.getPlayer((Player) sender).getParty(); Party playerParty = UserManager.getPlayer((Player) sender).getParty();
String targetName = CommandUtils.getMatchedPlayerName(args[1]); String targetName = CommandUtils.getMatchedPlayerName(args[1]);
OfflinePlayer target = mcMMO.p.getServer().getOfflinePlayer(targetName); OfflinePlayer target = mcMMO.p.getServer().getOfflinePlayer(targetName);

View File

@ -11,6 +11,12 @@ import org.bukkit.entity.Player;
public class PartyChangePasswordCommand implements CommandExecutor { public class PartyChangePasswordCommand implements CommandExecutor {
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(UserManager.getPlayer((Player) sender) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
Party party = UserManager.getPlayer((Player) sender).getParty(); Party party = UserManager.getPlayer((Player) sender).getParty();
switch (args.length) { switch (args.length) {

View File

@ -79,6 +79,12 @@ public class PartyCommand implements TabExecutor {
return true; return true;
} }
if(UserManager.getPlayer(player) == null)
{
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if (args.length < 1) { if (args.length < 1) {
@ -202,6 +208,14 @@ public class PartyCommand implements TabExecutor {
if (matches.size() == 0) { if (matches.size() == 0) {
Player player = (Player) sender; Player player = (Player) sender;
//Not Loaded
if(UserManager.getPlayer(player) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return ImmutableList.of();
}
Party party = UserManager.getPlayer(player).getParty(); Party party = UserManager.getPlayer(player).getParty();
playerNames = party.getOnlinePlayerNames(player); playerNames = party.getOnlinePlayerNames(player);

View File

@ -18,6 +18,12 @@ public class PartyCreateCommand implements CommandExecutor {
Player player = (Player) sender; Player player = (Player) sender;
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if(UserManager.getPlayer(player) == null)
{
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
// Check to see if the party exists, and if it does cancel creating a new party // Check to see if the party exists, and if it does cancel creating a new party
if (PartyManager.checkPartyExistence(player, args[1])) { if (PartyManager.checkPartyExistence(player, args[1])) {
return true; return true;

View File

@ -15,6 +15,12 @@ public class PartyDisbandCommand implements CommandExecutor {
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) { switch (args.length) {
case 1: case 1:
if(UserManager.getPlayer((Player) sender) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
Party playerParty = UserManager.getPlayer((Player) sender).getParty(); Party playerParty = UserManager.getPlayer((Player) sender).getParty();
String partyName = playerParty.getName(); String partyName = playerParty.getName();

View File

@ -22,6 +22,11 @@ public class PartyInfoCommand implements CommandExecutor {
switch (args.length) { switch (args.length) {
case 0: case 0:
case 1: case 1:
if(UserManager.getPlayer((Player) sender) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
Player player = (Player) sender; Player player = (Player) sender;
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
Party party = mcMMOPlayer.getParty(); Party party = mcMMOPlayer.getParty();

View File

@ -25,6 +25,13 @@ public class PartyInviteCommand implements CommandExecutor {
} }
Player target = mcMMOTarget.getPlayer(); Player target = mcMMOTarget.getPlayer();
if(UserManager.getPlayer((Player) sender) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
Player player = (Player) sender; Player player = (Player) sender;
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
String playerName = player.getName(); String playerName = player.getName();

View File

@ -17,6 +17,12 @@ import org.bukkit.entity.Player;
public class PartyItemShareCommand implements CommandExecutor { public class PartyItemShareCommand implements CommandExecutor {
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(UserManager.getPlayer((Player) sender) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
Party party = UserManager.getPlayer((Player) sender).getParty(); Party party = UserManager.getPlayer((Player) sender).getParty();
if (party.getLevel() < PartyManager.getPartyFeatureUnlockLevel(PartyFeature.ITEM_SHARE)) { if (party.getLevel() < PartyManager.getPartyFeatureUnlockLevel(PartyFeature.ITEM_SHARE)) {

View File

@ -33,6 +33,13 @@ public class PartyJoinCommand implements CommandExecutor {
} }
Player player = (Player) sender; Player player = (Player) sender;
if(UserManager.getPlayer((Player) sender) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
Party targetParty = mcMMOTarget.getParty(); Party targetParty = mcMMOTarget.getParty();

View File

@ -18,6 +18,12 @@ public class PartyKickCommand implements CommandExecutor {
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) { switch (args.length) {
case 2: case 2:
if(UserManager.getPlayer((Player) sender) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
Party playerParty = UserManager.getPlayer((Player) sender).getParty(); Party playerParty = UserManager.getPlayer((Player) sender).getParty();
String targetName = CommandUtils.getMatchedPlayerName(args[1]); String targetName = CommandUtils.getMatchedPlayerName(args[1]);

View File

@ -54,6 +54,12 @@ public class PartyLockCommand implements CommandExecutor {
} }
private void togglePartyLock(CommandSender sender, boolean lock) { private void togglePartyLock(CommandSender sender, boolean lock) {
if(UserManager.getPlayer((Player) sender) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return;
}
Party party = UserManager.getPlayer((Player) sender).getParty(); Party party = UserManager.getPlayer((Player) sender).getParty();
if (!Permissions.partySubcommand(sender, lock ? PartySubcommandType.LOCK : PartySubcommandType.UNLOCK)) { if (!Permissions.partySubcommand(sender, lock ? PartySubcommandType.LOCK : PartySubcommandType.UNLOCK)) {

View File

@ -17,6 +17,13 @@ public class PartyQuitCommand implements CommandExecutor {
switch (args.length) { switch (args.length) {
case 1: case 1:
Player player = (Player) sender; Player player = (Player) sender;
if(UserManager.getPlayer((Player) sender) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
Party playerParty = mcMMOPlayer.getParty(); Party playerParty = mcMMOPlayer.getParty();

View File

@ -16,6 +16,12 @@ public class PartyRenameCommand implements CommandExecutor {
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) { switch (args.length) {
case 2: case 2:
if(UserManager.getPlayer((Player) sender) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
McMMOPlayer mcMMOPlayer = UserManager.getPlayer((Player) sender); McMMOPlayer mcMMOPlayer = UserManager.getPlayer((Player) sender);
Party playerParty = mcMMOPlayer.getParty(); Party playerParty = mcMMOPlayer.getParty();

View File

@ -16,6 +16,12 @@ import org.bukkit.entity.Player;
public class PartyXpShareCommand implements CommandExecutor { public class PartyXpShareCommand implements CommandExecutor {
@Override @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(UserManager.getPlayer((Player) sender) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
Party party = UserManager.getPlayer((Player) sender).getParty(); Party party = UserManager.getPlayer((Player) sender).getParty();
if (party.getLevel() < PartyManager.getPartyFeatureUnlockLevel(PartyFeature.XP_SHARE)) { if (party.getLevel() < PartyManager.getPartyFeatureUnlockLevel(PartyFeature.XP_SHARE)) {

View File

@ -14,6 +14,11 @@ public class PartyAllianceAcceptCommand implements CommandExecutor {
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) { switch (args.length) {
case 2: case 2:
if(UserManager.getPlayer((Player) sender) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
Player player = (Player) sender; Player player = (Player) sender;
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);

View File

@ -36,6 +36,12 @@ public class PartyAllianceCommand implements TabExecutor {
return true; return true;
} }
if(UserManager.getPlayer((Player) sender) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
player = (Player) sender; player = (Player) sender;
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);

View File

@ -15,6 +15,11 @@ public class PartyAllianceDisbandCommand implements CommandExecutor {
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) { switch (args.length) {
case 2: case 2:
if(UserManager.getPlayer((Player) sender) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
Player player = (Player) sender; Player player = (Player) sender;
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
Party party = mcMMOPlayer.getParty(); Party party = mcMMOPlayer.getParty();

View File

@ -24,6 +24,13 @@ public class PartyAllianceInviteCommand implements CommandExecutor {
} }
Player target = mcMMOTarget.getPlayer(); Player target = mcMMOTarget.getPlayer();
if(UserManager.getPlayer((Player) sender) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
Player player = (Player) sender; Player player = (Player) sender;
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
String playerName = player.getName(); String playerName = player.getName();

View File

@ -20,6 +20,12 @@ public class PtpAcceptCommand implements CommandExecutor {
return true; return true;
} }
if(UserManager.getPlayer((Player) sender) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
Player player = (Player) sender; Player player = (Player) sender;
PartyTeleportRecord ptpRecord = UserManager.getPlayer(player).getPartyTeleportRecord(); PartyTeleportRecord ptpRecord = UserManager.getPlayer(player).getPartyTeleportRecord();

View File

@ -58,6 +58,12 @@ public class PtpCommand implements TabExecutor {
return true; return true;
} }
if(UserManager.getPlayer((Player) sender) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if (!mcMMOPlayer.inParty()) { if (!mcMMOPlayer.inParty()) {
@ -130,6 +136,12 @@ public class PtpCommand implements TabExecutor {
List<String> matches = StringUtil.copyPartialMatches(args[0], TELEPORT_SUBCOMMANDS, new ArrayList<>(TELEPORT_SUBCOMMANDS.size())); List<String> matches = StringUtil.copyPartialMatches(args[0], TELEPORT_SUBCOMMANDS, new ArrayList<>(TELEPORT_SUBCOMMANDS.size()));
if (matches.size() == 0) { if (matches.size() == 0) {
if(UserManager.getPlayer((Player) sender) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return ImmutableList.of();
}
Player player = (Player) sender; Player player = (Player) sender;
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
@ -204,6 +216,18 @@ public class PtpCommand implements TabExecutor {
} }
protected static void handleTeleportWarmup(Player teleportingPlayer, Player targetPlayer) { protected static void handleTeleportWarmup(Player teleportingPlayer, Player targetPlayer) {
if(UserManager.getPlayer(targetPlayer) == null)
{
targetPlayer.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return;
}
if(UserManager.getPlayer(teleportingPlayer) == null)
{
teleportingPlayer.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return;
}
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(teleportingPlayer); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(teleportingPlayer);
McMMOPlayer mcMMOTarget = UserManager.getPlayer(targetPlayer); McMMOPlayer mcMMOTarget = UserManager.getPlayer(targetPlayer);

View File

@ -38,6 +38,12 @@ public class MccooldownCommand implements TabExecutor {
} }
} }
if(UserManager.getPlayer(player) == null)
{
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
player.sendMessage(LocaleLoader.getString("Commands.Cooldowns.Header")); player.sendMessage(LocaleLoader.getString("Commands.Cooldowns.Header"));

View File

@ -88,11 +88,19 @@ public class McrankCommand implements TabExecutor {
private void display(CommandSender sender, String playerName) { private void display(CommandSender sender, String playerName) {
if (sender instanceof Player) { if (sender instanceof Player) {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName()); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
if(mcMMOPlayer == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return;
}
long cooldownMillis = Math.max(MainConfig.getInstance().getDatabasePlayerCooldown(), 1750); long cooldownMillis = Math.max(MainConfig.getInstance().getDatabasePlayerCooldown(), 1750);
if (mcMMOPlayer.getDatabaseATS() + cooldownMillis > System.currentTimeMillis()) { if (mcMMOPlayer.getDatabaseATS() + cooldownMillis > System.currentTimeMillis()) {
sender.sendMessage(LocaleLoader.getString("Commands.Database.Cooldown")); sender.sendMessage(LocaleLoader.getString("Commands.Database.CooldownMS", getCDSeconds(mcMMOPlayer, cooldownMillis)));
return; return;
} }
@ -112,4 +120,8 @@ public class McrankCommand implements TabExecutor {
new McrankCommandAsyncTask(playerName, sender, useBoard, useChat).runTaskAsynchronously(mcMMO.p); new McrankCommandAsyncTask(playerName, sender, useBoard, useChat).runTaskAsynchronously(mcMMO.p);
} }
private long getCDSeconds(McMMOPlayer mcMMOPlayer, long cooldownMillis) {
return ((mcMMOPlayer.getDatabaseATS() + cooldownMillis) - System.currentTimeMillis());
}
} }

View File

@ -26,6 +26,12 @@ public class McstatsCommand implements TabExecutor {
switch (args.length) { switch (args.length) {
case 0: case 0:
if(UserManager.getPlayer((Player) sender) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
Player player = (Player) sender; Player player = (Player) sender;
if (mcMMO.getScoreboardSettings().isScoreboardEnabled(ScoreboardManager.SidebarType.STATS_BOARD) && mcMMO.getScoreboardSettings().getScoreboardsEnabled()) { if (mcMMO.getScoreboardSettings().isScoreboardEnabled(ScoreboardManager.SidebarType.STATS_BOARD) && mcMMO.getScoreboardSettings().getScoreboardsEnabled()) {

View File

@ -30,6 +30,13 @@ public class AlchemyCommand extends SkillCommand {
} }
protected String[] calculateAbilityDisplayValues(Player player) { protected String[] calculateAbilityDisplayValues(Player player) {
//TODO: Needed?
if(UserManager.getPlayer(player) == null)
{
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return new String[] {"DATA NOT LOADED", "DATA NOT LOADED"};
}
AlchemyManager alchemyManager = UserManager.getPlayer(player).getAlchemyManager(); AlchemyManager alchemyManager = UserManager.getPlayer(player).getAlchemyManager();
String[] displayValues = new String[2]; String[] displayValues = new String[2];

View File

@ -84,7 +84,7 @@ public class RepairCommand extends SkillCommand {
canRepairString = Permissions.repairMaterialType(player, ItemMaterialCategory.STRING); canRepairString = Permissions.repairMaterialType(player, ItemMaterialCategory.STRING);
canRepairLeather = Permissions.repairMaterialType(player, ItemMaterialCategory.LEATHER); canRepairLeather = Permissions.repairMaterialType(player, ItemMaterialCategory.LEATHER);
canRepairWood = Permissions.repairMaterialType(player, ItemMaterialCategory.WOOD); canRepairWood = Permissions.repairMaterialType(player, ItemMaterialCategory.WOOD);
arcaneBypass = Permissions.arcaneBypass(player); arcaneBypass = (Permissions.arcaneBypass(player) || Permissions.hasRepairEnchantBypassPerk(player));
} }
@Override @Override

View File

@ -56,6 +56,12 @@ public abstract class SkillCommand implements TabExecutor {
return true; return true;
} }
if(UserManager.getPlayer((Player) sender) == null)
{
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
return true;
}
switch (args.length) { switch (args.length) {
case 0: case 0:
Player player = (Player) sender; Player player = (Player) sender;

View File

@ -541,7 +541,7 @@ public class McMMOPlayer {
*/ */
private void checkXp(PrimarySkillType primarySkillType, XPGainReason xpGainReason, XPGainSource xpGainSource) { private void checkXp(PrimarySkillType primarySkillType, XPGainReason xpGainReason, XPGainSource xpGainSource) {
if (getSkillXpLevelRaw(primarySkillType) < getXpToLevel(primarySkillType)) { if (getSkillXpLevelRaw(primarySkillType) < getXpToLevel(primarySkillType)) {
UserManager.getPlayer(player).processPostXpEvent(xpGainReason, primarySkillType, mcMMO.p, xpGainSource); processPostXpEvent(xpGainReason, primarySkillType, mcMMO.p, xpGainSource);
return; return;
} }
@ -560,7 +560,7 @@ public class McMMOPlayer {
} }
if (!EventUtils.handleLevelChangeEvent(player, primarySkillType, levelsGained, xpRemoved, true, xpGainReason)) { if (!EventUtils.handleLevelChangeEvent(player, primarySkillType, levelsGained, xpRemoved, true, xpGainReason)) {
UserManager.getPlayer(player).processPostXpEvent(xpGainReason, primarySkillType, mcMMO.p, xpGainSource); processPostXpEvent(xpGainReason, primarySkillType, mcMMO.p, xpGainSource);
return; return;
} }
@ -572,10 +572,10 @@ public class McMMOPlayer {
* Check to see if the player unlocked any new skills * Check to see if the player unlocked any new skills
*/ */
NotificationManager.sendPlayerLevelUpNotification(UserManager.getPlayer(player), primarySkillType, levelsGained, profile.getSkillLevel(primarySkillType)); NotificationManager.sendPlayerLevelUpNotification(this, primarySkillType, levelsGained, profile.getSkillLevel(primarySkillType));
//UPDATE XP BARS //UPDATE XP BARS
UserManager.getPlayer(player).processPostXpEvent(xpGainReason, primarySkillType, mcMMO.p, xpGainSource); processPostXpEvent(xpGainReason, primarySkillType, mcMMO.p, xpGainSource);
} }
/* /*

View File

@ -67,6 +67,9 @@ public class Roll extends AcrobaticsSubSkill {
//Grab the player //Grab the player
McMMOPlayer mcMMOPlayer = EventUtils.getMcMMOPlayer(entityDamageEvent.getEntity()); McMMOPlayer mcMMOPlayer = EventUtils.getMcMMOPlayer(entityDamageEvent.getEntity());
if(mcMMOPlayer == null)
break;
/* /*
* Check for success * Check for success
*/ */

View File

@ -64,11 +64,10 @@ public class BlockListener implements Listener {
if(is.getAmount() <= 0) if(is.getAmount() <= 0)
continue; continue;
if(!MainConfig.getInstance().getDoubleDropsEnabled(PrimarySkillType.MINING, is.getType()) if(!mcMMO.getConfigManager().getBonusDropManager().isBonusDropWhitelisted(is.getType()))
&& !MainConfig.getInstance().getDoubleDropsEnabled(PrimarySkillType.HERBALISM, is.getType())
&& !MainConfig.getInstance().getDoubleDropsEnabled(PrimarySkillType.WOODCUTTING, is.getType()))
continue; continue;
//TODO: Should just store the amount of drops in the metadata itself and use a loop
if(event.getBlock().getState().getMetadata(mcMMO.doubleDrops).size() > 0) if(event.getBlock().getState().getMetadata(mcMMO.doubleDrops).size() > 0)
{ {
event.getBlock().getState().getWorld().dropItemNaturally(event.getBlockState().getLocation(), is); event.getBlock().getState().getWorld().dropItemNaturally(event.getBlockState().getLocation(), is);
@ -283,11 +282,18 @@ public class BlockListener implements Listener {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if (blockState.getType() == Repair.getInstance().getAnvilMaterial() && PrimarySkillType.REPAIR.getPermissions(player)) { if (blockState.getType() == Repair.getInstance().getAnvilMaterial()
mcMMOPlayer.getRepairManager().placedAnvilCheck(); && PrimarySkillType.REPAIR.getPermissions(player)) {
} if (mcMMOPlayer == null)
else if (blockState.getType() == Salvage.anvilMaterial && PrimarySkillType.SALVAGE.getPermissions(player)) { return;
mcMMOPlayer.getSalvageManager().placedAnvilCheck();
if (blockState.getType() == Repair.getInstance().getAnvilMaterial()
&& PrimarySkillType.REPAIR.getPermissions(player)) {
mcMMOPlayer.getRepairManager().placedAnvilCheck();
} else if (blockState.getType() == Salvage.anvilMaterial
&& PrimarySkillType.SALVAGE.getPermissions(player)) {
mcMMOPlayer.getSalvageManager().placedAnvilCheck();
}
} }
} }
@ -376,6 +382,11 @@ public class BlockListener implements Listener {
} }
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
//Check if profile is loaded
if(mcMMOPlayer == null)
return;
ItemStack heldItem = player.getInventory().getItemInMainHand(); ItemStack heldItem = player.getInventory().getItemInMainHand();
/* HERBALISM */ /* HERBALISM */
@ -455,6 +466,12 @@ public class BlockListener implements Listener {
return; return;
} }
//Profile not loaded
if(UserManager.getPlayer(player) == null)
{
return;
}
BlockState blockState = event.getBlock().getState(); BlockState blockState = event.getBlock().getState();
ItemStack heldItem = player.getInventory().getItemInMainHand(); ItemStack heldItem = player.getInventory().getItemInMainHand();
@ -520,6 +537,12 @@ public class BlockListener implements Listener {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
//Profile not loaded
if(mcMMOPlayer == null)
{
return;
}
/* /*
* ABILITY PREPARATION CHECKS * ABILITY PREPARATION CHECKS
* *
@ -594,6 +617,13 @@ public class BlockListener implements Listener {
} }
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
//Profile not loaded
if(UserManager.getPlayer(player) == null)
{
return;
}
ItemStack heldItem = player.getInventory().getItemInMainHand(); ItemStack heldItem = player.getInventory().getItemInMainHand();
Block block = event.getBlock(); Block block = event.getBlock();
BlockState blockState = block.getState(); BlockState blockState = block.getState();
@ -629,6 +659,14 @@ public class BlockListener implements Listener {
public void onBlockDamageCleanup(BlockDamageEvent event) { public void onBlockDamageCleanup(BlockDamageEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
//Profile not loaded
if(UserManager.getPlayer(player) == null)
{
return;
}
BlockState blockState = event.getBlock().getState(); BlockState blockState = event.getBlock().getState();
ItemStack heldItem = player.getInventory().getItemInMainHand(); ItemStack heldItem = player.getInventory().getItemInMainHand();
@ -639,6 +677,12 @@ public class BlockListener implements Listener {
} }
public void debugStickDump(Player player, BlockState blockState) { public void debugStickDump(Player player, BlockState blockState) {
//Profile not loaded
if(UserManager.getPlayer(player) == null)
{
return;
}
if(player.getInventory().getItemInMainHand().getType() == Material.DEBUG_STICK) if(player.getInventory().getItemInMainHand().getType() == Material.DEBUG_STICK)
{ {
if(mcMMO.getPlaceStore().isTrue(blockState)) if(mcMMO.getPlaceStore().isTrue(blockState))

View File

@ -476,6 +476,10 @@ public class EntityListener implements Listener {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
//Profile not loaded
if(mcMMOPlayer == null)
return;
/* Check for invincibility */ /* Check for invincibility */
if (mcMMOPlayer.getGodMode()) { if (mcMMOPlayer.getGodMode()) {
event.setCancelled(true); event.setCancelled(true);
@ -507,6 +511,12 @@ public class EntityListener implements Listener {
Player player = (Player) owner; Player player = (Player) owner;
Wolf wolf = (Wolf) pet; Wolf wolf = (Wolf) pet;
//Profile not loaded
if(UserManager.getPlayer(player) == null)
{
return;
}
TamingManager tamingManager = UserManager.getPlayer(player).getTamingManager(); TamingManager tamingManager = UserManager.getPlayer(player).getTamingManager();
switch (cause) { switch (cause) {
@ -685,6 +695,12 @@ public class EntityListener implements Listener {
return; return;
} }
//Profile not loaded
if(UserManager.getPlayer(player) == null)
{
return;
}
/* WORLD GUARD MAIN FLAG CHECK */ /* WORLD GUARD MAIN FLAG CHECK */
if(WorldGuardUtils.isWorldGuardLoaded()) if(WorldGuardUtils.isWorldGuardLoaded())
{ {
@ -732,6 +748,12 @@ public class EntityListener implements Listener {
return; return;
} }
//Profile not loaded
if(UserManager.getPlayer(player) == null)
{
return;
}
MiningManager miningManager = UserManager.getPlayer(player).getMiningManager(); MiningManager miningManager = UserManager.getPlayer(player).getMiningManager();
if (miningManager.canUseBlastMining()) { if (miningManager.canUseBlastMining()) {
@ -781,6 +803,12 @@ public class EntityListener implements Listener {
Player player = (Player) entity; Player player = (Player) entity;
//Profile not loaded
if(UserManager.getPlayer(player) == null)
{
return;
}
/* WORLD GUARD MAIN FLAG CHECK */ /* WORLD GUARD MAIN FLAG CHECK */
if(WorldGuardUtils.isWorldGuardLoaded()) if(WorldGuardUtils.isWorldGuardLoaded())
{ {
@ -885,10 +913,16 @@ public class EntityListener implements Listener {
return; return;
} }
if(mcMMO.getConfigManager().getConfigExploitPrevention().doTamedEntitiesGiveXP()) if(mcMMO.getConfigManager().getConfigExploitPrevention().doTamedEntitiesGiveXP())
entity.setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue); entity.setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue);
//Profile not loaded
//TODO: Redundant
/*if(UserManager.getPlayer(player) == null)
{
return;
}*/
UserManager.getPlayer(player).getTamingManager().awardTamingXP(entity); UserManager.getPlayer(player).getTamingManager().awardTamingXP(entity);
} }

View File

@ -57,6 +57,12 @@ public class InventoryListener implements Listener {
return; return;
} }
//Profile not loaded
if(UserManager.getPlayer((Player) player) == null)
{
return;
}
if(!furnaceBlock.hasMetadata(mcMMO.furnaceMetadataKey) && furnaceBlock.getMetadata(mcMMO.furnaceMetadataKey).size() == 0) if(!furnaceBlock.hasMetadata(mcMMO.furnaceMetadataKey) && furnaceBlock.getMetadata(mcMMO.furnaceMetadataKey).size() == 0)
furnaceBlock.setMetadata(mcMMO.furnaceMetadataKey, UserManager.getPlayer((Player) player).getPlayerMetadata()); furnaceBlock.setMetadata(mcMMO.furnaceMetadataKey, UserManager.getPlayer((Player) player).getPlayerMetadata());
} }
@ -109,6 +115,12 @@ public class InventoryListener implements Listener {
return; return;
} }
//Profile not loaded
if(UserManager.getPlayer(player) == null)
{
return;
}
event.setBurnTime(UserManager.getPlayer(player).getSmeltingManager().fuelEfficiency(event.getBurnTime())); event.setBurnTime(UserManager.getPlayer(player).getSmeltingManager().fuelEfficiency(event.getBurnTime()));
} }
@ -138,6 +150,12 @@ public class InventoryListener implements Listener {
return; return;
} }
//Profile not loaded
if(UserManager.getPlayer(player) == null)
{
return;
}
event.setResult(UserManager.getPlayer(player).getSmeltingManager().smeltProcessing(smelting, event.getResult())); event.setResult(UserManager.getPlayer(player).getSmeltingManager().smeltProcessing(smelting, event.getResult()));
} }
@ -166,6 +184,12 @@ public class InventoryListener implements Listener {
return; return;
} }
//Profile not loaded
if(UserManager.getPlayer(player) == null)
{
return;
}
int exp = UserManager.getPlayer(player).getSmeltingManager().vanillaXPBoost(event.getExpToDrop()); int exp = UserManager.getPlayer(player).getSmeltingManager().vanillaXPBoost(event.getExpToDrop());
event.setExpToDrop(exp); event.setExpToDrop(exp);
} }
@ -188,6 +212,12 @@ public class InventoryListener implements Listener {
if (furnaceBlock.getMetadata(mcMMO.furnaceMetadataKey).size() > 0) if (furnaceBlock.getMetadata(mcMMO.furnaceMetadataKey).size() > 0)
furnaceBlock.removeMetadata(mcMMO.furnaceMetadataKey, mcMMO.p); furnaceBlock.removeMetadata(mcMMO.furnaceMetadataKey, mcMMO.p);
//Profile not loaded
if(UserManager.getPlayer(player) == null)
{
return;
}
furnaceBlock.setMetadata(mcMMO.furnaceMetadataKey, UserManager.getPlayer(player).getPlayerMetadata()); furnaceBlock.setMetadata(mcMMO.furnaceMetadataKey, UserManager.getPlayer(player).getPlayerMetadata());
} }
} }

View File

@ -82,8 +82,17 @@ public class PlayerListener implements Listener {
return; return;
} }
//Profile not loaded
if(UserManager.getPlayer(player) == null)
{
return;
}
if(mcMMO.getConfigManager().getConfigExploitPrevention().getConfigSectionExploitAcrobatics().isPreventAcrobaticsAbuse()) if(mcMMO.getConfigManager().getConfigExploitPrevention().getConfigSectionExploitAcrobatics().isPreventAcrobaticsAbuse())
UserManager.getPlayer(player).actualizeTeleportATS(); UserManager.getPlayer(player).actualizeTeleportATS();
UserManager.getPlayer(player).actualizeTeleportATS();
} }
/** /**
@ -188,6 +197,12 @@ public class PlayerListener implements Listener {
return; return;
} }
//Profile not loaded
if(UserManager.getPlayer(player) == null)
{
return;
}
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
mcMMOPlayer.checkGodMode(); mcMMOPlayer.checkGodMode();
@ -253,6 +268,12 @@ public class PlayerListener implements Listener {
return; return;
} }
//Profile not loaded
if(UserManager.getPlayer(player) == null)
{
return;
}
FishingManager fishingManager = UserManager.getPlayer(player).getFishingManager(); FishingManager fishingManager = UserManager.getPlayer(player).getFishingManager();
switch (event.getState()) { switch (event.getState()) {
@ -326,6 +347,12 @@ public class PlayerListener implements Listener {
return; return;
} }
//Profile not loaded
if(UserManager.getPlayer(player) == null)
{
return;
}
Entity caught = event.getCaught(); Entity caught = event.getCaught();
FishingManager fishingManager = UserManager.getPlayer(player).getFishingManager(); FishingManager fishingManager = UserManager.getPlayer(player).getFishingManager();
@ -423,6 +450,12 @@ public class PlayerListener implements Listener {
return; return;
} }
//Profile not loaded
if(UserManager.getPlayer(player) == null)
{
return;
}
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
Item drop = event.getItem(); Item drop = event.getItem();
@ -474,6 +507,12 @@ public class PlayerListener implements Listener {
return; return;
} }
//Profile not loaded
if(UserManager.getPlayer(player) == null)
{
return;
}
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
mcMMOPlayer.logout(false); mcMMOPlayer.logout(false);
} }
@ -530,6 +569,12 @@ public class PlayerListener implements Listener {
return; return;
} }
//Profile not loaded
if(UserManager.getPlayer(player) == null)
{
return;
}
UserManager.getPlayer(player).actualizeRespawnATS(); UserManager.getPlayer(player).actualizeRespawnATS();
} }
@ -557,6 +602,12 @@ public class PlayerListener implements Listener {
return; return;
} }
//Profile not loaded
if(UserManager.getPlayer(player) == null)
{
return;
}
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
MiningManager miningManager = mcMMOPlayer.getMiningManager(); MiningManager miningManager = mcMMOPlayer.getMiningManager();
Block block = event.getClickedBlock(); Block block = event.getClickedBlock();
@ -660,6 +711,12 @@ public class PlayerListener implements Listener {
return; return;
} }
//Profile not loaded
if(UserManager.getPlayer(player) == null)
{
return;
}
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
ItemStack heldItem = player.getInventory().getItemInMainHand(); ItemStack heldItem = player.getInventory().getItemInMainHand();

View File

@ -111,6 +111,17 @@ public final class PartyManager {
if(!mcMMO.getConfigManager().getConfigParty().isPartySystemEnabled()) if(!mcMMO.getConfigManager().getConfigParty().isPartySystemEnabled())
return false; return false;
//Profile not loaded
if(UserManager.getPlayer(firstPlayer) == null)
{
return false;
}
//Profile not loaded
if(UserManager.getPlayer(secondPlayer) == null)
{
return false;
}
Party firstParty = UserManager.getPlayer(firstPlayer).getParty(); Party firstParty = UserManager.getPlayer(firstPlayer).getParty();
Party secondParty = UserManager.getPlayer(secondPlayer).getParty(); Party secondParty = UserManager.getPlayer(secondPlayer).getParty();
@ -127,6 +138,17 @@ public final class PartyManager {
if(!mcMMO.getConfigManager().getConfigParty().isPartySystemEnabled()) if(!mcMMO.getConfigManager().getConfigParty().isPartySystemEnabled())
return false; return false;
//Profile not loaded
if(UserManager.getPlayer(firstPlayer) == null)
{
return false;
}
//Profile not loaded
if(UserManager.getPlayer(secondPlayer) == null)
{
return false;
}
Party firstParty = UserManager.getPlayer(firstPlayer).getParty(); Party firstParty = UserManager.getPlayer(firstPlayer).getParty();
Party secondParty = UserManager.getPlayer(secondPlayer).getParty(); Party secondParty = UserManager.getPlayer(secondPlayer).getParty();
@ -294,6 +316,12 @@ public final class PartyManager {
* @return the existing party, null otherwise * @return the existing party, null otherwise
*/ */
public static Party getParty(Player player) { public static Party getParty(Player player) {
//Profile not loaded
if(UserManager.getPlayer(player) == null)
{
return null;
}
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
return mcMMOPlayer.getParty(); return mcMMOPlayer.getParty();
@ -353,7 +381,14 @@ public final class PartyManager {
* @param party The party to remove * @param party The party to remove
*/ */
public static void disbandParty(Party party) { public static void disbandParty(Party party) {
//TODO: Potential issues with unloaded profile?
for (Player member : party.getOnlineMembers()) { for (Player member : party.getOnlineMembers()) {
//Profile not loaded
if(UserManager.getPlayer(member) == null)
{
continue;
}
processPartyLeaving(UserManager.getPlayer(member)); processPartyLeaving(UserManager.getPlayer(member));
} }

View File

@ -50,6 +50,12 @@ public final class ShareHandler {
float splitXp = (float) (xp / partySize * shareBonus); float splitXp = (float) (xp / partySize * shareBonus);
for (Player member : nearMembers) { for (Player member : nearMembers) {
//Profile not loaded
if(UserManager.getPlayer(member) == null)
{
continue;
}
UserManager.getPlayer(member).beginUnsharedXpGain(primarySkillType, splitXp, xpGainReason, XPGainSource.PARTY_MEMBERS); UserManager.getPlayer(member).beginUnsharedXpGain(primarySkillType, splitXp, xpGainReason, XPGainSource.PARTY_MEMBERS);
} }
@ -107,6 +113,13 @@ public final class ShareHandler {
for (Player member : nearMembers) { for (Player member : nearMembers) {
McMMOPlayer mcMMOMember = UserManager.getPlayer(member); McMMOPlayer mcMMOMember = UserManager.getPlayer(member);
//Profile not loaded
if(UserManager.getPlayer(member) == null)
{
continue;
}
int itemShareModifier = mcMMOMember.getItemShareModifier(); int itemShareModifier = mcMMOMember.getItemShareModifier();
int diceRoll = Misc.getRandom().nextInt(itemShareModifier); int diceRoll = Misc.getRandom().nextInt(itemShareModifier);

View File

@ -35,7 +35,11 @@ public class AlchemyBrewTask extends BukkitRunnable {
brewSpeed = 1.0; brewSpeed = 1.0;
brewTimer = 400; brewTimer = 400;
if (player != null && !Misc.isNPCEntity(player) && Permissions.isSubSkillEnabled(player, SubSkillType.ALCHEMY_CATALYSIS)) { if (player != null
&& !Misc.isNPCEntity(player)
&& Permissions.isSubSkillEnabled(player, SubSkillType.ALCHEMY_CATALYSIS)
&& UserManager.getPlayer(player) != null) {
double catalysis = UserManager.getPlayer(player).getAlchemyManager().calculateBrewSpeed(Permissions.lucky(player, PrimarySkillType.ALCHEMY)); double catalysis = UserManager.getPlayer(player).getAlchemyManager().calculateBrewSpeed(Permissions.lucky(player, PrimarySkillType.ALCHEMY));
McMMOPlayerCatalysisEvent event = new McMMOPlayerCatalysisEvent(player, catalysis); McMMOPlayerCatalysisEvent event = new McMMOPlayerCatalysisEvent(player, catalysis);

View File

@ -90,7 +90,12 @@ public final class AlchemyPotionBrewer {
} }
private static List<ItemStack> getValidIngredients(Player player) { private static List<ItemStack> getValidIngredients(Player player) {
return PotionConfig.getInstance().getIngredients((player == null || !Permissions.isSubSkillEnabled(player, SubSkillType.ALCHEMY_CONCOCTIONS)) ? 1 : UserManager.getPlayer(player).getAlchemyManager().getTier()); if(player == null || UserManager.getPlayer(player) == null)
{
return PotionConfig.getInstance().getIngredients(1);
}
return PotionConfig.getInstance().getIngredients(!Permissions.isSubSkillEnabled(player, SubSkillType.ALCHEMY_CONCOCTIONS) ? 1 : UserManager.getPlayer(player).getAlchemyManager().getTier());
} }
public static void finishBrewing(BlockState brewingStand, Player player, boolean forced) { public static void finishBrewing(BlockState brewingStand, Player player, boolean forced) {
@ -139,6 +144,7 @@ public final class AlchemyPotionBrewer {
if (output != null && player != null) { if (output != null && player != null) {
PotionStage potionStage = PotionStage.getPotionStage(input, output); PotionStage potionStage = PotionStage.getPotionStage(input, output);
//TODO: hmm
if (UserManager.hasPlayerDataKey(player)) { if (UserManager.hasPlayerDataKey(player)) {
UserManager.getPlayer(player).getAlchemyManager().handlePotionBrewSuccesses(potionStage, 1); UserManager.getPlayer(player).getAlchemyManager().handlePotionBrewSuccesses(potionStage, 1);
} }

View File

@ -9,7 +9,6 @@ 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;
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.random.RandomChanceUtil; import com.gmail.nossr50.util.random.RandomChanceUtil;
import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.skills.SkillActivationType; import com.gmail.nossr50.util.skills.SkillActivationType;
@ -90,7 +89,8 @@ public class ArcheryManager extends SkillManager {
defender.teleport(dazedLocation); defender.teleport(dazedLocation);
defender.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 20 * 10, 10)); defender.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 20 * 10, 10));
if (UserManager.getPlayer(defender).useChatNotifications()) {
if (NotificationManager.doesPlayerUseNotifications(defender)) {
NotificationManager.sendPlayerInformation(defender, NotificationType.SUBSKILL_MESSAGE, "Combat.TouchedFuzzy"); NotificationManager.sendPlayerInformation(defender, NotificationType.SUBSKILL_MESSAGE, "Combat.TouchedFuzzy");
} }

View File

@ -10,7 +10,6 @@ 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;
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.random.RandomChanceUtil; import com.gmail.nossr50.util.random.RandomChanceUtil;
import com.gmail.nossr50.util.skills.*; import com.gmail.nossr50.util.skills.*;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
@ -95,7 +94,7 @@ public class AxesManager extends SkillManager {
if (target instanceof Player) { if (target instanceof Player) {
Player defender = (Player) target; Player defender = (Player) target;
if (UserManager.getPlayer(defender).useChatNotifications()) { if (NotificationManager.doesPlayerUseNotifications(defender)) {
NotificationManager.sendPlayerInformation(defender, NotificationType.SUBSKILL_MESSAGE, "Axes.Combat.CritStruck"); NotificationManager.sendPlayerInformation(defender, NotificationType.SUBSKILL_MESSAGE, "Axes.Combat.CritStruck");
} }
@ -152,7 +151,7 @@ public class AxesManager extends SkillManager {
if (target instanceof Player) { if (target instanceof Player) {
Player defender = (Player) target; Player defender = (Player) target;
if (UserManager.getPlayer(defender).useChatNotifications()) { if (NotificationManager.doesPlayerUseNotifications(defender)) {
NotificationManager.sendPlayerInformation(defender, NotificationType.SUBSKILL_MESSAGE, "Axes.Combat.GI.Struck"); NotificationManager.sendPlayerInformation(defender, NotificationType.SUBSKILL_MESSAGE, "Axes.Combat.GI.Struck");
} }
} }

View File

@ -103,6 +103,11 @@ public class BlastMining {
return false; return false;
} }
if(UserManager.getPlayer(defender) == null)
{
return false;
}
MiningManager miningManager = UserManager.getPlayer(defender).getMiningManager(); MiningManager miningManager = UserManager.getPlayer(defender).getMiningManager();
if (!miningManager.canUseDemolitionsExpertise()) { if (!miningManager.canUseDemolitionsExpertise()) {

View File

@ -147,8 +147,7 @@ public class RepairManager extends SkillManager {
} }
// Handle the enchants // Handle the enchants
// if (ArcaneForging.arcaneForgingEnchantLoss) { if (mcMMO.getConfigManager().getConfigRepair().getArcaneForging().isMayLoseEnchants() && !Permissions.hasRepairEnchantBypassPerk(player)) {
if (mcMMO.getConfigManager().getConfigRepair().getArcaneForging().isMayLoseEnchants()) {
addEnchants(item); addEnchants(item);
} }

View File

@ -179,6 +179,9 @@ public class SalvageManager extends SkillManager {
}*/ }*/
public double getExtractFullEnchantChance() { public double getExtractFullEnchantChance() {
if(Permissions.hasSalvageEnchantBypassPerk(getPlayer()))
return 100.0D;
return AdvancedConfig.getInstance().getArcaneSalvageExtractFullEnchantsChance(getArcaneSalvageRank()); return AdvancedConfig.getInstance().getArcaneSalvageExtractFullEnchantsChance(getArcaneSalvageRank());
} }
@ -198,10 +201,11 @@ public class SalvageManager extends SkillManager {
EnchantmentStorageMeta enchantMeta = (EnchantmentStorageMeta) book.getItemMeta(); EnchantmentStorageMeta enchantMeta = (EnchantmentStorageMeta) book.getItemMeta();
boolean downgraded = false; boolean downgraded = false;
boolean arcaneFailure = false; int arcaneFailureCount = 0;
for (Entry<Enchantment, Integer> enchant : enchants.entrySet()) { for (Entry<Enchantment, Integer> enchant : enchants.entrySet()) {
if (!Salvage.arcaneSalvageEnchantLoss if (!Salvage.arcaneSalvageEnchantLoss
|| Permissions.hasSalvageEnchantBypassPerk(player)
|| RandomChanceUtil.checkRandomChanceExecutionSuccess(new RandomChanceSkillStatic(getExtractFullEnchantChance(), getPlayer(), SubSkillType.SALVAGE_ARCANE_SALVAGE))) { || RandomChanceUtil.checkRandomChanceExecutionSuccess(new RandomChanceSkillStatic(getExtractFullEnchantChance(), getPlayer(), SubSkillType.SALVAGE_ARCANE_SALVAGE))) {
enchantMeta.addStoredEnchant(enchant.getKey(), enchant.getValue(), true); enchantMeta.addStoredEnchant(enchant.getKey(), enchant.getValue(), true);
} }
@ -210,36 +214,28 @@ public class SalvageManager extends SkillManager {
&& RandomChanceUtil.checkRandomChanceExecutionSuccess(new RandomChanceSkillStatic(getExtractPartialEnchantChance(), getPlayer(), SubSkillType.SALVAGE_ARCANE_SALVAGE))) { && RandomChanceUtil.checkRandomChanceExecutionSuccess(new RandomChanceSkillStatic(getExtractPartialEnchantChance(), getPlayer(), SubSkillType.SALVAGE_ARCANE_SALVAGE))) {
enchantMeta.addStoredEnchant(enchant.getKey(), enchant.getValue() - 1, true); enchantMeta.addStoredEnchant(enchant.getKey(), enchant.getValue() - 1, true);
downgraded = true; downgraded = true;
} } else {
else { arcaneFailureCount++;
arcaneFailure = true;
downgraded = true;
} }
} }
if(!arcaneFailure) if(failedAllEnchants(arcaneFailureCount, enchants.entrySet().size()))
{ {
Map<Enchantment, Integer> newEnchants = enchantMeta.getStoredEnchants(); NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, "Salvage.Skills.ArcaneFailed");
if (downgraded || newEnchants.size() < enchants.size()) {
NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, "Salvage.Skills.ArcanePartial");
}
else {
NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, "Salvage.Skills.ArcanePartial");
}
book.setItemMeta(enchantMeta);
} else {
if(enchantMeta.getStoredEnchants().size() > 0)
{
NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, "Salvage.Skills.ArcaneFailed");
}
return null; return null;
} else if(downgraded)
{
NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, "Salvage.Skills.ArcanePartial");
} }
book.setItemMeta(enchantMeta);
return book; return book;
} }
private boolean failedAllEnchants(int arcaneFailureCount, int size) {
return arcaneFailureCount == size;
}
/** /**
* Check if the player has tried to use an Anvil before. * Check if the player has tried to use an Anvil before.
* @param actualize * @param actualize

View File

@ -12,7 +12,6 @@ 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;
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.random.RandomChanceUtil; import com.gmail.nossr50.util.random.RandomChanceUtil;
import com.gmail.nossr50.util.skills.CombatUtils; import com.gmail.nossr50.util.skills.CombatUtils;
import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.RankUtils;
@ -71,7 +70,7 @@ public class SwordsManager extends SkillManager {
if(defender.isBlocking()) if(defender.isBlocking())
return; return;
if (UserManager.getPlayer(defender).useChatNotifications()) { if (NotificationManager.doesPlayerUseNotifications(defender)) {
if(!BleedTimerTask.isBleeding(defender)) if(!BleedTimerTask.isBleeding(defender))
NotificationManager.sendPlayerInformation(defender, NotificationType.SUBSKILL_MESSAGE, "Swords.Combat.Bleeding.Started"); NotificationManager.sendPlayerInformation(defender, NotificationType.SUBSKILL_MESSAGE, "Swords.Combat.Bleeding.Started");
} }

View File

@ -17,7 +17,6 @@ import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.StringUtils;
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.random.RandomChanceSkillStatic; import com.gmail.nossr50.util.random.RandomChanceSkillStatic;
import com.gmail.nossr50.util.random.RandomChanceUtil; import com.gmail.nossr50.util.random.RandomChanceUtil;
import com.gmail.nossr50.util.skills.ParticleEffectUtils; import com.gmail.nossr50.util.skills.ParticleEffectUtils;
@ -225,7 +224,7 @@ public class TamingManager extends SkillManager {
if (target instanceof Player) { if (target instanceof Player) {
Player defender = (Player) target; Player defender = (Player) target;
if (UserManager.getPlayer(defender).useChatNotifications()) { if (NotificationManager.doesPlayerUseNotifications(defender)) {
NotificationManager.sendPlayerInformation(defender, NotificationType.SUBSKILL_MESSAGE, "Taming.SubSkill.Pummel.TargetMessage"); NotificationManager.sendPlayerInformation(defender, NotificationType.SUBSKILL_MESSAGE, "Taming.SubSkill.Pummel.TargetMessage");
} }
} }

View File

@ -101,6 +101,9 @@ public class UnarmedManager extends SkillManager {
return; return;
} }
if(UserManager.getPlayer(defender) == null)
return;
Item item = Misc.dropItem(defender.getLocation(), defender.getInventory().getItemInMainHand()); Item item = Misc.dropItem(defender.getLocation(), defender.getInventory().getItemInMainHand());
if (item != null && AdvancedConfig.getInstance().getDisarmProtected()) { if (item != null && AdvancedConfig.getInstance().getDisarmProtected()) {

View File

@ -54,6 +54,10 @@ public final class ChimaeraWing {
mcMMOPlayer = UserManager.getPlayer(player); mcMMOPlayer = UserManager.getPlayer(player);
//Not loaded
if(mcMMOPlayer == null)
return;
if (mcMMOPlayer.getTeleportCommenceLocation() != null) { if (mcMMOPlayer.getTeleportCommenceLocation() != null) {
return; return;
} }

View File

@ -120,11 +120,16 @@ public class EventUtils {
Player player = (Player) entity; Player player = (Player) entity;
if (!UserManager.hasPlayerDataKey(player)) { if (!UserManager.hasPlayerDataKey(player)) {
return false; return true;
} }
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if(mcMMOPlayer == null)
{
return true;
}
/* Check for invincibility */ /* Check for invincibility */
if (mcMMOPlayer.getGodMode()) { if (mcMMOPlayer.getGodMode()) {
entityDamageEvent.setCancelled(true); entityDamageEvent.setCancelled(true);
@ -240,6 +245,9 @@ public class EventUtils {
public static void handlePartyTeleportEvent(Player teleportingPlayer, Player targetPlayer) { public static void handlePartyTeleportEvent(Player teleportingPlayer, Player targetPlayer) {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(teleportingPlayer); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(teleportingPlayer);
if(mcMMOPlayer == null)
return;
McMMOPartyTeleportEvent event = new McMMOPartyTeleportEvent(teleportingPlayer, targetPlayer, mcMMOPlayer.getParty().getName()); McMMOPartyTeleportEvent event = new McMMOPartyTeleportEvent(teleportingPlayer, targetPlayer, mcMMOPlayer.getParty().getName());
mcMMO.p.getServer().getPluginManager().callEvent(event); mcMMO.p.getServer().getPluginManager().callEvent(event);
@ -298,6 +306,9 @@ public class EventUtils {
} }
public static boolean handleStatsLossEvent(Player player, HashMap<String, Integer> levelChanged, HashMap<String, Float> experienceChanged) { public static boolean handleStatsLossEvent(Player player, HashMap<String, Integer> levelChanged, HashMap<String, Float> experienceChanged) {
if(UserManager.getPlayer(player) == null)
return true;
McMMOPlayerStatLossEvent event = new McMMOPlayerStatLossEvent(player, levelChanged, experienceChanged); McMMOPlayerStatLossEvent event = new McMMOPlayerStatLossEvent(player, levelChanged, experienceChanged);
mcMMO.p.getServer().getPluginManager().callEvent(event); mcMMO.p.getServer().getPluginManager().callEvent(event);
@ -344,6 +355,15 @@ public class EventUtils {
HashMap<String, Float> experienceChangedVictim = eventVictim.getExperienceChanged(); HashMap<String, Float> experienceChangedVictim = eventVictim.getExperienceChanged();
McMMOPlayer killerPlayer = UserManager.getPlayer(killer); McMMOPlayer killerPlayer = UserManager.getPlayer(killer);
//Not loaded
if(killerPlayer == null)
return true;
//Not loaded
if(UserManager.getPlayer(victim) == null)
return true;
PlayerProfile victimProfile = UserManager.getPlayer(victim).getProfile(); PlayerProfile victimProfile = UserManager.getPlayer(victim).getProfile();
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) { for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {

View File

@ -17,6 +17,9 @@ public final class HardcoreManager {
double statLossPercentage = MainConfig.getInstance().getHardcoreDeathStatPenaltyPercentage(); double statLossPercentage = MainConfig.getInstance().getHardcoreDeathStatPenaltyPercentage();
int levelThreshold = MainConfig.getInstance().getHardcoreDeathStatPenaltyLevelThreshold(); int levelThreshold = MainConfig.getInstance().getHardcoreDeathStatPenaltyLevelThreshold();
if(UserManager.getPlayer(player) == null)
return;
PlayerProfile playerProfile = UserManager.getPlayer(player).getProfile(); PlayerProfile playerProfile = UserManager.getPlayer(player).getProfile();
int totalLevelsLost = 0; int totalLevelsLost = 0;
@ -59,6 +62,9 @@ public final class HardcoreManager {
double vampirismStatLeechPercentage = MainConfig.getInstance().getHardcoreVampirismStatLeechPercentage(); double vampirismStatLeechPercentage = MainConfig.getInstance().getHardcoreVampirismStatLeechPercentage();
int levelThreshold = MainConfig.getInstance().getHardcoreVampirismLevelThreshold(); int levelThreshold = MainConfig.getInstance().getHardcoreVampirismLevelThreshold();
if(UserManager.getPlayer(killer) == null || UserManager.getPlayer(victim) == null)
return;
PlayerProfile killerProfile = UserManager.getPlayer(killer).getProfile(); PlayerProfile killerProfile = UserManager.getPlayer(killer).getProfile();
PlayerProfile victimProfile = UserManager.getPlayer(victim).getProfile(); PlayerProfile victimProfile = UserManager.getPlayer(victim).getProfile();
int totalLevelsStolen = 0; int totalLevelsStolen = 0;

View File

@ -106,6 +106,11 @@ public final class Permissions {
* PERKS * PERKS
*/ */
/* BYPASS PERKS */
public static boolean hasRepairEnchantBypassPerk(Permissible permissible) { return permissible.hasPermission("mcmmo.perks.bypass.repairenchant"); }
public static boolean hasSalvageEnchantBypassPerk(Permissible permissible) { return permissible.hasPermission("mcmmo.perks.bypass.salvageenchant"); }
public static boolean lucky(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.perks.lucky." + skill.toString().toLowerCase()); } public static boolean lucky(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.perks.lucky." + skill.toString().toLowerCase()); }
/* XP PERKS */ /* XP PERKS */

View File

@ -228,6 +228,9 @@ public final class CommandUtils {
} }
private static void printGroupedSkillData(Player inspect, CommandSender display, String header, List<PrimarySkillType> skillGroup) { private static void printGroupedSkillData(Player inspect, CommandSender display, String header, List<PrimarySkillType> skillGroup) {
if(UserManager.getPlayer(inspect) == null)
return;
PlayerProfile profile = UserManager.getPlayer(inspect).getProfile(); PlayerProfile profile = UserManager.getPlayer(inspect).getProfile();
List<String> displayData = new ArrayList<>(); List<String> displayData = new ArrayList<>();

View File

@ -28,7 +28,7 @@ public class NotificationManager {
*/ */
public static void sendPlayerInformation(Player player, NotificationType notificationType, String key) public static void sendPlayerInformation(Player player, NotificationType notificationType, String key)
{ {
if(!UserManager.getPlayer(player).useChatNotifications()) if(UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())
return; return;
ChatMessageType destination = AdvancedConfig.getInstance().doesNotificationUseActionBar(notificationType) ? ChatMessageType.ACTION_BAR : ChatMessageType.SYSTEM; ChatMessageType destination = AdvancedConfig.getInstance().doesNotificationUseActionBar(notificationType) ? ChatMessageType.ACTION_BAR : ChatMessageType.SYSTEM;
@ -39,6 +39,15 @@ public class NotificationManager {
sendNotification(player, customEvent); sendNotification(player, customEvent);
} }
public static boolean doesPlayerUseNotifications(Player player)
{
if(UserManager.getPlayer(player) == null)
return false;
else
return UserManager.getPlayer(player).useChatNotifications();
}
/** /**
* Sends players notifications from mcMMO * Sends players notifications from mcMMO
* This does this by sending out an event so other plugins can cancel it * This does this by sending out an event so other plugins can cancel it
@ -60,7 +69,7 @@ public class NotificationManager {
public static void sendPlayerInformation(Player player, NotificationType notificationType, String key, String... values) public static void sendPlayerInformation(Player player, NotificationType notificationType, String key, String... values)
{ {
if(!UserManager.getPlayer(player).useChatNotifications()) if(UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())
return; return;
ChatMessageType destination = AdvancedConfig.getInstance().doesNotificationUseActionBar(notificationType) ? ChatMessageType.ACTION_BAR : ChatMessageType.SYSTEM; ChatMessageType destination = AdvancedConfig.getInstance().doesNotificationUseActionBar(notificationType) ? ChatMessageType.ACTION_BAR : ChatMessageType.SYSTEM;
@ -108,7 +117,7 @@ public class NotificationManager {
*/ */
public static void sendPlayerLevelUpNotification(McMMOPlayer mcMMOPlayer, PrimarySkillType skillName, int levelsGained, int newLevel) public static void sendPlayerLevelUpNotification(McMMOPlayer mcMMOPlayer, PrimarySkillType skillName, int levelsGained, int newLevel)
{ {
if(!UserManager.getPlayer(mcMMOPlayer.getPlayer()).useChatNotifications()) if(!mcMMOPlayer.useChatNotifications())
return; return;
ChatMessageType destination = AdvancedConfig.getInstance().doesNotificationUseActionBar(NotificationType.LEVEL_UP_MESSAGE) ? ChatMessageType.ACTION_BAR : ChatMessageType.SYSTEM; ChatMessageType destination = AdvancedConfig.getInstance().doesNotificationUseActionBar(NotificationType.LEVEL_UP_MESSAGE) ? ChatMessageType.ACTION_BAR : ChatMessageType.SYSTEM;
@ -129,7 +138,7 @@ public class NotificationManager {
public static void sendPlayerUnlockNotification(McMMOPlayer mcMMOPlayer, SubSkillType subSkillType) public static void sendPlayerUnlockNotification(McMMOPlayer mcMMOPlayer, SubSkillType subSkillType)
{ {
if(!UserManager.getPlayer(mcMMOPlayer.getPlayer()).useChatNotifications()) if(!mcMMOPlayer.useChatNotifications())
return; return;
//CHAT MESSAGE //CHAT MESSAGE

View File

@ -1,5 +1,6 @@
package com.gmail.nossr50.util.player; package com.gmail.nossr50.util.player;
import com.gmail.nossr50.api.exceptions.McMMOPlayerNotFoundException;
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.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
@ -95,9 +96,14 @@ public final class UserManager {
return retrieveMcMMOPlayer(playerName, true); return retrieveMcMMOPlayer(playerName, true);
} }
/**
* Gets the McMMOPlayer object for a player, this can be null if the player has not yet been loaded.
* @param player target player
* @return McMMOPlayer object for this player, null if Player has not been loaded
*/
public static McMMOPlayer getPlayer(Player player) { public static McMMOPlayer getPlayer(Player player) {
//Avoid Array Index out of bounds //Avoid Array Index out of bounds
if(player.hasMetadata(mcMMO.playerDataKey)) if(player != null && player.hasMetadata(mcMMO.playerDataKey))
return (McMMOPlayer) player.getMetadata(mcMMO.playerDataKey).get(0).value(); return (McMMOPlayer) player.getMetadata(mcMMO.playerDataKey).get(0).value();
else else
return null; return null;

View File

@ -204,6 +204,9 @@ public class ScoreboardWrapper {
// TODO is there any way to do the time that looks acceptable? // TODO is there any way to do the time that looks acceptable?
// player.sendMessage(LocaleLoader.getString("Commands.ConfigScoreboard.Timer", StringUtils.capitalize(sidebarType.toString().toLowerCase()), ticks / 20F)); // player.sendMessage(LocaleLoader.getString("Commands.ConfigScoreboard.Timer", StringUtils.capitalize(sidebarType.toString().toLowerCase()), ticks / 20F));
if(UserManager.getPlayer(playerName) == null)
return;
PlayerProfile profile = UserManager.getPlayer(player).getProfile(); PlayerProfile profile = UserManager.getPlayer(player).getProfile();
if (profile.getScoreboardTipsShown() >= mcMMO.getScoreboardSettings().getTipsAmount()) { if (profile.getScoreboardTipsShown() >= mcMMO.getScoreboardSettings().getTipsAmount()) {
@ -434,6 +437,9 @@ public class ScoreboardWrapper {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if(mcMMOPlayer == null)
return;
switch (sidebarType) { switch (sidebarType) {
case SKILL_BOARD: case SKILL_BOARD:

View File

@ -629,6 +629,10 @@ public final class CombatUtils {
if (entity instanceof Player) { if (entity instanceof Player) {
Player defender = (Player) entity; Player defender = (Player) entity;
//TODO: NPC Interaction?
if(UserManager.getPlayer(defender) == null)
return true;
if (!defender.getWorld().getPVP() || defender == player || UserManager.getPlayer(defender).getGodMode()) { if (!defender.getWorld().getPVP() || defender == player || UserManager.getPlayer(defender).getGodMode()) {
return false; return false;
} }

View File

@ -172,6 +172,9 @@ public class RankUtils {
//Get our rank map //Get our rank map
HashMap<Integer, Integer> rankMap = subSkillRanks.get(skillName); HashMap<Integer, Integer> rankMap = subSkillRanks.get(skillName);
if(UserManager.getPlayer(player) == null)
return 0;
//Skill level of parent skill //Skill level of parent skill
int currentSkillLevel = UserManager.getPlayer(player).getSkillLevel(subSkillType.getParentSkill()); int currentSkillLevel = UserManager.getPlayer(player).getSkillLevel(subSkillType.getParentSkill());
@ -216,6 +219,9 @@ public class RankUtils {
//Get our rank map //Get our rank map
HashMap<Integer, Integer> rankMap = subSkillRanks.get(skillName); HashMap<Integer, Integer> rankMap = subSkillRanks.get(skillName);
if(UserManager.getPlayer(player) == null)
return 0;
//Skill level of parent skill //Skill level of parent skill
int currentSkillLevel = UserManager.getPlayer(player).getSkillLevel(abstractSubSkill.getPrimarySkill()); int currentSkillLevel = UserManager.getPlayer(player).getSkillLevel(abstractSubSkill.getPrimarySkill());

View File

@ -160,6 +160,11 @@ public class SkillUtils {
} }
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player); McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
//Not Loaded
if(mcMMOPlayer == null)
return;
PrimarySkillType skill = mcMMOPlayer.getAbilityMode(SuperAbilityType.SUPER_BREAKER) ? PrimarySkillType.MINING : PrimarySkillType.EXCAVATION; PrimarySkillType skill = mcMMOPlayer.getAbilityMode(SuperAbilityType.SUPER_BREAKER) ? PrimarySkillType.MINING : PrimarySkillType.EXCAVATION;
int abilityLengthVar = AdvancedConfig.getInstance().getAbilityLength(); int abilityLengthVar = AdvancedConfig.getInstance().getAbilityLength();

View File

@ -573,7 +573,7 @@ Commands.Chat.Console=*Console*
Commands.Cooldowns.Header=[[GOLD]]--= [[GREEN]]mcMMO Ability Cooldowns[[GOLD]] =-- Commands.Cooldowns.Header=[[GOLD]]--= [[GREEN]]mcMMO Ability Cooldowns[[GOLD]] =--
Commands.Cooldowns.Row.N=\ [[RED]]{0}[[WHITE]] - [[GOLD]]{1} seconds left Commands.Cooldowns.Row.N=\ [[RED]]{0}[[WHITE]] - [[GOLD]]{1} seconds left
Commands.Cooldowns.Row.Y=\ [[AQUA]]{0}[[WHITE]] - [[DARK_GREEN]]Ready! Commands.Cooldowns.Row.Y=\ [[AQUA]]{0}[[WHITE]] - [[DARK_GREEN]]Ready!
Commands.Database.Cooldown=You must wait {0} seconds before using this command again. Commands.Database.CooldownMS=You must wait {0} milliseconds before using this command again.
Commands.Database.Processing=Your previous command is still being processed. Please wait. Commands.Database.Processing=Your previous command is still being processed. Please wait.
Commands.Disabled=This command is disabled. Commands.Disabled=This command is disabled.
Commands.DoesNotExist= [[RED]]Player does not exist in the database! Commands.DoesNotExist= [[RED]]Player does not exist in the database!
@ -1072,6 +1072,7 @@ Scoreboard.Misc.Cooldown=[[LIGHT_PURPLE]]Cooldown
Scoreboard.Misc.Overall=[[GOLD]]Overall Scoreboard.Misc.Overall=[[GOLD]]Overall
Scoreboard.Misc.Ability=Super Ability Scoreboard.Misc.Ability=Super Ability
#DATABASE RECOVERY #DATABASE RECOVERY
Profile.PendingLoad=[[RED]]Your mcMMO player data has not yet been loaded.
Profile.Loading.Success=[[GREEN]]Your mcMMO profile has been loaded. Profile.Loading.Success=[[GREEN]]Your mcMMO profile has been loaded.
Profile.Loading.FailurePlayer=[[RED]]mcMMO is having trouble loading your data, we have attempted to load it [[GREEN]]{0}[[RED]] times.[[LIGHT_GRAY]] You may want to contact the server admins about this issue. mcMMO will attempt to load your data until you disconnect, you will not gain XP or be able to use skills while the data is not loaded. Profile.Loading.FailurePlayer=[[RED]]mcMMO is having trouble loading your data, we have attempted to load it [[GREEN]]{0}[[RED]] times.[[LIGHT_GRAY]] You may want to contact the server admins about this issue. mcMMO will attempt to load your data until you disconnect, you will not gain XP or be able to use skills while the data is not loaded.
Profile.Loading.FailureNotice=[[DARK_RED]][A][[RED]] mcMMO was unable to load the player data for [[YELLOW]]{0}[[RED]]. [[LIGHT_PURPLE]]Please inspect your database setup. Attempts made so far {1}. Profile.Loading.FailureNotice=[[DARK_RED]][A][[RED]] mcMMO was unable to load the player data for [[YELLOW]]{0}[[RED]]. [[LIGHT_PURPLE]]Please inspect your database setup. Attempts made so far {1}.

View File

@ -1281,6 +1281,8 @@ permissions:
default: false default: false
description: implies access to all mcmmo perks description: implies access to all mcmmo perks
children: children:
mcmmo.perks.bypass.salvageenchant: true
mcmmo.perks.bypass.repairenchant: true
mcmmo.perks.activationtime.all: true mcmmo.perks.activationtime.all: true
mcmmo.perks.cooldowns.all: true mcmmo.perks.cooldowns.all: true
mcmmo.perks.lucky.all: true mcmmo.perks.lucky.all: true
@ -1297,6 +1299,23 @@ permissions:
mcmmo.perks.activationtime.eightseconds: true mcmmo.perks.activationtime.eightseconds: true
mcmmo.perks.activationtime.fourseconds: true mcmmo.perks.activationtime.fourseconds: true
mcmmo.perks.activationtime.twelveseconds: true mcmmo.perks.activationtime.twelveseconds: true
mcmmo.perks.bypass.*:
default: false
description: Perks that bypass certain RNG elements and guarantee success
children:
mcmmo.perks.bypass.all: true
mcmmo.perks.bypass.all:
default: false
description: Perks that bypass certain RNG elements and guarantee success
children:
mcmmo.perks.bypass.repairenchant: true
mcmmo.perks.bypass.salvageenchant: true
mcmmo.perks.bypass.repairenchant:
default: false
description: Guarantees repairing without enchantment degradation
mcmmo.perks.bypass.salvageenchant:
default: false
description: Guarantees salvage will return the best legal enchantment book
mcmmo.perks.activationtime.eightseconds: mcmmo.perks.activationtime.eightseconds:
default: false default: false
description: Increases activation time by 8 seconds description: Increases activation time by 8 seconds