Changes names of some variables and one method to increase readability
This commit is contained in:
parent
e5fef0b16a
commit
151c242e69
@ -60,7 +60,7 @@ public class BloxPopulator {
|
|||||||
*
|
*
|
||||||
* @return <p>The material used for population</p>
|
* @return <p>The material used for population</p>
|
||||||
*/
|
*/
|
||||||
public Material getMat() {
|
public Material getMaterial() {
|
||||||
return nextMat;
|
return nextMat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,20 +12,22 @@ public class BlockPopulatorThread implements Runnable {
|
|||||||
public void run() {
|
public void run() {
|
||||||
long sTime = System.nanoTime();
|
long sTime = System.nanoTime();
|
||||||
while (System.nanoTime() - sTime < 25000000) {
|
while (System.nanoTime() - sTime < 25000000) {
|
||||||
BloxPopulator b = Stargate.blockPopulatorQueue.poll();
|
BloxPopulator bloxPopulator = Stargate.blockPopulatorQueue.poll();
|
||||||
if (b == null) return;
|
if (bloxPopulator == null) {
|
||||||
Block blk = b.getBlockLocation().getBlock();
|
return;
|
||||||
blk.setType(b.getMat(), false);
|
}
|
||||||
if (b.getMat() == Material.END_GATEWAY && blk.getWorld().getEnvironment() == World.Environment.THE_END) {
|
Block block = bloxPopulator.getBlockLocation().getBlock();
|
||||||
|
block.setType(bloxPopulator.getMaterial(), false);
|
||||||
|
if (bloxPopulator.getMaterial() == Material.END_GATEWAY && block.getWorld().getEnvironment() == World.Environment.THE_END) {
|
||||||
// force a location to prevent exit gateway generation
|
// force a location to prevent exit gateway generation
|
||||||
EndGateway gateway = (EndGateway) blk.getState();
|
EndGateway gateway = (EndGateway) block.getState();
|
||||||
gateway.setExitLocation(blk.getWorld().getSpawnLocation());
|
gateway.setExitLocation(block.getWorld().getSpawnLocation());
|
||||||
gateway.setExactTeleport(true);
|
gateway.setExactTeleport(true);
|
||||||
gateway.update(false, false);
|
gateway.update(false, false);
|
||||||
} else if (b.getAxis() != null) {
|
} else if (bloxPopulator.getAxis() != null) {
|
||||||
Orientable orientable = (Orientable) blk.getBlockData();
|
Orientable orientable = (Orientable) block.getBlockData();
|
||||||
orientable.setAxis(b.getAxis());
|
orientable.setAxis(bloxPopulator.getAxis());
|
||||||
blk.setBlockData(orientable);
|
block.setBlockData(orientable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,21 +14,24 @@ public class StarGateThread implements Runnable {
|
|||||||
long time = System.currentTimeMillis() / 1000;
|
long time = System.currentTimeMillis() / 1000;
|
||||||
// Close open portals
|
// Close open portals
|
||||||
for (Iterator<Portal> iterator = Stargate.openList.iterator(); iterator.hasNext(); ) {
|
for (Iterator<Portal> iterator = Stargate.openList.iterator(); iterator.hasNext(); ) {
|
||||||
Portal p = iterator.next();
|
Portal portal = iterator.next();
|
||||||
// Skip always open gates
|
// Skip always open and non-open gates
|
||||||
if (p.isAlwaysOn()) continue;
|
if (portal.isAlwaysOn() || !portal.isOpen()) {
|
||||||
if (!p.isOpen()) continue;
|
continue;
|
||||||
if (time > p.getOpenTime() + Stargate.getOpenTime()) {
|
}
|
||||||
p.close(false);
|
if (time > portal.getOpenTime() + Stargate.getOpenTime()) {
|
||||||
|
portal.close(false);
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Deactivate active portals
|
// Deactivate active portals
|
||||||
for (Iterator<Portal> iterator = Stargate.activeList.iterator(); iterator.hasNext(); ) {
|
for (Iterator<Portal> iterator = Stargate.activeList.iterator(); iterator.hasNext(); ) {
|
||||||
Portal p = iterator.next();
|
Portal portal = iterator.next();
|
||||||
if (!p.isActive()) continue;
|
if (!portal.isActive()) {
|
||||||
if (time > p.getOpenTime() + Stargate.getActiveTime()) {
|
continue;
|
||||||
p.deactivate();
|
}
|
||||||
|
if (time > portal.getOpenTime() + Stargate.getActiveTime()) {
|
||||||
|
portal.deactivate();
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user