Skip to content

Commit

Permalink
Changed LitLibs getter
Browse files Browse the repository at this point in the history
  • Loading branch information
WaterArchery committed Oct 9, 2024
1 parent aa4b735 commit 9da9fef
Show file tree
Hide file tree
Showing 14 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public void mainCommand(CommandSender sender) {
SoundManager.sendSound((Player) sender, "DefaultMenuOpened");
}
else {
LitLibs libs = LitSellChest.getInstance().getLibs();
LitLibs libs = LitSellChest.getLibs();
libs.getLogger().log("You can only use this command on in game.");
}
}
Expand All @@ -40,7 +40,7 @@ public void shop(CommandSender sender) {
guiHandler.openShop((Player) sender);
}
else {
LitLibs libs = LitSellChest.getInstance().getLibs();
LitLibs libs = LitSellChest.getLibs();
libs.getLogger().log("You can only use this command on in game.");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public ShopMenu(ConfigManager file, String path, LitLibs litLibs) {

public Inventory generateInventory(Player player) {
GUIHandler guiHandler = GUIHandler.getInstance();
LitLibs libs = LitSellChest.getInstance().getLibs();
LitLibs libs = LitSellChest.getLibs();
MessageHandler mHandler = libs.getMessageHandler();
ChestHandler chestHandler = ChestHandler.getInstance();
ConfigManager configManager = new ConfigManager(libs, "gui", "shop_menu", false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
public class YourChestsMenu {

public static Inventory generateInventory(Player player) {
LitLibs libs = LitSellChest.getInstance().getLibs();
LitLibs libs = LitSellChest.getLibs();
MessageHandler mHandler = libs.getMessageHandler();
ChestHandler chestHandler = ChestHandler.getInstance();
NBTAPIHook nbtapiHook = libs.getNBTAPIHook();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void startTask() {
ConfigHandler configHandler = ConfigHandler.getInstance();
ConfigManager manager = configHandler.getConfig();
int interval = manager.getYml().getInt("DefaultCheckInterval");
LitLibs libs = LitSellChest.getInstance().getLibs();
LitLibs libs = LitSellChest.getLibs();
task = new SellTask(interval, libs);
task.runTaskTimer(LitSellChest.getInstance(), 20, interval * 20L);
}
Expand All @@ -69,7 +69,7 @@ public boolean isLocationValid(Location location) {
}

public void loadChestTypes() {
LitLibs libs = LitSellChest.getInstance().getLibs();
LitLibs libs = LitSellChest.getLibs();
ConfigHandler configHandler = ConfigHandler.getInstance();
ConfigManager manager = configHandler.getChests();
FileConfiguration yml = manager.getYml();
Expand Down Expand Up @@ -123,7 +123,7 @@ public int getChestCount(OfflinePlayer p) {
}

public @Nullable SellChestType getType(ItemStack itemStack) {
LitLibs libs = LitSellChest.getInstance().getLibs();
LitLibs libs = LitSellChest.getLibs();
String rawType = libs.getNBTAPIHook().getNBT(itemStack, "SellChestType");
if (rawType != null) {
return getType(rawType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void registerSuggestions(BukkitCommandManager<CommandSender> manager) {
}

public void registerMessages(BukkitCommandManager<CommandSender> manager) {
LitLibs libs = LitSellChest.getInstance().getLibs();
LitLibs libs = LitSellChest.getLibs();
ConfigHandler configHandler = ConfigHandler.getInstance();
MessageHandler mHandler = libs.getMessageHandler();
ConfigManager lang = configHandler.getLang();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void load() {
// for it.
//
// It is easier this way.
LitLibs libs = LitSellChest.getInstance().getLibs();
LitLibs libs = LitSellChest.getLibs();
saveDefaultYaml("default_menu", "gui");
saveDefaultYaml("shop_menu", "gui");
saveDefaultYaml("your_chests", "gui");
Expand Down Expand Up @@ -92,12 +92,12 @@ public FileConfiguration getGUIYaml(String guiName) {

public String getGuiString(String gui, String path){
FileConfiguration yaml = getGUIYaml(gui);
LitLibs libs = LitSellChest.getInstance().getLibs();
LitLibs libs = LitSellChest.getLibs();
return libs.getMessageHandler().updateColors(yaml.getString(path, path + "ERROR"));
}

public void sendMessageLang(CommandSender target, String path) {
LitLibs libs = LitSellChest.getInstance().getLibs();
LitLibs libs = LitSellChest.getLibs();
libs.getMessageHandler().sendMessage(target, getMessageLang(path));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static synchronized GUIHandler getInstance() {
private GUIHandler() { initialize(); }

public void initialize() {
LitLibs libs = LitSellChest.getInstance().getLibs();
LitLibs libs = LitSellChest.getLibs();

ConfigManager defaultMenuFile = new ConfigManager(libs, "gui", "default_menu", false);
defaultMenu = new DefaultMenu(defaultMenuFile, "default_menu", libs);
Expand All @@ -55,7 +55,7 @@ public void openShop(Player player) {

public ItemStack createItem(String menuName, String path){
ConfigHandler configHandler = ConfigHandler.getInstance();
LitLibs libs = LitSellChest.getInstance().getLibs();
LitLibs libs = LitSellChest.getLibs();
MessageHandler messageHandler = libs.getMessageHandler();
NBTAPIHook nbtapiHook = libs.getNBTAPIHook();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class SoundManager {

public static void sendSound(Player player, String path) {
ConfigHandler configHandler = ConfigHandler.getInstance();
LitLibs libs = LitSellChest.getInstance().getLibs();
LitLibs libs = LitSellChest.getLibs();
ConfigManager config = configHandler.getConfig();
SoundHandler soundHandler = libs.getSoundHandler();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void onChestPlace(BlockPlaceEvent event) {
ChestHandler chestHandler = ChestHandler.getInstance();
SellChestType chestType = chestHandler.getType(itemStack);
ConfigHandler configHandler = ConfigHandler.getInstance();
LitLibs libs = LitSellChest.getInstance().getLibs();
LitLibs libs = LitSellChest.getLibs();

if (chestType != null) {
if (chestHandler.isLocationValid(block.getLocation())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void onMainMenuClick(InventoryClickEvent event) {
String title = ConfigHandler.getInstance().getGuiString("default_menu", "default_menu" + ".name");
if (title.equalsIgnoreCase(menuTitle))
event.setCancelled(true);
LitLibs libs = LitSellChest.getInstance().getLibs();
LitLibs libs = LitSellChest.getLibs();
NBTAPIHook nbtapiHook = libs.getNBTAPIHook();
GUIHandler guiHandler = GUIHandler.getInstance();
Action action = nbtapiHook.getGUIAction(itemStack);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public void onShopMenuClick(InventoryClickEvent event) {
Inventory inventory = event.getClickedInventory();
ItemStack itemStack = event.getCurrentItem();
Player player = (Player) event.getWhoClicked();
LitLibs libs = LitSellChest.getInstance().getLibs();
LitLibs libs = LitSellChest.getLibs();

if (inventory != null && itemStack != null && itemStack.getType() != Material.AIR) {
String menuTitle = CompatibilityUtil.getTitle(event);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void onMainMenuClick(InventoryClickEvent event) {
String title = ConfigHandler.getInstance().getGuiString("your_chests", "your_chests" + ".name");

if (title.equalsIgnoreCase(menuTitle)) event.setCancelled(true);
LitLibs libs = LitSellChest.getInstance().getLibs();
LitLibs libs = LitSellChest.getLibs();
NBTAPIHook nbtapiHook = libs.getNBTAPIHook();
Action action = nbtapiHook.getGUIAction(itemStack);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public List<String> getHologramLines() {

public String statusToText() {
FileConfiguration yml = ConfigHandler.getInstance().getLang().getYml();
LitLibs libs = LitSellChest.getInstance().getLibs();
LitLibs libs = LitSellChest.getLibs();
MessageHandler mHandler = libs.getMessageHandler();

String statusText = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public SellChestType(String id) {
public ItemStack toItemStack() {
ConfigManager manager = ConfigHandler.getInstance().getChests();
FileConfiguration yml = manager.getYml();
LitLibs lib = LitSellChest.getInstance().getLibs();
LitLibs lib = LitSellChest.getLibs();
String rawMaterial = yml.getString(getId() + ".item.material", "STONE");
XMaterial material = XMaterial.valueOf(rawMaterial);
String name = manager.getString(getId() + ".item.name");
Expand Down

0 comments on commit 9da9fef

Please sign in to comment.