Merge pull request #6 from Pablete1234/block36

Enable block 36 and add proto 1.4.3
This commit is contained in:
ShinyDialga 2017-03-27 20:49:49 -05:00 committed by GitHub
commit ff8dc68b3c
2 changed files with 17 additions and 9 deletions

View File

@ -19,11 +19,14 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.world.ChunkLoadEvent; import org.bukkit.event.world.ChunkLoadEvent;
import tc.oc.api.docs.SemanticVersion;
import tc.oc.api.util.Permissions; import tc.oc.api.util.Permissions;
import tc.oc.commons.bukkit.util.BlockVectorSet; import tc.oc.commons.bukkit.util.BlockVectorSet;
import tc.oc.commons.bukkit.util.ChunkPosition; import tc.oc.commons.bukkit.util.ChunkPosition;
import tc.oc.commons.bukkit.util.NMSHacks; import tc.oc.commons.bukkit.util.NMSHacks;
import tc.oc.pgm.events.ListenerScope; import tc.oc.pgm.events.ListenerScope;
import tc.oc.pgm.map.MapProto;
import tc.oc.pgm.map.ProtoVersions;
import tc.oc.pgm.match.Match; import tc.oc.pgm.match.Match;
import tc.oc.pgm.match.MatchModule; import tc.oc.pgm.match.MatchModule;
import tc.oc.pgm.match.MatchScope; import tc.oc.pgm.match.MatchScope;
@ -36,7 +39,8 @@ public class WorldProblemMatchModule extends MatchModule implements Listener {
private final Set<ChunkPosition> repairedChunks = new HashSet<>(); private final Set<ChunkPosition> repairedChunks = new HashSet<>();
private final BlockVectorSet block36Locations = new BlockVectorSet(); private final BlockVectorSet block36Locations = new BlockVectorSet();
private @Inject World world; @Inject private @MapProto SemanticVersion proto;
@Inject private World world;
@Inject WorldProblemMatchModule(Match match) { @Inject WorldProblemMatchModule(Match match) {
super(match); super(match);
@ -99,7 +103,7 @@ public class WorldProblemMatchModule extends MatchModule implements Listener {
ironDoor.setType(Material.BARRIER, false); ironDoor.setType(Material.BARRIER, false);
} }
} }
if (proto.isOlderThan(ProtoVersions.ENABLE_BLOCK_36)) {
// Remove all block 36 and remember the ones at y=0 so VoidFilter can check them // Remove all block 36 and remember the ones at y=0 so VoidFilter can check them
for(Block block36 : chunk.getBlocks(Material.PISTON_MOVING_PIECE)) { for(Block block36 : chunk.getBlocks(Material.PISTON_MOVING_PIECE)) {
if(block36.getY() == 0) { if(block36.getY() == 0) {
@ -109,6 +113,7 @@ public class WorldProblemMatchModule extends MatchModule implements Listener {
} }
} }
} }
}
public boolean wasBlock36(int x, int y, int z) { public boolean wasBlock36(int x, int y, int z) {
checkChunk(ChunkPosition.ofBlock(x, y, z), null); checkChunk(ChunkPosition.ofBlock(x, y, z), null);

View File

@ -42,6 +42,9 @@ public class ProtoVersions {
// Various changes to support dynamic filters // Various changes to support dynamic filters
public static final SemanticVersion DYNAMIC_FILTERS = new SemanticVersion(1, 4, 2); public static final SemanticVersion DYNAMIC_FILTERS = new SemanticVersion(1, 4, 2);
// Enable block 36 to be used, protos before this will remove it from the map
public static final SemanticVersion ENABLE_BLOCK_36 = new SemanticVersion(1, 4, 3);
// Current version - change this whenever we bump the proto // Current version - change this whenever we bump the proto
public static final SemanticVersion CURRENT = DYNAMIC_FILTERS; public static final SemanticVersion CURRENT = ENABLE_BLOCK_36;
} }