Remove and add gates to the gate attributes.

This commit is contained in:
Tobias Ottenweller 2013-06-23 18:43:22 +02:00
parent 09b9c65ef6
commit f4495240a5

View File

@ -88,7 +88,7 @@ public class GatesManager
return;
}
gatesConfig.set(gatesPath, new ArrayList<Object>(gatesById.values()));
gatesConfig.set(gatesPath, gates);
gatesConfig.set(storageVersionPath, storageVersion);
try {
@ -288,20 +288,26 @@ public class GatesManager
protected void removeGateByLocation(final Set<Location> gateBlocks)
{
if (gateBlocks != null) {
for (Location l : gateBlocks) {
SimpleLocation sl = new SimpleLocation(l);
gatesByLocation.remove(sl);
}
}
}
protected void removeGateByFrameLocation(final Set<Block> gateFrameBlocks)
{
if (gateFrameBlocks != null) {
for (Block block : gateFrameBlocks) {
SimpleLocation sl = new SimpleLocation(block.getLocation());
gatesByFrameLocation.remove(sl);
}
}
}
protected void addGateByLocations(final Gate g)
@ -460,6 +466,8 @@ public class GatesManager
public void handleNewGate(final Gate g)
{
this.gates.add(g);
this.addGateByChunk(g);
this.addGateByLocations(g);
this.addGateWithId(g);
@ -469,6 +477,8 @@ public class GatesManager
public void handleDeletion(final Gate g)
{
this.gates.remove(g);
this.removeGateById(g.getId());
this.removeGateFromChunk(g, g.getLocation());
this.removeGateByLocation(g.getGateBlockLocations());