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;
}
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;
}
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();
}
}
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);
}
}
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());
}
}
Aggregations