mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2024-11-27 20:59:12 +01:00
Fix some more things picked up by static analysis.
This commit is contained in:
parent
a6095c680f
commit
215b70dcd7
@ -7,10 +7,7 @@ import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import javax.imageio.ImageIO;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
|
@ -8,8 +8,10 @@ import net.md_5.bungee.api.ChatColor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import lombok.ToString;
|
||||
|
||||
@Setter
|
||||
@ToString
|
||||
@NoArgsConstructor
|
||||
public abstract class BaseComponent
|
||||
{
|
||||
@ -370,10 +372,4 @@ public abstract class BaseComponent
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return String.format( "BaseComponent{color=%s, bold=%b, italic=%b, underlined=%b, strikethrough=%b, obfuscated=%b, clickEvent=%s, hoverEvent=%s, extra=%s}", getColor().getName(), isBold(), isItalic(), isUnderlined(), isStrikethrough(), isObfuscated(), getClickEvent(), getHoverEvent(), getExtra() );
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,14 @@
|
||||
package net.md_5.bungee.api.chat;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.ToString;
|
||||
import net.md_5.bungee.api.chat.ClickEvent.Action;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
final public class ClickEvent
|
||||
@ToString
|
||||
@RequiredArgsConstructor
|
||||
public final class ClickEvent
|
||||
{
|
||||
|
||||
/**
|
||||
@ -42,15 +42,9 @@ final public class ClickEvent
|
||||
RUN_COMMAND,
|
||||
/**
|
||||
* Inserts the string given by
|
||||
* {@link net.md_5.bungee.api.chat.ClickEvent#value} into the
|
||||
* players text box
|
||||
* {@link net.md_5.bungee.api.chat.ClickEvent#value} into the players
|
||||
* text box
|
||||
*/
|
||||
SUGGEST_COMMAND
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return String.format( "ClickEvent{action=%s, value=%s}", action, value );
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,6 @@
|
||||
package net.md_5.bungee.api.chat;
|
||||
|
||||
import lombok.NoArgsConstructor;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -28,7 +26,7 @@ public class ComponentBuilder
|
||||
{
|
||||
|
||||
private TextComponent current;
|
||||
private List<BaseComponent> parts = new ArrayList<>();
|
||||
private final List<BaseComponent> parts = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Creates a ComponentBuilder with the given text as the first part.
|
||||
|
@ -1,12 +1,12 @@
|
||||
package net.md_5.bungee.api.chat;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
@ToString
|
||||
@RequiredArgsConstructor
|
||||
final public class HoverEvent
|
||||
{
|
||||
|
||||
@ -20,10 +20,4 @@ final public class HoverEvent
|
||||
SHOW_ACHIEVEMENT,
|
||||
SHOW_ITEM
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return String.format( "HoverEvent{action=%s, value=%s}", action, value );
|
||||
}
|
||||
}
|
||||
|
@ -121,8 +121,8 @@ public class TextComponent extends BaseComponent
|
||||
components.add( component );
|
||||
}
|
||||
|
||||
//The client will crash if the array is empty
|
||||
if ( components.size() == 0 )
|
||||
// The client will crash if the array is empty
|
||||
if ( components.isEmpty() )
|
||||
{
|
||||
components.add( new TextComponent( "" ) );
|
||||
}
|
||||
|
@ -4,16 +4,16 @@ import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@NoArgsConstructor
|
||||
public class TranslatableComponent extends BaseComponent
|
||||
{
|
||||
@ -104,6 +104,7 @@ public class TranslatableComponent extends BaseComponent
|
||||
protected void toPlainText(StringBuilder builder)
|
||||
{
|
||||
String trans = locales.getString( translate );
|
||||
// TODO: Yell @ Thinkofdeath, this is impossible. getString(..) actually throws an exception when there is no string.
|
||||
if ( trans == null )
|
||||
{
|
||||
builder.append( translate );
|
||||
@ -212,10 +213,4 @@ public class TranslatableComponent extends BaseComponent
|
||||
builder.append( ChatColor.MAGIC );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return String.format( "TranslatableComponent{translate=%s, with=%s, %s}", translate, with, super.toString() );
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
import java.util.logging.Logger;
|
||||
import lombok.Getter;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
|
@ -49,8 +49,8 @@ public class PluginManager
|
||||
private final Map<String, Plugin> plugins = new LinkedHashMap<>();
|
||||
private final Map<String, Command> commandMap = new HashMap<>();
|
||||
private Map<String, PluginDescription> toLoad = new HashMap<>();
|
||||
private Multimap<Plugin, Command> commandsByPlugin = ArrayListMultimap.create();
|
||||
private Multimap<Plugin, Listener> listenersByPlugin = ArrayListMultimap.create();
|
||||
private final Multimap<Plugin, Command> commandsByPlugin = ArrayListMultimap.create();
|
||||
private final Multimap<Plugin, Listener> listenersByPlugin = ArrayListMultimap.create();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public PluginManager(ProxyServer proxy)
|
||||
@ -191,7 +191,7 @@ public class PluginManager
|
||||
PluginDescription plugin = entry.getValue();
|
||||
if ( !enablePlugin( pluginStatuses, new Stack<PluginDescription>(), plugin ) )
|
||||
{
|
||||
ProxyServer.getInstance().getLogger().warning( "Failed to enable " + entry.getKey() );
|
||||
ProxyServer.getInstance().getLogger().log( Level.WARNING, "Failed to enable {0}", entry.getKey() );
|
||||
}
|
||||
}
|
||||
toLoad.clear();
|
||||
@ -247,7 +247,7 @@ public class PluginManager
|
||||
dependencyGraph.append( element.getName() ).append( " -> " );
|
||||
}
|
||||
dependencyGraph.append( plugin.getName() ).append( " -> " ).append( dependName );
|
||||
ProxyServer.getInstance().getLogger().log( Level.WARNING, "Circular dependency detected: " + dependencyGraph );
|
||||
ProxyServer.getInstance().getLogger().log( Level.WARNING, "Circular dependency detected: {0}", dependencyGraph );
|
||||
status = false;
|
||||
} else
|
||||
{
|
||||
|
@ -11,7 +11,7 @@ public class GroupedThreadFactory implements ThreadFactory
|
||||
|
||||
private final ThreadGroup group;
|
||||
|
||||
public class BungeeGroup extends ThreadGroup
|
||||
public static class BungeeGroup extends ThreadGroup
|
||||
{
|
||||
|
||||
private BungeeGroup(String name)
|
||||
|
@ -7,8 +7,6 @@ import com.google.gson.JsonDeserializer;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParseException;
|
||||
import com.google.gson.JsonSerializationContext;
|
||||
import com.google.gson.JsonSerializer;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import net.md_5.bungee.api.chat.TranslatableComponent;
|
||||
|
@ -31,7 +31,7 @@ public class TextComponentSerializer extends BaseComponentSerializer implements
|
||||
public JsonElement serialize(TextComponent src, Type typeOfSrc, JsonSerializationContext context)
|
||||
{
|
||||
List<BaseComponent> extra = src.getExtra();
|
||||
if ( !src.hasFormatting() && ( extra == null || extra.size() == 0 ) )
|
||||
if ( !src.hasFormatting() && ( extra == null || extra.isEmpty() ) )
|
||||
{
|
||||
return new JsonPrimitive( src.getText() );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user