Get rid of lombok

This commit is contained in:
Eric 2020-03-19 15:27:29 +01:00
parent 4a907ee309
commit ff9c1a4cb4
3 changed files with 23 additions and 26 deletions

View File

@ -2,10 +2,9 @@ package de.epiceric.shopchest.util;
import org.bukkit.inventory.ItemStack;
import lombok.experimental.UtilityClass;
@UtilityClass
public class ItemUtil {
private ItemUtil() {
}
/**
* Gets whether the given item stacks are equal not considering their amount
@ -14,7 +13,7 @@ public class ItemUtil {
* @param itemStack2 the other item stack
* @return whether the item stacks are equal
*/
public boolean isEqual(ItemStack itemStack1, ItemStack itemStack2) {
public static boolean isEqual(ItemStack itemStack1, ItemStack itemStack2) {
if (itemStack1 == null || itemStack2 == null) {
return false;
}
@ -23,5 +22,4 @@ public class ItemUtil {
return itemStack1.isSimilar(itemStack2);
}
}

View File

@ -2,37 +2,37 @@ package de.epiceric.shopchest.util;
import java.util.logging.Level;
import lombok.experimental.UtilityClass;
@UtilityClass
public class Logger {
private static final java.util.logging.Logger LOGGER = java.util.logging.Logger.getLogger("ShopChest");
public void info(String message, Object... args) {
private Logger() {
}
public static void info(String message, Object... args) {
log(Level.INFO, message, args);
}
public void info(Throwable throwable) {
public static void info(Throwable throwable) {
log(Level.INFO, throwable);
}
public void warning(String message, Object... args) {
public static void warning(String message, Object... args) {
log(Level.WARNING, message, args);
}
public void warning(Throwable throwable) {
public static void warning(Throwable throwable) {
log(Level.WARNING, throwable);
}
public void severe(String message, Object... args) {
public static void severe(String message, Object... args) {
log(Level.SEVERE, message, args);
}
public void severe(Throwable throwable) {
public static void severe(Throwable throwable) {
log(Level.SEVERE, throwable);
}
public void log(Level logLevel, String message, Object... args) {
public static void log(Level logLevel, String message, Object... args) {
if (args.length > 0) {
LOGGER.log(logLevel, message, args);
} else {
@ -40,7 +40,7 @@ public class Logger {
}
}
public void log(Level logLevel, Throwable throwable) {
public static void log(Level logLevel, Throwable throwable) {
LOGGER.log(logLevel, throwable.getMessage(), throwable);
}
}

View File

@ -6,10 +6,9 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import lombok.experimental.UtilityClass;
@UtilityClass
public class NmsUtil {
private NmsUtil() {
}
/**
* Gets the current server version with revision number
@ -18,7 +17,7 @@ public class NmsUtil {
*
* @return the server version
*/
public String getServerVersion() {
public static String getServerVersion() {
String packageName = Bukkit.getServer().getClass().getPackage().getName();
return packageName.substring(packageName.lastIndexOf('.') + 1);
}
@ -30,7 +29,7 @@ public class NmsUtil {
*
* @return the revision
*/
public int getRevision() {
public static int getRevision() {
String version = getServerVersion();
return Integer.parseInt(version.substring(version.length() - 1));
}
@ -40,7 +39,7 @@ public class NmsUtil {
* <p>
* (e.g. 9 for v1_9_R2, 10 for v1_10_R1)
*/
public int getMajorVersion() {
public static int getMajorVersion() {
return Integer.parseInt(getServerVersion().split("_")[1]);
}
@ -50,7 +49,7 @@ public class NmsUtil {
* @param className the name of the class
* @return the class or {@code null} if it was not found
*/
public Class<?> getNmsClass(String className) {
public static Class<?> getNmsClass(String className) {
try {
return Class.forName("net.minecraft.server." + getServerVersion() + "." + className);
} catch (ClassNotFoundException e) {
@ -64,7 +63,7 @@ public class NmsUtil {
* @param className the name of the class
* @return the class or {@code null} if it was not found
*/
public Class<?> getCraftClass(String className) {
public static Class<?> getCraftClass(String className) {
try {
return Class.forName("org.bukkit.craftbukkit." + getServerVersion() + "." + className);
} catch (ClassNotFoundException e) {
@ -102,7 +101,7 @@ public class NmsUtil {
* @param player the player to whom the packet should be sent
* @return whether the packet has successfully been sent
*/
public boolean sendPacket(Object packet, Player player) {
public static boolean sendPacket(Object packet, Player player) {
try {
if (packet == null) {
Logger.severe("Failed to send packet to {0}: Packet is null", player.getName());
@ -134,7 +133,7 @@ public class NmsUtil {
* @param player the player
* @param jsonMessage the JSON message
*/
public void sendJsonMessage(Player player, String jsonMessage) {
public static void sendJsonMessage(Player player, String jsonMessage) {
try {
Class<?> chatSerializerClass = getServerVersion().equals("v1_8_R1")
? getNmsClass("ChatSerializer")