More formatting fixes
This commit is contained in:
@@ -53,7 +53,7 @@ public abstract class BaseComponent
|
||||
public static String toLegacyText(BaseComponent[] components)
|
||||
{
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for (BaseComponent msg : components)
|
||||
for ( BaseComponent msg : components )
|
||||
{
|
||||
builder.append( msg.toLegacyText() );
|
||||
}
|
||||
@@ -63,7 +63,7 @@ public abstract class BaseComponent
|
||||
public static String toPlainText(BaseComponent[] components)
|
||||
{
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for (BaseComponent msg : components)
|
||||
for ( BaseComponent msg : components )
|
||||
{
|
||||
builder.append( msg.toPlainText() );
|
||||
}
|
||||
@@ -80,9 +80,9 @@ public abstract class BaseComponent
|
||||
*/
|
||||
public ChatColor getColor()
|
||||
{
|
||||
if (color == null)
|
||||
if ( color == null )
|
||||
{
|
||||
if (parent == null)
|
||||
if ( parent == null )
|
||||
{
|
||||
return ChatColor.WHITE;
|
||||
}
|
||||
@@ -111,7 +111,7 @@ public abstract class BaseComponent
|
||||
*/
|
||||
public boolean isBold()
|
||||
{
|
||||
if (bold == null)
|
||||
if ( bold == null )
|
||||
{
|
||||
return parent != null && parent.isBold();
|
||||
}
|
||||
@@ -138,7 +138,7 @@ public abstract class BaseComponent
|
||||
*/
|
||||
public boolean isItalic()
|
||||
{
|
||||
if (italic == null)
|
||||
if ( italic == null )
|
||||
{
|
||||
return parent != null && parent.isItalic();
|
||||
}
|
||||
@@ -165,7 +165,7 @@ public abstract class BaseComponent
|
||||
*/
|
||||
public boolean isUnderlined()
|
||||
{
|
||||
if (underlined == null)
|
||||
if ( underlined == null )
|
||||
{
|
||||
return parent != null && parent.isUnderlined();
|
||||
}
|
||||
@@ -192,7 +192,7 @@ public abstract class BaseComponent
|
||||
*/
|
||||
public boolean isStrikethrough()
|
||||
{
|
||||
if (strikethrough == null)
|
||||
if ( strikethrough == null )
|
||||
{
|
||||
return parent != null && parent.isStrikethrough();
|
||||
}
|
||||
@@ -219,7 +219,7 @@ public abstract class BaseComponent
|
||||
*/
|
||||
public boolean isObfuscated()
|
||||
{
|
||||
if (obfuscated == null)
|
||||
if ( obfuscated == null )
|
||||
{
|
||||
return parent != null && parent.isObfuscated();
|
||||
}
|
||||
@@ -239,7 +239,7 @@ public abstract class BaseComponent
|
||||
|
||||
public void setExtra(List<BaseComponent> components)
|
||||
{
|
||||
for (BaseComponent component : components)
|
||||
for ( BaseComponent component : components )
|
||||
{
|
||||
component.parent = this;
|
||||
}
|
||||
@@ -265,7 +265,7 @@ public abstract class BaseComponent
|
||||
*/
|
||||
public void addExtra(BaseComponent component)
|
||||
{
|
||||
if (extra == null)
|
||||
if ( extra == null )
|
||||
{
|
||||
extra = new ArrayList<>();
|
||||
}
|
||||
@@ -289,9 +289,9 @@ public abstract class BaseComponent
|
||||
|
||||
protected void toPlainText(StringBuilder builder)
|
||||
{
|
||||
if (extra != null)
|
||||
if ( extra != null )
|
||||
{
|
||||
for (BaseComponent e : extra)
|
||||
for ( BaseComponent e : extra )
|
||||
{
|
||||
e.toPlainText( builder );
|
||||
}
|
||||
@@ -307,9 +307,9 @@ public abstract class BaseComponent
|
||||
|
||||
protected void toLegacyText(StringBuilder builder)
|
||||
{
|
||||
if (extra != null)
|
||||
if ( extra != null )
|
||||
{
|
||||
for (BaseComponent e : extra)
|
||||
for ( BaseComponent e : extra )
|
||||
{
|
||||
e.toLegacyText( builder );
|
||||
}
|
||||
|
@@ -26,18 +26,18 @@ public class TextComponent extends BaseComponent
|
||||
TextComponent component = new TextComponent();
|
||||
Matcher matcher = url.matcher( message );
|
||||
|
||||
for (int i = 0; i < message.length(); i++)
|
||||
for ( int i = 0; i < message.length(); i++ )
|
||||
{
|
||||
char c = message.charAt( i );
|
||||
if (c == ChatColor.COLOR_CHAR)
|
||||
if ( c == ChatColor.COLOR_CHAR )
|
||||
{
|
||||
i++;
|
||||
c = message.charAt( i );
|
||||
if (c >= 'A' && c <= 'Z')
|
||||
if ( c >= 'A' && c <= 'Z' )
|
||||
{
|
||||
c += 32;
|
||||
}
|
||||
if (builder.length() > 0)
|
||||
if ( builder.length() > 0 )
|
||||
{
|
||||
TextComponent old = component;
|
||||
component = new TextComponent( old );
|
||||
@@ -46,7 +46,7 @@ public class TextComponent extends BaseComponent
|
||||
components.add( old );
|
||||
}
|
||||
ChatColor format = ChatColor.getByChar( c );
|
||||
switch (format)
|
||||
switch ( format )
|
||||
{
|
||||
case BOLD:
|
||||
component.setBold( true );
|
||||
@@ -73,11 +73,11 @@ public class TextComponent extends BaseComponent
|
||||
continue;
|
||||
}
|
||||
int pos = message.indexOf( ' ', i );
|
||||
if (pos == -1) pos = message.length();
|
||||
if (matcher.region( i, pos ).find())
|
||||
if ( pos == -1 ) pos = message.length();
|
||||
if ( matcher.region( i, pos ).find() )
|
||||
{ //Web link handling
|
||||
|
||||
if (builder.length() > 0)
|
||||
if ( builder.length() > 0 )
|
||||
{
|
||||
TextComponent old = component;
|
||||
component = new TextComponent( old );
|
||||
@@ -91,7 +91,7 @@ public class TextComponent extends BaseComponent
|
||||
ClickEvent clickEvent = new ClickEvent();
|
||||
clickEvent.setAction( ClickEvent.Action.OPEN_URL );
|
||||
String urlString = message.substring( i, pos );
|
||||
if (urlString.startsWith( "http" ))
|
||||
if ( urlString.startsWith( "http" ) )
|
||||
{
|
||||
component.setText( urlString );
|
||||
clickEvent.setValue( urlString );
|
||||
@@ -108,7 +108,7 @@ public class TextComponent extends BaseComponent
|
||||
}
|
||||
builder.append( c );
|
||||
}
|
||||
if (builder.length() > 0)
|
||||
if ( builder.length() > 0 )
|
||||
{
|
||||
component.setText( builder.toString() );
|
||||
components.add( component );
|
||||
@@ -135,11 +135,11 @@ public class TextComponent extends BaseComponent
|
||||
protected void toLegacyText(StringBuilder builder)
|
||||
{
|
||||
builder.append( getColor() );
|
||||
if (isBold()) builder.append( ChatColor.BOLD );
|
||||
if (isItalic()) builder.append( ChatColor.ITALIC );
|
||||
if (isUnderlined()) builder.append( ChatColor.UNDERLINE );
|
||||
if (isStrikethrough()) builder.append( ChatColor.STRIKETHROUGH );
|
||||
if (isObfuscated()) builder.append( ChatColor.MAGIC );
|
||||
if ( isBold() ) builder.append( ChatColor.BOLD );
|
||||
if ( isItalic() ) builder.append( ChatColor.ITALIC );
|
||||
if ( isUnderlined() ) builder.append( ChatColor.UNDERLINE );
|
||||
if ( isStrikethrough() ) builder.append( ChatColor.STRIKETHROUGH );
|
||||
if ( isObfuscated() ) builder.append( ChatColor.MAGIC );
|
||||
builder.append( text );
|
||||
super.toLegacyText( builder );
|
||||
}
|
||||
|
@@ -20,9 +20,9 @@ public class TranslatableComponent extends BaseComponent
|
||||
{
|
||||
setTranslate( translate );
|
||||
this.with = new ArrayList<>();
|
||||
for (Object w : with)
|
||||
for ( Object w : with )
|
||||
{
|
||||
if (w instanceof String)
|
||||
if ( w instanceof String )
|
||||
{
|
||||
this.with.add( new TextComponent( (String) w ) );
|
||||
} else
|
||||
@@ -34,7 +34,7 @@ public class TranslatableComponent extends BaseComponent
|
||||
|
||||
public void setWith(List<BaseComponent> components)
|
||||
{
|
||||
for (BaseComponent component : components)
|
||||
for ( BaseComponent component : components )
|
||||
{
|
||||
component.parent = this;
|
||||
}
|
||||
|
Reference in New Issue
Block a user