1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-21 04:05:48 +00:00

Fixed Mincraft Version Compatibility and some IDE weirdness

This commit is contained in:
beSnow 2020-05-15 11:22:22 +02:00
parent 865f97d1ba
commit d88c815005
3 changed files with 60 additions and 71 deletions

View File

@ -3353,22 +3353,24 @@ public final class SlimefunItemSetup {
new ItemStack[] {SlimefunItems.BLISTERING_INGOT_3, new ItemStack(Material.NETHER_STAR), SlimefunItems.BLISTERING_INGOT_3, SlimefunItems.WITHER_PROOF_OBSIDIAN, SlimefunItems.ANDROID_MEMORY_CORE, SlimefunItems.WITHER_PROOF_OBSIDIAN, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.REINFORCED_ALLOY_INGOT, SlimefunItems.CARBONADO_EDGED_CAPACITOR}) new ItemStack[] {SlimefunItems.BLISTERING_INGOT_3, new ItemStack(Material.NETHER_STAR), SlimefunItems.BLISTERING_INGOT_3, SlimefunItems.WITHER_PROOF_OBSIDIAN, SlimefunItems.ANDROID_MEMORY_CORE, SlimefunItems.WITHER_PROOF_OBSIDIAN, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.REINFORCED_ALLOY_INGOT, SlimefunItems.CARBONADO_EDGED_CAPACITOR})
.register(plugin); .register(plugin);
new SlimefunItem(categories.magicalArmor, SlimefunItems.BEE_HELMET, RecipeType.ARMOR_FORGE, if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_15)) {
new ItemStack[]{SlimefunItems.GOLD_8K, new ItemStack(Material.HONEY_BLOCK), SlimefunItems.GOLD_8K, new ItemStack(Material.HONEYCOMB_BLOCK), null, new ItemStack(Material.HONEYCOMB_BLOCK), null, null, null}) new SlimefunItem(categories.magicalArmor, SlimefunItems.BEE_HELMET, RecipeType.ARMOR_FORGE,
.register(plugin); new ItemStack[]{SlimefunItems.GOLD_8K, new ItemStack(Material.HONEY_BLOCK), SlimefunItems.GOLD_8K, new ItemStack(Material.HONEYCOMB_BLOCK), null, new ItemStack(Material.HONEYCOMB_BLOCK), null, null, null})
.register(plugin);
new SlimefunItem(categories.magicalArmor, SlimefunItems.BEE_WINGS, RecipeType.ARMOR_FORGE, new SlimefunItem(categories.magicalArmor, SlimefunItems.BEE_WINGS, RecipeType.ARMOR_FORGE,
new ItemStack[]{SlimefunItems.GOLD_8K, null, SlimefunItems.GOLD_8K, new ItemStack(Material.HONEYCOMB_BLOCK), new ItemStack(Material.ELYTRA), new ItemStack(Material.HONEYCOMB_BLOCK), new ItemStack(Material.HONEY_BLOCK), SlimefunItems.GOLD_8K, new ItemStack(Material.HONEY_BLOCK)}) new ItemStack[]{SlimefunItems.GOLD_8K, null, SlimefunItems.GOLD_8K, new ItemStack(Material.HONEYCOMB_BLOCK), new ItemStack(Material.ELYTRA), new ItemStack(Material.HONEYCOMB_BLOCK), new ItemStack(Material.HONEY_BLOCK), SlimefunItems.GOLD_8K, new ItemStack(Material.HONEY_BLOCK)})
.register(plugin); .register(plugin);
new SlimefunItem(categories.magicalArmor, SlimefunItems.BEE_LEGGINGS, RecipeType.ARMOR_FORGE, new SlimefunItem(categories.magicalArmor, SlimefunItems.BEE_LEGGINGS, RecipeType.ARMOR_FORGE,
new ItemStack[]{SlimefunItems.GOLD_8K, new ItemStack(Material.HONEY_BLOCK), SlimefunItems.GOLD_8K, new ItemStack(Material.HONEYCOMB_BLOCK), null, new ItemStack(Material.HONEYCOMB_BLOCK), new ItemStack(Material.HONEYCOMB_BLOCK), null, new ItemStack(Material.HONEYCOMB_BLOCK)}) new ItemStack[]{SlimefunItems.GOLD_8K, new ItemStack(Material.HONEY_BLOCK), SlimefunItems.GOLD_8K, new ItemStack(Material.HONEYCOMB_BLOCK), null, new ItemStack(Material.HONEYCOMB_BLOCK), new ItemStack(Material.HONEYCOMB_BLOCK), null, new ItemStack(Material.HONEYCOMB_BLOCK)})
.register(plugin); .register(plugin);
new SlimefunArmorPiece(categories.magicalArmor, SlimefunItems.BEE_BOOTS, RecipeType.ARMOR_FORGE, new SlimefunArmorPiece(categories.magicalArmor, SlimefunItems.BEE_BOOTS, RecipeType.ARMOR_FORGE,
new ItemStack[]{null, null, null, SlimefunItems.GOLD_8K, null, SlimefunItems.GOLD_8K, new ItemStack(Material.HONEY_BLOCK), null, new ItemStack(Material.HONEY_BLOCK)}, new ItemStack[]{null, null, null, SlimefunItems.GOLD_8K, null, SlimefunItems.GOLD_8K, new ItemStack(Material.HONEY_BLOCK), null, new ItemStack(Material.HONEY_BLOCK)},
new PotionEffect[]{new PotionEffect(PotionEffectType.JUMP, 300, 2)}) new PotionEffect[]{new PotionEffect(PotionEffectType.JUMP, 300, 2)})
.register(plugin); .register(plugin);
}
} }
private static void registerArmorSet(Category category, ItemStack baseComponent, ItemStack[] items, String idSyntax, boolean vanilla, SlimefunAddon addon) { private static void registerArmorSet(Category category, ItemStack baseComponent, ItemStack[] items, String idSyntax, boolean vanilla, SlimefunAddon addon) {

View File

@ -266,11 +266,35 @@ public final class SlimefunItems {
public static final SlimefunItemStack BOOTS_OF_THE_STOMPER = new SlimefunItemStack("BOOTS_OF_THE_STOMPER", Material.LEATHER_BOOTS, Color.AQUA, "&bBoots of the Stomper", "", "&9All Fall Damage you receive", "&9will be applied to nearby Mobs/Players", "", "&9+ No Fall Damage"); public static final SlimefunItemStack BOOTS_OF_THE_STOMPER = new SlimefunItemStack("BOOTS_OF_THE_STOMPER", Material.LEATHER_BOOTS, Color.AQUA, "&bBoots of the Stomper", "", "&9All Fall Damage you receive", "&9will be applied to nearby Mobs/Players", "", "&9+ No Fall Damage");
public static final SlimefunItemStack BEE_HELMET = new SlimefunItemStack("BEE_HELMET", Material.GOLDEN_HELMET, "&e&lBee Helmet", " ", "&e&oNOT THE BEES"); public static final SlimefunItemStack BEE_HELMET;
public static final SlimefunItemStack BEE_WINGS = new SlimefunItemStack("BEE_WINGS", Material.ELYTRA, "&e&lBee Wings", " ", "&e&oFly Like a Bee", " ", "&9Activates Slow falling", "&9When approaching the ground", " "); public static final SlimefunItemStack BEE_WINGS;
public static final SlimefunItemStack BEE_LEGGINGS = new SlimefunItemStack("BEE_LEGGINGS", Material.GOLDEN_LEGGINGS, "&e&lBee Leggings", " ", "&e&oBee like a Bee"); public static final SlimefunItemStack BEE_LEGGINGS;
public static final SlimefunItemStack BEE_BOOTS = new SlimefunItemStack("BEE_BOOTS", Material.GOLDEN_BOOTS, "&e&lBee Boots", "", "&e&oNever have trouble taking off again", "", "&9+ Jump Boost", "&9+ No Fall Damage"); public static final SlimefunItemStack BEE_BOOTS;
static {
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_15)) {
BEE_HELMET = new SlimefunItemStack("BEE_HELMET", Material.GOLDEN_HELMET, "&e&lBee Helmet", " ", "&e&oNOT THE BEES");
BEE_WINGS = new SlimefunItemStack("BEE_WINGS", Material.ELYTRA, "&e&lBee Wings", " ", "&e&oFly Like a Bee", " ", "&9Activates Slow falling", "&9When approaching the ground", " ");
BEE_LEGGINGS = new SlimefunItemStack("BEE_LEGGINGS", Material.GOLDEN_LEGGINGS, "&e&lBee Leggings", " ", "&e&oBee like a Bee");
BEE_BOOTS = new SlimefunItemStack("BEE_BOOTS", Material.GOLDEN_BOOTS, "&e&lBee Boots", "", "&e&oNever have trouble taking off again", "", "&9+ Jump Boost", "&9+ No Fall Damage");
Map<Enchantment, Integer> bee = new HashMap<>();
bee.put(Enchantment.DURABILITY, 4);
bee.put(Enchantment.PROTECTION_ENVIRONMENTAL, 2);
BEE_HELMET.addUnsafeEnchantments(bee);
BEE_WINGS.addUnsafeEnchantments(bee);
BEE_LEGGINGS.addUnsafeEnchantments(bee);
BEE_BOOTS.addUnsafeEnchantments(bee);
}
else {
BEE_HELMET = null;
BEE_WINGS = null;
BEE_LEGGINGS = null;
BEE_BOOTS = null;
}
}
static { static {
Map<Enchantment, Integer> cactus = new HashMap<>(); Map<Enchantment, Integer> cactus = new HashMap<>();
cactus.put(Enchantment.THORNS, 3); cactus.put(Enchantment.THORNS, 3);
@ -321,15 +345,6 @@ public final class SlimefunItems {
SLIME_CHESTPLATE_STEEL.addUnsafeEnchantments(slime); SLIME_CHESTPLATE_STEEL.addUnsafeEnchantments(slime);
SLIME_LEGGINGS_STEEL.addUnsafeEnchantments(slime); SLIME_LEGGINGS_STEEL.addUnsafeEnchantments(slime);
SLIME_BOOTS_STEEL.addUnsafeEnchantments(slime); SLIME_BOOTS_STEEL.addUnsafeEnchantments(slime);
Map<Enchantment, Integer> bee = new HashMap<>();
bee.put(Enchantment.DURABILITY, 4);
bee.put(Enchantment.PROTECTION_ENVIRONMENTAL, 2);
BEE_HELMET.addUnsafeEnchantments(bee);
BEE_WINGS.addUnsafeEnchantments(bee);
BEE_LEGGINGS.addUnsafeEnchantments(bee);
BEE_BOOTS.addUnsafeEnchantments(bee);
} }
/* Misc */ /* Misc */

View File

@ -9,38 +9,7 @@ import java.util.Set;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.AncientAltarListener; import io.github.thebusybiscuit.slimefun4.implementation.listeners.*;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.BackpackListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.BlockListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.BlockPhysicsListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.CargoNodeListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.CoolerListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.DeathpointListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.DebugFishListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.DispenserListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.EnhancedFurnaceListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.ExplosionsListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.FireworksListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.GadgetsListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.GrapplingHookListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.IronGolemListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.ItemPickupListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.MobDropListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.MultiBlockListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.PlayerProfileListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.SeismicAxeListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunBootsListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunBowListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunGuideListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunItemConsumeListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunItemListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.SoulboundListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.TalismanListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.VampireBladeListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.VanillaMachinesListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.WitherListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.WorldListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.BeeWingListener;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.World; import org.bukkit.World;
@ -100,7 +69,7 @@ import me.mrCookieSlime.Slimefun.api.inventory.UniversalBlockMenu;
* This is the main class of Slimefun. * This is the main class of Slimefun.
* This is where all the magic starts, take a look around. * This is where all the magic starts, take a look around.
* Feel like home. * Feel like home.
* *
* @author TheBusyBiscuit * @author TheBusyBiscuit
* *
*/ */
@ -200,8 +169,7 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
if (config.getBoolean("options.auto-update")) { if (config.getBoolean("options.auto-update")) {
getLogger().log(Level.INFO, "Starting Auto-Updater..."); getLogger().log(Level.INFO, "Starting Auto-Updater...");
updaterService.start(); updaterService.start();
} } else {
else {
updaterService.disable(); updaterService.disable();
} }
@ -238,7 +206,6 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
new FireworksListener(this); new FireworksListener(this);
new WitherListener(this); new WitherListener(this);
new IronGolemListener(this); new IronGolemListener(this);
new BeeWingListener(this);
// Item-specific Listeners // Item-specific Listeners
new VampireBladeListener(this, (VampireBlade) SlimefunItems.BLADE_OF_VAMPIRES.getItem()); new VampireBladeListener(this, (VampireBlade) SlimefunItems.BLADE_OF_VAMPIRES.getItem());
@ -271,6 +238,11 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
// Clear the Slimefun Guide History upon Player Leaving // Clear the Slimefun Guide History upon Player Leaving
new PlayerProfileListener(this); new PlayerProfileListener(this);
// Listeners that only need to function in at least Minecraft version 1.15.X
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_15)) {
new BeeWingListener(this);
}
// Initiating various Stuff and all Items with a slightly delay (0ms after the Server finished loading) // Initiating various Stuff and all Items with a slightly delay (0ms after the Server finished loading)
Slimefun.runSync(new SlimefunStartupTask(this, () -> { Slimefun.runSync(new SlimefunStartupTask(this, () -> {
protections = new ProtectionManager(getServer()); protections = new ProtectionManager(getServer());
@ -325,7 +297,7 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
/** /**
* This method checks for the {@link MinecraftVersion} of the {@link Server}. * This method checks for the {@link MinecraftVersion} of the {@link Server}.
* If the version is unsupported, a warning will be printed to the console. * If the version is unsupported, a warning will be printed to the console.
* *
* @return Whether the {@link MinecraftVersion} is unsupported * @return Whether the {@link MinecraftVersion} is unsupported
*/ */
private boolean isVersionUnsupported() { private boolean isVersionUnsupported() {
@ -488,7 +460,7 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
/** /**
* This returns the version of Slimefun that is currently installed. * This returns the version of Slimefun that is currently installed.
* *
* @return The currently installed version of Slimefun * @return The currently installed version of Slimefun
*/ */
public static String getVersion() { public static String getVersion() {
@ -501,7 +473,7 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
/** /**
* This returns the {@link LocalizationService} of Slimefun. * This returns the {@link LocalizationService} of Slimefun.
* *
* @return The {@link LocalizationService} of Slimefun * @return The {@link LocalizationService} of Slimefun
*/ */
public static LocalizationService getLocal() { public static LocalizationService getLocal() {
@ -539,7 +511,7 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
/** /**
* This method returns the {@link UpdaterService} of Slimefun. * This method returns the {@link UpdaterService} of Slimefun.
* It is used to handle automatic updates. * It is used to handle automatic updates.
* *
* @return The {@link UpdaterService} for Slimefun * @return The {@link UpdaterService} for Slimefun
*/ */
public static UpdaterService getUpdater() { public static UpdaterService getUpdater() {
@ -549,7 +521,7 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
/** /**
* This method returns the {@link GitHubService} of Slimefun. * This method returns the {@link GitHubService} of Slimefun.
* It is used to retrieve data from GitHub repositories. * It is used to retrieve data from GitHub repositories.
* *
* @return The {@link GitHubService} for Slimefun * @return The {@link GitHubService} for Slimefun
*/ */
public static GitHubService getGitHubService() { public static GitHubService getGitHubService() {
@ -583,9 +555,9 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
/** /**
* This method returns a {@link Set} of every {@link Plugin} that lists Slimefun * This method returns a {@link Set} of every {@link Plugin} that lists Slimefun
* as a required or optional dependency. * as a required or optional dependency.
* *
* We will just assume this to be a list of our addons. * We will just assume this to be a list of our addons.
* *
* @return A {@link Set} of every {@link Plugin} that is dependent on Slimefun * @return A {@link Set} of every {@link Plugin} that is dependent on Slimefun
*/ */
public static Set<Plugin> getInstalledAddons() { public static Set<Plugin> getInstalledAddons() {
@ -594,7 +566,7 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
/** /**
* The {@link Command} that was added by Slimefun. * The {@link Command} that was added by Slimefun.
* *
* @return Slimefun's command * @return Slimefun's command
*/ */
public static SlimefunCommand getCommand() { public static SlimefunCommand getCommand() {
@ -603,7 +575,7 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
/** /**
* This returns the currently installed version of Minecraft. * This returns the currently installed version of Minecraft.
* *
* @return The current version of Minecraft * @return The current version of Minecraft
*/ */
public static MinecraftVersion getMinecraftVersion() { public static MinecraftVersion getMinecraftVersion() {