Reduce paint time down to 30 seconds

This commit is contained in:
Graphica 2017-05-27 17:58:53 -05:00 committed by cnr
parent 6b2a99a881
commit 9c48919e42

View File

@ -53,7 +53,7 @@ public class MorphBobRoss extends MorphGadget
private static final int DESTROY_LIMIT = 20; private static final int DESTROY_LIMIT = 20;
/** The # of minutes for which paint blocks exist */ /** The # of minutes for which paint blocks exist */
private static final int PAINT_MINUTES = 1; private static final int PAINT_SECONDS = 30;
/** Height above a player's location at which quotes are to be displayed */ /** Height above a player's location at which quotes are to be displayed */
private static final double QUOTE_HEIGHT = 2.25; private static final double QUOTE_HEIGHT = 2.25;
@ -278,20 +278,26 @@ public class MorphBobRoss extends MorphGadget
if (event.getType() == UpdateType.FASTER) // do paint removal if (event.getType() == UpdateType.FASTER) // do paint removal
{ {
int limit = 0; int limit = 0;
int offset = 0;
// destroy up to 20 paint blocks that are older than a set number of minutes // destroy up to 20 paint blocks that are older than a set number of minutes
while (!_paintBlocks.isEmpty() while (!_paintBlocks.isEmpty()
&& _paintBlocks.get(0).time < System.currentTimeMillis() - TimeUnit.MINUTES.toMillis(PAINT_MINUTES) && offset < _paintBlocks.size()
&& _paintBlocks.get(offset).time < System.currentTimeMillis() - TimeUnit.SECONDS.toMillis(PAINT_SECONDS)
&& limit < DESTROY_LIMIT) && limit < DESTROY_LIMIT)
{ {
Block block = _paintBlocks.remove(0).block; Block block = _paintBlocks.get(0).block;
if (block.getType() == Material.CARPET) if (block.getType() == Material.CARPET)
{ {
_paintBlocks.remove(0);
block.setType(Material.AIR); block.setType(Material.AIR);
limit++;
}
else
{
offset++;
} }
limit++;
} }
} }
else if (event.getType() == UpdateType.TICK) // do random quote displaying else if (event.getType() == UpdateType.TICK) // do random quote displaying