Search in sources :

Example 86 with ISoliniaPlayer

use of com.solinia.solinia.Interfaces.ISoliniaPlayer in project solinia3-core by mixxit.

the class SoliniaActiveSpell method applyGate.

private void applyGate(SpellEffect spellEffect, ISoliniaSpell soliniaSpell, int casterLevel) {
    if (!isOwnerPlayer())
        return;
    Player player = (Player) getLivingEntity();
    try {
        ISoliniaPlayer solPlayer = SoliniaPlayerAdapter.Adapt(player);
        String blocation = solPlayer.getBindPoint();
        if (blocation == null || solPlayer.getBindPoint().equals("")) {
            player.sendMessage("Could not teleport, you are not bound to a location (by bind affinity)");
            return;
        }
        String[] loc = solPlayer.getBindPoint().split(",");
        Location location = new Location(Bukkit.getWorld(loc[0]), Double.parseDouble(loc[1]), Double.parseDouble(loc[2]), Double.parseDouble(loc[3]));
        player.setBedSpawnLocation(location, true);
        player.teleport(location);
    } catch (CoreStateInitException e) {
    }
}
Also used : Player(org.bukkit.entity.Player) ISoliniaPlayer(com.solinia.solinia.Interfaces.ISoliniaPlayer) CoreStateInitException(com.solinia.solinia.Exceptions.CoreStateInitException) ISoliniaPlayer(com.solinia.solinia.Interfaces.ISoliniaPlayer) Location(org.bukkit.Location)

Example 87 with ISoliniaPlayer

use of com.solinia.solinia.Interfaces.ISoliniaPlayer in project solinia3-core by mixxit.

the class SoliniaLivingEntity method tryIncreaseSkill.

@Override
public void tryIncreaseSkill(String skillName, int amount) {
    if (!isPlayer())
        return;
    try {
        ISoliniaPlayer solplayerReward = SoliniaPlayerAdapter.Adapt((Player) this.getBukkitLivingEntity());
        solplayerReward.tryIncreaseSkill(skillName, amount);
    } catch (CoreStateInitException e) {
    // dont increase skill
    }
}
Also used : CoreStateInitException(com.solinia.solinia.Exceptions.CoreStateInitException) ISoliniaPlayer(com.solinia.solinia.Interfaces.ISoliniaPlayer)

Example 88 with ISoliniaPlayer

use of com.solinia.solinia.Interfaces.ISoliniaPlayer in project solinia3-core by mixxit.

the class SoliniaLivingEntity method getIntelligence.

@Override
public int getIntelligence() {
    if (getNpcid() < 1 && !isPlayer())
        return 1;
    try {
        if (getNpcid() > 0) {
            ISoliniaNPC npc = StateManager.getInstance().getConfigurationManager().getNPC(getNpcid());
            if (npc == null)
                return 1;
            int stat = npc.getLevel() * 5;
            stat += Utils.getTotalEffectStat(this.getBukkitLivingEntity(), "INTELLIGENCE");
            if (stat > getMaxStat("INTELLIGENCE"))
                stat = getMaxStat("INTELLIGENCE");
            return stat;
        }
        if (isPlayer()) {
            ISoliniaPlayer solplayer = SoliniaPlayerAdapter.Adapt((Player) getBukkitLivingEntity());
            if (solplayer == null)
                return 1;
            int stat = 1;
            if (solplayer.getRace() != null)
                stat += solplayer.getRace().getIntelligence();
            stat += solplayer.getTotalItemStat("INTELLIGENCE");
            stat += Utils.getTotalEffectStat(this.getBukkitLivingEntity(), "INTELLIGENCE");
            stat += Utils.getTotalAAEffectStat(this.getBukkitLivingEntity(), "INTELLIGENCE");
            if (stat > getMaxStat("INTELLIGENCE"))
                stat = getMaxStat("INTELLIGENCE");
            return stat;
        }
    } catch (CoreStateInitException e) {
        return 1;
    }
    return 1;
}
Also used : CoreStateInitException(com.solinia.solinia.Exceptions.CoreStateInitException) ISoliniaNPC(com.solinia.solinia.Interfaces.ISoliniaNPC) ISoliniaPlayer(com.solinia.solinia.Interfaces.ISoliniaPlayer)

Example 89 with ISoliniaPlayer

use of com.solinia.solinia.Interfaces.ISoliniaPlayer in project solinia3-core by mixxit.

the class ScoreboardUtils method RemoveScoreboard.

public static void RemoveScoreboard(UUID uuid) {
    if (StateManager.getInstance().getScoreboard(Bukkit.getPlayer(uuid)).getObjective("playercard") != null)
        StateManager.getInstance().getScoreboard(Bukkit.getPlayer(uuid)).getObjective("playercard").unregister();
    Bukkit.getPlayer(uuid).setScoreboard(StateManager.getInstance().getScoreboard(Bukkit.getPlayer(uuid)));
    Objective objective = StateManager.getInstance().getScoreboard(Bukkit.getPlayer(uuid)).registerNewObjective("playercard", "dummy");
    objective.setDisplaySlot(DisplaySlot.SIDEBAR);
    objective.setDisplayName("Party");
    if (StateManager.getInstance().getScoreboard(Bukkit.getPlayer(uuid)).getObjective("showhealth") != null)
        StateManager.getInstance().getScoreboard(Bukkit.getPlayer(uuid)).getObjective("showhealth").unregister();
    Objective health = StateManager.getInstance().getScoreboard(Bukkit.getPlayer(uuid)).registerNewObjective("showhealth", "health");
    health.setDisplayName(ChatColor.RED + "❤");
    health.setDisplaySlot(DisplaySlot.BELOW_NAME);
    try {
        ISoliniaPlayer solplayer = SoliniaPlayerAdapter.Adapt(Bukkit.getPlayer(uuid));
        Score score = objective.getScore(ChatColor.GOLD + solplayer.getFullName() + "");
        score.setScore(solplayer.getLevel());
    } catch (CoreStateInitException e) {
        e.printStackTrace();
    }
}
Also used : Objective(org.bukkit.scoreboard.Objective) Score(org.bukkit.scoreboard.Score) CoreStateInitException(com.solinia.solinia.Exceptions.CoreStateInitException) ISoliniaPlayer(com.solinia.solinia.Interfaces.ISoliniaPlayer)

Aggregations

ISoliniaPlayer (com.solinia.solinia.Interfaces.ISoliniaPlayer)89 CoreStateInitException (com.solinia.solinia.Exceptions.CoreStateInitException)85 Player (org.bukkit.entity.Player)57 ISoliniaNPC (com.solinia.solinia.Interfaces.ISoliniaNPC)16 ISoliniaLivingEntity (com.solinia.solinia.Interfaces.ISoliniaLivingEntity)13 ISoliniaItem (com.solinia.solinia.Interfaces.ISoliniaItem)12 EventHandler (org.bukkit.event.EventHandler)11 LivingEntity (org.bukkit.entity.LivingEntity)10 ArrayList (java.util.ArrayList)9 UUID (java.util.UUID)9 SoliniaItemException (com.solinia.solinia.Exceptions.SoliniaItemException)8 TextComponent (net.md_5.bungee.api.chat.TextComponent)8 ItemStack (org.bukkit.inventory.ItemStack)8 CommandSender (org.bukkit.command.CommandSender)5 ConsoleCommandSender (org.bukkit.command.ConsoleCommandSender)5 Entity (org.bukkit.entity.Entity)5 Timestamp (java.sql.Timestamp)4 LocalDateTime (java.time.LocalDateTime)4 ComponentBuilder (net.md_5.bungee.api.chat.ComponentBuilder)4 HoverEvent (net.md_5.bungee.api.chat.HoverEvent)4