Compare commits

..

1 Commits

Author SHA1 Message Date
5b1bc98edd Get the most out of javadocs 2023-01-09 13:17:36 +01:00
13 changed files with 42 additions and 82 deletions

View File

@ -1,23 +0,0 @@
name: Build PR
on: [ pull_request ]
jobs:
build_pr:
if: github.repository_owner == 'IntellectualSites'
runs-on: ${{ matrix.os }}
strategy:
matrix:
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
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- name: Clean Build
run: ./gradlew clean build

View File

@ -1,18 +1,15 @@
name: build
on:
push:
branches:
- v6
on: [ pull_request, push ]
jobs:
build:
if: github.repository_owner == 'IntellectualSites'
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Validate Gradle Wrapper
- name: Validate Gradle Wrapper"
uses: gradle/wrapper-validation-action@v1
- name: Setup Java
uses: actions/setup-java@v3

View File

@ -1,6 +1,8 @@
name: "CodeQL"
on:
push:
branches: [ v6 ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ v6 ]

View File

@ -98,7 +98,6 @@ tasks.named<ShadowJar>("shadowJar") {
tasks {
withType<Javadoc> {
val isRelease = if (rootProject.version.toString().endsWith("-SNAPSHOT")) "TODO" else rootProject.version.toString()
val opt = options as StandardJavadocDocletOptions
opt.links("https://jd.papermc.io/paper/1.18/")
opt.links("https://docs.enginehub.org/javadoc/com.sk89q.worldedit/worldedit-bukkit/" + libs.worldeditBukkit.get().versionConstraint.toString())
@ -111,6 +110,5 @@ tasks {
opt.isUse = true
opt.encoding("UTF-8")
opt.keyWords()
opt.addStringOption("-since", isRelease)
}
}

View File

@ -36,6 +36,7 @@ import com.plotsquared.bukkit.listener.ChunkListener;
import com.plotsquared.bukkit.listener.EntityEventListener;
import com.plotsquared.bukkit.listener.EntitySpawnListener;
import com.plotsquared.bukkit.listener.PaperListener;
import com.plotsquared.bukkit.listener.PaperListener113;
import com.plotsquared.bukkit.listener.PlayerEventListener;
import com.plotsquared.bukkit.listener.ProjectileEventListener;
import com.plotsquared.bukkit.listener.ServerListener;
@ -355,7 +356,11 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
getServer().getPluginManager().registerEvents(injector().getInstance(ServerListener.class), this);
getServer().getPluginManager().registerEvents(injector().getInstance(EntitySpawnListener.class), this);
if (PaperLib.isPaper() && Settings.Paper_Components.PAPER_LISTENERS) {
if (serverVersion()[1] == 13) {
getServer().getPluginManager().registerEvents(injector().getInstance(PaperListener113.class), this);
} else {
getServer().getPluginManager().registerEvents(injector().getInstance(PaperListener.class), this);
}
} else {
getServer().getPluginManager().registerEvents(injector().getInstance(SpigotListener.class), this);
}

View File

@ -30,9 +30,8 @@ import org.checkerframework.checker.nullness.qual.Nullable;
*
* @deprecated Deprecated and scheduled for removal without replacement
* in favor of the build in setup wizard.
* However, this class will be kept around for a while, given it's not a maintenance burden.
*/
@Deprecated
@Deprecated(forRemoval = true, since = "6.0.0")
@Singleton
public class MultiverseWorldManager extends BukkitWorldManager {

View File

@ -67,15 +67,14 @@ public class BukkitPlayer extends PlotPlayer<Player> {
private String name;
/**
* <p>Please do not use this method. Instead use
* BukkitUtil.getPlayer(Player), as it caches player objects.</p>
*
* @param plotAreaManager PlotAreaManager instance
* @param eventDispatcher EventDispatcher instance
* @param player Bukkit player instance
* @param permissionHandler PermissionHandler instance
*
* @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")
public BukkitPlayer(
final @NonNull PlotAreaManager plotAreaManager, final @NonNull EventDispatcher eventDispatcher,
final @NonNull Player player, final @NonNull PermissionHandler permissionHandler
@ -83,16 +82,6 @@ public class BukkitPlayer extends PlotPlayer<Player> {
this(plotAreaManager, eventDispatcher, player, false, permissionHandler);
}
/**
* @param plotAreaManager PlotAreaManager instance
* @param eventDispatcher EventDispatcher instance
* @param player Bukkit player instance
* @param permissionHandler PermissionHandler instance
*
* @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")
public BukkitPlayer(
final @NonNull PlotAreaManager plotAreaManager, final @NonNull
EventDispatcher eventDispatcher, final @NonNull Player player,

View File

@ -54,7 +54,6 @@ public class BukkitPlayerManager extends PlayerManager<BukkitPlayer, Player> {
@NonNull
@Override
@SuppressWarnings("deprecation")
public BukkitPlayer getPlayer(final @NonNull Player object) {
if (object.getUniqueId().version() == 2) { // not a real player
return new BukkitPlayer(this.plotAreaManager, this.eventDispatcher, object, false, this.permissionHandler);
@ -66,7 +65,6 @@ public class BukkitPlayerManager extends PlayerManager<BukkitPlayer, Player> {
}
@Override
@SuppressWarnings("deprecation")
public @NonNull BukkitPlayer createPlayer(final @NonNull UUID uuid) {
final Player player = Bukkit.getPlayer(uuid);
if (player == null || !player.isOnline()) {

View File

@ -65,7 +65,6 @@ tasks.processResources {
tasks {
withType<Javadoc> {
val isRelease = if (rootProject.version.toString().endsWith("-SNAPSHOT")) "TODO" else rootProject.version.toString()
val opt = options as StandardJavadocDocletOptions
opt.links("https://docs.enginehub.org/javadoc/com.sk89q.worldedit/worldedit-core/" + libs.worldeditCore.get().versionConstraint.toString())
opt.links("https://jd.adventure.kyori.net/api/4.9.3/")
@ -77,6 +76,5 @@ tasks {
opt.isUse = true
opt.encoding("UTF-8")
opt.keyWords()
opt.addStringOption("-since", isRelease)
}
}

View File

@ -122,6 +122,9 @@ public class Plot {
private static final MiniMessage MINI_MESSAGE = MiniMessage.builder().build();
private static final Cleaner CLEANER = Cleaner.create();
static Set<Plot> connected_cache;
static Set<CuboidRegion> regions_cache;
static {
FLAG_DECIMAL_FORMAT.setMaximumFractionDigits(340);
}
@ -204,8 +207,6 @@ public class Plot {
*/
private Plot origin;
private Set<Plot> connectedCache;
/**
* Constructor for a new plot.
* (Only changes after plot.create() will be properly set in the database)
@ -575,14 +576,7 @@ public class Plot {
return false;
}
final Set<Plot> connected = getConnectedPlots();
for (Plot current : connected) {
// can skip ServerPlotFlag check in getOwner()
// as flags are synchronized between plots
if (uuid.equals(current.getOwnerAbs())) {
return true;
}
}
return false;
return connected.stream().anyMatch(current -> uuid.equals(current.getOwner()));
}
/**
@ -1300,7 +1294,6 @@ public class Plot {
DBFunc.delete(current);
current.setOwnerAbs(null);
current.settings = null;
current.clearCache();
for (final PlotPlayer<?> pp : players) {
this.plotListener.plotEntry(pp, current);
}
@ -1871,7 +1864,6 @@ public class Plot {
this.area.removePlot(this.id);
this.id = plot.getId();
this.area.addPlotAbs(this);
clearCache();
DBFunc.movePlot(this, plot);
TaskManager.runTaskLater(whenDone, TaskTime.ticks(1L));
return true;
@ -2136,16 +2128,17 @@ public class Plot {
this.origin.origin = base;
other.origin = base;
this.origin = base;
this.connectedCache = null;
connected_cache = null;
}
} else {
if (this.origin != null) {
this.origin.origin = null;
this.origin = null;
}
this.connectedCache = null;
connected_cache = null;
}
DBFunc.setMerged(this, this.getSettings().getMerged());
regions_cache = null;
}
}
@ -2180,7 +2173,8 @@ public class Plot {
}
public void clearCache() {
this.connectedCache = null;
connected_cache = null;
regions_cache = null;
if (this.origin != null) {
this.origin.origin = null;
this.origin = null;
@ -2307,9 +2301,10 @@ public class Plot {
if (!this.isMerged()) {
return Collections.singleton(this);
}
if (this.connectedCache != null && this.connectedCache.contains(this)) {
return this.connectedCache;
if (connected_cache != null && connected_cache.contains(this)) {
return connected_cache;
}
regions_cache = null;
HashSet<Plot> tmpSet = new HashSet<>();
tmpSet.add(this);
@ -2414,7 +2409,7 @@ public class Plot {
}
}
}
this.connectedCache = tmpSet;
connected_cache = tmpSet;
return tmpSet;
}
@ -2426,15 +2421,19 @@ public class Plot {
* @return all regions within the plot
*/
public @NonNull Set<CuboidRegion> getRegions() {
if (regions_cache != null && connected_cache != null && connected_cache.contains(this)) {
return regions_cache;
}
if (!this.isMerged()) {
Location pos1 = this.getBottomAbs().withY(getArea().getMinBuildHeight());
Location pos2 = this.getTopAbs().withY(getArea().getMaxBuildHeight());
this.connectedCache = Sets.newHashSet(this);
connected_cache = Sets.newHashSet(this);
CuboidRegion rg = new CuboidRegion(pos1.getBlockVector3(), pos2.getBlockVector3());
return Collections.singleton(rg);
regions_cache = Collections.singleton(rg);
return regions_cache;
}
Set<Plot> plots = this.getConnectedPlots();
Set<CuboidRegion> regions = new HashSet<>();
Set<CuboidRegion> regions = regions_cache = new HashSet<>();
Set<PlotId> visited = new HashSet<>();
for (Plot current : plots) {
if (visited.contains(current.getId())) {

View File

@ -263,7 +263,6 @@ public final class PlotModificationManager {
return;
}
Plot current = queue.poll();
current.clearCache();
if (plot.getArea().getTerrain() != PlotAreaTerrainType.NONE) {
try {
PlotSquared.platform().regionManager().regenerateRegion(
@ -328,7 +327,6 @@ public final class PlotModificationManager {
ArrayList<PlotId> ids = new ArrayList<>(plots.size());
for (Plot current : plots) {
current.setHome(null);
current.clearCache();
ids.add(current.getId());
}
this.plot.clearRatings();
@ -480,7 +478,8 @@ public final class PlotModificationManager {
this.plot.updateWorldBorder();
}
}
this.plot.clearCache();
Plot.connected_cache = null;
Plot.regions_cache = null;
this.plot.getTrusted().clear();
this.plot.getMembers().clear();
this.plot.getDenied().clear();
@ -631,7 +630,6 @@ public final class PlotModificationManager {
if (queue.size() > 0) {
queue.enqueue();
}
visited.forEach(Plot::clearCache);
return toReturn;
}

View File

@ -23,9 +23,9 @@ import com.plotsquared.core.plot.PlotArea;
import com.plotsquared.core.plot.world.PlotAreaManager;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.HashSet;
import java.util.Set;
class GlobalPlotProvider implements PlotProvider {
@ -37,7 +37,7 @@ class GlobalPlotProvider implements PlotProvider {
@Override
public Collection<Plot> getPlots() {
final List<Plot> plots = new ArrayList<>();
final Set<Plot> plots = new HashSet<>();
for (final PlotArea plotArea : this.plotAreaManager.getAllPlotAreas()) {
plots.addAll(plotArea.getPlots());
}

View File

@ -18,7 +18,7 @@ plugins {
}
group = "com.plotsquared"
version = "6.10.9-SNAPSHOT"
version = "6.10.7-SNASPHOT"
subprojects {
group = rootProject.group
@ -64,12 +64,12 @@ subprojects {
}
dependencies {
implementation(platform("com.intellectualsites.bom:bom-1.18.x:1.22"))
implementation(platform("com.intellectualsites.bom:bom-1.18.x:1.21"))
}
dependencies {
// Tests
testImplementation("org.junit.jupiter:junit-jupiter:5.9.2")
testImplementation("org.junit.jupiter:junit-jupiter:5.9.1")
}
plugins.withId("java") {