Compare commits

...

2 Commits

Author SHA1 Message Date
thatsIch e712a9d8ce Merge pull request #640 from thatsIch/b-639-crash-on-disabled-channels
Fixes #639 Missing null check for people with disabled channels
2014-12-28 18:38:56 +01:00
thatsIch 0cb58b4d93 Fixes #639 Missing null check for people with disabled channels 2014-12-28 18:00:04 +01:00
@@ -121,18 +121,18 @@ public enum Achievements
public Achievement getAchievement() public Achievement getAchievement()
{ {
if ( stat == null && stack != null ) if ( this.stat == null && this.stack != null )
{ {
stat = new Achievement( "achievement.ae2." + name(), "ae2." + name(), x, y, stack, parent ); this.stat = new Achievement( "achievement.ae2." + this.name(), "ae2." + this.name(), this.x, this.y, this.stack, this.parent );
stat.registerStat(); this.stat.registerStat();
} }
return stat; return this.stat;
} }
private Achievements( int x, int y, AEColoredItemDefinition which, AchievementType type ) private Achievements( int x, int y, AEColoredItemDefinition which, AchievementType type )
{ {
stack = which.stack( AEColor.Transparent, 1 ); this.stack = (which != null) ? which.stack( AEColor.Transparent, 1 ) : null;
this.type = type; this.type = type;
this.x = x; this.x = x;
this.y = y; this.y = y;
@@ -140,7 +140,7 @@ public enum Achievements
private Achievements( int x, int y, AEItemDefinition which, AchievementType type ) private Achievements( int x, int y, AEItemDefinition which, AchievementType type )
{ {
stack = which.stack( 1 ); this.stack = (which != null) ? which.stack( 1 ) : null;
this.type = type; this.type = type;
this.x = x; this.x = x;
this.y = y; this.y = y;
@@ -148,7 +148,7 @@ public enum Achievements
private Achievements( int x, int y, ItemStack which, AchievementType type ) private Achievements( int x, int y, ItemStack which, AchievementType type )
{ {
stack = which; this.stack = which;
this.type = type; this.type = type;
this.x = x; this.x = x;
this.y = y; this.y = y;
@@ -156,7 +156,7 @@ public enum Achievements
public void addToPlayer( EntityPlayer player ) public void addToPlayer( EntityPlayer player )
{ {
player.addStat( getAchievement(), 1 ); player.addStat( this.getAchievement(), 1 );
} }
} }