mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 07:06:44 +01:00
Clean up PlotAreaManager and move a bunch of plot area related logic out of PlotSquared
This commit is contained in:
parent
d76c9dad52
commit
196df855ac
@ -1010,7 +1010,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
}
|
}
|
||||||
map.put(plotAreaType.name().toLowerCase(), terrainTypes);
|
map.put(plotAreaType.name().toLowerCase(), terrainTypes);
|
||||||
}
|
}
|
||||||
for (final PlotArea plotArea : PlotSquared.get().getPlotAreas()) {
|
for (final PlotArea plotArea : PlotSquared.get().getPlotAreaManager().getAllPlotAreas()) {
|
||||||
final Map<String, Integer> terrainTypeMap =
|
final Map<String, Integer> terrainTypeMap =
|
||||||
map.get(plotArea.getType().name().toLowerCase());
|
map.get(plotArea.getType().name().toLowerCase());
|
||||||
terrainTypeMap.put(plotArea.getTerrain().name().toLowerCase(),
|
terrainTypeMap.put(plotArea.getTerrain().name().toLowerCase(),
|
||||||
@ -1071,7 +1071,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
|
|||||||
world = Bukkit.getWorld(worldName);
|
world = Bukkit.getWorld(worldName);
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
if (!PlotSquared.get().hasPlotArea(worldName)) {
|
if (!PlotSquared.get().getPlotAreaManager().hasPlotArea(worldName)) {
|
||||||
SetGenCB.setGenerator(BukkitUtil.getWorld(worldName));
|
SetGenCB.setGenerator(BukkitUtil.getWorld(worldName));
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -54,7 +54,10 @@ final class BlockStatePopulator extends BlockPopulator {
|
|||||||
if (this.queue == null) {
|
if (this.queue == null) {
|
||||||
this.queue = GlobalBlockQueue.IMP.getNewQueue(world.getName(), false);
|
this.queue = GlobalBlockQueue.IMP.getNewQueue(world.getName(), false);
|
||||||
}
|
}
|
||||||
final PlotArea area = PlotSquared.get().getPlotArea(world.getName(), null);
|
final PlotArea area = PlotSquared.get().getPlotAreaManager().getPlotArea(world.getName(), null);
|
||||||
|
if (area == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
final ChunkWrapper wrap =
|
final ChunkWrapper wrap =
|
||||||
new ChunkWrapper(area.getWorldName(), source.getX(), source.getZ());
|
new ChunkWrapper(area.getWorldName(), source.getX(), source.getZ());
|
||||||
final ScopedLocalBlockQueue chunk = this.queue.getForChunk(wrap.x, wrap.z);
|
final ScopedLocalBlockQueue chunk = this.queue.getForChunk(wrap.x, wrap.z);
|
||||||
|
@ -108,7 +108,7 @@ public class BukkitPlotGenerator extends ChunkGenerator
|
|||||||
if (!this.loaded) {
|
if (!this.loaded) {
|
||||||
String name = world.getName();
|
String name = world.getName();
|
||||||
PlotSquared.get().loadWorld(name, this);
|
PlotSquared.get().loadWorld(name, this);
|
||||||
Set<PlotArea> areas = PlotSquared.get().getPlotAreas(name);
|
final Set<PlotArea> areas = PlotSquared.get().getPlotAreaManager().getPlotAreasSet(name);
|
||||||
if (!areas.isEmpty()) {
|
if (!areas.isEmpty()) {
|
||||||
PlotArea area = areas.iterator().next();
|
PlotArea area = areas.iterator().next();
|
||||||
if (!area.isMobSpawning()) {
|
if (!area.isMobSpawning()) {
|
||||||
@ -198,8 +198,8 @@ public class BukkitPlotGenerator extends ChunkGenerator
|
|||||||
if (ChunkManager.preProcessChunk(loc, result)) {
|
if (ChunkManager.preProcessChunk(loc, result)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlotArea area = PlotSquared.get().getPlotArea(world.getName(), null);
|
PlotArea area = PlotSquared.get().getPlotAreaManager().getPlotArea(world.getName(), null);
|
||||||
if (area == null && (area = PlotSquared.get().getPlotArea(this.levelName, null)) == null) {
|
if (area == null && (area = PlotSquared.get().getPlotAreaManager().getPlotArea(this.levelName, null)) == null) {
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException(
|
||||||
"Cannot regenerate chunk that does not belong to a plot area." + " Location: " + loc
|
"Cannot regenerate chunk that does not belong to a plot area." + " Location: " + loc
|
||||||
+ ", world: " + world);
|
+ ", world: " + world);
|
||||||
|
@ -90,7 +90,7 @@ public class ChunkListener implements Listener {
|
|||||||
HashSet<Chunk> toUnload = new HashSet<>();
|
HashSet<Chunk> toUnload = new HashSet<>();
|
||||||
for (World world : Bukkit.getWorlds()) {
|
for (World world : Bukkit.getWorlds()) {
|
||||||
String worldName = world.getName();
|
String worldName = world.getName();
|
||||||
if (!PlotSquared.get().hasPlotArea(worldName)) {
|
if (!PlotSquared.get().getPlotAreaManager().hasPlotArea(worldName)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Object w = world.getClass().getDeclaredMethod("getHandle").invoke(world);
|
Object w = world.getClass().getDeclaredMethod("getHandle").invoke(world);
|
||||||
@ -177,7 +177,7 @@ public class ChunkListener implements Listener {
|
|||||||
Chunk chunk = event.getChunk();
|
Chunk chunk = event.getChunk();
|
||||||
if (Settings.Chunk_Processor.AUTO_TRIM) {
|
if (Settings.Chunk_Processor.AUTO_TRIM) {
|
||||||
String world = chunk.getWorld().getName();
|
String world = chunk.getWorld().getName();
|
||||||
if (PlotSquared.get().hasPlotArea(world)) {
|
if (PlotSquared.get().getPlotAreaManager().hasPlotArea(world)) {
|
||||||
if (unloadChunk(world, chunk, true)) {
|
if (unloadChunk(world, chunk, true)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -200,7 +200,7 @@ public class ChunkListener implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!PlotSquared.get().hasPlotArea(chunk.getWorld().getName())) {
|
if (!PlotSquared.get().getPlotAreaManager().hasPlotArea(chunk.getWorld().getName())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Entity[] entities = chunk.getEntities();
|
Entity[] entities = chunk.getEntities();
|
||||||
@ -230,7 +230,7 @@ public class ChunkListener implements Listener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!PlotSquared.get().hasPlotArea(chunk.getWorld().getName())) {
|
if (!PlotSquared.get().getPlotAreaManager().hasPlotArea(chunk.getWorld().getName())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Entity[] entities = chunk.getEntities();
|
Entity[] entities = chunk.getEntities();
|
||||||
@ -281,7 +281,7 @@ public class ChunkListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean processChunk(Chunk chunk, boolean unload) {
|
public boolean processChunk(Chunk chunk, boolean unload) {
|
||||||
if (!PlotSquared.get().hasPlotArea(chunk.getWorld().getName())) {
|
if (!PlotSquared.get().getPlotAreaManager().hasPlotArea(chunk.getWorld().getName())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Entity[] entities = chunk.getEntities();
|
Entity[] entities = chunk.getEntities();
|
||||||
|
@ -78,7 +78,7 @@ public class EntitySpawnListener implements Listener {
|
|||||||
if (areaName == world.getName()) {
|
if (areaName == world.getName()) {
|
||||||
} else {
|
} else {
|
||||||
areaName = world.getName();
|
areaName = world.getName();
|
||||||
hasPlotArea = PlotSquared.get().hasPlotArea(areaName);
|
hasPlotArea = PlotSquared.get().getPlotAreaManager().hasPlotArea(areaName);
|
||||||
}
|
}
|
||||||
if (!hasPlotArea) {
|
if (!hasPlotArea) {
|
||||||
return;
|
return;
|
||||||
@ -90,7 +90,7 @@ public class EntitySpawnListener implements Listener {
|
|||||||
@NotNull World world = entity.getWorld();
|
@NotNull World world = entity.getWorld();
|
||||||
List<MetadataValue> meta = entity.getMetadata(KEY);
|
List<MetadataValue> meta = entity.getMetadata(KEY);
|
||||||
if (meta.isEmpty()) {
|
if (meta.isEmpty()) {
|
||||||
if (PlotSquared.get().hasPlotArea(world.getName())) {
|
if (PlotSquared.get().getPlotAreaManager().hasPlotArea(world.getName())) {
|
||||||
entity.setMetadata(KEY,
|
entity.setMetadata(KEY,
|
||||||
new FixedMetadataValue((Plugin) PlotSquared.platform(), entity.getLocation()));
|
new FixedMetadataValue((Plugin) PlotSquared.platform(), entity.getLocation()));
|
||||||
}
|
}
|
||||||
|
@ -305,7 +305,7 @@ public class PaperListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Location location = BukkitUtil.getLocation(entity);
|
Location location = BukkitUtil.getLocation(entity);
|
||||||
if (!PlotSquared.get().hasPlotArea(location.getWorld())) {
|
if (!PlotSquared.get().getPlotAreaManager().hasPlotArea(location.getWorld())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlotPlayer<?> pp = BukkitUtil.getPlayer((Player) shooter);
|
PlotPlayer<?> pp = BukkitUtil.getPlayer((Player) shooter);
|
||||||
|
@ -483,7 +483,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Location location = BukkitUtil.getLocation(entity);
|
Location location = BukkitUtil.getLocation(entity);
|
||||||
if (!PlotSquared.get().hasPlotArea(location.getWorld())) {
|
if (!PlotSquared.get().getPlotAreaManager().hasPlotArea(location.getWorld())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlotPlayer<Player> pp = BukkitUtil.getPlayer((Player) shooter);
|
PlotPlayer<Player> pp = BukkitUtil.getPlayer((Player) shooter);
|
||||||
@ -497,7 +497,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
@EventHandler public boolean onProjectileHit(ProjectileHitEvent event) {
|
@EventHandler public boolean onProjectileHit(ProjectileHitEvent event) {
|
||||||
Projectile entity = event.getEntity();
|
Projectile entity = event.getEntity();
|
||||||
Location location = BukkitUtil.getLocation(entity);
|
Location location = BukkitUtil.getLocation(entity);
|
||||||
if (!PlotSquared.get().hasPlotArea(location.getWorld())) {
|
if (!PlotSquared.get().getPlotAreaManager().hasPlotArea(location.getWorld())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
PlotArea area = location.getPlotArea();
|
PlotArea area = location.getPlotArea();
|
||||||
@ -1069,7 +1069,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
PlotArea area = location.getPlotArea();
|
PlotArea area = location.getPlotArea();
|
||||||
boolean plotArea = location.isPlotArea();
|
boolean plotArea = location.isPlotArea();
|
||||||
if (!plotArea) {
|
if (!plotArea) {
|
||||||
if (!PlotSquared.get().hasPlotArea(location.getWorld())) {
|
if (!PlotSquared.get().getPlotAreaManager().hasPlotArea(location.getWorld())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -1165,7 +1165,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onEntityBlockForm(EntityBlockFormEvent event) {
|
public void onEntityBlockForm(EntityBlockFormEvent event) {
|
||||||
String world = event.getBlock().getWorld().getName();
|
String world = event.getBlock().getWorld().getName();
|
||||||
if (!PlotSquared.get().hasPlotArea(world)) {
|
if (!PlotSquared.get().getPlotAreaManager().hasPlotArea(world)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Location location = BukkitUtil.getLocation(event.getBlock().getLocation());
|
Location location = BukkitUtil.getLocation(event.getBlock().getLocation());
|
||||||
@ -1495,7 +1495,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
Vector relative = new Vector(face.getModX(), face.getModY(), face.getModZ());
|
Vector relative = new Vector(face.getModX(), face.getModY(), face.getModZ());
|
||||||
PlotArea area = location.getPlotArea();
|
PlotArea area = location.getPlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
if (!PlotSquared.get().hasPlotArea(location.getWorld())) {
|
if (!PlotSquared.get().getPlotAreaManager().hasPlotArea(location.getWorld())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (Block block1 : event.getBlocks()) {
|
for (Block block1 : event.getBlocks()) {
|
||||||
@ -1532,7 +1532,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
Location location = BukkitUtil.getLocation(block.getLocation());
|
Location location = BukkitUtil.getLocation(block.getLocation());
|
||||||
PlotArea area = location.getPlotArea();
|
PlotArea area = location.getPlotArea();
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
if (!PlotSquared.get().hasPlotArea(location.getWorld())) {
|
if (!PlotSquared.get().getPlotAreaManager().hasPlotArea(location.getWorld())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.pistonBlocks) {
|
if (this.pistonBlocks) {
|
||||||
@ -1625,7 +1625,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onStructureGrow(StructureGrowEvent event) {
|
public void onStructureGrow(StructureGrowEvent event) {
|
||||||
if (!PlotSquared.get().hasPlotArea(event.getWorld().getName())) {
|
if (!PlotSquared.get().getPlotAreaManager().hasPlotArea(event.getWorld().getName())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<org.bukkit.block.BlockState> blocks = event.getBlocks();
|
List<org.bukkit.block.BlockState> blocks = event.getBlocks();
|
||||||
@ -1688,7 +1688,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}*/
|
}*/
|
||||||
HumanEntity entity = event.getWhoClicked();
|
HumanEntity entity = event.getWhoClicked();
|
||||||
if (!(entity instanceof Player) || !PlotSquared.get()
|
if (!(entity instanceof Player) || !PlotSquared.get().getPlotAreaManager()
|
||||||
.hasPlotArea(entity.getWorld().getName())) {
|
.hasPlotArea(entity.getWorld().getName())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1819,7 +1819,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
public void onPotionSplash(LingeringPotionSplashEvent event) {
|
public void onPotionSplash(LingeringPotionSplashEvent event) {
|
||||||
Projectile entity = event.getEntity();
|
Projectile entity = event.getEntity();
|
||||||
Location location = BukkitUtil.getLocation(entity);
|
Location location = BukkitUtil.getLocation(entity);
|
||||||
if (!PlotSquared.get().hasPlotArea(location.getWorld())) {
|
if (!PlotSquared.get().getPlotAreaManager().hasPlotArea(location.getWorld())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!this.onProjectileHit(event)) {
|
if (!this.onProjectileHit(event)) {
|
||||||
@ -1884,7 +1884,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
Location location = BukkitUtil.getLocation(block.getLocation());
|
Location location = BukkitUtil.getLocation(block.getLocation());
|
||||||
String world = location.getWorld();
|
String world = location.getWorld();
|
||||||
if (!PlotSquared.get().hasPlotArea(world)) {
|
if (!PlotSquared.get().getPlotAreaManager().hasPlotArea(world)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlotArea area = location.getPlotArea();
|
PlotArea area = location.getPlotArea();
|
||||||
@ -2158,7 +2158,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
World world = block.getWorld();
|
World world = block.getWorld();
|
||||||
String worldName = world.getName();
|
String worldName = world.getName();
|
||||||
if (!PlotSquared.get().hasPlotArea(worldName)) {
|
if (!PlotSquared.get().getPlotAreaManager().hasPlotArea(worldName)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Location location = BukkitUtil.getLocation(block.getLocation());
|
Location location = BukkitUtil.getLocation(block.getLocation());
|
||||||
@ -2669,7 +2669,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
public void onPotionSplash(PotionSplashEvent event) {
|
public void onPotionSplash(PotionSplashEvent event) {
|
||||||
ThrownPotion damager = event.getPotion();
|
ThrownPotion damager = event.getPotion();
|
||||||
Location location = BukkitUtil.getLocation(damager);
|
Location location = BukkitUtil.getLocation(damager);
|
||||||
if (!PlotSquared.get().hasPlotArea(location.getWorld())) {
|
if (!PlotSquared.get().getPlotAreaManager().hasPlotArea(location.getWorld())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@ -2699,7 +2699,7 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
public void onEntityDamageByEntityEvent(EntityDamageByEntityEvent event) {
|
public void onEntityDamageByEntityEvent(EntityDamageByEntityEvent event) {
|
||||||
Entity damager = event.getDamager();
|
Entity damager = event.getDamager();
|
||||||
Location location = BukkitUtil.getLocation(damager);
|
Location location = BukkitUtil.getLocation(damager);
|
||||||
if (!PlotSquared.get().hasPlotArea(location.getWorld())) {
|
if (!PlotSquared.get().getPlotAreaManager().hasPlotArea(location.getWorld())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Entity victim = event.getEntity();
|
Entity victim = event.getEntity();
|
||||||
|
@ -87,7 +87,6 @@ import com.plotsquared.core.util.task.TaskManager;
|
|||||||
import com.plotsquared.core.uuid.UUIDPipeline;
|
import com.plotsquared.core.uuid.UUIDPipeline;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.math.BlockVector2;
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@ -387,11 +386,17 @@ public class PlotSquared<P> {
|
|||||||
return PlotSquared.instance;
|
return PlotSquared.instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the platform specific implementation of PlotSquared
|
||||||
|
*
|
||||||
|
* @return Platform implementation
|
||||||
|
*/
|
||||||
@NotNull public static PlotPlatform<?> platform() {
|
@NotNull public static PlotPlatform<?> platform() {
|
||||||
if (instance != null && instance.platform != null) {
|
if (instance != null && instance.platform != null) {
|
||||||
return instance.platform;
|
return instance.platform;
|
||||||
}
|
}
|
||||||
throw new IllegalStateException("Plot main implementation is missing");
|
throw new IllegalStateException("Plot platform implementation is missing");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -480,9 +485,12 @@ public class PlotSquared<P> {
|
|||||||
return plot.getArea().getPlotManager();
|
return plot.getArea().getPlotManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlotManager getPlotManager(Location location) {
|
@Nullable public PlotManager getPlotManager(@NotNull final Location location) {
|
||||||
PlotArea pa = getPlotAreaAbs(location);
|
final PlotArea plotArea = this.getPlotAreaManager().getPlotArea(location);
|
||||||
return pa != null ? pa.getPlotManager() : null;
|
if (plotArea == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return plotArea.getPlotManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -586,8 +594,8 @@ public class PlotSquared<P> {
|
|||||||
setPlotsTmp(area);
|
setPlotsTmp(area);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removePlotAreas(String world) {
|
public void removePlotAreas(@NotNull final String world) {
|
||||||
for (PlotArea area : getPlotAreas(world)) {
|
for (final PlotArea area : this.getPlotAreaManager().getPlotAreasSet(world)) {
|
||||||
if (area.getWorldName().equals(world)) {
|
if (area.getWorldName().equals(world)) {
|
||||||
removePlotArea(area);
|
removePlotArea(area);
|
||||||
}
|
}
|
||||||
@ -609,9 +617,9 @@ public class PlotSquared<P> {
|
|||||||
this.clusters_tmp.put(area.toString(), area.getClusters());
|
this.clusters_tmp.put(area.toString(), area.getClusters());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<PlotCluster> getClusters(String world) {
|
public Set<PlotCluster> getClusters(@NotNull final String world) {
|
||||||
Set<PlotCluster> set = new HashSet<>();
|
final Set<PlotCluster> set = new HashSet<>();
|
||||||
for (PlotArea area : getPlotAreas(world)) {
|
for (final PlotArea area : this.getPlotAreaManager().getPlotAreasSet(world)) {
|
||||||
set.addAll(area.getClusters());
|
set.addAll(area.getClusters());
|
||||||
}
|
}
|
||||||
return Collections.unmodifiableSet(set);
|
return Collections.unmodifiableSet(set);
|
||||||
@ -882,7 +890,7 @@ public class PlotSquared<P> {
|
|||||||
*/
|
*/
|
||||||
@Deprecated public Set<Plot> getPlots(final PlotFilter... filters) {
|
@Deprecated public Set<Plot> getPlots(final PlotFilter... filters) {
|
||||||
final List<PlotArea> areas = new LinkedList<>();
|
final List<PlotArea> areas = new LinkedList<>();
|
||||||
for (final PlotArea plotArea : this.getPlotAreas()) {
|
for (final PlotArea plotArea : this.getPlotAreaManager().getAllPlotAreas()) {
|
||||||
for (final PlotFilter filter : filters) {
|
for (final PlotFilter filter : filters) {
|
||||||
if (filter.allowsArea(plotArea)) {
|
if (filter.allowsArea(plotArea)) {
|
||||||
areas.add(plotArea);
|
areas.add(plotArea);
|
||||||
@ -911,21 +919,20 @@ public class PlotSquared<P> {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPlots(HashMap<String, HashMap<PlotId, Plot>> plots) {
|
public void setPlots(@NotNull final Map<String, HashMap<PlotId, Plot>> plots) {
|
||||||
if (this.plots_tmp == null) {
|
if (this.plots_tmp == null) {
|
||||||
this.plots_tmp = new HashMap<>();
|
this.plots_tmp = new HashMap<>();
|
||||||
}
|
}
|
||||||
for (Entry<String, HashMap<PlotId, Plot>> entry : plots.entrySet()) {
|
for (final Entry<String, HashMap<PlotId, Plot>> entry : plots.entrySet()) {
|
||||||
String world = entry.getKey();
|
final String world = entry.getKey();
|
||||||
PlotArea area = getPlotArea(world, null);
|
final PlotArea plotArea = this.getPlotAreaManager().getPlotArea(world, null);
|
||||||
if (area == null) {
|
if (plotArea == null) {
|
||||||
HashMap<PlotId, Plot> map =
|
Map<PlotId, Plot> map = this.plots_tmp.computeIfAbsent(world, k -> new HashMap<>());
|
||||||
this.plots_tmp.computeIfAbsent(world, k -> new HashMap<>());
|
|
||||||
map.putAll(entry.getValue());
|
map.putAll(entry.getValue());
|
||||||
} else {
|
} else {
|
||||||
for (Plot plot : entry.getValue().values()) {
|
for (Plot plot : entry.getValue().values()) {
|
||||||
plot.setArea(area);
|
plot.setArea(plotArea);
|
||||||
area.addPlot(plot);
|
plotArea.addPlot(plot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -962,7 +969,7 @@ public class PlotSquared<P> {
|
|||||||
* @param player the plot owner
|
* @param player the plot owner
|
||||||
* @return Set of plot
|
* @return Set of plot
|
||||||
*/
|
*/
|
||||||
public Set<Plot> getPlots(String world, PlotPlayer player) {
|
public Set<Plot> getPlots(String world, PlotPlayer<?> player) {
|
||||||
return PlotQuery.newQuery().inWorld(world).ownedBy(player).asSet();
|
return PlotQuery.newQuery().inWorld(world).ownedBy(player).asSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -973,7 +980,7 @@ public class PlotSquared<P> {
|
|||||||
* @param player the plot owner
|
* @param player the plot owner
|
||||||
* @return Set of plot
|
* @return Set of plot
|
||||||
*/
|
*/
|
||||||
public Set<Plot> getPlots(PlotArea area, PlotPlayer player) {
|
public Set<Plot> getPlots(PlotArea area, PlotPlayer<?> player) {
|
||||||
return PlotQuery.newQuery().inArea(area).ownedBy(player).asSet();
|
return PlotQuery.newQuery().inArea(area).ownedBy(player).asSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -999,17 +1006,6 @@ public class PlotSquared<P> {
|
|||||||
return PlotQuery.newQuery().inArea(area).ownedBy(uuid).asSet();
|
return PlotQuery.newQuery().inArea(area).ownedBy(uuid).asSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if a plot world.
|
|
||||||
*
|
|
||||||
* @param world the world
|
|
||||||
* @return if a plot world is registered
|
|
||||||
* @see #getPlotAreaByString(String) to get the PlotArea object
|
|
||||||
*/
|
|
||||||
public boolean hasPlotArea(String world) {
|
|
||||||
return plotAreaManager.getPlotAreas(world, null).length != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Collection<Plot> getPlots(String world) {
|
public Collection<Plot> getPlots(String world) {
|
||||||
return PlotQuery.newQuery().inWorld(world).asCollection();
|
return PlotQuery.newQuery().inWorld(world).asCollection();
|
||||||
}
|
}
|
||||||
@ -1020,7 +1016,7 @@ public class PlotSquared<P> {
|
|||||||
* @param player the player to retrieve the plots for
|
* @param player the player to retrieve the plots for
|
||||||
* @return Set of Plot
|
* @return Set of Plot
|
||||||
*/
|
*/
|
||||||
public Set<Plot> getPlots(PlotPlayer player) {
|
public Set<Plot> getPlots(PlotPlayer<?> player) {
|
||||||
return PlotQuery.newQuery().ownedBy(player).asSet();
|
return PlotQuery.newQuery().ownedBy(player).asSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1032,7 +1028,7 @@ public class PlotSquared<P> {
|
|||||||
return area == null ? null : id == null ? null : area.getPlot(id);
|
return area == null ? null : id == null ? null : area.getPlot(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<Plot> getBasePlots(PlotPlayer player) {
|
public Set<Plot> getBasePlots(PlotPlayer<?> player) {
|
||||||
return getBasePlots(player.getUUID());
|
return getBasePlots(player.getUUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1276,7 +1272,7 @@ public class PlotSquared<P> {
|
|||||||
throw new IllegalArgumentException("Invalid Area identifier: " + areaId
|
throw new IllegalArgumentException("Invalid Area identifier: " + areaId
|
||||||
+ ". Expected form `<name>-<x1;z1>-<x2;z2>`");
|
+ ". Expected form `<name>-<x1;z1>-<x2;z2>`");
|
||||||
}
|
}
|
||||||
PlotArea existing = getPlotArea(world, name);
|
final PlotArea existing = this.getPlotAreaManager().getPlotArea(world, name);
|
||||||
if (existing != null && name.equals(existing.getId())) {
|
if (existing != null && name.equals(existing.getId())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1937,11 +1933,6 @@ public class PlotSquared<P> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlotArea getFirstPlotArea() {
|
|
||||||
PlotArea[] areas = plotAreaManager.getAllPlotAreas();
|
|
||||||
return areas.length > 0 ? areas[0] : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getPlotAreaCount() {
|
public int getPlotAreaCount() {
|
||||||
return this.plotAreaManager.getAllPlotAreas().length;
|
return this.plotAreaManager.getAllPlotAreas().length;
|
||||||
}
|
}
|
||||||
@ -1951,12 +1942,6 @@ public class PlotSquared<P> {
|
|||||||
.mapToInt(PlotArea::getPlotCount).sum();
|
.mapToInt(PlotArea::getPlotCount).sum();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<PlotArea> getPlotAreas() {
|
|
||||||
final Set<PlotArea> set = new HashSet<>();
|
|
||||||
Collections.addAll(set, plotAreaManager.getAllPlotAreas());
|
|
||||||
return Collections.unmodifiableSet(set);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the chunk uses vanilla/non-PlotSquared generation
|
* Check if the chunk uses vanilla/non-PlotSquared generation
|
||||||
*
|
*
|
||||||
@ -1979,81 +1964,6 @@ public class PlotSquared<P> {
|
|||||||
return areas != null && (areas.length > 1 || areas[0].getType() != PlotAreaType.NORMAL);
|
return areas != null && (areas.length > 1 || areas[0].getType() != PlotAreaType.NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets a list of PlotArea objects.
|
|
||||||
*
|
|
||||||
* @param world the world
|
|
||||||
* @return Collection of PlotArea objects
|
|
||||||
*/
|
|
||||||
public Set<PlotArea> getPlotAreas(@NonNull final String world) {
|
|
||||||
final Set<PlotArea> set = new HashSet<>();
|
|
||||||
Collections.addAll(set, plotAreaManager.getPlotAreas(world, null));
|
|
||||||
return set;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the relevant plot area for a specified location.
|
|
||||||
* <ul>
|
|
||||||
* <li>If there is only one plot area globally that will be returned.
|
|
||||||
* <li>If there is only one plot area in the world, it will return that.
|
|
||||||
* <li>If the plot area for a location cannot be unambiguously
|
|
||||||
* resolved, null will be returned.
|
|
||||||
* </ul>
|
|
||||||
* Note: An applicable plot area may not include the location i.e. clusters
|
|
||||||
*
|
|
||||||
* @param location the location
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public PlotArea getApplicablePlotArea(@NonNull final Location location) {
|
|
||||||
return plotAreaManager.getApplicablePlotArea(location);
|
|
||||||
}
|
|
||||||
|
|
||||||
public PlotArea getPlotArea(@NonNull final String world, final String id) {
|
|
||||||
return plotAreaManager.getPlotArea(world, id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the {@code PlotArea} which contains a location.
|
|
||||||
* <ul>
|
|
||||||
* <li>If the plot area does not contain a location, null
|
|
||||||
* will be returned.
|
|
||||||
* </ul>
|
|
||||||
*
|
|
||||||
* @param location the location
|
|
||||||
* @return the {@link PlotArea} in the location, null if non existent
|
|
||||||
*/
|
|
||||||
public PlotArea getPlotAreaAbs(@NonNull final Location location) {
|
|
||||||
return plotAreaManager.getPlotArea(location);
|
|
||||||
}
|
|
||||||
|
|
||||||
public PlotArea getPlotAreaByString(@NonNull final String search) {
|
|
||||||
String[] split = search.split("[;,]");
|
|
||||||
PlotArea[] areas = plotAreaManager.getPlotAreas(split[0], null);
|
|
||||||
if (areas == null) {
|
|
||||||
for (PlotArea area : plotAreaManager.getAllPlotAreas()) {
|
|
||||||
if (area.getWorldName().equalsIgnoreCase(split[0])) {
|
|
||||||
if (area.getId() == null || split.length == 2 && area.getId()
|
|
||||||
.equalsIgnoreCase(split[1])) {
|
|
||||||
return area;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (areas.length == 1) {
|
|
||||||
return areas[0];
|
|
||||||
} else if (split.length == 1) {
|
|
||||||
return null;
|
|
||||||
} else {
|
|
||||||
for (PlotArea area : areas) {
|
|
||||||
if (StringMan.isEqual(split[1], area.getId())) {
|
|
||||||
return area;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets Plots based on alias
|
* Gets Plots based on alias
|
||||||
*
|
*
|
||||||
@ -2066,13 +1976,6 @@ public class PlotSquared<P> {
|
|||||||
return PlotQuery.newQuery().inWorld(worldname).withAlias(alias).asSet();
|
return PlotQuery.newQuery().inWorld(worldname).withAlias(alias).asSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<PlotArea> getPlotAreas(final String world, final CuboidRegion region) {
|
|
||||||
final PlotArea[] areas = plotAreaManager.getPlotAreas(world, region);
|
|
||||||
final Set<PlotArea> set = new HashSet<>();
|
|
||||||
Collections.addAll(set, areas);
|
|
||||||
return Collections.unmodifiableSet(set);
|
|
||||||
}
|
|
||||||
|
|
||||||
public YamlConfiguration getConfig() {
|
public YamlConfiguration getConfig() {
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,7 @@ import java.util.UUID;
|
|||||||
if (world == null) {
|
if (world == null) {
|
||||||
return Collections.emptySet();
|
return Collections.emptySet();
|
||||||
}
|
}
|
||||||
return PlotSquared.get().getPlotAreas(world);
|
return PlotSquared.get().getPlotAreaManager().getPlotAreasSet(world);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -70,6 +70,8 @@ import java.io.File;
|
|||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@ -102,7 +104,7 @@ public class Area extends SubCommand {
|
|||||||
MainUtil.sendMessage(player, Captions.SINGLE_AREA_NEEDS_NAME);
|
MainUtil.sendMessage(player, Captions.SINGLE_AREA_NEEDS_NAME);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final PlotArea existingArea = PlotSquared.get().getPlotArea(player.getLocation().getWorld(), args[1]);
|
final PlotArea existingArea = PlotSquared.get().getPlotAreaManager().getPlotArea(player.getLocation().getWorld(), args[1]);
|
||||||
if (existingArea != null && existingArea.getId().equalsIgnoreCase(args[1])) {
|
if (existingArea != null && existingArea.getId().equalsIgnoreCase(args[1])) {
|
||||||
MainUtil.sendMessage(player, Captions.SINGLE_AREA_NAME_TAKEN);
|
MainUtil.sendMessage(player, Captions.SINGLE_AREA_NAME_TAKEN);
|
||||||
return false;
|
return false;
|
||||||
@ -274,8 +276,8 @@ public class Area extends SubCommand {
|
|||||||
final int offsetX = bx - (area.ROAD_WIDTH == 0 ? 0 : lower);
|
final int offsetX = bx - (area.ROAD_WIDTH == 0 ? 0 : lower);
|
||||||
final int offsetZ = bz - (area.ROAD_WIDTH == 0 ? 0 : lower);
|
final int offsetZ = bz - (area.ROAD_WIDTH == 0 ? 0 : lower);
|
||||||
final CuboidRegion region = RegionUtil.createRegion(bx, tx, bz, tz);
|
final CuboidRegion region = RegionUtil.createRegion(bx, tx, bz, tz);
|
||||||
Set<PlotArea> areas =
|
final Set<PlotArea> areas = PlotSquared.get().getPlotAreaManager()
|
||||||
PlotSquared.get().getPlotAreas(area.getWorldName(), region);
|
.getPlotAreasSet(area.getWorldName(), region);
|
||||||
if (!areas.isEmpty()) {
|
if (!areas.isEmpty()) {
|
||||||
Captions.CLUSTER_INTERSECTION
|
Captions.CLUSTER_INTERSECTION
|
||||||
.send(player, areas.iterator().next().toString());
|
.send(player, areas.iterator().next().toString());
|
||||||
@ -340,12 +342,12 @@ public class Area extends SubCommand {
|
|||||||
builder.worldName(split[0]);
|
builder.worldName(split[0]);
|
||||||
final HybridPlotWorld pa = new HybridPlotWorld(builder.worldName(), id,
|
final HybridPlotWorld pa = new HybridPlotWorld(builder.worldName(), id,
|
||||||
PlotSquared.platform().getDefaultGenerator(), null, null);
|
PlotSquared.platform().getDefaultGenerator(), null, null);
|
||||||
PlotArea other = PlotSquared.get().getPlotArea(pa.getWorldName(), id);
|
PlotArea other = PlotSquared.get().getPlotAreaManager().getPlotArea(pa.getWorldName(), id);
|
||||||
if (other != null && Objects.equals(pa.getId(), other.getId())) {
|
if (other != null && Objects.equals(pa.getId(), other.getId())) {
|
||||||
Captions.SETUP_WORLD_TAKEN.send(player, pa.toString());
|
Captions.SETUP_WORLD_TAKEN.send(player, pa.toString());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Set<PlotArea> areas = PlotSquared.get().getPlotAreas(pa.getWorldName());
|
Set<PlotArea> areas = PlotSquared.get().getPlotAreaManager().getPlotAreasSet(pa.getWorldName());
|
||||||
if (!areas.isEmpty()) {
|
if (!areas.isEmpty()) {
|
||||||
PlotArea area = areas.iterator().next();
|
PlotArea area = areas.iterator().next();
|
||||||
pa.setType(area.getType());
|
pa.setType(area.getType());
|
||||||
@ -490,7 +492,7 @@ public class Area extends SubCommand {
|
|||||||
area = player.getApplicablePlotArea();
|
area = player.getApplicablePlotArea();
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
area = PlotSquared.get().getPlotAreaByString(args[1]);
|
area = PlotSquared.get().getPlotAreaManager().getPlotAreaByString(args[1]);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Captions.COMMAND_SYNTAX.send(player, getCommandString() + " info [area]");
|
Captions.COMMAND_SYNTAX.send(player, getCommandString() + " info [area]");
|
||||||
@ -552,7 +554,7 @@ public class Area extends SubCommand {
|
|||||||
Captions.COMMAND_SYNTAX.send(player, getCommandString() + " list [#]");
|
Captions.COMMAND_SYNTAX.send(player, getCommandString() + " list [#]");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ArrayList<PlotArea> areas = new ArrayList<>(PlotSquared.get().getPlotAreas());
|
final List<PlotArea> areas = new ArrayList<>(Arrays.asList(PlotSquared.get().getPlotAreaManager().getAllPlotAreas()));
|
||||||
paginate(player, areas, 8, page,
|
paginate(player, areas, 8, page,
|
||||||
new RunnableVal3<Integer, PlotArea, PlotMessage>() {
|
new RunnableVal3<Integer, PlotArea, PlotMessage>() {
|
||||||
@Override public void run(Integer i, PlotArea area, PlotMessage message) {
|
@Override public void run(Integer i, PlotArea area, PlotMessage message) {
|
||||||
@ -635,7 +637,7 @@ public class Area extends SubCommand {
|
|||||||
Captions.COMMAND_SYNTAX.send(player, "/plot visit [area]");
|
Captions.COMMAND_SYNTAX.send(player, "/plot visit [area]");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotArea area = PlotSquared.get().getPlotAreaByString(args[1]);
|
PlotArea area = PlotSquared.get().getPlotAreaManager().getPlotAreaByString(args[1]);
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
Captions.NOT_VALID_PLOT_WORLD.send(player, args[1]);
|
Captions.NOT_VALID_PLOT_WORLD.send(player, args[1]);
|
||||||
return false;
|
return false;
|
||||||
|
@ -59,7 +59,7 @@ public class Condense extends SubCommand {
|
|||||||
MainUtil.sendMessage(player, getUsage());
|
MainUtil.sendMessage(player, getUsage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]);
|
PlotArea area = PlotSquared.get().getPlotAreaManager().getPlotAreaByString(args[0]);
|
||||||
if (area == null || !WorldUtil.IMP.isWorld(area.getWorldName())) {
|
if (area == null || !WorldUtil.IMP.isWorld(area.getWorldName())) {
|
||||||
MainUtil.sendMessage(player, "INVALID AREA");
|
MainUtil.sendMessage(player, "INVALID AREA");
|
||||||
return false;
|
return false;
|
||||||
|
@ -80,7 +80,7 @@ public class DatabaseCommand extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
List<Plot> plots;
|
List<Plot> plots;
|
||||||
PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]);
|
PlotArea area = PlotSquared.get().getPlotAreaManager().getPlotAreaByString(args[0]);
|
||||||
if (area != null) {
|
if (area != null) {
|
||||||
plots = PlotSquared.get().sortPlotsByTemp(area.getPlots());
|
plots = PlotSquared.get().sortPlotsByTemp(area.getPlots());
|
||||||
args = Arrays.copyOfRange(args, 1, args.length);
|
args = Arrays.copyOfRange(args, 1, args.length);
|
||||||
@ -116,7 +116,7 @@ public class DatabaseCommand extends SubCommand {
|
|||||||
plots = new ArrayList<>();
|
plots = new ArrayList<>();
|
||||||
for (Entry<String, HashMap<PlotId, Plot>> entry : map.entrySet()) {
|
for (Entry<String, HashMap<PlotId, Plot>> entry : map.entrySet()) {
|
||||||
String areaName = entry.getKey();
|
String areaName = entry.getKey();
|
||||||
PlotArea pa = PlotSquared.get().getPlotAreaByString(areaName);
|
PlotArea pa = PlotSquared.get().getPlotAreaManager().getPlotAreaByString(areaName);
|
||||||
if (pa != null) {
|
if (pa != null) {
|
||||||
for (Entry<PlotId, Plot> entry2 : entry.getValue().entrySet()) {
|
for (Entry<PlotId, Plot> entry2 : entry.getValue().entrySet()) {
|
||||||
Plot plot = entry2.getValue();
|
Plot plot = entry2.getValue();
|
||||||
|
@ -118,7 +118,7 @@ public class Debug extends SubCommand {
|
|||||||
information.append(header);
|
information.append(header);
|
||||||
information.append(getSection(section, "PlotArea"));
|
information.append(getSection(section, "PlotArea"));
|
||||||
information.append(
|
information.append(
|
||||||
getLine(line, "Plot Worlds", StringMan.join(PlotSquared.get().getPlotAreas(), ", ")));
|
getLine(line, "Plot Worlds", StringMan.join(PlotSquared.get().getPlotAreaManager().getAllPlotAreas(), ", ")));
|
||||||
information.append(getLine(line, "Owned Plots", PlotSquared.get().getPlots().size()));
|
information.append(getLine(line, "Owned Plots", PlotSquared.get().getPlots().size()));
|
||||||
information.append(getSection(section, "Messages"));
|
information.append(getSection(section, "Messages"));
|
||||||
information.append(getLine(line, "Total Messages", Captions.values().length));
|
information.append(getLine(line, "Total Messages", Captions.values().length));
|
||||||
|
@ -259,7 +259,7 @@ public class DebugExec extends SubCommand {
|
|||||||
"&cInvalid syntax: /plot debugexec start-rgar <world>");
|
"&cInvalid syntax: /plot debugexec start-rgar <world>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotArea area = PlotSquared.get().getPlotAreaByString(args[1]);
|
PlotArea area = PlotSquared.get().getPlotAreaManager().getPlotAreaByString(args[1]);
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_WORLD, args[1]);
|
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_WORLD, args[1]);
|
||||||
return false;
|
return false;
|
||||||
|
@ -52,7 +52,7 @@ public class Download extends SubCommand {
|
|||||||
|
|
||||||
@Override public boolean onCommand(final PlotPlayer<?> player, String[] args) {
|
@Override public boolean onCommand(final PlotPlayer<?> player, String[] args) {
|
||||||
String world = player.getLocation().getWorld();
|
String world = player.getLocation().getWorld();
|
||||||
if (!PlotSquared.get().hasPlotArea(world)) {
|
if (!PlotSquared.get().getPlotAreaManager().hasPlotArea(world)) {
|
||||||
return !sendMessage(player, Captions.NOT_IN_PLOT_WORLD);
|
return !sendMessage(player, Captions.NOT_IN_PLOT_WORLD);
|
||||||
}
|
}
|
||||||
final Plot plot = player.getCurrentPlot();
|
final Plot plot = player.getCurrentPlot();
|
||||||
|
@ -297,7 +297,7 @@ public class ListCmd extends SubCommand {
|
|||||||
plotConsumer.accept(PlotQuery.newQuery().plotsBySearch(term));
|
plotConsumer.accept(PlotQuery.newQuery().plotsBySearch(term));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (PlotSquared.get().hasPlotArea(args[0])) {
|
if (PlotSquared.get().getPlotAreaManager().hasPlotArea(args[0])) {
|
||||||
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_WORLD)) {
|
if (!Permissions.hasPermission(player, Captions.PERMISSION_LIST_WORLD)) {
|
||||||
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
MainUtil.sendMessage(player, Captions.NO_PERMISSION,
|
||||||
Captions.PERMISSION_LIST_WORLD);
|
Captions.PERMISSION_LIST_WORLD);
|
||||||
|
@ -54,7 +54,7 @@ public class Load extends SubCommand {
|
|||||||
|
|
||||||
@Override public boolean onCommand(final PlotPlayer<?> player, String[] args) {
|
@Override public boolean onCommand(final PlotPlayer<?> player, String[] args) {
|
||||||
String world = player.getLocation().getWorld();
|
String world = player.getLocation().getWorld();
|
||||||
if (!PlotSquared.get().hasPlotArea(world)) {
|
if (!PlotSquared.get().getPlotAreaManager().hasPlotArea(world)) {
|
||||||
return !sendMessage(player, Captions.NOT_IN_PLOT_WORLD);
|
return !sendMessage(player, Captions.NOT_IN_PLOT_WORLD);
|
||||||
}
|
}
|
||||||
final Plot plot = player.getCurrentPlot();
|
final Plot plot = player.getCurrentPlot();
|
||||||
|
@ -70,7 +70,7 @@ public class Move extends SubCommand {
|
|||||||
Captions.COMMAND_SYNTAX.send(player, getUsage());
|
Captions.COMMAND_SYNTAX.send(player, getUsage());
|
||||||
return CompletableFuture.completedFuture(false);
|
return CompletableFuture.completedFuture(false);
|
||||||
}
|
}
|
||||||
PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]);
|
PlotArea area = PlotSquared.get().getPlotAreaManager().getPlotAreaByString(args[0]);
|
||||||
Plot plot2;
|
Plot plot2;
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
plot2 = MainUtil.getPlotFromString(player, args[0], true);
|
plot2 = MainUtil.getPlotFromString(player, args[0], true);
|
||||||
|
@ -78,7 +78,7 @@ public class Purge extends SubCommand {
|
|||||||
break;
|
break;
|
||||||
case "area":
|
case "area":
|
||||||
case "a":
|
case "a":
|
||||||
area = PlotSquared.get().getPlotAreaByString(split[1]);
|
area = PlotSquared.get().getPlotAreaManager().getPlotAreaByString(split[1]);
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
Captions.NOT_VALID_PLOT_WORLD.send(player, split[1]);
|
Captions.NOT_VALID_PLOT_WORLD.send(player, split[1]);
|
||||||
return false;
|
return false;
|
||||||
|
@ -59,7 +59,7 @@ public class RegenAllRoads extends SubCommand {
|
|||||||
"/plot regenallroads <world> [height]");
|
"/plot regenallroads <world> [height]");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]);
|
PlotArea area = PlotSquared.get().getPlotAreaManager().getPlotAreaByString(args[0]);
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
Captions.NOT_VALID_PLOT_WORLD.send(player, args[0]);
|
Captions.NOT_VALID_PLOT_WORLD.send(player, args[0]);
|
||||||
return false;
|
return false;
|
||||||
|
@ -51,7 +51,7 @@ public class Save extends SubCommand {
|
|||||||
|
|
||||||
@Override public boolean onCommand(final PlotPlayer<?> player, String[] args) {
|
@Override public boolean onCommand(final PlotPlayer<?> player, String[] args) {
|
||||||
String world = player.getLocation().getWorld();
|
String world = player.getLocation().getWorld();
|
||||||
if (!PlotSquared.get().hasPlotArea(world)) {
|
if (!PlotSquared.get().getPlotAreaManager().hasPlotArea(world)) {
|
||||||
return !sendMessage(player, Captions.NOT_IN_PLOT_WORLD);
|
return !sendMessage(player, Captions.NOT_IN_PLOT_WORLD);
|
||||||
}
|
}
|
||||||
final Plot plot = player.getCurrentPlot();
|
final Plot plot = player.getCurrentPlot();
|
||||||
|
@ -150,7 +150,7 @@ public class SchematicCmd extends SubCommand {
|
|||||||
MainUtil.sendMessage(player, Captions.SCHEMATIC_EXPORTALL_WORLD_ARGS);
|
MainUtil.sendMessage(player, Captions.SCHEMATIC_EXPORTALL_WORLD_ARGS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotArea area = PlotSquared.get().getPlotAreaByString(args[1]);
|
PlotArea area = PlotSquared.get().getPlotAreaManager().getPlotAreaByString(args[1]);
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
Captions.NOT_VALID_PLOT_WORLD.send(player, args[1]);
|
Captions.NOT_VALID_PLOT_WORLD.send(player, args[1]);
|
||||||
return false;
|
return false;
|
||||||
|
@ -159,7 +159,7 @@ public class Template extends SubCommand {
|
|||||||
"/plot template import <world> <template>");
|
"/plot template import <world> <template>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (PlotSquared.get().hasPlotArea(world)) {
|
if (PlotSquared.get().getPlotAreaManager().hasPlotArea(world)) {
|
||||||
MainUtil.sendMessage(player, Captions.SETUP_WORLD_TAKEN, world);
|
MainUtil.sendMessage(player, Captions.SETUP_WORLD_TAKEN, world);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -203,7 +203,7 @@ public class Template extends SubCommand {
|
|||||||
"/plot template export <world>");
|
"/plot template export <world>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final PlotArea area = PlotSquared.get().getPlotAreaByString(world);
|
final PlotArea area = PlotSquared.get().getPlotAreaManager().getPlotAreaByString(world);
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_WORLD);
|
MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_WORLD);
|
||||||
return false;
|
return false;
|
||||||
|
@ -165,7 +165,7 @@ public class Trim extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final String world = args[0];
|
final String world = args[0];
|
||||||
if (!WorldUtil.IMP.isWorld(world) || !PlotSquared.get().hasPlotArea(world)) {
|
if (!WorldUtil.IMP.isWorld(world) || !PlotSquared.get().getPlotAreaManager().hasPlotArea(world)) {
|
||||||
MainUtil.sendMessage(player, Captions.NOT_VALID_WORLD);
|
MainUtil.sendMessage(player, Captions.NOT_VALID_WORLD);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -165,7 +165,7 @@ public class Visit extends Command {
|
|||||||
// /p v <name> [page]
|
// /p v <name> [page]
|
||||||
case 2:
|
case 2:
|
||||||
if (page != Integer.MIN_VALUE || !MathMan.isInteger(args[1])) {
|
if (page != Integer.MIN_VALUE || !MathMan.isInteger(args[1])) {
|
||||||
sortByArea = PlotSquared.get().getPlotAreaByString(args[1]);
|
sortByArea = PlotSquared.get().getPlotAreaManager().getPlotAreaByString(args[1]);
|
||||||
if (sortByArea == null) {
|
if (sortByArea == null) {
|
||||||
Captions.NOT_VALID_NUMBER.send(player, "(1, ∞)");
|
Captions.NOT_VALID_NUMBER.send(player, "(1, ∞)");
|
||||||
Captions.COMMAND_SYNTAX.send(player, getUsage());
|
Captions.COMMAND_SYNTAX.send(player, getUsage());
|
||||||
@ -305,7 +305,7 @@ public class Visit extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void completeAreas(final List<Command> commands, final String arg) {
|
private void completeAreas(final List<Command> commands, final String arg) {
|
||||||
for (final PlotArea area : PlotSquared.get().getPlotAreas()) {
|
for (final PlotArea area : PlotSquared.get().getPlotAreaManager().getAllPlotAreas()) {
|
||||||
final String areaName = area.getWorldName() + ";" + area.getId();
|
final String areaName = area.getWorldName() + ";" + area.getId();
|
||||||
if (!areaName.toLowerCase().startsWith(arg.toLowerCase())) {
|
if (!areaName.toLowerCase().startsWith(arg.toLowerCase())) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -68,7 +68,7 @@ public class AugmentedUtils {
|
|||||||
// entire chunk
|
// entire chunk
|
||||||
CuboidRegion region = RegionUtil.createRegion(blockX, blockX + 15, blockZ, blockZ + 15);
|
CuboidRegion region = RegionUtil.createRegion(blockX, blockX + 15, blockZ, blockZ + 15);
|
||||||
// Query for plot areas in the chunk
|
// Query for plot areas in the chunk
|
||||||
Set<PlotArea> areas = PlotSquared.get().getPlotAreas(world, region);
|
final Set<PlotArea> areas = PlotSquared.get().getPlotAreaManager().getPlotAreasSet(world, region);
|
||||||
if (areas.isEmpty()) {
|
if (areas.isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ public abstract class HybridUtils {
|
|||||||
final int width = tx - bx + 1;
|
final int width = tx - bx + 1;
|
||||||
final int length = tz - bz + 1;
|
final int length = tz - bz + 1;
|
||||||
|
|
||||||
PlotArea area = PlotSquared.get().getPlotArea(world, null);
|
PlotArea area = PlotSquared.get().getPlotAreaManager().getPlotArea(world, null);
|
||||||
|
|
||||||
if (!(area instanceof HybridPlotWorld)) {
|
if (!(area instanceof HybridPlotWorld)) {
|
||||||
return;
|
return;
|
||||||
|
@ -83,19 +83,19 @@ public class WESubscriber {
|
|||||||
if (Permissions.hasPermission(plotPlayer, "plots.worldedit.bypass")) {
|
if (Permissions.hasPermission(plotPlayer, "plots.worldedit.bypass")) {
|
||||||
MainUtil.sendMessage(plotPlayer, Captions.WORLDEDIT_BYPASS);
|
MainUtil.sendMessage(plotPlayer, Captions.WORLDEDIT_BYPASS);
|
||||||
}
|
}
|
||||||
if (PlotSquared.get().hasPlotArea(world)) {
|
if (PlotSquared.get().getPlotAreaManager().hasPlotArea(world)) {
|
||||||
event.setExtent(new NullExtent());
|
event.setExtent(new NullExtent());
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Settings.Enabled_Components.CHUNK_PROCESSOR) {
|
if (Settings.Enabled_Components.CHUNK_PROCESSOR) {
|
||||||
if (PlotSquared.get().hasPlotArea(world)) {
|
if (PlotSquared.get().getPlotAreaManager().hasPlotArea(world)) {
|
||||||
event.setExtent(
|
event.setExtent(
|
||||||
new ProcessedWEExtent(world, mask, event.getMaxBlocks(), event.getExtent(),
|
new ProcessedWEExtent(world, mask, event.getMaxBlocks(), event.getExtent(),
|
||||||
event.getExtent()));
|
event.getExtent()));
|
||||||
}
|
}
|
||||||
} else if (PlotSquared.get().hasPlotArea(world)) {
|
} else if (PlotSquared.get().getPlotAreaManager().hasPlotArea(world)) {
|
||||||
event.setExtent(new WEExtent(mask, event.getExtent()));
|
event.setExtent(new WEExtent(mask, event.getExtent()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@ import com.sk89q.worldedit.math.BlockVector2;
|
|||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.khelekore.prtree.MBR;
|
import org.khelekore.prtree.MBR;
|
||||||
import org.khelekore.prtree.SimpleMBR;
|
import org.khelekore.prtree.SimpleMBR;
|
||||||
|
|
||||||
@ -103,8 +104,8 @@ public class Location implements Cloneable, Comparable<Location> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlotArea getPlotArea() {
|
@Nullable public PlotArea getPlotArea() {
|
||||||
return PlotSquared.get().getPlotAreaAbs(this);
|
return PlotSquared.get().getPlotAreaManager().getPlotArea(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Plot getOwnedPlot() {
|
public Plot getOwnedPlot() {
|
||||||
|
@ -46,7 +46,13 @@ public class ConsolePlayer extends PlotPlayer<Actor> {
|
|||||||
private static ConsolePlayer instance;
|
private static ConsolePlayer instance;
|
||||||
|
|
||||||
private ConsolePlayer() {
|
private ConsolePlayer() {
|
||||||
PlotArea area = PlotSquared.get().getFirstPlotArea();
|
final PlotArea[] areas = PlotSquared.get().getPlotAreaManager().getAllPlotAreas();
|
||||||
|
final PlotArea area;
|
||||||
|
if (areas.length > 0) {
|
||||||
|
area = areas[0];
|
||||||
|
} else {
|
||||||
|
area = null;
|
||||||
|
}
|
||||||
Location location;
|
Location location;
|
||||||
if (area != null) {
|
if (area != null) {
|
||||||
CuboidRegion region = area.getRegion();
|
CuboidRegion region = area.getRegion();
|
||||||
|
@ -54,6 +54,7 @@ import com.sk89q.worldedit.world.gamemode.GameMode;
|
|||||||
import com.sk89q.worldedit.world.item.ItemType;
|
import com.sk89q.worldedit.world.item.ItemType;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -307,7 +308,7 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer
|
|||||||
public int getPlotCount(String world) {
|
public int getPlotCount(String world) {
|
||||||
UUID uuid = getUUID();
|
UUID uuid = getUUID();
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (PlotArea area : PlotSquared.get().getPlotAreas(world)) {
|
for (PlotArea area : PlotSquared.get().getPlotAreaManager().getPlotAreasSet(world)) {
|
||||||
if (!Settings.Done.COUNTS_TOWARDS_LIMIT) {
|
if (!Settings.Done.COUNTS_TOWARDS_LIMIT) {
|
||||||
count +=
|
count +=
|
||||||
area.getPlotsAbs(uuid).stream().filter(plot -> !DoneFlag.isDone(plot)).count();
|
area.getPlotsAbs(uuid).stream().filter(plot -> !DoneFlag.isDone(plot)).count();
|
||||||
@ -321,7 +322,7 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer
|
|||||||
public int getClusterCount(String world) {
|
public int getClusterCount(String world) {
|
||||||
UUID uuid = getUUID();
|
UUID uuid = getUUID();
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (PlotArea area : PlotSquared.get().getPlotAreas(world)) {
|
for (PlotArea area : PlotSquared.get().getPlotAreaManager().getPlotAreasSet(world)) {
|
||||||
for (PlotCluster cluster : area.getClusters()) {
|
for (PlotCluster cluster : area.getClusters()) {
|
||||||
if (cluster.isOwner(getUUID())) {
|
if (cluster.isOwner(getUUID())) {
|
||||||
count++;
|
count++;
|
||||||
@ -345,14 +346,14 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer
|
|||||||
/**
|
/**
|
||||||
* Return the PlotArea this player is currently in, or null.
|
* Return the PlotArea this player is currently in, or null.
|
||||||
*
|
*
|
||||||
* @return
|
* @return Plot area the player is currently in, or {@code null}
|
||||||
*/
|
*/
|
||||||
public PlotArea getPlotAreaAbs() {
|
@Nullable public PlotArea getPlotAreaAbs() {
|
||||||
return PlotSquared.get().getPlotAreaAbs(getLocation());
|
return PlotSquared.get().getPlotAreaManager().getPlotArea(getLocation());
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlotArea getApplicablePlotArea() {
|
public PlotArea getApplicablePlotArea() {
|
||||||
return PlotSquared.get().getApplicablePlotArea(getLocation());
|
return PlotSquared.get().getPlotAreaManager().getApplicablePlotArea(getLocation());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public RequiredType getSuperCaller() {
|
@Override public RequiredType getSuperCaller() {
|
||||||
|
@ -278,13 +278,13 @@ public class Plot {
|
|||||||
return defaultArea.getPlotAbs(id);
|
return defaultArea.getPlotAbs(id);
|
||||||
}
|
}
|
||||||
} else if (split.length == 3) {
|
} else if (split.length == 3) {
|
||||||
PlotArea pa = PlotSquared.get().getPlotArea(split[0], null);
|
PlotArea pa = PlotSquared.get().getPlotAreaManager().getPlotArea(split[0], null);
|
||||||
if (pa != null) {
|
if (pa != null) {
|
||||||
PlotId id = PlotId.fromString(split[1] + ';' + split[2]);
|
PlotId id = PlotId.fromString(split[1] + ';' + split[2]);
|
||||||
return pa.getPlotAbs(id);
|
return pa.getPlotAbs(id);
|
||||||
}
|
}
|
||||||
} else if (split.length == 4) {
|
} else if (split.length == 4) {
|
||||||
PlotArea pa = PlotSquared.get().getPlotArea(split[0], split[1]);
|
PlotArea pa = PlotSquared.get().getPlotAreaManager().getPlotArea(split[0], split[1]);
|
||||||
if (pa != null) {
|
if (pa != null) {
|
||||||
PlotId id = PlotId.fromString(split[1] + ';' + split[2]);
|
PlotId id = PlotId.fromString(split[1] + ';' + split[2]);
|
||||||
return pa.getPlotAbs(id);
|
return pa.getPlotAbs(id);
|
||||||
|
@ -46,7 +46,7 @@ public class DefaultPlotAreaManager implements PlotAreaManager {
|
|||||||
final PlotArea[] noPlotAreas = new PlotArea[0];
|
final PlotArea[] noPlotAreas = new PlotArea[0];
|
||||||
private final Map<String, PlotWorld> plotWorlds = new HashMap<>();
|
private final Map<String, PlotWorld> plotWorlds = new HashMap<>();
|
||||||
|
|
||||||
@Override public PlotArea[] getAllPlotAreas() {
|
@Override @NotNull public PlotArea[] getAllPlotAreas() {
|
||||||
final Set<PlotArea> area = new HashSet<>();
|
final Set<PlotArea> area = new HashSet<>();
|
||||||
for (final PlotWorld world : plotWorlds.values()) {
|
for (final PlotWorld world : plotWorlds.values()) {
|
||||||
area.addAll(world.getAreas());
|
area.addAll(world.getAreas());
|
||||||
@ -54,7 +54,7 @@ public class DefaultPlotAreaManager implements PlotAreaManager {
|
|||||||
return area.toArray(new PlotArea[0]);
|
return area.toArray(new PlotArea[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override @Nullable public PlotArea getApplicablePlotArea(final Location location) {
|
@Override @Nullable public PlotArea getApplicablePlotArea(@Nullable final Location location) {
|
||||||
if (location == null) {
|
if (location == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -65,7 +65,7 @@ public class DefaultPlotAreaManager implements PlotAreaManager {
|
|||||||
return world.getArea(location);
|
return world.getArea(location);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void addPlotArea(final PlotArea plotArea) {
|
@Override public void addPlotArea(@NotNull final PlotArea plotArea) {
|
||||||
PlotWorld world = this.plotWorlds.get(plotArea.getWorldName());
|
PlotWorld world = this.plotWorlds.get(plotArea.getWorldName());
|
||||||
if (world != null) {
|
if (world != null) {
|
||||||
if (world instanceof StandardPlotWorld && world.getAreas().isEmpty()) {
|
if (world instanceof StandardPlotWorld && world.getAreas().isEmpty()) {
|
||||||
@ -84,7 +84,7 @@ public class DefaultPlotAreaManager implements PlotAreaManager {
|
|||||||
this.plotWorlds.put(plotArea.getWorldName(), world);
|
this.plotWorlds.put(plotArea.getWorldName(), world);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void removePlotArea(final PlotArea area) {
|
@Override public void removePlotArea(@NotNull final PlotArea area) {
|
||||||
final PlotWorld world = this.plotWorlds.get(area.getWorldName());
|
final PlotWorld world = this.plotWorlds.get(area.getWorldName());
|
||||||
if (world == null) {
|
if (world == null) {
|
||||||
return;
|
return;
|
||||||
@ -99,7 +99,7 @@ public class DefaultPlotAreaManager implements PlotAreaManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public PlotArea getPlotArea(final String world, final String id) {
|
@Override public PlotArea getPlotArea(@NotNull final String world, @Nullable final String id) {
|
||||||
final PlotWorld plotWorld = this.plotWorlds.get(world);
|
final PlotWorld plotWorld = this.plotWorlds.get(world);
|
||||||
if (plotWorld == null) {
|
if (plotWorld == null) {
|
||||||
return null;
|
return null;
|
||||||
@ -119,11 +119,11 @@ public class DefaultPlotAreaManager implements PlotAreaManager {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public PlotArea getPlotArea(@NotNull final Location location) {
|
@Override @Nullable public PlotArea getPlotArea(@NotNull final Location location) {
|
||||||
return this.getApplicablePlotArea(location);
|
return this.getApplicablePlotArea(location);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public PlotArea[] getPlotAreas(final String world, final CuboidRegion region) {
|
@Override @NotNull public PlotArea[] getPlotAreas(@NotNull final String world, @Nullable final CuboidRegion region) {
|
||||||
final PlotWorld plotWorld = this.plotWorlds.get(world);
|
final PlotWorld plotWorld = this.plotWorlds.get(world);
|
||||||
if (plotWorld == null) {
|
if (plotWorld == null) {
|
||||||
return noPlotAreas;
|
return noPlotAreas;
|
||||||
@ -134,7 +134,7 @@ public class DefaultPlotAreaManager implements PlotAreaManager {
|
|||||||
return plotWorld.getAreasInRegion(region).toArray(new PlotArea[0]);
|
return plotWorld.getAreasInRegion(region).toArray(new PlotArea[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void addWorld(final String worldName) {
|
@Override public void addWorld(@NotNull final String worldName) {
|
||||||
PlotWorld world = this.plotWorlds.get(worldName);
|
PlotWorld world = this.plotWorlds.get(worldName);
|
||||||
if (world != null) {
|
if (world != null) {
|
||||||
return;
|
return;
|
||||||
@ -145,11 +145,11 @@ public class DefaultPlotAreaManager implements PlotAreaManager {
|
|||||||
this.plotWorlds.put(worldName, world);
|
this.plotWorlds.put(worldName, world);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void removeWorld(final String worldName) {
|
@Override public void removeWorld(@NotNull final String worldName) {
|
||||||
this.plotWorlds.remove(worldName);
|
this.plotWorlds.remove(worldName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public String[] getAllWorlds() {
|
@Override @NotNull public String[] getAllWorlds() {
|
||||||
return this.plotWorlds.keySet().toArray(new String[0]);
|
return this.plotWorlds.keySet().toArray(new String[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,10 +27,15 @@ package com.plotsquared.core.plot.world;
|
|||||||
|
|
||||||
import com.plotsquared.core.location.Location;
|
import com.plotsquared.core.location.Location;
|
||||||
import com.plotsquared.core.plot.PlotArea;
|
import com.plotsquared.core.plot.PlotArea;
|
||||||
|
import com.plotsquared.core.util.StringMan;
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public interface PlotAreaManager {
|
public interface PlotAreaManager {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -45,7 +50,7 @@ public interface PlotAreaManager {
|
|||||||
* @param location The location
|
* @param location The location
|
||||||
* @return An applicable area, or null
|
* @return An applicable area, or null
|
||||||
*/
|
*/
|
||||||
@Nullable PlotArea getApplicablePlotArea(Location location);
|
@Nullable PlotArea getApplicablePlotArea(@Nullable Location location);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the plot area, if there is any, for the given
|
* Get the plot area, if there is any, for the given
|
||||||
@ -53,24 +58,146 @@ public interface PlotAreaManager {
|
|||||||
* does not belong to a plot area.
|
* does not belong to a plot area.
|
||||||
*
|
*
|
||||||
* @param location The location
|
* @param location The location
|
||||||
* @return The area, if found
|
* @return The area if found, else {@code null}
|
||||||
*/
|
*/
|
||||||
PlotArea getPlotArea(@NotNull Location location);
|
@Nullable PlotArea getPlotArea(@NotNull Location location);
|
||||||
|
|
||||||
PlotArea getPlotArea(String world, String id);
|
/**
|
||||||
|
* Get the plot area in a world with an (optional ID).
|
||||||
|
* If the world has more than one plot area, and ID must be
|
||||||
|
* supplied. If the world only has one plot area, the ID will
|
||||||
|
* be ignored
|
||||||
|
*
|
||||||
|
* @param world World name
|
||||||
|
* @param id Area ID
|
||||||
|
* @return Plot area matching the criteria
|
||||||
|
*/
|
||||||
|
@Nullable PlotArea getPlotArea(@NotNull String world, @Nullable String id);
|
||||||
|
|
||||||
PlotArea[] getPlotAreas(String world, CuboidRegion region);
|
/**
|
||||||
|
* Get all plot areas in a world, with an optional region constraint
|
||||||
|
*
|
||||||
|
* @param world World name
|
||||||
|
* @param region Optional region
|
||||||
|
* @return All plots in the region
|
||||||
|
*/
|
||||||
|
@NotNull PlotArea[] getPlotAreas(@NotNull String world, @Nullable CuboidRegion region);
|
||||||
|
|
||||||
PlotArea[] getAllPlotAreas();
|
/**
|
||||||
|
* Get all plot areas recognized by PlotSquared
|
||||||
|
*
|
||||||
|
* @return All plot areas
|
||||||
|
*/
|
||||||
|
@NotNull PlotArea[] getAllPlotAreas();
|
||||||
|
|
||||||
String[] getAllWorlds();
|
/**
|
||||||
|
* Get all worlds recognized by PlotSquared
|
||||||
|
*
|
||||||
|
* @return All world names
|
||||||
|
*/
|
||||||
|
@NotNull String[] getAllWorlds();
|
||||||
|
|
||||||
void addPlotArea(PlotArea area);
|
/**
|
||||||
|
* Add a plot area
|
||||||
|
*
|
||||||
|
* @param area Area
|
||||||
|
*/
|
||||||
|
void addPlotArea(@NotNull PlotArea area);
|
||||||
|
|
||||||
void removePlotArea(PlotArea area);
|
/**
|
||||||
|
* Remove a plot area
|
||||||
|
*
|
||||||
|
* @param area Area
|
||||||
|
*/
|
||||||
|
void removePlotArea(@NotNull PlotArea area);
|
||||||
|
|
||||||
void addWorld(String worldName);
|
/**
|
||||||
|
* Add a world
|
||||||
|
*
|
||||||
|
* @param worldName Name of the world to add
|
||||||
|
*/
|
||||||
|
void addWorld(@NotNull String worldName);
|
||||||
|
|
||||||
void removeWorld(String worldName);
|
/**
|
||||||
|
* Remove a world
|
||||||
|
*
|
||||||
|
* @param worldName Name of the world to remove
|
||||||
|
*/
|
||||||
|
void removeWorld(@NotNull String worldName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method that delegates to {@link #getPlotAreas(String, CuboidRegion)} but returns an
|
||||||
|
* immutable set, instead of an array
|
||||||
|
*
|
||||||
|
* @param world World name
|
||||||
|
* @param region Optional region
|
||||||
|
* @return All areas in the world (and region)
|
||||||
|
*/
|
||||||
|
@NotNull default Set<PlotArea> getPlotAreasSet(@NotNull final String world,
|
||||||
|
@Nullable final CuboidRegion region) {
|
||||||
|
final PlotArea[] areas = this.getPlotAreas(world, region);
|
||||||
|
final Set<PlotArea> set = new HashSet<>();
|
||||||
|
Collections.addAll(set, areas);
|
||||||
|
return Collections.unmodifiableSet(set);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method identical to {@link #getPlotAreasSet(String, CuboidRegion)} but that
|
||||||
|
* does not take in a region, and returns a modifiable set
|
||||||
|
*
|
||||||
|
* @param world World name
|
||||||
|
* @return Modifiable set containing all plot areas in the specified world
|
||||||
|
*/
|
||||||
|
@NotNull default Set<PlotArea> getPlotAreasSet(@NotNull final String world) {
|
||||||
|
final Set<PlotArea> set = new HashSet<>();
|
||||||
|
Collections.addAll(set, this.getPlotAreas(world, null));
|
||||||
|
return set;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a plot area from a search string in the format "world;id" or "world,id"
|
||||||
|
* where the ID portion is optional
|
||||||
|
*
|
||||||
|
* @param search Search string
|
||||||
|
* @return An area that matches the search string, or {@code null}
|
||||||
|
*/
|
||||||
|
@Nullable default PlotArea getPlotAreaByString(@NotNull final String search) {
|
||||||
|
String[] split = search.split("[;,]");
|
||||||
|
PlotArea[] areas = this.getPlotAreas(split[0], null);
|
||||||
|
if (areas == null) {
|
||||||
|
for (PlotArea area : this.getAllPlotAreas()) {
|
||||||
|
if (area.getWorldName().equalsIgnoreCase(split[0])) {
|
||||||
|
if (area.getId() == null || split.length == 2 && area.getId()
|
||||||
|
.equalsIgnoreCase(split[1])) {
|
||||||
|
return area;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (areas.length == 1) {
|
||||||
|
return areas[0];
|
||||||
|
} else if (split.length == 1) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
for (PlotArea area : areas) {
|
||||||
|
if (StringMan.isEqual(split[1], area.getId())) {
|
||||||
|
return area;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a plot world.
|
||||||
|
*
|
||||||
|
* @param world the world
|
||||||
|
* @return if a plot world is registered
|
||||||
|
* @see #getPlotAreaByString(String) to get the PlotArea object
|
||||||
|
*/
|
||||||
|
default boolean hasPlotArea(@NotNull final String world) {
|
||||||
|
return this.getPlotAreas(world, null).length != 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -32,8 +32,10 @@ import com.plotsquared.core.plot.PlotArea;
|
|||||||
import com.plotsquared.core.util.SetupUtils;
|
import com.plotsquared.core.util.SetupUtils;
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
public class SinglePlotAreaManager extends DefaultPlotAreaManager {
|
public class SinglePlotAreaManager extends DefaultPlotAreaManager {
|
||||||
|
|
||||||
private final SinglePlotArea[] array;
|
private final SinglePlotArea[] array;
|
||||||
private SinglePlotArea area;
|
private SinglePlotArea area;
|
||||||
private PlotArea[] all;
|
private PlotArea[] all;
|
||||||
@ -50,13 +52,13 @@ public class SinglePlotAreaManager extends DefaultPlotAreaManager {
|
|||||||
return area;
|
return area;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setArea(SinglePlotArea area) {
|
public void setArea(@NotNull final SinglePlotArea area) {
|
||||||
this.area = area;
|
this.area = area;
|
||||||
array[0] = area;
|
array[0] = area;
|
||||||
all = ArrayUtil.concatAll(super.getAllPlotAreas(), array);
|
all = ArrayUtil.concatAll(super.getAllPlotAreas(), array);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isWorld(String id) {
|
public boolean isWorld(@NotNull final String id) {
|
||||||
char[] chars = id.toCharArray();
|
char[] chars = id.toCharArray();
|
||||||
if (chars.length == 1 && chars[0] == '*') {
|
if (chars.length == 1 && chars[0] == '*') {
|
||||||
return true;
|
return true;
|
||||||
@ -88,20 +90,22 @@ public class SinglePlotAreaManager extends DefaultPlotAreaManager {
|
|||||||
if ((c <= '/') || (c >= ':')) {
|
if ((c <= '/') || (c >= ':')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return mode == 3;
|
return mode == 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public PlotArea getApplicablePlotArea(Location location) {
|
@Override @Nullable public PlotArea getApplicablePlotArea(@Nullable final Location location) {
|
||||||
|
if (location == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
String world = location.getWorld();
|
String world = location.getWorld();
|
||||||
return isWorld(world) || world.equals("*") || super.getAllPlotAreas().length == 0 ?
|
return isWorld(world) || world.equals("*") || super.getAllPlotAreas().length == 0 ?
|
||||||
area :
|
area :
|
||||||
super.getApplicablePlotArea(location);
|
super.getApplicablePlotArea(location);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public PlotArea getPlotArea(String world, String id) {
|
@Override @Nullable public PlotArea getPlotArea(@NotNull final String world, @NotNull final String id) {
|
||||||
PlotArea found = super.getPlotArea(world, id);
|
PlotArea found = super.getPlotArea(world, id);
|
||||||
if (found != null) {
|
if (found != null) {
|
||||||
return found;
|
return found;
|
||||||
@ -109,7 +113,7 @@ public class SinglePlotAreaManager extends DefaultPlotAreaManager {
|
|||||||
return isWorld(world) || world.equals("*") ? area : super.getPlotArea(world, id);
|
return isWorld(world) || world.equals("*") ? area : super.getPlotArea(world, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public PlotArea getPlotArea(@NotNull Location location) {
|
@Override @Nullable public PlotArea getPlotArea(@NotNull final Location location) {
|
||||||
PlotArea found = super.getPlotArea(location);
|
PlotArea found = super.getPlotArea(location);
|
||||||
if (found != null) {
|
if (found != null) {
|
||||||
return found;
|
return found;
|
||||||
@ -117,7 +121,7 @@ public class SinglePlotAreaManager extends DefaultPlotAreaManager {
|
|||||||
return isWorld(location.getWorld()) || location.getWorld().equals("*") ? area : null;
|
return isWorld(location.getWorld()) || location.getWorld().equals("*") ? area : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public PlotArea[] getPlotAreas(String world, CuboidRegion region) {
|
@Override @NotNull public PlotArea[] getPlotAreas(@NotNull final String world, @NotNull final CuboidRegion region) {
|
||||||
PlotArea[] found = super.getPlotAreas(world, region);
|
PlotArea[] found = super.getPlotAreas(world, region);
|
||||||
if (found != null && found.length != 0) {
|
if (found != null && found.length != 0) {
|
||||||
return found;
|
return found;
|
||||||
@ -127,15 +131,15 @@ public class SinglePlotAreaManager extends DefaultPlotAreaManager {
|
|||||||
all.length == 0 ? noPlotAreas : super.getPlotAreas(world, region);
|
all.length == 0 ? noPlotAreas : super.getPlotAreas(world, region);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public PlotArea[] getAllPlotAreas() {
|
@Override @NotNull public PlotArea[] getAllPlotAreas() {
|
||||||
return all;
|
return all;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public String[] getAllWorlds() {
|
@Override @NotNull public String[] getAllWorlds() {
|
||||||
return super.getAllWorlds();
|
return super.getAllWorlds();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void addPlotArea(PlotArea area) {
|
@Override public void addPlotArea(@NotNull final PlotArea area) {
|
||||||
if (area == this.area) {
|
if (area == this.area) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -143,18 +147,18 @@ public class SinglePlotAreaManager extends DefaultPlotAreaManager {
|
|||||||
all = ArrayUtil.concatAll(super.getAllPlotAreas(), array);
|
all = ArrayUtil.concatAll(super.getAllPlotAreas(), array);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void removePlotArea(PlotArea area) {
|
@Override public void removePlotArea(@NotNull final PlotArea area) {
|
||||||
if (area == this.area) {
|
if (area == this.area) {
|
||||||
throw new UnsupportedOperationException("Cannot remove base area!");
|
throw new UnsupportedOperationException("Cannot remove base area!");
|
||||||
}
|
}
|
||||||
super.removePlotArea(area);
|
super.removePlotArea(area);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void addWorld(String worldName) {
|
@Override public void addWorld(@NotNull final String worldName) {
|
||||||
super.addWorld(worldName);
|
super.addWorld(worldName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void removeWorld(String worldName) {
|
@Override public void removeWorld(@NotNull final String worldName) {
|
||||||
super.removeWorld(worldName);
|
super.removeWorld(worldName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ public class ScopedLocalBlockQueue extends DelegateLocalBlockQueue {
|
|||||||
public void mapByType2D(RunnableVal3<Plot, Integer, Integer> task) {
|
public void mapByType2D(RunnableVal3<Plot, Integer, Integer> task) {
|
||||||
int bx = minX;
|
int bx = minX;
|
||||||
int bz = minZ;
|
int bz = minZ;
|
||||||
PlotArea area = PlotSquared.get().getPlotArea(getWorld(), null);
|
PlotArea area = PlotSquared.get().getPlotAreaManager().getPlotArea(getWorld(), null);
|
||||||
Location location = new Location(getWorld(), bx, 0, bz);
|
Location location = new Location(getWorld(), bx, 0, bz);
|
||||||
if (area != null) {
|
if (area != null) {
|
||||||
PlotManager manager = area.getPlotManager();
|
PlotManager manager = area.getPlotManager();
|
||||||
|
@ -134,7 +134,7 @@ public enum CommonSetupSteps implements SetupStep {
|
|||||||
MainUtil.sendMessage(plotPlayer, Captions.SETUP_AREA_NON_ALPHANUMERICAL);
|
MainUtil.sendMessage(plotPlayer, Captions.SETUP_AREA_NON_ALPHANUMERICAL);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
for (PlotArea area : PlotSquared.get().getPlotAreas()) {
|
for (PlotArea area : PlotSquared.get().getPlotAreaManager().getAllPlotAreas()) {
|
||||||
if (area.getId() != null && area.getId().equalsIgnoreCase(argument)) {
|
if (area.getId() != null && area.getId().equalsIgnoreCase(argument)) {
|
||||||
MainUtil.sendMessage(plotPlayer, Captions.SETUP_AREA_INVALID_ID);
|
MainUtil.sendMessage(plotPlayer, Captions.SETUP_AREA_INVALID_ID);
|
||||||
return this;
|
return this;
|
||||||
@ -215,7 +215,7 @@ public enum CommonSetupSteps implements SetupStep {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
if (WorldUtil.IMP.isWorld(argument)) {
|
if (WorldUtil.IMP.isWorld(argument)) {
|
||||||
if (PlotSquared.get().hasPlotArea(argument)) {
|
if (PlotSquared.get().getPlotAreaManager().hasPlotArea(argument)) {
|
||||||
MainUtil.sendMessage(plotPlayer, Captions.SETUP_WORLD_NAME_TAKEN);
|
MainUtil.sendMessage(plotPlayer, Captions.SETUP_WORLD_NAME_TAKEN);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -528,7 +528,7 @@ public class MainUtil {
|
|||||||
}
|
}
|
||||||
PlotArea area;
|
PlotArea area;
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
area = PlotSquared.get().getPlotAreaByString(arg);
|
area = PlotSquared.get().getPlotAreaManager().getPlotAreaByString(arg);
|
||||||
if (area == null) {
|
if (area == null) {
|
||||||
area = player.getApplicablePlotArea();
|
area = player.getApplicablePlotArea();
|
||||||
}
|
}
|
||||||
@ -538,10 +538,10 @@ public class MainUtil {
|
|||||||
String[] split = arg.split(";|,");
|
String[] split = arg.split(";|,");
|
||||||
PlotId id;
|
PlotId id;
|
||||||
if (split.length == 4) {
|
if (split.length == 4) {
|
||||||
area = PlotSquared.get().getPlotAreaByString(split[0] + ';' + split[1]);
|
area = PlotSquared.get().getPlotAreaManager().getPlotAreaByString(split[0] + ';' + split[1]);
|
||||||
id = PlotId.fromString(split[2] + ';' + split[3]);
|
id = PlotId.fromString(split[2] + ';' + split[3]);
|
||||||
} else if (split.length == 3) {
|
} else if (split.length == 3) {
|
||||||
area = PlotSquared.get().getPlotAreaByString(split[0]);
|
area = PlotSquared.get().getPlotAreaManager().getPlotAreaByString(split[0]);
|
||||||
id = PlotId.fromString(split[1] + ';' + split[2]);
|
id = PlotId.fromString(split[1] + ';' + split[2]);
|
||||||
} else if (split.length == 2) {
|
} else if (split.length == 2) {
|
||||||
id = PlotId.fromString(arg);
|
id = PlotId.fromString(arg);
|
||||||
|
@ -88,7 +88,7 @@ public class WEManager {
|
|||||||
UUID uuid = player.getUUID();
|
UUID uuid = player.getUUID();
|
||||||
Location location = player.getLocation();
|
Location location = player.getLocation();
|
||||||
String world = location.getWorld();
|
String world = location.getWorld();
|
||||||
if (!PlotSquared.get().hasPlotArea(world)) {
|
if (!PlotSquared.get().getPlotAreaManager().hasPlotArea(world)) {
|
||||||
regions.add(RegionUtil
|
regions.add(RegionUtil
|
||||||
.createRegion(Integer.MIN_VALUE, Integer.MAX_VALUE, Integer.MIN_VALUE,
|
.createRegion(Integer.MIN_VALUE, Integer.MAX_VALUE, Integer.MIN_VALUE,
|
||||||
Integer.MAX_VALUE));
|
Integer.MAX_VALUE));
|
||||||
|
@ -95,7 +95,7 @@ public final class PlotQuery {
|
|||||||
*/
|
*/
|
||||||
@NotNull public PlotQuery inWorld(@NotNull final String world) {
|
@NotNull public PlotQuery inWorld(@NotNull final String world) {
|
||||||
Preconditions.checkNotNull(world, "World may not be null");
|
Preconditions.checkNotNull(world, "World may not be null");
|
||||||
this.plotProvider = new AreaLimitedPlotProvider(PlotSquared.get().getPlotAreas(world));
|
this.plotProvider = new AreaLimitedPlotProvider(PlotSquared.get().getPlotAreaManager().getPlotAreasSet(world));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user