use of com.flowpowered.math.vector.Vector3d in project Skree by Skelril.
the class GoldRushInstance method moveToRoom.
private void moveToRoom(Player player, ZoneBoundingBox room) {
Vector3d target = room.getCenter();
target = new Vector3d(target.getX(), 2, target.getZ());
player.setLocation(new Location<>(getRegion().getExtent(), target));
}
use of com.flowpowered.math.vector.Vector3d in project Skree by Skelril.
the class SkyWarsInstance method setup.
private void setup() {
teams = createTeamsMapping();
Vector3d centerPoint = getRegion().getCenter();
startingLocation = new Location<>(getRegion().getExtent(), centerPoint.getX(), 14, centerPoint.getZ());
showStartingPlatform(true);
}
use of com.flowpowered.math.vector.Vector3d in project Skree by Skelril.
the class AntiPeskListener method punish.
private void punish(Player player) {
player.sendMessage(Text.of(TextColors.RED, "Command forbidden..."));
player.sendMessage(Text.of(TextColors.RED, "... prepare to hate your life ..."));
IntegratedRunnable integratedRunnable = new IntegratedRunnable() {
@Override
public boolean run(int times) {
player.setVelocity(new Vector3d(Probability.getRangedRandom(-3.0, 3.0), Probability.getRangedRandom(-3.0, 3.0), Probability.getRangedRandom(-3.0, 3.0)));
return true;
}
@Override
public void end() {
player.kick(Text.of("How about you don't do that again, K?"));
}
};
TimedRunnable<IntegratedRunnable> runnable = new TimedRunnable<>(integratedRunnable, 12);
Task task = Task.builder().execute(runnable).interval(1, TimeUnit.SECONDS).delay(5, TimeUnit.SECONDS).submit(SkreePlugin.inst());
runnable.setTask(task);
}
use of com.flowpowered.math.vector.Vector3d in project Skree by Skelril.
the class VelocityEntitySpawner method sendRadial.
public static List<Entity> sendRadial(EntityType type, Living living, int amt, float speed, Cause cause) {
Location<World> livingLocation = living.getLocation();
Optional<EyeLocationProperty> optEyeLoc = living.getProperty(EyeLocationProperty.class);
if (optEyeLoc.isPresent()) {
Vector3d eyePosition = optEyeLoc.get().getValue();
livingLocation = livingLocation.setPosition(eyePosition);
}
return sendRadial(type, livingLocation, amt, speed, cause);
}
use of com.flowpowered.math.vector.Vector3d in project Skree by Skelril.
the class VelocityEntitySpawner method send.
public static Optional<Entity> send(EntityType type, Location<World> loc, Vector3d dir, float speed, Cause cause) {
Vector3d actualDir = dir.normalize();
// Shift the entity out two movements to prevent collision with the source entity
Vector3d finalVecLoc = loc.getPosition().add(actualDir.mul(2));
loc = loc.setPosition(finalVecLoc);
Entity entity = loc.getExtent().createEntity(type, loc.getPosition());
entity.setVelocity(dir.mul(speed));
return loc.getExtent().spawnEntity(entity, cause) ? Optional.of(entity) : Optional.empty();
}
Aggregations