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