Merge pull request #42 from sgdc3/master

Minor code smell fixes
This commit is contained in:
Andrzej Pomirski 2015-08-06 15:10:55 +02:00
commit 757fa85cb7
11 changed files with 27 additions and 23 deletions

15
pom.xml
View File

@ -54,24 +54,28 @@
<groupId>com.j256.ormlite</groupId>
<artifactId>ormlite-jdbc</artifactId>
<version>4.48</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.0-beta9</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.8.7-R0.1-SNAPSHOT</version>
<version>1.8.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mcstats.bukkit</groupId>
<artifactId>metrics</artifactId>
<version>R7</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>org.bukkit</groupId>
@ -88,6 +92,7 @@
<groupId>net.milkbowl.vault</groupId>
<artifactId>Vault</artifactId>
<version>1.5.2</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.bukkit</groupId>
@ -104,6 +109,7 @@
<groupId>info.somethingodd</groupId>
<artifactId>odditem</artifactId>
<version>0.9.5</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>org.bukkit</groupId>
@ -121,6 +127,7 @@
<groupId>com.herocraftonline.heroes</groupId>
<artifactId>Heroes</artifactId>
<version>1.5.5.6-SNAPSHOT</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.bukkit</groupId>
@ -137,6 +144,7 @@
<groupId>com.griefcraft.lwc</groupId>
<artifactId>lwc</artifactId>
<version>4.3.1</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.bukkit</groupId>
@ -153,6 +161,7 @@
<groupId>com.daemitus.deadbolt</groupId>
<artifactId>deadbolt</artifactId>
<version>2.2</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.bukkit</groupId>
@ -169,6 +178,7 @@
<groupId>com.sk89q</groupId>
<artifactId>worldguard</artifactId>
<version>6.1.1-SNAPSHOT</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.bukkit</groupId>
@ -185,6 +195,7 @@
<groupId>com.webkonsept.bukkit.simplechestlock</groupId>
<artifactId>simplechestlock</artifactId>
<version>1.2.1</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.bukkit</groupId>
@ -201,6 +212,7 @@
<groupId>org.yi.acru.bukkit.lockette</groupId>
<artifactId>lockette</artifactId>
<version>1.8.14</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.bukkit</groupId>
@ -217,6 +229,7 @@
<groupId>net.t00thpick1</groupId>
<artifactId>residence</artifactId>
<version>3.0.0q-SNAPSHOT</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.bukkit</groupId>

View File

@ -22,7 +22,7 @@ public class Configuration {
* @param file File to load
* @param clazz Class to modify
*/
public static void pairFileAndClass(File file, Class clazz) {
public static void pairFileAndClass(File file, Class<?> clazz) {
FileConfiguration config = YamlConfiguration.loadConfiguration(file);
try {
@ -79,6 +79,10 @@ public class Configuration {
lastLine = scanner.nextLine();
}
if (scanner != null) {
scanner.close();
}
return lastLine.isEmpty();
} catch (FileNotFoundException e) {
e.printStackTrace();

View File

@ -44,7 +44,7 @@ public class Database {
* @param clazz Class with fields
* @return If table was succesfully created
*/
public boolean createFromClass(Class clazz) {
public boolean createFromClass(Class<?> clazz) {
if (!clazz.isAnnotationPresent(Entity.class) || !clazz.isAnnotationPresent(javax.persistence.Table.class)) {
return false;
}

View File

@ -15,9 +15,9 @@ import java.util.List;
* @author Acrobot
*/
public class EntityParser {
private Class entity;
private Class<?> entity;
public EntityParser(Class table) {
public EntityParser(Class<?> table) {
if (!table.isAnnotationPresent(Entity.class) || !table.isAnnotationPresent(javax.persistence.Table.class)) {
throw new AnnotationFormatError("The class hasn't got Entity or Table annotation!");
}

View File

@ -33,7 +33,6 @@ package com.Acrobot.Breeze.Utils.Encoding;
* @author rob@iharder.net
* @version 2.3.7
*/
@SuppressWarnings("ALL")
public class Base64 {
/* ******** P U B L I C F I E L D S ******** */
@ -1272,7 +1271,7 @@ public class Base64 {
@Override
public Class<?> resolveClass(java.io.ObjectStreamClass streamClass)
throws java.io.IOException, ClassNotFoundException {
Class c = Class.forName(streamClass.getName(), false, loader);
Class<?> c = Class.forName(streamClass.getName(), false, loader);
if (c == null) {
return super.resolveClass(streamClass);
} else {

View File

@ -15,7 +15,6 @@ import java.util.UUID;
*/
public class NameUtil {
private static final UUID INVALID_UUID = UUID.fromString("00000000-0000-0000-0000-000000000000");
private static final String PROFILE_AGENT = "minecraft";
/**
* Get the UUID of a player

View File

@ -36,14 +36,6 @@ import com.Acrobot.ChestShop.Metadata.ItemDatabase;
import com.Acrobot.ChestShop.Signs.RestrictedSign;
import com.Acrobot.ChestShop.UUIDs.NameManager;
import com.Acrobot.ChestShop.Updater.Updater;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Marker;
import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.LoggerContext;
import org.apache.logging.log4j.core.config.LoggerConfig;
import org.apache.logging.log4j.core.filter.AbstractFilter;
import org.apache.logging.log4j.message.Message;
import org.bukkit.Bukkit;
import org.bukkit.Server;
import org.bukkit.configuration.file.YamlConfiguration;
@ -294,10 +286,6 @@ public class ChestShop extends JavaPlugin {
getServer().getPluginManager().registerEvents(listener, this);
}
private void scheduleTask(Runnable runnable, long startTime, long repetitionTime) {
server.getScheduler().runTaskTimerAsynchronously(this, runnable, startTime, repetitionTime);
}
private void startStatistics() {
try {
new Metrics(this).start();

View File

@ -23,8 +23,6 @@ import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.material.Directional;
import org.bukkit.material.PistonBaseMaterial;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.metadata.MetadataValue;
import java.util.*;
import static com.Acrobot.Breeze.Utils.BlockUtil.getAttachedBlock;

View File

@ -47,6 +47,8 @@ public class ErrorMessageSender implements Listener {
case NOT_ENOUGH_MONEY:
message = Messages.NOT_ENOUGH_MONEY;
break;
default:
break;
}
if (message != null) {

View File

@ -1,6 +1,5 @@
package com.Acrobot.ChestShop.Listeners.PreShopCreation;
import com.Acrobot.Breeze.Utils.NumberUtil;
import com.Acrobot.Breeze.Utils.PriceUtil;
import com.Acrobot.ChestShop.Events.PreShopCreationEvent;
import org.bukkit.event.EventHandler;

View File

@ -73,6 +73,8 @@ public class ErrorMessageSender implements Listener {
case INVALID_SHOP:
message = Messages.INVALID_SHOP_DETECTED;
break;
default:
break;
}
if (message != null) {