use of org.spongepowered.api.world.World in project Skree by Skelril.
the class AntiJumpListener method onBlockPlace.
@Listener(order = Order.POST)
@IsCancelled(value = Tristate.TRUE)
public void onBlockPlace(ChangeBlockEvent.Place event, @Root Player player) {
final Location<World> playerLoc = player.getLocation();
for (Transaction<BlockSnapshot> transaction : event.getTransactions()) {
Optional<Location<World>> optLoc = transaction.getOriginal().getLocation();
if (!optLoc.isPresent()) {
continue;
}
Location<World> blockLoc = optLoc.get();
final int blockY = blockLoc.getBlockY();
if (Math.abs(player.getVelocity().getY()) > UPWARDS_VELOCITY && playerLoc.getY() > blockY) {
Task.builder().execute(() -> {
Vector3d position = player.getLocation().getPosition();
if (position.getY() >= (blockY + LEAP_DISTANCE)) {
if (playerLoc.getPosition().distanceSquared(blockLoc.getPosition()) > Math.pow(RADIUS, 2)) {
return;
}
player.sendMessage(Text.of(TextColors.RED, "Hack jumping detected."));
player.setLocation(playerLoc.setPosition(new Vector3d(position.getX(), blockY, position.getZ())));
}
}).delayTicks(4).submit(SkreePlugin.inst());
}
}
}
use of org.spongepowered.api.world.World in project Skree by Skelril.
the class AntiRailDupeListener method onPistonMove.
@Listener
public void onPistonMove(ChangeBlockEvent event, @Named(NamedCause.SOURCE) Piston piston) {
event.getTransactions().stream().map(Transaction::getFinal).forEach(block -> {
BlockType finalType = block.getState().getType();
if (railBlocks.contains(finalType)) {
Location<World> location = block.getLocation().get();
Task.builder().execute(() -> {
location.setBlockType(BlockTypes.AIR, Cause.source(SkreePlugin.container()).build());
}).delayTicks(1).submit(SkreePlugin.inst());
}
});
}
use of org.spongepowered.api.world.World in project Skree by Skelril.
the class WorldSystem method loadWorld.
private void loadWorld(WorldConfig worldConfig) throws Throwable {
World world = getOrCreateWorld(worldConfig);
String targetWrapper = worldConfig.getWrapper();
if (targetWrapper == null || targetWrapper.isEmpty()) {
return;
}
wrappers.get(targetWrapper).addWorld(world);
}
use of org.spongepowered.api.world.World in project Skree by Skelril.
the class ThorAttack method apply.
@Override
public Optional<Instruction<DamageCondition, Boss<Zombie, CatacombsBossDetail>>> apply(DamageCondition damageCondition, Boss<Zombie, CatacombsBossDetail> zombieCatacombsBossDetailBoss) {
Living bossEnt = zombieCatacombsBossDetailBoss.getTargetEntity().get();
Entity toHit = damageCondition.getAttacked();
toHit.setVelocity(EntityDirectionUtil.getFacingVector(bossEnt).mul(2));
Task.builder().execute(() -> {
Location<World> targetLoc = toHit.getLocation();
Task.builder().execute(() -> {
Lightning lightning = (Lightning) toHit.getWorld().createEntity(EntityTypes.LIGHTNING, targetLoc.getPosition());
toHit.getWorld().spawnEntity(lightning, Cause.source(SpawnCause.builder().type(SpawnTypes.PLUGIN).build()).build());
}).delay(750, TimeUnit.MILLISECONDS).submit(SkreePlugin.inst());
}).delay(1500, TimeUnit.MILLISECONDS).submit(SkreePlugin.inst());
return Optional.empty();
}
use of org.spongepowered.api.world.World in project Skree by Skelril.
the class TheForgeInstance method dropResults.
private void dropResults() {
Location<World> targetDropPoint = centralDropPoint.add(Probability.pickOneOf(pointAdjustments));
new FixedPointItemDropper(targetDropPoint).dropStacks(getProduce(), SpawnTypes.PLUGIN);
state.save();
}
Aggregations