mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +01:00
Merge branch 'v6' into v7
This commit is contained in:
commit
aa784e98f8
@ -72,6 +72,8 @@ import com.plotsquared.core.configuration.Storage;
|
||||
import com.plotsquared.core.configuration.caption.ChatFormatter;
|
||||
import com.plotsquared.core.configuration.file.YamlConfiguration;
|
||||
import com.plotsquared.core.database.DBFunc;
|
||||
import com.plotsquared.core.events.RemoveRoadEntityEvent;
|
||||
import com.plotsquared.core.events.Result;
|
||||
import com.plotsquared.core.generator.GeneratorWrapper;
|
||||
import com.plotsquared.core.generator.IndependentPlotGenerator;
|
||||
import com.plotsquared.core.generator.SingleWorldGenerator;
|
||||
@ -110,6 +112,7 @@ import com.plotsquared.core.uuid.CacheUUIDService;
|
||||
import com.plotsquared.core.uuid.UUIDPipeline;
|
||||
import com.plotsquared.core.uuid.offline.OfflineModeUUIDService;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import io.papermc.lib.PaperLib;
|
||||
import net.kyori.adventure.audience.Audience;
|
||||
import net.kyori.adventure.text.Component;
|
||||
@ -818,8 +821,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
||||
if (entity.hasMetadata("ps-tmp-teleport")) {
|
||||
continue;
|
||||
}
|
||||
iterator.remove();
|
||||
entity.remove();
|
||||
this.removeRoadEntity(entity, iterator);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@ -832,8 +834,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
||||
if (entity.hasMetadata("ps-tmp-teleport")) {
|
||||
continue;
|
||||
}
|
||||
iterator.remove();
|
||||
entity.remove();
|
||||
this.removeRoadEntity(entity, iterator);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
@ -843,7 +844,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
||||
case "DROPPED_ITEM":
|
||||
if (Settings.Enabled_Components.KILL_ROAD_ITEMS
|
||||
&& plotArea.getOwnedPlotAbs(BukkitUtil.adapt(entity.getLocation())) == null) {
|
||||
entity.remove();
|
||||
this.removeRoadEntity(entity, iterator);
|
||||
}
|
||||
// dropped item
|
||||
continue;
|
||||
@ -874,8 +875,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
||||
if (entity.hasMetadata("ps-tmp-teleport")) {
|
||||
continue;
|
||||
}
|
||||
iterator.remove();
|
||||
entity.remove();
|
||||
this.removeRoadEntity(entity, iterator);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -980,8 +980,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
||||
if (entity.hasMetadata("ps-tmp-teleport")) {
|
||||
continue;
|
||||
}
|
||||
iterator.remove();
|
||||
entity.remove();
|
||||
this.removeRoadEntity(entity, iterator);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -992,8 +991,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
||||
if (entity.hasMetadata("ps-tmp-teleport")) {
|
||||
continue;
|
||||
}
|
||||
iterator.remove();
|
||||
entity.remove();
|
||||
this.removeRoadEntity(entity, iterator);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1007,6 +1005,17 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
||||
}), TaskTime.seconds(1L));
|
||||
}
|
||||
|
||||
private void removeRoadEntity(Entity entity, Iterator<Entity> entityIterator) {
|
||||
RemoveRoadEntityEvent event = eventDispatcher.callRemoveRoadEntity(BukkitAdapter.adapt(entity));
|
||||
|
||||
if (event.getEventResult() == Result.DENY) {
|
||||
return;
|
||||
}
|
||||
|
||||
entityIterator.remove();
|
||||
entity.remove();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable
|
||||
final ChunkGenerator getDefaultWorldGenerator(
|
||||
|
@ -99,6 +99,7 @@ import org.bukkit.event.block.BlockSpreadEvent;
|
||||
import org.bukkit.event.block.CauldronLevelChangeEvent;
|
||||
import org.bukkit.event.block.EntityBlockFormEvent;
|
||||
import org.bukkit.event.block.LeavesDecayEvent;
|
||||
import org.bukkit.event.block.MoistureChangeEvent;
|
||||
import org.bukkit.event.block.SpongeAbsorbEvent;
|
||||
import org.bukkit.event.world.StructureGrowEvent;
|
||||
import org.bukkit.projectiles.BlockProjectileSource;
|
||||
@ -740,6 +741,28 @@ public class BlockEventListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onMoistureChange(MoistureChangeEvent event) {
|
||||
Block block = event.getBlock();
|
||||
Location location = BukkitUtil.adapt(block.getLocation());
|
||||
PlotArea area = location.getPlotArea();
|
||||
if (area == null) {
|
||||
return;
|
||||
}
|
||||
Plot plot = area.getOwnedPlot(location);
|
||||
if (plot == null) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
Material blockType = block.getType();
|
||||
if (blockType == Material.FARMLAND) {
|
||||
if (!plot.getFlag(SoilDryFlag.class)) {
|
||||
plot.debug("Soil could not dry because soil-dry = false");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onChange(BlockFromToEvent event) {
|
||||
Block fromBlock = event.getBlock();
|
||||
|
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* @since TODO
|
||||
*/
|
||||
public abstract class EntityEvent {
|
||||
|
||||
private final Entity entity;
|
||||
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* @since TODO
|
||||
*/
|
||||
public EntityEvent(Entity entity) {
|
||||
this.entity = entity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain the entity involved in the event
|
||||
*
|
||||
* @return Entity
|
||||
* @since TODO
|
||||
*/
|
||||
public Entity getEntity() {
|
||||
return this.entity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain the event's class name
|
||||
*
|
||||
* @return the event class name
|
||||
* @since TODO
|
||||
*/
|
||||
@NonNull public String getEventName() {
|
||||
if (this.name == null) {
|
||||
this.name = this.getClass().getSimpleName();
|
||||
}
|
||||
return this.name;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
|
||||
/**
|
||||
* @since TODO
|
||||
*/
|
||||
public class RemoveRoadEntityEvent extends EntityEvent implements CancellablePlotEvent {
|
||||
|
||||
private Result eventResult;
|
||||
|
||||
/**
|
||||
* RemoveRoadEntityEvent: Called when an entity on road is removed.
|
||||
*
|
||||
* @param entity The entity to remove
|
||||
* @since TODO
|
||||
*/
|
||||
public RemoveRoadEntityEvent(Entity entity) {
|
||||
super(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result getEventResult() {
|
||||
return this.eventResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEventResult(Result eventResult) {
|
||||
this.eventResult = eventResult;
|
||||
}
|
||||
|
||||
}
|
@ -45,6 +45,7 @@ import com.plotsquared.core.events.PlotFlagRemoveEvent;
|
||||
import com.plotsquared.core.events.PlotMergeEvent;
|
||||
import com.plotsquared.core.events.PlotRateEvent;
|
||||
import com.plotsquared.core.events.PlotUnlinkEvent;
|
||||
import com.plotsquared.core.events.RemoveRoadEntityEvent;
|
||||
import com.plotsquared.core.events.TeleportCause;
|
||||
import com.plotsquared.core.events.post.PostPlayerAutoPlotEvent;
|
||||
import com.plotsquared.core.events.post.PostPlotChangeOwnerEvent;
|
||||
@ -71,6 +72,7 @@ import com.plotsquared.core.plot.flag.types.BlockTypeWrapper;
|
||||
import com.plotsquared.core.plot.world.SinglePlotArea;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
@ -298,6 +300,12 @@ public class EventDispatcher {
|
||||
return event;
|
||||
}
|
||||
|
||||
public RemoveRoadEntityEvent callRemoveRoadEntity(Entity entity) {
|
||||
RemoveRoadEntityEvent event = new RemoveRoadEntityEvent(entity);
|
||||
eventBus.post(event);
|
||||
return event;
|
||||
}
|
||||
|
||||
public void doJoinTask(final PlotPlayer<?> player) {
|
||||
if (player == null) {
|
||||
return; //possible future warning message to figure out where we are retrieving null
|
||||
|
@ -74,7 +74,7 @@ subprojects {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(platform("com.intellectualsites.bom:bom-newest:1.22"))
|
||||
implementation(platform("com.intellectualsites.bom:bom-newest:1.23"))
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
@ -20,7 +20,7 @@ squirrelid = "0.3.1"
|
||||
# Gradle plugins
|
||||
shadow = "7.1.2"
|
||||
grgit = "4.1.1"
|
||||
spotless = "6.13.0"
|
||||
spotless = "6.14.1"
|
||||
nexus = "1.1.0"
|
||||
|
||||
[libraries]
|
||||
|
Loading…
Reference in New Issue
Block a user