diff --git a/mcmmo-api/src/main/java/com/gmail/nossr50/mcmmo/api/data/MMOEntity.java b/mcmmo-api/src/main/java/com/gmail/nossr50/mcmmo/api/data/MMOEntity.java index e9c0169c6..7d7ec377c 100644 --- a/mcmmo-api/src/main/java/com/gmail/nossr50/mcmmo/api/data/MMOEntity.java +++ b/mcmmo-api/src/main/java/com/gmail/nossr50/mcmmo/api/data/MMOEntity.java @@ -1,4 +1,6 @@ package com.gmail.nossr50.mcmmo.api.data; -public interface MMOEntity { +public interface MMOEntity { + + N getNative(); } diff --git a/mcmmo-api/src/main/java/com/gmail/nossr50/mcmmo/api/data/MMOPlayer.java b/mcmmo-api/src/main/java/com/gmail/nossr50/mcmmo/api/data/MMOPlayer.java index b4e41aad2..5abe8ed69 100644 --- a/mcmmo-api/src/main/java/com/gmail/nossr50/mcmmo/api/data/MMOPlayer.java +++ b/mcmmo-api/src/main/java/com/gmail/nossr50/mcmmo/api/data/MMOPlayer.java @@ -1,7 +1,5 @@ package com.gmail.nossr50.mcmmo.api.data; -public interface MMOPlayer extends MMOEntity { +public interface MMOPlayer extends MMOEntity { - - N getPlayer(); } diff --git a/mcmmo-api/src/main/java/com/gmail/nossr50/mcmmo/api/platform/PlatformProvider.java b/mcmmo-api/src/main/java/com/gmail/nossr50/mcmmo/api/platform/PlatformProvider.java index f47b014a0..195c4c8dd 100644 --- a/mcmmo-api/src/main/java/com/gmail/nossr50/mcmmo/api/platform/PlatformProvider.java +++ b/mcmmo-api/src/main/java/com/gmail/nossr50/mcmmo/api/platform/PlatformProvider.java @@ -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(); } diff --git a/mcmmo-api/src/main/java/com/gmail/nossr50/mcmmo/api/platform/util/MobHealthBarManager.java b/mcmmo-api/src/main/java/com/gmail/nossr50/mcmmo/api/platform/util/MobHealthBarManager.java new file mode 100644 index 000000000..1646d0ad7 --- /dev/null +++ b/mcmmo-api/src/main/java/com/gmail/nossr50/mcmmo/api/platform/util/MobHealthBarManager.java @@ -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 { + /** + * 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 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 target, double damage); + + +} diff --git a/mcmmo-bukkit/src/main/java/com/gmail/nossr50/mcmmo/bukkit/BukkitBoostrap.java b/mcmmo-bukkit/src/main/java/com/gmail/nossr50/mcmmo/bukkit/BukkitBoostrap.java index ff10dad9d..212572c36 100644 --- a/mcmmo-bukkit/src/main/java/com/gmail/nossr50/mcmmo/bukkit/BukkitBoostrap.java +++ b/mcmmo-bukkit/src/main/java/com/gmail/nossr50/mcmmo/bukkit/BukkitBoostrap.java @@ -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(); diff --git a/mcmmo-bukkit/src/main/java/com/gmail/nossr50/mcmmo/bukkit/platform/scheduler/BukkitPlatformScheduler.java b/mcmmo-bukkit/src/main/java/com/gmail/nossr50/mcmmo/bukkit/platform/scheduler/BukkitPlatformScheduler.java index 85d9b0421..e8872347f 100644 --- a/mcmmo-bukkit/src/main/java/com/gmail/nossr50/mcmmo/bukkit/platform/scheduler/BukkitPlatformScheduler.java +++ b/mcmmo-bukkit/src/main/java/com/gmail/nossr50/mcmmo/bukkit/platform/scheduler/BukkitPlatformScheduler.java @@ -15,7 +15,6 @@ public class BukkitPlatformScheduler implements PlatformScheduler { private final BukkitBoostrap bukkitBoostrap; public BukkitPlatformScheduler(BukkitBoostrap bukkitBoostrap) { - this.bukkitBoostrap = bukkitBoostrap; } diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/util/MobHealthBarManager.java b/mcmmo-bukkit/src/main/java/com/gmail/nossr50/mcmmo/bukkit/platform/util/BukkitMobHealthBarManager.java similarity index 80% rename from mcmmo-core/src/main/java/com/gmail/nossr50/util/MobHealthBarManager.java rename to mcmmo-bukkit/src/main/java/com/gmail/nossr50/mcmmo/bukkit/platform/util/BukkitMobHealthBarManager.java index 9f525d797..fa93557e5 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/util/MobHealthBarManager.java +++ b/mcmmo-bukkit/src/main/java/com/gmail/nossr50/mcmmo/bukkit/platform/util/BukkitMobHealthBarManager.java @@ -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 { 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) { + 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 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 = ""; diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/chat/ChatManager.java b/mcmmo-core/src/main/java/com/gmail/nossr50/chat/ChatManager.java index 8302d43b6..cfa6037ea 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/chat/ChatManager.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/chat/ChatManager.java @@ -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()) { diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/commands/AbilityToggleCommand.java b/mcmmo-core/src/main/java/com/gmail/nossr50/commands/AbilityToggleCommand.java index 9464a92bb..5077b6996 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/commands/AbilityToggleCommand.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/commands/AbilityToggleCommand.java @@ -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(); } diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/commands/GodModeCommand.java b/mcmmo-core/src/main/java/com/gmail/nossr50/commands/GodModeCommand.java index 8081d017d..7409a39e0 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/commands/GodModeCommand.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/commands/GodModeCommand.java @@ -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(); } diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/commands/RefreshCooldownsCommand.java b/mcmmo-core/src/main/java/com/gmail/nossr50/commands/RefreshCooldownsCommand.java index ef14f9cb9..da5c69aee 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/commands/RefreshCooldownsCommand.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/commands/RefreshCooldownsCommand.java @@ -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 diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/commands/admin/PlayerDebugCommand.java b/mcmmo-core/src/main/java/com/gmail/nossr50/commands/admin/PlayerDebugCommand.java index 1621fc6ec..67accad16 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/commands/admin/PlayerDebugCommand.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/commands/admin/PlayerDebugCommand.java @@ -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; diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/commands/chat/ChatSpyCommand.java b/mcmmo-core/src/main/java/com/gmail/nossr50/commands/chat/ChatSpyCommand.java index 2ed8c865e..4909e41af 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/commands/chat/ChatSpyCommand.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/commands/chat/ChatSpyCommand.java @@ -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(); } diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/commands/experience/ExperienceCommand.java b/mcmmo-core/src/main/java/com/gmail/nossr50/commands/experience/ExperienceCommand.java index b75ea1fdf..b20eee624 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/commands/experience/ExperienceCommand.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/commands/experience/ExperienceCommand.java @@ -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); diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/commands/experience/SkillResetCommand.java b/mcmmo-core/src/main/java/com/gmail/nossr50/commands/experience/SkillResetCommand.java index 58db40ecc..105555bc7 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/commands/experience/SkillResetCommand.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/commands/experience/SkillResetCommand.java @@ -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); diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/commands/party/PartyInviteCommand.java b/mcmmo-core/src/main/java/com/gmail/nossr50/commands/party/PartyInviteCommand.java index be0e14d6e..f05be4f70 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/commands/party/PartyInviteCommand.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/commands/party/PartyInviteCommand.java @@ -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")); diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/commands/party/PartyJoinCommand.java b/mcmmo-core/src/main/java/com/gmail/nossr50/commands/party/PartyJoinCommand.java index 463cf009f..e4d1d100d 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/commands/party/PartyJoinCommand.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/commands/party/PartyJoinCommand.java @@ -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)); diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/commands/party/PartyRenameCommand.java b/mcmmo-core/src/main/java/com/gmail/nossr50/commands/party/PartyRenameCommand.java index 9d9a8a43a..e94a7901c 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/commands/party/PartyRenameCommand.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/commands/party/PartyRenameCommand.java @@ -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)) { diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/commands/party/alliance/PartyAllianceInviteCommand.java b/mcmmo-core/src/main/java/com/gmail/nossr50/commands/party/alliance/PartyAllianceInviteCommand.java index 65d07a17a..9d550cabb 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/commands/party/alliance/PartyAllianceInviteCommand.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/commands/party/alliance/PartyAllianceInviteCommand.java @@ -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")); diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/commands/party/teleport/PtpCommand.java b/mcmmo-core/src/main/java/com/gmail/nossr50/commands/party/teleport/PtpCommand.java index 16c6a3ba0..1fac4e5aa 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/commands/party/teleport/PtpCommand.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/commands/party/teleport/PtpCommand.java @@ -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(); diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/commands/player/InspectCommand.java b/mcmmo-core/src/main/java/com/gmail/nossr50/commands/player/InspectCommand.java index b89c0058a..196a11403 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/commands/player/InspectCommand.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/commands/player/InspectCommand.java @@ -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")); diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/commands/player/RankCommand.java b/mcmmo-core/src/main/java/com/gmail/nossr50/commands/player/RankCommand.java index a5924e0df..9f3f8e6b6 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/commands/player/RankCommand.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/commands/player/RankCommand.java @@ -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))) { diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/datatypes/party/Party.java b/mcmmo-core/src/main/java/com/gmail/nossr50/datatypes/party/Party.java index 9deb29f19..6ea79ba5f 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/datatypes/party/Party.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/datatypes/party/Party.java @@ -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()) { diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/datatypes/player/BukkitMMOPlayer.java b/mcmmo-core/src/main/java/com/gmail/nossr50/datatypes/player/BukkitMMOPlayer.java index 2d1611cb2..dd7b086ab 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/datatypes/player/BukkitMMOPlayer.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/datatypes/player/BukkitMMOPlayer.java @@ -695,7 +695,7 @@ public class BukkitMMOPlayer implements MMOPlayer { */ @Override - public Player getPlayer() { + public Player getNative() { return player; } @@ -769,7 +769,7 @@ public class BukkitMMOPlayer implements MMOPlayer { } public void loginParty() { - party.addOnlineMember(this.getPlayer()); + party.addOnlineMember(this.getNative()); } public int getItemShareModifier() { @@ -903,7 +903,7 @@ public class BukkitMMOPlayer implements MMOPlayer { //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 { * @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(); diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/acrobatics/Roll.java b/mcmmo-core/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/acrobatics/Roll.java index c95f557c6..49d415266 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/acrobatics/Roll.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/datatypes/skills/subskills/acrobatics/Roll.java @@ -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; diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/listeners/SelfListener.java b/mcmmo-core/src/main/java/com/gmail/nossr50/listeners/SelfListener.java index 77c989a0d..7722e0d19 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/listeners/SelfListener.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/listeners/SelfListener.java @@ -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()); } } diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/mcMMO.java b/mcmmo-core/src/main/java/com/gmail/nossr50/mcMMO.java index 2e1e5f5a7..417051061 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/mcMMO.java @@ -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; } diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/party/PartyManager.java b/mcmmo-core/src/main/java/com/gmail/nossr50/party/PartyManager.java index fb010e65c..2d6d6d17b 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/party/PartyManager.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/party/PartyManager.java @@ -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()); } /** diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/party/ShareHandler.java b/mcmmo-core/src/main/java/com/gmail/nossr50/party/ShareHandler.java index 12c0ad3a7..c88e719a6 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/party/ShareHandler.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/party/ShareHandler.java @@ -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(); diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/runnables/items/ChimaeraWingWarmup.java b/mcmmo-core/src/main/java/com/gmail/nossr50/runnables/items/ChimaeraWingWarmup.java index f90f2d70b..b7212e1e7 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/runnables/items/ChimaeraWingWarmup.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/runnables/items/ChimaeraWingWarmup.java @@ -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); diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/runnables/items/TeleportationWarmup.java b/mcmmo-core/src/main/java/com/gmail/nossr50/runnables/items/TeleportationWarmup.java index 38ad059a4..13422f2ee 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/runnables/items/TeleportationWarmup.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/runnables/items/TeleportationWarmup.java @@ -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); diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/runnables/skills/AbilityCooldownTask.java b/mcmmo-core/src/main/java/com/gmail/nossr50/runnables/skills/AbilityCooldownTask.java index 98fd4264e..79539bd40 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/runnables/skills/AbilityCooldownTask.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/runnables/skills/AbilityCooldownTask.java @@ -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()); } } diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/runnables/skills/AbilityDisableTask.java b/mcmmo-core/src/main/java/com/gmail/nossr50/runnables/skills/AbilityDisableTask.java index 48b51cf14..83d9b9466 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/runnables/skills/AbilityDisableTask.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/runnables/skills/AbilityDisableTask.java @@ -26,7 +26,7 @@ public class AbilityDisableTask extends BukkitRunnable { return; } - Player player = mcMMOPlayer.getPlayer(); + Player player = mcMMOPlayer.getNative(); switch (superAbilityType) { case SUPER_BREAKER: diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/runnables/skills/ToolLowerTask.java b/mcmmo-core/src/main/java/com/gmail/nossr50/runnables/skills/ToolLowerTask.java index fb3c11f67..c17a8926a 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/runnables/skills/ToolLowerTask.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/runnables/skills/ToolLowerTask.java @@ -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()); } } } diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/skills/SkillManager.java b/mcmmo-core/src/main/java/com/gmail/nossr50/skills/SkillManager.java index 41bfa0ec0..021557780 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/skills/SkillManager.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/skills/SkillManager.java @@ -21,7 +21,7 @@ public abstract class SkillManager { } public Player getPlayer() { - return mcMMOPlayer.getPlayer(); + return mcMMOPlayer.getNative(); } public int getSkillLevel() { diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java b/mcmmo-core/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java index 934fbe1df..bac25c936 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java @@ -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 diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/util/ChimaeraWing.java b/mcmmo-core/src/main/java/com/gmail/nossr50/util/ChimaeraWing.java index b1f519893..d46176cf9 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/util/ChimaeraWing.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/util/ChimaeraWing.java @@ -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()); diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/util/commands/CommandTools.java b/mcmmo-core/src/main/java/com/gmail/nossr50/util/commands/CommandTools.java index 427cae861..2d89ebd9c 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/util/commands/CommandTools.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/util/commands/CommandTools.java @@ -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; } diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/util/experience/ExperienceBarWrapper.java b/mcmmo-core/src/main/java/com/gmail/nossr50/util/experience/ExperienceBarWrapper.java index ffe1f835c..e861f1d77 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/util/experience/ExperienceBarWrapper.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/util/experience/ExperienceBarWrapper.java @@ -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()); } } diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java b/mcmmo-core/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java index 0c5131634..dec980ffd 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java @@ -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); } /** diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/util/player/UserManager.java b/mcmmo-core/src/main/java/com/gmail/nossr50/util/player/UserManager.java index a47d6b98c..822b0f0ea 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/util/player/UserManager.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/util/player/UserManager.java @@ -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<>(); diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardManager.java b/mcmmo-core/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardManager.java index b9ea74942..6e3e358d2 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardManager.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/util/scoreboards/ScoreboardManager.java @@ -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); diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/util/skills/CombatTools.java b/mcmmo-core/src/main/java/com/gmail/nossr50/util/skills/CombatTools.java index 9ccb36144..70f475328 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/util/skills/CombatTools.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/util/skills/CombatTools.java @@ -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; } diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/util/skills/RankTools.java b/mcmmo-core/src/main/java/com/gmail/nossr50/util/skills/RankTools.java index 76559bcf7..38ef0278c 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/util/skills/RankTools.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/util/skills/RankTools.java @@ -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 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 diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/util/skills/SkillTools.java b/mcmmo-core/src/main/java/com/gmail/nossr50/util/skills/SkillTools.java index f6ca174ae..9261bade8 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/util/skills/SkillTools.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/util/skills/SkillTools.java @@ -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) {