Enable more style checks and fix violations
This commit is contained in:
parent
defb6b8b44
commit
73ad900387
@ -6,14 +6,80 @@
|
||||
<module name="LineLength">
|
||||
<property name="max" value="120"/>
|
||||
</module>
|
||||
|
||||
<module name="FileTabCharacter"/>
|
||||
|
||||
<module name="TreeWalker">
|
||||
<module name="SingleSpaceSeparator"/>
|
||||
|
||||
<module name="ModifierOrder"/>
|
||||
|
||||
<module name="UpperEll"/>
|
||||
|
||||
<module name="GenericWhitespace"/>
|
||||
|
||||
<module name="AvoidStarImport"/>
|
||||
|
||||
<module name="OneStatementPerLine"/>
|
||||
|
||||
<module name="UnusedImports"/>
|
||||
|
||||
<module name="TrailingComment"/>
|
||||
|
||||
<module name="VisibilityModifier">
|
||||
<property name="protectedAllowed" value="true"/>
|
||||
</module>
|
||||
|
||||
<module name="EmptyLineSeparator">
|
||||
<property name="tokens"
|
||||
value="PACKAGE_DEF, IMPORT, STATIC_IMPORT, CLASS_DEF, INTERFACE_DEF, ENUM_DEF, STATIC_INIT,
|
||||
INSTANCE_INIT, METHOD_DEF, CTOR_DEF, RECORD_DEF, COMPACT_CTOR_DEF"/>
|
||||
</module>
|
||||
|
||||
<module name="Regexp">
|
||||
<property name="format" value="[ \t]+$"/>
|
||||
<property name="illegalPattern" value="true"/>
|
||||
<property name="message" value="Trailing whitespace"/>
|
||||
</module>
|
||||
|
||||
<module name="NoWhitespaceBefore">
|
||||
<property name="tokens"
|
||||
value="COMMA, SEMI, POST_INC, POST_DEC, DOT,
|
||||
LABELED_STAT, METHOD_REF"/>
|
||||
<property name="allowLineBreaks" value="true"/>
|
||||
</module>
|
||||
|
||||
<module name="FallThrough">
|
||||
<property name="reliefPattern" value="\$FALL-THROUGH\$"/>
|
||||
</module>
|
||||
|
||||
<module name="WhitespaceAround">
|
||||
<property name="ignoreEnhancedForColon" value="false"/>
|
||||
<property name="tokens"
|
||||
value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON,
|
||||
DIV, DIV_ASSIGN, DO_WHILE, EQUAL, GE, GT, LAMBDA, LAND, LE, LITERAL_CATCH, LITERAL_DO,
|
||||
LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SWITCH,
|
||||
LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD,
|
||||
MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN,
|
||||
STAR, STAR_ASSIGN, LITERAL_ASSERT, TYPE_EXTENSION_AND"/>
|
||||
</module>
|
||||
|
||||
<module name="LeftCurly">
|
||||
<property name="option" value="nl"/>
|
||||
<property name="tokens" value="CLASS_DEF,INTERFACE_DEF"/>
|
||||
<property name="ignoreEnums" value="false"/>
|
||||
</module>
|
||||
|
||||
<module name="RightCurly">
|
||||
<property name="option" value="alone"/>
|
||||
</module>
|
||||
|
||||
<module name="TypeName">
|
||||
<property name="format" value="^[A-Z]([a-zA-Z0-9]+)*$"/>
|
||||
</module>
|
||||
|
||||
<module name="TypeName">
|
||||
<property name="format" value="^I[A-Z][a-zA-Z0-9]*$"/>
|
||||
<property name="tokens" value="INTERFACE_DEF"/>
|
||||
</module>
|
||||
</module>
|
||||
</module>
|
||||
|
@ -162,7 +162,9 @@ public class ArmoredElytra extends JavaPlugin implements Listener
|
||||
|
||||
private void readMessages()
|
||||
{
|
||||
armorTierNames.put(ArmorTier.NONE, new ArmorTierName("NONE", "NONE")); // Shouldn't be used.
|
||||
// Shouldn't be used.
|
||||
armorTierNames.put(ArmorTier.NONE, new ArmorTierName("NONE", "NONE"));
|
||||
|
||||
armorTierNames.put(ArmorTier.LEATHER, new ArmorTierName(messages.getString(Message.TIER_LEATHER),
|
||||
messages.getString(Message.TIER_SHORT_LEATHER)));
|
||||
armorTierNames.put(ArmorTier.GOLD, new ArmorTierName(messages.getString(Message.TIER_GOLD),
|
||||
|
@ -1,5 +1,6 @@
|
||||
package nl.pim16aap2.armoredElytra.handlers;
|
||||
|
||||
import nl.pim16aap2.armoredElytra.ArmoredElytra;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -7,8 +8,6 @@ import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import nl.pim16aap2.armoredElytra.ArmoredElytra;
|
||||
|
||||
public class LoginHandler implements Listener
|
||||
{
|
||||
private final ArmoredElytra plugin;
|
||||
|
@ -42,7 +42,7 @@ public final class ArmorEquipEvent extends PlayerEvent implements Cancellable
|
||||
*
|
||||
* @return A list of handlers handling this event.
|
||||
*/
|
||||
public final static HandlerList getHandlerList()
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
@ -120,7 +120,7 @@ public final class ArmorEquipEvent extends PlayerEvent implements Cancellable
|
||||
}
|
||||
|
||||
public enum EquipMethod
|
||||
{// These have got to be the worst documentations ever.
|
||||
{
|
||||
/**
|
||||
* When you shift click an armor piece to equip or unequip
|
||||
*/
|
||||
|
@ -41,7 +41,8 @@ public class ArmorListener implements Listener
|
||||
if (e.isCancelled())
|
||||
return;
|
||||
if (e.getAction() == InventoryAction.NOTHING)
|
||||
return;// Why does this get called if nothing happens??
|
||||
// Why does this get called if nothing happens??
|
||||
return;
|
||||
if (e.getClick().equals(ClickType.SHIFT_LEFT) || e.getClick().equals(ClickType.SHIFT_RIGHT))
|
||||
shift = true;
|
||||
if (e.getClick().equals(ClickType.NUMBER_KEY))
|
||||
@ -102,7 +103,8 @@ public class ArmorListener implements Listener
|
||||
ItemStack oldArmorPiece = e.getCurrentItem();
|
||||
if (numberkey)
|
||||
if (e.getClickedInventory().getType().equals(InventoryType.PLAYER))
|
||||
{ // Prevents shit in the 2by2 crafting
|
||||
{
|
||||
// Prevents shit in the 2by2 crafting
|
||||
// e.getClickedInventory() == The players inventory
|
||||
// e.getHotBarButton() == key people are pressing to equip or unequip the item
|
||||
// to or from.
|
||||
@ -111,7 +113,8 @@ public class ArmorListener implements Listener
|
||||
// slot ;-;
|
||||
ItemStack hotbarItem = e.getClickedInventory().getItem(e.getHotbarButton());
|
||||
if (!isAirOrNull(hotbarItem))
|
||||
{ // Equipping
|
||||
{
|
||||
// Equipping
|
||||
newArmorType = ArmorType.matchType(hotbarItem);
|
||||
newArmorPiece = hotbarItem;
|
||||
oldArmorPiece = e.getClickedInventory().getItem(e.getSlot());
|
||||
@ -150,7 +153,8 @@ public class ArmorListener implements Listener
|
||||
{
|
||||
final Player player = e.getPlayer();
|
||||
if (e.getClickedBlock() != null && e.getAction() == Action.RIGHT_CLICK_BLOCK)
|
||||
{ // Having both of these checks is useless, might as well do it though.
|
||||
{
|
||||
// Having both of these checks is useless, might as well do it though.
|
||||
// Some blocks have actions when you right click them which stops the client
|
||||
// from equipping the armor in hand.
|
||||
Material mat = e.getClickedBlock().getType();
|
||||
@ -191,7 +195,8 @@ public class ArmorListener implements Listener
|
||||
// Can't replace armor using this method making getCursor() useless.
|
||||
ArmorType type = ArmorType.matchType(event.getOldCursor());
|
||||
if (event.getRawSlots().isEmpty())
|
||||
return;// Idk if this will ever happen
|
||||
// Idk if this will ever happen
|
||||
return;
|
||||
if (type != null && type.getSlot() == event.getRawSlots().stream().findFirst().orElse(0))
|
||||
{
|
||||
ArmorEquipEvent armorEquipEvent = new ArmorEquipEvent((Player) event.getWhoClicked(), EquipMethod.DRAG,
|
||||
|
@ -27,7 +27,7 @@ public enum ArmorType
|
||||
* @param itemStack The ItemStack to parse the type of.
|
||||
* @return The parsed ArmorType. (null if none were found.)
|
||||
*/
|
||||
public final static ArmorType matchType(final ItemStack itemStack)
|
||||
public static final ArmorType matchType(final ItemStack itemStack)
|
||||
{
|
||||
if (itemStack == null || itemStack.getType().equals(Material.AIR))
|
||||
return null;
|
||||
|
@ -1,10 +1,6 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package nl.pim16aap2.armoredElytra.util;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Pim
|
||||
*/
|
||||
public class ArmorTierName
|
||||
|
@ -36,7 +36,7 @@ import java.util.regex.Pattern;
|
||||
*/
|
||||
public final class UpdateChecker
|
||||
{
|
||||
public static final VersionScheme VERSION_SCHEME_DECIMAL = (first, second) ->
|
||||
public static final IVersionScheme VERSION_SCHEME_DECIMAL = (first, second) ->
|
||||
{
|
||||
String[] firstSplit = splitVersionInfo(first), secondSplit = splitVersionInfo(second);
|
||||
if (firstSplit == null || secondSplit == null)
|
||||
@ -65,9 +65,9 @@ public final class UpdateChecker
|
||||
|
||||
private final ArmoredElytra plugin;
|
||||
private final int pluginID;
|
||||
private final VersionScheme versionScheme;
|
||||
private final IVersionScheme versionScheme;
|
||||
|
||||
private UpdateChecker(final ArmoredElytra plugin, final int pluginID, final VersionScheme versionScheme)
|
||||
private UpdateChecker(final ArmoredElytra plugin, final int pluginID, final IVersionScheme versionScheme)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
this.pluginID = pluginID;
|
||||
@ -186,7 +186,7 @@ public final class UpdateChecker
|
||||
* @param versionScheme a custom version scheme parser. Cannot be null
|
||||
* @return the UpdateChecker instance
|
||||
*/
|
||||
public static UpdateChecker init(final ArmoredElytra plugin, final int pluginID, final VersionScheme versionScheme)
|
||||
public static UpdateChecker init(final ArmoredElytra plugin, final int pluginID, final IVersionScheme versionScheme)
|
||||
{
|
||||
Preconditions.checkArgument(pluginID > 0, "Plugin ID must be greater than 0");
|
||||
|
||||
@ -237,7 +237,7 @@ public final class UpdateChecker
|
||||
* A functional interface to compare two version Strings with similar version schemes.
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface VersionScheme
|
||||
public interface IVersionScheme
|
||||
{
|
||||
|
||||
/**
|
||||
@ -259,9 +259,11 @@ public final class UpdateChecker
|
||||
{
|
||||
|
||||
/**
|
||||
* A new update is available for download on SpigotMC.
|
||||
* A new update is available for download.
|
||||
* <p>
|
||||
* This is the only reason that requires an update.
|
||||
*/
|
||||
NEW_UPDATE, // The only reason that requires an update
|
||||
NEW_UPDATE,
|
||||
|
||||
/**
|
||||
* A successful connection to the SpiGet API could not be established.
|
||||
@ -311,7 +313,7 @@ public final class UpdateChecker
|
||||
private final String newestVersion;
|
||||
private final long age;
|
||||
|
||||
{ // An actual use for initializer blocks. This is madness!
|
||||
{
|
||||
lastResult = this;
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,8 @@ public final class UpdateManager
|
||||
{
|
||||
checkForUpdates();
|
||||
}
|
||||
}.runTaskTimer(plugin, 0L, 864000L); // Run immediately, then every 12 hours.
|
||||
// Run immediately, then every 12 hours.
|
||||
}.runTaskTimer(plugin, 0L, 864000L);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -729,7 +729,8 @@ public enum XMaterial
|
||||
for (String legacy : this.legacy)
|
||||
{
|
||||
if (legacy.isEmpty())
|
||||
break; // Left-side suggestion list
|
||||
// Left-side suggestion list
|
||||
break;
|
||||
if (name.equals(legacy))
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user