mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-24 22:26:46 +01:00
more work on parties and user data
This commit is contained in:
parent
0bb65e66e8
commit
3cb63202a3
@ -11,35 +11,35 @@ public final class AbilityAPI {
|
|||||||
private AbilityAPI() {}
|
private AbilityAPI() {}
|
||||||
|
|
||||||
public static boolean berserkEnabled(Player player) {
|
public static boolean berserkEnabled(Player player) {
|
||||||
return mcMMO.getUserManager().queryMcMMOPlayer(player).getSuperAbilityManager().getAbilityMode(SuperAbilityType.BERSERK);
|
return mcMMO.getUserManager().queryPlayer(player).getSuperAbilityManager().getAbilityMode(SuperAbilityType.BERSERK);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean gigaDrillBreakerEnabled(Player player) {
|
public static boolean gigaDrillBreakerEnabled(Player player) {
|
||||||
return mcMMO.getUserManager().queryMcMMOPlayer(player).getSuperAbilityManager().getAbilityMode(SuperAbilityType.GIGA_DRILL_BREAKER);
|
return mcMMO.getUserManager().queryPlayer(player).getSuperAbilityManager().getAbilityMode(SuperAbilityType.GIGA_DRILL_BREAKER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean greenTerraEnabled(Player player) {
|
public static boolean greenTerraEnabled(Player player) {
|
||||||
return mcMMO.getUserManager().queryMcMMOPlayer(player).getSuperAbilityManager().getAbilityMode(SuperAbilityType.GREEN_TERRA);
|
return mcMMO.getUserManager().queryPlayer(player).getSuperAbilityManager().getAbilityMode(SuperAbilityType.GREEN_TERRA);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean serratedStrikesEnabled(Player player) {
|
public static boolean serratedStrikesEnabled(Player player) {
|
||||||
return mcMMO.getUserManager().queryMcMMOPlayer(player).getSuperAbilityManager().getAbilityMode(SuperAbilityType.SERRATED_STRIKES);
|
return mcMMO.getUserManager().queryPlayer(player).getSuperAbilityManager().getAbilityMode(SuperAbilityType.SERRATED_STRIKES);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean skullSplitterEnabled(Player player) {
|
public static boolean skullSplitterEnabled(Player player) {
|
||||||
return mcMMO.getUserManager().queryMcMMOPlayer(player).getSuperAbilityManager().getAbilityMode(SuperAbilityType.SKULL_SPLITTER);
|
return mcMMO.getUserManager().queryPlayer(player).getSuperAbilityManager().getAbilityMode(SuperAbilityType.SKULL_SPLITTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean superBreakerEnabled(Player player) {
|
public static boolean superBreakerEnabled(Player player) {
|
||||||
return mcMMO.getUserManager().queryMcMMOPlayer(player).getSuperAbilityManager().getAbilityMode(SuperAbilityType.SUPER_BREAKER);
|
return mcMMO.getUserManager().queryPlayer(player).getSuperAbilityManager().getAbilityMode(SuperAbilityType.SUPER_BREAKER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean treeFellerEnabled(Player player) {
|
public static boolean treeFellerEnabled(Player player) {
|
||||||
return mcMMO.getUserManager().queryMcMMOPlayer(player).getSuperAbilityManager().getAbilityMode(SuperAbilityType.TREE_FELLER);
|
return mcMMO.getUserManager().queryPlayer(player).getSuperAbilityManager().getAbilityMode(SuperAbilityType.TREE_FELLER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isAnyAbilityEnabled(Player player) {
|
public static boolean isAnyAbilityEnabled(Player player) {
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||||
|
|
||||||
for (SuperAbilityType ability : SuperAbilityType.values()) {
|
for (SuperAbilityType ability : SuperAbilityType.values()) {
|
||||||
if (mmoPlayer.getSuperAbilityManager().getAbilityMode(ability)) {
|
if (mmoPlayer.getSuperAbilityManager().getAbilityMode(ability)) {
|
||||||
@ -51,35 +51,35 @@ public final class AbilityAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void resetCooldowns(Player player) {
|
public static void resetCooldowns(Player player) {
|
||||||
mcMMO.getUserManager().queryMcMMOPlayer(player).getPersistentPlayerData().resetCooldowns();
|
mcMMO.getUserManager().queryPlayer(player).getPersistentPlayerData().resetCooldowns();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setBerserkCooldown(Player player, long cooldown) {
|
public static void setBerserkCooldown(Player player, long cooldown) {
|
||||||
mcMMO.getUserManager().queryMcMMOPlayer(player).getPersistentPlayerData().setAbilityDATS(SuperAbilityType.BERSERK, cooldown);
|
mcMMO.getUserManager().queryPlayer(player).getPersistentPlayerData().setAbilityDATS(SuperAbilityType.BERSERK, cooldown);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setGigaDrillBreakerCooldown(Player player, long cooldown) {
|
public static void setGigaDrillBreakerCooldown(Player player, long cooldown) {
|
||||||
mcMMO.getUserManager().queryMcMMOPlayer(player).getPersistentPlayerData().setAbilityDATS(SuperAbilityType.GIGA_DRILL_BREAKER, cooldown);
|
mcMMO.getUserManager().queryPlayer(player).getPersistentPlayerData().setAbilityDATS(SuperAbilityType.GIGA_DRILL_BREAKER, cooldown);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setGreenTerraCooldown(Player player, long cooldown) {
|
public static void setGreenTerraCooldown(Player player, long cooldown) {
|
||||||
mcMMO.getUserManager().queryMcMMOPlayer(player).getPersistentPlayerData().setAbilityDATS(SuperAbilityType.GREEN_TERRA, cooldown);
|
mcMMO.getUserManager().queryPlayer(player).getPersistentPlayerData().setAbilityDATS(SuperAbilityType.GREEN_TERRA, cooldown);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setSerratedStrikesCooldown(Player player, long cooldown) {
|
public static void setSerratedStrikesCooldown(Player player, long cooldown) {
|
||||||
mcMMO.getUserManager().queryMcMMOPlayer(player).getPersistentPlayerData().setAbilityDATS(SuperAbilityType.SERRATED_STRIKES, cooldown);
|
mcMMO.getUserManager().queryPlayer(player).getPersistentPlayerData().setAbilityDATS(SuperAbilityType.SERRATED_STRIKES, cooldown);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setSkullSplitterCooldown(Player player, long cooldown) {
|
public static void setSkullSplitterCooldown(Player player, long cooldown) {
|
||||||
mcMMO.getUserManager().queryMcMMOPlayer(player).getPersistentPlayerData().setAbilityDATS(SuperAbilityType.SKULL_SPLITTER, cooldown);
|
mcMMO.getUserManager().queryPlayer(player).getPersistentPlayerData().setAbilityDATS(SuperAbilityType.SKULL_SPLITTER, cooldown);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setSuperBreakerCooldown(Player player, long cooldown) {
|
public static void setSuperBreakerCooldown(Player player, long cooldown) {
|
||||||
mcMMO.getUserManager().queryMcMMOPlayer(player).getPersistentPlayerData().setAbilityDATS(SuperAbilityType.SUPER_BREAKER, cooldown);
|
mcMMO.getUserManager().queryPlayer(player).getPersistentPlayerData().setAbilityDATS(SuperAbilityType.SUPER_BREAKER, cooldown);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setTreeFellerCooldown(Player player, long cooldown) {
|
public static void setTreeFellerCooldown(Player player, long cooldown) {
|
||||||
mcMMO.getUserManager().queryMcMMOPlayer(player).getPersistentPlayerData().setAbilityDATS(SuperAbilityType.TREE_FELLER, cooldown);
|
mcMMO.getUserManager().queryPlayer(player).getPersistentPlayerData().setAbilityDATS(SuperAbilityType.TREE_FELLER, cooldown);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isBleeding(LivingEntity entity) {
|
public static boolean isBleeding(LivingEntity entity) {
|
||||||
|
@ -20,7 +20,7 @@ public final class ChatAPI {
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static boolean isUsingPartyChat(@NotNull Player player) {
|
public static boolean isUsingPartyChat(@NotNull Player player) {
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||||
|
|
||||||
if(mmoPlayer != null)
|
if(mmoPlayer != null)
|
||||||
return mmoPlayer.getChatChannel() == ChatChannel.PARTY;
|
return mmoPlayer.getChatChannel() == ChatChannel.PARTY;
|
||||||
@ -63,7 +63,7 @@ public final class ChatAPI {
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static boolean isUsingAdminChat(@NotNull Player player) {
|
public static boolean isUsingAdminChat(@NotNull Player player) {
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||||
|
|
||||||
if(mmoPlayer != null)
|
if(mmoPlayer != null)
|
||||||
return mmoPlayer.getChatChannel() == ChatChannel.ADMIN;
|
return mmoPlayer.getChatChannel() == ChatChannel.ADMIN;
|
||||||
@ -114,7 +114,7 @@ public final class ChatAPI {
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void togglePartyChat(Player player) throws NullPointerException {
|
public static void togglePartyChat(Player player) throws NullPointerException {
|
||||||
mcMMO.p.getChatManager().setOrToggleChatChannel(Objects.requireNonNull(mcMMO.getUserManager().queryMcMMOPlayer(player)), ChatChannel.PARTY);
|
mcMMO.p.getChatManager().setOrToggleChatChannel(Objects.requireNonNull(mcMMO.getUserManager().queryPlayer(player)), ChatChannel.PARTY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -145,7 +145,7 @@ public final class ChatAPI {
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void toggleAdminChat(Player player) throws NullPointerException {
|
public static void toggleAdminChat(Player player) throws NullPointerException {
|
||||||
mcMMO.p.getChatManager().setOrToggleChatChannel(Objects.requireNonNull(mcMMO.getUserManager().queryMcMMOPlayer(player)), ChatChannel.ADMIN);
|
mcMMO.p.getChatManager().setOrToggleChatChannel(Objects.requireNonNull(mcMMO.getUserManager().queryPlayer(player)), ChatChannel.ADMIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1217,6 +1217,6 @@ public final class ExperienceAPI {
|
|||||||
throw new McMMOPlayerNotFoundException(player);
|
throw new McMMOPlayerNotFoundException(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
return mcMMO.getUserManager().queryMcMMOPlayer(player);
|
return mcMMO.getUserManager().queryPlayer(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ public final class PartyAPI {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return mcMMO.getUserManager().queryMcMMOPlayer(player).getParty().getName();
|
return mcMMO.getUserManager().queryPlayer(player).getParty().getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -38,10 +38,10 @@ 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(mcMMO.getUserManager().queryMcMMOPlayer(player) == null)
|
if(mcMMO.getUserManager().queryPlayer(player) == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return mcMMO.getUserManager().queryMcMMOPlayer(player).inParty();
|
return mcMMO.getUserManager().queryPlayer(player).inParty();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -80,7 +80,7 @@ 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
|
//Check if player profile is loaded
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(player) == null)
|
if(mcMMO.getUserManager().queryPlayer(player) == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Party party = mcMMO.getPartyManager().getParty(partyName);
|
Party party = mcMMO.getPartyManager().getParty(partyName);
|
||||||
@ -95,7 +95,7 @@ public final class PartyAPI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mcMMO.getPartyManager().addToParty(mcMMO.getUserManager().queryMcMMOPlayer(player), party);
|
mcMMO.getPartyManager().addToParty(mcMMO.getUserManager().queryPlayer(player), party);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -120,7 +120,7 @@ public final class PartyAPI {
|
|||||||
//TODO: bypasslimit not used?
|
//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
|
//Check if player profile is loaded
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(player) == null)
|
if(mcMMO.getUserManager().queryPlayer(player) == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Party party = mcMMO.getPartyManager().getParty(partyName);
|
Party party = mcMMO.getPartyManager().getParty(partyName);
|
||||||
@ -129,7 +129,7 @@ public final class PartyAPI {
|
|||||||
party = new Party(new PartyLeader(player.getUniqueId(), player.getName()), partyName);
|
party = new Party(new PartyLeader(player.getUniqueId(), player.getName()), partyName);
|
||||||
}
|
}
|
||||||
|
|
||||||
mcMMO.getPartyManager().addToParty(mcMMO.getUserManager().queryMcMMOPlayer(player), party);
|
mcMMO.getPartyManager().addToParty(mcMMO.getUserManager().queryPlayer(player), party);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -141,10 +141,10 @@ public final class PartyAPI {
|
|||||||
*/
|
*/
|
||||||
public static void removeFromParty(Player player) {
|
public static void removeFromParty(Player player) {
|
||||||
//Check if player profile is loaded
|
//Check if player profile is loaded
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(player) == null)
|
if(mcMMO.getUserManager().queryPlayer(player) == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mcMMO.getPartyManager().removeFromParty(mcMMO.getUserManager().queryMcMMOPlayer(player));
|
mcMMO.getPartyManager().removeFromParty(mcMMO.getUserManager().queryPlayer(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -21,7 +21,7 @@ public class McnotifyCommand implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer((Player) sender);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer((Player) sender);
|
||||||
|
|
||||||
//Not Loaded yet
|
//Not Loaded yet
|
||||||
if (mmoPlayer == null)
|
if (mmoPlayer == null)
|
||||||
|
@ -22,7 +22,7 @@ public class DatabaseRemovePlayerCommand implements TabExecutor {
|
|||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
|
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
|
||||||
|
|
||||||
if (mcMMO.getUserManager().getOfflinePlayer(playerName) == null
|
if (mcMMO.getUserManager().queryPlayerName(playerName) == null
|
||||||
&& CommandUtils.hasNoProfile(sender, mcMMO.getDatabaseManager().queryPlayerDataByUUID(playerName, false))) {
|
&& CommandUtils.hasNoProfile(sender, mcMMO.getDatabaseManager().queryPlayerDataByUUID(playerName, false))) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.Offline"));
|
sender.sendMessage(LocaleLoader.getString("Commands.Offline"));
|
||||||
return true;
|
return true;
|
||||||
|
@ -91,7 +91,7 @@ public abstract class ExperienceCommand implements TabExecutor {
|
|||||||
int value = Integer.parseInt(args[2]);
|
int value = Integer.parseInt(args[2]);
|
||||||
|
|
||||||
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
|
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().getOfflinePlayer(playerName);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayerName(playerName);
|
||||||
|
|
||||||
// If the mmoPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process.
|
// If the mmoPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process.
|
||||||
if (mmoPlayer == null) {
|
if (mmoPlayer == null) {
|
||||||
|
@ -73,7 +73,7 @@ public class SkillresetCommand implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
|
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().getOfflinePlayer(playerName);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayerName(playerName);
|
||||||
|
|
||||||
// If the mmoPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process.
|
// If the mmoPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process.
|
||||||
if (mmoPlayer == null) {
|
if (mmoPlayer == null) {
|
||||||
|
@ -16,12 +16,12 @@ public class PartyAcceptCommand implements CommandExecutor {
|
|||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
//Check if player profile is loaded
|
//Check if player profile is loaded
|
||||||
if (mcMMO.getUserManager().queryMcMMOPlayer(player) == null) {
|
if (mcMMO.getUserManager().queryPlayer(player) == null) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||||
|
|
||||||
|
|
||||||
if (!mmoPlayer.hasPartyInvite()) {
|
if (!mmoPlayer.hasPartyInvite()) {
|
||||||
|
@ -12,13 +12,13 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
public class PartyChangePasswordCommand implements CommandExecutor {
|
public class PartyChangePasswordCommand implements CommandExecutor {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer((Player) sender) == null)
|
if(mcMMO.getUserManager().queryPlayer((Player) sender) == null)
|
||||||
{
|
{
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Party party = mcMMO.getUserManager().queryMcMMOPlayer((Player) sender).getParty();
|
Party party = mcMMO.getUserManager().queryPlayer((Player) sender).getParty();
|
||||||
|
|
||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -69,13 +69,13 @@ public class PartyCommand implements TabExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(player) == null)
|
if(mcMMO.getUserManager().queryPlayer(player) == null)
|
||||||
{
|
{
|
||||||
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||||
|
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
if (!mcMMO.getPartyManager().mmoPlayer.inParty()) {
|
if (!mcMMO.getPartyManager().mmoPlayer.inParty()) {
|
||||||
@ -187,13 +187,13 @@ public class PartyCommand implements TabExecutor {
|
|||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
//Not Loaded
|
//Not Loaded
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(player) == null)
|
if(mcMMO.getUserManager().queryPlayer(player) == null)
|
||||||
{
|
{
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return ImmutableList.of();
|
return ImmutableList.of();
|
||||||
}
|
}
|
||||||
|
|
||||||
Party party = mcMMO.getUserManager().queryMcMMOPlayer(player).getParty();
|
Party party = mcMMO.getUserManager().queryPlayer(player).getParty();
|
||||||
|
|
||||||
playerNames = party.getOnlinePlayerNames(player);
|
playerNames = party.getOnlinePlayerNames(player);
|
||||||
return StringUtil.copyPartialMatches(args[1], playerNames, new ArrayList<>(playerNames.size()));
|
return StringUtil.copyPartialMatches(args[1], playerNames, new ArrayList<>(playerNames.size()));
|
||||||
|
@ -16,9 +16,9 @@ public class PartyCreateCommand implements CommandExecutor {
|
|||||||
case 2:
|
case 2:
|
||||||
case 3:
|
case 3:
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||||
|
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(player) == null)
|
if(mcMMO.getUserManager().queryPlayer(player) == null)
|
||||||
{
|
{
|
||||||
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
|
@ -15,12 +15,12 @@ public class PartyDisbandCommand implements CommandExecutor {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
if (mcMMO.getUserManager().queryMcMMOPlayer((Player) sender) == null) {
|
if (mcMMO.getUserManager().queryPlayer((Player) sender) == null) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Party playerParty = mcMMO.getUserManager().queryMcMMOPlayer((Player) sender).getParty();
|
Party playerParty = mcMMO.getUserManager().queryPlayer((Player) sender).getParty();
|
||||||
String partyName = playerParty.getPartyName();
|
String partyName = playerParty.getPartyName();
|
||||||
|
|
||||||
for (PartyMember member : playerParty.getPartyMembers()) {
|
for (PartyMember member : playerParty.getPartyMembers()) {
|
||||||
|
@ -21,13 +21,13 @@ public class PartyInfoCommand implements CommandExecutor {
|
|||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 0:
|
case 0:
|
||||||
case 1:
|
case 1:
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer((Player) sender) == null)
|
if(mcMMO.getUserManager().queryPlayer((Player) sender) == null)
|
||||||
{
|
{
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||||
Party party = mmoPlayer.getParty();
|
Party party = mmoPlayer.getParty();
|
||||||
|
|
||||||
displayPartyHeader(player, party);
|
displayPartyHeader(player, party);
|
||||||
|
@ -17,7 +17,7 @@ public class PartyInviteCommand implements CommandExecutor {
|
|||||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
String targetName = CommandUtils.getMatchedPlayerName(args[1]);
|
String targetName = CommandUtils.getMatchedPlayerName(args[1]);
|
||||||
McMMOPlayer mcMMOTarget = mcMMO.getUserManager().getOfflinePlayer(targetName);
|
McMMOPlayer mcMMOTarget = mcMMO.getUserManager().queryPlayerName(targetName);
|
||||||
|
|
||||||
if (!CommandUtils.checkPlayerExistence(sender, targetName, mcMMOTarget)) {
|
if (!CommandUtils.checkPlayerExistence(sender, targetName, mcMMOTarget)) {
|
||||||
return false;
|
return false;
|
||||||
@ -25,13 +25,13 @@ public class PartyInviteCommand implements CommandExecutor {
|
|||||||
|
|
||||||
Player target = mcMMOTarget.getPlayer();
|
Player target = mcMMOTarget.getPlayer();
|
||||||
|
|
||||||
if (mcMMO.getUserManager().queryMcMMOPlayer((Player) sender) == null) {
|
if (mcMMO.getUserManager().queryPlayer((Player) sender) == null) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||||
String playerName = player.getName();
|
String playerName = player.getName();
|
||||||
|
|
||||||
if (player.equals(target)) {
|
if (player.equals(target)) {
|
||||||
|
@ -16,12 +16,12 @@ public class PartyKickCommand implements CommandExecutor {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
if (mcMMO.getUserManager().queryMcMMOPlayer((Player) sender) == null) {
|
if (mcMMO.getUserManager().queryPlayer((Player) sender) == null) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Party playerParty = mcMMO.getUserManager().queryMcMMOPlayer((Player) sender).getParty();
|
Party playerParty = mcMMO.getUserManager().queryPlayer((Player) sender).getParty();
|
||||||
String targetName = CommandUtils.getMatchedPlayerName(args[1]);
|
String targetName = CommandUtils.getMatchedPlayerName(args[1]);
|
||||||
|
|
||||||
if (!playerParty.hasMember(targetName)) {
|
if (!playerParty.hasMember(targetName)) {
|
||||||
@ -39,7 +39,7 @@ public class PartyKickCommand implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
mcMMO.getPartyManager().processPartyLeaving(mcMMO.getUserManager().queryMcMMOPlayer(onlineTarget));
|
mcMMO.getPartyManager().processPartyLeaving(mcMMO.getUserManager().queryPlayer(onlineTarget));
|
||||||
onlineTarget.sendMessage(LocaleLoader.getString("Commands.Party.Kick", partyName));
|
onlineTarget.sendMessage(LocaleLoader.getString("Commands.Party.Kick", partyName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,12 +16,12 @@ public class PartyRenameCommand implements CommandExecutor {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
if (mcMMO.getUserManager().queryMcMMOPlayer((Player) sender) == null) {
|
if (mcMMO.getUserManager().queryPlayer((Player) sender) == null) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer((Player) sender);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer((Player) sender);
|
||||||
Party playerParty = mmoPlayer.getParty();
|
Party playerParty = mmoPlayer.getParty();
|
||||||
|
|
||||||
String oldPartyName = playerParty.getPartyName();
|
String oldPartyName = playerParty.getPartyName();
|
||||||
|
@ -17,13 +17,13 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
public class PartyXpShareCommand implements CommandExecutor {
|
public class PartyXpShareCommand implements CommandExecutor {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer((Player) sender) == null)
|
if(mcMMO.getUserManager().queryPlayer((Player) sender) == null)
|
||||||
{
|
{
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Party party = mcMMO.getUserManager().queryMcMMOPlayer((Player) sender).getParty();
|
Party party = mcMMO.getUserManager().queryPlayer((Player) sender).getParty();
|
||||||
|
|
||||||
if (party.getLevel() < Config.getInstance().getPartyFeatureUnlockLevel(PartyFeature.XP_SHARE)) {
|
if (party.getLevel() < Config.getInstance().getPartyFeatureUnlockLevel(PartyFeature.XP_SHARE)) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.5"));
|
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.5"));
|
||||||
|
@ -1,12 +1,17 @@
|
|||||||
package com.gmail.nossr50.commands.party.teleport;
|
package com.gmail.nossr50.commands.party.teleport;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
|
import com.gmail.nossr50.datatypes.party.PartyMember;
|
||||||
import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
|
import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
|
||||||
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.command.ConsoleCommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class PtpAcceptAnyCommand implements CommandExecutor {
|
public class PtpAcceptAnyCommand implements CommandExecutor {
|
||||||
@ -17,7 +22,36 @@ public class PtpAcceptAnyCommand implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
PartyTeleportRecord ptpRecord = mcMMO.getUserManager().getPlayer(sender.getName()).getPartyTeleportRecord();
|
if(sender instanceof ConsoleCommandSender)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
Player playerSender = (Player) sender;
|
||||||
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(playerSender);
|
||||||
|
|
||||||
|
if(mmoPlayer == null) {
|
||||||
|
playerSender.sendMessage(LocaleLoader.getString("Commands.NotLoaded"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Party party = mcMMO.getPartyManager().getParty(playerSender);
|
||||||
|
if(party == null) {
|
||||||
|
//TODO: Localize error message
|
||||||
|
playerSender.sendMessage("You don't have a party!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
PartyMember partyMember = party.getPartyMember(playerSender.getUniqueId());
|
||||||
|
|
||||||
|
if(partyMember == null) {
|
||||||
|
mcMMO.p.getLogger().severe("PartyMember ref didn't exist for player named "+playerSender.getName() + ", this should never happen!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
PartyTeleportRecord ptpRecord = partyMember.getPartyTeleportRecord();
|
||||||
|
|
||||||
|
if(ptpRecord == null) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (ptpRecord.isConfirmRequired()) {
|
if (ptpRecord.isConfirmRequired()) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.ptp.AcceptAny.Disabled"));
|
sender.sendMessage(LocaleLoader.getString("Commands.ptp.AcceptAny.Disabled"));
|
||||||
|
@ -21,14 +21,14 @@ public class PtpAcceptCommand implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer((Player) sender) == null)
|
if(mcMMO.getUserManager().queryPlayer((Player) sender) == null)
|
||||||
{
|
{
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
PartyTeleportRecord ptpRecord = mcMMO.getUserManager().queryMcMMOPlayer(player).getPartyTeleportRecord();
|
PartyTeleportRecord ptpRecord = mcMMO.getUserManager().queryPlayer(player).getPartyTeleportRecord();
|
||||||
|
|
||||||
if (!ptpRecord.hasRequest()) {
|
if (!ptpRecord.hasRequest()) {
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.ptp.NoRequests"));
|
player.sendMessage(LocaleLoader.getString("Commands.ptp.NoRequests"));
|
||||||
|
@ -59,13 +59,13 @@ public class PtpCommand implements TabExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer((Player) sender) == null)
|
if(mcMMO.getUserManager().queryPlayer((Player) sender) == null)
|
||||||
{
|
{
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||||
|
|
||||||
if (!mmoPlayer.inParty()) {
|
if (!mmoPlayer.inParty()) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.Party.None"));
|
sender.sendMessage(LocaleLoader.getString("Commands.Party.None"));
|
||||||
@ -133,13 +133,13 @@ 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 (mcMMO.getUserManager().queryMcMMOPlayer((Player) sender) == null) {
|
if (mcMMO.getUserManager().queryPlayer((Player) sender) == null) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return ImmutableList.of();
|
return ImmutableList.of();
|
||||||
}
|
}
|
||||||
|
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||||
|
|
||||||
if (!mmoPlayer.inParty()) {
|
if (!mmoPlayer.inParty()) {
|
||||||
return ImmutableList.of();
|
return ImmutableList.of();
|
||||||
@ -228,20 +228,20 @@ public class PtpCommand implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected static void handleTeleportWarmup(Player teleportingPlayer, Player targetPlayer) {
|
protected static void handleTeleportWarmup(Player teleportingPlayer, Player targetPlayer) {
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(targetPlayer) == null)
|
if(mcMMO.getUserManager().queryPlayer(targetPlayer) == null)
|
||||||
{
|
{
|
||||||
targetPlayer.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
targetPlayer.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(teleportingPlayer) == null)
|
if(mcMMO.getUserManager().queryPlayer(teleportingPlayer) == null)
|
||||||
{
|
{
|
||||||
teleportingPlayer.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
teleportingPlayer.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(teleportingPlayer);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(teleportingPlayer);
|
||||||
McMMOPlayer mcMMOTarget = mcMMO.getUserManager().queryMcMMOPlayer(targetPlayer);
|
McMMOPlayer mcMMOTarget = mcMMO.getUserManager().queryPlayer(targetPlayer);
|
||||||
|
|
||||||
long warmup = Config.getInstance().getPTPCommandWarmup();
|
long warmup = Config.getInstance().getPTPCommandWarmup();
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ public class InspectCommand implements TabExecutor {
|
|||||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
|
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().getOfflinePlayer(playerName);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayerName(playerName);
|
||||||
|
|
||||||
// If the mmoPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process.
|
// If the mmoPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process.
|
||||||
if (mmoPlayer == null) {
|
if (mmoPlayer == null) {
|
||||||
|
@ -52,7 +52,7 @@ public class McrankCommand implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
|
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().getOfflinePlayer(playerName);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayerName(playerName);
|
||||||
|
|
||||||
if (mmoPlayer != null) {
|
if (mmoPlayer != null) {
|
||||||
Player player = mmoPlayer.getPlayer();
|
Player player = mmoPlayer.getPlayer();
|
||||||
|
@ -33,7 +33,7 @@ public class AlchemyCommand extends SkillCommand {
|
|||||||
|
|
||||||
protected String[] calculateAbilityDisplayValues(@NotNull Player player) {
|
protected String[] calculateAbilityDisplayValues(@NotNull Player player) {
|
||||||
//TODO: Needed?
|
//TODO: Needed?
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||||
if(mmoPlayer == null)
|
if(mmoPlayer == null)
|
||||||
{
|
{
|
||||||
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
|
@ -59,7 +59,7 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer((Player) sender);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer((Player) sender);
|
||||||
|
|
||||||
if(mmoPlayer == null) {
|
if(mmoPlayer == null) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.gmail.nossr50.database;
|
package com.gmail.nossr50.database;
|
||||||
|
|
||||||
import com.gmail.nossr50.api.exceptions.ProfileRetrievalException;
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.datatypes.MobHealthBarType;
|
import com.gmail.nossr50.datatypes.MobHealthBarType;
|
||||||
@ -13,10 +12,11 @@ import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
|
|||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.runnables.database.UUIDUpdateAsyncTask;
|
import com.gmail.nossr50.runnables.database.UUIDUpdateAsyncTask;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
import com.gmail.nossr50.util.StringUtils;
|
|
||||||
import com.gmail.nossr50.util.experience.MMOExperienceBarManager;
|
import com.gmail.nossr50.util.experience.MMOExperienceBarManager;
|
||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||||
|
import com.gmail.nossr50.util.text.StringUtils;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
import com.neetgames.mcmmo.exceptions.ProfileRetrievalException;
|
||||||
import org.apache.commons.lang.NullArgumentException;
|
import org.apache.commons.lang.NullArgumentException;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -2,10 +2,13 @@ package com.gmail.nossr50.datatypes.party;
|
|||||||
|
|
||||||
import com.gmail.nossr50.chat.SamePartyPredicate;
|
import com.gmail.nossr50.chat.SamePartyPredicate;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
public class Party {
|
public class Party {
|
||||||
@ -68,6 +71,14 @@ public class Party {
|
|||||||
return Objects.hash(samePartyPredicate, persistentPartyData, partyMemberManager, partyExperienceManager);
|
return Objects.hash(samePartyPredicate, persistentPartyData, partyMemberManager, partyExperienceManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public @Nullable PartyMember getPartyMember(@NotNull Player player) {
|
||||||
|
return getPartyMember(player.getUniqueId());
|
||||||
|
}
|
||||||
|
|
||||||
|
public @Nullable PartyMember getPartyMember(@NotNull UUID playerUUID) {
|
||||||
|
return partyMemberManager.getPartyMember(playerUUID);
|
||||||
|
}
|
||||||
|
|
||||||
public @NotNull Predicate<CommandSender> getSamePartyPredicate() {
|
public @NotNull Predicate<CommandSender> getSamePartyPredicate() {
|
||||||
return samePartyPredicate;
|
return samePartyPredicate;
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,27 @@
|
|||||||
package com.gmail.nossr50.datatypes.party;
|
package com.gmail.nossr50.datatypes.party;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
|
import com.gmail.nossr50.datatypes.dirtydata.DirtySet;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
|
import com.neetgames.mcmmo.exceptions.InvalidPlayerException;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class PartyMemberManager {
|
public class PartyMemberManager {
|
||||||
|
|
||||||
private final @NotNull PersistentPartyData persistentPartyData;
|
private final @NotNull PersistentPartyData persistentPartyData;
|
||||||
|
private final @NotNull HashMap<UUID, PartyMember> partyMemberMap;
|
||||||
|
private @Nullable PartyMember partyLeaderRef;
|
||||||
|
|
||||||
public PartyMemberManager(@NotNull PersistentPartyData persistentPartyData) {
|
public PartyMemberManager(@NotNull PersistentPartyData persistentPartyData) {
|
||||||
this.persistentPartyData = persistentPartyData;
|
this.persistentPartyData = persistentPartyData;
|
||||||
|
this.partyMemberMap = new HashMap<>();
|
||||||
|
initPartyLeaderRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -22,10 +29,21 @@ public class PartyMemberManager {
|
|||||||
*
|
*
|
||||||
* @return all party members
|
* @return all party members
|
||||||
*/
|
*/
|
||||||
public @NotNull Set<PartyMember> getPartyMembers() {
|
public @NotNull DirtySet<PartyMember> getPartyMembers() {
|
||||||
return persistentPartyData.getPartyMembers();
|
return persistentPartyData.getPartyMembers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Grab a specific {@link PartyMember} by {@link UUID}
|
||||||
|
*
|
||||||
|
* @param playerUUID target UUID
|
||||||
|
* @return the party member if they exist, otherwise null
|
||||||
|
*/
|
||||||
|
public @Nullable PartyMember getPartyMember(@NotNull UUID playerUUID) {
|
||||||
|
return partyMemberMap.get(playerUUID);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a {@link PartyMember} to this {@link Party} with a designated rank
|
* Add a {@link PartyMember} to this {@link Party} with a designated rank
|
||||||
* If you are adding a {@link PartyMemberRank} of Leader, any existing party leaders will be demoted to a regular member of the party
|
* If you are adding a {@link PartyMemberRank} of Leader, any existing party leaders will be demoted to a regular member of the party
|
||||||
@ -36,7 +54,9 @@ public class PartyMemberManager {
|
|||||||
public void addPartyMember(@NotNull UUID playerUUID, @NotNull PartyMemberRank partyMemberRank) {
|
public void addPartyMember(@NotNull UUID playerUUID, @NotNull PartyMemberRank partyMemberRank) {
|
||||||
//TODO: Prevent adding multiple leaders
|
//TODO: Prevent adding multiple leaders
|
||||||
//TODO: Call event
|
//TODO: Call event
|
||||||
persistentPartyData.getPartyMembers().add(new PartyMember(playerUUID, partyMemberRank));
|
PartyMember partyMember = new PartyMember(playerUUID, partyMemberRank);
|
||||||
|
persistentPartyData.getPartyMembers().add(partyMember);
|
||||||
|
partyMemberMap.put(playerUUID, partyMember);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -66,16 +86,49 @@ public class PartyMemberManager {
|
|||||||
*
|
*
|
||||||
* @param playerUUID the UUID of the new party leader
|
* @param playerUUID the UUID of the new party leader
|
||||||
*/
|
*/
|
||||||
public void changeLeader(@NotNull UUID playerUUID) {
|
public void changeLeader(@NotNull UUID playerUUID) throws RuntimeException {
|
||||||
//TODO: implementation
|
if(hasMember(playerUUID)) {
|
||||||
|
//TODO: implementation
|
||||||
|
for(PartyMember partyMember : getPartyMembers()) {
|
||||||
|
if (partyMember.getPartyMemberRank() == PartyMemberRank.LEADER) {
|
||||||
|
partyMember.setPartyMemberRank(PartyMemberRank.MEMBER);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
partyLeaderRef = partyMemberMap.get(playerUUID);
|
||||||
|
partyLeaderRef.setPartyMemberRank(PartyMemberRank.LEADER);
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initPartyLeaderRef() {
|
||||||
|
for(PartyMember partyMember : getPartyMembers()) {
|
||||||
|
if(partyMember.getPartyMemberRank() == PartyMemberRank.LEADER) {
|
||||||
|
partyLeaderRef = partyMember;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves a party leader, if one doesn't exist a "random" player is forcibly promoted to leader
|
||||||
|
* Random being the first player in the set
|
||||||
|
*
|
||||||
|
* @return the party leader
|
||||||
|
*/
|
||||||
|
public @NotNull PartyMember getPartyLeader() {
|
||||||
|
if(partyLeaderRef == null) {
|
||||||
|
//The first player in a party is now the leader
|
||||||
|
partyLeaderRef = (PartyMember) getPartyMembers().unwrapSet().toArray()[0];
|
||||||
|
partyLeaderRef.setPartyMemberRank(PartyMemberRank.LEADER);
|
||||||
|
}
|
||||||
|
|
||||||
|
return partyLeaderRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasMember(@NotNull UUID playerUUID) {
|
public boolean hasMember(@NotNull UUID playerUUID) {
|
||||||
for(PartyMember partyMember : persistentPartyData.getPartyMembers()) {
|
return partyMemberMap.containsKey(playerUUID);
|
||||||
if(partyMember.getUniqueId().equals(playerUUID))
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasMember(@NotNull Player player) {
|
public boolean hasMember(@NotNull Player player) {
|
||||||
@ -110,7 +163,7 @@ public class PartyMemberManager {
|
|||||||
* @param mmoPlayer The player to check
|
* @param mmoPlayer The player to check
|
||||||
* @return the near party members
|
* @return the near party members
|
||||||
*/
|
*/
|
||||||
public List<Player> getNearMembers(McMMOPlayer mmoPlayer) {
|
public @NotNull List<Player> getNearMembers(@NotNull McMMOPlayer mmoPlayer) {
|
||||||
List<Player> nearMembers = new ArrayList<>();
|
List<Player> nearMembers = new ArrayList<>();
|
||||||
Party party = mmoPlayer.getParty();
|
Party party = mmoPlayer.getParty();
|
||||||
|
|
||||||
@ -130,8 +183,4 @@ public class PartyMemberManager {
|
|||||||
|
|
||||||
return nearMembers;
|
return nearMembers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public @NotNull PartyMember getPartyLeader() {
|
|
||||||
return persistentPartyData.getPartyLeader();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -16,44 +16,14 @@ public class PersistentPartyData {
|
|||||||
private final @NotNull MutableBoolean dirtyFlag; //Dirty values in this class will change this flag as needed
|
private final @NotNull MutableBoolean dirtyFlag; //Dirty values in this class will change this flag as needed
|
||||||
private final @NotNull DirtyData<MutableString> partyName;
|
private final @NotNull DirtyData<MutableString> partyName;
|
||||||
private final @NotNull DirtySet<PartyMember> partyMembers; //TODO: Add cache for subsets
|
private final @NotNull DirtySet<PartyMember> partyMembers; //TODO: Add cache for subsets
|
||||||
private @Nullable PartyMember partyLeaderRef;
|
|
||||||
|
|
||||||
public PersistentPartyData(@NotNull String partyName,
|
public PersistentPartyData(@NotNull String partyName,
|
||||||
@NotNull Set<PartyMember> partyMembers) throws RuntimeException {
|
@NotNull Set<PartyMember> partyMembers) throws RuntimeException {
|
||||||
dirtyFlag = new MutableBoolean(false);
|
dirtyFlag = new MutableBoolean(false);
|
||||||
this.partyName = new DirtyData<>(new MutableString(partyName), dirtyFlag);
|
this.partyName = new DirtyData<>(new MutableString(partyName), dirtyFlag);
|
||||||
this.partyMembers = new DirtySet<>(new HashSet<>(partyMembers), dirtyFlag);
|
this.partyMembers = new DirtySet<>(new HashSet<>(partyMembers), dirtyFlag);
|
||||||
|
|
||||||
initPartyLeaderRef();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initPartyLeaderRef() {
|
|
||||||
for(PartyMember partyMember : getPartyMembers()) {
|
|
||||||
if(partyMember.getPartyMemberRank() == PartyMemberRank.LEADER) {
|
|
||||||
partyLeaderRef = partyMember;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves a party leader, if one doesn't exist a "random" player is forcibly promoted to leader
|
|
||||||
* Random being the first player in the set
|
|
||||||
*
|
|
||||||
* @see #partyMembers
|
|
||||||
* @return the party leader
|
|
||||||
*/
|
|
||||||
public @NotNull PartyMember getPartyLeader() {
|
|
||||||
if(partyLeaderRef == null) {
|
|
||||||
//The first player in a party is now the leader
|
|
||||||
partyLeaderRef = (PartyMember) getPartyMembers().unwrapSet().toArray()[0];
|
|
||||||
partyLeaderRef.setPartyMemberRank(PartyMemberRank.LEADER);
|
|
||||||
}
|
|
||||||
|
|
||||||
return partyLeaderRef;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public @NotNull String getPartyName() {
|
public @NotNull String getPartyName() {
|
||||||
return partyName.getData().getImmutableCopy();
|
return partyName.getData().getImmutableCopy();
|
||||||
}
|
}
|
||||||
@ -71,11 +41,11 @@ public class PersistentPartyData {
|
|||||||
if (this == o) return true;
|
if (this == o) return true;
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
PersistentPartyData that = (PersistentPartyData) o;
|
PersistentPartyData that = (PersistentPartyData) o;
|
||||||
return partyName.equals(that.partyName) && partyMembers.equals(that.partyMembers) && Objects.equals(partyLeaderRef, that.partyLeaderRef);
|
return dirtyFlag.equals(that.dirtyFlag) && partyName.equals(that.partyName) && partyMembers.equals(that.partyMembers);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(partyName, partyMembers, partyLeaderRef);
|
return Objects.hash(dirtyFlag, partyName, partyMembers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,7 @@ public class Roll extends AcrobaticsSubSkill {
|
|||||||
String rollChance, rollChanceLucky, gracefulRollChance, gracefulRollChanceLucky;
|
String rollChance, rollChanceLucky, gracefulRollChance, gracefulRollChanceLucky;
|
||||||
|
|
||||||
/* Values related to the player */
|
/* Values related to the player */
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||||
float skillValue = mmoPlayer.getExperienceManager().getSkillLevel(getPrimarySkill());
|
float skillValue = mmoPlayer.getExperienceManager().getSkillLevel(getPrimarySkill());
|
||||||
boolean isLucky = Permissions.lucky(player, getPrimarySkill());
|
boolean isLucky = Permissions.lucky(player, getPrimarySkill());
|
||||||
|
|
||||||
@ -269,7 +269,7 @@ public class Roll extends AcrobaticsSubSkill {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||||
|
|
||||||
if (ItemUtils.hasItemInEitherHand(player, Material.ENDER_PEARL) || player.isInsideVehicle()) {
|
if (ItemUtils.hasItemInEitherHand(player, Material.ENDER_PEARL) || player.isInsideVehicle()) {
|
||||||
if(mmoPlayer.isDebugMode()) {
|
if(mmoPlayer.isDebugMode()) {
|
||||||
@ -278,7 +278,7 @@ public class Roll extends AcrobaticsSubSkill {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(player).getAcrobaticsManager().hasFallenInLocationBefore(getBlockLocation(player)))
|
if(mcMMO.getUserManager().queryPlayer(player).getAcrobaticsManager().hasFallenInLocationBefore(getBlockLocation(player)))
|
||||||
{
|
{
|
||||||
if(mmoPlayer.isDebugMode()) {
|
if(mmoPlayer.isDebugMode()) {
|
||||||
mmoPlayer.getPlayer().sendMessage("Acrobatics XP Prevented: Fallen in location before");
|
mmoPlayer.getPlayer().sendMessage("Acrobatics XP Prevented: Fallen in location before");
|
||||||
@ -420,7 +420,7 @@ public class Roll extends AcrobaticsSubSkill {
|
|||||||
|
|
||||||
public void addFallLocation(Player player)
|
public void addFallLocation(Player player)
|
||||||
{
|
{
|
||||||
mcMMO.getUserManager().queryMcMMOPlayer(player).getAcrobaticsManager().addLocationToFallMap(getBlockLocation(player));
|
mcMMO.getUserManager().queryPlayer(player).getAcrobaticsManager().addLocationToFallMap(getBlockLocation(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Location getBlockLocation(Player player)
|
public Location getBlockLocation(Player player)
|
||||||
|
@ -216,7 +216,7 @@ public class BlockListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||||
|
|
||||||
if(mmoPlayer == null)
|
if(mmoPlayer == null)
|
||||||
return;
|
return;
|
||||||
@ -312,7 +312,7 @@ public class BlockListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||||
|
|
||||||
//Check if profile is loaded
|
//Check if profile is loaded
|
||||||
if(mmoPlayer == null) {
|
if(mmoPlayer == null) {
|
||||||
@ -410,7 +410,7 @@ public class BlockListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(player) == null)
|
if(mcMMO.getUserManager().queryPlayer(player) == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -419,7 +419,7 @@ public class BlockListener implements Listener {
|
|||||||
ItemStack heldItem = player.getInventory().getItemInMainHand();
|
ItemStack heldItem = player.getInventory().getItemInMainHand();
|
||||||
|
|
||||||
if (ItemUtils.isSword(heldItem)) {
|
if (ItemUtils.isSword(heldItem)) {
|
||||||
HerbalismManager herbalismManager = mcMMO.getUserManager().queryMcMMOPlayer(player).getHerbalismManager();
|
HerbalismManager herbalismManager = mcMMO.getUserManager().queryPlayer(player).getHerbalismManager();
|
||||||
|
|
||||||
if (herbalismManager.canUseHylianLuck()) {
|
if (herbalismManager.canUseHylianLuck()) {
|
||||||
if (herbalismManager.processHylianLuck(blockState)) {
|
if (herbalismManager.processHylianLuck(blockState)) {
|
||||||
@ -473,7 +473,7 @@ public class BlockListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(mmoPlayer == null)
|
if(mmoPlayer == null)
|
||||||
@ -559,10 +559,10 @@ public class BlockListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(player) == null)
|
if(mcMMO.getUserManager().queryPlayer(player) == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -606,10 +606,10 @@ public class BlockListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onBlockDamageCleanup(BlockDamageEvent event) {
|
public void onBlockDamageCleanup(BlockDamageEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(player) == null)
|
if(mcMMO.getUserManager().queryPlayer(player) == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -627,19 +627,19 @@ public class BlockListener implements Listener {
|
|||||||
//TODO: Convert into locale strings
|
//TODO: Convert into locale strings
|
||||||
private void debugStickDump(Player player, BlockState blockState) {
|
private void debugStickDump(Player player, BlockState blockState) {
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(player) == null)
|
if(mcMMO.getUserManager().queryPlayer(player) == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(player).isDebugMode())
|
if(mcMMO.getUserManager().queryPlayer(player).isDebugMode())
|
||||||
{
|
{
|
||||||
if(mcMMO.getPlaceStore().isTrue(blockState))
|
if(mcMMO.getPlaceStore().isTrue(blockState))
|
||||||
player.sendMessage("[mcMMO DEBUG] This block is not natural and does not reward treasures/XP");
|
player.sendMessage("[mcMMO DEBUG] This block is not natural and does not reward treasures/XP");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.sendMessage("[mcMMO DEBUG] This block is considered natural by mcMMO");
|
player.sendMessage("[mcMMO DEBUG] This block is considered natural by mcMMO");
|
||||||
mcMMO.getUserManager().queryMcMMOPlayer(player).getExcavationManager().printExcavationDebug(player, blockState);
|
mcMMO.getUserManager().queryPlayer(player).getExcavationManager().printExcavationDebug(player, blockState);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(WorldGuardUtils.isWorldGuardLoaded())
|
if(WorldGuardUtils.isWorldGuardLoaded())
|
||||||
|
@ -192,7 +192,7 @@ public class EntityListener implements Listener {
|
|||||||
|
|
||||||
//Crossbow only
|
//Crossbow only
|
||||||
if (isCrossbow) {
|
if (isCrossbow) {
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||||
|
|
||||||
//Process launch event
|
//Process launch event
|
||||||
if (Permissions.skillEnabled(player, PrimarySkillType.CROSSBOWS)) {
|
if (Permissions.skillEnabled(player, PrimarySkillType.CROSSBOWS)) {
|
||||||
@ -460,7 +460,7 @@ public class EntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Deflect checks
|
//Deflect checks
|
||||||
final McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(defendingPlayer);
|
final McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(defendingPlayer);
|
||||||
if (mmoPlayer != null) {
|
if (mmoPlayer != null) {
|
||||||
UnarmedManager unarmedManager = mmoPlayer.getUnarmedManager();
|
UnarmedManager unarmedManager = mmoPlayer.getUnarmedManager();
|
||||||
|
|
||||||
@ -617,7 +617,7 @@ public class EntityListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(mmoPlayer == null)
|
if(mmoPlayer == null)
|
||||||
@ -655,12 +655,12 @@ public class EntityListener implements Listener {
|
|||||||
Wolf wolf = (Wolf) pet;
|
Wolf wolf = (Wolf) pet;
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(player) == null)
|
if(mcMMO.getUserManager().queryPlayer(player) == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TamingManager tamingManager = mcMMO.getUserManager().queryMcMMOPlayer(player).getTamingManager();
|
TamingManager tamingManager = mcMMO.getUserManager().queryPlayer(player).getTamingManager();
|
||||||
|
|
||||||
switch (cause) {
|
switch (cause) {
|
||||||
case CONTACT:
|
case CONTACT:
|
||||||
@ -843,7 +843,7 @@ public class EntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(player) == null)
|
if(mcMMO.getUserManager().queryPlayer(player) == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -855,7 +855,7 @@ public class EntityListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MiningManager miningManager = mcMMO.getUserManager().queryMcMMOPlayer(player).getMiningManager();
|
MiningManager miningManager = mcMMO.getUserManager().queryPlayer(player).getMiningManager();
|
||||||
|
|
||||||
if (miningManager.canUseBiggerBombs()) {
|
if (miningManager.canUseBiggerBombs()) {
|
||||||
event.setRadius(miningManager.biggerBombs(event.getRadius()));
|
event.setRadius(miningManager.biggerBombs(event.getRadius()));
|
||||||
@ -896,12 +896,12 @@ public class EntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(player) == null)
|
if(mcMMO.getUserManager().queryPlayer(player) == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MiningManager miningManager = mcMMO.getUserManager().queryMcMMOPlayer(player).getMiningManager();
|
MiningManager miningManager = mcMMO.getUserManager().queryPlayer(player).getMiningManager();
|
||||||
|
|
||||||
if (miningManager.canUseBlastMining()) {
|
if (miningManager.canUseBlastMining()) {
|
||||||
miningManager.blastMiningDropProcessing(event.getYield(), event);
|
miningManager.blastMiningDropProcessing(event.getYield(), event);
|
||||||
@ -930,7 +930,7 @@ public class EntityListener implements Listener {
|
|||||||
Player player = (Player) entity;
|
Player player = (Player) entity;
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(player) == null)
|
if(mcMMO.getUserManager().queryPlayer(player) == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -995,7 +995,7 @@ public class EntityListener implements Listener {
|
|||||||
* 1000
|
* 1000
|
||||||
*/
|
*/
|
||||||
if (Permissions.isSubSkillEnabled(player, SubSkillType.HERBALISM_FARMERS_DIET)) {
|
if (Permissions.isSubSkillEnabled(player, SubSkillType.HERBALISM_FARMERS_DIET)) {
|
||||||
event.setFoodLevel(mcMMO.getUserManager().queryMcMMOPlayer(player).getHerbalismManager().farmersDiet(newFoodLevel));
|
event.setFoodLevel(mcMMO.getUserManager().queryPlayer(player).getHerbalismManager().farmersDiet(newFoodLevel));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1007,7 +1007,7 @@ public class EntityListener implements Listener {
|
|||||||
*/
|
*/
|
||||||
case POTATO: /* RESTORES 1/2 HUNGER - RESTORES 2 HUNGER @ 1000 */
|
case POTATO: /* RESTORES 1/2 HUNGER - RESTORES 2 HUNGER @ 1000 */
|
||||||
if (Permissions.isSubSkillEnabled(player, SubSkillType.HERBALISM_FARMERS_DIET)) {
|
if (Permissions.isSubSkillEnabled(player, SubSkillType.HERBALISM_FARMERS_DIET)) {
|
||||||
event.setFoodLevel(mcMMO.getUserManager().queryMcMMOPlayer(player).getHerbalismManager().farmersDiet(newFoodLevel));
|
event.setFoodLevel(mcMMO.getUserManager().queryPlayer(player).getHerbalismManager().farmersDiet(newFoodLevel));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case COD:
|
case COD:
|
||||||
@ -1017,7 +1017,7 @@ public class EntityListener implements Listener {
|
|||||||
case COOKED_SALMON:
|
case COOKED_SALMON:
|
||||||
|
|
||||||
if (Permissions.isSubSkillEnabled(player, SubSkillType.FISHING_FISHERMANS_DIET)) {
|
if (Permissions.isSubSkillEnabled(player, SubSkillType.FISHING_FISHERMANS_DIET)) {
|
||||||
event.setFoodLevel(mcMMO.getUserManager().queryMcMMOPlayer(player).getFishingManager().handleFishermanDiet(newFoodLevel));
|
event.setFoodLevel(mcMMO.getUserManager().queryPlayer(player).getFishingManager().handleFishermanDiet(newFoodLevel));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1052,7 +1052,7 @@ public class EntityListener implements Listener {
|
|||||||
|
|
||||||
LivingEntity livingEntity = event.getEntity();
|
LivingEntity livingEntity = event.getEntity();
|
||||||
|
|
||||||
if (mcMMO.getUserManager().queryMcMMOPlayer(player) == null
|
if (mcMMO.getUserManager().queryPlayer(player) == null
|
||||||
|| Misc.isNPCEntityExcludingVillagers(livingEntity)
|
|| Misc.isNPCEntityExcludingVillagers(livingEntity)
|
||||||
|| persistentDataLayer.hasMobFlag(MobMetaFlagType.EGG_MOB, livingEntity)
|
|| persistentDataLayer.hasMobFlag(MobMetaFlagType.EGG_MOB, livingEntity)
|
||||||
|| persistentDataLayer.hasMobFlag(MobMetaFlagType.MOB_SPAWNER_MOB, livingEntity)) {
|
|| persistentDataLayer.hasMobFlag(MobMetaFlagType.MOB_SPAWNER_MOB, livingEntity)) {
|
||||||
@ -1062,12 +1062,12 @@ public class EntityListener implements Listener {
|
|||||||
persistentDataLayer.flagMetadata(MobMetaFlagType.PLAYER_TAMED_MOB, livingEntity);
|
persistentDataLayer.flagMetadata(MobMetaFlagType.PLAYER_TAMED_MOB, livingEntity);
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(player) == null)
|
if(mcMMO.getUserManager().queryPlayer(player) == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mcMMO.getUserManager().queryMcMMOPlayer(player).getTamingManager().awardTamingXP(livingEntity);
|
mcMMO.getUserManager().queryPlayer(player).getTamingManager().awardTamingXP(livingEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -66,13 +66,13 @@ public class InventoryListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Profile doesn't exist
|
//Profile doesn't exist
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(offlinePlayer) == null)
|
if(mcMMO.getUserManager().queryOfflineMcMMOPlayer(offlinePlayer) == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
boolean debugMode = player.isOnline() && mcMMO.getUserManager().queryMcMMOPlayer(player).isDebugMode();
|
boolean debugMode = player.isOnline() && mcMMO.getUserManager().queryPlayer(player).isDebugMode();
|
||||||
|
|
||||||
if(debugMode) {
|
if(debugMode) {
|
||||||
player.sendMessage("FURNACE FUEL EFFICIENCY DEBUG REPORT");
|
player.sendMessage("FURNACE FUEL EFFICIENCY DEBUG REPORT");
|
||||||
@ -81,7 +81,7 @@ public class InventoryListener implements Listener {
|
|||||||
player.sendMessage("Burn Length before Fuel Efficiency is applied - "+event.getBurnTime());
|
player.sendMessage("Burn Length before Fuel Efficiency is applied - "+event.getBurnTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
event.setBurnTime(mcMMO.getUserManager().queryMcMMOPlayer(player).getSmeltingManager().fuelEfficiency(event.getBurnTime()));
|
event.setBurnTime(mcMMO.getUserManager().queryPlayer(player).getSmeltingManager().fuelEfficiency(event.getBurnTime()));
|
||||||
|
|
||||||
if(debugMode) {
|
if(debugMode) {
|
||||||
player.sendMessage("New Furnace Burn Length (after applying fuel efficiency) "+event.getBurnTime());
|
player.sendMessage("New Furnace Burn Length (after applying fuel efficiency) "+event.getBurnTime());
|
||||||
@ -111,7 +111,7 @@ public class InventoryListener implements Listener {
|
|||||||
|
|
||||||
if(offlinePlayer != null) {
|
if(offlinePlayer != null) {
|
||||||
|
|
||||||
McMMOPlayer offlineProfile = mcMMO.getUserManager().queryMcMMOPlayer(offlinePlayer);
|
McMMOPlayer offlineProfile = mcMMO.getUserManager().queryOfflineMcMMOPlayer(offlinePlayer);
|
||||||
|
|
||||||
//Profile doesn't exist
|
//Profile doesn't exist
|
||||||
if(offlineProfile != null) {
|
if(offlineProfile != null) {
|
||||||
@ -148,13 +148,13 @@ public class InventoryListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(player) == null)
|
if(mcMMO.getUserManager().queryPlayer(player) == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int xpToDrop = event.getExpToDrop();
|
int xpToDrop = event.getExpToDrop();
|
||||||
int exp = mcMMO.getUserManager().queryMcMMOPlayer(player).getSmeltingManager().vanillaXPBoost(xpToDrop);
|
int exp = mcMMO.getUserManager().queryPlayer(player).getSmeltingManager().vanillaXPBoost(xpToDrop);
|
||||||
event.setExpToDrop(exp);
|
event.setExpToDrop(exp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,12 +87,12 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(player) == null)
|
if(mcMMO.getUserManager().queryPlayer(player) == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mcMMO.getUserManager().queryMcMMOPlayer(player).actualizeTeleportATS();
|
mcMMO.getUserManager().queryPlayer(player).actualizeTeleportATS();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Handle PlayerDeathEvents at the lowest priority.
|
* Handle PlayerDeathEvents at the lowest priority.
|
||||||
@ -197,12 +197,12 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(player) == null)
|
if(mcMMO.getUserManager().queryPlayer(player) == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||||
|
|
||||||
mmoPlayer.checkGodMode();
|
mmoPlayer.checkGodMode();
|
||||||
mmoPlayer.checkParty();
|
mmoPlayer.checkParty();
|
||||||
@ -268,12 +268,12 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(player) == null)
|
if(mcMMO.getUserManager().queryPlayer(player) == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FishingManager fishingManager = mcMMO.getUserManager().queryMcMMOPlayer(player).getFishingManager();
|
FishingManager fishingManager = mcMMO.getUserManager().queryPlayer(player).getFishingManager();
|
||||||
|
|
||||||
switch (event.getState()) {
|
switch (event.getState()) {
|
||||||
case CAUGHT_FISH:
|
case CAUGHT_FISH:
|
||||||
@ -346,13 +346,13 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(player) == null)
|
if(mcMMO.getUserManager().queryPlayer(player) == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Entity caught = event.getCaught();
|
Entity caught = event.getCaught();
|
||||||
FishingManager fishingManager = mcMMO.getUserManager().queryMcMMOPlayer(player).getFishingManager();
|
FishingManager fishingManager = mcMMO.getUserManager().queryPlayer(player).getFishingManager();
|
||||||
|
|
||||||
//Track the hook
|
//Track the hook
|
||||||
if(ExperienceConfig.getInstance().isFishingExploitingPrevented())
|
if(ExperienceConfig.getInstance().isFishingExploitingPrevented())
|
||||||
@ -441,12 +441,12 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(player) == null)
|
if(mcMMO.getUserManager().queryPlayer(player) == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||||
|
|
||||||
Item drop = event.getItem();
|
Item drop = event.getItem();
|
||||||
ItemStack dropStack = drop.getItemStack();
|
ItemStack dropStack = drop.getItemStack();
|
||||||
@ -503,13 +503,13 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(player) == null)
|
if(mcMMO.getUserManager().queryPlayer(player) == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//No need for null checks here
|
//No need for null checks here
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||||
//TODO: There's an issue with using Async saves on player quit
|
//TODO: There's an issue with using Async saves on player quit
|
||||||
//TODO: Basically there are conditions in which an async task does not execute fast enough to save the data if the server shutdown shortly after this task was scheduled
|
//TODO: Basically there are conditions in which an async task does not execute fast enough to save the data if the server shutdown shortly after this task was scheduled
|
||||||
mcMMO.getUserManager().saveUserWithDelay(mmoPlayer.getPersistentPlayerData(), false, 20);
|
mcMMO.getUserManager().saveUserWithDelay(mmoPlayer.getPersistentPlayerData(), false, 20);
|
||||||
@ -560,12 +560,12 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(player) == null)
|
if(mcMMO.getUserManager().queryPlayer(player) == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mcMMO.getUserManager().queryMcMMOPlayer(player).actualizeRespawnATS();
|
mcMMO.getUserManager().queryPlayer(player).actualizeRespawnATS();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -607,12 +607,12 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(player) == null)
|
if(mcMMO.getUserManager().queryPlayer(player) == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||||
MiningManager miningManager = mmoPlayer.getMiningManager();
|
MiningManager miningManager = mmoPlayer.getMiningManager();
|
||||||
ItemStack heldItem = player.getInventory().getItemInMainHand();
|
ItemStack heldItem = player.getInventory().getItemInMainHand();
|
||||||
|
|
||||||
@ -641,7 +641,7 @@ public class PlayerListener implements Listener {
|
|||||||
&& RankUtils.hasUnlockedSubskill(player, SubSkillType.SALVAGE_SCRAP_COLLECTOR)
|
&& RankUtils.hasUnlockedSubskill(player, SubSkillType.SALVAGE_SCRAP_COLLECTOR)
|
||||||
&& mcMMO.getSalvageableManager().isSalvageable(heldItem)
|
&& mcMMO.getSalvageableManager().isSalvageable(heldItem)
|
||||||
&& heldItem.getAmount() <= 1) {
|
&& heldItem.getAmount() <= 1) {
|
||||||
SalvageManager salvageManager = mcMMO.getUserManager().queryMcMMOPlayer(player).getSalvageManager();
|
SalvageManager salvageManager = mcMMO.getUserManager().queryPlayer(player).getSalvageManager();
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
// Make sure the player knows what he's doing when trying to salvage an enchanted item
|
// Make sure the player knows what he's doing when trying to salvage an enchanted item
|
||||||
@ -723,12 +723,12 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(player) == null)
|
if(mcMMO.getUserManager().queryPlayer(player) == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||||
ItemStack heldItem = player.getInventory().getItemInMainHand();
|
ItemStack heldItem = player.getInventory().getItemInMainHand();
|
||||||
|
|
||||||
//Spam Fishing Detection
|
//Spam Fishing Detection
|
||||||
@ -763,7 +763,7 @@ public class PlayerListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||||
|
|
||||||
if (mmoPlayer == null) {
|
if (mmoPlayer == null) {
|
||||||
mcMMO.p.debug(player.getName() + "is chatting, but is currently not logged in to the server.");
|
mcMMO.p.debug(player.getName() + "is chatting, but is currently not logged in to the server.");
|
||||||
|
@ -38,14 +38,14 @@ public class SelfListener implements Listener {
|
|||||||
{
|
{
|
||||||
int previousLevelGained = event.getSkillLevel() - i;
|
int previousLevelGained = event.getSkillLevel() - i;
|
||||||
//Send player skill unlock notifications
|
//Send player skill unlock notifications
|
||||||
RankUtils.executeSkillUnlockNotifications(plugin, mcMMO.getUserManager().queryMcMMOPlayer(player), event.getSkill(), previousLevelGained);
|
RankUtils.executeSkillUnlockNotifications(plugin, mcMMO.getUserManager().queryPlayer(player), event.getSkill(), previousLevelGained);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < event.getLevelsGained(); i++)
|
for(int i = 0; i < event.getLevelsGained(); i++)
|
||||||
{
|
{
|
||||||
int previousLevelGained = event.getSkillLevel() - i;
|
int previousLevelGained = event.getSkillLevel() - i;
|
||||||
//Send player skill unlock notifications
|
//Send player skill unlock notifications
|
||||||
RankUtils.executeSkillUnlockNotifications(plugin, mcMMO.getUserManager().queryMcMMOPlayer(player), event.getSkill(), previousLevelGained);
|
RankUtils.executeSkillUnlockNotifications(plugin, mcMMO.getUserManager().queryPlayer(player), event.getSkill(), previousLevelGained);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Reset the delay timer
|
//Reset the delay timer
|
||||||
@ -81,7 +81,7 @@ public class SelfListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onPlayerXpGain(McMMOPlayerXpGainEvent event) {
|
public void onPlayerXpGain(McMMOPlayerXpGainEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||||
PrimarySkillType primarySkillType = event.getSkill();
|
PrimarySkillType primarySkillType = event.getSkill();
|
||||||
|
|
||||||
if(mmoPlayer.isDebugMode()) {
|
if(mmoPlayer.isDebugMode()) {
|
||||||
|
@ -139,19 +139,19 @@ public final class PartyManager {
|
|||||||
*/
|
*/
|
||||||
public boolean inSameParty(Player firstPlayer, Player secondPlayer) {
|
public boolean inSameParty(Player firstPlayer, Player secondPlayer) {
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(firstPlayer) == null)
|
if(mcMMO.getUserManager().queryPlayer(firstPlayer) == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(secondPlayer) == null)
|
if(mcMMO.getUserManager().queryPlayer(secondPlayer) == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Party firstParty = mcMMO.getUserManager().queryMcMMOPlayer(firstPlayer).getParty();
|
Party firstParty = mcMMO.getUserManager().queryPlayer(firstPlayer).getParty();
|
||||||
Party secondParty = mcMMO.getUserManager().queryMcMMOPlayer(secondPlayer).getParty();
|
Party secondParty = mcMMO.getUserManager().queryPlayer(secondPlayer).getParty();
|
||||||
|
|
||||||
if (firstParty == null || secondParty == null) {
|
if (firstParty == null || secondParty == null) {
|
||||||
return false;
|
return false;
|
||||||
@ -305,12 +305,12 @@ public final class PartyManager {
|
|||||||
*/
|
*/
|
||||||
public Party getParty(Player player) {
|
public Party getParty(Player player) {
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(player) == null)
|
if(mcMMO.getUserManager().queryPlayer(player) == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||||
|
|
||||||
return mmoPlayer.getParty();
|
return mmoPlayer.getParty();
|
||||||
}
|
}
|
||||||
@ -372,12 +372,12 @@ public final class PartyManager {
|
|||||||
//TODO: Potential issues with unloaded profile?
|
//TODO: Potential issues with unloaded profile?
|
||||||
for (Player member : party.getPartyMembers()) {
|
for (Player member : party.getPartyMembers()) {
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(member) == null)
|
if(mcMMO.getUserManager().queryPlayer(member) == null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
processPartyLeaving(mcMMO.getUserManager().queryMcMMOPlayer(member));
|
processPartyLeaving(mcMMO.getUserManager().queryPlayer(member));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disband the alliance between the disbanded party and it's ally
|
// Disband the alliance between the disbanded party and it's ally
|
||||||
|
@ -48,7 +48,7 @@ public final class ShareHandler {
|
|||||||
float splitXp = (float) (xp / partySize * shareBonus);
|
float splitXp = (float) (xp / partySize * shareBonus);
|
||||||
|
|
||||||
for (Player otherMember : nearMembers) {
|
for (Player otherMember : nearMembers) {
|
||||||
McMMOPlayer partyMember = mcMMO.getUserManager().queryMcMMOPlayer(otherMember);
|
McMMOPlayer partyMember = mcMMO.getUserManager().queryPlayer(otherMember);
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(partyMember == null) {
|
if(partyMember == null) {
|
||||||
|
@ -26,7 +26,7 @@ public class FormulaConversionTask extends BukkitRunnable {
|
|||||||
int convertedUsers = 0;
|
int convertedUsers = 0;
|
||||||
long startMillis = System.currentTimeMillis();
|
long startMillis = System.currentTimeMillis();
|
||||||
for (String playerName : mcMMO.getDatabaseManager().getStoredUsers()) {
|
for (String playerName : mcMMO.getDatabaseManager().getStoredUsers()) {
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().getOfflinePlayer(playerName);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayerName(playerName);
|
||||||
PlayerProfile profile;
|
PlayerProfile profile;
|
||||||
|
|
||||||
// If the mmoPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process.
|
// If the mmoPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process.
|
||||||
|
@ -39,9 +39,9 @@ public class AlchemyBrewTask extends BukkitRunnable {
|
|||||||
if (player != null
|
if (player != null
|
||||||
&& !Misc.isNPCEntityExcludingVillagers(player)
|
&& !Misc.isNPCEntityExcludingVillagers(player)
|
||||||
&& Permissions.isSubSkillEnabled(player, SubSkillType.ALCHEMY_CATALYSIS)
|
&& Permissions.isSubSkillEnabled(player, SubSkillType.ALCHEMY_CATALYSIS)
|
||||||
&& mcMMO.getUserManager().queryMcMMOPlayer(player) != null) {
|
&& mcMMO.getUserManager().queryPlayer(player) != null) {
|
||||||
|
|
||||||
double catalysis = mcMMO.getUserManager().queryMcMMOPlayer(player).getAlchemyManager().calculateBrewSpeed(Permissions.lucky(player, PrimarySkillType.ALCHEMY));
|
double catalysis = mcMMO.getUserManager().queryPlayer(player).getAlchemyManager().calculateBrewSpeed(Permissions.lucky(player, PrimarySkillType.ALCHEMY));
|
||||||
|
|
||||||
McMMOPlayerCatalysisEvent event = new McMMOPlayerCatalysisEvent(player, catalysis);
|
McMMOPlayerCatalysisEvent event = new McMMOPlayerCatalysisEvent(player, catalysis);
|
||||||
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
mcMMO.p.getServer().getPluginManager().callEvent(event);
|
||||||
|
@ -92,12 +92,12 @@ public final class AlchemyPotionBrewer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static List<ItemStack> getValidIngredients(Player player) {
|
private static List<ItemStack> getValidIngredients(Player player) {
|
||||||
if(player == null || mcMMO.getUserManager().queryMcMMOPlayer(player) == null)
|
if(player == null || mcMMO.getUserManager().queryPlayer(player) == null)
|
||||||
{
|
{
|
||||||
return PotionConfig.getInstance().getIngredients(1);
|
return PotionConfig.getInstance().getIngredients(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return PotionConfig.getInstance().getIngredients(!Permissions.isSubSkillEnabled(player, SubSkillType.ALCHEMY_CONCOCTIONS) ? 1 : mcMMO.getUserManager().queryMcMMOPlayer(player).getAlchemyManager().getTier());
|
return PotionConfig.getInstance().getIngredients(!Permissions.isSubSkillEnabled(player, SubSkillType.ALCHEMY_CONCOCTIONS) ? 1 : mcMMO.getUserManager().queryPlayer(player).getAlchemyManager().getTier());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void finishBrewing(BlockState brewingStand, Player player, boolean forced) {
|
public static void finishBrewing(BlockState brewingStand, Player player, boolean forced) {
|
||||||
@ -148,7 +148,7 @@ public final class AlchemyPotionBrewer {
|
|||||||
|
|
||||||
//TODO: hmm
|
//TODO: hmm
|
||||||
if (mcMMO.getUserManager().hasPlayerDataKey(player)) {
|
if (mcMMO.getUserManager().hasPlayerDataKey(player)) {
|
||||||
mcMMO.getUserManager().queryMcMMOPlayer(player).getAlchemyManager().handlePotionBrewSuccesses(potionStage, 1);
|
mcMMO.getUserManager().queryPlayer(player).getAlchemyManager().handlePotionBrewSuccesses(potionStage, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -102,12 +102,12 @@ public class BlastMining {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(defender) == null)
|
if(mcMMO.getUserManager().queryPlayer(defender) == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
MiningManager miningManager = mcMMO.getUserManager().queryMcMMOPlayer(defender).getMiningManager();
|
MiningManager miningManager = mcMMO.getUserManager().queryPlayer(defender).getMiningManager();
|
||||||
|
|
||||||
if (!miningManager.canUseDemolitionsExpertise()) {
|
if (!miningManager.canUseDemolitionsExpertise()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -106,13 +106,13 @@ public class UnarmedManager extends SkillManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(defender) == null)
|
if(mcMMO.getUserManager().queryPlayer(defender) == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Item item = Misc.spawnItem(defender.getLocation(), defender.getInventory().getItemInMainHand(), ItemSpawnReason.UNARMED_DISARMED_ITEM);
|
Item item = Misc.spawnItem(defender.getLocation(), defender.getInventory().getItemInMainHand(), ItemSpawnReason.UNARMED_DISARMED_ITEM);
|
||||||
|
|
||||||
if (item != null && AdvancedConfig.getInstance().getDisarmProtected()) {
|
if (item != null && AdvancedConfig.getInstance().getDisarmProtected()) {
|
||||||
item.setMetadata(mcMMO.disarmedItemKey, mcMMO.getUserManager().queryMcMMOPlayer(defender).getPlayerMetadata());
|
item.setMetadata(mcMMO.disarmedItemKey, mcMMO.getUserManager().queryPlayer(defender).getPlayerMetadata());
|
||||||
}
|
}
|
||||||
|
|
||||||
defender.getInventory().setItemInMainHand(new ItemStack(Material.AIR));
|
defender.getInventory().setItemInMainHand(new ItemStack(Material.AIR));
|
||||||
|
@ -51,7 +51,7 @@ public final class ChimaeraWing {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||||
|
|
||||||
//Not loaded
|
//Not loaded
|
||||||
if(mmoPlayer == null)
|
if(mmoPlayer == null)
|
||||||
|
@ -96,7 +96,7 @@ public final class EventUtils {
|
|||||||
*/
|
*/
|
||||||
public static McMMOPlayer getMcMMOPlayer(@NotNull Entity entity)
|
public static McMMOPlayer getMcMMOPlayer(@NotNull Entity entity)
|
||||||
{
|
{
|
||||||
return mcMMO.getUserManager().queryMcMMOPlayer((Player)entity);
|
return mcMMO.getUserManager().queryPlayer((Player)entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -144,7 +144,7 @@ public final class EventUtils {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||||
|
|
||||||
if(mmoPlayer == null)
|
if(mmoPlayer == null)
|
||||||
{
|
{
|
||||||
@ -222,7 +222,7 @@ public final class EventUtils {
|
|||||||
boolean isCancelled = event.isCancelled();
|
boolean isCancelled = event.isCancelled();
|
||||||
|
|
||||||
if (isCancelled) {
|
if (isCancelled) {
|
||||||
PlayerProfile profile = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
PlayerProfile profile = mcMMO.getUserManager().queryPlayer(player);
|
||||||
|
|
||||||
profile.getExperienceManager().setSkillLevel(skill, profile.getSkillLevel(skill) - (isLevelUp ? levelsChanged : -levelsChanged));
|
profile.getExperienceManager().setSkillLevel(skill, profile.getSkillLevel(skill) - (isLevelUp ? levelsChanged : -levelsChanged));
|
||||||
profile.addXp(skill, xpRemoved);
|
profile.addXp(skill, xpRemoved);
|
||||||
@ -238,7 +238,7 @@ public final class EventUtils {
|
|||||||
boolean isCancelled = event.isCancelled();
|
boolean isCancelled = event.isCancelled();
|
||||||
|
|
||||||
if (isCancelled) {
|
if (isCancelled) {
|
||||||
PlayerProfile profile = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
PlayerProfile profile = mcMMO.getUserManager().queryPlayer(player);
|
||||||
|
|
||||||
profile.modifySkill(skill, profile.getSkillLevel(skill) - (isLevelUp ? levelsChanged : -levelsChanged));
|
profile.modifySkill(skill, profile.getSkillLevel(skill) - (isLevelUp ? levelsChanged : -levelsChanged));
|
||||||
profile.addXp(skill, xpRemoved);
|
profile.addXp(skill, xpRemoved);
|
||||||
@ -273,7 +273,7 @@ public final class EventUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void handlePartyTeleportEvent(Player teleportingPlayer, Player targetPlayer) {
|
public static void handlePartyTeleportEvent(Player teleportingPlayer, Player targetPlayer) {
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(teleportingPlayer);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(teleportingPlayer);
|
||||||
|
|
||||||
if(mmoPlayer == null)
|
if(mmoPlayer == null)
|
||||||
return;
|
return;
|
||||||
@ -328,15 +328,15 @@ public final class EventUtils {
|
|||||||
boolean isCancelled = event.isCancelled();
|
boolean isCancelled = event.isCancelled();
|
||||||
|
|
||||||
if (!isCancelled) {
|
if (!isCancelled) {
|
||||||
mcMMO.getUserManager().queryMcMMOPlayer(player).addXp(skill, event.getRawXpGained());
|
mcMMO.getUserManager().queryPlayer(player).addXp(skill, event.getRawXpGained());
|
||||||
mcMMO.getUserManager().queryMcMMOPlayer(player).registerXpGain(skill, event.getRawXpGained());
|
mcMMO.getUserManager().queryPlayer(player).registerXpGain(skill, event.getRawXpGained());
|
||||||
}
|
}
|
||||||
|
|
||||||
return !isCancelled;
|
return !isCancelled;
|
||||||
}
|
}
|
||||||
|
|
||||||
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(mcMMO.getUserManager().queryMcMMOPlayer(player) == null)
|
if(mcMMO.getUserManager().queryPlayer(player) == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
McMMOPlayerStatLossEvent event = new McMMOPlayerStatLossEvent(player, levelChanged, experienceChanged);
|
McMMOPlayerStatLossEvent event = new McMMOPlayerStatLossEvent(player, levelChanged, experienceChanged);
|
||||||
@ -347,7 +347,7 @@ public final class EventUtils {
|
|||||||
if (!isCancelled) {
|
if (!isCancelled) {
|
||||||
levelChanged = event.getLevelChanged();
|
levelChanged = event.getLevelChanged();
|
||||||
experienceChanged = event.getExperienceChanged();
|
experienceChanged = event.getExperienceChanged();
|
||||||
PlayerProfile playerProfile = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
PlayerProfile playerProfile = mcMMO.getUserManager().queryPlayer(player);
|
||||||
|
|
||||||
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
|
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
|
||||||
String skillName = primarySkillType.toString();
|
String skillName = primarySkillType.toString();
|
||||||
@ -386,17 +386,17 @@ public final class EventUtils {
|
|||||||
HashMap<String, Integer> levelChangedVictim = eventVictim.getLevelChanged();
|
HashMap<String, Integer> levelChangedVictim = eventVictim.getLevelChanged();
|
||||||
HashMap<String, Float> experienceChangedVictim = eventVictim.getExperienceChanged();
|
HashMap<String, Float> experienceChangedVictim = eventVictim.getExperienceChanged();
|
||||||
|
|
||||||
McMMOPlayer killerPlayer = mcMMO.getUserManager().queryMcMMOPlayer(killer);
|
McMMOPlayer killerPlayer = mcMMO.getUserManager().queryPlayer(killer);
|
||||||
|
|
||||||
//Not loaded
|
//Not loaded
|
||||||
if(killerPlayer == null)
|
if(killerPlayer == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
//Not loaded
|
//Not loaded
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(victim) == null)
|
if(mcMMO.getUserManager().queryPlayer(victim) == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
PlayerProfile victimProfile = mcMMO.getUserManager().queryMcMMOPlayer(victim);
|
PlayerProfile victimProfile = mcMMO.getUserManager().queryPlayer(victim);
|
||||||
|
|
||||||
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
|
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
|
||||||
String skillName = primarySkillType.toString();
|
String skillName = primarySkillType.toString();
|
||||||
|
@ -25,10 +25,10 @@ public final class HardcoreManager {
|
|||||||
double statLossPercentage = Config.getInstance().getHardcoreDeathStatPenaltyPercentage();
|
double statLossPercentage = Config.getInstance().getHardcoreDeathStatPenaltyPercentage();
|
||||||
int levelThreshold = Config.getInstance().getHardcoreDeathStatPenaltyLevelThreshold();
|
int levelThreshold = Config.getInstance().getHardcoreDeathStatPenaltyLevelThreshold();
|
||||||
|
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(player) == null)
|
if(mcMMO.getUserManager().queryPlayer(player) == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PlayerProfile playerProfile = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
PlayerProfile playerProfile = mcMMO.getUserManager().queryPlayer(player);
|
||||||
int totalLevelsLost = 0;
|
int totalLevelsLost = 0;
|
||||||
|
|
||||||
HashMap<String, Integer> levelChanged = new HashMap<>();
|
HashMap<String, Integer> levelChanged = new HashMap<>();
|
||||||
@ -76,11 +76,11 @@ public final class HardcoreManager {
|
|||||||
double vampirismStatLeechPercentage = Config.getInstance().getHardcoreVampirismStatLeechPercentage();
|
double vampirismStatLeechPercentage = Config.getInstance().getHardcoreVampirismStatLeechPercentage();
|
||||||
int levelThreshold = Config.getInstance().getHardcoreVampirismLevelThreshold();
|
int levelThreshold = Config.getInstance().getHardcoreVampirismLevelThreshold();
|
||||||
|
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(killer) == null || mcMMO.getUserManager().queryMcMMOPlayer(victim) == null)
|
if(mcMMO.getUserManager().queryPlayer(killer) == null || mcMMO.getUserManager().queryPlayer(victim) == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PlayerProfile killerProfile = mcMMO.getUserManager().queryMcMMOPlayer(killer);
|
PlayerProfile killerProfile = mcMMO.getUserManager().queryPlayer(killer);
|
||||||
PlayerProfile victimProfile = mcMMO.getUserManager().queryMcMMOPlayer(victim);
|
PlayerProfile victimProfile = mcMMO.getUserManager().queryPlayer(victim);
|
||||||
int totalLevelsStolen = 0;
|
int totalLevelsStolen = 0;
|
||||||
|
|
||||||
HashMap<String, Integer> levelChanged = new HashMap<>();
|
HashMap<String, Integer> levelChanged = new HashMap<>();
|
||||||
|
@ -368,7 +368,7 @@ public final class HolidayManager {
|
|||||||
if(!Config.getInstance().isAprilFoolsAllowed())
|
if(!Config.getInstance().isAprilFoolsAllowed())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
final McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
final McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||||
if (mmoPlayer == null) return;
|
if (mmoPlayer == null) return;
|
||||||
|
|
||||||
int levelTotal = Misc.getRandom().nextInt(1 + mmoPlayer.getSkillLevel(PrimarySkillType.MINING)) + 1;
|
int levelTotal = Misc.getRandom().nextInt(1 + mmoPlayer.getSkillLevel(PrimarySkillType.MINING)) + 1;
|
||||||
|
@ -215,10 +215,10 @@ 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(mcMMO.getUserManager().queryMcMMOPlayer(inspect) == null)
|
if(mcMMO.getUserManager().queryPlayer(inspect) == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PlayerProfile profile = mcMMO.getUserManager().queryMcMMOPlayer(inspect);
|
PlayerProfile profile = mcMMO.getUserManager().queryPlayer(inspect);
|
||||||
|
|
||||||
List<String> displayData = new ArrayList<>();
|
List<String> displayData = new ArrayList<>();
|
||||||
displayData.add(header);
|
displayData.add(header);
|
||||||
|
@ -36,7 +36,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(mcMMO.getUserManager().queryMcMMOPlayer(player) == null || !mcMMO.getUserManager().queryMcMMOPlayer(player).hasSkillChatNotifications())
|
if(mcMMO.getUserManager().queryPlayer(player) == null || !mcMMO.getUserManager().queryPlayer(player).hasSkillChatNotifications())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
McMMOMessageType destination = AdvancedConfig.getInstance().doesNotificationUseActionBar(notificationType) ? McMMOMessageType.ACTION_BAR : McMMOMessageType.SYSTEM;
|
McMMOMessageType destination = AdvancedConfig.getInstance().doesNotificationUseActionBar(notificationType) ? McMMOMessageType.ACTION_BAR : McMMOMessageType.SYSTEM;
|
||||||
@ -50,10 +50,10 @@ public class NotificationManager {
|
|||||||
|
|
||||||
public static boolean doesPlayerUseNotifications(Player player)
|
public static boolean doesPlayerUseNotifications(Player player)
|
||||||
{
|
{
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(player) == null)
|
if(mcMMO.getUserManager().queryPlayer(player) == null)
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
return mcMMO.getUserManager().queryMcMMOPlayer(player).hasSkillChatNotifications();
|
return mcMMO.getUserManager().queryPlayer(player).hasSkillChatNotifications();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -72,7 +72,7 @@ public class NotificationManager {
|
|||||||
|
|
||||||
public static void sendPlayerInformationChatOnly(Player player, String key, String... values)
|
public static void sendPlayerInformationChatOnly(Player player, String key, String... values)
|
||||||
{
|
{
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(player) == null || !mcMMO.getUserManager().queryMcMMOPlayer(player).hasSkillChatNotifications())
|
if(mcMMO.getUserManager().queryPlayer(player) == null || !mcMMO.getUserManager().queryPlayer(player).hasSkillChatNotifications())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
String preColoredString = LocaleLoader.getString(key, (Object[]) values);
|
String preColoredString = LocaleLoader.getString(key, (Object[]) values);
|
||||||
@ -81,7 +81,7 @@ public class NotificationManager {
|
|||||||
|
|
||||||
public static void sendPlayerInformationChatOnlyPrefixed(Player player, String key, String... values)
|
public static void sendPlayerInformationChatOnlyPrefixed(Player player, String key, String... values)
|
||||||
{
|
{
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(player) == null || !mcMMO.getUserManager().queryMcMMOPlayer(player).hasSkillChatNotifications())
|
if(mcMMO.getUserManager().queryPlayer(player) == null || !mcMMO.getUserManager().queryPlayer(player).hasSkillChatNotifications())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
String preColoredString = LocaleLoader.getString(key, (Object[]) values);
|
String preColoredString = LocaleLoader.getString(key, (Object[]) values);
|
||||||
@ -91,7 +91,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(mcMMO.getUserManager().queryMcMMOPlayer(player) == null || !mcMMO.getUserManager().queryMcMMOPlayer(player).hasSkillChatNotifications())
|
if(mcMMO.getUserManager().queryPlayer(player) == null || !mcMMO.getUserManager().queryPlayer(player).hasSkillChatNotifications())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
McMMOMessageType destination = AdvancedConfig.getInstance().doesNotificationUseActionBar(notificationType) ? McMMOMessageType.ACTION_BAR : McMMOMessageType.SYSTEM;
|
McMMOMessageType destination = AdvancedConfig.getInstance().doesNotificationUseActionBar(notificationType) ? McMMOMessageType.ACTION_BAR : McMMOMessageType.SYSTEM;
|
||||||
|
@ -4,6 +4,7 @@ import com.gmail.nossr50.config.Config;
|
|||||||
import com.gmail.nossr50.datatypes.player.MMODataSnapshot;
|
import com.gmail.nossr50.datatypes.player.MMODataSnapshot;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.player.PersistentPlayerData;
|
import com.gmail.nossr50.datatypes.player.PersistentPlayerData;
|
||||||
|
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.runnables.player.PersistentPlayerDataSaveTask;
|
import com.gmail.nossr50.runnables.player.PersistentPlayerDataSaveTask;
|
||||||
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
|
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
|
||||||
@ -42,20 +43,43 @@ public final class UserManager {
|
|||||||
playerDataSet.add(mmoPlayer); //for sync saves on shutdown
|
playerDataSet.add(mmoPlayer); //for sync saves on shutdown
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cleanup player data
|
||||||
|
*
|
||||||
|
* @param mmoPlayer target player
|
||||||
|
*/
|
||||||
public void cleanupPlayer(@NotNull McMMOPlayer mmoPlayer) {
|
public void cleanupPlayer(@NotNull McMMOPlayer mmoPlayer) {
|
||||||
playerDataSet.remove(mmoPlayer);
|
playerDataSet.remove(mmoPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 @Nullable McMMOPlayer queryPlayer(@Nullable Player player) {
|
||||||
|
if(player == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
if(player.hasMetadata(mcMMO.playerDataKey))
|
||||||
|
return (McMMOPlayer) player.getMetadata(mcMMO.playerDataKey).get(0).value();
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a user.
|
* Remove a user.
|
||||||
*
|
*
|
||||||
* @param player The Player object
|
* @param player The Player object
|
||||||
*/
|
*/
|
||||||
public void remove(@NotNull Player player) {
|
public void remove(@NotNull Player player) {
|
||||||
McMMOPlayer mmoPlayer = queryMcMMOPlayer(player);
|
McMMOPlayer mmoPlayer = queryPlayer(player);
|
||||||
mmoPlayer.cleanup();
|
|
||||||
player.removeMetadata(mcMMO.playerDataKey, mcMMO.p);
|
|
||||||
|
|
||||||
|
if(mmoPlayer != null) {
|
||||||
|
mmoPlayer.cleanup();
|
||||||
|
}
|
||||||
|
|
||||||
|
player.removeMetadata(mcMMO.playerDataKey, mcMMO.p);
|
||||||
playerDataSet.remove(mmoPlayer); //Clear sync save tracking
|
playerDataSet.remove(mmoPlayer); //Clear sync save tracking
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,83 +99,13 @@ public final class UserManager {
|
|||||||
|
|
||||||
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
|
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
|
||||||
if (hasPlayerDataKey(player)) {
|
if (hasPlayerDataKey(player)) {
|
||||||
playerCollection.add(queryMcMMOPlayer(player));
|
playerCollection.add(queryPlayer(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return playerCollection;
|
return playerCollection;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the McMMOPlayer of a player by name.
|
|
||||||
*
|
|
||||||
* @param playerName The name of the player whose McMMOPlayer to retrieve
|
|
||||||
* @return the player's McMMOPlayer object
|
|
||||||
*/
|
|
||||||
public @Nullable McMMOPlayer queryMcMMOPlayer(@NotNull UUID playerUUID) {
|
|
||||||
return retrieveMcMMOPlayer(playerName, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Attempts to find a player in the database by name alone
|
|
||||||
* @param playerName target player name
|
|
||||||
* @return will return a valid McMMOPlayer if one is found, otherwise returns null
|
|
||||||
*/
|
|
||||||
public @Nullable OfflinePlayer findPlayer(@NotNull String playerName) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public @Nullable McMMOPlayer queryMcMMOPlayer(@NotNull OfflinePlayer offlinePlayer) {
|
|
||||||
return queryMcMMOPlayer(offlinePlayer.getUniqueId());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to grab a player by name alone
|
|
||||||
* @param playerName
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public @Nullable McMMOPlayer queryMcMMOPlayer(@NotNull String playerName) {
|
|
||||||
OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(playerName);
|
|
||||||
|
|
||||||
if(offlinePlayer != null) {
|
|
||||||
return retrieveMcMMOPlayer(offlinePlayer);
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public @Nullable McMMOPlayer getOfflinePlayer(String playerName) {
|
|
||||||
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 @Nullable McMMOPlayer queryMcMMOPlayer(@NotNull Player player) {
|
|
||||||
//Avoid Array Index out of bounds
|
|
||||||
if(player != null && player.hasMetadata(mcMMO.playerDataKey))
|
|
||||||
return (McMMOPlayer) player.getMetadata(mcMMO.playerDataKey).get(0).value();
|
|
||||||
else
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private @Nullable McMMOPlayer retrieveMcMMOPlayer(@NotNull String playerName, boolean offlineValid) {
|
|
||||||
Player player = mcMMO.p.getServer().getPlayerExact(playerName);
|
|
||||||
|
|
||||||
if (player == null) {
|
|
||||||
if (!offlineValid) {
|
|
||||||
mcMMO.p.getLogger().warning("A valid mmoPlayer object could not be found for " + playerName + ".");
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return queryMcMMOPlayer(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasPlayerDataKey(Entity entity) {
|
public boolean hasPlayerDataKey(Entity entity) {
|
||||||
return entity != null && entity.hasMetadata(mcMMO.playerDataKey);
|
return entity != null && entity.hasMetadata(mcMMO.playerDataKey);
|
||||||
}
|
}
|
||||||
|
@ -205,7 +205,7 @@ public class ScoreboardWrapper {
|
|||||||
if(mcMMO.getUserManager().getPlayer(playerName) == null)
|
if(mcMMO.getUserManager().getPlayer(playerName) == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PlayerProfile profile = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
PlayerProfile profile = mcMMO.getUserManager().queryPlayer(player);
|
||||||
|
|
||||||
if (profile.getScoreboardTipsShown() >= Config.getInstance().getTipsAmount()) {
|
if (profile.getScoreboardTipsShown() >= Config.getInstance().getTipsAmount()) {
|
||||||
return;
|
return;
|
||||||
@ -433,7 +433,7 @@ public class ScoreboardWrapper {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||||
|
|
||||||
if(mmoPlayer == null)
|
if(mmoPlayer == null)
|
||||||
return;
|
return;
|
||||||
|
@ -75,7 +75,7 @@ public final class CombatUtils {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||||
|
|
||||||
//Make sure the profiles been loaded
|
//Make sure the profiles been loaded
|
||||||
if(mmoPlayer == null) {
|
if(mmoPlayer == null) {
|
||||||
@ -125,7 +125,7 @@ public final class CombatUtils {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||||
|
|
||||||
//Make sure the profiles been loaded
|
//Make sure the profiles been loaded
|
||||||
if(mmoPlayer == null) {
|
if(mmoPlayer == null) {
|
||||||
@ -161,7 +161,7 @@ public final class CombatUtils {
|
|||||||
double finalDamage = initialDamage;
|
double finalDamage = initialDamage;
|
||||||
Map<DamageModifier, Double> modifiers = getModifiers(event);
|
Map<DamageModifier, Double> modifiers = getModifiers(event);
|
||||||
|
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||||
|
|
||||||
//Make sure the profiles been loaded
|
//Make sure the profiles been loaded
|
||||||
if(mmoPlayer == null) {
|
if(mmoPlayer == null) {
|
||||||
@ -212,7 +212,7 @@ public final class CombatUtils {
|
|||||||
double initialDamage = event.getDamage();
|
double initialDamage = event.getDamage();
|
||||||
double finalDamage = initialDamage;
|
double finalDamage = initialDamage;
|
||||||
|
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||||
|
|
||||||
//Make sure the profiles been loaded
|
//Make sure the profiles been loaded
|
||||||
if(mmoPlayer == null) {
|
if(mmoPlayer == null) {
|
||||||
@ -253,7 +253,7 @@ public final class CombatUtils {
|
|||||||
double finalDamage = initialDamage;
|
double finalDamage = initialDamage;
|
||||||
|
|
||||||
if(master != null && master.isOnline() && master.isValid()) {
|
if(master != null && master.isOnline() && master.isValid()) {
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(master);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(master);
|
||||||
|
|
||||||
//Make sure the profiles been loaded
|
//Make sure the profiles been loaded
|
||||||
if(mmoPlayer == null) {
|
if(mmoPlayer == null) {
|
||||||
@ -285,7 +285,7 @@ public final class CombatUtils {
|
|||||||
private static void processArcheryCombat(@NotNull LivingEntity target, @NotNull Player player, @NotNull EntityDamageByEntityEvent event, @NotNull Projectile arrow) {
|
private static void processArcheryCombat(@NotNull LivingEntity target, @NotNull Player player, @NotNull EntityDamageByEntityEvent event, @NotNull Projectile arrow) {
|
||||||
double initialDamage = event.getDamage();
|
double initialDamage = event.getDamage();
|
||||||
|
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||||
|
|
||||||
//Make sure the profiles been loaded
|
//Make sure the profiles been loaded
|
||||||
if(mmoPlayer == null) {
|
if(mmoPlayer == null) {
|
||||||
@ -334,7 +334,7 @@ public final class CombatUtils {
|
|||||||
private static void processCrossbowCombat(LivingEntity target, Player player, EntityDamageByEntityEvent event, Projectile arrow) {
|
private static void processCrossbowCombat(LivingEntity target, Player player, EntityDamageByEntityEvent event, Projectile arrow) {
|
||||||
double initialDamage = event.getDamage();
|
double initialDamage = event.getDamage();
|
||||||
|
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||||
|
|
||||||
//Make sure the profiles been loaded
|
//Make sure the profiles been loaded
|
||||||
if(mmoPlayer == null) {
|
if(mmoPlayer == null) {
|
||||||
@ -346,7 +346,7 @@ public final class CombatUtils {
|
|||||||
double finalDamage = event.getDamage();
|
double finalDamage = event.getDamage();
|
||||||
|
|
||||||
if (target instanceof Player && PrimarySkillType.UNARMED.getPVPEnabled()) {
|
if (target instanceof Player && PrimarySkillType.UNARMED.getPVPEnabled()) {
|
||||||
UnarmedManager unarmedManager = mcMMO.getUserManager().queryMcMMOPlayer((Player) target).getUnarmedManager();
|
UnarmedManager unarmedManager = mcMMO.getUserManager().queryPlayer((Player) target).getUnarmedManager();
|
||||||
|
|
||||||
if (unarmedManager.canDeflect()) {
|
if (unarmedManager.canDeflect()) {
|
||||||
event.setCancelled(unarmedManager.deflectCheck());
|
event.setCancelled(unarmedManager.deflectCheck());
|
||||||
@ -393,7 +393,7 @@ public final class CombatUtils {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||||
AcrobaticsManager acrobaticsManager = mmoPlayer.getAcrobaticsManager();
|
AcrobaticsManager acrobaticsManager = mmoPlayer.getAcrobaticsManager();
|
||||||
|
|
||||||
if (acrobaticsManager.canDodge(target)) {
|
if (acrobaticsManager.canDodge(target)) {
|
||||||
@ -424,7 +424,7 @@ public final class CombatUtils {
|
|||||||
|
|
||||||
if (target instanceof Tameable) {
|
if (target instanceof Tameable) {
|
||||||
if (heldItem.getType() == Material.BONE) {
|
if (heldItem.getType() == Material.BONE) {
|
||||||
TamingManager tamingManager = mcMMO.getUserManager().queryMcMMOPlayer(player).getTamingManager();
|
TamingManager tamingManager = mcMMO.getUserManager().queryPlayer(player).getTamingManager();
|
||||||
|
|
||||||
if (tamingManager.canUseBeastLore()) {
|
if (tamingManager.canUseBeastLore()) {
|
||||||
tamingManager.beastLore(target);
|
tamingManager.beastLore(target);
|
||||||
@ -514,7 +514,7 @@ public final class CombatUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (target.getType() != EntityType.CREEPER && !Misc.isNPCEntityExcludingVillagers(player) && PrimarySkillType.TAMING.getPermissions(player)) {
|
if (target.getType() != EntityType.CREEPER && !Misc.isNPCEntityExcludingVillagers(player) && PrimarySkillType.TAMING.getPermissions(player)) {
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||||
|
|
||||||
if(mmoPlayer == null) {
|
if(mmoPlayer == null) {
|
||||||
return;
|
return;
|
||||||
@ -769,7 +769,7 @@ public final class CombatUtils {
|
|||||||
NotificationManager.sendPlayerInformation((Player)entity, NotificationType.SUBSKILL_MESSAGE, "Swords.Combat.SS.Struck");
|
NotificationManager.sendPlayerInformation((Player)entity, NotificationType.SUBSKILL_MESSAGE, "Swords.Combat.SS.Struck");
|
||||||
}
|
}
|
||||||
|
|
||||||
mcMMO.getUserManager().queryMcMMOPlayer(attacker).getSwordsManager().ruptureCheck(target);
|
mcMMO.getUserManager().queryPlayer(attacker).getSwordsManager().ruptureCheck(target);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AXES:
|
case AXES:
|
||||||
@ -895,10 +895,10 @@ public final class CombatUtils {
|
|||||||
Player defender = (Player) entity;
|
Player defender = (Player) entity;
|
||||||
|
|
||||||
//TODO: NPC Interaction?
|
//TODO: NPC Interaction?
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(defender) == null)
|
if(mcMMO.getUserManager().queryPlayer(defender) == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!defender.getWorld().getPVP() || defender == player || mcMMO.getUserManager().queryMcMMOPlayer(defender).getGodMode()) {
|
if (!defender.getWorld().getPVP() || defender == player || mcMMO.getUserManager().queryPlayer(defender).getGodMode()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ public final class PerksUtils {
|
|||||||
double modifier = 1.0F;
|
double modifier = 1.0F;
|
||||||
|
|
||||||
if (Permissions.customXpBoost(player, skill)) {
|
if (Permissions.customXpBoost(player, skill)) {
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(player) != null && mcMMO.getUserManager().queryMcMMOPlayer(player).isDebugMode()) {
|
if(mcMMO.getUserManager().queryPlayer(player) != null && mcMMO.getUserManager().queryPlayer(player).isDebugMode()) {
|
||||||
player.sendMessage(ChatColor.GOLD + "[DEBUG] " + ChatColor.DARK_GRAY + "XP Perk Multiplier IS CUSTOM! ");
|
player.sendMessage(ChatColor.GOLD + "[DEBUG] " + ChatColor.DARK_GRAY + "XP Perk Multiplier IS CUSTOM! ");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ public final class PerksUtils {
|
|||||||
|
|
||||||
float modifiedXP = (float) (xp * modifier);
|
float modifiedXP = (float) (xp * modifier);
|
||||||
|
|
||||||
if(mcMMO.getUserManager().queryMcMMOPlayer(player) != null && mcMMO.getUserManager().queryMcMMOPlayer(player).isDebugMode()) {
|
if(mcMMO.getUserManager().queryPlayer(player) != null && mcMMO.getUserManager().queryPlayer(player).isDebugMode()) {
|
||||||
player.sendMessage(ChatColor.GOLD + "[DEBUG] " + ChatColor.RESET + "XP Perk Multiplier - " + ChatColor.GOLD + modifier);
|
player.sendMessage(ChatColor.GOLD + "[DEBUG] " + ChatColor.RESET + "XP Perk Multiplier - " + ChatColor.GOLD + modifier);
|
||||||
player.sendMessage(ChatColor.GOLD + "[DEBUG] " + ChatColor.RESET + "Original XP before perk boosts " + ChatColor.RED + (double) xp);
|
player.sendMessage(ChatColor.GOLD + "[DEBUG] " + ChatColor.RESET + "Original XP before perk boosts " + ChatColor.RED + (double) xp);
|
||||||
player.sendMessage(ChatColor.GOLD + "[DEBUG] " + ChatColor.RESET + "XP AFTER PERKS " + ChatColor.DARK_RED + modifiedXP);
|
player.sendMessage(ChatColor.GOLD + "[DEBUG] " + ChatColor.RESET + "XP AFTER PERKS " + ChatColor.DARK_RED + modifiedXP);
|
||||||
|
@ -186,7 +186,7 @@ public final class SkillUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||||
|
|
||||||
//Not Loaded
|
//Not Loaded
|
||||||
if(mmoPlayer == null)
|
if(mmoPlayer == null)
|
||||||
|
@ -21,7 +21,7 @@ public class SmeltingTracker {
|
|||||||
|
|
||||||
private void changeFurnaceOwnership(Furnace furnace, Player player) {
|
private void changeFurnaceOwnership(Furnace furnace, Player player) {
|
||||||
|
|
||||||
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryMcMMOPlayer(player);
|
McMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Debug output
|
Debug output
|
||||||
@ -52,7 +52,7 @@ public class SmeltingTracker {
|
|||||||
OfflinePlayer furnaceOwner = getFurnaceOwner(furnace);
|
OfflinePlayer furnaceOwner = getFurnaceOwner(furnace);
|
||||||
|
|
||||||
if(furnaceOwner != null && furnaceOwner.isOnline()) {
|
if(furnaceOwner != null && furnaceOwner.isOnline()) {
|
||||||
McMMOPlayer furnaceOwnerProfile = mcMMO.getUserManager().queryMcMMOPlayer(furnaceOwner.getPlayer());
|
McMMOPlayer furnaceOwnerProfile = mcMMO.getUserManager().queryPlayer(furnaceOwner.getPlayer());
|
||||||
|
|
||||||
if(furnaceOwnerProfile != null) {
|
if(furnaceOwnerProfile != null) {
|
||||||
if(furnaceOwnerProfile.isDebugMode()) {
|
if(furnaceOwnerProfile.isDebugMode()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user