From b91eab2f0cfde435882ba19c7eb5c71312f902cc Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Mon, 25 Jul 2016 09:47:49 +1000 Subject: [PATCH] Minor sponge fixes --- Sponge/build.gradle | 4 ++-- Sponge/src/main/java/com/plotsquared/sponge/SpongeMain.java | 3 +++ .../sponge/generator/SpongeAugmentedGenerator.java | 6 +----- .../main/java/com/plotsquared/sponge/util/SpongeUtil.java | 3 ++- .../java/com/plotsquared/sponge/util/block/GenChunk.java | 3 ++- .../com/plotsquared/sponge/util/block/SpongeLocalQueue.java | 3 ++- 6 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Sponge/build.gradle b/Sponge/build.gradle index 8b036dc26..4295fe4e7 100644 --- a/Sponge/build.gradle +++ b/Sponge/build.gradle @@ -14,7 +14,7 @@ buildscript { } } -apply plugin: 'net.minecrell.vanilla.server.library' +apply plugin: 'net.minecraftforge.gradle.forge' dependencies { compile project(':Core') @@ -35,7 +35,7 @@ repositories { } } minecraft { - version = "1.10.2" + version = "2014" mappings = "snapshot_20160629" runDir = 'run' } diff --git a/Sponge/src/main/java/com/plotsquared/sponge/SpongeMain.java b/Sponge/src/main/java/com/plotsquared/sponge/SpongeMain.java index 0ceef43dc..d62792e94 100644 --- a/Sponge/src/main/java/com/plotsquared/sponge/SpongeMain.java +++ b/Sponge/src/main/java/com/plotsquared/sponge/SpongeMain.java @@ -58,6 +58,8 @@ import org.spongepowered.api.Sponge; import org.spongepowered.api.config.ConfigDir; import org.spongepowered.api.entity.living.player.Player; 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.plugin.Plugin; import org.spongepowered.api.plugin.PluginContainer; @@ -80,6 +82,7 @@ import java.util.stream.Collectors; public class SpongeMain implements IPlotMain { public static SpongeMain THIS; + public static final Cause CAUSE = Cause.of(NamedCause.of("PlotSquared", SpongeMain.THIS)); @Inject public PluginContainer plugin; diff --git a/Sponge/src/main/java/com/plotsquared/sponge/generator/SpongeAugmentedGenerator.java b/Sponge/src/main/java/com/plotsquared/sponge/generator/SpongeAugmentedGenerator.java index 99660f1a9..8597d4300 100644 --- a/Sponge/src/main/java/com/plotsquared/sponge/generator/SpongeAugmentedGenerator.java +++ b/Sponge/src/main/java/com/plotsquared/sponge/generator/SpongeAugmentedGenerator.java @@ -8,8 +8,6 @@ import com.plotsquared.sponge.SpongeMain; import com.plotsquared.sponge.util.SpongeUtil; import java.util.List; import org.spongepowered.api.block.BlockState; -import org.spongepowered.api.event.cause.Cause; -import org.spongepowered.api.event.cause.NamedCause; import org.spongepowered.api.world.World; import org.spongepowered.api.world.extent.ImmutableBiomeArea; import org.spongepowered.api.world.extent.MutableBlockVolume; @@ -37,8 +35,6 @@ public class SpongeAugmentedGenerator implements GenerationPopulator { return generator; } - private Cause cause = Cause.of(NamedCause.of("PlotSquared", SpongeMain.THIS)); - @Override public void populate(World world, MutableBlockVolume terrain, ImmutableBiomeArea biome) { Vector3i min = terrain.getBlockMin(); @@ -49,7 +45,7 @@ public class SpongeAugmentedGenerator implements GenerationPopulator { AugmentedUtils.generate(world.getName(), cx, cz, new DelegateLocalBlockQueue(null) { @Override public boolean setBlock(int x, int y, int z, int id, int data) { - terrain.setBlock(bx + x, y, bz + z, SpongeUtil.getBlockState(id, data), cause); + terrain.setBlock(bx + x, y, bz + z, SpongeUtil.getBlockState(id, data), SpongeMain.CAUSE); return true; } diff --git a/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeUtil.java b/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeUtil.java index e84d5f89a..f3fb6920c 100644 --- a/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeUtil.java +++ b/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeUtil.java @@ -15,6 +15,7 @@ import com.intellectualcrafters.plot.util.StringComparison; import com.intellectualcrafters.plot.util.StringMan; import com.intellectualcrafters.plot.util.UUIDHandler; import com.intellectualcrafters.plot.util.WorldUtil; +import com.plotsquared.sponge.SpongeMain; import com.plotsquared.sponge.object.SpongePlayer; import net.minecraft.block.Block; import net.minecraft.world.biome.Biome; @@ -429,7 +430,7 @@ public class SpongeUtil extends WorldUtil { @Override public void setSign(String worldName, int x, int y, int z, String[] lines) { World world = SpongeUtil.getWorld(worldName); - world.setBlock(x, y, z, BlockTypes.WALL_SIGN.getDefaultState()); + world.setBlock(x, y, z, BlockTypes.WALL_SIGN.getDefaultState(), SpongeMain.CAUSE); Optional block = world.getTileEntity(x, y, z); if (!block.isPresent()) { return; diff --git a/Sponge/src/main/java/com/plotsquared/sponge/util/block/GenChunk.java b/Sponge/src/main/java/com/plotsquared/sponge/util/block/GenChunk.java index 361258217..a89860302 100644 --- a/Sponge/src/main/java/com/plotsquared/sponge/util/block/GenChunk.java +++ b/Sponge/src/main/java/com/plotsquared/sponge/util/block/GenChunk.java @@ -4,6 +4,7 @@ import com.intellectualcrafters.plot.object.ChunkWrapper; import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.PlotBlock; import com.intellectualcrafters.plot.util.block.ScopedLocalBlockQueue; +import com.plotsquared.sponge.SpongeMain; import com.plotsquared.sponge.util.SpongeUtil; import org.spongepowered.api.world.biome.BiomeType; import org.spongepowered.api.world.extent.MutableBiomeArea; @@ -52,7 +53,7 @@ public class GenChunk extends ScopedLocalBlockQueue { @Override public boolean setBlock(int x, int y, int z, int id, int data) { modified = true; - this.terrain.setBlock(this.bx + x, y, this.bz + z, SpongeUtil.getBlockState(id, data)); + this.terrain.setBlock(this.bx + x, y, this.bz + z, SpongeUtil.getBlockState(id, data), SpongeMain.CAUSE); return true; } diff --git a/Sponge/src/main/java/com/plotsquared/sponge/util/block/SpongeLocalQueue.java b/Sponge/src/main/java/com/plotsquared/sponge/util/block/SpongeLocalQueue.java index 52aed64b9..a2a62634e 100644 --- a/Sponge/src/main/java/com/plotsquared/sponge/util/block/SpongeLocalQueue.java +++ b/Sponge/src/main/java/com/plotsquared/sponge/util/block/SpongeLocalQueue.java @@ -6,6 +6,7 @@ import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.StringMan; import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.block.BasicLocalBlockQueue; +import com.plotsquared.sponge.SpongeMain; import com.plotsquared.sponge.util.SpongeUtil; import java.lang.reflect.Field; import java.util.Arrays; @@ -441,7 +442,7 @@ public class SpongeLocalQueue extends BasicLocalBlockQueue { World worldObj = getSpongeWorld(); org.spongepowered.api.world.Chunk spongeChunk = (org.spongepowered.api.world.Chunk) getChunk(worldObj, lc.getX(), lc.getZ()); char[][] ids = ((CharLocalChunk) lc).blocks; - MutableBlockVolumeWorker blockWorker = spongeChunk.getBlockWorker(); + MutableBlockVolumeWorker blockWorker = spongeChunk.getBlockWorker(SpongeMain.CAUSE); blockWorker.map(new BlockVolumeMapper() { @Override public BlockState map(UnmodifiableBlockVolume volume, int xx, int y, int zz) {