Fix plot claim.

This commit is contained in:
dordsor21 2020-04-18 17:22:51 +01:00
parent 546c4defb7
commit 100861484a
2 changed files with 6 additions and 8 deletions

View File

@ -132,7 +132,7 @@ public class Claim extends SubCommand {
final String finalSchematic = schematic;
DBFunc.createPlotSafe(plot, () -> TaskManager.IMP.sync(new RunnableVal<Object>() {
@Override public void run(Object value) {
if (!plot.claim(player, true, finalSchematic)) {
if (!plot.claim(player, true, finalSchematic, false)) {
PlotSquared.get().getLogger().log(Captions.PREFIX.getTranslated() +
String.format("Failed to claim plot %s", plot.getId().toCommaSeparatedString()));
sendMessage(player, Captions.PLOT_NOT_CLAIMED);

View File

@ -1752,7 +1752,7 @@ public class Plot {
return this.create(this.owner, true);
}
public boolean claim(final PlotPlayer player, boolean teleport, String schematic) {
public boolean claim(@NotNull final PlotPlayer player, boolean teleport, String schematic) {
if (!canClaim(player)) {
PlotSquared.debug(Captions.PREFIX.getTranslated() + String
.format("Player %s attempted to claim plot %s, but was not allowed",
@ -1762,7 +1762,7 @@ public class Plot {
return claim(player, teleport, schematic, true);
}
public boolean claim(final PlotPlayer player, boolean teleport, String schematic,
public boolean claim(@NotNull final PlotPlayer player, boolean teleport, String schematic,
boolean updateDB) {
if (updateDB) {
@ -2390,9 +2390,9 @@ public class Plot {
* @param player the claiming player
* @return
*/
public boolean canClaim(@Nullable PlotPlayer player) {
public boolean canClaim(@NotNull PlotPlayer player) {
PlotCluster cluster = this.getCluster();
if (cluster != null && player != null) {
if (cluster != null) {
if (!cluster.isAdded(player.getUUID()) && !Permissions
.hasPermission(player, "plots.admin.command.claim")) {
return false;
@ -2400,10 +2400,8 @@ public class Plot {
}
final UUID owner = this.guessOwner();
if (owner != null) {
if (player == null || !player.getUUID().equals(owner)) {
return false;
}
}
return !isMerged();
}