1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-12-12 03:00:30 +00:00

Clean up checkstyle warning

Fixes #251, closes #252
This commit is contained in:
SquidDev 2019-06-14 20:55:32 +01:00
parent 717ab69093
commit 29dce26bf6
4 changed files with 15 additions and 19 deletions

View File

@ -3,10 +3,6 @@
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN" "-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
"https://checkstyle.org/dtds/suppressions_1_2.dtd"> "https://checkstyle.org/dtds/suppressions_1_2.dtd">
<suppressions> <suppressions>
<!-- Has a public m_label field. We need to check if this is used in other projects before renaming it. -->
<suppress checks="MemberName" files=".*[\\/]TileComputerBase.java"
message="Name 'm_label' must match pattern .*" />
<!-- All the config options and method fields. --> <!-- All the config options and method fields. -->
<suppress checks="StaticVariableName" files=".*[\\/]ComputerCraft.java" /> <suppress checks="StaticVariableName" files=".*[\\/]ComputerCraft.java" />
<suppress checks="StaticVariableName" files=".*[\\/]ComputerCraftAPI.java" /> <suppress checks="StaticVariableName" files=".*[\\/]ComputerCraftAPI.java" />

View File

@ -32,7 +32,7 @@ public class TileComputer extends TileComputerBase
ServerComputer computer = new ServerComputer( ServerComputer computer = new ServerComputer(
getWorld(), getWorld(),
id, id,
m_label, label,
instanceID, instanceID,
family, family,
ComputerCraft.terminalWidth_computer, ComputerCraft.terminalWidth_computer,

View File

@ -47,7 +47,7 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT
{ {
private int m_instanceID = -1; private int m_instanceID = -1;
private int m_computerID = -1; private int m_computerID = -1;
protected String m_label = null; protected String label = null;
private boolean m_on = false; private boolean m_on = false;
boolean m_startOn = false; boolean m_startOn = false;
private boolean m_fresh = false; private boolean m_fresh = false;
@ -190,7 +190,7 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT
m_fresh = false; m_fresh = false;
m_computerID = computer.getID(); m_computerID = computer.getID();
m_label = computer.getLabel(); label = computer.getLabel();
m_on = computer.isOn(); m_on = computer.isOn();
if( computer.hasOutputChanged() ) updateOutput(); if( computer.hasOutputChanged() ) updateOutput();
@ -212,9 +212,9 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT
{ {
nbt.setInteger( "computerID", m_computerID ); nbt.setInteger( "computerID", m_computerID );
} }
if( m_label != null ) if( label != null )
{ {
nbt.setString( "label", m_label ); nbt.setString( "label", label );
} }
nbt.setBoolean( "on", m_on ); nbt.setBoolean( "on", m_on );
return super.writeToNBT( nbt ); return super.writeToNBT( nbt );
@ -248,7 +248,7 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT
m_computerID = id; m_computerID = id;
// Load label // Load label
m_label = nbt.hasKey( "label" ) ? nbt.getString( "label" ) : null; label = nbt.hasKey( "label" ) ? nbt.getString( "label" ) : null;
// Load power state // Load power state
m_startOn = nbt.getBoolean( "on" ); m_startOn = nbt.getBoolean( "on" );
@ -361,7 +361,7 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT
@Override @Override
public final String getLabel() public final String getLabel()
{ {
return m_label; return label;
} }
@Override @Override
@ -378,9 +378,9 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT
@Override @Override
public final void setLabel( String label ) public final void setLabel( String label )
{ {
if( getWorld().isRemote || Objects.equals( m_label, label ) ) return; if( getWorld().isRemote || Objects.equals( this.label, label ) ) return;
m_label = label; this.label = label;
ServerComputer computer = getServerComputer(); ServerComputer computer = getServerComputer();
if( computer != null ) computer.setLabel( label ); if( computer != null ) computer.setLabel( label );
markDirty(); markDirty();
@ -454,7 +454,7 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT
{ {
super.writeDescription( nbt ); super.writeDescription( nbt );
if( m_instanceID >= 0 ) nbt.setInteger( "instanceID", m_instanceID ); if( m_instanceID >= 0 ) nbt.setInteger( "instanceID", m_instanceID );
if( m_label != null ) nbt.setString( "label", m_label ); if( label != null ) nbt.setString( "label", label );
if( m_computerID >= 0 ) nbt.setInteger( "computerID", m_computerID ); if( m_computerID >= 0 ) nbt.setInteger( "computerID", m_computerID );
} }
@ -463,7 +463,7 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT
{ {
super.readDescription( nbt ); super.readDescription( nbt );
m_instanceID = nbt.getInteger( "instanceID" ); m_instanceID = nbt.getInteger( "instanceID" );
m_label = nbt.hasKey( "label" ) ? nbt.getString( "label" ) : null; label = nbt.hasKey( "label" ) ? nbt.getString( "label" ) : null;
m_computerID = nbt.hasKey( "computerID" ) ? nbt.getInteger( "computerID" ) : -1; m_computerID = nbt.hasKey( "computerID" ) ? nbt.getInteger( "computerID" ) : -1;
} }
@ -474,7 +474,7 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT
unload(); unload();
m_instanceID = copy.m_instanceID; m_instanceID = copy.m_instanceID;
m_computerID = copy.m_computerID; m_computerID = copy.m_computerID;
m_label = copy.m_label; label = copy.label;
m_on = copy.m_on; m_on = copy.m_on;
m_startOn = copy.m_startOn; m_startOn = copy.m_startOn;
updateBlock(); updateBlock();
@ -493,13 +493,13 @@ public abstract class TileComputerBase extends TileGeneric implements IComputerT
@Override @Override
public String getName() public String getName()
{ {
return hasCustomName() ? m_label : getBlockType().getTranslationKey(); return hasCustomName() ? label : getBlockType().getTranslationKey();
} }
@Override @Override
public boolean hasCustomName() public boolean hasCustomName()
{ {
return !Strings.isNullOrEmpty( m_label ); return !Strings.isNullOrEmpty( label );
} }
@Nonnull @Nonnull

View File

@ -95,7 +95,7 @@ public class TileTurtle extends TileComputerBase implements ITurtleTile, Default
protected ServerComputer createComputer( int instanceID, int id ) protected ServerComputer createComputer( int instanceID, int id )
{ {
ServerComputer computer = new ServerComputer( ServerComputer computer = new ServerComputer(
getWorld(), id, m_label, instanceID, getFamily(), getWorld(), id, label, instanceID, getFamily(),
ComputerCraft.terminalWidth_turtle, ComputerCraft.terminalHeight_turtle ComputerCraft.terminalWidth_turtle, ComputerCraft.terminalHeight_turtle
); );
computer.setPosition( getPos() ); computer.setPosition( getPos() );