Search in sources :

Example 56 with CoreStateInitException

use of com.solinia.solinia.Exceptions.CoreStateInitException in project solinia3-core by mixxit.

the class ConfigurationManager method getSpellsByClassId.

@Override
public List<ISoliniaSpell> getSpellsByClassId(int classId) {
    List<ISoliniaSpell> returnSpells = new ArrayList<ISoliniaSpell>();
    ISoliniaClass classObj;
    try {
        classObj = StateManager.getInstance().getConfigurationManager().getClassObj(classId);
    } catch (CoreStateInitException e) {
        return returnSpells;
    }
    for (ISoliniaSpell spell : getSpells()) {
        boolean addSpell = false;
        for (SoliniaSpellClass spellclass : spell.getAllowedClasses()) {
            if (spellclass.getClassname().toUpperCase().equals(classObj.getName().toUpperCase())) {
                addSpell = true;
                break;
            }
        }
        if (addSpell == true)
            returnSpells.add(spell);
    }
    return returnSpells;
}
Also used : ISoliniaClass(com.solinia.solinia.Interfaces.ISoliniaClass) ISoliniaSpell(com.solinia.solinia.Interfaces.ISoliniaSpell) CoreStateInitException(com.solinia.solinia.Exceptions.CoreStateInitException) ArrayList(java.util.ArrayList) SoliniaSpellClass(com.solinia.solinia.Models.SoliniaSpellClass)

Example 57 with CoreStateInitException

use of com.solinia.solinia.Exceptions.CoreStateInitException in project solinia3-core by mixxit.

the class ConfigurationManager method getSpellsByClassIdAndMaxLevel.

@Override
public List<ISoliniaSpell> getSpellsByClassIdAndMaxLevel(int classId, int level) {
    List<ISoliniaSpell> returnSpells = new ArrayList<ISoliniaSpell>();
    ISoliniaClass classObj;
    try {
        classObj = StateManager.getInstance().getConfigurationManager().getClassObj(classId);
    } catch (CoreStateInitException e) {
        return returnSpells;
    }
    for (ISoliniaSpell spell : getSpells()) {
        boolean addSpell = false;
        for (SoliniaSpellClass spellclass : spell.getAllowedClasses()) {
            if (spellclass.getMinlevel() > level)
                continue;
            if (spellclass.getClassname().toUpperCase().equals(classObj.getName().toUpperCase())) {
                addSpell = true;
                break;
            }
        }
        if (addSpell == true)
            returnSpells.add(spell);
    }
    return returnSpells;
}
Also used : ISoliniaClass(com.solinia.solinia.Interfaces.ISoliniaClass) ISoliniaSpell(com.solinia.solinia.Interfaces.ISoliniaSpell) CoreStateInitException(com.solinia.solinia.Exceptions.CoreStateInitException) ArrayList(java.util.ArrayList) SoliniaSpellClass(com.solinia.solinia.Models.SoliniaSpellClass)

Example 58 with CoreStateInitException

use of com.solinia.solinia.Exceptions.CoreStateInitException in project solinia3-core by mixxit.

the class Solinia3CorePlayerListener method onPlayerRespawn.

@EventHandler
public void onPlayerRespawn(PlayerRespawnEvent event) {
    try {
        ISoliniaPlayer solplayer = SoliniaPlayerAdapter.Adapt(event.getPlayer());
        if (solplayer != null) {
            solplayer.updateMaxHp();
            if (solplayer.getBindPoint() != null && !solplayer.getBindPoint().equals("")) {
                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]));
                event.setRespawnLocation(location);
                event.getPlayer().teleport(location);
            }
        }
    } catch (CoreStateInitException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
Also used : CoreStateInitException(com.solinia.solinia.Exceptions.CoreStateInitException) ISoliniaPlayer(com.solinia.solinia.Interfaces.ISoliniaPlayer) Location(org.bukkit.Location) EventHandler(org.bukkit.event.EventHandler)

Example 59 with CoreStateInitException

use of com.solinia.solinia.Exceptions.CoreStateInitException in project solinia3-core by mixxit.

the class SoliniaLivingEntity method getMaxStat.

@Override
public int getMaxStat(String skillname) {
    int baseMaxStat = 255;
    ISoliniaAAAbility aa = null;
    try {
        aa = StateManager.getInstance().getConfigurationManager().getFirstAAAbilityBySysname("PLANARPOWER");
    } catch (CoreStateInitException e) {
    }
    int rank = 0;
    if (aa != null) {
        rank = Utils.getRankOfAAAbility(getBukkitLivingEntity(), aa);
    }
    if (rank == 0) {
        return baseMaxStat;
    } else {
        return baseMaxStat + (rank * 5);
    }
}
Also used : CoreStateInitException(com.solinia.solinia.Exceptions.CoreStateInitException) ISoliniaAAAbility(com.solinia.solinia.Interfaces.ISoliniaAAAbility)

Example 60 with CoreStateInitException

use of com.solinia.solinia.Exceptions.CoreStateInitException in project solinia3-core by mixxit.

the class SoliniaLootTable method sendLootTableSettingsToSender.

@Override
public void sendLootTableSettingsToSender(CommandSender sender) {
    try {
        for (ISoliniaLootTableEntry le : getEntries()) {
            ISoliniaLootDrop ld = StateManager.getInstance().getConfigurationManager().getLootDrop(le.getLootdropid());
            sender.sendMessage("- " + ChatColor.GOLD + ld.getName().toUpperCase() + ChatColor.RESET + "[" + ld.getId() + "]:");
            for (ISoliniaLootDropEntry lde : ld.getEntries()) {
                ISoliniaItem i = StateManager.getInstance().getConfigurationManager().getItem(lde.getItemid());
                sender.sendMessage("  - " + ChatColor.GOLD + i.getDisplayname() + ChatColor.RESET + "[" + i.getId() + "] - " + lde.getChance() + "% chance Count: " + lde.getCount() + " Always: " + lde.isAlways());
            }
        }
    } catch (CoreStateInitException e) {
        sender.sendMessage(e.getMessage());
    }
}
Also used : ISoliniaLootDropEntry(com.solinia.solinia.Interfaces.ISoliniaLootDropEntry) ISoliniaItem(com.solinia.solinia.Interfaces.ISoliniaItem) ISoliniaLootTableEntry(com.solinia.solinia.Interfaces.ISoliniaLootTableEntry) CoreStateInitException(com.solinia.solinia.Exceptions.CoreStateInitException) ISoliniaLootDrop(com.solinia.solinia.Interfaces.ISoliniaLootDrop)

Aggregations

CoreStateInitException (com.solinia.solinia.Exceptions.CoreStateInitException)216 Player (org.bukkit.entity.Player)114 ISoliniaPlayer (com.solinia.solinia.Interfaces.ISoliniaPlayer)99 ISoliniaNPC (com.solinia.solinia.Interfaces.ISoliniaNPC)43 CommandSender (org.bukkit.command.CommandSender)42 ISoliniaLivingEntity (com.solinia.solinia.Interfaces.ISoliniaLivingEntity)41 ISoliniaItem (com.solinia.solinia.Interfaces.ISoliniaItem)36 ConsoleCommandSender (org.bukkit.command.ConsoleCommandSender)36 LivingEntity (org.bukkit.entity.LivingEntity)32 ArrayList (java.util.ArrayList)31 Entity (org.bukkit.entity.Entity)21 ItemStack (org.bukkit.inventory.ItemStack)20 SoliniaItemException (com.solinia.solinia.Exceptions.SoliniaItemException)17 ISoliniaSpell (com.solinia.solinia.Interfaces.ISoliniaSpell)16 EventHandler (org.bukkit.event.EventHandler)16 Timestamp (java.sql.Timestamp)13 TextComponent (net.md_5.bungee.api.chat.TextComponent)12 CraftEntity (org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity)11 CraftLivingEntity (org.bukkit.craftbukkit.v1_12_R1.entity.CraftLivingEntity)11 PathEntity (net.minecraft.server.v1_12_R1.PathEntity)10