use of org.spongepowered.api.entity.living.player.Player in project Skree by Skelril.
the class SoulReaper method apply.
@Override
public Optional<Instruction<DamageCondition, Boss<Zombie, CatacombsBossDetail>>> apply(DamageCondition damageCondition, Boss<Zombie, CatacombsBossDetail> zombieCatacombsBossDetailBoss) {
CatacombsBossDetail detail = zombieCatacombsBossDetailBoss.getDetail();
Entity attacked = damageCondition.getAttacked();
if (attacked instanceof Player && activate(detail)) {
Task.builder().execute(() -> {
Optional<Zombie> optZombie = zombieCatacombsBossDetailBoss.getTargetEntity();
if (optZombie.isPresent()) {
Zombie boss = optZombie.get();
double stolen = EntityHealthUtil.getHealth((Living) attacked) - 1;
attacked.offer(Keys.HEALTH, 1D);
EntityHealthUtil.heal(boss, stolen);
((Player) attacked).sendMessage(Text.of(TextColors.RED, "The necromancer reaps your soul."));
}
}).delayTicks(1).submit(SkreePlugin.inst());
}
return Optional.empty();
}
use of org.spongepowered.api.entity.living.player.Player in project Skree by Skelril.
the class TheForgeListener method onPlayerCombat.
@Listener
public void onPlayerCombat(CollideEntityEvent.Impact event, @First Projectile projectile) {
Optional<TheForgeInstance> optInst = manager.getApplicableZone(projectile);
if (!optInst.isPresent()) {
return;
}
new PlayerCombatParser() {
@Override
public void processMonsterAttack(Living attacker, Player defender) {
if (!(event instanceof DamageEntityEvent)) {
return;
}
DamageEntityEvent dEvent = (DamageEntityEvent) event;
if (isFlying(defender)) {
dEvent.setBaseDamage(dEvent.getBaseDamage() * 3);
}
}
}.parse(event);
}
use of org.spongepowered.api.entity.living.player.Player in project Skree by Skelril.
the class TempleOfFateInstance method feedPlayers.
private void feedPlayers() {
for (Player player : getPlayers(PARTICIPANT)) {
player.offer(Keys.FOOD_LEVEL, 20);
player.offer(Keys.SATURATION, 5D);
}
}
use of org.spongepowered.api.entity.living.player.Player in project Skree by Skelril.
the class CursedMineListener method onPlayerDeath.
@Listener
public void onPlayerDeath(DestructEntityEvent.Death event) {
Entity entity = event.getTargetEntity();
if (!(entity instanceof Player)) {
return;
}
Player player = (Player) entity;
Optional<CursedMineInstance> optInst = manager.getApplicableZone(player);
HitList hitList = manager.getHitList();
if (optInst.isPresent() || hitList.isOnHitList(player)) {
if (!optInst.isPresent()) {
optInst = manager.getActiveZone();
}
if (optInst.isPresent()) {
optInst.get().revertPlayer(player);
optInst.get().clearCurses(player);
}
if (hitList.isOnHitList(player)) {
hitList.remPlayer(player);
}
String deathMessage;
switch(Probability.getRandom(11)) {
case 1:
deathMessage = " was killed by Dave";
break;
case 2:
deathMessage = " got on Dave's bad side";
break;
case 3:
deathMessage = " was slain by an evil spirit";
break;
case 4:
deathMessage = " needs to stay away from the cursed mine";
break;
case 5:
deathMessage = " enjoys death a little too much";
break;
case 6:
deathMessage = " seriously needs to stop mining";
break;
case 7:
deathMessage = " angered an evil spirit";
break;
case 8:
deathMessage = " doesn't get a cookie from COOKIE";
break;
case 9:
deathMessage = " should stay away";
break;
case 10:
deathMessage = " needs to consider retirement";
break;
default:
deathMessage = "'s head is now on Dave's mantel";
break;
}
event.setMessage(Text.of(player.getName(), deathMessage));
// addSkull(player);
}
}
use of org.spongepowered.api.entity.living.player.Player in project Skree by Skelril.
the class RegionSelectCommand method execute.
@Override
public CommandResult execute(CommandSource src, CommandContext args) throws CommandException {
if (!(src instanceof Player)) {
src.sendMessage(Text.of("You must be a player to use this command (for now ;) )!"));
return CommandResult.empty();
}
Optional<RegionService> optService = Sponge.getServiceManager().provide(RegionService.class);
if (!optService.isPresent()) {
src.sendMessage(Text.of(TextColors.DARK_RED, "The region service is not currently running."));
return CommandResult.empty();
}
RegionService service = optService.get();
Player player = (Player) src;
Optional<Player> optPlayer = args.getOne("player");
Optional<Location<World>> optLocation = args.getOne("location");
Optional<Region> optRegion;
if (optPlayer.isPresent()) {
Player targPlayer = optPlayer.get();
optRegion = service.get(targPlayer.getLocation());
player.sendMessage(Text.of(TextColors.YELLOW, "Searching for ", targPlayer.getName(), "'s local region..."));
} else if (optLocation.isPresent()) {
optRegion = service.get(optLocation.get());
player.sendMessage(Text.of(TextColors.YELLOW, "Searching for a region at the given location..."));
} else {
optRegion = service.get(player.getLocation());
player.sendMessage(Text.of(TextColors.YELLOW, "Searching for your local region..."));
}
service.setSelectedRegion(player, optRegion.orElse(null));
if (optRegion.isPresent()) {
player.sendMessage(Text.of(TextColors.YELLOW, "Region found! View information with ", Text.of(TextColors.GREEN, TextActions.runCommand("/region info"), "/region info")));
} else {
player.sendMessage(Text.of(TextColors.YELLOW, "No region found, your region selection has been cleared"));
}
return CommandResult.success();
}
Aggregations