Assorted whitespace fixes

By: md_5 <git@md-5.net>
This commit is contained in:
Bukkit/Spigot
2017-08-06 09:08:05 +10:00
parent da073e8e66
commit e3d4acc303
50 changed files with 96 additions and 107 deletions

View File

@@ -54,7 +54,6 @@
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- bundled with Minecraft, should be kept in sync -->

View File

@@ -781,7 +781,7 @@ public final class Bukkit {
* @param type the type of list to fetch, cannot be null
* @return a ban list of the specified type
*/
public static BanList getBanList(BanList.Type type){
public static BanList getBanList(BanList.Type type) {
return server.getBanList(type);
}

View File

@@ -204,7 +204,7 @@ public enum Effect {
private static final Map<Integer, Effect> BY_ID = Maps.newHashMap();
Effect(int id, Type type) {
this(id,type,null);
this(id, type, null);
}
Effect(int id, Type type, Class<?> data) {

View File

@@ -145,7 +145,7 @@ public final class FireworkEffect implements ConfigurationSerializable {
* @throws IllegalArgumentException If any color is null (may be
* thrown after changes have occurred)
*/
public Builder withColor(Color...colors) throws IllegalArgumentException {
public Builder withColor(Color... colors) throws IllegalArgumentException {
Validate.notNull(colors, "Cannot have null colors");
if (colors.length == 0) {
return this;
@@ -214,7 +214,7 @@ public final class FireworkEffect implements ConfigurationSerializable {
* @throws IllegalArgumentException If any color is null (may be
* thrown after changes have occurred)
*/
public Builder withFade(Color...colors) throws IllegalArgumentException {
public Builder withFade(Color... colors) throws IllegalArgumentException {
Validate.notNull(colors, "Cannot have null colors");
if (colors.length == 0) {
return this;

View File

@@ -41,7 +41,7 @@ public enum Rotation {
COUNTER_CLOCKWISE_45
;
private static final Rotation [] rotations = values();
private static final Rotation[] rotations = values();
/**
* Rotate clockwise by 90 degrees.

View File

@@ -918,7 +918,7 @@ public interface Server extends PluginMessageRecipient {
* @param flags an optional list of flags to set on the boss bar
* @return the created boss bar
*/
BossBar createBossBar(String title, BarColor color, BarStyle style, BarFlag ...flags);
BossBar createBossBar(String title, BarColor color, BarStyle style, BarFlag... flags);
/**
* Gets an entity on the server by its UUID

View File

@@ -38,7 +38,7 @@ public class Pattern implements ConfigurationSerializable {
pattern = PatternType.getByIdentifier(getString(map, PATTERN));
}
private static String getString(Map<?,?> map, Object key) {
private static String getString(Map<?, ?> map, Object key) {
Object str = map.get(key);
if (str instanceof String) {
return (String) str;

View File

@@ -46,7 +46,7 @@ public class TimingsCommand extends BukkitCommand {
for (HandlerList handlerList : HandlerList.getHandlerLists()) {
for (RegisteredListener listener : handlerList.getRegisteredListeners()) {
if (listener instanceof TimedRegisteredListener) {
((TimedRegisteredListener)listener).reset();
((TimedRegisteredListener) listener).reset();
}
}
}

View File

@@ -3,7 +3,6 @@ package org.bukkit.configuration.file;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.util.Map;
import java.util.logging.Level;
@@ -181,7 +180,7 @@ public class YamlConfiguration extends FileConfiguration {
} catch (IOException ex) {
Bukkit.getLogger().log(Level.SEVERE, "Cannot load " + file, ex);
} catch (InvalidConfigurationException ex) {
Bukkit.getLogger().log(Level.SEVERE, "Cannot load " + file , ex);
Bukkit.getLogger().log(Level.SEVERE, "Cannot load " + file, ex);
}
return config;

View File

@@ -7,7 +7,7 @@ import org.apache.commons.lang.BooleanUtils;
* BooleanPrompt is the base class for any prompt that requires a boolean
* response from the user.
*/
public abstract class BooleanPrompt extends ValidatingPrompt{
public abstract class BooleanPrompt extends ValidatingPrompt {
public BooleanPrompt() {
super();

View File

@@ -217,7 +217,7 @@ public class Conversation {
}
// Test for conversation abandonment based on input
for(ConversationCanceller canceller : cancellers) {
for (ConversationCanceller canceller : cancellers) {
if (canceller.cancelBasedOnInput(context, input)) {
abandon(new ConversationAbandonedEvent(this, canceller));
return;

View File

@@ -35,8 +35,7 @@ public class ConversationFactory {
*
* @param plugin The plugin that owns the factory.
*/
public ConversationFactory(Plugin plugin)
{
public ConversationFactory(Plugin plugin) {
this.plugin = plugin;
isModal = true;
localEchoEnabled = true;
@@ -58,8 +57,7 @@ public class ConversationFactory {
* @param modal The modality of all conversations to be created.
* @return This object.
*/
public ConversationFactory withModality(boolean modal)
{
public ConversationFactory withModality(boolean modal) {
isModal = modal;
return this;
}
@@ -141,7 +139,6 @@ public class ConversationFactory {
return withConversationCanceller(new ExactMatchConversationCanceller(escapeSequence));
}
/**
* Adds a {@link ConversationCanceller} to constructed conversations.
*

View File

@@ -1,6 +1,5 @@
package org.bukkit.conversations;
import org.bukkit.Server;
import org.bukkit.plugin.Plugin;
/**

View File

@@ -5,7 +5,7 @@ package org.bukkit.conversations;
* ConversationAbandonedEvent} to indicate that the conversation was manually
* abandoned by programmatically calling the abandon() method on it.
*/
public class ManuallyAbandonedConversationCanceller implements ConversationCanceller{
public class ManuallyAbandonedConversationCanceller implements ConversationCanceller {
public void setConversation(Conversation conversation) {
throw new UnsupportedOperationException();
}

View File

@@ -4,7 +4,7 @@ package org.bukkit.conversations;
* MessagePrompt is the base class for any prompt that only displays a message
* to the user and requires no input.
*/
public abstract class MessagePrompt implements Prompt{
public abstract class MessagePrompt implements Prompt {
public MessagePrompt() {
super();

View File

@@ -1,12 +1,10 @@
package org.bukkit.conversations;
import org.bukkit.command.CommandSender;
/**
* NullConversationPrefix is a {@link ConversationPrefix} implementation that
* displays nothing in front of conversation output.
*/
public class NullConversationPrefix implements ConversationPrefix{
public class NullConversationPrefix implements ConversationPrefix {
/**
* Prepends each conversation message with an empty string.

View File

@@ -6,7 +6,7 @@ import org.apache.commons.lang.math.NumberUtils;
* NumericPrompt is the base class for any prompt that requires a {@link
* Number} response from the user.
*/
public abstract class NumericPrompt extends ValidatingPrompt{
public abstract class NumericPrompt extends ValidatingPrompt {
public NumericPrompt() {
super();
}
@@ -30,8 +30,7 @@ public abstract class NumericPrompt extends ValidatingPrompt{
@Override
protected Prompt acceptValidatedInput(ConversationContext context, String input) {
try
{
try {
return acceptValidatedInput(context, NumberUtils.createNumber(input));
} catch (NumberFormatException e) {
return acceptValidatedInput(context, NumberUtils.INTEGER_ZERO);

View File

@@ -7,7 +7,7 @@ import org.bukkit.plugin.Plugin;
* PlayerNamePrompt is the base class for any prompt that requires the player
* to enter another player's name.
*/
public abstract class PlayerNamePrompt extends ValidatingPrompt{
public abstract class PlayerNamePrompt extends ValidatingPrompt {
private Plugin plugin;
public PlayerNamePrompt(Plugin plugin) {
@@ -18,7 +18,6 @@ public abstract class PlayerNamePrompt extends ValidatingPrompt{
@Override
protected boolean isInputValid(ConversationContext context, String input) {
return plugin.getServer().getPlayer(input) != null;
}
@Override

View File

@@ -4,7 +4,7 @@ package org.bukkit.conversations;
* StringPrompt is the base class for any prompt that accepts an arbitrary
* string from the user.
*/
public abstract class StringPrompt implements Prompt{
public abstract class StringPrompt implements Prompt {
/**
* Ensures that the prompt waits for the user to provide input.

View File

@@ -122,7 +122,7 @@ public class AsyncPlayerChatEvent extends PlayerEvent implements Cancellable {
}
public boolean isCancelled() {
return cancel ;
return cancel;
}
public void setCancelled(boolean cancel) {

View File

@@ -23,7 +23,7 @@ public class PlayerEditBookEvent extends PlayerEvent implements Cancellable {
public PlayerEditBookEvent(Player who, int slot, BookMeta previousBookMeta, BookMeta newBookMeta, boolean isSigning) {
super(who);
Validate.isTrue(slot >= 0 && slot <=8, "Slot must be in range 0-8 inclusive");
Validate.isTrue(slot >= 0 && slot <= 8, "Slot must be in range 0-8 inclusive");
Validate.notNull(previousBookMeta, "Previous book meta must not be null");
Validate.notNull(newBookMeta, "New book meta must not be null");

View File

@@ -24,7 +24,7 @@ public class PlayerStatisticIncrementEvent extends PlayerEvent implements Cancel
private final Material material;
public PlayerStatisticIncrementEvent(Player player, Statistic statistic, int initialValue, int newValue) {
super (player);
super(player);
this.statistic = statistic;
this.initialValue = initialValue;
this.newValue = newValue;
@@ -33,7 +33,7 @@ public class PlayerStatisticIncrementEvent extends PlayerEvent implements Cancel
}
public PlayerStatisticIncrementEvent(Player player, Statistic statistic, int initialValue, int newValue, EntityType entityType) {
super (player);
super(player);
this.statistic = statistic;
this.initialValue = initialValue;
this.newValue = newValue;
@@ -42,7 +42,7 @@ public class PlayerStatisticIncrementEvent extends PlayerEvent implements Cancel
}
public PlayerStatisticIncrementEvent(Player player, Statistic statistic, int initialValue, int newValue, Material material) {
super (player);
super(player);
this.statistic = statistic;
this.initialValue = initialValue;
this.newValue = newValue;

View File

@@ -159,9 +159,9 @@ public abstract class InventoryView {
public void setItem(int slot, ItemStack item) {
if (slot != OUTSIDE) {
if (slot < getTopInventory().getSize()) {
getTopInventory().setItem(convertSlot(slot),item);
getTopInventory().setItem(convertSlot(slot), item);
} else {
getBottomInventory().setItem(convertSlot(slot),item);
getBottomInventory().setItem(convertSlot(slot), item);
}
} else {
getPlayer().getWorld().dropItemNaturally(getPlayer().getLocation(), item);

View File

@@ -26,7 +26,7 @@ public interface FireworkMeta extends ItemMeta {
* @throws IllegalArgumentException If any effect is null (may be thrown
* after changes have occurred)
*/
void addEffects(FireworkEffect...effects) throws IllegalArgumentException;
void addEffects(FireworkEffect... effects) throws IllegalArgumentException;
/**
* Add several firework effects to this firework.

View File

@@ -53,7 +53,7 @@ public class MapFont {
throw new IllegalArgumentException("text contains invalid characters");
}
if (text.length() == 0){
if (text.length() == 0) {
return 0;
}

View File

@@ -20,7 +20,7 @@ public class Cauldron extends MaterialData {
* @deprecated Magic value
*/
@Deprecated
public Cauldron(int type, byte data){
public Cauldron(int type, byte data) {
super(type, data);
}

View File

@@ -98,7 +98,7 @@ public class Comparator extends MaterialData implements Directional, Redstone {
* @param isSubtraction True if the comparator is in subtraction mode, false for normal comparator operation
*/
public void setSubtractionMode(boolean isSubtraction) {
setData((byte)(getData() & 0xB | (isSubtraction ? 0x4 : 0x0)));
setData((byte) (getData() & 0xB | (isSubtraction ? 0x4 : 0x0)));
}
/**
@@ -139,7 +139,7 @@ public class Comparator extends MaterialData implements Directional, Redstone {
data |= 0x0;
}
setData((byte)data);
setData((byte) data);
}
/**

View File

@@ -96,12 +96,12 @@ public class Crops extends MaterialData {
case CARROT:
case POTATO:
// Mask the data just in case top bit set
return CropState.getByData((byte)(getData() & 0x7));
return CropState.getByData((byte) (getData() & 0x7));
case BEETROOT_BLOCK:
case NETHER_WARTS:
// Mask the data just in case top bits are set
// Will return SEEDED, SMALL, TALL, RIPE for the three growth data values
return CropState.getByData((byte)(((getData() & 0x3)*7+2)/3)) ;
return CropState.getByData((byte) (((getData() & 0x3) * 7 + 2) / 3));
default:
throw new IllegalArgumentException("Block type is not a crop");
}
@@ -127,12 +127,12 @@ public class Crops extends MaterialData {
case CARROT:
case POTATO:
// Preserve the top bit in case it is set
setData((byte)((getData() & 0x8)|state.getData()));
setData((byte) ((getData() & 0x8) | state.getData()));
break;
case NETHER_WARTS:
case BEETROOT_BLOCK:
// Preserve the top bits in case they are set
setData((byte)((getData() & 0xC)|(state.getData() >> 1)));
setData((byte) ((getData() & 0xC) | (state.getData() >> 1)));
break;
default:
throw new IllegalArgumentException("Block type is not a crop");

View File

@@ -18,7 +18,7 @@ public class Gate extends MaterialData implements Directional, Openable {
super(Material.FENCE_GATE);
}
public Gate(int type, byte data){
public Gate(int type, byte data) {
super(type, data);
}
@@ -27,7 +27,7 @@ public class Gate extends MaterialData implements Directional, Openable {
}
public void setFacingDirection(BlockFace face) {
byte data = (byte) (getData() &~ DIR_BIT);
byte data = (byte) (getData() & ~DIR_BIT);
switch (face) {
default:

View File

@@ -88,7 +88,7 @@ public class Mushroom extends MaterialData {
* @deprecated Magic value
*/
@Deprecated
public Mushroom(int type, byte data){
public Mushroom(int type, byte data) {
super(type, data);
Validate.isTrue(type == Material.HUGE_MUSHROOM_1.getId() || type == Material.HUGE_MUSHROOM_2.getId(), "Not a mushroom!");
}
@@ -237,8 +237,7 @@ public class Mushroom extends MaterialData {
case DOWN:
if (painted) {
data = MushroomBlockTexture.ALL_CAP.getData();
}
else {
} else {
data = MushroomBlockTexture.ALL_PORES.getData();
}
break;

View File

@@ -26,7 +26,7 @@ public class NetherWarts extends MaterialData {
}
public NetherWarts(final Material type) {
super (type);
super(type);
}
/**

View File

@@ -21,7 +21,7 @@ public class SpawnEgg extends MaterialData {
* @deprecated Magic value
*/
@Deprecated
public SpawnEgg(int type, byte data){
public SpawnEgg(int type, byte data) {
super(type, data);
}

View File

@@ -130,7 +130,7 @@ public class Stairs extends MaterialData implements Directional {
@Override
public String toString() {
return super.toString() + " facing " + getFacing() + (isInverted()?" inverted":"");
return super.toString() + " facing " + getFacing() + (isInverted() ? " inverted" : "");
}
@Override

View File

@@ -116,6 +116,6 @@ public class Step extends TexturedMaterial {
@Override
public String toString() {
return super.toString() + (isInverted()?"inverted":"");
return super.toString() + (isInverted() ? "inverted" : "");
}
}

View File

@@ -81,6 +81,6 @@ public class Tripwire extends MaterialData {
@Override
public String toString() {
return super.toString() + (isActivated()?" Activated":"") + (isObjectTriggering()?" Triggered":"");
return super.toString() + (isActivated() ? " Activated" : "") + (isObjectTriggering() ? " Triggered" : "");
}
}

View File

@@ -124,6 +124,6 @@ public class TripwireHook extends SimpleAttachableMaterialData implements Redsto
@Override
public String toString() {
return super.toString() + " facing " + getFacing() + (isActivated()?" Activated":"") + (isConnected()?" Connected":"");
return super.toString() + " facing " + getFacing() + (isActivated() ? " Activated" : "") + (isConnected() ? " Connected" : "");
}
}

View File

@@ -26,7 +26,7 @@ public class Vine extends MaterialData {
* @deprecated Magic value
*/
@Deprecated
public Vine(int type, byte data){
public Vine(int type, byte data) {
super(type, data);
}
@@ -107,7 +107,7 @@ public class Vine extends MaterialData {
* @param face The face to attach.
*/
public void putOnFace(BlockFace face) {
switch(face) {
switch (face) {
case WEST:
setData((byte) (getData() | VINE_WEST));
break;
@@ -149,7 +149,7 @@ public class Vine extends MaterialData {
* @param face The face to detach.
*/
public void removeFromFace(BlockFace face) {
switch(face) {
switch (face) {
case WEST:
setData((byte) (getData() & ~VINE_WEST));
break;

View File

@@ -305,7 +305,7 @@ public class Permission {
}
}
} else if (childrenNode instanceof Map) {
children = extractChildren((Map<?,?>) childrenNode, name, def, output);
children = extractChildren((Map<?, ?>) childrenNode, name, def, output);
} else {
throw new IllegalArgumentException("'children' key is of wrong type");
}

View File

@@ -1060,9 +1060,9 @@ public final class PluginDescriptionFile {
return map;
}
private Map<?,?> asMap(Object object) throws InvalidDescriptionException {
private Map<?, ?> asMap(Object object) throws InvalidDescriptionException {
if (object instanceof Map) {
return (Map<?,?>) object;
return (Map<?, ?>) object;
}
throw new InvalidDescriptionException(object + " is not properly structured.");
}

View File

@@ -54,8 +54,8 @@ public class RegisteredListener {
* @throws EventException If an event handler throws an exception.
*/
public void callEvent(final Event event) throws EventException {
if (event instanceof Cancellable){
if (((Cancellable) event).isCancelled() && isIgnoringCancelled()){
if (event instanceof Cancellable) {
if (((Cancellable) event).isCancelled() && isIgnoringCancelled()) {
return;
}
}

View File

@@ -443,7 +443,7 @@ public final class SimplePluginManager implements PluginManager {
try {
server.getMessenger().unregisterIncomingPluginChannel(plugin);
server.getMessenger().unregisterOutgoingPluginChannel(plugin);
} catch(Throwable ex) {
} catch (Throwable ex) {
server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while unregistering plugin channels for " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
}
}

View File

@@ -41,7 +41,7 @@ public class PotionEffect implements ConfigurationSerializable {
* @param particles the particle status, see {@link PotionEffect#hasParticles()}
* @param color the particle color, see {@link PotionEffect#getColor()}
*/
public PotionEffect(PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles, Color color){
public PotionEffect(PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles, Color color) {
Validate.notNull(type, "effect type cannot be null");
this.type = type;
this.duration = duration;
@@ -99,7 +99,7 @@ public class PotionEffect implements ConfigurationSerializable {
this(getEffectType(map), getInt(map, DURATION), getInt(map, AMPLIFIER), getBool(map, AMBIENT, false), getBool(map, PARTICLES, true));
}
private static PotionEffectType getEffectType(Map<?,?> map) {
private static PotionEffectType getEffectType(Map<?, ?> map) {
int type = getInt(map, TYPE);
PotionEffectType effect = PotionEffectType.getById(type);
if (effect != null) {
@@ -108,7 +108,7 @@ public class PotionEffect implements ConfigurationSerializable {
throw new NoSuchElementException(map + " does not contain " + TYPE);
}
private static int getInt(Map<?,?> map, Object key) {
private static int getInt(Map<?, ?> map, Object key) {
Object num = map.get(key);
if (num instanceof Integer) {
return (Integer) num;
@@ -116,7 +116,7 @@ public class PotionEffect implements ConfigurationSerializable {
throw new NoSuchElementException(map + " does not contain " + key);
}
private static boolean getBool(Map<?,?> map, Object key, boolean def) {
private static boolean getBool(Map<?, ?> map, Object key, boolean def) {
Object bool = map.get(key);
if (bool instanceof Boolean) {
return (Boolean) bool;
@@ -200,7 +200,7 @@ public class PotionEffect implements ConfigurationSerializable {
/**
* @return whether this effect has particles or not
*/
public boolean hasParticles(){
public boolean hasParticles() {
return particles;
}

View File

@@ -121,7 +121,7 @@ public class ChatPaginator {
}
}
if(line.length() > 0) { // Only add the last line if there is anything to add
if (line.length() > 0) { // Only add the last line if there is anything to add
lines.add(line.toString());
}
@@ -130,7 +130,7 @@ public class ChatPaginator {
lines.set(0, ChatColor.WHITE + lines.get(0));
}
for (int i = 1; i < lines.size(); i++) {
final String pLine = lines.get(i-1);
final String pLine = lines.get(i - 1);
final String subLine = lines.get(i);
char color = pLine.charAt(pLine.lastIndexOf(ChatColor.COLOR_CHAR) + 1);