Merge branch 'v6' into chore/v6/v7-removal-deprecations

This commit is contained in:
Alexander Brandes 2023-03-04 11:56:44 +01:00
commit f15a652add
No known key found for this signature in database
GPG Key ID: 158F5701A6AAD00C
23 changed files with 210 additions and 58 deletions

View File

@ -2,7 +2,6 @@ name: Announce release on discord
on:
release:
types: [published]
jobs:
send_announcement:
runs-on: ubuntu-latest
@ -12,7 +11,7 @@ jobs:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
DISCORD_USERNAME: PlotSquared Release
DISCORD_AVATAR: https://raw.githubusercontent.com/IntellectualSites/Assets/main/plugins/PlotSquared/PlotSquared.png
uses: Ilshidur/action-discord@0.3.2
uses: Ilshidur/action-discord@0c4b27844ba47cb1c7bee539c8eead5284ce9fa9 # ratchet:Ilshidur/action-discord@0.3.2
with:
args: |
"<@&525015541815967744> <@&679322738552471574> <@&699293353862496266>"

View File

@ -1,19 +1,17 @@
name: Build PR
on: [ pull_request ]
on: [pull_request]
jobs:
build_pr:
if: github.repository_owner == 'IntellectualSites'
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
uses: gradle/wrapper-validation-action@55e685c48d84285a5b0418cd094606e199cca3b6 # v1
- name: Setup Java
uses: actions/setup-java@v3
with:

View File

@ -1,10 +1,8 @@
name: build
on:
push:
branches:
- v6
jobs:
build:
if: github.repository_owner == 'IntellectualSites'
@ -13,7 +11,7 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
uses: gradle/wrapper-validation-action@55e685c48d84285a5b0418cd094606e199cca3b6 # v1
- name: Setup Java
uses: actions/setup-java@v3
with:
@ -45,7 +43,7 @@ jobs:
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
- name: Publish core javadoc
if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/v6'}}
uses: cpina/github-action-push-to-another-repository@main
uses: cpina/github-action-push-to-another-repository@0a14457bb28b04dfa1652e0ffdfda866d2845c73 # main
env:
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
with:
@ -57,7 +55,7 @@ jobs:
target-directory: core
- name: Publish bukkit javadoc
if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/v6'}}
uses: cpina/github-action-push-to-another-repository@main
uses: cpina/github-action-push-to-another-repository@0a14457bb28b04dfa1652e0ffdfda866d2845c73 # main
env:
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
with:

View File

@ -1,10 +1,8 @@
name: "CodeQL"
on:
pull_request:
# The branches below must be a subset of the branches above
branches: [ v6 ]
branches: [v6]
jobs:
analyze:
name: Analyze
@ -13,23 +11,18 @@ jobs:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'java' ]
language: ['java']
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@32dc499307d133bb5085bae78498c0ac2cf762d5 # v2
with:
languages: ${{ matrix.language }}
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@32dc499307d133bb5085bae78498c0ac2cf762d5 # v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@32dc499307d133bb5085bae78498c0ac2cf762d5 # v2

View File

@ -1,14 +1,12 @@
name: draft release
on:
push:
branches:
- v6
pull_request:
types: [ opened, reopened, synchronize ]
types: [opened, reopened, synchronize]
pull_request_target:
types: [ opened, reopened, synchronize ]
types: [opened, reopened, synchronize]
jobs:
update_release_draft:
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}

View File

@ -71,6 +71,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;
@ -109,6 +111,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;
@ -810,8 +813,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;
}
@ -824,8 +826,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;
@ -835,7 +836,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;
@ -866,8 +867,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);
}
}
}
@ -972,8 +972,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 {
@ -984,8 +983,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);
}
}
}
@ -999,6 +997,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(

View File

@ -161,6 +161,12 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
world.setWaterAnimalSpawnLimit(limit);
}
/**
* The entire method is deprecated, but kept for compatibility with versions lower than or equal to 1.16.2.
* The method will be removed in future versions, because WorldEdit and FastAsyncWorldEdit only support the latest point
* release.
*/
@Deprecated(forRemoval = true, since = "6.11.0")
@Override
public @NonNull ChunkData generateChunkData(
@NonNull World world, @NonNull Random random, int x, int z,

View File

@ -98,6 +98,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;
@ -703,6 +704,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();

View File

@ -75,7 +75,7 @@ public class BukkitPlayer extends PlotPlayer<Player> {
* @deprecated Please do not use this method. Instead use {@link BukkitUtil#adapt(Player)}, as it caches player objects.
* This method will be made private in a future release.
*/
@Deprecated(forRemoval = true, since = "TODO")
@Deprecated(forRemoval = true, since = "6.10.9")
public BukkitPlayer(
final @NonNull PlotAreaManager plotAreaManager, final @NonNull EventDispatcher eventDispatcher,
final @NonNull Player player, final @NonNull PermissionHandler permissionHandler
@ -92,7 +92,7 @@ public class BukkitPlayer extends PlotPlayer<Player> {
* @deprecated Please do not use this method. Instead use {@link BukkitUtil#adapt(Player)}, as it caches player objects.
* This method will be made private in a future release.
*/
@Deprecated(forRemoval = true, since = "TODO")
@Deprecated(forRemoval = true, since = "6.10.9")
public BukkitPlayer(
final @NonNull PlotAreaManager plotAreaManager, final @NonNull
EventDispatcher eventDispatcher, final @NonNull Player player,

View File

@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at contact@intellectualsites.com. All
reported by contacting the project team at contact<at>intellectualsites.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.

View File

@ -56,6 +56,7 @@ import com.plotsquared.core.util.TabCompletions;
import com.plotsquared.core.util.WorldUtil;
import com.plotsquared.core.util.task.RunnableVal3;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.EditSessionBuilder;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.entity.Player;
@ -228,10 +229,9 @@ public class Area extends SubCommand {
try (final ClipboardWriter clipboardWriter = BuiltInClipboardFormat.SPONGE_SCHEMATIC.getWriter(new FileOutputStream(
file))) {
final BlockArrayClipboard clipboard = new BlockArrayClipboard(selectedRegion);
final EditSession editSession = WorldEdit
.getInstance()
.getEditSessionFactory()
.getEditSession(selectedRegion.getWorld(), -1);
EditSessionBuilder editSessionBuilder = WorldEdit.getInstance().newEditSessionBuilder();
editSessionBuilder.world(selectedRegion.getWorld());
final EditSession editSession = editSessionBuilder.build();
final ForwardExtentCopy forwardExtentCopy =
new ForwardExtentCopy(editSession, selectedRegion, clipboard, selectedRegion.getMinimumPoint());
forwardExtentCopy.setCopyingBiomes(true);

View File

@ -106,7 +106,6 @@ public class Clear extends Command {
BackupManager.backup(player, plot, () -> {
final long start = System.currentTimeMillis();
boolean result = plot.getPlotModificationManager().clear(true, false, player, () -> {
plot.getPlotModificationManager().unlink();
TaskManager.runTask(() -> {
plot.removeRunning();
// If the state changes, then mark it as no longer done

View File

@ -62,7 +62,7 @@ public class ComponentPreset implements ConfigurationSerializable {
public static ComponentPreset deserialize(final @NonNull Map<String, Object> map) {
final ClassicPlotManagerComponent classicPlotManagerComponent = ClassicPlotManagerComponent
.fromString(map.getOrDefault("component", "").toString()).orElseThrow(() ->
new IllegalArgumentException("The preset needs a valid target component"));
new IllegalArgumentException("The preset in components.yml needs a valid target component, got: " + map.get("component")));
final String pattern = map.getOrDefault("pattern", "").toString();
final double cost = Double.parseDouble(map.getOrDefault("cost", "0.0").toString());
final String permission = map.getOrDefault("permission", "").toString();

View File

@ -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 6.11.0
*/
public EntityEvent(Entity entity) {
this.entity = entity;
}
/**
* Obtain the entity involved in the event
*
* @return Entity
* @since 6.11.0
*/
public Entity getEntity() {
return this.entity;
}
/**
* Obtain the event's class name
*
* @return the event class name
* @since 6.11.0
*/
@NonNull public String getEventName() {
if (this.name == null) {
this.name = this.getClass().getSimpleName();
}
return this.name;
}
}

View File

@ -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 6.11.0
*/
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 6.11.0
*/
public RemoveRoadEntityEvent(Entity entity) {
super(entity);
}
@Override
public Result getEventResult() {
return this.eventResult;
}
@Override
public void setEventResult(Result eventResult) {
this.eventResult = eventResult;
}
}

View File

@ -334,7 +334,7 @@ public final class PlotModificationManager {
* @param createSign whether to recreate signs
* @param whenDone Task to run when unlink is complete
* @return success/!cancelled
* @since TODO
* @since 6.10.9
*/
public boolean unlinkPlot(final boolean createRoad, final boolean createSign, final Runnable whenDone) {
if (!this.plot.isMerged()) {

View File

@ -221,7 +221,7 @@ public abstract class QueueCoordinator {
* @return success or not
* @deprecated Biomes now take XYZ, see {@link #setBiome(int, int, int, BiomeType)}
* <br>
* Scheduled for removal once we drop the support for versions not supporting 3D biomes.
* Scheduled for removal once we drop the support for versions not supporting 3D biomes, 1.18 and earlier.
*/
@Deprecated(forRemoval = true, since = "6.0.0")
public abstract boolean setBiome(int x, int z, @NonNull BiomeType biome);

View File

@ -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;
@ -296,6 +298,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

View File

@ -491,6 +491,10 @@ public abstract class SchematicHandler {
return null;
}
/**
* The legacy web interface is deprecated for removal in favor of Arkitektonika.
*/
@Deprecated(forRemoval = true, since = "6.11.0")
public List<String> getSaves(UUID uuid) {
String rawJSON;
try {

View File

@ -252,6 +252,10 @@ public abstract class WorldUtil {
*/
public abstract void refreshChunk(int x, int z, String world);
/**
* The legacy web interface is deprecated for removal in favor of Arkitektonika.
*/
@Deprecated(forRemoval = true, since = "6.11.0")
public void upload(
final @NonNull Plot plot,
final @Nullable UUID uuid,

View File

@ -18,7 +18,7 @@ plugins {
}
group = "com.plotsquared"
version = "6.10.9-SNAPSHOT"
version = "6.11.1-SNAPSHOT"
if (!File("$rootDir/.git").exists()) {
logger.lifecycle("""
@ -74,7 +74,7 @@ subprojects {
}
dependencies {
implementation(platform("com.intellectualsites.bom:bom-1.18.x:1.22"))
implementation(platform("com.intellectualsites.bom:bom-1.18.x:1.24"))
}
dependencies {
@ -155,7 +155,7 @@ subprojects {
id.set("NotMyFault")
name.set("Alexander Brandes")
organization.set("IntellectualSites")
email.set("contact@notmyfault.dev")
email.set("contact(at)notmyfault.dev")
}
developer {
id.set("SirYwell")

View File

@ -11,9 +11,9 @@ essentialsx = "2.19.7"
mvdwapi = "3.1.1"
# Third party
prtree = "2.0.0"
prtree = "2.0.1"
aopalliance = "1.0"
cloud-services = "1.8.0"
cloud-services = "1.8.2"
arkitektonika = "2.1.1"
squirrelid = "0.3.1"
http4j = "1.3"
@ -21,8 +21,8 @@ http4j = "1.3"
# Gradle plugins
shadow = "7.1.2"
grgit = "4.1.1"
spotless = "6.13.0"
nexus = "1.1.0"
spotless = "6.16.0"
nexus = "1.2.0"
[libraries]
# Platform expectations

View File

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists