Begin implementation of CheckStyle style checking

By: md_5 <git@md-5.net>
This commit is contained in:
Bukkit/Spigot 2019-04-23 14:00:20 +10:00
parent 30a442aef7
commit c240b58f66
88 changed files with 246 additions and 192 deletions

36
paper-api/checkstyle.xml Normal file
View File

@ -0,0 +1,36 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
<!-- See http://checkstyle.sourceforge.net/config_misc.html#NewlineAtEndOfFile -->
<module name="NewlineAtEndOfFile"/>
<!-- See http://checkstyle.sourceforge.net/config_whitespace.html -->
<module name="FileTabCharacter"/>
<!-- See http://checkstyle.sourceforge.net/config_misc.html -->
<module name="RegexpSingleline">
<property name="format" value="\s+$"/>
<property name="minimum" value="0"/>
<property name="maximum" value="0"/>
<property name="message" value="Line has trailing spaces."/>
</module>
<module name="TreeWalker">
<!-- See http://checkstyle.sourceforge.net/config_import.html -->
<module name="RedundantImport"/>
<!-- See http://checkstyle.sourceforge.net/config_modifiers.html -->
<module name="ModifierOrder"/>
<!-- See http://checkstyle.sourceforge.net/config_design.html -->
<module name="FinalClass"/>
<module name="InterfaceIsType"/>
<!-- See http://checkstyle.sourceforge.net/config_misc.html -->
<module name="ArrayTypeStyle"/>
<module name="UpperEll"/>
</module>
</module>

View File

@ -164,6 +164,30 @@
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
<configuration>
<configLocation>checkstyle.xml</configLocation>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
</configuration>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>8.19</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>

View File

@ -56,7 +56,7 @@ public enum Achievement {
/**
* Returns whether or not this achievement has a parent achievement.
*
*
* @return whether the achievement has a parent achievement
*/
public boolean hasParent() {
@ -65,7 +65,7 @@ public enum Achievement {
/**
* Returns the parent achievement of this achievement, or null if none.
*
*
* @return the parent achievement or null
*/
@Nullable

View File

@ -1210,12 +1210,12 @@ public final class Bukkit {
/**
* Create a ChunkData for use in a generator.
*
*
* See {@link ChunkGenerator#generateChunkData(org.bukkit.World, java.util.Random, int, int, org.bukkit.generator.ChunkGenerator.BiomeGrid)}
*
*
* @param world the world to create the ChunkData for
* @return a new ChunkData for the world
*
*
*/
@NotNull
public static ChunkGenerator.ChunkData createChunkData(@NotNull World world) {

View File

@ -114,8 +114,8 @@ public enum ChatColor {
private final char code;
private final boolean isFormat;
private final String toString;
private final static Map<Integer, ChatColor> BY_ID = Maps.newHashMap();
private final static Map<Character, ChatColor> BY_CHAR = Maps.newHashMap();
private static final Map<Integer, ChatColor> BY_ID = Maps.newHashMap();
private static final Map<Character, ChatColor> BY_CHAR = Maps.newHashMap();
private ChatColor(char code, int intCode) {
this(code, intCode, false);
@ -145,7 +145,7 @@ public enum ChatColor {
/**
* Checks if this code is a format code as opposed to a color code.
*
*
* @return whether this ChatColor is a format code
*/
public boolean isFormat() {
@ -154,7 +154,7 @@ public enum ChatColor {
/**
* Checks if this code is a color code as opposed to a format code.
*
*
* @return whether this ChatColor is a color code
*/
public boolean isColor() {

View File

@ -13,7 +13,7 @@ public enum CoalType {
CHARCOAL(0x1);
private final byte data;
private final static Map<Byte, CoalType> BY_DATA = Maps.newHashMap();
private static final Map<Byte, CoalType> BY_DATA = Maps.newHashMap();
private CoalType(final int data) {
this.data = (byte) data;

View File

@ -44,7 +44,7 @@ public enum CropState {
RIPE(0x7);
private final byte data;
private final static Map<Byte, CropState> BY_DATA = Maps.newHashMap();
private static final Map<Byte, CropState> BY_DATA = Maps.newHashMap();
private CropState(final int data) {
this.data = (byte) data;

View File

@ -35,7 +35,7 @@ public enum Difficulty {
HARD(3);
private final int value;
private final static Map<Integer, Difficulty> BY_ID = Maps.newHashMap();
private static final Map<Integer, Difficulty> BY_ID = Maps.newHashMap();
private Difficulty(final int value) {
this.value = value;

View File

@ -80,10 +80,10 @@ public enum DyeColor {
private final byte dyeData;
private final Color color;
private final Color firework;
private final static DyeColor[] BY_WOOL_DATA;
private final static DyeColor[] BY_DYE_DATA;
private final static Map<Color, DyeColor> BY_COLOR;
private final static Map<Color, DyeColor> BY_FIREWORK;
private static final DyeColor[] BY_WOOL_DATA;
private static final DyeColor[] BY_DYE_DATA;
private static final Map<Color, DyeColor> BY_COLOR;
private static final Map<Color, DyeColor> BY_FIREWORK;
private DyeColor(final int woolData, final int dyeData, /*@NotNull*/ Color color, /*@NotNull*/ Color firework) {
this.woolData = (byte) woolData;

View File

@ -153,7 +153,7 @@ public enum EntityEffect {
private final byte data;
private final Class<? extends Entity> applicable;
private final static Map<Byte, EntityEffect> BY_DATA = Maps.newHashMap();
private static final Map<Byte, EntityEffect> BY_DATA = Maps.newHashMap();
EntityEffect(final int data, /*@NotNull*/ Class<? extends Entity> clazz) {
this.data = (byte) data;

View File

@ -29,14 +29,14 @@ public enum GameMode {
ADVENTURE(2),
/**
* Spectator mode cannot interact with the world in anyway and is
* invisible to normal players. This grants the player the
* Spectator mode cannot interact with the world in anyway and is
* invisible to normal players. This grants the player the
* ability to no-clip through the world.
*/
SPECTATOR(3);
private final int value;
private final static Map<Integer, GameMode> BY_ID = Maps.newHashMap();
private static final Map<Integer, GameMode> BY_ID = Maps.newHashMap();
private GameMode(final int value) {
this.value = value;

View File

@ -24,7 +24,7 @@ public enum GrassSpecies {
FERN_LIKE(0x2);
private final byte data;
private final static Map<Byte, GrassSpecies> BY_DATA = Maps.newHashMap();
private static final Map<Byte, GrassSpecies> BY_DATA = Maps.newHashMap();
private GrassSpecies(final int data) {
this.data = (byte) data;

View File

@ -78,7 +78,7 @@ public enum Instrument {
PLING(0xF);
private final byte type;
private final static Map<Byte, Instrument> BY_DATA = Maps.newHashMap();
private static final Map<Byte, Instrument> BY_DATA = Maps.newHashMap();
private Instrument(final int type) {
this.type = (byte) type;

View File

@ -275,7 +275,7 @@ public class Location implements Cloneable, ConfigurationSerializable {
/**
* Sets the {@link #getYaw() yaw} and {@link #getPitch() pitch} to point
* in the direction of the vector.
*
*
* @param vector the direction vector
* @return the same location
*/

View File

@ -3243,7 +3243,7 @@ public enum Material implements Keyed {
private final int id;
private final Constructor<? extends MaterialData> ctor;
private final static Map<String, Material> BY_NAME = Maps.newHashMap();
private static final Map<String, Material> BY_NAME = Maps.newHashMap();
private final int maxStack;
private final short durability;
public final Class<?> data;

View File

@ -126,7 +126,7 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
@Nullable
T get(@NotNull NamespacedKey key);
final static class SimpleRegistry<T extends Enum<T> & Keyed> implements Registry<T> {
static final class SimpleRegistry<T extends Enum<T> & Keyed> implements Registry<T> {
private final Map<NamespacedKey, T> map;

View File

@ -14,7 +14,7 @@ public enum SandstoneType {
SMOOTH(0x2);
private final byte data;
private final static Map<Byte, SandstoneType> BY_DATA = Maps.newHashMap();
private static final Map<Byte, SandstoneType> BY_DATA = Maps.newHashMap();
private SandstoneType(final int data) {
this.data = (byte) data;

View File

@ -1009,12 +1009,12 @@ public interface Server extends PluginMessageRecipient {
/**
* Create a ChunkData for use in a generator.
*
*
* See {@link ChunkGenerator#generateChunkData(org.bukkit.World, java.util.Random, int, int, org.bukkit.generator.ChunkGenerator.BiomeGrid)}
*
*
* @param world the world to create the ChunkData for
* @return a new ChunkData for the world
*
*
*/
@NotNull
public ChunkGenerator.ChunkData createChunkData(@NotNull World world);

View File

@ -20,7 +20,7 @@ import java.util.Objects;
* The registration of new {@link StructureType}s is case-sensitive.
*/
// Order is retrieved from WorldGenFactory
public class StructureType {
public final class StructureType {
private static final Map<String, StructureType> structureTypeMap = new HashMap<>();

View File

@ -37,7 +37,7 @@ public enum TreeSpecies {
;
private final byte data;
private final static Map<Byte, TreeSpecies> BY_DATA = Maps.newHashMap();
private static final Map<Byte, TreeSpecies> BY_DATA = Maps.newHashMap();
private TreeSpecies(final int data) {
this.data = (byte) data;

View File

@ -264,7 +264,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
* @param x X-coordinate of the chunk
* @param z Z-coordinate of the chunk
* @return Whether the chunk was actually refreshed
*
*
* @deprecated This method is not guaranteed to work suitably across all client implementations.
*/
@Deprecated
@ -431,7 +431,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
/**
* Get a collection of all entities in this World matching the given
* class/interface
*
*
* @param <T> an entity subclass
* @param cls The class representing the type of entity to match
* @return A List of all Entities currently residing in this world that
@ -1378,7 +1378,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
* <p>
* <b>Note:</b> If set to a negative number the world will use the
* server-wide spawn limit instead.
*
*
* @param limit the new mob limit
*/
void setMonsterSpawnLimit(int limit);
@ -1397,7 +1397,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
* <p>
* <b>Note:</b> If set to a negative number the world will use the
* server-wide spawn limit instead.
*
*
* @param limit the new mob limit
*/
void setAnimalSpawnLimit(int limit);
@ -1416,7 +1416,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
* <p>
* <b>Note:</b> If set to a negative number the world will use the
* server-wide spawn limit instead.
*
*
* @param limit the new mob limit
*/
void setWaterAnimalSpawnLimit(int limit);
@ -1435,7 +1435,7 @@ public interface World extends PluginMessageRecipient, Metadatable {
* <p>
* <b>Note:</b> If set to a negative number the world will use the
* server-wide spawn limit instead.
*
*
* @param limit the new mob limit
*/
void setAmbientSpawnLimit(int limit);

View File

@ -18,7 +18,7 @@ public enum WorldType {
CUSTOMIZED("CUSTOMIZED"),
BUFFET("BUFFET");
private final static Map<String, WorldType> BY_NAME = Maps.newHashMap();
private static final Map<String, WorldType> BY_NAME = Maps.newHashMap();
private final String name;
private WorldType(/*@NotNull*/ String name) {

View File

@ -241,7 +241,7 @@ public interface Block extends Metadatable {
/**
* Gets the face relation of this block compared to the given block.
* <p>
* For example:
* For example:
* <pre>{@code
* Block current = world.getBlockAt(100, 100, 100);
* Block target = world.getBlockAt(100, 101, 100);

View File

@ -14,7 +14,7 @@ public interface Dropper extends Container, Lootable {
* Normal behavior of a dropper is as follows:
* <p>
* If the block that the dropper is facing is an InventoryHolder,
* the randomly selected ItemStack is placed within that
* the randomly selected ItemStack is placed within that
* Inventory in the first slot that's available, starting with 0 and
* counting up. If the inventory is full, nothing happens.
* <p>
@ -24,7 +24,7 @@ public interface Dropper extends Container, Lootable {
* <p>
* If the block represented by this state is no longer a dropper, this will
* do nothing.
*
*
* @throws IllegalStateException if this block state is not placed
*/
public void drop();

View File

@ -9,11 +9,11 @@ import org.jetbrains.annotations.Nullable;
public interface EndGateway extends BlockState {
/**
* Gets the location that entities are teleported to when
* Gets the location that entities are teleported to when
* entering the gateway portal.
* <p>
* If this block state is not placed the location's world will be null.
*
*
* @return the gateway exit location
*/
@Nullable
@ -24,7 +24,7 @@ public interface EndGateway extends BlockState {
* they enter the gateway portal.
* <p>
* If this block state is not placed the location's world has to be null.
*
*
* @param location the new exit location
* @throws IllegalArgumentException for differing worlds
*/
@ -33,7 +33,7 @@ public interface EndGateway extends BlockState {
/**
* Gets whether this gateway will teleport entities directly to
* the exit location instead of finding a nearby location.
*
*
* @return true if the gateway is teleporting to the exact location
*/
boolean isExactTeleport();
@ -41,7 +41,7 @@ public interface EndGateway extends BlockState {
/**
* Sets whether this gateway will teleport entities directly to
* the exit location instead of finding a nearby location.
*
*
* @param exact whether to teleport to the exact location
*/
void setExactTeleport(boolean exact);

View File

@ -15,7 +15,7 @@ public interface TabCompleter {
*
* @param sender Source of the command. For players tab-completing a
* command inside of a command block, this will be the player, not
* the command block.
* the command block.
* @param command Command which was executed
* @param alias The alias used
* @param args The arguments passed to the command, including final

View File

@ -226,4 +226,4 @@ public abstract class FileConfiguration extends MemoryConfiguration {
return (FileConfigurationOptions) options;
}
}
}

View File

@ -18,7 +18,7 @@ public class ExactMatchConversationCanceller implements ConversationCanceller {
public ExactMatchConversationCanceller(@NotNull String escapeSequence) {
this.escapeSequence = escapeSequence;
}
public void setConversation(@NotNull Conversation conversation) {}
public boolean cancelBasedOnInput(@NotNull ConversationContext context, @NotNull String input) {

View File

@ -12,7 +12,7 @@ import java.util.List;
* response from the user.
*/
public abstract class FixedSetPrompt extends ValidatingPrompt {
protected List<String> fixedSet;
/**

View File

@ -9,17 +9,17 @@ import org.jetbrains.annotations.NotNull;
* that displays the plugin name in front of conversation output.
*/
public class PluginNameConversationPrefix implements ConversationPrefix {
protected String separator;
protected ChatColor prefixColor;
protected Plugin plugin;
private String cachedPrefix;
public PluginNameConversationPrefix(@NotNull Plugin plugin) {
this(plugin, " > ", ChatColor.LIGHT_PURPLE);
}
public PluginNameConversationPrefix(@NotNull Plugin plugin, @NotNull String separator, @NotNull ChatColor prefixColor) {
this.separator = separator;
this.prefixColor = prefixColor;

View File

@ -3,7 +3,7 @@ package org.bukkit.entity;
/**
* Represents an entity that can age and breed.
*/
public interface Ageable extends Creature {
public interface Ageable extends Creature {
/**
* Gets the age of this animal.
*
@ -49,7 +49,7 @@ public interface Ageable extends Creature {
* @return return true if the animal is an adult
*/
public boolean isAdult();
/**
* Return the ability to breed of the animal.
*

View File

@ -226,7 +226,7 @@ public interface AreaEffectCloud extends Entity {
/**
* Retrieve the original source of this cloud.
*
*
* @return the {@link ProjectileSource} that threw the LingeringPotion
*/
@Nullable

View File

@ -10,7 +10,7 @@ public interface Boat extends Vehicle {
/**
* Gets the wood type of the boat.
*
*
* @return the wood type
*/
@NotNull
@ -18,7 +18,7 @@ public interface Boat extends Vehicle {
/**
* Sets the wood type of the boat.
*
*
* @param species the new wood type
*/
void setWoodType(@NotNull TreeSpecies species);

View File

@ -20,8 +20,8 @@ public interface Creeper extends Monster {
public void setPowered(boolean value);
/**
* Set the maximum fuse ticks for this Creeper, where the maximum ticks
* is the amount of time in which a creeper is allowed to be in the
* Set the maximum fuse ticks for this Creeper, where the maximum ticks
* is the amount of time in which a creeper is allowed to be in the
* primed state before exploding.
*
* @param ticks the new maximum fuse ticks
@ -29,8 +29,8 @@ public interface Creeper extends Monster {
public void setMaxFuseTicks(int ticks);
/**
* Get the maximum fuse ticks for this Creeper, where the maximum ticks
* is the amount of time in which a creeper is allowed to be in the
* Get the maximum fuse ticks for this Creeper, where the maximum ticks
* is the amount of time in which a creeper is allowed to be in the
* primed state before exploding.
*
* @return the maximum fuse ticks

View File

@ -41,8 +41,8 @@ public interface EnderDragon extends ComplexLivingEntity, Boss {
BREATH_ATTACK,
/**
* The dragon will search for a player to attack with dragon breath.
* If no player is close enough to the dragon for 5 seconds, the
* dragon will charge at a player within 150 blocks or will take off
* If no player is close enough to the dragon for 5 seconds, the
* dragon will charge at a player within 150 blocks or will take off
* and begin circling if no player is found.
*/
SEARCH_FOR_BREATH_ATTACK_TARGET,

View File

@ -350,7 +350,7 @@ public enum EntityType implements Keyed {
/**
*
* @return the raw type id
* @return the raw type id
* @deprecated Magic value
*/
@Deprecated

View File

@ -4,5 +4,5 @@ package org.bukkit.entity;
* A mechanical creature that may harm enemies.
*/
public interface Golem extends Creature {
}

View File

@ -4,7 +4,7 @@ public interface Guardian extends Monster {
/**
* Check if the Guardian is an elder Guardian
*
*
* @return true if the Guardian is an Elder Guardian, false if not
* @deprecated should check if instance of {@link ElderGuardian}.
*/

View File

@ -139,7 +139,7 @@ public interface Minecart extends Vehicle {
/**
* Gets the offset of the display block.
*
*
* @return the current block offset for this minecart.
*/
public int getDisplayBlockOffset();

View File

@ -8,14 +8,14 @@ public interface SpectralArrow extends Arrow {
/**
* Returns the amount of time that this arrow will apply
* the glowing effect for.
*
*
* @return the glowing effect ticks
*/
int getGlowingTicks();
/**
* Sets the amount of time to apply the glowing effect for.
*
*
* @param duration the glowing effect ticks
*/
void setGlowingTicks(int duration);

View File

@ -10,16 +10,16 @@ import org.bukkit.loot.Lootable;
public interface HopperMinecart extends Minecart, InventoryHolder, Lootable {
/**
* Checks whether or not this Minecart will pick up
* Checks whether or not this Minecart will pick up
* items into its inventory.
*
*
* @return true if the Minecart will pick up items
*/
boolean isEnabled();
/**
* Sets whether this Minecart will pick up items.
*
*
* @param enabled new enabled state
*/
void setEnabled(boolean enabled);

View File

@ -24,7 +24,7 @@ public @interface EventHandler {
* <li>HIGHEST
* <li>MONITOR
* </ol>
*
*
* @return the priority
*/
EventPriority priority() default EventPriority.NORMAL;
@ -34,7 +34,7 @@ public @interface EventHandler {
* <p>
* If ignoreCancelled is true and the event is cancelled, the method is
* not called. Otherwise, the method is always called.
*
*
* @return whether cancelled events should be ignored
*/
boolean ignoreCancelled() default false;

View File

@ -44,7 +44,7 @@ public class BlockPhysicsEvent extends BlockEvent implements Cancellable {
/**
* Gets the source block that triggered this event.
*
*
* Note: This will default to block if not set.
*
* @return The source block

View File

@ -13,10 +13,10 @@ import org.jetbrains.annotations.NotNull;
public class BlockPistonRetractEvent extends BlockPistonEvent {
private static final HandlerList handlers = new HandlerList();
private List<Block> blocks;
public BlockPistonRetractEvent(@NotNull final Block block, @NotNull final List<Block> blocks, @NotNull final BlockFace direction) {
super(block, direction);
this.blocks = blocks;
}
@ -31,7 +31,7 @@ public class BlockPistonRetractEvent extends BlockPistonEvent {
public Location getRetractLocation() {
return getBlock().getRelative(getDirection(), 2).getLocation();
}
/**
* Get an immutable list of the blocks which will be moved by the
* extending.

View File

@ -32,4 +32,4 @@ public class EntityBlockFormEvent extends BlockFormEvent {
public Entity getEntity() {
return entity;
}
}
}

View File

@ -30,9 +30,9 @@ public class EnderDragonChangePhaseEvent extends EntityEvent implements Cancella
}
/**
* Gets the current phase that the dragon is in. This method will return null
* Gets the current phase that the dragon is in. This method will return null
* when a dragon is first spawned and hasn't yet been assigned a phase.
*
*
* @return the current dragon phase
*/
@Nullable
@ -42,7 +42,7 @@ public class EnderDragonChangePhaseEvent extends EntityEvent implements Cancella
/**
* Gets the new phase that the dragon will switch to.
*
*
* @return the new dragon phase
*/
@NotNull
@ -52,7 +52,7 @@ public class EnderDragonChangePhaseEvent extends EntityEvent implements Cancella
/**
* Sets the new phase for the ender dragon.
*
*
* @param newPhase the new dragon phase
*/
public void setNewPhase(@NotNull EnderDragon.Phase newPhase) {

View File

@ -29,4 +29,4 @@ public class EntityPortalEvent extends EntityTeleportEvent {
public static HandlerList getHandlerList() {
return handlers;
}
}
}

View File

@ -47,7 +47,7 @@ public class EntityPortalExitEvent extends EntityTeleportEvent {
/**
* Sets the velocity that the entity will have after exiting the portal.
*
*
* @param after the velocity after exiting the portal
*/
public void setAfter(@NotNull Vector after) {
@ -64,4 +64,4 @@ public class EntityPortalExitEvent extends EntityTeleportEvent {
public static HandlerList getHandlerList() {
return handlers;
}
}
}

View File

@ -82,4 +82,4 @@ public class EntityTeleportEvent extends EntityEvent implements Cancellable {
public static HandlerList getHandlerList() {
return handlers;
}
}
}

View File

@ -60,4 +60,4 @@ public class SlimeSplitEvent extends EntityEvent implements Cancellable {
public static HandlerList getHandlerList() {
return handlers;
}
}
}

View File

@ -29,7 +29,7 @@ import org.jetbrains.annotations.Nullable;
* <li>{@link HumanEntity#openEnchanting(Location, boolean)}
* <li>{@link InventoryView#close()}
* </ul>
* To invoke one of these methods, schedule a task using
* To invoke one of these methods, schedule a task using
* {@link BukkitScheduler#runTask(Plugin, Runnable)}, which will run the task
* on the next tick. Also be aware that this is not an exhaustive list, and
* other methods could potentially create issues as well.

View File

@ -22,7 +22,7 @@ import org.jetbrains.annotations.Nullable;
/**
* This event is called when the player drags an item in their cursor across
* the inventory. The ItemStack is distributed across the slots the
* HumanEntity dragged over. The method of distribution is described by the
* HumanEntity dragged over. The method of distribution is described by the
* DragType returned by {@link #getType()}.
* <p>
* Canceling this event will result in none of the changes described in
@ -41,7 +41,7 @@ import org.jetbrains.annotations.Nullable;
* <li>{@link HumanEntity#openEnchanting(Location, boolean)}
* <li>{@link InventoryView#close()}
* </ul>
* To invoke one of these methods, schedule a task using
* To invoke one of these methods, schedule a task using
* {@link BukkitScheduler#runTask(Plugin, Runnable)}, which will run the task
* on the next tick. Also be aware that this is not an exhaustive list, and
* other methods could potentially create issues as well.

View File

@ -35,7 +35,7 @@ public class ServerListPingEvent extends ServerEvent implements Iterable<Player>
* This constructor is intended for implementations that provide the
* {@link #iterator()} method, thus provided the {@link #getNumPlayers()}
* count.
*
*
* @param address the address of the pinger
* @param motd the message of the day
* @param maxPlayers the max number of players

View File

@ -18,4 +18,4 @@ public abstract class ServiceEvent extends ServerEvent {
public RegisteredServiceProvider<?> getProvider() {
return provider;
}
}
}

View File

@ -52,7 +52,7 @@ public abstract class ChunkGenerator {
/**
* Shapes the chunk for the given coordinates.
*
*
* This method must return a ChunkData.
* <p>
* Notes:
@ -64,7 +64,7 @@ public abstract class ChunkGenerator {
* been returned.
* <p>
* This method <b>must</b> return a ChunkData returned by {@link ChunkGenerator#createChunkData(org.bukkit.World)}
*
*
* @param world The world this chunk will be used for
* @param random The random generator to use
* @param x The X-coordinate of the chunk
@ -144,9 +144,9 @@ public abstract class ChunkGenerator {
public static interface ChunkData {
/**
* Get the maximum height for the chunk.
*
*
* Setting blocks at or above this height will do nothing.
*
*
* @return the maximum height
*/
public int getMaxHeight();
@ -174,7 +174,7 @@ public abstract class ChunkGenerator {
* @param material the type to set the block to
*/
public void setBlock(int x, int y, int z, @NotNull MaterialData material);
/**
* Set the block at x,y,z in the chunk data to material.
*
@ -202,7 +202,7 @@ public abstract class ChunkGenerator {
* @param material the type to set the blocks to
*/
public void setRegion(int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, @NotNull Material material);
/**
* Set a region of this chunk from xMin, yMin, zMin (inclusive)
* to xMax, yMax, zMax (exclusive) to material.
@ -218,7 +218,7 @@ public abstract class ChunkGenerator {
* @param material the type to set the blocks to
*/
public void setRegion(int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, @NotNull MaterialData material);
/**
* Set a region of this chunk from xMin, yMin, zMin (inclusive) to xMax,
* yMax, zMax (exclusive) to material.
@ -247,7 +247,7 @@ public abstract class ChunkGenerator {
*/
@NotNull
public Material getType(int x, int y, int z);
/**
* Get the type and data of the block at x, y, z.
*
@ -260,7 +260,7 @@ public abstract class ChunkGenerator {
*/
@NotNull
public MaterialData getTypeAndData(int x, int y, int z);
/**
* Get the type and data of the block at x, y, z.
*
@ -273,7 +273,7 @@ public abstract class ChunkGenerator {
*/
@NotNull
public BlockData getBlockData(int x, int y, int z);
/**
* Get the block data at x,y,z in the chunk data.
*

View File

@ -10,7 +10,7 @@ import java.util.List;
* The HelpMap tracks all help topics registered in a Bukkit server. When the
* server starts up or is reloaded, help is processed and topics are added in
* the following order:
*
*
* <ol>
* <li>General topics are loaded from the help.yml
* <li>Plugins load and optionally call {@code addTopic()}
@ -37,7 +37,7 @@ public interface HelpMap {
*/
@NotNull
public Collection<HelpTopic> getHelpTopics();
/**
* Adds a topic to the server's help index.
*

View File

@ -10,7 +10,7 @@ import java.util.Comparator;
* All topics are listed in alphabetic order, but topics that start with a
* slash come after topics that don't.
*/
public class HelpTopicComparator implements Comparator<HelpTopic> {
public final class HelpTopicComparator implements Comparator<HelpTopic> {
// Singleton implementations
private static final TopicNameComparator tnc = new TopicNameComparator();
@ -31,7 +31,7 @@ public class HelpTopicComparator implements Comparator<HelpTopic> {
return tnc.compare(lhs.getName(), rhs.getName());
}
public static class TopicNameComparator implements Comparator<String> {
public static final class TopicNameComparator implements Comparator<String> {
private TopicNameComparator(){}
public int compare(@NotNull String lhs, @NotNull String rhs) {

View File

@ -234,7 +234,7 @@ public interface EntityEquipment {
/**
* Sets the chance of the helmet being dropped upon this creature's death.
*
*
* <ul>
* <li>A drop chance of 0.0F will never drop
* <li>A drop chance of 1.0F will always drop
@ -248,7 +248,7 @@ public interface EntityEquipment {
/**
* Gets the chance of the chest plate being dropped upon this creature's
* death.
*
*
* <ul>
* <li>A drop chance of 0.0F will never drop
* <li>A drop chance of 1.0F will always drop
@ -261,7 +261,7 @@ public interface EntityEquipment {
/**
* Sets the chance of the chest plate being dropped upon this creature's
* death.
*
*
* <ul>
* <li>A drop chance of 0.0F will never drop
* <li>A drop chance of 1.0F will always drop
@ -275,7 +275,7 @@ public interface EntityEquipment {
/**
* Gets the chance of the leggings being dropped upon this creature's
* death.
*
*
* <ul>
* <li>A drop chance of 0.0F will never drop
* <li>A drop chance of 1.0F will always drop
@ -288,7 +288,7 @@ public interface EntityEquipment {
/**
* Sets the chance of the leggings being dropped upon this creature's
* death.
*
*
* <ul>
* <li>A drop chance of 0.0F will never drop
* <li>A drop chance of 1.0F will always drop
@ -301,7 +301,7 @@ public interface EntityEquipment {
/**
* Gets the chance of the boots being dropped upon this creature's death.
*
*
* <ul>
* <li>A drop chance of 0.0F will never drop
* <li>A drop chance of 1.0F will always drop
@ -313,7 +313,7 @@ public interface EntityEquipment {
/**
* Sets the chance of the boots being dropped upon this creature's death.
*
*
* <ul>
* <li>A drop chance of 0.0F will never drop
* <li>A drop chance of 1.0F will always drop

View File

@ -15,7 +15,7 @@ import org.jetbrains.annotations.Nullable;
* as it should.
*/
public abstract class InventoryView {
public final static int OUTSIDE = -999;
public static final int OUTSIDE = -999;
/**
* Represents various extra properties of certain inventory windows.
*/

View File

@ -9,7 +9,7 @@ public interface BlockStateMeta extends ItemMeta {
/**
* Returns whether the item has a block state currently
* attached to it.
*
*
* @return whether a block state is already attached
*/
boolean hasBlockState();

View File

@ -86,14 +86,14 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable {
* <p>
* Plugins should check if hasLore() returns <code>true</code> before
* calling this method.
*
*
* @return a list of lore that is set
*/
@Nullable
List<String> getLore();
/**
* Sets the lore for this item.
* Sets the lore for this item.
* Removes lore when given null.
*
* @param lore the lore that will be set
@ -157,7 +157,7 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable {
int getEnchantLevel(@NotNull Enchantment ench);
/**
* Returns a copy the enchantments in this ItemMeta. <br>
* Returns a copy the enchantments in this ItemMeta. <br>
* Returns an empty map if none.
*
* @return An immutable copy of the enchantments

View File

@ -262,7 +262,7 @@ public final class MapCursor {
/**
*
* @return the value
* @return the value
* @deprecated Magic value
*/
@Deprecated

View File

@ -34,7 +34,7 @@ public abstract class MapRenderer {
*
* @return True if contextual, false otherwise.
*/
final public boolean isContextual() {
public final boolean isContextual() {
return contextual;
}
@ -52,6 +52,6 @@ public abstract class MapRenderer {
* @param canvas The canvas to use for rendering.
* @param player The player who triggered the rendering.
*/
abstract public void render(@NotNull MapView map, @NotNull MapCanvas canvas, @NotNull Player player);
public abstract void render(@NotNull MapView map, @NotNull MapCanvas canvas, @NotNull Player player);
}

View File

@ -7,16 +7,16 @@ import org.bukkit.block.BlockFace;
* Material data for the piston base block
*/
public class PistonBaseMaterial extends MaterialData implements Directional, Redstone {
public PistonBaseMaterial(final Material type) {
super(type);
}
/**
* Constructs a PistonBaseMaterial.
*
*
* @param type the material type to use
* @param data the raw data value
* @param data the raw data value
* @deprecated Magic value
*/
@Deprecated

View File

@ -23,7 +23,7 @@ public class Wood extends MaterialData {
/**
* Constructs a wood block of the given tree species.
*
*
* @param species the species of the wood block
*/
public Wood(TreeSpecies species) {

View File

@ -66,8 +66,8 @@ public enum MushroomBlockTexture {
* Stem texture on all faces.
*/
ALL_STEM(15, null);
private final static Map<Byte, MushroomBlockTexture> BY_DATA = Maps.newHashMap();
private final static Map<BlockFace, MushroomBlockTexture> BY_BLOCKFACE = Maps.newHashMap();
private static final Map<Byte, MushroomBlockTexture> BY_DATA = Maps.newHashMap();
private static final Map<BlockFace, MushroomBlockTexture> BY_BLOCKFACE = Maps.newHashMap();
private final Byte data;
private final BlockFace capFace;

View File

@ -58,7 +58,7 @@ public class LazyMetadataValue extends MetadataValueAdapter {
/**
* Protected special constructor used by FixedMetadataValue to bypass
* standard setup.
*
*
* @param owningPlugin the owning plugin
*/
protected LazyMetadataValue(@NotNull Plugin owningPlugin) {

View File

@ -16,7 +16,7 @@ public enum PermissionDefault {
NOT_OP("!op", "notop", "!operator", "notoperator", "!admin", "notadmin");
private final String[] names;
private final static Map<String, PermissionDefault> lookup = new HashMap<String, PermissionDefault>();
private static final Map<String, PermissionDefault> lookup = new HashMap<String, PermissionDefault>();
private PermissionDefault(/*@NotNull*/ String... names) {
this.names = names;

View File

@ -784,7 +784,7 @@ public final class PluginDescriptionFile {
*</pre></blockquote>
* Another example, with nested definitions, can be found <a
* href="doc-files/permissions-example_plugin.yml">here</a>.
*
*
* @return the permissions this plugin will register
*/
@NotNull
@ -829,7 +829,7 @@ public final class PluginDescriptionFile {
* not included in the API. Any unrecognized
* awareness (one unsupported or in a future version) will cause a dummy
* object to be created instead of failing.
*
*
* <ul>
* <li>Currently only supports the enumerated values in {@link
* PluginAwareness.Flags}.

View File

@ -56,7 +56,7 @@ public final class JavaPluginLoader implements PluginLoader {
/**
* This class was not meant to be constructed explicitly
*
*
* @param instance the server instance
*/
@Deprecated

View File

@ -54,7 +54,7 @@ public enum PotionType {
* Checks if the potion type has an upgraded state.
* This refers to whether or not the potion type can be Tier 2,
* such as Potion of Fire Resistance II.
*
*
* @return true if the potion type can be upgraded;
*/
public boolean isUpgradeable() {
@ -64,7 +64,7 @@ public enum PotionType {
/**
* Checks if the potion type has an extended state.
* This refers to the extended duration potions
*
*
* @return true if the potion type can be extended
*/
public boolean isExtendable() {

View File

@ -3,18 +3,12 @@ package org.bukkit.scoreboard;
/**
* Criteria names which trigger an objective to be modified by actions in-game
*/
public class Criterias {
public static final String HEALTH;
public static final String PLAYER_KILLS;
public static final String TOTAL_KILLS;
public static final String DEATHS;
public final class Criterias {
static {
HEALTH="health";
PLAYER_KILLS="playerKillCount";
TOTAL_KILLS="totalKillCount";
DEATHS="deathCount";
}
public static final String HEALTH = "health";
public static final String PLAYER_KILLS = "playerKillCount";
public static final String TOTAL_KILLS = "totalKillCount";
public static final String DEATHS = "deathCount";
private Criterias() {}
}

View File

@ -9,7 +9,7 @@ import org.bukkit.configuration.serialization.ConfigurationSerialization;
import com.google.common.collect.ImmutableMap;
import org.jetbrains.annotations.NotNull;
class Wrapper<T extends Map<String, ?> & Serializable> implements Serializable {
final class Wrapper<T extends Map<String, ?> & Serializable> implements Serializable {
private static final long serialVersionUID = -986209235411767547L;
final T map;

View File

@ -4,7 +4,7 @@ package org.bukkit.util.noise;
* Base class for all noise generators
*/
public abstract class NoiseGenerator {
protected final int perm[] = new int[512];
protected final int[] perm= new int[512];
protected double offsetX;
protected double offsetY;
protected double offsetZ;

View File

@ -11,13 +11,13 @@ import org.jetbrains.annotations.NotNull;
* different results
*/
public class PerlinNoiseGenerator extends NoiseGenerator {
protected static final int grad3[][] = {{1, 1, 0}, {-1, 1, 0}, {1, -1, 0}, {-1, -1, 0},
protected static final int[][] grad3 = {{1, 1, 0}, {-1, 1, 0}, {1, -1, 0}, {-1, -1, 0},
{1, 0, 1}, {-1, 0, 1}, {1, 0, -1}, {-1, 0, -1},
{0, 1, 1}, {0, -1, 1}, {0, 1, -1}, {0, -1, -1}};
private static final PerlinNoiseGenerator instance = new PerlinNoiseGenerator();
protected PerlinNoiseGenerator() {
int p[] = {151, 160, 137, 91, 90, 15, 131, 13, 201,
int[] p = {151, 160, 137, 91, 90, 15, 131, 13, 201,
95, 96, 53, 194, 233, 7, 225, 140, 36, 103, 30, 69, 142, 8, 99, 37,
240, 21, 10, 23, 190, 6, 148, 247, 120, 234, 75, 0, 26, 197, 62,
94, 252, 219, 203, 117, 35, 11, 32, 57, 177, 33, 88, 237, 149, 56,

View File

@ -25,7 +25,7 @@ public class SimplexNoiseGenerator extends PerlinNoiseGenerator {
protected static final double G42 = G4 * 2.0;
protected static final double G43 = G4 * 3.0;
protected static final double G44 = G4 * 4.0 - 1.0;
protected static final int grad4[][] = {{0, 1, 1, 1}, {0, 1, 1, -1}, {0, 1, -1, 1}, {0, 1, -1, -1},
protected static final int[][] grad4 = {{0, 1, 1, 1}, {0, 1, 1, -1}, {0, 1, -1, 1}, {0, 1, -1, -1},
{0, -1, 1, 1}, {0, -1, 1, -1}, {0, -1, -1, 1}, {0, -1, -1, -1},
{1, 0, 1, 1}, {1, 0, 1, -1}, {1, 0, -1, 1}, {1, 0, -1, -1},
{-1, 0, 1, 1}, {-1, 0, 1, -1}, {-1, 0, -1, 1}, {-1, 0, -1, -1},
@ -33,7 +33,7 @@ public class SimplexNoiseGenerator extends PerlinNoiseGenerator {
{-1, 1, 0, 1}, {-1, 1, 0, -1}, {-1, -1, 0, 1}, {-1, -1, 0, -1},
{1, 1, 1, 0}, {1, 1, -1, 0}, {1, -1, 1, 0}, {1, -1, -1, 0},
{-1, 1, 1, 0}, {-1, 1, -1, 0}, {-1, -1, 1, 0}, {-1, -1, -1, 0}};
protected static final int simplex[][] = {
protected static final int[][] simplex = {
{0, 1, 2, 3}, {0, 1, 3, 2}, {0, 0, 0, 0}, {0, 2, 3, 1}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {1, 2, 3, 0},
{0, 2, 1, 3}, {0, 0, 0, 0}, {0, 3, 1, 2}, {0, 3, 2, 1}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {1, 3, 2, 0},
{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0},

View File

@ -62,7 +62,7 @@ public class ChatColorTest {
assertThat(String.format("%c%c", ChatColor.COLOR_CHAR, color.getChar()), is(color.toString()));
}
}
@Test
public void translateAlternateColorCodes() {
String s = "&0&1&2&3&4&5&6&7&8&9&A&a&B&b&C&c&D&d&E&e&F&f&K&k & more";

View File

@ -41,7 +41,7 @@ public class LocationTest {
@Parameters(name= "{index}: {0}")
public static List<Object[]> data() {
Random RANDOM = new Random(1l); // Test is deterministic
Random RANDOM = new Random(1L); // Test is deterministic
int r = 0;
return ImmutableList.<Object[]>of(
new Object[] { "X",

View File

@ -12,7 +12,7 @@ import org.bukkit.plugin.SimplePluginManager;
import com.google.common.collect.ImmutableMap;
public class TestServer implements InvocationHandler {
public final class TestServer implements InvocationHandler {
private static interface MethodHandler {
Object handle(TestServer server, Object[] args);
}

View File

@ -428,7 +428,7 @@ public abstract class ConfigurationSectionTest {
assertEquals(Arrays.asList((Object) true, false), section.getBooleanList(key));
assertEquals(Arrays.asList((Object) 4.0, 5.0, 6.0), section.getDoubleList(key));
assertEquals(Arrays.asList((Object) 4.0f, 5.0f, 6.0f), section.getFloatList(key));
assertEquals(Arrays.asList((Object) 4l, 5l, 6l), section.getLongList(key));
assertEquals(Arrays.asList((Object) 4L, 5L, 6L), section.getLongList(key));
assertEquals(Arrays.asList((Object) (byte) 4, (byte) 5, (byte) 6), section.getByteList(key));
assertEquals(Arrays.asList((Object) (short) 4, (short) 5, (short) 6), section.getShortList(key));
assertEquals(map, section.getMapList(key).get(0));
@ -597,4 +597,4 @@ public abstract class ConfigurationSectionTest {
WORLD,
BANANAS
}
}
}

View File

@ -153,4 +153,4 @@ public abstract class ConfigurationTest {
assertEquals(defaults, config.getDefaults());
}
}
}

View File

@ -15,13 +15,13 @@ public class FakeConversable implements Conversable {
public Conversation begunConversation;
public Conversation abandonedConverstion;
public ConversationAbandonedEvent abandonedConversationEvent;
public boolean isConversing() {
return false;
return false;
}
public void acceptConversationInput(String input) {
}
public boolean beginConversation(Conversation conversation) {
@ -40,66 +40,66 @@ public class FakeConversable implements Conversable {
}
public void sendRawMessage(String message) {
lastSentMessage = message;
lastSentMessage = message;
}
public Server getServer() {
return null;
return null;
}
public String getName() {
return null;
return null;
}
public boolean isPermissionSet(String name) {
return false;
return false;
}
public boolean isPermissionSet(Permission perm) {
return false;
return false;
}
public boolean hasPermission(String name) {
return false;
return false;
}
public boolean hasPermission(Permission perm) {
return false;
return false;
}
public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value) {
return null;
return null;
}
public PermissionAttachment addAttachment(Plugin plugin) {
return null;
return null;
}
public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value, int ticks) {
return null;
return null;
}
public PermissionAttachment addAttachment(Plugin plugin, int ticks) {
return null;
return null;
}
public void removeAttachment(PermissionAttachment attachment) {
}
public void recalculatePermissions() {
}
public Set<PermissionAttachmentInfo> getEffectivePermissions() {
return null;
return null;
}
public boolean isOp() {
return false;
return false;
}
public void setOp(boolean value) {
}
}

View File

@ -18,7 +18,7 @@ public class ValidatingPromptTest {
prompt.acceptInput(null, "no");
assertFalse(prompt.result);
}
@Test
public void TestFixedSetPrompt() {
TestFixedSetPrompt prompt = new TestFixedSetPrompt("foo", "bar");
@ -27,7 +27,7 @@ public class ValidatingPromptTest {
prompt.acceptInput(null, "foo");
assertEquals("foo", prompt.result);
}
@Test
public void TestNumericPrompt() {
TestNumericPrompt prompt = new TestNumericPrompt();
@ -36,7 +36,7 @@ public class ValidatingPromptTest {
prompt.acceptInput(null, "1010220");
assertEquals(1010220, prompt.result);
}
@Test
public void TestRegexPrompt() {
TestRegexPrompt prompt = new TestRegexPrompt("a.c");
@ -48,10 +48,10 @@ public class ValidatingPromptTest {
}
//TODO: TestPlayerNamePrompt()
private class TestBooleanPrompt extends BooleanPrompt {
public boolean result;
@Override
protected Prompt acceptValidatedInput(ConversationContext context, boolean input) {
result = input;
@ -62,7 +62,7 @@ public class ValidatingPromptTest {
return null;
}
}
private class TestFixedSetPrompt extends FixedSetPrompt {
public String result;
@ -80,10 +80,10 @@ public class ValidatingPromptTest {
return null;
}
}
private class TestNumericPrompt extends NumericPrompt {
public Number result;
@Override
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
result = input;

View File

@ -30,7 +30,7 @@ public class SyntheticEventTest {
Assert.assertEquals(1, impl.callCount);
}
public static abstract class Base<E extends Event> implements Listener {
public abstract static class Base<E extends Event> implements Listener {
int callCount = 0;
public void accept(E evt) {

View File

@ -34,7 +34,7 @@ public class MaterialDataTest {
assertThat("Constructed with default top or bottom",door.isTopHalf(),equalTo(false));
assertThat("Constructed with default direction",door.getFacing(),equalTo(BlockFace.WEST));
assertThat("Constructed with default open state",door.isOpen(),equalTo(false));
Material[] types = new Material[] { Material.LEGACY_WOODEN_DOOR,
Material.LEGACY_IRON_DOOR_BLOCK, Material.LEGACY_SPRUCE_DOOR,
Material.LEGACY_BIRCH_DOOR, Material.LEGACY_JUNGLE_DOOR,

View File

@ -114,7 +114,7 @@ public class MetadataStoreTest {
assertEquals(1, subject.getMetadata("subject", "key").size());
assertEquals(10, subject.getMetadata("subject", "key").get(0).value());
}
@Test
public void testHasMetadata() {
subject.setMetadata("subject", "key", new FixedMetadataValue(pluginX, 10));

View File

@ -13,7 +13,7 @@ import org.bukkit.generator.ChunkGenerator;
public class TestPlugin extends PluginBase {
private boolean enabled = true;
final private String pluginName;
private final String pluginName;
public TestPlugin(String pluginName) {
this.pluginName = pluginName;

View File

@ -9,7 +9,7 @@ import java.util.HashMap;
import org.bukkit.entity.Player;
public class TestPlayer implements InvocationHandler {
public final class TestPlayer implements InvocationHandler {
private static interface MethodHandler {
Object handle(TestPlayer server, Object[] args);
}