use of gg.projecteden.nexus.models.aeveonproject.AeveonProjectUser in project Nexus by ProjectEdenGG.
the class ClientsideBlocks method update.
public static void update(Player player, String region) {
if (!service.hasStarted(player))
return;
AeveonProjectUser user = service.get(player);
// Any Ship Color Region
if (region.contains("shipcolor")) {
Color shipColor = user.getShipColor();
ColorType colorType;
Material concreteType = Material.BLACK_CONCRETE;
Material bedType = Material.BLACK_BED;
if (shipColor != null) {
colorType = ColorType.of(shipColor);
if (colorType != null) {
concreteType = colorType.getConcrete();
bedType = colorType.getBed();
}
}
List<Block> blocks = worldedit().getBlocks(worldguard().getRegion(getShipColorRegion(region)));
for (Block block : blocks) {
if (block.getType().equals(Material.WHITE_CONCRETE))
user.getOnlinePlayer().sendBlockChange(block.getLocation(), concreteType.createBlockData());
else if (block.getType().equals(Material.WHITE_BED)) {
BlockData blockData = bedType.createBlockData();
Bed newBed = (Bed) blockData;
Bed oldBed = (Bed) block.getBlockData();
if (oldBed.getPart().equals(Bed.Part.HEAD))
newBed.setPart(Bed.Part.HEAD);
else
newBed.setPart(Bed.Part.FOOT);
newBed.setFacing(oldBed.getFacing());
blockData = newBed;
user.getOnlinePlayer().sendBlockChange(block.getLocation(), blockData);
}
}
}
// Any Docking Ports Region
if (region.contains("dockingport") || region.contains("vent_door")) {
List<Block> blocks = worldedit().getBlocks(worldguard().getRegion(region));
for (Block block : blocks) {
if (block.getType().equals(Material.WATER))
player.sendBlockChange(block.getLocation(), Material.AIR.createBlockData());
}
}
}
Aggregations