Resolve IntelliJ recommended defects and increment paper version

This commit is contained in:
Michael Ziluck 2019-05-31 23:35:11 -05:00
parent 18e199bc2a
commit 3a25d70762
7 changed files with 14 additions and 20 deletions

View File

@ -15,7 +15,7 @@
<dependency>
<groupId>com.destroystokyo.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.14.1-R0.1-SNAPSHOT</version>
<version>1.14.2-R0.1-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@ -133,7 +133,7 @@ public class CommandArgumentBuilder<T>
public static <T> CommandArgumentBuilder<T> createBuilder(Class<T> type)
{
return new CommandArgumentBuilder<T>();
return new CommandArgumentBuilder<>();
}
}

View File

@ -170,7 +170,7 @@ public abstract class ValidBaseCommand extends ValidCommand
* @param sender the sender of the command.
* @param label the labels that this command has.
*/
public void help(CommandSender sender, String label[])
public void help(CommandSender sender, String[] label)
{
List<ValidCommand> allowedSubs = new LinkedList<>();
for (ValidCommand sub : subCommands)

View File

@ -261,7 +261,7 @@ public abstract class ValidCommand
}
else
{
return Arrays.asList();
return Collections.emptyList();
}
}
else
@ -473,11 +473,11 @@ public abstract class ValidCommand
*/
protected boolean matches(String label)
{
label = label.toLowerCase();
if (label == null)
{
return false;
}
label = label.toLowerCase();
if (label.equals(getName()))
{
return true;

View File

@ -198,7 +198,7 @@ public class CollectionUtils
*/
public static <T> T randomValue(Collection<T> collection)
{
return randomValue(collection, null);
return randomValue(collection, (T) null);
}
/**
@ -210,6 +210,7 @@ public class CollectionUtils
*
* @return a random value from the collection.
*/
@SafeVarargs
public static <T> T randomValue(Collection<T> collection, T... ignored)
{
// if it's null or empty, we don't care

View File

@ -11,7 +11,7 @@ public class StringUtils
for (int i = start; i < end; i++)
{
sb.append(strings[i] + " ");
sb.append(strings[i]).append(" ");
}
return sb.toString().trim();
@ -20,10 +20,7 @@ public class StringUtils
public static String[] add(String[] array, String add)
{
String[] values = new String[array.length + 1];
for (int i = 0; i < array.length; i++)
{
values[i] = array[i];
}
System.arraycopy(array, 0, values, 0, array.length);
values[array.length] = add;
return values;
}
@ -49,7 +46,7 @@ public class StringUtils
return str;
}
final int newCodePoints[] = new int[strLen]; // cannot be longer than
final int[] newCodePoints = new int[strLen]; // cannot be longer than
// the char array
int outOffset = 0;
newCodePoints[outOffset++] = newCodePoint; // copy the first codepoint

View File

@ -259,15 +259,11 @@ public class ItemDb
try (final BufferedReader reader = new BufferedReader(new FileReader(file)))
{
final List<String> lines = new ArrayList<>(9000);
String line = null;
do
String line;
while ((line = reader.readLine()) != null)
{
if ((line = reader.readLine()) == null)
{
break;
}
lines.add(line);
} while (true);
}
return lines;
}
catch (IOException ex)