mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-24 14:16:45 +01:00
Return type McMMOPlayer from UserManager
This commit is contained in:
parent
7c270feacb
commit
a379b90c46
@ -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;
|
||||
@ -218,13 +220,12 @@ public class EntityListener implements Listener {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user