More API work

This commit is contained in:
Shane Freeder 2020-02-04 23:03:42 +00:00
parent c916070cd1
commit c2bbbdf24f
No known key found for this signature in database
GPG Key ID: A3F61EA5A085289C
45 changed files with 145 additions and 106 deletions

View File

@ -1,4 +1,6 @@
package com.gmail.nossr50.mcmmo.api.data;
public interface MMOEntity {
public interface MMOEntity<N> {
N getNative();
}

View File

@ -1,7 +1,5 @@
package com.gmail.nossr50.mcmmo.api.data;
public interface MMOPlayer<N> extends MMOEntity {
public interface MMOPlayer<N> extends MMOEntity<N> {
N getPlayer();
}

View File

@ -2,6 +2,7 @@ package com.gmail.nossr50.mcmmo.api.platform;
import com.gmail.nossr50.mcmmo.api.platform.scheduler.PlatformScheduler;
import com.gmail.nossr50.mcmmo.api.platform.util.MetadataStore;
import com.gmail.nossr50.mcmmo.api.platform.util.MobHealthBarManager;
import java.io.File;
import java.util.logging.Logger;
@ -35,4 +36,6 @@ public interface PlatformProvider {
PlatformScheduler getScheduler();
void checkMetrics();
MobHealthBarManager getHealthBarManager();
}

View File

@ -0,0 +1,27 @@
package com.gmail.nossr50.mcmmo.api.platform.util;
import com.gmail.nossr50.mcmmo.api.data.MMOEntity;
import com.gmail.nossr50.mcmmo.api.data.MMOPlayer;
@Deprecated // Not really deprecated, just /really/ needs a do-over...
public interface MobHealthBarManager<PT, ET> {
/**
* Fix issues with death messages caused by the mob healthbars.
*
* @param deathMessage The original death message
* @param player The player who died
* @return the fixed death message
*/
public String fixDeathMessage(String deathMessage, MMOPlayer<PT> player);
/**
* Handle the creation of mob healthbars.
*
* @param target the targetted entity
* @param damage damage done by the attack triggering this
*/
public void handleMobHealthbars(MMOEntity<ET> target, double damage);
}

View File

@ -11,7 +11,9 @@ import com.gmail.nossr50.mcmmo.api.platform.PlatformProvider;
import com.gmail.nossr50.mcmmo.api.platform.ServerSoftwareType;
import com.gmail.nossr50.mcmmo.api.platform.scheduler.PlatformScheduler;
import com.gmail.nossr50.mcmmo.api.platform.util.MetadataStore;
import com.gmail.nossr50.mcmmo.api.platform.util.MobHealthBarManager;
import com.gmail.nossr50.mcmmo.bukkit.platform.scheduler.BukkitPlatformScheduler;
import com.gmail.nossr50.mcmmo.bukkit.platform.util.BukkitMobHealthBarManager;
import org.bstats.bukkit.Metrics;
import org.bukkit.Bukkit;
@ -27,6 +29,7 @@ public class BukkitBoostrap extends JavaPlugin implements PlatformProvider {
private mcMMO core = new mcMMO(this);
private final BukkitPlatformScheduler scheduler = new BukkitPlatformScheduler(this);
private final MobHealthBarManager healthBarManager = new BukkitMobHealthBarManager(core);
@Override
public @NotNull Logger getLogger() {
@ -53,6 +56,12 @@ public class BukkitBoostrap extends JavaPlugin implements PlatformProvider {
@Override
public void earlyInit() {
PluginManager pluginManager = Bukkit.getPluginManager();
if (pluginManager.getPlugin("NoCheatPlus") != null && pluginManager.getPlugin("CompatNoCheatPlus") == null) {
getLogger().warning("NoCheatPlus plugin found, but CompatNoCheatPlus was not found!");
getLogger().warning("mcMMO will not work properly alongside NoCheatPlus without CompatNoCheatPlus");
}
registerEvents();
}
@ -117,6 +126,11 @@ public class BukkitBoostrap extends JavaPlugin implements PlatformProvider {
}
}
@Override
public MobHealthBarManager getHealthBarManager() {
return null;
}
private void registerEvents() {
PluginManager pluginManager = getServer().getPluginManager();

View File

@ -15,7 +15,6 @@ public class BukkitPlatformScheduler implements PlatformScheduler {
private final BukkitBoostrap bukkitBoostrap;
public BukkitPlatformScheduler(BukkitBoostrap bukkitBoostrap) {
this.bukkitBoostrap = bukkitBoostrap;
}

View File

@ -1,22 +1,37 @@
package com.gmail.nossr50.util;
package com.gmail.nossr50.mcmmo.bukkit.platform.util;
import com.gmail.nossr50.core.MetadataConstants;
import com.gmail.nossr50.datatypes.MobHealthbarType;
import com.gmail.nossr50.datatypes.meta.OldName;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.mcmmo.api.data.MMOEntity;
import com.gmail.nossr50.mcmmo.api.data.MMOPlayer;
import com.gmail.nossr50.mcmmo.api.platform.util.MobHealthBarManager;
import com.gmail.nossr50.runnables.MobHealthDisplayUpdaterTask;
import com.gmail.nossr50.util.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.plugin.PluginManager;
public final class MobHealthBarManager {
public final class BukkitMobHealthBarManager implements MobHealthBarManager<Player, LivingEntity> {
private final mcMMO pluginRef;
private final boolean healthBarPluginEnabled;
public MobHealthBarManager(mcMMO pluginRef) {
public BukkitMobHealthBarManager(mcMMO pluginRef) {
this.pluginRef = pluginRef;
PluginManager pluginManager = Bukkit.getServer().getPluginManager();
healthBarPluginEnabled = pluginManager.getPlugin("HealthBar") != null;
if (healthBarPluginEnabled) {
pluginRef.getLogger().info("HealthBar plugin found, mcMMO's healthbars are automatically disabled.");
}
}
/**
@ -26,8 +41,9 @@ public final class MobHealthBarManager {
* @param player The player who died
* @return the fixed death message
*/
public String fixDeathMessage(String deathMessage, Player player) {
EntityDamageEvent lastDamageCause = player.getLastDamageCause();
@Override
public String fixDeathMessage(String deathMessage, MMOPlayer<Player> player) {
EntityDamageEvent lastDamageCause = player.getNative().getLastDamageCause();
String replaceString = lastDamageCause instanceof EntityDamageByEntityEvent ? StringUtils.getPrettyEntityTypeString(((EntityDamageByEntityEvent) lastDamageCause).getDamager().getType()) : "a mob";
return deathMessage.replaceAll("(?:\u00A7(?:[0-9A-FK-ORa-fk-or]){1}(?:[\u2764\u25A0]{1,10})){1,2}", replaceString);
@ -39,10 +55,12 @@ public final class MobHealthBarManager {
* @param target the targetted entity
* @param damage damage done by the attack triggering this
*/
public void handleMobHealthbars(LivingEntity target, double damage, mcMMO plugin) {
if (pluginRef.isHealthBarPluginEnabled() || !pluginRef.getConfigManager().getConfigMobs().getCombat().getHealthBars().isEnableHealthBars()) {
@Override
public void handleMobHealthbars(MMOEntity<LivingEntity> mmoTarget, double damage) {
if (healthBarPluginEnabled || !pluginRef.getConfigManager().getConfigMobs().getCombat().getHealthBars().isEnableHealthBars()) {
return;
}
LivingEntity target = mmoTarget.getNative();
if (isBoss(target)) {
return;
@ -60,7 +78,7 @@ public final class MobHealthBarManager {
* Store the name in metadata
*/
if (target.getMetadata("mcMMO_oldName").size() <= 0 && originalName != null)
target.setMetadata("mcMMO_oldName", new OldName(originalName, plugin));
target.setMetadata("mcMMO_oldName", new OldName(originalName, pluginRef));
if (oldName == null) {
oldName = "";

View File

@ -85,7 +85,7 @@ public class ChatManager {
* Party Chat Spying
*/
for (BukkitMMOPlayer mcMMOPlayer : pluginRef.getUserManager().getPlayers()) {
Player player = mcMMOPlayer.getPlayer();
Player player = mcMMOPlayer.getNative();
//Check for toggled players
if (mcMMOPlayer.isPartyChatSpying()) {

View File

@ -22,7 +22,7 @@ public class AbilityToggleCommand extends ToggleCommand {
@Override
protected void applyCommandAction(BukkitMMOPlayer mcMMOPlayer) {
mcMMOPlayer.getPlayer().sendMessage(pluginRef.getLocaleManager().getString("Commands.Ability." + (mcMMOPlayer.getAllowAbilityUse() ? "Off" : "On")));
mcMMOPlayer.getNative().sendMessage(pluginRef.getLocaleManager().getString("Commands.Ability." + (mcMMOPlayer.getAllowAbilityUse() ? "Off" : "On")));
mcMMOPlayer.toggleAbilityUse();
}

View File

@ -22,7 +22,7 @@ public class GodModeCommand extends ToggleCommand {
@Override
protected void applyCommandAction(BukkitMMOPlayer mcMMOPlayer) {
mcMMOPlayer.getPlayer().sendMessage(pluginRef.getLocaleManager().getString("Commands.GodMode." + (mcMMOPlayer.getGodMode() ? "Disabled" : "Enabled")));
mcMMOPlayer.getNative().sendMessage(pluginRef.getLocaleManager().getString("Commands.GodMode." + (mcMMOPlayer.getGodMode() ? "Disabled" : "Enabled")));
mcMMOPlayer.toggleGodMode();
}

View File

@ -27,7 +27,7 @@ public class RefreshCooldownsCommand extends ToggleCommand {
mcMMOPlayer.resetToolPrepMode();
mcMMOPlayer.resetSuperAbilityMode();
mcMMOPlayer.getPlayer().sendMessage(pluginRef.getLocaleManager().getString("Ability.Generic.Refresh"));
mcMMOPlayer.getNative().sendMessage(pluginRef.getLocaleManager().getString("Ability.Generic.Refresh"));
}
@Override

View File

@ -20,7 +20,7 @@ public class PlayerDebugCommand implements CommandExecutor {
if(sender instanceof Player) {
BukkitMMOPlayer mcMMOPlayer = pluginRef.getUserManager().getPlayer((Player) sender);
mcMMOPlayer.toggleDebugMode(); //Toggle debug mode
pluginRef.getNotificationManager().sendPlayerInformationChatOnlyPrefixed(mcMMOPlayer.getPlayer(), "Commands.Mmodebug.Toggle", String.valueOf(mcMMOPlayer.isDebugMode()));
pluginRef.getNotificationManager().sendPlayerInformationChatOnlyPrefixed(mcMMOPlayer.getNative(), "Commands.Mmodebug.Toggle", String.valueOf(mcMMOPlayer.isDebugMode()));
return true;
} else {
return false;

View File

@ -23,7 +23,7 @@ public class ChatSpyCommand extends ToggleCommand {
@Override
protected void applyCommandAction(BukkitMMOPlayer mcMMOPlayer) {
mcMMOPlayer.getPlayer().sendMessage(pluginRef.getLocaleManager().getString("Commands.AdminChatSpy." + (mcMMOPlayer.isPartyChatSpying() ? "Disabled" : "Enabled")));
mcMMOPlayer.getNative().sendMessage(pluginRef.getLocaleManager().getString("Commands.AdminChatSpy." + (mcMMOPlayer.isPartyChatSpying() ? "Disabled" : "Enabled")));
mcMMOPlayer.togglePartyChatSpying();
}

View File

@ -113,7 +113,7 @@ public abstract class ExperienceCommand implements TabExecutor {
editValues(null, profile, skill, value);
} else {
editValues(mcMMOPlayer.getPlayer(), mcMMOPlayer.getProfile(), skill, value);
editValues(mcMMOPlayer.getNative(), mcMMOPlayer.getProfile(), skill, value);
}
handleSenderMessage(sender, playerName, skill);

View File

@ -98,7 +98,7 @@ public class SkillResetCommand implements TabExecutor {
editValues(null, profile, skill);
} else {
editValues(mcMMOPlayer.getPlayer(), mcMMOPlayer.getProfile(), skill);
editValues(mcMMOPlayer.getNative(), mcMMOPlayer.getProfile(), skill);
}
handleSenderMessage(sender, playerName, skill);

View File

@ -27,7 +27,7 @@ public class PartyInviteCommand implements CommandExecutor {
return false;
}
Player target = mcMMOTarget.getPlayer();
Player target = mcMMOTarget.getNative();
if (pluginRef.getUserManager().getPlayer((Player) sender) == null) {
sender.sendMessage(pluginRef.getLocaleManager().getString("Profile.PendingLoad"));

View File

@ -28,7 +28,7 @@ public class PartyJoinCommand implements CommandExecutor {
return true;
}
Player target = mcMMOTarget.getPlayer();
Player target = mcMMOTarget.getNative();
if (!mcMMOTarget.inParty()) {
sender.sendMessage(pluginRef.getLocaleManager().getString("Party.PlayerNotInParty", targetName));

View File

@ -38,7 +38,7 @@ public class PartyRenameCommand implements CommandExecutor {
return true;
}
Player player = mcMMOPlayer.getPlayer();
Player player = mcMMOPlayer.getNative();
// Check to see if the party exists, and if it does cancel renaming the party
if (pluginRef.getPartyManager().checkPartyExistence(player, newPartyName)) {

View File

@ -27,7 +27,7 @@ public class PartyAllianceInviteCommand implements CommandExecutor {
return false;
}
Player target = mcMMOTarget.getPlayer();
Player target = mcMMOTarget.getNative();
if (pluginRef.getUserManager().getPlayer((Player) sender) == null) {
sender.sendMessage(pluginRef.getLocaleManager().getString("Profile.PendingLoad"));

View File

@ -158,7 +158,7 @@ public class PtpCommand implements TabExecutor {
}
BukkitMMOPlayer mcMMOTarget = pluginRef.getUserManager().getPlayer(targetName);
Player target = mcMMOTarget.getPlayer();
Player target = mcMMOTarget.getNative();
if (pluginRef.getConfigManager().getConfigParty().getPTP().isPtpWorldBasedPermissions()) {
World targetWorld = target.getWorld();

View File

@ -65,7 +65,7 @@ public class InspectCommand implements TabExecutor {
}
} else {
Player target = mcMMOPlayer.getPlayer();
Player target = mcMMOPlayer.getNative();
if (pluginRef.getCommandTools().hidden(sender, target, pluginRef.getPermissionTools().inspectHidden(sender))) {
sender.sendMessage(pluginRef.getLocaleManager().getString("Inspect.Offline"));

View File

@ -59,7 +59,7 @@ public class RankCommand implements TabExecutor {
BukkitMMOPlayer mcMMOPlayer = pluginRef.getUserManager().getOfflinePlayer(playerName);
if (mcMMOPlayer != null) {
Player player = mcMMOPlayer.getPlayer();
Player player = mcMMOPlayer.getNative();
playerName = player.getName();
if (pluginRef.getCommandTools().tooFar(sender, player, pluginRef.getPermissionTools().mcrankFar(sender))) {

View File

@ -508,7 +508,7 @@ public class Party {
Party party = mcMMOPlayer.getParty();
if (party != null) {
Player player = mcMMOPlayer.getPlayer();
Player player = mcMMOPlayer.getNative();
double range = pluginRef.getConfigManager().getConfigParty().getPartyXP().getPartyExperienceSharing().getPartyShareRange();
for (Player member : party.getOnlineMembers()) {

View File

@ -695,7 +695,7 @@ public class BukkitMMOPlayer implements MMOPlayer<Player> {
*/
@Override
public Player getPlayer() {
public Player getNative() {
return player;
}
@ -769,7 +769,7 @@ public class BukkitMMOPlayer implements MMOPlayer<Player> {
}
public void loginParty() {
party.addOnlineMember(this.getPlayer());
party.addOnlineMember(this.getNative());
}
public int getItemShareModifier() {
@ -903,7 +903,7 @@ public class BukkitMMOPlayer implements MMOPlayer<Player> {
//TODO: This is hacky and temporary solution until skills are moved to the new system
//Potential problems with this include skills with two super abilities (ie mining)
if (!pluginRef.getSkillTools().isSuperAbilityUnlocked(primarySkillType, getPlayer())) {
if (!pluginRef.getSkillTools().isSuperAbilityUnlocked(primarySkillType, getNative())) {
int diff = pluginRef.getRankTools().getSuperAbilityUnlockRequirement(pluginRef.getSkillTools().getSuperAbility(primarySkillType)) - getSkillLevel(primarySkillType);
//Inform the player they are not yet skilled enough
@ -1071,7 +1071,7 @@ public class BukkitMMOPlayer implements MMOPlayer<Player> {
* @param syncSave if true, data is saved synchronously
*/
public void logout(boolean syncSave) {
Player thisPlayer = getPlayer();
Player thisPlayer = getNative();
resetSuperAbilityMode();
pluginRef.getBleedTimerTask().bleedOut(thisPlayer);
cleanup();

View File

@ -222,7 +222,7 @@ public class Roll extends AcrobaticsSubSkill {
}
private int getActivationChance(BukkitMMOPlayer mcMMOPlayer) {
return pluginRef.getPerkUtils().handleLuckyPerks(mcMMOPlayer.getPlayer(), getPrimarySkill());
return pluginRef.getPerkUtils().handleLuckyPerks(mcMMOPlayer.getNative(), getPrimarySkill());
}
/**
@ -276,7 +276,7 @@ public class Roll extends AcrobaticsSubSkill {
if (pluginRef.getItemTools().hasItemInEitherHand(player, Material.ENDER_PEARL) || player.isInsideVehicle()) {
if(mcMMOPlayer.isDebugMode()) {
mcMMOPlayer.getPlayer().sendMessage("Acrobatics XP Prevented: Ender Pearl or Inside Vehicle");
mcMMOPlayer.getNative().sendMessage("Acrobatics XP Prevented: Ender Pearl or Inside Vehicle");
}
return true;
}
@ -288,7 +288,7 @@ public class Roll extends AcrobaticsSubSkill {
if (pluginRef.getUserManager().getPlayer(player).getAcrobaticsManager().hasFallenInLocationBefore(getBlockLocation(player)))
{
if(mcMMOPlayer.isDebugMode()) {
mcMMOPlayer.getPlayer().sendMessage("Acrobatics XP Prevented: Fallen in location before");
mcMMOPlayer.getNative().sendMessage("Acrobatics XP Prevented: Fallen in location before");
}
return true;

View File

@ -62,8 +62,8 @@ public class SelfListener implements Listener {
PrimarySkillType primarySkillType = event.getSkill();
if(mcMMOPlayer.isDebugMode()) {
mcMMOPlayer.getPlayer().sendMessage(event.getSkill().toString() + " XP Gained");
mcMMOPlayer.getPlayer().sendMessage("Incoming Raw XP: "+event.getRawXpGained());
mcMMOPlayer.getNative().sendMessage(event.getSkill().toString() + " XP Gained");
mcMMOPlayer.getNative().sendMessage("Incoming Raw XP: "+event.getRawXpGained());
}
//WorldGuard XP Check
@ -77,7 +77,7 @@ public class SelfListener implements Listener {
event.setCancelled(true);
if(mcMMOPlayer.isDebugMode()) {
mcMMOPlayer.getPlayer().sendMessage("No WG XP Flag - New Raw XP: "+event.getRawXpGained());
mcMMOPlayer.getNative().sendMessage("No WG XP Flag - New Raw XP: "+event.getRawXpGained());
}
}
}
@ -103,7 +103,7 @@ public class SelfListener implements Listener {
if (threshold <= 0 || !pluginRef.getConfigManager().getConfigLeveling().getConfigLevelingDiminishedReturns().isDiminishedReturnsEnabled()) {
if(mcMMOPlayer.isDebugMode()) {
mcMMOPlayer.getPlayer().sendMessage("Final Raw XP: "+event.getRawXpGained());
mcMMOPlayer.getNative().sendMessage("Final Raw XP: "+event.getRawXpGained());
}
// Diminished returns is turned off
return;
@ -149,7 +149,7 @@ public class SelfListener implements Listener {
}
if(mcMMOPlayer.isDebugMode()) {
mcMMOPlayer.getPlayer().sendMessage("Final Raw XP: "+event.getRawXpGained());
mcMMOPlayer.getNative().sendMessage("Final Raw XP: "+event.getRawXpGained());
}
}

View File

@ -47,7 +47,7 @@ import com.gmail.nossr50.util.sounds.SoundManager;
import com.gmail.nossr50.worldguard.WorldGuardManager;
import com.gmail.nossr50.worldguard.WorldGuardUtils;
import net.shatteredlands.shatt.backup.ZipLibrary;
import org.bstats.bukkit.Metrics;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
@ -77,7 +77,6 @@ public class mcMMO implements McMMOApi {
private PartyManager partyManager;
private LocaleManager localeManager;
private ChatManager chatManager;
private MobHealthBarManager mobHealthBarManager;
private EventManager eventManager;
private UserManager userManager;
private ScoreboardManager scoreboardManager;
@ -115,8 +114,6 @@ public class mcMMO implements McMMOApi {
private String usersFile;
private String modDirectory;
/* Plugin Checks */
private boolean healthBarPluginEnabled;
// API checks
private boolean serverAPIOutdated = false;
// XP Event Check
@ -135,9 +132,6 @@ public class mcMMO implements McMMOApi {
try {
platformProvider.getLogger().setFilter(new LogFilter(this));
PluginManager pluginManager = platformProvider.getServer().getPluginManager();
healthBarPluginEnabled = pluginManager.getPlugin("HealthBar") != null;
//Init Permission Tools
permissionTools = new PermissionTools(this);
@ -166,14 +160,6 @@ public class mcMMO implements McMMOApi {
//Init TextComponentFactory
textComponentFactory = new TextComponentFactory(this);
if (healthBarPluginEnabled) {
getLogger().info("HealthBar plugin found, mcMMO's healthbars are automatically disabled.");
}
if (pluginManager.getPlugin("NoCheatPlus") != null && pluginManager.getPlugin("CompatNoCheatPlus") == null) {
getLogger().warning("NoCheatPlus plugin found, but CompatNoCheatPlus was not found!");
getLogger().warning("mcMMO will not work properly alongside NoCheatPlus without CompatNoCheatPlus");
}
//TODO: Strange design...
databaseManagerFactory = new DatabaseManagerFactory(this);
@ -242,7 +228,7 @@ public class mcMMO implements McMMOApi {
chatManager = new ChatManager(this);
//Init Mob Health Bar Manager
mobHealthBarManager = new MobHealthBarManager(this);
bukkitMobHealthBarManager = new BukkitMobHealthBarManager(this);
//Init Event Manager
eventManager = new EventManager(this);
@ -457,10 +443,6 @@ public class mcMMO implements McMMOApi {
return configManager.getConfigScoreboard();
}
public boolean isHealthBarPluginEnabled() {
return healthBarPluginEnabled;
}
public ConfigManager getConfigManager() {
return configManager;
}
@ -697,10 +679,6 @@ public class mcMMO implements McMMOApi {
return chatManager;
}
public MobHealthBarManager getMobHealthBarManager() {
return mobHealthBarManager;
}
public EventManager getEventManager() {
return eventManager;
}
@ -757,6 +735,7 @@ public class mcMMO implements McMMOApi {
return permissionTools;
}
@Deprecated // This needs to be removed...
public WorldGuardUtils getWorldGuardUtils() {
return worldGuardUtils;
}

View File

@ -40,7 +40,7 @@ public final class PartyManager {
return false;
}
Player target = mcMMOTarget.getPlayer();
Player target = mcMMOTarget.getNative();
if (player.equals(target)) {
player.sendMessage(pluginRef.getLocaleManager().getString("Party.Teleport.Self"));
@ -140,7 +140,7 @@ public final class PartyManager {
* @return true if the party was joined successfully, false otherwise
*/
public boolean changeOrJoinParty(BukkitMMOPlayer mcMMOPlayer, String newPartyName) {
Player player = mcMMOPlayer.getPlayer();
Player player = mcMMOPlayer.getNative();
if (mcMMOPlayer.inParty()) {
Party oldParty = mcMMOPlayer.getParty();
@ -223,7 +223,7 @@ public final class PartyManager {
Party party = mcMMOPlayer.getParty();
if (party != null) {
Player player = mcMMOPlayer.getPlayer();
Player player = mcMMOPlayer.getNative();
double range = pluginRef.getPartyXPShareSettings().getPartyShareRange();
for (Player member : party.getOnlineMembers()) {
@ -241,7 +241,7 @@ public final class PartyManager {
Party party = mcMMOPlayer.getParty();
if (party != null) {
Player player = mcMMOPlayer.getPlayer();
Player player = mcMMOPlayer.getNative();
double range = pluginRef.getPartyXPShareSettings().getPartyShareRange();
for (Player member : party.getVisibleMembers(player)) {
@ -421,7 +421,7 @@ public final class PartyManager {
* @param mcMMOPlayer The player to remove
*/
public void removeFromParty(BukkitMMOPlayer mcMMOPlayer) {
removeFromParty(mcMMOPlayer.getPlayer(), mcMMOPlayer.getParty());
removeFromParty(mcMMOPlayer.getNative(), mcMMOPlayer.getParty());
processPartyLeaving(mcMMOPlayer);
}
@ -457,7 +457,7 @@ public final class PartyManager {
* @param password The password for this party, null if there was no password
*/
public void createParty(BukkitMMOPlayer mcMMOPlayer, String partyName, String password) {
Player player = mcMMOPlayer.getPlayer();
Player player = mcMMOPlayer.getNative();
Party party = new Party(new PartyLeader(player.getUniqueId(), player.getName()), partyName.replace(".", ""), password, pluginRef);
@ -512,7 +512,7 @@ public final class PartyManager {
// Check if the party still exists, it might have been disbanded
if (!parties.contains(invite)) {
pluginRef.getNotificationManager().sendPlayerInformation(mcMMOPlayer.getPlayer(), NotificationType.PARTY_MESSAGE, "Party.Disband");
pluginRef.getNotificationManager().sendPlayerInformation(mcMMOPlayer.getNative(), NotificationType.PARTY_MESSAGE, "Party.Disband");
return;
}
@ -520,13 +520,13 @@ public final class PartyManager {
* Don't let players join a full party
*/
if (pluginRef.getConfigManager().getConfigParty().isPartySizeCapped() && invite.getMembers().size() >= pluginRef.getConfigManager().getConfigParty().getPartySizeLimit()) {
pluginRef.getNotificationManager().sendPlayerInformation(mcMMOPlayer.getPlayer(),
pluginRef.getNotificationManager().sendPlayerInformation(mcMMOPlayer.getNative(),
NotificationType.PARTY_MESSAGE, "Commands.Party.PartyFull.InviteAccept",
invite.getName(), String.valueOf(pluginRef.getConfigManager().getConfigParty().getPartySizeLimit()));
return;
}
pluginRef.getNotificationManager().sendPlayerInformation(mcMMOPlayer.getPlayer(), NotificationType.PARTY_MESSAGE, "Commands.Party.Invite.Accepted", invite.getName());
pluginRef.getNotificationManager().sendPlayerInformation(mcMMOPlayer.getNative(), NotificationType.PARTY_MESSAGE, "Commands.Party.Invite.Accepted", invite.getName());
mcMMOPlayer.removePartyInvite();
addToParty(mcMMOPlayer, invite);
}
@ -538,7 +538,7 @@ public final class PartyManager {
*/
public void acceptAllianceInvite(BukkitMMOPlayer mcMMOPlayer) {
Party invite = mcMMOPlayer.getPartyAllianceInvite();
Player player = mcMMOPlayer.getPlayer();
Player player = mcMMOPlayer.getNative();
// Check if the party still exists, it might have been disbanded
if (!parties.contains(invite)) {
@ -593,7 +593,7 @@ public final class PartyManager {
* @param party The party
*/
public void addToParty(BukkitMMOPlayer mcMMOPlayer, Party party) {
Player player = mcMMOPlayer.getPlayer();
Player player = mcMMOPlayer.getNative();
String playerName = player.getName();
informPartyMembersJoin(party, playerName);
@ -647,7 +647,7 @@ public final class PartyManager {
public boolean canInvite(BukkitMMOPlayer mcMMOPlayer) {
Party party = mcMMOPlayer.getParty();
return !party.isLocked() || party.getLeader().getUniqueId().equals(mcMMOPlayer.getPlayer().getUniqueId());
return !party.isLocked() || party.getLeader().getUniqueId().equals(mcMMOPlayer.getNative().getUniqueId());
}
/**

View File

@ -43,7 +43,7 @@ public final class ShareHandler {
return false;
}
nearMembers.add(mcMMOPlayer.getPlayer());
nearMembers.add(mcMMOPlayer.getNative());
int partySize = nearMembers.size();
double shareBonus = Math.min(pluginRef.getPartyXPShareSettings().getPartyShareXPBonusBase()
@ -97,7 +97,7 @@ public final class ShareHandler {
Player winningPlayer = null;
ItemStack newStack = itemStack.clone();
nearMembers.add(mcMMOPlayer.getPlayer());
nearMembers.add(mcMMOPlayer.getNative());
int partySize = nearMembers.size();
drop.remove();

View File

@ -23,7 +23,7 @@ public class ChimaeraWingWarmup extends BukkitRunnable {
}
private void checkChimaeraWingTeleport() {
Player player = mcMMOPlayer.getPlayer();
Player player = mcMMOPlayer.getNative();
Location previousLocation = mcMMOPlayer.getTeleportCommenceLocation();
ChimaeraWing chimaeraWing = new ChimaeraWing(pluginRef, mcMMOPlayer);

View File

@ -20,10 +20,10 @@ public class TeleportationWarmup extends BukkitRunnable {
@Override
public void run() {
Player teleportingPlayer = mcMMOPlayer.getPlayer();
Player targetPlayer = mcMMOTarget.getPlayer();
Player teleportingPlayer = mcMMOPlayer.getNative();
Player targetPlayer = mcMMOTarget.getNative();
Location previousLocation = mcMMOPlayer.getTeleportCommenceLocation();
Location newLocation = mcMMOPlayer.getPlayer().getLocation();
Location newLocation = mcMMOPlayer.getNative().getLocation();
long recentlyHurt = mcMMOPlayer.getRecentlyHurt();
mcMMOPlayer.setTeleportCommenceLocation(null);

View File

@ -19,13 +19,13 @@ public class AbilityCooldownTask extends BukkitRunnable {
@Override
public void run() {
if (!mcMMOPlayer.getPlayer().isOnline() || mcMMOPlayer.getSuperAbilityInformed(superAbilityType)) {
if (!mcMMOPlayer.getNative().isOnline() || mcMMOPlayer.getSuperAbilityInformed(superAbilityType)) {
return;
}
mcMMOPlayer.setAbilityInformed(superAbilityType, true);
pluginRef.getNotificationManager().sendPlayerInformation(mcMMOPlayer.getPlayer(), NotificationType.ABILITY_REFRESHED, pluginRef.getSkillTools().getSuperAbilityRefreshedLocaleKey(superAbilityType));
pluginRef.getNotificationManager().sendPlayerInformation(mcMMOPlayer.getNative(), NotificationType.ABILITY_REFRESHED, pluginRef.getSkillTools().getSuperAbilityRefreshedLocaleKey(superAbilityType));
//mcMMOPlayer.getPlayer().sendMessage(ability.getAbilityRefresh());
}
}

View File

@ -26,7 +26,7 @@ public class AbilityDisableTask extends BukkitRunnable {
return;
}
Player player = mcMMOPlayer.getPlayer();
Player player = mcMMOPlayer.getNative();
switch (superAbilityType) {
case SUPER_BREAKER:

View File

@ -26,7 +26,7 @@ public class ToolLowerTask extends BukkitRunnable {
mcMMOPlayer.setToolPreparationMode(tool, false);
if (pluginRef.getConfigManager().getConfigNotifications().isSuperAbilityToolMessage()) {
pluginRef.getNotificationManager().sendPlayerInformation(mcMMOPlayer.getPlayer(), NotificationType.TOOL, tool.getLowerTool());
pluginRef.getNotificationManager().sendPlayerInformation(mcMMOPlayer.getNative(), NotificationType.TOOL, tool.getLowerTool());
}
}
}

View File

@ -21,7 +21,7 @@ public abstract class SkillManager {
}
public Player getPlayer() {
return mcMMOPlayer.getPlayer();
return mcMMOPlayer.getNative();
}
public int getSkillLevel() {

View File

@ -349,7 +349,7 @@ public class HerbalismManager extends SkillManager {
}
if(mcMMOPlayer.isDebugMode()) {
mcMMOPlayer.getPlayer().sendMessage("Plants processed: "+brokenPlants.size());
mcMMOPlayer.getNative().sendMessage("Plants processed: "+brokenPlants.size());
}
//Reward XP
@ -400,8 +400,8 @@ public class HerbalismManager extends SkillManager {
}
if(mcMMOPlayer.isDebugMode()) {
mcMMOPlayer.getPlayer().sendMessage("Chorus Plants checked for XP: "+brokenPlants.size());
mcMMOPlayer.getPlayer().sendMessage("Valid Chorus Plant XP Gains: "+blocksGivingXP);
mcMMOPlayer.getNative().sendMessage("Chorus Plants checked for XP: "+brokenPlants.size());
mcMMOPlayer.getNative().sendMessage("Valid Chorus Plant XP Gains: "+blocksGivingXP);
}
//Reward XP

View File

@ -20,7 +20,7 @@ public final class ChimaeraWing {
public ChimaeraWing(mcMMO pluginRef, BukkitMMOPlayer mcMMOPlayer) {
this.pluginRef = pluginRef;
this.mcMMOPlayer = mcMMOPlayer;
this.player = mcMMOPlayer.getPlayer();
this.player = mcMMOPlayer.getNative();
this.location = player.getLocation();
}
@ -101,7 +101,7 @@ public final class ChimaeraWing {
}
public void chimaeraExecuteTeleport() {
Player player = mcMMOPlayer.getPlayer();
Player player = mcMMOPlayer.getNative();
if (pluginRef.getConfigManager().getConfigItems().doesChimaeraUseBedSpawn() && player.getBedSpawnLocation() != null) {
player.teleport(player.getBedSpawnLocation());

View File

@ -69,7 +69,7 @@ public final class CommandTools {
*/
public boolean checkPlayerExistence(CommandSender sender, String playerName, BukkitMMOPlayer mcMMOPlayer) {
if (mcMMOPlayer != null) {
if (hidden(sender, mcMMOPlayer.getPlayer(), false)) {
if (hidden(sender, mcMMOPlayer.getNative(), false)) {
sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Offline"));
return false;
}

View File

@ -156,9 +156,9 @@ public class ExperienceBarWrapper {
}*/
private void createBossBar() {
bossBar = mcMMOPlayer.getPlayer().getServer().createBossBar(title,
bossBar = mcMMOPlayer.getNative().getServer().createBossBar(title,
pluginRef.getConfigManager().getConfigLeveling().getXPBarColor(primarySkillType),
pluginRef.getConfigManager().getConfigLeveling().getXPBarStyle(primarySkillType));
bossBar.addPlayer(mcMMOPlayer.getPlayer());
bossBar.addPlayer(mcMMOPlayer.getNative());
}
}

View File

@ -146,7 +146,7 @@ public class NotificationManager {
return;
TextComponent levelUpTextComponent = pluginRef.getTextComponentFactory().getNotificationLevelUpTextComponent(skillName, levelsGained, newLevel);
McMMOPlayerNotificationEvent customEvent = pluginRef.getEventManager().createAndCallNotificationEvent(mcMMOPlayer.getPlayer(), NotificationType.LEVEL_UP_MESSAGE, levelUpTextComponent);
McMMOPlayerNotificationEvent customEvent = pluginRef.getEventManager().createAndCallNotificationEvent(mcMMOPlayer.getNative(), NotificationType.LEVEL_UP_MESSAGE, levelUpTextComponent);
sendNotification(customEvent);
}
@ -189,10 +189,10 @@ public class NotificationManager {
return;
//CHAT MESSAGE
mcMMOPlayer.getPlayer().spigot().sendMessage(pluginRef.getTextComponentFactory().getSubSkillUnlockedNotificationComponents(mcMMOPlayer.getPlayer(), subSkillType));
mcMMOPlayer.getNative().spigot().sendMessage(pluginRef.getTextComponentFactory().getSubSkillUnlockedNotificationComponents(mcMMOPlayer.getNative(), subSkillType));
//Unlock Sound Effect
pluginRef.getSoundManager().sendCategorizedSound(mcMMOPlayer.getPlayer(), mcMMOPlayer.getPlayer().getLocation(), SoundType.SKILL_UNLOCKED, SoundCategory.MASTER);
pluginRef.getSoundManager().sendCategorizedSound(mcMMOPlayer.getNative(), mcMMOPlayer.getNative().getLocation(), SoundType.SKILL_UNLOCKED, SoundCategory.MASTER);
}
/**

View File

@ -30,7 +30,7 @@ public final class UserManager {
* @param mcMMOPlayer the player profile to start tracking
*/
public void track(BukkitMMOPlayer mcMMOPlayer) {
mcMMOPlayer.getPlayer().setMetadata(MetadataConstants.PLAYER_DATA_METAKEY, new FixedMetadataValue(pluginRef, mcMMOPlayer));
mcMMOPlayer.getNative().setMetadata(MetadataConstants.PLAYER_DATA_METAKEY, new FixedMetadataValue(pluginRef, mcMMOPlayer));
if(playerDataSet == null)
playerDataSet = new HashSet<>();

View File

@ -245,7 +245,7 @@ public class ScoreboardManager {
continue;
}
Player player = mcMMOPlayer.getPlayer();
Player player = mcMMOPlayer.getNative();
int power = mcMMOPlayer.getPowerLevel();
mainObjective.getScore(playerName).setScore(power);

View File

@ -11,7 +11,6 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.events.fake.FakeEntityDamageByEntityEvent;
import com.gmail.nossr50.events.fake.FakeEntityDamageEvent;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.mcmmo.api.data.MMOPlayer;
import com.gmail.nossr50.runnables.skills.AwardCombatXpTask;
import com.gmail.nossr50.skills.acrobatics.AcrobaticsManager;
import com.gmail.nossr50.skills.archery.ArcheryManager;
@ -739,7 +738,7 @@ public final class CombatTools {
XPGainReason xpGainReason;
if (target instanceof Player) {
if (!pluginRef.getConfigManager().getConfigExperience().isPvpXPEnabled() || pluginRef.getPartyManager().inSameParty(mcMMOPlayer.getPlayer(), (Player) target)) {
if (!pluginRef.getConfigManager().getConfigExperience().isPvpXPEnabled() || pluginRef.getPartyManager().inSameParty(mcMMOPlayer.getNative(), (Player) target)) {
return;
}

View File

@ -35,7 +35,7 @@ public class RankTools {
*/
public void executeSkillUnlockNotifications(BukkitMMOPlayer mcMMOPlayer, PrimarySkillType primarySkillType, int newLevel) {
for (SubSkillType subSkillType : pluginRef.getSkillTools().getSkillAbilities(primarySkillType)) {
int playerRankInSkill = getRank(mcMMOPlayer.getPlayer(), subSkillType);
int playerRankInSkill = getRank(mcMMOPlayer.getNative(), subSkillType);
HashMap<Integer, Integer> innerMap = subSkillRanks.get(subSkillType.toString());
@ -44,7 +44,7 @@ public class RankTools {
continue;
//Don't send notifications if the player lacks the permission node
if(!pluginRef.getPermissionTools().isSubSkillEnabled(mcMMOPlayer.getPlayer(), subSkillType))
if(!pluginRef.getPermissionTools().isSubSkillEnabled(mcMMOPlayer.getNative(), subSkillType))
continue;
//The players level is the exact level requirement for this skill

View File

@ -280,7 +280,7 @@ public class SkillTools {
* @return how long an ability should last in seconds
*/
public int calculateAbilityLengthPerks(BukkitMMOPlayer mcMMOPlayer, PrimarySkillType skill, SuperAbilityType superAbilityType) {
return getEnduranceLength(mcMMOPlayer.getPlayer()) + calculateAbilityLength(mcMMOPlayer, skill, superAbilityType);
return getEnduranceLength(mcMMOPlayer.getNative()) + calculateAbilityLength(mcMMOPlayer, skill, superAbilityType);
}
public int getEnduranceLength(Player player) {