diff options
author | Articdive <articdive@gmail.com> | 2018-07-23 17:20:52 +1000 |
---|---|---|
committer | md_5 <git@md-5.net> | 2018-07-23 17:21:07 +1000 |
commit | 30ab12cf4ceea49628d27e66fb06f00b9b29aa57 (patch) | |
tree | 860e3e55d376c91f2e53e4d5de9ca7420b767691 /src/main/java/org | |
parent | b50bb15f56ff4e6541b0c053ca4f725dfc815a19 (diff) | |
download | craftbukkit-30ab12cf4ceea49628d27e66fb06f00b9b29aa57.tar craftbukkit-30ab12cf4ceea49628d27e66fb06f00b9b29aa57.tar.gz craftbukkit-30ab12cf4ceea49628d27e66fb06f00b9b29aa57.tar.lz craftbukkit-30ab12cf4ceea49628d27e66fb06f00b9b29aa57.tar.xz craftbukkit-30ab12cf4ceea49628d27e66fb06f00b9b29aa57.zip |
SPIGOT-824: SpongeAbsorbEvent
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/util/BlockStateListPopulator.java | 25 | ||||
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java | 2 |
2 files changed, 12 insertions, 15 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/util/BlockStateListPopulator.java b/src/main/java/org/bukkit/craftbukkit/util/BlockStateListPopulator.java index 3db85a3b..165843dd 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/BlockStateListPopulator.java +++ b/src/main/java/org/bukkit/craftbukkit/util/BlockStateListPopulator.java @@ -1,6 +1,7 @@ package org.bukkit.craftbukkit.util; import java.util.ArrayList; +import java.util.LinkedHashMap; import java.util.List; import net.minecraft.server.BlockPosition; @@ -10,39 +11,35 @@ import net.minecraft.server.World; import org.bukkit.block.BlockState; import org.bukkit.craftbukkit.block.CraftBlockState; -public class BlockStateListPopulator { +public class BlockStateListPopulator extends DummyGeneratorAccess { private final World world; - private final List<CraftBlockState> list; + private final LinkedHashMap<BlockPosition, CraftBlockState> list; public BlockStateListPopulator(World world) { - this(world, new ArrayList<CraftBlockState>()); + this(world, new LinkedHashMap<>()); } - public BlockStateListPopulator(World world, List<CraftBlockState> list) { + public BlockStateListPopulator(World world, LinkedHashMap<BlockPosition, CraftBlockState> list) { this.world = world; this.list = list; } - public void setTypeUpdate(BlockPosition position, IBlockData data) { - CraftBlockState state = CraftBlockState.getBlockState(world, position); - state.setData(data); - list.add(state); - } - - public void setTypeAndData(BlockPosition position, IBlockData data, int flag) { + @Override + public boolean setTypeAndData(BlockPosition position, IBlockData data, int flag) { CraftBlockState state = CraftBlockState.getBlockState(world, position, flag); state.setData(data); - list.add(state); + list.put(position, state); + return true; } public void updateList() { - for (BlockState state : list) { + for (BlockState state : list.values()) { state.update(true); } } public List<CraftBlockState> getList() { - return list; + return new ArrayList<>(list.values()); } public World getWorld() { diff --git a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java index 2d6e7089..897c8cc5 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java +++ b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java @@ -39,7 +39,7 @@ public class DummyGeneratorAccess implements GeneratorAccess { public static final GeneratorAccess INSTANCE = new DummyGeneratorAccess(); - private DummyGeneratorAccess() { + protected DummyGeneratorAccess() { } @Override |