More API migration

This commit is contained in:
nossr50 2020-12-22 19:23:03 -08:00
parent 4199ea0095
commit 7e756c4438
35 changed files with 83 additions and 90 deletions

View File

@ -2,7 +2,7 @@ package com.gmail.nossr50.api;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.interactions.NotificationType; import com.gmail.nossr50.datatypes.interactions.NotificationType;
import com.gmail.nossr50.datatypes.party.Party; import com.neetgames.mcmmo.party.Party;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.player.NotificationManager; import com.gmail.nossr50.util.player.NotificationManager;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;

View File

@ -6,7 +6,7 @@ import com.gmail.nossr50.chat.mailer.AdminChatMailer;
import com.gmail.nossr50.chat.mailer.PartyChatMailer; import com.gmail.nossr50.chat.mailer.PartyChatMailer;
import com.gmail.nossr50.config.ChatConfig; import com.gmail.nossr50.config.ChatConfig;
import com.gmail.nossr50.datatypes.chat.ChatChannel; import com.gmail.nossr50.datatypes.chat.ChatChannel;
import com.gmail.nossr50.datatypes.party.Party; import com.neetgames.mcmmo.party.Party;
import com.neetgames.mcmmo.player.OnlineMMOPlayer; import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;

View File

@ -1,8 +1,8 @@
package com.gmail.nossr50.chat; package com.gmail.nossr50.chat;
import com.gmail.nossr50.datatypes.party.Party; import com.gmail.nossr50.mcMMO;
import com.neetgames.mcmmo.party.Party;
import com.neetgames.mcmmo.player.OnlineMMOPlayer; import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender; import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -4,7 +4,7 @@ import com.gmail.nossr50.chat.author.Author;
import com.gmail.nossr50.chat.message.ChatMessage; import com.gmail.nossr50.chat.message.ChatMessage;
import com.gmail.nossr50.chat.message.PartyChatMessage; import com.gmail.nossr50.chat.message.PartyChatMessage;
import com.gmail.nossr50.datatypes.chat.ChatChannel; import com.gmail.nossr50.datatypes.chat.ChatChannel;
import com.gmail.nossr50.datatypes.party.Party; import com.neetgames.mcmmo.party.Party;
import com.gmail.nossr50.events.chat.McMMOChatEvent; import com.gmail.nossr50.events.chat.McMMOChatEvent;
import com.gmail.nossr50.events.chat.McMMOPartyChatEvent; import com.gmail.nossr50.events.chat.McMMOPartyChatEvent;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;

View File

@ -2,7 +2,7 @@ package com.gmail.nossr50.chat.message;
import com.gmail.nossr50.chat.author.Author; import com.gmail.nossr50.chat.author.Author;
import com.gmail.nossr50.datatypes.chat.ChatChannel; import com.gmail.nossr50.datatypes.chat.ChatChannel;
import com.gmail.nossr50.datatypes.party.Party; import com.neetgames.mcmmo.party.Party;
import com.neetgames.mcmmo.player.OnlineMMOPlayer; import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;

View File

@ -7,7 +7,7 @@ import co.aikar.commands.annotation.Conditions;
import co.aikar.commands.annotation.Default; import co.aikar.commands.annotation.Default;
import com.gmail.nossr50.commands.CommandManager; import com.gmail.nossr50.commands.CommandManager;
import com.gmail.nossr50.datatypes.chat.ChatChannel; import com.gmail.nossr50.datatypes.chat.ChatChannel;
import com.gmail.nossr50.datatypes.party.Party; import com.neetgames.mcmmo.party.Party;
import com.neetgames.mcmmo.player.OnlineMMOPlayer; import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager; import com.gmail.nossr50.party.PartyManager;

View File

@ -1,6 +1,6 @@
package com.gmail.nossr50.commands.party; package com.gmail.nossr50.commands.party;
import com.gmail.nossr50.datatypes.party.Party; import com.neetgames.mcmmo.party.Party;
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.commands.CommandUtils; import com.gmail.nossr50.util.commands.CommandUtils;

View File

@ -1,6 +1,6 @@
package com.gmail.nossr50.commands.party; package com.gmail.nossr50.commands.party;
import com.gmail.nossr50.datatypes.party.Party; import com.neetgames.mcmmo.party.Party;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import org.bukkit.command.Command; import org.bukkit.command.Command;

View File

@ -2,7 +2,7 @@ package com.gmail.nossr50.commands.party;
import com.gmail.nossr50.commands.chat.PartyChatCommand; import com.gmail.nossr50.commands.chat.PartyChatCommand;
import com.gmail.nossr50.commands.party.teleport.PtpCommand; import com.gmail.nossr50.commands.party.teleport.PtpCommand;
import com.gmail.nossr50.datatypes.party.Party; import com.neetgames.mcmmo.party.Party;
import com.neetgames.mcmmo.player.OnlineMMOPlayer; import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;

View File

@ -1,6 +1,6 @@
package com.gmail.nossr50.commands.party; package com.gmail.nossr50.commands.party;
import com.gmail.nossr50.datatypes.party.Party; import com.neetgames.mcmmo.party.Party;
import com.gmail.nossr50.datatypes.party.PartyMember; import com.gmail.nossr50.datatypes.party.PartyMember;
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason; import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;

View File

@ -1,7 +1,7 @@
package com.gmail.nossr50.commands.party; package com.gmail.nossr50.commands.party;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.party.Party; import com.neetgames.mcmmo.party.Party;
import com.gmail.nossr50.datatypes.party.PartyFeature; import com.gmail.nossr50.datatypes.party.PartyFeature;
import com.neetgames.mcmmo.player.OnlineMMOPlayer; import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;

View File

@ -1,7 +1,7 @@
package com.gmail.nossr50.commands.party; package com.gmail.nossr50.commands.party;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.party.Party; import com.neetgames.mcmmo.party.Party;
import com.neetgames.mcmmo.player.OnlineMMOPlayer; import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;

View File

@ -1,6 +1,6 @@
package com.gmail.nossr50.commands.party; package com.gmail.nossr50.commands.party;
import com.gmail.nossr50.datatypes.party.Party; import com.neetgames.mcmmo.party.Party;
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason; import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;

View File

@ -1,6 +1,6 @@
package com.gmail.nossr50.commands.party; package com.gmail.nossr50.commands.party;
import com.gmail.nossr50.datatypes.party.Party; import com.neetgames.mcmmo.party.Party;
import com.neetgames.mcmmo.player.OnlineMMOPlayer; import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason; import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;

View File

@ -1,6 +1,6 @@
package com.gmail.nossr50.commands.party; package com.gmail.nossr50.commands.party;
import com.gmail.nossr50.datatypes.party.Party; import com.neetgames.mcmmo.party.Party;
import com.gmail.nossr50.datatypes.party.PartyMember; import com.gmail.nossr50.datatypes.party.PartyMember;
import com.neetgames.mcmmo.player.OnlineMMOPlayer; import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason; import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;

View File

@ -1,7 +1,7 @@
package com.gmail.nossr50.commands.party; package com.gmail.nossr50.commands.party;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.party.Party; import com.neetgames.mcmmo.party.Party;
import com.gmail.nossr50.datatypes.party.PartyFeature; import com.gmail.nossr50.datatypes.party.PartyFeature;
import com.gmail.nossr50.datatypes.party.ShareMode; import com.gmail.nossr50.datatypes.party.ShareMode;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;

View File

@ -1,6 +1,6 @@
package com.gmail.nossr50.commands.party.teleport; package com.gmail.nossr50.commands.party.teleport;
import com.gmail.nossr50.datatypes.party.Party; import com.neetgames.mcmmo.party.Party;
import com.gmail.nossr50.datatypes.party.PartyMember; import com.gmail.nossr50.datatypes.party.PartyMember;
import com.gmail.nossr50.datatypes.party.PartyTeleportRecord; import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
import com.neetgames.mcmmo.player.OnlineMMOPlayer; import com.neetgames.mcmmo.player.OnlineMMOPlayer;

View File

@ -2,7 +2,7 @@ package com.gmail.nossr50.commands.party.teleport;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.WorldBlacklist; import com.gmail.nossr50.config.WorldBlacklist;
import com.gmail.nossr50.datatypes.party.Party; import com.neetgames.mcmmo.party.Party;
import com.gmail.nossr50.datatypes.party.PartyFeature; import com.gmail.nossr50.datatypes.party.PartyFeature;
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.datatypes.player.McMMOPlayer;

View File

@ -6,6 +6,7 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SuperAbilityType; import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
import com.gmail.nossr50.util.text.StringUtils; import com.gmail.nossr50.util.text.StringUtils;
import com.neetgames.mcmmo.MobHealthBarType; import com.neetgames.mcmmo.MobHealthBarType;
import com.neetgames.mcmmo.skill.RootSkill;
import com.neetgames.mcmmo.skill.SkillIdentity; import com.neetgames.mcmmo.skill.SkillIdentity;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.data.BlockData; import org.bukkit.block.data.BlockData;
@ -551,9 +552,15 @@ public class Config extends AutoUpdateConfigLoader {
return (cap <= 0) ? Integer.MAX_VALUE : cap; return (cap <= 0) ? Integer.MAX_VALUE : cap;
} }
public int getLevelCap(@NotNull SkillIdentity skillIdentity) { public int getLevelCap(@NotNull RootSkill rootSkill) {
int cap = config.getInt("Skills." + StringUtils.getCapitalized(skillIdentity.getSkillName()) + ".Level_Cap", 0); int cap = config.getInt("Skills." + StringUtils.getCapitalized(rootSkill.getSkillName()) + ".Level_Cap", 0);
return (cap <= 0) ? Integer.MAX_VALUE : cap;
}
public int getLevelCap(@NotNull PrimarySkillType primarySkillType) {
int cap = config.getInt("Skills." + StringUtils.getCapitalized(primarySkillType.toString()) + ".Level_Cap", 0);
return (cap <= 0) ? Integer.MAX_VALUE : cap; return (cap <= 0) ? Integer.MAX_VALUE : cap;
} }

View File

@ -2,8 +2,7 @@ package com.gmail.nossr50.datatypes.experience;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.experience.ExperienceConfig; import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.party.Party; import com.neetgames.mcmmo.party.Party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.neetgames.mcmmo.experience.ExperienceHandler; import com.neetgames.mcmmo.experience.ExperienceHandler;
@ -11,9 +10,7 @@ import com.neetgames.mcmmo.experience.XPGainReason;
import com.neetgames.mcmmo.experience.XPGainSource; import com.neetgames.mcmmo.experience.XPGainSource;
import com.neetgames.mcmmo.player.MMOPlayer; import com.neetgames.mcmmo.player.MMOPlayer;
import com.neetgames.mcmmo.player.MMOPlayerData; import com.neetgames.mcmmo.player.MMOPlayerData;
import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.datatypes.skills.CoreSkills; import com.gmail.nossr50.datatypes.skills.CoreSkills;
import com.gmail.nossr50.datatypes.skills.RootSkill;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.ShareHandler; import com.gmail.nossr50.party.ShareHandler;
import com.gmail.nossr50.skills.child.FamilyTree; import com.gmail.nossr50.skills.child.FamilyTree;
@ -27,7 +24,6 @@ import com.neetgames.mcmmo.exceptions.UnknownSkillException;
import com.neetgames.mcmmo.skill.RootSkill; import com.neetgames.mcmmo.skill.RootSkill;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.Map; import java.util.Map;
@ -322,7 +318,7 @@ public class OnlineExperienceProcessor implements ExperienceHandler {
if(hasReachedPowerLevelCap()) { if(hasReachedPowerLevelCap()) {
NotificationManager.sendPlayerInformationChatOnly(Misc.adaptPlayer(mmoPlayer), "LevelCap.PowerLevel", String.valueOf(Config.getInstance().getPowerLevelCap())); NotificationManager.sendPlayerInformationChatOnly(Misc.adaptPlayer(mmoPlayer), "LevelCap.PowerLevel", String.valueOf(Config.getInstance().getPowerLevelCap()));
} else if(hasReachedLevelCap(rootSkill)) { } else if(hasReachedLevelCap(rootSkill)) {
NotificationManager.sendPlayerInformationChatOnly(Misc.adaptPlayer(mmoPlayer), "LevelCap.Skill", String.valueOf(Config.getInstance().getLevelCap(rootSkill)), rootSkill.getName()); NotificationManager.sendPlayerInformationChatOnly(Misc.adaptPlayer(mmoPlayer), "LevelCap.Skill", String.valueOf(Config.getInstance().getLevelCap(rootSkill)), rootSkill.getSkillName());
} }
//Updates from Party sources //Updates from Party sources

View File

@ -1,6 +1,7 @@
package com.gmail.nossr50.datatypes.party; package com.gmail.nossr50.datatypes.party;
import com.gmail.nossr50.chat.SamePartyPredicate; import com.gmail.nossr50.chat.SamePartyPredicate;
import com.neetgames.mcmmo.party.Party;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -11,13 +12,13 @@ import java.util.Set;
import java.util.UUID; import java.util.UUID;
import java.util.function.Predicate; import java.util.function.Predicate;
public class Party { public class PartyImpl implements Party {
private final @NotNull Predicate<CommandSender> samePartyPredicate; private final @NotNull Predicate<CommandSender> samePartyPredicate;
private final @NotNull PersistentPartyData persistentPartyData; private final @NotNull PersistentPartyData persistentPartyData;
private final @NotNull PartyMemberManager partyMemberManager; private final @NotNull PartyMemberManager partyMemberManager;
private final @NotNull PartyExperienceManager partyExperienceManager; private final @NotNull PartyExperienceManager partyExperienceManager;
public Party(@NotNull PersistentPartyData persistentPartyData) { public PartyImpl(@NotNull PersistentPartyData persistentPartyData) {
this.persistentPartyData = persistentPartyData; this.persistentPartyData = persistentPartyData;
//Initialize Managers //Initialize Managers
@ -59,7 +60,7 @@ public class Party {
public boolean equals(Object o) { public boolean equals(Object o) {
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;
Party party = (Party) o; PartyImpl party = (PartyImpl) o;
return samePartyPredicate.equals(party.samePartyPredicate) return samePartyPredicate.equals(party.samePartyPredicate)
&& persistentPartyData.equals(party.persistentPartyData) && persistentPartyData.equals(party.persistentPartyData)
&& partyMemberManager.equals(party.partyMemberManager) && partyMemberManager.equals(party.partyMemberManager)

View File

@ -1,10 +1,9 @@
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.neetgames.mcmmo.party.Party;
import com.neetgames.mcmmo.player.OnlineMMOPlayer; import com.neetgames.mcmmo.player.OnlineMMOPlayer;
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;
@ -29,7 +28,7 @@ public class PartyMemberManager {
* *
* @return all party members * @return all party members
*/ */
public @NotNull DirtySet<PartyMember> getPartyMembers() { public @NotNull Set<PartyMember> getPartyMembers() {
return persistentPartyData.getPartyMembers(); return persistentPartyData.getPartyMembers();
} }

View File

@ -1,11 +1,10 @@
package com.gmail.nossr50.datatypes.party; package com.gmail.nossr50.datatypes.party;
import com.gmail.nossr50.datatypes.dirtydata.DirtyData; import com.neetgames.neetlib.dirtydata.DirtyData;
import com.gmail.nossr50.datatypes.dirtydata.DirtySet; import com.neetgames.neetlib.dirtydata.DirtySet;
import com.gmail.nossr50.datatypes.mutableprimitives.MutableBoolean; import com.neetgames.neetlib.mutableprimitives.MutableBoolean;
import com.gmail.nossr50.datatypes.mutableprimitives.MutableString; import com.neetgames.neetlib.mutableprimitives.MutableString;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.HashSet; import java.util.HashSet;
import java.util.Objects; import java.util.Objects;
@ -17,8 +16,7 @@ public class PersistentPartyData {
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
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);
@ -28,7 +26,7 @@ public class PersistentPartyData {
return partyName.getData().getImmutableCopy(); return partyName.getData().getImmutableCopy();
} }
public @NotNull DirtySet<PartyMember> getPartyMembers() { public @NotNull Set<PartyMember> getPartyMembers() {
return partyMembers; return partyMembers;
} }

View File

@ -4,7 +4,7 @@ import com.gmail.nossr50.chat.author.PlayerAuthor;
import com.gmail.nossr50.config.ChatConfig; import com.gmail.nossr50.config.ChatConfig;
import com.gmail.nossr50.config.WorldBlacklist; import com.gmail.nossr50.config.WorldBlacklist;
import com.gmail.nossr50.datatypes.chat.ChatChannel; import com.gmail.nossr50.datatypes.chat.ChatChannel;
import com.gmail.nossr50.datatypes.party.Party; import com.neetgames.mcmmo.party.Party;
import com.gmail.nossr50.datatypes.party.PartyTeleportRecord; import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SuperAbilityType; import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
@ -33,17 +33,14 @@ import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.experience.MMOExperienceBarManager; import com.gmail.nossr50.util.experience.MMOExperienceBarManager;
import com.gmail.nossr50.util.input.AbilityActivationProcessor; import com.gmail.nossr50.util.input.AbilityActivationProcessor;
import com.gmail.nossr50.util.input.SuperAbilityManager; import com.gmail.nossr50.util.input.SuperAbilityManager;
import com.neetgames.mcmmo.exceptions.UnknownSkillException;
import com.neetgames.mcmmo.player.MMOPlayerData; import com.neetgames.mcmmo.player.MMOPlayerData;
import com.neetgames.mcmmo.player.OnlineMMOPlayer; import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.neetgames.mcmmo.skill.RootSkill; import com.neetgames.mcmmo.skill.RootSkill;
import com.neetgames.mcmmo.skill.SkillIdentity;
import net.kyori.adventure.identity.Identified; import net.kyori.adventure.identity.Identified;
import net.kyori.adventure.identity.Identity; import net.kyori.adventure.identity.Identity;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -57,6 +54,7 @@ public class McMMOPlayer extends PlayerProfile implements OnlineMMOPlayer, Ident
private final @NotNull Identity identity; private final @NotNull Identity identity;
private @Nullable Party playerPartyRef; private @Nullable Party playerPartyRef;
//Used in our chat systems for chat messages //Used in our chat systems for chat messages
private final @NotNull PlayerAuthor playerAuthor; private final @NotNull PlayerAuthor playerAuthor;
private final @NotNull Map<PrimarySkillType, SkillManager> skillManagers = new HashMap<>(); private final @NotNull Map<PrimarySkillType, SkillManager> skillManagers = new HashMap<>();
@ -481,16 +479,6 @@ public class McMMOPlayer extends PlayerProfile implements OnlineMMOPlayer, Ident
return player; return player;
} }
/**
* Update the experience bars for this player
* @param skillIdentity target skill
* @param plugin your {@link Plugin}
*/
public void updateXPBar(@NotNull SkillIdentity skillIdentity, Plugin plugin) {
//XP BAR UPDATES
experienceBarManager.updateExperienceBar(skillIdentity, plugin);
}
/** /**
* Checks whether or not a player can still be in god mode when transitioning between worlds * Checks whether or not a player can still be in god mode when transitioning between worlds
*/ */
@ -502,13 +490,6 @@ public class McMMOPlayer extends PlayerProfile implements OnlineMMOPlayer, Ident
} }
} }
public void checkParty() {
if (inParty() && !Permissions.party(player)) {
removeParty();
player.sendMessage(LocaleLoader.getString("Party.Forbidden"));
}
}
/** /**
* Calculate the time remaining until the superAbilityType's cooldown expires. * Calculate the time remaining until the superAbilityType's cooldown expires.
* *
@ -647,4 +628,16 @@ public class McMMOPlayer extends PlayerProfile implements OnlineMMOPlayer, Ident
public void updateXPBar(@NotNull RootSkill rootSkill) { public void updateXPBar(@NotNull RootSkill rootSkill) {
experienceBarManager.updateExperienceBar(rootSkill, mcMMO.p); experienceBarManager.updateExperienceBar(rootSkill, mcMMO.p);
} }
@Override
public void validateGodMode() {
if(!Permissions.mcgod(player)) {
godMode = false;
}
}
@Override
public @Nullable Party getParty() {
return playerPartyRef;
}
} }

View File

@ -1,7 +1,7 @@
package com.gmail.nossr50.events.chat; package com.gmail.nossr50.events.chat;
import com.gmail.nossr50.chat.message.PartyChatMessage; import com.gmail.nossr50.chat.message.PartyChatMessage;
import com.gmail.nossr50.datatypes.party.Party; import com.neetgames.mcmmo.party.Party;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@ -1,6 +1,6 @@
package com.gmail.nossr50.events.party; package com.gmail.nossr50.events.party;
import com.gmail.nossr50.datatypes.party.Party; import com.neetgames.mcmmo.party.Party;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;

View File

@ -1,6 +1,6 @@
package com.gmail.nossr50.events.party; package com.gmail.nossr50.events.party;
import com.gmail.nossr50.datatypes.party.Party; import com.neetgames.mcmmo.party.Party;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;

View File

@ -4,6 +4,7 @@ import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.WorldBlacklist; import com.gmail.nossr50.config.WorldBlacklist;
import com.gmail.nossr50.config.experience.ExperienceConfig; import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.chat.ChatChannel; import com.gmail.nossr50.datatypes.chat.ChatChannel;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.neetgames.mcmmo.player.OnlineMMOPlayer; import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
@ -89,12 +90,13 @@ public class PlayerListener implements Listener {
} }
//Profile not loaded //Profile not loaded
if(mcMMO.getUserManager().queryPlayer(player) == null) McMMOPlayer mmoPlayer = (McMMOPlayer) mcMMO.getUserManager().queryPlayer(player);
{
if(mmoPlayer == null) {
return; return;
} }
mcMMO.getUserManager().queryPlayer(player).actualizeTeleportATS(); mmoPlayer.actualizeTeleportATS();
} }
/** /**
* Handle PlayerDeathEvents at the lowest priority. * Handle PlayerDeathEvents at the lowest priority.
@ -206,8 +208,12 @@ public class PlayerListener implements Listener {
OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player);
mmoPlayer.checkGodMode(); if(mmoPlayer == null) {
mmoPlayer.checkParty(); return;
}
mmoPlayer.validateGodMode();
mmoPlayer.validateParty();
} }
/** /**

View File

@ -5,9 +5,10 @@ import com.gmail.nossr50.datatypes.chat.ChatChannel;
import com.gmail.nossr50.datatypes.database.UpgradeType; import com.gmail.nossr50.datatypes.database.UpgradeType;
import com.gmail.nossr50.datatypes.interactions.NotificationType; import com.gmail.nossr50.datatypes.interactions.NotificationType;
import com.gmail.nossr50.datatypes.party.ItemShareType; import com.gmail.nossr50.datatypes.party.ItemShareType;
import com.gmail.nossr50.datatypes.party.Party; import com.neetgames.mcmmo.party.Party;
import com.gmail.nossr50.datatypes.party.PartyMember; import com.gmail.nossr50.datatypes.party.PartyMember;
import com.gmail.nossr50.datatypes.party.ShareMode; import com.gmail.nossr50.datatypes.party.ShareMode;
import com.neetgames.mcmmo.party.Party;
import com.neetgames.mcmmo.player.OnlineMMOPlayer; import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.datatypes.player.PlayerProfile; import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.events.party.McMMOPartyAllianceChangeEvent; import com.gmail.nossr50.events.party.McMMOPartyAllianceChangeEvent;

View File

@ -3,7 +3,7 @@ package com.gmail.nossr50.party;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.party.ItemWeightConfig; import com.gmail.nossr50.config.party.ItemWeightConfig;
import com.gmail.nossr50.datatypes.party.ItemShareType; import com.gmail.nossr50.datatypes.party.ItemShareType;
import com.gmail.nossr50.datatypes.party.Party; import com.neetgames.mcmmo.party.Party;
import com.gmail.nossr50.datatypes.party.ShareMode; import com.gmail.nossr50.datatypes.party.ShareMode;
import com.neetgames.mcmmo.player.OnlineMMOPlayer; import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;

View File

@ -1,7 +1,7 @@
package com.gmail.nossr50.runnables.party; package com.gmail.nossr50.runnables.party;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.party.Party; import com.neetgames.mcmmo.party.Party;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;

View File

@ -1,7 +1,7 @@
package com.gmail.nossr50.util; package com.gmail.nossr50.util;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.party.Party; import com.neetgames.mcmmo.party.Party;
import com.neetgames.mcmmo.player.OnlineMMOPlayer; import com.neetgames.mcmmo.player.OnlineMMOPlayer;
import com.gmail.nossr50.datatypes.player.PlayerProfile; import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;

View File

@ -6,6 +6,7 @@ import com.gmail.nossr50.datatypes.experience.FormulaType;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import org.jetbrains.annotations.NotNull;
import java.io.File; import java.io.File;
import java.util.HashMap; import java.util.HashMap;
@ -15,23 +16,14 @@ public class FormulaManager {
private static final File formulaFile = new File(mcMMO.getFlatFileDirectory() + "formula.yml"); private static final File formulaFile = new File(mcMMO.getFlatFileDirectory() + "formula.yml");
// Experience needed to reach a level, cached values to improve conversion speed // Experience needed to reach a level, cached values to improve conversion speed
private Map<Integer, Integer> experienceNeededRetroLinear; private @NotNull Map<Integer, Integer> experienceNeededRetroLinear;
private Map<Integer, Integer> experienceNeededStandardLinear; private @NotNull Map<Integer, Integer> experienceNeededStandardLinear;
private Map<Integer, Integer> experienceNeededRetroExponential; private @NotNull Map<Integer, Integer> experienceNeededRetroExponential;
private Map<Integer, Integer> experienceNeededStandardExponential; private @NotNull Map<Integer, Integer> experienceNeededStandardExponential;
private FormulaType previousFormula; private FormulaType previousFormula;
public FormulaManager() { public FormulaManager() {
/* Setting for Classic Mode (Scales a lot of stuff up by * 10) */
initExperienceNeededMaps();
loadFormula();
}
/**
* Initialize maps used for XP to next level
*/
private void initExperienceNeededMaps() {
experienceNeededRetroLinear = new HashMap<>(); experienceNeededRetroLinear = new HashMap<>();
experienceNeededRetroExponential = new HashMap<>(); experienceNeededRetroExponential = new HashMap<>();
experienceNeededStandardLinear = new HashMap<>(); experienceNeededStandardLinear = new HashMap<>();

View File

@ -16,8 +16,8 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
/** /**
* ExperienceBarManager handles displaying and updating mcMMO experience bars for players * {@link MMOExperienceBarManager} handles displaying and updating mcMMO experience bars for players
* Each ExperienceBarManager only manages a single player * Each {@link MMOExperienceBarManager} only manages a single player
*/ */
public class MMOExperienceBarManager { public class MMOExperienceBarManager {
private final McMMOPlayer mmoPlayer; private final McMMOPlayer mmoPlayer;

View File

@ -1,7 +1,7 @@
package com.gmail.nossr50.util.player; package com.gmail.nossr50.util.player;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.party.Party; import com.neetgames.mcmmo.party.Party;
import com.gmail.nossr50.datatypes.party.PartyFeature; import com.gmail.nossr50.datatypes.party.PartyFeature;
import com.gmail.nossr50.datatypes.party.PartyMember; import com.gmail.nossr50.datatypes.party.PartyMember;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;