mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-07-06 23:54:43 +02:00
Compare commits
7 Commits
feat/plotB
...
7.3.2
Author | SHA1 | Date | |
---|---|---|---|
5021f5b379 | |||
76ea9e0d3c | |||
951f08bc8b | |||
ae941e67a4 | |||
9566af5fda | |||
fccc146053 | |||
a1d94af242 |
@ -779,6 +779,10 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
Iterator<Entity> iterator = entities.iterator();
|
Iterator<Entity> iterator = entities.iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
Entity entity = iterator.next();
|
Entity entity = iterator.next();
|
||||||
|
final String spawnReason = entity.getEntitySpawnReason().name();
|
||||||
|
if ("CUSTOM".equals(spawnReason)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
switch (entity.getType().toString()) {
|
switch (entity.getType().toString()) {
|
||||||
case "EGG":
|
case "EGG":
|
||||||
case "FISHING_HOOK":
|
case "FISHING_HOOK":
|
||||||
@ -867,8 +871,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
if (livingEntity.isLeashed() && !Settings.Enabled_Components.KILL_OWNED_ROAD_MOBS) {
|
if (livingEntity.isLeashed() && !Settings.Enabled_Components.KILL_OWNED_ROAD_MOBS) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
List<MetadataValue> keep = entity.getMetadata("keep");
|
if (entity.hasMetadata("keep")) {
|
||||||
if (!keep.isEmpty()) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +120,10 @@ public class EntitySpawnListener implements Listener {
|
|||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
Location location = BukkitUtil.adapt(entity.getLocation());
|
Location location = BukkitUtil.adapt(entity.getLocation());
|
||||||
PlotArea area = location.getPlotArea();
|
PlotArea area = location.getPlotArea();
|
||||||
if (!location.isPlotArea()) {
|
if (!location.isPlotArea() || area == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (area.isSpawnCustom() && "CUSTOM".equals(entity.getEntitySpawnReason().name())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Plot plot = location.getOwnedPlotAbs();
|
Plot plot = location.getOwnedPlotAbs();
|
||||||
|
@ -40,6 +40,7 @@ import io.papermc.lib.PaperLib;
|
|||||||
import net.kyori.adventure.audience.Audience;
|
import net.kyori.adventure.audience.Audience;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.SoundCategory;
|
||||||
import org.bukkit.WeatherType;
|
import org.bukkit.WeatherType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
@ -51,7 +52,6 @@ import org.bukkit.potion.PotionEffectType;
|
|||||||
import org.checkerframework.checker.index.qual.NonNegative;
|
import org.checkerframework.checker.index.qual.NonNegative;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@ -309,18 +309,21 @@ public class BukkitPlayer extends PlotPlayer<Player> {
|
|||||||
@Override
|
@Override
|
||||||
public void playMusic(final @NonNull Location location, final @NonNull ItemType id) {
|
public void playMusic(final @NonNull Location location, final @NonNull ItemType id) {
|
||||||
if (id == ItemTypes.AIR) {
|
if (id == ItemTypes.AIR) {
|
||||||
// Let's just stop all the discs because why not?
|
if (PlotSquared.platform().serverVersion()[1] >= 19) {
|
||||||
for (final Sound sound : Arrays.stream(Sound.values())
|
player.stopSound(SoundCategory.MUSIC);
|
||||||
.filter(sound -> sound.name().contains("DISC")).toList()) {
|
return;
|
||||||
player.stopSound(sound);
|
|
||||||
}
|
}
|
||||||
// this.player.playEffect(BukkitUtil.getLocation(location), Effect.RECORD_PLAY, Material.AIR);
|
// 1.18 and downwards require a specific Sound to stop (even tho the packet does not??)
|
||||||
} else {
|
for (final Sound sound : Sound.values()) {
|
||||||
// this.player.playEffect(BukkitUtil.getLocation(location), Effect.RECORD_PLAY, id.to(Material.class));
|
if (sound.name().startsWith("MUSIC_DISC")) {
|
||||||
this.player.playSound(BukkitUtil.adapt(location),
|
this.player.stopSound(sound, SoundCategory.MUSIC);
|
||||||
Sound.valueOf(BukkitAdapter.adapt(id).name()), Float.MAX_VALUE, 1f
|
}
|
||||||
);
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
this.player.playSound(BukkitUtil.adapt(location), Sound.valueOf(BukkitAdapter.adapt(id).name()),
|
||||||
|
SoundCategory.MUSIC, 1f, 1f
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation") // Needed for Spigot compatibility
|
@SuppressWarnings("deprecation") // Needed for Spigot compatibility
|
||||||
|
@ -37,7 +37,9 @@ import com.sk89q.worldedit.regions.CuboidRegion;
|
|||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class FaweRegionManager extends BukkitRegionManager {
|
public class FaweRegionManager extends BukkitRegionManager {
|
||||||
@ -59,7 +61,10 @@ public class FaweRegionManager extends BukkitRegionManager {
|
|||||||
@Nullable PlotPlayer<?> actor,
|
@Nullable PlotPlayer<?> actor,
|
||||||
@Nullable QueueCoordinator queue
|
@Nullable QueueCoordinator queue
|
||||||
) {
|
) {
|
||||||
return delegate.setCuboids(area, regions, blocks, minY, maxY, queue.getCompleteTask());
|
return delegate.setCuboids(
|
||||||
|
area, regions, blocks, minY, maxY,
|
||||||
|
Objects.requireNonNullElseGet(queue, area::getQueue).getCompleteTask()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -111,7 +116,7 @@ public class FaweRegionManager extends BukkitRegionManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean regenerateRegion(final Location pos1, final Location pos2, boolean ignore, final Runnable whenDone) {
|
public boolean regenerateRegion(final @NotNull Location pos1, final @NotNull Location pos2, boolean ignore, final Runnable whenDone) {
|
||||||
return delegate.regenerateRegion(pos1, pos2, ignore, whenDone);
|
return delegate.regenerateRegion(pos1, pos2, ignore, whenDone);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,6 +135,7 @@ public class Clear extends Command {
|
|||||||
.tag("plot", Tag.inserting(Component.text(plot.getId().toString())))
|
.tag("plot", Tag.inserting(Component.text(plot.getId().toString())))
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
|
this.eventDispatcher.callPostPlotClear(player, plot);
|
||||||
}));
|
}));
|
||||||
if (!result) {
|
if (!result) {
|
||||||
player.sendMessage(TranslatableCaption.of("errors.wait_for_timer"));
|
player.sendMessage(TranslatableCaption.of("errors.wait_for_timer"));
|
||||||
|
@ -2401,7 +2401,8 @@ public class SQLManager implements AbstractDB {
|
|||||||
addPlotTask(plot, new UniqueStatement("setPosition") {
|
addPlotTask(plot, new UniqueStatement("setPosition") {
|
||||||
@Override
|
@Override
|
||||||
public void set(PreparedStatement statement) throws SQLException {
|
public void set(PreparedStatement statement) throws SQLException {
|
||||||
statement.setString(1, position == null ? "" : position);
|
// Please see the table creation statement. There is the default value of "default"
|
||||||
|
statement.setString(1, position == null ? "DEFAULT" : position);
|
||||||
statement.setInt(2, getId(plot));
|
statement.setInt(2, getId(plot));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ public interface CancellablePlotEvent {
|
|||||||
/**
|
/**
|
||||||
* @deprecated No usage and not null-safe
|
* @deprecated No usage and not null-safe
|
||||||
*/
|
*/
|
||||||
@Deprecated(since = "TODO")
|
@Deprecated(since = "7.3.2")
|
||||||
default int getEventResultRaw() {
|
default int getEventResultRaw() {
|
||||||
return getEventResult() != null ? getEventResult().getValue() : -1;
|
return getEventResult() != null ? getEventResult().getValue() : -1;
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
|||||||
* <p>
|
* <p>
|
||||||
* Setting the {@link #setPrice(double) price} to {@code 0} makes the plot practically free.
|
* Setting the {@link #setPrice(double) price} to {@code 0} makes the plot practically free.
|
||||||
*
|
*
|
||||||
* @since TODO
|
* @since 7.3.2
|
||||||
*/
|
*/
|
||||||
public class PlayerBuyPlotEvent extends PlotPlayerEvent implements CancellablePlotEvent {
|
public class PlayerBuyPlotEvent extends PlotPlayerEvent implements CancellablePlotEvent {
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ public class PlayerBuyPlotEvent extends PlotPlayerEvent implements CancellablePl
|
|||||||
* Sets the price required to buy the plot.
|
* Sets the price required to buy the plot.
|
||||||
*
|
*
|
||||||
* @param price the new price.
|
* @param price the new price.
|
||||||
* @since TODO
|
* @since 7.3.2
|
||||||
*/
|
*/
|
||||||
public void setPrice(@NonNegative final double price) {
|
public void setPrice(@NonNegative final double price) {
|
||||||
//noinspection ConstantValue - the annotation does not ensure a non-negative runtime value
|
//noinspection ConstantValue - the annotation does not ensure a non-negative runtime value
|
||||||
@ -63,7 +63,7 @@ public class PlayerBuyPlotEvent extends PlotPlayerEvent implements CancellablePl
|
|||||||
* Returns the currently set price required to buy the plot.
|
* Returns the currently set price required to buy the plot.
|
||||||
*
|
*
|
||||||
* @return the price.
|
* @return the price.
|
||||||
* @since TODO
|
* @since 7.3.2
|
||||||
*/
|
*/
|
||||||
public @NonNegative double price() {
|
public @NonNegative double price() {
|
||||||
return price;
|
return price;
|
||||||
|
@ -27,7 +27,7 @@ import org.checkerframework.checker.index.qual.NonNegative;
|
|||||||
/**
|
/**
|
||||||
* Called after a player has successfully bought a plot.
|
* Called after a player has successfully bought a plot.
|
||||||
*
|
*
|
||||||
* @since TODO
|
* @since 7.3.2
|
||||||
*/
|
*/
|
||||||
public class PostPlayerBuyPlotEvent extends PlotPlayerEvent {
|
public class PostPlayerBuyPlotEvent extends PlotPlayerEvent {
|
||||||
|
|
||||||
|
@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* PlotSquared, a land and world management plugin for Minecraft.
|
||||||
|
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
||||||
|
* Copyright (C) IntellectualSites team and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.plotsquared.core.events.post;
|
||||||
|
|
||||||
|
import com.plotsquared.core.events.PlotPlayerEvent;
|
||||||
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
|
import com.plotsquared.core.plot.Plot;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called after a {@link Plot} was cleared.
|
||||||
|
*
|
||||||
|
* @since 7.3.2
|
||||||
|
*/
|
||||||
|
public class PostPlotClearEvent extends PlotPlayerEvent {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiate a new PostPlotClearEvent.
|
||||||
|
*
|
||||||
|
* @param plotPlayer The {@link PlotPlayer} that initiated the clear.
|
||||||
|
* @param plot The clearing plot.
|
||||||
|
*/
|
||||||
|
public PostPlotClearEvent(final PlotPlayer<?> plotPlayer, final Plot plot) {
|
||||||
|
super(plotPlayer, plot);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1483,7 +1483,7 @@ public class Plot {
|
|||||||
*/
|
*/
|
||||||
public void setHome(BlockLoc location) {
|
public void setHome(BlockLoc location) {
|
||||||
Plot plot = this.getBasePlot(false);
|
Plot plot = this.getBasePlot(false);
|
||||||
if (BlockLoc.ZERO.equals(location) || BlockLoc.MINY.equals(location)) {
|
if (location != null && (BlockLoc.ZERO.equals(location) || BlockLoc.MINY.equals(location))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
plot.getSettings().setPosition(location);
|
plot.getSettings().setPosition(location);
|
||||||
|
@ -52,6 +52,7 @@ import com.plotsquared.core.events.TeleportCause;
|
|||||||
import com.plotsquared.core.events.post.PostPlayerAutoPlotEvent;
|
import com.plotsquared.core.events.post.PostPlayerAutoPlotEvent;
|
||||||
import com.plotsquared.core.events.post.PostPlayerBuyPlotEvent;
|
import com.plotsquared.core.events.post.PostPlayerBuyPlotEvent;
|
||||||
import com.plotsquared.core.events.post.PostPlotChangeOwnerEvent;
|
import com.plotsquared.core.events.post.PostPlotChangeOwnerEvent;
|
||||||
|
import com.plotsquared.core.events.post.PostPlotClearEvent;
|
||||||
import com.plotsquared.core.events.post.PostPlotDeleteEvent;
|
import com.plotsquared.core.events.post.PostPlotDeleteEvent;
|
||||||
import com.plotsquared.core.events.post.PostPlotMergeEvent;
|
import com.plotsquared.core.events.post.PostPlotMergeEvent;
|
||||||
import com.plotsquared.core.events.post.PostPlotUnlinkEvent;
|
import com.plotsquared.core.events.post.PostPlotUnlinkEvent;
|
||||||
@ -182,6 +183,12 @@ public class EventDispatcher {
|
|||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PostPlotClearEvent callPostPlotClear(PlotPlayer<?> player, Plot plot) {
|
||||||
|
PostPlotClearEvent event = new PostPlotClearEvent(player, plot);
|
||||||
|
callEvent(event);
|
||||||
|
return event;
|
||||||
|
}
|
||||||
|
|
||||||
public PlotDeleteEvent callDelete(Plot plot) {
|
public PlotDeleteEvent callDelete(Plot plot) {
|
||||||
PlotDeleteEvent event = new PlotDeleteEvent(plot);
|
PlotDeleteEvent event = new PlotDeleteEvent(plot);
|
||||||
callEvent(event);
|
callEvent(event);
|
||||||
|
@ -22,7 +22,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = "com.intellectualsites.plotsquared"
|
group = "com.intellectualsites.plotsquared"
|
||||||
version = "7.3.2-SNAPSHOT"
|
version = "7.3.2"
|
||||||
|
|
||||||
if (!File("$rootDir/.git").exists()) {
|
if (!File("$rootDir/.git").exists()) {
|
||||||
logger.lifecycle("""
|
logger.lifecycle("""
|
||||||
|
Reference in New Issue
Block a user