Compare commits

..

1 Commits

Author SHA1 Message Date
f54bb88394 deprecate PlotId#copy 2022-10-02 20:23:26 +02:00
5 changed files with 9 additions and 13 deletions

View File

@ -176,7 +176,7 @@ public class DatabaseCommand extends SubCommand {
);
worldFile.renameTo(newFile);
}
plot.setId(newId.copy());
plot.setId(newId);
plot.setArea(pa);
plots.add(plot);
continue;

View File

@ -181,7 +181,6 @@ public class Download extends SubCommand {
schematicHandler.upload(compoundTag, null, null, new RunnableVal<>() {
@Override
public void run(URL value) {
plot.removeRunning();
player.sendMessage(
TranslatableCaption.of("web.generation_link_success"),
Template.of("download", value.toString()),

View File

@ -26,7 +26,6 @@ import com.plotsquared.core.util.task.RunnableVal2;
import com.plotsquared.core.util.task.RunnableVal3;
import net.kyori.adventure.text.minimessage.Template;
import java.util.List;
import java.util.concurrent.CompletableFuture;
@CommandDeclaration(command = "near",
@ -49,13 +48,9 @@ public class Near extends Command {
final Plot plot = check(player.getCurrentPlot(), TranslatableCaption.of("errors.not_in_plot"));
player.sendMessage(
TranslatableCaption.of("near.plot_near"),
Template.of("list", StringMan.join(getPlayersInPlotVisible(plot, player), ", "))
Template.of("list", StringMan.join(plot.getPlayersInPlot(), ", "))
);
return CompletableFuture.completedFuture(true);
}
private List<PlotPlayer<?>> getPlayersInPlotVisible(Plot plot, PlotPlayer<?> executor) {
return plot.getPlayersInPlot().stream().filter(executor::canSee).toList();
}
}

View File

@ -457,7 +457,7 @@ public class Plot {
* that could alter the de facto owner of the plot.
*
* @return The plot owner of this particular (sub-)plot
* as stored in the database, if one exists. Else, null.
* as stored in the database, if one exists. Else, null.
*/
public @Nullable UUID getOwnerAbs() {
return this.owner;
@ -1836,8 +1836,8 @@ public class Plot {
}
// Swap cached
final PlotId temp = PlotId.of(this.getId().getX(), this.getId().getY());
this.id = plot.getId().copy();
plot.id = temp.copy();
this.id = plot.getId();
plot.id = temp;
this.area.removePlot(this.getId());
plot.area.removePlot(plot.getId());
this.area.addPlotAbs(this);
@ -1863,7 +1863,7 @@ public class Plot {
return false;
}
this.area.removePlot(this.id);
this.id = plot.getId().copy();
this.id = plot.getId();
this.area.addPlotAbs(this);
DBFunc.movePlot(this, plot);
TaskManager.runTaskLater(whenDone, TaskTime.ticks(1L));

View File

@ -110,9 +110,11 @@ public final class PlotId {
* Get a copy of the plot ID
*
* @return Plot ID copy
* @deprecated PlotId is immutable, copy is not required.
*/
@Deprecated(forRemoval = true, since = "TODO")
public @NonNull PlotId copy() {
return of(this.getX(), this.getY());
return this;
}
/**