Search in sources :

Example 61 with Location

use of com.plotsquared.core.location.Location in project PlotSquared by IntellectualSites.

the class PlotModificationManager method removeRoadEast.

/**
 * Remove the east road section of a plot<br>
 * - Used when a plot is merged<br>
 *
 * @param queue Nullable {@link QueueCoordinator}. If null, creates own queue and enqueues,
 *              otherwise writes to the queue but does not enqueue.
 */
public void removeRoadEast(@Nullable QueueCoordinator queue) {
    if (this.plot.getArea().getType() != PlotAreaType.NORMAL && this.plot.getArea().getTerrain() == PlotAreaTerrainType.ROAD) {
        Plot other = this.plot.getRelative(Direction.EAST);
        Location bot = other.getBottomAbs();
        Location top = this.plot.getTopAbs();
        Location pos1 = Location.at(this.plot.getWorldName(), top.getX(), plot.getArea().getMinGenHeight(), bot.getZ());
        Location pos2 = Location.at(this.plot.getWorldName(), bot.getX(), plot.getArea().getMaxGenHeight(), top.getZ());
        PlotSquared.platform().regionManager().regenerateRegion(pos1, pos2, true, null);
    } else if (this.plot.getArea().getTerrain() != PlotAreaTerrainType.ALL) {
        // no road generated => no road to remove
        this.plot.getArea().getPlotManager().removeRoadEast(this.plot, queue);
    }
}
Also used : Location(com.plotsquared.core.location.Location)

Example 62 with Location

use of com.plotsquared.core.location.Location in project PlotSquared by IntellectualSites.

the class PlotModificationManager method removeSign.

/**
 * Remove the plot sign if it is set.
 */
public void removeSign() {
    PlotManager manager = this.plot.getArea().getPlotManager();
    if (!this.plot.getArea().allowSigns()) {
        return;
    }
    Location location = manager.getSignLoc(this.plot);
    QueueCoordinator queue = PlotSquared.platform().globalBlockQueue().getNewQueue(PlotSquared.platform().worldUtil().getWeWorld(this.plot.getWorldName()));
    queue.setBlock(location.getX(), location.getY(), location.getZ(), BlockTypes.AIR.getDefaultState());
    queue.enqueue();
}
Also used : QueueCoordinator(com.plotsquared.core.queue.QueueCoordinator) Location(com.plotsquared.core.location.Location)

Example 63 with Location

use of com.plotsquared.core.location.Location in project PlotSquared by IntellectualSites.

the class PlotListener method plotEntry.

public boolean plotEntry(final PlotPlayer<?> player, final Plot plot) {
    if (plot.isDenied(player.getUUID()) && !Permissions.hasPermission(player, "plots.admin.entry.denied")) {
        player.sendMessage(TranslatableCaption.of("deny.no_enter"), Template.of("plot", plot.toString()));
        return false;
    }
    try (final MetaDataAccess<Plot> lastPlot = player.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_LAST_PLOT)) {
        Plot last = lastPlot.get().orElse(null);
        if ((last != null) && !last.getId().equals(plot.getId())) {
            plotExit(player, last);
        }
        if (ExpireManager.IMP != null) {
            ExpireManager.IMP.handleEntry(player, plot);
        }
        lastPlot.set(plot);
    }
    this.eventDispatcher.callEntry(player, plot);
    if (plot.hasOwner()) {
        // This will inherit values from PlotArea
        final TitlesFlag.TitlesFlagValue titlesFlag = plot.getFlag(TitlesFlag.class);
        final boolean titles;
        if (titlesFlag == TitlesFlag.TitlesFlagValue.NONE) {
            titles = Settings.Titles.DISPLAY_TITLES;
        } else {
            titles = titlesFlag == TitlesFlag.TitlesFlagValue.TRUE;
        }
        String greeting = plot.getFlag(GreetingFlag.class);
        if (!greeting.isEmpty()) {
            if (!Settings.Chat.NOTIFICATION_AS_ACTIONBAR) {
                plot.format(StaticCaption.of(greeting), player, false).thenAcceptAsync(player::sendMessage);
            } else {
                plot.format(StaticCaption.of(greeting), player, false).thenAcceptAsync(player::sendActionBar);
            }
        }
        if (plot.getFlag(NotifyEnterFlag.class)) {
            if (!Permissions.hasPermission(player, "plots.flag.notify-enter.bypass")) {
                for (UUID uuid : plot.getOwners()) {
                    final PlotPlayer<?> owner = PlotSquared.platform().playerManager().getPlayerIfExists(uuid);
                    if (owner != null && !owner.getUUID().equals(player.getUUID()) && owner.canSee(player)) {
                        Caption caption = TranslatableCaption.of("notification.notify_enter");
                        notifyPlotOwner(player, plot, owner, caption);
                    }
                }
            }
        }
        final FlyFlag.FlyStatus flyStatus = plot.getFlag(FlyFlag.class);
        if (!Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_FLIGHT)) {
            if (flyStatus != FlyFlag.FlyStatus.DEFAULT) {
                boolean flight = player.getFlight();
                GameMode gamemode = player.getGameMode();
                if (flight != (gamemode == GameModes.CREATIVE || gamemode == GameModes.SPECTATOR)) {
                    try (final MetaDataAccess<Boolean> metaDataAccess = player.accessPersistentMetaData(PlayerMetaDataKeys.PERSISTENT_FLIGHT)) {
                        metaDataAccess.set(player.getFlight());
                    }
                }
                player.setFlight(flyStatus == FlyFlag.FlyStatus.ENABLED);
            }
        }
        final GameMode gameMode = plot.getFlag(GamemodeFlag.class);
        if (!gameMode.equals(GamemodeFlag.DEFAULT)) {
            if (player.getGameMode() != gameMode) {
                if (!Permissions.hasPermission(player, "plots.gamemode.bypass")) {
                    player.setGameMode(gameMode);
                } else {
                    player.sendMessage(TranslatableCaption.of("gamemode.gamemode_was_bypassed"), Template.of("gamemode", String.valueOf(gameMode)), Template.of("plot", plot.getId().toString()));
                }
            }
        }
        final GameMode guestGameMode = plot.getFlag(GuestGamemodeFlag.class);
        if (!guestGameMode.equals(GamemodeFlag.DEFAULT)) {
            if (player.getGameMode() != guestGameMode && !plot.isAdded(player.getUUID())) {
                if (!Permissions.hasPermission(player, "plots.gamemode.bypass")) {
                    player.setGameMode(guestGameMode);
                } else {
                    player.sendMessage(TranslatableCaption.of("gamemode.gamemode_was_bypassed"), Template.of("gamemode", String.valueOf(guestGameMode)), Template.of("plot", plot.getId().toString()));
                }
            }
        }
        long time = plot.getFlag(TimeFlag.class);
        if (time != TimeFlag.TIME_DISABLED.getValue() && !player.getAttribute("disabletime")) {
            try {
                player.setTime(time);
            } catch (Exception ignored) {
                PlotFlag<?, ?> plotFlag = GlobalFlagContainer.getInstance().getFlag(TimeFlag.class);
                PlotFlagRemoveEvent event = this.eventDispatcher.callFlagRemove(plotFlag, plot);
                if (event.getEventResult() != Result.DENY) {
                    plot.removeFlag(event.getFlag());
                }
            }
        }
        player.setWeather(plot.getFlag(WeatherFlag.class));
        ItemType musicFlag = plot.getFlag(MusicFlag.class);
        try (final MetaDataAccess<Location> musicMeta = player.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_MUSIC)) {
            if (musicFlag != null) {
                final String rawId = musicFlag.getId();
                if (rawId.contains("disc") || musicFlag == ItemTypes.AIR) {
                    Location location = player.getLocation();
                    Location lastLocation = musicMeta.get().orElse(null);
                    if (lastLocation != null) {
                        plot.getCenter(center -> player.playMusic(center.add(0, Short.MAX_VALUE, 0), musicFlag));
                        if (musicFlag == ItemTypes.AIR) {
                            musicMeta.remove();
                        }
                    }
                    if (musicFlag != ItemTypes.AIR) {
                        try {
                            musicMeta.set(location);
                            plot.getCenter(center -> player.playMusic(center.add(0, Short.MAX_VALUE, 0), musicFlag));
                        } catch (Exception ignored) {
                        }
                    }
                }
            } else {
                musicMeta.get().ifPresent(lastLoc -> {
                    musicMeta.remove();
                    player.playMusic(lastLoc, ItemTypes.AIR);
                });
            }
        }
        CommentManager.sendTitle(player, plot);
        if (titles && !player.getAttribute("disabletitles")) {
            String title;
            String subtitle;
            PlotTitle titleFlag = plot.getFlag(PlotTitleFlag.class);
            boolean fromFlag;
            if (titleFlag.title() != null && titleFlag.subtitle() != null) {
                title = titleFlag.title();
                subtitle = titleFlag.subtitle();
                fromFlag = true;
            } else {
                title = "";
                subtitle = "";
                fromFlag = false;
            }
            if (fromFlag || !plot.getFlag(ServerPlotFlag.class) || Settings.Titles.DISPLAY_DEFAULT_ON_SERVER_PLOT) {
                TaskManager.runTaskLaterAsync(() -> {
                    Plot lastPlot;
                    try (final MetaDataAccess<Plot> lastPlotAccess = player.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_LAST_PLOT)) {
                        lastPlot = lastPlotAccess.get().orElse(null);
                    }
                    if ((lastPlot != null) && plot.getId().equals(lastPlot.getId()) && plot.hasOwner()) {
                        final UUID plotOwner = plot.getOwnerAbs();
                        String owner = PlayerManager.resolveName(plotOwner, true).getComponent(player);
                        Caption header = fromFlag ? StaticCaption.of(title) : TranslatableCaption.of("titles" + ".title_entered_plot");
                        Caption subHeader = fromFlag ? StaticCaption.of(subtitle) : TranslatableCaption.of("titles" + ".title_entered_plot_sub");
                        Template plotTemplate = Template.of("plot", lastPlot.getId().toString());
                        Template worldTemplate = Template.of("world", player.getLocation().getWorldName());
                        Template ownerTemplate = Template.of("owner", owner);
                        Template aliasTemplate = Template.of("alias", plot.getAlias());
                        final Consumer<String> userConsumer = user -> {
                            if (Settings.Titles.TITLES_AS_ACTIONBAR) {
                                player.sendActionBar(header, aliasTemplate, plotTemplate, worldTemplate, ownerTemplate);
                            } else {
                                player.sendTitle(header, subHeader, aliasTemplate, plotTemplate, worldTemplate, ownerTemplate);
                            }
                        };
                        UUID uuid = plot.getOwner();
                        if (uuid == null) {
                            userConsumer.accept("Unknown");
                        } else if (uuid.equals(DBFunc.SERVER)) {
                            userConsumer.accept(MINI_MESSAGE.stripTokens(TranslatableCaption.of("info.server").getComponent(player)));
                        } else {
                            PlotSquared.get().getImpromptuUUIDPipeline().getSingle(plot.getOwner(), (user, throwable) -> {
                                if (throwable != null) {
                                    userConsumer.accept("Unknown");
                                } else {
                                    userConsumer.accept(user);
                                }
                            });
                        }
                    }
                }, TaskTime.seconds(1L));
            }
        }
        TimedFlag.Timed<Integer> feed = plot.getFlag(FeedFlag.class);
        if (feed.getInterval() != 0 && feed.getValue() != 0) {
            feedRunnable.put(player.getUUID(), new Interval(feed.getInterval(), feed.getValue(), 20));
        }
        TimedFlag.Timed<Integer> heal = plot.getFlag(HealFlag.class);
        if (heal.getInterval() != 0 && heal.getValue() != 0) {
            healRunnable.put(player.getUUID(), new Interval(heal.getInterval(), heal.getValue(), 20));
        }
        return true;
    }
    return true;
}
Also used : NotifyEnterFlag(com.plotsquared.core.plot.flag.implementations.NotifyEnterFlag) FeedFlag(com.plotsquared.core.plot.flag.implementations.FeedFlag) Permission(com.plotsquared.core.permissions.Permission) StaticCaption(com.plotsquared.core.configuration.caption.StaticCaption) TimedFlag(com.plotsquared.core.plot.flag.types.TimedFlag) Map(java.util.Map) DenyExitFlag(com.plotsquared.core.plot.flag.implementations.DenyExitFlag) Template(net.kyori.adventure.text.minimessage.Template) EventDispatcher(com.plotsquared.core.util.EventDispatcher) FlyFlag(com.plotsquared.core.plot.flag.implementations.FlyFlag) Caption(com.plotsquared.core.configuration.caption.Caption) DBFunc(com.plotsquared.core.database.DBFunc) ServerPlotFlag(com.plotsquared.core.plot.flag.implementations.ServerPlotFlag) MiniMessage(net.kyori.adventure.text.minimessage.MiniMessage) TimeFlag(com.plotsquared.core.plot.flag.implementations.TimeFlag) UUID(java.util.UUID) Result(com.plotsquared.core.events.Result) HealFlag(com.plotsquared.core.plot.flag.implementations.HealFlag) GameModes(com.sk89q.worldedit.world.gamemode.GameModes) TranslatableCaption(com.plotsquared.core.configuration.caption.TranslatableCaption) GreetingFlag(com.plotsquared.core.plot.flag.implementations.GreetingFlag) GamemodeFlag(com.plotsquared.core.plot.flag.implementations.GamemodeFlag) Optional(java.util.Optional) PlayerMetaDataKeys(com.plotsquared.core.player.PlayerMetaDataKeys) FarewellFlag(com.plotsquared.core.plot.flag.implementations.FarewellFlag) PlotTitleFlag(com.plotsquared.core.plot.flag.implementations.PlotTitleFlag) WeatherFlag(com.plotsquared.core.plot.flag.implementations.WeatherFlag) TaskTime(com.plotsquared.core.util.task.TaskTime) MetaDataAccess(com.plotsquared.core.player.MetaDataAccess) HashMap(java.util.HashMap) PlotFlag(com.plotsquared.core.plot.flag.PlotFlag) PlotWeather(com.plotsquared.core.plot.PlotWeather) CommentManager(com.plotsquared.core.plot.comment.CommentManager) ExpireManager(com.plotsquared.core.plot.expiration.ExpireManager) GuestGamemodeFlag(com.plotsquared.core.plot.flag.implementations.GuestGamemodeFlag) Nullable(org.checkerframework.checker.nullness.qual.Nullable) Location(com.plotsquared.core.location.Location) GlobalFlagContainer(com.plotsquared.core.plot.flag.GlobalFlagContainer) TitlesFlag(com.plotsquared.core.plot.flag.implementations.TitlesFlag) PlotFlagRemoveEvent(com.plotsquared.core.events.PlotFlagRemoveEvent) Permissions(com.plotsquared.core.util.Permissions) Plot(com.plotsquared.core.plot.Plot) Iterator(java.util.Iterator) TaskManager(com.plotsquared.core.util.task.TaskManager) ItemTypes(com.sk89q.worldedit.world.item.ItemTypes) GameMode(com.sk89q.worldedit.world.gamemode.GameMode) Consumer(java.util.function.Consumer) PlotSquared(com.plotsquared.core.PlotSquared) PlayerManager(com.plotsquared.core.util.PlayerManager) PlotPlayer(com.plotsquared.core.player.PlotPlayer) NotifyLeaveFlag(com.plotsquared.core.plot.flag.implementations.NotifyLeaveFlag) PlotTitle(com.plotsquared.core.plot.PlotTitle) Settings(com.plotsquared.core.configuration.Settings) PlotArea(com.plotsquared.core.plot.PlotArea) ItemType(com.sk89q.worldedit.world.item.ItemType) MusicFlag(com.plotsquared.core.plot.flag.implementations.MusicFlag) ItemType(com.sk89q.worldedit.world.item.ItemType) Template(net.kyori.adventure.text.minimessage.Template) WeatherFlag(com.plotsquared.core.plot.flag.implementations.WeatherFlag) FlyFlag(com.plotsquared.core.plot.flag.implementations.FlyFlag) UUID(java.util.UUID) PlotFlagRemoveEvent(com.plotsquared.core.events.PlotFlagRemoveEvent) ServerPlotFlag(com.plotsquared.core.plot.flag.implementations.ServerPlotFlag) PlotFlag(com.plotsquared.core.plot.flag.PlotFlag) TitlesFlag(com.plotsquared.core.plot.flag.implementations.TitlesFlag) Plot(com.plotsquared.core.plot.Plot) StaticCaption(com.plotsquared.core.configuration.caption.StaticCaption) Caption(com.plotsquared.core.configuration.caption.Caption) TranslatableCaption(com.plotsquared.core.configuration.caption.TranslatableCaption) PlotTitle(com.plotsquared.core.plot.PlotTitle) ServerPlotFlag(com.plotsquared.core.plot.flag.implementations.ServerPlotFlag) TimedFlag(com.plotsquared.core.plot.flag.types.TimedFlag) GameMode(com.sk89q.worldedit.world.gamemode.GameMode) TimeFlag(com.plotsquared.core.plot.flag.implementations.TimeFlag) Location(com.plotsquared.core.location.Location)

Example 64 with Location

use of com.plotsquared.core.location.Location in project PlotSquared by IntellectualSites.

the class HybridGen method generateChunk.

@Override
public void generateChunk(@NonNull ScopedQueueCoordinator result, @NonNull PlotArea settings) {
    Preconditions.checkNotNull(result, "result cannot be null");
    Preconditions.checkNotNull(settings, "settings cannot be null");
    HybridPlotWorld hybridPlotWorld = (HybridPlotWorld) settings;
    // Biome
    result.fillBiome(hybridPlotWorld.getPlotBiome());
    // Bedrock
    if (hybridPlotWorld.PLOT_BEDROCK) {
        for (short x = 0; x < 16; x++) {
            for (short z = 0; z < 16; z++) {
                result.setBlock(x, hybridPlotWorld.getMinGenHeight(), z, BlockTypes.BEDROCK.getDefaultState());
            }
        }
    }
    // Coords
    Location min = result.getMin();
    int bx = min.getX() - hybridPlotWorld.ROAD_OFFSET_X;
    int bz = min.getZ() - hybridPlotWorld.ROAD_OFFSET_Z;
    // The relative X-coordinate (within the plot) of the minimum X coordinate
    // contained in the scoped queue
    short relativeOffsetX;
    if (bx < 0) {
        relativeOffsetX = (short) (hybridPlotWorld.SIZE + (bx % hybridPlotWorld.SIZE));
    } else {
        relativeOffsetX = (short) (bx % hybridPlotWorld.SIZE);
    }
    // The relative Z-coordinate (within the plot) of the minimum Z coordinate
    // contained in the scoped queue
    short relativeOffsetZ;
    if (bz < 0) {
        relativeOffsetZ = (short) (hybridPlotWorld.SIZE + (bz % hybridPlotWorld.SIZE));
    } else {
        relativeOffsetZ = (short) (bz % hybridPlotWorld.SIZE);
    }
    // The X-coordinate of a given X coordinate, relative to the
    // plot (Counting from the corner with the least positive
    // coordinates)
    short[] relativeX = new short[16];
    boolean[] insideRoadX = new boolean[16];
    boolean[] insideWallX = new boolean[16];
    for (short i = 0; i < 16; i++) {
        short v = (short) (relativeOffsetX + i);
        while (v >= hybridPlotWorld.SIZE) {
            v -= hybridPlotWorld.SIZE;
        }
        relativeX[i] = v;
        if (hybridPlotWorld.ROAD_WIDTH != 0) {
            insideRoadX[i] = v < hybridPlotWorld.PATH_WIDTH_LOWER || v > hybridPlotWorld.PATH_WIDTH_UPPER;
            insideWallX[i] = v == hybridPlotWorld.PATH_WIDTH_LOWER || v == hybridPlotWorld.PATH_WIDTH_UPPER;
        }
    }
    // The Z-coordinate of a given Z coordinate, relative to the
    // plot (Counting from the corner with the least positive
    // coordinates)
    short[] relativeZ = new short[16];
    // Whether or not the given Z coordinate belongs to the road
    boolean[] insideRoadZ = new boolean[16];
    // Whether or not the given Z coordinate belongs to the wall
    boolean[] insideWallZ = new boolean[16];
    for (short i = 0; i < 16; i++) {
        short v = (short) (relativeOffsetZ + i);
        while (v >= hybridPlotWorld.SIZE) {
            v -= hybridPlotWorld.SIZE;
        }
        relativeZ[i] = v;
        if (hybridPlotWorld.ROAD_WIDTH != 0) {
            insideRoadZ[i] = v < hybridPlotWorld.PATH_WIDTH_LOWER || v > hybridPlotWorld.PATH_WIDTH_UPPER;
            insideWallZ[i] = v == hybridPlotWorld.PATH_WIDTH_LOWER || v == hybridPlotWorld.PATH_WIDTH_UPPER;
        }
    }
    // generation
    int startY = hybridPlotWorld.getMinGenHeight() + (hybridPlotWorld.PLOT_BEDROCK ? 1 : 0);
    for (short x = 0; x < 16; x++) {
        if (insideRoadX[x]) {
            for (short z = 0; z < 16; z++) {
                // Road
                for (int y = startY; y <= hybridPlotWorld.ROAD_HEIGHT; y++) {
                    result.setBlock(x, y, z, hybridPlotWorld.ROAD_BLOCK.toPattern());
                }
                if (hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) {
                    placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, true);
                }
            }
        } else if (insideWallX[x]) {
            for (short z = 0; z < 16; z++) {
                if (insideRoadZ[z]) {
                    // road
                    for (int y = startY; y <= hybridPlotWorld.ROAD_HEIGHT; y++) {
                        result.setBlock(x, y, z, hybridPlotWorld.ROAD_BLOCK.toPattern());
                    }
                    if (hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) {
                        placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, true);
                    }
                } else {
                    // wall
                    for (int y = startY; y <= hybridPlotWorld.WALL_HEIGHT; y++) {
                        result.setBlock(x, y, z, hybridPlotWorld.WALL_FILLING.toPattern());
                    }
                    if (!hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) {
                        if (hybridPlotWorld.PLACE_TOP_BLOCK) {
                            result.setBlock(x, hybridPlotWorld.WALL_HEIGHT + 1, z, hybridPlotWorld.WALL_BLOCK.toPattern());
                        }
                    } else {
                        placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, true);
                    }
                }
            }
        } else {
            for (short z = 0; z < 16; z++) {
                if (insideRoadZ[z]) {
                    // road
                    for (int y = startY; y <= hybridPlotWorld.ROAD_HEIGHT; y++) {
                        result.setBlock(x, y, z, hybridPlotWorld.ROAD_BLOCK.toPattern());
                    }
                    if (hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) {
                        placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, true);
                    }
                } else if (insideWallZ[z]) {
                    // wall
                    for (int y = startY; y <= hybridPlotWorld.WALL_HEIGHT; y++) {
                        result.setBlock(x, y, z, hybridPlotWorld.WALL_FILLING.toPattern());
                    }
                    if (!hybridPlotWorld.ROAD_SCHEMATIC_ENABLED) {
                        if (hybridPlotWorld.PLACE_TOP_BLOCK) {
                            result.setBlock(x, hybridPlotWorld.WALL_HEIGHT + 1, z, hybridPlotWorld.WALL_BLOCK.toPattern());
                        }
                    } else {
                        placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, true);
                    }
                } else {
                    // plot
                    for (int y = startY; y < hybridPlotWorld.PLOT_HEIGHT; y++) {
                        result.setBlock(x, y, z, hybridPlotWorld.MAIN_BLOCK.toPattern());
                    }
                    result.setBlock(x, hybridPlotWorld.PLOT_HEIGHT, z, hybridPlotWorld.TOP_BLOCK.toPattern());
                    if (hybridPlotWorld.PLOT_SCHEMATIC) {
                        placeSchem(hybridPlotWorld, result, relativeX[x], relativeZ[z], x, z, false);
                    }
                }
            }
        }
    }
}
Also used : Location(com.plotsquared.core.location.Location)

Example 65 with Location

use of com.plotsquared.core.location.Location in project PlotSquared by IntellectualSites.

the class HybridPlotWorld method getSignLocation.

public Location getSignLocation(@NonNull Plot plot) {
    plot = plot.getBasePlot(false);
    final Location bot = plot.getBottomAbs();
    if (SIGN_LOCATION == null) {
        return bot.withY(ROAD_HEIGHT + 1).add(-1, 0, -2);
    } else {
        return bot.withY(0).add(SIGN_LOCATION.getX(), SIGN_LOCATION.getY(), SIGN_LOCATION.getZ());
    }
}
Also used : Location(com.plotsquared.core.location.Location)

Aggregations

Location (com.plotsquared.core.location.Location)82 Plot (com.plotsquared.core.plot.Plot)41 PlotArea (com.plotsquared.core.plot.PlotArea)26 EventHandler (org.bukkit.event.EventHandler)15 CuboidRegion (com.sk89q.worldedit.regions.CuboidRegion)14 PlotPlayer (com.plotsquared.core.player.PlotPlayer)12 UUID (java.util.UUID)12 HashSet (java.util.HashSet)10 TranslatableCaption (com.plotsquared.core.configuration.caption.TranslatableCaption)9 NonNull (org.checkerframework.checker.nullness.qual.NonNull)9 QueueCoordinator (com.plotsquared.core.queue.QueueCoordinator)8 Caption (com.plotsquared.core.configuration.caption.Caption)7 BlockLoc (com.plotsquared.core.location.BlockLoc)7 Template (net.kyori.adventure.text.minimessage.Template)7 Entity (org.bukkit.entity.Entity)7 Settings (com.plotsquared.core.configuration.Settings)6 ClassicPlotWorld (com.plotsquared.core.generator.ClassicPlotWorld)6 PlotFlag (com.plotsquared.core.plot.flag.PlotFlag)6 SinglePlotArea (com.plotsquared.core.plot.world.SinglePlotArea)6 PlotSquared (com.plotsquared.core.PlotSquared)5