mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 10:14:42 +02:00
Refactor BlockVector2
This commit is contained in:
@ -18,7 +18,6 @@ import com.github.intellectualsites.plotsquared.plot.object.worlds.PlotAreaManag
|
||||
import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotArea;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotAreaManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.worlds.SingleWorldGenerator;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.block.QueueProvider;
|
||||
import com.github.intellectualsites.plotsquared.plot.uuid.UUIDWrapper;
|
||||
import com.github.intellectualsites.plotsquared.sponge.generator.SpongePlotGenerator;
|
||||
|
@ -4,8 +4,6 @@ import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.github.intellectualsites.plotsquared.plot.config.C;
|
||||
import com.github.intellectualsites.plotsquared.plot.flag.Flags;
|
||||
import com.github.intellectualsites.plotsquared.plot.listener.PlotListener;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.*;
|
||||
import com.github.intellectualsites.plotsquared.sponge.SpongeMain;
|
||||
import com.github.intellectualsites.plotsquared.sponge.object.SpongePlayer;
|
||||
import com.github.intellectualsites.plotsquared.sponge.util.SpongeUtil;
|
||||
@ -35,7 +33,6 @@ import org.spongepowered.api.event.world.ExplosionEvent.Detonate;
|
||||
import org.spongepowered.api.text.Text;
|
||||
import org.spongepowered.api.world.World;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.function.Predicate;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.github.intellectualsites.plotsquared.sponge.util;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.object.ChunkLoc;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.BlockVector2;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
|
||||
@ -53,12 +53,12 @@ public class SpongeChunkManager extends ChunkManager {
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override public boolean loadChunk(String world, ChunkLoc loc, boolean force) {
|
||||
@Override public boolean loadChunk(String world, BlockVector2 loc, boolean force) {
|
||||
World worldObj = SpongeUtil.getWorld(world);
|
||||
return worldObj.loadChunk(loc.x << 4, 0, loc.z << 4, force).isPresent();
|
||||
}
|
||||
|
||||
@Override public Set<ChunkLoc> getChunkChunks(String world) {
|
||||
@Override public Set<BlockVector2> getChunkChunks(String world) {
|
||||
// TODO save world;
|
||||
return super.getChunkChunks(world);
|
||||
}
|
||||
@ -100,7 +100,7 @@ public class SpongeChunkManager extends ChunkManager {
|
||||
throw new UnsupportedOperationException("NOT IMPLEMENTED YET");
|
||||
}
|
||||
|
||||
@Override public void unloadChunk(String world, ChunkLoc loc, boolean save, boolean safe) {
|
||||
@Override public void unloadChunk(String world, BlockVector2 loc, boolean save, boolean safe) {
|
||||
World worldObj = SpongeUtil.getWorld(world);
|
||||
Optional<Chunk> chunk = worldObj.getChunk(loc.x << 4, 0, loc.z << 4);
|
||||
if (chunk.isPresent()) {
|
||||
|
@ -16,8 +16,6 @@ import org.spongepowered.api.text.Text;
|
||||
import org.spongepowered.api.world.Location;
|
||||
import org.spongepowered.api.world.World;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class SpongeCommand implements CommandCallable {
|
||||
|
||||
@Override public CommandResult process(CommandSource source, String arguments)
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.github.intellectualsites.plotsquared.sponge.util;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.flag.Flag;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.EventUtil;
|
||||
import com.github.intellectualsites.plotsquared.sponge.SpongeMain;
|
||||
import com.github.intellectualsites.plotsquared.sponge.events.*;
|
||||
|
@ -1,5 +1,24 @@
|
||||
package com.github.intellectualsites.plotsquared.sponge.util;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.google.inject.Inject;
|
||||
import ninja.leaping.configurate.commented.CommentedConfigurationNode;
|
||||
import ninja.leaping.configurate.hocon.HoconConfigurationLoader;
|
||||
import ninja.leaping.configurate.loader.ConfigurationLoader;
|
||||
import org.spongepowered.api.Game;
|
||||
import org.spongepowered.api.plugin.PluginContainer;
|
||||
import org.spongepowered.api.scheduler.Task;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.Proxy;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
/*
|
||||
* Copyright 2011-2013 Tyler Blair. All rights reserved.
|
||||
*
|
||||
@ -28,24 +47,6 @@ package com.github.intellectualsites.plotsquared.sponge.util;
|
||||
* either expressed or implied, of anybody else.
|
||||
*/
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||
import com.google.inject.Inject;
|
||||
import ninja.leaping.configurate.commented.CommentedConfigurationNode;
|
||||
import ninja.leaping.configurate.hocon.HoconConfigurationLoader;
|
||||
import ninja.leaping.configurate.loader.ConfigurationLoader;
|
||||
import org.spongepowered.api.Game;
|
||||
import org.spongepowered.api.plugin.PluginContainer;
|
||||
import org.spongepowered.api.scheduler.Task;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.Proxy;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
public class SpongeMetrics {
|
||||
|
||||
/**
|
||||
|
@ -1,17 +1,16 @@
|
||||
package com.github.intellectualsites.plotsquared.sponge.util;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.jnbt.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import org.spongepowered.api.block.BlockState;
|
||||
import org.spongepowered.api.item.inventory.Carrier;
|
||||
import org.spongepowered.api.item.inventory.type.CarriedInventory;
|
||||
import org.spongepowered.api.world.World;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class SpongeSchematicHandler extends SchematicHandler {
|
||||
@ -92,10 +91,10 @@ public class SpongeSchematicHandler extends SchematicHandler {
|
||||
int sy = pos1.getY();
|
||||
int ey = pos2.getY();
|
||||
// Generate list of chunks
|
||||
ArrayList<ChunkLoc> chunks = new ArrayList<>();
|
||||
ArrayList<BlockVector2> chunks = new ArrayList<>();
|
||||
for (int x = bcx; x <= tcx; x++) {
|
||||
for (int z = bcz; z <= tcz; z++) {
|
||||
chunks.add(new ChunkLoc(x, z));
|
||||
chunks.add(BlockVector2.at(x, z));
|
||||
}
|
||||
}
|
||||
World worldObj = SpongeUtil.getWorld(world);
|
||||
@ -106,7 +105,7 @@ public class SpongeSchematicHandler extends SchematicHandler {
|
||||
while (!chunks.isEmpty()
|
||||
&& System.currentTimeMillis() - start < 20) {
|
||||
// save schematics
|
||||
ChunkLoc chunk = chunks.remove(0);
|
||||
BlockVector2 chunk = chunks.remove(0);
|
||||
int X = chunk.x;
|
||||
int Z = chunk.z;
|
||||
if (!worldObj.getChunk(X, 0, Z).isPresent() && !worldObj
|
||||
|
@ -19,7 +19,6 @@ import org.spongepowered.api.world.gen.WorldGeneratorModifier;
|
||||
import org.spongepowered.api.world.storage.WorldProperties;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class SpongeSetupUtils extends SetupUtils {
|
||||
|
@ -9,7 +9,6 @@ import com.github.intellectualsites.plotsquared.plot.object.PlotBlock;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.RegionWrapper;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.schematic.PlotItem;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.*;
|
||||
import com.github.intellectualsites.plotsquared.sponge.SpongeMain;
|
||||
import com.github.intellectualsites.plotsquared.sponge.object.SpongePlayer;
|
||||
import net.minecraft.block.Block;
|
||||
@ -39,7 +38,6 @@ import org.spongepowered.api.world.extent.Extent;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
|
||||
public class SpongeUtil extends WorldUtil {
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.sponge.util.block;
|
||||
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.object.ChunkWrapper;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotBlock;
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.github.intellectualsites.plotsquared.sponge.util.block;
|
||||
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PlotBlock;
|
||||
import com.github.intellectualsites.plotsquared.plot.object.PseudoRandom;
|
||||
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||
|
Reference in New Issue
Block a user