mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
This commit is contained in:
parent
a75db92007
commit
aca2d2e510
@ -33,6 +33,8 @@ import com.plotsquared.core.events.PlotChangeOwnerEvent;
|
|||||||
import com.plotsquared.core.events.PlotUnlinkEvent;
|
import com.plotsquared.core.events.PlotUnlinkEvent;
|
||||||
import com.plotsquared.core.events.Result;
|
import com.plotsquared.core.events.Result;
|
||||||
import com.plotsquared.core.permissions.Permission;
|
import com.plotsquared.core.permissions.Permission;
|
||||||
|
import com.plotsquared.core.player.MetaDataAccess;
|
||||||
|
import com.plotsquared.core.player.PlayerMetaDataKeys;
|
||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
import com.plotsquared.core.plot.Plot;
|
import com.plotsquared.core.plot.Plot;
|
||||||
import com.plotsquared.core.util.EventDispatcher;
|
import com.plotsquared.core.util.EventDispatcher;
|
||||||
@ -152,11 +154,20 @@ public class Owner extends SetCommand {
|
|||||||
int currentPlots = (Settings.Limit.GLOBAL ?
|
int currentPlots = (Settings.Limit.GLOBAL ?
|
||||||
other.getPlotCount() :
|
other.getPlotCount() :
|
||||||
other.getPlotCount(plot.getWorldName())) + size;
|
other.getPlotCount(plot.getWorldName())) + size;
|
||||||
if (currentPlots > other.getAllowedPlots()) {
|
try (final MetaDataAccess<Integer> metaDataAccess = player.accessPersistentMetaData(PlayerMetaDataKeys.PERSISTENT_GRANTED_PLOTS)) {
|
||||||
|
int grants = 0;
|
||||||
|
if (currentPlots >= other.getAllowedPlots()) {
|
||||||
|
if (metaDataAccess.isPresent()) {
|
||||||
|
grants = metaDataAccess.get().orElse(0);
|
||||||
|
if (grants <= 0) {
|
||||||
|
metaDataAccess.remove();
|
||||||
player.sendMessage(TranslatableCaption.of("permission.cant_transfer_more_plots"));
|
player.sendMessage(TranslatableCaption.of("permission.cant_transfer_more_plots"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
final UUID finalUUID = uuid;
|
final UUID finalUUID = uuid;
|
||||||
PlotSquared.get().getImpromptuUUIDPipeline().getSingle(uuid, (finalName, throwable) -> {
|
PlotSquared.get().getImpromptuUUIDPipeline().getSingle(uuid, (finalName, throwable) -> {
|
||||||
final boolean removeDenied = plot.isDenied(finalUUID);
|
final boolean removeDenied = plot.isDenied(finalUUID);
|
||||||
|
Loading…
Reference in New Issue
Block a user