final variables and parameters
This commit is contained in:
@@ -67,7 +67,7 @@ public final class CompassService
|
||||
this.jobSize = 0;
|
||||
}
|
||||
|
||||
public Future<?> getCompassDirection( DimensionalCoord coord, int maxRange, ICompassCallback cc )
|
||||
public Future<?> getCompassDirection( final DimensionalCoord coord, final int maxRange, final ICompassCallback cc )
|
||||
{
|
||||
this.jobSize++;
|
||||
return this.executor.submit( new CMDirectionRequest( coord, maxRange, cc ) );
|
||||
@@ -79,7 +79,7 @@ public final class CompassService
|
||||
* @param event the event containing the unloaded world.
|
||||
*/
|
||||
@SubscribeEvent
|
||||
public void unloadWorld( WorldEvent.Unload event )
|
||||
public void unloadWorld( final WorldEvent.Unload event )
|
||||
{
|
||||
if( Platform.isServer() && this.worldSet.containsKey( event.world ) )
|
||||
{
|
||||
@@ -102,7 +102,7 @@ public final class CompassService
|
||||
}
|
||||
}
|
||||
|
||||
public void updateArea( World w, int chunkX, int chunkZ )
|
||||
public void updateArea( final World w, final int chunkX, final int chunkZ )
|
||||
{
|
||||
final int x = chunkX << 4;
|
||||
final int z = chunkZ << 4;
|
||||
@@ -118,7 +118,7 @@ public final class CompassService
|
||||
this.updateArea( w, x, CHUNK_SIZE + 224, z );
|
||||
}
|
||||
|
||||
public Future<?> updateArea( World w, int x, int y, int z )
|
||||
public Future<?> updateArea( final World w, final int x, final int y, final int z )
|
||||
{
|
||||
this.jobSize++;
|
||||
|
||||
@@ -140,7 +140,7 @@ public final class CompassService
|
||||
{
|
||||
for( int k = low_y; k < hi_y; k++ )
|
||||
{
|
||||
Block blk = c.getBlock( i, k, j );
|
||||
final Block blk = c.getBlock( i, k, j );
|
||||
if( blk == skyStoneBlock )
|
||||
{
|
||||
return this.executor.submit( new CMUpdatePost( w, cx, cz, cdy, true ) );
|
||||
@@ -175,7 +175,7 @@ public final class CompassService
|
||||
}
|
||||
}
|
||||
|
||||
private CompassReader getReader( World w )
|
||||
private CompassReader getReader( final World w )
|
||||
{
|
||||
CompassReader cr = this.worldSet.get( w );
|
||||
|
||||
@@ -188,7 +188,7 @@ public final class CompassService
|
||||
return cr;
|
||||
}
|
||||
|
||||
private int dist( int ax, int az, int bx, int bz )
|
||||
private int dist( final int ax, final int az, final int bx, final int bz )
|
||||
{
|
||||
final int up = ( bz - az ) * CHUNK_SIZE;
|
||||
final int side = ( bx - ax ) * CHUNK_SIZE;
|
||||
@@ -196,7 +196,7 @@ public final class CompassService
|
||||
return up * up + side * side;
|
||||
}
|
||||
|
||||
private double rad( int ax, int az, int bx, int bz )
|
||||
private double rad( final int ax, final int az, final int bx, final int bz )
|
||||
{
|
||||
final int up = bz - az;
|
||||
final int side = bx - ax;
|
||||
@@ -214,7 +214,7 @@ public final class CompassService
|
||||
public final int doubleChunkY; // 32 blocks instead of 16.
|
||||
public final boolean value;
|
||||
|
||||
public CMUpdatePost( World w, int cx, int cz, int dcy, boolean val )
|
||||
public CMUpdatePost( final World w, final int cx, final int cz, final int dcy, final boolean val )
|
||||
{
|
||||
this.world = w;
|
||||
this.chunkX = cx;
|
||||
@@ -246,7 +246,7 @@ public final class CompassService
|
||||
public final DimensionalCoord coord;
|
||||
public final ICompassCallback callback;
|
||||
|
||||
public CMDirectionRequest( DimensionalCoord coord, int getMaxRange, ICompassCallback cc )
|
||||
public CMDirectionRequest( final DimensionalCoord coord, final int getMaxRange, final ICompassCallback cc )
|
||||
{
|
||||
this.coord = coord;
|
||||
this.maxRange = getMaxRange;
|
||||
|
||||
@@ -64,7 +64,7 @@ public final class VersionChecker implements Runnable
|
||||
private static final int MS_TO_SEC = 1000;
|
||||
private final VersionCheckerConfig config;
|
||||
|
||||
public VersionChecker( VersionCheckerConfig config )
|
||||
public VersionChecker( final VersionCheckerConfig config )
|
||||
{
|
||||
this.config = config;
|
||||
}
|
||||
@@ -92,7 +92,7 @@ public final class VersionChecker implements Runnable
|
||||
* @param nowInMs now in milli seconds
|
||||
* @param lastAfterInterval last version check including the interval defined in the config
|
||||
*/
|
||||
private void processInterval( long nowInMs, long lastAfterInterval )
|
||||
private void processInterval( final long nowInMs, final long lastAfterInterval )
|
||||
{
|
||||
if( nowInMs > lastAfterInterval )
|
||||
{
|
||||
@@ -119,7 +119,7 @@ public final class VersionChecker implements Runnable
|
||||
* @param modVersion version of mod
|
||||
* @param githubRelease release retrieved through github
|
||||
*/
|
||||
private void processVersions( Version modVersion, FormattedRelease githubRelease )
|
||||
private void processVersions( final Version modVersion, final FormattedRelease githubRelease )
|
||||
{
|
||||
final Version githubVersion = githubRelease.version();
|
||||
final String modFormatted = modVersion.formatted();
|
||||
@@ -154,7 +154,7 @@ public final class VersionChecker implements Runnable
|
||||
* @param ghFormatted retrieved github version formatted as rv2-beta-8
|
||||
* @param changelog retrieved github changelog
|
||||
*/
|
||||
private void interactWithVersionCheckerMod( String modFormatted, String ghFormatted, String changelog )
|
||||
private void interactWithVersionCheckerMod( final String modFormatted, final String ghFormatted, final String changelog )
|
||||
{
|
||||
if( Loader.isModLoaded( "VersionChecker" ) )
|
||||
{
|
||||
|
||||
@@ -26,7 +26,7 @@ public class CompassException extends RuntimeException
|
||||
|
||||
public final Throwable inner;
|
||||
|
||||
public CompassException( Throwable t )
|
||||
public CompassException( final Throwable t )
|
||||
{
|
||||
this.inner = t;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public final class CompassReader
|
||||
private final int dimensionId;
|
||||
private final File worldCompassFolder;
|
||||
|
||||
public CompassReader( int dimensionId, @Nonnull final File worldCompassFolder )
|
||||
public CompassReader( final int dimensionId, @Nonnull final File worldCompassFolder )
|
||||
{
|
||||
Preconditions.checkNotNull( worldCompassFolder );
|
||||
Preconditions.checkArgument( worldCompassFolder.isDirectory() );
|
||||
@@ -45,7 +45,7 @@ public final class CompassReader
|
||||
|
||||
public void close()
|
||||
{
|
||||
for( CompassRegion r : this.regions.values() )
|
||||
for( final CompassRegion r : this.regions.values() )
|
||||
{
|
||||
r.close();
|
||||
}
|
||||
@@ -53,21 +53,21 @@ public final class CompassReader
|
||||
this.regions.clear();
|
||||
}
|
||||
|
||||
public void setHasBeacon( int cx, int cz, int cdy, boolean hasBeacon )
|
||||
public void setHasBeacon( final int cx, final int cz, final int cdy, final boolean hasBeacon )
|
||||
{
|
||||
final CompassRegion r = this.getRegion( cx, cz );
|
||||
|
||||
r.setHasBeacon( cx, cz, cdy, hasBeacon );
|
||||
}
|
||||
|
||||
public boolean hasBeacon( int cx, int cz )
|
||||
public boolean hasBeacon( final int cx, final int cz )
|
||||
{
|
||||
final CompassRegion r = this.getRegion( cx, cz );
|
||||
|
||||
return r.hasBeacon( cx, cz );
|
||||
}
|
||||
|
||||
private CompassRegion getRegion( int cx, int cz )
|
||||
private CompassRegion getRegion( final int cx, final int cz )
|
||||
{
|
||||
long pos = cx >> 10;
|
||||
pos <<= 32;
|
||||
|
||||
@@ -43,7 +43,7 @@ public final class CompassRegion
|
||||
private RandomAccessFile raf = null;
|
||||
private ByteBuffer buffer;
|
||||
|
||||
public CompassRegion( int cx, int cz, int worldID, @Nonnull final File worldCompassFolder )
|
||||
public CompassRegion( final int cx, final int cz, final int worldID, @Nonnull final File worldCompassFolder )
|
||||
{
|
||||
Preconditions.checkNotNull( worldCompassFolder );
|
||||
Preconditions.checkArgument( worldCompassFolder.isDirectory() );
|
||||
@@ -73,7 +73,7 @@ public final class CompassRegion
|
||||
this.hasFile = false;
|
||||
}
|
||||
}
|
||||
catch( Throwable t )
|
||||
catch( final Throwable t )
|
||||
{
|
||||
throw new CompassException( t );
|
||||
}
|
||||
@@ -96,7 +96,7 @@ public final class CompassRegion
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setHasBeacon( int cx, int cz, int cdy, boolean hasBeacon )
|
||||
public void setHasBeacon( int cx, int cz, final int cdy, final boolean hasBeacon )
|
||||
{
|
||||
cx &= 0x3FF;
|
||||
cz &= 0x3FF;
|
||||
@@ -141,7 +141,7 @@ public final class CompassRegion
|
||||
|
||||
}
|
||||
|
||||
private void openFile( boolean create )
|
||||
private void openFile( final boolean create )
|
||||
{
|
||||
if( this.hasFile )
|
||||
{
|
||||
@@ -172,12 +172,12 @@ public final class CompassRegion
|
||||
return new File( this.worldCompassFolder, fileName );
|
||||
}
|
||||
|
||||
private boolean isFileExistent( File file )
|
||||
private boolean isFileExistent( final File file )
|
||||
{
|
||||
return file.exists() && file.isFile();
|
||||
}
|
||||
|
||||
private int read( int cx, int cz )
|
||||
private int read( final int cx, final int cz )
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -185,17 +185,17 @@ public final class CompassRegion
|
||||
// raf.seek( cx + cz * 0x400 );
|
||||
// return raf.readByte();
|
||||
}
|
||||
catch( IndexOutOfBoundsException outOfBounds )
|
||||
catch( final IndexOutOfBoundsException outOfBounds )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
catch( Throwable t )
|
||||
catch( final Throwable t )
|
||||
{
|
||||
throw new CompassException( t );
|
||||
}
|
||||
}
|
||||
|
||||
private void write( int cx, int cz, int val )
|
||||
private void write( final int cx, final int cz, final int val )
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -203,7 +203,7 @@ public final class CompassRegion
|
||||
// raf.seek( cx + cz * 0x400 );
|
||||
// raf.writeByte( val );
|
||||
}
|
||||
catch( Throwable t )
|
||||
catch( final Throwable t )
|
||||
{
|
||||
throw new CompassException( t );
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ public abstract class BaseVersion implements Version
|
||||
*
|
||||
* @throws AssertionError if assertion are enabled and revision or build are not natural numbers
|
||||
*/
|
||||
public BaseVersion( int revision, Channel channel, int build )
|
||||
public BaseVersion( final int revision, final Channel channel, final int build )
|
||||
{
|
||||
assert revision >= 0;
|
||||
assert build >= 0;
|
||||
@@ -63,7 +63,7 @@ public abstract class BaseVersion implements Version
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean equals( Object o )
|
||||
public final boolean equals( final Object o )
|
||||
{
|
||||
if( this == o )
|
||||
{
|
||||
@@ -74,7 +74,7 @@ public abstract class BaseVersion implements Version
|
||||
return false;
|
||||
}
|
||||
|
||||
Version that = (Version) o;
|
||||
final Version that = (Version) o;
|
||||
|
||||
if( this.revision != that.revision() )
|
||||
{
|
||||
|
||||
@@ -12,13 +12,13 @@ public final class DefaultVersion extends BaseVersion
|
||||
* @param channel either alpha, beta or release
|
||||
* @param build natural number
|
||||
*/
|
||||
public DefaultVersion( int revision, Channel channel, int build )
|
||||
public DefaultVersion( final int revision, final Channel channel, final int build )
|
||||
{
|
||||
super( revision, channel, build );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNewerAs( Version maybeOlder )
|
||||
public boolean isNewerAs( final Version maybeOlder )
|
||||
{
|
||||
if( this.revision() > maybeOlder.revision() )
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@ public final class DoNotCheckVersion extends BaseVersion
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNewerAs( Version maybeOlder )
|
||||
public boolean isNewerAs( final Version maybeOlder )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ public final class MissingVersion extends BaseVersion
|
||||
* @return false
|
||||
*/
|
||||
@Override
|
||||
public boolean isNewerAs( Version maybeOlder )
|
||||
public boolean isNewerAs( final Version maybeOlder )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ public final class ModVersionFetcher implements VersionFetcher
|
||||
private final String rawModVersion;
|
||||
private final VersionParser parser;
|
||||
|
||||
public ModVersionFetcher( String rawModVersion, VersionParser parser )
|
||||
public ModVersionFetcher( final String rawModVersion, final VersionParser parser )
|
||||
{
|
||||
this.rawModVersion = rawModVersion;
|
||||
this.parser = parser;
|
||||
|
||||
@@ -49,7 +49,7 @@ public final class VersionCheckerConfig
|
||||
/**
|
||||
* @param file requires fully qualified file in which the config is saved
|
||||
*/
|
||||
public VersionCheckerConfig( File file )
|
||||
public VersionCheckerConfig( final File file )
|
||||
{
|
||||
this.config = new Configuration( file );
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ public final class VersionParser
|
||||
*
|
||||
* @throws AssertionError if raw String does not match pattern of a {@link Version}
|
||||
*/
|
||||
public Version parse( String raw )
|
||||
public Version parse( final String raw )
|
||||
{
|
||||
final String transformed = this.transformDelimiter( raw );
|
||||
final String[] split = transformed.split( "_" );
|
||||
@@ -59,7 +59,7 @@ public final class VersionParser
|
||||
*
|
||||
* @return transformed raw, where "." and "-" are replaced by "_"
|
||||
*/
|
||||
private String transformDelimiter( String raw )
|
||||
private String transformDelimiter( final String raw )
|
||||
{
|
||||
assert raw.contains( "." ) || raw.contains( "-" );
|
||||
|
||||
@@ -78,7 +78,7 @@ public final class VersionParser
|
||||
*
|
||||
* @return {@link Version} represented by the splitRaw
|
||||
*/
|
||||
private Version parseVersion( String[] splitRaw )
|
||||
private Version parseVersion( final String[] splitRaw )
|
||||
{
|
||||
assert splitRaw.length == 3;
|
||||
|
||||
@@ -100,7 +100,7 @@ public final class VersionParser
|
||||
*
|
||||
* @return revision number
|
||||
*/
|
||||
private int parseRevision( String rawRevision )
|
||||
private int parseRevision( final String rawRevision )
|
||||
{
|
||||
assert PATTERN_VALID_REVISION.matcher( rawRevision ).matches();
|
||||
|
||||
@@ -120,11 +120,11 @@ public final class VersionParser
|
||||
*
|
||||
* @return matching {@link Channel} to the String
|
||||
*/
|
||||
private Channel parseChannel( String rawChannel )
|
||||
private Channel parseChannel( final String rawChannel )
|
||||
{
|
||||
assert rawChannel.equalsIgnoreCase( Channel.Alpha.name() ) || rawChannel.equalsIgnoreCase( Channel.Beta.name() ) || rawChannel.equalsIgnoreCase( Channel.Stable.name() );
|
||||
|
||||
for( Channel channel : Channel.values() )
|
||||
for( final Channel channel : Channel.values() )
|
||||
{
|
||||
if( channel.name().equalsIgnoreCase( rawChannel ) )
|
||||
{
|
||||
@@ -142,7 +142,7 @@ public final class VersionParser
|
||||
*
|
||||
* @return build number
|
||||
*/
|
||||
private int parseBuild( String rawBuild )
|
||||
private int parseBuild( final String rawBuild )
|
||||
{
|
||||
assert PATTERN_NATURAL.matcher( rawBuild ).matches();
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ public final class DefaultFormattedRelease implements FormattedRelease
|
||||
private final Version version;
|
||||
private final String changelog;
|
||||
|
||||
public DefaultFormattedRelease( Version version, String changelog )
|
||||
public DefaultFormattedRelease( final Version version, final String changelog )
|
||||
{
|
||||
this.version = version;
|
||||
this.changelog = changelog;
|
||||
|
||||
@@ -27,7 +27,7 @@ public final class ReleaseFetcher
|
||||
private final VersionCheckerConfig config;
|
||||
private final VersionParser parser;
|
||||
|
||||
public ReleaseFetcher( VersionCheckerConfig config, VersionParser parser )
|
||||
public ReleaseFetcher( final VersionCheckerConfig config, final VersionParser parser )
|
||||
{
|
||||
this.config = config;
|
||||
this.parser = parser;
|
||||
@@ -50,11 +50,11 @@ public final class ReleaseFetcher
|
||||
|
||||
return latestFitRelease;
|
||||
}
|
||||
catch( MalformedURLException e )
|
||||
catch( final MalformedURLException e )
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
catch( IOException e )
|
||||
catch( final IOException e )
|
||||
{
|
||||
AELog.warning( "Could not connect to %s.", GITHUB_RELEASES_URL );
|
||||
}
|
||||
@@ -62,18 +62,18 @@ public final class ReleaseFetcher
|
||||
return EXCEPTIONAL_RELEASE;
|
||||
}
|
||||
|
||||
private String getRawReleases( URL url ) throws IOException
|
||||
private String getRawReleases( final URL url ) throws IOException
|
||||
{
|
||||
return IOUtils.toString( url );
|
||||
}
|
||||
|
||||
private FormattedRelease getLatestFitRelease( Iterable<Release> releases )
|
||||
private FormattedRelease getLatestFitRelease( final Iterable<Release> releases )
|
||||
{
|
||||
final String levelInConfig = this.config.level();
|
||||
final Channel level = Channel.valueOf( levelInConfig );
|
||||
final int levelOrdinal = level.ordinal();
|
||||
|
||||
for( Release release : releases )
|
||||
for( final Release release : releases )
|
||||
{
|
||||
final String rawVersion = release.tag_name;
|
||||
final String changelog = release.body;
|
||||
|
||||
Reference in New Issue
Block a user