diff --git a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java index 976ba6567..0d817bd21 100644 --- a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java @@ -5,6 +5,8 @@ import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.WorldBlacklist; import com.gmail.nossr50.config.experience.ExperienceConfig; import com.gmail.nossr50.datatypes.meta.ProjectileOriginMeta; +import com.gmail.nossr50.datatypes.player.McMMOPlayer; +import com.neetgames.mcmmo.player.MMOPlayer; import com.neetgames.mcmmo.player.OnlineMMOPlayer; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType; @@ -212,19 +214,18 @@ public class EntityListener implements Listener { return; } - if (RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkillType.ARCHERY_ARROW_RETRIEVAL, player)) { - projectile.setMetadata(mcMMO.trackedArrow, mcMMO.metadataValue); - } + if (RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkillType.ARCHERY_ARROW_RETRIEVAL, player)) { + projectile.setMetadata(mcMMO.trackedArrow, mcMMO.metadataValue); } } } } - private void markProjectileOriginAsCrossbow(Projectile projectile) { + private void markProjectileOriginAsCrossbow(@NotNull Projectile projectile) { projectile.setMetadata(mcMMO.PROJECTILE_ORIGIN_METAKEY, new ProjectileOriginMeta(plugin, 2)); } - private void markProjectileOriginAsBow(Projectile projectile) { + private void markProjectileOriginAsBow(@NotNull Projectile projectile) { projectile.setMetadata(mcMMO.PROJECTILE_ORIGIN_METAKEY, new ProjectileOriginMeta(plugin, 1)); } @@ -567,14 +568,14 @@ public class EntityListener implements Listener { return; } - OnlineMMOPlayer mmoPlayer = mcMMO.getUserManager().queryPlayer(player); + McMMOPlayer mmoPlayer = (McMMOPlayer) mcMMO.getUserManager().queryPlayer(player); //Profile not loaded if(mmoPlayer == null) return; /* Check for invincibility */ - if (mmoPlayer.getGodMode()) { + if (mmoPlayer.isGodMode()) { event.setCancelled(true); return; } diff --git a/src/main/java/com/gmail/nossr50/util/player/UserManager.java b/src/main/java/com/gmail/nossr50/util/player/UserManager.java index 5da4b44d3..f2a1e418a 100644 --- a/src/main/java/com/gmail/nossr50/util/player/UserManager.java +++ b/src/main/java/com/gmail/nossr50/util/player/UserManager.java @@ -59,12 +59,12 @@ public final class UserManager { * @param player target player * @return OnlineMMOPlayer object for this player, null if Player has not been loaded */ - public @Nullable OnlineMMOPlayer queryPlayer(@Nullable Player player) { + public @Nullable McMMOPlayer queryPlayer(@Nullable Player player) { if(player == null) return null; if(player.hasMetadata(mcMMO.playerDataKey)) - return (OnlineMMOPlayer) player.getMetadata(mcMMO.playerDataKey).get(0).value(); + return (McMMOPlayer) player.getMetadata(mcMMO.playerDataKey).get(0).value(); else return null; }