Minor code cleanup

Replaced some use of Material with CompatibleMaterial in hopes for the legacy Meterial system to not trigger but without any luck
This commit is contained in:
Christian Koop 2021-12-14 21:17:51 +01:00
parent d16b93aaed
commit 95a1db50b3
No known key found for this signature in database
GPG Key ID: 89A8181384E010A3
4 changed files with 18 additions and 17 deletions

View File

@ -23,7 +23,6 @@ import com.songoda.epichoppers.commands.CommandSettings;
import com.songoda.epichoppers.containers.ContainerManager;
import com.songoda.epichoppers.database.DataManager;
import com.songoda.epichoppers.database.migrations._1_InitialMigration;
import com.songoda.epichoppers.hopper.teleport.TeleportHandler;
import com.songoda.epichoppers.hopper.HopperManager;
import com.songoda.epichoppers.hopper.levels.Level;
import com.songoda.epichoppers.hopper.levels.LevelManager;
@ -34,6 +33,7 @@ import com.songoda.epichoppers.hopper.levels.modules.ModuleAutoSmelter;
import com.songoda.epichoppers.hopper.levels.modules.ModuleBlockBreak;
import com.songoda.epichoppers.hopper.levels.modules.ModuleMobHopper;
import com.songoda.epichoppers.hopper.levels.modules.ModuleSuction;
import com.songoda.epichoppers.hopper.teleport.TeleportHandler;
import com.songoda.epichoppers.listeners.BlockListeners;
import com.songoda.epichoppers.listeners.EntityListeners;
import com.songoda.epichoppers.listeners.HopperListeners;
@ -46,7 +46,6 @@ import com.songoda.epichoppers.utils.Methods;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.permission.BasicPermission;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
@ -235,18 +234,20 @@ public class EpicHoppers extends SongodaPlugin {
private void saveModules() {
if (levelManager != null) {
for (Level level : levelManager.getLevels().values())
for (Module module : level.getRegisteredModules())
for (Level level : levelManager.getLevels().values()) {
for (Module module : level.getRegisteredModules()) {
module.saveDataToFile();
}
}
}
}
public ItemStack newHopperItem(Level level) {
ItemStack item = new ItemStack(Material.HOPPER, 1);
ItemStack item = new ItemStack(CompatibleMaterial.HOPPER.getMaterial());
ItemMeta itemmeta = item.getItemMeta();
itemmeta.setDisplayName(TextUtils.formatText(Methods.formatName(level.getLevel())));
String line = getLocale().getMessage("general.nametag.lore").getMessage();
if (!line.equals("")) {
if (!line.isEmpty()) {
itemmeta.setLore(Arrays.asList(line.split("\n")));
}
item.setItemMeta(itemmeta);

View File

@ -58,7 +58,7 @@ public class GUIAutoSellFilter extends CustomizableGui {
mirrorFill("mirrorfill_9", 4, 7, false, false, glass1);
setButton("back", 8, GuiUtils.createButtonItem(CompatibleMaterial.ARROW.getItem(),
plugin.getLocale().getMessage("general.nametag.back").getMessage()),
plugin.getLocale().getMessage("general.nametag.back").getMessage()),
(event) -> {
hopper.overview(guiManager, event.player);
compile();
@ -101,7 +101,7 @@ public class GUIAutoSellFilter extends CustomizableGui {
}
// Info item
indicatorItem = new ItemStack(Material.PAPER, 1);
indicatorItem = new ItemStack(CompatibleMaterial.PAPER.getMaterial());
indicatorMeta = indicatorItem.getItemMeta();
indicatorMeta.setDisplayName(plugin.getLocale().getMessage("interface.autosell-filter.infotitle").getMessage());
@ -135,7 +135,7 @@ public class GUIAutoSellFilter extends CustomizableGui {
for (int slot : whiteListSlots) {
if (slot != i) continue;
if (items[i] != null && items[i].getType() != Material.AIR) {
if (items[i] != null && !items[i].getType().isAir()) {
ItemStack item = items[i];
if (item.getAmount() != 1) {
item.setAmount(item.getAmount() - 1);
@ -150,7 +150,7 @@ public class GUIAutoSellFilter extends CustomizableGui {
for (int slot : blackListSlots) {
if (slot != i) continue;
if (items[i] != null && items[i].getType() != Material.AIR) {
if (items[i] != null && !items[i].getType().isAir()) {
ItemStack item = items[i];
if (item.getAmount() != 1) {
item.setAmount(item.getAmount() - 1);

View File

@ -99,7 +99,7 @@ public class GUIFilter extends CustomizableGui {
num++;
}
it = new ItemStack(Material.BARRIER);
it = new ItemStack(CompatibleMaterial.BARRIER.getMaterial());
itm = it.getItemMeta();
itm.setDisplayName(plugin.getLocale().getMessage("interface.filter.void").getMessage());
it.setItemMeta(itm);
@ -117,7 +117,7 @@ public class GUIFilter extends CustomizableGui {
num++;
}
ItemStack itemInfo = new ItemStack(Material.PAPER, 1);
ItemStack itemInfo = new ItemStack(CompatibleMaterial.PAPER.getMaterial());
ItemMeta itemmetaInfo = itemInfo.getItemMeta();
itemmetaInfo.setDisplayName(plugin.getLocale().getMessage("interface.filter.infotitle").getMessage());
ArrayList<String> loreInfo = new ArrayList<>();
@ -131,7 +131,7 @@ public class GUIFilter extends CustomizableGui {
setItem("info", 16, itemInfo);
ItemStack hook = new ItemStack(Material.TRIPWIRE_HOOK, 1);
ItemStack hook = new ItemStack(CompatibleMaterial.TRIPWIRE_HOOK.getMaterial());
ItemMeta hookmeta = hook.getItemMeta();
hookmeta.setDisplayName(plugin.getLocale().getMessage("interface.hopper.rejectsync").getMessage());
ArrayList<String> lorehook = new ArrayList<>();

View File

@ -1,7 +1,7 @@
name: EpicHoppers
description: EpicHoppers
main: com.songoda.epichoppers.EpicHoppers
softdepend: [FabledSkyBlock, LiquidTanks, UltimateStacker, WildStacker, Reserve, Towny, RedProtect, Kingdoms, PlotsSquared, GriefPrevention, USkyBlock, ASkyBlock, WorldGuard, Factions, Vault, EpicFarming, AdvancedChests]
softdepend: [ FabledSkyBlock, LiquidTanks, UltimateStacker, WildStacker, Reserve, Towny, RedProtect, Kingdoms, PlotsSquared, GriefPrevention, USkyBlock, ASkyBlock, WorldGuard, Factions, Vault, EpicFarming, AdvancedChests ]
version: maven-version-number
author: Songoda
api-version: 1.13
@ -9,5 +9,5 @@ commands:
eh:
description: View information on this plugin.
default: true
aliases: [EpicHoppers]
aliases: [ EpicHoppers ]
usage: /eh