Basic reformat, hit once, hope never again
This commit is contained in:
@@ -66,7 +66,7 @@ public class CompassService implements ThreadFactory
|
||||
|
||||
public void cleanUp()
|
||||
{
|
||||
for ( CompassReader cr : this.worldSet.values() )
|
||||
for( CompassReader cr : this.worldSet.values() )
|
||||
cr.close();
|
||||
}
|
||||
|
||||
@@ -100,16 +100,16 @@ public class CompassService implements ThreadFactory
|
||||
// lower level...
|
||||
Chunk c = w.getChunkFromBlockCoords( x, z );
|
||||
|
||||
for ( Block skyStoneBlock : AEApi.instance().definitions().blocks().skyStone().maybeBlock().asSet() )
|
||||
for( Block skyStoneBlock : AEApi.instance().definitions().blocks().skyStone().maybeBlock().asSet() )
|
||||
{
|
||||
for ( int i = 0; i < CHUNK_SIZE; i++ )
|
||||
for( int i = 0; i < CHUNK_SIZE; i++ )
|
||||
{
|
||||
for ( int j = 0; j < CHUNK_SIZE; j++ )
|
||||
for( int j = 0; j < CHUNK_SIZE; j++ )
|
||||
{
|
||||
for ( int k = low_y; k < hi_y; k++ )
|
||||
for( int k = low_y; k < hi_y; k++ )
|
||||
{
|
||||
Block blk = c.getBlock( i, k, j );
|
||||
if ( blk == skyStoneBlock && c.getBlockMetadata( i, k, j ) == 0 )
|
||||
if( blk == skyStoneBlock && c.getBlockMetadata( i, k, j ) == 0 )
|
||||
{
|
||||
return this.executor.submit( new CMUpdatePost( w, cx, cz, cdy, true ) );
|
||||
}
|
||||
@@ -125,7 +125,7 @@ public class CompassService implements ThreadFactory
|
||||
{
|
||||
CompassReader cr = this.worldSet.get( w );
|
||||
|
||||
if ( cr == null )
|
||||
if( cr == null )
|
||||
{
|
||||
cr = new CompassReader( w.provider.dimensionId, this.rootFolder );
|
||||
this.worldSet.put( w, cr );
|
||||
@@ -159,14 +159,14 @@ public class CompassService implements ThreadFactory
|
||||
this.executor.awaitTermination( 6, TimeUnit.MINUTES );
|
||||
this.jobSize = 0;
|
||||
|
||||
for ( CompassReader cr : this.worldSet.values() )
|
||||
for( CompassReader cr : this.worldSet.values() )
|
||||
{
|
||||
cr.close();
|
||||
}
|
||||
|
||||
this.worldSet.clear();
|
||||
}
|
||||
catch ( InterruptedException e )
|
||||
catch( InterruptedException e )
|
||||
{
|
||||
// wrap this up..
|
||||
}
|
||||
@@ -178,7 +178,6 @@ public class CompassService implements ThreadFactory
|
||||
return new Thread( job, "AE Compass Service" );
|
||||
}
|
||||
|
||||
|
||||
private class CMUpdatePost implements Runnable
|
||||
{
|
||||
|
||||
@@ -206,7 +205,7 @@ public class CompassService implements ThreadFactory
|
||||
CompassReader cr = CompassService.this.getReader( this.world );
|
||||
cr.setHasBeacon( this.chunkX, this.chunkZ, this.doubleChunkY, this.value );
|
||||
|
||||
if ( CompassService.this.jobSize() < 2 )
|
||||
if( CompassService.this.jobSize() < 2 )
|
||||
CompassService.this.cleanUp();
|
||||
}
|
||||
}
|
||||
@@ -237,18 +236,18 @@ public class CompassService implements ThreadFactory
|
||||
CompassReader cr = CompassService.this.getReader( this.coord.getWorld() );
|
||||
|
||||
// Am I standing on it?
|
||||
if ( cr.hasBeacon( cx, cz ) )
|
||||
if( cr.hasBeacon( cx, cz ) )
|
||||
{
|
||||
this.callback.calculatedDirection( true, true, -999, 0 );
|
||||
|
||||
if ( CompassService.this.jobSize() < 2 )
|
||||
if( CompassService.this.jobSize() < 2 )
|
||||
CompassService.this.cleanUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// spiral outward...
|
||||
for ( int offset = 1; offset < this.maxRange; offset++ )
|
||||
for( int offset = 1; offset < this.maxRange; offset++ )
|
||||
{
|
||||
int minX = cx - offset;
|
||||
int minZ = cz - offset;
|
||||
@@ -259,12 +258,12 @@ public class CompassService implements ThreadFactory
|
||||
int chosen_x = cx;
|
||||
int chosen_z = cz;
|
||||
|
||||
for ( int z = minZ; z <= maxZ; z++ )
|
||||
for( int z = minZ; z <= maxZ; z++ )
|
||||
{
|
||||
if ( cr.hasBeacon( minX, z ) )
|
||||
if( cr.hasBeacon( minX, z ) )
|
||||
{
|
||||
int closeness = CompassService.this.dist( cx, cz, minX, z );
|
||||
if ( closeness < closest )
|
||||
if( closeness < closest )
|
||||
{
|
||||
closest = closeness;
|
||||
chosen_x = minX;
|
||||
@@ -272,10 +271,10 @@ public class CompassService implements ThreadFactory
|
||||
}
|
||||
}
|
||||
|
||||
if ( cr.hasBeacon( maxX, z ) )
|
||||
if( cr.hasBeacon( maxX, z ) )
|
||||
{
|
||||
int closeness = CompassService.this.dist( cx, cz, maxX, z );
|
||||
if ( closeness < closest )
|
||||
if( closeness < closest )
|
||||
{
|
||||
closest = closeness;
|
||||
chosen_x = maxX;
|
||||
@@ -284,12 +283,12 @@ public class CompassService implements ThreadFactory
|
||||
}
|
||||
}
|
||||
|
||||
for ( int x = minX + 1; x < maxX; x++ )
|
||||
for( int x = minX + 1; x < maxX; x++ )
|
||||
{
|
||||
if ( cr.hasBeacon( x, minZ ) )
|
||||
if( cr.hasBeacon( x, minZ ) )
|
||||
{
|
||||
int closeness = CompassService.this.dist( cx, cz, x, minZ );
|
||||
if ( closeness < closest )
|
||||
if( closeness < closest )
|
||||
{
|
||||
closest = closeness;
|
||||
chosen_x = x;
|
||||
@@ -297,10 +296,10 @@ public class CompassService implements ThreadFactory
|
||||
}
|
||||
}
|
||||
|
||||
if ( cr.hasBeacon( x, maxZ ) )
|
||||
if( cr.hasBeacon( x, maxZ ) )
|
||||
{
|
||||
int closeness = CompassService.this.dist( cx, cz, x, maxZ );
|
||||
if ( closeness < closest )
|
||||
if( closeness < closest )
|
||||
{
|
||||
closest = closeness;
|
||||
chosen_x = x;
|
||||
@@ -309,11 +308,11 @@ public class CompassService implements ThreadFactory
|
||||
}
|
||||
}
|
||||
|
||||
if ( closest < Integer.MAX_VALUE )
|
||||
if( closest < Integer.MAX_VALUE )
|
||||
{
|
||||
this.callback.calculatedDirection( true, false, CompassService.this.rad( cx, cz, chosen_x, chosen_z ), CompassService.this.dist( cx, cz, chosen_x, chosen_z ) );
|
||||
|
||||
if ( CompassService.this.jobSize() < 2 )
|
||||
if( CompassService.this.jobSize() < 2 )
|
||||
CompassService.this.cleanUp();
|
||||
|
||||
return;
|
||||
@@ -323,7 +322,7 @@ public class CompassService implements ThreadFactory
|
||||
// didn't find shit...
|
||||
this.callback.calculatedDirection( false, true, -999, 999 );
|
||||
|
||||
if ( CompassService.this.jobSize() < 2 )
|
||||
if( CompassService.this.jobSize() < 2 )
|
||||
CompassService.this.cleanUp();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,13 +29,13 @@ import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.services.version.github.FormattedRelease;
|
||||
import appeng.services.version.github.ReleaseFetcher;
|
||||
import appeng.services.version.ModVersionFetcher;
|
||||
import appeng.services.version.Version;
|
||||
import appeng.services.version.VersionCheckerConfig;
|
||||
import appeng.services.version.VersionFetcher;
|
||||
import appeng.services.version.VersionParser;
|
||||
import appeng.services.version.github.FormattedRelease;
|
||||
import appeng.services.version.github.ReleaseFetcher;
|
||||
|
||||
|
||||
/**
|
||||
@@ -91,12 +91,12 @@ public final class VersionChecker implements Runnable
|
||||
/**
|
||||
* checks if enough time since last check has expired
|
||||
*
|
||||
* @param nowInMs now in milli seconds
|
||||
* @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 )
|
||||
{
|
||||
if ( nowInMs > lastAfterInterval )
|
||||
if( nowInMs > lastAfterInterval )
|
||||
{
|
||||
final String rawModVersion = AEConfig.VERSION;
|
||||
final VersionParser parser = new VersionParser();
|
||||
@@ -118,7 +118,7 @@ public final class VersionChecker implements Runnable
|
||||
* Checks if the retrieved version is newer as the current mod version.
|
||||
* Will notify player if config is enabled.
|
||||
*
|
||||
* @param modVersion version of mod
|
||||
* @param modVersion version of mod
|
||||
* @param githubRelease release retrieved through github
|
||||
*/
|
||||
private void processVersions( Version modVersion, FormattedRelease githubRelease )
|
||||
@@ -127,15 +127,15 @@ public final class VersionChecker implements Runnable
|
||||
final String modFormatted = modVersion.formatted();
|
||||
final String ghFormatted = githubVersion.formatted();
|
||||
|
||||
if ( githubVersion.isNewerAs( modVersion ) )
|
||||
if( githubVersion.isNewerAs( modVersion ) )
|
||||
{
|
||||
final String changelog = githubRelease.changelog();
|
||||
|
||||
if ( this.config.shouldNotifyPlayer() )
|
||||
if( this.config.shouldNotifyPlayer() )
|
||||
{
|
||||
AELog.info( "Newer version is available: " + ghFormatted + " (found) > " + modFormatted + " (current)" );
|
||||
|
||||
if ( this.config.shouldPostChangelog() )
|
||||
if( this.config.shouldPostChangelog() )
|
||||
{
|
||||
AELog.info( "Changelog: " + changelog );
|
||||
}
|
||||
@@ -145,7 +145,7 @@ public final class VersionChecker implements Runnable
|
||||
}
|
||||
else
|
||||
{
|
||||
AELog.info( "No newer version is available: " + ghFormatted + "(found) < " + modFormatted + " (current)");
|
||||
AELog.info( "No newer version is available: " + ghFormatted + "(found) < " + modFormatted + " (current)" );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,12 +153,12 @@ public final class VersionChecker implements Runnable
|
||||
* Checks if the version checker mod is installed and handles it depending on that information
|
||||
*
|
||||
* @param modFormatted mod version formatted as rv2-beta-8
|
||||
* @param ghFormatted retrieved github version formatted as rv2-beta-8
|
||||
* @param changelog retrieved github changelog
|
||||
* @param ghFormatted retrieved github version formatted as rv2-beta-8
|
||||
* @param changelog retrieved github changelog
|
||||
*/
|
||||
private void interactWithVersionCheckerMod( String modFormatted, String ghFormatted, String changelog )
|
||||
{
|
||||
if ( Loader.isModLoaded( "VersionChecker" ) )
|
||||
if( Loader.isModLoaded( "VersionChecker" ) )
|
||||
{
|
||||
final NBTTagCompound versionInf = new NBTTagCompound();
|
||||
versionInf.setString( "modDisplayName", AppEng.MOD_NAME );
|
||||
@@ -167,7 +167,7 @@ public final class VersionChecker implements Runnable
|
||||
versionInf.setString( "updateUrl", "http://ae-mod.info/builds/appliedenergistics2-" + ghFormatted + ".jar" );
|
||||
versionInf.setBoolean( "isDirectLink", true );
|
||||
|
||||
if ( !changelog.isEmpty() )
|
||||
if( !changelog.isEmpty() )
|
||||
{
|
||||
versionInf.setString( "changeLog", changelog );
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.services.compass;
|
||||
|
||||
|
||||
public class CompassException extends RuntimeException
|
||||
{
|
||||
|
||||
@@ -25,8 +26,8 @@ public class CompassException extends RuntimeException
|
||||
|
||||
public final Throwable inner;
|
||||
|
||||
public CompassException(Throwable t) {
|
||||
public CompassException( Throwable t )
|
||||
{
|
||||
this.inner = t;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.services.compass;
|
||||
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
|
||||
@@ -28,9 +29,15 @@ public class CompassReader
|
||||
private final int dimensionId;
|
||||
private final File rootFolder;
|
||||
|
||||
public CompassReader( int dimensionId, File rootFolder )
|
||||
{
|
||||
this.dimensionId = dimensionId;
|
||||
this.rootFolder = rootFolder;
|
||||
}
|
||||
|
||||
public void close()
|
||||
{
|
||||
for (CompassRegion r : this.regions.values())
|
||||
for( CompassRegion r : this.regions.values() )
|
||||
{
|
||||
r.close();
|
||||
}
|
||||
@@ -38,39 +45,31 @@ public class CompassReader
|
||||
this.regions.clear();
|
||||
}
|
||||
|
||||
public CompassReader(int dimensionId, File rootFolder)
|
||||
{
|
||||
this.dimensionId = dimensionId;
|
||||
this.rootFolder = rootFolder;
|
||||
}
|
||||
|
||||
public void setHasBeacon(int cx, int cz, int cdy, boolean hasBeacon)
|
||||
public void setHasBeacon( int cx, int cz, int cdy, boolean hasBeacon )
|
||||
{
|
||||
CompassRegion r = this.getRegion( cx, cz );
|
||||
r.setHasBeacon( cx, cz, cdy, hasBeacon );
|
||||
}
|
||||
|
||||
public boolean hasBeacon(int cx, int cz)
|
||||
{
|
||||
CompassRegion r = this.getRegion( cx, cz );
|
||||
return r.hasBeacon( cx, cz );
|
||||
}
|
||||
|
||||
private CompassRegion getRegion(int cx, int cz)
|
||||
private CompassRegion getRegion( int cx, int cz )
|
||||
{
|
||||
long pos = cx >> 10;
|
||||
pos <<= 32;
|
||||
pos |= ( cz >> 10 );
|
||||
|
||||
CompassRegion cr = this.regions.get( pos );
|
||||
if ( cr == null )
|
||||
if( cr == null )
|
||||
{
|
||||
cr = new CompassRegion( cx, cz, this.dimensionId, this.rootFolder );
|
||||
this.regions.put( pos, cr );
|
||||
}
|
||||
|
||||
return cr;
|
||||
|
||||
}
|
||||
|
||||
public boolean hasBeacon( int cx, int cz )
|
||||
{
|
||||
CompassRegion r = this.getRegion( cx, cz );
|
||||
return r.hasBeacon( cx, cz );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,11 +59,52 @@ public class CompassRegion
|
||||
this.openFile( false );
|
||||
}
|
||||
|
||||
private void openFile( boolean create )
|
||||
{
|
||||
File fName = this.getFileName();
|
||||
if( this.hasFile )
|
||||
return;
|
||||
|
||||
if( create || this.fileExists( fName ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
this.raf = new RandomAccessFile( fName, "rw" );
|
||||
FileChannel fc = this.raf.getChannel();
|
||||
this.buffer = fc.map( FileChannel.MapMode.READ_WRITE, 0, 0x400 * 0x400 );// fc.size() );
|
||||
this.hasFile = true;
|
||||
}
|
||||
catch( Throwable t )
|
||||
{
|
||||
throw new CompassException( t );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private File getFileName()
|
||||
{
|
||||
String folder = this.rootFolder.getPath() + File.separatorChar + "compass";
|
||||
File folderFile = new File( folder );
|
||||
|
||||
if( !folderFile.exists() || !folderFile.isDirectory() )
|
||||
{
|
||||
if( !folderFile.mkdir() )
|
||||
AELog.info( "Failed to create AE2/compass/" );
|
||||
}
|
||||
|
||||
return new File( folder, this.world + '_' + this.low_x + '_' + this.low_z + ".dat" );
|
||||
}
|
||||
|
||||
private boolean fileExists( File name )
|
||||
{
|
||||
return name.exists() && name.isFile();
|
||||
}
|
||||
|
||||
public void close()
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( this.hasFile )
|
||||
if( this.hasFile )
|
||||
{
|
||||
this.buffer = null;
|
||||
this.raf.close();
|
||||
@@ -71,7 +112,7 @@ public class CompassRegion
|
||||
this.hasFile = false;
|
||||
}
|
||||
}
|
||||
catch ( Throwable t )
|
||||
catch( Throwable t )
|
||||
{
|
||||
throw new CompassException( t );
|
||||
}
|
||||
@@ -79,55 +120,19 @@ public class CompassRegion
|
||||
|
||||
public boolean hasBeacon( int cx, int cz )
|
||||
{
|
||||
if ( this.hasFile )
|
||||
if( this.hasFile )
|
||||
{
|
||||
cx &= 0x3FF;
|
||||
cz &= 0x3FF;
|
||||
|
||||
int val = this.read( cx, cz );
|
||||
if ( val != 0 )
|
||||
if( val != 0 )
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setHasBeacon( int cx, int cz, int cdy, boolean hasBeacon )
|
||||
{
|
||||
cx &= 0x3FF;
|
||||
cz &= 0x3FF;
|
||||
|
||||
this.openFile( hasBeacon );
|
||||
|
||||
if ( this.hasFile )
|
||||
{
|
||||
int val = this.read( cx, cz );
|
||||
int originalVal = val;
|
||||
|
||||
if ( hasBeacon )
|
||||
val |= 1 << cdy;
|
||||
else
|
||||
val &= ~( 1 << cdy );
|
||||
|
||||
if ( originalVal != val )
|
||||
this.write( cx, cz, val );
|
||||
}
|
||||
}
|
||||
|
||||
private void write( int cx, int cz, int val )
|
||||
{
|
||||
try
|
||||
{
|
||||
this.buffer.put( cx + cz * 0x400, ( byte ) val );
|
||||
// raf.seek( cx + cz * 0x400 );
|
||||
// raf.writeByte( val );
|
||||
}
|
||||
catch ( Throwable t )
|
||||
{
|
||||
throw new CompassException( t );
|
||||
}
|
||||
}
|
||||
|
||||
private int read( int cx, int cz )
|
||||
{
|
||||
try
|
||||
@@ -136,55 +141,49 @@ public class CompassRegion
|
||||
// raf.seek( cx + cz * 0x400 );
|
||||
// return raf.readByte();
|
||||
}
|
||||
catch ( IndexOutOfBoundsException outOfBounds )
|
||||
catch( IndexOutOfBoundsException outOfBounds )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
catch ( Throwable t )
|
||||
catch( Throwable t )
|
||||
{
|
||||
throw new CompassException( t );
|
||||
}
|
||||
}
|
||||
|
||||
private void openFile( boolean create )
|
||||
public void setHasBeacon( int cx, int cz, int cdy, boolean hasBeacon )
|
||||
{
|
||||
File fName = this.getFileName();
|
||||
if ( this.hasFile )
|
||||
return;
|
||||
cx &= 0x3FF;
|
||||
cz &= 0x3FF;
|
||||
|
||||
if ( create || this.fileExists( fName ) )
|
||||
this.openFile( hasBeacon );
|
||||
|
||||
if( this.hasFile )
|
||||
{
|
||||
try
|
||||
{
|
||||
this.raf = new RandomAccessFile( fName, "rw" );
|
||||
FileChannel fc = this.raf.getChannel();
|
||||
this.buffer = fc.map( FileChannel.MapMode.READ_WRITE, 0, 0x400 * 0x400 );// fc.size() );
|
||||
this.hasFile = true;
|
||||
}
|
||||
catch ( Throwable t )
|
||||
{
|
||||
throw new CompassException( t );
|
||||
}
|
||||
}
|
||||
int val = this.read( cx, cz );
|
||||
int originalVal = val;
|
||||
|
||||
if( hasBeacon )
|
||||
val |= 1 << cdy;
|
||||
else
|
||||
val &= ~( 1 << cdy );
|
||||
|
||||
if( originalVal != val )
|
||||
this.write( cx, cz, val );
|
||||
}
|
||||
}
|
||||
|
||||
private boolean fileExists( File name )
|
||||
private void write( int cx, int cz, int val )
|
||||
{
|
||||
return name.exists() && name.isFile();
|
||||
}
|
||||
|
||||
private File getFileName()
|
||||
{
|
||||
String folder = this.rootFolder.getPath() + File.separatorChar + "compass";
|
||||
File folderFile = new File( folder );
|
||||
|
||||
if ( !folderFile.exists() || !folderFile.isDirectory() )
|
||||
try
|
||||
{
|
||||
if ( !folderFile.mkdir() )
|
||||
AELog.info( "Failed to create AE2/compass/" );
|
||||
this.buffer.put( cx + cz * 0x400, (byte) val );
|
||||
// raf.seek( cx + cz * 0x400 );
|
||||
// raf.writeByte( val );
|
||||
}
|
||||
catch( Throwable t )
|
||||
{
|
||||
throw new CompassException( t );
|
||||
}
|
||||
|
||||
return new File( folder, this.world + '_' + this.low_x + '_' + this.low_z + ".dat" );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.services.compass;
|
||||
|
||||
|
||||
public interface ICompassCallback
|
||||
{
|
||||
|
||||
@@ -25,10 +26,9 @@ public interface ICompassCallback
|
||||
* Called from another thread.
|
||||
*
|
||||
* @param hasResult true if found a target
|
||||
* @param spin true if should spin
|
||||
* @param radians radians
|
||||
* @param dist distance
|
||||
* @param spin true if should spin
|
||||
* @param radians radians
|
||||
* @param dist distance
|
||||
*/
|
||||
void calculatedDirection( boolean hasResult, boolean spin, double radians, double dist );
|
||||
|
||||
}
|
||||
|
||||
@@ -14,8 +14,8 @@ public abstract class BaseVersion implements Version
|
||||
|
||||
/**
|
||||
* @param revision revision in natural number
|
||||
* @param channel channel
|
||||
* @param build build in natural number
|
||||
* @param channel channel
|
||||
* @param build build in natural number
|
||||
*
|
||||
* @throws AssertionError if assertion are enabled and revision or build are not natural numbers
|
||||
*/
|
||||
@@ -65,16 +65,16 @@ public abstract class BaseVersion implements Version
|
||||
@Override
|
||||
public final boolean equals( Object o )
|
||||
{
|
||||
if ( this == o )
|
||||
if( this == o )
|
||||
return true;
|
||||
if ( !( o instanceof Version ) )
|
||||
if( !( o instanceof Version ) )
|
||||
return false;
|
||||
|
||||
Version that = (Version) o;
|
||||
|
||||
if ( this.revision != that.revision() )
|
||||
if( this.revision != that.revision() )
|
||||
return false;
|
||||
if ( this.build != that.build() )
|
||||
if( this.build != that.build() )
|
||||
return false;
|
||||
return this.channel == that.channel();
|
||||
}
|
||||
|
||||
@@ -20,12 +20,12 @@ public final class DefaultVersion extends BaseVersion
|
||||
@Override
|
||||
public boolean isNewerAs( Version maybeOlder )
|
||||
{
|
||||
if ( this.revision() > maybeOlder.revision() )
|
||||
if( this.revision() > maybeOlder.revision() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( this.channel().compareTo( maybeOlder.channel() ) > 0 )
|
||||
if( this.channel().compareTo( maybeOlder.channel() ) > 0 )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ public final class ModVersionFetcher implements VersionFetcher
|
||||
@Override
|
||||
public Version get()
|
||||
{
|
||||
if ( this.rawModVersion.equals( "@version@" ) || this.rawModVersion.contains( "pr" ) )
|
||||
if( this.rawModVersion.equals( "@version@" ) || this.rawModVersion.contains( "pr" ) )
|
||||
{
|
||||
return new DoNotCheckVersion();
|
||||
}
|
||||
|
||||
@@ -103,9 +103,9 @@ public final class VersionParser
|
||||
{
|
||||
assert rawChannel.equalsIgnoreCase( Channel.Alpha.name() ) || rawChannel.equalsIgnoreCase( Channel.Beta.name() ) || rawChannel.equalsIgnoreCase( Channel.Release.name() );
|
||||
|
||||
for ( Channel channel : Channel.values() )
|
||||
for( Channel channel : Channel.values() )
|
||||
{
|
||||
if ( channel.name().equalsIgnoreCase( rawChannel ) )
|
||||
if( channel.name().equalsIgnoreCase( rawChannel ) )
|
||||
{
|
||||
return channel;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public final class ReleaseFetcher
|
||||
|
||||
return latestFitRelease;
|
||||
}
|
||||
catch ( Exception e )
|
||||
catch( Exception e )
|
||||
{
|
||||
AELog.error( e );
|
||||
|
||||
@@ -68,14 +68,14 @@ public final class ReleaseFetcher
|
||||
final Channel level = Channel.valueOf( levelInConfig );
|
||||
final int levelOrdinal = level.ordinal();
|
||||
|
||||
for ( Release release : releases )
|
||||
for( Release release : releases )
|
||||
{
|
||||
final String rawVersion = release.tag_name;
|
||||
final String changelog = release.body;
|
||||
|
||||
final Version version = this.parser.parse( rawVersion );
|
||||
|
||||
if ( version.channel().ordinal() >= levelOrdinal )
|
||||
if( version.channel().ordinal() >= levelOrdinal )
|
||||
{
|
||||
return new DefaultFormattedRelease( version, changelog );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user