1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 11:45:51 +00:00

Merge pull request #1055 from Sfiguz7/master

Code cleaning
This commit is contained in:
TheBusyBiscuit 2019-08-29 20:35:58 +02:00 committed by GitHub
commit cc034588f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 48 additions and 48 deletions

View File

@ -23,15 +23,15 @@ public final class Categories {
private Categories() {} private Categories() {}
public static final Category WEAPONS = new Category(new CustomItem(Material.GOLDEN_SWORD, "&7Weapons", "", "&a> Click to open"), 1); public static final Category WEAPONS = new Category(new CustomItem(Material.GOLDEN_SWORD, "&7Weapons", "", "&a> Click to open"), 1);
public static final Category PORTABLE = new Category(new CustomItem(getSkull("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNDBjYjFlNjdiNTEyYWIyZDRiZjNkN2FjZTBlYWFmNjFjMzJjZDQ2ODFkZGMzOTg3Y2ViMzI2NzA2YTMzZmEifX19"), "&7Items", "", "&a> Click to open"), 1);; public static final Category PORTABLE = new Category(new CustomItem(getSkull("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNDBjYjFlNjdiNTEyYWIyZDRiZjNkN2FjZTBlYWFmNjFjMzJjZDQ2ODFkZGMzOTg3Y2ViMzI2NzA2YTMzZmEifX19"), "&7Items", "", "&a> Click to open"), 1);
public static final Category FOOD = new Category(new CustomItem(Material.APPLE, "&7Food", "", "&a> Click to open"), 2); public static final Category FOOD = new Category(new CustomItem(Material.APPLE, "&7Food", "", "&a> Click to open"), 2);
public static final Category MACHINES_1 = new Category(new CustomItem(getSkull("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTM0M2NlNThkYTU0Yzc5OTI0YTJjOTMzMWNmYzQxN2ZlOGNjYmJlYTliZTQ1YTdhYzg1ODYwYTZjNzMwIn19fQ=="), "&7Basic Machines", "", "&a> Click to open"), 1);; public static final Category MACHINES_1 = new Category(new CustomItem(getSkull("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTM0M2NlNThkYTU0Yzc5OTI0YTJjOTMzMWNmYzQxN2ZlOGNjYmJlYTliZTQ1YTdhYzg1ODYwYTZjNzMwIn19fQ=="), "&7Basic Machines", "", "&a> Click to open"), 1);
public static final LockedCategory ELECTRICITY = new LockedCategory(new CustomItem(getSkull("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNTU4NDQzMmFmNmYzODIxNjcxMjAyNThkMWVlZThjODdjNmU3NWQ5ZTQ3OWU3YjBkNGM3YjZhZDQ4Y2ZlZWYifX19"), "&bEnergy and Electricity", "", "&a> Click to open"), 4, MACHINES_1); public static final LockedCategory ELECTRICITY = new LockedCategory(new CustomItem(getSkull("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNTU4NDQzMmFmNmYzODIxNjcxMjAyNThkMWVlZThjODdjNmU3NWQ5ZTQ3OWU3YjBkNGM3YjZhZDQ4Y2ZlZWYifX19"), "&bEnergy and Electricity", "", "&a> Click to open"), 4, MACHINES_1);
public static final LockedCategory GPS = new LockedCategory(new CustomItem(getSkull("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjBjOWMxYTAyMmY0MGI3M2YxNGI0Y2JhMzdjNzE4YzZhNTMzZjNhMjg2NGI2NTM2ZDVmNDU2OTM0Y2MxZiJ9fX0="), "&bGPS-based Machines", "", "&a> Click to open"), 4, MACHINES_1); public static final LockedCategory GPS = new LockedCategory(new CustomItem(getSkull("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjBjOWMxYTAyMmY0MGI3M2YxNGI0Y2JhMzdjNzE4YzZhNTMzZjNhMjg2NGI2NTM2ZDVmNDU2OTM0Y2MxZiJ9fX0="), "&bGPS-based Machines", "", "&a> Click to open"), 4, MACHINES_1);
public static final Category ARMOR = new Category(new CustomItem(Material.IRON_CHESTPLATE, "&7Armor", "", "&a> Click to open"), 2); public static final Category ARMOR = new Category(new CustomItem(Material.IRON_CHESTPLATE, "&7Armor", "", "&a> Click to open"), 2);
public static final Category LUMPS_AND_MAGIC = new Category(new CustomItem(Material.FIRE_CHARGE, "&7Magical Items", "", "&a> Click to open"), 2); public static final Category LUMPS_AND_MAGIC = new Category(new CustomItem(Material.FIRE_CHARGE, "&7Magical Items", "", "&a> Click to open"), 2);
public static final Category MAGIC = new Category(new CustomItem(Material.BLAZE_POWDER, "&7Magical Gadgets", "", "&a> Click to open"), 3); public static final Category MAGIC = new Category(new CustomItem(Material.BLAZE_POWDER, "&7Magical Gadgets", "", "&a> Click to open"), 3);
public static final Category MISC = new Category(new CustomItem(getSkull("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTRkYTk3ZjA4MGUzOTViODQyYzRjYzgyYTg0MDgyM2Q0ZGJkOGNhNjg4YTIwNjg1M2U1NzgzZTRiZmRjMDEyIn19fQ=="), "&7Miscellaneous", "", "&a> Click to open"), 2);; public static final Category MISC = new Category(new CustomItem(getSkull("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTRkYTk3ZjA4MGUzOTViODQyYzRjYzgyYTg0MDgyM2Q0ZGJkOGNhNjg4YTIwNjg1M2U1NzgzZTRiZmRjMDEyIn19fQ=="), "&7Miscellaneous", "", "&a> Click to open"), 2);
public static final Category TECH = new Category(new CustomArmor(new CustomItem(Material.LEATHER_CHESTPLATE, "&7Technical Gadgets", "", "&a> Click to open"), Color.SILVER), 3); public static final Category TECH = new Category(new CustomArmor(new CustomItem(Material.LEATHER_CHESTPLATE, "&7Technical Gadgets", "", "&a> Click to open"), Color.SILVER), 3);
public static final Category RESOURCES = new Category(new CustomItem(getSkull("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvY2U4ZjVhZGIxNGQ2YzlmNmI4MTBkMDI3NTQzZjFhOGMxZjQxN2UyZmVkOTkzYzk3YmNkODljNzRmNWUyZTgifX19"), "&7Resources", "", "&a> Click to open"), 1); public static final Category RESOURCES = new Category(new CustomItem(getSkull("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvY2U4ZjVhZGIxNGQ2YzlmNmI4MTBkMDI3NTQzZjFhOGMxZjQxN2UyZmVkOTkzYzk3YmNkODljNzRmNWUyZTgifX19"), "&7Resources", "", "&a> Click to open"), 1);
public static final Category CARGO = new LockedCategory(new CustomItem(getSkull("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZTUxMGJjODUzNjJhMTMwYTZmZjlkOTFmZjExZDZmYTQ2ZDdkMTkxMmEzNDMxZjc1MTU1OGVmM2M0ZDljMiJ9fX0="), "&cCargo Management", "", "&a> Click to open"), 4, MACHINES_1); public static final Category CARGO = new LockedCategory(new CustomItem(getSkull("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZTUxMGJjODUzNjJhMTMwYTZmZjlkOTFmZjExZDZmYTQ2ZDdkMTkxMmEzNDMxZjc1MTU1OGVmM2M0ZDljMiJ9fX0="), "&cCargo Management", "", "&a> Click to open"), 4, MACHINES_1);

View File

@ -101,7 +101,7 @@ public abstract class AFarm extends SlimefunItem {
@Override @Override
public int[] getSlotsAccessedByItemTransport(ItemTransportFlow flow) { public int[] getSlotsAccessedByItemTransport(ItemTransportFlow flow) {
if (flow.equals(ItemTransportFlow.WITHDRAW)) return getOutputSlots(); if (flow == ItemTransportFlow.WITHDRAW) return getOutputSlots();
return new int[0]; return new int[0];
} }
}; };

View File

@ -52,7 +52,7 @@ public class AnimalGrowthAccelerator extends SlimefunItem {
@Override @Override
public int[] getSlotsAccessedByItemTransport(ItemTransportFlow flow) { public int[] getSlotsAccessedByItemTransport(ItemTransportFlow flow) {
if (flow.equals(ItemTransportFlow.INSERT)) return getInputSlots(); if (flow == ItemTransportFlow.INSERT) return getInputSlots();
return new int[0]; return new int[0];
} }
}; };

View File

@ -52,7 +52,7 @@ public class AutoBreeder extends SlimefunItem {
@Override @Override
public int[] getSlotsAccessedByItemTransport(ItemTransportFlow flow) { public int[] getSlotsAccessedByItemTransport(ItemTransportFlow flow) {
if (flow.equals(ItemTransportFlow.INSERT)) return getInputSlots(); if (flow == ItemTransportFlow.INSERT) return getInputSlots();
return new int[0]; return new int[0];
} }
}; };

View File

@ -85,7 +85,7 @@ public abstract class AutomatedCraftingChamber extends SlimefunItem {
@Override @Override
public int[] getSlotsAccessedByItemTransport(BlockMenu menu, ItemTransportFlow flow, ItemStack item) { public int[] getSlotsAccessedByItemTransport(BlockMenu menu, ItemTransportFlow flow, ItemStack item) {
if (flow.equals(ItemTransportFlow.WITHDRAW)) return getOutputSlots(); if (flow == ItemTransportFlow.WITHDRAW) return getOutputSlots();
List<Integer> slots = new ArrayList<>(); List<Integer> slots = new ArrayList<>();
for (int slot : getInputSlots()) { for (int slot : getInputSlots()) {

View File

@ -39,7 +39,7 @@ public class ChargingBench extends AContainer {
@Override @Override
public int[] getSlotsAccessedByItemTransport(ItemTransportFlow flow) { public int[] getSlotsAccessedByItemTransport(ItemTransportFlow flow) {
if (flow.equals(ItemTransportFlow.INSERT)) return getInputSlots(); if (flow == ItemTransportFlow.INSERT) return getInputSlots();
else return getOutputSlots(); else return getOutputSlots();
} }
}; };

View File

@ -64,7 +64,7 @@ public abstract class CropGrowthAccelerator extends SlimefunItem {
@Override @Override
public int[] getSlotsAccessedByItemTransport(ItemTransportFlow flow) { public int[] getSlotsAccessedByItemTransport(ItemTransportFlow flow) {
if (flow.equals(ItemTransportFlow.INSERT)) return getInputSlots(); if (flow == ItemTransportFlow.INSERT) return getInputSlots();
return new int[0]; return new int[0];
} }
}; };

View File

@ -67,7 +67,7 @@ public abstract class ElectricSmeltery extends AContainer {
@Override @Override
public int[] getSlotsAccessedByItemTransport(BlockMenu menu, ItemTransportFlow flow, ItemStack item) { public int[] getSlotsAccessedByItemTransport(BlockMenu menu, ItemTransportFlow flow, ItemStack item) {
if (flow.equals(ItemTransportFlow.WITHDRAW)) return getOutputSlots(); if (flow == ItemTransportFlow.WITHDRAW) return getOutputSlots();
List<Integer> slots = new ArrayList<>(); List<Integer> slots = new ArrayList<>();

View File

@ -64,7 +64,7 @@ public class FluidPump extends SlimefunItem{
@Override @Override
public int[] getSlotsAccessedByItemTransport(ItemTransportFlow flow) { public int[] getSlotsAccessedByItemTransport(ItemTransportFlow flow) {
if (flow.equals(ItemTransportFlow.INSERT)) return getInputSlots(); if (flow == ItemTransportFlow.INSERT) return getInputSlots();
else return getOutputSlots(); else return getOutputSlots();
} }
}; };
@ -117,7 +117,7 @@ public class FluidPump extends SlimefunItem{
protected void tick(Block b) { protected void tick(Block b) {
Block fluid = b.getRelative(BlockFace.DOWN); Block fluid = b.getRelative(BlockFace.DOWN);
if (fluid.getType().equals(Material.LAVA)) { if (fluid.getType() == Material.LAVA) {
for (int slot : getInputSlots()) { for (int slot : getInputSlots()) {
if (SlimefunManager.isItemSimiliar(BlockStorage.getInventory(b).getItemInSlot(slot), new ItemStack(Material.BUCKET), true)) { if (SlimefunManager.isItemSimiliar(BlockStorage.getInventory(b).getItemInSlot(slot), new ItemStack(Material.BUCKET), true)) {
if (ChargableBlock.getCharge(b) < getEnergyConsumption()) return; if (ChargableBlock.getCharge(b) < getEnergyConsumption()) return;
@ -139,7 +139,7 @@ public class FluidPump extends SlimefunItem{
} }
} }
} }
else if (fluid.getType().equals(Material.WATER)) { else if (fluid.getType() == Material.WATER) {
for (int slot : getInputSlots()) { for (int slot : getInputSlots()) {
if (SlimefunManager.isItemSimiliar(BlockStorage.getInventory(b).getItemInSlot(slot), new ItemStack(Material.BUCKET), true)) { if (SlimefunManager.isItemSimiliar(BlockStorage.getInventory(b).getItemInSlot(slot), new ItemStack(Material.BUCKET), true)) {
if (ChargableBlock.getCharge(b) < getEnergyConsumption()) return; if (ChargableBlock.getCharge(b) < getEnergyConsumption()) return;

View File

@ -61,7 +61,7 @@ public abstract class HeatedPressureChamber extends AContainer {
@Override @Override
public int[] getSlotsAccessedByItemTransport(BlockMenu menu, ItemTransportFlow flow, ItemStack item) { public int[] getSlotsAccessedByItemTransport(BlockMenu menu, ItemTransportFlow flow, ItemStack item) {
if (flow.equals(ItemTransportFlow.WITHDRAW)) return getOutputSlots(); if (flow == ItemTransportFlow.WITHDRAW) return getOutputSlots();
List<Integer> slots = new ArrayList<>(); List<Integer> slots = new ArrayList<>();

View File

@ -59,7 +59,7 @@ public abstract class OilPump extends AContainer {
@Override @Override
public int[] getSlotsAccessedByItemTransport(ItemTransportFlow flow) { public int[] getSlotsAccessedByItemTransport(ItemTransportFlow flow) {
if (flow.equals(ItemTransportFlow.INSERT)) return getInputSlots(); if (flow == ItemTransportFlow.INSERT) return getInputSlots();
else return getOutputSlots(); else return getOutputSlots();
} }
}; };

View File

@ -86,13 +86,13 @@ public class ReactorAccessPort extends SlimefunItem {
@Override @Override
public int[] getSlotsAccessedByItemTransport(ItemTransportFlow flow) { public int[] getSlotsAccessedByItemTransport(ItemTransportFlow flow) {
if (flow.equals(ItemTransportFlow.INSERT)) return getInputSlots(); if (flow == ItemTransportFlow.INSERT) return getInputSlots();
else return getOutputSlots(); else return getOutputSlots();
} }
@Override @Override
public int[] getSlotsAccessedByItemTransport(BlockMenu menu, ItemTransportFlow flow, ItemStack item) { public int[] getSlotsAccessedByItemTransport(BlockMenu menu, ItemTransportFlow flow, ItemStack item) {
if (flow.equals(ItemTransportFlow.INSERT)) { if (flow == ItemTransportFlow.INSERT) {
if (SlimefunManager.isItemSimiliar(item, SlimefunItems.REACTOR_COOLANT_CELL, true)) return getCoolantSlots(); if (SlimefunManager.isItemSimiliar(item, SlimefunItems.REACTOR_COOLANT_CELL, true)) return getCoolantSlots();
else if (SlimefunManager.isItemSimiliar(item, SlimefunItems.NETHER_ICE_COOLANT_CELL, true)) return getCoolantSlots(); else if (SlimefunManager.isItemSimiliar(item, SlimefunItems.NETHER_ICE_COOLANT_CELL, true)) return getCoolantSlots();
else return getFuelSlots(); else return getFuelSlots();

View File

@ -41,7 +41,7 @@ public class TrashCan extends SlimefunItem {
@Override @Override
public int[] getSlotsAccessedByItemTransport(ItemTransportFlow flow) { public int[] getSlotsAccessedByItemTransport(ItemTransportFlow flow) {
if (flow.equals(ItemTransportFlow.INSERT)) return getInputSlots(); if (flow == ItemTransportFlow.INSERT) return getInputSlots();
return new int[0]; return new int[0];
} }
}; };

View File

@ -86,13 +86,13 @@ public class WitherAssembler extends SlimefunItem {
@Override @Override
public int[] getSlotsAccessedByItemTransport(ItemTransportFlow flow) { public int[] getSlotsAccessedByItemTransport(ItemTransportFlow flow) {
if (flow.equals(ItemTransportFlow.INSERT)) return getInputSlots(); if (flow == ItemTransportFlow.INSERT) return getInputSlots();
else return new int[0]; else return new int[0];
} }
@Override @Override
public int[] getSlotsAccessedByItemTransport(BlockMenu menu, ItemTransportFlow flow, ItemStack item) { public int[] getSlotsAccessedByItemTransport(BlockMenu menu, ItemTransportFlow flow, ItemStack item) {
if (flow.equals(ItemTransportFlow.INSERT)) { if (flow == ItemTransportFlow.INSERT) {
if (SlimefunManager.isItemSimiliar(item, new ItemStack(Material.SOUL_SAND), true)) return getSoulSandSlots(); if (SlimefunManager.isItemSimiliar(item, new ItemStack(Material.SOUL_SAND), true)) return getSoulSandSlots();
else return getWitherSkullSlots(); else return getWitherSkullSlots();
} }
@ -110,7 +110,7 @@ public class WitherAssembler extends SlimefunItem {
@Override @Override
public boolean onBreak(Player p, Block b, SlimefunItem item, UnregisterReason reason) { public boolean onBreak(Player p, Block b, SlimefunItem item, UnregisterReason reason) {
if (reason.equals(UnregisterReason.EXPLODE)) return false; if (reason == UnregisterReason.EXPLODE) return false;
BlockMenu inv = BlockStorage.getInventory(b); BlockMenu inv = BlockStorage.getInventory(b);
if (inv != null) { if (inv != null) {
for (int slot: getSoulSandSlots()) { for (int slot: getSoulSandSlots()) {

View File

@ -51,7 +51,7 @@ public class XPCollector extends SlimefunItem {
@Override @Override
public int[] getSlotsAccessedByItemTransport(ItemTransportFlow flow) { public int[] getSlotsAccessedByItemTransport(ItemTransportFlow flow) {
if (flow.equals(ItemTransportFlow.WITHDRAW)) return getOutputSlots(); if (flow == ItemTransportFlow.WITHDRAW) return getOutputSlots();
return new int[0]; return new int[0];
} }
}; };

View File

@ -39,7 +39,7 @@ public final class Files {
if (files != null) { if (files != null) {
for (File current: files) { for (File current: files) {
if (current.isDirectory()) { if (current.isDirectory()) {
if (!delete(current)) return false;; if (!delete(current)) return false;
} }
else { else {
if (!current.delete()) return false; if (!current.delete()) return false;

View File

@ -860,7 +860,7 @@ public final class SlimefunSetup {
if (SlimefunManager.isItemSimiliar(item, SlimefunItems.GRAPPLING_HOOK, true)) { if (SlimefunManager.isItemSimiliar(item, SlimefunItems.GRAPPLING_HOOK, true)) {
if (e.getClickedBlock() == null && !variables.jumpState.containsKey(p.getUniqueId())) { if (e.getClickedBlock() == null && !variables.jumpState.containsKey(p.getUniqueId())) {
e.setCancelled(true); e.setCancelled(true);
if (p.getInventory().getItemInOffHand().getType().equals(Material.BOW)) { if (p.getInventory().getItemInOffHand().getType() == Material.BOW) {
// Cancel, to fix dupe #740 // Cancel, to fix dupe #740
return false; return false;
} }
@ -1048,7 +1048,7 @@ public final class SlimefunSetup {
public boolean onBlockBreak(BlockBreakEvent e, ItemStack item, int fortune, List<ItemStack> drops) { public boolean onBlockBreak(BlockBreakEvent e, ItemStack item, int fortune, List<ItemStack> drops) {
if (SlimefunManager.isItemSimiliar(item, SlimefunItems.AUTO_SMELT_PICKAXE, true)) { if (SlimefunManager.isItemSimiliar(item, SlimefunItems.AUTO_SMELT_PICKAXE, true)) {
if (BlockStorage.hasBlockInfo(e.getBlock())) return true; if (BlockStorage.hasBlockInfo(e.getBlock())) return true;
if (e.getBlock().getType().equals(Material.PLAYER_HEAD)) return true; if (e.getBlock().getType() == Material.PLAYER_HEAD) return true;
int j = -1; int j = -1;
List<ItemStack> dropsList = (List<ItemStack>) e.getBlock().getDrops(); List<ItemStack> dropsList = (List<ItemStack>) e.getBlock().getDrops();
@ -1726,7 +1726,7 @@ public final class SlimefunSetup {
drops.add(BlockStorage.retrieve(e.getBlock())); drops.add(BlockStorage.retrieve(e.getBlock()));
} }
} }
else if (b.getType().equals(Material.PLAYER_HEAD)) { else if (b.getType() == Material.PLAYER_HEAD) {
b.breakNaturally(); b.breakNaturally();
} }
else if (b.getType().name().endsWith("_SHULKER_BOX")) { else if (b.getType().name().endsWith("_SHULKER_BOX")) {
@ -1734,7 +1734,7 @@ public final class SlimefunSetup {
} }
else { else {
for (ItemStack drop: b.getDrops()) { for (ItemStack drop: b.getDrops()) {
b.getWorld().dropItemNaturally(b.getLocation(), (b.getType().toString().endsWith("_ORE") && !b.getType().equals(Material.IRON_ORE) && !b.getType().equals(Material.GOLD_ORE)) ? new CustomItem(drop, fortune): drop); b.getWorld().dropItemNaturally(b.getLocation(), (b.getType().toString().endsWith("_ORE") && b.getType() != Material.IRON_ORE && b.getType() != Material.GOLD_ORE) ? new CustomItem(drop, fortune): drop);
} }
b.setType(Material.AIR); b.setType(Material.AIR);
} }
@ -3848,7 +3848,7 @@ public final class SlimefunSetup {
@Override @Override
public boolean onRightClick(ItemUseEvent e, Player p, ItemStack item) { public boolean onRightClick(ItemUseEvent e, Player p, ItemStack item) {
if (SlimefunManager.isItemSimiliar(e.getItem(), SlimefunItems.INFERNAL_BONEMEAL, true)) { if (SlimefunManager.isItemSimiliar(e.getItem(), SlimefunItems.INFERNAL_BONEMEAL, true)) {
if (e.getClickedBlock() != null && e.getClickedBlock().getType().equals(Material.NETHER_WART)) { if (e.getClickedBlock() != null && e.getClickedBlock().getType() == Material.NETHER_WART) {
Ageable ageable = (Ageable)e.getClickedBlock().getBlockData(); Ageable ageable = (Ageable)e.getClickedBlock().getBlockData();
if (ageable.getAge() < ageable.getMaximumAge()) { if (ageable.getAge() < ageable.getMaximumAge()) {
ageable.setAge(ageable.getMaximumAge()); ageable.setAge(ageable.getMaximumAge());
@ -3969,7 +3969,7 @@ public final class SlimefunSetup {
@Override @Override
public int getSpeed() { public int getSpeed() {
return 1; return 1;
}; }
}.registerChargeableBlock(true, 200); }.registerChargeableBlock(true, 200);
@ -4009,7 +4009,7 @@ public final class SlimefunSetup {
@Override @Override
public int getSpeed() { public int getSpeed() {
return 1; return 1;
}; }
}.registerChargeableBlock(true, 256); }.registerChargeableBlock(true, 256);
@ -4260,7 +4260,7 @@ public final class SlimefunSetup {
@Override @Override
public int getSpeed() { public int getSpeed() {
return 1; return 1;
}; }
}.registerChargeableBlock(true, 256); }.registerChargeableBlock(true, 256);
@ -4285,7 +4285,7 @@ public final class SlimefunSetup {
@Override @Override
public int getSpeed() { public int getSpeed() {
return 6; return 6;
}; }
}.registerChargeableBlock(true, 512); }.registerChargeableBlock(true, 512);

View File

@ -214,7 +214,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
@Override @Override
public boolean onBreak(Player p, Block b, SlimefunItem item, UnregisterReason reason) { public boolean onBreak(Player p, Block b, SlimefunItem item, UnregisterReason reason) {
boolean allow = reason.equals(UnregisterReason.PLAYER_BREAK) && (BlockStorage.getLocationInfo(b.getLocation(), "owner").equals(p.getUniqueId().toString()) || p.hasPermission("slimefun.android.bypass")); boolean allow = reason == UnregisterReason.PLAYER_BREAK && (BlockStorage.getLocationInfo(b.getLocation(), "owner").equals(p.getUniqueId().toString()) || p.hasPermission("slimefun.android.bypass"));
if (allow) { if (allow) {
BlockMenu inv = BlockStorage.getInventory(b); BlockMenu inv = BlockStorage.getInventory(b);
@ -332,7 +332,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
break; break;
case CATCH_FISH: case CATCH_FISH:
Block water = b.getRelative(BlockFace.DOWN); Block water = b.getRelative(BlockFace.DOWN);
if (water.getType().equals(Material.WATER)) { if (water.getType() == Material.WATER) {
water.getWorld().playSound(water.getLocation(), Sound.ENTITY_PLAYER_SPLASH, 1F, 1F); water.getWorld().playSound(water.getLocation(), Sound.ENTITY_PLAYER_SPLASH, 1F, 1F);
if (CSCoreLib.randomizer().nextInt(100) < 10 * getTier()) { if (CSCoreLib.randomizer().nextInt(100) < 10 * getTier()) {
ItemStack drop = fish[CSCoreLib.randomizer().nextInt(fish.length)]; ItemStack drop = fish[CSCoreLib.randomizer().nextInt(fish.length)];
@ -1346,7 +1346,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
if (script.getName().endsWith("sfs")) scripts.add(new Config(script)); if (script.getName().endsWith("sfs")) scripts.add(new Config(script));
} }
if (!this.getAndroidType().equals(AndroidType.NONE)) { if (this.getAndroidType() != AndroidType.NONE) {
File directory2 = new File("plugins/Slimefun/scripts/NONE"); File directory2 = new File("plugins/Slimefun/scripts/NONE");
if (!directory2.exists()) directory2.mkdirs(); if (!directory2.exists()) directory2.mkdirs();
@ -1364,7 +1364,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem {
List<ScriptPart> list = new ArrayList<>(); List<ScriptPart> list = new ArrayList<>();
for (final ScriptPart part : ScriptPart.values()) { for (final ScriptPart part : ScriptPart.values()) {
if (!part.equals(ScriptPart.START) && !part.equals(ScriptPart.REPEAT) && getAndroidType().isType(part.getRequiredType())) { if (part != ScriptPart.START && part != ScriptPart.REPEAT && getAndroidType().isType(part.getRequiredType())) {
list.add(part); list.add(part);
} }
} }

View File

@ -16,7 +16,7 @@ public class ItemEnergy {
// "&c&o&8\u21E8 &e\u26A1 &70 / 50 J" // "&c&o&8\u21E8 &e\u26A1 &70 / 50 J"
public static float getStoredEnergy(ItemStack item) { public static float getStoredEnergy(ItemStack item) {
if (item == null || item.getType() == null || item.getType().equals(Material.AIR)) return 0F; if (item == null || item.getType() == null || item.getType() == Material.AIR) return 0F;
if (!item.hasItemMeta() || !item.getItemMeta().hasLore()) return 0F; if (!item.hasItemMeta() || !item.getItemMeta().hasLore()) return 0F;
for (String line: item.getItemMeta().getLore()) { for (String line: item.getItemMeta().getLore()) {
@ -29,7 +29,7 @@ public class ItemEnergy {
} }
public static float getMaxEnergy(ItemStack item) { public static float getMaxEnergy(ItemStack item) {
if (item == null || item.getType() == null || item.getType().equals(Material.AIR)) return 0F; if (item == null || item.getType() == null || item.getType() == Material.AIR) return 0F;
if (!item.hasItemMeta() || !item.getItemMeta().hasLore()) return 0F; if (!item.hasItemMeta() || !item.getItemMeta().hasLore()) return 0F;
for (String line: item.getItemMeta().getLore()) { for (String line: item.getItemMeta().getLore()) {
@ -42,7 +42,7 @@ public class ItemEnergy {
} }
public static float addStoredEnergy(ItemStack item, float energy) { public static float addStoredEnergy(ItemStack item, float energy) {
if (item == null || item.getType() == null || item.getType().equals(Material.AIR)) return 0F; if (item == null || item.getType() == null || item.getType() == Material.AIR) return 0F;
if (!item.hasItemMeta() || !item.getItemMeta().hasLore()) return 0F; if (!item.hasItemMeta() || !item.getItemMeta().hasLore()) return 0F;
float rest = 0F; float rest = 0F;

View File

@ -64,7 +64,7 @@ public class AncientAltarListener implements Listener {
e.setCancelled(true); e.setCancelled(true);
Item stack = findItem(b); Item stack = findItem(b);
if (stack == null) { if (stack == null) {
if(e.getPlayer().getInventory().getItemInMainHand().getType().equals(Material.AIR)) return; if(e.getPlayer().getInventory().getItemInMainHand().getType() == Material.AIR) return;
if(b.getRelative(0, 1, 0).getType() != Material.AIR) { if(b.getRelative(0, 1, 0).getType() != Material.AIR) {
Messages.local.sendTranslation(e.getPlayer(), "machines.ANCIENT_PEDESTAL.obstructed", true); Messages.local.sendTranslation(e.getPlayer(), "machines.ANCIENT_PEDESTAL.obstructed", true);
return; return;
@ -102,7 +102,7 @@ public class AncientAltarListener implements Listener {
if (pedestals.size() == 8) { if (pedestals.size() == 8) {
pedestals.forEach(block -> utilities.altarinuse.add(block.getLocation())); pedestals.forEach(block -> utilities.altarinuse.add(block.getLocation()));
if (catalyst != null && !catalyst.getType().equals(Material.AIR)) { if (catalyst != null && catalyst.getType() != Material.AIR) {
List<ItemStack> input = new ArrayList<>(); List<ItemStack> input = new ArrayList<>();
for (Block pedestal: pedestals) { for (Block pedestal: pedestals) {
Item stack = findItem(pedestal); Item stack = findItem(pedestal);

View File

@ -80,7 +80,7 @@ public class BlockListener implements Listener {
@EventHandler @EventHandler
public void onRightClick(PlayerInteractEvent e) { public void onRightClick(PlayerInteractEvent e) {
if (e.getAction() == Action.RIGHT_CLICK_BLOCK) { if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
if (!e.getHand().equals(EquipmentSlot.HAND)) return; if (e.getHand() != EquipmentSlot.HAND) return;
Player p = e.getPlayer(); Player p = e.getPlayer();
Block b = e.getClickedBlock(); Block b = e.getClickedBlock();
List<MultiBlock> multiblocks = new ArrayList<>(); List<MultiBlock> multiblocks = new ArrayList<>();
@ -119,7 +119,7 @@ public class BlockListener implements Listener {
if (blocks[0] != null && blocks[0] == blocks[2] && !BlockAdjacents.hasMaterialOnBothSides(b.getRelative(0, 1, 0), blocks[0])); if (blocks[0] != null && blocks[0] == blocks[2] && !BlockAdjacents.hasMaterialOnBothSides(b.getRelative(0, 1, 0), blocks[0]));
else if (blocks[3] != null && blocks[3] == blocks[5] && !BlockAdjacents.hasMaterialOnBothSides(b.getRelative(0, 0, 0), blocks[5])); else if (blocks[3] != null && blocks[3] == blocks[5] && !BlockAdjacents.hasMaterialOnBothSides(b.getRelative(0, 0, 0), blocks[5]));
else if (blocks[6] != null && blocks[6] == blocks[8] && !BlockAdjacents.hasMaterialOnBothSides(b.getRelative(0, -1, 0), blocks[8])); else if (blocks[6] != null && blocks[6] == blocks[8] && !BlockAdjacents.hasMaterialOnBothSides(b.getRelative(0, -1, 0), blocks[8]));
else multiblocks.add(mb);; else multiblocks.add(mb);
} }
} }
else if (mb.getTriggerBlock() == blocks[7]) { else if (mb.getTriggerBlock() == blocks[7]) {
@ -136,7 +136,7 @@ public class BlockListener implements Listener {
if (blocks[0] != null && blocks[0] == blocks[2] && !BlockAdjacents.hasMaterialOnBothSides(b.getRelative(0, 2, 0), blocks[0])); if (blocks[0] != null && blocks[0] == blocks[2] && !BlockAdjacents.hasMaterialOnBothSides(b.getRelative(0, 2, 0), blocks[0]));
else if (blocks[3] != null && blocks[3] == blocks[5] && !BlockAdjacents.hasMaterialOnBothSides(b.getRelative(0, 1, 0), blocks[5])); else if (blocks[3] != null && blocks[3] == blocks[5] && !BlockAdjacents.hasMaterialOnBothSides(b.getRelative(0, 1, 0), blocks[5]));
else if (blocks[6] != null && blocks[6] == blocks[8] && !BlockAdjacents.hasMaterialOnBothSides(b.getRelative(0, 0, 0), blocks[8])); else if (blocks[6] != null && blocks[6] == blocks[8] && !BlockAdjacents.hasMaterialOnBothSides(b.getRelative(0, 0, 0), blocks[8]));
else multiblocks.add(mb);; else multiblocks.add(mb);
} }
} }
} }

View File

@ -117,7 +117,7 @@ public class ItemListener implements Listener {
} }
@EventHandler @EventHandler
public void debug(PlayerInteractEvent e) { public void debug(PlayerInteractEvent e) {
if (e.getAction().equals(Action.PHYSICAL) || !e.getHand().equals(EquipmentSlot.HAND)) return; if (e.getAction() == Action.PHYSICAL || e.getHand() != EquipmentSlot.HAND) return;
Player p = e.getPlayer(); Player p = e.getPlayer();
@ -196,7 +196,7 @@ public class ItemListener implements Listener {
@EventHandler(priority = EventPriority.NORMAL) @EventHandler(priority = EventPriority.NORMAL)
public void onRightClick(ItemUseEvent e) { public void onRightClick(ItemUseEvent e) {
if (e.getParentEvent() != null && !e.getParentEvent().getHand().equals(EquipmentSlot.HAND)) { if (e.getParentEvent() != null && e.getParentEvent().getHand() != EquipmentSlot.HAND) {
return; return;
} }
@ -297,7 +297,7 @@ public class ItemListener implements Listener {
} }
private boolean canPlaceBlock(Player p, Block relative) { private boolean canPlaceBlock(Player p, Block relative) {
return p.isSneaking() && relative.getType().equals(Material.AIR); return p.isSneaking() && relative.getType() == Material.AIR;
} }
@EventHandler @EventHandler

View File

@ -23,7 +23,7 @@ public class TeleporterListener implements Listener {
@EventHandler(priority=EventPriority.HIGHEST,ignoreCancelled=true) @EventHandler(priority=EventPriority.HIGHEST,ignoreCancelled=true)
public void onStarve(PlayerInteractEvent e) { public void onStarve(PlayerInteractEvent e) {
if (!e.getAction().equals(Action.PHYSICAL)) return; if (e.getAction() != Action.PHYSICAL) return;
if (e.getClickedBlock() == null) return; if (e.getClickedBlock() == null) return;
SlimefunItem item = BlockStorage.check(e.getClickedBlock()); SlimefunItem item = BlockStorage.check(e.getClickedBlock());