mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 11:55:38 +01:00
Fix plot claim.
This commit is contained in:
parent
546c4defb7
commit
100861484a
@ -132,7 +132,7 @@ public class Claim extends SubCommand {
|
|||||||
final String finalSchematic = schematic;
|
final String finalSchematic = schematic;
|
||||||
DBFunc.createPlotSafe(plot, () -> TaskManager.IMP.sync(new RunnableVal<Object>() {
|
DBFunc.createPlotSafe(plot, () -> TaskManager.IMP.sync(new RunnableVal<Object>() {
|
||||||
@Override public void run(Object value) {
|
@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() +
|
PlotSquared.get().getLogger().log(Captions.PREFIX.getTranslated() +
|
||||||
String.format("Failed to claim plot %s", plot.getId().toCommaSeparatedString()));
|
String.format("Failed to claim plot %s", plot.getId().toCommaSeparatedString()));
|
||||||
sendMessage(player, Captions.PLOT_NOT_CLAIMED);
|
sendMessage(player, Captions.PLOT_NOT_CLAIMED);
|
||||||
|
@ -1752,7 +1752,7 @@ public class Plot {
|
|||||||
return this.create(this.owner, true);
|
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)) {
|
if (!canClaim(player)) {
|
||||||
PlotSquared.debug(Captions.PREFIX.getTranslated() + String
|
PlotSquared.debug(Captions.PREFIX.getTranslated() + String
|
||||||
.format("Player %s attempted to claim plot %s, but was not allowed",
|
.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);
|
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) {
|
boolean updateDB) {
|
||||||
|
|
||||||
if (updateDB) {
|
if (updateDB) {
|
||||||
@ -2390,9 +2390,9 @@ public class Plot {
|
|||||||
* @param player the claiming player
|
* @param player the claiming player
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean canClaim(@Nullable PlotPlayer player) {
|
public boolean canClaim(@NotNull PlotPlayer player) {
|
||||||
PlotCluster cluster = this.getCluster();
|
PlotCluster cluster = this.getCluster();
|
||||||
if (cluster != null && player != null) {
|
if (cluster != null) {
|
||||||
if (!cluster.isAdded(player.getUUID()) && !Permissions
|
if (!cluster.isAdded(player.getUUID()) && !Permissions
|
||||||
.hasPermission(player, "plots.admin.command.claim")) {
|
.hasPermission(player, "plots.admin.command.claim")) {
|
||||||
return false;
|
return false;
|
||||||
@ -2400,9 +2400,7 @@ public class Plot {
|
|||||||
}
|
}
|
||||||
final UUID owner = this.guessOwner();
|
final UUID owner = this.guessOwner();
|
||||||
if (owner != null) {
|
if (owner != null) {
|
||||||
if (player == null || !player.getUUID().equals(owner)) {
|
return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return !isMerged();
|
return !isMerged();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user