mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 06:36:45 +01:00
Merge 2.1.44
This commit is contained in:
commit
7e039321e1
@ -162,6 +162,30 @@ Version 2.2.0
|
||||
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 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
|
||||
(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
|
||||
|
25
README.md
25
README.md
@ -5,6 +5,7 @@
|
||||
I'm working on a brand new website for mcMMO
|
||||
|
||||
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.
|
||||
|
||||
@ -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.
|
||||
|
||||
## 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
|
||||
[![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)
|
||||
|
||||
### Developers
|
||||
### Former team members
|
||||
[![bm01](http://www.gravatar.com/avatar/ec8146f5358177f12e9a252271bbc391.png)](https://github.com/bm01)
|
||||
[![Glitchfinder](http://www.gravatar.com/avatar/5aa4cce22f72ae9c002ecec30f061d00.png)](https://github.com/Glitchfinder)
|
||||
[![NuclearW](http://www.gravatar.com/avatar/90926bdcf1c8a75918df5ea5fa801ce6.png)](https://github.com/NuclearW)
|
||||
[![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)
|
||||
[![t00thpick1](http://www.gravatar.com/avatar/ee23c7794a0c40120c3474287c7bce06.png)](https://github.com/t00thpick1)
|
||||
[![riking](https://1.gravatar.com/avatar/aca9f37e569ac3a63929920035a91ba4.png)](https://github.com/riking)
|
||||
|
||||
### Special thanks
|
||||
[![EasyMFnE](https://www.gravatar.com/avatar/99c9a1fa3bbf957791ceac7b45daadb0.png)](https://github.com/EasyMFnE)
|
||||
Added the Alchemy skill
|
||||
[![TheYeti](https://i.imgur.com/tzFrxdo.png)](https://github.com/TheYeti)
|
||||
|
||||
## Compiling
|
||||
|
||||
@ -46,5 +52,8 @@ The typical command used to build mcMMO is: `mvn clean package install`
|
||||
Required Libraries:
|
||||
* Bukkit
|
||||
* JUnit
|
||||
* WorldGuard 7
|
||||
* bStats Bukkit
|
||||
|
||||
http://spigot.mcmmo.org for more up to date information.
|
||||
https://www.spigotmc.org/resources/official-mcmmo-original-author-returns.64348/
|
||||
|
@ -1181,6 +1181,13 @@ public final class ExperienceAPI {
|
||||
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 {
|
||||
if (!UserManager.hasPlayerDataKey(player)) {
|
||||
throw new McMMOPlayerNotFoundException(player);
|
||||
|
@ -40,6 +40,9 @@ public final class PartyAPI {
|
||||
* @return true if the player is in a party, false otherwise
|
||||
*/
|
||||
public static boolean inParty(Player player) {
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
return false;
|
||||
|
||||
return UserManager.getPlayer(player).inParty();
|
||||
}
|
||||
|
||||
@ -78,6 +81,10 @@ public final class PartyAPI {
|
||||
*/
|
||||
@Deprecated
|
||||
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);
|
||||
|
||||
if (party == null) {
|
||||
@ -120,7 +127,12 @@ public final class PartyAPI {
|
||||
* @param partyName The party to add the player to
|
||||
* @param bypassLimit if true bypasses party size limits
|
||||
*/
|
||||
//TODO: bypasslimit not used?
|
||||
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);
|
||||
|
||||
if (party == null) {
|
||||
@ -138,6 +150,10 @@ public final class PartyAPI {
|
||||
* @param player The player to remove
|
||||
*/
|
||||
public static void removeFromParty(Player player) {
|
||||
//Check if player profile is loaded
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
return;
|
||||
|
||||
PartyManager.removeFromParty(UserManager.getPlayer(player));
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,6 @@ public class McMMOPlayerNotFoundException extends RuntimeException {
|
||||
private static final long serialVersionUID = 761917904993202836L;
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,10 @@ public class McnotifyCommand implements TabExecutor {
|
||||
case 0:
|
||||
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")));
|
||||
mcMMOPlayer.toggleChatNotifications();
|
||||
return true;
|
||||
|
@ -21,6 +21,10 @@ public class PartyChatCommand extends ChatCommand {
|
||||
String message;
|
||||
|
||||
if (sender instanceof Player) {
|
||||
//Check if player profile is loaded
|
||||
if(UserManager.getPlayer((Player) sender) == null)
|
||||
return;
|
||||
|
||||
party = UserManager.getPlayer((Player) sender).getParty();
|
||||
|
||||
if (party == null) {
|
||||
|
@ -24,6 +24,10 @@ public class AddxpCommand extends ExperienceCommand {
|
||||
@Override
|
||||
protected void handleCommand(Player player, PlayerProfile profile, PrimarySkillType skill, int value) {
|
||||
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);
|
||||
}
|
||||
else {
|
||||
|
@ -51,6 +51,14 @@ public abstract class ExperienceCommand implements TabExecutor {
|
||||
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]));
|
||||
return true;
|
||||
|
||||
|
@ -15,8 +15,17 @@ public class PartyAcceptCommand implements CommandExecutor {
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
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);
|
||||
|
||||
|
||||
if (!mcMMOPlayer.hasPartyInvite()) {
|
||||
sender.sendMessage(LocaleLoader.getString("mcMMO.NoInvites"));
|
||||
return true;
|
||||
|
@ -17,6 +17,13 @@ public class PartyChangeOwnerCommand implements CommandExecutor {
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
switch (args.length) {
|
||||
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();
|
||||
String targetName = CommandUtils.getMatchedPlayerName(args[1]);
|
||||
OfflinePlayer target = mcMMO.p.getServer().getOfflinePlayer(targetName);
|
||||
|
@ -11,6 +11,12 @@ import org.bukkit.entity.Player;
|
||||
public class PartyChangePasswordCommand implements CommandExecutor {
|
||||
@Override
|
||||
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();
|
||||
|
||||
switch (args.length) {
|
||||
|
@ -79,6 +79,12 @@ public class PartyCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
{
|
||||
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return true;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
if (args.length < 1) {
|
||||
@ -202,6 +208,14 @@ public class PartyCommand implements TabExecutor {
|
||||
|
||||
if (matches.size() == 0) {
|
||||
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();
|
||||
|
||||
playerNames = party.getOnlinePlayerNames(player);
|
||||
|
@ -18,6 +18,12 @@ public class PartyCreateCommand implements CommandExecutor {
|
||||
Player player = (Player) sender;
|
||||
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
|
||||
if (PartyManager.checkPartyExistence(player, args[1])) {
|
||||
return true;
|
||||
|
@ -15,6 +15,12 @@ public class PartyDisbandCommand implements CommandExecutor {
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
if(UserManager.getPlayer((Player) sender) == null)
|
||||
{
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return true;
|
||||
}
|
||||
|
||||
Party playerParty = UserManager.getPlayer((Player) sender).getParty();
|
||||
String partyName = playerParty.getName();
|
||||
|
||||
|
@ -22,6 +22,11 @@ public class PartyInfoCommand implements CommandExecutor {
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
case 1:
|
||||
if(UserManager.getPlayer((Player) sender) == null)
|
||||
{
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return true;
|
||||
}
|
||||
Player player = (Player) sender;
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
Party party = mcMMOPlayer.getParty();
|
||||
|
@ -25,6 +25,13 @@ public class PartyInviteCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
Player target = mcMMOTarget.getPlayer();
|
||||
|
||||
if(UserManager.getPlayer((Player) sender) == null)
|
||||
{
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
String playerName = player.getName();
|
||||
|
@ -17,6 +17,12 @@ import org.bukkit.entity.Player;
|
||||
public class PartyItemShareCommand implements CommandExecutor {
|
||||
@Override
|
||||
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();
|
||||
|
||||
if (party.getLevel() < PartyManager.getPartyFeatureUnlockLevel(PartyFeature.ITEM_SHARE)) {
|
||||
|
@ -33,6 +33,13 @@ public class PartyJoinCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
|
||||
if(UserManager.getPlayer((Player) sender) == null)
|
||||
{
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return true;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
Party targetParty = mcMMOTarget.getParty();
|
||||
|
||||
|
@ -18,6 +18,12 @@ public class PartyKickCommand implements CommandExecutor {
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
switch (args.length) {
|
||||
case 2:
|
||||
if(UserManager.getPlayer((Player) sender) == null)
|
||||
{
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return true;
|
||||
}
|
||||
|
||||
Party playerParty = UserManager.getPlayer((Player) sender).getParty();
|
||||
String targetName = CommandUtils.getMatchedPlayerName(args[1]);
|
||||
|
||||
|
@ -54,6 +54,12 @@ public class PartyLockCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
if (!Permissions.partySubcommand(sender, lock ? PartySubcommandType.LOCK : PartySubcommandType.UNLOCK)) {
|
||||
|
@ -17,6 +17,13 @@ public class PartyQuitCommand implements CommandExecutor {
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
Player player = (Player) sender;
|
||||
|
||||
if(UserManager.getPlayer((Player) sender) == null)
|
||||
{
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return true;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
Party playerParty = mcMMOPlayer.getParty();
|
||||
|
||||
|
@ -16,6 +16,12 @@ public class PartyRenameCommand implements CommandExecutor {
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
switch (args.length) {
|
||||
case 2:
|
||||
if(UserManager.getPlayer((Player) sender) == null)
|
||||
{
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return true;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer((Player) sender);
|
||||
Party playerParty = mcMMOPlayer.getParty();
|
||||
|
||||
|
@ -16,6 +16,12 @@ import org.bukkit.entity.Player;
|
||||
public class PartyXpShareCommand implements CommandExecutor {
|
||||
@Override
|
||||
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();
|
||||
|
||||
if (party.getLevel() < PartyManager.getPartyFeatureUnlockLevel(PartyFeature.XP_SHARE)) {
|
||||
|
@ -14,6 +14,11 @@ public class PartyAllianceAcceptCommand implements CommandExecutor {
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
switch (args.length) {
|
||||
case 2:
|
||||
if(UserManager.getPlayer((Player) sender) == null)
|
||||
{
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return true;
|
||||
}
|
||||
Player player = (Player) sender;
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
|
@ -36,6 +36,12 @@ public class PartyAllianceCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(UserManager.getPlayer((Player) sender) == null)
|
||||
{
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return true;
|
||||
}
|
||||
|
||||
player = (Player) sender;
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
|
@ -15,6 +15,11 @@ public class PartyAllianceDisbandCommand implements CommandExecutor {
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
switch (args.length) {
|
||||
case 2:
|
||||
if(UserManager.getPlayer((Player) sender) == null)
|
||||
{
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return true;
|
||||
}
|
||||
Player player = (Player) sender;
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
Party party = mcMMOPlayer.getParty();
|
||||
|
@ -24,6 +24,13 @@ public class PartyAllianceInviteCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
Player target = mcMMOTarget.getPlayer();
|
||||
|
||||
if(UserManager.getPlayer((Player) sender) == null)
|
||||
{
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
String playerName = player.getName();
|
||||
|
@ -20,6 +20,12 @@ public class PtpAcceptCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(UserManager.getPlayer((Player) sender) == null)
|
||||
{
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
PartyTeleportRecord ptpRecord = UserManager.getPlayer(player).getPartyTeleportRecord();
|
||||
|
||||
|
@ -58,6 +58,12 @@ public class PtpCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(UserManager.getPlayer((Player) sender) == null)
|
||||
{
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return true;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
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()));
|
||||
|
||||
if (matches.size() == 0) {
|
||||
if(UserManager.getPlayer((Player) sender) == null)
|
||||
{
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
@ -204,6 +216,18 @@ public class PtpCommand implements TabExecutor {
|
||||
}
|
||||
|
||||
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 mcMMOTarget = UserManager.getPlayer(targetPlayer);
|
||||
|
||||
|
@ -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);
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Cooldowns.Header"));
|
||||
|
@ -88,11 +88,19 @@ public class McrankCommand implements TabExecutor {
|
||||
|
||||
private void display(CommandSender sender, String playerName) {
|
||||
if (sender instanceof Player) {
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
||||
|
||||
if(mcMMOPlayer == null)
|
||||
{
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return;
|
||||
}
|
||||
|
||||
long cooldownMillis = Math.max(MainConfig.getInstance().getDatabasePlayerCooldown(), 1750);
|
||||
|
||||
if (mcMMOPlayer.getDatabaseATS() + cooldownMillis > System.currentTimeMillis()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Database.Cooldown"));
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Database.CooldownMS", getCDSeconds(mcMMOPlayer, cooldownMillis)));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -112,4 +120,8 @@ public class McrankCommand implements TabExecutor {
|
||||
|
||||
new McrankCommandAsyncTask(playerName, sender, useBoard, useChat).runTaskAsynchronously(mcMMO.p);
|
||||
}
|
||||
|
||||
private long getCDSeconds(McMMOPlayer mcMMOPlayer, long cooldownMillis) {
|
||||
return ((mcMMOPlayer.getDatabaseATS() + cooldownMillis) - System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,12 @@ public class McstatsCommand implements TabExecutor {
|
||||
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
if(UserManager.getPlayer((Player) sender) == null)
|
||||
{
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
|
||||
if (mcMMO.getScoreboardSettings().isScoreboardEnabled(ScoreboardManager.SidebarType.STATS_BOARD) && mcMMO.getScoreboardSettings().getScoreboardsEnabled()) {
|
||||
|
@ -30,6 +30,13 @@ public class AlchemyCommand extends SkillCommand {
|
||||
}
|
||||
|
||||
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();
|
||||
String[] displayValues = new String[2];
|
||||
|
||||
|
@ -84,7 +84,7 @@ public class RepairCommand extends SkillCommand {
|
||||
canRepairString = Permissions.repairMaterialType(player, ItemMaterialCategory.STRING);
|
||||
canRepairLeather = Permissions.repairMaterialType(player, ItemMaterialCategory.LEATHER);
|
||||
canRepairWood = Permissions.repairMaterialType(player, ItemMaterialCategory.WOOD);
|
||||
arcaneBypass = Permissions.arcaneBypass(player);
|
||||
arcaneBypass = (Permissions.arcaneBypass(player) || Permissions.hasRepairEnchantBypassPerk(player));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -56,6 +56,12 @@ public abstract class SkillCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(UserManager.getPlayer((Player) sender) == null)
|
||||
{
|
||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
Player player = (Player) sender;
|
||||
|
@ -541,7 +541,7 @@ public class McMMOPlayer {
|
||||
*/
|
||||
private void checkXp(PrimarySkillType primarySkillType, XPGainReason xpGainReason, XPGainSource xpGainSource) {
|
||||
if (getSkillXpLevelRaw(primarySkillType) < getXpToLevel(primarySkillType)) {
|
||||
UserManager.getPlayer(player).processPostXpEvent(xpGainReason, primarySkillType, mcMMO.p, xpGainSource);
|
||||
processPostXpEvent(xpGainReason, primarySkillType, mcMMO.p, xpGainSource);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -560,7 +560,7 @@ public class McMMOPlayer {
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -572,10 +572,10 @@ public class McMMOPlayer {
|
||||
* 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
|
||||
UserManager.getPlayer(player).processPostXpEvent(xpGainReason, primarySkillType, mcMMO.p, xpGainSource);
|
||||
processPostXpEvent(xpGainReason, primarySkillType, mcMMO.p, xpGainSource);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -67,6 +67,9 @@ public class Roll extends AcrobaticsSubSkill {
|
||||
//Grab the player
|
||||
McMMOPlayer mcMMOPlayer = EventUtils.getMcMMOPlayer(entityDamageEvent.getEntity());
|
||||
|
||||
if(mcMMOPlayer == null)
|
||||
break;
|
||||
|
||||
/*
|
||||
* Check for success
|
||||
*/
|
||||
|
@ -64,11 +64,10 @@ public class BlockListener implements Listener {
|
||||
if(is.getAmount() <= 0)
|
||||
continue;
|
||||
|
||||
if(!MainConfig.getInstance().getDoubleDropsEnabled(PrimarySkillType.MINING, is.getType())
|
||||
&& !MainConfig.getInstance().getDoubleDropsEnabled(PrimarySkillType.HERBALISM, is.getType())
|
||||
&& !MainConfig.getInstance().getDoubleDropsEnabled(PrimarySkillType.WOODCUTTING, is.getType()))
|
||||
if(!mcMMO.getConfigManager().getBonusDropManager().isBonusDropWhitelisted(is.getType()))
|
||||
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)
|
||||
{
|
||||
event.getBlock().getState().getWorld().dropItemNaturally(event.getBlockState().getLocation(), is);
|
||||
@ -283,11 +282,18 @@ public class BlockListener implements Listener {
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
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();
|
||||
if (blockState.getType() == Repair.getInstance().getAnvilMaterial()
|
||||
&& PrimarySkillType.REPAIR.getPermissions(player)) {
|
||||
if (mcMMOPlayer == null)
|
||||
return;
|
||||
|
||||
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);
|
||||
|
||||
//Check if profile is loaded
|
||||
if(mcMMOPlayer == null)
|
||||
return;
|
||||
|
||||
ItemStack heldItem = player.getInventory().getItemInMainHand();
|
||||
|
||||
/* HERBALISM */
|
||||
@ -455,6 +466,12 @@ public class BlockListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
//Profile not loaded
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
BlockState blockState = event.getBlock().getState();
|
||||
ItemStack heldItem = player.getInventory().getItemInMainHand();
|
||||
|
||||
@ -520,6 +537,12 @@ public class BlockListener implements Listener {
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
//Profile not loaded
|
||||
if(mcMMOPlayer == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* ABILITY PREPARATION CHECKS
|
||||
*
|
||||
@ -594,6 +617,13 @@ public class BlockListener implements Listener {
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
//Profile not loaded
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack heldItem = player.getInventory().getItemInMainHand();
|
||||
Block block = event.getBlock();
|
||||
BlockState blockState = block.getState();
|
||||
@ -629,6 +659,14 @@ public class BlockListener implements Listener {
|
||||
public void onBlockDamageCleanup(BlockDamageEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
//Profile not loaded
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
BlockState blockState = event.getBlock().getState();
|
||||
|
||||
ItemStack heldItem = player.getInventory().getItemInMainHand();
|
||||
@ -639,6 +677,12 @@ public class BlockListener implements Listener {
|
||||
}
|
||||
|
||||
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(mcMMO.getPlaceStore().isTrue(blockState))
|
||||
|
@ -476,6 +476,10 @@ public class EntityListener implements Listener {
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
//Profile not loaded
|
||||
if(mcMMOPlayer == null)
|
||||
return;
|
||||
|
||||
/* Check for invincibility */
|
||||
if (mcMMOPlayer.getGodMode()) {
|
||||
event.setCancelled(true);
|
||||
@ -507,6 +511,12 @@ public class EntityListener implements Listener {
|
||||
Player player = (Player) owner;
|
||||
Wolf wolf = (Wolf) pet;
|
||||
|
||||
//Profile not loaded
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
TamingManager tamingManager = UserManager.getPlayer(player).getTamingManager();
|
||||
|
||||
switch (cause) {
|
||||
@ -685,6 +695,12 @@ public class EntityListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
//Profile not loaded
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* WORLD GUARD MAIN FLAG CHECK */
|
||||
if(WorldGuardUtils.isWorldGuardLoaded())
|
||||
{
|
||||
@ -732,6 +748,12 @@ public class EntityListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
//Profile not loaded
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
MiningManager miningManager = UserManager.getPlayer(player).getMiningManager();
|
||||
|
||||
if (miningManager.canUseBlastMining()) {
|
||||
@ -781,6 +803,12 @@ public class EntityListener implements Listener {
|
||||
|
||||
Player player = (Player) entity;
|
||||
|
||||
//Profile not loaded
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* WORLD GUARD MAIN FLAG CHECK */
|
||||
if(WorldGuardUtils.isWorldGuardLoaded())
|
||||
{
|
||||
@ -885,10 +913,16 @@ public class EntityListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(mcMMO.getConfigManager().getConfigExploitPrevention().doTamedEntitiesGiveXP())
|
||||
entity.setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue);
|
||||
|
||||
//Profile not loaded
|
||||
//TODO: Redundant
|
||||
/*if(UserManager.getPlayer(player) == null)
|
||||
{
|
||||
return;
|
||||
}*/
|
||||
|
||||
UserManager.getPlayer(player).getTamingManager().awardTamingXP(entity);
|
||||
|
||||
}
|
||||
|
@ -57,6 +57,12 @@ public class InventoryListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
//Profile not loaded
|
||||
if(UserManager.getPlayer((Player) player) == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(!furnaceBlock.hasMetadata(mcMMO.furnaceMetadataKey) && furnaceBlock.getMetadata(mcMMO.furnaceMetadataKey).size() == 0)
|
||||
furnaceBlock.setMetadata(mcMMO.furnaceMetadataKey, UserManager.getPlayer((Player) player).getPlayerMetadata());
|
||||
}
|
||||
@ -109,6 +115,12 @@ public class InventoryListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
//Profile not loaded
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
event.setBurnTime(UserManager.getPlayer(player).getSmeltingManager().fuelEfficiency(event.getBurnTime()));
|
||||
}
|
||||
|
||||
@ -138,6 +150,12 @@ public class InventoryListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
//Profile not loaded
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
event.setResult(UserManager.getPlayer(player).getSmeltingManager().smeltProcessing(smelting, event.getResult()));
|
||||
}
|
||||
|
||||
@ -166,6 +184,12 @@ public class InventoryListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
//Profile not loaded
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int exp = UserManager.getPlayer(player).getSmeltingManager().vanillaXPBoost(event.getExpToDrop());
|
||||
event.setExpToDrop(exp);
|
||||
}
|
||||
@ -188,6 +212,12 @@ public class InventoryListener implements Listener {
|
||||
if (furnaceBlock.getMetadata(mcMMO.furnaceMetadataKey).size() > 0)
|
||||
furnaceBlock.removeMetadata(mcMMO.furnaceMetadataKey, mcMMO.p);
|
||||
|
||||
//Profile not loaded
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
furnaceBlock.setMetadata(mcMMO.furnaceMetadataKey, UserManager.getPlayer(player).getPlayerMetadata());
|
||||
}
|
||||
}
|
||||
|
@ -82,8 +82,17 @@ public class PlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
//Profile not loaded
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(mcMMO.getConfigManager().getConfigExploitPrevention().getConfigSectionExploitAcrobatics().isPreventAcrobaticsAbuse())
|
||||
UserManager.getPlayer(player).actualizeTeleportATS();
|
||||
|
||||
|
||||
UserManager.getPlayer(player).actualizeTeleportATS();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -188,6 +197,12 @@ public class PlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
//Profile not loaded
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
mcMMOPlayer.checkGodMode();
|
||||
@ -253,6 +268,12 @@ public class PlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
//Profile not loaded
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
FishingManager fishingManager = UserManager.getPlayer(player).getFishingManager();
|
||||
|
||||
switch (event.getState()) {
|
||||
@ -326,6 +347,12 @@ public class PlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
//Profile not loaded
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Entity caught = event.getCaught();
|
||||
FishingManager fishingManager = UserManager.getPlayer(player).getFishingManager();
|
||||
|
||||
@ -423,6 +450,12 @@ public class PlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
//Profile not loaded
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
Item drop = event.getItem();
|
||||
@ -474,6 +507,12 @@ public class PlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
//Profile not loaded
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
mcMMOPlayer.logout(false);
|
||||
}
|
||||
@ -530,6 +569,12 @@ public class PlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
//Profile not loaded
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UserManager.getPlayer(player).actualizeRespawnATS();
|
||||
}
|
||||
|
||||
@ -557,6 +602,12 @@ public class PlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
//Profile not loaded
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
MiningManager miningManager = mcMMOPlayer.getMiningManager();
|
||||
Block block = event.getClickedBlock();
|
||||
@ -660,6 +711,12 @@ public class PlayerListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
//Profile not loaded
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
ItemStack heldItem = player.getInventory().getItemInMainHand();
|
||||
|
||||
|
@ -111,6 +111,17 @@ public final class PartyManager {
|
||||
if(!mcMMO.getConfigManager().getConfigParty().isPartySystemEnabled())
|
||||
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 secondParty = UserManager.getPlayer(secondPlayer).getParty();
|
||||
@ -127,6 +138,17 @@ public final class PartyManager {
|
||||
if(!mcMMO.getConfigManager().getConfigParty().isPartySystemEnabled())
|
||||
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 secondParty = UserManager.getPlayer(secondPlayer).getParty();
|
||||
@ -294,6 +316,12 @@ public final class PartyManager {
|
||||
* @return the existing party, null otherwise
|
||||
*/
|
||||
public static Party getParty(Player player) {
|
||||
//Profile not loaded
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
return mcMMOPlayer.getParty();
|
||||
@ -353,7 +381,14 @@ public final class PartyManager {
|
||||
* @param party The party to remove
|
||||
*/
|
||||
public static void disbandParty(Party party) {
|
||||
//TODO: Potential issues with unloaded profile?
|
||||
for (Player member : party.getOnlineMembers()) {
|
||||
//Profile not loaded
|
||||
if(UserManager.getPlayer(member) == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
processPartyLeaving(UserManager.getPlayer(member));
|
||||
}
|
||||
|
||||
|
@ -50,6 +50,12 @@ public final class ShareHandler {
|
||||
float splitXp = (float) (xp / partySize * shareBonus);
|
||||
|
||||
for (Player member : nearMembers) {
|
||||
//Profile not loaded
|
||||
if(UserManager.getPlayer(member) == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
UserManager.getPlayer(member).beginUnsharedXpGain(primarySkillType, splitXp, xpGainReason, XPGainSource.PARTY_MEMBERS);
|
||||
}
|
||||
|
||||
@ -107,6 +113,13 @@ public final class ShareHandler {
|
||||
|
||||
for (Player member : nearMembers) {
|
||||
McMMOPlayer mcMMOMember = UserManager.getPlayer(member);
|
||||
|
||||
//Profile not loaded
|
||||
if(UserManager.getPlayer(member) == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
int itemShareModifier = mcMMOMember.getItemShareModifier();
|
||||
int diceRoll = Misc.getRandom().nextInt(itemShareModifier);
|
||||
|
||||
|
@ -35,7 +35,11 @@ public class AlchemyBrewTask extends BukkitRunnable {
|
||||
brewSpeed = 1.0;
|
||||
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));
|
||||
|
||||
McMMOPlayerCatalysisEvent event = new McMMOPlayerCatalysisEvent(player, catalysis);
|
||||
|
@ -90,7 +90,12 @@ public final class AlchemyPotionBrewer {
|
||||
}
|
||||
|
||||
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) {
|
||||
@ -139,6 +144,7 @@ public final class AlchemyPotionBrewer {
|
||||
if (output != null && player != null) {
|
||||
PotionStage potionStage = PotionStage.getPotionStage(input, output);
|
||||
|
||||
//TODO: hmm
|
||||
if (UserManager.hasPlayerDataKey(player)) {
|
||||
UserManager.getPlayer(player).getAlchemyManager().handlePotionBrewSuccesses(potionStage, 1);
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
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.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
@ -90,7 +89,8 @@ public class ArcheryManager extends SkillManager {
|
||||
defender.teleport(dazedLocation);
|
||||
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");
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,6 @@ import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
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.skills.*;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
@ -95,7 +94,7 @@ public class AxesManager extends SkillManager {
|
||||
if (target instanceof Player) {
|
||||
Player defender = (Player) target;
|
||||
|
||||
if (UserManager.getPlayer(defender).useChatNotifications()) {
|
||||
if (NotificationManager.doesPlayerUseNotifications(defender)) {
|
||||
NotificationManager.sendPlayerInformation(defender, NotificationType.SUBSKILL_MESSAGE, "Axes.Combat.CritStruck");
|
||||
}
|
||||
|
||||
@ -152,7 +151,7 @@ public class AxesManager extends SkillManager {
|
||||
if (target instanceof Player) {
|
||||
Player defender = (Player) target;
|
||||
|
||||
if (UserManager.getPlayer(defender).useChatNotifications()) {
|
||||
if (NotificationManager.doesPlayerUseNotifications(defender)) {
|
||||
NotificationManager.sendPlayerInformation(defender, NotificationType.SUBSKILL_MESSAGE, "Axes.Combat.GI.Struck");
|
||||
}
|
||||
}
|
||||
|
@ -103,6 +103,11 @@ public class BlastMining {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(UserManager.getPlayer(defender) == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
MiningManager miningManager = UserManager.getPlayer(defender).getMiningManager();
|
||||
|
||||
if (!miningManager.canUseDemolitionsExpertise()) {
|
||||
|
@ -147,8 +147,7 @@ public class RepairManager extends SkillManager {
|
||||
}
|
||||
|
||||
// Handle the enchants
|
||||
// if (ArcaneForging.arcaneForgingEnchantLoss) {
|
||||
if (mcMMO.getConfigManager().getConfigRepair().getArcaneForging().isMayLoseEnchants()) {
|
||||
if (mcMMO.getConfigManager().getConfigRepair().getArcaneForging().isMayLoseEnchants() && !Permissions.hasRepairEnchantBypassPerk(player)) {
|
||||
addEnchants(item);
|
||||
}
|
||||
|
||||
|
@ -179,6 +179,9 @@ public class SalvageManager extends SkillManager {
|
||||
}*/
|
||||
|
||||
public double getExtractFullEnchantChance() {
|
||||
if(Permissions.hasSalvageEnchantBypassPerk(getPlayer()))
|
||||
return 100.0D;
|
||||
|
||||
return AdvancedConfig.getInstance().getArcaneSalvageExtractFullEnchantsChance(getArcaneSalvageRank());
|
||||
}
|
||||
|
||||
@ -198,10 +201,11 @@ public class SalvageManager extends SkillManager {
|
||||
EnchantmentStorageMeta enchantMeta = (EnchantmentStorageMeta) book.getItemMeta();
|
||||
|
||||
boolean downgraded = false;
|
||||
boolean arcaneFailure = false;
|
||||
int arcaneFailureCount = 0;
|
||||
|
||||
for (Entry<Enchantment, Integer> enchant : enchants.entrySet()) {
|
||||
if (!Salvage.arcaneSalvageEnchantLoss
|
||||
|| Permissions.hasSalvageEnchantBypassPerk(player)
|
||||
|| RandomChanceUtil.checkRandomChanceExecutionSuccess(new RandomChanceSkillStatic(getExtractFullEnchantChance(), getPlayer(), SubSkillType.SALVAGE_ARCANE_SALVAGE))) {
|
||||
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))) {
|
||||
enchantMeta.addStoredEnchant(enchant.getKey(), enchant.getValue() - 1, true);
|
||||
downgraded = true;
|
||||
}
|
||||
else {
|
||||
arcaneFailure = true;
|
||||
downgraded = true;
|
||||
} else {
|
||||
arcaneFailureCount++;
|
||||
}
|
||||
}
|
||||
|
||||
if(!arcaneFailure)
|
||||
if(failedAllEnchants(arcaneFailureCount, enchants.entrySet().size()))
|
||||
{
|
||||
Map<Enchantment, Integer> newEnchants = enchantMeta.getStoredEnchants();
|
||||
|
||||
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");
|
||||
}
|
||||
NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, "Salvage.Skills.ArcaneFailed");
|
||||
return null;
|
||||
} else if(downgraded)
|
||||
{
|
||||
NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE_FAILED, "Salvage.Skills.ArcanePartial");
|
||||
}
|
||||
|
||||
book.setItemMeta(enchantMeta);
|
||||
return book;
|
||||
}
|
||||
|
||||
private boolean failedAllEnchants(int arcaneFailureCount, int size) {
|
||||
return arcaneFailureCount == size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the player has tried to use an Anvil before.
|
||||
* @param actualize
|
||||
|
@ -12,7 +12,6 @@ import com.gmail.nossr50.skills.SkillManager;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
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.skills.CombatUtils;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
@ -71,7 +70,7 @@ public class SwordsManager extends SkillManager {
|
||||
if(defender.isBlocking())
|
||||
return;
|
||||
|
||||
if (UserManager.getPlayer(defender).useChatNotifications()) {
|
||||
if (NotificationManager.doesPlayerUseNotifications(defender)) {
|
||||
if(!BleedTimerTask.isBleeding(defender))
|
||||
NotificationManager.sendPlayerInformation(defender, NotificationType.SUBSKILL_MESSAGE, "Swords.Combat.Bleeding.Started");
|
||||
}
|
||||
|
@ -17,7 +17,6 @@ import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
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.RandomChanceUtil;
|
||||
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
|
||||
@ -225,7 +224,7 @@ public class TamingManager extends SkillManager {
|
||||
if (target instanceof Player) {
|
||||
Player defender = (Player) target;
|
||||
|
||||
if (UserManager.getPlayer(defender).useChatNotifications()) {
|
||||
if (NotificationManager.doesPlayerUseNotifications(defender)) {
|
||||
NotificationManager.sendPlayerInformation(defender, NotificationType.SUBSKILL_MESSAGE, "Taming.SubSkill.Pummel.TargetMessage");
|
||||
}
|
||||
}
|
||||
|
@ -101,6 +101,9 @@ public class UnarmedManager extends SkillManager {
|
||||
return;
|
||||
}
|
||||
|
||||
if(UserManager.getPlayer(defender) == null)
|
||||
return;
|
||||
|
||||
Item item = Misc.dropItem(defender.getLocation(), defender.getInventory().getItemInMainHand());
|
||||
|
||||
if (item != null && AdvancedConfig.getInstance().getDisarmProtected()) {
|
||||
|
@ -54,6 +54,10 @@ public final class ChimaeraWing {
|
||||
|
||||
mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
//Not loaded
|
||||
if(mcMMOPlayer == null)
|
||||
return;
|
||||
|
||||
if (mcMMOPlayer.getTeleportCommenceLocation() != null) {
|
||||
return;
|
||||
}
|
||||
|
@ -120,11 +120,16 @@ public class EventUtils {
|
||||
Player player = (Player) entity;
|
||||
|
||||
if (!UserManager.hasPlayerDataKey(player)) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
if(mcMMOPlayer == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Check for invincibility */
|
||||
if (mcMMOPlayer.getGodMode()) {
|
||||
entityDamageEvent.setCancelled(true);
|
||||
@ -240,6 +245,9 @@ public class EventUtils {
|
||||
public static void handlePartyTeleportEvent(Player teleportingPlayer, Player targetPlayer) {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(teleportingPlayer);
|
||||
|
||||
if(mcMMOPlayer == null)
|
||||
return;
|
||||
|
||||
McMMOPartyTeleportEvent event = new McMMOPartyTeleportEvent(teleportingPlayer, targetPlayer, mcMMOPlayer.getParty().getName());
|
||||
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) {
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
return true;
|
||||
|
||||
McMMOPlayerStatLossEvent event = new McMMOPlayerStatLossEvent(player, levelChanged, experienceChanged);
|
||||
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
@ -344,6 +355,15 @@ public class EventUtils {
|
||||
HashMap<String, Float> experienceChangedVictim = eventVictim.getExperienceChanged();
|
||||
|
||||
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();
|
||||
|
||||
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
|
||||
|
@ -17,6 +17,9 @@ public final class HardcoreManager {
|
||||
double statLossPercentage = MainConfig.getInstance().getHardcoreDeathStatPenaltyPercentage();
|
||||
int levelThreshold = MainConfig.getInstance().getHardcoreDeathStatPenaltyLevelThreshold();
|
||||
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
return;
|
||||
|
||||
PlayerProfile playerProfile = UserManager.getPlayer(player).getProfile();
|
||||
int totalLevelsLost = 0;
|
||||
|
||||
@ -59,6 +62,9 @@ public final class HardcoreManager {
|
||||
double vampirismStatLeechPercentage = MainConfig.getInstance().getHardcoreVampirismStatLeechPercentage();
|
||||
int levelThreshold = MainConfig.getInstance().getHardcoreVampirismLevelThreshold();
|
||||
|
||||
if(UserManager.getPlayer(killer) == null || UserManager.getPlayer(victim) == null)
|
||||
return;
|
||||
|
||||
PlayerProfile killerProfile = UserManager.getPlayer(killer).getProfile();
|
||||
PlayerProfile victimProfile = UserManager.getPlayer(victim).getProfile();
|
||||
int totalLevelsStolen = 0;
|
||||
|
@ -106,6 +106,11 @@ public final class Permissions {
|
||||
* 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()); }
|
||||
|
||||
/* XP PERKS */
|
||||
|
@ -228,6 +228,9 @@ public final class CommandUtils {
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
List<String> displayData = new ArrayList<>();
|
||||
|
@ -28,7 +28,7 @@ public class NotificationManager {
|
||||
*/
|
||||
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;
|
||||
|
||||
ChatMessageType destination = AdvancedConfig.getInstance().doesNotificationUseActionBar(notificationType) ? ChatMessageType.ACTION_BAR : ChatMessageType.SYSTEM;
|
||||
@ -39,6 +39,15 @@ public class NotificationManager {
|
||||
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
|
||||
* 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)
|
||||
{
|
||||
if(!UserManager.getPlayer(player).useChatNotifications())
|
||||
if(UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())
|
||||
return;
|
||||
|
||||
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)
|
||||
{
|
||||
if(!UserManager.getPlayer(mcMMOPlayer.getPlayer()).useChatNotifications())
|
||||
if(!mcMMOPlayer.useChatNotifications())
|
||||
return;
|
||||
|
||||
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)
|
||||
{
|
||||
if(!UserManager.getPlayer(mcMMOPlayer.getPlayer()).useChatNotifications())
|
||||
if(!mcMMOPlayer.useChatNotifications())
|
||||
return;
|
||||
|
||||
//CHAT MESSAGE
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.gmail.nossr50.util.player;
|
||||
|
||||
import com.gmail.nossr50.api.exceptions.McMMOPlayerNotFoundException;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
@ -95,9 +96,14 @@ public final class UserManager {
|
||||
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) {
|
||||
//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();
|
||||
else
|
||||
return null;
|
||||
|
@ -204,6 +204,9 @@ public class ScoreboardWrapper {
|
||||
// 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));
|
||||
|
||||
if(UserManager.getPlayer(playerName) == null)
|
||||
return;
|
||||
|
||||
PlayerProfile profile = UserManager.getPlayer(player).getProfile();
|
||||
|
||||
if (profile.getScoreboardTipsShown() >= mcMMO.getScoreboardSettings().getTipsAmount()) {
|
||||
@ -434,6 +437,9 @@ public class ScoreboardWrapper {
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
if(mcMMOPlayer == null)
|
||||
return;
|
||||
|
||||
switch (sidebarType) {
|
||||
|
||||
case SKILL_BOARD:
|
||||
|
@ -629,6 +629,10 @@ public final class CombatUtils {
|
||||
if (entity instanceof Player) {
|
||||
Player defender = (Player) entity;
|
||||
|
||||
//TODO: NPC Interaction?
|
||||
if(UserManager.getPlayer(defender) == null)
|
||||
return true;
|
||||
|
||||
if (!defender.getWorld().getPVP() || defender == player || UserManager.getPlayer(defender).getGodMode()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -172,6 +172,9 @@ public class RankUtils {
|
||||
//Get our rank map
|
||||
HashMap<Integer, Integer> rankMap = subSkillRanks.get(skillName);
|
||||
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
return 0;
|
||||
|
||||
//Skill level of parent skill
|
||||
int currentSkillLevel = UserManager.getPlayer(player).getSkillLevel(subSkillType.getParentSkill());
|
||||
|
||||
@ -216,6 +219,9 @@ public class RankUtils {
|
||||
//Get our rank map
|
||||
HashMap<Integer, Integer> rankMap = subSkillRanks.get(skillName);
|
||||
|
||||
if(UserManager.getPlayer(player) == null)
|
||||
return 0;
|
||||
|
||||
//Skill level of parent skill
|
||||
int currentSkillLevel = UserManager.getPlayer(player).getSkillLevel(abstractSubSkill.getPrimarySkill());
|
||||
|
||||
|
@ -160,6 +160,11 @@ public class SkillUtils {
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
//Not Loaded
|
||||
if(mcMMOPlayer == null)
|
||||
return;
|
||||
|
||||
PrimarySkillType skill = mcMMOPlayer.getAbilityMode(SuperAbilityType.SUPER_BREAKER) ? PrimarySkillType.MINING : PrimarySkillType.EXCAVATION;
|
||||
|
||||
int abilityLengthVar = AdvancedConfig.getInstance().getAbilityLength();
|
||||
|
@ -573,7 +573,7 @@ Commands.Chat.Console=*Console*
|
||||
Commands.Cooldowns.Header=[[GOLD]]--= [[GREEN]]mcMMO Ability Cooldowns[[GOLD]] =--
|
||||
Commands.Cooldowns.Row.N=\ [[RED]]{0}[[WHITE]] - [[GOLD]]{1} seconds left
|
||||
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.Disabled=This command is disabled.
|
||||
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.Ability=Super Ability
|
||||
#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.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}.
|
||||
|
@ -1281,6 +1281,8 @@ permissions:
|
||||
default: false
|
||||
description: implies access to all mcmmo perks
|
||||
children:
|
||||
mcmmo.perks.bypass.salvageenchant: true
|
||||
mcmmo.perks.bypass.repairenchant: true
|
||||
mcmmo.perks.activationtime.all: true
|
||||
mcmmo.perks.cooldowns.all: true
|
||||
mcmmo.perks.lucky.all: true
|
||||
@ -1297,6 +1299,23 @@ permissions:
|
||||
mcmmo.perks.activationtime.eightseconds: true
|
||||
mcmmo.perks.activationtime.fourseconds: 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:
|
||||
default: false
|
||||
description: Increases activation time by 8 seconds
|
||||
|
Loading…
Reference in New Issue
Block a user