Add lombok
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package com.alttd.playershops;
|
||||
|
||||
import com.alttd.playershops.config.Config;
|
||||
import com.alttd.playershops.handler.ShopHandler;
|
||||
import lombok.Getter;
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
@@ -8,8 +10,12 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class PlayerShops extends JavaPlugin {
|
||||
|
||||
@Getter
|
||||
private static PlayerShops instance;
|
||||
@Getter
|
||||
private Economy econ;
|
||||
@Getter
|
||||
private ShopHandler shopHandler;
|
||||
|
||||
public void onEnable() {
|
||||
instance = this;
|
||||
@@ -23,6 +29,8 @@ public class PlayerShops extends JavaPlugin {
|
||||
|
||||
registerListeners();
|
||||
registerCommands();
|
||||
|
||||
shopHandler = new ShopHandler(instance);
|
||||
}
|
||||
|
||||
private boolean setupEconomy() {
|
||||
@@ -56,8 +64,4 @@ public class PlayerShops extends JavaPlugin {
|
||||
Config.reload();
|
||||
}
|
||||
|
||||
public static PlayerShops getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,4 +23,10 @@ public class Config extends AbstractConfiguration {
|
||||
config.readConfig(Config.class, null);
|
||||
}
|
||||
|
||||
public static int shopLimit = 100;
|
||||
private static void shopSettings() {
|
||||
String path = "shop-settings.";
|
||||
shopLimit = config.getInt(path + "player-shop-limit", shopLimit);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+5
-5
@@ -1,20 +1,20 @@
|
||||
package com.alttd.playershops.config;
|
||||
|
||||
public class ShopMessageConfig {
|
||||
public class ShopTypeConfig {
|
||||
|
||||
private final String shopType;
|
||||
private final String configPath;
|
||||
private final String defaultPath;
|
||||
|
||||
public ShopMessageConfig(String shopType) {
|
||||
public ShopTypeConfig(String shopType) {
|
||||
this.shopType = shopType;
|
||||
this.configPath = "shop.text." + this.shopType + ".";
|
||||
this.defaultPath = "shop.text.default.";
|
||||
this.configPath = "shop.type." + this.shopType + ".";
|
||||
this.defaultPath = "shop.type.default.";
|
||||
init();
|
||||
}
|
||||
|
||||
public void init() {
|
||||
Config.config.readConfig(ShopMessageConfig.class, this);
|
||||
Config.config.readConfig(ShopTypeConfig.class, this);
|
||||
}
|
||||
|
||||
private static void set(String path, Object def) {
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.alttd.playershops.handler;
|
||||
|
||||
import com.alttd.playershops.PlayerShops;
|
||||
import com.alttd.playershops.config.Config;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class ShopHandler {
|
||||
|
||||
private final PlayerShops plugin;
|
||||
@Getter
|
||||
private final Object2IntMap<UUID> shopBuildLimits;
|
||||
|
||||
public ShopHandler(PlayerShops instance) {
|
||||
plugin = instance;
|
||||
shopBuildLimits = new Object2IntOpenHashMap<>();
|
||||
shopBuildLimits.defaultReturnValue(Config.shopLimit);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.alttd.playershops.shop;
|
||||
|
||||
public abstract class AbstractShop {
|
||||
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.alttd.playershops.shop;
|
||||
|
||||
import com.alttd.playershops.config.ShopMessageConfig;
|
||||
import com.alttd.playershops.config.ShopTypeConfig;
|
||||
|
||||
public enum ShopType {
|
||||
|
||||
@@ -9,10 +9,10 @@ public enum ShopType {
|
||||
GAMBLE,
|
||||
BARTER;
|
||||
|
||||
private final ShopMessageConfig shopMessageConfig;
|
||||
private final ShopTypeConfig shopTypeConfig;
|
||||
|
||||
ShopType() {
|
||||
this.shopMessageConfig = new ShopMessageConfig(toString());
|
||||
this.shopTypeConfig = new ShopTypeConfig(toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user