diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 9a726c5..555dace 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -15,23 +15,23 @@ jobs:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2
- - name: Set up JDK 1.8
- uses: actions/setup-java@v1
- with:
- java-version: 1.8
- - name: Build with Maven
- run: mvn -B package --file pom.xml
- - name: Move Files
- run: mkdir staging && cp target/*.jar staging
- - name: Pack
- uses: actions/cache@v1
- with:
- path: ~/.m2
- key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
- restore-keys: ${{ runner.os }}-m2
- - name: Upload Artifact
- uses: actions/upload-artifact@v1
- with:
- name: ClayTech
- path: staging
+ - uses: actions/checkout@v2
+ - name: Set up JDK 1.8
+ uses: actions/setup-java@v1
+ with:
+ java-version: 1.8
+ - name: Build with Maven
+ run: mvn -B package --file pom.xml
+ - name: Move Files
+ run: mkdir staging && cp target/*.jar staging
+ - name: Pack
+ uses: actions/cache@v1
+ with:
+ path: ~/.m2
+ key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
+ restore-keys: ${{ runner.os }}-m2
+ - name: Upload Artifact
+ uses: actions/upload-artifact@v1
+ with:
+ name: ClayTech
+ path: staging
diff --git a/pom.xml b/pom.xml
index cca09ad..931bad0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,84 +1,85 @@
-
- 4.0.0
- club.claycoffee
- ClayTech
- 1.2.0-dev17
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
-
- 1.8
-
-
-
-
-
-
- spigot-repo
- https://hub.spigotmc.org/nexus/content/repositories/snapshots/
-
-
- jitpack.io
- https://jitpack.io
-
-
-
-
- org.spigotmc
- spigot-api
- 1.16.1-R0.1-SNAPSHOT
- provided
-
-
- com.github.TheBusyBiscuit
- CS-CoreLib
- master-SNAPSHOT
- provided
-
-
- io.github.thebusybiscuit
- cscorelib2
-
-
- org.bstats
- bstats-bukkit
-
-
-
-
- com.github.Multiverse
- Multiverse-Core
- master-SNAPSHOT
- provided
-
-
- com.github.TheBusyBiscuit
- Slimefun4
- master-SNAPSHOT
- provided
-
-
- io.github.thebusybiscuit
- cscorelib2
-
-
- org.bstats
- bstats-bukkit
-
-
-
-
+
+ 4.0.0
+ club.claycoffee
+ ClayTech
+ 1.2.0-dev17
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+ 1.8
+
+
+
+
+
+
+ spigot-repo
+ https://hub.spigotmc.org/nexus/content/repositories/snapshots/
+
+
+ jitpack.io
+ https://jitpack.io
+
+
+
+
+ org.spigotmc
+ spigot-api
+ 1.16.1-R0.1-SNAPSHOT
+ provided
+
+
+ com.github.TheBusyBiscuit
+ CS-CoreLib
+ master-SNAPSHOT
+ provided
+
+
+ io.github.thebusybiscuit
+ cscorelib2
+
+
+ org.bstats
+ bstats-bukkit
+
+
+
+
+ com.github.Multiverse
+ Multiverse-Core
+ master-SNAPSHOT
+ provided
+
+
+ com.github.TheBusyBiscuit
+ Slimefun4
+ master-SNAPSHOT
+ provided
+
+
+ io.github.thebusybiscuit
+ cscorelib2
+
+
+ org.bstats
+ bstats-bukkit
+
+
+
+
org.eclipse.jdt
Anotation
2.2.400
system
${project.basedir}/lib/org.eclipse.jdt.annotation_2.2.400.v20191120-1313.jar
-
-
-
+
+
+
UTF-8
\ No newline at end of file
diff --git a/src/main/java/club/claycoffee/ClayTech/ClayTech.java b/src/main/java/club/claycoffee/ClayTech/ClayTech.java
index 846976f..c7975e2 100644
--- a/src/main/java/club/claycoffee/ClayTech/ClayTech.java
+++ b/src/main/java/club/claycoffee/ClayTech/ClayTech.java
@@ -1,10 +1,22 @@
package club.claycoffee.ClayTech;
-import java.io.File;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.List;
-
+import club.claycoffee.ClayTech.api.ClayTechManager;
+import club.claycoffee.ClayTech.api.Planet;
+import club.claycoffee.ClayTech.implementation.Planets.Earth;
+import club.claycoffee.ClayTech.implementation.Planets.Mars;
+import club.claycoffee.ClayTech.implementation.Planets.Moon;
+import club.claycoffee.ClayTech.implementation.items.*;
+import club.claycoffee.ClayTech.implementation.machines.*;
+import club.claycoffee.ClayTech.implementation.resources.ClayFuel;
+import club.claycoffee.ClayTech.listeners.*;
+import club.claycoffee.ClayTech.utils.*;
+import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
+import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon;
+import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
+import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
+import me.mrCookieSlime.Slimefun.Lists.RecipeType;
+import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
@@ -17,552 +29,506 @@
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable;
-import club.claycoffee.ClayTech.utils.DataYML;
-import club.claycoffee.ClayTech.utils.Lang;
-import club.claycoffee.ClayTech.utils.Metrics;
-import club.claycoffee.ClayTech.utils.PlanetUtils;
-import club.claycoffee.ClayTech.utils.RocketUtils;
-import club.claycoffee.ClayTech.utils.Utils;
-import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
-import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
-import club.claycoffee.ClayTech.api.ClayTechManager;
-import club.claycoffee.ClayTech.api.Planet;
-import club.claycoffee.ClayTech.implementation.Planets.Earth;
-import club.claycoffee.ClayTech.implementation.Planets.Mars;
-import club.claycoffee.ClayTech.implementation.Planets.Moon;
-import club.claycoffee.ClayTech.implementation.items.Armors;
-import club.claycoffee.ClayTech.implementation.items.ClayFuelResource;
-import club.claycoffee.ClayTech.implementation.items.Clay_basic;
-import club.claycoffee.ClayTech.implementation.items.DrinkMakingStaff;
-import club.claycoffee.ClayTech.implementation.items.Drinks;
-import club.claycoffee.ClayTech.implementation.items.EffectItems;
-import club.claycoffee.ClayTech.implementation.items.Elements;
-import club.claycoffee.ClayTech.implementation.items.FoodMakingStaff;
-import club.claycoffee.ClayTech.implementation.items.Foods;
-import club.claycoffee.ClayTech.implementation.items.Golden_things;
-import club.claycoffee.ClayTech.implementation.items.Ingots;
-import club.claycoffee.ClayTech.implementation.items.MachineMakingBasic;
-import club.claycoffee.ClayTech.implementation.items.PotionAffect_Weapons;
-import club.claycoffee.ClayTech.implementation.items.Railways;
-import club.claycoffee.ClayTech.implementation.items.RocketMakings;
-import club.claycoffee.ClayTech.implementation.items.Rockets;
-import club.claycoffee.ClayTech.implementation.items.Skulls;
-import club.claycoffee.ClayTech.implementation.items.Tools;
-import club.claycoffee.ClayTech.implementation.machines.CobbleStoneGenerator;
-import club.claycoffee.ClayTech.implementation.machines.CraftingTable;
-import club.claycoffee.ClayTech.implementation.machines.ElectricStoneCrusher;
-import club.claycoffee.ClayTech.implementation.machines.ElectricWaterPump;
-import club.claycoffee.ClayTech.implementation.machines.ElementExtracter;
-import club.claycoffee.ClayTech.implementation.machines.ExperimentTableNormal;
-import club.claycoffee.ClayTech.implementation.machines.FoodCauldron;
-import club.claycoffee.ClayTech.implementation.machines.FoodChalkingMachine;
-import club.claycoffee.ClayTech.implementation.machines.RocketAssemblingMachine;
-import club.claycoffee.ClayTech.implementation.machines.RocketFuelGenerator;
-import club.claycoffee.ClayTech.implementation.machines.RocketFuelInjector;
-import club.claycoffee.ClayTech.implementation.machines.SpaceSuitOxygenInjector;
-import club.claycoffee.ClayTech.implementation.resources.ClayFuel;
-import club.claycoffee.ClayTech.listeners.*;
-import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
-import me.mrCookieSlime.Slimefun.Lists.RecipeType;
-import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
+import java.io.File;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.List;
public class ClayTech extends JavaPlugin implements SlimefunAddon {
- protected static ClayTech plugin;
- private static String locale;
- private static DataYML currentLangYML;
- private static FileConfiguration currentLang;
- private static DataYML planetYML;
- private static String highrailspeed;
- private static String version = Bukkit.getServer().getClass().getPackage().getName().replace(".", ",")
- .split(",")[3];
- private static boolean compatible = true;
- private static List planetList = new ArrayList();
- private static String overworld = "";
- private static DataYML planetDataYML;
- private static ClayTechUpdater updater;
- private static boolean spacetravelneedperm;
-
- public static ClayTech getInstance() {
- return plugin;
- }
-
- public static String getLocale() {
- return locale;
- }
-
- public static DataYML getLangYML() {
- return currentLangYML;
- }
-
- public static boolean isSpaceTravelNeedPerm() {
- return spacetravelneedperm;
- }
-
- public static String getHighRailSpeed() {
- return highrailspeed;
- }
-
- public static ClayTechUpdater getUpdater() {
- return updater;
- }
-
- public static boolean getCompatible() {
- return compatible;
- }
-
- public static List getPlanets() {
- return planetList;
- }
-
- public static String getOverworld() {
- return overworld;
- }
-
- public static DataYML getPlanetYML() {
- return planetYML;
- }
-
- public static DataYML getPlanetDataYML() {
- return planetDataYML;
- }
-
- @SuppressWarnings({ "unused", "static-access" })
- @Override
- public void onEnable() {
- plugin = this;
- // 当前研究ID: 9933
- this.saveDefaultConfig();
- FileConfiguration config = this.getConfig();
- locale = config.getString("Locale");
- if (locale == null)
- locale = "en-US";
- highrailspeed = config.getString("highrailspeed");
- if (highrailspeed == null)
- highrailspeed = "3";
- if (!Utils.ExitsInList(locale, Lang.LocaleList)) {
- Utils.info("§cLoading Error: Locale not found.Disableing plugin..");
- this.getServer().getPluginManager().disablePlugin(this);
- }
- // config
- try {
- FileConfiguration current = YamlConfiguration
- .loadConfiguration(new InputStreamReader(this.getResource("config.yml"), "UTF8"));
- List currentconfig = new ArrayList();
- for (String each : config.getKeys(false)) {
- currentconfig.add(each);
- }
- for (String each : current.getKeys(false)) {
- if (!Utils.ExitsInListL(each, currentconfig)) {
- try {
- if (current.isString(each)) {
- config.set(each, current.getString(each));
- }
- if (current.isInt(each)) {
- config.set(each, current.getInt(each));
- }
- if (current.isList(each)) {
- config.set(each, current.getList(each));
- }
- if (current.isBoolean(each)) {
- config.set(each, current.getBoolean(each));
- }
-
- } catch (Exception e) {
- Utils.info("§cThere is an error when reading the config file.Replacing the new config file..");
- config = current;
- this.saveConfig();
- this.reloadConfig();
- e.printStackTrace();
- }
- }
- }
- } catch (Exception e2) {
- Utils.info("§cThere is an error when reading the config file.");
- e2.printStackTrace();
- }
- this.saveConfig();
- this.reloadConfig();
- overworld = config.getString("overworld");
- currentLangYML = new DataYML(locale + ".yml");
- currentLangYML.saveCDefaultConfig();
- currentLangYML.reloadCustomConfig();
- currentLang = currentLangYML.getCustomConfig();
- try {
- FileConfiguration current = YamlConfiguration
- .loadConfiguration(new InputStreamReader(this.getResource(locale + ".yml"), "UTF8"));
- for (String select : current.getKeys(false)) {
- if (Utils.sectionKeyToList(current.getConfigurationSection(select)).get(0).equalsIgnoreCase("null")
- || current.getConfigurationSection(select).getKeys(false) == null) {
- currentLang.createPath(current.getConfigurationSection(select), select);
- currentLangYML.saveCustomConfig();
- continue;
- } else {
- List found = Utils.sectionKeyToList(current.getConfigurationSection(select));
- List found2 = Utils.sectionKeyToList(currentLang.getConfigurationSection(select));
- for (String each : found) {
- if (!Utils.ExitsInListL(each, found2)) {
- try {
- if (current.isString(select + "." + each)) {
- currentLang.set(select + "." + each, current.getString(select + "." + each));
- }
- if (current.isInt(select + "." + each)) {
- currentLang.set(select + "." + each, current.getInt(select + "." + each));
- }
- if (current.isList(select + "." + each)) {
- currentLang.set(select + "." + each, current.getList(select + "." + each));
- }
- } catch (Exception e) {
- Utils.info(
- "§cThere is an error when reading the language file.Replacing the new language file..");
- currentLang = current;
- currentLangYML.saveCustomConfig();
- currentLangYML.reloadCustomConfig();
- e.printStackTrace();
- }
- }
- }
- }
- }
- } catch (Exception e2) {
- Utils.info("§cThere is an error when reading the language file.Replacing the new language file..");
- e2.printStackTrace();
- }
- currentLangYML.saveCustomConfig();
- currentLangYML.reloadCustomConfig();
- switch (version) {
- case "v1_16_R1":
- break;
- case "v1_15_R1":
- break;
- case "v1_14_R1":
- break;
- case "v1_13_R2":
- break;
- case "v1_13_R1":
- break;
- default:
- compatible = false;
- break;
- }
- if (!compatible) {
- Utils.info(Lang.readGeneralText("Not_compatible"));
- this.getServer().getPluginManager().disablePlugin(this);
- return;
- }
- if (!SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_15)) {
- Utils.info(Lang.readGeneralText("Before_115"));
- }
- Metrics mt = new Metrics(this, 6887);
- mt.addCustomChart(new Metrics.SimplePie("language", () -> languageCodeToLanguage(locale)));
-
- planetYML = new DataYML("planets.yml");
- planetYML.saveCDefaultConfig();
- planetYML.reloadCustomConfig();
- planetDataYML = new DataYML("planetsdata.yml");
- planetDataYML.saveCDefaultConfig();
- planetDataYML.reloadCustomConfig();
- Utils.info(Lang.readGeneralText("startTip"));
- Config cfg = new Config(this);
- Utils.info(Lang.readGeneralText("registeringItems"));
- try {
- registerSlimefun();
- registerPlanets();
- registerResources();
- } catch (Exception e) {
- Utils.info(Lang.readGeneralText("registeringError"));
- e.printStackTrace();
- }
- Bukkit.getPluginManager().registerEvents(new ItemInteractListener(), this);
- Bukkit.getPluginManager().registerEvents(new ItemUseListener(), this);
- Bukkit.getPluginManager().registerEvents(new FoodEatListener(), this);
- Bukkit.getPluginManager().registerEvents(new FoodDropListener(), this);
- Bukkit.getPluginManager().registerEvents(new WeaponListener(), this);
- Bukkit.getPluginManager().registerEvents(new RailwayListener(), this);
- Bukkit.getPluginManager().registerEvents(new PlanetListener(), this);
- Bukkit.getPluginManager().registerEvents(new RocketLauncherListener(), this);
- Bukkit.getPluginManager().registerEvents(new PlanetBaseListener(), this);
-
- this.getCommand("claytech").setExecutor(new ClayTechCommands());
-
- spacetravelneedperm = config.getBoolean("space-travel-need-perm");
-
- ClayTechData.currentVersion = this.getDescription().getVersion();
+ protected static ClayTech plugin;
+ private static String locale;
+ private static DataYML currentLangYML;
+ private static FileConfiguration currentLang;
+ private static DataYML planetYML;
+ private static String highrailspeed;
+ private static String version = Bukkit.getServer().getClass().getPackage().getName().replace(".", ",")
+ .split(",")[3];
+ private static boolean compatible = true;
+ private static List planetList = new ArrayList();
+ private static String overworld = "";
+ private static DataYML planetDataYML;
+ private static ClayTechUpdater updater;
+ private static boolean spacetravelneedperm;
+
+ public static ClayTech getInstance() {
+ return plugin;
+ }
+
+ public static String getLocale() {
+ return locale;
+ }
+
+ public static DataYML getLangYML() {
+ return currentLangYML;
+ }
+
+ public static boolean isSpaceTravelNeedPerm() {
+ return spacetravelneedperm;
+ }
+
+ public static String getHighRailSpeed() {
+ return highrailspeed;
+ }
+
+ public static ClayTechUpdater getUpdater() {
+ return updater;
+ }
+
+ public static boolean getCompatible() {
+ return compatible;
+ }
+
+ public static List getPlanets() {
+ return planetList;
+ }
+
+ public static String getOverworld() {
+ return overworld;
+ }
+
+ public static DataYML getPlanetYML() {
+ return planetYML;
+ }
+
+ public static DataYML getPlanetDataYML() {
+ return planetDataYML;
+ }
+
+ @SuppressWarnings({"unused", "static-access"})
+ @Override
+ public void onEnable() {
+ plugin = this;
+ // 当前研究ID: 9933
+ this.saveDefaultConfig();
+ FileConfiguration config = this.getConfig();
+ locale = config.getString("Locale");
+ if (locale == null)
+ locale = "en-US";
+ highrailspeed = config.getString("highrailspeed");
+ if (highrailspeed == null)
+ highrailspeed = "3";
+ if (!Utils.ExitsInList(locale, Lang.LocaleList)) {
+ Utils.info("§cLoading Error: Locale not found.Disableing plugin..");
+ this.getServer().getPluginManager().disablePlugin(this);
+ }
+ // config
+ try {
+ FileConfiguration current = YamlConfiguration
+ .loadConfiguration(new InputStreamReader(this.getResource("config.yml"), "UTF8"));
+ List currentconfig = new ArrayList();
+ for (String each : config.getKeys(false)) {
+ currentconfig.add(each);
+ }
+ for (String each : current.getKeys(false)) {
+ if (!Utils.ExitsInListL(each, currentconfig)) {
+ try {
+ if (current.isString(each)) {
+ config.set(each, current.getString(each));
+ }
+ if (current.isInt(each)) {
+ config.set(each, current.getInt(each));
+ }
+ if (current.isList(each)) {
+ config.set(each, current.getList(each));
+ }
+ if (current.isBoolean(each)) {
+ config.set(each, current.getBoolean(each));
+ }
+
+ } catch (Exception e) {
+ Utils.info("§cThere is an error when reading the config file.Replacing the new config file..");
+ config = current;
+ this.saveConfig();
+ this.reloadConfig();
+ e.printStackTrace();
+ }
+ }
+ }
+ } catch (Exception e2) {
+ Utils.info("§cThere is an error when reading the config file.");
+ e2.printStackTrace();
+ }
+ this.saveConfig();
+ this.reloadConfig();
+ overworld = config.getString("overworld");
+ currentLangYML = new DataYML(locale + ".yml");
+ currentLangYML.saveCDefaultConfig();
+ currentLangYML.reloadCustomConfig();
+ currentLang = currentLangYML.getCustomConfig();
+ try {
+ FileConfiguration current = YamlConfiguration
+ .loadConfiguration(new InputStreamReader(this.getResource(locale + ".yml"), "UTF8"));
+ for (String select : current.getKeys(false)) {
+ if (Utils.sectionKeyToList(current.getConfigurationSection(select)).get(0).equalsIgnoreCase("null")
+ || current.getConfigurationSection(select).getKeys(false) == null) {
+ currentLang.createPath(current.getConfigurationSection(select), select);
+ currentLangYML.saveCustomConfig();
+ continue;
+ } else {
+ List found = Utils.sectionKeyToList(current.getConfigurationSection(select));
+ List found2 = Utils.sectionKeyToList(currentLang.getConfigurationSection(select));
+ for (String each : found) {
+ if (!Utils.ExitsInListL(each, found2)) {
+ try {
+ if (current.isString(select + "." + each)) {
+ currentLang.set(select + "." + each, current.getString(select + "." + each));
+ }
+ if (current.isInt(select + "." + each)) {
+ currentLang.set(select + "." + each, current.getInt(select + "." + each));
+ }
+ if (current.isList(select + "." + each)) {
+ currentLang.set(select + "." + each, current.getList(select + "." + each));
+ }
+ } catch (Exception e) {
+ Utils.info(
+ "§cThere is an error when reading the language file.Replacing the new language file..");
+ currentLang = current;
+ currentLangYML.saveCustomConfig();
+ currentLangYML.reloadCustomConfig();
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ }
+ } catch (Exception e2) {
+ Utils.info("§cThere is an error when reading the language file.Replacing the new language file..");
+ e2.printStackTrace();
+ }
+ currentLangYML.saveCustomConfig();
+ currentLangYML.reloadCustomConfig();
+ switch (version) {
+ case "v1_16_R1":
+ break;
+ case "v1_15_R1":
+ break;
+ case "v1_14_R1":
+ break;
+ case "v1_13_R2":
+ break;
+ case "v1_13_R1":
+ break;
+ default:
+ compatible = false;
+ break;
+ }
+ if (!compatible) {
+ Utils.info(Lang.readGeneralText("Not_compatible"));
+ this.getServer().getPluginManager().disablePlugin(this);
+ return;
+ }
+ if (!SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_15)) {
+ Utils.info(Lang.readGeneralText("Before_115"));
+ }
+ Metrics mt = new Metrics(this, 6887);
+ mt.addCustomChart(new Metrics.SimplePie("language", () -> languageCodeToLanguage(locale)));
+
+ planetYML = new DataYML("planets.yml");
+ planetYML.saveCDefaultConfig();
+ planetYML.reloadCustomConfig();
+ planetDataYML = new DataYML("planetsdata.yml");
+ planetDataYML.saveCDefaultConfig();
+ planetDataYML.reloadCustomConfig();
+ Utils.info(Lang.readGeneralText("startTip"));
+ Config cfg = new Config(this);
+ Utils.info(Lang.readGeneralText("registeringItems"));
+ try {
+ registerSlimefun();
+ registerPlanets();
+ registerResources();
+ } catch (Exception e) {
+ Utils.info(Lang.readGeneralText("registeringError"));
+ e.printStackTrace();
+ }
+ Bukkit.getPluginManager().registerEvents(new ItemInteractListener(), this);
+ Bukkit.getPluginManager().registerEvents(new ItemUseListener(), this);
+ Bukkit.getPluginManager().registerEvents(new FoodEatListener(), this);
+ Bukkit.getPluginManager().registerEvents(new FoodDropListener(), this);
+ Bukkit.getPluginManager().registerEvents(new WeaponListener(), this);
+ Bukkit.getPluginManager().registerEvents(new RailwayListener(), this);
+ Bukkit.getPluginManager().registerEvents(new PlanetListener(), this);
+ Bukkit.getPluginManager().registerEvents(new RocketLauncherListener(), this);
+ Bukkit.getPluginManager().registerEvents(new PlanetBaseListener(), this);
+
+ this.getCommand("claytech").setExecutor(new ClayTechCommands());
+
+ spacetravelneedperm = config.getBoolean("space-travel-need-perm");
+
+ ClayTechData.currentVersion = this.getDescription().getVersion();
// Bukkit.getPluginManager().registerEvents(new Debug(), this);
- new BukkitRunnable() {
-
- @Override
- public void run() {
- // Updater
- updater = new ClayTechUpdater();
- if (!getConfig().getBoolean("disable-auto-updater")) {
- updater.tryUpdate();
- new BukkitRunnable() {
-
- @Override
- public void run() {
- updater.tryUpdate();
- }
-
- }.runTaskTimerAsynchronously(ClayTech.getInstance(), 72000, 72000);
- } else {
- Bukkit.getLogger().info(ChatColor.YELLOW + Lang.readGeneralText("Info_1"));
- Bukkit.getLogger().info(ChatColor.YELLOW + Lang.readGeneralText("Auto-updater_disabled"));
- Bukkit.getLogger().info(ChatColor.YELLOW + Lang.readGeneralText("Info_6"));
- }
- List Authors = plugin.getDescription().getAuthors();
- Bukkit.getLogger().info(ChatColor.GREEN + Lang.readGeneralText("Info_1"));
- Bukkit.getLogger().info(ChatColor.GREEN + Lang.readGeneralText("Info_2").replaceAll("\\{version\\}",
- plugin.getDescription().getVersion()));
- Bukkit.getLogger().info(ChatColor.GREEN + Lang.readGeneralText("Info_3").replaceAll("\\{author\\}",
- Utils.ArrayToString(Authors.toArray(new String[Authors.size()]), ",", ".")));
- Bukkit.getLogger().info(ChatColor.GREEN + Lang.readGeneralText("Info_4"));
- Bukkit.getLogger().info(ChatColor.GREEN
- + Lang.readGeneralText("Info_5").replaceAll("\\{issue_tracker\\}", plugin.getBugTrackerURL()));
- Bukkit.getLogger().info(ChatColor.GREEN + Lang.readGeneralText("Info_6"));
- for (Player player : Bukkit.getOnlinePlayers()) {
- Planet p = PlanetUtils.getPlanet(player.getWorld());
- if (p != null) {
- if (!p.getHabitable()) {
- World PreviousWorld = player.getWorld();
- new BukkitRunnable() {
- @SuppressWarnings("deprecation")
- @Override
- public void run() {
- if (!PreviousWorld.equals(player.getWorld()) || !player.isOnline()) {
- this.cancel();
- return;
- }
- if (!(ClayTechManager.isSpaceSuit(player.getInventory().getHelmet())
- && ClayTechManager.isSpaceSuit(player.getInventory().getChestplate())
- && ClayTechManager.isSpaceSuit(player.getInventory().getLeggings())
- && ClayTechManager.isSpaceSuit(player.getInventory().getBoots()))) {
- // 扣血
- player.sendTitle(Lang.readGeneralText("SpaceSuitError"),
- Lang.readGeneralText("SpaceSuitError_Sub"));
- player.damage(5);
-
- } else {
- if (!(RocketUtils.getOxygen(player.getInventory().getHelmet()) > 0
- && RocketUtils.getOxygen(player.getInventory().getChestplate()) > 0
- && RocketUtils.getOxygen(player.getInventory().getLeggings()) > 0
- && RocketUtils.getOxygen(player.getInventory().getBoots()) > 0)) {
- // 扣血
- player.sendTitle(Lang.readGeneralText("SpaceSuitError"),
- Lang.readGeneralText("SpaceSuitError_Sub"));
- player.damage(5);
- } else {
- int harmlevel = p.getHarmLevel();
- if (RocketUtils
- .getProtectLevel(player.getInventory().getHelmet()) < harmlevel
- || RocketUtils.getProtectLevel(
- player.getInventory().getChestplate()) < harmlevel
- || RocketUtils.getProtectLevel(
- player.getInventory().getLeggings()) < harmlevel
- || RocketUtils.getProtectLevel(
- player.getInventory().getBoots()) < harmlevel) {
- // 扣血
- player.sendTitle(Lang.readGeneralText("SpaceSuitError"),
- Lang.readGeneralText("SpaceSuitError_Sub"));
- player.damage(5);
- }
- }
- }
- }
-
- }.runTaskTimer(ClayTech.getInstance(), 20, 20);
- }
- }
- }
- }
-
- }.runTaskAsynchronously(this);
-
- }
-
- @Override
- public void onDisable() {
- }
-
- private String languageCodeToLanguage(String code) {
- switch (code.toUpperCase()) {
- case "ZH-CN":
- return "Simplified Chinese";
- case "ZH-TW":
- return "Traditional Chinese";
- case "EN-US":
- return "English(US)";
- case "EN-UK":
- return "English(UK)";
- default:
- return code;
- }
- }
-
- private void registerSlimefun() {
- registerMachines();
-
- new Clay_basic();
- new PotionAffect_Weapons();
- new Golden_things();
- new Skulls();
- new Armors();
- new DrinkMakingStaff();
- new Drinks();
- new FoodMakingStaff();
- new Foods();
- new MachineMakingBasic();
- new Elements();
- new Railways();
- new EffectItems();
- new Ingots();
- new Tools();
- new ClayFuelResource();
- new RocketMakings();
- new Rockets();
- }
-
- public void registerMachines() {
- ItemStack[] ClayCrafingTable = { SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ELECTRO_MAGNET,
- SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.BATTERY, new ItemStack(Material.CRAFTING_TABLE),
- SlimefunItems.BATTERY, ClayTechItems.MAGIC_CLAY, SlimefunItems.SMALL_CAPACITOR,
- ClayTechItems.MAGIC_CLAY };
- ItemStack[] ClayStoneCrusher = { SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ELECTRO_MAGNET,
- SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.BATTERY, SlimefunItems.ADVANCED_CIRCUIT_BOARD,
- SlimefunItems.BATTERY, ClayTechItems.MAGIC_CLAY, SlimefunItems.SMALL_CAPACITOR,
- new ItemStack(Material.DISPENSER) };
- ItemStack[] ClayFoodCauldron = { SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ELECTRO_MAGNET,
- SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.BATTERY, ClayTechItems.CLAY_CRAFTING_TABLE,
- SlimefunItems.BATTERY, ClayTechItems.MAGIC_CLAY, SlimefunItems.MEDIUM_CAPACITOR,
- ClayTechItems.MAGIC_CLAY };
- ItemStack[] ClayChalkingMachine = { SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ELECTRO_MAGNET,
- SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.BATTERY, ClayTechItems.CLAY_CRAFTING_TABLE,
- SlimefunItems.BATTERY, ClayTechItems.CLAY_STICK, SlimefunItems.MEDIUM_CAPACITOR,
- ClayTechItems.MAGIC_CLAY };
- ItemStack[] ClayElementExtracter = { ClayTechItems.BLISTERING_CORE, ClayTechItems.BLISTERING_CORE,
- ClayTechItems.BLISTERING_CORE, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ADVANCED_CIRCUIT_BOARD,
- SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.WITHER_PROOF_OBSIDIAN, SlimefunItems.PROGRAMMABLE_ANDROID,
- SlimefunItems.WITHER_PROOF_OBSIDIAN };
- ItemStack[] ClayExperimentTableBasic = { ClayTechItems.CLAY_ALLOY_INGOT, SlimefunItems.ELECTRIC_MOTOR,
- ClayTechItems.CLAY_ALLOY_INGOT, SlimefunItems.ADVANCED_CIRCUIT_BOARD, ClayTechItems.CLAY_FOOD_CAULDRON,
- ClayTechItems.BLISTERING_CORE, ClayTechItems.CLAY_ALLOY_INGOT, ClayTechItems.ELEMENT_UNIT,
- ClayTechItems.CLAY_ALLOY_INGOT };
- ItemStack[] ClayRocketAssemblingMachine = { SlimefunItems.ELECTRIC_MOTOR, ClayTechItems.BLISTERING_CORE,
- SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ADVANCED_CIRCUIT_BOARD, SlimefunItems.WITHER_PROOF_OBSIDIAN,
- SlimefunItems.ADVANCED_CIRCUIT_BOARD, SlimefunItems.MEDIUM_CAPACITOR,
- SlimefunItems.PROGRAMMABLE_ANDROID, SlimefunItems.MEDIUM_CAPACITOR };
- ItemStack[] ClayRocketFuelGenerator = { SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ELECTRIC_MOTOR,
- SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ADVANCED_CIRCUIT_BOARD, SlimefunItems.WITHER_PROOF_OBSIDIAN,
- SlimefunItems.ADVANCED_CIRCUIT_BOARD, SlimefunItems.SMALL_CAPACITOR, ClayTechItems.CLAY_FUSION_INGOT,
- SlimefunItems.SMALL_CAPACITOR };
- ItemStack[] ClayRocketFuelInjector = { SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ELECTRIC_MOTOR,
- SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ADVANCED_CIRCUIT_BOARD, SlimefunItems.WITHER_PROOF_OBSIDIAN,
- SlimefunItems.ADVANCED_CIRCUIT_BOARD, SlimefunItems.SMALL_CAPACITOR, ClayTechItems.BLISTERING_CORE,
- SlimefunItems.SMALL_CAPACITOR };
- ItemStack[] ClaySpaceSuitOxygenInjector = { SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ELECTRIC_MOTOR,
- SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ADVANCED_CIRCUIT_BOARD,
- ClayTechItems.CLAY_ROCKET_FUEL_INJECTOR, SlimefunItems.ADVANCED_CIRCUIT_BOARD,
- SlimefunItems.SMALL_CAPACITOR, ClayTechItems.OXYGEN_TANK, SlimefunItems.SMALL_CAPACITOR };
- ItemStack[] ClayCobbleStoneGenerator = { SlimefunItems.ELECTRIC_MOTOR, new ItemStack(Material.WATER_BUCKET),
- SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ADVANCED_CIRCUIT_BOARD,
- SlimefunItems.PROGRAMMABLE_ANDROID_MINER, SlimefunItems.ADVANCED_CIRCUIT_BOARD,
- SlimefunItems.SMALL_CAPACITOR, new ItemStack(Material.LAVA_BUCKET), SlimefunItems.SMALL_CAPACITOR };
- ItemStack[] ClayElectricWaterPump = { SlimefunItems.ELECTRIC_MOTOR, new ItemStack(Material.DISPENSER),
- SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ADVANCED_CIRCUIT_BOARD,
- SlimefunItems.PROGRAMMABLE_ANDROID_MINER, SlimefunItems.ADVANCED_CIRCUIT_BOARD,
- SlimefunItems.SMALL_CAPACITOR, new ItemStack(Material.DISPENSER), SlimefunItems.SMALL_CAPACITOR };
-
- // 机器
- SlimefunItemStack craftingtable = new SlimefunItemStack("CLAY_CRAFTING_TABLE",
- ClayTechItems.CLAY_CRAFTING_TABLE);
- SlimefunItemStack foodcauldron = new SlimefunItemStack("CLAY_FOOD_CAULDRON", ClayTechItems.CLAY_FOOD_CAULDRON);
- SlimefunItemStack chalkingmachine = new SlimefunItemStack("CLAY_FOOD_CHALKING_MACHINE",
- ClayTechItems.CLAY_FOOD_CHALKING_MACHINE);
- SlimefunItemStack elementextracter = new SlimefunItemStack("CLAY_ELEMENT_EXTRACTER",
- ClayTechItems.CLAY_ELEMENT_EXTRACTER);
- SlimefunItemStack electricstonecrusher = new SlimefunItemStack("CLAY_ELECTRIC_STONE_CRUSHER",
- ClayTechItems.CLAY_ELECTRIC_STONE_CRUSHER);
- SlimefunItemStack experimenttablebasic = new SlimefunItemStack("CLAY_EXPERIMENT_TABLE_BASIC",
- ClayTechItems.CLAY_EXPERIMENT_TABLE_NORMAL);
- SlimefunItemStack rocketassemblingmachine = new SlimefunItemStack("CLAY_ROCKET_ASSEMBLING_MACHINE",
- ClayTechItems.CLAY_ROCKET_ASSEMBLING_MACHINE);
- SlimefunItemStack rocketfuelgenerator = new SlimefunItemStack("CLAY_ROCKET_FUEL_GENERATOR",
- ClayTechItems.CLAY_ROCKET_FUEL_GENERATOR);
- SlimefunItemStack rocketfuelinjector = new SlimefunItemStack("CLAY_ROCKET_FUEL_INJECTOR",
- ClayTechItems.CLAY_ROCKET_FUEL_INJECTOR);
- SlimefunItemStack spacesuitoxygeninjector = new SlimefunItemStack("CLAY_SPACESUIT_OXYGEN_INJECTOR",
- ClayTechItems.CLAY_SPACESUIT_OXYGEN_INJECTOR);
- SlimefunItemStack cobblestonegenerator = new SlimefunItemStack("CLAY_COBBLESTONE_GENERATOR",
- ClayTechItems.CLAY_COBBLESTONE_GENERATOR);
- SlimefunItemStack electricwaterpump = new SlimefunItemStack("CLAY_ELECTRIC_WATER_PUMP",
- ClayTechItems.CLAY_ELECTRIC_WATER_PUMP);
-
- new CraftingTable(ClayTechItems.C_MACHINES, craftingtable, "CLAY_CRAFTING_TABLE",
- RecipeType.ENHANCED_CRAFTING_TABLE, ClayCrafingTable).register(this);
- new ElectricStoneCrusher(ClayTechItems.C_MACHINES, electricstonecrusher, "CLAY_ELECTRIC_STONE_CRUSHER",
- RecipeType.ENHANCED_CRAFTING_TABLE, ClayStoneCrusher).register(this);
- new FoodCauldron(ClayTechItems.C_MACHINES, foodcauldron, "CLAY_FOOD_CAULDRON",
- RecipeType.ENHANCED_CRAFTING_TABLE, ClayFoodCauldron).register(this);
- new FoodChalkingMachine(ClayTechItems.C_MACHINES, chalkingmachine, "CLAY_FOOD_CHALKING_MACHINE",
- RecipeType.ENHANCED_CRAFTING_TABLE, ClayChalkingMachine).register(this);
- new ElementExtracter(ClayTechItems.C_MACHINES, elementextracter, "CLAY_ELEMENT_EXTRACTER",
- RecipeType.ENHANCED_CRAFTING_TABLE, ClayElementExtracter).register(this);
- new ExperimentTableNormal(ClayTechItems.C_MACHINES, experimenttablebasic, "CLAY_EXPERIMENT_TABLE_BASIC",
- RecipeType.ENHANCED_CRAFTING_TABLE, ClayExperimentTableBasic).register(this);
- new RocketAssemblingMachine(ClayTechItems.C_MACHINES, rocketassemblingmachine, "CLAY_ROCKET_ASSEMBLING_MACHINE",
- RecipeType.ENHANCED_CRAFTING_TABLE, ClayRocketAssemblingMachine).register(this);
- new RocketFuelGenerator(ClayTechItems.C_MACHINES, rocketfuelgenerator, "CLAY_ROCKET_FUEL_GENERATOR",
- RecipeType.ENHANCED_CRAFTING_TABLE, ClayRocketFuelGenerator).register(this);
- new RocketFuelInjector(ClayTechItems.C_MACHINES, rocketfuelinjector, "CLAY_ROCKET_FUEL_INJECTOR",
- RecipeType.ENHANCED_CRAFTING_TABLE, ClayRocketFuelInjector).register(this);
- new SpaceSuitOxygenInjector(ClayTechItems.C_MACHINES, spacesuitoxygeninjector, "CLAY_SPACESUIT_OXYGEN_INJECTOR",
- RecipeType.ENHANCED_CRAFTING_TABLE, ClaySpaceSuitOxygenInjector).register(this);
- new CobbleStoneGenerator(ClayTechItems.C_MACHINES, cobblestonegenerator, "CLAY_COBBLESTONE_GENERATOR",
- RecipeType.ENHANCED_CRAFTING_TABLE, ClayCobbleStoneGenerator).register(this);
- new ElectricWaterPump(ClayTechItems.C_MACHINES, electricwaterpump, "CLAY_ELECTRIC_WATER_PUMP",
- RecipeType.ENHANCED_CRAFTING_TABLE, ClayElectricWaterPump).register(this);
- }
-
- @Override
- public JavaPlugin getJavaPlugin() {
- return this;
- }
-
- @Override
- public File getFile() {
- return super.getFile();
- }
-
- @Override
- public String getBugTrackerURL() {
- return "https://github.com/ClayCoffee/ClayTech/issues";
- }
-
- private void registerPlanets() {
- // Earth(Overworld) 地球(主世界)
- new Earth();
- // Moon 月球
- new Moon();
- // Mars 火星
- new Mars();
- }
-
- private void registerResources() {
- new ClayFuel();
- }
-
- @Override
- public ChunkGenerator getDefaultWorldGenerator(String worldName, String id) {
- List PlanetNameList = new ArrayList();
- List PlanetList = getPlanets();
- for (Planet p : PlanetList) {
- PlanetNameList.add(p.getPlanetWorldName());
- }
- if (Utils.ExitsInList(id, PlanetNameList.toArray(new String[PlanetNameList.size()]))) {
- return PlanetList.get(PlanetNameList.indexOf(id)).getPlanetGenerator();
- }
- return Bukkit.getWorld(getOverworld()).getGenerator();
- }
+ new BukkitRunnable() {
+
+ @Override
+ public void run() {
+ // Updater
+ updater = new ClayTechUpdater();
+ if (!getConfig().getBoolean("disable-auto-updater")) {
+ updater.tryUpdate();
+ new BukkitRunnable() {
+
+ @Override
+ public void run() {
+ updater.tryUpdate();
+ }
+
+ }.runTaskTimerAsynchronously(ClayTech.getInstance(), 72000, 72000);
+ } else {
+ Bukkit.getLogger().info(ChatColor.YELLOW + Lang.readGeneralText("Info_1"));
+ Bukkit.getLogger().info(ChatColor.YELLOW + Lang.readGeneralText("Auto-updater_disabled"));
+ Bukkit.getLogger().info(ChatColor.YELLOW + Lang.readGeneralText("Info_6"));
+ }
+ List Authors = plugin.getDescription().getAuthors();
+ Bukkit.getLogger().info(ChatColor.GREEN + Lang.readGeneralText("Info_1"));
+ Bukkit.getLogger().info(ChatColor.GREEN + Lang.readGeneralText("Info_2").replaceAll("\\{version\\}",
+ plugin.getDescription().getVersion()));
+ Bukkit.getLogger().info(ChatColor.GREEN + Lang.readGeneralText("Info_3").replaceAll("\\{author\\}",
+ Utils.ArrayToString(Authors.toArray(new String[Authors.size()]), ",", ".")));
+ Bukkit.getLogger().info(ChatColor.GREEN + Lang.readGeneralText("Info_4"));
+ Bukkit.getLogger().info(ChatColor.GREEN
+ + Lang.readGeneralText("Info_5").replaceAll("\\{issue_tracker\\}", plugin.getBugTrackerURL()));
+ Bukkit.getLogger().info(ChatColor.GREEN + Lang.readGeneralText("Info_6"));
+ for (Player player : Bukkit.getOnlinePlayers()) {
+ Planet p = PlanetUtils.getPlanet(player.getWorld());
+ if (p != null) {
+ if (!p.getHabitable()) {
+ World PreviousWorld = player.getWorld();
+ new BukkitRunnable() {
+ @SuppressWarnings("deprecation")
+ @Override
+ public void run() {
+ if (!PreviousWorld.equals(player.getWorld()) || !player.isOnline()) {
+ this.cancel();
+ return;
+ }
+ if (!(ClayTechManager.isSpaceSuit(player.getInventory().getHelmet())
+ && ClayTechManager.isSpaceSuit(player.getInventory().getChestplate())
+ && ClayTechManager.isSpaceSuit(player.getInventory().getLeggings())
+ && ClayTechManager.isSpaceSuit(player.getInventory().getBoots()))) {
+ // 扣血
+ player.sendTitle(Lang.readGeneralText("SpaceSuitError"),
+ Lang.readGeneralText("SpaceSuitError_Sub"));
+ player.damage(5);
+
+ } else {
+ if (!(RocketUtils.getOxygen(player.getInventory().getHelmet()) > 0
+ && RocketUtils.getOxygen(player.getInventory().getChestplate()) > 0
+ && RocketUtils.getOxygen(player.getInventory().getLeggings()) > 0
+ && RocketUtils.getOxygen(player.getInventory().getBoots()) > 0)) {
+ // 扣血
+ player.sendTitle(Lang.readGeneralText("SpaceSuitError"),
+ Lang.readGeneralText("SpaceSuitError_Sub"));
+ player.damage(5);
+ } else {
+ int harmlevel = p.getHarmLevel();
+ if (RocketUtils
+ .getProtectLevel(player.getInventory().getHelmet()) < harmlevel
+ || RocketUtils.getProtectLevel(
+ player.getInventory().getChestplate()) < harmlevel
+ || RocketUtils.getProtectLevel(
+ player.getInventory().getLeggings()) < harmlevel
+ || RocketUtils.getProtectLevel(
+ player.getInventory().getBoots()) < harmlevel) {
+ // 扣血
+ player.sendTitle(Lang.readGeneralText("SpaceSuitError"),
+ Lang.readGeneralText("SpaceSuitError_Sub"));
+ player.damage(5);
+ }
+ }
+ }
+ }
+
+ }.runTaskTimer(ClayTech.getInstance(), 20, 20);
+ }
+ }
+ }
+ }
+
+ }.runTaskAsynchronously(this);
+
+ }
+
+ @Override
+ public void onDisable() {
+ }
+
+ private String languageCodeToLanguage(String code) {
+ switch (code.toUpperCase()) {
+ case "ZH-CN":
+ return "Simplified Chinese";
+ case "ZH-TW":
+ return "Traditional Chinese";
+ case "EN-US":
+ return "English(US)";
+ case "EN-UK":
+ return "English(UK)";
+ default:
+ return code;
+ }
+ }
+
+ private void registerSlimefun() {
+ registerMachines();
+
+ new Clay_basic();
+ new PotionAffect_Weapons();
+ new Golden_things();
+ new Skulls();
+ new Armors();
+ new DrinkMakingStaff();
+ new Drinks();
+ new FoodMakingStaff();
+ new Foods();
+ new MachineMakingBasic();
+ new Elements();
+ new Railways();
+ new EffectItems();
+ new Ingots();
+ new Tools();
+ new ClayFuelResource();
+ new RocketMakings();
+ new Rockets();
+ }
+
+ public void registerMachines() {
+ ItemStack[] ClayCrafingTable = {SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ELECTRO_MAGNET,
+ SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.BATTERY, new ItemStack(Material.CRAFTING_TABLE),
+ SlimefunItems.BATTERY, ClayTechItems.MAGIC_CLAY, SlimefunItems.SMALL_CAPACITOR,
+ ClayTechItems.MAGIC_CLAY};
+ ItemStack[] ClayStoneCrusher = {SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ELECTRO_MAGNET,
+ SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.BATTERY, SlimefunItems.ADVANCED_CIRCUIT_BOARD,
+ SlimefunItems.BATTERY, ClayTechItems.MAGIC_CLAY, SlimefunItems.SMALL_CAPACITOR,
+ new ItemStack(Material.DISPENSER)};
+ ItemStack[] ClayFoodCauldron = {SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ELECTRO_MAGNET,
+ SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.BATTERY, ClayTechItems.CLAY_CRAFTING_TABLE,
+ SlimefunItems.BATTERY, ClayTechItems.MAGIC_CLAY, SlimefunItems.MEDIUM_CAPACITOR,
+ ClayTechItems.MAGIC_CLAY};
+ ItemStack[] ClayChalkingMachine = {SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ELECTRO_MAGNET,
+ SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.BATTERY, ClayTechItems.CLAY_CRAFTING_TABLE,
+ SlimefunItems.BATTERY, ClayTechItems.CLAY_STICK, SlimefunItems.MEDIUM_CAPACITOR,
+ ClayTechItems.MAGIC_CLAY};
+ ItemStack[] ClayElementExtracter = {ClayTechItems.BLISTERING_CORE, ClayTechItems.BLISTERING_CORE,
+ ClayTechItems.BLISTERING_CORE, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ADVANCED_CIRCUIT_BOARD,
+ SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.WITHER_PROOF_OBSIDIAN, SlimefunItems.PROGRAMMABLE_ANDROID,
+ SlimefunItems.WITHER_PROOF_OBSIDIAN};
+ ItemStack[] ClayExperimentTableBasic = {ClayTechItems.CLAY_ALLOY_INGOT, SlimefunItems.ELECTRIC_MOTOR,
+ ClayTechItems.CLAY_ALLOY_INGOT, SlimefunItems.ADVANCED_CIRCUIT_BOARD, ClayTechItems.CLAY_FOOD_CAULDRON,
+ ClayTechItems.BLISTERING_CORE, ClayTechItems.CLAY_ALLOY_INGOT, ClayTechItems.ELEMENT_UNIT,
+ ClayTechItems.CLAY_ALLOY_INGOT};
+ ItemStack[] ClayRocketAssemblingMachine = {SlimefunItems.ELECTRIC_MOTOR, ClayTechItems.BLISTERING_CORE,
+ SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ADVANCED_CIRCUIT_BOARD, SlimefunItems.WITHER_PROOF_OBSIDIAN,
+ SlimefunItems.ADVANCED_CIRCUIT_BOARD, SlimefunItems.MEDIUM_CAPACITOR,
+ SlimefunItems.PROGRAMMABLE_ANDROID, SlimefunItems.MEDIUM_CAPACITOR};
+ ItemStack[] ClayRocketFuelGenerator = {SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ELECTRIC_MOTOR,
+ SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ADVANCED_CIRCUIT_BOARD, SlimefunItems.WITHER_PROOF_OBSIDIAN,
+ SlimefunItems.ADVANCED_CIRCUIT_BOARD, SlimefunItems.SMALL_CAPACITOR, ClayTechItems.CLAY_FUSION_INGOT,
+ SlimefunItems.SMALL_CAPACITOR};
+ ItemStack[] ClayRocketFuelInjector = {SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ELECTRIC_MOTOR,
+ SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ADVANCED_CIRCUIT_BOARD, SlimefunItems.WITHER_PROOF_OBSIDIAN,
+ SlimefunItems.ADVANCED_CIRCUIT_BOARD, SlimefunItems.SMALL_CAPACITOR, ClayTechItems.BLISTERING_CORE,
+ SlimefunItems.SMALL_CAPACITOR};
+ ItemStack[] ClaySpaceSuitOxygenInjector = {SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ELECTRIC_MOTOR,
+ SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ADVANCED_CIRCUIT_BOARD,
+ ClayTechItems.CLAY_ROCKET_FUEL_INJECTOR, SlimefunItems.ADVANCED_CIRCUIT_BOARD,
+ SlimefunItems.SMALL_CAPACITOR, ClayTechItems.OXYGEN_TANK, SlimefunItems.SMALL_CAPACITOR};
+ ItemStack[] ClayCobbleStoneGenerator = {SlimefunItems.ELECTRIC_MOTOR, new ItemStack(Material.WATER_BUCKET),
+ SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ADVANCED_CIRCUIT_BOARD,
+ SlimefunItems.PROGRAMMABLE_ANDROID_MINER, SlimefunItems.ADVANCED_CIRCUIT_BOARD,
+ SlimefunItems.SMALL_CAPACITOR, new ItemStack(Material.LAVA_BUCKET), SlimefunItems.SMALL_CAPACITOR};
+ ItemStack[] ClayElectricWaterPump = {SlimefunItems.ELECTRIC_MOTOR, new ItemStack(Material.DISPENSER),
+ SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ADVANCED_CIRCUIT_BOARD,
+ SlimefunItems.PROGRAMMABLE_ANDROID_MINER, SlimefunItems.ADVANCED_CIRCUIT_BOARD,
+ SlimefunItems.SMALL_CAPACITOR, new ItemStack(Material.DISPENSER), SlimefunItems.SMALL_CAPACITOR};
+
+ // 机器
+ SlimefunItemStack craftingtable = new SlimefunItemStack("CLAY_CRAFTING_TABLE",
+ ClayTechItems.CLAY_CRAFTING_TABLE);
+ SlimefunItemStack foodcauldron = new SlimefunItemStack("CLAY_FOOD_CAULDRON", ClayTechItems.CLAY_FOOD_CAULDRON);
+ SlimefunItemStack chalkingmachine = new SlimefunItemStack("CLAY_FOOD_CHALKING_MACHINE",
+ ClayTechItems.CLAY_FOOD_CHALKING_MACHINE);
+ SlimefunItemStack elementextracter = new SlimefunItemStack("CLAY_ELEMENT_EXTRACTER",
+ ClayTechItems.CLAY_ELEMENT_EXTRACTER);
+ SlimefunItemStack electricstonecrusher = new SlimefunItemStack("CLAY_ELECTRIC_STONE_CRUSHER",
+ ClayTechItems.CLAY_ELECTRIC_STONE_CRUSHER);
+ SlimefunItemStack experimenttablebasic = new SlimefunItemStack("CLAY_EXPERIMENT_TABLE_BASIC",
+ ClayTechItems.CLAY_EXPERIMENT_TABLE_NORMAL);
+ SlimefunItemStack rocketassemblingmachine = new SlimefunItemStack("CLAY_ROCKET_ASSEMBLING_MACHINE",
+ ClayTechItems.CLAY_ROCKET_ASSEMBLING_MACHINE);
+ SlimefunItemStack rocketfuelgenerator = new SlimefunItemStack("CLAY_ROCKET_FUEL_GENERATOR",
+ ClayTechItems.CLAY_ROCKET_FUEL_GENERATOR);
+ SlimefunItemStack rocketfuelinjector = new SlimefunItemStack("CLAY_ROCKET_FUEL_INJECTOR",
+ ClayTechItems.CLAY_ROCKET_FUEL_INJECTOR);
+ SlimefunItemStack spacesuitoxygeninjector = new SlimefunItemStack("CLAY_SPACESUIT_OXYGEN_INJECTOR",
+ ClayTechItems.CLAY_SPACESUIT_OXYGEN_INJECTOR);
+ SlimefunItemStack cobblestonegenerator = new SlimefunItemStack("CLAY_COBBLESTONE_GENERATOR",
+ ClayTechItems.CLAY_COBBLESTONE_GENERATOR);
+ SlimefunItemStack electricwaterpump = new SlimefunItemStack("CLAY_ELECTRIC_WATER_PUMP",
+ ClayTechItems.CLAY_ELECTRIC_WATER_PUMP);
+
+ new CraftingTable(ClayTechItems.C_MACHINES, craftingtable, "CLAY_CRAFTING_TABLE",
+ RecipeType.ENHANCED_CRAFTING_TABLE, ClayCrafingTable).register(this);
+ new ElectricStoneCrusher(ClayTechItems.C_MACHINES, electricstonecrusher, "CLAY_ELECTRIC_STONE_CRUSHER",
+ RecipeType.ENHANCED_CRAFTING_TABLE, ClayStoneCrusher).register(this);
+ new FoodCauldron(ClayTechItems.C_MACHINES, foodcauldron, "CLAY_FOOD_CAULDRON",
+ RecipeType.ENHANCED_CRAFTING_TABLE, ClayFoodCauldron).register(this);
+ new FoodChalkingMachine(ClayTechItems.C_MACHINES, chalkingmachine, "CLAY_FOOD_CHALKING_MACHINE",
+ RecipeType.ENHANCED_CRAFTING_TABLE, ClayChalkingMachine).register(this);
+ new ElementExtracter(ClayTechItems.C_MACHINES, elementextracter, "CLAY_ELEMENT_EXTRACTER",
+ RecipeType.ENHANCED_CRAFTING_TABLE, ClayElementExtracter).register(this);
+ new ExperimentTableNormal(ClayTechItems.C_MACHINES, experimenttablebasic, "CLAY_EXPERIMENT_TABLE_BASIC",
+ RecipeType.ENHANCED_CRAFTING_TABLE, ClayExperimentTableBasic).register(this);
+ new RocketAssemblingMachine(ClayTechItems.C_MACHINES, rocketassemblingmachine, "CLAY_ROCKET_ASSEMBLING_MACHINE",
+ RecipeType.ENHANCED_CRAFTING_TABLE, ClayRocketAssemblingMachine).register(this);
+ new RocketFuelGenerator(ClayTechItems.C_MACHINES, rocketfuelgenerator, "CLAY_ROCKET_FUEL_GENERATOR",
+ RecipeType.ENHANCED_CRAFTING_TABLE, ClayRocketFuelGenerator).register(this);
+ new RocketFuelInjector(ClayTechItems.C_MACHINES, rocketfuelinjector, "CLAY_ROCKET_FUEL_INJECTOR",
+ RecipeType.ENHANCED_CRAFTING_TABLE, ClayRocketFuelInjector).register(this);
+ new SpaceSuitOxygenInjector(ClayTechItems.C_MACHINES, spacesuitoxygeninjector, "CLAY_SPACESUIT_OXYGEN_INJECTOR",
+ RecipeType.ENHANCED_CRAFTING_TABLE, ClaySpaceSuitOxygenInjector).register(this);
+ new CobbleStoneGenerator(ClayTechItems.C_MACHINES, cobblestonegenerator, "CLAY_COBBLESTONE_GENERATOR",
+ RecipeType.ENHANCED_CRAFTING_TABLE, ClayCobbleStoneGenerator).register(this);
+ new ElectricWaterPump(ClayTechItems.C_MACHINES, electricwaterpump, "CLAY_ELECTRIC_WATER_PUMP",
+ RecipeType.ENHANCED_CRAFTING_TABLE, ClayElectricWaterPump).register(this);
+ }
+
+ @Override
+ public JavaPlugin getJavaPlugin() {
+ return this;
+ }
+
+ @Override
+ public File getFile() {
+ return super.getFile();
+ }
+
+ @Override
+ public String getBugTrackerURL() {
+ return "https://github.com/ClayCoffee/ClayTech/issues";
+ }
+
+ private void registerPlanets() {
+ // Earth(Overworld) 地球(主世界)
+ new Earth();
+ // Moon 月球
+ new Moon();
+ // Mars 火星
+ new Mars();
+ }
+
+ private void registerResources() {
+ new ClayFuel();
+ }
+
+ @Override
+ public ChunkGenerator getDefaultWorldGenerator(String worldName, String id) {
+ List PlanetNameList = new ArrayList();
+ List PlanetList = getPlanets();
+ for (Planet p : PlanetList) {
+ PlanetNameList.add(p.getPlanetWorldName());
+ }
+ if (Utils.ExitsInList(id, PlanetNameList.toArray(new String[PlanetNameList.size()]))) {
+ return PlanetList.get(PlanetNameList.indexOf(id)).getPlanetGenerator();
+ }
+ return Bukkit.getWorld(getOverworld()).getGenerator();
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/ClayTechBiomes.java b/src/main/java/club/claycoffee/ClayTech/ClayTechBiomes.java
index 757e5b7..8ee4ec6 100644
--- a/src/main/java/club/claycoffee/ClayTech/ClayTechBiomes.java
+++ b/src/main/java/club/claycoffee/ClayTech/ClayTechBiomes.java
@@ -1,21 +1,21 @@
package club.claycoffee.ClayTech;
public enum ClayTechBiomes {
- LAVA_RIVER(1, "Lava River"), PLAIN(2, "Plain"), MOUNTAIN(3, "Mountain"), RIVER(4, "River"), CRATER(5, "Crater");
+ LAVA_RIVER(1, "Lava River"), PLAIN(2, "Plain"), MOUNTAIN(3, "Mountain"), RIVER(4, "River"), CRATER(5, "Crater");
- public final int id;
- public final String name;
+ public final int id;
+ public final String name;
- ClayTechBiomes(int id, String name) {
- this.id = id;
- this.name = name;
- }
+ ClayTechBiomes(int id, String name) {
+ this.id = id;
+ this.name = name;
+ }
- public int getID() {
- return this.id;
- }
+ public int getID() {
+ return this.id;
+ }
- public String getName() {
- return this.name;
- }
+ public String getName() {
+ return this.name;
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/ClayTechCommands.java b/src/main/java/club/claycoffee/ClayTech/ClayTechCommands.java
index f65a3af..3987762 100644
--- a/src/main/java/club/claycoffee/ClayTech/ClayTechCommands.java
+++ b/src/main/java/club/claycoffee/ClayTech/ClayTechCommands.java
@@ -1,61 +1,60 @@
package club.claycoffee.ClayTech;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.stream.Collectors;
-
+import club.claycoffee.ClayTech.utils.Lang;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
-import club.claycoffee.ClayTech.utils.Lang;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
public class ClayTechCommands implements TabExecutor {
- String[] subCommands = { "checkupdate" };
-
- @Override
- public List onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
- if (args.length > 1)
- return new ArrayList<>();
- if (args.length == 0)
- return Arrays.asList(subCommands);
- return Arrays.stream(subCommands).filter(s -> s.startsWith(args[0])).collect(Collectors.toList());
- }
-
- @Override
- public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
- if (command.getName().equalsIgnoreCase("claytech")) {
- if (args.length >= 1) {
- if (args.length == 1) {
- if (args[0].equalsIgnoreCase("checkupdate")) {
- if (sender.hasPermission("claytech.checkupdate")) {
- // 检查更新了兄弟!!
- ClayTech.getUpdater().tryUpdate();
- return true;
- } else {
- sender.sendMessage(Lang.readGeneralText("no_permission"));
- }
- } else {
- subCommandNotFound(sender);
- return true;
- }
- } else {
- subCommandNotFound(sender);
- return true;
- }
- } else {
- // 基础命令
- sender.sendMessage(Lang.readGeneralText("basic_command").replaceAll("\\{version\\}",
- ClayTech.getInstance().getPluginVersion()));
- return true;
- }
- }
- return true;
- }
-
- private void subCommandNotFound(CommandSender sender) {
- sender.sendMessage(Lang.readGeneralText("command_not_found"));
- }
+ String[] subCommands = {"checkupdate"};
+
+ @Override
+ public List onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
+ if (args.length > 1)
+ return new ArrayList<>();
+ if (args.length == 0)
+ return Arrays.asList(subCommands);
+ return Arrays.stream(subCommands).filter(s -> s.startsWith(args[0])).collect(Collectors.toList());
+ }
+
+ @Override
+ public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
+ if (command.getName().equalsIgnoreCase("claytech")) {
+ if (args.length >= 1) {
+ if (args.length == 1) {
+ if (args[0].equalsIgnoreCase("checkupdate")) {
+ if (sender.hasPermission("claytech.checkupdate")) {
+ // 检查更新了兄弟!!
+ ClayTech.getUpdater().tryUpdate();
+ return true;
+ } else {
+ sender.sendMessage(Lang.readGeneralText("no_permission"));
+ }
+ } else {
+ subCommandNotFound(sender);
+ return true;
+ }
+ } else {
+ subCommandNotFound(sender);
+ return true;
+ }
+ } else {
+ // 基础命令
+ sender.sendMessage(Lang.readGeneralText("basic_command").replaceAll("\\{version\\}",
+ ClayTech.getInstance().getPluginVersion()));
+ return true;
+ }
+ }
+ return true;
+ }
+
+ private void subCommandNotFound(CommandSender sender) {
+ sender.sendMessage(Lang.readGeneralText("command_not_found"));
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/ClayTechData.java b/src/main/java/club/claycoffee/ClayTech/ClayTechData.java
index 8938f5e..1829622 100644
--- a/src/main/java/club/claycoffee/ClayTech/ClayTechData.java
+++ b/src/main/java/club/claycoffee/ClayTech/ClayTechData.java
@@ -1,14 +1,14 @@
package club.claycoffee.ClayTech;
-import java.util.HashMap;
-import java.util.Map;
-
import org.bukkit.block.Block;
import org.bukkit.inventory.Inventory;
+import java.util.HashMap;
+import java.util.Map;
+
public class ClayTechData {
- public static Map RunningLaunchersG = new HashMap();
- public static Map RunningInjectors = new HashMap();
- public static Map RunningInjectorsOxygen = new HashMap();
- public static String currentVersion = "";
+ public static Map RunningLaunchersG = new HashMap();
+ public static Map RunningInjectors = new HashMap();
+ public static Map RunningInjectorsOxygen = new HashMap();
+ public static String currentVersion = "";
}
diff --git a/src/main/java/club/claycoffee/ClayTech/ClayTechItems.java b/src/main/java/club/claycoffee/ClayTech/ClayTechItems.java
index c1718b4..50fc91c 100644
--- a/src/main/java/club/claycoffee/ClayTech/ClayTechItems.java
+++ b/src/main/java/club/claycoffee/ClayTech/ClayTechItems.java
@@ -1,439 +1,432 @@
package club.claycoffee.ClayTech;
-import org.bukkit.Material;
-import org.bukkit.NamespacedKey;
-import org.bukkit.enchantments.Enchantment;
-import org.bukkit.inventory.ItemStack;
-
import club.claycoffee.ClayTech.utils.Lang;
import club.claycoffee.ClayTech.utils.Utils;
-import club.claycoffee.ClayTech.ClayTech;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
-import io.github.thebusybiscuit.slimefun4.core.categories.LockedCategory;
-import me.mrCookieSlime.Slimefun.cscorelib2.skull.SkullItem;
-import io.github.thebusybiscuit.slimefun4.utils.LoreBuilder;
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
import io.github.thebusybiscuit.slimefun4.core.attributes.MachineTier;
import io.github.thebusybiscuit.slimefun4.core.attributes.MachineType;
+import io.github.thebusybiscuit.slimefun4.core.categories.LockedCategory;
+import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.utils.LoreBuilder;
+import me.mrCookieSlime.Slimefun.cscorelib2.skull.SkullItem;
+import org.bukkit.Material;
+import org.bukkit.NamespacedKey;
+import org.bukkit.enchantments.Enchantment;
+import org.bukkit.inventory.ItemStack;
public class ClayTechItems {
- public static final ItemStack[] NORECIPE = { null, null, null, null, null, null, null, null, null };
- private static final NamespacedKey N_BASIC = new NamespacedKey(ClayTech.plugin, "claycategory");
-
- // 分类
- public static final LockedCategory C_BASICS = new LockedCategory(N_BASIC,
- Utils.newItemD(Material.CLAY, Lang.readCategoriesText("Basic")),
- new NamespacedKey(SlimefunPlugin.instance(), "basic_machines"));
- public static final LockedCategory C_WEAPONS = new LockedCategory(
- new NamespacedKey(ClayTech.plugin, "claycategory1"),
- Utils.newItemD(Material.DIAMOND_SWORD, Lang.readCategoriesText("Weapons")), N_BASIC);
- public static final LockedCategory C_FOOD = new LockedCategory(new NamespacedKey(ClayTech.plugin, "claycategory"),
- Utils.newItemD(Material.ENCHANTED_GOLDEN_APPLE, Lang.readCategoriesText("Food")), N_BASIC);
- public static final LockedCategory C_FOODMATERIALS = new LockedCategory(
- new NamespacedKey(ClayTech.plugin, "claycategory2"),
- Utils.newItemD(Material.COCOA_BEANS, Lang.readCategoriesText("FoodMakings")), N_BASIC);
- public static final LockedCategory C_DRINK = new LockedCategory(new NamespacedKey(ClayTech.plugin, "claycategory"),
- Utils.newItemD(Material.WATER_BUCKET, Lang.readCategoriesText("Drink")), N_BASIC);
- public static final LockedCategory C_MATERIALS = new LockedCategory(
- new NamespacedKey(ClayTech.plugin, "claycategory3"),
- Utils.newItemD(Material.COAL, Lang.readCategoriesText("Makings")), N_BASIC);
- public static final LockedCategory C_ARMORS = new LockedCategory(new NamespacedKey(ClayTech.plugin, "claycategory"),
- Utils.newItemD(Material.DIAMOND_CHESTPLATE, Lang.readCategoriesText("Armors")), N_BASIC);
- public static final LockedCategory C_DECORATES = new LockedCategory(
- new NamespacedKey(ClayTech.plugin, "claycategory4"),
- Utils.newItemD(Material.PLAYER_HEAD, Lang.readCategoriesText("Decorates")), N_BASIC);
- public static final LockedCategory C_ELEMENTS = new LockedCategory(
- new NamespacedKey(ClayTech.plugin, "claycategory5"),
- Utils.newItemD(Material.FLOWER_POT, Lang.readCategoriesText("Elements")), N_BASIC);
- public static final LockedCategory C_MACHINES = new LockedCategory(
- new NamespacedKey(ClayTech.plugin, "claycategory6"),
- Utils.newItemD(Material.FURNACE, Lang.readCategoriesText("Machines")), N_BASIC);
- public static final LockedCategory C_OTHER = new LockedCategory(new NamespacedKey(ClayTech.plugin, "claycategory7"),
- Utils.newItemD(Material.POWERED_RAIL, Lang.readCategoriesText("Other")), N_BASIC);
- public static final LockedCategory C_TOOLS = new LockedCategory(new NamespacedKey(ClayTech.plugin, "claycategory8"),
- Utils.newItemD(Material.DIAMOND_PICKAXE, Lang.readCategoriesText("Tools")), N_BASIC);
- public static final LockedCategory C_ORESTHINGS = new LockedCategory(
- new NamespacedKey(ClayTech.plugin, "claycategory9"),
- Utils.newItemD(Material.BRICK, Lang.readCategoriesText("OreThings")), N_BASIC);
-
- // 注册
- public static final ItemStack USEFUL_DIRT = Utils.setLore(
- Utils.setDisplayName(new ItemStack(Material.DIRT), Lang.readItemText("USEFUL_DIRT")),
- Lang.readItemLore("USEFUL_DIRT"));
- public static final ItemStack ORE_DIAMOND = Utils.setDisplayName(new ItemStack(Material.DIAMOND),
- Lang.readItemText("ORE_DIAMOND"));
- public static final ItemStack MAGIC_CLAY = Utils.setLore(
- Utils.newItemD(Material.CLAY_BALL, Lang.readItemText("MAGIC_CLAY")), Lang.readItemLore("MAGIC_CLAY"));
- public static final ItemStack CLAY_STICK = Utils
- .setLore(Utils.newItemD(Material.STICK, Lang.readItemText("CLAY_STICK")), Lang.readItemLore("CLAY_STICK"));
- public static final ItemStack ARTIFICIAL_GOLD_NUGGET = Utils.newItemD(Material.GOLD_NUGGET,
- Lang.readItemText("ARTIFICIAL_GOLD_NUGGET"));
- public static final ItemStack ARTIFICIAL_GOLD_INGOT_O = Utils.newItemD(Material.COAL,
- Lang.readItemText("ARTIFICIAL_GOLD_INGOT_O"));
- public static final ItemStack ARTIFICIAL_GOLD_INGOT = Utils.newItemD(Material.GOLD_INGOT,
- Lang.readItemText("ARTIFICIAL_GOLD_INGOT"));
- public static final ItemStack ARTIFICIAL_GOLD_BLOCK = Utils.newItemD(Material.GOLD_BLOCK,
- Lang.readItemText("ARTIFICIAL_GOLD_BLOCK"));
- public static final ItemStack ARTIFICIAL_ENCHANTED_GOLDEN_APPLE = Utils.newItemD(Material.ENCHANTED_GOLDEN_APPLE,
- Lang.readItemText("ARTIFICIAL_ENCHANTED_GOLDEN_APPLE"));
- public static final ItemStack BLIND_CORE = Utils.newItemD(Material.COAL, Lang.readItemText("BLIND_CORE"));
- public static final ItemStack BLIND_SWORD = Utils.setLore(
- Utils.newItemD(Material.DIAMOND_SWORD, Lang.readItemText("BLIND_SWORD")), Lang.readItemLore("BLIND_SWORD"));
- public static final ItemStack CONFUSION_CORE = Utils.newItemD(Material.WITHER_SKELETON_SKULL,
- Lang.readItemText("CONFUSION_CORE"));
- public static final ItemStack BLACK_ROCK_BLOCK = Utils.newItemD(Material.OBSIDIAN,
- Lang.readItemText("BLACK_ROCK_BLOCK"));
- public static final ItemStack SLOWNESS_CORE = Utils.newItemD(Material.OBSIDIAN, Lang.readItemText("SLOWNESS_CORE"));
- public static final ItemStack POISON_EYE = Utils.newItemD(Material.SPIDER_EYE, Lang.readItemText("POISON_EYE"));
- public static final ItemStack POISON_CORE = Utils.newItemD(Material.SPIDER_EYE, Lang.readItemText("POISON_CORE"));
- public static final ItemStack ADVANCED_BLIND_CORE = Utils.newItemD(Material.COAL,
- Lang.readItemText("ADVANCED_BLIND_CORE"));
- public static final ItemStack ADVANCED_CONFUSION_CORE = Utils.newItemD(Material.WITHER_SKELETON_SKULL,
- Lang.readItemText("ADVANCED_CONFUSION_CORE"));
- public static final ItemStack ADVANCED_SLOWNESS_CORE = Utils.newItemD(Material.OBSIDIAN,
- Lang.readItemText("ADVANCED_SLOWNESS_CORE"));
- public static final ItemStack ADVANCED_POISON_CORE = Utils.newItemD(Material.SPIDER_EYE,
- Lang.readItemText("ADVANCED_POISON_CORE"));
- public static final ItemStack FOUR_BOW = Utils.setLore(Utils.newItemD(Material.BOW, Lang.readItemText("FOUR_BOW")),
- Lang.readItemLore("FOUR_BOW"));
- public static final ItemStack POISON_SWORD = Utils.setLore(
- Utils.newItemD(Material.DIAMOND_SWORD, Lang.readItemText("POISON_SWORD")),
- Lang.readItemLore("POISON_SWORD"));
- public static final ItemStack ANTI_SLOWNESS_BOOTS = Utils.setLore(
- Utils.newItemD(Material.IRON_BOOTS, Lang.readItemText("ANTI_SLOWNESS_BOOTS")),
- Lang.readItemLore("ANTI_SLOWNESS_BOOTS"));
- public static final ItemStack COCOA_BEAN = Utils.setLore(
- Utils.newItemD(Material.COCOA_BEANS, Lang.readItemText("COCOA_BEAN")), Lang.readItemLore("COCOA_BEAN"));
- public static final ItemStack PLASTIC = Utils.setLore(Utils.newItemD(
- SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14) ? Material.WHITE_DYE
- : Material.BONE_MEAL,
- Lang.readItemText("PLASTIC")), Lang.readItemLore("PLASTIC"));
- public static final ItemStack RAW_CHICKEN_FOOT = Utils.setLore(
- Utils.newItemD(Material.RABBIT_FOOT, Lang.readItemText("RAW_CHICKEN_FOOT")),
- Lang.readItemLore("RAW_CHICKEN_FOOT"));
- public static final ItemStack CHICKEN_FOOT = Utils.setLore(
- Utils.newItemD(Material.RABBIT_FOOT, Lang.readItemText("FRIED_CHICKEN_FOOT")),
- Lang.readItemLore("FRIED_CHICKEN_FOOT"));
- public static final ItemStack RAW_BREAD = Utils
- .setLore(Utils.newItemD(Material.BREAD, Lang.readItemText("RAW_BREAD")), Lang.readItemLore("RAW_BREAD"));
- public static final ItemStack DIRTY_TEA = Utils
- .setLore(Utils.newItemD(Material.KELP, Lang.readItemText("DIRTY_TEA")), Lang.readItemLore("DIRTY_TEA"));
- public static final ItemStack RAW_TEA = Utils.setLore(Utils.newItemD(Material.KELP, Lang.readItemText("TEA")),
- Lang.readItemLore("TEA"));
- public static final ItemStack TEA_POWDER = Utils.setLore(Utils.newItemD(
- SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14) ? Material.BROWN_DYE
- : Material.BONE_MEAL,
- Lang.readItemText("TEA_POWDER")), Lang.readItemLore("TEA_POWDER"));
- public static final ItemStack LEMON_POWDER = Utils
- .setLore(
- Utils.newItemD(SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)
- ? Material.YELLOW_DYE
- : Material.BONE_MEAL, Lang.readItemText("LEMON_POWDER")),
- Lang.readItemLore("LEMON_POWDER"));
- public static final ItemStack FLOUR = Utils.setLore(Utils.newItemD(Material.SUGAR, Lang.readItemText("FLOUR")),
- Lang.readItemLore("FLOUR"));
- public static final ItemStack STARCH = Utils.setLore(Utils.newItemD(Material.SUGAR, Lang.readItemText("STARCH")),
- Lang.readItemLore("STARCH"));
- public static final ItemStack SNAIL_HEALTHY = Utils.setLore(
- Utils.newItemD(Material.NAUTILUS_SHELL, Lang.readItemText("SNAIL_HEALTHY")),
- Lang.readItemLore("SNAIL_HEALTHY"));
- public static final ItemStack SNAIL_BAD = Utils.setLore(
- Utils.newItemD(Material.NAUTILUS_SHELL, Lang.readItemText("SNAIL_BAD")), Lang.readItemLore("SNAIL_BAD"));
- public static final ItemStack HIGHSPEED_RAILWAY = Utils.setLore(
- Utils.newItemD(Material.POWERED_RAIL, Lang.readItemText("HIGHSPEED_RAILWAY")),
- Lang.readItemLore("HIGHSPEED_RAILWAY"));
- public static final ItemStack ELECTRIC_MOTOR_8 = Utils.newItemD(Material.FEATHER,
- Lang.readItemText("ELECTRIC_MOTOR_8"));
- public static final ItemStack ELEMENT_UNIT = Utils.setLore(
- Utils.newItemD(Material.FLOWER_POT, Lang.readItemText("ELEMENT_UNIT")), Lang.readItemLore("ELEMENT_UNIT"));
- public static final ItemStack ELEMENT_OXYGEN = Utils.setLore(
- Utils.newItemD(Material.FLOWER_POT, Lang.readItemText("ELEMENT_OXYGEN")),
- Lang.readItemLore("ELEMENT_OXYGEN"));
- public static final ItemStack ELEMENT_CARBON = Utils.setLore(
- Utils.newItemD(Material.FLOWER_POT, Lang.readItemText("ELEMENT_CARBON")),
- Lang.readItemLore("ELEMENT_CARBON"));
- public static final ItemStack ELEMENT_SILICON = Utils.setLore(
- Utils.newItemD(Material.FLOWER_POT, Lang.readItemText("ELEMENT_SILICON")),
- Lang.readItemLore("ELEMENT_SILICON"));
- public static final ItemStack BLISTERING_CORE = Utils.newItemD(Material.GOLD_INGOT,
- Lang.readItemText("BLISTERING_CORE"));
- public static final ItemStack TNT_EXPLOSION_CREATER = Utils.setLore(
- Utils.newItemD(Material.GOLDEN_HOE, Lang.readItemText("TNT_EXPLOSION_CREATER")),
- Lang.readItemLore("TNT_EXPLOSION_CREATER"));
- public static final ItemStack CLAY_SWEET_POTATO = Utils.setLore(
- Utils.newItemD(Material.BEETROOT, Lang.readItemText("SWEET_POTATO")), Lang.readItemLore("SWEET_POTATO"));
- public static final ItemStack COOKED_SWEET_POTATO = Utils.setLore(
- Utils.newItemD(Material.BEETROOT, Lang.readItemText("COOKED_SWEET_POTATO")),
- Lang.readItemLore("COOKED_SWEET_POTATO"));
- public static final ItemStack REINFORCED_ALLOY_PICKAXE = Utils.addEnchantH(
- Utils.addEnchantH(Utils.newItemD(Material.IRON_PICKAXE, Lang.readItemText("REINFORCED_ALLOY_PICKAXE")),
- Enchantment.DIG_SPEED, 9),
- Enchantment.DURABILITY, 9);
- public static final ItemStack CLAY_FUSION_INGOT = Utils.newItemD(Material.IRON_INGOT,
- Lang.readItemText("CLAY_FUSION_INGOT"));
- public static final ItemStack CLAY_ALLOY_INGOT = Utils.newItemD(Material.IRON_INGOT,
- Lang.readItemText("CLAY_ALLOY_INGOT"));
- public static final ItemStack CLAY_ALLOY_PICKAXE = Utils.addEnchantH(Utils.addEnchantH(
- Utils.addEnchantH(Utils.newItemD(Material.IRON_PICKAXE, Lang.readItemText("CLAY_ALLOY_PICKAXE")),
- Enchantment.DIG_SPEED, 10),
- Enchantment.DURABILITY, 10), Enchantment.MENDING, 1);
- public static final ItemStack CLAY_ALLOY_HELMET = Utils.addEnchantH(
- Utils.addEnchantH(
- Utils.addEnchantH(Utils.newItemD(Material.IRON_HELMET, Lang.readItemText("CLAY_ALLOY_HELMET")),
- Enchantment.PROTECTION_ENVIRONMENTAL, 10),
- Enchantment.DURABILITY, 10),
- Enchantment.MENDING, 1);
- public static final ItemStack CLAY_ALLOY_CHESTPLATE = Utils
- .addEnchantH(
- Utils.addEnchantH(Utils.addEnchantH(
- Utils.newItemD(Material.IRON_CHESTPLATE, Lang.readItemText("CLAY_ALLOY_CHESTPLATE")),
- Enchantment.PROTECTION_ENVIRONMENTAL, 10), Enchantment.DURABILITY, 10),
- Enchantment.MENDING, 1);
- public static final ItemStack CLAY_ALLOY_LEGGINGS = Utils.addEnchantH(
- Utils.addEnchantH(
- Utils.addEnchantH(Utils.newItemD(Material.IRON_LEGGINGS, Lang.readItemText("CLAY_ALLOY_LEGGINGS")),
- Enchantment.PROTECTION_ENVIRONMENTAL, 10),
- Enchantment.DURABILITY, 10),
- Enchantment.MENDING, 1);
- public static final ItemStack CLAY_ALLOY_BOOTS = Utils.addEnchantH(
- Utils.addEnchantH(
- Utils.addEnchantH(Utils.newItemD(Material.IRON_BOOTS, Lang.readItemText("CLAY_ALLOY_BOOTS")),
- Enchantment.PROTECTION_ENVIRONMENTAL, 10),
- Enchantment.DURABILITY, 10),
- Enchantment.MENDING, 1);
- public static final ItemStack SILICON_INGOT = Utils.newItemD(Material.IRON_INGOT,
- Lang.readItemText("SILICON_INGOT"));
- public static final ItemStack ROCKET_LAUNCHER = Utils.newItemD(Material.IRON_BLOCK,
- Lang.readItemText("ROCKET_LAUNCHER"));
- public static final ItemStack MOTOR_CORE = Utils.newItemD(Material.NETHER_STAR, Lang.readItemText("MOTOR_CORE"));
- public static final ItemStack TEMPERATURE_RESISTANCE_OBSIDIAN = Utils.setLore(
- Utils.newItemD(Material.OBSIDIAN, Lang.readItemText("TEMPERATURE_RESISTANCE_OBSIDIAN")),
- Lang.readItemLore("TEMPERATURE_RESISTANCE_OBSIDIAN"));
- public static final ItemStack ROCKET_ENGINE_SHELL = Utils.newItemD(Material.IRON_INGOT,
- Lang.readItemText("ROCKET_ENGINE_SHELL"));
- public static final ItemStack ROCKET_ANTENNA = Utils.setLore(
- Utils.newItemD(Material.REDSTONE_TORCH, Lang.readItemText("ROCKET_ANTENNA")),
- Lang.readItemLore("ROCKET_ANTENNA"));
- public static final ItemStack ROCKET_CPU = Utils.setLore(
- Utils.newItemD(Material.NETHER_STAR, Lang.readItemText("ROCKET_CPU")), Lang.readItemLore("ROCKET_CPU"));
- public static final ItemStack ROCKET_CONTROL_CORE = Utils.setLore(
- Utils.newItemD(Material.FIREWORK_STAR, Lang.readItemText("ROCKET_CONTROL_CORE")),
- Lang.readItemLore("ROCKET_CONTROL_CORE"));
- public static final ItemStack ROCKET_GLASS = Utils.setLore(
- Utils.newItemD(Material.LIME_STAINED_GLASS_PANE, Lang.readItemText("ROCKET_GLASS")),
- Lang.readItemLore("ROCKET_GLASS"));
- public static final ItemStack ROCKET_STEEL_PLATE = Utils.setLore(
- Utils.newItemD(Material.PAPER, Lang.readItemText("ROCKET_STEEL_PLATE")),
- Lang.readItemLore("ROCKET_STEEL_PLATE"));
- public static final ItemStack SPACESUIT_HELMET = Utils.setLore(
- Utils.newItemD(Material.DIAMOND_HELMET, Lang.readItemText("SPACESUIT_HELMET")),
- Lang.readItemLore("SPACESUIT_HELMET"));
- public static final ItemStack SPACESUIT_CHESTPLATE = Utils.setLore(
- Utils.newItemD(Material.DIAMOND_CHESTPLATE, Lang.readItemText("SPACESUIT_CHESTPLATE")),
- Lang.readItemLore("SPACESUIT_CHESTPLATE"));
- public static final ItemStack SPACESUIT_LEGGINGS = Utils.setLore(
- Utils.newItemD(Material.DIAMOND_LEGGINGS, Lang.readItemText("SPACESUIT_LEGGINGS")),
- Lang.readItemLore("SPACESUIT_LEGGINGS"));
- public static final ItemStack SPACESUIT_BOOTS = Utils.setLore(
- Utils.newItemD(Material.DIAMOND_BOOTS, Lang.readItemText("SPACESUIT_BOOTS")),
- Lang.readItemLore("SPACESUIT_BOOTS"));
- public static final ItemStack KREEP_ROCK = Utils.setLore(
- Utils.newItemD(Material.GRANITE, Lang.readItemText("KREEP_ROCK")), Lang.readItemLore("KREEP_ROCK"));
- public static final ItemStack KREEP_INGOT = Utils.setLore(
- Utils.newItemD(Material.IRON_INGOT, Lang.readItemText("KREEP_INGOT")), Lang.readItemLore("KREEP_INGOT"));
- public static final ItemStack PLANET_BASE_SIGNER = Utils.setLore(
- Utils.newItemD(Material.OBSIDIAN, Lang.readItemText("PLANET_BASE_SIGNER")),
- Lang.readItemLore("PLANET_BASE_SIGNER"));
- public static final ItemStack TUBE = Utils.newItemD(Material.BONE, Lang.readItemText("TUBE"));
- public static final ItemStack OXYGEN_DISTRIBUTER = Utils.setLore(
- Utils.newItemD(Material.FIREWORK_STAR, Lang.readItemText("OXYGEN_DISTRIBUTER")),
- Lang.readItemLore("OXYGEN_DISTRIBUTER"));
- public static final ItemStack COPPER_ORE = Utils.setLore(
- Utils.newItemD(Material.GOLD_BLOCK, Lang.readItemText("COPPER_ORE")), Lang.readItemLore("COPPER_ORE"));
- public static final ItemStack CLAY_FUSION_ORE = Utils.setLore(
- Utils.newItemD(Material.IRON_BLOCK, Lang.readItemText("CLAY_FUSION_ORE")),
- Lang.readItemLore("CLAY_FUSION_ORE"));
- public static final ItemStack TUNA_FISH = Utils.setLore(
- Utils.newItemD(Material.TROPICAL_FISH, Lang.readItemText("TUNA_FISH")), Lang.readItemLore("TUNA_FISH"));
- public static final ItemStack GREEN_GRASS = Utils.setLore(
- Utils.newItemD(Material.GRASS, Lang.readItemText("GREEN_GRASS")), Lang.readItemLore("GREEN_GRASS"));
-
- public static final ItemStack CLAY_FUEL = Utils.setDisplayName(
- SkullItem.fromHash("3ce2dad9baf7eaba7e80d4d0f9fac0aab01a76b12fb71c3d2af2a16fdd4c7383"),
- Lang.readItemText("CLAY_FUEL"));
- public static final ItemStack MIXED_ROCKET_FUEL = Utils.setLore(
- Utils.setDisplayName(SkullItem.fromHash("3ce2dad9baf7eaba7e80d4d0f9fac0aab01a76b12fb71c3d2af2a16fdd4c7383"),
- Lang.readItemText("MIXED_ROCKET_FUEL")),
- Lang.readItemLore("MIXED_ROCKET_FUEL"));
-
- // 头颅
- public static final ItemStack CLAYCOFFEE_HEAD = Utils.setDisplayName(SkullItem.fromURL(
- "http://textures.minecraft.net/texture/58c55ba01ccc7e79b5495e5c4e00080ff6c92a832b2905fed724f2f68a3bb94c"),
- Lang.readItemText("AUTHOR_HEAD"));
- public static final ItemStack STALIN_HEAD = Utils.setDisplayName(SkullItem.fromURL(
- "http://textures.minecraft.net/texture/96fb8390f61a2cc51c08201834369829d9ba301effc01b6a7cb10d830c6c5043"),
- Lang.readItemText("STALIN_HEAD"));
- public static final ItemStack MARX_HEAD = Utils.setDisplayName(SkullItem.fromURL(
- "http://textures.minecraft.net/texture/57304952eff15a9fb81fa070fa549f85243c790f8fa61bf6e196a7516ce85a48"),
- Lang.readItemText("MARX_HEAD"));
- public static final ItemStack LANTERN_C = Utils.setDisplayName(SkullItem.fromURL(
- "http://textures.minecraft.net/texture/7cc217a9b9e3ce3cd0484c7e8ce49d1cf741281bdda5a4d6cb821f378752718"),
- Lang.readItemText("LANTERN"));
- public static final ItemStack CLOCK_C = Utils.setDisplayName(SkullItem.fromURL(
- "http://textures.minecraft.net/texture/ba10da526e5111cfb6e3ebd47693e162dd52d41a2182028daa7c2b19aa3143"),
- Lang.readItemText("BLACK_CLOCK"));
- public static final ItemStack CLAY_COFFEE = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
- "http://textures.minecraft.net/texture/411511bdd55bcb82803c8039f1c155fd43062636e23d4d46c4d761c04d22c2"),
- Lang.readItemText("CLAY_COFFEE")), Lang.readItemLore("CLAY_COFFEE"));;
- public static final ItemStack DRINK_BOTTLE = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
- "http://textures.minecraft.net/texture/9179ce4849723434e84747ec85fbbfb1121456c8aeb2e9171fb8328921d45"),
- Lang.readItemText("DRINK_BOTTLE")), Lang.readItemLore("DRINK_BOTTLE"));
- public static final ItemStack DIRTY_DRINK_BOTTLE = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
- "http://textures.minecraft.net/texture/9179ce4849723434e84747ec85fbbfb1121456c8aeb2e9171fb8328921d45"),
- Lang.readItemText("DIRTY_DRINK_BOTTLE")), Lang.readItemLore("DIRTY_DRINK_BOTTLE"));
- public static final ItemStack SPICY_CHICKEN_BURGER = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
- "http://textures.minecraft.net/texture/c5e27988a6538010efc0e24756bc3e3eea24d7536b20932c17e0404e5cc55f"),
- Lang.readItemText("SPICY_CHICKEN_BURGER")), Lang.readItemLore("SPICY_CHICKEN_BURGER"));
- public static final ItemStack BABA_BURGER = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
- "http://textures.minecraft.net/texture/c5e27988a6538010efc0e24756bc3e3eea24d7536b20932c17e0404e5cc55f"),
- Lang.readItemText("BABA_BURGER")), Lang.readItemLore("BABA_BURGER"));
- public static final ItemStack RAW_VEGETABLE = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
- "http://textures.minecraft.net/texture/477dd842c975d8fb03b1add66db8377a18ba987052161f22591e6a4ede7f5"),
- Lang.readItemText("LETTUSE")), Lang.readItemLore("LETTUSE"));
- public static final ItemStack CLAY_LEMON = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
- "http://textures.minecraft.net/texture/957fd56ca15978779324df519354b6639a8d9bc1192c7c3de925a329baef6c"),
- Lang.readItemText("LEMON")), Lang.readItemLore("LEMON"));
-
- public static final ItemStack LEMON_POWDER_DRINK = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
- "http://textures.minecraft.net/texture/d8e94ddd769a5bea748376b4ec7383fd36d267894d7c3bee011e8e4f5fcd7"),
- Lang.readItemText("LEMON_POWDER_DRINK")), Lang.readItemLore("LEMON_POWDER_DRINK"));
- public static final ItemStack TEA_DRINK = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
- "http://textures.minecraft.net/texture/d8e94ddd769a5bea748376b4ec7383fd36d267894d7c3bee011e8e4f5fcd7"),
- Lang.readItemText("TEA_DRINK")), Lang.readItemLore("TEA_DRINK"));
- public static final ItemStack LEMON_TEA_DRINK = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
- "http://textures.minecraft.net/texture/d8e94ddd769a5bea748376b4ec7383fd36d267894d7c3bee011e8e4f5fcd7"),
- Lang.readItemText("LEMON_TEA_DRINK")), Lang.readItemLore("LEMON_TEA_DRINK"));
- public static final ItemStack CHOCOLATE = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
- "http://textures.minecraft.net/texture/819f948d17718adace5dd6e050c586229653fef645d7113ab94d17b639cc466"),
- Lang.readItemText("CHOCOLATE")), Lang.readItemLore("CHOCOLATE"));
- public static final ItemStack SNAIL_FOOD = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
- "http://textures.minecraft.net/texture/26834b5b25426de63538ec82ca8fbecfcbb3e682d8063643d2e67a7621bd"),
- Lang.readItemText("LUOSI_RICE_NOODLE")), Lang.readItemLore("LUOSI_RICE_NOODLE"));
- public static final ItemStack ROCKET = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
- "http://textures.minecraft.net/texture/25b3f2cfa0739c4e828316f39f90b05bc1f4ed27b1e35888511f558d4675"),
- Lang.readItemText("ROCKET")), Lang.readItemLore("ROCKET"));
- public static final ItemStack FUEL_TANK = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
- "http://textures.minecraft.net/texture/5175bdf47aea1a4bf1d349be6b7fa4ab37f479672f4c43aca57511b427ab4"),
- Lang.readItemText("FUEL_TANK")), Lang.readItemLore("FUEL_TANK"));
- public static final ItemStack ROCKET_ENGINE = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
- "http://textures.minecraft.net/texture/5175bdf47aea1a4bf1d349be6b7fa4ab37f479672f4c43aca57511b427ab4"),
- Lang.readItemText("ROCKET_ENGINE")), Lang.readItemLore("ROCKET_ENGINE"));
- public static final ItemStack ROCKET_FUEL_TANK = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
- "http://textures.minecraft.net/texture/5175bdf47aea1a4bf1d349be6b7fa4ab37f479672f4c43aca57511b427ab4"),
- Lang.readItemText("ROCKET_FUEL_TANK")), Lang.readItemLore("ROCKET_FUEL_TANK"));
- public static final ItemStack OXYGEN_TANK = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
- "http://textures.minecraft.net/texture/52baeb4a35da8a85d14bdccf7184f5545088f954da55144f235c2983fdb8e05b"),
- Lang.readItemText("OXYGEN_TANK")), Lang.readItemLore("OXYGEN_TANK"));
- public static final ItemStack SPACESUIT_OXYGEN_TANK = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
- "http://textures.minecraft.net/texture/52baeb4a35da8a85d14bdccf7184f5545088f954da55144f235c2983fdb8e05b"),
- Lang.readItemText("SPACESUIT_OXYGEN_TANK")), Lang.readItemLore("SPACESUIT_OXYGEN_TANK"));
-
- // 机器
- public static final ItemStack CLAY_CRAFTING_TABLE = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
- "http://textures.minecraft.net/texture/6d6c65b44c34b1acc2ccb346752397125f0d9ffa0ab3c50a99d1db3b74c63"),
- Lang.readItemText("CLAY_FUSION_MACHINE")),
- Utils.replaceList(
- Utils.replaceList(Lang.readItemLore("CLAY_FUSION_MACHINE"), "%TIER%",
- LoreBuilder.machine(MachineTier.BASIC, MachineType.MACHINE).replaceAll("&", "§")),
- "%POWER%", LoreBuilder.powerBuffer(128).replaceAll("&", "§")));
- public static final ItemStack CLAY_ELECTRIC_STONE_CRUSHER = Utils
- .setLore(
- Utils.newItemD(Material.RED_STAINED_GLASS, Lang.readItemText("CLAY_ELECTRIC_STONE_CRUSHER")), Utils
- .replaceList(
- Utils.replaceList(Lang.readItemLore("CLAY_ELECTRIC_STONE_CRUSHER"), "%TIER%",
- LoreBuilder.machine(MachineTier.BASIC, MachineType.MACHINE).replaceAll("&",
- "§")),
- "%POWER%", LoreBuilder.powerBuffer(128).replaceAll("&", "§")));
- public static final ItemStack CLAY_FOOD_CAULDRON = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
- "http://textures.minecraft.net/texture/dfd9b2f42d5f1c2a77b511fe41a4c6b5c192fb10b2ceadde05bd1af52a151"),
- Lang.readItemText("CLAY_ELETRIC_CAULDRON")),
- Utils.replaceList(
- Utils.replaceList(Lang.readItemLore("CLAY_ELETRIC_CAULDRON"), "%TIER%",
- LoreBuilder.machine(MachineTier.AVERAGE, MachineType.MACHINE).replaceAll("&", "§")),
- "%POWER%", LoreBuilder.powerBuffer(512).replaceAll("&", "§")));
- public static final ItemStack CLAY_FOOD_CHALKING_MACHINE = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
- "http://textures.minecraft.net/texture/98636123b1a3755abd8aef6d85b2a85bf10f486edefdd1a3cef7679d825"),
- Lang.readItemText("CLAY_FOOD_CHALKING_MACHINE")),
- Utils.replaceList(
- Utils.replaceList(Lang.readItemLore("CLAY_FOOD_CHALKING_MACHINE"), "%TIER%",
- LoreBuilder.machine(MachineTier.AVERAGE, MachineType.MACHINE).replaceAll("&", "§")),
- "%POWER%", LoreBuilder.powerBuffer(512).replaceAll("&", "§")));
- public static final ItemStack CLAY_ELEMENT_EXTRACTER = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
- "http://textures.minecraft.net/texture/c74170c66bf3140f234b322add724c5df6949a9209f807ebf86d4f9c8c1e178"),
- Lang.readItemText("CLAY_ELEMENT_EXTRACTER")),
- Utils.replaceList(
- Utils.replaceList(Lang.readItemLore("CLAY_ELEMENT_EXTRACTER"), "%TIER%",
- LoreBuilder.machine(MachineTier.ADVANCED, MachineType.MACHINE).replaceAll("&", "§")),
- "%POWER%", LoreBuilder.powerBuffer(1024).replaceAll("&", "§")));
- public static final ItemStack CLAY_EXPERIMENT_TABLE_NORMAL = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
- "http://textures.minecraft.net/texture/52baeb4a35da8a85d14bdccf7184f5545088f954da55144f235c2983fdb8e05b"),
- Lang.readItemText("CLAY_EXPERIMENT_TABLE_NORMAL")),
- Utils.replaceList(
- Utils.replaceList(Lang.readItemLore("CLAY_EXPERIMENT_TABLE_NORMAL"), "%TIER%",
- LoreBuilder.machine(MachineTier.ADVANCED, MachineType.MACHINE).replaceAll("&", "§")),
- "%POWER%", LoreBuilder.powerBuffer(1024).replaceAll("&", "§")));
- public static final ItemStack CLAY_ROCKET_ASSEMBLING_MACHINE = Utils
- .setLore(
- Utils.newItemD(Material.GOLD_BLOCK, Lang.readItemText("CLAY_ROCKET_ASSEMBLING_MACHINE")), Utils
- .replaceList(
- Utils.replaceList(Lang.readItemLore("CLAY_ROCKET_ASSEMBLING_MACHINE"), "%TIER%",
- LoreBuilder.machine(MachineTier.ADVANCED, MachineType.MACHINE)
- .replaceAll("&", "§")),
- "%POWER%", LoreBuilder.powerBuffer(512).replaceAll("&", "§")));
- public static final ItemStack CLAY_ROCKET_FUEL_GENERATOR = Utils
- .setLore(
- Utils.newItemD(Material.EMERALD_BLOCK, Lang.readItemText("CLAY_ROCKET_FUEL_GENERATOR")), Utils
- .replaceList(
- Utils.replaceList(Lang.readItemLore("CLAY_ROCKET_FUEL_GENERATOR"), "%TIER%",
- LoreBuilder.machine(MachineTier.ADVANCED, MachineType.MACHINE)
- .replaceAll("&", "§")),
- "%POWER%", LoreBuilder.powerBuffer(256).replaceAll("&", "§")));
- public static final ItemStack CLAY_ROCKET_FUEL_INJECTOR = Utils
- .setLore(
- Utils.newItemD(Material.DIAMOND_BLOCK, Lang.readItemText("CLAY_ROCKET_FUEL_INJECTOR")), Utils
- .replaceList(
- Utils.replaceList(Lang.readItemLore("CLAY_ROCKET_FUEL_INJECTOR"), "%TIER%",
- LoreBuilder.machine(MachineTier.ADVANCED, MachineType.MACHINE)
- .replaceAll("&", "§")),
- "%POWER%", LoreBuilder.powerBuffer(256).replaceAll("&", "§")));
- public static final ItemStack CLAY_SPACESUIT_OXYGEN_INJECTOR = Utils
- .setLore(
- Utils.newItemD(Material.LAPIS_BLOCK, Lang.readItemText("CLAY_SPACESUIT_OXYGEN_INJECTOR")), Utils
- .replaceList(
- Utils.replaceList(Lang.readItemLore("CLAY_SPACESUIT_OXYGEN_INJECTOR"), "%TIER%",
- LoreBuilder.machine(MachineTier.ADVANCED, MachineType.MACHINE)
- .replaceAll("&", "§")),
- "%POWER%", LoreBuilder.powerBuffer(256).replaceAll("&", "§")));
- public static final ItemStack CLAY_COBBLESTONE_GENERATOR = Utils
- .setLore(
- Utils.newItemD(Material.FURNACE, Lang.readItemText("CLAY_COBBLESTONE_GENERATOR")), Utils
- .replaceList(
- Utils.replaceList(Lang.readItemLore("CLAY_COBBLESTONE_GENERATOR"), "%TIER%",
- LoreBuilder.machine(MachineTier.ADVANCED, MachineType.MACHINE)
- .replaceAll("&", "§")),
- "%POWER%", LoreBuilder.powerBuffer(256).replaceAll("&", "§")));
- public static final ItemStack CLAY_ELECTRIC_WATER_PUMP = Utils
- .setLore(
- Utils.newItemD(Material.DISPENSER, Lang.readItemText("CLAY_ELECTRIC_WATER_PUMP")), Utils
- .replaceList(
- Utils.replaceList(Lang.readItemLore("CLAY_ELECTRIC_WATER_PUMP"), "%TIER%",
- LoreBuilder.machine(MachineTier.ADVANCED, MachineType.MACHINE)
- .replaceAll("&", "§")),
- "%POWER%", LoreBuilder.powerBuffer(256).replaceAll("&", "§")));
- public static ItemStack HONEY_SWEET = SlimefunPlugin.getMinecraftVersion()
- .isAtLeast(MinecraftVersion.MINECRAFT_1_15)
- ? Utils.setLore(Utils.newItemD(Material.HONEYCOMB, Lang.readItemText("HONEY_SWEET")),
- Lang.readItemLore("HONEY_SWEET"))
- : Utils.setLore(Utils.newItemD(Material.SUGAR, Lang.readItemText("HONEY_SWEET")),
- Lang.readItemLore("HONEY_SWEET"));
+ public static final ItemStack[] NORECIPE = {null, null, null, null, null, null, null, null, null};
+ // 注册
+ public static final ItemStack USEFUL_DIRT = Utils.setLore(
+ Utils.setDisplayName(new ItemStack(Material.DIRT), Lang.readItemText("USEFUL_DIRT")),
+ Lang.readItemLore("USEFUL_DIRT"));
+ public static final ItemStack ORE_DIAMOND = Utils.setDisplayName(new ItemStack(Material.DIAMOND),
+ Lang.readItemText("ORE_DIAMOND"));
+ public static final ItemStack MAGIC_CLAY = Utils.setLore(
+ Utils.newItemD(Material.CLAY_BALL, Lang.readItemText("MAGIC_CLAY")), Lang.readItemLore("MAGIC_CLAY"));
+ public static final ItemStack CLAY_STICK = Utils
+ .setLore(Utils.newItemD(Material.STICK, Lang.readItemText("CLAY_STICK")), Lang.readItemLore("CLAY_STICK"));
+ public static final ItemStack ARTIFICIAL_GOLD_NUGGET = Utils.newItemD(Material.GOLD_NUGGET,
+ Lang.readItemText("ARTIFICIAL_GOLD_NUGGET"));
+ public static final ItemStack ARTIFICIAL_GOLD_INGOT_O = Utils.newItemD(Material.COAL,
+ Lang.readItemText("ARTIFICIAL_GOLD_INGOT_O"));
+ public static final ItemStack ARTIFICIAL_GOLD_INGOT = Utils.newItemD(Material.GOLD_INGOT,
+ Lang.readItemText("ARTIFICIAL_GOLD_INGOT"));
+ public static final ItemStack ARTIFICIAL_GOLD_BLOCK = Utils.newItemD(Material.GOLD_BLOCK,
+ Lang.readItemText("ARTIFICIAL_GOLD_BLOCK"));
+ public static final ItemStack ARTIFICIAL_ENCHANTED_GOLDEN_APPLE = Utils.newItemD(Material.ENCHANTED_GOLDEN_APPLE,
+ Lang.readItemText("ARTIFICIAL_ENCHANTED_GOLDEN_APPLE"));
+ public static final ItemStack BLIND_CORE = Utils.newItemD(Material.COAL, Lang.readItemText("BLIND_CORE"));
+ public static final ItemStack BLIND_SWORD = Utils.setLore(
+ Utils.newItemD(Material.DIAMOND_SWORD, Lang.readItemText("BLIND_SWORD")), Lang.readItemLore("BLIND_SWORD"));
+ public static final ItemStack CONFUSION_CORE = Utils.newItemD(Material.WITHER_SKELETON_SKULL,
+ Lang.readItemText("CONFUSION_CORE"));
+ public static final ItemStack BLACK_ROCK_BLOCK = Utils.newItemD(Material.OBSIDIAN,
+ Lang.readItemText("BLACK_ROCK_BLOCK"));
+ public static final ItemStack SLOWNESS_CORE = Utils.newItemD(Material.OBSIDIAN, Lang.readItemText("SLOWNESS_CORE"));
+ public static final ItemStack POISON_EYE = Utils.newItemD(Material.SPIDER_EYE, Lang.readItemText("POISON_EYE"));
+ public static final ItemStack POISON_CORE = Utils.newItemD(Material.SPIDER_EYE, Lang.readItemText("POISON_CORE"));
+ public static final ItemStack ADVANCED_BLIND_CORE = Utils.newItemD(Material.COAL,
+ Lang.readItemText("ADVANCED_BLIND_CORE"));
+ public static final ItemStack ADVANCED_CONFUSION_CORE = Utils.newItemD(Material.WITHER_SKELETON_SKULL,
+ Lang.readItemText("ADVANCED_CONFUSION_CORE"));
+ public static final ItemStack ADVANCED_SLOWNESS_CORE = Utils.newItemD(Material.OBSIDIAN,
+ Lang.readItemText("ADVANCED_SLOWNESS_CORE"));
+ public static final ItemStack ADVANCED_POISON_CORE = Utils.newItemD(Material.SPIDER_EYE,
+ Lang.readItemText("ADVANCED_POISON_CORE"));
+ public static final ItemStack FOUR_BOW = Utils.setLore(Utils.newItemD(Material.BOW, Lang.readItemText("FOUR_BOW")),
+ Lang.readItemLore("FOUR_BOW"));
+ public static final ItemStack POISON_SWORD = Utils.setLore(
+ Utils.newItemD(Material.DIAMOND_SWORD, Lang.readItemText("POISON_SWORD")),
+ Lang.readItemLore("POISON_SWORD"));
+ public static final ItemStack ANTI_SLOWNESS_BOOTS = Utils.setLore(
+ Utils.newItemD(Material.IRON_BOOTS, Lang.readItemText("ANTI_SLOWNESS_BOOTS")),
+ Lang.readItemLore("ANTI_SLOWNESS_BOOTS"));
+ public static final ItemStack COCOA_BEAN = Utils.setLore(
+ Utils.newItemD(Material.COCOA_BEANS, Lang.readItemText("COCOA_BEAN")), Lang.readItemLore("COCOA_BEAN"));
+ public static final ItemStack PLASTIC = Utils.setLore(Utils.newItemD(
+ SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14) ? Material.WHITE_DYE
+ : Material.BONE_MEAL,
+ Lang.readItemText("PLASTIC")), Lang.readItemLore("PLASTIC"));
+ public static final ItemStack RAW_CHICKEN_FOOT = Utils.setLore(
+ Utils.newItemD(Material.RABBIT_FOOT, Lang.readItemText("RAW_CHICKEN_FOOT")),
+ Lang.readItemLore("RAW_CHICKEN_FOOT"));
+ public static final ItemStack CHICKEN_FOOT = Utils.setLore(
+ Utils.newItemD(Material.RABBIT_FOOT, Lang.readItemText("FRIED_CHICKEN_FOOT")),
+ Lang.readItemLore("FRIED_CHICKEN_FOOT"));
+ public static final ItemStack RAW_BREAD = Utils
+ .setLore(Utils.newItemD(Material.BREAD, Lang.readItemText("RAW_BREAD")), Lang.readItemLore("RAW_BREAD"));
+ public static final ItemStack DIRTY_TEA = Utils
+ .setLore(Utils.newItemD(Material.KELP, Lang.readItemText("DIRTY_TEA")), Lang.readItemLore("DIRTY_TEA"));
+ public static final ItemStack RAW_TEA = Utils.setLore(Utils.newItemD(Material.KELP, Lang.readItemText("TEA")),
+ Lang.readItemLore("TEA"));
+ public static final ItemStack TEA_POWDER = Utils.setLore(Utils.newItemD(
+ SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14) ? Material.BROWN_DYE
+ : Material.BONE_MEAL,
+ Lang.readItemText("TEA_POWDER")), Lang.readItemLore("TEA_POWDER"));
+ public static final ItemStack LEMON_POWDER = Utils
+ .setLore(
+ Utils.newItemD(SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)
+ ? Material.YELLOW_DYE
+ : Material.BONE_MEAL, Lang.readItemText("LEMON_POWDER")),
+ Lang.readItemLore("LEMON_POWDER"));
+ public static final ItemStack FLOUR = Utils.setLore(Utils.newItemD(Material.SUGAR, Lang.readItemText("FLOUR")),
+ Lang.readItemLore("FLOUR"));
+ public static final ItemStack STARCH = Utils.setLore(Utils.newItemD(Material.SUGAR, Lang.readItemText("STARCH")),
+ Lang.readItemLore("STARCH"));
+ public static final ItemStack SNAIL_HEALTHY = Utils.setLore(
+ Utils.newItemD(Material.NAUTILUS_SHELL, Lang.readItemText("SNAIL_HEALTHY")),
+ Lang.readItemLore("SNAIL_HEALTHY"));
+ public static final ItemStack SNAIL_BAD = Utils.setLore(
+ Utils.newItemD(Material.NAUTILUS_SHELL, Lang.readItemText("SNAIL_BAD")), Lang.readItemLore("SNAIL_BAD"));
+ public static final ItemStack HIGHSPEED_RAILWAY = Utils.setLore(
+ Utils.newItemD(Material.POWERED_RAIL, Lang.readItemText("HIGHSPEED_RAILWAY")),
+ Lang.readItemLore("HIGHSPEED_RAILWAY"));
+ public static final ItemStack ELECTRIC_MOTOR_8 = Utils.newItemD(Material.FEATHER,
+ Lang.readItemText("ELECTRIC_MOTOR_8"));
+ public static final ItemStack ELEMENT_UNIT = Utils.setLore(
+ Utils.newItemD(Material.FLOWER_POT, Lang.readItemText("ELEMENT_UNIT")), Lang.readItemLore("ELEMENT_UNIT"));
+ public static final ItemStack ELEMENT_OXYGEN = Utils.setLore(
+ Utils.newItemD(Material.FLOWER_POT, Lang.readItemText("ELEMENT_OXYGEN")),
+ Lang.readItemLore("ELEMENT_OXYGEN"));
+ public static final ItemStack ELEMENT_CARBON = Utils.setLore(
+ Utils.newItemD(Material.FLOWER_POT, Lang.readItemText("ELEMENT_CARBON")),
+ Lang.readItemLore("ELEMENT_CARBON"));
+ public static final ItemStack ELEMENT_SILICON = Utils.setLore(
+ Utils.newItemD(Material.FLOWER_POT, Lang.readItemText("ELEMENT_SILICON")),
+ Lang.readItemLore("ELEMENT_SILICON"));
+ public static final ItemStack BLISTERING_CORE = Utils.newItemD(Material.GOLD_INGOT,
+ Lang.readItemText("BLISTERING_CORE"));
+ public static final ItemStack TNT_EXPLOSION_CREATER = Utils.setLore(
+ Utils.newItemD(Material.GOLDEN_HOE, Lang.readItemText("TNT_EXPLOSION_CREATER")),
+ Lang.readItemLore("TNT_EXPLOSION_CREATER"));
+ public static final ItemStack CLAY_SWEET_POTATO = Utils.setLore(
+ Utils.newItemD(Material.BEETROOT, Lang.readItemText("SWEET_POTATO")), Lang.readItemLore("SWEET_POTATO"));
+ public static final ItemStack COOKED_SWEET_POTATO = Utils.setLore(
+ Utils.newItemD(Material.BEETROOT, Lang.readItemText("COOKED_SWEET_POTATO")),
+ Lang.readItemLore("COOKED_SWEET_POTATO"));
+ public static final ItemStack REINFORCED_ALLOY_PICKAXE = Utils.addEnchantH(
+ Utils.addEnchantH(Utils.newItemD(Material.IRON_PICKAXE, Lang.readItemText("REINFORCED_ALLOY_PICKAXE")),
+ Enchantment.DIG_SPEED, 9),
+ Enchantment.DURABILITY, 9);
+ public static final ItemStack CLAY_FUSION_INGOT = Utils.newItemD(Material.IRON_INGOT,
+ Lang.readItemText("CLAY_FUSION_INGOT"));
+ public static final ItemStack CLAY_ALLOY_INGOT = Utils.newItemD(Material.IRON_INGOT,
+ Lang.readItemText("CLAY_ALLOY_INGOT"));
+ public static final ItemStack CLAY_ALLOY_PICKAXE = Utils.addEnchantH(Utils.addEnchantH(
+ Utils.addEnchantH(Utils.newItemD(Material.IRON_PICKAXE, Lang.readItemText("CLAY_ALLOY_PICKAXE")),
+ Enchantment.DIG_SPEED, 10),
+ Enchantment.DURABILITY, 10), Enchantment.MENDING, 1);
+ public static final ItemStack CLAY_ALLOY_HELMET = Utils.addEnchantH(
+ Utils.addEnchantH(
+ Utils.addEnchantH(Utils.newItemD(Material.IRON_HELMET, Lang.readItemText("CLAY_ALLOY_HELMET")),
+ Enchantment.PROTECTION_ENVIRONMENTAL, 10),
+ Enchantment.DURABILITY, 10),
+ Enchantment.MENDING, 1);
+ public static final ItemStack CLAY_ALLOY_CHESTPLATE = Utils
+ .addEnchantH(
+ Utils.addEnchantH(Utils.addEnchantH(
+ Utils.newItemD(Material.IRON_CHESTPLATE, Lang.readItemText("CLAY_ALLOY_CHESTPLATE")),
+ Enchantment.PROTECTION_ENVIRONMENTAL, 10), Enchantment.DURABILITY, 10),
+ Enchantment.MENDING, 1);
+ public static final ItemStack CLAY_ALLOY_LEGGINGS = Utils.addEnchantH(
+ Utils.addEnchantH(
+ Utils.addEnchantH(Utils.newItemD(Material.IRON_LEGGINGS, Lang.readItemText("CLAY_ALLOY_LEGGINGS")),
+ Enchantment.PROTECTION_ENVIRONMENTAL, 10),
+ Enchantment.DURABILITY, 10),
+ Enchantment.MENDING, 1);
+ public static final ItemStack CLAY_ALLOY_BOOTS = Utils.addEnchantH(
+ Utils.addEnchantH(
+ Utils.addEnchantH(Utils.newItemD(Material.IRON_BOOTS, Lang.readItemText("CLAY_ALLOY_BOOTS")),
+ Enchantment.PROTECTION_ENVIRONMENTAL, 10),
+ Enchantment.DURABILITY, 10),
+ Enchantment.MENDING, 1);
+ public static final ItemStack SILICON_INGOT = Utils.newItemD(Material.IRON_INGOT,
+ Lang.readItemText("SILICON_INGOT"));
+ public static final ItemStack ROCKET_LAUNCHER = Utils.newItemD(Material.IRON_BLOCK,
+ Lang.readItemText("ROCKET_LAUNCHER"));
+ public static final ItemStack MOTOR_CORE = Utils.newItemD(Material.NETHER_STAR, Lang.readItemText("MOTOR_CORE"));
+ public static final ItemStack TEMPERATURE_RESISTANCE_OBSIDIAN = Utils.setLore(
+ Utils.newItemD(Material.OBSIDIAN, Lang.readItemText("TEMPERATURE_RESISTANCE_OBSIDIAN")),
+ Lang.readItemLore("TEMPERATURE_RESISTANCE_OBSIDIAN"));
+ public static final ItemStack ROCKET_ENGINE_SHELL = Utils.newItemD(Material.IRON_INGOT,
+ Lang.readItemText("ROCKET_ENGINE_SHELL"));
+ public static final ItemStack ROCKET_ANTENNA = Utils.setLore(
+ Utils.newItemD(Material.REDSTONE_TORCH, Lang.readItemText("ROCKET_ANTENNA")),
+ Lang.readItemLore("ROCKET_ANTENNA"));
+ public static final ItemStack ROCKET_CPU = Utils.setLore(
+ Utils.newItemD(Material.NETHER_STAR, Lang.readItemText("ROCKET_CPU")), Lang.readItemLore("ROCKET_CPU"));
+ public static final ItemStack ROCKET_CONTROL_CORE = Utils.setLore(
+ Utils.newItemD(Material.FIREWORK_STAR, Lang.readItemText("ROCKET_CONTROL_CORE")),
+ Lang.readItemLore("ROCKET_CONTROL_CORE"));
+ public static final ItemStack ROCKET_GLASS = Utils.setLore(
+ Utils.newItemD(Material.LIME_STAINED_GLASS_PANE, Lang.readItemText("ROCKET_GLASS")),
+ Lang.readItemLore("ROCKET_GLASS"));
+ public static final ItemStack ROCKET_STEEL_PLATE = Utils.setLore(
+ Utils.newItemD(Material.PAPER, Lang.readItemText("ROCKET_STEEL_PLATE")),
+ Lang.readItemLore("ROCKET_STEEL_PLATE"));
+ public static final ItemStack SPACESUIT_HELMET = Utils.setLore(
+ Utils.newItemD(Material.DIAMOND_HELMET, Lang.readItemText("SPACESUIT_HELMET")),
+ Lang.readItemLore("SPACESUIT_HELMET"));
+ public static final ItemStack SPACESUIT_CHESTPLATE = Utils.setLore(
+ Utils.newItemD(Material.DIAMOND_CHESTPLATE, Lang.readItemText("SPACESUIT_CHESTPLATE")),
+ Lang.readItemLore("SPACESUIT_CHESTPLATE"));
+ public static final ItemStack SPACESUIT_LEGGINGS = Utils.setLore(
+ Utils.newItemD(Material.DIAMOND_LEGGINGS, Lang.readItemText("SPACESUIT_LEGGINGS")),
+ Lang.readItemLore("SPACESUIT_LEGGINGS"));
+ public static final ItemStack SPACESUIT_BOOTS = Utils.setLore(
+ Utils.newItemD(Material.DIAMOND_BOOTS, Lang.readItemText("SPACESUIT_BOOTS")),
+ Lang.readItemLore("SPACESUIT_BOOTS"));
+ public static final ItemStack KREEP_ROCK = Utils.setLore(
+ Utils.newItemD(Material.GRANITE, Lang.readItemText("KREEP_ROCK")), Lang.readItemLore("KREEP_ROCK"));
+ public static final ItemStack KREEP_INGOT = Utils.setLore(
+ Utils.newItemD(Material.IRON_INGOT, Lang.readItemText("KREEP_INGOT")), Lang.readItemLore("KREEP_INGOT"));
+ public static final ItemStack PLANET_BASE_SIGNER = Utils.setLore(
+ Utils.newItemD(Material.OBSIDIAN, Lang.readItemText("PLANET_BASE_SIGNER")),
+ Lang.readItemLore("PLANET_BASE_SIGNER"));
+ public static final ItemStack TUBE = Utils.newItemD(Material.BONE, Lang.readItemText("TUBE"));
+ public static final ItemStack OXYGEN_DISTRIBUTER = Utils.setLore(
+ Utils.newItemD(Material.FIREWORK_STAR, Lang.readItemText("OXYGEN_DISTRIBUTER")),
+ Lang.readItemLore("OXYGEN_DISTRIBUTER"));
+ public static final ItemStack COPPER_ORE = Utils.setLore(
+ Utils.newItemD(Material.GOLD_BLOCK, Lang.readItemText("COPPER_ORE")), Lang.readItemLore("COPPER_ORE"));
+ public static final ItemStack CLAY_FUSION_ORE = Utils.setLore(
+ Utils.newItemD(Material.IRON_BLOCK, Lang.readItemText("CLAY_FUSION_ORE")),
+ Lang.readItemLore("CLAY_FUSION_ORE"));
+ public static final ItemStack TUNA_FISH = Utils.setLore(
+ Utils.newItemD(Material.TROPICAL_FISH, Lang.readItemText("TUNA_FISH")), Lang.readItemLore("TUNA_FISH"));
+ public static final ItemStack GREEN_GRASS = Utils.setLore(
+ Utils.newItemD(Material.GRASS, Lang.readItemText("GREEN_GRASS")), Lang.readItemLore("GREEN_GRASS"));
+ public static final ItemStack CLAY_FUEL = Utils.setDisplayName(
+ SkullItem.fromHash("3ce2dad9baf7eaba7e80d4d0f9fac0aab01a76b12fb71c3d2af2a16fdd4c7383"),
+ Lang.readItemText("CLAY_FUEL"));
+ public static final ItemStack MIXED_ROCKET_FUEL = Utils.setLore(
+ Utils.setDisplayName(SkullItem.fromHash("3ce2dad9baf7eaba7e80d4d0f9fac0aab01a76b12fb71c3d2af2a16fdd4c7383"),
+ Lang.readItemText("MIXED_ROCKET_FUEL")),
+ Lang.readItemLore("MIXED_ROCKET_FUEL"));
+ // 头颅
+ public static final ItemStack CLAYCOFFEE_HEAD = Utils.setDisplayName(SkullItem.fromURL(
+ "http://textures.minecraft.net/texture/58c55ba01ccc7e79b5495e5c4e00080ff6c92a832b2905fed724f2f68a3bb94c"),
+ Lang.readItemText("AUTHOR_HEAD"));
+ public static final ItemStack STALIN_HEAD = Utils.setDisplayName(SkullItem.fromURL(
+ "http://textures.minecraft.net/texture/96fb8390f61a2cc51c08201834369829d9ba301effc01b6a7cb10d830c6c5043"),
+ Lang.readItemText("STALIN_HEAD"));
+ public static final ItemStack MARX_HEAD = Utils.setDisplayName(SkullItem.fromURL(
+ "http://textures.minecraft.net/texture/57304952eff15a9fb81fa070fa549f85243c790f8fa61bf6e196a7516ce85a48"),
+ Lang.readItemText("MARX_HEAD"));
+ public static final ItemStack LANTERN_C = Utils.setDisplayName(SkullItem.fromURL(
+ "http://textures.minecraft.net/texture/7cc217a9b9e3ce3cd0484c7e8ce49d1cf741281bdda5a4d6cb821f378752718"),
+ Lang.readItemText("LANTERN"));
+ public static final ItemStack CLOCK_C = Utils.setDisplayName(SkullItem.fromURL(
+ "http://textures.minecraft.net/texture/ba10da526e5111cfb6e3ebd47693e162dd52d41a2182028daa7c2b19aa3143"),
+ Lang.readItemText("BLACK_CLOCK"));
+ public static final ItemStack CLAY_COFFEE = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
+ "http://textures.minecraft.net/texture/411511bdd55bcb82803c8039f1c155fd43062636e23d4d46c4d761c04d22c2"),
+ Lang.readItemText("CLAY_COFFEE")), Lang.readItemLore("CLAY_COFFEE"));
+ public static final ItemStack DRINK_BOTTLE = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
+ "http://textures.minecraft.net/texture/9179ce4849723434e84747ec85fbbfb1121456c8aeb2e9171fb8328921d45"),
+ Lang.readItemText("DRINK_BOTTLE")), Lang.readItemLore("DRINK_BOTTLE"));
+ public static final ItemStack DIRTY_DRINK_BOTTLE = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
+ "http://textures.minecraft.net/texture/9179ce4849723434e84747ec85fbbfb1121456c8aeb2e9171fb8328921d45"),
+ Lang.readItemText("DIRTY_DRINK_BOTTLE")), Lang.readItemLore("DIRTY_DRINK_BOTTLE"));
+ public static final ItemStack SPICY_CHICKEN_BURGER = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
+ "http://textures.minecraft.net/texture/c5e27988a6538010efc0e24756bc3e3eea24d7536b20932c17e0404e5cc55f"),
+ Lang.readItemText("SPICY_CHICKEN_BURGER")), Lang.readItemLore("SPICY_CHICKEN_BURGER"));
+ public static final ItemStack BABA_BURGER = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
+ "http://textures.minecraft.net/texture/c5e27988a6538010efc0e24756bc3e3eea24d7536b20932c17e0404e5cc55f"),
+ Lang.readItemText("BABA_BURGER")), Lang.readItemLore("BABA_BURGER"));
+ public static final ItemStack RAW_VEGETABLE = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
+ "http://textures.minecraft.net/texture/477dd842c975d8fb03b1add66db8377a18ba987052161f22591e6a4ede7f5"),
+ Lang.readItemText("LETTUSE")), Lang.readItemLore("LETTUSE"));
+ public static final ItemStack CLAY_LEMON = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
+ "http://textures.minecraft.net/texture/957fd56ca15978779324df519354b6639a8d9bc1192c7c3de925a329baef6c"),
+ Lang.readItemText("LEMON")), Lang.readItemLore("LEMON"));
+ public static final ItemStack LEMON_POWDER_DRINK = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
+ "http://textures.minecraft.net/texture/d8e94ddd769a5bea748376b4ec7383fd36d267894d7c3bee011e8e4f5fcd7"),
+ Lang.readItemText("LEMON_POWDER_DRINK")), Lang.readItemLore("LEMON_POWDER_DRINK"));
+ public static final ItemStack TEA_DRINK = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
+ "http://textures.minecraft.net/texture/d8e94ddd769a5bea748376b4ec7383fd36d267894d7c3bee011e8e4f5fcd7"),
+ Lang.readItemText("TEA_DRINK")), Lang.readItemLore("TEA_DRINK"));
+ public static final ItemStack LEMON_TEA_DRINK = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
+ "http://textures.minecraft.net/texture/d8e94ddd769a5bea748376b4ec7383fd36d267894d7c3bee011e8e4f5fcd7"),
+ Lang.readItemText("LEMON_TEA_DRINK")), Lang.readItemLore("LEMON_TEA_DRINK"));
+ public static final ItemStack CHOCOLATE = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
+ "http://textures.minecraft.net/texture/819f948d17718adace5dd6e050c586229653fef645d7113ab94d17b639cc466"),
+ Lang.readItemText("CHOCOLATE")), Lang.readItemLore("CHOCOLATE"));
+ public static final ItemStack SNAIL_FOOD = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
+ "http://textures.minecraft.net/texture/26834b5b25426de63538ec82ca8fbecfcbb3e682d8063643d2e67a7621bd"),
+ Lang.readItemText("LUOSI_RICE_NOODLE")), Lang.readItemLore("LUOSI_RICE_NOODLE"));
+ public static final ItemStack ROCKET = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
+ "http://textures.minecraft.net/texture/25b3f2cfa0739c4e828316f39f90b05bc1f4ed27b1e35888511f558d4675"),
+ Lang.readItemText("ROCKET")), Lang.readItemLore("ROCKET"));
+ public static final ItemStack FUEL_TANK = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
+ "http://textures.minecraft.net/texture/5175bdf47aea1a4bf1d349be6b7fa4ab37f479672f4c43aca57511b427ab4"),
+ Lang.readItemText("FUEL_TANK")), Lang.readItemLore("FUEL_TANK"));
+ public static final ItemStack ROCKET_ENGINE = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
+ "http://textures.minecraft.net/texture/5175bdf47aea1a4bf1d349be6b7fa4ab37f479672f4c43aca57511b427ab4"),
+ Lang.readItemText("ROCKET_ENGINE")), Lang.readItemLore("ROCKET_ENGINE"));
+ ;
+ public static final ItemStack ROCKET_FUEL_TANK = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
+ "http://textures.minecraft.net/texture/5175bdf47aea1a4bf1d349be6b7fa4ab37f479672f4c43aca57511b427ab4"),
+ Lang.readItemText("ROCKET_FUEL_TANK")), Lang.readItemLore("ROCKET_FUEL_TANK"));
+ public static final ItemStack OXYGEN_TANK = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
+ "http://textures.minecraft.net/texture/52baeb4a35da8a85d14bdccf7184f5545088f954da55144f235c2983fdb8e05b"),
+ Lang.readItemText("OXYGEN_TANK")), Lang.readItemLore("OXYGEN_TANK"));
+ public static final ItemStack SPACESUIT_OXYGEN_TANK = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
+ "http://textures.minecraft.net/texture/52baeb4a35da8a85d14bdccf7184f5545088f954da55144f235c2983fdb8e05b"),
+ Lang.readItemText("SPACESUIT_OXYGEN_TANK")), Lang.readItemLore("SPACESUIT_OXYGEN_TANK"));
+ // 机器
+ public static final ItemStack CLAY_CRAFTING_TABLE = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
+ "http://textures.minecraft.net/texture/6d6c65b44c34b1acc2ccb346752397125f0d9ffa0ab3c50a99d1db3b74c63"),
+ Lang.readItemText("CLAY_FUSION_MACHINE")),
+ Utils.replaceList(
+ Utils.replaceList(Lang.readItemLore("CLAY_FUSION_MACHINE"), "%TIER%",
+ LoreBuilder.machine(MachineTier.BASIC, MachineType.MACHINE).replaceAll("&", "§")),
+ "%POWER%", LoreBuilder.powerBuffer(128).replaceAll("&", "§")));
+ public static final ItemStack CLAY_ELECTRIC_STONE_CRUSHER = Utils
+ .setLore(
+ Utils.newItemD(Material.RED_STAINED_GLASS, Lang.readItemText("CLAY_ELECTRIC_STONE_CRUSHER")), Utils
+ .replaceList(
+ Utils.replaceList(Lang.readItemLore("CLAY_ELECTRIC_STONE_CRUSHER"), "%TIER%",
+ LoreBuilder.machine(MachineTier.BASIC, MachineType.MACHINE).replaceAll("&",
+ "§")),
+ "%POWER%", LoreBuilder.powerBuffer(128).replaceAll("&", "§")));
+ public static final ItemStack CLAY_FOOD_CAULDRON = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
+ "http://textures.minecraft.net/texture/dfd9b2f42d5f1c2a77b511fe41a4c6b5c192fb10b2ceadde05bd1af52a151"),
+ Lang.readItemText("CLAY_ELETRIC_CAULDRON")),
+ Utils.replaceList(
+ Utils.replaceList(Lang.readItemLore("CLAY_ELETRIC_CAULDRON"), "%TIER%",
+ LoreBuilder.machine(MachineTier.AVERAGE, MachineType.MACHINE).replaceAll("&", "§")),
+ "%POWER%", LoreBuilder.powerBuffer(512).replaceAll("&", "§")));
+ public static final ItemStack CLAY_FOOD_CHALKING_MACHINE = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
+ "http://textures.minecraft.net/texture/98636123b1a3755abd8aef6d85b2a85bf10f486edefdd1a3cef7679d825"),
+ Lang.readItemText("CLAY_FOOD_CHALKING_MACHINE")),
+ Utils.replaceList(
+ Utils.replaceList(Lang.readItemLore("CLAY_FOOD_CHALKING_MACHINE"), "%TIER%",
+ LoreBuilder.machine(MachineTier.AVERAGE, MachineType.MACHINE).replaceAll("&", "§")),
+ "%POWER%", LoreBuilder.powerBuffer(512).replaceAll("&", "§")));
+ public static final ItemStack CLAY_ELEMENT_EXTRACTER = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
+ "http://textures.minecraft.net/texture/c74170c66bf3140f234b322add724c5df6949a9209f807ebf86d4f9c8c1e178"),
+ Lang.readItemText("CLAY_ELEMENT_EXTRACTER")),
+ Utils.replaceList(
+ Utils.replaceList(Lang.readItemLore("CLAY_ELEMENT_EXTRACTER"), "%TIER%",
+ LoreBuilder.machine(MachineTier.ADVANCED, MachineType.MACHINE).replaceAll("&", "§")),
+ "%POWER%", LoreBuilder.powerBuffer(1024).replaceAll("&", "§")));
+ public static final ItemStack CLAY_EXPERIMENT_TABLE_NORMAL = Utils.setLore(Utils.setDisplayName(SkullItem.fromURL(
+ "http://textures.minecraft.net/texture/52baeb4a35da8a85d14bdccf7184f5545088f954da55144f235c2983fdb8e05b"),
+ Lang.readItemText("CLAY_EXPERIMENT_TABLE_NORMAL")),
+ Utils.replaceList(
+ Utils.replaceList(Lang.readItemLore("CLAY_EXPERIMENT_TABLE_NORMAL"), "%TIER%",
+ LoreBuilder.machine(MachineTier.ADVANCED, MachineType.MACHINE).replaceAll("&", "§")),
+ "%POWER%", LoreBuilder.powerBuffer(1024).replaceAll("&", "§")));
+ public static final ItemStack CLAY_ROCKET_ASSEMBLING_MACHINE = Utils
+ .setLore(
+ Utils.newItemD(Material.GOLD_BLOCK, Lang.readItemText("CLAY_ROCKET_ASSEMBLING_MACHINE")), Utils
+ .replaceList(
+ Utils.replaceList(Lang.readItemLore("CLAY_ROCKET_ASSEMBLING_MACHINE"), "%TIER%",
+ LoreBuilder.machine(MachineTier.ADVANCED, MachineType.MACHINE)
+ .replaceAll("&", "§")),
+ "%POWER%", LoreBuilder.powerBuffer(512).replaceAll("&", "§")));
+ public static final ItemStack CLAY_ROCKET_FUEL_GENERATOR = Utils
+ .setLore(
+ Utils.newItemD(Material.EMERALD_BLOCK, Lang.readItemText("CLAY_ROCKET_FUEL_GENERATOR")), Utils
+ .replaceList(
+ Utils.replaceList(Lang.readItemLore("CLAY_ROCKET_FUEL_GENERATOR"), "%TIER%",
+ LoreBuilder.machine(MachineTier.ADVANCED, MachineType.MACHINE)
+ .replaceAll("&", "§")),
+ "%POWER%", LoreBuilder.powerBuffer(256).replaceAll("&", "§")));
+ public static final ItemStack CLAY_ROCKET_FUEL_INJECTOR = Utils
+ .setLore(
+ Utils.newItemD(Material.DIAMOND_BLOCK, Lang.readItemText("CLAY_ROCKET_FUEL_INJECTOR")), Utils
+ .replaceList(
+ Utils.replaceList(Lang.readItemLore("CLAY_ROCKET_FUEL_INJECTOR"), "%TIER%",
+ LoreBuilder.machine(MachineTier.ADVANCED, MachineType.MACHINE)
+ .replaceAll("&", "§")),
+ "%POWER%", LoreBuilder.powerBuffer(256).replaceAll("&", "§")));
+ public static final ItemStack CLAY_SPACESUIT_OXYGEN_INJECTOR = Utils
+ .setLore(
+ Utils.newItemD(Material.LAPIS_BLOCK, Lang.readItemText("CLAY_SPACESUIT_OXYGEN_INJECTOR")), Utils
+ .replaceList(
+ Utils.replaceList(Lang.readItemLore("CLAY_SPACESUIT_OXYGEN_INJECTOR"), "%TIER%",
+ LoreBuilder.machine(MachineTier.ADVANCED, MachineType.MACHINE)
+ .replaceAll("&", "§")),
+ "%POWER%", LoreBuilder.powerBuffer(256).replaceAll("&", "§")));
+ public static final ItemStack CLAY_COBBLESTONE_GENERATOR = Utils
+ .setLore(
+ Utils.newItemD(Material.FURNACE, Lang.readItemText("CLAY_COBBLESTONE_GENERATOR")), Utils
+ .replaceList(
+ Utils.replaceList(Lang.readItemLore("CLAY_COBBLESTONE_GENERATOR"), "%TIER%",
+ LoreBuilder.machine(MachineTier.ADVANCED, MachineType.MACHINE)
+ .replaceAll("&", "§")),
+ "%POWER%", LoreBuilder.powerBuffer(256).replaceAll("&", "§")));
+ public static final ItemStack CLAY_ELECTRIC_WATER_PUMP = Utils
+ .setLore(
+ Utils.newItemD(Material.DISPENSER, Lang.readItemText("CLAY_ELECTRIC_WATER_PUMP")), Utils
+ .replaceList(
+ Utils.replaceList(Lang.readItemLore("CLAY_ELECTRIC_WATER_PUMP"), "%TIER%",
+ LoreBuilder.machine(MachineTier.ADVANCED, MachineType.MACHINE)
+ .replaceAll("&", "§")),
+ "%POWER%", LoreBuilder.powerBuffer(256).replaceAll("&", "§")));
+ private static final NamespacedKey N_BASIC = new NamespacedKey(ClayTech.plugin, "claycategory");
+ // 分类
+ public static final LockedCategory C_BASICS = new LockedCategory(N_BASIC,
+ Utils.newItemD(Material.CLAY, Lang.readCategoriesText("Basic")),
+ new NamespacedKey(SlimefunPlugin.instance(), "basic_machines"));
+ public static final LockedCategory C_WEAPONS = new LockedCategory(
+ new NamespacedKey(ClayTech.plugin, "claycategory1"),
+ Utils.newItemD(Material.DIAMOND_SWORD, Lang.readCategoriesText("Weapons")), N_BASIC);
+ public static final LockedCategory C_FOOD = new LockedCategory(new NamespacedKey(ClayTech.plugin, "claycategory"),
+ Utils.newItemD(Material.ENCHANTED_GOLDEN_APPLE, Lang.readCategoriesText("Food")), N_BASIC);
+ public static final LockedCategory C_FOODMATERIALS = new LockedCategory(
+ new NamespacedKey(ClayTech.plugin, "claycategory2"),
+ Utils.newItemD(Material.COCOA_BEANS, Lang.readCategoriesText("FoodMakings")), N_BASIC);
+ public static final LockedCategory C_DRINK = new LockedCategory(new NamespacedKey(ClayTech.plugin, "claycategory"),
+ Utils.newItemD(Material.WATER_BUCKET, Lang.readCategoriesText("Drink")), N_BASIC);
+ public static final LockedCategory C_MATERIALS = new LockedCategory(
+ new NamespacedKey(ClayTech.plugin, "claycategory3"),
+ Utils.newItemD(Material.COAL, Lang.readCategoriesText("Makings")), N_BASIC);
+ public static final LockedCategory C_ARMORS = new LockedCategory(new NamespacedKey(ClayTech.plugin, "claycategory"),
+ Utils.newItemD(Material.DIAMOND_CHESTPLATE, Lang.readCategoriesText("Armors")), N_BASIC);
+ public static final LockedCategory C_DECORATES = new LockedCategory(
+ new NamespacedKey(ClayTech.plugin, "claycategory4"),
+ Utils.newItemD(Material.PLAYER_HEAD, Lang.readCategoriesText("Decorates")), N_BASIC);
+ public static final LockedCategory C_ELEMENTS = new LockedCategory(
+ new NamespacedKey(ClayTech.plugin, "claycategory5"),
+ Utils.newItemD(Material.FLOWER_POT, Lang.readCategoriesText("Elements")), N_BASIC);
+ public static final LockedCategory C_MACHINES = new LockedCategory(
+ new NamespacedKey(ClayTech.plugin, "claycategory6"),
+ Utils.newItemD(Material.FURNACE, Lang.readCategoriesText("Machines")), N_BASIC);
+ public static final LockedCategory C_OTHER = new LockedCategory(new NamespacedKey(ClayTech.plugin, "claycategory7"),
+ Utils.newItemD(Material.POWERED_RAIL, Lang.readCategoriesText("Other")), N_BASIC);
+ public static final LockedCategory C_TOOLS = new LockedCategory(new NamespacedKey(ClayTech.plugin, "claycategory8"),
+ Utils.newItemD(Material.DIAMOND_PICKAXE, Lang.readCategoriesText("Tools")), N_BASIC);
+ public static final LockedCategory C_ORESTHINGS = new LockedCategory(
+ new NamespacedKey(ClayTech.plugin, "claycategory9"),
+ Utils.newItemD(Material.BRICK, Lang.readCategoriesText("OreThings")), N_BASIC);
+ public static ItemStack HONEY_SWEET = SlimefunPlugin.getMinecraftVersion()
+ .isAtLeast(MinecraftVersion.MINECRAFT_1_15)
+ ? Utils.setLore(Utils.newItemD(Material.HONEYCOMB, Lang.readItemText("HONEY_SWEET")),
+ Lang.readItemLore("HONEY_SWEET"))
+ : Utils.setLore(Utils.newItemD(Material.SUGAR, Lang.readItemText("HONEY_SWEET")),
+ Lang.readItemLore("HONEY_SWEET"));
}
diff --git a/src/main/java/club/claycoffee/ClayTech/ClayTechMachineRecipes.java b/src/main/java/club/claycoffee/ClayTech/ClayTechMachineRecipes.java
index 4043fd7..0249bc1 100644
--- a/src/main/java/club/claycoffee/ClayTech/ClayTechMachineRecipes.java
+++ b/src/main/java/club/claycoffee/ClayTech/ClayTechMachineRecipes.java
@@ -1,258 +1,252 @@
package club.claycoffee.ClayTech;
-import org.bukkit.Material;
-import org.bukkit.inventory.ItemStack;
-
import club.claycoffee.ClayTech.utils.Slimefunutils;
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
+import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import org.bukkit.Material;
+import org.bukkit.inventory.ItemStack;
public class ClayTechMachineRecipes {
- static ItemStack newMotor;
- public final static ItemStack[] BLIND_CORE = { new ItemStack(Material.INK_SAC), new ItemStack(Material.END_CRYSTAL),
- new ItemStack(Material.INK_SAC), new ItemStack(Material.INK_SAC), ClayTechItems.MAGIC_CLAY,
- new ItemStack(Material.INK_SAC), new ItemStack(Material.INK_SAC), new ItemStack(Material.END_CRYSTAL),
- new ItemStack(Material.INK_SAC) };
- public final static ItemStack[] BLIND_SWORD = { ClayTechItems.BLIND_CORE, ClayTechItems.BLIND_CORE,
- ClayTechItems.BLIND_CORE, ClayTechItems.BLIND_CORE, new ItemStack(Material.DIAMOND_SWORD),
- ClayTechItems.BLIND_CORE, ClayTechItems.BLIND_CORE, ClayTechItems.BLIND_CORE, ClayTechItems.BLIND_CORE };
- public final static ItemStack[] POISON_EYE = { new ItemStack(Material.SPIDER_EYE),
- new ItemStack(Material.SPIDER_EYE), new ItemStack(Material.SPIDER_EYE), new ItemStack(Material.SPIDER_EYE),
- ClayTechItems.MAGIC_CLAY, new ItemStack(Material.SPIDER_EYE), new ItemStack(Material.SPIDER_EYE),
- new ItemStack(Material.SPIDER_EYE), new ItemStack(Material.SPIDER_EYE) };
- public final static ItemStack[] POISON_CORE = { new ItemStack(Material.COAL_BLOCK), ClayTechItems.POISON_EYE,
- new ItemStack(Material.COAL_BLOCK), new ItemStack(Material.FERMENTED_SPIDER_EYE),
- new ItemStack(Material.FERMENTED_SPIDER_EYE), new ItemStack(Material.FERMENTED_SPIDER_EYE),
- new ItemStack(Material.COAL_BLOCK), ClayTechItems.POISON_EYE, new ItemStack(Material.COAL_BLOCK) };
- public final static ItemStack[] CONFUSION_CORE = { new ItemStack(Material.PUFFERFISH),
- new ItemStack(Material.PUFFERFISH), new ItemStack(Material.PUFFERFISH), new ItemStack(Material.PUFFERFISH),
- ClayTechItems.MAGIC_CLAY, new ItemStack(Material.PUFFERFISH), new ItemStack(Material.PUFFERFISH),
- new ItemStack(Material.PUFFERFISH), new ItemStack(Material.PUFFERFISH) };
- public final static ItemStack[] BLACK_ROCK_BLOCK = { new ItemStack(Material.OBSIDIAN),
- new ItemStack(Material.OBSIDIAN), new ItemStack(Material.OBSIDIAN), new ItemStack(Material.OBSIDIAN),
- ClayTechItems.MAGIC_CLAY, new ItemStack(Material.OBSIDIAN), new ItemStack(Material.OBSIDIAN),
- new ItemStack(Material.OBSIDIAN), new ItemStack(Material.OBSIDIAN) };
- public final static ItemStack[] SLOWNESS_CORE = { ClayTechItems.BLACK_ROCK_BLOCK, ClayTechItems.BLACK_ROCK_BLOCK,
- ClayTechItems.BLACK_ROCK_BLOCK, ClayTechItems.BLACK_ROCK_BLOCK, ClayTechItems.MAGIC_CLAY,
- ClayTechItems.BLACK_ROCK_BLOCK, ClayTechItems.BLACK_ROCK_BLOCK, ClayTechItems.BLACK_ROCK_BLOCK,
- ClayTechItems.BLACK_ROCK_BLOCK };
- public final static ItemStack[] ADVANCED_CONFUSION_CORE = { ClayTechItems.CONFUSION_CORE,
- ClayTechItems.CONFUSION_CORE, ClayTechItems.CONFUSION_CORE, ClayTechItems.CONFUSION_CORE,
- ClayTechItems.MAGIC_CLAY, ClayTechItems.CONFUSION_CORE, ClayTechItems.CONFUSION_CORE,
- ClayTechItems.CONFUSION_CORE, ClayTechItems.CONFUSION_CORE };
- public final static ItemStack[] ADVANCED_POISON_CORE = { ClayTechItems.POISON_CORE, ClayTechItems.POISON_CORE,
- ClayTechItems.POISON_CORE, ClayTechItems.POISON_CORE, ClayTechItems.MAGIC_CLAY, ClayTechItems.POISON_CORE,
- ClayTechItems.POISON_CORE, ClayTechItems.POISON_CORE, ClayTechItems.POISON_CORE };
- public final static ItemStack[] ADVANCED_SLOWNESS_CORE = { ClayTechItems.SLOWNESS_CORE, ClayTechItems.SLOWNESS_CORE,
- ClayTechItems.SLOWNESS_CORE, ClayTechItems.SLOWNESS_CORE, ClayTechItems.MAGIC_CLAY,
- ClayTechItems.SLOWNESS_CORE, ClayTechItems.SLOWNESS_CORE, ClayTechItems.SLOWNESS_CORE,
- ClayTechItems.SLOWNESS_CORE };
- public final static ItemStack[] ADVANCED_BLIND_CORE = { ClayTechItems.BLIND_CORE, ClayTechItems.BLIND_CORE,
- ClayTechItems.BLIND_CORE, ClayTechItems.BLIND_CORE, ClayTechItems.MAGIC_CLAY, ClayTechItems.BLIND_CORE,
- ClayTechItems.BLIND_CORE, ClayTechItems.BLIND_CORE, ClayTechItems.BLIND_CORE };
- public final static ItemStack[] FOUR_BOW = { ClayTechItems.ADVANCED_SLOWNESS_CORE,
- ClayTechItems.ADVANCED_POISON_CORE, ClayTechItems.ADVANCED_BLIND_CORE,
- ClayTechItems.ADVANCED_CONFUSION_CORE, new ItemStack(Material.BOW), ClayTechItems.ADVANCED_CONFUSION_CORE,
- ClayTechItems.ADVANCED_BLIND_CORE, ClayTechItems.ADVANCED_POISON_CORE,
- ClayTechItems.ADVANCED_SLOWNESS_CORE };
- public final static ItemStack[] POISON_SWORD = { ClayTechItems.POISON_CORE, ClayTechItems.POISON_CORE,
- ClayTechItems.POISON_CORE, ClayTechItems.POISON_CORE, new ItemStack(Material.DIAMOND_SWORD),
- ClayTechItems.POISON_CORE, ClayTechItems.POISON_CORE, ClayTechItems.POISON_CORE,
- ClayTechItems.POISON_CORE };
- public final static ItemStack[] ANTI_SLOWNESS_BOOTS = { ClayTechItems.SLOWNESS_CORE, ClayTechItems.SLOWNESS_CORE,
- ClayTechItems.SLOWNESS_CORE, ClayTechItems.SLOWNESS_CORE, new ItemStack(Material.IRON_BOOTS),
- ClayTechItems.SLOWNESS_CORE, ClayTechItems.SLOWNESS_CORE, ClayTechItems.SLOWNESS_CORE,
- ClayTechItems.SLOWNESS_CORE };
- public final static ItemStack[] TNT_EXPLOSION_CREATER = { new ItemStack(Material.TNT), ClayTechItems.MAGIC_CLAY,
- new ItemStack(Material.TNT), ClayTechItems.MAGIC_CLAY, new ItemStack(Material.DIAMOND_HOE),
- ClayTechItems.MAGIC_CLAY, new ItemStack(Material.TNT), new ItemStack(Material.FLINT_AND_STEEL),
- new ItemStack(Material.TNT) };
-
- // 食物
- public final static ItemStack[] CHICKEN_FOOT = { null, new ItemStack(Material.COAL), null, null,
- ClayTechItems.RAW_CHICKEN_FOOT, null, null, new ItemStack(Material.COAL), null };
- public final static ItemStack[] SPICY_CHICKEN_BURGER = { ClayTechItems.RAW_BREAD, ClayTechItems.RAW_VEGETABLE,
- ClayTechItems.RAW_BREAD, ClayTechItems.RAW_VEGETABLE, ClayTechItems.CHICKEN_FOOT,
- ClayTechItems.RAW_VEGETABLE, ClayTechItems.RAW_BREAD, ClayTechItems.MAGIC_CLAY, ClayTechItems.RAW_BREAD };
- public final static ItemStack[] BABA_BURGER = { new ItemStack(Material.COAL), ClayTechItems.RAW_BREAD,
- new ItemStack(Material.COAL), new ItemStack(Material.COAL), new ItemStack(Material.COAL),
- new ItemStack(Material.COAL), new ItemStack(Material.COAL), ClayTechItems.RAW_BREAD,
- new ItemStack(Material.COAL) };
- public final static ItemStack[] CHOCOLATE = { ClayTechItems.COCOA_BEAN, ClayTechItems.COCOA_BEAN,
- ClayTechItems.COCOA_BEAN, ClayTechItems.COCOA_BEAN, ClayTechItems.STARCH, ClayTechItems.COCOA_BEAN,
- ClayTechItems.COCOA_BEAN, ClayTechItems.COCOA_BEAN, ClayTechItems.COCOA_BEAN };
- public final static ItemStack[] SNAIL_FOOD = { ClayTechItems.FLOUR, ClayTechItems.FLOUR, ClayTechItems.FLOUR,
- ClayTechItems.FLOUR, ClayTechItems.SNAIL_HEALTHY, ClayTechItems.FLOUR, ClayTechItems.FLOUR,
- ClayTechItems.FLOUR, ClayTechItems.FLOUR };
- public final static ItemStack[] CLAY_COFFEE = { null, ClayTechItems.COCOA_BEAN, null, null,
- ClayTechItems.COCOA_BEAN, null, null, ClayTechItems.DRINK_BOTTLE, null };
- public final static ItemStack[] LEMON_POWDER_DRINK = { null, ClayTechItems.LEMON_POWDER, null, null,
- ClayTechItems.LEMON_POWDER, null, null, ClayTechItems.DRINK_BOTTLE, null };
- public final static ItemStack[] TEA_DRINK = { null, ClayTechItems.TEA_POWDER, null, null, ClayTechItems.TEA_POWDER,
- null, null, ClayTechItems.DRINK_BOTTLE, null };
- public final static ItemStack[] LEMON_TEA_DRINK = { null, ClayTechItems.TEA_POWDER, null,
- ClayTechItems.LEMON_POWDER, ClayTechItems.TEA_POWDER, ClayTechItems.LEMON_POWDER, null,
- ClayTechItems.DRINK_BOTTLE, null };
- public final static ItemStack[] TEA_POWDER = { null, null, null, null, ClayTechItems.RAW_TEA, null, null, null,
- null };
- public final static ItemStack[] LEMON_POWDER = { null, null, null, null, ClayTechItems.CLAY_LEMON, null, null, null,
- null };
- public final static ItemStack[] COOKED_SWEET_POTATO = { null, new ItemStack(Material.COAL), null, null,
- ClayTechItems.CLAY_SWEET_POTATO, null, null, new ItemStack(Material.COAL), null };
-
- public static ItemStack[] HONEY_SWEET = SlimefunPlugin.getMinecraftVersion()
- .isAtLeast(MinecraftVersion.MINECRAFT_1_15)
- ? new ItemStack[] { new ItemStack(Material.SWEET_BERRIES), new ItemStack(Material.SWEET_BERRIES),
- new ItemStack(Material.SWEET_BERRIES), new ItemStack(Material.SUGAR),
- new ItemStack(Material.HONEY_BOTTLE), new ItemStack(Material.SUGAR),
- new ItemStack(Material.SUGAR), new ItemStack(Material.SUGAR),
- new ItemStack(Material.SUGAR) }
- : SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)
- ? new ItemStack[] { new ItemStack(Material.SWEET_BERRIES), new ItemStack(Material.SUGAR),
- new ItemStack(Material.SWEET_BERRIES), new ItemStack(Material.SUGAR),
- new ItemStack(Material.GOLD_INGOT), new ItemStack(Material.SUGAR),
- new ItemStack(Material.SUGAR), new ItemStack(Material.SUGAR),
- new ItemStack(Material.SUGAR) }
- : new ItemStack[] { new ItemStack(Material.SUGAR), new ItemStack(Material.SUGAR),
- new ItemStack(Material.SUGAR), new ItemStack(Material.SUGAR),
- new ItemStack(Material.GOLD_INGOT), new ItemStack(Material.SUGAR),
- new ItemStack(Material.SUGAR), new ItemStack(Material.SUGAR),
- new ItemStack(Material.SUGAR) };
-
- public final static ItemStack[] ELEMENT_CARBON = { null, null, null, null, new ItemStack(Material.COAL, 8), null,
- null, null, null };
- public final static ItemStack[] ELEMENT_OXYGEN = { null, null, null, null, new ItemStack(Material.GRASS_BLOCK, 3),
- null, null, null, null };
- public final static ItemStack[] ELEMENT_SILICON = { null, null, null, null, new ItemStack(Material.SAND, 10), null,
- null, null, null };
- public final static ItemStack[] BLISTERING_CORE = { null, ClayTechItems.CLAY_FUSION_INGOT, null, null,
- SlimefunItems.BLISTERING_INGOT_3, null, null, ClayTechItems.CLAY_FUSION_INGOT, null };
- public final static ItemStack[] ELEMENT_UNIT = { SlimefunItems.DAMASCUS_STEEL_INGOT,
- SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.DAMASCUS_STEEL_INGOT,
- null, SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.DAMASCUS_STEEL_INGOT,
- SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.DAMASCUS_STEEL_INGOT };
- static {
- newMotor = ClayTechItems.ELECTRIC_MOTOR_8.clone();
- newMotor.setAmount(1);
- }
- public final static ItemStack[] ELECTRIC_MOTOR_8 = { null, null, null, null, SlimefunItems.ELECTRIC_MOTOR, null,
- null, null, null };
- public final static ItemStack[] HIGHSPEED_RAILWAY = { null, null, null, null, new ItemStack(Material.POWERED_RAIL),
- null, null, newMotor, null };
- public final static ItemStack[] REINFORCED_ALLOY_PICKAXE = { SlimefunItems.REINFORCED_ALLOY_INGOT,
- SlimefunItems.REINFORCED_ALLOY_INGOT, SlimefunItems.REINFORCED_ALLOY_INGOT, null,
- SlimefunItems.REINFORCED_ALLOY_INGOT, null, null, SlimefunItems.REINFORCED_ALLOY_INGOT, null };
- public final static ItemStack[] CLAY_FUSION_INGOT = { SlimefunItems.GOLD_12K, SlimefunItems.SYNTHETIC_EMERALD,
- SlimefunItems.SYNTHETIC_SAPPHIRE, SlimefunItems.REINFORCED_ALLOY_INGOT, ClayTechItems.MAGIC_CLAY,
- SlimefunItems.REINFORCED_ALLOY_INGOT, null, null, null };
- public final static ItemStack[] CLAY_ALLOY_INGOT = { SlimefunItems.REINFORCED_ALLOY_INGOT,
- ClayTechItems.CLAY_FUSION_INGOT, SlimefunItems.CARBONADO, SlimefunItems.REDSTONE_ALLOY,
- ClayTechItems.MAGIC_CLAY, SlimefunItems.GOLD_24K, null, null, null };
- public final static ItemStack[] CLAY_ALLOY_PICKAXE = { ClayTechItems.CLAY_ALLOY_INGOT,
- ClayTechItems.CLAY_ALLOY_INGOT, ClayTechItems.CLAY_ALLOY_INGOT, null, ClayTechItems.CLAY_ALLOY_INGOT, null,
- null, ClayTechItems.CLAY_ALLOY_INGOT, null };
- public final static ItemStack[] CLAY_ALLOY_HELMET = Slimefunutils.getArmorsStack(1, ClayTechItems.CLAY_ALLOY_INGOT);
- public final static ItemStack[] CLAY_ALLOY_CHESTPLATE = Slimefunutils.getArmorsStack(2,
- ClayTechItems.CLAY_ALLOY_INGOT);
- public final static ItemStack[] CLAY_ALLOY_LEGGINGS = Slimefunutils.getArmorsStack(3,
- ClayTechItems.CLAY_ALLOY_INGOT);
- public final static ItemStack[] CLAY_ALLOY_BOOTS = Slimefunutils.getArmorsStack(4, ClayTechItems.CLAY_ALLOY_INGOT);
- public final static ItemStack[] SILICON_INGOT = { ClayTechItems.ELEMENT_SILICON, ClayTechItems.ELEMENT_SILICON,
- ClayTechItems.ELEMENT_SILICON, ClayTechItems.ELEMENT_SILICON, ClayTechItems.ELEMENT_SILICON, null, null,
- null, null };
-
- public final static ItemStack[] MOTOR_CORE = { SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ELECTRIC_MOTOR,
- SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ELECTRIC_MOTOR, ClayTechItems.CLAY_FUSION_INGOT,
- SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ELECTRIC_MOTOR, ClayTechItems.SILICON_INGOT,
- SlimefunItems.ELECTRIC_MOTOR };
- public final static ItemStack[] TEMPERATURE_RESISTANCE_OBSIDIAN = { SlimefunItems.WITHER_PROOF_OBSIDIAN,
- SlimefunItems.WITHER_PROOF_OBSIDIAN, SlimefunItems.WITHER_PROOF_OBSIDIAN,
- SlimefunItems.WITHER_PROOF_OBSIDIAN, SlimefunItems.BLISTERING_INGOT_3, SlimefunItems.WITHER_PROOF_OBSIDIAN,
- SlimefunItems.WITHER_PROOF_OBSIDIAN, SlimefunItems.WITHER_PROOF_OBSIDIAN,
- SlimefunItems.WITHER_PROOF_OBSIDIAN };
- public final static ItemStack[] ROCKET_ENGINE_SHELL = { SlimefunItems.DAMASCUS_STEEL_INGOT,
- ClayTechItems.CLAY_FUSION_INGOT, SlimefunItems.DAMASCUS_STEEL_INGOT, ClayTechItems.CLAY_FUSION_INGOT,
- ClayTechItems.TEMPERATURE_RESISTANCE_OBSIDIAN, ClayTechItems.CLAY_FUSION_INGOT,
- SlimefunItems.DAMASCUS_STEEL_INGOT, ClayTechItems.CLAY_FUSION_INGOT, SlimefunItems.DAMASCUS_STEEL_INGOT };
- public final static ItemStack[] FUEL_TANK = { SlimefunItems.TIN_INGOT, SlimefunItems.TIN_INGOT,
- SlimefunItems.TIN_INGOT, SlimefunItems.TIN_INGOT, ClayTechItems.MAGIC_CLAY, SlimefunItems.TIN_INGOT,
- SlimefunItems.TIN_INGOT, SlimefunItems.TIN_INGOT, SlimefunItems.TIN_INGOT };
- public final static ItemStack[] ROCKET_ENGINE = { ClayTechItems.ROCKET_ENGINE_SHELL,
- ClayTechItems.ROCKET_ENGINE_SHELL, ClayTechItems.ROCKET_ENGINE_SHELL, ClayTechItems.MOTOR_CORE,
- ClayTechItems.FUEL_TANK, ClayTechItems.MOTOR_CORE, ClayTechItems.ARTIFICIAL_GOLD_BLOCK,
- ClayTechItems.ARTIFICIAL_GOLD_BLOCK, ClayTechItems.ARTIFICIAL_GOLD_BLOCK };
- public final static ItemStack[] ROCKET_ANTENNA = { SlimefunItems.DAMASCUS_STEEL_INGOT,
- ClayTechItems.CLAY_FUSION_INGOT, SlimefunItems.DAMASCUS_STEEL_INGOT, ClayTechItems.CLAY_FUSION_INGOT,
- SlimefunItems.COPPER_WIRE, ClayTechItems.CLAY_FUSION_INGOT, SlimefunItems.DAMASCUS_STEEL_INGOT,
- ClayTechItems.CLAY_FUSION_INGOT, SlimefunItems.DAMASCUS_STEEL_INGOT };
- public final static ItemStack[] ROCKET_CPU = { ClayTechItems.CLAY_FUSION_INGOT,
- ClayTechItems.TEMPERATURE_RESISTANCE_OBSIDIAN, ClayTechItems.CLAY_FUSION_INGOT,
- ClayTechItems.ROCKET_ANTENNA, SlimefunItems.PROGRAMMABLE_ANDROID, ClayTechItems.ROCKET_ANTENNA,
- ClayTechItems.ROCKET_ENGINE_SHELL, ClayTechItems.ROCKET_ENGINE_SHELL, ClayTechItems.ROCKET_ENGINE_SHELL };
- public final static ItemStack[] ROCKET_CONTROL_CORE = { ClayTechItems.ARTIFICIAL_GOLD_BLOCK,
- ClayTechItems.ARTIFICIAL_GOLD_BLOCK, ClayTechItems.ARTIFICIAL_GOLD_BLOCK, ClayTechItems.ROCKET_ENGINE_SHELL,
- ClayTechItems.ROCKET_CPU, ClayTechItems.ROCKET_ENGINE_SHELL, ClayTechItems.TEMPERATURE_RESISTANCE_OBSIDIAN,
- ClayTechItems.TEMPERATURE_RESISTANCE_OBSIDIAN, ClayTechItems.TEMPERATURE_RESISTANCE_OBSIDIAN };
- public final static ItemStack[] ROCKET_FUEL_TANK = { ClayTechItems.FUEL_TANK, ClayTechItems.FUEL_TANK,
- ClayTechItems.FUEL_TANK, ClayTechItems.FUEL_TANK, ClayTechItems.TEMPERATURE_RESISTANCE_OBSIDIAN,
- ClayTechItems.FUEL_TANK, ClayTechItems.FUEL_TANK, ClayTechItems.FUEL_TANK, ClayTechItems.FUEL_TANK };
- public final static ItemStack[] ROCKET_GLASS = { SlimefunItems.WITHER_PROOF_GLASS, SlimefunItems.WITHER_PROOF_GLASS,
- SlimefunItems.WITHER_PROOF_GLASS, SlimefunItems.WITHER_PROOF_GLASS, SlimefunItems.STEEL_PLATE,
- SlimefunItems.WITHER_PROOF_GLASS, SlimefunItems.WITHER_PROOF_GLASS, SlimefunItems.WITHER_PROOF_GLASS,
- SlimefunItems.WITHER_PROOF_GLASS };
- public final static ItemStack[] ROCKET_STEEL_PLATE = { ClayTechItems.CLAY_FUSION_INGOT, null,
- ClayTechItems.CLAY_FUSION_INGOT, ClayTechItems.CLAY_FUSION_INGOT,
- ClayTechItems.TEMPERATURE_RESISTANCE_OBSIDIAN, ClayTechItems.CLAY_FUSION_INGOT,
- ClayTechItems.CLAY_FUSION_INGOT, null, ClayTechItems.CLAY_FUSION_INGOT };
- public final static ItemStack[] MIXED_ROCKET_FUEL = { ClayTechItems.CLAY_FUEL, ClayTechItems.CLAY_FUEL,
- ClayTechItems.CLAY_FUEL, new ItemStack(Material.COAL_BLOCK), new ItemStack(Material.COAL_BLOCK),
- new ItemStack(Material.COAL_BLOCK), SlimefunItems.NETHER_ICE, SlimefunItems.NETHER_ICE,
- SlimefunItems.NETHER_ICE };
-
- public final static ItemStack[] ROCKET_1 = { ClayTechItems.ROCKET_GLASS, ClayTechItems.ROCKET_FUEL_TANK,
- ClayTechItems.ROCKET_GLASS, ClayTechItems.ROCKET_STEEL_PLATE, ClayTechItems.ROCKET_CONTROL_CORE,
- ClayTechItems.ROCKET_STEEL_PLATE, ClayTechItems.ROCKET_STEEL_PLATE, ClayTechItems.ROCKET_ENGINE,
- ClayTechItems.ROCKET_STEEL_PLATE };
-
- public final static ItemStack[] OXYGEN_TANK = { SlimefunItems.TIN_INGOT, SlimefunItems.TIN_INGOT,
- SlimefunItems.TIN_INGOT, SlimefunItems.TIN_INGOT, ClayTechItems.CLAY_STICK, SlimefunItems.TIN_INGOT,
- SlimefunItems.TIN_INGOT, SlimefunItems.TIN_INGOT, SlimefunItems.TIN_INGOT };
- public final static ItemStack[] SPACESUIT_OXYGEN_TANK = { ClayTechItems.OXYGEN_TANK, ClayTechItems.OXYGEN_TANK,
- ClayTechItems.OXYGEN_TANK, ClayTechItems.OXYGEN_TANK, ClayTechItems.TEMPERATURE_RESISTANCE_OBSIDIAN,
- ClayTechItems.OXYGEN_TANK, ClayTechItems.OXYGEN_TANK, ClayTechItems.OXYGEN_TANK,
- ClayTechItems.OXYGEN_TANK };
- public final static ItemStack[] SPACESUIT_HELMET = { SlimefunItems.PLASTIC_SHEET, SlimefunItems.PLASTIC_SHEET,
- SlimefunItems.PLASTIC_SHEET, SlimefunItems.PLASTIC_SHEET, ClayTechItems.SPACESUIT_OXYGEN_TANK,
- SlimefunItems.PLASTIC_SHEET, null, null, null };
- public final static ItemStack[] SPACESUIT_CHESTPLATE = { SlimefunItems.PLASTIC_SHEET,
- ClayTechItems.SPACESUIT_OXYGEN_TANK, SlimefunItems.PLASTIC_SHEET, SlimefunItems.PLASTIC_SHEET,
- SlimefunItems.PLASTIC_SHEET, SlimefunItems.PLASTIC_SHEET, SlimefunItems.PLASTIC_SHEET,
- SlimefunItems.PLASTIC_SHEET, SlimefunItems.PLASTIC_SHEET };
- public final static ItemStack[] SPACESUIT_LEGGINGS = { SlimefunItems.PLASTIC_SHEET, SlimefunItems.PLASTIC_SHEET,
- SlimefunItems.PLASTIC_SHEET, SlimefunItems.PLASTIC_SHEET, ClayTechItems.SPACESUIT_OXYGEN_TANK,
- SlimefunItems.PLASTIC_SHEET, SlimefunItems.PLASTIC_SHEET, null, SlimefunItems.PLASTIC_SHEET };
- public final static ItemStack[] SPACESUIT_BOOTS = { SlimefunItems.PLASTIC_SHEET, null, SlimefunItems.PLASTIC_SHEET,
- SlimefunItems.PLASTIC_SHEET, ClayTechItems.SPACESUIT_OXYGEN_TANK, SlimefunItems.PLASTIC_SHEET, null, null,
- null };
- public final static ItemStack[] KREEP_INGOT = { null, null, null, null, ClayTechItems.KREEP_ROCK, null, null, null,
- null };
- public final static ItemStack[] RAW_CHICKEN_FOOT = { null, null, null, null, new ItemStack(Material.CHICKEN), null,
- null, null, null };;
- public final static ItemStack[] PLANET_BASE_SIGNER = { SlimefunItems.STEEL_PLATE, ClayTechItems.ROCKET_ANTENNA,
- SlimefunItems.STEEL_PLATE, SlimefunItems.HARDENED_GLASS, SlimefunItems.PROGRAMMABLE_ANDROID,
- SlimefunItems.HARDENED_GLASS, ClayTechItems.TEMPERATURE_RESISTANCE_OBSIDIAN, SlimefunItems.ELECTRIC_MOTOR,
- ClayTechItems.TEMPERATURE_RESISTANCE_OBSIDIAN };
- public final static ItemStack[] TUBE = { SlimefunItems.PLASTIC_SHEET, null, SlimefunItems.PLASTIC_SHEET,
- SlimefunItems.PLASTIC_SHEET, null, SlimefunItems.PLASTIC_SHEET, SlimefunItems.PLASTIC_SHEET, null,
- SlimefunItems.PLASTIC_SHEET };
- public final static ItemStack[] OXYGEN_DISTRIBUTER = { SlimefunItems.REINFORCED_ALLOY_INGOT, ClayTechItems.TUBE,
- SlimefunItems.REINFORCED_ALLOY_INGOT, ClayTechItems.SPACESUIT_OXYGEN_TANK,
- ClayTechItems.SPACESUIT_OXYGEN_TANK, ClayTechItems.SPACESUIT_OXYGEN_TANK, ClayTechItems.KREEP_INGOT,
- ClayTechItems.SPACESUIT_OXYGEN_TANK, ClayTechItems.KREEP_INGOT };
+ public final static ItemStack[] BLIND_CORE = {new ItemStack(Material.INK_SAC), new ItemStack(Material.END_CRYSTAL),
+ new ItemStack(Material.INK_SAC), new ItemStack(Material.INK_SAC), ClayTechItems.MAGIC_CLAY,
+ new ItemStack(Material.INK_SAC), new ItemStack(Material.INK_SAC), new ItemStack(Material.END_CRYSTAL),
+ new ItemStack(Material.INK_SAC)};
+ public final static ItemStack[] BLIND_SWORD = {ClayTechItems.BLIND_CORE, ClayTechItems.BLIND_CORE,
+ ClayTechItems.BLIND_CORE, ClayTechItems.BLIND_CORE, new ItemStack(Material.DIAMOND_SWORD),
+ ClayTechItems.BLIND_CORE, ClayTechItems.BLIND_CORE, ClayTechItems.BLIND_CORE, ClayTechItems.BLIND_CORE};
+ public final static ItemStack[] POISON_EYE = {new ItemStack(Material.SPIDER_EYE),
+ new ItemStack(Material.SPIDER_EYE), new ItemStack(Material.SPIDER_EYE), new ItemStack(Material.SPIDER_EYE),
+ ClayTechItems.MAGIC_CLAY, new ItemStack(Material.SPIDER_EYE), new ItemStack(Material.SPIDER_EYE),
+ new ItemStack(Material.SPIDER_EYE), new ItemStack(Material.SPIDER_EYE)};
+ public final static ItemStack[] POISON_CORE = {new ItemStack(Material.COAL_BLOCK), ClayTechItems.POISON_EYE,
+ new ItemStack(Material.COAL_BLOCK), new ItemStack(Material.FERMENTED_SPIDER_EYE),
+ new ItemStack(Material.FERMENTED_SPIDER_EYE), new ItemStack(Material.FERMENTED_SPIDER_EYE),
+ new ItemStack(Material.COAL_BLOCK), ClayTechItems.POISON_EYE, new ItemStack(Material.COAL_BLOCK)};
+ public final static ItemStack[] CONFUSION_CORE = {new ItemStack(Material.PUFFERFISH),
+ new ItemStack(Material.PUFFERFISH), new ItemStack(Material.PUFFERFISH), new ItemStack(Material.PUFFERFISH),
+ ClayTechItems.MAGIC_CLAY, new ItemStack(Material.PUFFERFISH), new ItemStack(Material.PUFFERFISH),
+ new ItemStack(Material.PUFFERFISH), new ItemStack(Material.PUFFERFISH)};
+ public final static ItemStack[] BLACK_ROCK_BLOCK = {new ItemStack(Material.OBSIDIAN),
+ new ItemStack(Material.OBSIDIAN), new ItemStack(Material.OBSIDIAN), new ItemStack(Material.OBSIDIAN),
+ ClayTechItems.MAGIC_CLAY, new ItemStack(Material.OBSIDIAN), new ItemStack(Material.OBSIDIAN),
+ new ItemStack(Material.OBSIDIAN), new ItemStack(Material.OBSIDIAN)};
+ public final static ItemStack[] SLOWNESS_CORE = {ClayTechItems.BLACK_ROCK_BLOCK, ClayTechItems.BLACK_ROCK_BLOCK,
+ ClayTechItems.BLACK_ROCK_BLOCK, ClayTechItems.BLACK_ROCK_BLOCK, ClayTechItems.MAGIC_CLAY,
+ ClayTechItems.BLACK_ROCK_BLOCK, ClayTechItems.BLACK_ROCK_BLOCK, ClayTechItems.BLACK_ROCK_BLOCK,
+ ClayTechItems.BLACK_ROCK_BLOCK};
+ public final static ItemStack[] ADVANCED_CONFUSION_CORE = {ClayTechItems.CONFUSION_CORE,
+ ClayTechItems.CONFUSION_CORE, ClayTechItems.CONFUSION_CORE, ClayTechItems.CONFUSION_CORE,
+ ClayTechItems.MAGIC_CLAY, ClayTechItems.CONFUSION_CORE, ClayTechItems.CONFUSION_CORE,
+ ClayTechItems.CONFUSION_CORE, ClayTechItems.CONFUSION_CORE};
+ public final static ItemStack[] ADVANCED_POISON_CORE = {ClayTechItems.POISON_CORE, ClayTechItems.POISON_CORE,
+ ClayTechItems.POISON_CORE, ClayTechItems.POISON_CORE, ClayTechItems.MAGIC_CLAY, ClayTechItems.POISON_CORE,
+ ClayTechItems.POISON_CORE, ClayTechItems.POISON_CORE, ClayTechItems.POISON_CORE};
+ public final static ItemStack[] ADVANCED_SLOWNESS_CORE = {ClayTechItems.SLOWNESS_CORE, ClayTechItems.SLOWNESS_CORE,
+ ClayTechItems.SLOWNESS_CORE, ClayTechItems.SLOWNESS_CORE, ClayTechItems.MAGIC_CLAY,
+ ClayTechItems.SLOWNESS_CORE, ClayTechItems.SLOWNESS_CORE, ClayTechItems.SLOWNESS_CORE,
+ ClayTechItems.SLOWNESS_CORE};
+ public final static ItemStack[] ADVANCED_BLIND_CORE = {ClayTechItems.BLIND_CORE, ClayTechItems.BLIND_CORE,
+ ClayTechItems.BLIND_CORE, ClayTechItems.BLIND_CORE, ClayTechItems.MAGIC_CLAY, ClayTechItems.BLIND_CORE,
+ ClayTechItems.BLIND_CORE, ClayTechItems.BLIND_CORE, ClayTechItems.BLIND_CORE};
+ public final static ItemStack[] FOUR_BOW = {ClayTechItems.ADVANCED_SLOWNESS_CORE,
+ ClayTechItems.ADVANCED_POISON_CORE, ClayTechItems.ADVANCED_BLIND_CORE,
+ ClayTechItems.ADVANCED_CONFUSION_CORE, new ItemStack(Material.BOW), ClayTechItems.ADVANCED_CONFUSION_CORE,
+ ClayTechItems.ADVANCED_BLIND_CORE, ClayTechItems.ADVANCED_POISON_CORE,
+ ClayTechItems.ADVANCED_SLOWNESS_CORE};
+ public final static ItemStack[] POISON_SWORD = {ClayTechItems.POISON_CORE, ClayTechItems.POISON_CORE,
+ ClayTechItems.POISON_CORE, ClayTechItems.POISON_CORE, new ItemStack(Material.DIAMOND_SWORD),
+ ClayTechItems.POISON_CORE, ClayTechItems.POISON_CORE, ClayTechItems.POISON_CORE,
+ ClayTechItems.POISON_CORE};
+ public final static ItemStack[] ANTI_SLOWNESS_BOOTS = {ClayTechItems.SLOWNESS_CORE, ClayTechItems.SLOWNESS_CORE,
+ ClayTechItems.SLOWNESS_CORE, ClayTechItems.SLOWNESS_CORE, new ItemStack(Material.IRON_BOOTS),
+ ClayTechItems.SLOWNESS_CORE, ClayTechItems.SLOWNESS_CORE, ClayTechItems.SLOWNESS_CORE,
+ ClayTechItems.SLOWNESS_CORE};
+ public final static ItemStack[] TNT_EXPLOSION_CREATER = {new ItemStack(Material.TNT), ClayTechItems.MAGIC_CLAY,
+ new ItemStack(Material.TNT), ClayTechItems.MAGIC_CLAY, new ItemStack(Material.DIAMOND_HOE),
+ ClayTechItems.MAGIC_CLAY, new ItemStack(Material.TNT), new ItemStack(Material.FLINT_AND_STEEL),
+ new ItemStack(Material.TNT)};
+ // 食物
+ public final static ItemStack[] CHICKEN_FOOT = {null, new ItemStack(Material.COAL), null, null,
+ ClayTechItems.RAW_CHICKEN_FOOT, null, null, new ItemStack(Material.COAL), null};
+ public final static ItemStack[] SPICY_CHICKEN_BURGER = {ClayTechItems.RAW_BREAD, ClayTechItems.RAW_VEGETABLE,
+ ClayTechItems.RAW_BREAD, ClayTechItems.RAW_VEGETABLE, ClayTechItems.CHICKEN_FOOT,
+ ClayTechItems.RAW_VEGETABLE, ClayTechItems.RAW_BREAD, ClayTechItems.MAGIC_CLAY, ClayTechItems.RAW_BREAD};
+ public final static ItemStack[] BABA_BURGER = {new ItemStack(Material.COAL), ClayTechItems.RAW_BREAD,
+ new ItemStack(Material.COAL), new ItemStack(Material.COAL), new ItemStack(Material.COAL),
+ new ItemStack(Material.COAL), new ItemStack(Material.COAL), ClayTechItems.RAW_BREAD,
+ new ItemStack(Material.COAL)};
+ public final static ItemStack[] CHOCOLATE = {ClayTechItems.COCOA_BEAN, ClayTechItems.COCOA_BEAN,
+ ClayTechItems.COCOA_BEAN, ClayTechItems.COCOA_BEAN, ClayTechItems.STARCH, ClayTechItems.COCOA_BEAN,
+ ClayTechItems.COCOA_BEAN, ClayTechItems.COCOA_BEAN, ClayTechItems.COCOA_BEAN};
+ public final static ItemStack[] SNAIL_FOOD = {ClayTechItems.FLOUR, ClayTechItems.FLOUR, ClayTechItems.FLOUR,
+ ClayTechItems.FLOUR, ClayTechItems.SNAIL_HEALTHY, ClayTechItems.FLOUR, ClayTechItems.FLOUR,
+ ClayTechItems.FLOUR, ClayTechItems.FLOUR};
+ public final static ItemStack[] CLAY_COFFEE = {null, ClayTechItems.COCOA_BEAN, null, null,
+ ClayTechItems.COCOA_BEAN, null, null, ClayTechItems.DRINK_BOTTLE, null};
+ public final static ItemStack[] LEMON_POWDER_DRINK = {null, ClayTechItems.LEMON_POWDER, null, null,
+ ClayTechItems.LEMON_POWDER, null, null, ClayTechItems.DRINK_BOTTLE, null};
+ public final static ItemStack[] TEA_DRINK = {null, ClayTechItems.TEA_POWDER, null, null, ClayTechItems.TEA_POWDER,
+ null, null, ClayTechItems.DRINK_BOTTLE, null};
+ public final static ItemStack[] LEMON_TEA_DRINK = {null, ClayTechItems.TEA_POWDER, null,
+ ClayTechItems.LEMON_POWDER, ClayTechItems.TEA_POWDER, ClayTechItems.LEMON_POWDER, null,
+ ClayTechItems.DRINK_BOTTLE, null};
+ public final static ItemStack[] TEA_POWDER = {null, null, null, null, ClayTechItems.RAW_TEA, null, null, null,
+ null};
+ public final static ItemStack[] LEMON_POWDER = {null, null, null, null, ClayTechItems.CLAY_LEMON, null, null, null,
+ null};
+ public final static ItemStack[] COOKED_SWEET_POTATO = {null, new ItemStack(Material.COAL), null, null,
+ ClayTechItems.CLAY_SWEET_POTATO, null, null, new ItemStack(Material.COAL), null};
+ public final static ItemStack[] ELEMENT_CARBON = {null, null, null, null, new ItemStack(Material.COAL, 8), null,
+ null, null, null};
+ public final static ItemStack[] ELEMENT_OXYGEN = {null, null, null, null, new ItemStack(Material.GRASS_BLOCK, 3),
+ null, null, null, null};
+ public final static ItemStack[] ELEMENT_SILICON = {null, null, null, null, new ItemStack(Material.SAND, 10), null,
+ null, null, null};
+ public final static ItemStack[] BLISTERING_CORE = {null, ClayTechItems.CLAY_FUSION_INGOT, null, null,
+ SlimefunItems.BLISTERING_INGOT_3, null, null, ClayTechItems.CLAY_FUSION_INGOT, null};
+ public final static ItemStack[] ELEMENT_UNIT = {SlimefunItems.DAMASCUS_STEEL_INGOT,
+ SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.DAMASCUS_STEEL_INGOT,
+ null, SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.DAMASCUS_STEEL_INGOT,
+ SlimefunItems.DAMASCUS_STEEL_INGOT, SlimefunItems.DAMASCUS_STEEL_INGOT};
+ public final static ItemStack[] ELECTRIC_MOTOR_8 = {null, null, null, null, SlimefunItems.ELECTRIC_MOTOR, null,
+ null, null, null};
+ public final static ItemStack[] REINFORCED_ALLOY_PICKAXE = {SlimefunItems.REINFORCED_ALLOY_INGOT,
+ SlimefunItems.REINFORCED_ALLOY_INGOT, SlimefunItems.REINFORCED_ALLOY_INGOT, null,
+ SlimefunItems.REINFORCED_ALLOY_INGOT, null, null, SlimefunItems.REINFORCED_ALLOY_INGOT, null};
+ public final static ItemStack[] CLAY_FUSION_INGOT = {SlimefunItems.GOLD_12K, SlimefunItems.SYNTHETIC_EMERALD,
+ SlimefunItems.SYNTHETIC_SAPPHIRE, SlimefunItems.REINFORCED_ALLOY_INGOT, ClayTechItems.MAGIC_CLAY,
+ SlimefunItems.REINFORCED_ALLOY_INGOT, null, null, null};
+ public final static ItemStack[] CLAY_ALLOY_INGOT = {SlimefunItems.REINFORCED_ALLOY_INGOT,
+ ClayTechItems.CLAY_FUSION_INGOT, SlimefunItems.CARBONADO, SlimefunItems.REDSTONE_ALLOY,
+ ClayTechItems.MAGIC_CLAY, SlimefunItems.GOLD_24K, null, null, null};
+ public final static ItemStack[] CLAY_ALLOY_PICKAXE = {ClayTechItems.CLAY_ALLOY_INGOT,
+ ClayTechItems.CLAY_ALLOY_INGOT, ClayTechItems.CLAY_ALLOY_INGOT, null, ClayTechItems.CLAY_ALLOY_INGOT, null,
+ null, ClayTechItems.CLAY_ALLOY_INGOT, null};
+ public final static ItemStack[] CLAY_ALLOY_HELMET = Slimefunutils.getArmorsStack(1, ClayTechItems.CLAY_ALLOY_INGOT);
+ public final static ItemStack[] CLAY_ALLOY_CHESTPLATE = Slimefunutils.getArmorsStack(2,
+ ClayTechItems.CLAY_ALLOY_INGOT);
+ public final static ItemStack[] CLAY_ALLOY_LEGGINGS = Slimefunutils.getArmorsStack(3,
+ ClayTechItems.CLAY_ALLOY_INGOT);
+ public final static ItemStack[] CLAY_ALLOY_BOOTS = Slimefunutils.getArmorsStack(4, ClayTechItems.CLAY_ALLOY_INGOT);
+ public final static ItemStack[] SILICON_INGOT = {ClayTechItems.ELEMENT_SILICON, ClayTechItems.ELEMENT_SILICON,
+ ClayTechItems.ELEMENT_SILICON, ClayTechItems.ELEMENT_SILICON, ClayTechItems.ELEMENT_SILICON, null, null,
+ null, null};
+ public final static ItemStack[] MOTOR_CORE = {SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ELECTRIC_MOTOR,
+ SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ELECTRIC_MOTOR, ClayTechItems.CLAY_FUSION_INGOT,
+ SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.ELECTRIC_MOTOR, ClayTechItems.SILICON_INGOT,
+ SlimefunItems.ELECTRIC_MOTOR};
+ public final static ItemStack[] TEMPERATURE_RESISTANCE_OBSIDIAN = {SlimefunItems.WITHER_PROOF_OBSIDIAN,
+ SlimefunItems.WITHER_PROOF_OBSIDIAN, SlimefunItems.WITHER_PROOF_OBSIDIAN,
+ SlimefunItems.WITHER_PROOF_OBSIDIAN, SlimefunItems.BLISTERING_INGOT_3, SlimefunItems.WITHER_PROOF_OBSIDIAN,
+ SlimefunItems.WITHER_PROOF_OBSIDIAN, SlimefunItems.WITHER_PROOF_OBSIDIAN,
+ SlimefunItems.WITHER_PROOF_OBSIDIAN};
+ public final static ItemStack[] ROCKET_ENGINE_SHELL = {SlimefunItems.DAMASCUS_STEEL_INGOT,
+ ClayTechItems.CLAY_FUSION_INGOT, SlimefunItems.DAMASCUS_STEEL_INGOT, ClayTechItems.CLAY_FUSION_INGOT,
+ ClayTechItems.TEMPERATURE_RESISTANCE_OBSIDIAN, ClayTechItems.CLAY_FUSION_INGOT,
+ SlimefunItems.DAMASCUS_STEEL_INGOT, ClayTechItems.CLAY_FUSION_INGOT, SlimefunItems.DAMASCUS_STEEL_INGOT};
+ public final static ItemStack[] FUEL_TANK = {SlimefunItems.TIN_INGOT, SlimefunItems.TIN_INGOT,
+ SlimefunItems.TIN_INGOT, SlimefunItems.TIN_INGOT, ClayTechItems.MAGIC_CLAY, SlimefunItems.TIN_INGOT,
+ SlimefunItems.TIN_INGOT, SlimefunItems.TIN_INGOT, SlimefunItems.TIN_INGOT};
+ public final static ItemStack[] ROCKET_ENGINE = {ClayTechItems.ROCKET_ENGINE_SHELL,
+ ClayTechItems.ROCKET_ENGINE_SHELL, ClayTechItems.ROCKET_ENGINE_SHELL, ClayTechItems.MOTOR_CORE,
+ ClayTechItems.FUEL_TANK, ClayTechItems.MOTOR_CORE, ClayTechItems.ARTIFICIAL_GOLD_BLOCK,
+ ClayTechItems.ARTIFICIAL_GOLD_BLOCK, ClayTechItems.ARTIFICIAL_GOLD_BLOCK};
+ public final static ItemStack[] ROCKET_ANTENNA = {SlimefunItems.DAMASCUS_STEEL_INGOT,
+ ClayTechItems.CLAY_FUSION_INGOT, SlimefunItems.DAMASCUS_STEEL_INGOT, ClayTechItems.CLAY_FUSION_INGOT,
+ SlimefunItems.COPPER_WIRE, ClayTechItems.CLAY_FUSION_INGOT, SlimefunItems.DAMASCUS_STEEL_INGOT,
+ ClayTechItems.CLAY_FUSION_INGOT, SlimefunItems.DAMASCUS_STEEL_INGOT};
+ public final static ItemStack[] ROCKET_CPU = {ClayTechItems.CLAY_FUSION_INGOT,
+ ClayTechItems.TEMPERATURE_RESISTANCE_OBSIDIAN, ClayTechItems.CLAY_FUSION_INGOT,
+ ClayTechItems.ROCKET_ANTENNA, SlimefunItems.PROGRAMMABLE_ANDROID, ClayTechItems.ROCKET_ANTENNA,
+ ClayTechItems.ROCKET_ENGINE_SHELL, ClayTechItems.ROCKET_ENGINE_SHELL, ClayTechItems.ROCKET_ENGINE_SHELL};
+ public final static ItemStack[] ROCKET_CONTROL_CORE = {ClayTechItems.ARTIFICIAL_GOLD_BLOCK,
+ ClayTechItems.ARTIFICIAL_GOLD_BLOCK, ClayTechItems.ARTIFICIAL_GOLD_BLOCK, ClayTechItems.ROCKET_ENGINE_SHELL,
+ ClayTechItems.ROCKET_CPU, ClayTechItems.ROCKET_ENGINE_SHELL, ClayTechItems.TEMPERATURE_RESISTANCE_OBSIDIAN,
+ ClayTechItems.TEMPERATURE_RESISTANCE_OBSIDIAN, ClayTechItems.TEMPERATURE_RESISTANCE_OBSIDIAN};
+ public final static ItemStack[] ROCKET_FUEL_TANK = {ClayTechItems.FUEL_TANK, ClayTechItems.FUEL_TANK,
+ ClayTechItems.FUEL_TANK, ClayTechItems.FUEL_TANK, ClayTechItems.TEMPERATURE_RESISTANCE_OBSIDIAN,
+ ClayTechItems.FUEL_TANK, ClayTechItems.FUEL_TANK, ClayTechItems.FUEL_TANK, ClayTechItems.FUEL_TANK};
+ public final static ItemStack[] ROCKET_GLASS = {SlimefunItems.WITHER_PROOF_GLASS, SlimefunItems.WITHER_PROOF_GLASS,
+ SlimefunItems.WITHER_PROOF_GLASS, SlimefunItems.WITHER_PROOF_GLASS, SlimefunItems.STEEL_PLATE,
+ SlimefunItems.WITHER_PROOF_GLASS, SlimefunItems.WITHER_PROOF_GLASS, SlimefunItems.WITHER_PROOF_GLASS,
+ SlimefunItems.WITHER_PROOF_GLASS};
+ public final static ItemStack[] ROCKET_STEEL_PLATE = {ClayTechItems.CLAY_FUSION_INGOT, null,
+ ClayTechItems.CLAY_FUSION_INGOT, ClayTechItems.CLAY_FUSION_INGOT,
+ ClayTechItems.TEMPERATURE_RESISTANCE_OBSIDIAN, ClayTechItems.CLAY_FUSION_INGOT,
+ ClayTechItems.CLAY_FUSION_INGOT, null, ClayTechItems.CLAY_FUSION_INGOT};
+ public final static ItemStack[] MIXED_ROCKET_FUEL = {ClayTechItems.CLAY_FUEL, ClayTechItems.CLAY_FUEL,
+ ClayTechItems.CLAY_FUEL, new ItemStack(Material.COAL_BLOCK), new ItemStack(Material.COAL_BLOCK),
+ new ItemStack(Material.COAL_BLOCK), SlimefunItems.NETHER_ICE, SlimefunItems.NETHER_ICE,
+ SlimefunItems.NETHER_ICE};
+ public final static ItemStack[] ROCKET_1 = {ClayTechItems.ROCKET_GLASS, ClayTechItems.ROCKET_FUEL_TANK,
+ ClayTechItems.ROCKET_GLASS, ClayTechItems.ROCKET_STEEL_PLATE, ClayTechItems.ROCKET_CONTROL_CORE,
+ ClayTechItems.ROCKET_STEEL_PLATE, ClayTechItems.ROCKET_STEEL_PLATE, ClayTechItems.ROCKET_ENGINE,
+ ClayTechItems.ROCKET_STEEL_PLATE};
+ public final static ItemStack[] OXYGEN_TANK = {SlimefunItems.TIN_INGOT, SlimefunItems.TIN_INGOT,
+ SlimefunItems.TIN_INGOT, SlimefunItems.TIN_INGOT, ClayTechItems.CLAY_STICK, SlimefunItems.TIN_INGOT,
+ SlimefunItems.TIN_INGOT, SlimefunItems.TIN_INGOT, SlimefunItems.TIN_INGOT};
+ public final static ItemStack[] SPACESUIT_OXYGEN_TANK = {ClayTechItems.OXYGEN_TANK, ClayTechItems.OXYGEN_TANK,
+ ClayTechItems.OXYGEN_TANK, ClayTechItems.OXYGEN_TANK, ClayTechItems.TEMPERATURE_RESISTANCE_OBSIDIAN,
+ ClayTechItems.OXYGEN_TANK, ClayTechItems.OXYGEN_TANK, ClayTechItems.OXYGEN_TANK,
+ ClayTechItems.OXYGEN_TANK};
+ public final static ItemStack[] SPACESUIT_HELMET = {SlimefunItems.PLASTIC_SHEET, SlimefunItems.PLASTIC_SHEET,
+ SlimefunItems.PLASTIC_SHEET, SlimefunItems.PLASTIC_SHEET, ClayTechItems.SPACESUIT_OXYGEN_TANK,
+ SlimefunItems.PLASTIC_SHEET, null, null, null};
+ public final static ItemStack[] SPACESUIT_CHESTPLATE = {SlimefunItems.PLASTIC_SHEET,
+ ClayTechItems.SPACESUIT_OXYGEN_TANK, SlimefunItems.PLASTIC_SHEET, SlimefunItems.PLASTIC_SHEET,
+ SlimefunItems.PLASTIC_SHEET, SlimefunItems.PLASTIC_SHEET, SlimefunItems.PLASTIC_SHEET,
+ SlimefunItems.PLASTIC_SHEET, SlimefunItems.PLASTIC_SHEET};
+ public final static ItemStack[] SPACESUIT_LEGGINGS = {SlimefunItems.PLASTIC_SHEET, SlimefunItems.PLASTIC_SHEET,
+ SlimefunItems.PLASTIC_SHEET, SlimefunItems.PLASTIC_SHEET, ClayTechItems.SPACESUIT_OXYGEN_TANK,
+ SlimefunItems.PLASTIC_SHEET, SlimefunItems.PLASTIC_SHEET, null, SlimefunItems.PLASTIC_SHEET};
+ public final static ItemStack[] SPACESUIT_BOOTS = {SlimefunItems.PLASTIC_SHEET, null, SlimefunItems.PLASTIC_SHEET,
+ SlimefunItems.PLASTIC_SHEET, ClayTechItems.SPACESUIT_OXYGEN_TANK, SlimefunItems.PLASTIC_SHEET, null, null,
+ null};
+ public final static ItemStack[] KREEP_INGOT = {null, null, null, null, ClayTechItems.KREEP_ROCK, null, null, null,
+ null};
+ public final static ItemStack[] RAW_CHICKEN_FOOT = {null, null, null, null, new ItemStack(Material.CHICKEN), null,
+ null, null, null};
+ public final static ItemStack[] PLANET_BASE_SIGNER = {SlimefunItems.STEEL_PLATE, ClayTechItems.ROCKET_ANTENNA,
+ SlimefunItems.STEEL_PLATE, SlimefunItems.HARDENED_GLASS, SlimefunItems.PROGRAMMABLE_ANDROID,
+ SlimefunItems.HARDENED_GLASS, ClayTechItems.TEMPERATURE_RESISTANCE_OBSIDIAN, SlimefunItems.ELECTRIC_MOTOR,
+ ClayTechItems.TEMPERATURE_RESISTANCE_OBSIDIAN};
+ public final static ItemStack[] TUBE = {SlimefunItems.PLASTIC_SHEET, null, SlimefunItems.PLASTIC_SHEET,
+ SlimefunItems.PLASTIC_SHEET, null, SlimefunItems.PLASTIC_SHEET, SlimefunItems.PLASTIC_SHEET, null,
+ SlimefunItems.PLASTIC_SHEET};
+ public final static ItemStack[] OXYGEN_DISTRIBUTER = {SlimefunItems.REINFORCED_ALLOY_INGOT, ClayTechItems.TUBE,
+ SlimefunItems.REINFORCED_ALLOY_INGOT, ClayTechItems.SPACESUIT_OXYGEN_TANK,
+ ClayTechItems.SPACESUIT_OXYGEN_TANK, ClayTechItems.SPACESUIT_OXYGEN_TANK, ClayTechItems.KREEP_INGOT,
+ ClayTechItems.SPACESUIT_OXYGEN_TANK, ClayTechItems.KREEP_INGOT};
+ public final static ItemStack[] COPPER_DUST_O = {null, null, null, null, ClayTechItems.COPPER_ORE, null, null,
+ null, null};
+ ;
+ public final static ItemStack[] CLAY_FUSION_INGOT_O = {null, null, null, null, ClayTechItems.CLAY_FUSION_ORE, null,
+ null, null, null};
+ public static ItemStack[] HONEY_SWEET = SlimefunPlugin.getMinecraftVersion()
+ .isAtLeast(MinecraftVersion.MINECRAFT_1_15)
+ ? new ItemStack[]{new ItemStack(Material.SWEET_BERRIES), new ItemStack(Material.SWEET_BERRIES),
+ new ItemStack(Material.SWEET_BERRIES), new ItemStack(Material.SUGAR),
+ new ItemStack(Material.HONEY_BOTTLE), new ItemStack(Material.SUGAR),
+ new ItemStack(Material.SUGAR), new ItemStack(Material.SUGAR),
+ new ItemStack(Material.SUGAR)}
+ : SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)
+ ? new ItemStack[]{new ItemStack(Material.SWEET_BERRIES), new ItemStack(Material.SUGAR),
+ new ItemStack(Material.SWEET_BERRIES), new ItemStack(Material.SUGAR),
+ new ItemStack(Material.GOLD_INGOT), new ItemStack(Material.SUGAR),
+ new ItemStack(Material.SUGAR), new ItemStack(Material.SUGAR),
+ new ItemStack(Material.SUGAR)}
+ : new ItemStack[]{new ItemStack(Material.SUGAR), new ItemStack(Material.SUGAR),
+ new ItemStack(Material.SUGAR), new ItemStack(Material.SUGAR),
+ new ItemStack(Material.GOLD_INGOT), new ItemStack(Material.SUGAR),
+ new ItemStack(Material.SUGAR), new ItemStack(Material.SUGAR),
+ new ItemStack(Material.SUGAR)};
+ static ItemStack newMotor;
+ public final static ItemStack[] HIGHSPEED_RAILWAY = {null, null, null, null, new ItemStack(Material.POWERED_RAIL),
+ null, null, newMotor, null};
- public final static ItemStack[] COPPER_DUST_O = { null, null, null, null, ClayTechItems.COPPER_ORE, null, null,
- null, null };
- public final static ItemStack[] CLAY_FUSION_INGOT_O = { null, null, null, null, ClayTechItems.CLAY_FUSION_ORE, null,
- null, null, null };
+ static {
+ newMotor = ClayTechItems.ELECTRIC_MOTOR_8.clone();
+ newMotor.setAmount(1);
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/ClayTechRecipeType.java b/src/main/java/club/claycoffee/ClayTech/ClayTechRecipeType.java
index fa58466..65019f1 100644
--- a/src/main/java/club/claycoffee/ClayTech/ClayTechRecipeType.java
+++ b/src/main/java/club/claycoffee/ClayTech/ClayTechRecipeType.java
@@ -1,58 +1,57 @@
package club.claycoffee.ClayTech;
-import org.bukkit.Material;
-import org.bukkit.NamespacedKey;
-import org.bukkit.inventory.ItemStack;
-
import club.claycoffee.ClayTech.utils.Lang;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
+import org.bukkit.Material;
+import org.bukkit.NamespacedKey;
+import org.bukkit.inventory.ItemStack;
public class ClayTechRecipeType {
- public static final RecipeType CLAY_CRAFTING_TABLE = new RecipeType(
- new NamespacedKey(ClayTech.plugin, "CLAY_CRAFTIONG_TABLE"),
- new SlimefunItemStack("CLAY_CRAFTING_TABLE", ClayTechItems.CLAY_CRAFTING_TABLE), "",
- Lang.readMachineRecipesText("CLAY_FUSION_MACHINE"));
- public static final RecipeType CLAY_FOOD_CAULDRON = new RecipeType(
- new NamespacedKey(ClayTech.plugin, "CLAY_FOOD_CAULDRON"),
- new SlimefunItemStack("CLAY_FOOD_CAULDRON", ClayTechItems.CLAY_FOOD_CAULDRON), "",
- Lang.readMachineRecipesText("CLAY_ELETRIC_CAULDRON"));
- public static final RecipeType CLAY_FOOD_CHALKING_MACHINE = new RecipeType(
- new NamespacedKey(ClayTech.plugin, "CLAY_FOOD_CHALKING_MACHINE"),
- new SlimefunItemStack("CLAY_FOOD_CHALKING_MACHINE", ClayTechItems.CLAY_FOOD_CHALKING_MACHINE), "",
- Lang.readMachineRecipesText("CLAY_FOOD_CHALKING_MACHINE"));
- public static final RecipeType CLAY_ELEMENT_EXTRACTER = new RecipeType(
- new NamespacedKey(ClayTech.plugin, "CLAY_ELEMENT_EXTRACTER"),
- new SlimefunItemStack("CLAY_ELEMENT_EXTRACTER", ClayTechItems.CLAY_ELEMENT_EXTRACTER), "",
- Lang.readMachineRecipesText("CLAY_ELEMENT_EXTRACTER"));
- public static final RecipeType CLAY_EXPERIMENT_TABLE_BASIC = new RecipeType(
- new NamespacedKey(ClayTech.plugin, "CLAY_EXPERIMENT_TABLE_BASIC"),
- new SlimefunItemStack("CLAY_EXPERIMENT_TABLE_BASIC", ClayTechItems.CLAY_EXPERIMENT_TABLE_NORMAL), "",
- Lang.readMachineRecipesText("CLAY_EXPERIMENT_TABLE_BASIC"));
- public static final RecipeType CLAY_ROCKET_ASSEMBLING_MACHINE = new RecipeType(
- new NamespacedKey(ClayTech.plugin, "CLAY_ROCKET_ASSEMBLING_MACHINE"),
- new SlimefunItemStack("CLAY_ROCKET_ASSEMBLING_MACHINE", ClayTechItems.CLAY_ROCKET_ASSEMBLING_MACHINE), "",
- Lang.readMachineRecipesText("CLAY_ROCKET_ASSEMBLING_MACHINE"));
- public static final RecipeType CLAY_ROCKET_FUEL_GENERATOR = new RecipeType(
- new NamespacedKey(ClayTech.plugin, "CLAY_ROCKET_FUEL_GENERATOR"),
- new SlimefunItemStack("CLAY_ROCKET_FUEL_GENERATOR", ClayTechItems.CLAY_ROCKET_FUEL_GENERATOR), "",
- Lang.readMachineRecipesText("CLAY_ROCKET_FUEL_GENERATOR"));
- public static final RecipeType DIG_IN_THE_MOON = new RecipeType(
- new NamespacedKey(ClayTech.plugin, "DIG_IN_THE_MOON"), new SlimefunItemStack("DIG_IN_THE_MOON",
- new ItemStack(Material.IRON_PICKAXE), "", Lang.readMachineRecipesText("DIG_IN_THE_MOON")));
- public static final RecipeType DIG_IN_NON_EARTH = new RecipeType(
- new NamespacedKey(ClayTech.plugin, "DIG_IN_NON_EARTH"), new SlimefunItemStack("DIG_IN_NON_EARTH",
- new ItemStack(Material.IRON_PICKAXE), "", Lang.readMachineRecipesText("DIG_IN_NON_EARTH")));
- public static final RecipeType FISHING = new RecipeType(new NamespacedKey(ClayTech.plugin, "FISHING"),
- new SlimefunItemStack("FISHING", new ItemStack(Material.TROPICAL_FISH), "",
- Lang.readMachineRecipesText("FISHING")));
- public static final RecipeType HARVEST = new RecipeType(new NamespacedKey(ClayTech.plugin, "HARVEST"),
- new SlimefunItemStack("HARVEST", new ItemStack(Material.DIAMOND_HOE), "",
- Lang.readMachineRecipesText("HARVEST")));
- public static final RecipeType PLUCKING = new RecipeType(new NamespacedKey(ClayTech.plugin, "PLUCKING"),
- new SlimefunItemStack("PLUCKING", new ItemStack(Material.APPLE), "",
- Lang.readMachineRecipesText("PLUCKING")));
- public static final RecipeType CLEANING = new RecipeType(new NamespacedKey(ClayTech.plugin, "CLEANING"),
- new SlimefunItemStack("CLEANING", new ItemStack(Material.WATER_BUCKET), "",
- Lang.readMachineRecipesText("CLEANING")));
+ public static final RecipeType CLAY_CRAFTING_TABLE = new RecipeType(
+ new NamespacedKey(ClayTech.plugin, "CLAY_CRAFTIONG_TABLE"),
+ new SlimefunItemStack("CLAY_CRAFTING_TABLE", ClayTechItems.CLAY_CRAFTING_TABLE), "",
+ Lang.readMachineRecipesText("CLAY_FUSION_MACHINE"));
+ public static final RecipeType CLAY_FOOD_CAULDRON = new RecipeType(
+ new NamespacedKey(ClayTech.plugin, "CLAY_FOOD_CAULDRON"),
+ new SlimefunItemStack("CLAY_FOOD_CAULDRON", ClayTechItems.CLAY_FOOD_CAULDRON), "",
+ Lang.readMachineRecipesText("CLAY_ELETRIC_CAULDRON"));
+ public static final RecipeType CLAY_FOOD_CHALKING_MACHINE = new RecipeType(
+ new NamespacedKey(ClayTech.plugin, "CLAY_FOOD_CHALKING_MACHINE"),
+ new SlimefunItemStack("CLAY_FOOD_CHALKING_MACHINE", ClayTechItems.CLAY_FOOD_CHALKING_MACHINE), "",
+ Lang.readMachineRecipesText("CLAY_FOOD_CHALKING_MACHINE"));
+ public static final RecipeType CLAY_ELEMENT_EXTRACTER = new RecipeType(
+ new NamespacedKey(ClayTech.plugin, "CLAY_ELEMENT_EXTRACTER"),
+ new SlimefunItemStack("CLAY_ELEMENT_EXTRACTER", ClayTechItems.CLAY_ELEMENT_EXTRACTER), "",
+ Lang.readMachineRecipesText("CLAY_ELEMENT_EXTRACTER"));
+ public static final RecipeType CLAY_EXPERIMENT_TABLE_BASIC = new RecipeType(
+ new NamespacedKey(ClayTech.plugin, "CLAY_EXPERIMENT_TABLE_BASIC"),
+ new SlimefunItemStack("CLAY_EXPERIMENT_TABLE_BASIC", ClayTechItems.CLAY_EXPERIMENT_TABLE_NORMAL), "",
+ Lang.readMachineRecipesText("CLAY_EXPERIMENT_TABLE_BASIC"));
+ public static final RecipeType CLAY_ROCKET_ASSEMBLING_MACHINE = new RecipeType(
+ new NamespacedKey(ClayTech.plugin, "CLAY_ROCKET_ASSEMBLING_MACHINE"),
+ new SlimefunItemStack("CLAY_ROCKET_ASSEMBLING_MACHINE", ClayTechItems.CLAY_ROCKET_ASSEMBLING_MACHINE), "",
+ Lang.readMachineRecipesText("CLAY_ROCKET_ASSEMBLING_MACHINE"));
+ public static final RecipeType CLAY_ROCKET_FUEL_GENERATOR = new RecipeType(
+ new NamespacedKey(ClayTech.plugin, "CLAY_ROCKET_FUEL_GENERATOR"),
+ new SlimefunItemStack("CLAY_ROCKET_FUEL_GENERATOR", ClayTechItems.CLAY_ROCKET_FUEL_GENERATOR), "",
+ Lang.readMachineRecipesText("CLAY_ROCKET_FUEL_GENERATOR"));
+ public static final RecipeType DIG_IN_THE_MOON = new RecipeType(
+ new NamespacedKey(ClayTech.plugin, "DIG_IN_THE_MOON"), new SlimefunItemStack("DIG_IN_THE_MOON",
+ new ItemStack(Material.IRON_PICKAXE), "", Lang.readMachineRecipesText("DIG_IN_THE_MOON")));
+ public static final RecipeType DIG_IN_NON_EARTH = new RecipeType(
+ new NamespacedKey(ClayTech.plugin, "DIG_IN_NON_EARTH"), new SlimefunItemStack("DIG_IN_NON_EARTH",
+ new ItemStack(Material.IRON_PICKAXE), "", Lang.readMachineRecipesText("DIG_IN_NON_EARTH")));
+ public static final RecipeType FISHING = new RecipeType(new NamespacedKey(ClayTech.plugin, "FISHING"),
+ new SlimefunItemStack("FISHING", new ItemStack(Material.TROPICAL_FISH), "",
+ Lang.readMachineRecipesText("FISHING")));
+ public static final RecipeType HARVEST = new RecipeType(new NamespacedKey(ClayTech.plugin, "HARVEST"),
+ new SlimefunItemStack("HARVEST", new ItemStack(Material.DIAMOND_HOE), "",
+ Lang.readMachineRecipesText("HARVEST")));
+ public static final RecipeType PLUCKING = new RecipeType(new NamespacedKey(ClayTech.plugin, "PLUCKING"),
+ new SlimefunItemStack("PLUCKING", new ItemStack(Material.APPLE), "",
+ Lang.readMachineRecipesText("PLUCKING")));
+ public static final RecipeType CLEANING = new RecipeType(new NamespacedKey(ClayTech.plugin, "CLEANING"),
+ new SlimefunItemStack("CLEANING", new ItemStack(Material.WATER_BUCKET), "",
+ Lang.readMachineRecipesText("CLEANING")));
}
diff --git a/src/main/java/club/claycoffee/ClayTech/ClayTechUpdater.java b/src/main/java/club/claycoffee/ClayTech/ClayTechUpdater.java
index e8aeb72..01ea26f 100644
--- a/src/main/java/club/claycoffee/ClayTech/ClayTechUpdater.java
+++ b/src/main/java/club/claycoffee/ClayTech/ClayTechUpdater.java
@@ -1,129 +1,123 @@
package club.claycoffee.ClayTech;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.URL;
-
-import org.bukkit.Bukkit;
-import org.bukkit.scheduler.BukkitRunnable;
-
-import com.google.gson.JsonArray;
-import com.google.gson.JsonParser;
-
import club.claycoffee.ClayTech.api.ClayTechBranch;
import club.claycoffee.ClayTech.utils.FileDownloader;
import club.claycoffee.ClayTech.utils.Lang;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonParser;
+import org.bukkit.Bukkit;
+import org.bukkit.scheduler.BukkitRunnable;
+
+import java.io.*;
+import java.net.URL;
public class ClayTechUpdater {
- private ClayTech plugin = ClayTech.getInstance();
- private ClayTechBranch branch;
+ private ClayTech plugin = ClayTech.getInstance();
+ private ClayTechBranch branch;
- public ClayTechUpdater() {
- if (plugin.getDescription().getVersion().toUpperCase().contains("DEV")
- || plugin.getDescription().getVersion().toUpperCase().contains("PRE")) {
- branch = ClayTechBranch.DEVELOPMENT;
- Bukkit.getServer().getLogger().info("§e" + Lang.readGeneralText("Info_1"));
- Bukkit.getServer().getLogger().info(Lang.readGeneralText("DEV_VERSION"));
- Bukkit.getServer().getLogger().info("§e" + Lang.readGeneralText("Info_6"));
- } else {
- branch = ClayTechBranch.STABLE;
- }
- }
+ public ClayTechUpdater() {
+ if (plugin.getDescription().getVersion().toUpperCase().contains("DEV")
+ || plugin.getDescription().getVersion().toUpperCase().contains("PRE")) {
+ branch = ClayTechBranch.DEVELOPMENT;
+ Bukkit.getServer().getLogger().info("§e" + Lang.readGeneralText("Info_1"));
+ Bukkit.getServer().getLogger().info(Lang.readGeneralText("DEV_VERSION"));
+ Bukkit.getServer().getLogger().info("§e" + Lang.readGeneralText("Info_6"));
+ } else {
+ branch = ClayTechBranch.STABLE;
+ }
+ }
- public void tryUpdate() {
- new BukkitRunnable() {
+ public void tryUpdate() {
+ new BukkitRunnable() {
- @Override
- public void run() {
- try {
- URL url = new URL("https://api.github.com/repos/ClayCoffee/ClayTech/releases");
- InputStream in = url.openStream();
- BufferedReader bf = new BufferedReader(new InputStreamReader(in));
- JsonArray ja = new JsonParser().parse(bf.readLine()).getAsJsonArray();
- String downloadURL = null;
- if (branch == ClayTechBranch.STABLE) {
- for (int i = 0; i < ja.size(); i++) {
- if (ja.get(i).getAsJsonObject().get("prerelease").getAsBoolean()) {
- continue;
- } else if (!ja.get(i).getAsJsonObject().get("tag_name").getAsString()
- .equalsIgnoreCase(ClayTechData.currentVersion)) {
- if (new File(plugin.getServer().getUpdateFolder().replaceAll("update", "plugins"),
- ja.get(i).getAsJsonObject().get("assets").getAsJsonArray().get(0)
- .getAsJsonObject().get("name").getAsString()).exists())
- return;
+ @Override
+ public void run() {
+ try {
+ URL url = new URL("https://api.github.com/repos/ClayCoffee/ClayTech/releases");
+ InputStream in = url.openStream();
+ BufferedReader bf = new BufferedReader(new InputStreamReader(in));
+ JsonArray ja = new JsonParser().parse(bf.readLine()).getAsJsonArray();
+ String downloadURL = null;
+ if (branch == ClayTechBranch.STABLE) {
+ for (int i = 0; i < ja.size(); i++) {
+ if (ja.get(i).getAsJsonObject().get("prerelease").getAsBoolean()) {
+ continue;
+ } else if (!ja.get(i).getAsJsonObject().get("tag_name").getAsString()
+ .equalsIgnoreCase(ClayTechData.currentVersion)) {
+ if (new File(plugin.getServer().getUpdateFolder().replaceAll("update", "plugins"),
+ ja.get(i).getAsJsonObject().get("assets").getAsJsonArray().get(0)
+ .getAsJsonObject().get("name").getAsString()).exists())
+ return;
- downloadURL = ja.get(i).getAsJsonObject().get("assets").getAsJsonArray().get(0)
- .getAsJsonObject().get("browser_download_url").getAsString();
- if (!FileDownloader.updateFunc(downloadURL,
- ja.get(i).getAsJsonObject().get("assets").getAsJsonArray().get(0)
- .getAsJsonObject().get("name").getAsString(),
- plugin.getServer().getUpdateFolder().replaceAll("update", "plugins"), ja)
- .equalsIgnoreCase("")) {
- Bukkit.getServer().getLogger().info("§a" + Lang.readGeneralText("Info_1"));
- Bukkit.getServer().getLogger()
- .info(Lang.readGeneralText("update_done")
- .replaceAll("\\{new_version\\}",
- ja.get(i).getAsJsonObject().get("tag_name").getAsString())
- .replaceAll("\\{old_version\\}",
- ClayTech.getInstance().getPluginVersion()));
- Bukkit.getServer().getLogger().info("§a" + Lang.readGeneralText("Info_6"));
- ClayTechData.currentVersion = ja.get(i).getAsJsonObject().get("tag_name")
- .getAsString();
- return;
- }
- }
- }
- Bukkit.getServer().getLogger().info(Lang.readGeneralText("LatestVersion"));
- } else {
- if (ja.get(0).getAsJsonObject().get("prerelease").getAsBoolean()) {
- if (!ja.get(0).getAsJsonObject().get("tag_name").getAsString()
- .equalsIgnoreCase(ClayTechData.currentVersion)) {
- if (new File(plugin.getServer().getUpdateFolder().replaceAll("update", "plugins"),
- ja.get(0).getAsJsonObject().get("assets").getAsJsonArray().get(0)
- .getAsJsonObject().get("name").getAsString()).exists())
- return;
- downloadURL = ja.get(0).getAsJsonObject().get("assets").getAsJsonArray().get(0)
- .getAsJsonObject().get("browser_download_url").getAsString();
- // 开始下载
- if (!FileDownloader.updateFunc(downloadURL,
- ja.get(0).getAsJsonObject().get("assets").getAsJsonArray().get(0)
- .getAsJsonObject().get("name").getAsString(),
- plugin.getServer().getUpdateFolder().replaceAll("update", "plugins"), ja)
- .equalsIgnoreCase("")) {
- Bukkit.getServer().getLogger().info("§a" + Lang.readGeneralText("Info_1"));
- Bukkit.getServer().getLogger()
- .info(Lang.readGeneralText("update_done")
- .replaceAll("\\{new_version\\}",
- ja.get(0).getAsJsonObject().get("tag_name").getAsString())
- .replaceAll("\\{old_version\\}",
- ClayTech.getInstance().getPluginVersion()));
- Bukkit.getServer().getLogger().info("§a" + Lang.readGeneralText("Info_6"));
- ClayTechData.currentVersion = ja.get(0).getAsJsonObject().get("tag_name")
- .getAsString();
- return;
- }
- } else {
- Bukkit.getServer().getLogger().info(Lang.readGeneralText("LatestVersion"));
- return;
- }
- } else
- return;
- }
+ downloadURL = ja.get(i).getAsJsonObject().get("assets").getAsJsonArray().get(0)
+ .getAsJsonObject().get("browser_download_url").getAsString();
+ if (!FileDownloader.updateFunc(downloadURL,
+ ja.get(i).getAsJsonObject().get("assets").getAsJsonArray().get(0)
+ .getAsJsonObject().get("name").getAsString(),
+ plugin.getServer().getUpdateFolder().replaceAll("update", "plugins"), ja)
+ .equalsIgnoreCase("")) {
+ Bukkit.getServer().getLogger().info("§a" + Lang.readGeneralText("Info_1"));
+ Bukkit.getServer().getLogger()
+ .info(Lang.readGeneralText("update_done")
+ .replaceAll("\\{new_version\\}",
+ ja.get(i).getAsJsonObject().get("tag_name").getAsString())
+ .replaceAll("\\{old_version\\}",
+ ClayTech.getInstance().getPluginVersion()));
+ Bukkit.getServer().getLogger().info("§a" + Lang.readGeneralText("Info_6"));
+ ClayTechData.currentVersion = ja.get(i).getAsJsonObject().get("tag_name")
+ .getAsString();
+ return;
+ }
+ }
+ }
+ Bukkit.getServer().getLogger().info(Lang.readGeneralText("LatestVersion"));
+ } else {
+ if (ja.get(0).getAsJsonObject().get("prerelease").getAsBoolean()) {
+ if (!ja.get(0).getAsJsonObject().get("tag_name").getAsString()
+ .equalsIgnoreCase(ClayTechData.currentVersion)) {
+ if (new File(plugin.getServer().getUpdateFolder().replaceAll("update", "plugins"),
+ ja.get(0).getAsJsonObject().get("assets").getAsJsonArray().get(0)
+ .getAsJsonObject().get("name").getAsString()).exists())
+ return;
+ downloadURL = ja.get(0).getAsJsonObject().get("assets").getAsJsonArray().get(0)
+ .getAsJsonObject().get("browser_download_url").getAsString();
+ // 开始下载
+ if (!FileDownloader.updateFunc(downloadURL,
+ ja.get(0).getAsJsonObject().get("assets").getAsJsonArray().get(0)
+ .getAsJsonObject().get("name").getAsString(),
+ plugin.getServer().getUpdateFolder().replaceAll("update", "plugins"), ja)
+ .equalsIgnoreCase("")) {
+ Bukkit.getServer().getLogger().info("§a" + Lang.readGeneralText("Info_1"));
+ Bukkit.getServer().getLogger()
+ .info(Lang.readGeneralText("update_done")
+ .replaceAll("\\{new_version\\}",
+ ja.get(0).getAsJsonObject().get("tag_name").getAsString())
+ .replaceAll("\\{old_version\\}",
+ ClayTech.getInstance().getPluginVersion()));
+ Bukkit.getServer().getLogger().info("§a" + Lang.readGeneralText("Info_6"));
+ ClayTechData.currentVersion = ja.get(0).getAsJsonObject().get("tag_name")
+ .getAsString();
+ return;
+ }
+ } else {
+ Bukkit.getServer().getLogger().info(Lang.readGeneralText("LatestVersion"));
+ return;
+ }
+ } else
+ return;
+ }
- } catch (IOException e) {
- Bukkit.getLogger().info("§cCould not perform update. Is the Github down?");
- e.printStackTrace();
- return;
- }
- }
+ } catch (IOException e) {
+ Bukkit.getLogger().info("§cCould not perform update. Is the Github down?");
+ e.printStackTrace();
+ return;
+ }
+ }
- }.runTaskAsynchronously(ClayTech.getInstance());
- }
+ }.runTaskAsynchronously(ClayTech.getInstance());
+ }
- public ClayTechBranch getBranch() {
- return branch;
- }
+ public ClayTechBranch getBranch() {
+ return branch;
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/api/ClayTechBranch.java b/src/main/java/club/claycoffee/ClayTech/api/ClayTechBranch.java
index 2e17f2e..6dfc054 100644
--- a/src/main/java/club/claycoffee/ClayTech/api/ClayTechBranch.java
+++ b/src/main/java/club/claycoffee/ClayTech/api/ClayTechBranch.java
@@ -2,15 +2,15 @@
public enum ClayTechBranch {
- DEVELOPMENT("dev"), STABLE("stable");
+ DEVELOPMENT("dev"), STABLE("stable");
- public final String name;
+ public final String name;
- ClayTechBranch(String name) {
- this.name = name;
- }
+ ClayTechBranch(String name) {
+ this.name = name;
+ }
- public String getName() {
- return name;
- }
+ public String getName() {
+ return name;
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/api/ClayTechManager.java b/src/main/java/club/claycoffee/ClayTech/api/ClayTechManager.java
index 9c5de54..1346f3e 100644
--- a/src/main/java/club/claycoffee/ClayTech/api/ClayTechManager.java
+++ b/src/main/java/club/claycoffee/ClayTech/api/ClayTechManager.java
@@ -1,104 +1,102 @@
package club.claycoffee.ClayTech.api;
-import java.lang.reflect.Field;
-
-import org.bukkit.entity.Player;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.metadata.FixedMetadataValue;
-
import club.claycoffee.ClayTech.ClayTech;
import club.claycoffee.ClayTech.ClayTechItems;
import club.claycoffee.ClayTech.utils.ClayItem;
import club.claycoffee.ClayTech.utils.Lang;
import club.claycoffee.ClayTech.utils.Utils;
+import org.bukkit.entity.Player;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.metadata.FixedMetadataValue;
+
+import java.lang.reflect.Field;
/**
* the ClayTech API manager. 粘土科技API管理器
*/
public class ClayTechManager {
- /**
- *
- * @return the ItemStack is ClayTech item or not. 这个ItemStack是不是粘土科技物品.
- * @param item The item.物品.
- */
- public static boolean isClayTechItem(ItemStack item) {
- Field[] fields = ClayTechItems.class.getDeclaredFields();
- for (Field field : fields) {
- ItemStack is;
- try {
- is = (ItemStack) field.get(new ClayTechItems());
- } catch (IllegalArgumentException e) {
- return false;
- } catch (IllegalAccessException e) {
- return false;
- }
- if (Utils.getDisplayName(is).equalsIgnoreCase(Utils.getDisplayName(item))
- && Utils.getLoreList(is).equals(Utils.getLoreList(item)) && is.getType() == item.getType()) {
- return true;
- } else if (Utils.getDisplayName(is).equalsIgnoreCase(Utils.getDisplayName(item))
- && !Utils.getLoreList(is).equals(Utils.getLoreList(item)) && ClayItem.hasDurability(is)
- && is.getType() == item.getType()) {
- return true;
- } else if (isRocket(is)) {
- return true;
- } else if (isSpaceSuit(is)) {
- return true;
- } else if (isOxygenDistributer(is)) {
- return true;
- }
- }
- return false;
- }
+ /**
+ * @param item The item.物品.
+ * @return the ItemStack is ClayTech item or not. 这个ItemStack是不是粘土科技物品.
+ */
+ public static boolean isClayTechItem(ItemStack item) {
+ Field[] fields = ClayTechItems.class.getDeclaredFields();
+ for (Field field : fields) {
+ ItemStack is;
+ try {
+ is = (ItemStack) field.get(new ClayTechItems());
+ } catch (IllegalArgumentException e) {
+ return false;
+ } catch (IllegalAccessException e) {
+ return false;
+ }
+ if (Utils.getDisplayName(is).equalsIgnoreCase(Utils.getDisplayName(item))
+ && Utils.getLoreList(is).equals(Utils.getLoreList(item)) && is.getType() == item.getType()) {
+ return true;
+ } else if (Utils.getDisplayName(is).equalsIgnoreCase(Utils.getDisplayName(item))
+ && !Utils.getLoreList(is).equals(Utils.getLoreList(item)) && ClayItem.hasDurability(is)
+ && is.getType() == item.getType()) {
+ return true;
+ } else if (isRocket(is)) {
+ return true;
+ } else if (isSpaceSuit(is)) {
+ return true;
+ } else if (isOxygenDistributer(is)) {
+ return true;
+ }
+ }
+ return false;
+ }
- public static boolean isRocket(ItemStack item) {
- if (item == null)
- return false;
- if (item.hasItemMeta()) {
- if (item.getItemMeta().getDisplayName().startsWith(Lang.readGeneralText("Rocket"))) {
- return true;
- } else {
- return false;
- }
- }
- return false;
- }
+ public static boolean isRocket(ItemStack item) {
+ if (item == null)
+ return false;
+ if (item.hasItemMeta()) {
+ if (item.getItemMeta().getDisplayName().startsWith(Lang.readGeneralText("Rocket"))) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ return false;
+ }
- public static boolean isSpaceSuit(ItemStack item) {
- if (item == null)
- return false;
- if (item.hasItemMeta()) {
- if (item.getItemMeta().getDisplayName().startsWith(Lang.readGeneralText("SpaceSuit"))) {
- return true;
- } else {
- return false;
- }
- }
- return false;
- }
+ public static boolean isSpaceSuit(ItemStack item) {
+ if (item == null)
+ return false;
+ if (item.hasItemMeta()) {
+ if (item.getItemMeta().getDisplayName().startsWith(Lang.readGeneralText("SpaceSuit"))) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ return false;
+ }
- public static boolean isOxygenDistributer(ItemStack item) {
- if (item == null)
- return false;
- if (item.hasItemMeta()) {
- if (item.getItemMeta().getDisplayName().startsWith(Lang.readGeneralText("OxygenDistributer"))) {
- return true;
- } else {
- return false;
- }
- }
- return false;
- }
+ public static boolean isOxygenDistributer(ItemStack item) {
+ if (item == null)
+ return false;
+ if (item.hasItemMeta()) {
+ if (item.getItemMeta().getDisplayName().startsWith(Lang.readGeneralText("OxygenDistributer"))) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ return false;
+ }
- /**
- * set a player's spacesuit cost no durability once.(will lose efficacy when the
- * server restarting or reloading)
- */
- public static void setSpaceSuitFallNoCostDurabilityOnce(Player p) {
- p.setMetadata("SpaceSuitNoCostDurability", new FixedMetadataValue(ClayTech.getInstance(), true));
- }
+ /**
+ * set a player's spacesuit cost no durability once.(will lose efficacy when the
+ * server restarting or reloading)
+ */
+ public static void setSpaceSuitFallNoCostDurabilityOnce(Player p) {
+ p.setMetadata("SpaceSuitNoCostDurability", new FixedMetadataValue(ClayTech.getInstance(), true));
+ }
- public static void allowSpaceTeleportOnce(Player p) {
- p.setMetadata("allowSpaceTeleport", new FixedMetadataValue(ClayTech.getInstance(), true));
- }
+ public static void allowSpaceTeleportOnce(Player p) {
+ p.setMetadata("allowSpaceTeleport", new FixedMetadataValue(ClayTech.getInstance(), true));
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/api/Planet.java b/src/main/java/club/claycoffee/ClayTech/api/Planet.java
index 2827a5c..6106bcd 100644
--- a/src/main/java/club/claycoffee/ClayTech/api/Planet.java
+++ b/src/main/java/club/claycoffee/ClayTech/api/Planet.java
@@ -1,235 +1,229 @@
package club.claycoffee.ClayTech.api;
-import java.util.Random;
-
-import org.bukkit.Bukkit;
-import org.bukkit.GameRule;
-import org.bukkit.World;
-import org.bukkit.WorldCreator;
-import org.bukkit.WorldType;
-import org.bukkit.configuration.file.FileConfiguration;
+import club.claycoffee.ClayTech.ClayTech;
+import club.claycoffee.ClayTech.utils.DataYML;
+import club.claycoffee.ClayTech.utils.Utils;
+import com.onarandombox.MultiverseCore.MultiverseCore;
+import com.onarandombox.MultiverseCore.api.MVWorldManager;
+import org.bukkit.*;
import org.bukkit.World.Environment;
+import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitRunnable;
-import com.onarandombox.MultiverseCore.MultiverseCore;
-import com.onarandombox.MultiverseCore.api.MVWorldManager;
-
-import club.claycoffee.ClayTech.ClayTech;
-import club.claycoffee.ClayTech.utils.DataYML;
-import club.claycoffee.ClayTech.utils.Utils;
+import java.util.Random;
/**
* Planet. 星球.
*/
public class Planet {
- private String planetName;
- private ItemStack displayItem;
- private ChunkGenerator planetWorld;
- private Environment environment;
- private boolean habitable;
- private int gravity;
- private int distance;
- private int harmlevel;
- private boolean cold;
- private boolean spawnMob;
- private DataYML planets = ClayTech.getPlanetYML();
- private FileConfiguration f = planets.getCustomConfig();
-
- public Planet(String planetName, ItemStack displayItem, ChunkGenerator planetWorld, Environment environment,
- boolean habitable, int gravity, int distance, int harmlevel, boolean cold) {
- this.planetName = planetName;
- this.displayItem = displayItem;
- this.planetWorld = planetWorld;
- this.environment = environment;
- this.habitable = habitable;
- this.gravity = gravity;
- this.distance = distance;
- this.harmlevel = harmlevel;
- this.cold = cold;
- if (!f.contains(this.planetName)) {
- if (this.planetName.equalsIgnoreCase(ClayTech.getOverworld())) {
- f.set(this.planetName, true);
- } else {
- f.set(this.planetName, false);
- }
- planets.saveCustomConfig();
- planets.reloadCustomConfig();
- }
- if (!f.contains(this.planetName + "-spawnMobs")) {
- if (this.planetName.equalsIgnoreCase(ClayTech.getOverworld())) {
- f.set(this.planetName + "-spawnMobs", true);
- this.spawnMob = true;
- } else {
- f.set(this.planetName + "-spawnMobs", false);
- this.spawnMob = false;
- }
- planets.saveCustomConfig();
- planets.reloadCustomConfig();
- } else {
- this.spawnMob = f.getBoolean(this.planetName + "-spawnMobs");
- }
-
- }
-
- public Planet(String planetName, ItemStack displayItem, World planetWorld, Environment environment,
- boolean habitable, int gravity, int distance, int harmlevel, boolean cold) {
- this.planetName = planetName;
- this.displayItem = displayItem;
- this.planetWorld = planetWorld.getGenerator();
- this.environment = environment;
- this.habitable = habitable;
- this.gravity = gravity;
- this.harmlevel = harmlevel;
- this.cold = cold;
- if (!f.contains(this.planetName)) {
- if (this.planetName.equalsIgnoreCase(ClayTech.getOverworld())) {
- f.set(this.planetName, true);
- } else {
- f.set(this.planetName, false);
- }
- planets.saveCustomConfig();
- planets.reloadCustomConfig();
- }
- if (!f.contains(this.planetName + "-spawnMobs")) {
- if (this.planetName.equalsIgnoreCase(ClayTech.getOverworld())) {
- f.set(this.planetName + "-spawnMobs", true);
- this.spawnMob = true;
- } else {
- f.set(this.planetName + "-spawnMobs", false);
- this.spawnMob = false;
- }
- planets.saveCustomConfig();
- planets.reloadCustomConfig();
- } else {
- this.spawnMob = f.getBoolean(this.planetName + "-spawnMobs");
- }
- }
-
- public void register() {
- if (planetName.equalsIgnoreCase(ClayTech.getOverworld())) {
- if (!f.getBoolean(this.planetName) && !this.planetName.equalsIgnoreCase(ClayTech.getOverworld())) {
- if (Bukkit.getWorld(this.planetName) != null) {
- Bukkit.unloadWorld(this.planetName, true);
- }
- return;
- }
- for (Planet each : ClayTech.getPlanets()) {
- if (each.planetName.equalsIgnoreCase(this.planetName)) {
- Utils.info("Registering Error: Planet" + this.planetName + "already exists!");
- return;
- }
- }
- ClayTech.getPlanets().add(this);
- return;
- }
-
- if (!f.getBoolean(this.planetName) && !this.planetName.equalsIgnoreCase(ClayTech.getOverworld())) {
- if (Bukkit.getWorld(this.planetName) != null) {
- Bukkit.unloadWorld(this.planetName, true);
- }
- return;
- }
- for (Planet each : ClayTech.getPlanets()) {
- if (each.planetName.equalsIgnoreCase(this.planetName)) {
- Utils.info("Registering Error: Planet" + this.planetName + "already exists!");
- return;
- }
- }
- ClayTech.getPlanets().add(this);
-
- WorldCreator newWorld = new WorldCreator(this.planetName);
- if (Bukkit.getWorld(this.planetName) == null) {
- newWorld.environment(this.environment);
- long seed = new Random().nextLong();
- newWorld = newWorld.seed(seed);
- newWorld = newWorld.type(WorldType.NORMAL);
- newWorld = newWorld.generateStructures(false);
- newWorld = newWorld.generator("ClayTech:" + this.planetName);
- World w = newWorld.createWorld();
- if (this.cold) {
- // 如果冷就不会下雨
- w.setGameRule(GameRule.DO_WEATHER_CYCLE, false);
- }
-
- return;
- }
- newWorld.createWorld();
-
- new BukkitRunnable() {
-
- @Override
- public void run() {
- if (Bukkit.getPluginManager().isPluginEnabled("Multiverse-Core")) {
- MVWorldManager wm = ((MultiverseCore) Bukkit.getPluginManager().getPlugin("Multiverse-Core"))
- .getMVWorldManager();
- wm.addWorld(trimWorldName(planetName), environment, null, WorldType.NORMAL, null,
- "ClayTech:" + planetName, true);
- }
-
- }
-
- }.runTaskAsynchronously(ClayTech.getInstance());
- }
-
- private String trimWorldName(String userInput) {
- return userInput.replaceAll("^[./\\\\]+", "");
- }
-
- public void setDistance(int newDistance) {
- this.distance = newDistance;
- }
-
- public void setHarmLevel(int newLevel) {
- this.harmlevel = newLevel;
- }
-
- public void setHabitable(boolean habitable) {
- this.habitable = habitable;
- }
-
- public void setCold(boolean cold) {
- this.cold = cold;
- }
-
- public void setGravity(int newGravity) {
- this.gravity = newGravity;
- }
-
- public int getDistance() {
- return this.distance;
- }
-
- public int getHarmLevel() {
- return this.harmlevel;
- }
-
- public boolean getHabitable() {
- return this.habitable;
- }
-
- public boolean getCold() {
- return this.cold;
- }
-
- public boolean getMobSpawnable() {
- return this.spawnMob;
- }
-
- public int getGravity() {
- return this.gravity;
- }
-
- public String getPlanetWorldName() {
- return this.planetName;
- }
-
- public ItemStack getDisplayStack() {
- return this.displayItem.clone();
- }
-
- public ChunkGenerator getPlanetGenerator() {
- return this.planetWorld;
- }
+ private String planetName;
+ private ItemStack displayItem;
+ private ChunkGenerator planetWorld;
+ private Environment environment;
+ private boolean habitable;
+ private int gravity;
+ private int distance;
+ private int harmlevel;
+ private boolean cold;
+ private boolean spawnMob;
+ private DataYML planets = ClayTech.getPlanetYML();
+ private FileConfiguration f = planets.getCustomConfig();
+
+ public Planet(String planetName, ItemStack displayItem, ChunkGenerator planetWorld, Environment environment,
+ boolean habitable, int gravity, int distance, int harmlevel, boolean cold) {
+ this.planetName = planetName;
+ this.displayItem = displayItem;
+ this.planetWorld = planetWorld;
+ this.environment = environment;
+ this.habitable = habitable;
+ this.gravity = gravity;
+ this.distance = distance;
+ this.harmlevel = harmlevel;
+ this.cold = cold;
+ if (!f.contains(this.planetName)) {
+ if (this.planetName.equalsIgnoreCase(ClayTech.getOverworld())) {
+ f.set(this.planetName, true);
+ } else {
+ f.set(this.planetName, false);
+ }
+ planets.saveCustomConfig();
+ planets.reloadCustomConfig();
+ }
+ if (!f.contains(this.planetName + "-spawnMobs")) {
+ if (this.planetName.equalsIgnoreCase(ClayTech.getOverworld())) {
+ f.set(this.planetName + "-spawnMobs", true);
+ this.spawnMob = true;
+ } else {
+ f.set(this.planetName + "-spawnMobs", false);
+ this.spawnMob = false;
+ }
+ planets.saveCustomConfig();
+ planets.reloadCustomConfig();
+ } else {
+ this.spawnMob = f.getBoolean(this.planetName + "-spawnMobs");
+ }
+
+ }
+
+ public Planet(String planetName, ItemStack displayItem, World planetWorld, Environment environment,
+ boolean habitable, int gravity, int distance, int harmlevel, boolean cold) {
+ this.planetName = planetName;
+ this.displayItem = displayItem;
+ this.planetWorld = planetWorld.getGenerator();
+ this.environment = environment;
+ this.habitable = habitable;
+ this.gravity = gravity;
+ this.harmlevel = harmlevel;
+ this.cold = cold;
+ if (!f.contains(this.planetName)) {
+ if (this.planetName.equalsIgnoreCase(ClayTech.getOverworld())) {
+ f.set(this.planetName, true);
+ } else {
+ f.set(this.planetName, false);
+ }
+ planets.saveCustomConfig();
+ planets.reloadCustomConfig();
+ }
+ if (!f.contains(this.planetName + "-spawnMobs")) {
+ if (this.planetName.equalsIgnoreCase(ClayTech.getOverworld())) {
+ f.set(this.planetName + "-spawnMobs", true);
+ this.spawnMob = true;
+ } else {
+ f.set(this.planetName + "-spawnMobs", false);
+ this.spawnMob = false;
+ }
+ planets.saveCustomConfig();
+ planets.reloadCustomConfig();
+ } else {
+ this.spawnMob = f.getBoolean(this.planetName + "-spawnMobs");
+ }
+ }
+
+ public void register() {
+ if (planetName.equalsIgnoreCase(ClayTech.getOverworld())) {
+ if (!f.getBoolean(this.planetName) && !this.planetName.equalsIgnoreCase(ClayTech.getOverworld())) {
+ if (Bukkit.getWorld(this.planetName) != null) {
+ Bukkit.unloadWorld(this.planetName, true);
+ }
+ return;
+ }
+ for (Planet each : ClayTech.getPlanets()) {
+ if (each.planetName.equalsIgnoreCase(this.planetName)) {
+ Utils.info("Registering Error: Planet" + this.planetName + "already exists!");
+ return;
+ }
+ }
+ ClayTech.getPlanets().add(this);
+ return;
+ }
+
+ if (!f.getBoolean(this.planetName) && !this.planetName.equalsIgnoreCase(ClayTech.getOverworld())) {
+ if (Bukkit.getWorld(this.planetName) != null) {
+ Bukkit.unloadWorld(this.planetName, true);
+ }
+ return;
+ }
+ for (Planet each : ClayTech.getPlanets()) {
+ if (each.planetName.equalsIgnoreCase(this.planetName)) {
+ Utils.info("Registering Error: Planet" + this.planetName + "already exists!");
+ return;
+ }
+ }
+ ClayTech.getPlanets().add(this);
+
+ WorldCreator newWorld = new WorldCreator(this.planetName);
+ if (Bukkit.getWorld(this.planetName) == null) {
+ newWorld.environment(this.environment);
+ long seed = new Random().nextLong();
+ newWorld = newWorld.seed(seed);
+ newWorld = newWorld.type(WorldType.NORMAL);
+ newWorld = newWorld.generateStructures(false);
+ newWorld = newWorld.generator("ClayTech:" + this.planetName);
+ World w = newWorld.createWorld();
+ if (this.cold) {
+ // 如果冷就不会下雨
+ w.setGameRule(GameRule.DO_WEATHER_CYCLE, false);
+ }
+
+ return;
+ }
+ newWorld.createWorld();
+
+ new BukkitRunnable() {
+
+ @Override
+ public void run() {
+ if (Bukkit.getPluginManager().isPluginEnabled("Multiverse-Core")) {
+ MVWorldManager wm = ((MultiverseCore) Bukkit.getPluginManager().getPlugin("Multiverse-Core"))
+ .getMVWorldManager();
+ wm.addWorld(trimWorldName(planetName), environment, null, WorldType.NORMAL, null,
+ "ClayTech:" + planetName, true);
+ }
+
+ }
+
+ }.runTaskAsynchronously(ClayTech.getInstance());
+ }
+
+ private String trimWorldName(String userInput) {
+ return userInput.replaceAll("^[./\\\\]+", "");
+ }
+
+ public int getDistance() {
+ return this.distance;
+ }
+
+ public void setDistance(int newDistance) {
+ this.distance = newDistance;
+ }
+
+ public int getHarmLevel() {
+ return this.harmlevel;
+ }
+
+ public void setHarmLevel(int newLevel) {
+ this.harmlevel = newLevel;
+ }
+
+ public boolean getHabitable() {
+ return this.habitable;
+ }
+
+ public void setHabitable(boolean habitable) {
+ this.habitable = habitable;
+ }
+
+ public boolean getCold() {
+ return this.cold;
+ }
+
+ public void setCold(boolean cold) {
+ this.cold = cold;
+ }
+
+ public boolean getMobSpawnable() {
+ return this.spawnMob;
+ }
+
+ public int getGravity() {
+ return this.gravity;
+ }
+
+ public void setGravity(int newGravity) {
+ this.gravity = newGravity;
+ }
+
+ public String getPlanetWorldName() {
+ return this.planetName;
+ }
+
+ public ItemStack getDisplayStack() {
+ return this.displayItem.clone();
+ }
+
+ public ChunkGenerator getPlanetGenerator() {
+ return this.planetWorld;
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/api/listeners/InjectOxygenEvent.java b/src/main/java/club/claycoffee/ClayTech/api/listeners/InjectOxygenEvent.java
index 25dd44e..7e54ca1 100644
--- a/src/main/java/club/claycoffee/ClayTech/api/listeners/InjectOxygenEvent.java
+++ b/src/main/java/club/claycoffee/ClayTech/api/listeners/InjectOxygenEvent.java
@@ -9,38 +9,36 @@
* Called when a item injected oxygen.当一个物品被注入氧气的时候触发.
*/
public class InjectOxygenEvent extends Event {
- private static final HandlerList handlers = new HandlerList();
- private Block machine;
- private ItemStack Item;
-
- public InjectOxygenEvent(Block machine, ItemStack Item) {
- this.Item = Item;
- this.machine = machine;
- }
-
- /**
- *
- * @return the item.物品
- */
- public ItemStack getItem() {
- return Item;
- }
-
- /**
- *
- * @return the injector.注入的机器.
- */
- public Block getMachine() {
- return machine;
- }
-
- @Override
- public HandlerList getHandlers() {
- return handlers;
- }
-
- public static HandlerList getHandlerList() {
- return handlers;
- }
+ private static final HandlerList handlers = new HandlerList();
+ private Block machine;
+ private ItemStack Item;
+
+ public InjectOxygenEvent(Block machine, ItemStack Item) {
+ this.Item = Item;
+ this.machine = machine;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ /**
+ * @return the item.物品
+ */
+ public ItemStack getItem() {
+ return Item;
+ }
+
+ /**
+ * @return the injector.注入的机器.
+ */
+ public Block getMachine() {
+ return machine;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/api/listeners/PlayerAssembleEvent.java b/src/main/java/club/claycoffee/ClayTech/api/listeners/PlayerAssembleEvent.java
index 11859d7..34ae551 100644
--- a/src/main/java/club/claycoffee/ClayTech/api/listeners/PlayerAssembleEvent.java
+++ b/src/main/java/club/claycoffee/ClayTech/api/listeners/PlayerAssembleEvent.java
@@ -9,36 +9,36 @@
* Called when a player assemble a item.当一个玩家组装物品的时候触发.
*/
public class PlayerAssembleEvent extends Event {
- private static final HandlerList handlers = new HandlerList();
- private Block machine;
- private ItemStack[] Recipe;
- private ItemStack AssembledItem;
-
- public PlayerAssembleEvent(Block machine, ItemStack[] Recipe, ItemStack AssembledItem) {
- this.Recipe = Recipe;
- this.AssembledItem = AssembledItem;
- this.machine = machine;
- }
-
- public ItemStack[] getRecipe() {
- return Recipe;
- }
-
- public ItemStack getAssembledItem() {
- return AssembledItem;
- }
-
- public Block getMachine() {
- return machine;
- }
-
- @Override
- public HandlerList getHandlers() {
- return handlers;
- }
-
- public static HandlerList getHandlerList() {
- return handlers;
- }
+ private static final HandlerList handlers = new HandlerList();
+ private Block machine;
+ private ItemStack[] Recipe;
+ private ItemStack AssembledItem;
+
+ public PlayerAssembleEvent(Block machine, ItemStack[] Recipe, ItemStack AssembledItem) {
+ this.Recipe = Recipe;
+ this.AssembledItem = AssembledItem;
+ this.machine = machine;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ public ItemStack[] getRecipe() {
+ return Recipe;
+ }
+
+ public ItemStack getAssembledItem() {
+ return AssembledItem;
+ }
+
+ public Block getMachine() {
+ return machine;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/api/listeners/PlayerCookItemEvent.java b/src/main/java/club/claycoffee/ClayTech/api/listeners/PlayerCookItemEvent.java
index 057eb5f..e50130e 100644
--- a/src/main/java/club/claycoffee/ClayTech/api/listeners/PlayerCookItemEvent.java
+++ b/src/main/java/club/claycoffee/ClayTech/api/listeners/PlayerCookItemEvent.java
@@ -9,48 +9,45 @@
* Called when a player cooked a item. 当一个玩家使用锅煮物品成功的时候触发.
*/
public class PlayerCookItemEvent extends Event {
- private static final HandlerList handlers = new HandlerList();
- private ItemStack[] Recipe;
- private ItemStack CraftedItem;
- private Block machine;
-
- public PlayerCookItemEvent(Block machine, ItemStack[] Recipe, ItemStack CraftedItem) {
- this.Recipe = Recipe;
- this.CraftedItem = CraftedItem;
- this.machine = machine;
- }
-
- /**
- *
- * @return the recipe.合成配方
- */
- public ItemStack[] getRecipe() {
- return Recipe;
- }
-
- /**
- *
- * @return the item just crafted.刚刚被合成的物品
- */
- public ItemStack getCraftedItem() {
- return CraftedItem;
- }
-
- /**
- *
- * @return the machine crafted the item.合成物品的机器.
- */
- public Block getMachine() {
- return machine;
- }
-
- @Override
- public HandlerList getHandlers() {
- return handlers;
- }
-
- public static HandlerList getHandlerList() {
- return handlers;
- }
+ private static final HandlerList handlers = new HandlerList();
+ private ItemStack[] Recipe;
+ private ItemStack CraftedItem;
+ private Block machine;
+
+ public PlayerCookItemEvent(Block machine, ItemStack[] Recipe, ItemStack CraftedItem) {
+ this.Recipe = Recipe;
+ this.CraftedItem = CraftedItem;
+ this.machine = machine;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ /**
+ * @return the recipe.合成配方
+ */
+ public ItemStack[] getRecipe() {
+ return Recipe;
+ }
+
+ /**
+ * @return the item just crafted.刚刚被合成的物品
+ */
+ public ItemStack getCraftedItem() {
+ return CraftedItem;
+ }
+
+ /**
+ * @return the machine crafted the item.合成物品的机器.
+ */
+ public Block getMachine() {
+ return machine;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/api/listeners/PlayerCraftItemEvent.java b/src/main/java/club/claycoffee/ClayTech/api/listeners/PlayerCraftItemEvent.java
index 48a30dc..08bed38 100644
--- a/src/main/java/club/claycoffee/ClayTech/api/listeners/PlayerCraftItemEvent.java
+++ b/src/main/java/club/claycoffee/ClayTech/api/listeners/PlayerCraftItemEvent.java
@@ -9,48 +9,45 @@
* Called when a player crafted a item. 当一个玩家使用粘土融合器合成物品成功的时候触发.
*/
public class PlayerCraftItemEvent extends Event {
- private static final HandlerList handlers = new HandlerList();
- private Block machine;
- private ItemStack[] Recipe;
- private ItemStack CraftedItem;
-
- public PlayerCraftItemEvent(Block machine, ItemStack[] Recipe, ItemStack CraftedItem) {
- this.Recipe = Recipe;
- this.CraftedItem = CraftedItem;
- this.machine = machine;
- }
-
- /**
- *
- * @return the recipe.合成配方
- */
- public ItemStack[] getRecipe() {
- return Recipe;
- }
-
- /**
- *
- * @return the item just crafted.刚刚被合成的物品
- */
- public ItemStack getCraftedItem() {
- return CraftedItem;
- }
-
- /**
- *
- * @return the machine crafted the item.合成物品的机器
- */
- public Block getMachine() {
- return machine;
- }
-
- @Override
- public HandlerList getHandlers() {
- return handlers;
- }
-
- public static HandlerList getHandlerList() {
- return handlers;
- }
+ private static final HandlerList handlers = new HandlerList();
+ private Block machine;
+ private ItemStack[] Recipe;
+ private ItemStack CraftedItem;
+
+ public PlayerCraftItemEvent(Block machine, ItemStack[] Recipe, ItemStack CraftedItem) {
+ this.Recipe = Recipe;
+ this.CraftedItem = CraftedItem;
+ this.machine = machine;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ /**
+ * @return the recipe.合成配方
+ */
+ public ItemStack[] getRecipe() {
+ return Recipe;
+ }
+
+ /**
+ * @return the item just crafted.刚刚被合成的物品
+ */
+ public ItemStack getCraftedItem() {
+ return CraftedItem;
+ }
+
+ /**
+ * @return the machine crafted the item.合成物品的机器
+ */
+ public Block getMachine() {
+ return machine;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/api/listeners/PlayerDrinkEvent.java b/src/main/java/club/claycoffee/ClayTech/api/listeners/PlayerDrinkEvent.java
index cca8195..80f0a2b 100644
--- a/src/main/java/club/claycoffee/ClayTech/api/listeners/PlayerDrinkEvent.java
+++ b/src/main/java/club/claycoffee/ClayTech/api/listeners/PlayerDrinkEvent.java
@@ -9,37 +9,35 @@
* Called when a player drank a food. 当一个玩家喝粘土科技中的饮料的时候触发.
*/
public class PlayerDrinkEvent extends Event {
- private Player eatPlayer;
- private ItemStack drink;
- private static final HandlerList handlers = new HandlerList();
+ private static final HandlerList handlers = new HandlerList();
+ private Player eatPlayer;
+ private ItemStack drink;
- public PlayerDrinkEvent(Player p, ItemStack ClayFoodStack) {
- this.eatPlayer = p;
- this.drink = ClayFoodStack;
- }
+ public PlayerDrinkEvent(Player p, ItemStack ClayFoodStack) {
+ this.eatPlayer = p;
+ this.drink = ClayFoodStack;
+ }
- /**
- *
- * @return the player who drank the food.喝饮料的玩家
- */
- public Player getPlayer() {
- return eatPlayer;
- }
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
- /**
- *
- * @return the drink drank by the player.被喝的饮料
- */
- public ItemStack getDrink() {
- return drink;
- }
+ /**
+ * @return the player who drank the food.喝饮料的玩家
+ */
+ public Player getPlayer() {
+ return eatPlayer;
+ }
- @Override
- public HandlerList getHandlers() {
- return handlers;
- }
+ /**
+ * @return the drink drank by the player.被喝的饮料
+ */
+ public ItemStack getDrink() {
+ return drink;
+ }
- public static HandlerList getHandlerList() {
- return handlers;
- }
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/api/listeners/PlayerEatEvent.java b/src/main/java/club/claycoffee/ClayTech/api/listeners/PlayerEatEvent.java
index d7d9ebc..f6cc6aa 100644
--- a/src/main/java/club/claycoffee/ClayTech/api/listeners/PlayerEatEvent.java
+++ b/src/main/java/club/claycoffee/ClayTech/api/listeners/PlayerEatEvent.java
@@ -9,37 +9,35 @@
* Called when a player ate a food. 当一个玩家吃粘土科技中的食物的时候触发.
*/
public class PlayerEatEvent extends Event {
- private Player eatPlayer;
- private ItemStack food;
- private static final HandlerList handlers = new HandlerList();
+ private static final HandlerList handlers = new HandlerList();
+ private Player eatPlayer;
+ private ItemStack food;
- public PlayerEatEvent(Player p, ItemStack ClayFoodStack) {
- this.eatPlayer = p;
- this.food = ClayFoodStack;
- }
+ public PlayerEatEvent(Player p, ItemStack ClayFoodStack) {
+ this.eatPlayer = p;
+ this.food = ClayFoodStack;
+ }
- /**
- *
- * @return the player who ate the food.吃食物的玩家
- */
- public Player getPlayer() {
- return eatPlayer;
- }
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
- /**
- *
- * @return the food eaten by the player.被吃的食物
- */
- public ItemStack getFood() {
- return food;
- }
+ /**
+ * @return the player who ate the food.吃食物的玩家
+ */
+ public Player getPlayer() {
+ return eatPlayer;
+ }
- @Override
- public HandlerList getHandlers() {
- return handlers;
- }
+ /**
+ * @return the food eaten by the player.被吃的食物
+ */
+ public ItemStack getFood() {
+ return food;
+ }
- public static HandlerList getHandlerList() {
- return handlers;
- }
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/api/listeners/PlayerExtractElementEvent.java b/src/main/java/club/claycoffee/ClayTech/api/listeners/PlayerExtractElementEvent.java
index bc8702d..0ca6903 100644
--- a/src/main/java/club/claycoffee/ClayTech/api/listeners/PlayerExtractElementEvent.java
+++ b/src/main/java/club/claycoffee/ClayTech/api/listeners/PlayerExtractElementEvent.java
@@ -9,47 +9,44 @@
* Called when a player extracted a item. 当一个玩家使用元素提取器提取元素成功的时候触发.
*/
public class PlayerExtractElementEvent extends Event {
- private static final HandlerList handlers = new HandlerList();
- private Block machine;
- private ItemStack[] Recipe;
- private ItemStack Element;
-
- public PlayerExtractElementEvent(Block machine, ItemStack[] Recipe, ItemStack Element) {
- this.Recipe = Recipe;
- this.Element = Element;
- this.machine = machine;
- }
-
- /**
- *
- * @return the recipe.合成配方
- */
- public ItemStack[] getRecipe() {
- return Recipe;
- }
-
- /**
- *
- * @return the element just extracted.刚刚提取成功的元素
- */
- public ItemStack getElement() {
- return Element;
- }
-
- /**
- *
- * @return the machine extracted the element.提取元素的机器
- */
- public Block getMachine() {
- return machine;
- }
-
- @Override
- public HandlerList getHandlers() {
- return handlers;
- }
-
- public static HandlerList getHandlerList() {
- return handlers;
- }
+ private static final HandlerList handlers = new HandlerList();
+ private Block machine;
+ private ItemStack[] Recipe;
+ private ItemStack Element;
+
+ public PlayerExtractElementEvent(Block machine, ItemStack[] Recipe, ItemStack Element) {
+ this.Recipe = Recipe;
+ this.Element = Element;
+ this.machine = machine;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ /**
+ * @return the recipe.合成配方
+ */
+ public ItemStack[] getRecipe() {
+ return Recipe;
+ }
+
+ /**
+ * @return the element just extracted.刚刚提取成功的元素
+ */
+ public ItemStack getElement() {
+ return Element;
+ }
+
+ /**
+ * @return the machine extracted the element.提取元素的机器
+ */
+ public Block getMachine() {
+ return machine;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/api/listeners/PlayerUseItemEvent.java b/src/main/java/club/claycoffee/ClayTech/api/listeners/PlayerUseItemEvent.java
index 0e62ecc..df8dca6 100644
--- a/src/main/java/club/claycoffee/ClayTech/api/listeners/PlayerUseItemEvent.java
+++ b/src/main/java/club/claycoffee/ClayTech/api/listeners/PlayerUseItemEvent.java
@@ -9,37 +9,35 @@
* Called when a player used a ClayTech item. 当一个玩家使用粘土科技中的物品时触发.
*/
public class PlayerUseItemEvent extends Event {
- private static final HandlerList handlers = new HandlerList();
- private Player player;
- private ItemStack item;
+ private static final HandlerList handlers = new HandlerList();
+ private Player player;
+ private ItemStack item;
- public PlayerUseItemEvent(Player player, ItemStack item) {
- this.player = player;
- this.item = item;
- }
+ public PlayerUseItemEvent(Player player, ItemStack item) {
+ this.player = player;
+ this.item = item;
+ }
- /**
- *
- * @return the player.玩家
- */
- public Player getPlayer() {
- return player;
- }
+ /**
+ * @return the player.玩家
+ */
+ public Player getPlayer() {
+ return player;
+ }
- /**
- *
- * @return the item.物品
- */
- public ItemStack getItem() {
- return item;
- }
+ /**
+ * @return the item.物品
+ */
+ public ItemStack getItem() {
+ return item;
+ }
- @Override
- public HandlerList getHandlers() {
- return handlers;
- }
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
- public HandlerList getHandlerList() {
- return handlers;
- }
+ public HandlerList getHandlerList() {
+ return handlers;
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/api/listeners/PlayerWashEvent.java b/src/main/java/club/claycoffee/ClayTech/api/listeners/PlayerWashEvent.java
index 7d857d4..d0c5462 100644
--- a/src/main/java/club/claycoffee/ClayTech/api/listeners/PlayerWashEvent.java
+++ b/src/main/java/club/claycoffee/ClayTech/api/listeners/PlayerWashEvent.java
@@ -9,47 +9,44 @@
* Called when a player washed a item. 当一个玩家使用水桶清洗某个物品成功的时候触发.
*/
public class PlayerWashEvent extends Event {
- private Player eatPlayer;
- private ItemStack Washthing;
- private ItemStack CleanedItem;
- private static final HandlerList handlers = new HandlerList();
-
- public PlayerWashEvent(Player p, ItemStack ClayDirtyStack, ItemStack CleanedItem) {
- this.eatPlayer = p;
- this.Washthing = ClayDirtyStack;
- this.CleanedItem = CleanedItem;
- }
-
- /**
- *
- * @return the player who washed the item.洗物品的玩家
- */
- public Player getPlayer() {
- return eatPlayer;
- }
-
- /**
- *
- * @return the item just washed.已经被清洗的脏物品
- */
- public ItemStack getItem() {
- return Washthing;
- }
-
- /**
- *
- * @return the item after washing.清洗后的干净物品
- */
- public ItemStack getCleanedItem() {
- return CleanedItem;
- }
-
- @Override
- public HandlerList getHandlers() {
- return handlers;
- }
-
- public static HandlerList getHandlerList() {
- return handlers;
- }
+ private static final HandlerList handlers = new HandlerList();
+ private Player eatPlayer;
+ private ItemStack Washthing;
+ private ItemStack CleanedItem;
+
+ public PlayerWashEvent(Player p, ItemStack ClayDirtyStack, ItemStack CleanedItem) {
+ this.eatPlayer = p;
+ this.Washthing = ClayDirtyStack;
+ this.CleanedItem = CleanedItem;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ /**
+ * @return the player who washed the item.洗物品的玩家
+ */
+ public Player getPlayer() {
+ return eatPlayer;
+ }
+
+ /**
+ * @return the item just washed.已经被清洗的脏物品
+ */
+ public ItemStack getItem() {
+ return Washthing;
+ }
+
+ /**
+ * @return the item after washing.清洗后的干净物品
+ */
+ public ItemStack getCleanedItem() {
+ return CleanedItem;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/api/listeners/RocketInjectFuelEvent.java b/src/main/java/club/claycoffee/ClayTech/api/listeners/RocketInjectFuelEvent.java
index ec3465f..b0d75a5 100644
--- a/src/main/java/club/claycoffee/ClayTech/api/listeners/RocketInjectFuelEvent.java
+++ b/src/main/java/club/claycoffee/ClayTech/api/listeners/RocketInjectFuelEvent.java
@@ -9,48 +9,45 @@
* Called when a rocket injected fuel.当一个火箭注入燃料的时候触发.
*/
public class RocketInjectFuelEvent extends Event {
- private static final HandlerList handlers = new HandlerList();
- private Block machine;
- private ItemStack Fuel;
- private ItemStack Rocket;
-
- public RocketInjectFuelEvent(Block machine, ItemStack Fuel, ItemStack Rocket) {
- this.Fuel = Fuel;
- this.Rocket = Rocket;
- this.machine = machine;
- }
-
- /**
- *
- * @return the fuel.燃料.
- */
- public ItemStack getFuel() {
- return Fuel;
- }
-
- /**
- *
- * @return the rocket.火箭
- */
- public ItemStack getRocket() {
- return Rocket;
- }
-
- /**
- *
- * @return the injector.注入的机器.
- */
- public Block getMachine() {
- return machine;
- }
-
- @Override
- public HandlerList getHandlers() {
- return handlers;
- }
-
- public static HandlerList getHandlerList() {
- return handlers;
- }
+ private static final HandlerList handlers = new HandlerList();
+ private Block machine;
+ private ItemStack Fuel;
+ private ItemStack Rocket;
+
+ public RocketInjectFuelEvent(Block machine, ItemStack Fuel, ItemStack Rocket) {
+ this.Fuel = Fuel;
+ this.Rocket = Rocket;
+ this.machine = machine;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ /**
+ * @return the fuel.燃料.
+ */
+ public ItemStack getFuel() {
+ return Fuel;
+ }
+
+ /**
+ * @return the rocket.火箭
+ */
+ public ItemStack getRocket() {
+ return Rocket;
+ }
+
+ /**
+ * @return the injector.注入的机器.
+ */
+ public Block getMachine() {
+ return machine;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/api/listeners/RocketLandEvent.java b/src/main/java/club/claycoffee/ClayTech/api/listeners/RocketLandEvent.java
index 60e0dc5..311c1fb 100644
--- a/src/main/java/club/claycoffee/ClayTech/api/listeners/RocketLandEvent.java
+++ b/src/main/java/club/claycoffee/ClayTech/api/listeners/RocketLandEvent.java
@@ -1,51 +1,50 @@
package club.claycoffee.ClayTech.api.listeners;
+import club.claycoffee.ClayTech.api.Planet;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.bukkit.inventory.ItemStack;
-import club.claycoffee.ClayTech.api.Planet;
-
/**
* Called when a rocket land.在火箭着陆的时候触发.
*/
public class RocketLandEvent extends Event {
- private Player onRocketPlayer;
- private Planet fromPlanet;
- private Planet toPlanet;
- private ItemStack rocket;
- private static final HandlerList handlers = new HandlerList();
-
- public RocketLandEvent(Player p, Planet fromPlanet, Planet toPlanet, ItemStack rocket) {
- this.onRocketPlayer = p;
- this.fromPlanet = fromPlanet;
- this.toPlanet = toPlanet;
- this.rocket = rocket;
- }
-
- public Player getPlayer() {
- return onRocketPlayer;
- }
-
- public ItemStack getRocket() {
- return rocket;
- }
-
- public Planet getFromPlanet() {
- return fromPlanet;
- }
-
- public Planet getToPlanet() {
- return toPlanet;
- }
-
- @Override
- public HandlerList getHandlers() {
- return handlers;
- }
-
- public static HandlerList getHandlerList() {
- return handlers;
- }
+ private static final HandlerList handlers = new HandlerList();
+ private Player onRocketPlayer;
+ private Planet fromPlanet;
+ private Planet toPlanet;
+ private ItemStack rocket;
+
+ public RocketLandEvent(Player p, Planet fromPlanet, Planet toPlanet, ItemStack rocket) {
+ this.onRocketPlayer = p;
+ this.fromPlanet = fromPlanet;
+ this.toPlanet = toPlanet;
+ this.rocket = rocket;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ public Player getPlayer() {
+ return onRocketPlayer;
+ }
+
+ public ItemStack getRocket() {
+ return rocket;
+ }
+
+ public Planet getFromPlanet() {
+ return fromPlanet;
+ }
+
+ public Planet getToPlanet() {
+ return toPlanet;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/Planets/Earth.java b/src/main/java/club/claycoffee/ClayTech/implementation/Planets/Earth.java
index 3f88b33..60f45b1 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/Planets/Earth.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/Planets/Earth.java
@@ -1,18 +1,17 @@
package club.claycoffee.ClayTech.implementation.Planets;
-import org.bukkit.Material;
-import org.bukkit.World.Environment;
-import org.bukkit.generator.ChunkGenerator;
-
import club.claycoffee.ClayTech.ClayTech;
import club.claycoffee.ClayTech.api.Planet;
import club.claycoffee.ClayTech.utils.Lang;
import club.claycoffee.ClayTech.utils.Utils;
+import org.bukkit.Material;
+import org.bukkit.World.Environment;
+import org.bukkit.generator.ChunkGenerator;
public class Earth extends ChunkGenerator {
- public Earth() {
- new Planet(ClayTech.getOverworld(),
- Utils.newItemD(Material.GREEN_GLAZED_TERRACOTTA, Lang.readPlanetsText("Earth")), this,
- Environment.NORMAL, true, 1, 0, 0, false).register();
- }
+ public Earth() {
+ new Planet(ClayTech.getOverworld(),
+ Utils.newItemD(Material.GREEN_GLAZED_TERRACOTTA, Lang.readPlanetsText("Earth")), this,
+ Environment.NORMAL, true, 1, 0, 0, false).register();
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/Planets/Mars.java b/src/main/java/club/claycoffee/ClayTech/implementation/Planets/Mars.java
index 2864378..ce5fb26 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/Planets/Mars.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/Planets/Mars.java
@@ -1,8 +1,8 @@
package club.claycoffee.ClayTech.implementation.Planets;
-import java.util.Arrays;
-import java.util.Random;
-
+import club.claycoffee.ClayTech.api.Planet;
+import club.claycoffee.ClayTech.utils.Lang;
+import club.claycoffee.ClayTech.utils.Utils;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.World.Environment;
@@ -10,82 +10,81 @@
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.util.noise.SimplexOctaveGenerator;
-import club.claycoffee.ClayTech.api.Planet;
-import club.claycoffee.ClayTech.utils.Lang;
-import club.claycoffee.ClayTech.utils.Utils;
+import java.util.Arrays;
+import java.util.Random;
public class Mars extends ChunkGenerator {
- private SimplexOctaveGenerator sog;
-
- public Mars() {
- new Planet("CMars", Utils.newItemD(Material.YELLOW_GLAZED_TERRACOTTA, Lang.readPlanetsText("Mars")), this,
- Environment.NORMAL, true, 1, 100, 0, false).register();
- }
-
- @SuppressWarnings("deprecation")
- @Override
- public ChunkData generateChunkData(World world, Random random, int chunkX, int chunkZ, BiomeGrid biome) {
- ChunkData chunkData = createChunkData(world);
- if (sog == null) {
- sog = new SimplexOctaveGenerator(world.getSeed(), 1);
- sog.setScale(0.00125D);
- }
- // 最低一层为基岩
- chunkData.setRegion(0, 0, 0, 16, 1, 16, Material.BEDROCK);
- for (int x = 0; x < 16; x++) {
- for (int z = 0; z < 16; z++) {
- int realX = chunkX * 16 + x;
- int realZ = chunkZ * 16 + z;
- double noise1 = sog.noise(realX, realZ, 5D, 12D);
- double noise2 = sog.noise(realX, realZ, 128D, 6D);
- double noise3 = sog.noise(realX, realZ, 8D, 128D);
- double noise4 = sog.noise(realX, realZ, 256D, 16D);
- double noise5 = sog.noise(realX, realZ, 64D, 188D);
-
- double[] sort = new double[] { noise1, noise2, noise3, noise4, noise5 };
- Arrays.sort(sort);
-
- double basicNoiseValue = sort[0];
-
- int basicHeight = (int) (basicNoiseValue * 40D + 45D);
- int finalHeight = basicHeight;
- finalHeight += 7D;
-
- chunkData.setBlock(x, 0, z, Material.BEDROCK);
-
- for (int eh = 1; eh < finalHeight - 1; eh++) {
- chunkData.setBlock(x, eh, z, Material.STONE);
- }
-
- double c1 = random.nextDouble();
- if (c1 >= 0.4) {
- // 生成沙砾
- chunkData.setBlock(x, finalHeight - 1, z, Material.GRAVEL);
- } else if (c1 <= 0.4 && c1 >= 0.3) {
- // 生成红沙
- chunkData.setBlock(x, finalHeight - 1, z, Material.RED_SAND);
- } else {
- chunkData.setBlock(x, finalHeight - 1, z, Material.RED_SANDSTONE);
- }
-
- // 最顶端红沙石覆盖
- chunkData.setBlock(x, finalHeight, z, Material.RED_SANDSTONE);
-
- if (finalHeight + 1 <= 57) {
- for (int i = 57; i >= finalHeight + 1; i--) {
- chunkData.setBlock(x, i, z, Material.LAVA);
- }
- } else if (finalHeight + 1 <= 60) {
- for (int i = 60; i >= finalHeight + 1; i--) {
- chunkData.setBlock(x, i, z, Material.RED_SANDSTONE);
- }
- }
-
- biome.setBiome(x, z, Biome.DESERT);
- }
- }
- return chunkData;
- }
+ private SimplexOctaveGenerator sog;
+
+ public Mars() {
+ new Planet("CMars", Utils.newItemD(Material.YELLOW_GLAZED_TERRACOTTA, Lang.readPlanetsText("Mars")), this,
+ Environment.NORMAL, true, 1, 100, 0, false).register();
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public ChunkData generateChunkData(World world, Random random, int chunkX, int chunkZ, BiomeGrid biome) {
+ ChunkData chunkData = createChunkData(world);
+ if (sog == null) {
+ sog = new SimplexOctaveGenerator(world.getSeed(), 1);
+ sog.setScale(0.00125D);
+ }
+ // 最低一层为基岩
+ chunkData.setRegion(0, 0, 0, 16, 1, 16, Material.BEDROCK);
+ for (int x = 0; x < 16; x++) {
+ for (int z = 0; z < 16; z++) {
+ int realX = chunkX * 16 + x;
+ int realZ = chunkZ * 16 + z;
+ double noise1 = sog.noise(realX, realZ, 5D, 12D);
+ double noise2 = sog.noise(realX, realZ, 128D, 6D);
+ double noise3 = sog.noise(realX, realZ, 8D, 128D);
+ double noise4 = sog.noise(realX, realZ, 256D, 16D);
+ double noise5 = sog.noise(realX, realZ, 64D, 188D);
+
+ double[] sort = new double[]{noise1, noise2, noise3, noise4, noise5};
+ Arrays.sort(sort);
+
+ double basicNoiseValue = sort[0];
+
+ int basicHeight = (int) (basicNoiseValue * 40D + 45D);
+ int finalHeight = basicHeight;
+ finalHeight += 7D;
+
+ chunkData.setBlock(x, 0, z, Material.BEDROCK);
+
+ for (int eh = 1; eh < finalHeight - 1; eh++) {
+ chunkData.setBlock(x, eh, z, Material.STONE);
+ }
+
+ double c1 = random.nextDouble();
+ if (c1 >= 0.4) {
+ // 生成沙砾
+ chunkData.setBlock(x, finalHeight - 1, z, Material.GRAVEL);
+ } else if (c1 <= 0.4 && c1 >= 0.3) {
+ // 生成红沙
+ chunkData.setBlock(x, finalHeight - 1, z, Material.RED_SAND);
+ } else {
+ chunkData.setBlock(x, finalHeight - 1, z, Material.RED_SANDSTONE);
+ }
+
+ // 最顶端红沙石覆盖
+ chunkData.setBlock(x, finalHeight, z, Material.RED_SANDSTONE);
+
+ if (finalHeight + 1 <= 57) {
+ for (int i = 57; i >= finalHeight + 1; i--) {
+ chunkData.setBlock(x, i, z, Material.LAVA);
+ }
+ } else if (finalHeight + 1 <= 60) {
+ for (int i = 60; i >= finalHeight + 1; i--) {
+ chunkData.setBlock(x, i, z, Material.RED_SANDSTONE);
+ }
+ }
+
+ biome.setBiome(x, z, Biome.DESERT);
+ }
+ }
+ return chunkData;
+ }
// @Override
// public List getDefaultPopulators(World world) {
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/Planets/Moon.java b/src/main/java/club/claycoffee/ClayTech/implementation/Planets/Moon.java
index dea44eb..6c5e27a 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/Planets/Moon.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/Planets/Moon.java
@@ -1,73 +1,66 @@
package club.claycoffee.ClayTech.implementation.Planets;
-import java.util.List;
-import java.util.Random;
-
+import club.claycoffee.ClayTech.api.Planet;
+import club.claycoffee.ClayTech.implementation.Planets.populators.*;
+import club.claycoffee.ClayTech.utils.Lang;
+import club.claycoffee.ClayTech.utils.Utils;
+import com.google.common.collect.ImmutableList;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.World.Environment;
import org.bukkit.block.Biome;
import org.bukkit.generator.BlockPopulator;
import org.bukkit.generator.ChunkGenerator;
-
-import club.claycoffee.ClayTech.api.Planet;
-import club.claycoffee.ClayTech.implementation.Planets.populators.MoonClayFusionOrePopulator;
-import club.claycoffee.ClayTech.implementation.Planets.populators.MoonCoalPopulator;
-import club.claycoffee.ClayTech.implementation.Planets.populators.MoonCopperOrePopulator;
-import club.claycoffee.ClayTech.implementation.Planets.populators.MoonDiamondPopulator;
-import club.claycoffee.ClayTech.implementation.Planets.populators.MoonKreepPopulator;
-import club.claycoffee.ClayTech.utils.Lang;
-import club.claycoffee.ClayTech.utils.Utils;
-
import org.bukkit.util.noise.SimplexOctaveGenerator;
-import com.google.common.collect.ImmutableList;
+import java.util.List;
+import java.util.Random;
public class Moon extends ChunkGenerator {
- private SimplexOctaveGenerator sog;
+ private SimplexOctaveGenerator sog;
- public Moon() {
- new Planet("CMoon", Utils.newItemD(Material.GRAY_GLAZED_TERRACOTTA, Lang.readPlanetsText("Moon")), this,
- Environment.NORMAL, false, 3, 100, 1, true).register();
- }
+ public Moon() {
+ new Planet("CMoon", Utils.newItemD(Material.GRAY_GLAZED_TERRACOTTA, Lang.readPlanetsText("Moon")), this,
+ Environment.NORMAL, false, 3, 100, 1, true).register();
+ }
- @SuppressWarnings("deprecation")
- @Override
- public ChunkData generateChunkData(World world, Random random, int chunkX, int chunkZ, BiomeGrid biome) {
- ChunkData chunkData = createChunkData(world);
- if (sog == null) {
- sog = new SimplexOctaveGenerator(world.getSeed(), 1);
- sog.setScale(0.0025D);
- }
- // 最低一层为基岩
- chunkData.setRegion(0, 0, 0, 16, 1, 16, Material.BEDROCK);
- for (int x = 0; x < 16; x++) {
- for (int z = 0; z < 16; z++) {
- int realX = chunkX * 16 + x;
- int realZ = chunkZ * 16 + z;
- double noiseValue = sog.noise(realX, realZ, Math.random(), Math.random());
- int height;
- height = (int) (Math.pow(noiseValue, 2) * 40D + 90D);
- for (int y = 1; y < height; y++) {
- chunkData.setBlock(x, y, z, Material.STONE);
- }
- if (height <= 66) {
- for (; height <= 66; height++) {
- chunkData.setBlock(x, height, z, Material.LAVA);
- }
- } else {
- chunkData.setBlock(x, height, z, Material.END_STONE);
- }
- biome.setBiome(x, z, Biome.THE_END);
+ @SuppressWarnings("deprecation")
+ @Override
+ public ChunkData generateChunkData(World world, Random random, int chunkX, int chunkZ, BiomeGrid biome) {
+ ChunkData chunkData = createChunkData(world);
+ if (sog == null) {
+ sog = new SimplexOctaveGenerator(world.getSeed(), 1);
+ sog.setScale(0.0025D);
+ }
+ // 最低一层为基岩
+ chunkData.setRegion(0, 0, 0, 16, 1, 16, Material.BEDROCK);
+ for (int x = 0; x < 16; x++) {
+ for (int z = 0; z < 16; z++) {
+ int realX = chunkX * 16 + x;
+ int realZ = chunkZ * 16 + z;
+ double noiseValue = sog.noise(realX, realZ, Math.random(), Math.random());
+ int height;
+ height = (int) (Math.pow(noiseValue, 2) * 40D + 90D);
+ for (int y = 1; y < height; y++) {
+ chunkData.setBlock(x, y, z, Material.STONE);
+ }
+ if (height <= 66) {
+ for (; height <= 66; height++) {
+ chunkData.setBlock(x, height, z, Material.LAVA);
+ }
+ } else {
+ chunkData.setBlock(x, height, z, Material.END_STONE);
+ }
+ biome.setBiome(x, z, Biome.THE_END);
- }
- }
- return chunkData;
- }
+ }
+ }
+ return chunkData;
+ }
- @Override
- public List getDefaultPopulators(World world) {
- return ImmutableList.of(new MoonKreepPopulator(), new MoonDiamondPopulator(), new MoonCoalPopulator(),
- new MoonCopperOrePopulator(), new MoonClayFusionOrePopulator());
- }
+ @Override
+ public List getDefaultPopulators(World world) {
+ return ImmutableList.of(new MoonKreepPopulator(), new MoonDiamondPopulator(), new MoonCoalPopulator(),
+ new MoonCopperOrePopulator(), new MoonClayFusionOrePopulator());
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/Planets/populators/MoonClayFusionOrePopulator.java b/src/main/java/club/claycoffee/ClayTech/implementation/Planets/populators/MoonClayFusionOrePopulator.java
index f783710..87ba353 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/Planets/populators/MoonClayFusionOrePopulator.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/Planets/populators/MoonClayFusionOrePopulator.java
@@ -1,7 +1,9 @@
package club.claycoffee.ClayTech.implementation.Planets.populators;
-import java.util.Random;
-
+import club.claycoffee.ClayTech.ClayTech;
+import club.claycoffee.ClayTech.ClayTechItems;
+import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import me.mrCookieSlime.Slimefun.api.BlockStorage;
import org.bukkit.Chunk;
import org.bukkit.Material;
import org.bukkit.World;
@@ -10,79 +12,76 @@
import org.bukkit.scheduler.BukkitRunnable;
import org.eclipse.jdt.annotation.NonNull;
-import club.claycoffee.ClayTech.ClayTech;
-import club.claycoffee.ClayTech.ClayTechItems;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
-import me.mrCookieSlime.Slimefun.api.BlockStorage;
+import java.util.Random;
public class MoonClayFusionOrePopulator extends BlockPopulator {
- @Override
- public void populate(@NonNull World world, @NonNull Random random, @NonNull Chunk source) {
- new BukkitRunnable() {
+ @Override
+ public void populate(@NonNull World world, @NonNull Random random, @NonNull Chunk source) {
+ new BukkitRunnable() {
- @Override
- public void run() {
- int tryc = 3 + random.nextInt(2);
- for (int i = 0; i < tryc; i++) {
- int x = random.nextInt(16);
- int y = random.nextInt(100) + 1;
- int z = random.nextInt(16);
- int count = 0;
- while (random.nextDouble() < 0.85D && count <= 6 || count <= 3) {
- final int tx = x;
- final int ty = y;
- final int tz = z;
- Block sourceb = source.getBlock(x, y, z);
- if (sourceb.getType() == Material.STONE) {
- if (sourceb.getType() == Material.STONE) {
- if (!SlimefunPlugin.getRegistry().getWorlds().containsKey(world.getName())) {
- BlockStorage bs = new BlockStorage(world);
- SlimefunPlugin.getRegistry().getWorlds().put(world.getName(), bs);
- }
- new BukkitRunnable() {
+ @Override
+ public void run() {
+ int tryc = 3 + random.nextInt(2);
+ for (int i = 0; i < tryc; i++) {
+ int x = random.nextInt(16);
+ int y = random.nextInt(100) + 1;
+ int z = random.nextInt(16);
+ int count = 0;
+ while (random.nextDouble() < 0.85D && count <= 6 || count <= 3) {
+ final int tx = x;
+ final int ty = y;
+ final int tz = z;
+ Block sourceb = source.getBlock(x, y, z);
+ if (sourceb.getType() == Material.STONE) {
+ if (sourceb.getType() == Material.STONE) {
+ if (!SlimefunPlugin.getRegistry().getWorlds().containsKey(world.getName())) {
+ BlockStorage bs = new BlockStorage(world);
+ SlimefunPlugin.getRegistry().getWorlds().put(world.getName(), bs);
+ }
+ new BukkitRunnable() {
- @Override
- public void run() {
- source.getBlock(tx, ty, tz).setType(ClayTechItems.CLAY_FUSION_ORE.getType(),
- false);
- BlockStorage.addBlockInfo(source.getBlock(tx, ty, tz), "id", "CLAY_FUSION_ORE",
- true);
+ @Override
+ public void run() {
+ source.getBlock(tx, ty, tz).setType(ClayTechItems.CLAY_FUSION_ORE.getType(),
+ false);
+ BlockStorage.addBlockInfo(source.getBlock(tx, ty, tz), "id", "CLAY_FUSION_ORE",
+ true);
- }
+ }
- }.runTask(ClayTech.getInstance());
- count++;
- }
- }
+ }.runTask(ClayTech.getInstance());
+ count++;
+ }
+ }
- switch (random.nextInt(6)) {
- case 0:
- x = Math.min(x + 1, 15);
- break;
- case 1:
- y = Math.min(y + 1, 15);
- break;
- case 2:
- z = Math.min(z + 1, 15);
- break;
- case 3:
- x = Math.max(x - 1, 0);
- break;
- case 4:
- y = Math.max(y - 1, 1);
- break;
- default:
- z = Math.max(z - 1, 0);
- break;
- }
- }
+ switch (random.nextInt(6)) {
+ case 0:
+ x = Math.min(x + 1, 15);
+ break;
+ case 1:
+ y = Math.min(y + 1, 15);
+ break;
+ case 2:
+ z = Math.min(z + 1, 15);
+ break;
+ case 3:
+ x = Math.max(x - 1, 0);
+ break;
+ case 4:
+ y = Math.max(y - 1, 1);
+ break;
+ default:
+ z = Math.max(z - 1, 0);
+ break;
+ }
+ }
- }
+ }
- }
+ }
- }.runTaskAsynchronously(ClayTech.getInstance());
- }
+ }.runTaskAsynchronously(ClayTech.getInstance());
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/Planets/populators/MoonCoalPopulator.java b/src/main/java/club/claycoffee/ClayTech/implementation/Planets/populators/MoonCoalPopulator.java
index 2d17204..9fc224f 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/Planets/populators/MoonCoalPopulator.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/Planets/populators/MoonCoalPopulator.java
@@ -1,7 +1,8 @@
package club.claycoffee.ClayTech.implementation.Planets.populators;
-import java.util.Random;
-
+import club.claycoffee.ClayTech.ClayTech;
+import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import me.mrCookieSlime.Slimefun.api.BlockStorage;
import org.bukkit.Chunk;
import org.bukkit.Material;
import org.bukkit.World;
@@ -10,76 +11,74 @@
import org.bukkit.scheduler.BukkitRunnable;
import org.eclipse.jdt.annotation.NonNull;
-import club.claycoffee.ClayTech.ClayTech;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
-import me.mrCookieSlime.Slimefun.api.BlockStorage;
+import java.util.Random;
public class MoonCoalPopulator extends BlockPopulator {
- @Override
- public void populate(@NonNull World world, @NonNull Random random, @NonNull Chunk source) {
- new BukkitRunnable() {
+ @Override
+ public void populate(@NonNull World world, @NonNull Random random, @NonNull Chunk source) {
+ new BukkitRunnable() {
- @Override
- public void run() {
- int tryc = 8 + random.nextInt(3);
- for (int i = 0; i < tryc; i++) {
- int x = random.nextInt(16);
- int y = random.nextInt(100) + 1;
- int z = random.nextInt(16);
- int count = 0;
- while (random.nextDouble() < 0.94D && count <= 18 || count <= 12) {
- final int tx = x;
- final int ty = y;
- final int tz = z;
- Block sourceb = source.getBlock(x, y, z);
- if (sourceb.getType() == Material.STONE) {
- if (sourceb.getType() == Material.STONE) {
- if (!SlimefunPlugin.getRegistry().getWorlds().containsKey(world.getName())) {
- BlockStorage bs = new BlockStorage(world);
- SlimefunPlugin.getRegistry().getWorlds().put(world.getName(), bs);
- }
- new BukkitRunnable() {
+ @Override
+ public void run() {
+ int tryc = 8 + random.nextInt(3);
+ for (int i = 0; i < tryc; i++) {
+ int x = random.nextInt(16);
+ int y = random.nextInt(100) + 1;
+ int z = random.nextInt(16);
+ int count = 0;
+ while (random.nextDouble() < 0.94D && count <= 18 || count <= 12) {
+ final int tx = x;
+ final int ty = y;
+ final int tz = z;
+ Block sourceb = source.getBlock(x, y, z);
+ if (sourceb.getType() == Material.STONE) {
+ if (sourceb.getType() == Material.STONE) {
+ if (!SlimefunPlugin.getRegistry().getWorlds().containsKey(world.getName())) {
+ BlockStorage bs = new BlockStorage(world);
+ SlimefunPlugin.getRegistry().getWorlds().put(world.getName(), bs);
+ }
+ new BukkitRunnable() {
- @Override
- public void run() {
- source.getBlock(tx, ty, tz).setType(Material.COAL_ORE, false);
+ @Override
+ public void run() {
+ source.getBlock(tx, ty, tz).setType(Material.COAL_ORE, false);
- }
+ }
- }.runTask(ClayTech.getInstance());
- count++;
- }
- }
+ }.runTask(ClayTech.getInstance());
+ count++;
+ }
+ }
- switch (random.nextInt(6)) {
- case 0:
- x = Math.min(x + 1, 15);
- break;
- case 1:
- y = Math.min(y + 1, 15);
- break;
- case 2:
- z = Math.min(z + 1, 15);
- break;
- case 3:
- x = Math.max(x - 1, 0);
- break;
- case 4:
- y = Math.max(y - 1, 1);
- break;
- default:
- z = Math.max(z - 1, 0);
- break;
- }
- }
+ switch (random.nextInt(6)) {
+ case 0:
+ x = Math.min(x + 1, 15);
+ break;
+ case 1:
+ y = Math.min(y + 1, 15);
+ break;
+ case 2:
+ z = Math.min(z + 1, 15);
+ break;
+ case 3:
+ x = Math.max(x - 1, 0);
+ break;
+ case 4:
+ y = Math.max(y - 1, 1);
+ break;
+ default:
+ z = Math.max(z - 1, 0);
+ break;
+ }
+ }
- }
+ }
- }
+ }
- }.runTaskAsynchronously(ClayTech.getInstance());
+ }.runTaskAsynchronously(ClayTech.getInstance());
- }
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/Planets/populators/MoonCopperOrePopulator.java b/src/main/java/club/claycoffee/ClayTech/implementation/Planets/populators/MoonCopperOrePopulator.java
index 0af761d..67a769a 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/Planets/populators/MoonCopperOrePopulator.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/Planets/populators/MoonCopperOrePopulator.java
@@ -1,7 +1,9 @@
package club.claycoffee.ClayTech.implementation.Planets.populators;
-import java.util.Random;
-
+import club.claycoffee.ClayTech.ClayTech;
+import club.claycoffee.ClayTech.ClayTechItems;
+import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import me.mrCookieSlime.Slimefun.api.BlockStorage;
import org.bukkit.Chunk;
import org.bukkit.Material;
import org.bukkit.World;
@@ -10,79 +12,76 @@
import org.bukkit.scheduler.BukkitRunnable;
import org.eclipse.jdt.annotation.NonNull;
-import club.claycoffee.ClayTech.ClayTech;
-import club.claycoffee.ClayTech.ClayTechItems;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
-import me.mrCookieSlime.Slimefun.api.BlockStorage;
+import java.util.Random;
public class MoonCopperOrePopulator extends BlockPopulator {
- @Override
- public void populate(@NonNull World world, @NonNull Random random, @NonNull Chunk source) {
- new BukkitRunnable() {
+ @Override
+ public void populate(@NonNull World world, @NonNull Random random, @NonNull Chunk source) {
+ new BukkitRunnable() {
- @Override
- public void run() {
- int tryc = 5 + random.nextInt(4);
- for (int i = 0; i < tryc; i++) {
- int x = random.nextInt(16);
- int y = random.nextInt(100) + 1;
- int z = random.nextInt(16);
- int count = 0;
- while (random.nextDouble() < 0.92D && count <= 8 || count <= 5) {
- final int tx = x;
- final int ty = y;
- final int tz = z;
- Block sourceb = source.getBlock(x, y, z);
- if (sourceb.getType() == Material.STONE) {
- if (sourceb.getType() == Material.STONE) {
- if (!SlimefunPlugin.getRegistry().getWorlds().containsKey(world.getName())) {
- BlockStorage bs = new BlockStorage(world);
- SlimefunPlugin.getRegistry().getWorlds().put(world.getName(), bs);
- }
- new BukkitRunnable() {
+ @Override
+ public void run() {
+ int tryc = 5 + random.nextInt(4);
+ for (int i = 0; i < tryc; i++) {
+ int x = random.nextInt(16);
+ int y = random.nextInt(100) + 1;
+ int z = random.nextInt(16);
+ int count = 0;
+ while (random.nextDouble() < 0.92D && count <= 8 || count <= 5) {
+ final int tx = x;
+ final int ty = y;
+ final int tz = z;
+ Block sourceb = source.getBlock(x, y, z);
+ if (sourceb.getType() == Material.STONE) {
+ if (sourceb.getType() == Material.STONE) {
+ if (!SlimefunPlugin.getRegistry().getWorlds().containsKey(world.getName())) {
+ BlockStorage bs = new BlockStorage(world);
+ SlimefunPlugin.getRegistry().getWorlds().put(world.getName(), bs);
+ }
+ new BukkitRunnable() {
- @Override
- public void run() {
- source.getBlock(tx, ty, tz).setType(ClayTechItems.COPPER_ORE.getType(), false);
- BlockStorage.addBlockInfo(source.getBlock(tx, ty, tz), "id", "COPPER_ORE",
- true);
+ @Override
+ public void run() {
+ source.getBlock(tx, ty, tz).setType(ClayTechItems.COPPER_ORE.getType(), false);
+ BlockStorage.addBlockInfo(source.getBlock(tx, ty, tz), "id", "COPPER_ORE",
+ true);
- }
+ }
- }.runTask(ClayTech.getInstance());
- count++;
- }
- }
+ }.runTask(ClayTech.getInstance());
+ count++;
+ }
+ }
- switch (random.nextInt(6)) {
- case 0:
- x = Math.min(x + 1, 15);
- break;
- case 1:
- y = Math.min(y + 1, 15);
- break;
- case 2:
- z = Math.min(z + 1, 15);
- break;
- case 3:
- x = Math.max(x - 1, 0);
- break;
- case 4:
- y = Math.max(y - 1, 1);
- break;
- default:
- z = Math.max(z - 1, 0);
- break;
- }
- }
+ switch (random.nextInt(6)) {
+ case 0:
+ x = Math.min(x + 1, 15);
+ break;
+ case 1:
+ y = Math.min(y + 1, 15);
+ break;
+ case 2:
+ z = Math.min(z + 1, 15);
+ break;
+ case 3:
+ x = Math.max(x - 1, 0);
+ break;
+ case 4:
+ y = Math.max(y - 1, 1);
+ break;
+ default:
+ z = Math.max(z - 1, 0);
+ break;
+ }
+ }
- }
+ }
- }
+ }
- }.runTaskAsynchronously(ClayTech.getInstance());
+ }.runTaskAsynchronously(ClayTech.getInstance());
- }
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/Planets/populators/MoonDiamondPopulator.java b/src/main/java/club/claycoffee/ClayTech/implementation/Planets/populators/MoonDiamondPopulator.java
index bb3d6d0..ab0f59f 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/Planets/populators/MoonDiamondPopulator.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/Planets/populators/MoonDiamondPopulator.java
@@ -1,7 +1,8 @@
package club.claycoffee.ClayTech.implementation.Planets.populators;
-import java.util.Random;
-
+import club.claycoffee.ClayTech.ClayTech;
+import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import me.mrCookieSlime.Slimefun.api.BlockStorage;
import org.bukkit.Chunk;
import org.bukkit.Material;
import org.bukkit.World;
@@ -10,74 +11,72 @@
import org.bukkit.scheduler.BukkitRunnable;
import org.eclipse.jdt.annotation.NonNull;
-import club.claycoffee.ClayTech.ClayTech;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
-import me.mrCookieSlime.Slimefun.api.BlockStorage;
+import java.util.Random;
public class MoonDiamondPopulator extends BlockPopulator {
- @Override
- public void populate(@NonNull World world, @NonNull Random random, @NonNull Chunk source) {
- new BukkitRunnable() {
+ @Override
+ public void populate(@NonNull World world, @NonNull Random random, @NonNull Chunk source) {
+ new BukkitRunnable() {
- @Override
- public void run() {
- int tryc = 3 + random.nextInt(2);
- for (int i = 0; i < tryc; i++) {
- int x = random.nextInt(16);
- int y = random.nextInt(100) + 1;
- int z = random.nextInt(16);
- int count = 0;
- while (random.nextDouble() < 0.9D && count <= 12 || count <= 7) {
- final int tx = x;
- final int ty = y;
- final int tz = z;
- Block sourceb = source.getBlock(x, y, z);
- if (sourceb.getType() == Material.STONE) {
- if (sourceb.getType() == Material.STONE) {
- if (!SlimefunPlugin.getRegistry().getWorlds().containsKey(world.getName())) {
- BlockStorage bs = new BlockStorage(world);
- SlimefunPlugin.getRegistry().getWorlds().put(world.getName(), bs);
- }
- new BukkitRunnable() {
+ @Override
+ public void run() {
+ int tryc = 3 + random.nextInt(2);
+ for (int i = 0; i < tryc; i++) {
+ int x = random.nextInt(16);
+ int y = random.nextInt(100) + 1;
+ int z = random.nextInt(16);
+ int count = 0;
+ while (random.nextDouble() < 0.9D && count <= 12 || count <= 7) {
+ final int tx = x;
+ final int ty = y;
+ final int tz = z;
+ Block sourceb = source.getBlock(x, y, z);
+ if (sourceb.getType() == Material.STONE) {
+ if (sourceb.getType() == Material.STONE) {
+ if (!SlimefunPlugin.getRegistry().getWorlds().containsKey(world.getName())) {
+ BlockStorage bs = new BlockStorage(world);
+ SlimefunPlugin.getRegistry().getWorlds().put(world.getName(), bs);
+ }
+ new BukkitRunnable() {
- @Override
- public void run() {
- source.getBlock(tx, ty, tz).setType(Material.DIAMOND_ORE, false);
+ @Override
+ public void run() {
+ source.getBlock(tx, ty, tz).setType(Material.DIAMOND_ORE, false);
- }
+ }
- }.runTask(ClayTech.getInstance());
- count++;
- }
- }
+ }.runTask(ClayTech.getInstance());
+ count++;
+ }
+ }
- switch (random.nextInt(6)) {
- case 0:
- x = Math.min(x + 1, 15);
- break;
- case 1:
- y = Math.min(y + 1, 15);
- break;
- case 2:
- z = Math.min(z + 1, 15);
- break;
- case 3:
- x = Math.max(x - 1, 0);
- break;
- case 4:
- y = Math.max(y - 1, 1);
- break;
- default:
- z = Math.max(z - 1, 0);
- break;
- }
- }
- }
+ switch (random.nextInt(6)) {
+ case 0:
+ x = Math.min(x + 1, 15);
+ break;
+ case 1:
+ y = Math.min(y + 1, 15);
+ break;
+ case 2:
+ z = Math.min(z + 1, 15);
+ break;
+ case 3:
+ x = Math.max(x - 1, 0);
+ break;
+ case 4:
+ y = Math.max(y - 1, 1);
+ break;
+ default:
+ z = Math.max(z - 1, 0);
+ break;
+ }
+ }
+ }
- }
+ }
- }.runTaskAsynchronously(ClayTech.getInstance());
- }
+ }.runTaskAsynchronously(ClayTech.getInstance());
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/Planets/populators/MoonKreepPopulator.java b/src/main/java/club/claycoffee/ClayTech/implementation/Planets/populators/MoonKreepPopulator.java
index fbd8cae..6248d73 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/Planets/populators/MoonKreepPopulator.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/Planets/populators/MoonKreepPopulator.java
@@ -1,7 +1,9 @@
package club.claycoffee.ClayTech.implementation.Planets.populators;
-import java.util.Random;
-
+import club.claycoffee.ClayTech.ClayTech;
+import club.claycoffee.ClayTech.ClayTechItems;
+import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import me.mrCookieSlime.Slimefun.api.BlockStorage;
import org.bukkit.Chunk;
import org.bukkit.Material;
import org.bukkit.World;
@@ -9,71 +11,68 @@
import org.bukkit.scheduler.BukkitRunnable;
import org.eclipse.jdt.annotation.NonNull;
-import club.claycoffee.ClayTech.ClayTech;
-import club.claycoffee.ClayTech.ClayTechItems;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
-import me.mrCookieSlime.Slimefun.api.BlockStorage;
+import java.util.Random;
public class MoonKreepPopulator extends BlockPopulator {
- @Override
- public void populate(@NonNull World world, @NonNull Random random, @NonNull Chunk source) {
- new BukkitRunnable() {
+ @Override
+ public void populate(@NonNull World world, @NonNull Random random, @NonNull Chunk source) {
+ new BukkitRunnable() {
- @Override
- public void run() {
- int decreaseY = random.nextInt(9) + 1;
- int x = random.nextInt(16);
- int y = 30 - decreaseY;
- int z = random.nextInt(16);
- final int tx = x;
- final int ty = y;
- final int tz = z;
- int count = 0;
- while (random.nextDouble() < 0.8D && count <= 6 || count <= 3) {
- if (source.getBlock(x, y, z).getType() == Material.STONE) {
- if (!SlimefunPlugin.getRegistry().getWorlds().containsKey(world.getName())) {
- BlockStorage bs = new BlockStorage(world);
- SlimefunPlugin.getRegistry().getWorlds().put(world.getName(), bs);
- }
- new BukkitRunnable() {
+ @Override
+ public void run() {
+ int decreaseY = random.nextInt(9) + 1;
+ int x = random.nextInt(16);
+ int y = 30 - decreaseY;
+ int z = random.nextInt(16);
+ final int tx = x;
+ final int ty = y;
+ final int tz = z;
+ int count = 0;
+ while (random.nextDouble() < 0.8D && count <= 6 || count <= 3) {
+ if (source.getBlock(x, y, z).getType() == Material.STONE) {
+ if (!SlimefunPlugin.getRegistry().getWorlds().containsKey(world.getName())) {
+ BlockStorage bs = new BlockStorage(world);
+ SlimefunPlugin.getRegistry().getWorlds().put(world.getName(), bs);
+ }
+ new BukkitRunnable() {
- @Override
- public void run() {
- source.getBlock(tx, ty, tz).setType(ClayTechItems.KREEP_ROCK.getType(), false);
- BlockStorage.addBlockInfo(source.getBlock(tx, ty, tz), "id", "KREEP_ROCK", true);
- }
+ @Override
+ public void run() {
+ source.getBlock(tx, ty, tz).setType(ClayTechItems.KREEP_ROCK.getType(), false);
+ BlockStorage.addBlockInfo(source.getBlock(tx, ty, tz), "id", "KREEP_ROCK", true);
+ }
- }.runTask(ClayTech.getInstance());
- count++;
+ }.runTask(ClayTech.getInstance());
+ count++;
- }
+ }
- switch (random.nextInt(6)) {
- case 0:
- x = Math.min(x + 1, 15);
- break;
- case 1:
- y = Math.min(y + 1, 20);
- break;
- case 2:
- z = Math.min(z + 1, 15);
- break;
- case 3:
- x = Math.max(x - 1, 0);
- break;
- case 4:
- y = Math.max(y - 1, 30);
- break;
- default:
- z = Math.max(z - 1, 0);
- break;
- }
- }
+ switch (random.nextInt(6)) {
+ case 0:
+ x = Math.min(x + 1, 15);
+ break;
+ case 1:
+ y = Math.min(y + 1, 20);
+ break;
+ case 2:
+ z = Math.min(z + 1, 15);
+ break;
+ case 3:
+ x = Math.max(x - 1, 0);
+ break;
+ case 4:
+ y = Math.max(y - 1, 30);
+ break;
+ default:
+ z = Math.max(z - 1, 0);
+ break;
+ }
+ }
- }
+ }
- }.runTaskAsynchronously(ClayTech.getInstance());
- }
+ }.runTaskAsynchronously(ClayTech.getInstance());
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/abstractMachines/ACraftingTable.java b/src/main/java/club/claycoffee/ClayTech/implementation/abstractMachines/ACraftingTable.java
index 50a4372..389b98b 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/abstractMachines/ACraftingTable.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/abstractMachines/ACraftingTable.java
@@ -1,21 +1,13 @@
package club.claycoffee.ClayTech.implementation.abstractMachines;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.bukkit.inventory.ItemStack;
-
import club.claycoffee.ClayTech.utils.Lang;
import club.claycoffee.ClayTech.utils.Utils;
-
-import org.bukkit.Bukkit;
-import org.bukkit.Material;
-import org.bukkit.block.Block;
-import org.bukkit.entity.Player;
-import org.bukkit.event.inventory.InventoryClickEvent;
-
+import io.github.thebusybiscuit.slimefun4.core.attributes.EnergyNetComponent;
+import io.github.thebusybiscuit.slimefun4.core.networks.energy.EnergyNetComponentType;
+import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
+import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
+import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
+import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category;
@@ -26,268 +18,271 @@
import me.mrCookieSlime.Slimefun.api.BlockStorage;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
import me.mrCookieSlime.Slimefun.api.energy.ChargableBlock;
-import io.github.thebusybiscuit.slimefun4.core.networks.energy.EnergyNetComponentType;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset;
-import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
-import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler;
-import io.github.thebusybiscuit.slimefun4.core.attributes.EnergyNetComponent;
-import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
-import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
+import org.bukkit.Bukkit;
+import org.bukkit.Material;
+import org.bukkit.block.Block;
+import org.bukkit.entity.Player;
+import org.bukkit.event.inventory.InventoryClickEvent;
+import org.bukkit.inventory.ItemStack;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
public abstract class ACraftingTable extends SlimefunItem implements InventoryBlock, EnergyNetComponent {
- public static Map processing = new HashMap<>();
- public static Map progress = new HashMap<>();
- public final static int[] inputslots = new int[] { 19, 20, 21, 28, 29, 30, 37, 38, 39 };
- public final static int[] outputslots = new int[] { 34 };
-
- protected final List recipes = new ArrayList<>();
-
- private static final int[] BORDER = { 0, 1, 2, 3, 5, 6, 7, 8, 14, 15, 16, 17, 23, 41, 43, 50, 51, 52, 53, 32 };
- private static final int[] BORDER_IN = { 9, 10, 11, 12, 13, 18, 22, 27, 31, 36, 40, 45, 46, 47, 48, 49 };
- private static final int[] BORDER_OUT = { 24, 25, 26, 33, 35, 42, 43, 44 };
- private static final ItemStack BORDER_ITEM = Utils.newItemD(Material.LIGHT_BLUE_STAINED_GLASS_PANE,
- Lang.readMachinesText("SPLIT_LINE"));
- private static final ItemStack OTHERBORDER_ITEM = Utils.newItemD(Material.LIME_STAINED_GLASS_PANE,
- Lang.readMachinesText("SPLIT_LINE"));
- SlimefunItemStack items;
-
- public ACraftingTable(Category category, SlimefunItemStack item, String id, RecipeType recipeType,
- ItemStack[] recipe) {
-
- super(category, item, recipeType, recipe);
-
- createPreset(this, getInventoryTitle(), this::SetupMenu);
-
- registerBlockHandler(id, (p, b, tool, reason) -> {
- BlockMenu inv = BlockStorage.getInventory(b);
- if (inv != null) {
- for (int slot : getInputSlots()) {
- if (inv.getItemInSlot(slot) != null) {
- b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
- inv.replaceExistingItem(slot, null);
- }
- }
-
- for (int slot : getOutputSlots()) {
- if (inv.getItemInSlot(slot) != null) {
- b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
- inv.replaceExistingItem(slot, null);
- }
- }
- }
-
- progress.remove(b);
- processing.remove(b);
- return true;
- });
-
- this.registerDefaultRecipes();
- }
-
- public int[] getInputSlots() {
- return inputslots;
- }
-
- @Override
- public int[] getOutputSlots() {
- return outputslots;
- }
-
- public abstract String getInventoryTitle();
-
- public abstract ItemStack getProgressBar();
-
- public abstract int getEnergyConsumption();
-
- public abstract int getSpeed();
-
- public abstract String getMachineIdentifier();
-
- public void SetupMenu(BlockMenuPreset Preset) {
- Preset.addItem(5, BORDER_ITEM, ChestMenuUtils.getEmptyClickHandler());
- for (int eachID : BORDER) {
- Preset.addItem(eachID, BORDER_ITEM, ChestMenuUtils.getEmptyClickHandler());
- }
- for (int eachID : BORDER_IN) {
- Preset.addItem(eachID, OTHERBORDER_ITEM, ChestMenuUtils.getEmptyClickHandler());
- }
- for (int eachID : BORDER_OUT) {
- Preset.addItem(eachID, OTHERBORDER_ITEM, ChestMenuUtils.getEmptyClickHandler());
- }
- Preset.addItem(4, Utils.addLore(Utils.newItem(Material.BLACK_STAINED_GLASS_PANE), " "),
- ChestMenuUtils.getEmptyClickHandler());
- Preset.addItem(5, BORDER_ITEM, ChestMenuUtils.getEmptyClickHandler());
- for (int i : getOutputSlots()) {
- Preset.addMenuClickHandler(i, new AdvancedMenuClickHandler() {
-
- @Override
- public boolean onClick(Player p, int slot, ItemStack cursor, ClickAction action) {
- return false;
- }
-
- @Override
- public boolean onClick(InventoryClickEvent e, Player p, int slot, ItemStack cursor,
- ClickAction action) {
- return cursor == null || cursor.getType() == null || cursor.getType() == Material.AIR;
- }
- });
- }
- }
-
- public void registerDefaultRecipes() {
-
- }
-
- @Override
- public io.github.thebusybiscuit.slimefun4.core.networks.energy.EnergyNetComponentType getEnergyComponentType() {
- return EnergyNetComponentType.CONSUMER;
- }
-
- @Override
- public int getCapacity() {
- return 0;
- }
-
- public List getDisplayRecipes() {
- List displayRecipes = new ArrayList<>(recipes.size() * 2);
-
- for (MachineRecipe recipe : recipes) {
- if (recipe.getInput().length != 1)
- continue;
-
- displayRecipes.add(recipe.getInput()[0]);
- displayRecipes.add(recipe.getOutput()[0]);
- }
-
- return displayRecipes;
- }
-
- public MachineRecipe getProcessing(Block b) {
- return processing.get(b);
- }
-
- public boolean isProcessing(Block b) {
- return getProcessing(b) != null;
- }
-
- public void registerRecipe(MachineRecipe recipe) {
- recipe.setTicks(recipe.getTicks() / getSpeed());
- recipes.add(recipe);
- }
-
- public void registerRecipe(int seconds, ItemStack[] input, ItemStack[] output) {
- if (input.length > 9) {
- if (output[0].hasItemMeta()) {
- Bukkit.getLogger()
- .warning("There is an error when registering the recipe.Please contact the author.Error recipe:"
- + output[0].getItemMeta().getDisplayName());
- return;
- } else {
- Bukkit.getLogger()
- .warning("There is an error when registering the recipe.Please contact the author.Error recipe:"
- + output[0].getType());
- return;
- }
- }
- registerRecipe(new MachineRecipe(seconds, input, output));
- }
-
- @Override
- public void preRegister() {
- addItemHandler(new BlockTicker() {
- @Override
- public void tick(Block b, SlimefunItem sf, Config data) {
- ACraftingTable.this.tick(b);
- }
-
- @Override
- public boolean isSynchronized() {
- return false;
- }
- });
- }
-
- protected void tick(Block b) {
- BlockMenu inv = BlockStorage.getInventory(b);
- // 机器正在处理
- if (isProcessing(b)) {
- // 剩余时间
- int timeleft = progress.get(b);
-
- if (timeleft > 0) {
- // 还在处理
- ChestMenuUtils.updateProgressbar(inv, 4, timeleft, processing.get(b).getTicks(), getProgressBar());
-
- if (ChargableBlock.isChargable(b)) {
- if (ChargableBlock.getCharge(b) < getEnergyConsumption())
- return;
- ChargableBlock.addCharge(b, -getEnergyConsumption());
- progress.put(b, timeleft - 1);
- } else
- progress.put(b, timeleft - 1);
- } else {
- // 处理结束
- inv.replaceExistingItem(4, Utils.addLore(Utils.newItem(Material.BLACK_STAINED_GLASS_PANE), " "));
-
- for (ItemStack output : processing.get(b).getOutput()) {
- if (output != null)
- inv.pushItem(output.clone(), getOutputSlots());
- }
-
- progress.remove(b);
- processing.remove(b);
- }
- } else {
- // 没有在处理
- MachineRecipe r = null;
- Map found = new HashMap<>();
- int i;
- for (MachineRecipe recipe : recipes) {
- i = 0;
- for (ItemStack input : recipe.getInput()) {
- if (SlimefunUtils.isItemSimilar(inv.getItemInSlot(inputslots[i]), input, true)) {
- // 如果该位置的物品符合某合成配方的对应位置物品
- if (input != null) {
- found.put(inputslots[i], input.getAmount());
- }
- }
- if (inv.getItemInSlot(inputslots[i]) == input && input == null) {
- found.put(i, 0);
- }
- if (i < 8) {
- i++;
- } else
- i = 0;
- }
- if (found.size() == recipe.getInput().length) {
- r = recipe;
- break;
- } else
- found.clear();
- }
-
- if (r != null) {
- if (ChargableBlock.isChargable(b)) {
- if (ChargableBlock.getCharge(b) < getEnergyConsumption())
- return;
- ChargableBlock.addCharge(b, -getEnergyConsumption());
- }
- if (inv.getItemInSlot(outputslots[0]) != null) {
- ItemStack is = inv.getItemInSlot(outputslots[0]);
- if (is.getMaxStackSize() == is.getAmount())
- return;
- }
-
- for (Map.Entry entry : found.entrySet()) {
- if (entry.getValue() > 0)
- inv.consumeItem(entry.getKey(), entry.getValue());
- }
-
- processing.put(b, r);
- progress.put(b, r.getTicks());
- }
- }
- }
+ public final static int[] inputslots = new int[]{19, 20, 21, 28, 29, 30, 37, 38, 39};
+ public final static int[] outputslots = new int[]{34};
+ private static final int[] BORDER = {0, 1, 2, 3, 5, 6, 7, 8, 14, 15, 16, 17, 23, 41, 43, 50, 51, 52, 53, 32};
+ private static final int[] BORDER_IN = {9, 10, 11, 12, 13, 18, 22, 27, 31, 36, 40, 45, 46, 47, 48, 49};
+ private static final int[] BORDER_OUT = {24, 25, 26, 33, 35, 42, 43, 44};
+ private static final ItemStack BORDER_ITEM = Utils.newItemD(Material.LIGHT_BLUE_STAINED_GLASS_PANE,
+ Lang.readMachinesText("SPLIT_LINE"));
+ private static final ItemStack OTHERBORDER_ITEM = Utils.newItemD(Material.LIME_STAINED_GLASS_PANE,
+ Lang.readMachinesText("SPLIT_LINE"));
+ public static Map processing = new HashMap<>();
+ public static Map progress = new HashMap<>();
+ protected final List recipes = new ArrayList<>();
+ SlimefunItemStack items;
+
+ public ACraftingTable(Category category, SlimefunItemStack item, String id, RecipeType recipeType,
+ ItemStack[] recipe) {
+
+ super(category, item, recipeType, recipe);
+
+ createPreset(this, getInventoryTitle(), this::SetupMenu);
+
+ registerBlockHandler(id, (p, b, tool, reason) -> {
+ BlockMenu inv = BlockStorage.getInventory(b);
+ if (inv != null) {
+ for (int slot : getInputSlots()) {
+ if (inv.getItemInSlot(slot) != null) {
+ b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
+ inv.replaceExistingItem(slot, null);
+ }
+ }
+
+ for (int slot : getOutputSlots()) {
+ if (inv.getItemInSlot(slot) != null) {
+ b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
+ inv.replaceExistingItem(slot, null);
+ }
+ }
+ }
+
+ progress.remove(b);
+ processing.remove(b);
+ return true;
+ });
+
+ this.registerDefaultRecipes();
+ }
+
+ public int[] getInputSlots() {
+ return inputslots;
+ }
+
+ @Override
+ public int[] getOutputSlots() {
+ return outputslots;
+ }
+
+ public abstract String getInventoryTitle();
+
+ public abstract ItemStack getProgressBar();
+
+ public abstract int getEnergyConsumption();
+
+ public abstract int getSpeed();
+
+ public abstract String getMachineIdentifier();
+
+ public void SetupMenu(BlockMenuPreset Preset) {
+ Preset.addItem(5, BORDER_ITEM, ChestMenuUtils.getEmptyClickHandler());
+ for (int eachID : BORDER) {
+ Preset.addItem(eachID, BORDER_ITEM, ChestMenuUtils.getEmptyClickHandler());
+ }
+ for (int eachID : BORDER_IN) {
+ Preset.addItem(eachID, OTHERBORDER_ITEM, ChestMenuUtils.getEmptyClickHandler());
+ }
+ for (int eachID : BORDER_OUT) {
+ Preset.addItem(eachID, OTHERBORDER_ITEM, ChestMenuUtils.getEmptyClickHandler());
+ }
+ Preset.addItem(4, Utils.addLore(Utils.newItem(Material.BLACK_STAINED_GLASS_PANE), " "),
+ ChestMenuUtils.getEmptyClickHandler());
+ Preset.addItem(5, BORDER_ITEM, ChestMenuUtils.getEmptyClickHandler());
+ for (int i : getOutputSlots()) {
+ Preset.addMenuClickHandler(i, new AdvancedMenuClickHandler() {
+
+ @Override
+ public boolean onClick(Player p, int slot, ItemStack cursor, ClickAction action) {
+ return false;
+ }
+
+ @Override
+ public boolean onClick(InventoryClickEvent e, Player p, int slot, ItemStack cursor,
+ ClickAction action) {
+ return cursor == null || cursor.getType() == null || cursor.getType() == Material.AIR;
+ }
+ });
+ }
+ }
+
+ public void registerDefaultRecipes() {
+
+ }
+
+ @Override
+ public io.github.thebusybiscuit.slimefun4.core.networks.energy.EnergyNetComponentType getEnergyComponentType() {
+ return EnergyNetComponentType.CONSUMER;
+ }
+
+ @Override
+ public int getCapacity() {
+ return 0;
+ }
+
+ public List getDisplayRecipes() {
+ List displayRecipes = new ArrayList<>(recipes.size() * 2);
+
+ for (MachineRecipe recipe : recipes) {
+ if (recipe.getInput().length != 1)
+ continue;
+
+ displayRecipes.add(recipe.getInput()[0]);
+ displayRecipes.add(recipe.getOutput()[0]);
+ }
+
+ return displayRecipes;
+ }
+
+ public MachineRecipe getProcessing(Block b) {
+ return processing.get(b);
+ }
+
+ public boolean isProcessing(Block b) {
+ return getProcessing(b) != null;
+ }
+
+ public void registerRecipe(MachineRecipe recipe) {
+ recipe.setTicks(recipe.getTicks() / getSpeed());
+ recipes.add(recipe);
+ }
+
+ public void registerRecipe(int seconds, ItemStack[] input, ItemStack[] output) {
+ if (input.length > 9) {
+ if (output[0].hasItemMeta()) {
+ Bukkit.getLogger()
+ .warning("There is an error when registering the recipe.Please contact the author.Error recipe:"
+ + output[0].getItemMeta().getDisplayName());
+ return;
+ } else {
+ Bukkit.getLogger()
+ .warning("There is an error when registering the recipe.Please contact the author.Error recipe:"
+ + output[0].getType());
+ return;
+ }
+ }
+ registerRecipe(new MachineRecipe(seconds, input, output));
+ }
+
+ @Override
+ public void preRegister() {
+ addItemHandler(new BlockTicker() {
+ @Override
+ public void tick(Block b, SlimefunItem sf, Config data) {
+ ACraftingTable.this.tick(b);
+ }
+
+ @Override
+ public boolean isSynchronized() {
+ return false;
+ }
+ });
+ }
+
+ protected void tick(Block b) {
+ BlockMenu inv = BlockStorage.getInventory(b);
+ // 机器正在处理
+ if (isProcessing(b)) {
+ // 剩余时间
+ int timeleft = progress.get(b);
+
+ if (timeleft > 0) {
+ // 还在处理
+ ChestMenuUtils.updateProgressbar(inv, 4, timeleft, processing.get(b).getTicks(), getProgressBar());
+
+ if (ChargableBlock.isChargable(b)) {
+ if (ChargableBlock.getCharge(b) < getEnergyConsumption())
+ return;
+ ChargableBlock.addCharge(b, -getEnergyConsumption());
+ progress.put(b, timeleft - 1);
+ } else
+ progress.put(b, timeleft - 1);
+ } else {
+ // 处理结束
+ inv.replaceExistingItem(4, Utils.addLore(Utils.newItem(Material.BLACK_STAINED_GLASS_PANE), " "));
+
+ for (ItemStack output : processing.get(b).getOutput()) {
+ if (output != null)
+ inv.pushItem(output.clone(), getOutputSlots());
+ }
+
+ progress.remove(b);
+ processing.remove(b);
+ }
+ } else {
+ // 没有在处理
+ MachineRecipe r = null;
+ Map found = new HashMap<>();
+ int i;
+ for (MachineRecipe recipe : recipes) {
+ i = 0;
+ for (ItemStack input : recipe.getInput()) {
+ if (SlimefunUtils.isItemSimilar(inv.getItemInSlot(inputslots[i]), input, true)) {
+ // 如果该位置的物品符合某合成配方的对应位置物品
+ if (input != null) {
+ found.put(inputslots[i], input.getAmount());
+ }
+ }
+ if (inv.getItemInSlot(inputslots[i]) == input && input == null) {
+ found.put(i, 0);
+ }
+ if (i < 8) {
+ i++;
+ } else
+ i = 0;
+ }
+ if (found.size() == recipe.getInput().length) {
+ r = recipe;
+ break;
+ } else
+ found.clear();
+ }
+
+ if (r != null) {
+ if (ChargableBlock.isChargable(b)) {
+ if (ChargableBlock.getCharge(b) < getEnergyConsumption())
+ return;
+ ChargableBlock.addCharge(b, -getEnergyConsumption());
+ }
+ if (inv.getItemInSlot(outputslots[0]) != null) {
+ ItemStack is = inv.getItemInSlot(outputslots[0]);
+ if (is.getMaxStackSize() == is.getAmount())
+ return;
+ }
+
+ for (Map.Entry entry : found.entrySet()) {
+ if (entry.getValue() > 0)
+ inv.consumeItem(entry.getKey(), entry.getValue());
+ }
+
+ processing.put(b, r);
+ progress.put(b, r.getTicks());
+ }
+ }
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/abstractMachines/AExperimentTable.java b/src/main/java/club/claycoffee/ClayTech/implementation/abstractMachines/AExperimentTable.java
index 0dbd2de..21c6dbc 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/abstractMachines/AExperimentTable.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/abstractMachines/AExperimentTable.java
@@ -1,16 +1,5 @@
package club.claycoffee.ClayTech.implementation.abstractMachines;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.bukkit.Material;
-import org.bukkit.block.Block;
-import org.bukkit.entity.Player;
-import org.bukkit.event.inventory.InventoryClickEvent;
-import org.bukkit.inventory.ItemStack;
-
import club.claycoffee.ClayTech.utils.Lang;
import club.claycoffee.ClayTech.utils.Utils;
import io.github.thebusybiscuit.slimefun4.core.attributes.EnergyNetComponent;
@@ -18,8 +7,8 @@
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
-import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler;
+import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
@@ -31,243 +20,253 @@
import me.mrCookieSlime.Slimefun.api.energy.ChargableBlock;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset;
+import org.bukkit.Material;
+import org.bukkit.block.Block;
+import org.bukkit.entity.Player;
+import org.bukkit.event.inventory.InventoryClickEvent;
+import org.bukkit.inventory.ItemStack;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
public abstract class AExperimentTable extends SlimefunItem implements InventoryBlock, EnergyNetComponent {
- public final static int[] inputslots = new int[] { 20, 21, 22, 23, 24 };
- public final static int[] outputslots = new int[] { 40 };
- public static Map processing = new HashMap<>();
- public static Map progress = new HashMap<>();
- protected final List recipes = new ArrayList<>();
- private static final int[] BORDER_A = { 0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 25, 26,
- 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 44, 45, 46, 47, 48, 49, 50, 51, 41, 52, 53 };
- private static final int[] BORDER_B = { 37, 38, 39, 41, 42, 43 };
- private static final ItemStack FREE_STATE_ITEM = Utils.newItemD(Material.BLACK_STAINED_GLASS_PANE,
- Lang.readMachinesText("SPLIT_LINE"));
- private static final ItemStack BORDER_A_ITEM = Utils.newItemD(Material.LIGHT_BLUE_STAINED_GLASS_PANE,
- Lang.readMachinesText("SPLIT_LINE"));
- private static final ItemStack BORDER_B_ITEM = Utils.newItemD(Material.LIME_STAINED_GLASS_PANE,
- Lang.readMachinesText("SPLIT_LINE"));
-
- public AExperimentTable(Category category, SlimefunItemStack item, String id, RecipeType recipeType,
- ItemStack[] recipe) {
-
- super(category, item, recipeType, recipe);
-
- createPreset(this, getInventoryTitle(), this::SetupMenu);
-
- registerBlockHandler(id, (p, b, tool, reason) -> {
- BlockMenu inv = BlockStorage.getInventory(b);
- if (inv != null) {
- for (int slot : getInputSlots()) {
- if (inv.getItemInSlot(slot) != null) {
- b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
- inv.replaceExistingItem(slot, null);
- }
- }
-
- for (int slot : getOutputSlots()) {
- if (inv.getItemInSlot(slot) != null) {
- b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
- inv.replaceExistingItem(slot, null);
- }
- }
- }
-
- progress.remove(b);
- processing.remove(b);
- return true;
- });
-
- this.registerDefaultRecipes();
- }
-
- public abstract String getInventoryTitle();
-
- public abstract ItemStack getProgressBar();
-
- public abstract int getEnergyConsumption();
-
- public abstract int getSpeed();
-
- public abstract String getMachineIdentifier();
-
- @Override
- public void preRegister() {
- addItemHandler(new BlockTicker() {
- @Override
- public void tick(Block b, SlimefunItem sf, Config data) {
- AExperimentTable.this.tick(b);
- }
-
- @Override
- public boolean isSynchronized() {
- return false;
- }
- });
- }
-
- public void SetupMenu(BlockMenuPreset Preset) {
- // TODO Change
- Preset.addItem(4, FREE_STATE_ITEM, ChestMenuUtils.getEmptyClickHandler());
- for (int eachID : BORDER_A) {
- Preset.addItem(eachID, BORDER_A_ITEM, ChestMenuUtils.getEmptyClickHandler());
- }
- for (int eachID : BORDER_B) {
- Preset.addItem(eachID, BORDER_B_ITEM, ChestMenuUtils.getEmptyClickHandler());
- }
- Preset.addItem(4, Utils.addLore(Utils.newItem(Material.BLACK_STAINED_GLASS_PANE), " "),
- ChestMenuUtils.getEmptyClickHandler());
- Preset.addItem(4, FREE_STATE_ITEM, ChestMenuUtils.getEmptyClickHandler());
- for (int i : getOutputSlots()) {
- Preset.addMenuClickHandler(i, new AdvancedMenuClickHandler() {
-
- @Override
- public boolean onClick(Player p, int slot, ItemStack cursor, ClickAction action) {
- return false;
- }
-
- @Override
- public boolean onClick(InventoryClickEvent e, Player p, int slot, ItemStack cursor,
- ClickAction action) {
- return cursor == null || cursor.getType() == null || cursor.getType() == Material.AIR;
- }
- });
- }
- }
-
- public void registerDefaultRecipes() {
-
- }
-
- @Override
- public EnergyNetComponentType getEnergyComponentType() {
- return EnergyNetComponentType.CONSUMER;
- }
-
- @Override
- public int getCapacity() {
- return 1024;
- }
-
- @Override
- public int[] getInputSlots() {
- return inputslots;
- }
-
- @Override
- public int[] getOutputSlots() {
- return outputslots;
- }
-
- public List getDisplayRecipes() {
- List displayRecipes = new ArrayList<>(recipes.size() * 2);
-
- for (MachineRecipe recipe : recipes) {
- if (recipe.getInput().length != 1)
- continue;
-
- displayRecipes.add(recipe.getInput()[0]);
- displayRecipes.add(recipe.getOutput()[0]);
- }
-
- return displayRecipes;
- }
-
- public MachineRecipe getProcessing(Block b) {
- return processing.get(b);
- }
-
- public boolean isProcessing(Block b) {
- return getProcessing(b) != null;
- }
-
- public void registerRecipe(MachineRecipe recipe) {
- recipe.setTicks(recipe.getTicks() / getSpeed());
- recipes.add(recipe);
- }
-
- public void registerRecipe(int seconds, ItemStack[] input, ItemStack[] output) {
- registerRecipe(new MachineRecipe(seconds, input, output));
- }
-
- protected void tick(Block b) {
- BlockMenu inv = BlockStorage.getInventory(b);
- // 机器正在处理
- if (isProcessing(b)) {
- // 剩余时间
- int timeleft = progress.get(b);
-
- if (timeleft > 0) {
- // 还在处理
- ChestMenuUtils.updateProgressbar(inv, 4, timeleft, processing.get(b).getTicks(), getProgressBar());
-
- if (ChargableBlock.isChargable(b)) {
- if (ChargableBlock.getCharge(b) < getEnergyConsumption())
- return;
- ChargableBlock.addCharge(b, -getEnergyConsumption());
- progress.put(b, timeleft - 1);
- } else
- progress.put(b, timeleft - 1);
- } else {
- // 处理结束
- inv.replaceExistingItem(4, Utils.addLore(Utils.newItem(Material.BLACK_STAINED_GLASS_PANE), " "));
-
- for (ItemStack output : processing.get(b).getOutput()) {
- if (output != null)
- inv.pushItem(output.clone(), getOutputSlots());
- }
-
- progress.remove(b);
- processing.remove(b);
- }
- } else {
- // 没有在处理
- MachineRecipe r = null;
- Map found = new HashMap<>();
- int i;
- for (MachineRecipe recipe : recipes) {
- i = 0;
- for (ItemStack input : recipe.getInput()) {
- if (SlimefunUtils.isItemSimilar(inv.getItemInSlot(inputslots[i]), input, true)) {
- // 如果该位置的物品符合某实验配方的对应位置物品
- if (input != null) {
- found.put(inputslots[i], input.getAmount());
- }
- }
- if (inv.getItemInSlot(inputslots[i]) == input && input == null) {
- found.put(i, 0);
- }
- if (i < 4) {
- i++;
- } else
- i = 0;
- }
- if (found.size() == 5) {
- r = recipe;
- break;
- } else
- found.clear();
- }
-
- if (r != null) {
- if (ChargableBlock.isChargable(b)) {
- if (ChargableBlock.getCharge(b) < getEnergyConsumption())
- return;
- ChargableBlock.addCharge(b, -getEnergyConsumption());
- }
- if (inv.getItemInSlot(outputslots[0]) != null) {
- ItemStack is = inv.getItemInSlot(outputslots[0]);
- if (is.getMaxStackSize() == is.getAmount())
- return;
- }
- for (Map.Entry entry : found.entrySet()) {
- if (entry.getValue() > 0)
- inv.consumeItem(entry.getKey(), entry.getValue());
- }
-
- processing.put(b, r);
- progress.put(b, r.getTicks());
- }
- }
- }
+ public final static int[] inputslots = new int[]{20, 21, 22, 23, 24};
+ public final static int[] outputslots = new int[]{40};
+ private static final int[] BORDER_A = {0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 25, 26,
+ 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 44, 45, 46, 47, 48, 49, 50, 51, 41, 52, 53};
+ private static final int[] BORDER_B = {37, 38, 39, 41, 42, 43};
+ private static final ItemStack FREE_STATE_ITEM = Utils.newItemD(Material.BLACK_STAINED_GLASS_PANE,
+ Lang.readMachinesText("SPLIT_LINE"));
+ private static final ItemStack BORDER_A_ITEM = Utils.newItemD(Material.LIGHT_BLUE_STAINED_GLASS_PANE,
+ Lang.readMachinesText("SPLIT_LINE"));
+ private static final ItemStack BORDER_B_ITEM = Utils.newItemD(Material.LIME_STAINED_GLASS_PANE,
+ Lang.readMachinesText("SPLIT_LINE"));
+ public static Map processing = new HashMap<>();
+ public static Map progress = new HashMap<>();
+ protected final List recipes = new ArrayList<>();
+
+ public AExperimentTable(Category category, SlimefunItemStack item, String id, RecipeType recipeType,
+ ItemStack[] recipe) {
+
+ super(category, item, recipeType, recipe);
+
+ createPreset(this, getInventoryTitle(), this::SetupMenu);
+
+ registerBlockHandler(id, (p, b, tool, reason) -> {
+ BlockMenu inv = BlockStorage.getInventory(b);
+ if (inv != null) {
+ for (int slot : getInputSlots()) {
+ if (inv.getItemInSlot(slot) != null) {
+ b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
+ inv.replaceExistingItem(slot, null);
+ }
+ }
+
+ for (int slot : getOutputSlots()) {
+ if (inv.getItemInSlot(slot) != null) {
+ b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
+ inv.replaceExistingItem(slot, null);
+ }
+ }
+ }
+
+ progress.remove(b);
+ processing.remove(b);
+ return true;
+ });
+
+ this.registerDefaultRecipes();
+ }
+
+ public abstract String getInventoryTitle();
+
+ public abstract ItemStack getProgressBar();
+
+ public abstract int getEnergyConsumption();
+
+ public abstract int getSpeed();
+
+ public abstract String getMachineIdentifier();
+
+ @Override
+ public void preRegister() {
+ addItemHandler(new BlockTicker() {
+ @Override
+ public void tick(Block b, SlimefunItem sf, Config data) {
+ AExperimentTable.this.tick(b);
+ }
+
+ @Override
+ public boolean isSynchronized() {
+ return false;
+ }
+ });
+ }
+
+ public void SetupMenu(BlockMenuPreset Preset) {
+ // TODO Change
+ Preset.addItem(4, FREE_STATE_ITEM, ChestMenuUtils.getEmptyClickHandler());
+ for (int eachID : BORDER_A) {
+ Preset.addItem(eachID, BORDER_A_ITEM, ChestMenuUtils.getEmptyClickHandler());
+ }
+ for (int eachID : BORDER_B) {
+ Preset.addItem(eachID, BORDER_B_ITEM, ChestMenuUtils.getEmptyClickHandler());
+ }
+ Preset.addItem(4, Utils.addLore(Utils.newItem(Material.BLACK_STAINED_GLASS_PANE), " "),
+ ChestMenuUtils.getEmptyClickHandler());
+ Preset.addItem(4, FREE_STATE_ITEM, ChestMenuUtils.getEmptyClickHandler());
+ for (int i : getOutputSlots()) {
+ Preset.addMenuClickHandler(i, new AdvancedMenuClickHandler() {
+
+ @Override
+ public boolean onClick(Player p, int slot, ItemStack cursor, ClickAction action) {
+ return false;
+ }
+
+ @Override
+ public boolean onClick(InventoryClickEvent e, Player p, int slot, ItemStack cursor,
+ ClickAction action) {
+ return cursor == null || cursor.getType() == null || cursor.getType() == Material.AIR;
+ }
+ });
+ }
+ }
+
+ public void registerDefaultRecipes() {
+
+ }
+
+ @Override
+ public EnergyNetComponentType getEnergyComponentType() {
+ return EnergyNetComponentType.CONSUMER;
+ }
+
+ @Override
+ public int getCapacity() {
+ return 1024;
+ }
+
+ @Override
+ public int[] getInputSlots() {
+ return inputslots;
+ }
+
+ @Override
+ public int[] getOutputSlots() {
+ return outputslots;
+ }
+
+ public List getDisplayRecipes() {
+ List displayRecipes = new ArrayList<>(recipes.size() * 2);
+
+ for (MachineRecipe recipe : recipes) {
+ if (recipe.getInput().length != 1)
+ continue;
+
+ displayRecipes.add(recipe.getInput()[0]);
+ displayRecipes.add(recipe.getOutput()[0]);
+ }
+
+ return displayRecipes;
+ }
+
+ public MachineRecipe getProcessing(Block b) {
+ return processing.get(b);
+ }
+
+ public boolean isProcessing(Block b) {
+ return getProcessing(b) != null;
+ }
+
+ public void registerRecipe(MachineRecipe recipe) {
+ recipe.setTicks(recipe.getTicks() / getSpeed());
+ recipes.add(recipe);
+ }
+
+ public void registerRecipe(int seconds, ItemStack[] input, ItemStack[] output) {
+ registerRecipe(new MachineRecipe(seconds, input, output));
+ }
+
+ protected void tick(Block b) {
+ BlockMenu inv = BlockStorage.getInventory(b);
+ // 机器正在处理
+ if (isProcessing(b)) {
+ // 剩余时间
+ int timeleft = progress.get(b);
+
+ if (timeleft > 0) {
+ // 还在处理
+ ChestMenuUtils.updateProgressbar(inv, 4, timeleft, processing.get(b).getTicks(), getProgressBar());
+
+ if (ChargableBlock.isChargable(b)) {
+ if (ChargableBlock.getCharge(b) < getEnergyConsumption())
+ return;
+ ChargableBlock.addCharge(b, -getEnergyConsumption());
+ progress.put(b, timeleft - 1);
+ } else
+ progress.put(b, timeleft - 1);
+ } else {
+ // 处理结束
+ inv.replaceExistingItem(4, Utils.addLore(Utils.newItem(Material.BLACK_STAINED_GLASS_PANE), " "));
+
+ for (ItemStack output : processing.get(b).getOutput()) {
+ if (output != null)
+ inv.pushItem(output.clone(), getOutputSlots());
+ }
+
+ progress.remove(b);
+ processing.remove(b);
+ }
+ } else {
+ // 没有在处理
+ MachineRecipe r = null;
+ Map found = new HashMap<>();
+ int i;
+ for (MachineRecipe recipe : recipes) {
+ i = 0;
+ for (ItemStack input : recipe.getInput()) {
+ if (SlimefunUtils.isItemSimilar(inv.getItemInSlot(inputslots[i]), input, true)) {
+ // 如果该位置的物品符合某实验配方的对应位置物品
+ if (input != null) {
+ found.put(inputslots[i], input.getAmount());
+ }
+ }
+ if (inv.getItemInSlot(inputslots[i]) == input && input == null) {
+ found.put(i, 0);
+ }
+ if (i < 4) {
+ i++;
+ } else
+ i = 0;
+ }
+ if (found.size() == 5) {
+ r = recipe;
+ break;
+ } else
+ found.clear();
+ }
+
+ if (r != null) {
+ if (ChargableBlock.isChargable(b)) {
+ if (ChargableBlock.getCharge(b) < getEnergyConsumption())
+ return;
+ ChargableBlock.addCharge(b, -getEnergyConsumption());
+ }
+ if (inv.getItemInSlot(outputslots[0]) != null) {
+ ItemStack is = inv.getItemInSlot(outputslots[0]);
+ if (is.getMaxStackSize() == is.getAmount())
+ return;
+ }
+ for (Map.Entry entry : found.entrySet()) {
+ if (entry.getValue() > 0)
+ inv.consumeItem(entry.getKey(), entry.getValue());
+ }
+
+ processing.put(b, r);
+ progress.put(b, r.getTicks());
+ }
+ }
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/abstractMachines/AExtracter.java b/src/main/java/club/claycoffee/ClayTech/implementation/abstractMachines/AExtracter.java
index d42fca8..f5a88e4 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/abstractMachines/AExtracter.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/abstractMachines/AExtracter.java
@@ -1,23 +1,17 @@
package club.claycoffee.ClayTech.implementation.abstractMachines;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.bukkit.inventory.ItemStack;
-
import club.claycoffee.ClayTech.ClayTechItems;
import club.claycoffee.ClayTech.utils.Lang;
import club.claycoffee.ClayTech.utils.Utils;
-
-import org.bukkit.Material;
-import org.bukkit.block.Block;
-import org.bukkit.entity.Player;
-import org.bukkit.event.inventory.InventoryClickEvent;
-
-import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction;
+import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
+import io.github.thebusybiscuit.slimefun4.core.attributes.EnergyNetComponent;
+import io.github.thebusybiscuit.slimefun4.core.networks.energy.EnergyNetComponentType;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
+import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
+import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
+import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
+import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler;
+import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
@@ -27,260 +21,261 @@
import me.mrCookieSlime.Slimefun.api.BlockStorage;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
import me.mrCookieSlime.Slimefun.api.energy.ChargableBlock;
-import io.github.thebusybiscuit.slimefun4.core.networks.energy.EnergyNetComponentType;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset;
-import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
-import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler;
-import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
-import io.github.thebusybiscuit.slimefun4.core.attributes.EnergyNetComponent;
-import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
-import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
+import org.bukkit.Material;
+import org.bukkit.block.Block;
+import org.bukkit.entity.Player;
+import org.bukkit.event.inventory.InventoryClickEvent;
+import org.bukkit.inventory.ItemStack;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
public abstract class AExtracter extends SlimefunItem implements InventoryBlock, EnergyNetComponent {
- public static Map processing = new HashMap<>();
- public static Map progress = new HashMap<>();
- public final static int[] inputslots = new int[] { 20 };
- public final static int[] outputslots = new int[] { 24 };
-
- protected final List recipes = new ArrayList<>();
-
- private static final int[] BORDER = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 17, 18, 26, 27, 35, 36, 44, 45, 46, 47, 48, 49,
- 50, 51, 52, 53, 13 };
- private static final int[] BORDER_A = { 10, 11, 12, 19, 21, 28, 29, 30, 14, 15, 16, 23, 25, 32, 33, 34 };
- private static final int[] BORDER_B = { 37, 38, 39, 41, 42, 43 };
- private static final ItemStack BORDER_ITEM = Utils.newItemD(Material.BLACK_STAINED_GLASS_PANE,
- Lang.readMachinesText("SPLIT_LINE"));
- private static final ItemStack BORDERA_ITEM = Utils.newItemD(Material.LIME_STAINED_GLASS_PANE,
- Lang.readMachinesText("SPLIT_LINE"));
- private static final ItemStack BORDERB_ITEM = Utils.newItemD(Material.MAGENTA_STAINED_GLASS_PANE,
- Lang.readMachinesText("SPLIT_LINE"));
- SlimefunItemStack items;
-
- public AExtracter(Category category, SlimefunItemStack item, String id, RecipeType recipeType, ItemStack[] recipe) {
-
- super(category, item, recipeType, recipe);
-
- createPreset(this, getInventoryTitle(), this::SetupMenu);
-
- registerBlockHandler(id, (p, b, tool, reason) -> {
- BlockMenu inv = BlockStorage.getInventory(b);
- if (inv != null) {
- for (int slot : getInputSlots()) {
- if (inv.getItemInSlot(slot) != null) {
- b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
- inv.replaceExistingItem(slot, null);
- }
- }
-
- for (int slot : getOutputSlots()) {
- if (inv.getItemInSlot(slot) != null) {
- b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
- inv.replaceExistingItem(slot, null);
- }
- }
-
- if (inv.getItemInSlot(40) != null) {
- b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(40));
- inv.replaceExistingItem(40, null);
- }
- }
-
- progress.remove(b);
- processing.remove(b);
- return true;
- });
-
- this.registerDefaultRecipes();
- }
-
- public int[] getInputSlots() {
- return inputslots;
- }
-
- @Override
- public int[] getOutputSlots() {
- return outputslots;
- }
-
- public abstract String getInventoryTitle();
-
- public abstract ItemStack getProgressBar();
-
- public abstract int getEnergyConsumption();
-
- public abstract int getSpeed();
-
- public abstract String getMachineIdentifier();
-
- public abstract void registerDefaultRecipes();
-
- @SuppressWarnings("deprecation")
- public void SetupMenu(BlockMenuPreset Preset) {
- Preset.addItem(5, BORDER_ITEM, ChestMenuUtils.getEmptyClickHandler());
- for (int eachID : BORDER) {
- Preset.addItem(eachID, BORDER_ITEM, ChestMenuUtils.getEmptyClickHandler());
- }
- for (int eachID : BORDER_A) {
- Preset.addItem(eachID, BORDERA_ITEM, ChestMenuUtils.getEmptyClickHandler());
- }
- for (int eachID : BORDER_B) {
- Preset.addItem(eachID, BORDERB_ITEM, ChestMenuUtils.getEmptyClickHandler());
- }
- Preset.addItem(22, Utils.addLore(Utils.newItem(Material.PINK_STAINED_GLASS_PANE), " "),
- ChestMenuUtils.getEmptyClickHandler());
- Preset.addItem(5, BORDER_ITEM, ChestMenuUtils.getEmptyClickHandler());
- Preset.addItem(31,
- Utils.newItemD(SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)
- ? Material.OAK_SIGN
- : Material.LEGACY_SIGN, Lang.readMachinesText("ELEMENT_UNIT_DOWN")),
- ChestMenuUtils.getEmptyClickHandler());
- for (int i : getOutputSlots()) {
- Preset.addMenuClickHandler(i, new AdvancedMenuClickHandler() {
-
- @Override
- public boolean onClick(Player p, int slot, ItemStack cursor, ClickAction action) {
- return false;
- }
-
- @Override
- public boolean onClick(InventoryClickEvent e, Player p, int slot, ItemStack cursor,
- ClickAction action) {
- return cursor == null || cursor.getType() == null || cursor.getType() == Material.AIR;
- }
- });
- }
- }
-
- @Override
- public EnergyNetComponentType getEnergyComponentType() {
- return EnergyNetComponentType.CONSUMER;
- }
-
- @Override
- public int getCapacity() {
- return 0;
- }
-
- public List getDisplayRecipes() {
- List displayRecipes = new ArrayList<>(recipes.size() * 2);
-
- for (MachineRecipe recipe : recipes) {
- if (recipe.getInput().length != 1)
- continue;
-
- displayRecipes.add(recipe.getInput()[0]);
- displayRecipes.add(recipe.getOutput()[0]);
- }
-
- return displayRecipes;
- }
-
- public MachineRecipe getProcessing(Block b) {
- return processing.get(b);
- }
-
- public boolean isProcessing(Block b) {
- return getProcessing(b) != null;
- }
-
- public void registerRecipe(MachineRecipe recipe) {
- recipe.setTicks(recipe.getTicks() / getSpeed());
- recipes.add(recipe);
- }
-
- public void registerRecipe(int seconds, ItemStack[] input, ItemStack[] output) {
- registerRecipe(new MachineRecipe(seconds, input, output));
- }
-
- @Override
- public void preRegister() {
- addItemHandler(new BlockTicker() {
- @Override
- public void tick(Block b, SlimefunItem sf, Config data) {
- AExtracter.this.tick(b);
- }
-
- @Override
- public boolean isSynchronized() {
- return false;
- }
- });
- }
-
- protected void tick(Block b) {
- BlockMenu inv = BlockStorage.getInventory(b);
- // 机器正在处理
- if (isProcessing(b)) {
- // 剩余时间
- int timeleft = progress.get(b);
-
- if (timeleft > 0) {
- // 还在处理
- ChestMenuUtils.updateProgressbar(inv, 22, timeleft, processing.get(b).getTicks(), getProgressBar());
-
- if (ChargableBlock.isChargable(b)) {
- if (ChargableBlock.getCharge(b) < getEnergyConsumption())
- return;
- ChargableBlock.addCharge(b, -getEnergyConsumption());
- progress.put(b, timeleft - 1);
- } else
- progress.put(b, timeleft - 1);
- } else {
- // 处理结束
- inv.replaceExistingItem(22, Utils.addLore(Utils.newItem(Material.PINK_STAINED_GLASS_PANE), " "));
-
- for (ItemStack output : processing.get(b).getOutput()) {
- if (output != null)
- inv.pushItem(output.clone(), getOutputSlots());
- }
- progress.remove(b);
- processing.remove(b);
- }
- } else {
- // 没有在处理
- MachineRecipe r = null;
- Map found = new HashMap<>();
- for (MachineRecipe recipe : recipes) {
- ItemStack input = recipe.getInput()[0];
- if (SlimefunUtils.isItemSimilar(inv.getItemInSlot(inputslots[0]), input, true)) {
- if (input != null) {
- found.put(inputslots[0], input.getAmount());
- }
- }
- if (found.size() == recipe.getInput().length) {
- r = recipe;
- break;
- } else {
- found.clear();
- }
- }
-
- if (r != null) {
- if (ChargableBlock.isChargable(b)) {
- if (ChargableBlock.getCharge(b) < getEnergyConsumption())
- return;
- ChargableBlock.addCharge(b, -getEnergyConsumption());
- }
- if (!SlimefunUtils.isItemSimilar(inv.getItemInSlot(40), ClayTechItems.ELEMENT_UNIT, true))
- return;
- if (inv.getItemInSlot(outputslots[0]) != null) {
- ItemStack is = inv.getItemInSlot(outputslots[0]);
- if (is.getMaxStackSize() == is.getAmount())
- return;
- }
- for (Map.Entry entry : found.entrySet()) {
- if (entry.getValue() > 0) {
- inv.consumeItem(entry.getKey(), entry.getValue());
- inv.consumeItem(40, 1);
- }
-
- }
-
- processing.put(b, r);
- progress.put(b, r.getTicks());
- }
- }
- }
+ public final static int[] inputslots = new int[]{20};
+ public final static int[] outputslots = new int[]{24};
+ private static final int[] BORDER = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 17, 18, 26, 27, 35, 36, 44, 45, 46, 47, 48, 49,
+ 50, 51, 52, 53, 13};
+ private static final int[] BORDER_A = {10, 11, 12, 19, 21, 28, 29, 30, 14, 15, 16, 23, 25, 32, 33, 34};
+ private static final int[] BORDER_B = {37, 38, 39, 41, 42, 43};
+ private static final ItemStack BORDER_ITEM = Utils.newItemD(Material.BLACK_STAINED_GLASS_PANE,
+ Lang.readMachinesText("SPLIT_LINE"));
+ private static final ItemStack BORDERA_ITEM = Utils.newItemD(Material.LIME_STAINED_GLASS_PANE,
+ Lang.readMachinesText("SPLIT_LINE"));
+ private static final ItemStack BORDERB_ITEM = Utils.newItemD(Material.MAGENTA_STAINED_GLASS_PANE,
+ Lang.readMachinesText("SPLIT_LINE"));
+ public static Map processing = new HashMap<>();
+ public static Map progress = new HashMap<>();
+ protected final List recipes = new ArrayList<>();
+ SlimefunItemStack items;
+
+ public AExtracter(Category category, SlimefunItemStack item, String id, RecipeType recipeType, ItemStack[] recipe) {
+
+ super(category, item, recipeType, recipe);
+
+ createPreset(this, getInventoryTitle(), this::SetupMenu);
+
+ registerBlockHandler(id, (p, b, tool, reason) -> {
+ BlockMenu inv = BlockStorage.getInventory(b);
+ if (inv != null) {
+ for (int slot : getInputSlots()) {
+ if (inv.getItemInSlot(slot) != null) {
+ b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
+ inv.replaceExistingItem(slot, null);
+ }
+ }
+
+ for (int slot : getOutputSlots()) {
+ if (inv.getItemInSlot(slot) != null) {
+ b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
+ inv.replaceExistingItem(slot, null);
+ }
+ }
+
+ if (inv.getItemInSlot(40) != null) {
+ b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(40));
+ inv.replaceExistingItem(40, null);
+ }
+ }
+
+ progress.remove(b);
+ processing.remove(b);
+ return true;
+ });
+
+ this.registerDefaultRecipes();
+ }
+
+ public int[] getInputSlots() {
+ return inputslots;
+ }
+
+ @Override
+ public int[] getOutputSlots() {
+ return outputslots;
+ }
+
+ public abstract String getInventoryTitle();
+
+ public abstract ItemStack getProgressBar();
+
+ public abstract int getEnergyConsumption();
+
+ public abstract int getSpeed();
+
+ public abstract String getMachineIdentifier();
+
+ public abstract void registerDefaultRecipes();
+
+ @SuppressWarnings("deprecation")
+ public void SetupMenu(BlockMenuPreset Preset) {
+ Preset.addItem(5, BORDER_ITEM, ChestMenuUtils.getEmptyClickHandler());
+ for (int eachID : BORDER) {
+ Preset.addItem(eachID, BORDER_ITEM, ChestMenuUtils.getEmptyClickHandler());
+ }
+ for (int eachID : BORDER_A) {
+ Preset.addItem(eachID, BORDERA_ITEM, ChestMenuUtils.getEmptyClickHandler());
+ }
+ for (int eachID : BORDER_B) {
+ Preset.addItem(eachID, BORDERB_ITEM, ChestMenuUtils.getEmptyClickHandler());
+ }
+ Preset.addItem(22, Utils.addLore(Utils.newItem(Material.PINK_STAINED_GLASS_PANE), " "),
+ ChestMenuUtils.getEmptyClickHandler());
+ Preset.addItem(5, BORDER_ITEM, ChestMenuUtils.getEmptyClickHandler());
+ Preset.addItem(31,
+ Utils.newItemD(SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)
+ ? Material.OAK_SIGN
+ : Material.LEGACY_SIGN, Lang.readMachinesText("ELEMENT_UNIT_DOWN")),
+ ChestMenuUtils.getEmptyClickHandler());
+ for (int i : getOutputSlots()) {
+ Preset.addMenuClickHandler(i, new AdvancedMenuClickHandler() {
+
+ @Override
+ public boolean onClick(Player p, int slot, ItemStack cursor, ClickAction action) {
+ return false;
+ }
+
+ @Override
+ public boolean onClick(InventoryClickEvent e, Player p, int slot, ItemStack cursor,
+ ClickAction action) {
+ return cursor == null || cursor.getType() == null || cursor.getType() == Material.AIR;
+ }
+ });
+ }
+ }
+
+ @Override
+ public EnergyNetComponentType getEnergyComponentType() {
+ return EnergyNetComponentType.CONSUMER;
+ }
+
+ @Override
+ public int getCapacity() {
+ return 0;
+ }
+
+ public List getDisplayRecipes() {
+ List displayRecipes = new ArrayList<>(recipes.size() * 2);
+
+ for (MachineRecipe recipe : recipes) {
+ if (recipe.getInput().length != 1)
+ continue;
+
+ displayRecipes.add(recipe.getInput()[0]);
+ displayRecipes.add(recipe.getOutput()[0]);
+ }
+
+ return displayRecipes;
+ }
+
+ public MachineRecipe getProcessing(Block b) {
+ return processing.get(b);
+ }
+
+ public boolean isProcessing(Block b) {
+ return getProcessing(b) != null;
+ }
+
+ public void registerRecipe(MachineRecipe recipe) {
+ recipe.setTicks(recipe.getTicks() / getSpeed());
+ recipes.add(recipe);
+ }
+
+ public void registerRecipe(int seconds, ItemStack[] input, ItemStack[] output) {
+ registerRecipe(new MachineRecipe(seconds, input, output));
+ }
+
+ @Override
+ public void preRegister() {
+ addItemHandler(new BlockTicker() {
+ @Override
+ public void tick(Block b, SlimefunItem sf, Config data) {
+ AExtracter.this.tick(b);
+ }
+
+ @Override
+ public boolean isSynchronized() {
+ return false;
+ }
+ });
+ }
+
+ protected void tick(Block b) {
+ BlockMenu inv = BlockStorage.getInventory(b);
+ // 机器正在处理
+ if (isProcessing(b)) {
+ // 剩余时间
+ int timeleft = progress.get(b);
+
+ if (timeleft > 0) {
+ // 还在处理
+ ChestMenuUtils.updateProgressbar(inv, 22, timeleft, processing.get(b).getTicks(), getProgressBar());
+
+ if (ChargableBlock.isChargable(b)) {
+ if (ChargableBlock.getCharge(b) < getEnergyConsumption())
+ return;
+ ChargableBlock.addCharge(b, -getEnergyConsumption());
+ progress.put(b, timeleft - 1);
+ } else
+ progress.put(b, timeleft - 1);
+ } else {
+ // 处理结束
+ inv.replaceExistingItem(22, Utils.addLore(Utils.newItem(Material.PINK_STAINED_GLASS_PANE), " "));
+
+ for (ItemStack output : processing.get(b).getOutput()) {
+ if (output != null)
+ inv.pushItem(output.clone(), getOutputSlots());
+ }
+ progress.remove(b);
+ processing.remove(b);
+ }
+ } else {
+ // 没有在处理
+ MachineRecipe r = null;
+ Map found = new HashMap<>();
+ for (MachineRecipe recipe : recipes) {
+ ItemStack input = recipe.getInput()[0];
+ if (SlimefunUtils.isItemSimilar(inv.getItemInSlot(inputslots[0]), input, true)) {
+ if (input != null) {
+ found.put(inputslots[0], input.getAmount());
+ }
+ }
+ if (found.size() == recipe.getInput().length) {
+ r = recipe;
+ break;
+ } else {
+ found.clear();
+ }
+ }
+
+ if (r != null) {
+ if (ChargableBlock.isChargable(b)) {
+ if (ChargableBlock.getCharge(b) < getEnergyConsumption())
+ return;
+ ChargableBlock.addCharge(b, -getEnergyConsumption());
+ }
+ if (!SlimefunUtils.isItemSimilar(inv.getItemInSlot(40), ClayTechItems.ELEMENT_UNIT, true))
+ return;
+ if (inv.getItemInSlot(outputslots[0]) != null) {
+ ItemStack is = inv.getItemInSlot(outputslots[0]);
+ if (is.getMaxStackSize() == is.getAmount())
+ return;
+ }
+ for (Map.Entry entry : found.entrySet()) {
+ if (entry.getValue() > 0) {
+ inv.consumeItem(entry.getKey(), entry.getValue());
+ inv.consumeItem(40, 1);
+ }
+
+ }
+
+ processing.put(b, r);
+ progress.put(b, r.getTicks());
+ }
+ }
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/abstractMachines/ANewContainer.java b/src/main/java/club/claycoffee/ClayTech/implementation/abstractMachines/ANewContainer.java
index b154cfd..9e6270f 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/abstractMachines/ANewContainer.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/abstractMachines/ANewContainer.java
@@ -1,17 +1,12 @@
package club.claycoffee.ClayTech.implementation.abstractMachines;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.bukkit.Material;
-import org.bukkit.block.Block;
-import org.bukkit.inventory.ItemStack;
-
import io.github.thebusybiscuit.slimefun4.core.attributes.EnergyNetComponent;
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category;
+import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
+import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecipe;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.InventoryBlock;
import me.mrCookieSlime.Slimefun.api.BlockStorage;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
@@ -19,103 +14,107 @@
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
import me.mrCookieSlime.Slimefun.cscorelib2.inventory.InvUtils;
import me.mrCookieSlime.Slimefun.cscorelib2.item.CustomItem;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecipe;
+import org.bukkit.Material;
+import org.bukkit.block.Block;
+import org.bukkit.inventory.ItemStack;
+
+import java.util.HashMap;
+import java.util.Map;
public abstract class ANewContainer extends AContainer implements InventoryBlock, EnergyNetComponent {
- public ANewContainer(Category category, SlimefunItemStack item, String id, RecipeType recipeType,
- ItemStack[] recipe) {
-
- super(category, item, recipeType, recipe);
-
- createPreset(this, getInventoryTitle(), this::constructMenu);
-
- registerBlockHandler(id, (p, b, tool, reason) -> {
- BlockMenu inv = BlockStorage.getInventory(b);
- if (inv != null) {
- for (int slot : getInputSlots()) {
- if (inv.getItemInSlot(slot) != null) {
- b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
- inv.replaceExistingItem(slot, null);
- }
- }
-
- for (int slot : getOutputSlots()) {
- if (inv.getItemInSlot(slot) != null) {
- b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
- inv.replaceExistingItem(slot, null);
- }
- }
- }
-
- progress.remove(b);
- processing.remove(b);
- return true;
- });
-
- this.registerDefaultRecipes();
- }
-
- protected void tick(Block b) {
- BlockMenu inv = BlockStorage.getInventory(b);
-
- if (isProcessing(b)) {
- int timeleft = progress.get(b);
-
- if (timeleft > 0) {
- ChestMenuUtils.updateProgressbar(inv, 22, timeleft, processing.get(b).getTicks(), getProgressBar());
-
- if (ChargableBlock.isChargable(b)) {
- if (ChargableBlock.getCharge(b) < getEnergyConsumption())
- return;
- ChargableBlock.addCharge(b, -getEnergyConsumption());
- progress.put(b, timeleft - 1);
- } else
- progress.put(b, timeleft - 1);
- } else {
- inv.replaceExistingItem(22, new CustomItem(Material.BLACK_STAINED_GLASS_PANE, " "));
-
- for (ItemStack output : processing.get(b).getOutput()) {
- inv.pushItem(output.clone(), getOutputSlots());
- }
-
- progress.remove(b);
- processing.remove(b);
- }
- } else {
- MachineRecipe r = null;
- Map found = new HashMap<>();
-
- for (MachineRecipe recipe : recipes) {
- for (ItemStack input : recipe.getInput()) {
- if(input == null) continue;
- for (int slot : getInputSlots()) {
- if (SlimefunUtils.isItemSimilar(inv.getItemInSlot(slot), input, true)) {
- found.put(slot, input.getAmount());
- break;
- }
- }
- }
- if (found.size() == recipe.getInput().length) {
- r = recipe;
- break;
- } else
- found.clear();
- }
-
- if (r != null) {
- if (!InvUtils.fitAll(inv.toInventory(), r.getOutput(), getOutputSlots())) {
- return;
- }
-
- for (Map.Entry entry : found.entrySet()) {
- inv.consumeItem(entry.getKey(), entry.getValue());
- }
-
- processing.put(b, r);
- progress.put(b, r.getTicks());
- }
- }
- }
+ public ANewContainer(Category category, SlimefunItemStack item, String id, RecipeType recipeType,
+ ItemStack[] recipe) {
+
+ super(category, item, recipeType, recipe);
+
+ createPreset(this, getInventoryTitle(), this::constructMenu);
+
+ registerBlockHandler(id, (p, b, tool, reason) -> {
+ BlockMenu inv = BlockStorage.getInventory(b);
+ if (inv != null) {
+ for (int slot : getInputSlots()) {
+ if (inv.getItemInSlot(slot) != null) {
+ b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
+ inv.replaceExistingItem(slot, null);
+ }
+ }
+
+ for (int slot : getOutputSlots()) {
+ if (inv.getItemInSlot(slot) != null) {
+ b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
+ inv.replaceExistingItem(slot, null);
+ }
+ }
+ }
+
+ progress.remove(b);
+ processing.remove(b);
+ return true;
+ });
+
+ this.registerDefaultRecipes();
+ }
+
+ protected void tick(Block b) {
+ BlockMenu inv = BlockStorage.getInventory(b);
+
+ if (isProcessing(b)) {
+ int timeleft = progress.get(b);
+
+ if (timeleft > 0) {
+ ChestMenuUtils.updateProgressbar(inv, 22, timeleft, processing.get(b).getTicks(), getProgressBar());
+
+ if (ChargableBlock.isChargable(b)) {
+ if (ChargableBlock.getCharge(b) < getEnergyConsumption())
+ return;
+ ChargableBlock.addCharge(b, -getEnergyConsumption());
+ progress.put(b, timeleft - 1);
+ } else
+ progress.put(b, timeleft - 1);
+ } else {
+ inv.replaceExistingItem(22, new CustomItem(Material.BLACK_STAINED_GLASS_PANE, " "));
+
+ for (ItemStack output : processing.get(b).getOutput()) {
+ inv.pushItem(output.clone(), getOutputSlots());
+ }
+
+ progress.remove(b);
+ processing.remove(b);
+ }
+ } else {
+ MachineRecipe r = null;
+ Map found = new HashMap<>();
+
+ for (MachineRecipe recipe : recipes) {
+ for (ItemStack input : recipe.getInput()) {
+ if (input == null) continue;
+ for (int slot : getInputSlots()) {
+ if (SlimefunUtils.isItemSimilar(inv.getItemInSlot(slot), input, true)) {
+ found.put(slot, input.getAmount());
+ break;
+ }
+ }
+ }
+ if (found.size() == recipe.getInput().length) {
+ r = recipe;
+ break;
+ } else
+ found.clear();
+ }
+
+ if (r != null) {
+ if (!InvUtils.fitAll(inv.toInventory(), r.getOutput(), getOutputSlots())) {
+ return;
+ }
+
+ for (Map.Entry entry : found.entrySet()) {
+ inv.consumeItem(entry.getKey(), entry.getValue());
+ }
+
+ processing.put(b, r);
+ progress.put(b, r.getTicks());
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/abstractMachines/ARocketTable.java b/src/main/java/club/claycoffee/ClayTech/implementation/abstractMachines/ARocketTable.java
index 2fbe24a..8f45fff 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/abstractMachines/ARocketTable.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/abstractMachines/ARocketTable.java
@@ -1,24 +1,15 @@
package club.claycoffee.ClayTech.implementation.abstractMachines;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.scheduler.BukkitRunnable;
-
import club.claycoffee.ClayTech.ClayTech;
import club.claycoffee.ClayTech.api.listeners.PlayerAssembleEvent;
import club.claycoffee.ClayTech.utils.Lang;
import club.claycoffee.ClayTech.utils.Utils;
-
-import org.bukkit.Bukkit;
-import org.bukkit.Material;
-import org.bukkit.block.Block;
-import org.bukkit.entity.Player;
-import org.bukkit.event.inventory.InventoryClickEvent;
-
+import io.github.thebusybiscuit.slimefun4.core.attributes.EnergyNetComponent;
+import io.github.thebusybiscuit.slimefun4.core.networks.energy.EnergyNetComponentType;
+import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
+import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
+import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
+import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category;
@@ -29,267 +20,271 @@
import me.mrCookieSlime.Slimefun.api.BlockStorage;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
import me.mrCookieSlime.Slimefun.api.energy.ChargableBlock;
-import io.github.thebusybiscuit.slimefun4.core.networks.energy.EnergyNetComponentType;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset;
-import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
-import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler;
-import io.github.thebusybiscuit.slimefun4.core.attributes.EnergyNetComponent;
-import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
-import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
+import org.bukkit.Bukkit;
+import org.bukkit.Material;
+import org.bukkit.block.Block;
+import org.bukkit.entity.Player;
+import org.bukkit.event.inventory.InventoryClickEvent;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.scheduler.BukkitRunnable;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
public abstract class ARocketTable extends SlimefunItem implements InventoryBlock, EnergyNetComponent {
- public static Map processing = new HashMap<>();
- public static Map progress = new HashMap<>();
- public final static int[] inputslots = new int[] { 11, 19, 20, 21, 28, 29, 30, 37, 38, 39 };
- public final static int[] outputslots = new int[] { 34 };
-
- protected final List recipes = new ArrayList<>();
-
- private static final int[] BORDER = { 0, 1, 3, 5, 6, 7, 8, 14, 15, 16, 17, 23, 41, 50, 51, 52, 53, 32 };
- private static final int[] BORDER_IN = { 9, 10, 12, 13, 18, 22, 27, 31, 36, 40, 45, 46, 47, 48, 49 };
- private static final int[] BORDER_OUT = { 24, 25, 26, 33, 35, 42, 43, 44 };
- private static final ItemStack BORDER_ITEM = Utils.newItemD(Material.LIGHT_BLUE_STAINED_GLASS_PANE,
- Lang.readMachinesText("SPLIT_LINE"));
- private static final ItemStack OTHERBORDER_ITEM = Utils.newItemD(Material.LIME_STAINED_GLASS_PANE,
- Lang.readMachinesText("SPLIT_LINE"));
- SlimefunItemStack items;
- private ItemStack item;
-
- public ARocketTable(Category category, SlimefunItemStack item, String id, RecipeType recipeType,
- ItemStack[] recipe) {
-
- super(category, item, recipeType, recipe);
-
- createPreset(this, getInventoryTitle(), this::SetupMenu);
-
- registerBlockHandler(id, (p, b, tool, reason) -> {
- BlockMenu inv = BlockStorage.getInventory(b);
- if (inv != null) {
- for (int slot : getInputSlots()) {
- if (inv.getItemInSlot(slot) != null) {
- b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
- inv.replaceExistingItem(slot, null);
- }
- }
-
- for (int slot : getOutputSlots()) {
- if (inv.getItemInSlot(slot) != null) {
- b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
- inv.replaceExistingItem(slot, null);
- }
- }
- }
-
- progress.remove(b);
- processing.remove(b);
- return true;
- });
-
- this.registerDefaultRecipes();
- }
-
- public int[] getInputSlots() {
- return inputslots;
- }
-
- @Override
- public int[] getOutputSlots() {
- return outputslots;
- }
-
- public abstract String getInventoryTitle();
-
- public abstract ItemStack getProgressBar();
-
- public abstract int getEnergyConsumption();
-
- public abstract int getSpeed();
-
- public abstract String getMachineIdentifier();
-
- public void SetupMenu(BlockMenuPreset Preset) {
- Preset.addItem(5, BORDER_ITEM, ChestMenuUtils.getEmptyClickHandler());
- for (int eachID : BORDER) {
- Preset.addItem(eachID, BORDER_ITEM, ChestMenuUtils.getEmptyClickHandler());
- }
- for (int eachID : BORDER_IN) {
- Preset.addItem(eachID, OTHERBORDER_ITEM, ChestMenuUtils.getEmptyClickHandler());
- }
- for (int eachID : BORDER_OUT) {
- Preset.addItem(eachID, OTHERBORDER_ITEM, ChestMenuUtils.getEmptyClickHandler());
- }
- Preset.addItem(4, Utils.addLore(Utils.newItem(Material.BLACK_STAINED_GLASS_PANE), " "),
- ChestMenuUtils.getEmptyClickHandler());
-
- Preset.addItem(2, Utils.setDisplayName(new ItemStack(Material.RED_STAINED_GLASS_PANE),
- Lang.readMachinesText("ROCKET_ASSEMBLING_BLUEPRINT")), ChestMenuUtils.getEmptyClickHandler());
-
- Preset.addItem(5, BORDER_ITEM, ChestMenuUtils.getEmptyClickHandler());
- for (int i : getOutputSlots()) {
- Preset.addMenuClickHandler(i, new AdvancedMenuClickHandler() {
-
- @Override
- public boolean onClick(Player p, int slot, ItemStack cursor, ClickAction action) {
- return false;
- }
-
- @Override
- public boolean onClick(InventoryClickEvent e, Player p, int slot, ItemStack cursor,
- ClickAction action) {
- return cursor == null || cursor.getType() == null || cursor.getType() == Material.AIR;
- }
- });
- }
- }
-
- public void registerDefaultRecipes() {
-
- }
-
- @Override
- public io.github.thebusybiscuit.slimefun4.core.networks.energy.EnergyNetComponentType getEnergyComponentType() {
- return EnergyNetComponentType.CONSUMER;
- }
-
- @Override
- public int getCapacity() {
- return 0;
- }
-
- public List getDisplayRecipes() {
- List displayRecipes = new ArrayList<>(recipes.size() * 2);
-
- for (MachineRecipe recipe : recipes) {
- if (recipe.getInput().length != 1)
- continue;
-
- displayRecipes.add(recipe.getInput()[0]);
- displayRecipes.add(recipe.getOutput()[0]);
- }
-
- return displayRecipes;
- }
-
- public MachineRecipe getProcessing(Block b) {
- return processing.get(b);
- }
-
- public boolean isProcessing(Block b) {
- return getProcessing(b) != null;
- }
-
- public void registerRecipe(MachineRecipe recipe) {
- recipe.setTicks(recipe.getTicks() / getSpeed());
- recipes.add(recipe);
- }
-
- public void registerRecipe(int seconds, ItemStack[] input, ItemStack[] output) {
- registerRecipe(new MachineRecipe(seconds, input, output));
- }
-
- @Override
- public void preRegister() {
- addItemHandler(new BlockTicker() {
- @Override
- public void tick(Block b, SlimefunItem sf, Config data) {
- ARocketTable.this.tick(b);
- }
-
- @Override
- public boolean isSynchronized() {
- return false;
- }
- });
- }
-
- protected void tick(Block b) {
- BlockMenu inv = BlockStorage.getInventory(b);
- // 机器正在处理
- if (isProcessing(b)) {
- // 剩余时间
- int timeleft = progress.get(b);
-
- if (timeleft > 0) {
- // 还在处理
- ChestMenuUtils.updateProgressbar(inv, 4, timeleft, processing.get(b).getTicks(), getProgressBar());
-
- if (ChargableBlock.isChargable(b)) {
- if (ChargableBlock.getCharge(b) < getEnergyConsumption())
- return;
- ChargableBlock.addCharge(b, -getEnergyConsumption());
- progress.put(b, timeleft - 1);
- } else
- progress.put(b, timeleft - 1);
- } else {
- // 处理结束
- inv.replaceExistingItem(4, Utils.addLore(Utils.newItem(Material.BLACK_STAINED_GLASS_PANE), " "));
-
- for (ItemStack output : processing.get(b).getOutput()) {
- if (output != null)
- inv.pushItem(output.clone(), getOutputSlots());
- }
- new BukkitRunnable() {
-
- @Override
- public void run() {
- Bukkit.getPluginManager()
- .callEvent(new PlayerAssembleEvent(b, processing.get(b).getInput(), item));
- }
-
- }.runTask(ClayTech.getInstance());
- progress.remove(b);
- processing.remove(b);
- }
- } else {
- // 没有在处理
- MachineRecipe r = null;
- Map found = new HashMap<>();
- int i;
- for (MachineRecipe recipe : recipes) {
- i = 0;
- for (ItemStack input : recipe.getInput()) {
- if (SlimefunUtils.isItemSimilar(inv.getItemInSlot(inputslots[i]), input, true)) {
- // 如果该位置的物品符合某合成配方的对应位置物品
- if (input != null) {
- found.put(inputslots[i], input.getAmount());
- }
- }
- if (inv.getItemInSlot(inputslots[i]) == input && input == null) {
- found.put(i, 0);
- }
- if (i < 9) {
- i++;
- } else
- i = 0;
- }
- if (found.size() == recipe.getInput().length) {
- r = recipe;
- break;
- } else
- found.clear();
- }
-
- if (r != null) {
- if (ChargableBlock.isChargable(b)) {
- if (ChargableBlock.getCharge(b) < getEnergyConsumption())
- return;
- ChargableBlock.addCharge(b, -getEnergyConsumption());
- }
- if (inv.getItemInSlot(outputslots[0]) != null) {
- ItemStack is = inv.getItemInSlot(outputslots[0]);
- if (is.getMaxStackSize() == is.getAmount())
- return;
- }
- for (Map.Entry entry : found.entrySet()) {
- if (entry.getValue() > 0)
- inv.consumeItem(entry.getKey(), entry.getValue());
- }
- item = r.getOutput()[0];
- processing.put(b, r);
- progress.put(b, r.getTicks());
- }
- }
- }
+ public final static int[] inputslots = new int[]{11, 19, 20, 21, 28, 29, 30, 37, 38, 39};
+ public final static int[] outputslots = new int[]{34};
+ private static final int[] BORDER = {0, 1, 3, 5, 6, 7, 8, 14, 15, 16, 17, 23, 41, 50, 51, 52, 53, 32};
+ private static final int[] BORDER_IN = {9, 10, 12, 13, 18, 22, 27, 31, 36, 40, 45, 46, 47, 48, 49};
+ private static final int[] BORDER_OUT = {24, 25, 26, 33, 35, 42, 43, 44};
+ private static final ItemStack BORDER_ITEM = Utils.newItemD(Material.LIGHT_BLUE_STAINED_GLASS_PANE,
+ Lang.readMachinesText("SPLIT_LINE"));
+ private static final ItemStack OTHERBORDER_ITEM = Utils.newItemD(Material.LIME_STAINED_GLASS_PANE,
+ Lang.readMachinesText("SPLIT_LINE"));
+ public static Map processing = new HashMap<>();
+ public static Map progress = new HashMap<>();
+ protected final List recipes = new ArrayList<>();
+ SlimefunItemStack items;
+ private ItemStack item;
+
+ public ARocketTable(Category category, SlimefunItemStack item, String id, RecipeType recipeType,
+ ItemStack[] recipe) {
+
+ super(category, item, recipeType, recipe);
+
+ createPreset(this, getInventoryTitle(), this::SetupMenu);
+
+ registerBlockHandler(id, (p, b, tool, reason) -> {
+ BlockMenu inv = BlockStorage.getInventory(b);
+ if (inv != null) {
+ for (int slot : getInputSlots()) {
+ if (inv.getItemInSlot(slot) != null) {
+ b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
+ inv.replaceExistingItem(slot, null);
+ }
+ }
+
+ for (int slot : getOutputSlots()) {
+ if (inv.getItemInSlot(slot) != null) {
+ b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
+ inv.replaceExistingItem(slot, null);
+ }
+ }
+ }
+
+ progress.remove(b);
+ processing.remove(b);
+ return true;
+ });
+
+ this.registerDefaultRecipes();
+ }
+
+ public int[] getInputSlots() {
+ return inputslots;
+ }
+
+ @Override
+ public int[] getOutputSlots() {
+ return outputslots;
+ }
+
+ public abstract String getInventoryTitle();
+
+ public abstract ItemStack getProgressBar();
+
+ public abstract int getEnergyConsumption();
+
+ public abstract int getSpeed();
+
+ public abstract String getMachineIdentifier();
+
+ public void SetupMenu(BlockMenuPreset Preset) {
+ Preset.addItem(5, BORDER_ITEM, ChestMenuUtils.getEmptyClickHandler());
+ for (int eachID : BORDER) {
+ Preset.addItem(eachID, BORDER_ITEM, ChestMenuUtils.getEmptyClickHandler());
+ }
+ for (int eachID : BORDER_IN) {
+ Preset.addItem(eachID, OTHERBORDER_ITEM, ChestMenuUtils.getEmptyClickHandler());
+ }
+ for (int eachID : BORDER_OUT) {
+ Preset.addItem(eachID, OTHERBORDER_ITEM, ChestMenuUtils.getEmptyClickHandler());
+ }
+ Preset.addItem(4, Utils.addLore(Utils.newItem(Material.BLACK_STAINED_GLASS_PANE), " "),
+ ChestMenuUtils.getEmptyClickHandler());
+
+ Preset.addItem(2, Utils.setDisplayName(new ItemStack(Material.RED_STAINED_GLASS_PANE),
+ Lang.readMachinesText("ROCKET_ASSEMBLING_BLUEPRINT")), ChestMenuUtils.getEmptyClickHandler());
+
+ Preset.addItem(5, BORDER_ITEM, ChestMenuUtils.getEmptyClickHandler());
+ for (int i : getOutputSlots()) {
+ Preset.addMenuClickHandler(i, new AdvancedMenuClickHandler() {
+
+ @Override
+ public boolean onClick(Player p, int slot, ItemStack cursor, ClickAction action) {
+ return false;
+ }
+
+ @Override
+ public boolean onClick(InventoryClickEvent e, Player p, int slot, ItemStack cursor,
+ ClickAction action) {
+ return cursor == null || cursor.getType() == null || cursor.getType() == Material.AIR;
+ }
+ });
+ }
+ }
+
+ public void registerDefaultRecipes() {
+
+ }
+
+ @Override
+ public io.github.thebusybiscuit.slimefun4.core.networks.energy.EnergyNetComponentType getEnergyComponentType() {
+ return EnergyNetComponentType.CONSUMER;
+ }
+
+ @Override
+ public int getCapacity() {
+ return 0;
+ }
+
+ public List getDisplayRecipes() {
+ List displayRecipes = new ArrayList<>(recipes.size() * 2);
+
+ for (MachineRecipe recipe : recipes) {
+ if (recipe.getInput().length != 1)
+ continue;
+
+ displayRecipes.add(recipe.getInput()[0]);
+ displayRecipes.add(recipe.getOutput()[0]);
+ }
+
+ return displayRecipes;
+ }
+
+ public MachineRecipe getProcessing(Block b) {
+ return processing.get(b);
+ }
+
+ public boolean isProcessing(Block b) {
+ return getProcessing(b) != null;
+ }
+
+ public void registerRecipe(MachineRecipe recipe) {
+ recipe.setTicks(recipe.getTicks() / getSpeed());
+ recipes.add(recipe);
+ }
+
+ public void registerRecipe(int seconds, ItemStack[] input, ItemStack[] output) {
+ registerRecipe(new MachineRecipe(seconds, input, output));
+ }
+
+ @Override
+ public void preRegister() {
+ addItemHandler(new BlockTicker() {
+ @Override
+ public void tick(Block b, SlimefunItem sf, Config data) {
+ ARocketTable.this.tick(b);
+ }
+
+ @Override
+ public boolean isSynchronized() {
+ return false;
+ }
+ });
+ }
+
+ protected void tick(Block b) {
+ BlockMenu inv = BlockStorage.getInventory(b);
+ // 机器正在处理
+ if (isProcessing(b)) {
+ // 剩余时间
+ int timeleft = progress.get(b);
+
+ if (timeleft > 0) {
+ // 还在处理
+ ChestMenuUtils.updateProgressbar(inv, 4, timeleft, processing.get(b).getTicks(), getProgressBar());
+
+ if (ChargableBlock.isChargable(b)) {
+ if (ChargableBlock.getCharge(b) < getEnergyConsumption())
+ return;
+ ChargableBlock.addCharge(b, -getEnergyConsumption());
+ progress.put(b, timeleft - 1);
+ } else
+ progress.put(b, timeleft - 1);
+ } else {
+ // 处理结束
+ inv.replaceExistingItem(4, Utils.addLore(Utils.newItem(Material.BLACK_STAINED_GLASS_PANE), " "));
+
+ for (ItemStack output : processing.get(b).getOutput()) {
+ if (output != null)
+ inv.pushItem(output.clone(), getOutputSlots());
+ }
+ new BukkitRunnable() {
+
+ @Override
+ public void run() {
+ Bukkit.getPluginManager()
+ .callEvent(new PlayerAssembleEvent(b, processing.get(b).getInput(), item));
+ }
+
+ }.runTask(ClayTech.getInstance());
+ progress.remove(b);
+ processing.remove(b);
+ }
+ } else {
+ // 没有在处理
+ MachineRecipe r = null;
+ Map found = new HashMap<>();
+ int i;
+ for (MachineRecipe recipe : recipes) {
+ i = 0;
+ for (ItemStack input : recipe.getInput()) {
+ if (SlimefunUtils.isItemSimilar(inv.getItemInSlot(inputslots[i]), input, true)) {
+ // 如果该位置的物品符合某合成配方的对应位置物品
+ if (input != null) {
+ found.put(inputslots[i], input.getAmount());
+ }
+ }
+ if (inv.getItemInSlot(inputslots[i]) == input && input == null) {
+ found.put(i, 0);
+ }
+ if (i < 9) {
+ i++;
+ } else
+ i = 0;
+ }
+ if (found.size() == recipe.getInput().length) {
+ r = recipe;
+ break;
+ } else
+ found.clear();
+ }
+
+ if (r != null) {
+ if (ChargableBlock.isChargable(b)) {
+ if (ChargableBlock.getCharge(b) < getEnergyConsumption())
+ return;
+ ChargableBlock.addCharge(b, -getEnergyConsumption());
+ }
+ if (inv.getItemInSlot(outputslots[0]) != null) {
+ ItemStack is = inv.getItemInSlot(outputslots[0]);
+ if (is.getMaxStackSize() == is.getAmount())
+ return;
+ }
+ for (Map.Entry entry : found.entrySet()) {
+ if (entry.getValue() > 0)
+ inv.consumeItem(entry.getKey(), entry.getValue());
+ }
+ item = r.getOutput()[0];
+ processing.put(b, r);
+ progress.put(b, r.getTicks());
+ }
+ }
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/items/Armors.java b/src/main/java/club/claycoffee/ClayTech/implementation/items/Armors.java
index af809fc..a49cec6 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/items/Armors.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/items/Armors.java
@@ -1,8 +1,5 @@
package club.claycoffee.ClayTech.implementation.items;
-import org.bukkit.NamespacedKey;
-import org.bukkit.inventory.ItemStack;
-
import club.claycoffee.ClayTech.ClayTech;
import club.claycoffee.ClayTech.ClayTechItems;
import club.claycoffee.ClayTech.ClayTechMachineRecipes;
@@ -11,29 +8,31 @@
import club.claycoffee.ClayTech.utils.Slimefunutils;
import io.github.thebusybiscuit.slimefun4.core.researching.Research;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
+import org.bukkit.NamespacedKey;
+import org.bukkit.inventory.ItemStack;
public class Armors {
- public Armors() {
+ public Armors() {
- Slimefunutils.registerItem(ClayTechItems.C_ARMORS, "ANTI_SLOWNESS_BOOTS", ClayTechItems.ANTI_SLOWNESS_BOOTS,
- "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.ANTI_SLOWNESS_BOOTS,
- false);
+ Slimefunutils.registerItem(ClayTechItems.C_ARMORS, "ANTI_SLOWNESS_BOOTS", ClayTechItems.ANTI_SLOWNESS_BOOTS,
+ "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.ANTI_SLOWNESS_BOOTS,
+ false);
- Research basic = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_ARMORS"), 9908,
- Lang.readResearchesText("CLAYTECH_ARMORS_I"), 50);
- basic.addItems(SlimefunItem.getByItem(ClayTechItems.ANTI_SLOWNESS_BOOTS));
- basic.register();
+ Research basic = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_ARMORS"), 9908,
+ Lang.readResearchesText("CLAYTECH_ARMORS_I"), 50);
+ basic.addItems(SlimefunItem.getByItem(ClayTechItems.ANTI_SLOWNESS_BOOTS));
+ basic.register();
- Slimefunutils.registerArmors(ClayTechItems.C_ARMORS, "CLAY_ALLOY",
- new ItemStack[] { ClayTechItems.CLAY_ALLOY_HELMET, ClayTechItems.CLAY_ALLOY_CHESTPLATE,
- ClayTechItems.CLAY_ALLOY_LEGGINGS, ClayTechItems.CLAY_ALLOY_BOOTS },
- "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechItems.CLAY_ALLOY_INGOT, false);
- Research clayalloy = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_CLAY_ALLOY_ARMORS_I"),
- 9924, Lang.readResearchesText("CLAYTECH_CLAY_ALLOY_ARMORS_I"), 65);
- clayalloy.addItems(SlimefunItem.getByItem(ClayTechItems.CLAY_ALLOY_HELMET),
- SlimefunItem.getByItem(ClayTechItems.CLAY_ALLOY_CHESTPLATE),
- SlimefunItem.getByItem(ClayTechItems.CLAY_ALLOY_LEGGINGS),
- SlimefunItem.getByItem(ClayTechItems.CLAY_ALLOY_BOOTS));
- clayalloy.register();
- }
+ Slimefunutils.registerArmors(ClayTechItems.C_ARMORS, "CLAY_ALLOY",
+ new ItemStack[]{ClayTechItems.CLAY_ALLOY_HELMET, ClayTechItems.CLAY_ALLOY_CHESTPLATE,
+ ClayTechItems.CLAY_ALLOY_LEGGINGS, ClayTechItems.CLAY_ALLOY_BOOTS},
+ "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechItems.CLAY_ALLOY_INGOT, false);
+ Research clayalloy = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_CLAY_ALLOY_ARMORS_I"),
+ 9924, Lang.readResearchesText("CLAYTECH_CLAY_ALLOY_ARMORS_I"), 65);
+ clayalloy.addItems(SlimefunItem.getByItem(ClayTechItems.CLAY_ALLOY_HELMET),
+ SlimefunItem.getByItem(ClayTechItems.CLAY_ALLOY_CHESTPLATE),
+ SlimefunItem.getByItem(ClayTechItems.CLAY_ALLOY_LEGGINGS),
+ SlimefunItem.getByItem(ClayTechItems.CLAY_ALLOY_BOOTS));
+ clayalloy.register();
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/items/ClayFuelResource.java b/src/main/java/club/claycoffee/ClayTech/implementation/items/ClayFuelResource.java
index e2a968e..6cc986c 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/items/ClayFuelResource.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/items/ClayFuelResource.java
@@ -5,8 +5,8 @@
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
public class ClayFuelResource {
- public ClayFuelResource() {
- Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "CLAY_FUEL", ClayTechItems.CLAY_FUEL, "notresearch", 10,
- RecipeType.GEO_MINER, ClayTechItems.NORECIPE, false);
- }
+ public ClayFuelResource() {
+ Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "CLAY_FUEL", ClayTechItems.CLAY_FUEL, "notresearch", 10,
+ RecipeType.GEO_MINER, ClayTechItems.NORECIPE, false);
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/items/Clay_basic.java b/src/main/java/club/claycoffee/ClayTech/implementation/items/Clay_basic.java
index 2c763c7..b07a1bd 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/items/Clay_basic.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/items/Clay_basic.java
@@ -1,60 +1,59 @@
package club.claycoffee.ClayTech.implementation.items;
-import org.bukkit.Material;
-import org.bukkit.NamespacedKey;
-import org.bukkit.inventory.ItemStack;
-
import club.claycoffee.ClayTech.ClayTech;
import club.claycoffee.ClayTech.ClayTechItems;
import club.claycoffee.ClayTech.utils.Lang;
import club.claycoffee.ClayTech.utils.Slimefunutils;
-import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import io.github.thebusybiscuit.slimefun4.core.researching.Research;
+import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
+import org.bukkit.Material;
+import org.bukkit.NamespacedKey;
+import org.bukkit.inventory.ItemStack;
public class Clay_basic {
- public Clay_basic() {
- ItemStack endingot2 = new ItemStack(Material.COAL);
-
- ItemStack[] recipea = { endingot2, new ItemStack(Material.IRON_INGOT), endingot2,
- new ItemStack(Material.IRON_INGOT), new ItemStack(Material.CLAY), new ItemStack(Material.IRON_INGOT),
- endingot2, new ItemStack(Material.IRON_INGOT), endingot2 };
- ItemStack[] recipeb = { endingot2, new ItemStack(Material.IRON_INGOT), endingot2, new ItemStack(Material.DIRT),
- new ItemStack(Material.STICK), new ItemStack(Material.DIRT), endingot2,
- new ItemStack(Material.IRON_INGOT), endingot2 };
-
- Slimefunutils.registerItem(ClayTechItems.C_BASICS, "MAGIC_CLAY", ClayTechItems.MAGIC_CLAY, "notresearch", 10,
- RecipeType.ENHANCED_CRAFTING_TABLE, recipea, false);
- Slimefunutils.registerItem(ClayTechItems.C_BASICS, "CLAY_STICK", ClayTechItems.CLAY_STICK, "notresearch", 10,
- RecipeType.ENHANCED_CRAFTING_TABLE, recipeb, false);
-
- Research basic = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_BASIC"), 9900,
- Lang.readResearchesText("CLAYTECH_START"), 20);
- basic.addItems(SlimefunItem.getByItem(ClayTechItems.MAGIC_CLAY),
- SlimefunItem.getByItem(ClayTechItems.CLAY_STICK));
- basic.register();
-
- Research basic2 = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_ELECBASIC"), 9915,
- Lang.readResearchesText("CLAYTECH_ELECTRICMACHINE"), 65);
- basic2.addItems(SlimefunItem.getByItem(ClayTechItems.CLAY_CRAFTING_TABLE),
- SlimefunItem.getByItem(ClayTechItems.CLAY_ELECTRIC_STONE_CRUSHER),
- SlimefunItem.getByItem(ClayTechItems.CLAY_FOOD_CAULDRON),
- SlimefunItem.getByItem(ClayTechItems.CLAY_FOOD_CHALKING_MACHINE));
- basic2.register();
-
- Research basic3 = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_ELEMACHINE"), 9918,
- Lang.readResearchesText("CLAYTECH_ELEMENT_EXTRACTER_MACHINE"), 65);
- basic3.addItems(SlimefunItem.getByItem(ClayTechItems.CLAY_ELEMENT_EXTRACTER));
- basic3.register();
-
- Research basic4 = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_COBBLESTONE_GENERATOR"),
- 9932, Lang.readResearchesText("CLAYTECH_COBBLESTONE_GENERATOR"), 65);
- basic4.addItems(SlimefunItem.getByItem(ClayTechItems.CLAY_COBBLESTONE_GENERATOR));
- basic4.register();
-
- Research basic5 = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_ELECTRIC_WATER_PUMP"), 9933,
- Lang.readResearchesText("CLAYTECH_ELECTRIC_WATER_PUMP"), 65);
- basic5.addItems(SlimefunItem.getByItem(ClayTechItems.CLAY_ELECTRIC_WATER_PUMP));
- basic5.register();
- }
+ public Clay_basic() {
+ ItemStack endingot2 = new ItemStack(Material.COAL);
+
+ ItemStack[] recipea = {endingot2, new ItemStack(Material.IRON_INGOT), endingot2,
+ new ItemStack(Material.IRON_INGOT), new ItemStack(Material.CLAY), new ItemStack(Material.IRON_INGOT),
+ endingot2, new ItemStack(Material.IRON_INGOT), endingot2};
+ ItemStack[] recipeb = {endingot2, new ItemStack(Material.IRON_INGOT), endingot2, new ItemStack(Material.DIRT),
+ new ItemStack(Material.STICK), new ItemStack(Material.DIRT), endingot2,
+ new ItemStack(Material.IRON_INGOT), endingot2};
+
+ Slimefunutils.registerItem(ClayTechItems.C_BASICS, "MAGIC_CLAY", ClayTechItems.MAGIC_CLAY, "notresearch", 10,
+ RecipeType.ENHANCED_CRAFTING_TABLE, recipea, false);
+ Slimefunutils.registerItem(ClayTechItems.C_BASICS, "CLAY_STICK", ClayTechItems.CLAY_STICK, "notresearch", 10,
+ RecipeType.ENHANCED_CRAFTING_TABLE, recipeb, false);
+
+ Research basic = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_BASIC"), 9900,
+ Lang.readResearchesText("CLAYTECH_START"), 20);
+ basic.addItems(SlimefunItem.getByItem(ClayTechItems.MAGIC_CLAY),
+ SlimefunItem.getByItem(ClayTechItems.CLAY_STICK));
+ basic.register();
+
+ Research basic2 = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_ELECBASIC"), 9915,
+ Lang.readResearchesText("CLAYTECH_ELECTRICMACHINE"), 65);
+ basic2.addItems(SlimefunItem.getByItem(ClayTechItems.CLAY_CRAFTING_TABLE),
+ SlimefunItem.getByItem(ClayTechItems.CLAY_ELECTRIC_STONE_CRUSHER),
+ SlimefunItem.getByItem(ClayTechItems.CLAY_FOOD_CAULDRON),
+ SlimefunItem.getByItem(ClayTechItems.CLAY_FOOD_CHALKING_MACHINE));
+ basic2.register();
+
+ Research basic3 = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_ELEMACHINE"), 9918,
+ Lang.readResearchesText("CLAYTECH_ELEMENT_EXTRACTER_MACHINE"), 65);
+ basic3.addItems(SlimefunItem.getByItem(ClayTechItems.CLAY_ELEMENT_EXTRACTER));
+ basic3.register();
+
+ Research basic4 = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_COBBLESTONE_GENERATOR"),
+ 9932, Lang.readResearchesText("CLAYTECH_COBBLESTONE_GENERATOR"), 65);
+ basic4.addItems(SlimefunItem.getByItem(ClayTechItems.CLAY_COBBLESTONE_GENERATOR));
+ basic4.register();
+
+ Research basic5 = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_ELECTRIC_WATER_PUMP"), 9933,
+ Lang.readResearchesText("CLAYTECH_ELECTRIC_WATER_PUMP"), 65);
+ basic5.addItems(SlimefunItem.getByItem(ClayTechItems.CLAY_ELECTRIC_WATER_PUMP));
+ basic5.register();
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/items/DrinkMakingStaff.java b/src/main/java/club/claycoffee/ClayTech/implementation/items/DrinkMakingStaff.java
index aace0fa..d4a7291 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/items/DrinkMakingStaff.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/items/DrinkMakingStaff.java
@@ -1,62 +1,61 @@
package club.claycoffee.ClayTech.implementation.items;
-import org.bukkit.Material;
-import org.bukkit.NamespacedKey;
-import org.bukkit.inventory.ItemStack;
-
import club.claycoffee.ClayTech.ClayTech;
import club.claycoffee.ClayTech.ClayTechItems;
import club.claycoffee.ClayTech.ClayTechMachineRecipes;
import club.claycoffee.ClayTech.ClayTechRecipeType;
import club.claycoffee.ClayTech.utils.Lang;
import club.claycoffee.ClayTech.utils.Slimefunutils;
-import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import io.github.thebusybiscuit.slimefun4.core.researching.Research;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
+import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
+import org.bukkit.Material;
+import org.bukkit.NamespacedKey;
+import org.bukkit.inventory.ItemStack;
public class DrinkMakingStaff {
- public DrinkMakingStaff() {
- ItemStack[] recipea = { new ItemStack(Material.COCOA_BEANS), new ItemStack(Material.COCOA_BEANS),
- new ItemStack(Material.COCOA_BEANS), new ItemStack(Material.COCOA_BEANS), ClayTechItems.CLAY_STICK,
- new ItemStack(Material.COCOA_BEANS), new ItemStack(Material.COCOA_BEANS),
- new ItemStack(Material.COCOA_BEANS), new ItemStack(Material.COCOA_BEANS) };
- ItemStack[] recipeb = { null, null, null, null, SlimefunItems.OIL_BUCKET, null, null, null, null };
- ItemStack[] recipec = { ClayTechItems.PLASTIC, ClayTechItems.PLASTIC, ClayTechItems.PLASTIC,
- ClayTechItems.PLASTIC, ClayTechItems.MAGIC_CLAY, ClayTechItems.PLASTIC, ClayTechItems.PLASTIC,
- ClayTechItems.PLASTIC, ClayTechItems.PLASTIC };
+ public DrinkMakingStaff() {
+ ItemStack[] recipea = {new ItemStack(Material.COCOA_BEANS), new ItemStack(Material.COCOA_BEANS),
+ new ItemStack(Material.COCOA_BEANS), new ItemStack(Material.COCOA_BEANS), ClayTechItems.CLAY_STICK,
+ new ItemStack(Material.COCOA_BEANS), new ItemStack(Material.COCOA_BEANS),
+ new ItemStack(Material.COCOA_BEANS), new ItemStack(Material.COCOA_BEANS)};
+ ItemStack[] recipeb = {null, null, null, null, SlimefunItems.OIL_BUCKET, null, null, null, null};
+ ItemStack[] recipec = {ClayTechItems.PLASTIC, ClayTechItems.PLASTIC, ClayTechItems.PLASTIC,
+ ClayTechItems.PLASTIC, ClayTechItems.MAGIC_CLAY, ClayTechItems.PLASTIC, ClayTechItems.PLASTIC,
+ ClayTechItems.PLASTIC, ClayTechItems.PLASTIC};
- Slimefunutils.registerItem(ClayTechItems.C_FOODMATERIALS, "COCOA_BEAN", ClayTechItems.COCOA_BEAN, "notresearch",
- 10, RecipeType.ENHANCED_CRAFTING_TABLE, recipea, false);
- Slimefunutils.registerItem(ClayTechItems.C_FOODMATERIALS, "PLASTIC", ClayTechItems.PLASTIC, "notresearch", 10,
- RecipeType.ENHANCED_CRAFTING_TABLE, recipeb, false);
- Slimefunutils.registerItem(ClayTechItems.C_FOODMATERIALS, "DRINK_BOTTLE", ClayTechItems.DRINK_BOTTLE,
- "notresearch", 10, RecipeType.ENHANCED_CRAFTING_TABLE, recipec, false);
- Slimefunutils.registerItem(ClayTechItems.C_FOODMATERIALS, "DIRTY_DRINK_BOTTLE",
- ClayTechItems.DIRTY_DRINK_BOTTLE, "notresearch", 10, RecipeType.NULL, ClayTechItems.NORECIPE, false);
- Slimefunutils.registerItem(ClayTechItems.C_FOODMATERIALS, "DIRTY_TEA", ClayTechItems.DIRTY_TEA, "notresearch",
- 10, ClayTechRecipeType.HARVEST, ClayTechItems.NORECIPE, false);
- Slimefunutils.registerItem(ClayTechItems.C_FOODMATERIALS, "RAW_TEA", ClayTechItems.RAW_TEA, "notresearch", 10,
- ClayTechRecipeType.CLEANING, ClayTechItems.NORECIPE, false);
- Slimefunutils.registerItem(ClayTechItems.C_FOODMATERIALS, "TEA_POWDER", ClayTechItems.TEA_POWDER, "notresearch",
- 10, ClayTechRecipeType.CLAY_FOOD_CHALKING_MACHINE, ClayTechMachineRecipes.TEA_POWDER, false);
- Slimefunutils.registerItem(ClayTechItems.C_FOODMATERIALS, "LEMON_POWDER", ClayTechItems.LEMON_POWDER,
- "notresearch", 10, ClayTechRecipeType.CLAY_FOOD_CHALKING_MACHINE, ClayTechMachineRecipes.LEMON_POWDER,
- false);
+ Slimefunutils.registerItem(ClayTechItems.C_FOODMATERIALS, "COCOA_BEAN", ClayTechItems.COCOA_BEAN, "notresearch",
+ 10, RecipeType.ENHANCED_CRAFTING_TABLE, recipea, false);
+ Slimefunutils.registerItem(ClayTechItems.C_FOODMATERIALS, "PLASTIC", ClayTechItems.PLASTIC, "notresearch", 10,
+ RecipeType.ENHANCED_CRAFTING_TABLE, recipeb, false);
+ Slimefunutils.registerItem(ClayTechItems.C_FOODMATERIALS, "DRINK_BOTTLE", ClayTechItems.DRINK_BOTTLE,
+ "notresearch", 10, RecipeType.ENHANCED_CRAFTING_TABLE, recipec, false);
+ Slimefunutils.registerItem(ClayTechItems.C_FOODMATERIALS, "DIRTY_DRINK_BOTTLE",
+ ClayTechItems.DIRTY_DRINK_BOTTLE, "notresearch", 10, RecipeType.NULL, ClayTechItems.NORECIPE, false);
+ Slimefunutils.registerItem(ClayTechItems.C_FOODMATERIALS, "DIRTY_TEA", ClayTechItems.DIRTY_TEA, "notresearch",
+ 10, ClayTechRecipeType.HARVEST, ClayTechItems.NORECIPE, false);
+ Slimefunutils.registerItem(ClayTechItems.C_FOODMATERIALS, "RAW_TEA", ClayTechItems.RAW_TEA, "notresearch", 10,
+ ClayTechRecipeType.CLEANING, ClayTechItems.NORECIPE, false);
+ Slimefunutils.registerItem(ClayTechItems.C_FOODMATERIALS, "TEA_POWDER", ClayTechItems.TEA_POWDER, "notresearch",
+ 10, ClayTechRecipeType.CLAY_FOOD_CHALKING_MACHINE, ClayTechMachineRecipes.TEA_POWDER, false);
+ Slimefunutils.registerItem(ClayTechItems.C_FOODMATERIALS, "LEMON_POWDER", ClayTechItems.LEMON_POWDER,
+ "notresearch", 10, ClayTechRecipeType.CLAY_FOOD_CHALKING_MACHINE, ClayTechMachineRecipes.LEMON_POWDER,
+ false);
- Research foodmaterialsI = new Research(
- new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_DRINKMATERIALSBASIC"), 9908,
- Lang.readResearchesText("CLAYTECH_DRINK_MAKINGS_I"), 50);
- foodmaterialsI.addItems(SlimefunItem.getByItem(ClayTechItems.COCOA_BEAN),
- SlimefunItem.getByItem(ClayTechItems.PLASTIC), SlimefunItem.getByItem(ClayTechItems.DRINK_BOTTLE),
- SlimefunItem.getByItem(ClayTechItems.DIRTY_DRINK_BOTTLE));
- foodmaterialsI.register();
+ Research foodmaterialsI = new Research(
+ new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_DRINKMATERIALSBASIC"), 9908,
+ Lang.readResearchesText("CLAYTECH_DRINK_MAKINGS_I"), 50);
+ foodmaterialsI.addItems(SlimefunItem.getByItem(ClayTechItems.COCOA_BEAN),
+ SlimefunItem.getByItem(ClayTechItems.PLASTIC), SlimefunItem.getByItem(ClayTechItems.DRINK_BOTTLE),
+ SlimefunItem.getByItem(ClayTechItems.DIRTY_DRINK_BOTTLE));
+ foodmaterialsI.register();
- Research foodmaterialsII = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_DRINKMATERIALSII"),
- 9911, Lang.readResearchesText("CLAYTECH_DRINK_MAKINGS_II"), 50);
- foodmaterialsII.addItems(SlimefunItem.getByItem(ClayTechItems.DIRTY_TEA),
- SlimefunItem.getByItem(ClayTechItems.RAW_TEA), SlimefunItem.getByItem(ClayTechItems.LEMON_POWDER),
- SlimefunItem.getByItem(ClayTechItems.TEA_POWDER));
- foodmaterialsII.register();
- }
+ Research foodmaterialsII = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_DRINKMATERIALSII"),
+ 9911, Lang.readResearchesText("CLAYTECH_DRINK_MAKINGS_II"), 50);
+ foodmaterialsII.addItems(SlimefunItem.getByItem(ClayTechItems.DIRTY_TEA),
+ SlimefunItem.getByItem(ClayTechItems.RAW_TEA), SlimefunItem.getByItem(ClayTechItems.LEMON_POWDER),
+ SlimefunItem.getByItem(ClayTechItems.TEA_POWDER));
+ foodmaterialsII.register();
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/items/Drinks.java b/src/main/java/club/claycoffee/ClayTech/implementation/items/Drinks.java
index e848c75..3febac9 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/items/Drinks.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/items/Drinks.java
@@ -1,8 +1,5 @@
package club.claycoffee.ClayTech.implementation.items;
-import org.bukkit.NamespacedKey;
-import org.bukkit.inventory.ItemStack;
-
import club.claycoffee.ClayTech.ClayTech;
import club.claycoffee.ClayTech.ClayTechItems;
import club.claycoffee.ClayTech.ClayTechRecipeType;
@@ -10,32 +7,34 @@
import club.claycoffee.ClayTech.utils.Slimefunutils;
import io.github.thebusybiscuit.slimefun4.core.researching.Research;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
+import org.bukkit.NamespacedKey;
+import org.bukkit.inventory.ItemStack;
public class Drinks {
- public Drinks() {
- ItemStack[] recipea = { null, ClayTechItems.COCOA_BEAN, null, null, ClayTechItems.COCOA_BEAN, null, null,
- ClayTechItems.DRINK_BOTTLE, null };
- ItemStack[] recipeb = { null, ClayTechItems.LEMON_POWDER, null, null, ClayTechItems.LEMON_POWDER, null, null,
- ClayTechItems.DRINK_BOTTLE, null };
- ItemStack[] recipec = { null, ClayTechItems.TEA_POWDER, null, null, ClayTechItems.TEA_POWDER, null, null,
- ClayTechItems.DRINK_BOTTLE, null };
- ItemStack[] reciped = { null, ClayTechItems.TEA_POWDER, null, ClayTechItems.LEMON_POWDER,
- ClayTechItems.TEA_POWDER, ClayTechItems.LEMON_POWDER, null, ClayTechItems.DRINK_BOTTLE, null };
+ public Drinks() {
+ ItemStack[] recipea = {null, ClayTechItems.COCOA_BEAN, null, null, ClayTechItems.COCOA_BEAN, null, null,
+ ClayTechItems.DRINK_BOTTLE, null};
+ ItemStack[] recipeb = {null, ClayTechItems.LEMON_POWDER, null, null, ClayTechItems.LEMON_POWDER, null, null,
+ ClayTechItems.DRINK_BOTTLE, null};
+ ItemStack[] recipec = {null, ClayTechItems.TEA_POWDER, null, null, ClayTechItems.TEA_POWDER, null, null,
+ ClayTechItems.DRINK_BOTTLE, null};
+ ItemStack[] reciped = {null, ClayTechItems.TEA_POWDER, null, ClayTechItems.LEMON_POWDER,
+ ClayTechItems.TEA_POWDER, ClayTechItems.LEMON_POWDER, null, ClayTechItems.DRINK_BOTTLE, null};
- Slimefunutils.registerItem(ClayTechItems.C_DRINK, "CLAY_COFFEE", ClayTechItems.CLAY_COFFEE, "notresearch", 10,
- ClayTechRecipeType.CLAY_FOOD_CAULDRON, recipea, false);
- Slimefunutils.registerItem(ClayTechItems.C_DRINK, "LEMON_POWDER_DRINK", ClayTechItems.LEMON_POWDER_DRINK,
- "notresearch", 10, ClayTechRecipeType.CLAY_FOOD_CAULDRON, recipeb, false);
- Slimefunutils.registerItem(ClayTechItems.C_DRINK, "TEA_DRINK", ClayTechItems.TEA_DRINK, "notresearch", 10,
- ClayTechRecipeType.CLAY_FOOD_CAULDRON, recipec, false);
- Slimefunutils.registerItem(ClayTechItems.C_DRINK, "LEMON_TEA_DRINK", ClayTechItems.LEMON_TEA_DRINK,
- "notresearch", 10, ClayTechRecipeType.CLAY_FOOD_CAULDRON, reciped, false);
+ Slimefunutils.registerItem(ClayTechItems.C_DRINK, "CLAY_COFFEE", ClayTechItems.CLAY_COFFEE, "notresearch", 10,
+ ClayTechRecipeType.CLAY_FOOD_CAULDRON, recipea, false);
+ Slimefunutils.registerItem(ClayTechItems.C_DRINK, "LEMON_POWDER_DRINK", ClayTechItems.LEMON_POWDER_DRINK,
+ "notresearch", 10, ClayTechRecipeType.CLAY_FOOD_CAULDRON, recipeb, false);
+ Slimefunutils.registerItem(ClayTechItems.C_DRINK, "TEA_DRINK", ClayTechItems.TEA_DRINK, "notresearch", 10,
+ ClayTechRecipeType.CLAY_FOOD_CAULDRON, recipec, false);
+ Slimefunutils.registerItem(ClayTechItems.C_DRINK, "LEMON_TEA_DRINK", ClayTechItems.LEMON_TEA_DRINK,
+ "notresearch", 10, ClayTechRecipeType.CLAY_FOOD_CAULDRON, reciped, false);
- Research foodI = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_DRINKBASIC"), 9909,
- Lang.readResearchesText("CLAYTECH_DRINK_I"), 50);
- foodI.addItems(SlimefunItem.getByItem(ClayTechItems.CLAY_COFFEE),
- SlimefunItem.getByItem(ClayTechItems.LEMON_POWDER_DRINK),
- SlimefunItem.getByItem(ClayTechItems.TEA_DRINK), SlimefunItem.getByItem(ClayTechItems.LEMON_TEA_DRINK));
- foodI.register();
- }
+ Research foodI = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_DRINKBASIC"), 9909,
+ Lang.readResearchesText("CLAYTECH_DRINK_I"), 50);
+ foodI.addItems(SlimefunItem.getByItem(ClayTechItems.CLAY_COFFEE),
+ SlimefunItem.getByItem(ClayTechItems.LEMON_POWDER_DRINK),
+ SlimefunItem.getByItem(ClayTechItems.TEA_DRINK), SlimefunItem.getByItem(ClayTechItems.LEMON_TEA_DRINK));
+ foodI.register();
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/items/EffectItems.java b/src/main/java/club/claycoffee/ClayTech/implementation/items/EffectItems.java
index af11a2e..0aa55c8 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/items/EffectItems.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/items/EffectItems.java
@@ -1,7 +1,5 @@
package club.claycoffee.ClayTech.implementation.items;
-import org.bukkit.NamespacedKey;
-
import club.claycoffee.ClayTech.ClayTech;
import club.claycoffee.ClayTech.ClayTechItems;
import club.claycoffee.ClayTech.ClayTechMachineRecipes;
@@ -10,16 +8,17 @@
import club.claycoffee.ClayTech.utils.Slimefunutils;
import io.github.thebusybiscuit.slimefun4.core.researching.Research;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
+import org.bukkit.NamespacedKey;
public class EffectItems {
- public EffectItems() {
- Slimefunutils.registerItem(ClayTechItems.C_TOOLS, "TNT_EXPLOSION_CREATER", ClayTechItems.TNT_EXPLOSION_CREATER,
- "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.TNT_EXPLOSION_CREATER,
- false);
+ public EffectItems() {
+ Slimefunutils.registerItem(ClayTechItems.C_TOOLS, "TNT_EXPLOSION_CREATER", ClayTechItems.TNT_EXPLOSION_CREATER,
+ "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.TNT_EXPLOSION_CREATER,
+ false);
- Research rs = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_AFT_1"), 9921,
- Lang.readResearchesText("CLAYTECH_EFFECT_ITEM_I"), 30);
- rs.addItems(SlimefunItem.getByItem(ClayTechItems.TNT_EXPLOSION_CREATER));
- rs.register();
- }
+ Research rs = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_AFT_1"), 9921,
+ Lang.readResearchesText("CLAYTECH_EFFECT_ITEM_I"), 30);
+ rs.addItems(SlimefunItem.getByItem(ClayTechItems.TNT_EXPLOSION_CREATER));
+ rs.register();
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/items/Elements.java b/src/main/java/club/claycoffee/ClayTech/implementation/items/Elements.java
index 957cddc..e3fe83a 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/items/Elements.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/items/Elements.java
@@ -8,31 +8,30 @@
import club.claycoffee.ClayTech.utils.Slimefunutils;
import io.github.thebusybiscuit.slimefun4.core.researching.Research;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
-
import org.bukkit.NamespacedKey;
public class Elements {
- public Elements() {
+ public Elements() {
- Slimefunutils.registerItem(ClayTechItems.C_ELEMENTS, "ELEMENT_UNIT", ClayTechItems.ELEMENT_UNIT, "notresearch",
- 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.ELEMENT_UNIT, false);
- Slimefunutils.registerItem(ClayTechItems.C_ELEMENTS, "ELEMENT_OXYGEN", ClayTechItems.ELEMENT_OXYGEN,
- "notresearch", 10, ClayTechRecipeType.CLAY_ELEMENT_EXTRACTER, ClayTechMachineRecipes.ELEMENT_OXYGEN,
- false);
- Slimefunutils.registerItem(ClayTechItems.C_ELEMENTS, "ELEMENT_CARBON", ClayTechItems.ELEMENT_CARBON,
- "notresearch", 10, ClayTechRecipeType.CLAY_ELEMENT_EXTRACTER, ClayTechMachineRecipes.ELEMENT_CARBON,
- false);
- Slimefunutils.registerItem(ClayTechItems.C_ELEMENTS, "ELEMENT_SILICON", ClayTechItems.ELEMENT_SILICON,
- "notresearch", 10, ClayTechRecipeType.CLAY_ELEMENT_EXTRACTER, ClayTechMachineRecipes.ELEMENT_SILICON,
- false);
+ Slimefunutils.registerItem(ClayTechItems.C_ELEMENTS, "ELEMENT_UNIT", ClayTechItems.ELEMENT_UNIT, "notresearch",
+ 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.ELEMENT_UNIT, false);
+ Slimefunutils.registerItem(ClayTechItems.C_ELEMENTS, "ELEMENT_OXYGEN", ClayTechItems.ELEMENT_OXYGEN,
+ "notresearch", 10, ClayTechRecipeType.CLAY_ELEMENT_EXTRACTER, ClayTechMachineRecipes.ELEMENT_OXYGEN,
+ false);
+ Slimefunutils.registerItem(ClayTechItems.C_ELEMENTS, "ELEMENT_CARBON", ClayTechItems.ELEMENT_CARBON,
+ "notresearch", 10, ClayTechRecipeType.CLAY_ELEMENT_EXTRACTER, ClayTechMachineRecipes.ELEMENT_CARBON,
+ false);
+ Slimefunutils.registerItem(ClayTechItems.C_ELEMENTS, "ELEMENT_SILICON", ClayTechItems.ELEMENT_SILICON,
+ "notresearch", 10, ClayTechRecipeType.CLAY_ELEMENT_EXTRACTER, ClayTechMachineRecipes.ELEMENT_SILICON,
+ false);
- Research before_element = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_BEFORE_ELEMENT"),
- 9919, Lang.readResearchesText("CLAYTECH_ELEMENTS_I"), 50);
+ Research before_element = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_BEFORE_ELEMENT"),
+ 9919, Lang.readResearchesText("CLAYTECH_ELEMENTS_I"), 50);
- before_element.addItems(SlimefunItem.getByItem(ClayTechItems.ELEMENT_UNIT),
- SlimefunItem.getByItem(ClayTechItems.ELEMENT_OXYGEN),
- SlimefunItem.getByItem(ClayTechItems.ELEMENT_CARBON),
- SlimefunItem.getByItem(ClayTechItems.ELEMENT_SILICON));
- before_element.register();
- }
+ before_element.addItems(SlimefunItem.getByItem(ClayTechItems.ELEMENT_UNIT),
+ SlimefunItem.getByItem(ClayTechItems.ELEMENT_OXYGEN),
+ SlimefunItem.getByItem(ClayTechItems.ELEMENT_CARBON),
+ SlimefunItem.getByItem(ClayTechItems.ELEMENT_SILICON));
+ before_element.register();
+ }
}
\ No newline at end of file
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/items/FoodMakingStaff.java b/src/main/java/club/claycoffee/ClayTech/implementation/items/FoodMakingStaff.java
index 164a1ca..2cb6b02 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/items/FoodMakingStaff.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/items/FoodMakingStaff.java
@@ -1,9 +1,5 @@
package club.claycoffee.ClayTech.implementation.items;
-import org.bukkit.Material;
-import org.bukkit.NamespacedKey;
-import org.bukkit.inventory.ItemStack;
-
import club.claycoffee.ClayTech.ClayTech;
import club.claycoffee.ClayTech.ClayTechItems;
import club.claycoffee.ClayTech.ClayTechMachineRecipes;
@@ -11,55 +7,58 @@
import club.claycoffee.ClayTech.utils.Lang;
import club.claycoffee.ClayTech.utils.Slimefunutils;
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
+import io.github.thebusybiscuit.slimefun4.core.researching.Research;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
-import io.github.thebusybiscuit.slimefun4.core.researching.Research;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
+import org.bukkit.Material;
+import org.bukkit.NamespacedKey;
+import org.bukkit.inventory.ItemStack;
public class FoodMakingStaff {
- public FoodMakingStaff() {
- ItemStack[] recipec = { null, new ItemStack(Material.BREAD), null, null, ClayTechItems.MAGIC_CLAY, null, null,
- new ItemStack(Material.BREAD), null };
- ItemStack[] reciped = { null, new ItemStack(Material.KELP), null, null, ClayTechItems.MAGIC_CLAY, null, null,
- SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)
- ? new ItemStack(Material.BAMBOO)
- : new ItemStack(Material.KELP),
- null };
+ public FoodMakingStaff() {
+ ItemStack[] recipec = {null, new ItemStack(Material.BREAD), null, null, ClayTechItems.MAGIC_CLAY, null, null,
+ new ItemStack(Material.BREAD), null};
+ ItemStack[] reciped = {null, new ItemStack(Material.KELP), null, null, ClayTechItems.MAGIC_CLAY, null, null,
+ SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)
+ ? new ItemStack(Material.BAMBOO)
+ : new ItemStack(Material.KELP),
+ null};
- Slimefunutils.registerItem(ClayTechItems.C_FOODMATERIALS, "RAW_CHICKEN_FOOT", ClayTechItems.RAW_CHICKEN_FOOT,
- "notresearch", 10, ClayTechRecipeType.CLAY_FOOD_CHALKING_MACHINE,
- ClayTechMachineRecipes.RAW_CHICKEN_FOOT, false);
- Slimefunutils.registerItem(ClayTechItems.C_FOODMATERIALS, "RAW_BREAD", ClayTechItems.RAW_BREAD, "notresearch",
- 10, RecipeType.ENHANCED_CRAFTING_TABLE, recipec, false);
- Slimefunutils.registerItem(ClayTechItems.C_FOODMATERIALS, "RAW_VEGETABLE", ClayTechItems.RAW_VEGETABLE,
- "notresearch", 10, RecipeType.ENHANCED_CRAFTING_TABLE, reciped, false);
- Slimefunutils.registerItem(ClayTechItems.C_FOODMATERIALS, "CLAY_LEMON", ClayTechItems.CLAY_LEMON, "notresearch",
- 10, ClayTechRecipeType.PLUCKING, ClayTechItems.NORECIPE, false);
- Slimefunutils.registerItem(ClayTechItems.C_FOODMATERIALS, "STARCH", ClayTechItems.STARCH, "notresearch", 10,
- ClayTechRecipeType.HARVEST, ClayTechItems.NORECIPE, false);
- Slimefunutils.registerItem(ClayTechItems.C_FOODMATERIALS, "FLOUR", ClayTechItems.FLOUR, "notresearch", 10,
- ClayTechRecipeType.HARVEST, ClayTechItems.NORECIPE, false);
- Slimefunutils.registerItem(ClayTechItems.C_FOODMATERIALS, "SNAIL_HEALTHY", ClayTechItems.SNAIL_HEALTHY,
- "notresearch", 10, ClayTechRecipeType.FISHING, ClayTechItems.NORECIPE, false);
- Slimefunutils.registerItem(ClayTechItems.C_FOODMATERIALS, "CLAY_SWEET_POTATO", ClayTechItems.CLAY_SWEET_POTATO,
- "notresearch", 10, ClayTechRecipeType.HARVEST, ClayTechItems.NORECIPE, false);
+ Slimefunutils.registerItem(ClayTechItems.C_FOODMATERIALS, "RAW_CHICKEN_FOOT", ClayTechItems.RAW_CHICKEN_FOOT,
+ "notresearch", 10, ClayTechRecipeType.CLAY_FOOD_CHALKING_MACHINE,
+ ClayTechMachineRecipes.RAW_CHICKEN_FOOT, false);
+ Slimefunutils.registerItem(ClayTechItems.C_FOODMATERIALS, "RAW_BREAD", ClayTechItems.RAW_BREAD, "notresearch",
+ 10, RecipeType.ENHANCED_CRAFTING_TABLE, recipec, false);
+ Slimefunutils.registerItem(ClayTechItems.C_FOODMATERIALS, "RAW_VEGETABLE", ClayTechItems.RAW_VEGETABLE,
+ "notresearch", 10, RecipeType.ENHANCED_CRAFTING_TABLE, reciped, false);
+ Slimefunutils.registerItem(ClayTechItems.C_FOODMATERIALS, "CLAY_LEMON", ClayTechItems.CLAY_LEMON, "notresearch",
+ 10, ClayTechRecipeType.PLUCKING, ClayTechItems.NORECIPE, false);
+ Slimefunutils.registerItem(ClayTechItems.C_FOODMATERIALS, "STARCH", ClayTechItems.STARCH, "notresearch", 10,
+ ClayTechRecipeType.HARVEST, ClayTechItems.NORECIPE, false);
+ Slimefunutils.registerItem(ClayTechItems.C_FOODMATERIALS, "FLOUR", ClayTechItems.FLOUR, "notresearch", 10,
+ ClayTechRecipeType.HARVEST, ClayTechItems.NORECIPE, false);
+ Slimefunutils.registerItem(ClayTechItems.C_FOODMATERIALS, "SNAIL_HEALTHY", ClayTechItems.SNAIL_HEALTHY,
+ "notresearch", 10, ClayTechRecipeType.FISHING, ClayTechItems.NORECIPE, false);
+ Slimefunutils.registerItem(ClayTechItems.C_FOODMATERIALS, "CLAY_SWEET_POTATO", ClayTechItems.CLAY_SWEET_POTATO,
+ "notresearch", 10, ClayTechRecipeType.HARVEST, ClayTechItems.NORECIPE, false);
- Research foodmaterialsI = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_FOODMATERIALSBASIC"),
- 9910, Lang.readResearchesText("CLAYTECH_FOOD_MAKINGS_I"), 50);
- foodmaterialsI.addItems(SlimefunItem.getByItem(ClayTechItems.RAW_CHICKEN_FOOT),
- SlimefunItem.getByItem(ClayTechItems.RAW_BREAD), SlimefunItem.getByItem(ClayTechItems.RAW_VEGETABLE));
- foodmaterialsI.register();
+ Research foodmaterialsI = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_FOODMATERIALSBASIC"),
+ 9910, Lang.readResearchesText("CLAYTECH_FOOD_MAKINGS_I"), 50);
+ foodmaterialsI.addItems(SlimefunItem.getByItem(ClayTechItems.RAW_CHICKEN_FOOT),
+ SlimefunItem.getByItem(ClayTechItems.RAW_BREAD), SlimefunItem.getByItem(ClayTechItems.RAW_VEGETABLE));
+ foodmaterialsI.register();
- Research foodmaterialsIE = new Research(
- new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_FOODMATERIALSBASIC"), 9913,
- Lang.readResearchesText("CLAYTECH_FOOD_MAKINGS_II"), 50);
- foodmaterialsIE.addItems(SlimefunItem.getByItem(ClayTechItems.FLOUR),
- SlimefunItem.getByItem(ClayTechItems.STARCH), SlimefunItem.getByItem(ClayTechItems.SNAIL_HEALTHY));
- foodmaterialsIE.register();
+ Research foodmaterialsIE = new Research(
+ new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_FOODMATERIALSBASIC"), 9913,
+ Lang.readResearchesText("CLAYTECH_FOOD_MAKINGS_II"), 50);
+ foodmaterialsIE.addItems(SlimefunItem.getByItem(ClayTechItems.FLOUR),
+ SlimefunItem.getByItem(ClayTechItems.STARCH), SlimefunItem.getByItem(ClayTechItems.SNAIL_HEALTHY));
+ foodmaterialsIE.register();
- Research foodmaterialsII = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_FRUITBASIC"), 9912,
- Lang.readResearchesText("CLAYTECH_FRUIT_I"), 50);
- foodmaterialsII.addItems(SlimefunItem.getByItem(ClayTechItems.CLAY_LEMON));
- foodmaterialsII.register();
- }
+ Research foodmaterialsII = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_FRUITBASIC"), 9912,
+ Lang.readResearchesText("CLAYTECH_FRUIT_I"), 50);
+ foodmaterialsII.addItems(SlimefunItem.getByItem(ClayTechItems.CLAY_LEMON));
+ foodmaterialsII.register();
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/items/Foods.java b/src/main/java/club/claycoffee/ClayTech/implementation/items/Foods.java
index 4e6305f..0393834 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/items/Foods.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/items/Foods.java
@@ -1,7 +1,5 @@
package club.claycoffee.ClayTech.implementation.items;
-import org.bukkit.NamespacedKey;
-
import club.claycoffee.ClayTech.ClayTech;
import club.claycoffee.ClayTech.ClayTechItems;
import club.claycoffee.ClayTech.ClayTechMachineRecipes;
@@ -10,52 +8,53 @@
import club.claycoffee.ClayTech.utils.Slimefunutils;
import io.github.thebusybiscuit.slimefun4.core.researching.Research;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
+import org.bukkit.NamespacedKey;
public class Foods {
- public Foods() {
- Slimefunutils.registerItem(ClayTechItems.C_FOOD, "CHICKEN_FOOT", ClayTechItems.CHICKEN_FOOT, "notresearch", 10,
- ClayTechRecipeType.CLAY_FOOD_CAULDRON, ClayTechMachineRecipes.CHICKEN_FOOT, false);
- Slimefunutils.registerItem(ClayTechItems.C_FOOD, "SPICY_CHICKEN_BURGER", ClayTechItems.SPICY_CHICKEN_BURGER,
- "notresearch", 10, ClayTechRecipeType.CLAY_FOOD_CAULDRON, ClayTechMachineRecipes.SPICY_CHICKEN_BURGER,
- false);
- Slimefunutils.registerItem(ClayTechItems.C_FOOD, "BABA_BURGER", ClayTechItems.BABA_BURGER, "notresearch", 10,
- ClayTechRecipeType.CLAY_FOOD_CAULDRON, ClayTechMachineRecipes.BABA_BURGER, false);
- Slimefunutils.registerItem(ClayTechItems.C_FOOD, "CHOCOLATE", ClayTechItems.CHOCOLATE, "notresearch", 10,
- ClayTechRecipeType.CLAY_FOOD_CAULDRON, ClayTechMachineRecipes.CHOCOLATE, false);
- Slimefunutils.registerItem(ClayTechItems.C_FOOD, "SNAIL_BAD", ClayTechItems.SNAIL_BAD, "notresearch", 10,
- ClayTechRecipeType.FISHING, ClayTechItems.NORECIPE, false);
- Slimefunutils.registerItem(ClayTechItems.C_FOOD, "SNAIL_FOOD", ClayTechItems.SNAIL_FOOD, "notresearch", 10,
- ClayTechRecipeType.CLAY_FOOD_CAULDRON, ClayTechMachineRecipes.SNAIL_FOOD, false);
- Slimefunutils.registerItem(ClayTechItems.C_FOOD, "COOKED_SWEET_POTATO", ClayTechItems.COOKED_SWEET_POTATO,
- "notresearch", 10, ClayTechRecipeType.CLAY_FOOD_CAULDRON, ClayTechMachineRecipes.COOKED_SWEET_POTATO,
- false);
+ public Foods() {
+ Slimefunutils.registerItem(ClayTechItems.C_FOOD, "CHICKEN_FOOT", ClayTechItems.CHICKEN_FOOT, "notresearch", 10,
+ ClayTechRecipeType.CLAY_FOOD_CAULDRON, ClayTechMachineRecipes.CHICKEN_FOOT, false);
+ Slimefunutils.registerItem(ClayTechItems.C_FOOD, "SPICY_CHICKEN_BURGER", ClayTechItems.SPICY_CHICKEN_BURGER,
+ "notresearch", 10, ClayTechRecipeType.CLAY_FOOD_CAULDRON, ClayTechMachineRecipes.SPICY_CHICKEN_BURGER,
+ false);
+ Slimefunutils.registerItem(ClayTechItems.C_FOOD, "BABA_BURGER", ClayTechItems.BABA_BURGER, "notresearch", 10,
+ ClayTechRecipeType.CLAY_FOOD_CAULDRON, ClayTechMachineRecipes.BABA_BURGER, false);
+ Slimefunutils.registerItem(ClayTechItems.C_FOOD, "CHOCOLATE", ClayTechItems.CHOCOLATE, "notresearch", 10,
+ ClayTechRecipeType.CLAY_FOOD_CAULDRON, ClayTechMachineRecipes.CHOCOLATE, false);
+ Slimefunutils.registerItem(ClayTechItems.C_FOOD, "SNAIL_BAD", ClayTechItems.SNAIL_BAD, "notresearch", 10,
+ ClayTechRecipeType.FISHING, ClayTechItems.NORECIPE, false);
+ Slimefunutils.registerItem(ClayTechItems.C_FOOD, "SNAIL_FOOD", ClayTechItems.SNAIL_FOOD, "notresearch", 10,
+ ClayTechRecipeType.CLAY_FOOD_CAULDRON, ClayTechMachineRecipes.SNAIL_FOOD, false);
+ Slimefunutils.registerItem(ClayTechItems.C_FOOD, "COOKED_SWEET_POTATO", ClayTechItems.COOKED_SWEET_POTATO,
+ "notresearch", 10, ClayTechRecipeType.CLAY_FOOD_CAULDRON, ClayTechMachineRecipes.COOKED_SWEET_POTATO,
+ false);
- Research foodI = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_FOODBASIC"), 9911,
- Lang.readResearchesText("CLAYTECH_FOOD_I"), 50);
- foodI.addItems(SlimefunItem.getByItem(ClayTechItems.CHICKEN_FOOT),
- SlimefunItem.getByItem(ClayTechItems.SPICY_CHICKEN_BURGER),
- SlimefunItem.getByItem(ClayTechItems.BABA_BURGER), SlimefunItem.getByItem(ClayTechItems.CHOCOLATE),
- SlimefunItem.getByItem(ClayTechItems.SNAIL_BAD), SlimefunItem.getByItem(ClayTechItems.SNAIL_FOOD));
- foodI.register();
+ Research foodI = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_FOODBASIC"), 9911,
+ Lang.readResearchesText("CLAYTECH_FOOD_I"), 50);
+ foodI.addItems(SlimefunItem.getByItem(ClayTechItems.CHICKEN_FOOT),
+ SlimefunItem.getByItem(ClayTechItems.SPICY_CHICKEN_BURGER),
+ SlimefunItem.getByItem(ClayTechItems.BABA_BURGER), SlimefunItem.getByItem(ClayTechItems.CHOCOLATE),
+ SlimefunItem.getByItem(ClayTechItems.SNAIL_BAD), SlimefunItem.getByItem(ClayTechItems.SNAIL_FOOD));
+ foodI.register();
- Slimefunutils.registerItem(ClayTechItems.C_FOOD, "HONEY_SWEET", ClayTechItems.HONEY_SWEET, "notresearch", 10,
- ClayTechRecipeType.CLAY_FOOD_CAULDRON, ClayTechMachineRecipes.HONEY_SWEET, false);
- Slimefunutils.registerItem(ClayTechItems.C_FOOD, "GREEN_GRASS", ClayTechItems.GREEN_GRASS, "notresearch", 10,
- ClayTechRecipeType.HARVEST, ClayTechItems.NORECIPE, false);
- Research foodII = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_FOODBASIC2"), 9916,
- Lang.readResearchesText("CLAYTECH_FOOD_II"), 50);
- foodII.addItems(SlimefunItem.getByItem(ClayTechItems.HONEY_SWEET),
- SlimefunItem.getByItem(ClayTechItems.CLAY_SWEET_POTATO),
- SlimefunItem.getByItem(ClayTechItems.COOKED_SWEET_POTATO),
- SlimefunItem.getByItem(ClayTechItems.GREEN_GRASS));
- foodII.register();
+ Slimefunutils.registerItem(ClayTechItems.C_FOOD, "HONEY_SWEET", ClayTechItems.HONEY_SWEET, "notresearch", 10,
+ ClayTechRecipeType.CLAY_FOOD_CAULDRON, ClayTechMachineRecipes.HONEY_SWEET, false);
+ Slimefunutils.registerItem(ClayTechItems.C_FOOD, "GREEN_GRASS", ClayTechItems.GREEN_GRASS, "notresearch", 10,
+ ClayTechRecipeType.HARVEST, ClayTechItems.NORECIPE, false);
+ Research foodII = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_FOODBASIC2"), 9916,
+ Lang.readResearchesText("CLAYTECH_FOOD_II"), 50);
+ foodII.addItems(SlimefunItem.getByItem(ClayTechItems.HONEY_SWEET),
+ SlimefunItem.getByItem(ClayTechItems.CLAY_SWEET_POTATO),
+ SlimefunItem.getByItem(ClayTechItems.COOKED_SWEET_POTATO),
+ SlimefunItem.getByItem(ClayTechItems.GREEN_GRASS));
+ foodII.register();
- Slimefunutils.registerItem(ClayTechItems.C_FOOD, "TUNA_FISH", ClayTechItems.TUNA_FISH, "notresearch", 10,
- ClayTechRecipeType.FISHING, ClayTechItems.NORECIPE, false);
- Research foodIII = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_FISH1"), 9931,
- Lang.readResearchesText("CLAYTECH_FISH_I"), 30);
- foodIII.addItems(SlimefunItem.getByItem(ClayTechItems.TUNA_FISH));
- foodIII.register();
+ Slimefunutils.registerItem(ClayTechItems.C_FOOD, "TUNA_FISH", ClayTechItems.TUNA_FISH, "notresearch", 10,
+ ClayTechRecipeType.FISHING, ClayTechItems.NORECIPE, false);
+ Research foodIII = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_FISH1"), 9931,
+ Lang.readResearchesText("CLAYTECH_FISH_I"), 30);
+ foodIII.addItems(SlimefunItem.getByItem(ClayTechItems.TUNA_FISH));
+ foodIII.register();
- }
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/items/Golden_things.java b/src/main/java/club/claycoffee/ClayTech/implementation/items/Golden_things.java
index eee10d9..de868ad 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/items/Golden_things.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/items/Golden_things.java
@@ -1,74 +1,73 @@
package club.claycoffee.ClayTech.implementation.items;
-import org.bukkit.Material;
-import org.bukkit.NamespacedKey;
-import org.bukkit.inventory.ItemStack;
-
-import club.claycoffee.ClayTech.ClayTechItems;
import club.claycoffee.ClayTech.ClayTech;
+import club.claycoffee.ClayTech.ClayTechItems;
import club.claycoffee.ClayTech.utils.Lang;
import club.claycoffee.ClayTech.utils.Slimefunutils;
-import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import io.github.thebusybiscuit.slimefun4.core.researching.Research;
+import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
+import org.bukkit.Material;
+import org.bukkit.NamespacedKey;
+import org.bukkit.inventory.ItemStack;
public class Golden_things {
- public Golden_things() {
- ItemStack[] recipec = { new ItemStack(Material.GOLD_INGOT), new ItemStack(Material.GOLD_INGOT),
- new ItemStack(Material.GOLD_INGOT), new ItemStack(Material.GOLD_INGOT), ClayTechItems.MAGIC_CLAY,
- new ItemStack(Material.GOLD_INGOT), new ItemStack(Material.GOLD_INGOT),
- new ItemStack(Material.GOLD_INGOT), new ItemStack(Material.GOLD_INGOT) };
- ItemStack[] reciped = { ClayTechItems.ARTIFICIAL_GOLD_NUGGET, ClayTechItems.ARTIFICIAL_GOLD_NUGGET,
- ClayTechItems.ARTIFICIAL_GOLD_NUGGET, ClayTechItems.ARTIFICIAL_GOLD_NUGGET, ClayTechItems.MAGIC_CLAY,
- ClayTechItems.ARTIFICIAL_GOLD_NUGGET, ClayTechItems.ARTIFICIAL_GOLD_NUGGET,
- ClayTechItems.ARTIFICIAL_GOLD_NUGGET, ClayTechItems.ARTIFICIAL_GOLD_NUGGET };
- ItemStack[] recipee = { null, ClayTechItems.MAGIC_CLAY, null, null, ClayTechItems.ARTIFICIAL_GOLD_INGOT_O, null,
- null, null, null };
- ItemStack[] recipef = { ClayTechItems.ARTIFICIAL_GOLD_INGOT, ClayTechItems.ARTIFICIAL_GOLD_INGOT,
- ClayTechItems.ARTIFICIAL_GOLD_INGOT, ClayTechItems.ARTIFICIAL_GOLD_INGOT,
- ClayTechItems.ARTIFICIAL_GOLD_INGOT, ClayTechItems.ARTIFICIAL_GOLD_INGOT,
- ClayTechItems.ARTIFICIAL_GOLD_INGOT, ClayTechItems.ARTIFICIAL_GOLD_INGOT,
- ClayTechItems.ARTIFICIAL_GOLD_INGOT };
- ItemStack[] recipeg = { ClayTechItems.ARTIFICIAL_GOLD_BLOCK, ClayTechItems.ARTIFICIAL_GOLD_BLOCK,
- ClayTechItems.ARTIFICIAL_GOLD_BLOCK, ClayTechItems.ARTIFICIAL_GOLD_BLOCK,
- new ItemStack(Material.GOLDEN_APPLE), ClayTechItems.ARTIFICIAL_GOLD_BLOCK,
- ClayTechItems.ARTIFICIAL_GOLD_BLOCK, ClayTechItems.ARTIFICIAL_GOLD_BLOCK,
- ClayTechItems.ARTIFICIAL_GOLD_BLOCK };
+ public Golden_things() {
+ ItemStack[] recipec = {new ItemStack(Material.GOLD_INGOT), new ItemStack(Material.GOLD_INGOT),
+ new ItemStack(Material.GOLD_INGOT), new ItemStack(Material.GOLD_INGOT), ClayTechItems.MAGIC_CLAY,
+ new ItemStack(Material.GOLD_INGOT), new ItemStack(Material.GOLD_INGOT),
+ new ItemStack(Material.GOLD_INGOT), new ItemStack(Material.GOLD_INGOT)};
+ ItemStack[] reciped = {ClayTechItems.ARTIFICIAL_GOLD_NUGGET, ClayTechItems.ARTIFICIAL_GOLD_NUGGET,
+ ClayTechItems.ARTIFICIAL_GOLD_NUGGET, ClayTechItems.ARTIFICIAL_GOLD_NUGGET, ClayTechItems.MAGIC_CLAY,
+ ClayTechItems.ARTIFICIAL_GOLD_NUGGET, ClayTechItems.ARTIFICIAL_GOLD_NUGGET,
+ ClayTechItems.ARTIFICIAL_GOLD_NUGGET, ClayTechItems.ARTIFICIAL_GOLD_NUGGET};
+ ItemStack[] recipee = {null, ClayTechItems.MAGIC_CLAY, null, null, ClayTechItems.ARTIFICIAL_GOLD_INGOT_O, null,
+ null, null, null};
+ ItemStack[] recipef = {ClayTechItems.ARTIFICIAL_GOLD_INGOT, ClayTechItems.ARTIFICIAL_GOLD_INGOT,
+ ClayTechItems.ARTIFICIAL_GOLD_INGOT, ClayTechItems.ARTIFICIAL_GOLD_INGOT,
+ ClayTechItems.ARTIFICIAL_GOLD_INGOT, ClayTechItems.ARTIFICIAL_GOLD_INGOT,
+ ClayTechItems.ARTIFICIAL_GOLD_INGOT, ClayTechItems.ARTIFICIAL_GOLD_INGOT,
+ ClayTechItems.ARTIFICIAL_GOLD_INGOT};
+ ItemStack[] recipeg = {ClayTechItems.ARTIFICIAL_GOLD_BLOCK, ClayTechItems.ARTIFICIAL_GOLD_BLOCK,
+ ClayTechItems.ARTIFICIAL_GOLD_BLOCK, ClayTechItems.ARTIFICIAL_GOLD_BLOCK,
+ new ItemStack(Material.GOLDEN_APPLE), ClayTechItems.ARTIFICIAL_GOLD_BLOCK,
+ ClayTechItems.ARTIFICIAL_GOLD_BLOCK, ClayTechItems.ARTIFICIAL_GOLD_BLOCK,
+ ClayTechItems.ARTIFICIAL_GOLD_BLOCK};
- Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "ARTIFICIAL_GOLD_NUGGET",
- ClayTechItems.ARTIFICIAL_GOLD_NUGGET, "notresearch", 10, RecipeType.ENHANCED_CRAFTING_TABLE, recipec,
- false);
- Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "ARTIFICIAL_GOLD_INGOT_O",
- ClayTechItems.ARTIFICIAL_GOLD_INGOT_O, "notresearch", 10, RecipeType.ENHANCED_CRAFTING_TABLE, reciped,
- false);
- Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "ARTIFICIAL_GOLD_INGOT",
- ClayTechItems.ARTIFICIAL_GOLD_INGOT, "notresearch", 10, RecipeType.ENHANCED_CRAFTING_TABLE, recipee,
- false);
- Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "ARTIFICIAL_GOLD_BLOCK",
- ClayTechItems.ARTIFICIAL_GOLD_BLOCK, "notresearch", 10, RecipeType.ENHANCED_CRAFTING_TABLE, recipef,
- false);
- Slimefunutils.registerItem(ClayTechItems.C_FOOD, "ARTIFICIAL_ENCHANTED_GOLDEN_APPLE",
- ClayTechItems.ARTIFICIAL_ENCHANTED_GOLDEN_APPLE, "notresearch", 10, RecipeType.ANCIENT_ALTAR, recipeg,
- false);
+ Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "ARTIFICIAL_GOLD_NUGGET",
+ ClayTechItems.ARTIFICIAL_GOLD_NUGGET, "notresearch", 10, RecipeType.ENHANCED_CRAFTING_TABLE, recipec,
+ false);
+ Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "ARTIFICIAL_GOLD_INGOT_O",
+ ClayTechItems.ARTIFICIAL_GOLD_INGOT_O, "notresearch", 10, RecipeType.ENHANCED_CRAFTING_TABLE, reciped,
+ false);
+ Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "ARTIFICIAL_GOLD_INGOT",
+ ClayTechItems.ARTIFICIAL_GOLD_INGOT, "notresearch", 10, RecipeType.ENHANCED_CRAFTING_TABLE, recipee,
+ false);
+ Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "ARTIFICIAL_GOLD_BLOCK",
+ ClayTechItems.ARTIFICIAL_GOLD_BLOCK, "notresearch", 10, RecipeType.ENHANCED_CRAFTING_TABLE, recipef,
+ false);
+ Slimefunutils.registerItem(ClayTechItems.C_FOOD, "ARTIFICIAL_ENCHANTED_GOLDEN_APPLE",
+ ClayTechItems.ARTIFICIAL_ENCHANTED_GOLDEN_APPLE, "notresearch", 10, RecipeType.ANCIENT_ALTAR, recipeg,
+ false);
- Research artificial_basic = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_ARTIFICIAL_BASIC"),
- 9901, Lang.readResearchesText("CLAYTECH_ARTIFICIAL_I"), 45);
- artificial_basic.addItems(SlimefunItem.getByItem(ClayTechItems.ARTIFICIAL_GOLD_NUGGET),
- SlimefunItem.getByItem(ClayTechItems.ARTIFICIAL_GOLD_INGOT),
- SlimefunItem.getByItem(ClayTechItems.ARTIFICIAL_GOLD_BLOCK));
- artificial_basic.register();
+ Research artificial_basic = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_ARTIFICIAL_BASIC"),
+ 9901, Lang.readResearchesText("CLAYTECH_ARTIFICIAL_I"), 45);
+ artificial_basic.addItems(SlimefunItem.getByItem(ClayTechItems.ARTIFICIAL_GOLD_NUGGET),
+ SlimefunItem.getByItem(ClayTechItems.ARTIFICIAL_GOLD_INGOT),
+ SlimefunItem.getByItem(ClayTechItems.ARTIFICIAL_GOLD_BLOCK));
+ artificial_basic.register();
- Research artificial_basic_o = new Research(
- new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_ARTIFICIAL_BASIC_O"), 9902,
- Lang.readResearchesText("CLAYTECH_ARTIFICIAL_ORE_I"), 30);
- artificial_basic_o.addItems(SlimefunItem.getByItem(ClayTechItems.ARTIFICIAL_GOLD_INGOT_O));
- artificial_basic_o.register();
+ Research artificial_basic_o = new Research(
+ new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_ARTIFICIAL_BASIC_O"), 9902,
+ Lang.readResearchesText("CLAYTECH_ARTIFICIAL_ORE_I"), 30);
+ artificial_basic_o.addItems(SlimefunItem.getByItem(ClayTechItems.ARTIFICIAL_GOLD_INGOT_O));
+ artificial_basic_o.register();
- Research artificial_enchanted_golden_apple_r = new Research(
- new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_ENCHANTED_GOLDEN_APPLE"), 9903,
- Lang.readResearchesText("CLAYTECH_ARTIFICIAL_ENCHANTED_GOLDEN_APPLE"), 100);
- artificial_enchanted_golden_apple_r
- .addItems(SlimefunItem.getByItem(ClayTechItems.ARTIFICIAL_ENCHANTED_GOLDEN_APPLE));
- artificial_enchanted_golden_apple_r.register();
- }
+ Research artificial_enchanted_golden_apple_r = new Research(
+ new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_ENCHANTED_GOLDEN_APPLE"), 9903,
+ Lang.readResearchesText("CLAYTECH_ARTIFICIAL_ENCHANTED_GOLDEN_APPLE"), 100);
+ artificial_enchanted_golden_apple_r
+ .addItems(SlimefunItem.getByItem(ClayTechItems.ARTIFICIAL_ENCHANTED_GOLDEN_APPLE));
+ artificial_enchanted_golden_apple_r.register();
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/items/Ingots.java b/src/main/java/club/claycoffee/ClayTech/implementation/items/Ingots.java
index 5d7293b..26150a8 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/items/Ingots.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/items/Ingots.java
@@ -1,49 +1,48 @@
package club.claycoffee.ClayTech.implementation.items;
-import org.bukkit.NamespacedKey;
-
import club.claycoffee.ClayTech.ClayTech;
import club.claycoffee.ClayTech.ClayTechItems;
import club.claycoffee.ClayTech.ClayTechMachineRecipes;
import club.claycoffee.ClayTech.ClayTechRecipeType;
import club.claycoffee.ClayTech.utils.Lang;
import club.claycoffee.ClayTech.utils.Slimefunutils;
-import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import io.github.thebusybiscuit.slimefun4.core.researching.Research;
+import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
+import org.bukkit.NamespacedKey;
public class Ingots {
- public Ingots() {
- Slimefunutils.registerItem(ClayTechItems.C_ORESTHINGS, "CLAY_FUSION_INGOT", ClayTechItems.CLAY_FUSION_INGOT,
- "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.CLAY_FUSION_INGOT,
- false);
- Slimefunutils.registerItem(ClayTechItems.C_ORESTHINGS, "CLAY_ALLOY_INGOT", ClayTechItems.CLAY_ALLOY_INGOT,
- "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.CLAY_ALLOY_INGOT,
- false);
- Slimefunutils.registerItem(ClayTechItems.C_ORESTHINGS, "CLAY_SILICON_INGOT", ClayTechItems.SILICON_INGOT,
- "notresearch", 10, ClayTechRecipeType.CLAY_EXPERIMENT_TABLE_BASIC, ClayTechMachineRecipes.SILICON_INGOT,
- false);
- Slimefunutils.registerItem(ClayTechItems.C_ORESTHINGS, "KREEP_ROCK", ClayTechItems.KREEP_ROCK, "notresearch",
- 10, ClayTechRecipeType.DIG_IN_THE_MOON, ClayTechItems.NORECIPE, false);
- Slimefunutils.registerItem(ClayTechItems.C_ORESTHINGS, "KREEP_INGOT", ClayTechItems.KREEP_INGOT, "notresearch",
- 10, RecipeType.SMELTERY, ClayTechMachineRecipes.KREEP_INGOT, false);
- Slimefunutils.registerItem(ClayTechItems.C_ORESTHINGS, "COPPER_ORE", ClayTechItems.COPPER_ORE, "notresearch",
- 10, ClayTechRecipeType.DIG_IN_NON_EARTH, ClayTechItems.NORECIPE, false);
- Slimefunutils.registerItem(ClayTechItems.C_ORESTHINGS, "CLAY_FUSION_ORE", ClayTechItems.CLAY_FUSION_ORE,
- "notresearch", 10, ClayTechRecipeType.DIG_IN_NON_EARTH, ClayTechItems.NORECIPE, false);
+ public Ingots() {
+ Slimefunutils.registerItem(ClayTechItems.C_ORESTHINGS, "CLAY_FUSION_INGOT", ClayTechItems.CLAY_FUSION_INGOT,
+ "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.CLAY_FUSION_INGOT,
+ false);
+ Slimefunutils.registerItem(ClayTechItems.C_ORESTHINGS, "CLAY_ALLOY_INGOT", ClayTechItems.CLAY_ALLOY_INGOT,
+ "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.CLAY_ALLOY_INGOT,
+ false);
+ Slimefunutils.registerItem(ClayTechItems.C_ORESTHINGS, "CLAY_SILICON_INGOT", ClayTechItems.SILICON_INGOT,
+ "notresearch", 10, ClayTechRecipeType.CLAY_EXPERIMENT_TABLE_BASIC, ClayTechMachineRecipes.SILICON_INGOT,
+ false);
+ Slimefunutils.registerItem(ClayTechItems.C_ORESTHINGS, "KREEP_ROCK", ClayTechItems.KREEP_ROCK, "notresearch",
+ 10, ClayTechRecipeType.DIG_IN_THE_MOON, ClayTechItems.NORECIPE, false);
+ Slimefunutils.registerItem(ClayTechItems.C_ORESTHINGS, "KREEP_INGOT", ClayTechItems.KREEP_INGOT, "notresearch",
+ 10, RecipeType.SMELTERY, ClayTechMachineRecipes.KREEP_INGOT, false);
+ Slimefunutils.registerItem(ClayTechItems.C_ORESTHINGS, "COPPER_ORE", ClayTechItems.COPPER_ORE, "notresearch",
+ 10, ClayTechRecipeType.DIG_IN_NON_EARTH, ClayTechItems.NORECIPE, false);
+ Slimefunutils.registerItem(ClayTechItems.C_ORESTHINGS, "CLAY_FUSION_ORE", ClayTechItems.CLAY_FUSION_ORE,
+ "notresearch", 10, ClayTechRecipeType.DIG_IN_NON_EARTH, ClayTechItems.NORECIPE, false);
- Research rs = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_OREINGOTS_1"), 9923,
- Lang.readResearchesText("CLAYTECH_OREINGOTS_I"), 50);
- rs.addItems(SlimefunItem.getByItem(ClayTechItems.CLAY_FUSION_INGOT),
- SlimefunItem.getByItem(ClayTechItems.CLAY_ALLOY_INGOT),
- SlimefunItem.getByItem(ClayTechItems.SILICON_INGOT));
- rs.register();
+ Research rs = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_OREINGOTS_1"), 9923,
+ Lang.readResearchesText("CLAYTECH_OREINGOTS_I"), 50);
+ rs.addItems(SlimefunItem.getByItem(ClayTechItems.CLAY_FUSION_INGOT),
+ SlimefunItem.getByItem(ClayTechItems.CLAY_ALLOY_INGOT),
+ SlimefunItem.getByItem(ClayTechItems.SILICON_INGOT));
+ rs.register();
- Research rs2 = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_OREINGOTS_2"), 9925,
- Lang.readResearchesText("CLAYTECH_OREINGOTS_II"), 50);
- rs2.addItems(SlimefunItem.getByItem(ClayTechItems.KREEP_INGOT),
- SlimefunItem.getByItem(ClayTechItems.KREEP_ROCK), SlimefunItem.getByItem(ClayTechItems.COPPER_ORE),
- SlimefunItem.getByItem(ClayTechItems.CLAY_FUSION_ORE));
- rs2.register();
- }
+ Research rs2 = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_OREINGOTS_2"), 9925,
+ Lang.readResearchesText("CLAYTECH_OREINGOTS_II"), 50);
+ rs2.addItems(SlimefunItem.getByItem(ClayTechItems.KREEP_INGOT),
+ SlimefunItem.getByItem(ClayTechItems.KREEP_ROCK), SlimefunItem.getByItem(ClayTechItems.COPPER_ORE),
+ SlimefunItem.getByItem(ClayTechItems.CLAY_FUSION_ORE));
+ rs2.register();
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/items/MachineMakingBasic.java b/src/main/java/club/claycoffee/ClayTech/implementation/items/MachineMakingBasic.java
index b4b035f..fcd6fa4 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/items/MachineMakingBasic.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/items/MachineMakingBasic.java
@@ -11,17 +11,17 @@
import org.bukkit.NamespacedKey;
public class MachineMakingBasic {
- public MachineMakingBasic() {
+ public MachineMakingBasic() {
- Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "BLISTERING_CORE", ClayTechItems.BLISTERING_CORE,
- "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.BLISTERING_CORE,
- false);
+ Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "BLISTERING_CORE", ClayTechItems.BLISTERING_CORE,
+ "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.BLISTERING_CORE,
+ false);
- Research before_element = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_BEFORE_ELEMENT"),
- 9917, Lang.readResearchesText("CLAYTECH_BEFORE_ELEMENTS"), 50);
+ Research before_element = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_BEFORE_ELEMENT"),
+ 9917, Lang.readResearchesText("CLAYTECH_BEFORE_ELEMENTS"), 50);
- before_element.addItems(new SlimefunItem[] { SlimefunItem.getByItem(ClayTechItems.BLISTERING_CORE) });
- before_element.register();
- }
+ before_element.addItems(new SlimefunItem[]{SlimefunItem.getByItem(ClayTechItems.BLISTERING_CORE)});
+ before_element.register();
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/items/PotionAffect_Weapons.java b/src/main/java/club/claycoffee/ClayTech/implementation/items/PotionAffect_Weapons.java
index 2509c61..eb05d6a 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/items/PotionAffect_Weapons.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/items/PotionAffect_Weapons.java
@@ -1,80 +1,79 @@
package club.claycoffee.ClayTech.implementation.items;
-import org.bukkit.NamespacedKey;
-
import club.claycoffee.ClayTech.ClayTech;
import club.claycoffee.ClayTech.ClayTechItems;
import club.claycoffee.ClayTech.ClayTechMachineRecipes;
import club.claycoffee.ClayTech.ClayTechRecipeType;
import club.claycoffee.ClayTech.utils.Lang;
import club.claycoffee.ClayTech.utils.Slimefunutils;
-import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import io.github.thebusybiscuit.slimefun4.core.researching.Research;
+import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
+import org.bukkit.NamespacedKey;
public class PotionAffect_Weapons {
- public PotionAffect_Weapons() {
- Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "BLIND_CORE", ClayTechItems.BLIND_CORE, "notresearch", 10,
- ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.BLIND_CORE, false);
- Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "ADVANCED_BLIND_CORE", ClayTechItems.ADVANCED_BLIND_CORE,
- "notresearch", 10, RecipeType.ANCIENT_ALTAR, ClayTechMachineRecipes.ADVANCED_BLIND_CORE, false);
- Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "POISON_CORE", ClayTechItems.POISON_CORE, "notresearch",
- 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.POISON_CORE, false);
- Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "ADVANCED_POISON_CORE",
- ClayTechItems.ADVANCED_POISON_CORE, "notresearch", 10, RecipeType.ANCIENT_ALTAR,
- ClayTechMachineRecipes.ADVANCED_POISON_CORE, false);
- Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "CONFUSION_CORE", ClayTechItems.CONFUSION_CORE,
- "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.CONFUSION_CORE,
- false);
- Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "ADVANCED_CONFUSION_CORE",
- ClayTechItems.ADVANCED_CONFUSION_CORE, "notresearch", 10, RecipeType.ANCIENT_ALTAR,
- ClayTechMachineRecipes.ADVANCED_CONFUSION_CORE, false);
- Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "SLOWNESS_CORE", ClayTechItems.SLOWNESS_CORE,
- "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.SLOWNESS_CORE, false);
- Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "ADVANCED_SLOWNESS_CORE",
- ClayTechItems.ADVANCED_SLOWNESS_CORE, "notresearch", 10, RecipeType.ANCIENT_ALTAR,
- ClayTechMachineRecipes.ADVANCED_SLOWNESS_CORE, false);
+ public PotionAffect_Weapons() {
+ Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "BLIND_CORE", ClayTechItems.BLIND_CORE, "notresearch", 10,
+ ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.BLIND_CORE, false);
+ Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "ADVANCED_BLIND_CORE", ClayTechItems.ADVANCED_BLIND_CORE,
+ "notresearch", 10, RecipeType.ANCIENT_ALTAR, ClayTechMachineRecipes.ADVANCED_BLIND_CORE, false);
+ Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "POISON_CORE", ClayTechItems.POISON_CORE, "notresearch",
+ 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.POISON_CORE, false);
+ Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "ADVANCED_POISON_CORE",
+ ClayTechItems.ADVANCED_POISON_CORE, "notresearch", 10, RecipeType.ANCIENT_ALTAR,
+ ClayTechMachineRecipes.ADVANCED_POISON_CORE, false);
+ Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "CONFUSION_CORE", ClayTechItems.CONFUSION_CORE,
+ "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.CONFUSION_CORE,
+ false);
+ Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "ADVANCED_CONFUSION_CORE",
+ ClayTechItems.ADVANCED_CONFUSION_CORE, "notresearch", 10, RecipeType.ANCIENT_ALTAR,
+ ClayTechMachineRecipes.ADVANCED_CONFUSION_CORE, false);
+ Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "SLOWNESS_CORE", ClayTechItems.SLOWNESS_CORE,
+ "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.SLOWNESS_CORE, false);
+ Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "ADVANCED_SLOWNESS_CORE",
+ ClayTechItems.ADVANCED_SLOWNESS_CORE, "notresearch", 10, RecipeType.ANCIENT_ALTAR,
+ ClayTechMachineRecipes.ADVANCED_SLOWNESS_CORE, false);
- Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "POISON_EYE", ClayTechItems.POISON_EYE, "notresearch", 10,
- ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.POISON_EYE, false);
- Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "BLACK_ROCK_BLOCK", ClayTechItems.BLACK_ROCK_BLOCK,
- "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.BLACK_ROCK_BLOCK,
- false);
+ Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "POISON_EYE", ClayTechItems.POISON_EYE, "notresearch", 10,
+ ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.POISON_EYE, false);
+ Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "BLACK_ROCK_BLOCK", ClayTechItems.BLACK_ROCK_BLOCK,
+ "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.BLACK_ROCK_BLOCK,
+ false);
- Slimefunutils.registerItem(ClayTechItems.C_WEAPONS, "BLIND_SWORD", ClayTechItems.BLIND_SWORD, "notresearch", 10,
- ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.BLIND_SWORD, false);
- Slimefunutils.registerItem(ClayTechItems.C_WEAPONS, "FOUR_BOW", ClayTechItems.FOUR_BOW, "notresearch", 10,
- ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.FOUR_BOW, false);
- Slimefunutils.registerItem(ClayTechItems.C_WEAPONS, "POISON_SWORD", ClayTechItems.POISON_SWORD, "notresearch",
- 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.POISON_SWORD, false);
+ Slimefunutils.registerItem(ClayTechItems.C_WEAPONS, "BLIND_SWORD", ClayTechItems.BLIND_SWORD, "notresearch", 10,
+ ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.BLIND_SWORD, false);
+ Slimefunutils.registerItem(ClayTechItems.C_WEAPONS, "FOUR_BOW", ClayTechItems.FOUR_BOW, "notresearch", 10,
+ ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.FOUR_BOW, false);
+ Slimefunutils.registerItem(ClayTechItems.C_WEAPONS, "POISON_SWORD", ClayTechItems.POISON_SWORD, "notresearch",
+ 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.POISON_SWORD, false);
- Research weapon_requires = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_EX_BASIC_WEAPONS"),
- 9904, Lang.readResearchesText("CLAYTECH_BEFORE_AFFECT_WEAPONS"), 50);
- weapon_requires.addItems(SlimefunItem.getByItem(ClayTechItems.BLIND_CORE),
- SlimefunItem.getByItem(ClayTechItems.CONFUSION_CORE),
- SlimefunItem.getByItem(ClayTechItems.SLOWNESS_CORE), SlimefunItem.getByItem(ClayTechItems.POISON_CORE),
- SlimefunItem.getByItem(ClayTechItems.POISON_EYE),
- SlimefunItem.getByItem(ClayTechItems.BLACK_ROCK_BLOCK));
- weapon_requires.register();
+ Research weapon_requires = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_EX_BASIC_WEAPONS"),
+ 9904, Lang.readResearchesText("CLAYTECH_BEFORE_AFFECT_WEAPONS"), 50);
+ weapon_requires.addItems(SlimefunItem.getByItem(ClayTechItems.BLIND_CORE),
+ SlimefunItem.getByItem(ClayTechItems.CONFUSION_CORE),
+ SlimefunItem.getByItem(ClayTechItems.SLOWNESS_CORE), SlimefunItem.getByItem(ClayTechItems.POISON_CORE),
+ SlimefunItem.getByItem(ClayTechItems.POISON_EYE),
+ SlimefunItem.getByItem(ClayTechItems.BLACK_ROCK_BLOCK));
+ weapon_requires.register();
- Research weapons_basic = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_BASIC_WEAPONS"), 9905,
- Lang.readResearchesText("CLAYTECH_AFFECT_WEAPONS"), 50);
- weapons_basic.addItems(SlimefunItem.getByItem(ClayTechItems.BLIND_SWORD),
- SlimefunItem.getByItem(ClayTechItems.POISON_SWORD));
- weapons_basic.register();
+ Research weapons_basic = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_BASIC_WEAPONS"), 9905,
+ Lang.readResearchesText("CLAYTECH_AFFECT_WEAPONS"), 50);
+ weapons_basic.addItems(SlimefunItem.getByItem(ClayTechItems.BLIND_SWORD),
+ SlimefunItem.getByItem(ClayTechItems.POISON_SWORD));
+ weapons_basic.register();
- Research advancedweapon_requires = new Research(
- new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_EX_ADVANCED_WEAPONS"), 9906,
- Lang.readResearchesText("CLAYTECH_BEFORE_ADVANCED_AFFECT_WEAPONS"), 75);
- advancedweapon_requires.addItems(SlimefunItem.getByItem(ClayTechItems.ADVANCED_BLIND_CORE),
- SlimefunItem.getByItem(ClayTechItems.ADVANCED_CONFUSION_CORE),
- SlimefunItem.getByItem(ClayTechItems.ADVANCED_SLOWNESS_CORE),
- SlimefunItem.getByItem(ClayTechItems.ADVANCED_POISON_CORE));
- advancedweapon_requires.register();
+ Research advancedweapon_requires = new Research(
+ new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_EX_ADVANCED_WEAPONS"), 9906,
+ Lang.readResearchesText("CLAYTECH_BEFORE_ADVANCED_AFFECT_WEAPONS"), 75);
+ advancedweapon_requires.addItems(SlimefunItem.getByItem(ClayTechItems.ADVANCED_BLIND_CORE),
+ SlimefunItem.getByItem(ClayTechItems.ADVANCED_CONFUSION_CORE),
+ SlimefunItem.getByItem(ClayTechItems.ADVANCED_SLOWNESS_CORE),
+ SlimefunItem.getByItem(ClayTechItems.ADVANCED_POISON_CORE));
+ advancedweapon_requires.register();
- Research advancedweapon = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_ADVANCED_WEAPONS"),
- 9906, Lang.readResearchesText("CLAYTECH_ADVANCED_AFFECT_WEAPONS"), 100);
- advancedweapon.addItems(SlimefunItem.getByItem(ClayTechItems.FOUR_BOW));
- advancedweapon.register();
- }
+ Research advancedweapon = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_ADVANCED_WEAPONS"),
+ 9906, Lang.readResearchesText("CLAYTECH_ADVANCED_AFFECT_WEAPONS"), 100);
+ advancedweapon.addItems(SlimefunItem.getByItem(ClayTechItems.FOUR_BOW));
+ advancedweapon.register();
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/items/Railways.java b/src/main/java/club/claycoffee/ClayTech/implementation/items/Railways.java
index 968b8d1..9c3f531 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/items/Railways.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/items/Railways.java
@@ -1,8 +1,5 @@
package club.claycoffee.ClayTech.implementation.items;
-import org.bukkit.NamespacedKey;
-import org.bukkit.inventory.ItemStack;
-
import club.claycoffee.ClayTech.ClayTech;
import club.claycoffee.ClayTech.ClayTechItems;
import club.claycoffee.ClayTech.ClayTechMachineRecipes;
@@ -12,22 +9,24 @@
import io.github.thebusybiscuit.slimefun4.core.researching.Research;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
+import org.bukkit.NamespacedKey;
+import org.bukkit.inventory.ItemStack;
public class Railways {
- public Railways() {
- Slimefunutils.registerItem(ClayTechItems.C_OTHER, "CLAY_HIGHSPEED_RAILWAY", ClayTechItems.HIGHSPEED_RAILWAY,
- "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.HIGHSPEED_RAILWAY,
- false);
- ItemStack elem8 = ClayTechItems.ELECTRIC_MOTOR_8;
- elem8.setAmount(8);
- SlimefunItemStack motor_8 = new SlimefunItemStack("ELECTRIC_MOTOR_8", elem8);
- SlimefunItem motor_8_i = new SlimefunItem(ClayTechItems.C_OTHER, motor_8,
- ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.ELECTRIC_MOTOR_8);
- motor_8_i.register(ClayTech.getInstance());
- Research railway_basic = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_RAILWAY_BASIC"), 9920,
- Lang.readResearchesText("CLAYTECH_RAILWAY_I"), 40);
- railway_basic.addItems(SlimefunItem.getByItem(ClayTechItems.HIGHSPEED_RAILWAY),
- SlimefunItem.getByItem(ClayTechItems.ELECTRIC_MOTOR_8));
- railway_basic.register();
- }
+ public Railways() {
+ Slimefunutils.registerItem(ClayTechItems.C_OTHER, "CLAY_HIGHSPEED_RAILWAY", ClayTechItems.HIGHSPEED_RAILWAY,
+ "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.HIGHSPEED_RAILWAY,
+ false);
+ ItemStack elem8 = ClayTechItems.ELECTRIC_MOTOR_8;
+ elem8.setAmount(8);
+ SlimefunItemStack motor_8 = new SlimefunItemStack("ELECTRIC_MOTOR_8", elem8);
+ SlimefunItem motor_8_i = new SlimefunItem(ClayTechItems.C_OTHER, motor_8,
+ ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.ELECTRIC_MOTOR_8);
+ motor_8_i.register(ClayTech.getInstance());
+ Research railway_basic = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_RAILWAY_BASIC"), 9920,
+ Lang.readResearchesText("CLAYTECH_RAILWAY_I"), 40);
+ railway_basic.addItems(SlimefunItem.getByItem(ClayTechItems.HIGHSPEED_RAILWAY),
+ SlimefunItem.getByItem(ClayTechItems.ELECTRIC_MOTOR_8));
+ railway_basic.register();
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/items/RocketMakings.java b/src/main/java/club/claycoffee/ClayTech/implementation/items/RocketMakings.java
index 3416da3..c02d6cc 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/items/RocketMakings.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/items/RocketMakings.java
@@ -1,7 +1,5 @@
package club.claycoffee.ClayTech.implementation.items;
-import org.bukkit.NamespacedKey;
-
import club.claycoffee.ClayTech.ClayTech;
import club.claycoffee.ClayTech.ClayTechItems;
import club.claycoffee.ClayTech.ClayTechMachineRecipes;
@@ -10,106 +8,107 @@
import club.claycoffee.ClayTech.utils.Slimefunutils;
import io.github.thebusybiscuit.slimefun4.core.researching.Research;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
+import org.bukkit.NamespacedKey;
public class RocketMakings {
- public RocketMakings() {
- Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "MOTOR_CORE", ClayTechItems.MOTOR_CORE, "notresearch", 10,
- ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.MOTOR_CORE, false);
- Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "TEMPERATURE_RESISTANCE_OBSIDIAN",
- ClayTechItems.TEMPERATURE_RESISTANCE_OBSIDIAN, "notresearch", 10,
- ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.TEMPERATURE_RESISTANCE_OBSIDIAN, false);
- Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "ROCKET_ENGINE_SHELL", ClayTechItems.ROCKET_ENGINE_SHELL,
- "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.ROCKET_ENGINE_SHELL,
- false);
- Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "FUEL_TANK", ClayTechItems.FUEL_TANK, "notresearch", 10,
- ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.FUEL_TANK, false);
- Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "ROCKET_ENGINE", ClayTechItems.ROCKET_ENGINE,
- "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.ROCKET_ENGINE, false);
- Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "ROCKET_ANTENNA", ClayTechItems.ROCKET_ANTENNA,
- "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.ROCKET_ANTENNA,
- false);
- Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "ROCKET_CPU", ClayTechItems.ROCKET_CPU, "notresearch", 10,
- ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.ROCKET_CPU, false);
- Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "ROCKET_CONTROL_CORE", ClayTechItems.ROCKET_CONTROL_CORE,
- "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.ROCKET_CONTROL_CORE,
- false);
- Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "ROCKET_FUEL_TANK", ClayTechItems.ROCKET_FUEL_TANK,
- "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.ROCKET_FUEL_TANK,
- false);
- Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "ROCKET_GLASS", ClayTechItems.ROCKET_GLASS, "notresearch",
- 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.ROCKET_GLASS, false);
- Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "ROCKET_STEEL_PLATE", ClayTechItems.ROCKET_STEEL_PLATE,
- "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.ROCKET_STEEL_PLATE,
- false);
- Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "MIXED_ROCKET_FUEL", ClayTechItems.MIXED_ROCKET_FUEL,
- "notresearch", 10, ClayTechRecipeType.CLAY_ROCKET_FUEL_GENERATOR,
- ClayTechMachineRecipes.MIXED_ROCKET_FUEL, false);
+ public RocketMakings() {
+ Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "MOTOR_CORE", ClayTechItems.MOTOR_CORE, "notresearch", 10,
+ ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.MOTOR_CORE, false);
+ Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "TEMPERATURE_RESISTANCE_OBSIDIAN",
+ ClayTechItems.TEMPERATURE_RESISTANCE_OBSIDIAN, "notresearch", 10,
+ ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.TEMPERATURE_RESISTANCE_OBSIDIAN, false);
+ Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "ROCKET_ENGINE_SHELL", ClayTechItems.ROCKET_ENGINE_SHELL,
+ "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.ROCKET_ENGINE_SHELL,
+ false);
+ Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "FUEL_TANK", ClayTechItems.FUEL_TANK, "notresearch", 10,
+ ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.FUEL_TANK, false);
+ Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "ROCKET_ENGINE", ClayTechItems.ROCKET_ENGINE,
+ "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.ROCKET_ENGINE, false);
+ Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "ROCKET_ANTENNA", ClayTechItems.ROCKET_ANTENNA,
+ "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.ROCKET_ANTENNA,
+ false);
+ Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "ROCKET_CPU", ClayTechItems.ROCKET_CPU, "notresearch", 10,
+ ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.ROCKET_CPU, false);
+ Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "ROCKET_CONTROL_CORE", ClayTechItems.ROCKET_CONTROL_CORE,
+ "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.ROCKET_CONTROL_CORE,
+ false);
+ Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "ROCKET_FUEL_TANK", ClayTechItems.ROCKET_FUEL_TANK,
+ "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.ROCKET_FUEL_TANK,
+ false);
+ Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "ROCKET_GLASS", ClayTechItems.ROCKET_GLASS, "notresearch",
+ 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.ROCKET_GLASS, false);
+ Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "ROCKET_STEEL_PLATE", ClayTechItems.ROCKET_STEEL_PLATE,
+ "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.ROCKET_STEEL_PLATE,
+ false);
+ Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "MIXED_ROCKET_FUEL", ClayTechItems.MIXED_ROCKET_FUEL,
+ "notresearch", 10, ClayTechRecipeType.CLAY_ROCKET_FUEL_GENERATOR,
+ ClayTechMachineRecipes.MIXED_ROCKET_FUEL, false);
- Research rk1 = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_ROCKETS_1"), 9926,
- Lang.readResearchesText("CLAYTECH_ROCKETS_I"), 85);
- rk1.addItems(SlimefunItem.getByItem(ClayTechItems.MOTOR_CORE),
- SlimefunItem.getByItem(ClayTechItems.TEMPERATURE_RESISTANCE_OBSIDIAN),
- SlimefunItem.getByItem(ClayTechItems.ROCKET_ENGINE_SHELL),
- SlimefunItem.getByItem(ClayTechItems.FUEL_TANK), SlimefunItem.getByItem(ClayTechItems.ROCKET_ENGINE),
- SlimefunItem.getByItem(ClayTechItems.ROCKET_ANTENNA), SlimefunItem.getByItem(ClayTechItems.ROCKET_CPU),
- SlimefunItem.getByItem(ClayTechItems.ROCKET_CONTROL_CORE),
- SlimefunItem.getByItem(ClayTechItems.ROCKET_FUEL_TANK),
- SlimefunItem.getByItem(ClayTechItems.ROCKET_GLASS),
- SlimefunItem.getByItem(ClayTechItems.ROCKET_STEEL_PLATE),
- SlimefunItem.getByItem(ClayTechItems.MIXED_ROCKET_FUEL));
- rk1.register();
+ Research rk1 = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_ROCKETS_1"), 9926,
+ Lang.readResearchesText("CLAYTECH_ROCKETS_I"), 85);
+ rk1.addItems(SlimefunItem.getByItem(ClayTechItems.MOTOR_CORE),
+ SlimefunItem.getByItem(ClayTechItems.TEMPERATURE_RESISTANCE_OBSIDIAN),
+ SlimefunItem.getByItem(ClayTechItems.ROCKET_ENGINE_SHELL),
+ SlimefunItem.getByItem(ClayTechItems.FUEL_TANK), SlimefunItem.getByItem(ClayTechItems.ROCKET_ENGINE),
+ SlimefunItem.getByItem(ClayTechItems.ROCKET_ANTENNA), SlimefunItem.getByItem(ClayTechItems.ROCKET_CPU),
+ SlimefunItem.getByItem(ClayTechItems.ROCKET_CONTROL_CORE),
+ SlimefunItem.getByItem(ClayTechItems.ROCKET_FUEL_TANK),
+ SlimefunItem.getByItem(ClayTechItems.ROCKET_GLASS),
+ SlimefunItem.getByItem(ClayTechItems.ROCKET_STEEL_PLATE),
+ SlimefunItem.getByItem(ClayTechItems.MIXED_ROCKET_FUEL));
+ rk1.register();
- Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "OXYGEN_TANK", ClayTechItems.OXYGEN_TANK, "notresearch",
- 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.OXYGEN_TANK, false);
- Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "SPACESUIT_OXYGEN_TANK",
- ClayTechItems.SPACESUIT_OXYGEN_TANK, "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE,
- ClayTechMachineRecipes.SPACESUIT_OXYGEN_TANK, false);
+ Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "OXYGEN_TANK", ClayTechItems.OXYGEN_TANK, "notresearch",
+ 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.OXYGEN_TANK, false);
+ Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "SPACESUIT_OXYGEN_TANK",
+ ClayTechItems.SPACESUIT_OXYGEN_TANK, "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE,
+ ClayTechMachineRecipes.SPACESUIT_OXYGEN_TANK, false);
- Slimefunutils.registerItem(ClayTechItems.C_ARMORS, "SPACESUIT_HELMET", ClayTechItems.SPACESUIT_HELMET,
- "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.SPACESUIT_HELMET,
- false);
- Slimefunutils.registerItem(ClayTechItems.C_ARMORS, "SPACESUIT_CHESTPLATE", ClayTechItems.SPACESUIT_CHESTPLATE,
- "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.SPACESUIT_CHESTPLATE,
- false);
- Slimefunutils.registerItem(ClayTechItems.C_ARMORS, "SPACESUIT_LEGGINGS", ClayTechItems.SPACESUIT_LEGGINGS,
- "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.SPACESUIT_LEGGINGS,
- false);
- Slimefunutils.registerItem(ClayTechItems.C_ARMORS, "SPACESUIT_BOOTS", ClayTechItems.SPACESUIT_BOOTS,
- "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.SPACESUIT_BOOTS,
- false);
+ Slimefunutils.registerItem(ClayTechItems.C_ARMORS, "SPACESUIT_HELMET", ClayTechItems.SPACESUIT_HELMET,
+ "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.SPACESUIT_HELMET,
+ false);
+ Slimefunutils.registerItem(ClayTechItems.C_ARMORS, "SPACESUIT_CHESTPLATE", ClayTechItems.SPACESUIT_CHESTPLATE,
+ "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.SPACESUIT_CHESTPLATE,
+ false);
+ Slimefunutils.registerItem(ClayTechItems.C_ARMORS, "SPACESUIT_LEGGINGS", ClayTechItems.SPACESUIT_LEGGINGS,
+ "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.SPACESUIT_LEGGINGS,
+ false);
+ Slimefunutils.registerItem(ClayTechItems.C_ARMORS, "SPACESUIT_BOOTS", ClayTechItems.SPACESUIT_BOOTS,
+ "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.SPACESUIT_BOOTS,
+ false);
- Research ss1 = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_SPACESUIT_1"), 9927,
- Lang.readResearchesText("CLAYTECH_SPACESUIT_I"), 55);
- ss1.addItems(SlimefunItem.getByItem(ClayTechItems.OXYGEN_TANK),
- SlimefunItem.getByItem(ClayTechItems.SPACESUIT_OXYGEN_TANK),
- SlimefunItem.getByItem(ClayTechItems.SPACESUIT_HELMET),
- SlimefunItem.getByItem(ClayTechItems.SPACESUIT_CHESTPLATE),
- SlimefunItem.getByItem(ClayTechItems.SPACESUIT_LEGGINGS),
- SlimefunItem.getByItem(ClayTechItems.SPACESUIT_BOOTS));
- ss1.register();
+ Research ss1 = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_SPACESUIT_1"), 9927,
+ Lang.readResearchesText("CLAYTECH_SPACESUIT_I"), 55);
+ ss1.addItems(SlimefunItem.getByItem(ClayTechItems.OXYGEN_TANK),
+ SlimefunItem.getByItem(ClayTechItems.SPACESUIT_OXYGEN_TANK),
+ SlimefunItem.getByItem(ClayTechItems.SPACESUIT_HELMET),
+ SlimefunItem.getByItem(ClayTechItems.SPACESUIT_CHESTPLATE),
+ SlimefunItem.getByItem(ClayTechItems.SPACESUIT_LEGGINGS),
+ SlimefunItem.getByItem(ClayTechItems.SPACESUIT_BOOTS));
+ ss1.register();
- Research ms1 = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_UNIVERSE_MACHINE_1"), 9928,
- Lang.readResearchesText("CLAYTECH_UNIVERSE_MACHINE_I"), 70);
- ms1.addItems(SlimefunItem.getByItem(ClayTechItems.CLAY_ROCKET_ASSEMBLING_MACHINE),
- SlimefunItem.getByItem(ClayTechItems.CLAY_ROCKET_FUEL_GENERATOR),
- SlimefunItem.getByItem(ClayTechItems.CLAY_ROCKET_FUEL_INJECTOR),
- SlimefunItem.getByItem(ClayTechItems.CLAY_SPACESUIT_OXYGEN_INJECTOR));
- ms1.register();
+ Research ms1 = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_UNIVERSE_MACHINE_1"), 9928,
+ Lang.readResearchesText("CLAYTECH_UNIVERSE_MACHINE_I"), 70);
+ ms1.addItems(SlimefunItem.getByItem(ClayTechItems.CLAY_ROCKET_ASSEMBLING_MACHINE),
+ SlimefunItem.getByItem(ClayTechItems.CLAY_ROCKET_FUEL_GENERATOR),
+ SlimefunItem.getByItem(ClayTechItems.CLAY_ROCKET_FUEL_INJECTOR),
+ SlimefunItem.getByItem(ClayTechItems.CLAY_SPACESUIT_OXYGEN_INJECTOR));
+ ms1.register();
- Slimefunutils.registerItem(ClayTechItems.C_OTHER, "PLANET_BASE_SIGNER", ClayTechItems.PLANET_BASE_SIGNER,
- "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.PLANET_BASE_SIGNER,
- false);
- Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "TUBE", ClayTechItems.TUBE, "notresearch", 10,
- ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.TUBE, false);
- Slimefunutils.registerItem(ClayTechItems.C_OTHER, "OXYGEN_DISTRIBUTER", ClayTechItems.OXYGEN_DISTRIBUTER,
- "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.OXYGEN_DISTRIBUTER,
- false);
+ Slimefunutils.registerItem(ClayTechItems.C_OTHER, "PLANET_BASE_SIGNER", ClayTechItems.PLANET_BASE_SIGNER,
+ "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.PLANET_BASE_SIGNER,
+ false);
+ Slimefunutils.registerItem(ClayTechItems.C_MATERIALS, "TUBE", ClayTechItems.TUBE, "notresearch", 10,
+ ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.TUBE, false);
+ Slimefunutils.registerItem(ClayTechItems.C_OTHER, "OXYGEN_DISTRIBUTER", ClayTechItems.OXYGEN_DISTRIBUTER,
+ "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.OXYGEN_DISTRIBUTER,
+ false);
- Research bs1 = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_BASE_1"), 9930,
- Lang.readResearchesText("CLAYTECH_BASE_I"), 50);
- bs1.addItems(SlimefunItem.getByItem(ClayTechItems.PLANET_BASE_SIGNER),
- SlimefunItem.getByItem(ClayTechItems.TUBE), SlimefunItem.getByItem(ClayTechItems.OXYGEN_DISTRIBUTER));
- bs1.register();
+ Research bs1 = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_BASE_1"), 9930,
+ Lang.readResearchesText("CLAYTECH_BASE_I"), 50);
+ bs1.addItems(SlimefunItem.getByItem(ClayTechItems.PLANET_BASE_SIGNER),
+ SlimefunItem.getByItem(ClayTechItems.TUBE), SlimefunItem.getByItem(ClayTechItems.OXYGEN_DISTRIBUTER));
+ bs1.register();
- }
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/items/Rockets.java b/src/main/java/club/claycoffee/ClayTech/implementation/items/Rockets.java
index e807d1e..c154abf 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/items/Rockets.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/items/Rockets.java
@@ -1,7 +1,18 @@
package club.claycoffee.ClayTech.implementation.items;
-import java.util.Map;
-
+import club.claycoffee.ClayTech.*;
+import club.claycoffee.ClayTech.api.Planet;
+import club.claycoffee.ClayTech.utils.*;
+import io.github.thebusybiscuit.slimefun4.api.events.PlayerRightClickEvent;
+import io.github.thebusybiscuit.slimefun4.core.handlers.BlockPlaceHandler;
+import io.github.thebusybiscuit.slimefun4.core.handlers.BlockUseHandler;
+import io.github.thebusybiscuit.slimefun4.core.researching.Research;
+import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
+import me.mrCookieSlime.Slimefun.Lists.RecipeType;
+import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
+import me.mrCookieSlime.Slimefun.Objects.handlers.ItemHandler;
+import me.mrCookieSlime.Slimefun.api.BlockStorage;
+import me.mrCookieSlime.Slimefun.api.Slimefun;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
@@ -13,118 +24,98 @@
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
-import club.claycoffee.ClayTech.ClayTech;
-import club.claycoffee.ClayTech.ClayTechData;
-import club.claycoffee.ClayTech.ClayTechItems;
-import club.claycoffee.ClayTech.ClayTechMachineRecipes;
-import club.claycoffee.ClayTech.ClayTechRecipeType;
-import club.claycoffee.ClayTech.api.Planet;
-import club.claycoffee.ClayTech.utils.Lang;
-import club.claycoffee.ClayTech.utils.PlanetUtils;
-import club.claycoffee.ClayTech.utils.Slimefunutils;
-import club.claycoffee.ClayTech.utils.StrUtils;
-import club.claycoffee.ClayTech.utils.Utils;
-import me.mrCookieSlime.Slimefun.Lists.RecipeType;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
-import io.github.thebusybiscuit.slimefun4.core.researching.Research;
-import io.github.thebusybiscuit.slimefun4.api.events.PlayerRightClickEvent;
-import io.github.thebusybiscuit.slimefun4.core.handlers.BlockPlaceHandler;
-import io.github.thebusybiscuit.slimefun4.core.handlers.BlockUseHandler;
-import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
-import me.mrCookieSlime.Slimefun.Objects.handlers.ItemHandler;
-import me.mrCookieSlime.Slimefun.api.BlockStorage;
-import me.mrCookieSlime.Slimefun.api.Slimefun;
+import java.util.Map;
public class Rockets {
- private static final int[] BORDER = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 13, 17, 18, 26, 27, 35, 36, 44, 45, 47, 48, 49,
- 50, 51, 53 };
- private static final int[] BORDER_2 = { 10, 11, 12, 14, 15, 16 };
- private static final ItemStack BORDER_ITEM = Utils.newItemD(Material.LIGHT_BLUE_STAINED_GLASS_PANE,
- Lang.readMachinesText("SPLIT_LINE"));
- private static final ItemStack OTHERBORDER_ITEM = Utils.newItemD(Material.LIME_STAINED_GLASS_PANE,
- Lang.readMachinesText("SPLIT_LINE"));
- private static int currentPage = 1;
+ private static final int[] BORDER = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 13, 17, 18, 26, 27, 35, 36, 44, 45, 47, 48, 49,
+ 50, 51, 53};
+ private static final int[] BORDER_2 = {10, 11, 12, 14, 15, 16};
+ private static final ItemStack BORDER_ITEM = Utils.newItemD(Material.LIGHT_BLUE_STAINED_GLASS_PANE,
+ Lang.readMachinesText("SPLIT_LINE"));
+ private static final ItemStack OTHERBORDER_ITEM = Utils.newItemD(Material.LIME_STAINED_GLASS_PANE,
+ Lang.readMachinesText("SPLIT_LINE"));
+ private static int currentPage = 1;
- public Rockets() {
- // 平台
- ItemStack[] rocketlauncher = { ClayTechItems.CLAY_FUSION_INGOT, ClayTechItems.CLAY_FUSION_INGOT,
- ClayTechItems.CLAY_FUSION_INGOT, ClayTechItems.CLAY_FUSION_INGOT, SlimefunItems.PROGRAMMABLE_ANDROID,
- ClayTechItems.CLAY_FUSION_INGOT, ClayTechItems.CLAY_FUSION_INGOT, ClayTechItems.CLAY_FUSION_INGOT,
- ClayTechItems.CLAY_FUSION_INGOT };
+ public Rockets() {
+ // 平台
+ ItemStack[] rocketlauncher = {ClayTechItems.CLAY_FUSION_INGOT, ClayTechItems.CLAY_FUSION_INGOT,
+ ClayTechItems.CLAY_FUSION_INGOT, ClayTechItems.CLAY_FUSION_INGOT, SlimefunItems.PROGRAMMABLE_ANDROID,
+ ClayTechItems.CLAY_FUSION_INGOT, ClayTechItems.CLAY_FUSION_INGOT, ClayTechItems.CLAY_FUSION_INGOT,
+ ClayTechItems.CLAY_FUSION_INGOT};
- Slimefunutils.registerItem(ClayTechItems.C_MACHINES, "ROCKET_LAUNCHER", ClayTechItems.ROCKET_LAUNCHER,
- "notresearch", 10, RecipeType.ENHANCED_CRAFTING_TABLE, rocketlauncher, false,
- new ItemHandler[] { new BlockPlaceHandler() {
- @Override
- public boolean onBlockPlace(Player p, BlockPlaceEvent e, ItemStack item) {
- BlockStorage.addBlockInfo(e.getBlockPlaced(), "owner", e.getPlayer().getName(), true);
- return true;
- }
+ Slimefunutils.registerItem(ClayTechItems.C_MACHINES, "ROCKET_LAUNCHER", ClayTechItems.ROCKET_LAUNCHER,
+ "notresearch", 10, RecipeType.ENHANCED_CRAFTING_TABLE, rocketlauncher, false,
+ new ItemHandler[]{new BlockPlaceHandler() {
+ @Override
+ public boolean onBlockPlace(Player p, BlockPlaceEvent e, ItemStack item) {
+ BlockStorage.addBlockInfo(e.getBlockPlaced(), "owner", e.getPlayer().getName(), true);
+ return true;
+ }
- }, new BlockUseHandler() {
+ }, new BlockUseHandler() {
- @Override
- public void onRightClick(PlayerRightClickEvent ev) {
- PlayerInteractEvent e = ev.getInteractEvent();
- if (e.hasBlock() && e.getAction() == Action.RIGHT_CLICK_BLOCK) {
- Block b = e.getClickedBlock();
- if (BlockStorage.checkID(b) != null) {
- if (BlockStorage.checkID(b).equalsIgnoreCase("ROCKET_LAUNCHER")) {
- if (e.hasItem()) {
- if (!Slimefun.hasUnlocked(e.getPlayer(), e.getItem(), true)) {
- return;
- }
- }
- if (!Slimefun.hasUnlocked(e.getPlayer(), ClayTechItems.ROCKET_LAUNCHER, true)) {
- return;
- }
- Map jbj = StrUtils.parseJSON(BlockStorage.getBlockInfoAsJson(b));
- String ownerName = jbj.get("owner");
- if (ownerName.equalsIgnoreCase(e.getPlayer().getName())) {
- Planet current = PlanetUtils.getPlanet(b.getWorld());
- if (current == null) {
- e.getPlayer().sendMessage(Lang.readGeneralText("NotAtAPlanet"));
- return;
- }
- if (Utils.getMetadata(b, "currentPage") != null) {
- currentPage = new Integer(Utils.getMetadata(b, "currentPage")).intValue();
- }
- Inventory Preset = Bukkit.createInventory(null, 54,
- Lang.readMachinesText("ROCKET_LAUNCHER"));
- if (!ClayTechData.RunningLaunchersG.containsKey(Preset)) {
- ClayTechData.RunningLaunchersG.put(Preset, b);
- }
- Preset.setItem(5, BORDER_ITEM);
- for (int eachID : BORDER) {
- Preset.setItem(eachID, BORDER_ITEM);
- }
- for (int eachID : BORDER_2) {
- Preset.setItem(eachID, OTHERBORDER_ITEM);
- }
- Preset.setItem(5, BORDER_ITEM);
+ @Override
+ public void onRightClick(PlayerRightClickEvent ev) {
+ PlayerInteractEvent e = ev.getInteractEvent();
+ if (e.hasBlock() && e.getAction() == Action.RIGHT_CLICK_BLOCK) {
+ Block b = e.getClickedBlock();
+ if (BlockStorage.checkID(b) != null) {
+ if (BlockStorage.checkID(b).equalsIgnoreCase("ROCKET_LAUNCHER")) {
+ if (e.hasItem()) {
+ if (!Slimefun.hasUnlocked(e.getPlayer(), e.getItem(), true)) {
+ return;
+ }
+ }
+ if (!Slimefun.hasUnlocked(e.getPlayer(), ClayTechItems.ROCKET_LAUNCHER, true)) {
+ return;
+ }
+ Map jbj = StrUtils.parseJSON(BlockStorage.getBlockInfoAsJson(b));
+ String ownerName = jbj.get("owner");
+ if (ownerName.equalsIgnoreCase(e.getPlayer().getName())) {
+ Planet current = PlanetUtils.getPlanet(b.getWorld());
+ if (current == null) {
+ e.getPlayer().sendMessage(Lang.readGeneralText("NotAtAPlanet"));
+ return;
+ }
+ if (Utils.getMetadata(b, "currentPage") != null) {
+ currentPage = new Integer(Utils.getMetadata(b, "currentPage")).intValue();
+ }
+ Inventory Preset = Bukkit.createInventory(null, 54,
+ Lang.readMachinesText("ROCKET_LAUNCHER"));
+ if (!ClayTechData.RunningLaunchersG.containsKey(Preset)) {
+ ClayTechData.RunningLaunchersG.put(Preset, b);
+ }
+ Preset.setItem(5, BORDER_ITEM);
+ for (int eachID : BORDER) {
+ Preset.setItem(eachID, BORDER_ITEM);
+ }
+ for (int eachID : BORDER_2) {
+ Preset.setItem(eachID, OTHERBORDER_ITEM);
+ }
+ Preset.setItem(5, BORDER_ITEM);
- Preset = PlanetUtils.renderLauncherMenu(current, Preset, currentPage);
+ Preset = PlanetUtils.renderLauncherMenu(current, Preset, currentPage);
- e.getPlayer().openInventory(Preset);
- } else {
- e.getPlayer().sendMessage(Lang.readGeneralText("notOwner"));
- e.setCancelled(true);
- return;
- }
- }
- }
- }
- }
+ e.getPlayer().openInventory(Preset);
+ } else {
+ e.getPlayer().sendMessage(Lang.readGeneralText("notOwner"));
+ e.setCancelled(true);
+ return;
+ }
+ }
+ }
+ }
+ }
- } });
+ }});
- Research ms2 = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_UNIVERSE_MACHINE_2"), 9929,
- Lang.readResearchesText("CLAYTECH_UNIVERSE_MACHINE_II"), 55);
- ms2.addItems(SlimefunItem.getByItem(ClayTechItems.ROCKET_LAUNCHER));
- ms2.register();
+ Research ms2 = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_UNIVERSE_MACHINE_2"), 9929,
+ Lang.readResearchesText("CLAYTECH_UNIVERSE_MACHINE_II"), 55);
+ ms2.addItems(SlimefunItem.getByItem(ClayTechItems.ROCKET_LAUNCHER));
+ ms2.register();
- // 火箭一阶
- Slimefunutils.registerItem(ClayTechItems.C_OTHER, "ROCKET_1", ClayTechItems.ROCKET, "notresearch", 10,
- ClayTechRecipeType.CLAY_ROCKET_ASSEMBLING_MACHINE, ClayTechMachineRecipes.ROCKET_1, false);
- }
+ // 火箭一阶
+ Slimefunutils.registerItem(ClayTechItems.C_OTHER, "ROCKET_1", ClayTechItems.ROCKET, "notresearch", 10,
+ ClayTechRecipeType.CLAY_ROCKET_ASSEMBLING_MACHINE, ClayTechMachineRecipes.ROCKET_1, false);
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/items/Skulls.java b/src/main/java/club/claycoffee/ClayTech/implementation/items/Skulls.java
index d43abc8..1f4a268 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/items/Skulls.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/items/Skulls.java
@@ -1,73 +1,72 @@
package club.claycoffee.ClayTech.implementation.items;
-import org.bukkit.Material;
-import org.bukkit.NamespacedKey;
-import org.bukkit.inventory.ItemStack;
-
import club.claycoffee.ClayTech.ClayTech;
import club.claycoffee.ClayTech.ClayTechItems;
import club.claycoffee.ClayTech.utils.Lang;
import club.claycoffee.ClayTech.utils.Slimefunutils;
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
+import io.github.thebusybiscuit.slimefun4.core.researching.Research;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
-import io.github.thebusybiscuit.slimefun4.core.researching.Research;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
+import org.bukkit.Material;
+import org.bukkit.NamespacedKey;
+import org.bukkit.inventory.ItemStack;
public class Skulls {
- public Skulls() {
- // 合成方式
- ItemStack[] ClayCoffeeHeadRecipe = { new ItemStack(Material.DIAMOND_BLOCK), new ItemStack(Material.GOLD_BLOCK),
- new ItemStack(Material.DIAMOND_BLOCK), ClayTechItems.ARTIFICIAL_GOLD_INGOT, ClayTechItems.MAGIC_CLAY,
- ClayTechItems.ARTIFICIAL_GOLD_INGOT, new ItemStack(Material.DIAMOND_BLOCK),
- new ItemStack(Material.GOLD_BLOCK), new ItemStack(Material.DIAMOND_BLOCK) };
- ItemStack[] OtherHeadRecipe = { new ItemStack(Material.IRON_BLOCK), new ItemStack(Material.GOLD_BLOCK),
- new ItemStack(Material.IRON_BLOCK), ClayTechItems.ARTIFICIAL_GOLD_NUGGET, ClayTechItems.MAGIC_CLAY,
- ClayTechItems.ARTIFICIAL_GOLD_NUGGET, new ItemStack(Material.IRON_BLOCK),
- new ItemStack(Material.GOLD_BLOCK), new ItemStack(Material.IRON_BLOCK) };
- ItemStack[] OtherHeadRecipe2 = { new ItemStack(Material.IRON_BLOCK), new ItemStack(Material.GOLD_BLOCK),
- new ItemStack(Material.IRON_BLOCK), ClayTechItems.ARTIFICIAL_GOLD_NUGGET, ClayTechItems.CLAY_STICK,
- ClayTechItems.ARTIFICIAL_GOLD_NUGGET, new ItemStack(Material.IRON_BLOCK),
- new ItemStack(Material.GOLD_BLOCK), new ItemStack(Material.IRON_BLOCK) };
- ItemStack[] ClockRecipe = SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)
- ? new ItemStack[] { new ItemStack(Material.IRON_INGOT), new ItemStack(Material.IRON_INGOT),
- new ItemStack(Material.IRON_INGOT), new ItemStack(Material.IRON_INGOT),
- ClayTechItems.MAGIC_CLAY, new ItemStack(Material.IRON_INGOT),
- new ItemStack(Material.IRON_INGOT), new ItemStack(Material.BLACK_DYE),
- new ItemStack(Material.IRON_INGOT) }
- : new ItemStack[] { new ItemStack(Material.IRON_INGOT), new ItemStack(Material.IRON_INGOT),
- new ItemStack(Material.IRON_INGOT), new ItemStack(Material.IRON_INGOT),
- ClayTechItems.MAGIC_CLAY, new ItemStack(Material.IRON_INGOT),
- new ItemStack(Material.IRON_INGOT), new ItemStack(Material.COAL),
- new ItemStack(Material.IRON_INGOT) };
- ItemStack[] LanternRecipe = { new ItemStack(Material.OAK_LOG), new ItemStack(Material.OAK_LOG),
- new ItemStack(Material.OAK_LOG), new ItemStack(Material.OAK_LOG), new ItemStack(Material.GLOWSTONE),
- new ItemStack(Material.OAK_LOG), new ItemStack(Material.OAK_LOG), ClayTechItems.MAGIC_CLAY,
- new ItemStack(Material.OAK_LOG) };
+ public Skulls() {
+ // 合成方式
+ ItemStack[] ClayCoffeeHeadRecipe = {new ItemStack(Material.DIAMOND_BLOCK), new ItemStack(Material.GOLD_BLOCK),
+ new ItemStack(Material.DIAMOND_BLOCK), ClayTechItems.ARTIFICIAL_GOLD_INGOT, ClayTechItems.MAGIC_CLAY,
+ ClayTechItems.ARTIFICIAL_GOLD_INGOT, new ItemStack(Material.DIAMOND_BLOCK),
+ new ItemStack(Material.GOLD_BLOCK), new ItemStack(Material.DIAMOND_BLOCK)};
+ ItemStack[] OtherHeadRecipe = {new ItemStack(Material.IRON_BLOCK), new ItemStack(Material.GOLD_BLOCK),
+ new ItemStack(Material.IRON_BLOCK), ClayTechItems.ARTIFICIAL_GOLD_NUGGET, ClayTechItems.MAGIC_CLAY,
+ ClayTechItems.ARTIFICIAL_GOLD_NUGGET, new ItemStack(Material.IRON_BLOCK),
+ new ItemStack(Material.GOLD_BLOCK), new ItemStack(Material.IRON_BLOCK)};
+ ItemStack[] OtherHeadRecipe2 = {new ItemStack(Material.IRON_BLOCK), new ItemStack(Material.GOLD_BLOCK),
+ new ItemStack(Material.IRON_BLOCK), ClayTechItems.ARTIFICIAL_GOLD_NUGGET, ClayTechItems.CLAY_STICK,
+ ClayTechItems.ARTIFICIAL_GOLD_NUGGET, new ItemStack(Material.IRON_BLOCK),
+ new ItemStack(Material.GOLD_BLOCK), new ItemStack(Material.IRON_BLOCK)};
+ ItemStack[] ClockRecipe = SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)
+ ? new ItemStack[]{new ItemStack(Material.IRON_INGOT), new ItemStack(Material.IRON_INGOT),
+ new ItemStack(Material.IRON_INGOT), new ItemStack(Material.IRON_INGOT),
+ ClayTechItems.MAGIC_CLAY, new ItemStack(Material.IRON_INGOT),
+ new ItemStack(Material.IRON_INGOT), new ItemStack(Material.BLACK_DYE),
+ new ItemStack(Material.IRON_INGOT)}
+ : new ItemStack[]{new ItemStack(Material.IRON_INGOT), new ItemStack(Material.IRON_INGOT),
+ new ItemStack(Material.IRON_INGOT), new ItemStack(Material.IRON_INGOT),
+ ClayTechItems.MAGIC_CLAY, new ItemStack(Material.IRON_INGOT),
+ new ItemStack(Material.IRON_INGOT), new ItemStack(Material.COAL),
+ new ItemStack(Material.IRON_INGOT)};
+ ItemStack[] LanternRecipe = {new ItemStack(Material.OAK_LOG), new ItemStack(Material.OAK_LOG),
+ new ItemStack(Material.OAK_LOG), new ItemStack(Material.OAK_LOG), new ItemStack(Material.GLOWSTONE),
+ new ItemStack(Material.OAK_LOG), new ItemStack(Material.OAK_LOG), ClayTechItems.MAGIC_CLAY,
+ new ItemStack(Material.OAK_LOG)};
- // 注册物品
- Slimefunutils.registerItem(ClayTechItems.C_DECORATES, "CLAYCOFFEE_HEAD", ClayTechItems.CLAYCOFFEE_HEAD,
- "notresearch", 10, RecipeType.ANCIENT_ALTAR, ClayCoffeeHeadRecipe, false);
- Slimefunutils.registerItem(ClayTechItems.C_DECORATES, "STALIN_HEAD", ClayTechItems.STALIN_HEAD, "notresearch",
- 10, RecipeType.ANCIENT_ALTAR, OtherHeadRecipe, false);
- Slimefunutils.registerItem(ClayTechItems.C_DECORATES, "MARX_HEAD", ClayTechItems.MARX_HEAD, "notresearch", 10,
- RecipeType.ANCIENT_ALTAR, OtherHeadRecipe2, false);
- Slimefunutils.registerItem(ClayTechItems.C_DECORATES, "CLOCK_C", ClayTechItems.CLOCK_C, "notresearch", 10,
- RecipeType.ENHANCED_CRAFTING_TABLE, ClockRecipe, false);
- Slimefunutils.registerItem(ClayTechItems.C_DECORATES, "LANTERN_C", ClayTechItems.LANTERN_C, "notresearch", 10,
- RecipeType.ENHANCED_CRAFTING_TABLE, LanternRecipe, false);
+ // 注册物品
+ Slimefunutils.registerItem(ClayTechItems.C_DECORATES, "CLAYCOFFEE_HEAD", ClayTechItems.CLAYCOFFEE_HEAD,
+ "notresearch", 10, RecipeType.ANCIENT_ALTAR, ClayCoffeeHeadRecipe, false);
+ Slimefunutils.registerItem(ClayTechItems.C_DECORATES, "STALIN_HEAD", ClayTechItems.STALIN_HEAD, "notresearch",
+ 10, RecipeType.ANCIENT_ALTAR, OtherHeadRecipe, false);
+ Slimefunutils.registerItem(ClayTechItems.C_DECORATES, "MARX_HEAD", ClayTechItems.MARX_HEAD, "notresearch", 10,
+ RecipeType.ANCIENT_ALTAR, OtherHeadRecipe2, false);
+ Slimefunutils.registerItem(ClayTechItems.C_DECORATES, "CLOCK_C", ClayTechItems.CLOCK_C, "notresearch", 10,
+ RecipeType.ENHANCED_CRAFTING_TABLE, ClockRecipe, false);
+ Slimefunutils.registerItem(ClayTechItems.C_DECORATES, "LANTERN_C", ClayTechItems.LANTERN_C, "notresearch", 10,
+ RecipeType.ENHANCED_CRAFTING_TABLE, LanternRecipe, false);
- // 注册研究
- Research skull_basic = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_SKULL_BASIC"), 9907,
- Lang.readResearchesText("CLAYTECH_SKULL_I"), 50);
- skull_basic.addItems(SlimefunItem.getByItem(ClayTechItems.CLAYCOFFEE_HEAD),
- SlimefunItem.getByItem(ClayTechItems.STALIN_HEAD), SlimefunItem.getByItem(ClayTechItems.MARX_HEAD));
- skull_basic.register();
+ // 注册研究
+ Research skull_basic = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_SKULL_BASIC"), 9907,
+ Lang.readResearchesText("CLAYTECH_SKULL_I"), 50);
+ skull_basic.addItems(SlimefunItem.getByItem(ClayTechItems.CLAYCOFFEE_HEAD),
+ SlimefunItem.getByItem(ClayTechItems.STALIN_HEAD), SlimefunItem.getByItem(ClayTechItems.MARX_HEAD));
+ skull_basic.register();
- Research skull_basic2 = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_SKULL_BASIC"), 9914,
- Lang.readResearchesText("CLAYTECH_DECORATES_I"), 50);
- skull_basic2.addItems(SlimefunItem.getByItem(ClayTechItems.CLOCK_C),
- SlimefunItem.getByItem(ClayTechItems.LANTERN_C));
- skull_basic2.register();
- }
+ Research skull_basic2 = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_SKULL_BASIC"), 9914,
+ Lang.readResearchesText("CLAYTECH_DECORATES_I"), 50);
+ skull_basic2.addItems(SlimefunItem.getByItem(ClayTechItems.CLOCK_C),
+ SlimefunItem.getByItem(ClayTechItems.LANTERN_C));
+ skull_basic2.register();
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/items/Tools.java b/src/main/java/club/claycoffee/ClayTech/implementation/items/Tools.java
index 2dbf75e..5e1004e 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/items/Tools.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/items/Tools.java
@@ -1,7 +1,5 @@
package club.claycoffee.ClayTech.implementation.items;
-import org.bukkit.NamespacedKey;
-
import club.claycoffee.ClayTech.ClayTech;
import club.claycoffee.ClayTech.ClayTechItems;
import club.claycoffee.ClayTech.ClayTechMachineRecipes;
@@ -10,20 +8,21 @@
import club.claycoffee.ClayTech.utils.Slimefunutils;
import io.github.thebusybiscuit.slimefun4.core.researching.Research;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
+import org.bukkit.NamespacedKey;
public class Tools {
- public Tools() {
- Slimefunutils.registerItem(ClayTechItems.C_TOOLS, "REINFORCED_ALLOY_PICKAXE",
- ClayTechItems.REINFORCED_ALLOY_PICKAXE, "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE,
- ClayTechMachineRecipes.REINFORCED_ALLOY_PICKAXE, false);
- Slimefunutils.registerItem(ClayTechItems.C_TOOLS, "CLAY_ALLOY_PICKAXE", ClayTechItems.CLAY_ALLOY_PICKAXE,
- "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.CLAY_ALLOY_PICKAXE,
- false);
+ public Tools() {
+ Slimefunutils.registerItem(ClayTechItems.C_TOOLS, "REINFORCED_ALLOY_PICKAXE",
+ ClayTechItems.REINFORCED_ALLOY_PICKAXE, "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE,
+ ClayTechMachineRecipes.REINFORCED_ALLOY_PICKAXE, false);
+ Slimefunutils.registerItem(ClayTechItems.C_TOOLS, "CLAY_ALLOY_PICKAXE", ClayTechItems.CLAY_ALLOY_PICKAXE,
+ "notresearch", 10, ClayTechRecipeType.CLAY_CRAFTING_TABLE, ClayTechMachineRecipes.CLAY_ALLOY_PICKAXE,
+ false);
- Research rs = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_TOOLS_1"), 9922,
- Lang.readResearchesText("CLAYTECH_TOOLS_I"), 35);
- rs.addItems(SlimefunItem.getByItem(ClayTechItems.REINFORCED_ALLOY_PICKAXE),
- SlimefunItem.getByItem(ClayTechItems.CLAY_ALLOY_PICKAXE));
- rs.register();
- }
+ Research rs = new Research(new NamespacedKey(ClayTech.getInstance(), "CLAYTECH_TOOLS_1"), 9922,
+ Lang.readResearchesText("CLAYTECH_TOOLS_I"), 35);
+ rs.addItems(SlimefunItem.getByItem(ClayTechItems.REINFORCED_ALLOY_PICKAXE),
+ SlimefunItem.getByItem(ClayTechItems.CLAY_ALLOY_PICKAXE));
+ rs.register();
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/machines/CobbleStoneGenerator.java b/src/main/java/club/claycoffee/ClayTech/implementation/machines/CobbleStoneGenerator.java
index 15c0d64..4055e4b 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/machines/CobbleStoneGenerator.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/machines/CobbleStoneGenerator.java
@@ -1,24 +1,13 @@
package club.claycoffee.ClayTech.implementation.machines;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.bukkit.Material;
-import org.bukkit.block.Block;
-import org.bukkit.entity.Player;
-import org.bukkit.event.inventory.InventoryClickEvent;
-import org.bukkit.inventory.ItemStack;
-
import club.claycoffee.ClayTech.utils.Lang;
import club.claycoffee.ClayTech.utils.Utils;
import io.github.thebusybiscuit.slimefun4.core.attributes.EnergyNetComponent;
import io.github.thebusybiscuit.slimefun4.core.networks.energy.EnergyNetComponentType;
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
-import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler;
+import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
@@ -30,184 +19,192 @@
import me.mrCookieSlime.Slimefun.api.energy.ChargableBlock;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset;
+import org.bukkit.Material;
+import org.bukkit.block.Block;
+import org.bukkit.entity.Player;
+import org.bukkit.event.inventory.InventoryClickEvent;
+import org.bukkit.inventory.ItemStack;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
public class CobbleStoneGenerator extends SlimefunItem implements InventoryBlock, EnergyNetComponent {
- public static Map processing = new HashMap<>();
- public static Map progress = new HashMap<>();
- public final static int[] inputslots = new int[] {};
- public final static int[] outputslots = new int[] { 22 };
-
- protected final List recipes = new ArrayList<>();
-
- private static final int[] BORDER_A = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 17, 18, 26, 27, 35, 36, 37, 38, 39, 40, 41,
- 42, 43, 44, 12, 14, 21, 23, 30, 31, 32 };
- private static final int[] BORDER_B = { 10, 11, 15, 16, 19, 20, 24, 25, 28, 29, 33, 34 };
- private static final ItemStack BORDER_A_ITEM = Utils.newItemD(Material.LIGHT_BLUE_STAINED_GLASS_PANE,
- Lang.readMachinesText("SPLIT_LINE"));
- private static final ItemStack BORDER_B_ITEM = Utils.newItemD(Material.LIME_STAINED_GLASS_PANE,
- Lang.readMachinesText("SPLIT_LINE"));
-
- public CobbleStoneGenerator(Category category, SlimefunItemStack item, String id, RecipeType recipeType,
- ItemStack[] recipe) {
- super(category, item, id, recipeType, recipe);
-
- createPreset(this, getInventoryTitle(), this::SetupMenu);
-
- registerBlockHandler(id, (p, b, tool, reason) -> {
- BlockMenu inv = BlockStorage.getInventory(b);
- if (inv != null) {
- for (int slot : getInputSlots()) {
- if (inv.getItemInSlot(slot) != null) {
- if (inv.getItemInSlot(slot).getType() != Material.BEDROCK) {
- b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
- inv.replaceExistingItem(slot, null);
- }
- }
- }
-
- for (int slot : getOutputSlots()) {
- if (inv.getItemInSlot(slot) != null) {
- b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
- inv.replaceExistingItem(slot, null);
- }
- }
- }
-
- progress.remove(b);
- processing.remove(b);
- return true;
- });
- }
-
- private String getInventoryTitle() {
- return Lang.readMachinesText("CLAY_COBBLESTONE_GENERATOR");
- }
-
- @Override
- public int getCapacity() {
- return 256;
- }
-
- @Override
- public EnergyNetComponentType getEnergyComponentType() {
- return EnergyNetComponentType.CONSUMER;
- }
-
- @Override
- public int[] getOutputSlots() {
- return new int[] { 22 };
- }
-
- public void SetupMenu(BlockMenuPreset Preset) {
- for (int eachID : BORDER_A) {
- Preset.addItem(eachID, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
- }
- for (int eachID : BORDER_B) {
- Preset.addItem(eachID, BORDER_B_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
- }
- Preset.addItem(13, Utils.addLore(Utils.newItem(Material.BLACK_STAINED_GLASS_PANE), " "),
- ChestMenuUtils.getEmptyClickHandler());
- for (int i : getOutputSlots()) {
- Preset.addMenuClickHandler(i, new AdvancedMenuClickHandler() {
-
- @Override
- public boolean onClick(Player p, int slot, ItemStack cursor, ClickAction action) {
- return false;
- }
-
- @Override
- public boolean onClick(InventoryClickEvent e, Player p, int slot, ItemStack cursor,
- ClickAction action) {
- return cursor == null || cursor.getType() == null || cursor.getType() == Material.AIR;
- }
- });
- }
- }
-
- @Override
- public int[] getInputSlots() {
- return new int[] {};
- }
-
- @Override
- public void preRegister() {
- addItemHandler(new BlockTicker() {
- @Override
- public void tick(Block b, SlimefunItem sf, Config data) {
- CobbleStoneGenerator.this.tick(b);
- }
-
- @Override
- public boolean isSynchronized() {
- return false;
- }
- });
- }
-
- protected void tick(Block b) {
- BlockMenu inv = BlockStorage.getInventory(b);
- // 机器正在处理
- if (isProcessing(b)) {
- // 剩余时间
- int timeleft = progress.get(b);
-
- if (timeleft > 0) {
- // 还在处理
- ChestMenuUtils.updateProgressbar(inv, 13, timeleft, processing.get(b).getTicks(), getProgressBar());
-
- if (ChargableBlock.isChargable(b)) {
- if (ChargableBlock.getCharge(b) < getEnergyConsumption())
- return;
- ChargableBlock.addCharge(b, -getEnergyConsumption());
- progress.put(b, timeleft - 1);
- } else
- progress.put(b, timeleft - 1);
- } else {
- // 处理结束
- inv.replaceExistingItem(13, Utils.addLore(Utils.newItem(Material.BLACK_STAINED_GLASS_PANE), " "));
-
- for (ItemStack output : processing.get(b).getOutput()) {
- if (output != null)
- inv.pushItem(output.clone(), getOutputSlots());
- }
-
- progress.remove(b);
- processing.remove(b);
- }
- } else {
- // 没有在处理
- MachineRecipe r = new MachineRecipe(1, new ItemStack[] {},
- new ItemStack[] { new ItemStack(Material.COBBLESTONE) });
- if (ChargableBlock.isChargable(b)) {
- if (ChargableBlock.getCharge(b) < getEnergyConsumption())
- return;
- ChargableBlock.addCharge(b, -getEnergyConsumption());
- }
- if (inv.getItemInSlot(outputslots[0]) != null) {
- ItemStack is = inv.getItemInSlot(outputslots[0]);
- if (is.getMaxStackSize() == is.getAmount())
- return;
- }
-
- processing.put(b, r);
- progress.put(b, r.getTicks());
- }
- }
-
- private ItemStack getProgressBar() {
- return new ItemStack(Material.MOSSY_COBBLESTONE);
- }
-
- public int getEnergyConsumption() {
- return 50;
- }
-
- public MachineRecipe getProcessing(Block b) {
- return processing.get(b);
- }
-
- public boolean isProcessing(Block b) {
- return getProcessing(b) != null;
- }
+ public final static int[] inputslots = new int[]{};
+ public final static int[] outputslots = new int[]{22};
+ private static final int[] BORDER_A = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 17, 18, 26, 27, 35, 36, 37, 38, 39, 40, 41,
+ 42, 43, 44, 12, 14, 21, 23, 30, 31, 32};
+ private static final int[] BORDER_B = {10, 11, 15, 16, 19, 20, 24, 25, 28, 29, 33, 34};
+ private static final ItemStack BORDER_A_ITEM = Utils.newItemD(Material.LIGHT_BLUE_STAINED_GLASS_PANE,
+ Lang.readMachinesText("SPLIT_LINE"));
+ private static final ItemStack BORDER_B_ITEM = Utils.newItemD(Material.LIME_STAINED_GLASS_PANE,
+ Lang.readMachinesText("SPLIT_LINE"));
+ public static Map processing = new HashMap<>();
+ public static Map progress = new HashMap<>();
+ protected final List recipes = new ArrayList<>();
+
+ public CobbleStoneGenerator(Category category, SlimefunItemStack item, String id, RecipeType recipeType,
+ ItemStack[] recipe) {
+ super(category, item, id, recipeType, recipe);
+
+ createPreset(this, getInventoryTitle(), this::SetupMenu);
+
+ registerBlockHandler(id, (p, b, tool, reason) -> {
+ BlockMenu inv = BlockStorage.getInventory(b);
+ if (inv != null) {
+ for (int slot : getInputSlots()) {
+ if (inv.getItemInSlot(slot) != null) {
+ if (inv.getItemInSlot(slot).getType() != Material.BEDROCK) {
+ b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
+ inv.replaceExistingItem(slot, null);
+ }
+ }
+ }
+
+ for (int slot : getOutputSlots()) {
+ if (inv.getItemInSlot(slot) != null) {
+ b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
+ inv.replaceExistingItem(slot, null);
+ }
+ }
+ }
+
+ progress.remove(b);
+ processing.remove(b);
+ return true;
+ });
+ }
+
+ private String getInventoryTitle() {
+ return Lang.readMachinesText("CLAY_COBBLESTONE_GENERATOR");
+ }
+
+ @Override
+ public int getCapacity() {
+ return 256;
+ }
+
+ @Override
+ public EnergyNetComponentType getEnergyComponentType() {
+ return EnergyNetComponentType.CONSUMER;
+ }
+
+ @Override
+ public int[] getOutputSlots() {
+ return new int[]{22};
+ }
+
+ public void SetupMenu(BlockMenuPreset Preset) {
+ for (int eachID : BORDER_A) {
+ Preset.addItem(eachID, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
+ }
+ for (int eachID : BORDER_B) {
+ Preset.addItem(eachID, BORDER_B_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
+ }
+ Preset.addItem(13, Utils.addLore(Utils.newItem(Material.BLACK_STAINED_GLASS_PANE), " "),
+ ChestMenuUtils.getEmptyClickHandler());
+ for (int i : getOutputSlots()) {
+ Preset.addMenuClickHandler(i, new AdvancedMenuClickHandler() {
+
+ @Override
+ public boolean onClick(Player p, int slot, ItemStack cursor, ClickAction action) {
+ return false;
+ }
+
+ @Override
+ public boolean onClick(InventoryClickEvent e, Player p, int slot, ItemStack cursor,
+ ClickAction action) {
+ return cursor == null || cursor.getType() == null || cursor.getType() == Material.AIR;
+ }
+ });
+ }
+ }
+
+ @Override
+ public int[] getInputSlots() {
+ return new int[]{};
+ }
+
+ @Override
+ public void preRegister() {
+ addItemHandler(new BlockTicker() {
+ @Override
+ public void tick(Block b, SlimefunItem sf, Config data) {
+ CobbleStoneGenerator.this.tick(b);
+ }
+
+ @Override
+ public boolean isSynchronized() {
+ return false;
+ }
+ });
+ }
+
+ protected void tick(Block b) {
+ BlockMenu inv = BlockStorage.getInventory(b);
+ // 机器正在处理
+ if (isProcessing(b)) {
+ // 剩余时间
+ int timeleft = progress.get(b);
+
+ if (timeleft > 0) {
+ // 还在处理
+ ChestMenuUtils.updateProgressbar(inv, 13, timeleft, processing.get(b).getTicks(), getProgressBar());
+
+ if (ChargableBlock.isChargable(b)) {
+ if (ChargableBlock.getCharge(b) < getEnergyConsumption())
+ return;
+ ChargableBlock.addCharge(b, -getEnergyConsumption());
+ progress.put(b, timeleft - 1);
+ } else
+ progress.put(b, timeleft - 1);
+ } else {
+ // 处理结束
+ inv.replaceExistingItem(13, Utils.addLore(Utils.newItem(Material.BLACK_STAINED_GLASS_PANE), " "));
+
+ for (ItemStack output : processing.get(b).getOutput()) {
+ if (output != null)
+ inv.pushItem(output.clone(), getOutputSlots());
+ }
+
+ progress.remove(b);
+ processing.remove(b);
+ }
+ } else {
+ // 没有在处理
+ MachineRecipe r = new MachineRecipe(1, new ItemStack[]{},
+ new ItemStack[]{new ItemStack(Material.COBBLESTONE)});
+ if (ChargableBlock.isChargable(b)) {
+ if (ChargableBlock.getCharge(b) < getEnergyConsumption())
+ return;
+ ChargableBlock.addCharge(b, -getEnergyConsumption());
+ }
+ if (inv.getItemInSlot(outputslots[0]) != null) {
+ ItemStack is = inv.getItemInSlot(outputslots[0]);
+ if (is.getMaxStackSize() == is.getAmount())
+ return;
+ }
+
+ processing.put(b, r);
+ progress.put(b, r.getTicks());
+ }
+ }
+
+ private ItemStack getProgressBar() {
+ return new ItemStack(Material.MOSSY_COBBLESTONE);
+ }
+
+ public int getEnergyConsumption() {
+ return 50;
+ }
+
+ public MachineRecipe getProcessing(Block b) {
+ return processing.get(b);
+ }
+
+ public boolean isProcessing(Block b) {
+ return getProcessing(b) != null;
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/machines/CraftingTable.java b/src/main/java/club/claycoffee/ClayTech/implementation/machines/CraftingTable.java
index 2e3b0bf..d303382 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/machines/CraftingTable.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/machines/CraftingTable.java
@@ -1,14 +1,5 @@
package club.claycoffee.ClayTech.implementation.machines;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.bukkit.Bukkit;
-import org.bukkit.Material;
-import org.bukkit.block.Block;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.scheduler.BukkitRunnable;
-
import club.claycoffee.ClayTech.ClayTech;
import club.claycoffee.ClayTech.ClayTechItems;
import club.claycoffee.ClayTech.ClayTechMachineRecipes;
@@ -16,241 +7,249 @@
import club.claycoffee.ClayTech.implementation.abstractMachines.ACraftingTable;
import club.claycoffee.ClayTech.utils.Lang;
import club.claycoffee.ClayTech.utils.Utils;
+import io.github.thebusybiscuit.slimefun4.core.categories.LockedCategory;
+import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
-import io.github.thebusybiscuit.slimefun4.core.categories.LockedCategory;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecipe;
import me.mrCookieSlime.Slimefun.api.BlockStorage;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
import me.mrCookieSlime.Slimefun.api.energy.ChargableBlock;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
+import org.bukkit.Bukkit;
+import org.bukkit.Material;
+import org.bukkit.block.Block;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.scheduler.BukkitRunnable;
-public class CraftingTable extends ACraftingTable {
- private ItemStack[] inputItem;
- private ItemStack outputItem;
-
- public CraftingTable(LockedCategory category, SlimefunItemStack item, String id, RecipeType recipeType,
- ItemStack[] recipe) {
- super(category, item, id, recipeType, recipe);
- }
-
- @Override
- public String getInventoryTitle() {
- return Lang.readMachinesText("CLAY_FUSION_MACHINE");
- }
-
- @Override
- public ItemStack getProgressBar() {
- return new ItemStack(Material.CRAFTING_TABLE);
- }
-
- @Override
- public int getEnergyConsumption() {
- return 16;
- }
-
- @Override
- public int getSpeed() {
- return 1;
- }
-
- @Override
- public String getMachineIdentifier() {
- return "CLAY_CRAFTING_TABLE";
- }
-
- @Override
- public int getCapacity() {
- return 128;
- }
-
- @Override
- public void registerDefaultRecipes() {
- this.registerRecipe(20, ClayTechMachineRecipes.BLIND_CORE, new ItemStack[] { ClayTechItems.BLIND_CORE });
- this.registerRecipe(100, ClayTechMachineRecipes.BLIND_SWORD, new ItemStack[] { ClayTechItems.BLIND_SWORD });
- this.registerRecipe(20, ClayTechMachineRecipes.POISON_EYE, new ItemStack[] { ClayTechItems.POISON_EYE });
-
- this.registerRecipe(20, ClayTechMachineRecipes.POISON_CORE, new ItemStack[] { ClayTechItems.POISON_CORE });
-
- this.registerRecipe(40, ClayTechMachineRecipes.ADVANCED_POISON_CORE,
- new ItemStack[] { ClayTechItems.ADVANCED_POISON_CORE });
- this.registerRecipe(20, ClayTechMachineRecipes.CONFUSION_CORE,
- new ItemStack[] { ClayTechItems.CONFUSION_CORE });
- this.registerRecipe(40, ClayTechMachineRecipes.ADVANCED_CONFUSION_CORE,
- new ItemStack[] { ClayTechItems.ADVANCED_CONFUSION_CORE });
- this.registerRecipe(20, ClayTechMachineRecipes.BLACK_ROCK_BLOCK,
- new ItemStack[] { ClayTechItems.BLACK_ROCK_BLOCK });
- this.registerRecipe(20, ClayTechMachineRecipes.SLOWNESS_CORE, new ItemStack[] { ClayTechItems.SLOWNESS_CORE });
- this.registerRecipe(40, ClayTechMachineRecipes.ADVANCED_SLOWNESS_CORE,
- new ItemStack[] { ClayTechItems.ADVANCED_SLOWNESS_CORE });
- this.registerRecipe(40, ClayTechMachineRecipes.ADVANCED_BLIND_CORE,
- new ItemStack[] { ClayTechItems.ADVANCED_BLIND_CORE });
- this.registerRecipe(400, ClayTechMachineRecipes.FOUR_BOW, new ItemStack[] { ClayTechItems.FOUR_BOW });
- this.registerRecipe(100, ClayTechMachineRecipes.POISON_SWORD, new ItemStack[] { ClayTechItems.POISON_SWORD });
- this.registerRecipe(100, ClayTechMachineRecipes.ANTI_SLOWNESS_BOOTS,
- new ItemStack[] { ClayTechItems.ANTI_SLOWNESS_BOOTS });
- this.registerRecipe(80, ClayTechMachineRecipes.BLISTERING_CORE,
- new ItemStack[] { ClayTechItems.BLISTERING_CORE });
- this.registerRecipe(30, ClayTechMachineRecipes.ELEMENT_UNIT, new ItemStack[] { ClayTechItems.ELEMENT_UNIT });
- this.registerRecipe(8, ClayTechMachineRecipes.HIGHSPEED_RAILWAY,
- new ItemStack[] { ClayTechItems.HIGHSPEED_RAILWAY });
- ItemStack elem8 = ClayTechItems.ELECTRIC_MOTOR_8;
- elem8.setAmount(8);
- this.registerRecipe(8, ClayTechMachineRecipes.ELECTRIC_MOTOR_8, new ItemStack[] { elem8 });
-
- this.registerRecipe(50, ClayTechMachineRecipes.TNT_EXPLOSION_CREATER,
- new ItemStack[] { ClayTechItems.TNT_EXPLOSION_CREATER });
- this.registerRecipe(180, ClayTechMachineRecipes.REINFORCED_ALLOY_PICKAXE,
- new ItemStack[] { ClayTechItems.REINFORCED_ALLOY_PICKAXE });
- this.registerRecipe(40, ClayTechMachineRecipes.CLAY_FUSION_INGOT,
- new ItemStack[] { ClayTechItems.CLAY_FUSION_INGOT });
- this.registerRecipe(50, ClayTechMachineRecipes.CLAY_ALLOY_INGOT,
- new ItemStack[] { ClayTechItems.CLAY_ALLOY_INGOT });
- this.registerRecipe(300, ClayTechMachineRecipes.CLAY_ALLOY_PICKAXE,
- new ItemStack[] { ClayTechItems.CLAY_ALLOY_PICKAXE });
- this.registerRecipe(300, ClayTechMachineRecipes.CLAY_ALLOY_HELMET,
- new ItemStack[] { ClayTechItems.CLAY_ALLOY_HELMET });
- this.registerRecipe(300, ClayTechMachineRecipes.CLAY_ALLOY_CHESTPLATE,
- new ItemStack[] { ClayTechItems.CLAY_ALLOY_CHESTPLATE });
- this.registerRecipe(300, ClayTechMachineRecipes.CLAY_ALLOY_LEGGINGS,
- new ItemStack[] { ClayTechItems.CLAY_ALLOY_LEGGINGS });
- this.registerRecipe(300, ClayTechMachineRecipes.CLAY_ALLOY_BOOTS,
- new ItemStack[] { ClayTechItems.CLAY_ALLOY_BOOTS });
-
- this.registerRecipe(30, ClayTechMachineRecipes.MOTOR_CORE, new ItemStack[] { ClayTechItems.MOTOR_CORE });
- this.registerRecipe(60, ClayTechMachineRecipes.TEMPERATURE_RESISTANCE_OBSIDIAN,
- new ItemStack[] { ClayTechItems.TEMPERATURE_RESISTANCE_OBSIDIAN });
- this.registerRecipe(120, ClayTechMachineRecipes.ROCKET_ENGINE_SHELL,
- new ItemStack[] { ClayTechItems.ROCKET_ENGINE_SHELL });
- this.registerRecipe(45, ClayTechMachineRecipes.FUEL_TANK, new ItemStack[] { ClayTechItems.FUEL_TANK });
- this.registerRecipe(180, ClayTechMachineRecipes.ROCKET_ENGINE, new ItemStack[] { ClayTechItems.ROCKET_ENGINE });
- this.registerRecipe(120, ClayTechMachineRecipes.ROCKET_ANTENNA,
- new ItemStack[] { ClayTechItems.ROCKET_ANTENNA });
- this.registerRecipe(300, ClayTechMachineRecipes.ROCKET_CPU, new ItemStack[] { ClayTechItems.ROCKET_CPU });
- this.registerRecipe(400, ClayTechMachineRecipes.ROCKET_CONTROL_CORE,
- new ItemStack[] { ClayTechItems.ROCKET_CONTROL_CORE });
- this.registerRecipe(200, ClayTechMachineRecipes.ROCKET_FUEL_TANK,
- new ItemStack[] { ClayTechItems.ROCKET_FUEL_TANK });
- this.registerRecipe(45, ClayTechMachineRecipes.ROCKET_GLASS, new ItemStack[] { ClayTechItems.ROCKET_GLASS });
- this.registerRecipe(60, ClayTechMachineRecipes.ROCKET_STEEL_PLATE,
- new ItemStack[] { ClayTechItems.ROCKET_STEEL_PLATE });
-
- this.registerRecipe(50, ClayTechMachineRecipes.OXYGEN_TANK, new ItemStack[] { ClayTechItems.OXYGEN_TANK });
- this.registerRecipe(100, ClayTechMachineRecipes.SPACESUIT_OXYGEN_TANK,
- new ItemStack[] { ClayTechItems.SPACESUIT_OXYGEN_TANK });
- this.registerRecipe(300, ClayTechMachineRecipes.SPACESUIT_HELMET,
- new ItemStack[] { ClayTechItems.SPACESUIT_HELMET });
- this.registerRecipe(300, ClayTechMachineRecipes.SPACESUIT_CHESTPLATE,
- new ItemStack[] { ClayTechItems.SPACESUIT_CHESTPLATE });
- this.registerRecipe(300, ClayTechMachineRecipes.SPACESUIT_LEGGINGS,
- new ItemStack[] { ClayTechItems.SPACESUIT_LEGGINGS });
- this.registerRecipe(300, ClayTechMachineRecipes.SPACESUIT_BOOTS,
- new ItemStack[] { ClayTechItems.SPACESUIT_BOOTS });
-
- this.registerRecipe(60, ClayTechMachineRecipes.PLANET_BASE_SIGNER,
- new ItemStack[] { ClayTechItems.PLANET_BASE_SIGNER });
- this.registerRecipe(20, ClayTechMachineRecipes.TUBE, new ItemStack[] { ClayTechItems.TUBE });
- this.registerRecipe(60, ClayTechMachineRecipes.OXYGEN_DISTRIBUTER,
- new ItemStack[] { ClayTechItems.OXYGEN_DISTRIBUTER });
-
- this.registerRecipe(2, ClayTechMachineRecipes.COPPER_DUST_O, new ItemStack[] { SlimefunItems.COPPER_DUST });
- this.registerRecipe(2, ClayTechMachineRecipes.CLAY_FUSION_INGOT_O,
- new ItemStack[] { ClayTechItems.CLAY_FUSION_INGOT });
- }
-
- @Override
- protected void tick(Block b) {
- BlockMenu inv = BlockStorage.getInventory(b);
- // 机器正在处理
- if (isProcessing(b)) {
- // 剩余时间
- int timeleft = progress.get(b);
-
- if (timeleft > 0) {
- // 还在处理
- ChestMenuUtils.updateProgressbar(inv, 4, timeleft, processing.get(b).getTicks(), getProgressBar());
-
- if (ChargableBlock.isChargable(b)) {
- if (ChargableBlock.getCharge(b) < getEnergyConsumption())
- return;
- ChargableBlock.addCharge(b, -getEnergyConsumption());
- progress.put(b, timeleft - 1);
- } else
- progress.put(b, timeleft - 1);
- } else {
- // 处理结束
- inv.replaceExistingItem(4, Utils.addLore(Utils.newItem(Material.BLACK_STAINED_GLASS_PANE), " "));
-
- new BukkitRunnable() {
-
- @Override
- public void run() {
- Bukkit.getPluginManager().callEvent(new PlayerCraftItemEvent(b, inputItem, outputItem));
-
- }
-
- }.runTask(ClayTech.getInstance());
-
- for (ItemStack output : processing.get(b).getOutput()) {
- if (output != null)
- inv.pushItem(output.clone(), getOutputSlots());
- }
-
- progress.remove(b);
- processing.remove(b);
- }
- } else {
- // 没有在处理
- MachineRecipe r = null;
- Map found = new HashMap<>();
- int i;
- for (MachineRecipe recipe : recipes) {
- i = 0;
- for (ItemStack input : recipe.getInput()) {
- if (SlimefunUtils.isItemSimilar(inv.getItemInSlot(inputslots[i]), input, true)) {
- // 如果该位置的物品符合某合成配方的对应位置物品
- if (input != null) {
- found.put(inputslots[i], input.getAmount());
- }
- }
- if (inv.getItemInSlot(inputslots[i]) == input && input == null) {
- found.put(i, 0);
- }
- if (i < 8) {
- i++;
- } else
- i = 0;
- }
- if (found.size() == recipe.getInput().length) {
- r = recipe;
- break;
- } else
- found.clear();
- }
+import java.util.HashMap;
+import java.util.Map;
- if (r != null) {
- if (ChargableBlock.isChargable(b)) {
- if (ChargableBlock.getCharge(b) < getEnergyConsumption())
- return;
- ChargableBlock.addCharge(b, -getEnergyConsumption());
- }
- if (inv.getItemInSlot(outputslots[0]) != null) {
- ItemStack is = inv.getItemInSlot(outputslots[0]);
- if (is.getMaxStackSize() == is.getAmount())
- return;
- }
- for (Map.Entry entry : found.entrySet()) {
- if (entry.getValue() > 0)
- inv.consumeItem(entry.getKey(), entry.getValue());
- }
- inputItem = r.getInput();
- outputItem = r.getOutput()[0];
- processing.put(b, r);
- progress.put(b, r.getTicks());
- }
- }
- }
+public class CraftingTable extends ACraftingTable {
+ private ItemStack[] inputItem;
+ private ItemStack outputItem;
+
+ public CraftingTable(LockedCategory category, SlimefunItemStack item, String id, RecipeType recipeType,
+ ItemStack[] recipe) {
+ super(category, item, id, recipeType, recipe);
+ }
+
+ @Override
+ public String getInventoryTitle() {
+ return Lang.readMachinesText("CLAY_FUSION_MACHINE");
+ }
+
+ @Override
+ public ItemStack getProgressBar() {
+ return new ItemStack(Material.CRAFTING_TABLE);
+ }
+
+ @Override
+ public int getEnergyConsumption() {
+ return 16;
+ }
+
+ @Override
+ public int getSpeed() {
+ return 1;
+ }
+
+ @Override
+ public String getMachineIdentifier() {
+ return "CLAY_CRAFTING_TABLE";
+ }
+
+ @Override
+ public int getCapacity() {
+ return 128;
+ }
+
+ @Override
+ public void registerDefaultRecipes() {
+ this.registerRecipe(20, ClayTechMachineRecipes.BLIND_CORE, new ItemStack[]{ClayTechItems.BLIND_CORE});
+ this.registerRecipe(100, ClayTechMachineRecipes.BLIND_SWORD, new ItemStack[]{ClayTechItems.BLIND_SWORD});
+ this.registerRecipe(20, ClayTechMachineRecipes.POISON_EYE, new ItemStack[]{ClayTechItems.POISON_EYE});
+
+ this.registerRecipe(20, ClayTechMachineRecipes.POISON_CORE, new ItemStack[]{ClayTechItems.POISON_CORE});
+
+ this.registerRecipe(40, ClayTechMachineRecipes.ADVANCED_POISON_CORE,
+ new ItemStack[]{ClayTechItems.ADVANCED_POISON_CORE});
+ this.registerRecipe(20, ClayTechMachineRecipes.CONFUSION_CORE,
+ new ItemStack[]{ClayTechItems.CONFUSION_CORE});
+ this.registerRecipe(40, ClayTechMachineRecipes.ADVANCED_CONFUSION_CORE,
+ new ItemStack[]{ClayTechItems.ADVANCED_CONFUSION_CORE});
+ this.registerRecipe(20, ClayTechMachineRecipes.BLACK_ROCK_BLOCK,
+ new ItemStack[]{ClayTechItems.BLACK_ROCK_BLOCK});
+ this.registerRecipe(20, ClayTechMachineRecipes.SLOWNESS_CORE, new ItemStack[]{ClayTechItems.SLOWNESS_CORE});
+ this.registerRecipe(40, ClayTechMachineRecipes.ADVANCED_SLOWNESS_CORE,
+ new ItemStack[]{ClayTechItems.ADVANCED_SLOWNESS_CORE});
+ this.registerRecipe(40, ClayTechMachineRecipes.ADVANCED_BLIND_CORE,
+ new ItemStack[]{ClayTechItems.ADVANCED_BLIND_CORE});
+ this.registerRecipe(400, ClayTechMachineRecipes.FOUR_BOW, new ItemStack[]{ClayTechItems.FOUR_BOW});
+ this.registerRecipe(100, ClayTechMachineRecipes.POISON_SWORD, new ItemStack[]{ClayTechItems.POISON_SWORD});
+ this.registerRecipe(100, ClayTechMachineRecipes.ANTI_SLOWNESS_BOOTS,
+ new ItemStack[]{ClayTechItems.ANTI_SLOWNESS_BOOTS});
+ this.registerRecipe(80, ClayTechMachineRecipes.BLISTERING_CORE,
+ new ItemStack[]{ClayTechItems.BLISTERING_CORE});
+ this.registerRecipe(30, ClayTechMachineRecipes.ELEMENT_UNIT, new ItemStack[]{ClayTechItems.ELEMENT_UNIT});
+ this.registerRecipe(8, ClayTechMachineRecipes.HIGHSPEED_RAILWAY,
+ new ItemStack[]{ClayTechItems.HIGHSPEED_RAILWAY});
+ ItemStack elem8 = ClayTechItems.ELECTRIC_MOTOR_8;
+ elem8.setAmount(8);
+ this.registerRecipe(8, ClayTechMachineRecipes.ELECTRIC_MOTOR_8, new ItemStack[]{elem8});
+
+ this.registerRecipe(50, ClayTechMachineRecipes.TNT_EXPLOSION_CREATER,
+ new ItemStack[]{ClayTechItems.TNT_EXPLOSION_CREATER});
+ this.registerRecipe(180, ClayTechMachineRecipes.REINFORCED_ALLOY_PICKAXE,
+ new ItemStack[]{ClayTechItems.REINFORCED_ALLOY_PICKAXE});
+ this.registerRecipe(40, ClayTechMachineRecipes.CLAY_FUSION_INGOT,
+ new ItemStack[]{ClayTechItems.CLAY_FUSION_INGOT});
+ this.registerRecipe(50, ClayTechMachineRecipes.CLAY_ALLOY_INGOT,
+ new ItemStack[]{ClayTechItems.CLAY_ALLOY_INGOT});
+ this.registerRecipe(300, ClayTechMachineRecipes.CLAY_ALLOY_PICKAXE,
+ new ItemStack[]{ClayTechItems.CLAY_ALLOY_PICKAXE});
+ this.registerRecipe(300, ClayTechMachineRecipes.CLAY_ALLOY_HELMET,
+ new ItemStack[]{ClayTechItems.CLAY_ALLOY_HELMET});
+ this.registerRecipe(300, ClayTechMachineRecipes.CLAY_ALLOY_CHESTPLATE,
+ new ItemStack[]{ClayTechItems.CLAY_ALLOY_CHESTPLATE});
+ this.registerRecipe(300, ClayTechMachineRecipes.CLAY_ALLOY_LEGGINGS,
+ new ItemStack[]{ClayTechItems.CLAY_ALLOY_LEGGINGS});
+ this.registerRecipe(300, ClayTechMachineRecipes.CLAY_ALLOY_BOOTS,
+ new ItemStack[]{ClayTechItems.CLAY_ALLOY_BOOTS});
+
+ this.registerRecipe(30, ClayTechMachineRecipes.MOTOR_CORE, new ItemStack[]{ClayTechItems.MOTOR_CORE});
+ this.registerRecipe(60, ClayTechMachineRecipes.TEMPERATURE_RESISTANCE_OBSIDIAN,
+ new ItemStack[]{ClayTechItems.TEMPERATURE_RESISTANCE_OBSIDIAN});
+ this.registerRecipe(120, ClayTechMachineRecipes.ROCKET_ENGINE_SHELL,
+ new ItemStack[]{ClayTechItems.ROCKET_ENGINE_SHELL});
+ this.registerRecipe(45, ClayTechMachineRecipes.FUEL_TANK, new ItemStack[]{ClayTechItems.FUEL_TANK});
+ this.registerRecipe(180, ClayTechMachineRecipes.ROCKET_ENGINE, new ItemStack[]{ClayTechItems.ROCKET_ENGINE});
+ this.registerRecipe(120, ClayTechMachineRecipes.ROCKET_ANTENNA,
+ new ItemStack[]{ClayTechItems.ROCKET_ANTENNA});
+ this.registerRecipe(300, ClayTechMachineRecipes.ROCKET_CPU, new ItemStack[]{ClayTechItems.ROCKET_CPU});
+ this.registerRecipe(400, ClayTechMachineRecipes.ROCKET_CONTROL_CORE,
+ new ItemStack[]{ClayTechItems.ROCKET_CONTROL_CORE});
+ this.registerRecipe(200, ClayTechMachineRecipes.ROCKET_FUEL_TANK,
+ new ItemStack[]{ClayTechItems.ROCKET_FUEL_TANK});
+ this.registerRecipe(45, ClayTechMachineRecipes.ROCKET_GLASS, new ItemStack[]{ClayTechItems.ROCKET_GLASS});
+ this.registerRecipe(60, ClayTechMachineRecipes.ROCKET_STEEL_PLATE,
+ new ItemStack[]{ClayTechItems.ROCKET_STEEL_PLATE});
+
+ this.registerRecipe(50, ClayTechMachineRecipes.OXYGEN_TANK, new ItemStack[]{ClayTechItems.OXYGEN_TANK});
+ this.registerRecipe(100, ClayTechMachineRecipes.SPACESUIT_OXYGEN_TANK,
+ new ItemStack[]{ClayTechItems.SPACESUIT_OXYGEN_TANK});
+ this.registerRecipe(300, ClayTechMachineRecipes.SPACESUIT_HELMET,
+ new ItemStack[]{ClayTechItems.SPACESUIT_HELMET});
+ this.registerRecipe(300, ClayTechMachineRecipes.SPACESUIT_CHESTPLATE,
+ new ItemStack[]{ClayTechItems.SPACESUIT_CHESTPLATE});
+ this.registerRecipe(300, ClayTechMachineRecipes.SPACESUIT_LEGGINGS,
+ new ItemStack[]{ClayTechItems.SPACESUIT_LEGGINGS});
+ this.registerRecipe(300, ClayTechMachineRecipes.SPACESUIT_BOOTS,
+ new ItemStack[]{ClayTechItems.SPACESUIT_BOOTS});
+
+ this.registerRecipe(60, ClayTechMachineRecipes.PLANET_BASE_SIGNER,
+ new ItemStack[]{ClayTechItems.PLANET_BASE_SIGNER});
+ this.registerRecipe(20, ClayTechMachineRecipes.TUBE, new ItemStack[]{ClayTechItems.TUBE});
+ this.registerRecipe(60, ClayTechMachineRecipes.OXYGEN_DISTRIBUTER,
+ new ItemStack[]{ClayTechItems.OXYGEN_DISTRIBUTER});
+
+ this.registerRecipe(2, ClayTechMachineRecipes.COPPER_DUST_O, new ItemStack[]{SlimefunItems.COPPER_DUST});
+ this.registerRecipe(2, ClayTechMachineRecipes.CLAY_FUSION_INGOT_O,
+ new ItemStack[]{ClayTechItems.CLAY_FUSION_INGOT});
+ }
+
+ @Override
+ protected void tick(Block b) {
+ BlockMenu inv = BlockStorage.getInventory(b);
+ // 机器正在处理
+ if (isProcessing(b)) {
+ // 剩余时间
+ int timeleft = progress.get(b);
+
+ if (timeleft > 0) {
+ // 还在处理
+ ChestMenuUtils.updateProgressbar(inv, 4, timeleft, processing.get(b).getTicks(), getProgressBar());
+
+ if (ChargableBlock.isChargable(b)) {
+ if (ChargableBlock.getCharge(b) < getEnergyConsumption())
+ return;
+ ChargableBlock.addCharge(b, -getEnergyConsumption());
+ progress.put(b, timeleft - 1);
+ } else
+ progress.put(b, timeleft - 1);
+ } else {
+ // 处理结束
+ inv.replaceExistingItem(4, Utils.addLore(Utils.newItem(Material.BLACK_STAINED_GLASS_PANE), " "));
+
+ new BukkitRunnable() {
+
+ @Override
+ public void run() {
+ Bukkit.getPluginManager().callEvent(new PlayerCraftItemEvent(b, inputItem, outputItem));
+
+ }
+
+ }.runTask(ClayTech.getInstance());
+
+ for (ItemStack output : processing.get(b).getOutput()) {
+ if (output != null)
+ inv.pushItem(output.clone(), getOutputSlots());
+ }
+
+ progress.remove(b);
+ processing.remove(b);
+ }
+ } else {
+ // 没有在处理
+ MachineRecipe r = null;
+ Map found = new HashMap<>();
+ int i;
+ for (MachineRecipe recipe : recipes) {
+ i = 0;
+ for (ItemStack input : recipe.getInput()) {
+ if (SlimefunUtils.isItemSimilar(inv.getItemInSlot(inputslots[i]), input, true)) {
+ // 如果该位置的物品符合某合成配方的对应位置物品
+ if (input != null) {
+ found.put(inputslots[i], input.getAmount());
+ }
+ }
+ if (inv.getItemInSlot(inputslots[i]) == input && input == null) {
+ found.put(i, 0);
+ }
+ if (i < 8) {
+ i++;
+ } else
+ i = 0;
+ }
+ if (found.size() == recipe.getInput().length) {
+ r = recipe;
+ break;
+ } else
+ found.clear();
+ }
+
+ if (r != null) {
+ if (ChargableBlock.isChargable(b)) {
+ if (ChargableBlock.getCharge(b) < getEnergyConsumption())
+ return;
+ ChargableBlock.addCharge(b, -getEnergyConsumption());
+ }
+ if (inv.getItemInSlot(outputslots[0]) != null) {
+ ItemStack is = inv.getItemInSlot(outputslots[0]);
+ if (is.getMaxStackSize() == is.getAmount())
+ return;
+ }
+ for (Map.Entry entry : found.entrySet()) {
+ if (entry.getValue() > 0)
+ inv.consumeItem(entry.getKey(), entry.getValue());
+ }
+ inputItem = r.getInput();
+ outputItem = r.getOutput()[0];
+ processing.put(b, r);
+ progress.put(b, r.getTicks());
+ }
+ }
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/machines/ElectricStoneCrusher.java b/src/main/java/club/claycoffee/ClayTech/implementation/machines/ElectricStoneCrusher.java
index 9187ba2..35e6d33 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/machines/ElectricStoneCrusher.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/machines/ElectricStoneCrusher.java
@@ -1,54 +1,53 @@
package club.claycoffee.ClayTech.implementation.machines;
-import org.bukkit.Material;
-import org.bukkit.inventory.ItemStack;
-
import club.claycoffee.ClayTech.implementation.abstractMachines.ANewContainer;
import club.claycoffee.ClayTech.utils.Lang;
-import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import io.github.thebusybiscuit.slimefun4.core.categories.LockedCategory;
+import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
+import org.bukkit.Material;
+import org.bukkit.inventory.ItemStack;
public class ElectricStoneCrusher extends ANewContainer {
- public ElectricStoneCrusher(LockedCategory category, SlimefunItemStack item, String id, RecipeType recipeType,
- ItemStack[] recipe) {
- super(category, item, id, recipeType, recipe);
- }
-
- @Override
- public String getInventoryTitle() {
- return Lang.readMachinesText("CLAY_ELECTRIC_STONE_CRUSHER");
- }
-
- @Override
- public ItemStack getProgressBar() {
- return new ItemStack(Material.REDSTONE_TORCH);
- }
-
- @Override
- public int getEnergyConsumption() {
- return 16;
- }
-
- @Override
- public int getSpeed() {
- return 1;
- }
-
- @Override
- public void registerDefaultRecipes() {
- this.registerRecipe(5, new ItemStack[] { new ItemStack(Material.COBBLESTONE) },
- new ItemStack[] { new ItemStack(Material.GRAVEL) });
- }
-
- @Override
- public int getCapacity() {
- return 128;
- }
-
- @Override
- public String getMachineIdentifier() {
- return "CLAY_ELECTRIC_STONE_CRUSHER";
- }
+ public ElectricStoneCrusher(LockedCategory category, SlimefunItemStack item, String id, RecipeType recipeType,
+ ItemStack[] recipe) {
+ super(category, item, id, recipeType, recipe);
+ }
+
+ @Override
+ public String getInventoryTitle() {
+ return Lang.readMachinesText("CLAY_ELECTRIC_STONE_CRUSHER");
+ }
+
+ @Override
+ public ItemStack getProgressBar() {
+ return new ItemStack(Material.REDSTONE_TORCH);
+ }
+
+ @Override
+ public int getEnergyConsumption() {
+ return 16;
+ }
+
+ @Override
+ public int getSpeed() {
+ return 1;
+ }
+
+ @Override
+ public void registerDefaultRecipes() {
+ this.registerRecipe(5, new ItemStack[]{new ItemStack(Material.COBBLESTONE)},
+ new ItemStack[]{new ItemStack(Material.GRAVEL)});
+ }
+
+ @Override
+ public int getCapacity() {
+ return 128;
+ }
+
+ @Override
+ public String getMachineIdentifier() {
+ return "CLAY_ELECTRIC_STONE_CRUSHER";
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/machines/ElectricWaterPump.java b/src/main/java/club/claycoffee/ClayTech/implementation/machines/ElectricWaterPump.java
index 75cc8d2..fd32fd0 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/machines/ElectricWaterPump.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/machines/ElectricWaterPump.java
@@ -1,18 +1,5 @@
package club.claycoffee.ClayTech.implementation.machines;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.bukkit.Material;
-import org.bukkit.block.Block;
-import org.bukkit.block.data.type.Dispenser;
-import org.bukkit.entity.Player;
-import org.bukkit.event.inventory.InventoryClickEvent;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.scheduler.BukkitRunnable;
-
import club.claycoffee.ClayTech.ClayTech;
import club.claycoffee.ClayTech.utils.Lang;
import club.claycoffee.ClayTech.utils.Utils;
@@ -20,8 +7,8 @@
import io.github.thebusybiscuit.slimefun4.core.networks.energy.EnergyNetComponentType;
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
-import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler;
+import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
@@ -33,223 +20,233 @@
import me.mrCookieSlime.Slimefun.api.energy.ChargableBlock;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset;
+import org.bukkit.Material;
+import org.bukkit.block.Block;
+import org.bukkit.block.data.type.Dispenser;
+import org.bukkit.entity.Player;
+import org.bukkit.event.inventory.InventoryClickEvent;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.scheduler.BukkitRunnable;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
public class ElectricWaterPump extends SlimefunItem implements InventoryBlock, EnergyNetComponent {
- public static Map processing = new HashMap<>();
- public static Map progress = new HashMap<>();
- public final static int[] inputslots = new int[] { 20 };
- public final static int[] outputslots = new int[] { 24 };
-
- protected final List recipes = new ArrayList<>();
-
- private static final int[] BORDER_A = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 13, 31, 17, 18, 26, 27, 35, 36, 37, 38, 39,
- 40, 41, 42, 43, 44 };
- private static final int[] BORDER_B = { 10, 11, 12, 19, 21, 28, 29, 30, 14, 15, 16, 23, 25, 32, 33, 34 };
- private static final ItemStack BORDER_A_ITEM = Utils.newItemD(Material.LIGHT_BLUE_STAINED_GLASS_PANE,
- Lang.readMachinesText("SPLIT_LINE"));
- private static final ItemStack BORDER_B_ITEM = Utils.newItemD(Material.LIME_STAINED_GLASS_PANE,
- Lang.readMachinesText("SPLIT_LINE"));
-
- public ElectricWaterPump(Category category, SlimefunItemStack item, String id, RecipeType recipeType,
- ItemStack[] recipe) {
-
- super(category, item, recipeType, recipe);
- createPreset(this, getInventoryTitle(), this::SetupMenu);
-
- registerBlockHandler(id, (p, b, tool, reason) -> {
- BlockMenu inv = BlockStorage.getInventory(b);
- if (inv != null) {
- for (int slot : getInputSlots()) {
- if (inv.getItemInSlot(slot) != null) {
- if (inv.getItemInSlot(slot).getType() != Material.BEDROCK) {
- b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
- inv.replaceExistingItem(slot, null);
- }
- }
- }
-
- for (int slot : getOutputSlots()) {
- if (inv.getItemInSlot(slot) != null) {
- b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
- inv.replaceExistingItem(slot, null);
- }
- }
- }
-
- progress.remove(b);
- processing.remove(b);
- return true;
- });
- }
-
- @Override
- public EnergyNetComponentType getEnergyComponentType() {
- return EnergyNetComponentType.CONSUMER;
- }
-
- @Override
- public int getCapacity() {
- return 256;
- }
-
- @Override
- public int[] getInputSlots() {
- return inputslots;
- }
-
- @Override
- public int[] getOutputSlots() {
- return outputslots;
- }
-
- public String getInventoryTitle() {
- return Lang.readMachinesText("CLAY_ELECTRIC_WATER_PUMP");
- }
-
- public ItemStack getProgressBar() {
- return new ItemStack(Material.REDSTONE_TORCH);
- }
-
- public int getEnergyConsumption() {
- return 26;
- }
-
- public int getSpeed() {
- return 1;
- }
-
- public String getMachineIdentifier() {
- return "CLAY_ELECTRIC_WATER_PUMP";
- }
-
- public void SetupMenu(BlockMenuPreset Preset) {
- Preset.addItem(43, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
- Preset.addItem(43, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
- Preset.addItem(5, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
- for (int eachID : BORDER_A) {
- Preset.addItem(eachID, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
- }
- for (int eachID : BORDER_B) {
- Preset.addItem(eachID, BORDER_B_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
- }
- Preset.addItem(22, Utils.addLore(Utils.newItemD(Material.BLACK_STAINED_GLASS_PANE, "§9§l→"), " "),
- ChestMenuUtils.getEmptyClickHandler());
-
- Preset.addItem(5, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
- Preset.addItem(43, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
- for (int i : getOutputSlots()) {
- Preset.addMenuClickHandler(i, new AdvancedMenuClickHandler() {
-
- @Override
- public boolean onClick(Player p, int slot, ItemStack cursor, ClickAction action) {
- return false;
- }
-
- @Override
- public boolean onClick(InventoryClickEvent e, Player p, int slot, ItemStack cursor,
- ClickAction action) {
- return cursor == null || cursor.getType() == null || cursor.getType() == Material.AIR;
- }
- });
- }
- Preset.addItem(43, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
- }
-
- public MachineRecipe getProcessing(Block b) {
- return processing.get(b);
- }
-
- public boolean isProcessing(Block b) {
- return getProcessing(b) != null;
- }
-
- public void registerRecipe(MachineRecipe recipe) {
- recipe.setTicks(recipe.getTicks() / getSpeed());
- recipes.add(recipe);
- }
-
- public void registerRecipe(int seconds, ItemStack[] input, ItemStack[] output) {
- registerRecipe(new MachineRecipe(seconds, input, output));
- }
-
- @Override
- public void preRegister() {
- addItemHandler(new BlockTicker() {
- @Override
- public void tick(Block b, SlimefunItem sf, Config data) {
- ElectricWaterPump.this.tick(b);
- }
-
- @Override
- public boolean isSynchronized() {
- return false;
- }
- });
- }
-
- protected void tick(Block b) {
- BlockMenu inv = BlockStorage.getInventory(b);
- // 机器正在处理
- if (isProcessing(b)) {
- // 剩余时间
- int timeleft = progress.get(b);
-
- if (timeleft > 0) {
- // 还在处理
- ChestMenuUtils.updateProgressbar(inv, 22, timeleft, processing.get(b).getTicks(), getProgressBar());
-
- if (ChargableBlock.isChargable(b)) {
- if (ChargableBlock.getCharge(b) < getEnergyConsumption())
- return;
- ChargableBlock.addCharge(b, -getEnergyConsumption());
- progress.put(b, timeleft - 1);
- } else
- progress.put(b, timeleft - 1);
- } else {
- // 处理结束
- inv.replaceExistingItem(22,
- Utils.addLore(Utils.newItemD(Material.BLACK_STAINED_GLASS_PANE, "§9§l→"), " "));
-
- for (ItemStack output : processing.get(b).getOutput()) {
- if (output != null)
- inv.pushItem(output.clone(), getOutputSlots());
- }
-
- progress.remove(b);
- processing.remove(b);
- }
- } else {
- // 没有在处理
- ItemStack input = inv.getItemInSlot(20);
- ItemStack output = inv.getItemInSlot(24);
- if (input != null && output == null) {
- if (ChargableBlock.isChargable(b)) {
- if (ChargableBlock.getCharge(b) < getEnergyConsumption())
- return;
- ChargableBlock.addCharge(b, -getEnergyConsumption());
- }
- Dispenser dp = (Dispenser) b.getBlockData();
- Block targetBlock = b.getRelative(dp.getFacing());
- if (targetBlock.getType() != Material.WATER)
- return;
-
- new BukkitRunnable() {
-
- @Override
- public void run() {
- targetBlock.setType(Material.AIR);
- }
-
- }.runTask(ClayTech.getInstance());
-
- inv.consumeItem(20, 1);
-
- MachineRecipe recipe = new MachineRecipe(5, new ItemStack[] { new ItemStack(Material.BUCKET) },
- new ItemStack[] { new ItemStack(Material.WATER_BUCKET) });
-
- processing.put(b, recipe);
- progress.put(b, recipe.getTicks());
- }
- }
- }
+ public final static int[] inputslots = new int[]{20};
+ public final static int[] outputslots = new int[]{24};
+ private static final int[] BORDER_A = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 13, 31, 17, 18, 26, 27, 35, 36, 37, 38, 39,
+ 40, 41, 42, 43, 44};
+ private static final int[] BORDER_B = {10, 11, 12, 19, 21, 28, 29, 30, 14, 15, 16, 23, 25, 32, 33, 34};
+ private static final ItemStack BORDER_A_ITEM = Utils.newItemD(Material.LIGHT_BLUE_STAINED_GLASS_PANE,
+ Lang.readMachinesText("SPLIT_LINE"));
+ private static final ItemStack BORDER_B_ITEM = Utils.newItemD(Material.LIME_STAINED_GLASS_PANE,
+ Lang.readMachinesText("SPLIT_LINE"));
+ public static Map processing = new HashMap<>();
+ public static Map progress = new HashMap<>();
+ protected final List recipes = new ArrayList<>();
+
+ public ElectricWaterPump(Category category, SlimefunItemStack item, String id, RecipeType recipeType,
+ ItemStack[] recipe) {
+
+ super(category, item, recipeType, recipe);
+ createPreset(this, getInventoryTitle(), this::SetupMenu);
+
+ registerBlockHandler(id, (p, b, tool, reason) -> {
+ BlockMenu inv = BlockStorage.getInventory(b);
+ if (inv != null) {
+ for (int slot : getInputSlots()) {
+ if (inv.getItemInSlot(slot) != null) {
+ if (inv.getItemInSlot(slot).getType() != Material.BEDROCK) {
+ b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
+ inv.replaceExistingItem(slot, null);
+ }
+ }
+ }
+
+ for (int slot : getOutputSlots()) {
+ if (inv.getItemInSlot(slot) != null) {
+ b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
+ inv.replaceExistingItem(slot, null);
+ }
+ }
+ }
+
+ progress.remove(b);
+ processing.remove(b);
+ return true;
+ });
+ }
+
+ @Override
+ public EnergyNetComponentType getEnergyComponentType() {
+ return EnergyNetComponentType.CONSUMER;
+ }
+
+ @Override
+ public int getCapacity() {
+ return 256;
+ }
+
+ @Override
+ public int[] getInputSlots() {
+ return inputslots;
+ }
+
+ @Override
+ public int[] getOutputSlots() {
+ return outputslots;
+ }
+
+ public String getInventoryTitle() {
+ return Lang.readMachinesText("CLAY_ELECTRIC_WATER_PUMP");
+ }
+
+ public ItemStack getProgressBar() {
+ return new ItemStack(Material.REDSTONE_TORCH);
+ }
+
+ public int getEnergyConsumption() {
+ return 26;
+ }
+
+ public int getSpeed() {
+ return 1;
+ }
+
+ public String getMachineIdentifier() {
+ return "CLAY_ELECTRIC_WATER_PUMP";
+ }
+
+ public void SetupMenu(BlockMenuPreset Preset) {
+ Preset.addItem(43, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
+ Preset.addItem(43, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
+ Preset.addItem(5, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
+ for (int eachID : BORDER_A) {
+ Preset.addItem(eachID, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
+ }
+ for (int eachID : BORDER_B) {
+ Preset.addItem(eachID, BORDER_B_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
+ }
+ Preset.addItem(22, Utils.addLore(Utils.newItemD(Material.BLACK_STAINED_GLASS_PANE, "§9§l→"), " "),
+ ChestMenuUtils.getEmptyClickHandler());
+
+ Preset.addItem(5, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
+ Preset.addItem(43, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
+ for (int i : getOutputSlots()) {
+ Preset.addMenuClickHandler(i, new AdvancedMenuClickHandler() {
+
+ @Override
+ public boolean onClick(Player p, int slot, ItemStack cursor, ClickAction action) {
+ return false;
+ }
+
+ @Override
+ public boolean onClick(InventoryClickEvent e, Player p, int slot, ItemStack cursor,
+ ClickAction action) {
+ return cursor == null || cursor.getType() == null || cursor.getType() == Material.AIR;
+ }
+ });
+ }
+ Preset.addItem(43, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
+ }
+
+ public MachineRecipe getProcessing(Block b) {
+ return processing.get(b);
+ }
+
+ public boolean isProcessing(Block b) {
+ return getProcessing(b) != null;
+ }
+
+ public void registerRecipe(MachineRecipe recipe) {
+ recipe.setTicks(recipe.getTicks() / getSpeed());
+ recipes.add(recipe);
+ }
+
+ public void registerRecipe(int seconds, ItemStack[] input, ItemStack[] output) {
+ registerRecipe(new MachineRecipe(seconds, input, output));
+ }
+
+ @Override
+ public void preRegister() {
+ addItemHandler(new BlockTicker() {
+ @Override
+ public void tick(Block b, SlimefunItem sf, Config data) {
+ ElectricWaterPump.this.tick(b);
+ }
+
+ @Override
+ public boolean isSynchronized() {
+ return false;
+ }
+ });
+ }
+
+ protected void tick(Block b) {
+ BlockMenu inv = BlockStorage.getInventory(b);
+ // 机器正在处理
+ if (isProcessing(b)) {
+ // 剩余时间
+ int timeleft = progress.get(b);
+
+ if (timeleft > 0) {
+ // 还在处理
+ ChestMenuUtils.updateProgressbar(inv, 22, timeleft, processing.get(b).getTicks(), getProgressBar());
+
+ if (ChargableBlock.isChargable(b)) {
+ if (ChargableBlock.getCharge(b) < getEnergyConsumption())
+ return;
+ ChargableBlock.addCharge(b, -getEnergyConsumption());
+ progress.put(b, timeleft - 1);
+ } else
+ progress.put(b, timeleft - 1);
+ } else {
+ // 处理结束
+ inv.replaceExistingItem(22,
+ Utils.addLore(Utils.newItemD(Material.BLACK_STAINED_GLASS_PANE, "§9§l→"), " "));
+
+ for (ItemStack output : processing.get(b).getOutput()) {
+ if (output != null)
+ inv.pushItem(output.clone(), getOutputSlots());
+ }
+
+ progress.remove(b);
+ processing.remove(b);
+ }
+ } else {
+ // 没有在处理
+ ItemStack input = inv.getItemInSlot(20);
+ ItemStack output = inv.getItemInSlot(24);
+ if (input != null && output == null) {
+ if (ChargableBlock.isChargable(b)) {
+ if (ChargableBlock.getCharge(b) < getEnergyConsumption())
+ return;
+ ChargableBlock.addCharge(b, -getEnergyConsumption());
+ }
+ Dispenser dp = (Dispenser) b.getBlockData();
+ Block targetBlock = b.getRelative(dp.getFacing());
+ if (targetBlock.getType() != Material.WATER)
+ return;
+
+ new BukkitRunnable() {
+
+ @Override
+ public void run() {
+ targetBlock.setType(Material.AIR);
+ }
+
+ }.runTask(ClayTech.getInstance());
+
+ inv.consumeItem(20, 1);
+
+ MachineRecipe recipe = new MachineRecipe(5, new ItemStack[]{new ItemStack(Material.BUCKET)},
+ new ItemStack[]{new ItemStack(Material.WATER_BUCKET)});
+
+ processing.put(b, recipe);
+ progress.put(b, recipe.getTicks());
+ }
+ }
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/machines/ElementExtracter.java b/src/main/java/club/claycoffee/ClayTech/implementation/machines/ElementExtracter.java
index cc65d0a..b042e61 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/machines/ElementExtracter.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/machines/ElementExtracter.java
@@ -6,150 +6,149 @@
import club.claycoffee.ClayTech.implementation.abstractMachines.AExtracter;
import club.claycoffee.ClayTech.utils.Lang;
import club.claycoffee.ClayTech.utils.Utils;
+import io.github.thebusybiscuit.slimefun4.core.categories.LockedCategory;
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
-import io.github.thebusybiscuit.slimefun4.core.categories.LockedCategory;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecipe;
import me.mrCookieSlime.Slimefun.api.BlockStorage;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
import me.mrCookieSlime.Slimefun.api.energy.ChargableBlock;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
-
-import java.util.HashMap;
-import java.util.Map;
-
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitRunnable;
+import java.util.HashMap;
+import java.util.Map;
+
public class ElementExtracter extends AExtracter {
- private ItemStack[] inputItem;
- private ItemStack outputItem;
-
- public ElementExtracter(LockedCategory category, SlimefunItemStack item, String id, RecipeType recipeType,
- ItemStack[] recipe) {
- super(category, item, id, recipeType, recipe);
- }
-
- public String getInventoryTitle() {
- return Lang.readMachinesText("CLAY_ELEMENT_EXTRACTER");
- }
-
- public ItemStack getProgressBar() {
- return new ItemStack(Material.REDSTONE_TORCH);
- }
-
- public int getEnergyConsumption() {
- return 64;
- }
-
- public int getSpeed() {
- return 1;
- }
-
- @Override
- public int getCapacity() {
- return 1024;
- }
-
- public String getMachineIdentifier() {
- return "ELEMENT_EXTRACTER";
- }
-
- public void registerDefaultRecipes() {
- registerRecipe(10, new ItemStack[] { new ItemStack(Material.DIRT, 3) },
- new ItemStack[] { ClayTechItems.ELEMENT_OXYGEN });
- registerRecipe(10, new ItemStack[] { new ItemStack(Material.COAL, 8) },
- new ItemStack[] { ClayTechItems.ELEMENT_CARBON });
- registerRecipe(10, new ItemStack[] { new ItemStack(Material.SAND, 10) },
- new ItemStack[] { ClayTechItems.ELEMENT_SILICON });
- }
-
- protected void tick(Block b) {
- BlockMenu inv = BlockStorage.getInventory(b);
- // 机器正在处理
- if (isProcessing(b)) {
- // 剩余时间
- int timeleft = progress.get(b);
-
- if (timeleft > 0) {
- // 还在处理
- ChestMenuUtils.updateProgressbar(inv, 22, timeleft, processing.get(b).getTicks(), getProgressBar());
-
- if (ChargableBlock.isChargable(b)) {
- if (ChargableBlock.getCharge(b) < getEnergyConsumption())
- return;
- ChargableBlock.addCharge(b, -getEnergyConsumption());
- progress.put(b, timeleft - 1);
- } else
- progress.put(b, timeleft - 1);
- } else {
- // 处理结束
- inv.replaceExistingItem(22, Utils.addLore(Utils.newItem(Material.PINK_STAINED_GLASS_PANE), " "));
- new BukkitRunnable() {
-
- @Override
- public void run() {
- Bukkit.getPluginManager().callEvent(new PlayerExtractElementEvent(b, inputItem, outputItem));
-
- }
-
- }.runTask(ClayTech.getInstance());
- for (ItemStack output : processing.get(b).getOutput()) {
- if (output != null)
- inv.pushItem(output.clone(), getOutputSlots());
- }
-
- progress.remove(b);
- processing.remove(b);
- }
- } else {
- // 没有在处理
- MachineRecipe r = null;
- Map found = new HashMap<>();
- for (MachineRecipe recipe : recipes) {
- ItemStack input = recipe.getInput()[0];
- if (SlimefunUtils.isItemSimilar(inv.getItemInSlot(inputslots[0]), input, true)) {
- if (input != null) {
- found.put(inputslots[0], input.getAmount());
- }
- }
- if (found.size() == recipe.getInput().length) {
- r = recipe;
- break;
- } else {
- found.clear();
- }
- }
-
- if (r != null) {
- if (ChargableBlock.isChargable(b)) {
- if (ChargableBlock.getCharge(b) < getEnergyConsumption())
- return;
- ChargableBlock.addCharge(b, -getEnergyConsumption());
- }
- if (!SlimefunUtils.isItemSimilar(inv.getItemInSlot(40), ClayTechItems.ELEMENT_UNIT, true))
- return;
- if (inv.getItemInSlot(outputslots[0]) != null) {
- ItemStack is = inv.getItemInSlot(outputslots[0]);
- if (is.getMaxStackSize() == is.getAmount())
- return;
- }
- for (Map.Entry entry : found.entrySet()) {
- if (entry.getValue() > 0) {
- inv.consumeItem(entry.getKey(), entry.getValue());
- inv.consumeItem(40, 1);
- }
-
- }
- inputItem = r.getInput();
- outputItem = r.getOutput()[0];
- processing.put(b, r);
- progress.put(b, r.getTicks());
- }
- }
- }
+ private ItemStack[] inputItem;
+ private ItemStack outputItem;
+
+ public ElementExtracter(LockedCategory category, SlimefunItemStack item, String id, RecipeType recipeType,
+ ItemStack[] recipe) {
+ super(category, item, id, recipeType, recipe);
+ }
+
+ public String getInventoryTitle() {
+ return Lang.readMachinesText("CLAY_ELEMENT_EXTRACTER");
+ }
+
+ public ItemStack getProgressBar() {
+ return new ItemStack(Material.REDSTONE_TORCH);
+ }
+
+ public int getEnergyConsumption() {
+ return 64;
+ }
+
+ public int getSpeed() {
+ return 1;
+ }
+
+ @Override
+ public int getCapacity() {
+ return 1024;
+ }
+
+ public String getMachineIdentifier() {
+ return "ELEMENT_EXTRACTER";
+ }
+
+ public void registerDefaultRecipes() {
+ registerRecipe(10, new ItemStack[]{new ItemStack(Material.DIRT, 3)},
+ new ItemStack[]{ClayTechItems.ELEMENT_OXYGEN});
+ registerRecipe(10, new ItemStack[]{new ItemStack(Material.COAL, 8)},
+ new ItemStack[]{ClayTechItems.ELEMENT_CARBON});
+ registerRecipe(10, new ItemStack[]{new ItemStack(Material.SAND, 10)},
+ new ItemStack[]{ClayTechItems.ELEMENT_SILICON});
+ }
+
+ protected void tick(Block b) {
+ BlockMenu inv = BlockStorage.getInventory(b);
+ // 机器正在处理
+ if (isProcessing(b)) {
+ // 剩余时间
+ int timeleft = progress.get(b);
+
+ if (timeleft > 0) {
+ // 还在处理
+ ChestMenuUtils.updateProgressbar(inv, 22, timeleft, processing.get(b).getTicks(), getProgressBar());
+
+ if (ChargableBlock.isChargable(b)) {
+ if (ChargableBlock.getCharge(b) < getEnergyConsumption())
+ return;
+ ChargableBlock.addCharge(b, -getEnergyConsumption());
+ progress.put(b, timeleft - 1);
+ } else
+ progress.put(b, timeleft - 1);
+ } else {
+ // 处理结束
+ inv.replaceExistingItem(22, Utils.addLore(Utils.newItem(Material.PINK_STAINED_GLASS_PANE), " "));
+ new BukkitRunnable() {
+
+ @Override
+ public void run() {
+ Bukkit.getPluginManager().callEvent(new PlayerExtractElementEvent(b, inputItem, outputItem));
+
+ }
+
+ }.runTask(ClayTech.getInstance());
+ for (ItemStack output : processing.get(b).getOutput()) {
+ if (output != null)
+ inv.pushItem(output.clone(), getOutputSlots());
+ }
+
+ progress.remove(b);
+ processing.remove(b);
+ }
+ } else {
+ // 没有在处理
+ MachineRecipe r = null;
+ Map found = new HashMap<>();
+ for (MachineRecipe recipe : recipes) {
+ ItemStack input = recipe.getInput()[0];
+ if (SlimefunUtils.isItemSimilar(inv.getItemInSlot(inputslots[0]), input, true)) {
+ if (input != null) {
+ found.put(inputslots[0], input.getAmount());
+ }
+ }
+ if (found.size() == recipe.getInput().length) {
+ r = recipe;
+ break;
+ } else {
+ found.clear();
+ }
+ }
+
+ if (r != null) {
+ if (ChargableBlock.isChargable(b)) {
+ if (ChargableBlock.getCharge(b) < getEnergyConsumption())
+ return;
+ ChargableBlock.addCharge(b, -getEnergyConsumption());
+ }
+ if (!SlimefunUtils.isItemSimilar(inv.getItemInSlot(40), ClayTechItems.ELEMENT_UNIT, true))
+ return;
+ if (inv.getItemInSlot(outputslots[0]) != null) {
+ ItemStack is = inv.getItemInSlot(outputslots[0]);
+ if (is.getMaxStackSize() == is.getAmount())
+ return;
+ }
+ for (Map.Entry entry : found.entrySet()) {
+ if (entry.getValue() > 0) {
+ inv.consumeItem(entry.getKey(), entry.getValue());
+ inv.consumeItem(40, 1);
+ }
+
+ }
+ inputItem = r.getInput();
+ outputItem = r.getOutput()[0];
+ processing.put(b, r);
+ progress.put(b, r.getTicks());
+ }
+ }
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/machines/ExperimentTableNormal.java b/src/main/java/club/claycoffee/ClayTech/implementation/machines/ExperimentTableNormal.java
index 660a841..6eabc73 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/machines/ExperimentTableNormal.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/machines/ExperimentTableNormal.java
@@ -1,8 +1,5 @@
package club.claycoffee.ClayTech.implementation.machines;
-import org.bukkit.Material;
-import org.bukkit.inventory.ItemStack;
-
import club.claycoffee.ClayTech.ClayTechItems;
import club.claycoffee.ClayTech.ClayTechMachineRecipes;
import club.claycoffee.ClayTech.implementation.abstractMachines.AExperimentTable;
@@ -10,41 +7,43 @@
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
+import org.bukkit.Material;
+import org.bukkit.inventory.ItemStack;
public class ExperimentTableNormal extends AExperimentTable {
- public ExperimentTableNormal(Category category, SlimefunItemStack item, String id, RecipeType recipeType,
- ItemStack[] recipe) {
- super(category, item, id, recipeType, recipe);
- }
-
- @Override
- public String getInventoryTitle() {
- return Lang.readMachinesText("CLAY_EXPERIMENTTABLE_NORMAL");
- }
-
- @Override
- public ItemStack getProgressBar() {
- return new ItemStack(Material.TNT);
- }
-
- @Override
- public int getEnergyConsumption() {
- return 80;
- }
-
- @Override
- public int getSpeed() {
- return 1;
- }
-
- @Override
- public String getMachineIdentifier() {
- return null;
- }
-
- @Override
- public void registerDefaultRecipes() {
- this.registerRecipe(20, ClayTechMachineRecipes.SILICON_INGOT, new ItemStack[] { ClayTechItems.SILICON_INGOT });
- }
+ public ExperimentTableNormal(Category category, SlimefunItemStack item, String id, RecipeType recipeType,
+ ItemStack[] recipe) {
+ super(category, item, id, recipeType, recipe);
+ }
+
+ @Override
+ public String getInventoryTitle() {
+ return Lang.readMachinesText("CLAY_EXPERIMENTTABLE_NORMAL");
+ }
+
+ @Override
+ public ItemStack getProgressBar() {
+ return new ItemStack(Material.TNT);
+ }
+
+ @Override
+ public int getEnergyConsumption() {
+ return 80;
+ }
+
+ @Override
+ public int getSpeed() {
+ return 1;
+ }
+
+ @Override
+ public String getMachineIdentifier() {
+ return null;
+ }
+
+ @Override
+ public void registerDefaultRecipes() {
+ this.registerRecipe(20, ClayTechMachineRecipes.SILICON_INGOT, new ItemStack[]{ClayTechItems.SILICON_INGOT});
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/machines/FoodCauldron.java b/src/main/java/club/claycoffee/ClayTech/implementation/machines/FoodCauldron.java
index 70cc649..96ecae2 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/machines/FoodCauldron.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/machines/FoodCauldron.java
@@ -1,14 +1,5 @@
package club.claycoffee.ClayTech.implementation.machines;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.bukkit.Bukkit;
-import org.bukkit.Material;
-import org.bukkit.block.Block;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.scheduler.BukkitRunnable;
-
import club.claycoffee.ClayTech.ClayTech;
import club.claycoffee.ClayTech.ClayTechItems;
import club.claycoffee.ClayTech.ClayTechMachineRecipes;
@@ -16,163 +7,171 @@
import club.claycoffee.ClayTech.implementation.abstractMachines.ACraftingTable;
import club.claycoffee.ClayTech.utils.Lang;
import club.claycoffee.ClayTech.utils.Utils;
+import io.github.thebusybiscuit.slimefun4.core.categories.LockedCategory;
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
-import io.github.thebusybiscuit.slimefun4.core.categories.LockedCategory;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineRecipe;
import me.mrCookieSlime.Slimefun.api.BlockStorage;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
import me.mrCookieSlime.Slimefun.api.energy.ChargableBlock;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
+import org.bukkit.Bukkit;
+import org.bukkit.Material;
+import org.bukkit.block.Block;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.scheduler.BukkitRunnable;
+
+import java.util.HashMap;
+import java.util.Map;
public class FoodCauldron extends ACraftingTable {
- private ItemStack[] inputItem;
- private ItemStack outputItem;
-
- public FoodCauldron(LockedCategory category, SlimefunItemStack item, String id, RecipeType recipeType,
- ItemStack[] recipe) {
- super(category, item, id, recipeType, recipe);
- }
-
- @Override
- public String getInventoryTitle() {
- return Lang.readMachinesText("CLAY_FOOD_CAULDRON");
- }
-
- @Override
- public ItemStack getProgressBar() {
- return new ItemStack(Material.CAMPFIRE);
- }
-
- @Override
- public int getEnergyConsumption() {
- return 32;
- }
-
- @Override
- public int getSpeed() {
- return 1;
- }
-
- @Override
- public String getMachineIdentifier() {
- return "CLAY_FOOD_CAULDRON";
- }
-
- @Override
- public void registerDefaultRecipes() {
-
- this.registerRecipe(30, ClayTechMachineRecipes.CHICKEN_FOOT, new ItemStack[] { ClayTechItems.CHICKEN_FOOT });
- this.registerRecipe(30, ClayTechMachineRecipes.SPICY_CHICKEN_BURGER,
- new ItemStack[] { ClayTechItems.SPICY_CHICKEN_BURGER });
- this.registerRecipe(30, ClayTechMachineRecipes.BABA_BURGER, new ItemStack[] { ClayTechItems.BABA_BURGER });
- this.registerRecipe(30, ClayTechMachineRecipes.CHOCOLATE, new ItemStack[] { ClayTechItems.CHOCOLATE });
- this.registerRecipe(30, ClayTechMachineRecipes.SNAIL_FOOD, new ItemStack[] { ClayTechItems.SNAIL_FOOD });
- this.registerRecipe(10, ClayTechMachineRecipes.HONEY_SWEET, new ItemStack[] { ClayTechItems.HONEY_SWEET });
- this.registerRecipe(15, ClayTechMachineRecipes.COOKED_SWEET_POTATO,
- new ItemStack[] { ClayTechItems.COOKED_SWEET_POTATO });
-
- this.registerRecipe(30, ClayTechMachineRecipes.CLAY_COFFEE, new ItemStack[] { ClayTechItems.CLAY_COFFEE });
- this.registerRecipe(30, ClayTechMachineRecipes.LEMON_POWDER_DRINK,
- new ItemStack[] { ClayTechItems.LEMON_POWDER_DRINK });
- this.registerRecipe(30, ClayTechMachineRecipes.TEA_DRINK, new ItemStack[] { ClayTechItems.TEA_DRINK });
- this.registerRecipe(30, ClayTechMachineRecipes.LEMON_TEA_DRINK,
- new ItemStack[] { ClayTechItems.LEMON_TEA_DRINK });
- }
-
- @Override
- public int getCapacity() {
- return 512;
- }
-
- @Override
- protected void tick(Block b) {
- BlockMenu inv = BlockStorage.getInventory(b);
- // 机器正在处理
- if (isProcessing(b)) {
- // 剩余时间
- int timeleft = progress.get(b);
-
- if (timeleft > 0) {
- // 还在处理
- ChestMenuUtils.updateProgressbar(inv, 4, timeleft, processing.get(b).getTicks(), getProgressBar());
-
- if (ChargableBlock.isChargable(b)) {
- if (ChargableBlock.getCharge(b) < getEnergyConsumption())
- return;
- ChargableBlock.addCharge(b, -getEnergyConsumption());
- progress.put(b, timeleft - 1);
- } else
- progress.put(b, timeleft - 1);
- } else {
- // 处理结束
- inv.replaceExistingItem(4, Utils.addLore(Utils.newItem(Material.BLACK_STAINED_GLASS_PANE), " "));
- new BukkitRunnable() {
-
- @Override
- public void run() {
- Bukkit.getPluginManager().callEvent(new PlayerCookItemEvent(b, inputItem, outputItem));
-
- }
-
- }.runTask(ClayTech.getInstance());
- for (ItemStack output : processing.get(b).getOutput()) {
- if (output != null)
- inv.pushItem(output.clone(), getOutputSlots());
- }
- progress.remove(b);
- processing.remove(b);
- }
- } else {
- // 没有在处理
- MachineRecipe r = null;
- Map found = new HashMap<>();
- int i;
- for (MachineRecipe recipe : recipes) {
- i = 0;
- for (ItemStack input : recipe.getInput()) {
- if (SlimefunUtils.isItemSimilar(inv.getItemInSlot(inputslots[i]), input, true)) {
- // 如果该位置的物品符合某合成配方的对应位置物品
- if (input != null) {
- found.put(inputslots[i], input.getAmount());
- }
- }
- if (inv.getItemInSlot(inputslots[i]) == input && input == null) {
- found.put(i, 0);
- }
- if (i < 8) {
- i++;
- } else
- i = 0;
- }
- if (found.size() == recipe.getInput().length) {
- r = recipe;
- break;
- } else
- found.clear();
- }
-
- if (r != null) {
- if (ChargableBlock.isChargable(b)) {
- if (ChargableBlock.getCharge(b) < getEnergyConsumption())
- return;
- ChargableBlock.addCharge(b, -getEnergyConsumption());
- }
- if (inv.getItemInSlot(outputslots[0]) != null) {
- ItemStack is = inv.getItemInSlot(outputslots[0]);
- if (is.getMaxStackSize() == is.getAmount())
- return;
- }
- for (Map.Entry entry : found.entrySet()) {
- if (entry.getValue() > 0)
- inv.consumeItem(entry.getKey(), entry.getValue());
- }
- inputItem = r.getInput();
- outputItem = r.getOutput()[0];
- processing.put(b, r);
- progress.put(b, r.getTicks());
- }
- }
- }
+ private ItemStack[] inputItem;
+ private ItemStack outputItem;
+
+ public FoodCauldron(LockedCategory category, SlimefunItemStack item, String id, RecipeType recipeType,
+ ItemStack[] recipe) {
+ super(category, item, id, recipeType, recipe);
+ }
+
+ @Override
+ public String getInventoryTitle() {
+ return Lang.readMachinesText("CLAY_FOOD_CAULDRON");
+ }
+
+ @Override
+ public ItemStack getProgressBar() {
+ return new ItemStack(Material.CAMPFIRE);
+ }
+
+ @Override
+ public int getEnergyConsumption() {
+ return 32;
+ }
+
+ @Override
+ public int getSpeed() {
+ return 1;
+ }
+
+ @Override
+ public String getMachineIdentifier() {
+ return "CLAY_FOOD_CAULDRON";
+ }
+
+ @Override
+ public void registerDefaultRecipes() {
+
+ this.registerRecipe(30, ClayTechMachineRecipes.CHICKEN_FOOT, new ItemStack[]{ClayTechItems.CHICKEN_FOOT});
+ this.registerRecipe(30, ClayTechMachineRecipes.SPICY_CHICKEN_BURGER,
+ new ItemStack[]{ClayTechItems.SPICY_CHICKEN_BURGER});
+ this.registerRecipe(30, ClayTechMachineRecipes.BABA_BURGER, new ItemStack[]{ClayTechItems.BABA_BURGER});
+ this.registerRecipe(30, ClayTechMachineRecipes.CHOCOLATE, new ItemStack[]{ClayTechItems.CHOCOLATE});
+ this.registerRecipe(30, ClayTechMachineRecipes.SNAIL_FOOD, new ItemStack[]{ClayTechItems.SNAIL_FOOD});
+ this.registerRecipe(10, ClayTechMachineRecipes.HONEY_SWEET, new ItemStack[]{ClayTechItems.HONEY_SWEET});
+ this.registerRecipe(15, ClayTechMachineRecipes.COOKED_SWEET_POTATO,
+ new ItemStack[]{ClayTechItems.COOKED_SWEET_POTATO});
+
+ this.registerRecipe(30, ClayTechMachineRecipes.CLAY_COFFEE, new ItemStack[]{ClayTechItems.CLAY_COFFEE});
+ this.registerRecipe(30, ClayTechMachineRecipes.LEMON_POWDER_DRINK,
+ new ItemStack[]{ClayTechItems.LEMON_POWDER_DRINK});
+ this.registerRecipe(30, ClayTechMachineRecipes.TEA_DRINK, new ItemStack[]{ClayTechItems.TEA_DRINK});
+ this.registerRecipe(30, ClayTechMachineRecipes.LEMON_TEA_DRINK,
+ new ItemStack[]{ClayTechItems.LEMON_TEA_DRINK});
+ }
+
+ @Override
+ public int getCapacity() {
+ return 512;
+ }
+
+ @Override
+ protected void tick(Block b) {
+ BlockMenu inv = BlockStorage.getInventory(b);
+ // 机器正在处理
+ if (isProcessing(b)) {
+ // 剩余时间
+ int timeleft = progress.get(b);
+
+ if (timeleft > 0) {
+ // 还在处理
+ ChestMenuUtils.updateProgressbar(inv, 4, timeleft, processing.get(b).getTicks(), getProgressBar());
+
+ if (ChargableBlock.isChargable(b)) {
+ if (ChargableBlock.getCharge(b) < getEnergyConsumption())
+ return;
+ ChargableBlock.addCharge(b, -getEnergyConsumption());
+ progress.put(b, timeleft - 1);
+ } else
+ progress.put(b, timeleft - 1);
+ } else {
+ // 处理结束
+ inv.replaceExistingItem(4, Utils.addLore(Utils.newItem(Material.BLACK_STAINED_GLASS_PANE), " "));
+ new BukkitRunnable() {
+
+ @Override
+ public void run() {
+ Bukkit.getPluginManager().callEvent(new PlayerCookItemEvent(b, inputItem, outputItem));
+
+ }
+
+ }.runTask(ClayTech.getInstance());
+ for (ItemStack output : processing.get(b).getOutput()) {
+ if (output != null)
+ inv.pushItem(output.clone(), getOutputSlots());
+ }
+ progress.remove(b);
+ processing.remove(b);
+ }
+ } else {
+ // 没有在处理
+ MachineRecipe r = null;
+ Map found = new HashMap<>();
+ int i;
+ for (MachineRecipe recipe : recipes) {
+ i = 0;
+ for (ItemStack input : recipe.getInput()) {
+ if (SlimefunUtils.isItemSimilar(inv.getItemInSlot(inputslots[i]), input, true)) {
+ // 如果该位置的物品符合某合成配方的对应位置物品
+ if (input != null) {
+ found.put(inputslots[i], input.getAmount());
+ }
+ }
+ if (inv.getItemInSlot(inputslots[i]) == input && input == null) {
+ found.put(i, 0);
+ }
+ if (i < 8) {
+ i++;
+ } else
+ i = 0;
+ }
+ if (found.size() == recipe.getInput().length) {
+ r = recipe;
+ break;
+ } else
+ found.clear();
+ }
+
+ if (r != null) {
+ if (ChargableBlock.isChargable(b)) {
+ if (ChargableBlock.getCharge(b) < getEnergyConsumption())
+ return;
+ ChargableBlock.addCharge(b, -getEnergyConsumption());
+ }
+ if (inv.getItemInSlot(outputslots[0]) != null) {
+ ItemStack is = inv.getItemInSlot(outputslots[0]);
+ if (is.getMaxStackSize() == is.getAmount())
+ return;
+ }
+ for (Map.Entry entry : found.entrySet()) {
+ if (entry.getValue() > 0)
+ inv.consumeItem(entry.getKey(), entry.getValue());
+ }
+ inputItem = r.getInput();
+ outputItem = r.getOutput()[0];
+ processing.put(b, r);
+ progress.put(b, r.getTicks());
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/machines/FoodChalkingMachine.java b/src/main/java/club/claycoffee/ClayTech/implementation/machines/FoodChalkingMachine.java
index 2b3592c..abeda59 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/machines/FoodChalkingMachine.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/machines/FoodChalkingMachine.java
@@ -1,59 +1,58 @@
package club.claycoffee.ClayTech.implementation.machines;
-import org.bukkit.Material;
-import org.bukkit.inventory.ItemStack;
-
import club.claycoffee.ClayTech.ClayTechItems;
import club.claycoffee.ClayTech.ClayTechMachineRecipes;
import club.claycoffee.ClayTech.implementation.abstractMachines.ANewContainer;
import club.claycoffee.ClayTech.utils.Lang;
-import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import io.github.thebusybiscuit.slimefun4.core.categories.LockedCategory;
+import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
+import org.bukkit.Material;
+import org.bukkit.inventory.ItemStack;
public class FoodChalkingMachine extends ANewContainer {
- public FoodChalkingMachine(LockedCategory category, SlimefunItemStack item, String id, RecipeType recipeType,
- ItemStack[] recipe) {
- super(category, item, id, recipeType, recipe);
- }
-
- @Override
- public String getInventoryTitle() {
- return Lang.readMachinesText("CLAY_FOOD_CHALKING_MACHINE");
- }
-
- @Override
- public ItemStack getProgressBar() {
- return new ItemStack(Material.REDSTONE_TORCH);
- }
-
- @Override
- public int getEnergyConsumption() {
- return 32;
- }
-
- @Override
- public int getCapacity() {
- return 512;
- }
-
- @Override
- public int getSpeed() {
- return 1;
- }
-
- @Override
- public String getMachineIdentifier() {
- return "CLAY_FOOD_CHALKING_MACHINE";
- }
-
- @Override
- public void registerDefaultRecipes() {
- this.registerRecipe(8, new ItemStack[] { ClayTechItems.RAW_TEA }, new ItemStack[] { ClayTechItems.TEA_POWDER });
- this.registerRecipe(8, new ItemStack[] { ClayTechItems.CLAY_LEMON },
- new ItemStack[] { ClayTechItems.LEMON_POWDER });
- this.registerRecipe(8, ClayTechMachineRecipes.RAW_CHICKEN_FOOT,
- new ItemStack[] { ClayTechItems.RAW_CHICKEN_FOOT });
- }
+ public FoodChalkingMachine(LockedCategory category, SlimefunItemStack item, String id, RecipeType recipeType,
+ ItemStack[] recipe) {
+ super(category, item, id, recipeType, recipe);
+ }
+
+ @Override
+ public String getInventoryTitle() {
+ return Lang.readMachinesText("CLAY_FOOD_CHALKING_MACHINE");
+ }
+
+ @Override
+ public ItemStack getProgressBar() {
+ return new ItemStack(Material.REDSTONE_TORCH);
+ }
+
+ @Override
+ public int getEnergyConsumption() {
+ return 32;
+ }
+
+ @Override
+ public int getCapacity() {
+ return 512;
+ }
+
+ @Override
+ public int getSpeed() {
+ return 1;
+ }
+
+ @Override
+ public String getMachineIdentifier() {
+ return "CLAY_FOOD_CHALKING_MACHINE";
+ }
+
+ @Override
+ public void registerDefaultRecipes() {
+ this.registerRecipe(8, new ItemStack[]{ClayTechItems.RAW_TEA}, new ItemStack[]{ClayTechItems.TEA_POWDER});
+ this.registerRecipe(8, new ItemStack[]{ClayTechItems.CLAY_LEMON},
+ new ItemStack[]{ClayTechItems.LEMON_POWDER});
+ this.registerRecipe(8, ClayTechMachineRecipes.RAW_CHICKEN_FOOT,
+ new ItemStack[]{ClayTechItems.RAW_CHICKEN_FOOT});
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/machines/RocketAssemblingMachine.java b/src/main/java/club/claycoffee/ClayTech/implementation/machines/RocketAssemblingMachine.java
index 0aafa9f..3972451 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/machines/RocketAssemblingMachine.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/machines/RocketAssemblingMachine.java
@@ -1,59 +1,58 @@
package club.claycoffee.ClayTech.implementation.machines;
-import org.bukkit.Material;
-import org.bukkit.inventory.ItemStack;
-
import club.claycoffee.ClayTech.ClayTechItems;
import club.claycoffee.ClayTech.implementation.abstractMachines.ARocketTable;
import club.claycoffee.ClayTech.utils.Lang;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
+import org.bukkit.Material;
+import org.bukkit.inventory.ItemStack;
public class RocketAssemblingMachine extends ARocketTable {
- public RocketAssemblingMachine(Category category, SlimefunItemStack item, String id, RecipeType recipeType,
- ItemStack[] recipe) {
- super(category, item, id, recipeType, recipe);
- }
-
- @Override
- public String getInventoryTitle() {
- return Lang.readMachinesText("CLAY_ROCKET_ASSEMBLING_MACHINE");
- }
-
- @Override
- public ItemStack getProgressBar() {
- return new ItemStack(Material.REDSTONE_TORCH);
- }
-
- @Override
- public int getEnergyConsumption() {
- return 128;
- }
-
- @Override
- public int getSpeed() {
- return 1;
- }
-
- @Override
- public String getMachineIdentifier() {
- return "CLAY_ROCKET_ASSEMBLING_MACHINE";
- }
-
- @Override
- public void registerDefaultRecipes() {
- ItemStack[] ROCKET_1 = { null, ClayTechItems.ROCKET_GLASS, ClayTechItems.ROCKET_FUEL_TANK,
- ClayTechItems.ROCKET_GLASS, ClayTechItems.ROCKET_STEEL_PLATE, ClayTechItems.ROCKET_CONTROL_CORE,
- ClayTechItems.ROCKET_STEEL_PLATE, ClayTechItems.ROCKET_STEEL_PLATE, ClayTechItems.ROCKET_ENGINE,
- ClayTechItems.ROCKET_STEEL_PLATE };
- this.registerRecipe(600, ROCKET_1, new ItemStack[] { ClayTechItems.ROCKET });
- }
-
- @Override
- public int getCapacity() {
- return 512;
- }
+ public RocketAssemblingMachine(Category category, SlimefunItemStack item, String id, RecipeType recipeType,
+ ItemStack[] recipe) {
+ super(category, item, id, recipeType, recipe);
+ }
+
+ @Override
+ public String getInventoryTitle() {
+ return Lang.readMachinesText("CLAY_ROCKET_ASSEMBLING_MACHINE");
+ }
+
+ @Override
+ public ItemStack getProgressBar() {
+ return new ItemStack(Material.REDSTONE_TORCH);
+ }
+
+ @Override
+ public int getEnergyConsumption() {
+ return 128;
+ }
+
+ @Override
+ public int getSpeed() {
+ return 1;
+ }
+
+ @Override
+ public String getMachineIdentifier() {
+ return "CLAY_ROCKET_ASSEMBLING_MACHINE";
+ }
+
+ @Override
+ public void registerDefaultRecipes() {
+ ItemStack[] ROCKET_1 = {null, ClayTechItems.ROCKET_GLASS, ClayTechItems.ROCKET_FUEL_TANK,
+ ClayTechItems.ROCKET_GLASS, ClayTechItems.ROCKET_STEEL_PLATE, ClayTechItems.ROCKET_CONTROL_CORE,
+ ClayTechItems.ROCKET_STEEL_PLATE, ClayTechItems.ROCKET_STEEL_PLATE, ClayTechItems.ROCKET_ENGINE,
+ ClayTechItems.ROCKET_STEEL_PLATE};
+ this.registerRecipe(600, ROCKET_1, new ItemStack[]{ClayTechItems.ROCKET});
+ }
+
+ @Override
+ public int getCapacity() {
+ return 512;
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/machines/RocketFuelGenerator.java b/src/main/java/club/claycoffee/ClayTech/implementation/machines/RocketFuelGenerator.java
index 90bad99..5f728cc 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/machines/RocketFuelGenerator.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/machines/RocketFuelGenerator.java
@@ -1,8 +1,5 @@
package club.claycoffee.ClayTech.implementation.machines;
-import org.bukkit.Material;
-import org.bukkit.inventory.ItemStack;
-
import club.claycoffee.ClayTech.ClayTechItems;
import club.claycoffee.ClayTech.ClayTechMachineRecipes;
import club.claycoffee.ClayTech.implementation.abstractMachines.ACraftingTable;
@@ -10,48 +7,50 @@
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
+import org.bukkit.Material;
+import org.bukkit.inventory.ItemStack;
public class RocketFuelGenerator extends ACraftingTable {
- public RocketFuelGenerator(Category category, SlimefunItemStack item, String id, RecipeType recipeType,
- ItemStack[] recipe) {
- super(category, item, id, recipeType, recipe);
- }
-
- @Override
- public String getInventoryTitle() {
- return Lang.readMachinesText("CLAY_ROCKET_FUEL_GENERATOR");
- }
-
- @Override
- public ItemStack getProgressBar() {
- return new ItemStack(Material.REDSTONE_TORCH);
- }
-
- @Override
- public int getEnergyConsumption() {
- return 64;
- }
-
- @Override
- public int getSpeed() {
- return 1;
- }
-
- @Override
- public String getMachineIdentifier() {
- return "CLAY_ROCKET_FUEL_GENERATOR";
- }
-
- @Override
- public void registerDefaultRecipes() {
- this.registerRecipe(8, ClayTechMachineRecipes.MIXED_ROCKET_FUEL,
- new ItemStack[] { ClayTechItems.MIXED_ROCKET_FUEL });
- }
-
- @Override
- public int getCapacity() {
- return 256;
- }
+ public RocketFuelGenerator(Category category, SlimefunItemStack item, String id, RecipeType recipeType,
+ ItemStack[] recipe) {
+ super(category, item, id, recipeType, recipe);
+ }
+
+ @Override
+ public String getInventoryTitle() {
+ return Lang.readMachinesText("CLAY_ROCKET_FUEL_GENERATOR");
+ }
+
+ @Override
+ public ItemStack getProgressBar() {
+ return new ItemStack(Material.REDSTONE_TORCH);
+ }
+
+ @Override
+ public int getEnergyConsumption() {
+ return 64;
+ }
+
+ @Override
+ public int getSpeed() {
+ return 1;
+ }
+
+ @Override
+ public String getMachineIdentifier() {
+ return "CLAY_ROCKET_FUEL_GENERATOR";
+ }
+
+ @Override
+ public void registerDefaultRecipes() {
+ this.registerRecipe(8, ClayTechMachineRecipes.MIXED_ROCKET_FUEL,
+ new ItemStack[]{ClayTechItems.MIXED_ROCKET_FUEL});
+ }
+
+ @Override
+ public int getCapacity() {
+ return 256;
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/machines/RocketFuelInjector.java b/src/main/java/club/claycoffee/ClayTech/implementation/machines/RocketFuelInjector.java
index 11ec788..7c03734 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/machines/RocketFuelInjector.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/machines/RocketFuelInjector.java
@@ -1,18 +1,5 @@
package club.claycoffee.ClayTech.implementation.machines;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.bukkit.Bukkit;
-import org.bukkit.Material;
-import org.bukkit.block.Block;
-import org.bukkit.entity.Player;
-import org.bukkit.event.inventory.InventoryClickEvent;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.scheduler.BukkitRunnable;
-
import club.claycoffee.ClayTech.ClayTech;
import club.claycoffee.ClayTech.ClayTechData;
import club.claycoffee.ClayTech.ClayTechItems;
@@ -26,8 +13,8 @@
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
-import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler;
+import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
@@ -39,234 +26,244 @@
import me.mrCookieSlime.Slimefun.api.energy.ChargableBlock;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset;
+import org.bukkit.Bukkit;
+import org.bukkit.Material;
+import org.bukkit.block.Block;
+import org.bukkit.entity.Player;
+import org.bukkit.event.inventory.InventoryClickEvent;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.scheduler.BukkitRunnable;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
public class RocketFuelInjector extends SlimefunItem implements InventoryBlock, EnergyNetComponent {
- public static Map processing = new HashMap<>();
- public static Map progress = new HashMap<>();
- public final static int[] inputslots = new int[] { 20, 24 };
- public final static int[] outputslots = new int[] {};
-
- protected final List recipes = new ArrayList<>();
-
- private static final int[] BORDER_A = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 13, 31, 17, 18, 26, 27, 35, 36, 37, 38, 39,
- 40, 41, 42, 43, 44 };
- private static final int[] BORDER_B = { 10, 11, 12, 19, 21, 28, 29, 30, 14, 15, 16, 23, 25, 32, 33, 34 };
- private static final ItemStack BORDER_A_ITEM = Utils.newItemD(Material.LIGHT_BLUE_STAINED_GLASS_PANE,
- Lang.readMachinesText("SPLIT_LINE"));
- private static final ItemStack BORDER_B_ITEM = Utils.newItemD(Material.LIME_STAINED_GLASS_PANE,
- Lang.readMachinesText("SPLIT_LINE"));
- private ItemStack item;
- private ItemStack itemfuel;
-
- public RocketFuelInjector(Category category, SlimefunItemStack item, String id, RecipeType recipeType,
- ItemStack[] recipe) {
-
- super(category, item, recipeType, recipe);
- createPreset(this, getInventoryTitle(), this::SetupMenu);
-
- registerBlockHandler(id, (p, b, tool, reason) -> {
- BlockMenu inv = BlockStorage.getInventory(b);
- if (inv != null) {
- for (int slot : getInputSlots()) {
- if (inv.getItemInSlot(slot) != null) {
- if (inv.getItemInSlot(slot).getType() != Material.BEDROCK) {
- b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
- inv.replaceExistingItem(slot, null);
- }
- }
- }
-
- for (int slot : getOutputSlots()) {
- if (inv.getItemInSlot(slot) != null) {
- b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
- inv.replaceExistingItem(slot, null);
- }
- }
- }
-
- progress.remove(b);
- processing.remove(b);
- return true;
- });
- }
-
- @Override
- public EnergyNetComponentType getEnergyComponentType() {
- return EnergyNetComponentType.CONSUMER;
- }
-
- @Override
- public int getCapacity() {
- return 256;
- }
-
- @Override
- public int[] getInputSlots() {
- return inputslots;
- }
-
- @Override
- public int[] getOutputSlots() {
- return outputslots;
- }
-
- public String getInventoryTitle() {
- return Lang.readMachinesText("CLAY_ROCKET_FUEL_INJECTOR");
- }
-
- public ItemStack getProgressBar() {
- return new ItemStack(Material.REDSTONE_TORCH);
- }
-
- public int getEnergyConsumption() {
- return 64;
- }
-
- public int getSpeed() {
- return 1;
- }
-
- public String getMachineIdentifier() {
- return "CLAY_ROCKET_FUEL_INJECTOR";
- }
-
- public void SetupMenu(BlockMenuPreset Preset) {
- Preset.addItem(43, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
- Preset.addItem(43, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
- Preset.addItem(5, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
- for (int eachID : BORDER_A) {
- Preset.addItem(eachID, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
- }
- for (int eachID : BORDER_B) {
- Preset.addItem(eachID, BORDER_B_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
- }
- Preset.addItem(22, Utils.addLore(Utils.newItemD(Material.BLACK_STAINED_GLASS_PANE, "§9§l←"), " "),
- ChestMenuUtils.getEmptyClickHandler());
-
- Preset.addItem(5, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
- Preset.addItem(43, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
- for (int i : getOutputSlots()) {
- Preset.addMenuClickHandler(i, new AdvancedMenuClickHandler() {
-
- @Override
- public boolean onClick(Player p, int slot, ItemStack cursor, ClickAction action) {
- return false;
- }
-
- @Override
- public boolean onClick(InventoryClickEvent e, Player p, int slot, ItemStack cursor,
- ClickAction action) {
- return cursor == null || cursor.getType() == null || cursor.getType() == Material.AIR;
- }
- });
- }
- Preset.addItem(43, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
- }
-
- public MachineRecipe getProcessing(Block b) {
- return processing.get(b);
- }
-
- public boolean isProcessing(Block b) {
- return getProcessing(b) != null;
- }
-
- public void registerRecipe(MachineRecipe recipe) {
- recipe.setTicks(recipe.getTicks() / getSpeed());
- recipes.add(recipe);
- }
-
- public void registerRecipe(int seconds, ItemStack[] input, ItemStack[] output) {
- registerRecipe(new MachineRecipe(seconds, input, output));
- }
-
- @Override
- public void preRegister() {
- addItemHandler(new BlockTicker() {
- @Override
- public void tick(Block b, SlimefunItem sf, Config data) {
- RocketFuelInjector.this.tick(b);
- }
-
- @Override
- public boolean isSynchronized() {
- return false;
- }
- });
- }
-
- protected void tick(Block b) {
- BlockMenu inv = BlockStorage.getInventory(b);
- // 机器正在处理
- if (isProcessing(b)) {
- // 剩余时间
- int timeleft = progress.get(b);
-
- if (timeleft > 0) {
- // 还在处理
- ChestMenuUtils.updateProgressbar(inv, 22, timeleft, processing.get(b).getTicks(), getProgressBar());
-
- if (ChargableBlock.isChargable(b)) {
- if (ChargableBlock.getCharge(b) < getEnergyConsumption())
- return;
- ChargableBlock.addCharge(b, -getEnergyConsumption());
- progress.put(b, timeleft - 1);
- } else
- progress.put(b, timeleft - 1);
- } else {
- // 处理结束
- inv.replaceExistingItem(22,
- Utils.addLore(Utils.newItemD(Material.BLACK_STAINED_GLASS_PANE, "§9§l←"), " "));
-
- ItemStack rocket = item;
- if (RocketUtils.getFuel(rocket) + 5 > RocketUtils.getMaxFuel(rocket)) {
- RocketUtils.setFuel(rocket, RocketUtils.getMaxFuel(rocket));
- } else {
- RocketUtils.setFuel(rocket, RocketUtils.getFuel(rocket) + 5);
- }
- new BukkitRunnable() {
-
- @Override
- public void run() {
- Bukkit.getPluginManager().callEvent(new RocketInjectFuelEvent(b, itemfuel, rocket));
- }
-
- }.runTask(ClayTech.getInstance());
- inv.replaceExistingItem(20, rocket);
- ClayTechData.RunningInjectors.remove(inv.toInventory());
- progress.remove(b);
- processing.remove(b);
- }
- } else {
- // 没有在处理
- ItemStack rocket = inv.getItemInSlot(20);
- ItemStack fuel = inv.getItemInSlot(24);
- if (rocket != null && fuel != null) {
- if (ClayTechManager.isRocket(rocket)
- && SlimefunUtils.isItemSimilar(fuel, ClayTechItems.MIXED_ROCKET_FUEL, true)
- && rocket.getAmount() == 1) {
- if (ChargableBlock.isChargable(b)) {
- if (ChargableBlock.getCharge(b) < getEnergyConsumption())
- return;
- ChargableBlock.addCharge(b, -getEnergyConsumption());
- }
- if (RocketUtils.getFuel(rocket) == RocketUtils.getMaxFuel(rocket))
- return;
- itemfuel = fuel.clone();
- itemfuel.setAmount(1);
-
- inv.consumeItem(24, 1);
-
- MachineRecipe fuelinjectrecipe = new MachineRecipe(8, new ItemStack[] { rocket, fuel },
- new ItemStack[] {});
- item = rocket.clone();
- inv.consumeItem(20, 1);
- ClayTechData.RunningInjectors.put(inv.toInventory(), b);
- inv.replaceExistingItem(20, new ItemStack(Material.BEDROCK));
- processing.put(b, fuelinjectrecipe);
- progress.put(b, fuelinjectrecipe.getTicks());
- }
- }
- }
- }
+ public final static int[] inputslots = new int[]{20, 24};
+ public final static int[] outputslots = new int[]{};
+ private static final int[] BORDER_A = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 13, 31, 17, 18, 26, 27, 35, 36, 37, 38, 39,
+ 40, 41, 42, 43, 44};
+ private static final int[] BORDER_B = {10, 11, 12, 19, 21, 28, 29, 30, 14, 15, 16, 23, 25, 32, 33, 34};
+ private static final ItemStack BORDER_A_ITEM = Utils.newItemD(Material.LIGHT_BLUE_STAINED_GLASS_PANE,
+ Lang.readMachinesText("SPLIT_LINE"));
+ private static final ItemStack BORDER_B_ITEM = Utils.newItemD(Material.LIME_STAINED_GLASS_PANE,
+ Lang.readMachinesText("SPLIT_LINE"));
+ public static Map processing = new HashMap<>();
+ public static Map progress = new HashMap<>();
+ protected final List recipes = new ArrayList<>();
+ private ItemStack item;
+ private ItemStack itemfuel;
+
+ public RocketFuelInjector(Category category, SlimefunItemStack item, String id, RecipeType recipeType,
+ ItemStack[] recipe) {
+
+ super(category, item, recipeType, recipe);
+ createPreset(this, getInventoryTitle(), this::SetupMenu);
+
+ registerBlockHandler(id, (p, b, tool, reason) -> {
+ BlockMenu inv = BlockStorage.getInventory(b);
+ if (inv != null) {
+ for (int slot : getInputSlots()) {
+ if (inv.getItemInSlot(slot) != null) {
+ if (inv.getItemInSlot(slot).getType() != Material.BEDROCK) {
+ b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
+ inv.replaceExistingItem(slot, null);
+ }
+ }
+ }
+
+ for (int slot : getOutputSlots()) {
+ if (inv.getItemInSlot(slot) != null) {
+ b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
+ inv.replaceExistingItem(slot, null);
+ }
+ }
+ }
+
+ progress.remove(b);
+ processing.remove(b);
+ return true;
+ });
+ }
+
+ @Override
+ public EnergyNetComponentType getEnergyComponentType() {
+ return EnergyNetComponentType.CONSUMER;
+ }
+
+ @Override
+ public int getCapacity() {
+ return 256;
+ }
+
+ @Override
+ public int[] getInputSlots() {
+ return inputslots;
+ }
+
+ @Override
+ public int[] getOutputSlots() {
+ return outputslots;
+ }
+
+ public String getInventoryTitle() {
+ return Lang.readMachinesText("CLAY_ROCKET_FUEL_INJECTOR");
+ }
+
+ public ItemStack getProgressBar() {
+ return new ItemStack(Material.REDSTONE_TORCH);
+ }
+
+ public int getEnergyConsumption() {
+ return 64;
+ }
+
+ public int getSpeed() {
+ return 1;
+ }
+
+ public String getMachineIdentifier() {
+ return "CLAY_ROCKET_FUEL_INJECTOR";
+ }
+
+ public void SetupMenu(BlockMenuPreset Preset) {
+ Preset.addItem(43, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
+ Preset.addItem(43, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
+ Preset.addItem(5, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
+ for (int eachID : BORDER_A) {
+ Preset.addItem(eachID, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
+ }
+ for (int eachID : BORDER_B) {
+ Preset.addItem(eachID, BORDER_B_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
+ }
+ Preset.addItem(22, Utils.addLore(Utils.newItemD(Material.BLACK_STAINED_GLASS_PANE, "§9§l←"), " "),
+ ChestMenuUtils.getEmptyClickHandler());
+
+ Preset.addItem(5, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
+ Preset.addItem(43, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
+ for (int i : getOutputSlots()) {
+ Preset.addMenuClickHandler(i, new AdvancedMenuClickHandler() {
+
+ @Override
+ public boolean onClick(Player p, int slot, ItemStack cursor, ClickAction action) {
+ return false;
+ }
+
+ @Override
+ public boolean onClick(InventoryClickEvent e, Player p, int slot, ItemStack cursor,
+ ClickAction action) {
+ return cursor == null || cursor.getType() == null || cursor.getType() == Material.AIR;
+ }
+ });
+ }
+ Preset.addItem(43, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
+ }
+
+ public MachineRecipe getProcessing(Block b) {
+ return processing.get(b);
+ }
+
+ public boolean isProcessing(Block b) {
+ return getProcessing(b) != null;
+ }
+
+ public void registerRecipe(MachineRecipe recipe) {
+ recipe.setTicks(recipe.getTicks() / getSpeed());
+ recipes.add(recipe);
+ }
+
+ public void registerRecipe(int seconds, ItemStack[] input, ItemStack[] output) {
+ registerRecipe(new MachineRecipe(seconds, input, output));
+ }
+
+ @Override
+ public void preRegister() {
+ addItemHandler(new BlockTicker() {
+ @Override
+ public void tick(Block b, SlimefunItem sf, Config data) {
+ RocketFuelInjector.this.tick(b);
+ }
+
+ @Override
+ public boolean isSynchronized() {
+ return false;
+ }
+ });
+ }
+
+ protected void tick(Block b) {
+ BlockMenu inv = BlockStorage.getInventory(b);
+ // 机器正在处理
+ if (isProcessing(b)) {
+ // 剩余时间
+ int timeleft = progress.get(b);
+
+ if (timeleft > 0) {
+ // 还在处理
+ ChestMenuUtils.updateProgressbar(inv, 22, timeleft, processing.get(b).getTicks(), getProgressBar());
+
+ if (ChargableBlock.isChargable(b)) {
+ if (ChargableBlock.getCharge(b) < getEnergyConsumption())
+ return;
+ ChargableBlock.addCharge(b, -getEnergyConsumption());
+ progress.put(b, timeleft - 1);
+ } else
+ progress.put(b, timeleft - 1);
+ } else {
+ // 处理结束
+ inv.replaceExistingItem(22,
+ Utils.addLore(Utils.newItemD(Material.BLACK_STAINED_GLASS_PANE, "§9§l←"), " "));
+
+ ItemStack rocket = item;
+ if (RocketUtils.getFuel(rocket) + 5 > RocketUtils.getMaxFuel(rocket)) {
+ RocketUtils.setFuel(rocket, RocketUtils.getMaxFuel(rocket));
+ } else {
+ RocketUtils.setFuel(rocket, RocketUtils.getFuel(rocket) + 5);
+ }
+ new BukkitRunnable() {
+
+ @Override
+ public void run() {
+ Bukkit.getPluginManager().callEvent(new RocketInjectFuelEvent(b, itemfuel, rocket));
+ }
+
+ }.runTask(ClayTech.getInstance());
+ inv.replaceExistingItem(20, rocket);
+ ClayTechData.RunningInjectors.remove(inv.toInventory());
+ progress.remove(b);
+ processing.remove(b);
+ }
+ } else {
+ // 没有在处理
+ ItemStack rocket = inv.getItemInSlot(20);
+ ItemStack fuel = inv.getItemInSlot(24);
+ if (rocket != null && fuel != null) {
+ if (ClayTechManager.isRocket(rocket)
+ && SlimefunUtils.isItemSimilar(fuel, ClayTechItems.MIXED_ROCKET_FUEL, true)
+ && rocket.getAmount() == 1) {
+ if (ChargableBlock.isChargable(b)) {
+ if (ChargableBlock.getCharge(b) < getEnergyConsumption())
+ return;
+ ChargableBlock.addCharge(b, -getEnergyConsumption());
+ }
+ if (RocketUtils.getFuel(rocket) == RocketUtils.getMaxFuel(rocket))
+ return;
+ itemfuel = fuel.clone();
+ itemfuel.setAmount(1);
+
+ inv.consumeItem(24, 1);
+
+ MachineRecipe fuelinjectrecipe = new MachineRecipe(8, new ItemStack[]{rocket, fuel},
+ new ItemStack[]{});
+ item = rocket.clone();
+ inv.consumeItem(20, 1);
+ ClayTechData.RunningInjectors.put(inv.toInventory(), b);
+ inv.replaceExistingItem(20, new ItemStack(Material.BEDROCK));
+ processing.put(b, fuelinjectrecipe);
+ progress.put(b, fuelinjectrecipe.getTicks());
+ }
+ }
+ }
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/machines/SpaceSuitOxygenInjector.java b/src/main/java/club/claycoffee/ClayTech/implementation/machines/SpaceSuitOxygenInjector.java
index da369f0..8789873 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/machines/SpaceSuitOxygenInjector.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/machines/SpaceSuitOxygenInjector.java
@@ -1,19 +1,5 @@
package club.claycoffee.ClayTech.implementation.machines;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.bukkit.Bukkit;
-import org.bukkit.Material;
-import org.bukkit.block.Block;
-import org.bukkit.entity.Player;
-import org.bukkit.event.inventory.InventoryClickEvent;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.scheduler.BukkitRunnable;
-
import club.claycoffee.ClayTech.ClayTech;
import club.claycoffee.ClayTech.ClayTechData;
import club.claycoffee.ClayTech.api.ClayTechManager;
@@ -25,8 +11,8 @@
import io.github.thebusybiscuit.slimefun4.core.networks.energy.EnergyNetComponentType;
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
-import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler;
+import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
@@ -38,242 +24,249 @@
import me.mrCookieSlime.Slimefun.api.energy.ChargableBlock;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset;
+import org.bukkit.Bukkit;
+import org.bukkit.Material;
+import org.bukkit.block.Block;
+import org.bukkit.entity.Player;
+import org.bukkit.event.inventory.InventoryClickEvent;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.scheduler.BukkitRunnable;
+
+import java.util.*;
public class SpaceSuitOxygenInjector extends SlimefunItem implements InventoryBlock, EnergyNetComponent {
- public static Map processing = new HashMap<>();
- public static Map progress = new HashMap<>();
- public final static int[] inputslots = new int[] { 22 };
- public final static int[] outputslots = new int[] {};
-
- protected final List recipes = new ArrayList<>();
-
- private static final int[] BORDER_A = { 0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 15, 16, 17, 18, 19, 20, 24, 25, 26, 27,
- 28, 29, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44 };
- private static final int[] BORDER_B = { 12, 13, 14, 21, 23, 30, 31, 32 };
- private static final ItemStack BORDER_A_ITEM = Utils.newItemD(Material.LIGHT_BLUE_STAINED_GLASS_PANE,
- Lang.readMachinesText("SPLIT_LINE"));
- private static final ItemStack BORDER_B_ITEM = Utils.newItemD(Material.LIME_STAINED_GLASS_PANE,
- Lang.readMachinesText("SPLIT_LINE"));
- private static final List LEAVES = Arrays
- .asList(new Material[] { Material.OAK_LEAVES, Material.ACACIA_LEAVES, Material.BIRCH_LEAVES,
- Material.DARK_OAK_LEAVES, Material.JUNGLE_LEAVES, Material.SPRUCE_LEAVES });
- private ItemStack item;
-
- public SpaceSuitOxygenInjector(Category category, SlimefunItemStack item, String id, RecipeType recipeType,
- ItemStack[] recipe) {
-
- super(category, item, recipeType, recipe);
- createPreset(this, getInventoryTitle(), this::SetupMenu);
-
- registerBlockHandler(id, (p, b, tool, reason) -> {
- BlockMenu inv = BlockStorage.getInventory(b);
- if (inv != null) {
- for (int slot : getInputSlots()) {
- if (inv.getItemInSlot(slot) != null) {
- if (inv.getItemInSlot(slot).getType() != Material.BEDROCK) {
- b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
- inv.replaceExistingItem(slot, null);
- }
- }
- }
-
- for (int slot : getOutputSlots()) {
- if (inv.getItemInSlot(slot) != null) {
- b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
- inv.replaceExistingItem(slot, null);
- }
- }
- }
-
- progress.remove(b);
- processing.remove(b);
- return true;
- });
- }
-
- @Override
- public EnergyNetComponentType getEnergyComponentType() {
- return EnergyNetComponentType.CONSUMER;
- }
-
- @Override
- public int getCapacity() {
- return 256;
- }
-
- @Override
- public int[] getInputSlots() {
- return inputslots;
- }
-
- @Override
- public int[] getOutputSlots() {
- return outputslots;
- }
-
- public String getInventoryTitle() {
- return Lang.readMachinesText("CLAY_SPACESUIT_OXYGEN_INJECTOR");
- }
-
- public ItemStack getProgressBar() {
- return new ItemStack(Material.REDSTONE_TORCH);
- }
-
- public int getEnergyConsumption() {
- return 80;
- }
-
- public int getSpeed() {
- return 1;
- }
-
- public String getMachineIdentifier() {
- return "CLAY_SPACESUIT_OXYGEN_INJECTOR";
- }
-
- public void SetupMenu(BlockMenuPreset Preset) {
- Preset.addItem(43, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
- Preset.addItem(43, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
- Preset.addItem(5, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
- for (int eachID : BORDER_A) {
- Preset.addItem(eachID, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
- }
- for (int eachID : BORDER_B) {
- Preset.addItem(eachID, BORDER_B_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
- }
- Preset.addItem(4, Utils.addLore(Utils.newItem(Material.BLACK_STAINED_GLASS_PANE), " "),
- ChestMenuUtils.getEmptyClickHandler());
-
- Preset.addItem(5, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
- Preset.addItem(43, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
- for (int i : getOutputSlots()) {
- Preset.addMenuClickHandler(i, new AdvancedMenuClickHandler() {
-
- @Override
- public boolean onClick(Player p, int slot, ItemStack cursor, ClickAction action) {
- return false;
- }
-
- @Override
- public boolean onClick(InventoryClickEvent e, Player p, int slot, ItemStack cursor,
- ClickAction action) {
- return cursor == null || cursor.getType() == null || cursor.getType() == Material.AIR;
- }
- });
- }
- Preset.addItem(43, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
- }
-
- public MachineRecipe getProcessing(Block b) {
- return processing.get(b);
- }
-
- public boolean isProcessing(Block b) {
- return getProcessing(b) != null;
- }
-
- public void registerRecipe(MachineRecipe recipe) {
- recipe.setTicks(recipe.getTicks() / getSpeed());
- recipes.add(recipe);
- }
-
- public void registerRecipe(int seconds, ItemStack[] input, ItemStack[] output) {
- registerRecipe(new MachineRecipe(seconds, input, output));
- }
-
- @Override
- public void preRegister() {
- addItemHandler(new BlockTicker() {
- @Override
- public void tick(Block b, SlimefunItem sf, Config data) {
- SpaceSuitOxygenInjector.this.tick(b);
- }
-
- @Override
- public boolean isSynchronized() {
- return false;
- }
- });
- }
-
- protected void tick(Block b) {
- BlockMenu inv = BlockStorage.getInventory(b);
- // 机器正在处理
- if (isProcessing(b)) {
- // 剩余时间
- int timeleft = progress.get(b);
-
- if (timeleft > 0) {
- // 还在处理
- ChestMenuUtils.updateProgressbar(inv, 4, timeleft, processing.get(b).getTicks(), getProgressBar());
-
- if (ChargableBlock.isChargable(b)) {
- if (ChargableBlock.getCharge(b) < getEnergyConsumption())
- return;
- ChargableBlock.addCharge(b, -getEnergyConsumption());
- progress.put(b, timeleft - 1);
- } else {
- if (!LEAVES.contains(b.getLocation().add(0, 1, 0).getBlock().getType()))
- return;
- progress.put(b, timeleft - 1);
- }
- } else {
- // 处理结束
- inv.replaceExistingItem(4, Utils.addLore(Utils.newItem(Material.BLACK_STAINED_GLASS_PANE), " "));
-
- ItemStack spacesuit = item;
- if (RocketUtils.getOxygen(spacesuit) + 5 > RocketUtils.getMaxOxygen(spacesuit)) {
- RocketUtils.setOxygen(spacesuit, RocketUtils.getMaxOxygen(spacesuit));
- } else {
- RocketUtils.setOxygen(spacesuit, RocketUtils.getOxygen(spacesuit) + 5);
- }
- new BukkitRunnable() {
-
- @Override
- public void run() {
- Bukkit.getPluginManager().callEvent(new InjectOxygenEvent(b, spacesuit));
-
- }
-
- }.runTask(ClayTech.getInstance());
- inv.replaceExistingItem(22, spacesuit);
- ClayTechData.RunningInjectorsOxygen.remove(inv.toInventory());
- progress.remove(b);
- processing.remove(b);
- }
- } else {
- // 没有在处理
- ItemStack spacesuit = inv.getItemInSlot(22);
- if (spacesuit != null) {
- if (ClayTechManager.isSpaceSuit(spacesuit) && spacesuit.getAmount() == 1
- || ClayTechManager.isOxygenDistributer(spacesuit) && spacesuit.getAmount() == 1) {
- if (ChargableBlock.isChargable(b)) {
- if (ChargableBlock.getCharge(b) < getEnergyConsumption())
- return;
- ChargableBlock.addCharge(b, -getEnergyConsumption());
- }
- if (!LEAVES.contains(b.getLocation().add(0, 1, 0).getBlock().getType()))
- return;
- if (RocketUtils.getOxygen(spacesuit) >= RocketUtils.getMaxOxygen(spacesuit))
- return;
- new BukkitRunnable() {
-
- @Override
- public void run() {
- b.getLocation().add(0, 1, 0).getBlock().setType(Material.AIR); // 消耗树叶
- }
-
- }.runTask(ClayTech.getInstance());
- MachineRecipe oxygeninjectrecipe = new MachineRecipe(8, new ItemStack[] { spacesuit },
- new ItemStack[] {});
- item = spacesuit.clone();
- inv.consumeItem(22, 1);
- ClayTechData.RunningInjectorsOxygen.put(inv.toInventory(), b);
- inv.replaceExistingItem(22, new ItemStack(Material.BEDROCK));
- processing.put(b, oxygeninjectrecipe);
- progress.put(b, oxygeninjectrecipe.getTicks());
- }
- }
- }
- }
+ public final static int[] inputslots = new int[]{22};
+ public final static int[] outputslots = new int[]{};
+ private static final int[] BORDER_A = {0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 15, 16, 17, 18, 19, 20, 24, 25, 26, 27,
+ 28, 29, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44};
+ private static final int[] BORDER_B = {12, 13, 14, 21, 23, 30, 31, 32};
+ private static final ItemStack BORDER_A_ITEM = Utils.newItemD(Material.LIGHT_BLUE_STAINED_GLASS_PANE,
+ Lang.readMachinesText("SPLIT_LINE"));
+ private static final ItemStack BORDER_B_ITEM = Utils.newItemD(Material.LIME_STAINED_GLASS_PANE,
+ Lang.readMachinesText("SPLIT_LINE"));
+ private static final List LEAVES = Arrays
+ .asList(new Material[]{Material.OAK_LEAVES, Material.ACACIA_LEAVES, Material.BIRCH_LEAVES,
+ Material.DARK_OAK_LEAVES, Material.JUNGLE_LEAVES, Material.SPRUCE_LEAVES});
+ public static Map processing = new HashMap<>();
+ public static Map progress = new HashMap<>();
+ protected final List recipes = new ArrayList<>();
+ private ItemStack item;
+
+ public SpaceSuitOxygenInjector(Category category, SlimefunItemStack item, String id, RecipeType recipeType,
+ ItemStack[] recipe) {
+
+ super(category, item, recipeType, recipe);
+ createPreset(this, getInventoryTitle(), this::SetupMenu);
+
+ registerBlockHandler(id, (p, b, tool, reason) -> {
+ BlockMenu inv = BlockStorage.getInventory(b);
+ if (inv != null) {
+ for (int slot : getInputSlots()) {
+ if (inv.getItemInSlot(slot) != null) {
+ if (inv.getItemInSlot(slot).getType() != Material.BEDROCK) {
+ b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
+ inv.replaceExistingItem(slot, null);
+ }
+ }
+ }
+
+ for (int slot : getOutputSlots()) {
+ if (inv.getItemInSlot(slot) != null) {
+ b.getWorld().dropItemNaturally(b.getLocation(), inv.getItemInSlot(slot));
+ inv.replaceExistingItem(slot, null);
+ }
+ }
+ }
+
+ progress.remove(b);
+ processing.remove(b);
+ return true;
+ });
+ }
+
+ @Override
+ public EnergyNetComponentType getEnergyComponentType() {
+ return EnergyNetComponentType.CONSUMER;
+ }
+
+ @Override
+ public int getCapacity() {
+ return 256;
+ }
+
+ @Override
+ public int[] getInputSlots() {
+ return inputslots;
+ }
+
+ @Override
+ public int[] getOutputSlots() {
+ return outputslots;
+ }
+
+ public String getInventoryTitle() {
+ return Lang.readMachinesText("CLAY_SPACESUIT_OXYGEN_INJECTOR");
+ }
+
+ public ItemStack getProgressBar() {
+ return new ItemStack(Material.REDSTONE_TORCH);
+ }
+
+ public int getEnergyConsumption() {
+ return 80;
+ }
+
+ public int getSpeed() {
+ return 1;
+ }
+
+ public String getMachineIdentifier() {
+ return "CLAY_SPACESUIT_OXYGEN_INJECTOR";
+ }
+
+ public void SetupMenu(BlockMenuPreset Preset) {
+ Preset.addItem(43, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
+ Preset.addItem(43, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
+ Preset.addItem(5, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
+ for (int eachID : BORDER_A) {
+ Preset.addItem(eachID, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
+ }
+ for (int eachID : BORDER_B) {
+ Preset.addItem(eachID, BORDER_B_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
+ }
+ Preset.addItem(4, Utils.addLore(Utils.newItem(Material.BLACK_STAINED_GLASS_PANE), " "),
+ ChestMenuUtils.getEmptyClickHandler());
+
+ Preset.addItem(5, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
+ Preset.addItem(43, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
+ for (int i : getOutputSlots()) {
+ Preset.addMenuClickHandler(i, new AdvancedMenuClickHandler() {
+
+ @Override
+ public boolean onClick(Player p, int slot, ItemStack cursor, ClickAction action) {
+ return false;
+ }
+
+ @Override
+ public boolean onClick(InventoryClickEvent e, Player p, int slot, ItemStack cursor,
+ ClickAction action) {
+ return cursor == null || cursor.getType() == null || cursor.getType() == Material.AIR;
+ }
+ });
+ }
+ Preset.addItem(43, BORDER_A_ITEM.clone(), ChestMenuUtils.getEmptyClickHandler());
+ }
+
+ public MachineRecipe getProcessing(Block b) {
+ return processing.get(b);
+ }
+
+ public boolean isProcessing(Block b) {
+ return getProcessing(b) != null;
+ }
+
+ public void registerRecipe(MachineRecipe recipe) {
+ recipe.setTicks(recipe.getTicks() / getSpeed());
+ recipes.add(recipe);
+ }
+
+ public void registerRecipe(int seconds, ItemStack[] input, ItemStack[] output) {
+ registerRecipe(new MachineRecipe(seconds, input, output));
+ }
+
+ @Override
+ public void preRegister() {
+ addItemHandler(new BlockTicker() {
+ @Override
+ public void tick(Block b, SlimefunItem sf, Config data) {
+ SpaceSuitOxygenInjector.this.tick(b);
+ }
+
+ @Override
+ public boolean isSynchronized() {
+ return false;
+ }
+ });
+ }
+
+ protected void tick(Block b) {
+ BlockMenu inv = BlockStorage.getInventory(b);
+ // 机器正在处理
+ if (isProcessing(b)) {
+ // 剩余时间
+ int timeleft = progress.get(b);
+
+ if (timeleft > 0) {
+ // 还在处理
+ ChestMenuUtils.updateProgressbar(inv, 4, timeleft, processing.get(b).getTicks(), getProgressBar());
+
+ if (ChargableBlock.isChargable(b)) {
+ if (ChargableBlock.getCharge(b) < getEnergyConsumption())
+ return;
+ ChargableBlock.addCharge(b, -getEnergyConsumption());
+ progress.put(b, timeleft - 1);
+ } else {
+ if (!LEAVES.contains(b.getLocation().add(0, 1, 0).getBlock().getType()))
+ return;
+ progress.put(b, timeleft - 1);
+ }
+ } else {
+ // 处理结束
+ inv.replaceExistingItem(4, Utils.addLore(Utils.newItem(Material.BLACK_STAINED_GLASS_PANE), " "));
+
+ ItemStack spacesuit = item;
+ if (RocketUtils.getOxygen(spacesuit) + 5 > RocketUtils.getMaxOxygen(spacesuit)) {
+ RocketUtils.setOxygen(spacesuit, RocketUtils.getMaxOxygen(spacesuit));
+ } else {
+ RocketUtils.setOxygen(spacesuit, RocketUtils.getOxygen(spacesuit) + 5);
+ }
+ new BukkitRunnable() {
+
+ @Override
+ public void run() {
+ Bukkit.getPluginManager().callEvent(new InjectOxygenEvent(b, spacesuit));
+
+ }
+
+ }.runTask(ClayTech.getInstance());
+ inv.replaceExistingItem(22, spacesuit);
+ ClayTechData.RunningInjectorsOxygen.remove(inv.toInventory());
+ progress.remove(b);
+ processing.remove(b);
+ }
+ } else {
+ // 没有在处理
+ ItemStack spacesuit = inv.getItemInSlot(22);
+ if (spacesuit != null) {
+ if (ClayTechManager.isSpaceSuit(spacesuit) && spacesuit.getAmount() == 1
+ || ClayTechManager.isOxygenDistributer(spacesuit) && spacesuit.getAmount() == 1) {
+ if (ChargableBlock.isChargable(b)) {
+ if (ChargableBlock.getCharge(b) < getEnergyConsumption())
+ return;
+ ChargableBlock.addCharge(b, -getEnergyConsumption());
+ }
+ if (!LEAVES.contains(b.getLocation().add(0, 1, 0).getBlock().getType()))
+ return;
+ if (RocketUtils.getOxygen(spacesuit) >= RocketUtils.getMaxOxygen(spacesuit))
+ return;
+ new BukkitRunnable() {
+
+ @Override
+ public void run() {
+ b.getLocation().add(0, 1, 0).getBlock().setType(Material.AIR); // 消耗树叶
+ }
+
+ }.runTask(ClayTech.getInstance());
+ MachineRecipe oxygeninjectrecipe = new MachineRecipe(8, new ItemStack[]{spacesuit},
+ new ItemStack[]{});
+ item = spacesuit.clone();
+ inv.consumeItem(22, 1);
+ ClayTechData.RunningInjectorsOxygen.put(inv.toInventory(), b);
+ inv.replaceExistingItem(22, new ItemStack(Material.BEDROCK));
+ processing.put(b, oxygeninjectrecipe);
+ progress.put(b, oxygeninjectrecipe.getTicks());
+ }
+ }
+ }
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/implementation/resources/ClayFuel.java b/src/main/java/club/claycoffee/ClayTech/implementation/resources/ClayFuel.java
index 2132f59..17c821a 100644
--- a/src/main/java/club/claycoffee/ClayTech/implementation/resources/ClayFuel.java
+++ b/src/main/java/club/claycoffee/ClayTech/implementation/resources/ClayFuel.java
@@ -1,60 +1,59 @@
package club.claycoffee.ClayTech.implementation.resources;
-import org.bukkit.NamespacedKey;
-import org.bukkit.World.Environment;
-import org.bukkit.block.Biome;
-import org.bukkit.inventory.ItemStack;
-import org.eclipse.jdt.annotation.NonNull;
-
import club.claycoffee.ClayTech.ClayTech;
import club.claycoffee.ClayTech.ClayTechItems;
import club.claycoffee.ClayTech.utils.Lang;
import club.claycoffee.ClayTech.utils.Slimefunutils;
import io.github.thebusybiscuit.slimefun4.api.geo.GEOResource;
+import org.bukkit.NamespacedKey;
+import org.bukkit.World.Environment;
+import org.bukkit.block.Biome;
+import org.bukkit.inventory.ItemStack;
+import org.eclipse.jdt.annotation.NonNull;
public class ClayFuel implements GEOResource {
- private final NamespacedKey key = new NamespacedKey(ClayTech.getInstance(), "CLAY_FUEL");
-
- public ClayFuel() {
- Slimefunutils.registerResource(this);
- }
-
- @Override
- public @NonNull NamespacedKey getKey() {
- return key;
- }
-
- @Override
- public int getDefaultSupply(Environment environment, Biome biome) {
- if (environment == Environment.NORMAL && biome == Biome.THE_END) {
- return 12;
- } else if (environment == Environment.NORMAL) {
- return 4;
- } else if (environment == Environment.NETHER) {
- return 5;
- } else {
- return 0;
- }
- }
-
- @Override
- public int getMaxDeviation() {
- return 2;
- }
-
- @Override
- public String getName() {
- return Lang.readResourcesText("CLAY_FUEL");
- }
-
- @Override
- public ItemStack getItem() {
- return ClayTechItems.CLAY_FUEL.clone();
- }
-
- @Override
- public boolean isObtainableFromGEOMiner() {
- return true;
- }
+ private final NamespacedKey key = new NamespacedKey(ClayTech.getInstance(), "CLAY_FUEL");
+
+ public ClayFuel() {
+ Slimefunutils.registerResource(this);
+ }
+
+ @Override
+ public @NonNull NamespacedKey getKey() {
+ return key;
+ }
+
+ @Override
+ public int getDefaultSupply(Environment environment, Biome biome) {
+ if (environment == Environment.NORMAL && biome == Biome.THE_END) {
+ return 12;
+ } else if (environment == Environment.NORMAL) {
+ return 4;
+ } else if (environment == Environment.NETHER) {
+ return 5;
+ } else {
+ return 0;
+ }
+ }
+
+ @Override
+ public int getMaxDeviation() {
+ return 2;
+ }
+
+ @Override
+ public String getName() {
+ return Lang.readResourcesText("CLAY_FUEL");
+ }
+
+ @Override
+ public ItemStack getItem() {
+ return ClayTechItems.CLAY_FUEL.clone();
+ }
+
+ @Override
+ public boolean isObtainableFromGEOMiner() {
+ return true;
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/listeners/Debug.java b/src/main/java/club/claycoffee/ClayTech/listeners/Debug.java
index 984b625..95d5318 100644
--- a/src/main/java/club/claycoffee/ClayTech/listeners/Debug.java
+++ b/src/main/java/club/claycoffee/ClayTech/listeners/Debug.java
@@ -1,28 +1,27 @@
package club.claycoffee.ClayTech.listeners;
+import club.claycoffee.ClayTech.ClayTech;
+import club.claycoffee.ClayTech.api.ClayTechManager;
+import club.claycoffee.ClayTech.utils.PlanetUtils;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.scheduler.BukkitRunnable;
-import club.claycoffee.ClayTech.ClayTech;
-import club.claycoffee.ClayTech.api.ClayTechManager;
-import club.claycoffee.ClayTech.utils.PlanetUtils;
-
public class Debug implements Listener {
- @EventHandler
- public void onWantTeleport(AsyncPlayerChatEvent e) {
- if (e.getMessage().equalsIgnoreCase("gomoon")) {
- new BukkitRunnable() {
+ @EventHandler
+ public void onWantTeleport(AsyncPlayerChatEvent e) {
+ if (e.getMessage().equalsIgnoreCase("gomoon")) {
+ new BukkitRunnable() {
- @Override
- public void run() {
- ClayTechManager.allowSpaceTeleportOnce(e.getPlayer());
- e.getPlayer().teleport(PlanetUtils.findSafeLocation(Bukkit.getWorld("CMars")));
- }
+ @Override
+ public void run() {
+ ClayTechManager.allowSpaceTeleportOnce(e.getPlayer());
+ e.getPlayer().teleport(PlanetUtils.findSafeLocation(Bukkit.getWorld("CMars")));
+ }
- }.runTask(ClayTech.getInstance());
- }
- }
+ }.runTask(ClayTech.getInstance());
+ }
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/listeners/FoodDropListener.java b/src/main/java/club/claycoffee/ClayTech/listeners/FoodDropListener.java
index 57683c3..6ec7cdf 100644
--- a/src/main/java/club/claycoffee/ClayTech/listeners/FoodDropListener.java
+++ b/src/main/java/club/claycoffee/ClayTech/listeners/FoodDropListener.java
@@ -1,5 +1,7 @@
package club.claycoffee.ClayTech.listeners;
+import club.claycoffee.ClayTech.ClayTechItems;
+import club.claycoffee.ClayTech.utils.Food;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
@@ -10,45 +12,42 @@
import org.bukkit.event.player.PlayerFishEvent.State;
import org.bukkit.inventory.ItemStack;
-import club.claycoffee.ClayTech.ClayTechItems;
-import club.claycoffee.ClayTech.utils.Food;
-
public class FoodDropListener implements Listener {
- @EventHandler(priority = EventPriority.HIGHEST)
- public void BlockBreakEvent(BlockBreakEvent e) {
- if (!e.isCancelled()) {
- if (e.getPlayer().getGameMode() == GameMode.SURVIVAL) {
- Food.CheckDestroy(e.getPlayer(), e.getBlock(), new ItemStack(Material.OAK_LEAVES),
- ClayTechItems.CLAY_LEMON, new ItemStack(Material.SHEARS), 10, e);
- try {
- // 这里放其他事件
- Food.CheckDestroy(e.getPlayer(), e.getBlock(), new ItemStack(Material.GRASS),
- ClayTechItems.DIRTY_TEA, new ItemStack(Material.SHEARS), 10, e);
- Food.CheckDestroy(e.getPlayer(), e.getBlock(), new ItemStack(Material.WHEAT), ClayTechItems.FLOUR,
- new ItemStack(Material.SHEARS), 15, 20, e);
- Food.CheckDestroy(e.getPlayer(), e.getBlock(), new ItemStack(Material.POTATOES),
- ClayTechItems.STARCH, new ItemStack(Material.SHEARS), 15, 20, e);
- Food.CheckDestroy(e.getPlayer(), e.getBlock(), new ItemStack(Material.POTATOES),
- ClayTechItems.CLAY_SWEET_POTATO, new ItemStack(Material.SHEARS), 25, 30, e);
- Food.CheckDestroy(e.getPlayer(), e.getBlock(), new ItemStack(Material.GRASS),
- ClayTechItems.GREEN_GRASS, new ItemStack(Material.SHEARS), 31, 40, e);
- } catch (NullPointerException err) {
- }
- }
- }
- }
+ @EventHandler(priority = EventPriority.HIGHEST)
+ public void BlockBreakEvent(BlockBreakEvent e) {
+ if (!e.isCancelled()) {
+ if (e.getPlayer().getGameMode() == GameMode.SURVIVAL) {
+ Food.CheckDestroy(e.getPlayer(), e.getBlock(), new ItemStack(Material.OAK_LEAVES),
+ ClayTechItems.CLAY_LEMON, new ItemStack(Material.SHEARS), 10, e);
+ try {
+ // 这里放其他事件
+ Food.CheckDestroy(e.getPlayer(), e.getBlock(), new ItemStack(Material.GRASS),
+ ClayTechItems.DIRTY_TEA, new ItemStack(Material.SHEARS), 10, e);
+ Food.CheckDestroy(e.getPlayer(), e.getBlock(), new ItemStack(Material.WHEAT), ClayTechItems.FLOUR,
+ new ItemStack(Material.SHEARS), 15, 20, e);
+ Food.CheckDestroy(e.getPlayer(), e.getBlock(), new ItemStack(Material.POTATOES),
+ ClayTechItems.STARCH, new ItemStack(Material.SHEARS), 15, 20, e);
+ Food.CheckDestroy(e.getPlayer(), e.getBlock(), new ItemStack(Material.POTATOES),
+ ClayTechItems.CLAY_SWEET_POTATO, new ItemStack(Material.SHEARS), 25, 30, e);
+ Food.CheckDestroy(e.getPlayer(), e.getBlock(), new ItemStack(Material.GRASS),
+ ClayTechItems.GREEN_GRASS, new ItemStack(Material.SHEARS), 31, 40, e);
+ } catch (NullPointerException err) {
+ }
+ }
+ }
+ }
- @EventHandler(priority = EventPriority.HIGHEST)
- public void PlayerFishEvent(PlayerFishEvent e) {
- if (e.getState() == State.CAUGHT_FISH) {
- Food.FishItemCheck(e, 1, 10, ClayTechItems.SNAIL_HEALTHY);
- try {
- // 这里放其他食物/饮料8!!
- Food.FishItemCheck(e, 11, 20, ClayTechItems.SNAIL_BAD);
- Food.FishItemCheck(e, 85, 92, ClayTechItems.TUNA_FISH);
- } catch (NullPointerException err) {
- }
+ @EventHandler(priority = EventPriority.HIGHEST)
+ public void PlayerFishEvent(PlayerFishEvent e) {
+ if (e.getState() == State.CAUGHT_FISH) {
+ Food.FishItemCheck(e, 1, 10, ClayTechItems.SNAIL_HEALTHY);
+ try {
+ // 这里放其他食物/饮料8!!
+ Food.FishItemCheck(e, 11, 20, ClayTechItems.SNAIL_BAD);
+ Food.FishItemCheck(e, 85, 92, ClayTechItems.TUNA_FISH);
+ } catch (NullPointerException err) {
+ }
- }
- }
+ }
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/listeners/FoodEatListener.java b/src/main/java/club/claycoffee/ClayTech/listeners/FoodEatListener.java
index 9a11cbe..290fca7 100644
--- a/src/main/java/club/claycoffee/ClayTech/listeners/FoodEatListener.java
+++ b/src/main/java/club/claycoffee/ClayTech/listeners/FoodEatListener.java
@@ -1,5 +1,7 @@
package club.claycoffee.ClayTech.listeners;
+import club.claycoffee.ClayTech.ClayTechItems;
+import club.claycoffee.ClayTech.utils.Food;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@@ -9,54 +11,51 @@
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
-import club.claycoffee.ClayTech.ClayTechItems;
-import club.claycoffee.ClayTech.utils.Food;
-
public class FoodEatListener implements Listener {
- @SuppressWarnings("deprecation")
- @EventHandler(priority = EventPriority.HIGHEST)
- public void PlayerInteractEvent(PlayerInteractEvent e) {
- if (e.getAction() == Action.RIGHT_CLICK_AIR) {
- Player p = e.getPlayer();
- if (e.hasItem()) {
- Food.DrinkCheck(p, e.getItem(), ClayTechItems.CLAY_COFFEE, 5,
- new PotionEffect[] { new PotionEffect(PotionEffectType.NIGHT_VISION, 3600, 1) });
- try {
- // 这里放其他食物/饮料8!!
- Food.DrinkCheck(p, e.getItem(), ClayTechItems.LEMON_POWDER_DRINK, 6,
- new PotionEffect[] { new PotionEffect(PotionEffectType.CONFUSION, 200, 3) });
- Food.DrinkCheck(p, e.getItem(), ClayTechItems.TEA_DRINK, 6,
- new PotionEffect[] { new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 600, 2) });
- Food.DrinkCheck(p, e.getItem(), ClayTechItems.LEMON_TEA_DRINK, 12,
- new PotionEffect[] { new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 1200, 2) });
- Food.FoodCheck(p, e.getItem(), ClayTechItems.CHICKEN_FOOT, 8);
- Food.FoodCheck(p, e.getItem(), ClayTechItems.RAW_BREAD, 4);
- Food.FoodCheck(p, e.getItem(), ClayTechItems.RAW_VEGETABLE, 1);
- Food.FoodCheck(p, e.getItem(), ClayTechItems.CLAY_LEMON, 1,
- new PotionEffect[] { new PotionEffect(PotionEffectType.CONFUSION, 200, 3) });
- Food.FoodCheck(p, e.getItem(), ClayTechItems.SPICY_CHICKEN_BURGER, 15,
- new PotionEffect[] { new PotionEffect(PotionEffectType.getById(5), 400, 1) });
- Food.FoodCheck(p, e.getItem(), ClayTechItems.BABA_BURGER, -15,
- new PotionEffect[] { new PotionEffect(PotionEffectType.POISON, 3600, 5) });
- Food.FoodCheck(p, e.getItem(), ClayTechItems.SNAIL_BAD, -20,
- new PotionEffect[] { new PotionEffect(PotionEffectType.POISON, 8000, 9) });
- Food.FoodCheck(p, e.getItem(), ClayTechItems.CHOCOLATE, 15,
- new PotionEffect[] { new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 600, 2) });
- Food.FoodCheck(p, e.getItem(), ClayTechItems.SNAIL_FOOD, 12,
- new PotionEffect[] { new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 600, 2) });
- Food.FoodCheck(p, e.getItem(), ClayTechItems.HONEY_SWEET, 8);
- Food.FoodCheck(p, e.getItem(), ClayTechItems.COOKED_SWEET_POTATO, 6);
- Food.FoodCheck(p, e.getItem(), ClayTechItems.TUNA_FISH, 6);
- Food.FoodCheck(p, e.getItem(), ClayTechItems.GREEN_GRASS, 1);
- } catch (NullPointerException err) {
- }
- Food.WashCheck(p, e.getItem(), ClayTechItems.DIRTY_DRINK_BOTTLE, ClayTechItems.DRINK_BOTTLE);
- try {
- // 这里放其他清理Event!!
- Food.WashCheck(p, e.getItem(), ClayTechItems.DIRTY_TEA, ClayTechItems.RAW_TEA);
- } catch (NullPointerException err) {
- }
- }
- }
- }
+ @SuppressWarnings("deprecation")
+ @EventHandler(priority = EventPriority.HIGHEST)
+ public void PlayerInteractEvent(PlayerInteractEvent e) {
+ if (e.getAction() == Action.RIGHT_CLICK_AIR) {
+ Player p = e.getPlayer();
+ if (e.hasItem()) {
+ Food.DrinkCheck(p, e.getItem(), ClayTechItems.CLAY_COFFEE, 5,
+ new PotionEffect[]{new PotionEffect(PotionEffectType.NIGHT_VISION, 3600, 1)});
+ try {
+ // 这里放其他食物/饮料8!!
+ Food.DrinkCheck(p, e.getItem(), ClayTechItems.LEMON_POWDER_DRINK, 6,
+ new PotionEffect[]{new PotionEffect(PotionEffectType.CONFUSION, 200, 3)});
+ Food.DrinkCheck(p, e.getItem(), ClayTechItems.TEA_DRINK, 6,
+ new PotionEffect[]{new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 600, 2)});
+ Food.DrinkCheck(p, e.getItem(), ClayTechItems.LEMON_TEA_DRINK, 12,
+ new PotionEffect[]{new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 1200, 2)});
+ Food.FoodCheck(p, e.getItem(), ClayTechItems.CHICKEN_FOOT, 8);
+ Food.FoodCheck(p, e.getItem(), ClayTechItems.RAW_BREAD, 4);
+ Food.FoodCheck(p, e.getItem(), ClayTechItems.RAW_VEGETABLE, 1);
+ Food.FoodCheck(p, e.getItem(), ClayTechItems.CLAY_LEMON, 1,
+ new PotionEffect[]{new PotionEffect(PotionEffectType.CONFUSION, 200, 3)});
+ Food.FoodCheck(p, e.getItem(), ClayTechItems.SPICY_CHICKEN_BURGER, 15,
+ new PotionEffect[]{new PotionEffect(PotionEffectType.getById(5), 400, 1)});
+ Food.FoodCheck(p, e.getItem(), ClayTechItems.BABA_BURGER, -15,
+ new PotionEffect[]{new PotionEffect(PotionEffectType.POISON, 3600, 5)});
+ Food.FoodCheck(p, e.getItem(), ClayTechItems.SNAIL_BAD, -20,
+ new PotionEffect[]{new PotionEffect(PotionEffectType.POISON, 8000, 9)});
+ Food.FoodCheck(p, e.getItem(), ClayTechItems.CHOCOLATE, 15,
+ new PotionEffect[]{new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 600, 2)});
+ Food.FoodCheck(p, e.getItem(), ClayTechItems.SNAIL_FOOD, 12,
+ new PotionEffect[]{new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 600, 2)});
+ Food.FoodCheck(p, e.getItem(), ClayTechItems.HONEY_SWEET, 8);
+ Food.FoodCheck(p, e.getItem(), ClayTechItems.COOKED_SWEET_POTATO, 6);
+ Food.FoodCheck(p, e.getItem(), ClayTechItems.TUNA_FISH, 6);
+ Food.FoodCheck(p, e.getItem(), ClayTechItems.GREEN_GRASS, 1);
+ } catch (NullPointerException err) {
+ }
+ Food.WashCheck(p, e.getItem(), ClayTechItems.DIRTY_DRINK_BOTTLE, ClayTechItems.DRINK_BOTTLE);
+ try {
+ // 这里放其他清理Event!!
+ Food.WashCheck(p, e.getItem(), ClayTechItems.DIRTY_TEA, ClayTechItems.RAW_TEA);
+ } catch (NullPointerException err) {
+ }
+ }
+ }
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/listeners/ItemInteractListener.java b/src/main/java/club/claycoffee/ClayTech/listeners/ItemInteractListener.java
index 76f0368..89b7eb8 100644
--- a/src/main/java/club/claycoffee/ClayTech/listeners/ItemInteractListener.java
+++ b/src/main/java/club/claycoffee/ClayTech/listeners/ItemInteractListener.java
@@ -1,42 +1,41 @@
package club.claycoffee.ClayTech.listeners;
+import club.claycoffee.ClayTech.utils.Lang;
+import club.claycoffee.ClayTech.utils.Utils;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.player.PlayerInteractEvent;
-import club.claycoffee.ClayTech.utils.Lang;
-import club.claycoffee.ClayTech.utils.Utils;
-
public class ItemInteractListener implements Listener {
- @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
- public void BlockPlaceEvent(BlockPlaceEvent e) {
- if (Utils.ExitsInList(Lang.readGeneralText("CantPlaceLore"), Utils.getLore(e.getItemInHand()))
- && !e.isCancelled()) {
- e.setCancelled(true);
- e.getPlayer().sendMessage(Lang.readGeneralText("CantPlace"));
- }
+ @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
+ public void BlockPlaceEvent(BlockPlaceEvent e) {
+ if (Utils.ExitsInList(Lang.readGeneralText("CantPlaceLore"), Utils.getLore(e.getItemInHand()))
+ && !e.isCancelled()) {
+ e.setCancelled(true);
+ e.getPlayer().sendMessage(Lang.readGeneralText("CantPlace"));
+ }
- }
+ }
- @SuppressWarnings("deprecation")
- @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
- public void PlayerInteractEvent(PlayerInteractEvent e) {
- if (e.hasItem()) {
- if (e.getItem().hasItemMeta() && !e.isCancelled()) {
- if (Utils.ExitsInList(Lang.readGeneralText("CantEat"), Utils.getLore(e.getItem()))) {
- e.getPlayer().sendMessage(Lang.readGeneralText("CantEatMessage"));
- e.setCancelled(true);
- return;
- }
- if (Utils.ExitsInList(Lang.readGeneralText("CantInteract"), Utils.getLore(e.getItem()))
- && e.hasBlock()) {
- e.getPlayer().sendMessage(Lang.readGeneralText("CantInteractMessage"));
- e.setCancelled(true);
- return;
- }
- }
- }
- }
+ @SuppressWarnings("deprecation")
+ @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
+ public void PlayerInteractEvent(PlayerInteractEvent e) {
+ if (e.hasItem()) {
+ if (e.getItem().hasItemMeta() && !e.isCancelled()) {
+ if (Utils.ExitsInList(Lang.readGeneralText("CantEat"), Utils.getLore(e.getItem()))) {
+ e.getPlayer().sendMessage(Lang.readGeneralText("CantEatMessage"));
+ e.setCancelled(true);
+ return;
+ }
+ if (Utils.ExitsInList(Lang.readGeneralText("CantInteract"), Utils.getLore(e.getItem()))
+ && e.hasBlock()) {
+ e.getPlayer().sendMessage(Lang.readGeneralText("CantInteractMessage"));
+ e.setCancelled(true);
+ return;
+ }
+ }
+ }
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/listeners/ItemUseListener.java b/src/main/java/club/claycoffee/ClayTech/listeners/ItemUseListener.java
index 6c9ee84..f066737 100644
--- a/src/main/java/club/claycoffee/ClayTech/listeners/ItemUseListener.java
+++ b/src/main/java/club/claycoffee/ClayTech/listeners/ItemUseListener.java
@@ -1,19 +1,20 @@
package club.claycoffee.ClayTech.listeners;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
+import club.claycoffee.ClayTech.ClayTech;
+import club.claycoffee.ClayTech.api.listeners.PlayerUseItemEvent;
+import club.claycoffee.ClayTech.utils.ClayItem;
+import club.claycoffee.ClayTech.utils.Lang;
+import club.claycoffee.ClayTech.utils.Utils;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
-import org.bukkit.event.block.Action;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
+import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.Inventory;
@@ -22,102 +23,100 @@
import org.bukkit.metadata.MetadataValue;
import org.bukkit.scheduler.BukkitRunnable;
-import club.claycoffee.ClayTech.ClayTech;
-import club.claycoffee.ClayTech.api.listeners.PlayerUseItemEvent;
-import club.claycoffee.ClayTech.utils.ClayItem;
-import club.claycoffee.ClayTech.utils.Lang;
-import club.claycoffee.ClayTech.utils.Utils;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
public class ItemUseListener implements Listener {
- private Player p;
+ private Player p;
- @EventHandler(priority = EventPriority.HIGHEST)
- public void PlayerInteractEvent(PlayerInteractEvent e) {
- if (e.hasItem()) {
- if (e.getItem().hasItemMeta()) {
- if (e.getItem().getItemMeta().getDisplayName().equalsIgnoreCase(
- Lang.readItemText("TNT_EXPLOSION_CREATER")) && e.getAction() == Action.RIGHT_CLICK_AIR) {
- Bukkit.getPluginManager().callEvent(new PlayerUseItemEvent(e.getPlayer(), e.getItem()));
- boolean pass = false;
- String md = Utils.readPlayerMetadataString(e.getPlayer(), "lastUseTNTCreaterTime");
- if (md != null) {
- if (System.currentTimeMillis() >= Long.parseLong(md) + 5000L) {
- pass = true;
- }
- } else {
- pass = true;
- }
- if (pass) {
- if (e.getPlayer().getInventory().containsAtLeast(new ItemStack(Material.TNT), 1)) {
- Location currentLoc = e.getPlayer().getLocation();
- Inventory inv = e.getPlayer().getInventory();
- ItemStack TNT = inv.getItem(inv.first(Material.TNT));
- TNT.setAmount(TNT.getAmount() - 1);
- ItemStack tool = e.getPlayer().getInventory().getItemInMainHand();
- ClayItem.setDurability(tool, ClayItem.getDurability(tool) - 1);
- e.getPlayer().sendMessage(Lang.readGeneralText("TNT_EXPLOSION_CREATER_WAIT"));
- e.getPlayer().setMetadata("lastUseTNTCreaterTime",
- new FixedMetadataValue(ClayTech.getInstance(), System.currentTimeMillis() + ""));
- new BukkitRunnable() {
- @Override
- public void run() {
- e.getPlayer().getWorld().spawnEntity(currentLoc, EntityType.PRIMED_TNT);
- Block center = currentLoc.add(0, -1, 0).getBlock();
- center.setMetadata("isExplosionCreater",
- new FixedMetadataValue(ClayTech.getInstance(), true));
- p = e.getPlayer();
- return;
- }
+ @EventHandler(priority = EventPriority.HIGHEST)
+ public void PlayerInteractEvent(PlayerInteractEvent e) {
+ if (e.hasItem()) {
+ if (e.getItem().hasItemMeta()) {
+ if (e.getItem().getItemMeta().getDisplayName().equalsIgnoreCase(
+ Lang.readItemText("TNT_EXPLOSION_CREATER")) && e.getAction() == Action.RIGHT_CLICK_AIR) {
+ Bukkit.getPluginManager().callEvent(new PlayerUseItemEvent(e.getPlayer(), e.getItem()));
+ boolean pass = false;
+ String md = Utils.readPlayerMetadataString(e.getPlayer(), "lastUseTNTCreaterTime");
+ if (md != null) {
+ if (System.currentTimeMillis() >= Long.parseLong(md) + 5000L) {
+ pass = true;
+ }
+ } else {
+ pass = true;
+ }
+ if (pass) {
+ if (e.getPlayer().getInventory().containsAtLeast(new ItemStack(Material.TNT), 1)) {
+ Location currentLoc = e.getPlayer().getLocation();
+ Inventory inv = e.getPlayer().getInventory();
+ ItemStack TNT = inv.getItem(inv.first(Material.TNT));
+ TNT.setAmount(TNT.getAmount() - 1);
+ ItemStack tool = e.getPlayer().getInventory().getItemInMainHand();
+ ClayItem.setDurability(tool, ClayItem.getDurability(tool) - 1);
+ e.getPlayer().sendMessage(Lang.readGeneralText("TNT_EXPLOSION_CREATER_WAIT"));
+ e.getPlayer().setMetadata("lastUseTNTCreaterTime",
+ new FixedMetadataValue(ClayTech.getInstance(), System.currentTimeMillis() + ""));
+ new BukkitRunnable() {
+ @Override
+ public void run() {
+ e.getPlayer().getWorld().spawnEntity(currentLoc, EntityType.PRIMED_TNT);
+ Block center = currentLoc.add(0, -1, 0).getBlock();
+ center.setMetadata("isExplosionCreater",
+ new FixedMetadataValue(ClayTech.getInstance(), true));
+ p = e.getPlayer();
+ return;
+ }
- }.runTaskLater(ClayTech.getInstance(), 100);
- } else {
- e.getPlayer().sendMessage(Lang.readGeneralText("TNT_EXPLOSION_CREATER_NO_TNT"));
- return;
- }
+ }.runTaskLater(ClayTech.getInstance(), 100);
+ } else {
+ e.getPlayer().sendMessage(Lang.readGeneralText("TNT_EXPLOSION_CREATER_NO_TNT"));
+ return;
+ }
- } else {
- e.getPlayer().sendMessage(Lang.readGeneralText("TNT_EXPLOSION_CREATER_CD"));
- return;
- }
+ } else {
+ e.getPlayer().sendMessage(Lang.readGeneralText("TNT_EXPLOSION_CREATER_CD"));
+ return;
+ }
- }
- }
- }
- }
+ }
+ }
+ }
+ }
- @EventHandler(priority = EventPriority.HIGHEST)
- public void EntityExplodeEvent(EntityExplodeEvent e) {
- List blockL = new ArrayList();
- for (Block b : e.blockList()) {
- blockL.add(b);
- }
- boolean already = false;
- for (Block each : blockL) {
- for (MetadataValue eachv : each.getMetadata("isExplosionCreater")) {
- if (eachv.getOwningPlugin().equals(ClayTech.getInstance())) {
- if (e.isCancelled()) {
- p.sendMessage(Lang.readGeneralText("TNT_EXPLOSION_CREATER_FATAL"));
- return;
- } else {
- if (!already) {
- p.sendMessage(Lang.readGeneralText("TNT_EXPLOSION_CREATER_SUCCESS"));
- already = true;
- }
+ @EventHandler(priority = EventPriority.HIGHEST)
+ public void EntityExplodeEvent(EntityExplodeEvent e) {
+ List blockL = new ArrayList();
+ for (Block b : e.blockList()) {
+ blockL.add(b);
+ }
+ boolean already = false;
+ for (Block each : blockL) {
+ for (MetadataValue eachv : each.getMetadata("isExplosionCreater")) {
+ if (eachv.getOwningPlugin().equals(ClayTech.getInstance())) {
+ if (e.isCancelled()) {
+ p.sendMessage(Lang.readGeneralText("TNT_EXPLOSION_CREATER_FATAL"));
+ return;
+ } else {
+ if (!already) {
+ p.sendMessage(Lang.readGeneralText("TNT_EXPLOSION_CREATER_SUCCESS"));
+ already = true;
+ }
- }
- if (eachv.asBoolean()) {
- Iterator b = e.blockList().iterator();
- while (b.hasNext()) {
- Block next = b.next();
- if (next.getType() == Material.CHEST || next.getType() == Material.FURNACE) {
- b.remove();
- }
- }
- break;
+ }
+ if (eachv.asBoolean()) {
+ Iterator b = e.blockList().iterator();
+ while (b.hasNext()) {
+ Block next = b.next();
+ if (next.getType() == Material.CHEST || next.getType() == Material.FURNACE) {
+ b.remove();
+ }
+ }
+ break;
- }
- }
- }
- }
- }
+ }
+ }
+ }
+ }
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/listeners/PlanetBaseListener.java b/src/main/java/club/claycoffee/ClayTech/listeners/PlanetBaseListener.java
index 1316c9f..26c912d 100644
--- a/src/main/java/club/claycoffee/ClayTech/listeners/PlanetBaseListener.java
+++ b/src/main/java/club/claycoffee/ClayTech/listeners/PlanetBaseListener.java
@@ -1,19 +1,5 @@
package club.claycoffee.ClayTech.listeners;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.bukkit.configuration.file.FileConfiguration;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.EventPriority;
-import org.bukkit.event.Listener;
-import org.bukkit.event.block.Action;
-import org.bukkit.event.block.BlockBreakEvent;
-import org.bukkit.event.block.BlockPlaceEvent;
-import org.bukkit.event.player.PlayerInteractEvent;
-import org.bukkit.event.inventory.InventoryClickEvent;
-import org.bukkit.inventory.PlayerInventory;
-
import club.claycoffee.ClayTech.ClayTech;
import club.claycoffee.ClayTech.ClayTechData;
import club.claycoffee.ClayTech.ClayTechItems;
@@ -25,175 +11,192 @@
import club.claycoffee.ClayTech.utils.RocketUtils;
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
import me.mrCookieSlime.Slimefun.api.BlockStorage;
+import org.bukkit.configuration.file.FileConfiguration;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.bukkit.event.block.Action;
+import org.bukkit.event.block.BlockBreakEvent;
+import org.bukkit.event.block.BlockPlaceEvent;
+import org.bukkit.event.inventory.InventoryClickEvent;
+import org.bukkit.event.player.PlayerInteractEvent;
+import org.bukkit.inventory.PlayerInventory;
+
+import java.util.ArrayList;
+import java.util.List;
public class PlanetBaseListener implements Listener {
- @EventHandler(priority = EventPriority.HIGHEST)
- public void BlockPlaceEvent(BlockPlaceEvent e) {
- if (SlimefunUtils.isItemSimilar(e.getPlayer().getInventory().getItemInMainHand(),
- ClayTechItems.PLANET_BASE_SIGNER, true)) {
- Planet p = PlanetUtils.getPlanet(e.getBlock().getWorld());
- if (p != null) {
- DataYML planetsData = ClayTech.getPlanetDataYML();
- FileConfiguration pd = planetsData.getCustomConfig();
- if (!pd.getBoolean(e.getPlayer().getName() + "." + e.getPlayer().getWorld().getName() + ".base")) {
- pd.set(e.getPlayer().getName() + "." + e.getPlayer().getWorld().getName() + ".base", true);
- pd.set(e.getPlayer().getName() + "." + e.getPlayer().getWorld().getName() + ".baseX",
- e.getBlock().getX());
- pd.set(e.getPlayer().getName() + "." + e.getPlayer().getWorld().getName() + ".baseY",
- e.getBlock().getY() + 1);
- pd.set(e.getPlayer().getName() + "." + e.getPlayer().getWorld().getName() + ".baseZ",
- e.getBlock().getZ());
- planetsData.saveCustomConfig();
- e.getPlayer().sendMessage(Lang.readGeneralText("BaseCompleted"));
- return;
- } else {
- e.getPlayer().sendMessage(Lang.readGeneralText("BaseExists"));
- e.setCancelled(true);
- return;
- }
- } else {
- e.getPlayer().sendMessage(Lang.readGeneralText("NotInPlanet"));
- e.setCancelled(true);
- return;
- }
- }
- }
+ @EventHandler(priority = EventPriority.HIGHEST)
+ public void BlockPlaceEvent(BlockPlaceEvent e) {
+ if (SlimefunUtils.isItemSimilar(e.getPlayer().getInventory().getItemInMainHand(),
+ ClayTechItems.PLANET_BASE_SIGNER, true)) {
+ Planet p = PlanetUtils.getPlanet(e.getBlock().getWorld());
+ if (p != null) {
+ DataYML planetsData = ClayTech.getPlanetDataYML();
+ FileConfiguration pd = planetsData.getCustomConfig();
+ if (!pd.getBoolean(e.getPlayer().getName() + "." + e.getPlayer().getWorld().getName() + ".base")) {
+ pd.set(e.getPlayer().getName() + "." + e.getPlayer().getWorld().getName() + ".base", true);
+ pd.set(e.getPlayer().getName() + "." + e.getPlayer().getWorld().getName() + ".baseX",
+ e.getBlock().getX());
+ pd.set(e.getPlayer().getName() + "." + e.getPlayer().getWorld().getName() + ".baseY",
+ e.getBlock().getY() + 1);
+ pd.set(e.getPlayer().getName() + "." + e.getPlayer().getWorld().getName() + ".baseZ",
+ e.getBlock().getZ());
+ planetsData.saveCustomConfig();
+ e.getPlayer().sendMessage(Lang.readGeneralText("BaseCompleted"));
+ return;
+ } else {
+ e.getPlayer().sendMessage(Lang.readGeneralText("BaseExists"));
+ e.setCancelled(true);
+ return;
+ }
+ } else {
+ e.getPlayer().sendMessage(Lang.readGeneralText("NotInPlanet"));
+ e.setCancelled(true);
+ return;
+ }
+ }
+ }
- @EventHandler(priority = EventPriority.HIGHEST)
- public void BlockBreakEvent(BlockBreakEvent e) {
- if (BlockStorage.checkID(e.getBlock()) != null) {
- if (BlockStorage.checkID(e.getBlock()).equalsIgnoreCase("PLANET_BASE_SIGNER")) {
- DataYML planetsData = ClayTech.getPlanetDataYML();
- FileConfiguration pd = planetsData.getCustomConfig();
- int baseX = pd.getInt(e.getPlayer().getName() + "." + e.getPlayer().getWorld().getName() + ".baseX");
- int baseY = pd.getInt(e.getPlayer().getName() + "." + e.getPlayer().getWorld().getName() + ".baseY");
- int baseZ = pd.getInt(e.getPlayer().getName() + "." + e.getPlayer().getWorld().getName() + ".baseZ");
- boolean hasBase = pd
- .getBoolean(e.getPlayer().getName() + "." + e.getPlayer().getWorld().getName() + ".base");
- if (hasBase) {
- if (baseX == e.getBlock().getX() && baseY == e.getBlock().getY() + 1
- && baseZ == e.getBlock().getZ()) {
- pd.set(e.getPlayer().getName() + "." + e.getPlayer().getWorld().getName() + ".base", false);
- pd.set(e.getPlayer().getName() + "." + e.getPlayer().getWorld().getName() + ".baseX", null);
- pd.set(e.getPlayer().getName() + "." + e.getPlayer().getWorld().getName() + ".baseY", null);
- pd.set(e.getPlayer().getName() + "." + e.getPlayer().getWorld().getName() + ".baseZ", null);
- planetsData.saveCustomConfig();
- e.getPlayer().sendMessage(Lang.readGeneralText("BaseDestroyed"));
- } else {
- e.getPlayer().sendMessage(Lang.readGeneralText("NotYourBase"));
- }
- }
- }
- }
- }
+ @EventHandler(priority = EventPriority.HIGHEST)
+ public void BlockBreakEvent(BlockBreakEvent e) {
+ if (BlockStorage.checkID(e.getBlock()) != null) {
+ if (BlockStorage.checkID(e.getBlock()).equalsIgnoreCase("PLANET_BASE_SIGNER")) {
+ DataYML planetsData = ClayTech.getPlanetDataYML();
+ FileConfiguration pd = planetsData.getCustomConfig();
+ int baseX = pd.getInt(e.getPlayer().getName() + "." + e.getPlayer().getWorld().getName() + ".baseX");
+ int baseY = pd.getInt(e.getPlayer().getName() + "." + e.getPlayer().getWorld().getName() + ".baseY");
+ int baseZ = pd.getInt(e.getPlayer().getName() + "." + e.getPlayer().getWorld().getName() + ".baseZ");
+ boolean hasBase = pd
+ .getBoolean(e.getPlayer().getName() + "." + e.getPlayer().getWorld().getName() + ".base");
+ if (hasBase) {
+ if (baseX == e.getBlock().getX() && baseY == e.getBlock().getY() + 1
+ && baseZ == e.getBlock().getZ()) {
+ pd.set(e.getPlayer().getName() + "." + e.getPlayer().getWorld().getName() + ".base", false);
+ pd.set(e.getPlayer().getName() + "." + e.getPlayer().getWorld().getName() + ".baseX", null);
+ pd.set(e.getPlayer().getName() + "." + e.getPlayer().getWorld().getName() + ".baseY", null);
+ pd.set(e.getPlayer().getName() + "." + e.getPlayer().getWorld().getName() + ".baseZ", null);
+ planetsData.saveCustomConfig();
+ e.getPlayer().sendMessage(Lang.readGeneralText("BaseDestroyed"));
+ } else {
+ e.getPlayer().sendMessage(Lang.readGeneralText("NotYourBase"));
+ }
+ }
+ }
+ }
+ }
- @EventHandler(priority = EventPriority.HIGHEST)
- public void PlayerInteractEvent(PlayerInteractEvent e) {
- if (e.getAction() == Action.RIGHT_CLICK_AIR) {
- if (e.hasItem()) {
- if (ClayTechManager.isOxygenDistributer(e.getItem())) {
- PlayerInventory piv = e.getPlayer().getInventory();
- if (ClayTechManager.isSpaceSuit(piv.getHelmet()) && ClayTechManager.isSpaceSuit(piv.getChestplate())
- && ClayTechManager.isSpaceSuit(piv.getLeggings())
- && ClayTechManager.isSpaceSuit(piv.getBoots())) {
- if (RocketUtils.getOxygen(e.getItem()) >= 4) {
- List okPart = new ArrayList();
- if (RocketUtils.getMaxOxygen(piv.getHelmet()) > RocketUtils.getOxygen(piv.getHelmet())) {
- okPart.add("HELMET");
- }
- if (RocketUtils.getMaxOxygen(piv.getChestplate()) > RocketUtils
- .getOxygen(piv.getChestplate())) {
- okPart.add("CHESTPLATE");
- }
- if (RocketUtils.getMaxOxygen(piv.getLeggings()) > RocketUtils
- .getOxygen(piv.getLeggings())) {
- okPart.add("LEGGINGS");
- }
- if (RocketUtils.getMaxOxygen(piv.getBoots()) > RocketUtils.getOxygen(piv.getBoots())) {
- okPart.add("BOOTS");
- }
- int totalOxygen = RocketUtils.getOxygen(e.getItem());
- int takeOxygen = totalOxygen / okPart.size();
- for (String eachPart : okPart) {
- totalOxygen -= takeOxygen;
- int curOxg = 0;
- if (eachPart.equalsIgnoreCase("HELMET")) {
- curOxg = RocketUtils.getOxygen(piv.getHelmet());
- if (curOxg + takeOxygen > RocketUtils.getMaxOxygen(piv.getHelmet())) {
- totalOxygen += curOxg + takeOxygen - RocketUtils.getMaxOxygen(piv.getHelmet());
- RocketUtils.setOxygen(piv.getHelmet(),
- RocketUtils.getMaxOxygen(piv.getHelmet()));
+ @EventHandler(priority = EventPriority.HIGHEST)
+ public void PlayerInteractEvent(PlayerInteractEvent e) {
+ if (e.getAction() == Action.RIGHT_CLICK_AIR) {
+ if (e.hasItem()) {
+ if (ClayTechManager.isOxygenDistributer(e.getItem())) {
+ PlayerInventory piv = e.getPlayer().getInventory();
+ if (ClayTechManager.isSpaceSuit(piv.getHelmet()) && ClayTechManager.isSpaceSuit(piv.getChestplate())
+ && ClayTechManager.isSpaceSuit(piv.getLeggings())
+ && ClayTechManager.isSpaceSuit(piv.getBoots())) {
+ if (RocketUtils.getOxygen(e.getItem()) >= 4) {
+ List okPart = new ArrayList();
+ if (RocketUtils.getMaxOxygen(piv.getHelmet()) > RocketUtils.getOxygen(piv.getHelmet())) {
+ okPart.add("HELMET");
+ }
+ if (RocketUtils.getMaxOxygen(piv.getChestplate()) > RocketUtils
+ .getOxygen(piv.getChestplate())) {
+ okPart.add("CHESTPLATE");
+ }
+ if (RocketUtils.getMaxOxygen(piv.getLeggings()) > RocketUtils
+ .getOxygen(piv.getLeggings())) {
+ okPart.add("LEGGINGS");
+ }
+ if (RocketUtils.getMaxOxygen(piv.getBoots()) > RocketUtils.getOxygen(piv.getBoots())) {
+ okPart.add("BOOTS");
+ }
+ int totalOxygen = RocketUtils.getOxygen(e.getItem());
+ if (okPart.size() == 0) {
+ e.getPlayer().sendMessage(Lang.readGeneralText("SPACESUIT_DISTRIBUTER_FULL"));
+ return;
+ }
+ int takeOxygen = totalOxygen / okPart.size();
+ for (String eachPart : okPart) {
+ totalOxygen -= takeOxygen;
+ int curOxg = 0;
+ if (eachPart.equalsIgnoreCase("HELMET")) {
+ curOxg = RocketUtils.getOxygen(piv.getHelmet());
+ if (curOxg + takeOxygen > RocketUtils.getMaxOxygen(piv.getHelmet())) {
+ totalOxygen += curOxg + takeOxygen - RocketUtils.getMaxOxygen(piv.getHelmet());
+ RocketUtils.setOxygen(piv.getHelmet(),
+ RocketUtils.getMaxOxygen(piv.getHelmet()));
- } else {
- RocketUtils.setOxygen(piv.getHelmet(),
- RocketUtils.getOxygen(piv.getHelmet()) + takeOxygen);
- }
- }
- if (eachPart.equalsIgnoreCase("CHESTPLATE")) {
- curOxg = RocketUtils.getOxygen(piv.getChestplate());
- if (curOxg + takeOxygen > RocketUtils.getMaxOxygen(piv.getChestplate())) {
- totalOxygen += curOxg + takeOxygen
- - RocketUtils.getMaxOxygen(piv.getChestplate());
- RocketUtils.setOxygen(piv.getChestplate(),
- RocketUtils.getMaxOxygen(piv.getChestplate()));
+ } else {
+ RocketUtils.setOxygen(piv.getHelmet(),
+ RocketUtils.getOxygen(piv.getHelmet()) + takeOxygen);
+ }
+ }
+ if (eachPart.equalsIgnoreCase("CHESTPLATE")) {
+ curOxg = RocketUtils.getOxygen(piv.getChestplate());
+ if (curOxg + takeOxygen > RocketUtils.getMaxOxygen(piv.getChestplate())) {
+ totalOxygen += curOxg + takeOxygen
+ - RocketUtils.getMaxOxygen(piv.getChestplate());
+ RocketUtils.setOxygen(piv.getChestplate(),
+ RocketUtils.getMaxOxygen(piv.getChestplate()));
- } else {
- RocketUtils.setOxygen(piv.getChestplate(),
- RocketUtils.getOxygen(piv.getChestplate()) + takeOxygen);
- }
- }
- if (eachPart.equalsIgnoreCase("LEGGINGS")) {
- curOxg = RocketUtils.getOxygen(piv.getLeggings());
- if (curOxg + takeOxygen > RocketUtils.getMaxOxygen(piv.getLeggings())) {
- totalOxygen += curOxg + takeOxygen
- - RocketUtils.getMaxOxygen(piv.getLeggings());
- RocketUtils.setOxygen(piv.getLeggings(),
- RocketUtils.getMaxOxygen(piv.getLeggings()));
+ } else {
+ RocketUtils.setOxygen(piv.getChestplate(),
+ RocketUtils.getOxygen(piv.getChestplate()) + takeOxygen);
+ }
+ }
+ if (eachPart.equalsIgnoreCase("LEGGINGS")) {
+ curOxg = RocketUtils.getOxygen(piv.getLeggings());
+ if (curOxg + takeOxygen > RocketUtils.getMaxOxygen(piv.getLeggings())) {
+ totalOxygen += curOxg + takeOxygen
+ - RocketUtils.getMaxOxygen(piv.getLeggings());
+ RocketUtils.setOxygen(piv.getLeggings(),
+ RocketUtils.getMaxOxygen(piv.getLeggings()));
- } else {
- RocketUtils.setOxygen(piv.getLeggings(),
- RocketUtils.getOxygen(piv.getLeggings()) + takeOxygen);
- }
- }
- if (eachPart.equalsIgnoreCase("BOOTS")) {
- curOxg = RocketUtils.getOxygen(piv.getBoots());
- if (curOxg + takeOxygen > RocketUtils.getMaxOxygen(piv.getBoots())) {
- totalOxygen += curOxg + takeOxygen - RocketUtils.getMaxOxygen(piv.getBoots());
- RocketUtils.setOxygen(piv.getBoots(), RocketUtils.getMaxOxygen(piv.getBoots()));
+ } else {
+ RocketUtils.setOxygen(piv.getLeggings(),
+ RocketUtils.getOxygen(piv.getLeggings()) + takeOxygen);
+ }
+ }
+ if (eachPart.equalsIgnoreCase("BOOTS")) {
+ curOxg = RocketUtils.getOxygen(piv.getBoots());
+ if (curOxg + takeOxygen > RocketUtils.getMaxOxygen(piv.getBoots())) {
+ totalOxygen += curOxg + takeOxygen - RocketUtils.getMaxOxygen(piv.getBoots());
+ RocketUtils.setOxygen(piv.getBoots(), RocketUtils.getMaxOxygen(piv.getBoots()));
- } else {
- RocketUtils.setOxygen(piv.getBoots(),
- RocketUtils.getOxygen(piv.getBoots()) + takeOxygen);
- }
- }
- }
- RocketUtils.setOxygen(e.getItem(), totalOxygen);
- e.getPlayer().sendMessage(Lang.readGeneralText("SPACESUIT_DISTRIBUTER_OK"));
+ } else {
+ RocketUtils.setOxygen(piv.getBoots(),
+ RocketUtils.getOxygen(piv.getBoots()) + takeOxygen);
+ }
+ }
+ }
+ RocketUtils.setOxygen(e.getItem(), totalOxygen);
+ e.getPlayer().sendMessage(Lang.readGeneralText("SPACESUIT_DISTRIBUTER_OK"));
- } else {
- e.getPlayer().sendMessage(Lang.readGeneralText("SPACESUIT_4"));
- }
- } else {
- e.getPlayer().sendMessage(Lang.readGeneralText("SPACESUIT_NOT_OK"));
- }
- }
- }
- }
- }
+ } else {
+ e.getPlayer().sendMessage(Lang.readGeneralText("SPACESUIT_4"));
+ }
+ } else {
+ e.getPlayer().sendMessage(Lang.readGeneralText("SPACESUIT_NOT_OK"));
+ }
+ }
+ }
+ }
+ }
- @EventHandler
- public void InventoryClickEvent(InventoryClickEvent e) {
- if (e.getView().getTitle().equalsIgnoreCase(Lang.readMachinesText("CLAY_ROCKET_FUEL_INJECTOR"))
- && e.getSlot() == 20) {
- if (ClayTechData.RunningInjectors.get(e.getInventory()) != null) {
- e.setCancelled(true);
- }
- }
- if (e.getView().getTitle().equalsIgnoreCase(Lang.readMachinesText("CLAY_SPACESUIT_OXYGEN_INJECTOR"))
- && e.getSlot() == 22) {
- if (ClayTechData.RunningInjectorsOxygen.get(e.getInventory()) != null) {
- e.setCancelled(true);
- }
- }
- }
+ @EventHandler
+ public void InventoryClickEvent(InventoryClickEvent e) {
+ if (e.getView().getTitle().equalsIgnoreCase(Lang.readMachinesText("CLAY_ROCKET_FUEL_INJECTOR"))
+ && e.getSlot() == 20) {
+ if (ClayTechData.RunningInjectors.get(e.getInventory()) != null) {
+ e.setCancelled(true);
+ }
+ }
+ if (e.getView().getTitle().equalsIgnoreCase(Lang.readMachinesText("CLAY_SPACESUIT_OXYGEN_INJECTOR"))
+ && e.getSlot() == 22) {
+ if (ClayTechData.RunningInjectorsOxygen.get(e.getInventory()) != null) {
+ e.setCancelled(true);
+ }
+ }
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/listeners/PlanetListener.java b/src/main/java/club/claycoffee/ClayTech/listeners/PlanetListener.java
index 50d1bf5..dd3d679 100644
--- a/src/main/java/club/claycoffee/ClayTech/listeners/PlanetListener.java
+++ b/src/main/java/club/claycoffee/ClayTech/listeners/PlanetListener.java
@@ -1,528 +1,522 @@
package club.claycoffee.ClayTech.listeners;
+import club.claycoffee.ClayTech.ClayTech;
+import club.claycoffee.ClayTech.api.ClayTechManager;
+import club.claycoffee.ClayTech.api.Planet;
+import club.claycoffee.ClayTech.utils.Lang;
+import club.claycoffee.ClayTech.utils.PlanetUtils;
+import club.claycoffee.ClayTech.utils.RocketUtils;
+import club.claycoffee.ClayTech.utils.Utils;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.data.type.Dispenser;
-import org.bukkit.entity.Animals;
-import org.bukkit.entity.Boss;
-import org.bukkit.entity.EntityType;
-import org.bukkit.entity.Mob;
-import org.bukkit.entity.Monster;
-import org.bukkit.entity.Player;
+import org.bukkit.entity.*;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockDispenseEvent;
-import org.bukkit.event.entity.EntitySpawnEvent;
+import org.bukkit.event.block.CauldronLevelChangeEvent;
+import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
+import org.bukkit.event.entity.EntityPotionEffectEvent;
import org.bukkit.event.entity.EntityPotionEffectEvent.Cause;
+import org.bukkit.event.entity.EntitySpawnEvent;
import org.bukkit.event.player.PlayerBucketEmptyEvent;
import org.bukkit.event.player.PlayerChangedWorldEvent;
-import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.player.PlayerJoinEvent;
+import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.scheduler.BukkitRunnable;
-import org.bukkit.event.entity.EntityDamageEvent;
-import org.bukkit.event.block.CauldronLevelChangeEvent;
-import org.bukkit.event.entity.EntityPotionEffectEvent;
-
-import club.claycoffee.ClayTech.ClayTech;
-import club.claycoffee.ClayTech.api.ClayTechManager;
-import club.claycoffee.ClayTech.api.Planet;
-import club.claycoffee.ClayTech.utils.Lang;
-import club.claycoffee.ClayTech.utils.PlanetUtils;
-import club.claycoffee.ClayTech.utils.RocketUtils;
-import club.claycoffee.ClayTech.utils.Utils;
public class PlanetListener implements Listener {
- @EventHandler(priority = EventPriority.HIGHEST)
- public void EntitySpawnEvent(EntitySpawnEvent e) {
- Planet p = PlanetUtils.getPlanet(e.getEntity().getWorld());
- if (p != null) {
- if (!p.getMobSpawnable()) {
- if (e.getEntity() instanceof Mob || e.getEntity() instanceof Animals || e.getEntity() instanceof Monster
- || e.getEntity() instanceof Boss) {
- e.setCancelled(true);
- }
-
- }
- }
- }
-
- @EventHandler(priority = EventPriority.HIGHEST)
- public void PlayerChangeWorldEvent(PlayerChangedWorldEvent e) {
- e.getPlayer().removePotionEffect(PotionEffectType.JUMP);
- e.getPlayer().removePotionEffect(PotionEffectType.SLOW_FALLING);
-
- Planet p = PlanetUtils.getPlanet(e.getPlayer().getWorld());
- if (p != null) {
- if (!p.getHabitable()) {
- if (ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getHelmet())
- && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getChestplate())
- && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getLeggings())
- && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getBoots())) {
- World PreviousWorld = e.getPlayer().getWorld();
- new BukkitRunnable() {
-
- @Override
- public void run() {
- if (!PreviousWorld.equals(e.getPlayer().getWorld()) || !e.getPlayer().isOnline()) {
- this.cancel();
- return;
- }
- // 扣氧气线程
- if (ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getHelmet())
- && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getChestplate())
- && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getLeggings())
- && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getBoots())) {
- if (RocketUtils.getOxygen(e.getPlayer().getInventory().getHelmet()) > 0
- && RocketUtils.getOxygen(e.getPlayer().getInventory().getChestplate()) > 0
- && RocketUtils.getOxygen(e.getPlayer().getInventory().getLeggings()) > 0
- && RocketUtils.getOxygen(e.getPlayer().getInventory().getBoots()) > 0) {
- ItemStack helmet = e.getPlayer().getInventory().getHelmet();
- RocketUtils.setOxygen(helmet, RocketUtils.getOxygen(helmet) - 1);
-
- ItemStack chestplate = e.getPlayer().getInventory().getChestplate();
- RocketUtils.setOxygen(chestplate, RocketUtils.getOxygen(chestplate) - 1);
-
- ItemStack leggings = e.getPlayer().getInventory().getLeggings();
- RocketUtils.setOxygen(leggings, RocketUtils.getOxygen(leggings) - 1);
-
- ItemStack boots = e.getPlayer().getInventory().getBoots();
- RocketUtils.setOxygen(boots, RocketUtils.getOxygen(boots) - 1);
- }
- }
- }
-
- }.runTaskTimerAsynchronously(ClayTech.getInstance(), 1200, 1200);
- new BukkitRunnable() {
-
- @SuppressWarnings("deprecation")
- @Override
- public void run() {
- if (!PreviousWorld.equals(e.getPlayer().getWorld()) || !e.getPlayer().isOnline()) {
- this.cancel();
- return;
- }
- if (!(ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getHelmet())
- && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getChestplate())
- && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getLeggings())
- && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getBoots()))) {
- // 扣血
- e.getPlayer().sendTitle(Lang.readGeneralText("SpaceSuitError"),
- Lang.readGeneralText("SpaceSuitError_Sub"));
- e.getPlayer().damage(5);
-
- } else {
- if (!(RocketUtils.getOxygen(e.getPlayer().getInventory().getHelmet()) > 0
- && RocketUtils.getOxygen(e.getPlayer().getInventory().getChestplate()) > 0
- && RocketUtils.getOxygen(e.getPlayer().getInventory().getLeggings()) > 0
- && RocketUtils.getOxygen(e.getPlayer().getInventory().getBoots()) > 0)) {
- // 扣血
- e.getPlayer().sendTitle(Lang.readGeneralText("SpaceSuitError"),
- Lang.readGeneralText("SpaceSuitError_Sub"));
- e.getPlayer().damage(5);
- } else {
- int harmlevel = p.getHarmLevel();
- if (RocketUtils
- .getProtectLevel(e.getPlayer().getInventory().getHelmet()) < harmlevel
- || RocketUtils.getProtectLevel(
- e.getPlayer().getInventory().getChestplate()) < harmlevel
- || RocketUtils.getProtectLevel(
- e.getPlayer().getInventory().getLeggings()) < harmlevel
- || RocketUtils.getProtectLevel(
- e.getPlayer().getInventory().getBoots()) < harmlevel) {
- // 扣血
- e.getPlayer().sendTitle(Lang.readGeneralText("SpaceSuitError"),
- Lang.readGeneralText("SpaceSuitError_Sub"));
- e.getPlayer().damage(5);
- }
- }
- }
- }
-
- }.runTaskTimer(ClayTech.getInstance(), 20, 20);
- } else {
- World PreviousWorld = e.getPlayer().getWorld();
- new BukkitRunnable() {
-
- @SuppressWarnings("deprecation")
- @Override
- public void run() {
- if (!PreviousWorld.equals(e.getPlayer().getWorld()) || !e.getPlayer().isOnline()) {
- this.cancel();
- return;
- }
- if (!(ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getHelmet())
- && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getChestplate())
- && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getLeggings())
- && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getBoots()))) {
- // 扣血
- e.getPlayer().sendTitle(Lang.readGeneralText("SpaceSuitError"),
- Lang.readGeneralText("SpaceSuitError_Sub"));
- e.getPlayer().damage(5);
-
- } else {
- if (!(RocketUtils.getOxygen(e.getPlayer().getInventory().getHelmet()) > 0
- && RocketUtils.getOxygen(e.getPlayer().getInventory().getChestplate()) > 0
- && RocketUtils.getOxygen(e.getPlayer().getInventory().getLeggings()) > 0
- && RocketUtils.getOxygen(e.getPlayer().getInventory().getBoots()) > 0)) {
- // 扣血
- e.getPlayer().sendTitle(Lang.readGeneralText("SpaceSuitError"),
- Lang.readGeneralText("SpaceSuitError_Sub"));
- e.getPlayer().damage(5);
- } else {
- int harmlevel = p.getHarmLevel();
- if (RocketUtils
- .getProtectLevel(e.getPlayer().getInventory().getHelmet()) < harmlevel
- || RocketUtils.getProtectLevel(
- e.getPlayer().getInventory().getChestplate()) < harmlevel
- || RocketUtils.getProtectLevel(
- e.getPlayer().getInventory().getLeggings()) < harmlevel
- || RocketUtils.getProtectLevel(
- e.getPlayer().getInventory().getBoots()) < harmlevel) {
- // 扣血
- e.getPlayer().sendTitle(Lang.readGeneralText("SpaceSuitError"),
- Lang.readGeneralText("SpaceSuitError_Sub"));
- e.getPlayer().damage(5);
- }
- }
- }
- }
-
- }.runTaskTimer(ClayTech.getInstance(), 20, 20);
- }
- }
- if (p.getGravity() > 1) {
- e.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 99999, p.getGravity() - 1));
- e.getPlayer()
- .addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, 99999, p.getGravity() - 1));
- }
- }
- }
-
- @EventHandler
- public void PlayerJoinEvent(PlayerJoinEvent e) {
- e.getPlayer().removePotionEffect(PotionEffectType.JUMP);
- e.getPlayer().removePotionEffect(PotionEffectType.SLOW_FALLING);
-
- Planet p = PlanetUtils.getPlanet(e.getPlayer().getWorld());
- if (p != null) {
- if (!p.getHabitable()) {
- if (ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getHelmet())
- && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getChestplate())
- && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getLeggings())
- && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getBoots())) {
- World PreviousWorld = e.getPlayer().getWorld();
- new BukkitRunnable() {
-
- @Override
- public void run() {
- if (!PreviousWorld.equals(e.getPlayer().getWorld()) || !e.getPlayer().isOnline()) {
- this.cancel();
- return;
- }
- // 扣氧气线程
- if (ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getHelmet())
- && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getChestplate())
- && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getLeggings())
- && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getBoots())) {
- if (RocketUtils.getOxygen(e.getPlayer().getInventory().getHelmet()) > 0
- && RocketUtils.getOxygen(e.getPlayer().getInventory().getChestplate()) > 0
- && RocketUtils.getOxygen(e.getPlayer().getInventory().getLeggings()) > 0
- && RocketUtils.getOxygen(e.getPlayer().getInventory().getBoots()) > 0) {
- ItemStack helmet = e.getPlayer().getInventory().getHelmet();
- RocketUtils.setOxygen(helmet, RocketUtils.getOxygen(helmet) - 1);
-
- ItemStack chestplate = e.getPlayer().getInventory().getChestplate();
- RocketUtils.setOxygen(chestplate, RocketUtils.getOxygen(chestplate) - 1);
-
- ItemStack leggings = e.getPlayer().getInventory().getLeggings();
- RocketUtils.setOxygen(leggings, RocketUtils.getOxygen(leggings) - 1);
-
- ItemStack boots = e.getPlayer().getInventory().getBoots();
- RocketUtils.setOxygen(boots, RocketUtils.getOxygen(boots) - 1);
- }
- }
- }
-
- }.runTaskTimerAsynchronously(ClayTech.getInstance(), 1200, 1200);
- new BukkitRunnable() {
-
- @SuppressWarnings("deprecation")
- @Override
- public void run() {
- if (!PreviousWorld.equals(e.getPlayer().getWorld()) || !e.getPlayer().isOnline()) {
- this.cancel();
- return;
- }
- if (!(ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getHelmet())
- && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getChestplate())
- && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getLeggings())
- && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getBoots()))) {
- // 扣血
- e.getPlayer().sendTitle(Lang.readGeneralText("SpaceSuitError"),
- Lang.readGeneralText("SpaceSuitError_Sub"));
- e.getPlayer().damage(5);
-
- } else {
- if (!(RocketUtils.getOxygen(e.getPlayer().getInventory().getHelmet()) > 0
- && RocketUtils.getOxygen(e.getPlayer().getInventory().getChestplate()) > 0
- && RocketUtils.getOxygen(e.getPlayer().getInventory().getLeggings()) > 0
- && RocketUtils.getOxygen(e.getPlayer().getInventory().getBoots()) > 0)) {
- // 扣血
- e.getPlayer().sendTitle(Lang.readGeneralText("SpaceSuitError"),
- Lang.readGeneralText("SpaceSuitError_Sub"));
- e.getPlayer().damage(5);
- } else {
- int harmlevel = p.getHarmLevel();
- if (RocketUtils
- .getProtectLevel(e.getPlayer().getInventory().getHelmet()) < harmlevel
- || RocketUtils.getProtectLevel(
- e.getPlayer().getInventory().getChestplate()) < harmlevel
- || RocketUtils.getProtectLevel(
- e.getPlayer().getInventory().getLeggings()) < harmlevel
- || RocketUtils.getProtectLevel(
- e.getPlayer().getInventory().getBoots()) < harmlevel) {
- // 扣血
- e.getPlayer().sendTitle(Lang.readGeneralText("SpaceSuitError"),
- Lang.readGeneralText("SpaceSuitError_Sub"));
- e.getPlayer().damage(5);
- }
- }
- }
- }
-
- }.runTaskTimer(ClayTech.getInstance(), 20, 20);
- } else {
- World PreviousWorld = e.getPlayer().getWorld();
- new BukkitRunnable() {
-
- @SuppressWarnings("deprecation")
- @Override
- public void run() {
- if (!PreviousWorld.equals(e.getPlayer().getWorld()) || !e.getPlayer().isOnline()) {
- this.cancel();
- return;
- }
- if (!(ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getHelmet())
- && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getChestplate())
- && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getLeggings())
- && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getBoots()))) {
- // 扣血
- e.getPlayer().sendTitle(Lang.readGeneralText("SpaceSuitError"),
- Lang.readGeneralText("SpaceSuitError_Sub"));
- e.getPlayer().damage(5);
-
- } else {
- if (!(RocketUtils.getOxygen(e.getPlayer().getInventory().getHelmet()) > 0
- && RocketUtils.getOxygen(e.getPlayer().getInventory().getChestplate()) > 0
- && RocketUtils.getOxygen(e.getPlayer().getInventory().getLeggings()) > 0
- && RocketUtils.getOxygen(e.getPlayer().getInventory().getBoots()) > 0)) {
- // 扣血
- e.getPlayer().sendTitle(Lang.readGeneralText("SpaceSuitError"),
- Lang.readGeneralText("SpaceSuitError_Sub"));
- e.getPlayer().damage(5);
- } else {
- int harmlevel = p.getHarmLevel();
- if (RocketUtils
- .getProtectLevel(e.getPlayer().getInventory().getHelmet()) < harmlevel
- || RocketUtils.getProtectLevel(
- e.getPlayer().getInventory().getChestplate()) < harmlevel
- || RocketUtils.getProtectLevel(
- e.getPlayer().getInventory().getLeggings()) < harmlevel
- || RocketUtils.getProtectLevel(
- e.getPlayer().getInventory().getBoots()) < harmlevel) {
- // 扣血
- e.getPlayer().sendTitle(Lang.readGeneralText("SpaceSuitError"),
- Lang.readGeneralText("SpaceSuitError_Sub"));
- e.getPlayer().damage(5);
- }
- }
- }
- }
-
- }.runTaskTimer(ClayTech.getInstance(), 20, 20);
- }
- }
- if (p.getGravity() > 1) {
- e.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 99999, p.getGravity() - 1));
- e.getPlayer()
- .addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, 99999, p.getGravity() - 1));
- }
- }
- }
-
- @EventHandler(priority = EventPriority.HIGHEST)
- public void EntityPotionEffectEvent(EntityPotionEffectEvent e) {
- if (e.getCause() == Cause.MILK && e.getEntity() instanceof Player) {
- Planet p = PlanetUtils.getPlanet(e.getEntity().getWorld());
- if (p.getGravity() != 1) {
- e.setCancelled(true);
- e.getEntity().sendMessage(Lang.readGeneralText("Cant_Drink_Milk"));
- }
- }
- }
-
- @EventHandler(priority = EventPriority.HIGHEST)
- public void PlayerTeleportEvent(PlayerTeleportEvent e) {
- Planet p = PlanetUtils.getPlanet(e.getPlayer().getWorld());
- Planet to = PlanetUtils.getPlanet(e.getTo().getWorld());
- String inRocket = "false";
- if (p != null) {
- if (to != null) {
- if (p.getPlanetWorldName().equalsIgnoreCase(to.getPlanetWorldName())) {
- // 如果目标位置在当前世界
- return;
- }
- }
- if (Utils.readPlayerMetadataString(e.getPlayer(), "inrocket") != null) {
- inRocket = Utils.readPlayerMetadataString(e.getPlayer(), "inrocket");
- }
- boolean ast = Utils.readPlayerMetadataBoolean(e.getPlayer(), "allowSpaceTeleport");
- if (!inRocket.equalsIgnoreCase("true")
- && !p.getPlanetWorldName().equalsIgnoreCase(ClayTech.getOverworld())) {
- if (ast) {
- e.getPlayer().setMetadata("allowSpaceTeleport",
- new FixedMetadataValue(ClayTech.getInstance(), false));
- return;
- }
- // 其他星球传送到主世界
- e.getPlayer().sendMessage(Lang.readGeneralText("CantUseOtherTeleportInUniverse"));
- e.setCancelled(true);
- return;
- }
- }
-
- if (to != null && p != null) {
- if (Utils.readPlayerMetadataString(e.getPlayer(), "inrocket") != null) {
- inRocket = Utils.readPlayerMetadataString(e.getPlayer(), "inrocket");
- }
- boolean ast = Utils.readPlayerMetadataBoolean(e.getPlayer(), "allowSpaceTeleport");
- if (!inRocket.equalsIgnoreCase("true") && p.getPlanetWorldName().equalsIgnoreCase(ClayTech.getOverworld())
- && !to.getPlanetWorldName().equalsIgnoreCase(ClayTech.getOverworld())) {
- if (ast) {
- e.getPlayer().setMetadata("allowSpaceTeleport",
- new FixedMetadataValue(ClayTech.getInstance(), false));
- return;
- }
- // 在主世界传送到其他星球
- e.getPlayer().sendMessage(Lang.readGeneralText("CantUseOtherTeleportInUniverse"));
- e.setCancelled(true);
- return;
- }
- }
- }
-
- @EventHandler
- public void EntityDamageEvent(EntityDamageEvent e) {
- if (e.getEntityType() == EntityType.PLAYER && e.getCause() == DamageCause.FALL) {
- Player p = (Player) e.getEntity();
- if (ClayTechManager.isSpaceSuit(p.getInventory().getHelmet())
- && ClayTechManager.isSpaceSuit(p.getInventory().getChestplate())
- && ClayTechManager.isSpaceSuit(p.getInventory().getLeggings())
- && ClayTechManager.isSpaceSuit(p.getInventory().getBoots())) {
- e.setDamage(e.getDamage() - e.getFinalDamage());
- if (Utils.readPlayerMetadataBoolean(p, "SpaceSuitNoCostDurability")) {
- e.setCancelled(true);
- p.setMetadata("SpaceSuitNoCostDurability", new FixedMetadataValue(ClayTech.getInstance(), false));
- }
- p.sendMessage(Lang.readGeneralText("SpaceSuitFall"));
- }
- }
- }
-
- @EventHandler
- public void PlayerBucketEmptyEvent(PlayerBucketEmptyEvent e) {
- // 禁止玩家放置液体
- Planet p = PlanetUtils.getPlanet(e.getBlock().getWorld());
- if (p != null) {
- if (p.getCold()) {
- if (e.getPlayer().getInventory().getItemInMainHand().getType() == Material.WATER_BUCKET) {
- new BukkitRunnable() {
-
- @Override
- public void run() {
- e.getBlock().getWorld().playSound(e.getBlock().getLocation(), Sound.BLOCK_FIRE_EXTINGUISH,
- 1.0F, 1.0F);
- e.getBlock().setType(Material.BLUE_ICE);
- }
-
- }.runTaskLater(ClayTech.getInstance(), 30);
- return;
- }
- if (e.getPlayer().getInventory().getItemInMainHand().getType() == Material.LAVA_BUCKET) {
- new BukkitRunnable() {
-
- @Override
- public void run() {
- e.getBlock().getWorld().playSound(e.getBlock().getLocation(), Sound.BLOCK_FIRE_EXTINGUISH,
- 1.0F, 1.0F);
- e.getBlock().setType(Material.OBSIDIAN);
- }
-
- }.runTaskLater(ClayTech.getInstance(), 30);
- return;
- }
- }
- }
- }
-
- @EventHandler
- public void BlockDispenseEvent(BlockDispenseEvent e) {
- // 禁止发射器放置液体
- Planet p = PlanetUtils.getPlanet(e.getBlock().getWorld());
- if (p != null) {
- if (p.getCold()) {
- if (e.getItem().getType() == Material.WATER_BUCKET) {
- new BukkitRunnable() {
-
- @Override
- public void run() {
- Dispenser d = (Dispenser) e.getBlock().getBlockData();
- Block targetBlock = e.getBlock().getRelative(d.getFacing());
- e.getBlock().getWorld().playSound(e.getBlock().getLocation(), Sound.BLOCK_FIRE_EXTINGUISH,
- 1.0F, 1.0F);
- targetBlock.setType(Material.BLUE_ICE);
- }
-
- }.runTaskLater(ClayTech.getInstance(), 30);
- return;
- }
- if (e.getItem().getType() == Material.LAVA_BUCKET) {
- new BukkitRunnable() {
-
- @Override
- public void run() {
- Dispenser d = (Dispenser) e.getBlock().getBlockData();
- Block targetBlock = e.getBlock().getRelative(d.getFacing());
- e.getBlock().getWorld().playSound(e.getBlock().getLocation(), Sound.BLOCK_FIRE_EXTINGUISH,
- 1.0F, 1.0F);
- targetBlock.setType(Material.OBSIDIAN);
- }
-
- }.runTaskLater(ClayTech.getInstance(), 30);
- return;
- }
- }
- }
- }
-
- @EventHandler
- public void CauldronLevelChangeEvent(CauldronLevelChangeEvent e) {
- Planet p = PlanetUtils.getPlanet(e.getBlock().getWorld());
- if (p != null) {
- if (p.getCold()) {
- e.getBlock().getWorld().playSound(e.getBlock().getLocation(), Sound.BLOCK_FIRE_EXTINGUISH, 1.0F, 1.0F);
- e.setNewLevel(0);
- return;
- }
- }
- }
+ @EventHandler(priority = EventPriority.HIGHEST)
+ public void EntitySpawnEvent(EntitySpawnEvent e) {
+ Planet p = PlanetUtils.getPlanet(e.getEntity().getWorld());
+ if (p != null) {
+ if (!p.getMobSpawnable()) {
+ if (e.getEntity() instanceof Mob || e.getEntity() instanceof Animals || e.getEntity() instanceof Monster
+ || e.getEntity() instanceof Boss) {
+ e.setCancelled(true);
+ }
+
+ }
+ }
+ }
+
+ @EventHandler(priority = EventPriority.HIGHEST)
+ public void PlayerChangeWorldEvent(PlayerChangedWorldEvent e) {
+ e.getPlayer().removePotionEffect(PotionEffectType.JUMP);
+ e.getPlayer().removePotionEffect(PotionEffectType.SLOW_FALLING);
+
+ Planet p = PlanetUtils.getPlanet(e.getPlayer().getWorld());
+ if (p != null) {
+ if (!p.getHabitable()) {
+ if (ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getHelmet())
+ && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getChestplate())
+ && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getLeggings())
+ && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getBoots())) {
+ World PreviousWorld = e.getPlayer().getWorld();
+ new BukkitRunnable() {
+
+ @Override
+ public void run() {
+ if (!PreviousWorld.equals(e.getPlayer().getWorld()) || !e.getPlayer().isOnline()) {
+ this.cancel();
+ return;
+ }
+ // 扣氧气线程
+ if (ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getHelmet())
+ && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getChestplate())
+ && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getLeggings())
+ && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getBoots())) {
+ if (RocketUtils.getOxygen(e.getPlayer().getInventory().getHelmet()) > 0
+ && RocketUtils.getOxygen(e.getPlayer().getInventory().getChestplate()) > 0
+ && RocketUtils.getOxygen(e.getPlayer().getInventory().getLeggings()) > 0
+ && RocketUtils.getOxygen(e.getPlayer().getInventory().getBoots()) > 0) {
+ ItemStack helmet = e.getPlayer().getInventory().getHelmet();
+ RocketUtils.setOxygen(helmet, RocketUtils.getOxygen(helmet) - 1);
+
+ ItemStack chestplate = e.getPlayer().getInventory().getChestplate();
+ RocketUtils.setOxygen(chestplate, RocketUtils.getOxygen(chestplate) - 1);
+
+ ItemStack leggings = e.getPlayer().getInventory().getLeggings();
+ RocketUtils.setOxygen(leggings, RocketUtils.getOxygen(leggings) - 1);
+
+ ItemStack boots = e.getPlayer().getInventory().getBoots();
+ RocketUtils.setOxygen(boots, RocketUtils.getOxygen(boots) - 1);
+ }
+ }
+ }
+
+ }.runTaskTimerAsynchronously(ClayTech.getInstance(), 1200, 1200);
+ new BukkitRunnable() {
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public void run() {
+ if (!PreviousWorld.equals(e.getPlayer().getWorld()) || !e.getPlayer().isOnline()) {
+ this.cancel();
+ return;
+ }
+ if (!(ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getHelmet())
+ && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getChestplate())
+ && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getLeggings())
+ && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getBoots()))) {
+ // 扣血
+ e.getPlayer().sendTitle(Lang.readGeneralText("SpaceSuitError"),
+ Lang.readGeneralText("SpaceSuitError_Sub"));
+ e.getPlayer().damage(5);
+
+ } else {
+ if (!(RocketUtils.getOxygen(e.getPlayer().getInventory().getHelmet()) > 0
+ && RocketUtils.getOxygen(e.getPlayer().getInventory().getChestplate()) > 0
+ && RocketUtils.getOxygen(e.getPlayer().getInventory().getLeggings()) > 0
+ && RocketUtils.getOxygen(e.getPlayer().getInventory().getBoots()) > 0)) {
+ // 扣血
+ e.getPlayer().sendTitle(Lang.readGeneralText("SpaceSuitError"),
+ Lang.readGeneralText("SpaceSuitError_Sub"));
+ e.getPlayer().damage(5);
+ } else {
+ int harmlevel = p.getHarmLevel();
+ if (RocketUtils
+ .getProtectLevel(e.getPlayer().getInventory().getHelmet()) < harmlevel
+ || RocketUtils.getProtectLevel(
+ e.getPlayer().getInventory().getChestplate()) < harmlevel
+ || RocketUtils.getProtectLevel(
+ e.getPlayer().getInventory().getLeggings()) < harmlevel
+ || RocketUtils.getProtectLevel(
+ e.getPlayer().getInventory().getBoots()) < harmlevel) {
+ // 扣血
+ e.getPlayer().sendTitle(Lang.readGeneralText("SpaceSuitError"),
+ Lang.readGeneralText("SpaceSuitError_Sub"));
+ e.getPlayer().damage(5);
+ }
+ }
+ }
+ }
+
+ }.runTaskTimer(ClayTech.getInstance(), 20, 20);
+ } else {
+ World PreviousWorld = e.getPlayer().getWorld();
+ new BukkitRunnable() {
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public void run() {
+ if (!PreviousWorld.equals(e.getPlayer().getWorld()) || !e.getPlayer().isOnline()) {
+ this.cancel();
+ return;
+ }
+ if (!(ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getHelmet())
+ && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getChestplate())
+ && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getLeggings())
+ && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getBoots()))) {
+ // 扣血
+ e.getPlayer().sendTitle(Lang.readGeneralText("SpaceSuitError"),
+ Lang.readGeneralText("SpaceSuitError_Sub"));
+ e.getPlayer().damage(5);
+
+ } else {
+ if (!(RocketUtils.getOxygen(e.getPlayer().getInventory().getHelmet()) > 0
+ && RocketUtils.getOxygen(e.getPlayer().getInventory().getChestplate()) > 0
+ && RocketUtils.getOxygen(e.getPlayer().getInventory().getLeggings()) > 0
+ && RocketUtils.getOxygen(e.getPlayer().getInventory().getBoots()) > 0)) {
+ // 扣血
+ e.getPlayer().sendTitle(Lang.readGeneralText("SpaceSuitError"),
+ Lang.readGeneralText("SpaceSuitError_Sub"));
+ e.getPlayer().damage(5);
+ } else {
+ int harmlevel = p.getHarmLevel();
+ if (RocketUtils
+ .getProtectLevel(e.getPlayer().getInventory().getHelmet()) < harmlevel
+ || RocketUtils.getProtectLevel(
+ e.getPlayer().getInventory().getChestplate()) < harmlevel
+ || RocketUtils.getProtectLevel(
+ e.getPlayer().getInventory().getLeggings()) < harmlevel
+ || RocketUtils.getProtectLevel(
+ e.getPlayer().getInventory().getBoots()) < harmlevel) {
+ // 扣血
+ e.getPlayer().sendTitle(Lang.readGeneralText("SpaceSuitError"),
+ Lang.readGeneralText("SpaceSuitError_Sub"));
+ e.getPlayer().damage(5);
+ }
+ }
+ }
+ }
+
+ }.runTaskTimer(ClayTech.getInstance(), 20, 20);
+ }
+ }
+ if (p.getGravity() > 1) {
+ e.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 99999, p.getGravity() - 1));
+ e.getPlayer()
+ .addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, 99999, p.getGravity() - 1));
+ }
+ }
+ }
+
+ @EventHandler
+ public void PlayerJoinEvent(PlayerJoinEvent e) {
+ e.getPlayer().removePotionEffect(PotionEffectType.JUMP);
+ e.getPlayer().removePotionEffect(PotionEffectType.SLOW_FALLING);
+
+ Planet p = PlanetUtils.getPlanet(e.getPlayer().getWorld());
+ if (p != null) {
+ if (!p.getHabitable()) {
+ if (ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getHelmet())
+ && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getChestplate())
+ && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getLeggings())
+ && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getBoots())) {
+ World PreviousWorld = e.getPlayer().getWorld();
+ new BukkitRunnable() {
+
+ @Override
+ public void run() {
+ if (!PreviousWorld.equals(e.getPlayer().getWorld()) || !e.getPlayer().isOnline()) {
+ this.cancel();
+ return;
+ }
+ // 扣氧气线程
+ if (ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getHelmet())
+ && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getChestplate())
+ && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getLeggings())
+ && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getBoots())) {
+ if (RocketUtils.getOxygen(e.getPlayer().getInventory().getHelmet()) > 0
+ && RocketUtils.getOxygen(e.getPlayer().getInventory().getChestplate()) > 0
+ && RocketUtils.getOxygen(e.getPlayer().getInventory().getLeggings()) > 0
+ && RocketUtils.getOxygen(e.getPlayer().getInventory().getBoots()) > 0) {
+ ItemStack helmet = e.getPlayer().getInventory().getHelmet();
+ RocketUtils.setOxygen(helmet, RocketUtils.getOxygen(helmet) - 1);
+
+ ItemStack chestplate = e.getPlayer().getInventory().getChestplate();
+ RocketUtils.setOxygen(chestplate, RocketUtils.getOxygen(chestplate) - 1);
+
+ ItemStack leggings = e.getPlayer().getInventory().getLeggings();
+ RocketUtils.setOxygen(leggings, RocketUtils.getOxygen(leggings) - 1);
+
+ ItemStack boots = e.getPlayer().getInventory().getBoots();
+ RocketUtils.setOxygen(boots, RocketUtils.getOxygen(boots) - 1);
+ }
+ }
+ }
+
+ }.runTaskTimerAsynchronously(ClayTech.getInstance(), 1200, 1200);
+ new BukkitRunnable() {
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public void run() {
+ if (!PreviousWorld.equals(e.getPlayer().getWorld()) || !e.getPlayer().isOnline()) {
+ this.cancel();
+ return;
+ }
+ if (!(ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getHelmet())
+ && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getChestplate())
+ && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getLeggings())
+ && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getBoots()))) {
+ // 扣血
+ e.getPlayer().sendTitle(Lang.readGeneralText("SpaceSuitError"),
+ Lang.readGeneralText("SpaceSuitError_Sub"));
+ e.getPlayer().damage(5);
+
+ } else {
+ if (!(RocketUtils.getOxygen(e.getPlayer().getInventory().getHelmet()) > 0
+ && RocketUtils.getOxygen(e.getPlayer().getInventory().getChestplate()) > 0
+ && RocketUtils.getOxygen(e.getPlayer().getInventory().getLeggings()) > 0
+ && RocketUtils.getOxygen(e.getPlayer().getInventory().getBoots()) > 0)) {
+ // 扣血
+ e.getPlayer().sendTitle(Lang.readGeneralText("SpaceSuitError"),
+ Lang.readGeneralText("SpaceSuitError_Sub"));
+ e.getPlayer().damage(5);
+ } else {
+ int harmlevel = p.getHarmLevel();
+ if (RocketUtils
+ .getProtectLevel(e.getPlayer().getInventory().getHelmet()) < harmlevel
+ || RocketUtils.getProtectLevel(
+ e.getPlayer().getInventory().getChestplate()) < harmlevel
+ || RocketUtils.getProtectLevel(
+ e.getPlayer().getInventory().getLeggings()) < harmlevel
+ || RocketUtils.getProtectLevel(
+ e.getPlayer().getInventory().getBoots()) < harmlevel) {
+ // 扣血
+ e.getPlayer().sendTitle(Lang.readGeneralText("SpaceSuitError"),
+ Lang.readGeneralText("SpaceSuitError_Sub"));
+ e.getPlayer().damage(5);
+ }
+ }
+ }
+ }
+
+ }.runTaskTimer(ClayTech.getInstance(), 20, 20);
+ } else {
+ World PreviousWorld = e.getPlayer().getWorld();
+ new BukkitRunnable() {
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public void run() {
+ if (!PreviousWorld.equals(e.getPlayer().getWorld()) || !e.getPlayer().isOnline()) {
+ this.cancel();
+ return;
+ }
+ if (!(ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getHelmet())
+ && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getChestplate())
+ && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getLeggings())
+ && ClayTechManager.isSpaceSuit(e.getPlayer().getInventory().getBoots()))) {
+ // 扣血
+ e.getPlayer().sendTitle(Lang.readGeneralText("SpaceSuitError"),
+ Lang.readGeneralText("SpaceSuitError_Sub"));
+ e.getPlayer().damage(5);
+
+ } else {
+ if (!(RocketUtils.getOxygen(e.getPlayer().getInventory().getHelmet()) > 0
+ && RocketUtils.getOxygen(e.getPlayer().getInventory().getChestplate()) > 0
+ && RocketUtils.getOxygen(e.getPlayer().getInventory().getLeggings()) > 0
+ && RocketUtils.getOxygen(e.getPlayer().getInventory().getBoots()) > 0)) {
+ // 扣血
+ e.getPlayer().sendTitle(Lang.readGeneralText("SpaceSuitError"),
+ Lang.readGeneralText("SpaceSuitError_Sub"));
+ e.getPlayer().damage(5);
+ } else {
+ int harmlevel = p.getHarmLevel();
+ if (RocketUtils
+ .getProtectLevel(e.getPlayer().getInventory().getHelmet()) < harmlevel
+ || RocketUtils.getProtectLevel(
+ e.getPlayer().getInventory().getChestplate()) < harmlevel
+ || RocketUtils.getProtectLevel(
+ e.getPlayer().getInventory().getLeggings()) < harmlevel
+ || RocketUtils.getProtectLevel(
+ e.getPlayer().getInventory().getBoots()) < harmlevel) {
+ // 扣血
+ e.getPlayer().sendTitle(Lang.readGeneralText("SpaceSuitError"),
+ Lang.readGeneralText("SpaceSuitError_Sub"));
+ e.getPlayer().damage(5);
+ }
+ }
+ }
+ }
+
+ }.runTaskTimer(ClayTech.getInstance(), 20, 20);
+ }
+ }
+ if (p.getGravity() > 1) {
+ e.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 99999, p.getGravity() - 1));
+ e.getPlayer()
+ .addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, 99999, p.getGravity() - 1));
+ }
+ }
+ }
+
+ @EventHandler(priority = EventPriority.HIGHEST)
+ public void EntityPotionEffectEvent(EntityPotionEffectEvent e) {
+ if (e.getCause() == Cause.MILK && e.getEntity() instanceof Player) {
+ Planet p = PlanetUtils.getPlanet(e.getEntity().getWorld());
+ if (p.getGravity() != 1) {
+ e.setCancelled(true);
+ e.getEntity().sendMessage(Lang.readGeneralText("Cant_Drink_Milk"));
+ }
+ }
+ }
+
+ @EventHandler(priority = EventPriority.HIGHEST)
+ public void PlayerTeleportEvent(PlayerTeleportEvent e) {
+ Planet p = PlanetUtils.getPlanet(e.getPlayer().getWorld());
+ Planet to = PlanetUtils.getPlanet(e.getTo().getWorld());
+ String inRocket = "false";
+ if (p != null) {
+ if (to != null) {
+ if (p.getPlanetWorldName().equalsIgnoreCase(to.getPlanetWorldName())) {
+ // 如果目标位置在当前世界
+ return;
+ }
+ }
+ if (Utils.readPlayerMetadataString(e.getPlayer(), "inrocket") != null) {
+ inRocket = Utils.readPlayerMetadataString(e.getPlayer(), "inrocket");
+ }
+ boolean ast = Utils.readPlayerMetadataBoolean(e.getPlayer(), "allowSpaceTeleport");
+ if (!inRocket.equalsIgnoreCase("true")
+ && !p.getPlanetWorldName().equalsIgnoreCase(ClayTech.getOverworld())) {
+ if (ast) {
+ e.getPlayer().setMetadata("allowSpaceTeleport",
+ new FixedMetadataValue(ClayTech.getInstance(), false));
+ return;
+ }
+ // 其他星球传送到主世界
+ e.getPlayer().sendMessage(Lang.readGeneralText("CantUseOtherTeleportInUniverse"));
+ e.setCancelled(true);
+ return;
+ }
+ }
+
+ if (to != null && p != null) {
+ if (Utils.readPlayerMetadataString(e.getPlayer(), "inrocket") != null) {
+ inRocket = Utils.readPlayerMetadataString(e.getPlayer(), "inrocket");
+ }
+ boolean ast = Utils.readPlayerMetadataBoolean(e.getPlayer(), "allowSpaceTeleport");
+ if (!inRocket.equalsIgnoreCase("true") && p.getPlanetWorldName().equalsIgnoreCase(ClayTech.getOverworld())
+ && !to.getPlanetWorldName().equalsIgnoreCase(ClayTech.getOverworld())) {
+ if (ast) {
+ e.getPlayer().setMetadata("allowSpaceTeleport",
+ new FixedMetadataValue(ClayTech.getInstance(), false));
+ return;
+ }
+ // 在主世界传送到其他星球
+ e.getPlayer().sendMessage(Lang.readGeneralText("CantUseOtherTeleportInUniverse"));
+ e.setCancelled(true);
+ return;
+ }
+ }
+ }
+
+ @EventHandler
+ public void EntityDamageEvent(EntityDamageEvent e) {
+ if (e.getEntityType() == EntityType.PLAYER && e.getCause() == DamageCause.FALL) {
+ Player p = (Player) e.getEntity();
+ if (ClayTechManager.isSpaceSuit(p.getInventory().getHelmet())
+ && ClayTechManager.isSpaceSuit(p.getInventory().getChestplate())
+ && ClayTechManager.isSpaceSuit(p.getInventory().getLeggings())
+ && ClayTechManager.isSpaceSuit(p.getInventory().getBoots())) {
+ e.setDamage(e.getDamage() - e.getFinalDamage());
+ if (Utils.readPlayerMetadataBoolean(p, "SpaceSuitNoCostDurability")) {
+ e.setCancelled(true);
+ p.setMetadata("SpaceSuitNoCostDurability", new FixedMetadataValue(ClayTech.getInstance(), false));
+ }
+ p.sendMessage(Lang.readGeneralText("SpaceSuitFall"));
+ }
+ }
+ }
+
+ @EventHandler
+ public void PlayerBucketEmptyEvent(PlayerBucketEmptyEvent e) {
+ // 禁止玩家放置液体
+ Planet p = PlanetUtils.getPlanet(e.getBlock().getWorld());
+ if (p != null) {
+ if (p.getCold()) {
+ if (e.getPlayer().getInventory().getItemInMainHand().getType() == Material.WATER_BUCKET) {
+ new BukkitRunnable() {
+
+ @Override
+ public void run() {
+ e.getBlock().getWorld().playSound(e.getBlock().getLocation(), Sound.BLOCK_FIRE_EXTINGUISH,
+ 1.0F, 1.0F);
+ e.getBlock().setType(Material.BLUE_ICE);
+ }
+
+ }.runTaskLater(ClayTech.getInstance(), 30);
+ return;
+ }
+ if (e.getPlayer().getInventory().getItemInMainHand().getType() == Material.LAVA_BUCKET) {
+ new BukkitRunnable() {
+
+ @Override
+ public void run() {
+ e.getBlock().getWorld().playSound(e.getBlock().getLocation(), Sound.BLOCK_FIRE_EXTINGUISH,
+ 1.0F, 1.0F);
+ e.getBlock().setType(Material.OBSIDIAN);
+ }
+
+ }.runTaskLater(ClayTech.getInstance(), 30);
+ return;
+ }
+ }
+ }
+ }
+
+ @EventHandler
+ public void BlockDispenseEvent(BlockDispenseEvent e) {
+ // 禁止发射器放置液体
+ Planet p = PlanetUtils.getPlanet(e.getBlock().getWorld());
+ if (p != null) {
+ if (p.getCold()) {
+ if (e.getItem().getType() == Material.WATER_BUCKET) {
+ new BukkitRunnable() {
+
+ @Override
+ public void run() {
+ Dispenser d = (Dispenser) e.getBlock().getBlockData();
+ Block targetBlock = e.getBlock().getRelative(d.getFacing());
+ e.getBlock().getWorld().playSound(e.getBlock().getLocation(), Sound.BLOCK_FIRE_EXTINGUISH,
+ 1.0F, 1.0F);
+ targetBlock.setType(Material.BLUE_ICE);
+ }
+
+ }.runTaskLater(ClayTech.getInstance(), 30);
+ return;
+ }
+ if (e.getItem().getType() == Material.LAVA_BUCKET) {
+ new BukkitRunnable() {
+
+ @Override
+ public void run() {
+ Dispenser d = (Dispenser) e.getBlock().getBlockData();
+ Block targetBlock = e.getBlock().getRelative(d.getFacing());
+ e.getBlock().getWorld().playSound(e.getBlock().getLocation(), Sound.BLOCK_FIRE_EXTINGUISH,
+ 1.0F, 1.0F);
+ targetBlock.setType(Material.OBSIDIAN);
+ }
+
+ }.runTaskLater(ClayTech.getInstance(), 30);
+ return;
+ }
+ }
+ }
+ }
+
+ @EventHandler
+ public void CauldronLevelChangeEvent(CauldronLevelChangeEvent e) {
+ Planet p = PlanetUtils.getPlanet(e.getBlock().getWorld());
+ if (p != null) {
+ if (p.getCold()) {
+ e.getBlock().getWorld().playSound(e.getBlock().getLocation(), Sound.BLOCK_FIRE_EXTINGUISH, 1.0F, 1.0F);
+ e.setNewLevel(0);
+ return;
+ }
+ }
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/listeners/RailwayListener.java b/src/main/java/club/claycoffee/ClayTech/listeners/RailwayListener.java
index 8e5168d..86639fe 100644
--- a/src/main/java/club/claycoffee/ClayTech/listeners/RailwayListener.java
+++ b/src/main/java/club/claycoffee/ClayTech/listeners/RailwayListener.java
@@ -1,5 +1,7 @@
package club.claycoffee.ClayTech.listeners;
+import club.claycoffee.ClayTech.ClayTech;
+import me.mrCookieSlime.Slimefun.api.BlockStorage;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
@@ -9,30 +11,27 @@
import org.bukkit.event.Listener;
import org.bukkit.event.vehicle.VehicleMoveEvent;
-import club.claycoffee.ClayTech.ClayTech;
-import me.mrCookieSlime.Slimefun.api.BlockStorage;
-
public class RailwayListener implements Listener {
- @EventHandler
- public void VehicleMoveEvent(VehicleMoveEvent e) {
- if (e.getVehicle() instanceof Minecart) {
- Minecart ve = (Minecart) e.getVehicle();
- World veworld = ve.getWorld();
- Location veloc = ve.getLocation();
- Block rail = veworld.getBlockAt(veloc);
- if (rail.getBlockData().getMaterial() == Material.POWERED_RAIL) {
- if (BlockStorage.checkID(rail) != null) {
- if (BlockStorage.checkID(rail).equalsIgnoreCase("CLAY_HIGHSPEED_RAILWAY")) {
- ve.setMaxSpeed(0.4d * new Integer(ClayTech.getHighRailSpeed()).doubleValue());
- } else {
- ve.setMaxSpeed(0.4d);
- }
- } else {
- ve.setMaxSpeed(0.4d);
- }
- } else {
- ve.setMaxSpeed(0.4d);
- }
- }
- }
+ @EventHandler
+ public void VehicleMoveEvent(VehicleMoveEvent e) {
+ if (e.getVehicle() instanceof Minecart) {
+ Minecart ve = (Minecart) e.getVehicle();
+ World veworld = ve.getWorld();
+ Location veloc = ve.getLocation();
+ Block rail = veworld.getBlockAt(veloc);
+ if (rail.getBlockData().getMaterial() == Material.POWERED_RAIL) {
+ if (BlockStorage.checkID(rail) != null) {
+ if (BlockStorage.checkID(rail).equalsIgnoreCase("CLAY_HIGHSPEED_RAILWAY")) {
+ ve.setMaxSpeed(0.4d * new Integer(ClayTech.getHighRailSpeed()).doubleValue());
+ } else {
+ ve.setMaxSpeed(0.4d);
+ }
+ } else {
+ ve.setMaxSpeed(0.4d);
+ }
+ } else {
+ ve.setMaxSpeed(0.4d);
+ }
+ }
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/listeners/RocketLauncherListener.java b/src/main/java/club/claycoffee/ClayTech/listeners/RocketLauncherListener.java
index dbdee79..739dfa8 100644
--- a/src/main/java/club/claycoffee/ClayTech/listeners/RocketLauncherListener.java
+++ b/src/main/java/club/claycoffee/ClayTech/listeners/RocketLauncherListener.java
@@ -1,9 +1,13 @@
package club.claycoffee.ClayTech.listeners;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
+import club.claycoffee.ClayTech.ClayTech;
+import club.claycoffee.ClayTech.ClayTechData;
+import club.claycoffee.ClayTech.ClayTechItems;
+import club.claycoffee.ClayTech.api.ClayTechManager;
+import club.claycoffee.ClayTech.api.Planet;
+import club.claycoffee.ClayTech.api.listeners.RocketLandEvent;
+import club.claycoffee.ClayTech.utils.*;
+import me.mrCookieSlime.Slimefun.api.BlockStorage;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@@ -12,229 +16,219 @@
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
+import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.scheduler.BukkitRunnable;
-import club.claycoffee.ClayTech.ClayTech;
-import club.claycoffee.ClayTech.ClayTechData;
-import club.claycoffee.ClayTech.ClayTechItems;
-import club.claycoffee.ClayTech.api.ClayTechManager;
-import club.claycoffee.ClayTech.api.Planet;
-import club.claycoffee.ClayTech.api.listeners.RocketLandEvent;
-import club.claycoffee.ClayTech.utils.DataYML;
-import club.claycoffee.ClayTech.utils.Lang;
-import club.claycoffee.ClayTech.utils.PlanetUtils;
-import club.claycoffee.ClayTech.utils.RocketUtils;
-import club.claycoffee.ClayTech.utils.Utils;
-import me.mrCookieSlime.Slimefun.api.BlockStorage;
-
-import org.bukkit.event.inventory.InventoryClickEvent;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
public class RocketLauncherListener implements Listener {
- private static final int[] planet = { 19, 20, 21, 22, 23, 24, 25, 28, 29, 30, 31, 32, 33, 34, 37, 38, 39, 40, 41,
- 42, 43 };
+ private static final int[] planet = {19, 20, 21, 22, 23, 24, 25, 28, 29, 30, 31, 32, 33, 34, 37, 38, 39, 40, 41,
+ 42, 43};
- @EventHandler
- public void InventoryMoveItemEvent(InventoryClickEvent e) {
- if (e.getWhoClicked() instanceof Player) {
- Player p = (Player) e.getWhoClicked();
- if (e.getView().getTitle().equalsIgnoreCase(Lang.readMachinesText("ROCKET_LAUNCHER"))) {
- e.setCancelled(true);
- if (Utils.ExitsInList(e.getSlot(), planet)) {
- if (e.getInventory().getItem(e.getSlot()) != null) {
- ItemStack handItem = p.getInventory().getItemInMainHand();
- if (ClayTechManager.isRocket(handItem)) {
- // 是火箭
- Inventory inv = e.getInventory();
- Block b = ClayTechData.RunningLaunchersG.get(inv);
- int currentPage = 1;
- if (Utils.getMetadata(b, "currentPage") != null) {
- currentPage = new Integer(Utils.getMetadata(b, "currentPage")).intValue();
- }
- int index = (currentPage - 1) * 21 + (e.getSlot() - 18) - 1;
- Planet current = PlanetUtils.getPlanet(b.getWorld());
- // 排列星球
- List pl = new ArrayList();
- for (Planet p1 : ClayTech.getPlanets()) {
- pl.add(p1);
- }
- Planet[] pl2 = pl.toArray(new Planet[pl.size()]);
- List d = new ArrayList();
- for (Planet p1 : pl2) {
- d.add((Integer) PlanetUtils.getDistance(current, p1));
- }
- Integer[] distance = d.toArray(new Integer[d.size()]);
- for (int i = 0; i < distance.length; i++) {
- for (int j = 0; j < distance.length - i - 1; j++) {
- if (distance[j].intValue() > distance[j + 1].intValue()) {
- int temp = distance[j + 1];
- distance[j + 1] = distance[j];
- distance[j] = temp;
+ @EventHandler
+ public void InventoryMoveItemEvent(InventoryClickEvent e) {
+ if (e.getWhoClicked() instanceof Player) {
+ Player p = (Player) e.getWhoClicked();
+ if (e.getView().getTitle().equalsIgnoreCase(Lang.readMachinesText("ROCKET_LAUNCHER"))) {
+ e.setCancelled(true);
+ if (Utils.ExitsInList(e.getSlot(), planet)) {
+ if (e.getInventory().getItem(e.getSlot()) != null) {
+ ItemStack handItem = p.getInventory().getItemInMainHand();
+ if (ClayTechManager.isRocket(handItem)) {
+ // 是火箭
+ Inventory inv = e.getInventory();
+ Block b = ClayTechData.RunningLaunchersG.get(inv);
+ int currentPage = 1;
+ if (Utils.getMetadata(b, "currentPage") != null) {
+ currentPage = new Integer(Utils.getMetadata(b, "currentPage")).intValue();
+ }
+ int index = (currentPage - 1) * 21 + (e.getSlot() - 18) - 1;
+ Planet current = PlanetUtils.getPlanet(b.getWorld());
+ // 排列星球
+ List pl = new ArrayList();
+ for (Planet p1 : ClayTech.getPlanets()) {
+ pl.add(p1);
+ }
+ Planet[] pl2 = pl.toArray(new Planet[pl.size()]);
+ List d = new ArrayList();
+ for (Planet p1 : pl2) {
+ d.add((Integer) PlanetUtils.getDistance(current, p1));
+ }
+ Integer[] distance = d.toArray(new Integer[d.size()]);
+ for (int i = 0; i < distance.length; i++) {
+ for (int j = 0; j < distance.length - i - 1; j++) {
+ if (distance[j].intValue() > distance[j + 1].intValue()) {
+ int temp = distance[j + 1];
+ distance[j + 1] = distance[j];
+ distance[j] = temp;
- Planet temp2 = pl2[j + 1];
- pl2[j + 1] = pl2[j];
- pl2[j] = temp2;
- }
- }
- }
- pl = Arrays.asList(pl2);
+ Planet temp2 = pl2[j + 1];
+ pl2[j + 1] = pl2[j];
+ pl2[j] = temp2;
+ }
+ }
+ }
+ pl = Arrays.asList(pl2);
- Planet target = pl.get(index);
- if (!target.getPlanetWorldName().equalsIgnoreCase(current.getPlanetWorldName())) {
- if (PlanetUtils.getFuel(current, target) <= RocketUtils.getFuel(handItem)) {
- if (handItem.getAmount() == 1) {
- if (ClayTech.isSpaceTravelNeedPerm()) {
- if (!p.hasPermission("claytech.travel." + target.getPlanetWorldName())) {
- p.sendMessage(Lang.readGeneralText("no_permission"));
- return;
- }
- }
- String inRocket = "false";
- if (Utils.readPlayerMetadataString(p, "inrocket") != null) {
- inRocket = Utils.readPlayerMetadataString(p, "inrocket");
- }
- if (!inRocket.equalsIgnoreCase("true")) {
- p.setMetadata("inrocket",
- new FixedMetadataValue(ClayTech.getInstance(), "true"));
- p.sendMessage(Lang.readGeneralText("RocketOK"));
- new BukkitRunnable() {
- int time = 0;
+ Planet target = pl.get(index);
+ if (!target.getPlanetWorldName().equalsIgnoreCase(current.getPlanetWorldName())) {
+ if (PlanetUtils.getFuel(current, target) <= RocketUtils.getFuel(handItem)) {
+ if (handItem.getAmount() == 1) {
+ if (ClayTech.isSpaceTravelNeedPerm()) {
+ if (!p.hasPermission("claytech.travel." + target.getPlanetWorldName())) {
+ p.sendMessage(Lang.readGeneralText("no_permission"));
+ return;
+ }
+ }
+ String inRocket = "false";
+ if (Utils.readPlayerMetadataString(p, "inrocket") != null) {
+ inRocket = Utils.readPlayerMetadataString(p, "inrocket");
+ }
+ if (!inRocket.equalsIgnoreCase("true")) {
+ p.setMetadata("inrocket",
+ new FixedMetadataValue(ClayTech.getInstance(), "true"));
+ p.sendMessage(Lang.readGeneralText("RocketOK"));
+ new BukkitRunnable() {
+ int time = 0;
- @SuppressWarnings("deprecation")
- @Override
- public void run() {
- time++;
- p.sendMessage(Lang.readGeneralText("RocketCountdown")
- .replaceAll("%seconds%", "" + (10 - time)));
- ItemStack thandItem = p.getInventory().getItemInMainHand();
- if (ClayTechManager.isRocket(thandItem)) {
- if (time >= 10) {
- BlockStorage._integrated_removeBlockInfo(b.getLocation(),
- true);
- b.setType(Material.AIR);
- p.getInventory().addItem(ClayTechItems.ROCKET_LAUNCHER);
- DataYML planetsData = ClayTech.getPlanetDataYML();
- FileConfiguration pd = planetsData.getCustomConfig();
- if (pd.getBoolean(p.getName() + "."
- + target.getPlanetWorldName() + ".base")) {
- int X = pd.getInt(p.getName() + "."
- + target.getPlanetWorldName() + ".baseX");
- int Y = pd.getInt(p.getName() + "."
- + target.getPlanetWorldName() + ".baseY");
- int Z = pd.getInt(p.getName() + "."
- + target.getPlanetWorldName() + ".baseZ");
- p.teleport(new Location(
- Bukkit.getWorld(target.getPlanetWorldName()), X,
- Y, Z), TeleportCause.PLUGIN);
- p.sendTitle(Lang.readGeneralText("TeleportedToBase"),
- Lang.readGeneralText("TeleportedToBase_Sub"));
- } else {
- try {
- p.teleport(
- PlanetUtils.findSafeLocation(
- Bukkit.getWorld(target
- .getPlanetWorldName())),
- TeleportCause.PLUGIN);
- } catch (Exception ex) {
- p.sendMessage(
- Lang.readGeneralText("LocationFatal"));
- e.setCancelled(true);
- return;
- }
- }
- p.setMetadata("inrocket", new FixedMetadataValue(
- ClayTech.getInstance(), "false"));
- RocketUtils.setFuel(thandItem,
- RocketUtils.getFuel(thandItem)
- - PlanetUtils.getFuel(current, target));
- new BukkitRunnable() {
+ @SuppressWarnings("deprecation")
+ @Override
+ public void run() {
+ time++;
+ p.sendMessage(Lang.readGeneralText("RocketCountdown")
+ .replaceAll("%seconds%", "" + (10 - time)));
+ ItemStack thandItem = p.getInventory().getItemInMainHand();
+ if (ClayTechManager.isRocket(thandItem)) {
+ if (time >= 10) {
+ BlockStorage._integrated_removeBlockInfo(b.getLocation(),
+ true);
+ b.setType(Material.AIR);
+ p.getInventory().addItem(ClayTechItems.ROCKET_LAUNCHER);
+ DataYML planetsData = ClayTech.getPlanetDataYML();
+ FileConfiguration pd = planetsData.getCustomConfig();
+ if (pd.getBoolean(p.getName() + "."
+ + target.getPlanetWorldName() + ".base")) {
+ int X = pd.getInt(p.getName() + "."
+ + target.getPlanetWorldName() + ".baseX");
+ int Y = pd.getInt(p.getName() + "."
+ + target.getPlanetWorldName() + ".baseY");
+ int Z = pd.getInt(p.getName() + "."
+ + target.getPlanetWorldName() + ".baseZ");
+ p.teleport(new Location(
+ Bukkit.getWorld(target.getPlanetWorldName()), X,
+ Y, Z), TeleportCause.PLUGIN);
+ p.sendTitle(Lang.readGeneralText("TeleportedToBase"),
+ Lang.readGeneralText("TeleportedToBase_Sub"));
+ } else {
+ try {
+ p.teleport(
+ PlanetUtils.findSafeLocation(
+ Bukkit.getWorld(target
+ .getPlanetWorldName())),
+ TeleportCause.PLUGIN);
+ } catch (Exception ex) {
+ p.sendMessage(
+ Lang.readGeneralText("LocationFatal"));
+ e.setCancelled(true);
+ return;
+ }
+ }
+ p.setMetadata("inrocket", new FixedMetadataValue(
+ ClayTech.getInstance(), "false"));
+ RocketUtils.setFuel(thandItem,
+ RocketUtils.getFuel(thandItem)
+ - PlanetUtils.getFuel(current, target));
+ new BukkitRunnable() {
- @Override
- public void run() {
- Bukkit.getPluginManager()
- .callEvent(new RocketLandEvent(p, current,
- target, thandItem));
+ @Override
+ public void run() {
+ Bukkit.getPluginManager()
+ .callEvent(new RocketLandEvent(p, current,
+ target, thandItem));
- }
+ }
- }.runTask(ClayTech.getInstance());
- p.sendMessage(Lang.readGeneralText("RocketArrived"));
- this.cancel();
- }
- } else {
- p.setMetadata("inrocket", new FixedMetadataValue(
- ClayTech.getInstance(), "false"));
- p.sendMessage(Lang.readGeneralText("NotRocket"));
- this.cancel();
- }
- }
+ }.runTask(ClayTech.getInstance());
+ p.sendMessage(Lang.readGeneralText("RocketArrived"));
+ this.cancel();
+ }
+ } else {
+ p.setMetadata("inrocket", new FixedMetadataValue(
+ ClayTech.getInstance(), "false"));
+ p.sendMessage(Lang.readGeneralText("NotRocket"));
+ this.cancel();
+ }
+ }
- }.runTaskTimer(ClayTech.getInstance(), 0, 20);
- } else {
- p.sendMessage(Lang.readGeneralText("AlreadyInRocket"));
- e.setCancelled(true);
- }
- } else {
- p.sendMessage(Lang.readGeneralText("StakingRockets"));
- e.setCancelled(true);
- }
- } else {
- p.sendMessage(Lang.readGeneralText("NotEnoughFuel"));
- e.setCancelled(true);
- }
- } else {
- p.sendMessage(Lang.readGeneralText("SamePlanet"));
- e.setCancelled(true);
- }
- } else {
- p.sendMessage(Lang.readGeneralText("NotRocket"));
- e.setCancelled(true);
- }
- } else {
- e.setCancelled(true);
- p.openInventory(e.getInventory());
- }
- }
- Inventory inv = e.getInventory();
- Block b = ClayTechData.RunningLaunchersG.get(inv);
- Planet current = PlanetUtils.getPlanet(b.getWorld());
- int currentPage = 1;
- if (e.getSlot() == 46) {
- // 上一页
- if (b != null) {
- if (Utils.getMetadata(b, "currentPage") != null) {
- currentPage = new Integer(Utils.getMetadata(b, "currentPage")).intValue();
- }
- if (currentPage > 1) {
- currentPage -= 1;
- Utils.setMetadata(b, "currentPage", currentPage + "");
- inv = PlanetUtils.renderLauncherMenu(current, inv, currentPage);
- } else {
- e.setCancelled(true);
- p.openInventory(inv);
- }
- }
- }
- if (e.getSlot() == 52) {
- // 下一页
- if (b != null) {
- if (Utils.getMetadata(b, "currentPage") != null) {
- currentPage = new Integer(Utils.getMetadata(b, "currentPage")).intValue();
- }
- if (currentPage < PlanetUtils.getTotalPage()) {
- currentPage += 1;
- Utils.setMetadata(b, "currentPage", currentPage + "");
- inv = PlanetUtils.renderLauncherMenu(current, inv, currentPage);
- } else {
- e.setCancelled(true);
- p.openInventory(inv);
- }
- }
- }
- }
- }
- }
+ }.runTaskTimer(ClayTech.getInstance(), 0, 20);
+ } else {
+ p.sendMessage(Lang.readGeneralText("AlreadyInRocket"));
+ e.setCancelled(true);
+ }
+ } else {
+ p.sendMessage(Lang.readGeneralText("StakingRockets"));
+ e.setCancelled(true);
+ }
+ } else {
+ p.sendMessage(Lang.readGeneralText("NotEnoughFuel"));
+ e.setCancelled(true);
+ }
+ } else {
+ p.sendMessage(Lang.readGeneralText("SamePlanet"));
+ e.setCancelled(true);
+ }
+ } else {
+ p.sendMessage(Lang.readGeneralText("NotRocket"));
+ e.setCancelled(true);
+ }
+ } else {
+ e.setCancelled(true);
+ p.openInventory(e.getInventory());
+ }
+ }
+ Inventory inv = e.getInventory();
+ Block b = ClayTechData.RunningLaunchersG.get(inv);
+ Planet current = PlanetUtils.getPlanet(b.getWorld());
+ int currentPage = 1;
+ if (e.getSlot() == 46) {
+ // 上一页
+ if (b != null) {
+ if (Utils.getMetadata(b, "currentPage") != null) {
+ currentPage = new Integer(Utils.getMetadata(b, "currentPage")).intValue();
+ }
+ if (currentPage > 1) {
+ currentPage -= 1;
+ Utils.setMetadata(b, "currentPage", currentPage + "");
+ inv = PlanetUtils.renderLauncherMenu(current, inv, currentPage);
+ } else {
+ e.setCancelled(true);
+ p.openInventory(inv);
+ }
+ }
+ }
+ if (e.getSlot() == 52) {
+ // 下一页
+ if (b != null) {
+ if (Utils.getMetadata(b, "currentPage") != null) {
+ currentPage = new Integer(Utils.getMetadata(b, "currentPage")).intValue();
+ }
+ if (currentPage < PlanetUtils.getTotalPage()) {
+ currentPage += 1;
+ Utils.setMetadata(b, "currentPage", currentPage + "");
+ inv = PlanetUtils.renderLauncherMenu(current, inv, currentPage);
+ } else {
+ e.setCancelled(true);
+ p.openInventory(inv);
+ }
+ }
+ }
+ }
+ }
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/listeners/WeaponListener.java b/src/main/java/club/claycoffee/ClayTech/listeners/WeaponListener.java
index c3e6b2d..e18a401 100644
--- a/src/main/java/club/claycoffee/ClayTech/listeners/WeaponListener.java
+++ b/src/main/java/club/claycoffee/ClayTech/listeners/WeaponListener.java
@@ -1,5 +1,7 @@
package club.claycoffee.ClayTech.listeners;
+import club.claycoffee.ClayTech.utils.Affect;
+import club.claycoffee.ClayTech.utils.Utils;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
@@ -9,40 +11,37 @@
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
-import club.claycoffee.ClayTech.utils.Affect;
-import club.claycoffee.ClayTech.utils.Utils;
-
public class WeaponListener implements Listener {
- @EventHandler(priority = EventPriority.HIGHEST)
- public void EntityDamageByEntityEvent(EntityDamageByEntityEvent e) {
- if (e.getDamager().getType() == EntityType.ARROW) {
- try {
- Player d = (Player) ((Projectile) e.getDamager()).getShooter();
- Player p = (Player) e.getEntity();
- Affect.AffectCheck(d, p);
- } catch (Exception err) {
- }
- } else {
- if (e.getDamager().getType() == EntityType.PLAYER && e.getEntity().getType() == EntityType.PLAYER) {
- Player d = (Player) e.getDamager();
- Player p = (Player) e.getEntity();
- Affect.AffectCheck(d, p);
- }
- }
- }
+ @EventHandler(priority = EventPriority.HIGHEST)
+ public void EntityDamageByEntityEvent(EntityDamageByEntityEvent e) {
+ if (e.getDamager().getType() == EntityType.ARROW) {
+ try {
+ Player d = (Player) ((Projectile) e.getDamager()).getShooter();
+ Player p = (Player) e.getEntity();
+ Affect.AffectCheck(d, p);
+ } catch (Exception err) {
+ }
+ } else {
+ if (e.getDamager().getType() == EntityType.PLAYER && e.getEntity().getType() == EntityType.PLAYER) {
+ Player d = (Player) e.getDamager();
+ Player p = (Player) e.getEntity();
+ Affect.AffectCheck(d, p);
+ }
+ }
+ }
- @EventHandler(priority = EventPriority.HIGHEST)
- public void PlayerInteractEntityEvent(PlayerInteractEntityEvent e) {
- if (e.getRightClicked().getType() == EntityType.PLAYER) {
- Player d = e.getPlayer();
- try {
- if (Utils.ExitsInList("§7钩子武器", Utils.getLore(d.getInventory().getItemInMainHand()))) {
- Player p = (Player) e.getRightClicked();
- Affect.AffectCheck(d, p);
- }
- } catch (Exception err) {
+ @EventHandler(priority = EventPriority.HIGHEST)
+ public void PlayerInteractEntityEvent(PlayerInteractEntityEvent e) {
+ if (e.getRightClicked().getType() == EntityType.PLAYER) {
+ Player d = e.getPlayer();
+ try {
+ if (Utils.ExitsInList("§7钩子武器", Utils.getLore(d.getInventory().getItemInMainHand()))) {
+ Player p = (Player) e.getRightClicked();
+ Affect.AffectCheck(d, p);
+ }
+ } catch (Exception err) {
- }
- }
- }
+ }
+ }
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/utils/Affect.java b/src/main/java/club/claycoffee/ClayTech/utils/Affect.java
index b3570c1..7f96619 100644
--- a/src/main/java/club/claycoffee/ClayTech/utils/Affect.java
+++ b/src/main/java/club/claycoffee/ClayTech/utils/Affect.java
@@ -1,46 +1,44 @@
package club.claycoffee.ClayTech.utils;
+import me.mrCookieSlime.Slimefun.api.Slimefun;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
-import club.claycoffee.ClayTech.utils.Utils;
-import me.mrCookieSlime.Slimefun.api.Slimefun;
-
public class Affect {
- public static void AffectCheck(Player d, Player e) {
- if (d.getInventory().getItemInMainHand() != null) {
- ItemStack HandItem = d.getInventory().getItemInMainHand();
- if (Slimefun.hasUnlocked(d, HandItem, true)) {
- try {
- if (Utils.ExitsInList(Lang.readGeneralText("Blind_5_effect"), Utils.getLore(HandItem))) {
- e.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 100, 4));
- }
- if (Utils.ExitsInList(Lang.readGeneralText("Slowness_5_effect"), Utils.getLore(HandItem))) {
- e.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 100, 4));
- }
- if (Utils.ExitsInList(Lang.readGeneralText("Confusion_5_effect"), Utils.getLore(HandItem))) {
- e.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 100, 4));
- }
- if (Utils.ExitsInList(Lang.readGeneralText("Poison_3_effect"), Utils.getLore(HandItem))) {
- e.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 40, 2));
- }
- } catch (NullPointerException err2) {
- }
- }
- }
- if (e.getInventory().getBoots() != null) {
- if (Slimefun.hasUnlocked(e, e.getInventory().getBoots(), true)) {
- try {
- if (Utils.ExitsInList(Lang.readGeneralText("Anti_Slowness_3_effect"),
- Utils.getLore(e.getInventory().getBoots()))
- && Slimefun.hasUnlocked(e, e.getInventory().getBoots(), true)) {
- d.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 40, 2));
- }
- } catch (NullPointerException err2) {
- }
- }
- }
- }
+ public static void AffectCheck(Player d, Player e) {
+ if (d.getInventory().getItemInMainHand() != null) {
+ ItemStack HandItem = d.getInventory().getItemInMainHand();
+ if (Slimefun.hasUnlocked(d, HandItem, true)) {
+ try {
+ if (Utils.ExitsInList(Lang.readGeneralText("Blind_5_effect"), Utils.getLore(HandItem))) {
+ e.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 100, 4));
+ }
+ if (Utils.ExitsInList(Lang.readGeneralText("Slowness_5_effect"), Utils.getLore(HandItem))) {
+ e.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 100, 4));
+ }
+ if (Utils.ExitsInList(Lang.readGeneralText("Confusion_5_effect"), Utils.getLore(HandItem))) {
+ e.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 100, 4));
+ }
+ if (Utils.ExitsInList(Lang.readGeneralText("Poison_3_effect"), Utils.getLore(HandItem))) {
+ e.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 40, 2));
+ }
+ } catch (NullPointerException err2) {
+ }
+ }
+ }
+ if (e.getInventory().getBoots() != null) {
+ if (Slimefun.hasUnlocked(e, e.getInventory().getBoots(), true)) {
+ try {
+ if (Utils.ExitsInList(Lang.readGeneralText("Anti_Slowness_3_effect"),
+ Utils.getLore(e.getInventory().getBoots()))
+ && Slimefun.hasUnlocked(e, e.getInventory().getBoots(), true)) {
+ d.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 40, 2));
+ }
+ } catch (NullPointerException err2) {
+ }
+ }
+ }
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/utils/ClayItem.java b/src/main/java/club/claycoffee/ClayTech/utils/ClayItem.java
index 34e942b..21e2cd6 100644
--- a/src/main/java/club/claycoffee/ClayTech/utils/ClayItem.java
+++ b/src/main/java/club/claycoffee/ClayTech/utils/ClayItem.java
@@ -1,57 +1,57 @@
package club.claycoffee.ClayTech.utils;
-import java.util.List;
-
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
+import java.util.List;
+
public class ClayItem {
- public static boolean hasDurability(ItemStack item) {
- for (String each : Utils.getLoreList(item)) {
- if (each.startsWith(Lang.readGeneralText("Durability"))) {
- return true;
- }
- }
- return false;
- }
+ public static boolean hasDurability(ItemStack item) {
+ for (String each : Utils.getLoreList(item)) {
+ if (each.startsWith(Lang.readGeneralText("Durability"))) {
+ return true;
+ }
+ }
+ return false;
+ }
- public static int getDurability(ItemStack item) {
- if (hasDurability(item)) {
- for (String each : Utils.getLoreList(item)) {
- if (each.startsWith(Lang.readGeneralText("Durability"))) {
- return new Integer(
- each.replaceFirst(Lang.readGeneralText("Durability") + ":", "").replace(" §6", ""))
- .intValue();
- }
- }
- } else {
- return -1;
- }
- return -1;
- }
+ public static int getDurability(ItemStack item) {
+ if (hasDurability(item)) {
+ for (String each : Utils.getLoreList(item)) {
+ if (each.startsWith(Lang.readGeneralText("Durability"))) {
+ return new Integer(
+ each.replaceFirst(Lang.readGeneralText("Durability") + ":", "").replace(" §6", ""))
+ .intValue();
+ }
+ }
+ } else {
+ return -1;
+ }
+ return -1;
+ }
- public static boolean setDurability(ItemStack item, int durability) {
- if (hasDurability(item)) {
- if (durability <= 0) {
- item.setAmount(0);
- return true;
- }
- List Lore = Utils.getLoreList(item);
- int i = 0;
- for (String each : Lore) {
- if (each.startsWith(Lang.readGeneralText("Durability"))) {
- each = each.replace("" + getDurability(item), "" + durability);
- Lore.set(i, each);
- break;
- }
- i++;
- }
- ItemMeta im = item.getItemMeta();
- im.setLore(Lore);
- item.setItemMeta(im);
- return true;
- }
+ public static boolean setDurability(ItemStack item, int durability) {
+ if (hasDurability(item)) {
+ if (durability <= 0) {
+ item.setAmount(0);
+ return true;
+ }
+ List Lore = Utils.getLoreList(item);
+ int i = 0;
+ for (String each : Lore) {
+ if (each.startsWith(Lang.readGeneralText("Durability"))) {
+ each = each.replace("" + getDurability(item), "" + durability);
+ Lore.set(i, each);
+ break;
+ }
+ i++;
+ }
+ ItemMeta im = item.getItemMeta();
+ im.setLore(Lore);
+ item.setItemMeta(im);
+ return true;
+ }
- return false;
- }
+ return false;
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/utils/DataYML.java b/src/main/java/club/claycoffee/ClayTech/utils/DataYML.java
index 7ab0990..198e914 100644
--- a/src/main/java/club/claycoffee/ClayTech/utils/DataYML.java
+++ b/src/main/java/club/claycoffee/ClayTech/utils/DataYML.java
@@ -1,73 +1,68 @@
package club.claycoffee.ClayTech.utils;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.io.UnsupportedEncodingException;
-
+import club.claycoffee.ClayTech.ClayTech;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
-import club.claycoffee.ClayTech.ClayTech;
+import java.io.*;
public class DataYML {
- private FileConfiguration config = null;
- private File configFile = null;
- private String configName;
+ private FileConfiguration config = null;
+ private File configFile = null;
+ private String configName;
- public DataYML(String configName) {
- this.configName = configName;
- }
+ public DataYML(String configName) {
+ this.configName = configName;
+ }
- public DataYML() {
- reloadCustomConfig();
- }
+ public DataYML() {
+ reloadCustomConfig();
+ }
- public void reloadCustomConfig() {
- if (configFile == null) {
- configFile = new File(ClayTech.getInstance().getDataFolder(), configName);
- }
- config = YamlConfiguration.loadConfiguration(configFile);
+ public void reloadCustomConfig() {
+ if (configFile == null) {
+ configFile = new File(ClayTech.getInstance().getDataFolder(), configName);
+ }
+ config = YamlConfiguration.loadConfiguration(configFile);
- Reader stream;
- try {
- stream = new InputStreamReader(ClayTech.getInstance().getResource(configName), "UTF8");
- if (stream != null) {
- YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(stream);
- config.setDefaults(defConfig);
- }
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- }
+ Reader stream;
+ try {
+ stream = new InputStreamReader(ClayTech.getInstance().getResource(configName), "UTF8");
+ if (stream != null) {
+ YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(stream);
+ config.setDefaults(defConfig);
+ }
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ }
+ }
- public FileConfiguration getCustomConfig() {
- if (config == null) {
- reloadCustomConfig();
- }
- return config;
- }
+ public FileConfiguration getCustomConfig() {
+ if (config == null) {
+ reloadCustomConfig();
+ }
+ return config;
+ }
- public void saveCustomConfig() {
- if (config == null || configFile == null) {
- return;
- }
- try {
- getCustomConfig().save(configFile);
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
+ public void saveCustomConfig() {
+ if (config == null || configFile == null) {
+ return;
+ }
+ try {
+ getCustomConfig().save(configFile);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
- public void saveCDefaultConfig() {
- if (config == null) {
- configFile = new File(ClayTech.getInstance().getDataFolder(), configName);
- }
- if (!configFile.exists()) {
- Bukkit.getLogger().info("§bInit.");
- ClayTech.getInstance().saveResource(configName, false);
- }
- }
+ public void saveCDefaultConfig() {
+ if (config == null) {
+ configFile = new File(ClayTech.getInstance().getDataFolder(), configName);
+ }
+ if (!configFile.exists()) {
+ Bukkit.getLogger().info("§bInit.");
+ ClayTech.getInstance().saveResource(configName, false);
+ }
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/utils/FileDownloader.java b/src/main/java/club/claycoffee/ClayTech/utils/FileDownloader.java
index 4004fd9..9ea44b6 100644
--- a/src/main/java/club/claycoffee/ClayTech/utils/FileDownloader.java
+++ b/src/main/java/club/claycoffee/ClayTech/utils/FileDownloader.java
@@ -1,87 +1,82 @@
package club.claycoffee.ClayTech.utils;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.HttpURLConnection;
-import java.net.URL;
-
+import club.claycoffee.ClayTech.ClayTech;
import com.google.gson.JsonArray;
-import club.claycoffee.ClayTech.ClayTech;
+import java.io.*;
+import java.net.HttpURLConnection;
+import java.net.URL;
public class FileDownloader {
- public static String updateFunc(String urlp, String fileName, String savePath, JsonArray ja) {
- try {
- URL url = new URL(urlp);
- HttpURLConnection conne = (HttpURLConnection) url.openConnection();
- conne.setConnectTimeout(5 * 1000);
- conne.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
+ public static String updateFunc(String urlp, String fileName, String savePath, JsonArray ja) {
+ try {
+ URL url = new URL(urlp);
+ HttpURLConnection conne = (HttpURLConnection) url.openConnection();
+ conne.setConnectTimeout(5 * 1000);
+ conne.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
- InputStream input = conne.getInputStream();
- byte[] getdata = readInputStream(input);
+ InputStream input = conne.getInputStream();
+ byte[] getdata = readInputStream(input);
- File saveDir = new File(savePath);
- if (!saveDir.exists()) {
- saveDir.mkdir();
- }
- FileOutputStream fos = new FileOutputStream(ClayTech.getInstance().getFile());
- fos.write(getdata);
- if (fos != null) {
- fos.close();
- }
- if (input != null) {
- input.close();
- }
- return saveDir + File.separator + fileName;
- } catch (Exception e) {
- e.printStackTrace();
- return "";
- }
+ File saveDir = new File(savePath);
+ if (!saveDir.exists()) {
+ saveDir.mkdir();
+ }
+ FileOutputStream fos = new FileOutputStream(ClayTech.getInstance().getFile());
+ fos.write(getdata);
+ if (fos != null) {
+ fos.close();
+ }
+ if (input != null) {
+ input.close();
+ }
+ return saveDir + File.separator + fileName;
+ } catch (Exception e) {
+ e.printStackTrace();
+ return "";
+ }
- }
+ }
- public static String downloadFile(String urlp, String fileName, String savePath) {
- try {
- URL url = new URL(urlp);
- HttpURLConnection conne = (HttpURLConnection) url.openConnection();
- conne.setConnectTimeout(5 * 1000);
- conne.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
+ public static String downloadFile(String urlp, String fileName, String savePath) {
+ try {
+ URL url = new URL(urlp);
+ HttpURLConnection conne = (HttpURLConnection) url.openConnection();
+ conne.setConnectTimeout(5 * 1000);
+ conne.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
- InputStream input = conne.getInputStream();
- byte[] getdata = readInputStream(input);
+ InputStream input = conne.getInputStream();
+ byte[] getdata = readInputStream(input);
- File saveDir = new File(savePath);
- if (!saveDir.exists()) {
- saveDir.mkdir();
- }
- File file = new File(saveDir + File.separator + fileName);
- FileOutputStream fos = new FileOutputStream(file);
- fos.write(getdata);
- if (fos != null) {
- fos.close();
- }
- if (input != null) {
- input.close();
- }
- return saveDir + File.separator + fileName;
- } catch (Exception e) {
- e.printStackTrace();
- return "";
- }
- }
+ File saveDir = new File(savePath);
+ if (!saveDir.exists()) {
+ saveDir.mkdir();
+ }
+ File file = new File(saveDir + File.separator + fileName);
+ FileOutputStream fos = new FileOutputStream(file);
+ fos.write(getdata);
+ if (fos != null) {
+ fos.close();
+ }
+ if (input != null) {
+ input.close();
+ }
+ return saveDir + File.separator + fileName;
+ } catch (Exception e) {
+ e.printStackTrace();
+ return "";
+ }
+ }
- public static byte[] readInputStream(InputStream inputStream) throws IOException {
- byte[] buffer = new byte[1024];
- int leng = 0;
- ByteArrayOutputStream b = new ByteArrayOutputStream();
- while ((leng = inputStream.read(buffer)) != -1) {
- b.write(buffer, 0, leng);
- }
- b.close();
- return b.toByteArray();
- }
+ public static byte[] readInputStream(InputStream inputStream) throws IOException {
+ byte[] buffer = new byte[1024];
+ int leng = 0;
+ ByteArrayOutputStream b = new ByteArrayOutputStream();
+ while ((leng = inputStream.read(buffer)) != -1) {
+ b.write(buffer, 0, leng);
+ }
+ b.close();
+ return b.toByteArray();
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/utils/Food.java b/src/main/java/club/claycoffee/ClayTech/utils/Food.java
index 7437c6e..cdfaa32 100644
--- a/src/main/java/club/claycoffee/ClayTech/utils/Food.java
+++ b/src/main/java/club/claycoffee/ClayTech/utils/Food.java
@@ -1,259 +1,255 @@
package club.claycoffee.ClayTech.utils;
-import java.util.Random;
-
+import club.claycoffee.ClayTech.ClayTechItems;
+import club.claycoffee.ClayTech.api.listeners.PlayerDrinkEvent;
+import club.claycoffee.ClayTech.api.listeners.PlayerEatEvent;
+import club.claycoffee.ClayTech.api.listeners.PlayerWashEvent;
import org.bukkit.Bukkit;
-import org.bukkit.CropState;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockBreakEvent;
+import org.bukkit.event.player.PlayerFishEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
-import org.bukkit.material.Crops;
import org.bukkit.potion.PotionEffect;
-import org.bukkit.event.player.PlayerFishEvent;
-import club.claycoffee.ClayTech.ClayTechItems;
-import club.claycoffee.ClayTech.api.listeners.PlayerDrinkEvent;
-import club.claycoffee.ClayTech.api.listeners.PlayerEatEvent;
-import club.claycoffee.ClayTech.api.listeners.PlayerWashEvent;
-import club.claycoffee.ClayTech.utils.Utils;
+import java.util.Random;
public class Food {
- public static void DrinkCheck(Player p, ItemStack HandItem, ItemStack food, int incraseFoodLevel,
- PotionEffect[] PotionEffect) {
- if (HandItem.hasItemMeta()) {
- if (HandItem.getItemMeta().getDisplayName().equals(food.getItemMeta().getDisplayName())) {
- if (p.getFoodLevel() < 20 || PotionEffect.length > 0) {
- p.playSound(p.getLocation(), Sound.ENTITY_GENERIC_DRINK, 1.0F, 1.0F);
- Inventory i = p.getInventory();
- ItemStack HoldItem = HandItem;
- HoldItem.setAmount(HoldItem.getAmount() - 1);
- if (Utils.IsItemContain(i, food)) {
- i.setItem(Utils.GetItemIndex(i, HoldItem), HoldItem);
- }
- i.addItem(ClayTechItems.DIRTY_DRINK_BOTTLE);
- if (p.getFoodLevel() + incraseFoodLevel > 20) {
- p.setFoodLevel(20);
- p.setSaturation(p.getSaturation() + (p.getFoodLevel() + incraseFoodLevel - 20));
- } else {
- p.setFoodLevel(p.getFoodLevel() + incraseFoodLevel);
- }
- for (PotionEffect pe : PotionEffect) {
- p.addPotionEffect(pe);
- }
- p.sendMessage(Lang.readGeneralText("Drink_Message"));
- Bukkit.getPluginManager().callEvent(new PlayerDrinkEvent(p, HandItem));
- } else {
- p.sendMessage(Lang.readGeneralText("Cant_Drink_Message"));
- }
- }
- }
- }
+ public static void DrinkCheck(Player p, ItemStack HandItem, ItemStack food, int incraseFoodLevel,
+ PotionEffect[] PotionEffect) {
+ if (HandItem.hasItemMeta()) {
+ if (HandItem.getItemMeta().getDisplayName().equals(food.getItemMeta().getDisplayName())) {
+ if (p.getFoodLevel() < 20 || PotionEffect.length > 0) {
+ p.playSound(p.getLocation(), Sound.ENTITY_GENERIC_DRINK, 1.0F, 1.0F);
+ Inventory i = p.getInventory();
+ ItemStack HoldItem = HandItem;
+ HoldItem.setAmount(HoldItem.getAmount() - 1);
+ if (Utils.IsItemContain(i, food)) {
+ i.setItem(Utils.GetItemIndex(i, HoldItem), HoldItem);
+ }
+ i.addItem(ClayTechItems.DIRTY_DRINK_BOTTLE);
+ if (p.getFoodLevel() + incraseFoodLevel > 20) {
+ p.setFoodLevel(20);
+ p.setSaturation(p.getSaturation() + (p.getFoodLevel() + incraseFoodLevel - 20));
+ } else {
+ p.setFoodLevel(p.getFoodLevel() + incraseFoodLevel);
+ }
+ for (PotionEffect pe : PotionEffect) {
+ p.addPotionEffect(pe);
+ }
+ p.sendMessage(Lang.readGeneralText("Drink_Message"));
+ Bukkit.getPluginManager().callEvent(new PlayerDrinkEvent(p, HandItem));
+ } else {
+ p.sendMessage(Lang.readGeneralText("Cant_Drink_Message"));
+ }
+ }
+ }
+ }
- public static void DrinkCheck(Player p, ItemStack HandItem, ItemStack food, int incraseFoodLevel) {
- if (HandItem.hasItemMeta()) {
- if (HandItem.getItemMeta().getDisplayName().equals(food.getItemMeta().getDisplayName())) {
- if (p.getFoodLevel() < 20) {
- p.playSound(p.getLocation(), Sound.ENTITY_GENERIC_DRINK, 1.0F, 1.0F);
- Inventory i = p.getInventory();
- ItemStack HoldItem = HandItem;
- HoldItem.setAmount(HoldItem.getAmount() - 1);
- if (Utils.IsItemContain(i, food)) {
- i.setItem(Utils.GetItemIndex(i, HoldItem), HoldItem);
- }
- i.addItem(ClayTechItems.DIRTY_DRINK_BOTTLE);
- if (p.getFoodLevel() + incraseFoodLevel > 20) {
- p.setFoodLevel(20);
- p.setSaturation(p.getSaturation() + (p.getFoodLevel() + incraseFoodLevel - 20));
- } else {
- p.setFoodLevel(p.getFoodLevel() + incraseFoodLevel);
- }
- p.sendMessage(Lang.readGeneralText("Drink_Message"));
- Bukkit.getPluginManager().callEvent(new PlayerDrinkEvent(p, HandItem));
- } else {
- p.sendMessage(Lang.readGeneralText("Cant_Drink_Message"));
- }
- }
- }
- }
+ public static void DrinkCheck(Player p, ItemStack HandItem, ItemStack food, int incraseFoodLevel) {
+ if (HandItem.hasItemMeta()) {
+ if (HandItem.getItemMeta().getDisplayName().equals(food.getItemMeta().getDisplayName())) {
+ if (p.getFoodLevel() < 20) {
+ p.playSound(p.getLocation(), Sound.ENTITY_GENERIC_DRINK, 1.0F, 1.0F);
+ Inventory i = p.getInventory();
+ ItemStack HoldItem = HandItem;
+ HoldItem.setAmount(HoldItem.getAmount() - 1);
+ if (Utils.IsItemContain(i, food)) {
+ i.setItem(Utils.GetItemIndex(i, HoldItem), HoldItem);
+ }
+ i.addItem(ClayTechItems.DIRTY_DRINK_BOTTLE);
+ if (p.getFoodLevel() + incraseFoodLevel > 20) {
+ p.setFoodLevel(20);
+ p.setSaturation(p.getSaturation() + (p.getFoodLevel() + incraseFoodLevel - 20));
+ } else {
+ p.setFoodLevel(p.getFoodLevel() + incraseFoodLevel);
+ }
+ p.sendMessage(Lang.readGeneralText("Drink_Message"));
+ Bukkit.getPluginManager().callEvent(new PlayerDrinkEvent(p, HandItem));
+ } else {
+ p.sendMessage(Lang.readGeneralText("Cant_Drink_Message"));
+ }
+ }
+ }
+ }
- public static void FoodCheck(Player p, ItemStack HandItem, ItemStack food, int incraseFoodLevel,
- PotionEffect[] PotionEffect) {
- if (HandItem.hasItemMeta()) {
- if (HandItem.getItemMeta().getDisplayName().equals(food.getItemMeta().getDisplayName())) {
- if (p.getFoodLevel() < 20 || PotionEffect.length > 0) {
- p.playSound(p.getLocation(), Sound.ENTITY_GENERIC_EAT, 1.0F, 1.0F);
- Inventory i = p.getInventory();
- ItemStack HoldItem = HandItem;
- HoldItem.setAmount(HoldItem.getAmount() - 1);
- if (Utils.IsItemContain(i, food)) {
- i.setItem(Utils.GetItemIndex(i, HoldItem), HoldItem);
- }
- if (p.getFoodLevel() + incraseFoodLevel > 20) {
- p.setFoodLevel(20);
- p.setSaturation(p.getSaturation() + (p.getFoodLevel() + incraseFoodLevel - 20));
- } else {
- p.setFoodLevel(p.getFoodLevel() + incraseFoodLevel);
- }
- for (PotionEffect pe : PotionEffect) {
- p.addPotionEffect(pe);
- }
- p.sendMessage(Lang.readGeneralText("Eat_Message"));
- Bukkit.getPluginManager().callEvent(new PlayerEatEvent(p, HandItem));
- } else {
- p.sendMessage(Lang.readGeneralText("Cant_Eat_Message"));
- }
- }
- }
- }
+ public static void FoodCheck(Player p, ItemStack HandItem, ItemStack food, int incraseFoodLevel,
+ PotionEffect[] PotionEffect) {
+ if (HandItem.hasItemMeta()) {
+ if (HandItem.getItemMeta().getDisplayName().equals(food.getItemMeta().getDisplayName())) {
+ if (p.getFoodLevel() < 20 || PotionEffect.length > 0) {
+ p.playSound(p.getLocation(), Sound.ENTITY_GENERIC_EAT, 1.0F, 1.0F);
+ Inventory i = p.getInventory();
+ ItemStack HoldItem = HandItem;
+ HoldItem.setAmount(HoldItem.getAmount() - 1);
+ if (Utils.IsItemContain(i, food)) {
+ i.setItem(Utils.GetItemIndex(i, HoldItem), HoldItem);
+ }
+ if (p.getFoodLevel() + incraseFoodLevel > 20) {
+ p.setFoodLevel(20);
+ p.setSaturation(p.getSaturation() + (p.getFoodLevel() + incraseFoodLevel - 20));
+ } else {
+ p.setFoodLevel(p.getFoodLevel() + incraseFoodLevel);
+ }
+ for (PotionEffect pe : PotionEffect) {
+ p.addPotionEffect(pe);
+ }
+ p.sendMessage(Lang.readGeneralText("Eat_Message"));
+ Bukkit.getPluginManager().callEvent(new PlayerEatEvent(p, HandItem));
+ } else {
+ p.sendMessage(Lang.readGeneralText("Cant_Eat_Message"));
+ }
+ }
+ }
+ }
- public static void FoodCheck(Player p, ItemStack HandItem, ItemStack food, int incraseFoodLevel) {
- if (HandItem.hasItemMeta()) {
- if (HandItem.getItemMeta().getDisplayName().equals(food.getItemMeta().getDisplayName())) {
- if (p.getFoodLevel() < 20) {
- p.playSound(p.getLocation(), Sound.ENTITY_GENERIC_EAT, 1.0F, 1.0F);
- Inventory i = p.getInventory();
- ItemStack HoldItem = HandItem;
- HoldItem.setAmount(HoldItem.getAmount() - 1);
- if (Utils.IsItemContain(i, food)) {
- i.setItem(Utils.GetItemIndex(i, HoldItem), HoldItem);
- }
- if (p.getFoodLevel() + incraseFoodLevel > 20) {
- p.setFoodLevel(20);
- p.setSaturation(p.getSaturation() + (p.getFoodLevel() + incraseFoodLevel - 20));
- } else {
- p.setFoodLevel(p.getFoodLevel() + incraseFoodLevel);
- }
- p.sendMessage(Lang.readGeneralText("Eat_Message"));
- Bukkit.getPluginManager().callEvent(new PlayerEatEvent(p, HandItem));
- } else {
- p.sendMessage(Lang.readGeneralText("Cant_Eat_Message"));
- }
- }
- }
- }
+ public static void FoodCheck(Player p, ItemStack HandItem, ItemStack food, int incraseFoodLevel) {
+ if (HandItem.hasItemMeta()) {
+ if (HandItem.getItemMeta().getDisplayName().equals(food.getItemMeta().getDisplayName())) {
+ if (p.getFoodLevel() < 20) {
+ p.playSound(p.getLocation(), Sound.ENTITY_GENERIC_EAT, 1.0F, 1.0F);
+ Inventory i = p.getInventory();
+ ItemStack HoldItem = HandItem;
+ HoldItem.setAmount(HoldItem.getAmount() - 1);
+ if (Utils.IsItemContain(i, food)) {
+ i.setItem(Utils.GetItemIndex(i, HoldItem), HoldItem);
+ }
+ if (p.getFoodLevel() + incraseFoodLevel > 20) {
+ p.setFoodLevel(20);
+ p.setSaturation(p.getSaturation() + (p.getFoodLevel() + incraseFoodLevel - 20));
+ } else {
+ p.setFoodLevel(p.getFoodLevel() + incraseFoodLevel);
+ }
+ p.sendMessage(Lang.readGeneralText("Eat_Message"));
+ Bukkit.getPluginManager().callEvent(new PlayerEatEvent(p, HandItem));
+ } else {
+ p.sendMessage(Lang.readGeneralText("Cant_Eat_Message"));
+ }
+ }
+ }
+ }
- public static void WashCheck(Player p, ItemStack HandItem, ItemStack matchItem, ItemStack cleanItem) {
- try {
- if (HandItem.getItemMeta().getDisplayName().equals(matchItem.getItemMeta().getDisplayName())) {
- Inventory i = p.getInventory();
- if (i.contains(new ItemStack(Material.WATER_BUCKET))) {
- int itemindex = Utils.GetItemIndex(i, matchItem);
- int itemindex2 = i.first(new ItemStack(Material.WATER_BUCKET));
- ItemStack HoldItem = HandItem;
- HoldItem.setAmount(HoldItem.getAmount() - 1);
- if (Utils.IsItemContain(i, matchItem)) {
- i.setItem(itemindex, HoldItem);
- }
- ItemStack HoldItem2 = i.getItem(itemindex2);
- HoldItem2.setAmount(HoldItem2.getAmount() - 1);
- if (i.contains(new ItemStack(Material.WATER_BUCKET))) {
- i.setItem(itemindex2, HoldItem2);
- }
- i.addItem(new ItemStack(Material.BUCKET));
- i.addItem(cleanItem);
- p.sendMessage(Lang.readGeneralText("Wash_Message"));
- Bukkit.getPluginManager().callEvent(new PlayerWashEvent(p, matchItem, cleanItem));
- } else {
- p.sendMessage(Lang.readGeneralText("Cant_Wash_Message"));
- }
- }
+ public static void WashCheck(Player p, ItemStack HandItem, ItemStack matchItem, ItemStack cleanItem) {
+ try {
+ if (HandItem.getItemMeta().getDisplayName().equals(matchItem.getItemMeta().getDisplayName())) {
+ Inventory i = p.getInventory();
+ if (i.contains(new ItemStack(Material.WATER_BUCKET))) {
+ int itemindex = Utils.GetItemIndex(i, matchItem);
+ int itemindex2 = i.first(new ItemStack(Material.WATER_BUCKET));
+ ItemStack HoldItem = HandItem;
+ HoldItem.setAmount(HoldItem.getAmount() - 1);
+ if (Utils.IsItemContain(i, matchItem)) {
+ i.setItem(itemindex, HoldItem);
+ }
+ ItemStack HoldItem2 = i.getItem(itemindex2);
+ HoldItem2.setAmount(HoldItem2.getAmount() - 1);
+ if (i.contains(new ItemStack(Material.WATER_BUCKET))) {
+ i.setItem(itemindex2, HoldItem2);
+ }
+ i.addItem(new ItemStack(Material.BUCKET));
+ i.addItem(cleanItem);
+ p.sendMessage(Lang.readGeneralText("Wash_Message"));
+ Bukkit.getPluginManager().callEvent(new PlayerWashEvent(p, matchItem, cleanItem));
+ } else {
+ p.sendMessage(Lang.readGeneralText("Cant_Wash_Message"));
+ }
+ }
- } catch (NullPointerException err) {
- }
- }
+ } catch (NullPointerException err) {
+ }
+ }
- public static void CheckDestroy(Player p, Block b, ItemStack targetBlock, ItemStack dropItem, ItemStack disableItem,
- int i, BlockBreakEvent b1) {
- if (b.getType() == targetBlock.getType()) {
- boolean pass = false;
- if (p.getInventory().getItemInMainHand() != new ItemStack(Material.AIR)) {
- if (Utils.HasEnchantment(p.getInventory().getItemInMainHand(), Enchantment.SILK_TOUCH)
- || p.getInventory().getItemInMainHand().getType() == disableItem.getType()) {
- // b1.setDropItems(true);
- return;
- } else
- pass = true;
- } else
- pass = true;
- if (pass) {
- Random r = new Random();
- int random = r.nextInt(100);
- if (random == i) {
- Utils.dropItems(b.getLocation(), dropItem);
- b1.setDropItems(false);
- return;
- }
- }
- }
- // b1.setDropItems(true);
- return;
- }
+ public static void CheckDestroy(Player p, Block b, ItemStack targetBlock, ItemStack dropItem, ItemStack disableItem,
+ int i, BlockBreakEvent b1) {
+ if (b.getType() == targetBlock.getType()) {
+ boolean pass = false;
+ if (p.getInventory().getItemInMainHand() != new ItemStack(Material.AIR)) {
+ if (Utils.HasEnchantment(p.getInventory().getItemInMainHand(), Enchantment.SILK_TOUCH)
+ || p.getInventory().getItemInMainHand().getType() == disableItem.getType()) {
+ // b1.setDropItems(true);
+ return;
+ } else
+ pass = true;
+ } else
+ pass = true;
+ if (pass) {
+ Random r = new Random();
+ int random = r.nextInt(100);
+ if (random == i) {
+ Utils.dropItems(b.getLocation(), dropItem);
+ b1.setDropItems(false);
+ return;
+ }
+ }
+ }
+ // b1.setDropItems(true);
+ return;
+ }
- public static void CheckDestroy(Player p, Block b, ItemStack targetBlock, ItemStack dropItem, ItemStack disableItem,
- int from, int to, BlockBreakEvent b1) {
- if (b.getType() == targetBlock.getType()) {
- boolean pass = false;
- if (p.getInventory().getItemInMainHand() != new ItemStack(Material.AIR)) {
- if (Utils.HasEnchantment(p.getInventory().getItemInMainHand(), Enchantment.SILK_TOUCH)
- || p.getInventory().getItemInMainHand().getType() == disableItem.getType()) {
- // b1.setDropItems(true);
- return;
- } else
- pass = true;
- } else
- pass = true;
- if (pass) {
- Random r = new Random();
- int random = r.nextInt(100);
- if (random >= from && random <= to) {
- Utils.dropItems(b.getLocation(), dropItem);
- b1.setDropItems(false);
- return;
- }
- }
- }
- // b1.setDropItems(true);
- return;
- }
+ public static void CheckDestroy(Player p, Block b, ItemStack targetBlock, ItemStack dropItem, ItemStack disableItem,
+ int from, int to, BlockBreakEvent b1) {
+ if (b.getType() == targetBlock.getType()) {
+ boolean pass = false;
+ if (p.getInventory().getItemInMainHand() != new ItemStack(Material.AIR)) {
+ if (Utils.HasEnchantment(p.getInventory().getItemInMainHand(), Enchantment.SILK_TOUCH)
+ || p.getInventory().getItemInMainHand().getType() == disableItem.getType()) {
+ // b1.setDropItems(true);
+ return;
+ } else
+ pass = true;
+ } else
+ pass = true;
+ if (pass) {
+ Random r = new Random();
+ int random = r.nextInt(100);
+ if (random >= from && random <= to) {
+ Utils.dropItems(b.getLocation(), dropItem);
+ b1.setDropItems(false);
+ return;
+ }
+ }
+ }
+ // b1.setDropItems(true);
+ return;
+ }
- public static void CheckDestroy(Player p, Block b, ItemStack targetBlock, ItemStack dropItem, int i,
- BlockBreakEvent b1) {
- if (b.getType() == targetBlock.getType()) {
- boolean pass = false;
- if (p.getInventory().getItemInMainHand() != new ItemStack(Material.AIR)) {
- if (Utils.HasEnchantment(p.getInventory().getItemInMainHand(), Enchantment.SILK_TOUCH)) {
- // b1.setDropItems(true);
- return;
- } else
- pass = true;
- } else
- pass = true;
- if (pass) {
- Random r = new Random();
- int random = r.nextInt(100);
- if (random == i) {
- Utils.dropItems(b.getLocation(), dropItem);
- b1.setDropItems(false);
- return;
- }
- }
- }
- // b1.setDropItems(true);
- return;
- }
+ public static void CheckDestroy(Player p, Block b, ItemStack targetBlock, ItemStack dropItem, int i,
+ BlockBreakEvent b1) {
+ if (b.getType() == targetBlock.getType()) {
+ boolean pass = false;
+ if (p.getInventory().getItemInMainHand() != new ItemStack(Material.AIR)) {
+ if (Utils.HasEnchantment(p.getInventory().getItemInMainHand(), Enchantment.SILK_TOUCH)) {
+ // b1.setDropItems(true);
+ return;
+ } else
+ pass = true;
+ } else
+ pass = true;
+ if (pass) {
+ Random r = new Random();
+ int random = r.nextInt(100);
+ if (random == i) {
+ Utils.dropItems(b.getLocation(), dropItem);
+ b1.setDropItems(false);
+ return;
+ }
+ }
+ }
+ // b1.setDropItems(true);
+ return;
+ }
- public static void FishItemCheck(PlayerFishEvent e, int from, int to, ItemStack drop) {
- Random r = new Random();
- int random = r.nextInt(100);
- // Utils.info(""+random);
- if (random >= from && random <= to) {
- e.setCancelled(true);
- Utils.dropItems(e.getHook().getLocation(), drop);
- }
- }
+ public static void FishItemCheck(PlayerFishEvent e, int from, int to, ItemStack drop) {
+ Random r = new Random();
+ int random = r.nextInt(100);
+ // Utils.info(""+random);
+ if (random >= from && random <= to) {
+ e.setCancelled(true);
+ Utils.dropItems(e.getHook().getLocation(), drop);
+ }
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/utils/Lang.java b/src/main/java/club/claycoffee/ClayTech/utils/Lang.java
index 844b60f..5b92c1b 100644
--- a/src/main/java/club/claycoffee/ClayTech/utils/Lang.java
+++ b/src/main/java/club/claycoffee/ClayTech/utils/Lang.java
@@ -1,85 +1,85 @@
package club.claycoffee.ClayTech.utils;
+import club.claycoffee.ClayTech.ClayTech;
+
import java.util.Arrays;
import java.util.List;
-import club.claycoffee.ClayTech.ClayTech;
-
public class Lang {
- public static String[] LocaleList = { "zh-CN", "zh-TW", "en-GB", "en-US" };
+ public static String[] LocaleList = {"zh-CN", "zh-TW", "en-GB", "en-US"};
- public static String readItemText(String name) {
- if (ClayTech.getLangYML().getCustomConfig().getString("Items." + name) == null) {
- return "Missing locale.";
- } else {
- return ClayTech.getLangYML().getCustomConfig().getString("Items." + name).replaceAll("&", "§");
- }
- }
+ public static String readItemText(String name) {
+ if (ClayTech.getLangYML().getCustomConfig().getString("Items." + name) == null) {
+ return "Missing locale.";
+ } else {
+ return ClayTech.getLangYML().getCustomConfig().getString("Items." + name).replaceAll("&", "§");
+ }
+ }
- @SuppressWarnings("unchecked")
- public static List readItemLore(String name) {
- if (ClayTech.getLangYML().getCustomConfig().getString("Items." + name + "_LORE") == null) {
- return Arrays.asList(new String[] { "Missing locale." });
- } else {
- return Utils.replaceList(
- ((List) ClayTech.getLangYML().getCustomConfig().getList("Items." + name + "_LORE")), "&",
- "§");
- }
- }
+ @SuppressWarnings("unchecked")
+ public static List readItemLore(String name) {
+ if (ClayTech.getLangYML().getCustomConfig().getString("Items." + name + "_LORE") == null) {
+ return Arrays.asList(new String[]{"Missing locale."});
+ } else {
+ return Utils.replaceList(
+ ((List) ClayTech.getLangYML().getCustomConfig().getList("Items." + name + "_LORE")), "&",
+ "§");
+ }
+ }
- public static String readGeneralText(String name) {
- if (ClayTech.getLangYML().getCustomConfig().getString("General." + name) == null) {
- return "Missing locale.";
- } else {
- return ClayTech.getLangYML().getCustomConfig().getString("General." + name).replaceAll("&", "§");
- }
- }
+ public static String readGeneralText(String name) {
+ if (ClayTech.getLangYML().getCustomConfig().getString("General." + name) == null) {
+ return "Missing locale.";
+ } else {
+ return ClayTech.getLangYML().getCustomConfig().getString("General." + name).replaceAll("&", "§");
+ }
+ }
- public static String readCategoriesText(String name) {
- if (ClayTech.getLangYML().getCustomConfig().getString("Categories." + name) == null) {
- return "Missing locale.";
- } else {
- return ClayTech.getLangYML().getCustomConfig().getString("Categories." + name).replaceAll("&", "§");
- }
- }
+ public static String readCategoriesText(String name) {
+ if (ClayTech.getLangYML().getCustomConfig().getString("Categories." + name) == null) {
+ return "Missing locale.";
+ } else {
+ return ClayTech.getLangYML().getCustomConfig().getString("Categories." + name).replaceAll("&", "§");
+ }
+ }
- public static String readResearchesText(String name) {
- if (ClayTech.getLangYML().getCustomConfig().getString("Researches." + name) == null) {
- return "Missing locale.";
- } else {
- return ClayTech.getLangYML().getCustomConfig().getString("Researches." + name).replaceAll("&", "§");
- }
- }
+ public static String readResearchesText(String name) {
+ if (ClayTech.getLangYML().getCustomConfig().getString("Researches." + name) == null) {
+ return "Missing locale.";
+ } else {
+ return ClayTech.getLangYML().getCustomConfig().getString("Researches." + name).replaceAll("&", "§");
+ }
+ }
- public static String readMachinesText(String name) {
- if (ClayTech.getLangYML().getCustomConfig().getString("Machines." + name) == null) {
- return "Missing locale.";
- } else {
- return ClayTech.getLangYML().getCustomConfig().getString("Machines." + name).replaceAll("&", "§");
- }
- }
+ public static String readMachinesText(String name) {
+ if (ClayTech.getLangYML().getCustomConfig().getString("Machines." + name) == null) {
+ return "Missing locale.";
+ } else {
+ return ClayTech.getLangYML().getCustomConfig().getString("Machines." + name).replaceAll("&", "§");
+ }
+ }
- public static String readMachineRecipesText(String name) {
- if (ClayTech.getLangYML().getCustomConfig().getString("MachineRecipes." + name) == null) {
- return "Missing locale.";
- } else {
- return ClayTech.getLangYML().getCustomConfig().getString("MachineRecipes." + name).replaceAll("&", "§");
- }
- }
+ public static String readMachineRecipesText(String name) {
+ if (ClayTech.getLangYML().getCustomConfig().getString("MachineRecipes." + name) == null) {
+ return "Missing locale.";
+ } else {
+ return ClayTech.getLangYML().getCustomConfig().getString("MachineRecipes." + name).replaceAll("&", "§");
+ }
+ }
- public static String readPlanetsText(String name) {
- if (ClayTech.getLangYML().getCustomConfig().getString("Planets." + name) == null) {
- return "Missing locale.";
- } else {
- return ClayTech.getLangYML().getCustomConfig().getString("Planets." + name).replaceAll("&", "§");
- }
- }
+ public static String readPlanetsText(String name) {
+ if (ClayTech.getLangYML().getCustomConfig().getString("Planets." + name) == null) {
+ return "Missing locale.";
+ } else {
+ return ClayTech.getLangYML().getCustomConfig().getString("Planets." + name).replaceAll("&", "§");
+ }
+ }
- public static String readResourcesText(String name) {
- if (ClayTech.getLangYML().getCustomConfig().getString("Resources." + name) == null) {
- return "Missing locale.";
- } else {
- return ClayTech.getLangYML().getCustomConfig().getString("Resources." + name).replaceAll("&", "§");
- }
- }
+ public static String readResourcesText(String name) {
+ if (ClayTech.getLangYML().getCustomConfig().getString("Resources." + name) == null) {
+ return "Missing locale.";
+ } else {
+ return ClayTech.getLangYML().getCustomConfig().getString("Resources." + name).replaceAll("&", "§");
+ }
+ }
}
diff --git a/src/main/java/club/claycoffee/ClayTech/utils/Metrics.java b/src/main/java/club/claycoffee/ClayTech/utils/Metrics.java
index 4e1734c..29ad2a6 100644
--- a/src/main/java/club/claycoffee/ClayTech/utils/Metrics.java
+++ b/src/main/java/club/claycoffee/ClayTech/utils/Metrics.java
@@ -29,706 +29,698 @@
*/
public class Metrics {
- static {
- // You can use the property to disable the check in your test environment
- if (System.getProperty("bstats.relocatecheck") == null
- || !System.getProperty("bstats.relocatecheck").equals("false")) {
- // Maven's Relocate is clever and changes strings, too. So we have to use this
- // little "trick" ... :D
- final String defaultPackage = new String(
- new byte[] { 'o', 'r', 'g', '.', 'b', 's', 't', 'a', 't', 's', '.', 'b', 'u', 'k', 'k', 'i', 't' });
- final String examplePackage = new String(
- new byte[] { 'y', 'o', 'u', 'r', '.', 'p', 'a', 'c', 'k', 'a', 'g', 'e' });
- // We want to make sure nobody just copy & pastes the example and use the wrong
- // package names
- if (Metrics.class.getPackage().getName().equals(defaultPackage)
- || Metrics.class.getPackage().getName().equals(examplePackage)) {
- throw new IllegalStateException("bStats Metrics class has not been relocated correctly!");
- }
- }
- }
-
- // The version of this bStats class
- public static final int B_STATS_VERSION = 1;
-
- // The url to which the data is sent
- private static final String URL = "https://bStats.org/submitData/bukkit";
-
- // Is bStats enabled on this server?
- private boolean enabled;
-
- // Should failed requests be logged?
- private static boolean logFailedRequests;
-
- // Should the sent data be logged?
- private static boolean logSentData;
-
- // Should the response text be logged?
- private static boolean logResponseStatusText;
-
- // The uuid of the server
- private static String serverUUID;
-
- // The plugin
- private final Plugin plugin;
-
- // The plugin id
- private final int pluginId;
-
- // A list with all custom charts
- private final List charts = new ArrayList<>();
-
- /**
- * Class constructor.
- *
- * @param plugin The plugin which stats should be submitted.
- * @param pluginId The id of the plugin. It can be found at
- * What is my
- * plugin id?
- */
- public Metrics(Plugin plugin, int pluginId) {
- if (plugin == null) {
- throw new IllegalArgumentException("Plugin cannot be null!");
- }
- this.plugin = plugin;
- this.pluginId = pluginId;
-
- // Get the config file
- File bStatsFolder = new File(plugin.getDataFolder().getParentFile(), "bStats");
- File configFile = new File(bStatsFolder, "config.yml");
- YamlConfiguration config = YamlConfiguration.loadConfiguration(configFile);
-
- // Check if the config file exists
- if (!config.isSet("serverUuid")) {
-
- // Add default values
- config.addDefault("enabled", true);
- // Every server gets it's unique random id.
- config.addDefault("serverUuid", UUID.randomUUID().toString());
- // Should failed request be logged?
- config.addDefault("logFailedRequests", false);
- // Should the sent data be logged?
- config.addDefault("logSentData", false);
- // Should the response text be logged?
- config.addDefault("logResponseStatusText", false);
-
- // Inform the server owners about bStats
- config.options().header(
- "bStats collects some data for plugin authors like how many servers are using their plugins.\n"
- + "To honor their work, you should not disable it.\n"
- + "This has nearly no effect on the server performance!\n"
- + "Check out https://bStats.org/ to learn more :)")
- .copyDefaults(true);
- try {
- config.save(configFile);
- } catch (IOException ignored) {
- }
- }
-
- // Load the data
- enabled = config.getBoolean("enabled", true);
- serverUUID = config.getString("serverUuid");
- logFailedRequests = config.getBoolean("logFailedRequests", false);
- logSentData = config.getBoolean("logSentData", false);
- logResponseStatusText = config.getBoolean("logResponseStatusText", false);
-
- if (enabled) {
- boolean found = false;
- // Search for all other bStats Metrics classes to see if we are the first one
- for (Class> service : Bukkit.getServicesManager().getKnownServices()) {
- try {
- service.getField("B_STATS_VERSION"); // Our identifier :)
- found = true; // We aren't the first
- break;
- } catch (NoSuchFieldException ignored) {
- }
- }
- // Register our service
- Bukkit.getServicesManager().register(Metrics.class, this, plugin, ServicePriority.Normal);
- if (!found) {
- // We are the first!
- startSubmitting();
- }
- }
- }
-
- /**
- * Checks if bStats is enabled.
- *
- * @return Whether bStats is enabled or not.
- */
- public boolean isEnabled() {
- return enabled;
- }
-
- /**
- * Adds a custom chart.
- *
- * @param chart The chart to add.
- */
- public void addCustomChart(CustomChart chart) {
- if (chart == null) {
- throw new IllegalArgumentException("Chart cannot be null!");
- }
- charts.add(chart);
- }
-
- /**
- * Starts the Scheduler which submits our data every 30 minutes.
- */
- private void startSubmitting() {
- final Timer timer = new Timer(true); // We use a timer cause the Bukkit scheduler is affected by server lags
- timer.scheduleAtFixedRate(new TimerTask() {
- @Override
- public void run() {
- if (!plugin.isEnabled()) { // Plugin was disabled
- timer.cancel();
- return;
- }
- // Nevertheless we want our code to run in the Bukkit main thread, so we have to
- // use the Bukkit scheduler
- // Don't be afraid! The connection to the bStats server is still async, only the
- // stats collection is sync ;)
- Bukkit.getScheduler().runTask(plugin, () -> submitData());
- }
- }, 1000 * 60 * 5, 1000 * 60 * 30);
- // Submit the data every 30 minutes, first time after 5 minutes to give other
- // plugins enough time to start
- // WARNING: Changing the frequency has no effect but your plugin WILL be
- // blocked/deleted!
- // WARNING: Just don't do it!
- }
-
- /**
- * Gets the plugin specific data. This method is called using Reflection.
- *
- * @return The plugin specific data.
- */
- public JsonObject getPluginData() {
- JsonObject data = new JsonObject();
-
- String pluginName = plugin.getDescription().getName();
- String pluginVersion = plugin.getDescription().getVersion();
-
- data.addProperty("pluginName", pluginName); // Append the name of the plugin
- data.addProperty("id", pluginId); // Append the id of the plugin
- data.addProperty("pluginVersion", pluginVersion); // Append the version of the plugin
- JsonArray customCharts = new JsonArray();
- for (CustomChart customChart : charts) {
- // Add the data of the custom charts
- JsonObject chart = customChart.getRequestJsonObject();
- if (chart == null) { // If the chart is null, we skip it
- continue;
- }
- customCharts.add(chart);
- }
- data.add("customCharts", customCharts);
-
- return data;
- }
-
- /**
- * Gets the server specific data.
- *
- * @return The server specific data.
- */
- private JsonObject getServerData() {
- // Minecraft specific data
- int playerAmount;
- try {
- // Around MC 1.8 the return type was changed to a collection from an array,
- // This fixes java.lang.NoSuchMethodError:
- // org.bukkit.Bukkit.getOnlinePlayers()Ljava/util/Collection;
- Method onlinePlayersMethod = Class.forName("org.bukkit.Server").getMethod("getOnlinePlayers");
- playerAmount = onlinePlayersMethod.getReturnType().equals(Collection.class)
- ? ((Collection>) onlinePlayersMethod.invoke(Bukkit.getServer())).size()
- : ((Player[]) onlinePlayersMethod.invoke(Bukkit.getServer())).length;
- } catch (Exception e) {
- playerAmount = Bukkit.getOnlinePlayers().size(); // Just use the new method if the Reflection failed
- }
- int onlineMode = Bukkit.getOnlineMode() ? 1 : 0;
- String bukkitVersion = Bukkit.getVersion();
- String bukkitName = Bukkit.getName();
-
- // OS/Java specific data
- String javaVersion = System.getProperty("java.version");
- String osName = System.getProperty("os.name");
- String osArch = System.getProperty("os.arch");
- String osVersion = System.getProperty("os.version");
- int coreCount = Runtime.getRuntime().availableProcessors();
-
- JsonObject data = new JsonObject();
-
- data.addProperty("serverUUID", serverUUID);
-
- data.addProperty("playerAmount", playerAmount);
- data.addProperty("onlineMode", onlineMode);
- data.addProperty("bukkitVersion", bukkitVersion);
- data.addProperty("bukkitName", bukkitName);
-
- data.addProperty("javaVersion", javaVersion);
- data.addProperty("osName", osName);
- data.addProperty("osArch", osArch);
- data.addProperty("osVersion", osVersion);
- data.addProperty("coreCount", coreCount);
-
- return data;
- }
-
- /**
- * Collects the data and sends it afterwards.
- */
- private void submitData() {
- final JsonObject data = getServerData();
-
- JsonArray pluginData = new JsonArray();
- // Search for all other bStats Metrics classes to get their plugin data
- for (Class> service : Bukkit.getServicesManager().getKnownServices()) {
- try {
- service.getField("B_STATS_VERSION"); // Our identifier :)
-
- for (RegisteredServiceProvider> provider : Bukkit.getServicesManager().getRegistrations(service)) {
- try {
- Object plugin = provider.getService().getMethod("getPluginData").invoke(provider.getProvider());
- if (plugin instanceof JsonObject) {
- pluginData.add((JsonObject) plugin);
- } else { // old bstats version compatibility
- try {
- Class> jsonObjectJsonSimple = Class.forName("org.json.simple.JSONObject");
- if (plugin.getClass().isAssignableFrom(jsonObjectJsonSimple)) {
- Method jsonStringGetter = jsonObjectJsonSimple.getDeclaredMethod("toJSONString");
- jsonStringGetter.setAccessible(true);
- String jsonString = (String) jsonStringGetter.invoke(plugin);
- JsonObject object = new JsonParser().parse(jsonString).getAsJsonObject();
- pluginData.add(object);
- }
- } catch (ClassNotFoundException e) {
- // minecraft version 1.14+
- if (logFailedRequests) {
- this.plugin.getLogger().log(Level.SEVERE, "Encountered unexpected exception", e);
- }
- }
- }
- } catch (NullPointerException | NoSuchMethodException | IllegalAccessException
- | InvocationTargetException ignored) {
- }
- }
- } catch (NoSuchFieldException ignored) {
- }
- }
-
- data.add("plugins", pluginData);
-
- // Create a new thread for the connection to the bStats server
- new Thread(() -> {
- try {
- // Send the data
- sendData(plugin, data);
- } catch (Exception e) {
- // Something went wrong! :(
- if (logFailedRequests) {
- plugin.getLogger().log(Level.WARNING, "Could not submit plugin stats of " + plugin.getName(), e);
- }
- }
- }).start();
- }
-
- /**
- * Sends the data to the bStats server.
- *
- * @param plugin Any plugin. It's just used to get a logger instance.
- * @param data The data to send.
- * @throws Exception If the request failed.
- */
- private static void sendData(Plugin plugin, JsonObject data) throws Exception {
- if (data == null) {
- throw new IllegalArgumentException("Data cannot be null!");
- }
- if (Bukkit.isPrimaryThread()) {
- throw new IllegalAccessException("This method must not be called from the main thread!");
- }
- if (logSentData) {
- plugin.getLogger().info("Sending data to bStats: " + data);
- }
- HttpsURLConnection connection = (HttpsURLConnection) new URL(URL).openConnection();
-
- // Compress the data to save bandwidth
- byte[] compressedData = compress(data.toString());
-
- // Add headers
- connection.setRequestMethod("POST");
- connection.addRequestProperty("Accept", "application/json");
- connection.addRequestProperty("Connection", "close");
- connection.addRequestProperty("Content-Encoding", "gzip"); // We gzip our request
- connection.addRequestProperty("Content-Length", String.valueOf(compressedData.length));
- connection.setRequestProperty("Content-Type", "application/json"); // We send our data in JSON format
- connection.setRequestProperty("User-Agent", "MC-Server/" + B_STATS_VERSION);
-
- // Send data
- connection.setDoOutput(true);
- try (DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream())) {
- outputStream.write(compressedData);
- }
-
- StringBuilder builder = new StringBuilder();
- try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(connection.getInputStream()))) {
- String line;
- while ((line = bufferedReader.readLine()) != null) {
- builder.append(line);
- }
- }
-
- if (logResponseStatusText) {
- plugin.getLogger().info("Sent data to bStats and received response: " + builder);
- }
- }
-
- /**
- * Gzips the given String.
- *
- * @param str The string to gzip.
- * @return The gzipped String.
- * @throws IOException If the compression failed.
- */
- private static byte[] compress(final String str) throws IOException {
- if (str == null) {
- return null;
- }
- ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
- try (GZIPOutputStream gzip = new GZIPOutputStream(outputStream)) {
- gzip.write(str.getBytes(StandardCharsets.UTF_8));
- }
- return outputStream.toByteArray();
- }
-
- /**
- * Represents a custom chart.
- */
- public static abstract class CustomChart {
-
- // The id of the chart
- final String chartId;
-
- /**
- * Class constructor.
- *
- * @param chartId The id of the chart.
- */
- CustomChart(String chartId) {
- if (chartId == null || chartId.isEmpty()) {
- throw new IllegalArgumentException("ChartId cannot be null or empty!");
- }
- this.chartId = chartId;
- }
-
- private JsonObject getRequestJsonObject() {
- JsonObject chart = new JsonObject();
- chart.addProperty("chartId", chartId);
- try {
- JsonObject data = getChartData();
- if (data == null) {
- // If the data is null we don't send the chart.
- return null;
- }
- chart.add("data", data);
- } catch (Throwable t) {
- if (logFailedRequests) {
- Bukkit.getLogger().log(Level.WARNING, "Failed to get data for custom chart with id " + chartId, t);
- }
- return null;
- }
- return chart;
- }
-
- protected abstract JsonObject getChartData() throws Exception;
-
- }
-
- /**
- * Represents a custom simple pie.
- */
- public static class SimplePie extends CustomChart {
-
- private final Callable callable;
-
- /**
- * Class constructor.
- *
- * @param chartId The id of the chart.
- * @param callable The callable which is used to request the chart data.
- */
- public SimplePie(String chartId, Callable callable) {
- super(chartId);
- this.callable = callable;
- }
-
- @Override
- protected JsonObject getChartData() throws Exception {
- JsonObject data = new JsonObject();
- String value = callable.call();
- if (value == null || value.isEmpty()) {
- // Null = skip the chart
- return null;
- }
- data.addProperty("value", value);
- return data;
- }
- }
-
- /**
- * Represents a custom advanced pie.
- */
- public static class AdvancedPie extends CustomChart {
-
- private final Callable