*should use this cause instead

This commit is contained in:
Jesse Boyd 2016-07-25 09:54:35 +10:00
parent b91eab2f0c
commit 30d18c917d
5 changed files with 21 additions and 30 deletions

View File

@ -51,6 +51,13 @@ import com.plotsquared.sponge.util.block.SpongeLocalQueue;
import com.plotsquared.sponge.uuid.SpongeLowerOfflineUUIDWrapper; import com.plotsquared.sponge.uuid.SpongeLowerOfflineUUIDWrapper;
import com.plotsquared.sponge.uuid.SpongeOnlineUUIDWrapper; import com.plotsquared.sponge.uuid.SpongeOnlineUUIDWrapper;
import com.plotsquared.sponge.uuid.SpongeUUIDHandler; import com.plotsquared.sponge.uuid.SpongeUUIDHandler;
import java.io.File;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.spongepowered.api.Game; import org.spongepowered.api.Game;
import org.spongepowered.api.Server; import org.spongepowered.api.Server;
@ -58,8 +65,6 @@ import org.spongepowered.api.Sponge;
import org.spongepowered.api.config.ConfigDir; import org.spongepowered.api.config.ConfigDir;
import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.event.Listener; import org.spongepowered.api.event.Listener;
import org.spongepowered.api.event.cause.Cause;
import org.spongepowered.api.event.cause.NamedCause;
import org.spongepowered.api.event.game.state.GameAboutToStartServerEvent; import org.spongepowered.api.event.game.state.GameAboutToStartServerEvent;
import org.spongepowered.api.plugin.Plugin; import org.spongepowered.api.plugin.Plugin;
import org.spongepowered.api.plugin.PluginContainer; import org.spongepowered.api.plugin.PluginContainer;
@ -69,20 +74,11 @@ import org.spongepowered.api.world.gen.GenerationPopulator;
import org.spongepowered.api.world.gen.WorldGenerator; import org.spongepowered.api.world.gen.WorldGenerator;
import org.spongepowered.api.world.gen.WorldGeneratorModifier; import org.spongepowered.api.world.gen.WorldGeneratorModifier;
import java.io.File;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
@Plugin(id = "plotsquared", name = "PlotSquared", description = "Easy, yet powerful Plot World generation and management.", @Plugin(id = "plotsquared", name = "PlotSquared", description = "Easy, yet powerful Plot World generation and management.",
url = "https://github.com/IntellectualSites/PlotSquared", version = "3.3.3") url = "https://github.com/IntellectualSites/PlotSquared", version = "3.3.3")
public class SpongeMain implements IPlotMain { public class SpongeMain implements IPlotMain {
public static SpongeMain THIS; public static SpongeMain THIS;
public static final Cause CAUSE = Cause.of(NamedCause.of("PlotSquared", SpongeMain.THIS));
@Inject @Inject
public PluginContainer plugin; public PluginContainer plugin;

View File

@ -4,7 +4,6 @@ import com.flowpowered.math.vector.Vector3i;
import com.intellectualcrafters.plot.generator.AugmentedUtils; import com.intellectualcrafters.plot.generator.AugmentedUtils;
import com.intellectualcrafters.plot.object.PlotBlock; import com.intellectualcrafters.plot.object.PlotBlock;
import com.intellectualcrafters.plot.util.block.DelegateLocalBlockQueue; import com.intellectualcrafters.plot.util.block.DelegateLocalBlockQueue;
import com.plotsquared.sponge.SpongeMain;
import com.plotsquared.sponge.util.SpongeUtil; import com.plotsquared.sponge.util.SpongeUtil;
import java.util.List; import java.util.List;
import org.spongepowered.api.block.BlockState; import org.spongepowered.api.block.BlockState;
@ -45,7 +44,7 @@ public class SpongeAugmentedGenerator implements GenerationPopulator {
AugmentedUtils.generate(world.getName(), cx, cz, new DelegateLocalBlockQueue(null) { AugmentedUtils.generate(world.getName(), cx, cz, new DelegateLocalBlockQueue(null) {
@Override @Override
public boolean setBlock(int x, int y, int z, int id, int data) { public boolean setBlock(int x, int y, int z, int id, int data) {
terrain.setBlock(bx + x, y, bz + z, SpongeUtil.getBlockState(id, data), SpongeMain.CAUSE); terrain.setBlock(bx + x, y, bz + z, SpongeUtil.getBlockState(id, data), SpongeUtil.CAUSE);
return true; return true;
} }

View File

@ -15,8 +15,17 @@ import com.intellectualcrafters.plot.util.StringComparison;
import com.intellectualcrafters.plot.util.StringMan; import com.intellectualcrafters.plot.util.StringMan;
import com.intellectualcrafters.plot.util.UUIDHandler; import com.intellectualcrafters.plot.util.UUIDHandler;
import com.intellectualcrafters.plot.util.WorldUtil; import com.intellectualcrafters.plot.util.WorldUtil;
import com.plotsquared.sponge.SpongeMain;
import com.plotsquared.sponge.object.SpongePlayer; import com.plotsquared.sponge.object.SpongePlayer;
import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Optional;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome;
import org.spongepowered.api.Sponge; import org.spongepowered.api.Sponge;
@ -41,17 +50,6 @@ import org.spongepowered.api.world.biome.BiomeType;
import org.spongepowered.api.world.biome.BiomeTypes; import org.spongepowered.api.world.biome.BiomeTypes;
import org.spongepowered.api.world.extent.Extent; import org.spongepowered.api.world.extent.Extent;
import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Optional;
public class SpongeUtil extends WorldUtil { public class SpongeUtil extends WorldUtil {
public static Cause CAUSE = Cause.of(NamedCause.source("PlotSquared")); public static Cause CAUSE = Cause.of(NamedCause.source("PlotSquared"));
@ -430,7 +428,7 @@ public class SpongeUtil extends WorldUtil {
@Override @Override
public void setSign(String worldName, int x, int y, int z, String[] lines) { public void setSign(String worldName, int x, int y, int z, String[] lines) {
World world = SpongeUtil.getWorld(worldName); World world = SpongeUtil.getWorld(worldName);
world.setBlock(x, y, z, BlockTypes.WALL_SIGN.getDefaultState(), SpongeMain.CAUSE); world.setBlock(x, y, z, BlockTypes.WALL_SIGN.getDefaultState(), CAUSE);
Optional<TileEntity> block = world.getTileEntity(x, y, z); Optional<TileEntity> block = world.getTileEntity(x, y, z);
if (!block.isPresent()) { if (!block.isPresent()) {
return; return;

View File

@ -4,7 +4,6 @@ import com.intellectualcrafters.plot.object.ChunkWrapper;
import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.PlotBlock; import com.intellectualcrafters.plot.object.PlotBlock;
import com.intellectualcrafters.plot.util.block.ScopedLocalBlockQueue; import com.intellectualcrafters.plot.util.block.ScopedLocalBlockQueue;
import com.plotsquared.sponge.SpongeMain;
import com.plotsquared.sponge.util.SpongeUtil; import com.plotsquared.sponge.util.SpongeUtil;
import org.spongepowered.api.world.biome.BiomeType; import org.spongepowered.api.world.biome.BiomeType;
import org.spongepowered.api.world.extent.MutableBiomeArea; import org.spongepowered.api.world.extent.MutableBiomeArea;
@ -53,7 +52,7 @@ public class GenChunk extends ScopedLocalBlockQueue {
@Override @Override
public boolean setBlock(int x, int y, int z, int id, int data) { public boolean setBlock(int x, int y, int z, int id, int data) {
modified = true; modified = true;
this.terrain.setBlock(this.bx + x, y, this.bz + z, SpongeUtil.getBlockState(id, data), SpongeMain.CAUSE); this.terrain.setBlock(this.bx + x, y, this.bz + z, SpongeUtil.getBlockState(id, data), SpongeUtil.CAUSE);
return true; return true;
} }

View File

@ -6,7 +6,6 @@ import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.StringMan; import com.intellectualcrafters.plot.util.StringMan;
import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.TaskManager;
import com.intellectualcrafters.plot.util.block.BasicLocalBlockQueue; import com.intellectualcrafters.plot.util.block.BasicLocalBlockQueue;
import com.plotsquared.sponge.SpongeMain;
import com.plotsquared.sponge.util.SpongeUtil; import com.plotsquared.sponge.util.SpongeUtil;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.Arrays; import java.util.Arrays;
@ -442,7 +441,7 @@ public class SpongeLocalQueue extends BasicLocalBlockQueue<char[]> {
World worldObj = getSpongeWorld(); World worldObj = getSpongeWorld();
org.spongepowered.api.world.Chunk spongeChunk = (org.spongepowered.api.world.Chunk) getChunk(worldObj, lc.getX(), lc.getZ()); org.spongepowered.api.world.Chunk spongeChunk = (org.spongepowered.api.world.Chunk) getChunk(worldObj, lc.getX(), lc.getZ());
char[][] ids = ((CharLocalChunk) lc).blocks; char[][] ids = ((CharLocalChunk) lc).blocks;
MutableBlockVolumeWorker<? extends org.spongepowered.api.world.Chunk> blockWorker = spongeChunk.getBlockWorker(SpongeMain.CAUSE); MutableBlockVolumeWorker<? extends org.spongepowered.api.world.Chunk> blockWorker = spongeChunk.getBlockWorker(SpongeUtil.CAUSE);
blockWorker.map(new BlockVolumeMapper() { blockWorker.map(new BlockVolumeMapper() {
@Override @Override
public BlockState map(UnmodifiableBlockVolume volume, int xx, int y, int zz) { public BlockState map(UnmodifiableBlockVolume volume, int xx, int y, int zz) {