diff --git a/README.md b/README.md index 10955a4e20..a4c836a834 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Jenkins CI builds can be found here: [http://tardisjenkins.duckdns.org:8080/job/TARDIS/](http://tardisjenkins.duckdns.org:8080/job/TARDIS/) [![Jenkins status](https://img.shields.io/website?down_message=offline&label=Jenkins&style=for-the-badge&up_message=online&url=http%3A%2F%2Ftardisjenkins.duckdns.org%3A8080%2F)](http://tardisjenkins.duckdns.org:8080/job/TARDIS/) -![Build Status](https://img.shields.io/jenkins/build?jobUrl=http%3A%2F%2Ftardisjenkins.duckdns.org%3A8080%2Fjob%2FTARDIS&style=for-the-badge) +![Build Status](https://img.shields.io/jenkins/build?jobUrl=http://tardisjenkins.duckdns.org:8080/job/TARDIS&style=for-the-badge) ![GitHub last commit](https://img.shields.io/github/last-commit/eccentricdevotion/TARDIS?style=for-the-badge) ![GitHub top language](https://img.shields.io/github/languages/top/eccentricdevotion/TARDIS?style=for-the-badge) @@ -37,6 +37,7 @@ Jenkins CI builds can be found here: ![Spigot size](https://img.shields.io/spiget/download-size/45729?label=Spigot%20size&style=for-the-badge) ![bStats Servers](https://img.shields.io/bstats/servers/11698?style=for-the-badge) +![1.20.6 downloads](https://img.shields.io/github/downloads/eccentricdevotion/TARDIS/1.20.6/total?style=for-the-badge) ![1.20.4 downloads](https://img.shields.io/github/downloads/eccentricdevotion/TARDIS/1.20.4/total?style=for-the-badge) ![1.20.3 downloads](https://img.shields.io/github/downloads/eccentricdevotion/TARDIS/1.20.3/total?style=for-the-badge) ![1.20.2 downloads](https://img.shields.io/github/downloads/eccentricdevotion/TARDIS/1.20.2/total?style=for-the-badge) diff --git a/pom.xml b/pom.xml index 86c36c1efb..5251b8483d 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 me.eccentric_nz.TARDIS TARDIS - 5.6.0 + 5.7.0 TARDIS A Doctor Who Plugin @@ -170,9 +170,9 @@ remap-obf - org.spigotmc:minecraft-server:1.20.6-R0.1-SNAPSHOT:txt:maps-mojang + org.spigotmc:minecraft-server:1.21-R0.1-SNAPSHOT:txt:maps-mojang true - org.spigotmc:spigot:1.20.6-R0.1-SNAPSHOT:jar:remapped-mojang + org.spigotmc:spigot:1.21-R0.1-SNAPSHOT:jar:remapped-mojang true remapped-obf @@ -188,8 +188,8 @@ ${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar - org.spigotmc:minecraft-server:1.20.6-R0.1-SNAPSHOT:csrg:maps-spigot - org.spigotmc:spigot:1.20.6-R0.1-SNAPSHOT:jar:remapped-obf + org.spigotmc:minecraft-server:1.21-R0.1-SNAPSHOT:csrg:maps-spigot + org.spigotmc:spigot:1.21-R0.1-SNAPSHOT:jar:remapped-obf @@ -256,7 +256,7 @@ io.papermc.paper paper-api - 1.20.6-R0.1-SNAPSHOT + 1.21-R0.1-SNAPSHOT provided @@ -280,7 +280,7 @@ org.spigotmc spigot - 1.20.6-R0.1-SNAPSHOT + 1.21-R0.1-SNAPSHOT remapped-mojang provided @@ -349,7 +349,7 @@ com.palmergames.bukkit.towny towny - 0.100.2.0 + 0.100.3.0 provided @@ -486,7 +486,7 @@ me.clip placeholderapi - 2.11.5 + 2.11.6 jar provided @@ -565,6 +565,12 @@ 2.7.1 provided + + xyz.jpenilla + squaremap-api + 1.2.1 + provided + com.github.MilkBowl VaultAPI diff --git a/src/main/java/me/eccentric_nz/TARDIS/ARS/TARDISARSInventory.java b/src/main/java/me/eccentric_nz/TARDIS/ARS/TARDISARSInventory.java index fbeb4052ae..bd8df5db30 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/ARS/TARDISARSInventory.java +++ b/src/main/java/me/eccentric_nz/TARDIS/ARS/TARDISARSInventory.java @@ -19,7 +19,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; import me.eccentric_nz.TARDIS.custommodeldata.GUIArs; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; diff --git a/src/main/java/me/eccentric_nz/TARDIS/ARS/TARDISARSListener.java b/src/main/java/me/eccentric_nz/TARDIS/ARS/TARDISARSListener.java index 0ced06ce67..d0c83c81cc 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/ARS/TARDISARSListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/ARS/TARDISARSListener.java @@ -21,7 +21,7 @@ import me.eccentric_nz.TARDIS.commands.sudo.TARDISSudoTracker; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.utility.TARDISStringUtils; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/src/main/java/me/eccentric_nz/TARDIS/ARS/TARDISARSMapListener.java b/src/main/java/me/eccentric_nz/TARDIS/ARS/TARDISARSMapListener.java index 9fee647d9f..d70ecc6b54 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/ARS/TARDISARSMapListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/ARS/TARDISARSMapListener.java @@ -25,7 +25,7 @@ import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.move.TARDISDoorListener; import me.eccentric_nz.TARDIS.travel.TARDISDoorLocation; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; diff --git a/src/main/java/me/eccentric_nz/TARDIS/ARS/TARDISARSMethods.java b/src/main/java/me/eccentric_nz/TARDIS/ARS/TARDISARSMethods.java index 5a1b20395c..16b9403e3c 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/ARS/TARDISARSMethods.java +++ b/src/main/java/me/eccentric_nz/TARDIS/ARS/TARDISARSMethods.java @@ -27,11 +27,10 @@ import me.eccentric_nz.TARDIS.commands.sudo.TARDISSudoTracker; import me.eccentric_nz.TARDIS.database.resultset.*; import me.eccentric_nz.TARDIS.enumeration.Consoles; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; import me.eccentric_nz.TARDIS.enumeration.DiskCircuit; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.rooms.RoomRequiredLister; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.InventoryView; @@ -347,7 +346,7 @@ void close(Player player) { delay += period; } // damage the circuit if configured - if (plugin.getConfig().getBoolean("circuits.damage") && !plugin.getDifficulty().equals(Difficulty.EASY) && plugin.getConfig().getInt("circuits.uses.ars") > 0) { + if (plugin.getConfig().getBoolean("circuits.damage") && plugin.getConfig().getInt("circuits.uses.ars") > 0) { // get the id of the TARDIS this player is in int id = plugin.getTardisAPI().getIdOfTARDISPlayerIsIn(playerUUID); TARDISCircuitChecker tcc = new TARDISCircuitChecker(plugin, id); diff --git a/src/main/java/me/eccentric_nz/TARDIS/TARDIS.java b/src/main/java/me/eccentric_nz/TARDIS/TARDIS.java index d53bda9165..7cc2e50af2 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/TARDIS.java +++ b/src/main/java/me/eccentric_nz/TARDIS/TARDIS.java @@ -53,6 +53,7 @@ import me.eccentric_nz.TARDIS.mapping.TARDISBlueMap; import me.eccentric_nz.TARDIS.mapping.TARDISDynmap; import me.eccentric_nz.TARDIS.mapping.TARDISMapper; +import me.eccentric_nz.TARDIS.mapping.TARDISSquareMap; import me.eccentric_nz.TARDIS.messaging.AdventureMessage; import me.eccentric_nz.TARDIS.messaging.SpigotMessage; import me.eccentric_nz.TARDIS.messaging.TARDISMessage; @@ -140,10 +141,9 @@ public class TARDIS extends JavaPlugin { private final HashMap versions = new HashMap<>(); private final String versionRegex = "(\\d+[.])+\\d+"; private final Pattern versionPattern = Pattern.compile(versionRegex); - private final String serverStr = "1.20.6"; - private TARDISChatGUI jsonKeeper; + private final String serverStr = "1.21"; + private TARDISChatGUI jsonKeeper; private TARDISUpdateChatGUI updateChatGUI; - // public TARDISFurnaceRecipe fornacis; private Calendar afterCal; private Calendar beforeCal; private ConsoleCommandSender console; @@ -171,6 +171,7 @@ public class TARDIS extends JavaPlugin { private FileConfiguration itemsConfig; private FileConfiguration blasterConfig; private FileConfiguration customModelConfig; + private FileConfiguration systemUpgradesConfig; private HashMap condensables; private BukkitTask standbyTask; private TARDISChameleonPreset presets; @@ -192,7 +193,7 @@ public class TARDIS extends JavaPlugin { private TARDISHelper tardisHelper = null; private TARDISMultiverseHelper mvHelper = null; private String prefix; - private Difficulty difficulty; + private CraftingDifficulty craftingDifficulty; private WorldManager worldManager; private BukkitTask recordingTask; private NamespacedKey oldBlockKey; @@ -423,10 +424,10 @@ public void onEnable() { generalKeeper = new TARDISGeneralInstanceKeeper(this); generalKeeper.setQuotes(quotes()); try { - difficulty = Difficulty.valueOf(getConfig().getString("preferences.difficulty", "EASY").toUpperCase(Locale.ENGLISH)); + craftingDifficulty = CraftingDifficulty.valueOf(getConfig().getString("difficulty.crafting", "EASY").toUpperCase(Locale.ENGLISH)); } catch (IllegalArgumentException e) { debug("Could not determine difficulty setting, using EASY"); - difficulty = Difficulty.EASY; + craftingDifficulty = CraftingDifficulty.EASY; } // register recipes figura = new TARDISShapedRecipe(this); @@ -452,6 +453,8 @@ public void onEnable() { getMessenger().message(console, TardisModule.TARDIS, "Loading Mapping Module"); if (mapper.equals("dynmap")) { tardisMapper = new TARDISDynmap(this); + } else if (mapper.equals("squaremap")) { + tardisMapper = new TARDISSquareMap(this); } else { tardisMapper = new TARDISBlueMap(this); } @@ -885,6 +888,15 @@ public FileConfiguration getCustomModelConfig() { return customModelConfig; } + /** + * Gets the system upgrades configuration + * + * @return the system upgrades configuration + */ + public FileConfiguration getSystemUpgradesConfig() { + return systemUpgradesConfig; + } + /** * Gets the language configuration * @@ -1232,17 +1244,17 @@ public List getCleanUpWorlds() { * * @return the TARDIS Difficulty level */ - public Difficulty getDifficulty() { - return difficulty; + public CraftingDifficulty getCraftingDifficulty() { + return craftingDifficulty; } /** * Sets the TARDIS Difficulty level * - * @param difficulty the {@link Difficulty} level to set + * @param craftingDifficulty the {@link CraftingDifficulty} level to set */ - public void setDifficulty(Difficulty difficulty) { - this.difficulty = difficulty; + public void setDifficulty(CraftingDifficulty craftingDifficulty) { + this.craftingDifficulty = craftingDifficulty; } /** @@ -1648,7 +1660,7 @@ private void loadCustomConfigs() { "monsters.yml", "planets.yml", "recipes.yml", "rooms.yml", - "shop.yml", + "shop.yml", "system_upgrades.yml", "tag.yml", "vortex_manipulator.yml" ); @@ -1690,6 +1702,7 @@ private void loadCustomConfigs() { blasterConfig = YamlConfiguration.loadConfiguration(new File(getDataFolder(), "blaster.yml")); } customModelConfig = YamlConfiguration.loadConfiguration(new File(getDataFolder(), "custom_models.yml")); + systemUpgradesConfig = YamlConfiguration.loadConfiguration(new File(getDataFolder(), "system_upgrades.yml")); } /** diff --git a/src/main/java/me/eccentric_nz/TARDIS/TARDISListenerRegisterer.java b/src/main/java/me/eccentric_nz/TARDIS/TARDISListenerRegisterer.java index b4c5932294..c5a280a50b 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/TARDISListenerRegisterer.java +++ b/src/main/java/me/eccentric_nz/TARDIS/TARDISListenerRegisterer.java @@ -49,7 +49,6 @@ import me.eccentric_nz.TARDIS.desktop.TARDISThemeMenuListener; import me.eccentric_nz.TARDIS.desktop.TARDISWallMenuListener; import me.eccentric_nz.TARDIS.display.TARDISDisplayListener; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; import me.eccentric_nz.TARDIS.enumeration.InventoryManager; import me.eccentric_nz.TARDIS.flight.FlightGamemodeListener; import me.eccentric_nz.TARDIS.flight.TARDISHandbrakeListener; @@ -73,6 +72,7 @@ import me.eccentric_nz.TARDIS.listeners.controls.*; import me.eccentric_nz.TARDIS.mobfarming.TARDISFarmingMenuListener; import me.eccentric_nz.TARDIS.move.*; +import me.eccentric_nz.TARDIS.particles.TARDISParticleGUIListener; import me.eccentric_nz.TARDIS.planets.*; import me.eccentric_nz.TARDIS.recipes.TARDISRecipeCategoryListener; import me.eccentric_nz.TARDIS.recipes.TARDISRecipeInventoryListener; @@ -92,6 +92,7 @@ import me.eccentric_nz.TARDIS.travel.save.TARDISSavesPlanetListener; import me.eccentric_nz.TARDIS.universaltranslator.TARDISTranslateChatListener; import me.eccentric_nz.TARDIS.update.TARDISUpdateListener; +import me.eccentric_nz.TARDIS.upgrades.TARDISSystemTreeListener; import me.eccentric_nz.tardischemistry.block.ChemistryBlockListener; import me.eccentric_nz.tardischemistry.compound.CompoundGUIListener; import me.eccentric_nz.tardischemistry.compound.GlueListener; @@ -168,7 +169,7 @@ TARDISInformationSystemListener registerListeners() { plugin.getPM().registerEvents(new TARDISArtronFurnaceListener(plugin), plugin); plugin.getPM().registerEvents(new TARDISBeaconColouringListener(plugin), plugin); plugin.getPM().registerEvents(new TARDISBindListener(plugin), plugin); - if (!plugin.getDifficulty().equals(Difficulty.HARD)) { + if (plugin.getConfig().getBoolean("difficulty.biome_reader")) { plugin.getPM().registerEvents(new TARDISBiomeReaderListener(plugin), plugin); } plugin.getPM().registerEvents(new TARDISBlockDamageListener(plugin), plugin); @@ -241,6 +242,7 @@ TARDISInformationSystemListener registerListeners() { plugin.getPM().registerEvents(new TARDISPerceptionFilterListener(plugin), plugin); } plugin.getPM().registerEvents(new TARDISPaperBagListener(plugin), plugin); + plugin.getPM().registerEvents(new TARDISParticleGUIListener(plugin), plugin); plugin.getPM().registerEvents(new TARDISPistonListener(plugin), plugin); plugin.getPM().registerEvents(new TARDISPortalListener(plugin), plugin); plugin.getPM().registerEvents(new TARDISPrefsMenuListener(plugin), plugin); @@ -281,6 +283,7 @@ TARDISInformationSystemListener registerListeners() { plugin.getPM().registerEvents(new TARDISSpawnListener(plugin), plugin); plugin.getPM().registerEvents(new TARDISStattenheimListener(plugin), plugin); plugin.getPM().registerEvents(new TARDISStorageListener(plugin), plugin); + plugin.getPM().registerEvents(new TARDISSystemTreeListener(plugin), plugin); plugin.getPM().registerEvents(new TARDISTagListener(plugin), plugin); plugin.getPM().registerEvents(new TARDISTelepathicListener(plugin), plugin); plugin.getPM().registerEvents(new TARDISTeleportListener(plugin), plugin); diff --git a/src/main/java/me/eccentric_nz/TARDIS/advanced/TARDISAuthorisedControlDisk.java b/src/main/java/me/eccentric_nz/TARDIS/advanced/TARDISAuthorisedControlDisk.java index 1b7b43f387..1a45d8d7c9 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/advanced/TARDISAuthorisedControlDisk.java +++ b/src/main/java/me/eccentric_nz/TARDIS/advanced/TARDISAuthorisedControlDisk.java @@ -18,6 +18,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.api.Parameters; +import me.eccentric_nz.TARDIS.database.data.Throticle; import me.eccentric_nz.TARDIS.database.resultset.ResultSetControls; import me.eccentric_nz.TARDIS.database.resultset.ResultSetDestinations; import me.eccentric_nz.TARDIS.database.resultset.ResultSetHomeLocation; @@ -173,10 +174,11 @@ public String process() { TARDISEPSRunnable EPS_runnable = new TARDISEPSRunnable(plugin, message, player, playerUUIDs, id, eps, creeper); plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, EPS_runnable, 20L); plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> { + Throticle throticle = new Throticle(SpaceTimeThrottle.NORMAL, false); // dematerialise - new TARDISDematerialiseToVortex(plugin, id, player, handbrake, SpaceTimeThrottle.NORMAL).run(); + new TARDISDematerialiseToVortex(plugin, id, player, handbrake, throticle).run(); // materialise - new TARDISMaterialseFromVortex(plugin, id, player, handbrake, SpaceTimeThrottle.NORMAL).run(); + new TARDISMaterialseFromVortex(plugin, id, player, handbrake, throticle).run(); }, 60L); } else { return "Could not disengage handbrake."; diff --git a/src/main/java/me/eccentric_nz/TARDIS/advanced/TARDISCircuitChecker.java b/src/main/java/me/eccentric_nz/TARDIS/advanced/TARDISCircuitChecker.java index c4ad5a470e..9950a7db50 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/advanced/TARDISCircuitChecker.java +++ b/src/main/java/me/eccentric_nz/TARDIS/advanced/TARDISCircuitChecker.java @@ -16,19 +16,20 @@ */ package me.eccentric_nz.TARDIS.advanced; -import java.io.IOException; -import java.util.HashMap; -import java.util.List; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.database.resultset.ResultSetDiskStorage; import me.eccentric_nz.TARDIS.utility.TARDISNumberParsers; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; + /** - * The synchronic feedback circuit, along with the multi-loop stabiliser, was an - * essential component for a smooth rematerialisation of a TARDIS. + * The synchronic feedback circuit, along with the multi-loop stabiliser, was an essential component for a smooth + * rematerialisation of a TARDIS. * * @author eccentric_nz */ @@ -44,6 +45,7 @@ public class TARDISCircuitChecker { private boolean memory; private boolean randomiser; private boolean scanner; + private boolean telepathic; private boolean temporal; private int arsUses; private int chameleonUses; @@ -54,6 +56,7 @@ public class TARDISCircuitChecker { private int randomiserUses; private int scannerUses; private int temporalUses; + private int telepathicUses; public TARDISCircuitChecker(TARDIS plugin, int id) { this.plugin = plugin; @@ -66,6 +69,7 @@ public TARDISCircuitChecker(TARDIS plugin, int id) { memory = false; randomiser = false; scanner = false; + telepathic = false; temporal = false; arsUses = 0; chameleonUses = 0; @@ -75,12 +79,12 @@ public TARDISCircuitChecker(TARDIS plugin, int id) { memoryUses = 0; randomiserUses = 0; scannerUses = 0; + telepathicUses = 0; temporalUses = 0; } /** - * Checks the TARDIS's Advanced Console inventory to see which circuits are - * installed. + * Checks the TARDIS's Advanced Console inventory to see which circuits are installed. */ public void getCircuits() { HashMap where = new HashMap<>(); @@ -127,6 +131,10 @@ public void getCircuits() { scanner = true; scannerUses = getUses(im); } + if (dn.equals("TARDIS Telepathic Circuit")) { + temporal = true; + temporalUses = getUses(im); + } if (dn.equals("TARDIS Temporal Circuit")) { temporal = true; temporalUses = getUses(im); @@ -172,6 +180,10 @@ public boolean hasScanner() { return scanner; } + public boolean hasTelepathic() { + return telepathic; + } + public boolean hasTemporal() { return temporal; } @@ -208,6 +220,10 @@ public int getScannerUses() { return scannerUses; } + public int getTelepathicUses() { + return telepathicUses; + } + public int getTemporalUses() { return temporalUses; } diff --git a/src/main/java/me/eccentric_nz/TARDIS/advanced/TARDISCircuitDamager.java b/src/main/java/me/eccentric_nz/TARDIS/advanced/TARDISCircuitDamager.java index 8197e2a5cc..189be00acb 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/advanced/TARDISCircuitDamager.java +++ b/src/main/java/me/eccentric_nz/TARDIS/advanced/TARDISCircuitDamager.java @@ -16,20 +16,21 @@ */ package me.eccentric_nz.TARDIS.advanced; -import java.io.IOException; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.database.resultset.ResultSetDiskStorage; import me.eccentric_nz.TARDIS.enumeration.DiskCircuit; import me.eccentric_nz.TARDIS.enumeration.TardisModule; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; + /** * @author eccentric_nz */ @@ -53,13 +54,13 @@ public void damage() { if (uses_left == 0) { uses_left = plugin.getConfig().getInt("circuits.uses." + circuit.toString().toLowerCase(Locale.ENGLISH)); } - if ((uses_left - 1) <= 0) { + int decremented = uses_left - 1; + if (decremented <= 0) { // destroy setCircuitDamage(circuit.getName(), 0, true); plugin.getMessenger().send(p, TardisModule.TARDIS, "CIRCUIT_VAPOUR", circuit.getName()); } else { // decrement - int decremented = uses_left - 1; plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> { setCircuitDamage(circuit.getName(), decremented, false); plugin.getMessenger().send(p, TardisModule.TARDIS, "CIRCUIT_USES", circuit.getName(), String.format("%d", decremented)); diff --git a/src/main/java/me/eccentric_nz/TARDIS/advanced/TARDISCircuitRepairListener.java b/src/main/java/me/eccentric_nz/TARDIS/advanced/TARDISCircuitRepairListener.java index a88d2888e8..54d5b9576f 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/advanced/TARDISCircuitRepairListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/advanced/TARDISCircuitRepairListener.java @@ -18,7 +18,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.utility.TARDISNumberParsers; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -51,6 +51,7 @@ public TARDISCircuitRepairListener(TARDIS plugin) { circuits.put(10001980, "randomiser"); circuits.put(10001977, "scanner"); circuits.put(10001974, "temporal"); + circuits.put(10001962, "telepathic"); } @EventHandler(ignoreCancelled = true) diff --git a/src/main/java/me/eccentric_nz/TARDIS/advanced/TARDISConsoleCloseListener.java b/src/main/java/me/eccentric_nz/TARDIS/advanced/TARDISConsoleCloseListener.java index 2d91b51e59..f472531164 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/advanced/TARDISConsoleCloseListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/advanced/TARDISConsoleCloseListener.java @@ -33,7 +33,7 @@ import me.eccentric_nz.TARDIS.travel.TravelCostAndType; import me.eccentric_nz.TARDIS.utility.TARDISNumberParsers; import me.eccentric_nz.tardischunkgenerator.custombiome.BiomeUtilities; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.World; @@ -100,7 +100,7 @@ public void onInventoryClose(InventoryCloseEvent event) { Inventory inv = event.getInventory(); // remember what was placed in the console saveCurrentConsole(inv, p.getUniqueId().toString()); - if (!plugin.getDifficulty().equals(Difficulty.EASY)) { + if (plugin.getConfig().getBoolean("difficulty.circuits")) { // check circuits TARDISCircuitChecker tcc = new TARDISCircuitChecker(plugin, id); tcc.getCircuits(); @@ -331,7 +331,7 @@ public void onInventoryClose(InventoryCloseEvent event) { new TARDISLand(plugin, id, p).exitVortex(); plugin.getPM().callEvent(new TARDISTravelEvent(p, null, TravelType.SAVE, id)); } - if (plugin.getConfig().getBoolean("circuits.damage") && !plugin.getDifficulty().equals(Difficulty.EASY) && plugin.getConfig().getInt("circuits.uses.memory") > 0 && !plugin.getTrackerKeeper().getHasNotClickedHandbrake().contains(id)) { + if (plugin.getConfig().getBoolean("circuits.damage") && plugin.getConfig().getInt("circuits.uses.memory") > 0 && !plugin.getTrackerKeeper().getHasNotClickedHandbrake().contains(id)) { plugin.getTrackerKeeper().getHasNotClickedHandbrake().add(id); TARDISCircuitChecker tcc = new TARDISCircuitChecker(plugin, id); tcc.getCircuits(); @@ -368,7 +368,7 @@ public void onInventoryClose(InventoryCloseEvent event) { new TARDISLand(plugin, id, p).exitVortex(); plugin.getPM().callEvent(new TARDISTravelEvent(p, null, TravelType.RANDOM, id)); } - if (plugin.getConfig().getBoolean("circuits.damage") && !plugin.getDifficulty().equals(Difficulty.EASY) && plugin.getConfig().getInt("circuits.uses.randomiser") > 0) { + if (plugin.getConfig().getBoolean("circuits.damage") && plugin.getConfig().getInt("circuits.uses.randomiser") > 0) { TARDISCircuitChecker tcc = new TARDISCircuitChecker(plugin, id); tcc.getCircuits(); // decrement uses diff --git a/src/main/java/me/eccentric_nz/TARDIS/advanced/TARDISConsoleListener.java b/src/main/java/me/eccentric_nz/TARDIS/advanced/TARDISConsoleListener.java index af67c926d8..5dcf13ac7d 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/advanced/TARDISConsoleListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/advanced/TARDISConsoleListener.java @@ -26,7 +26,7 @@ import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.floodgate.TARDISFloodgate; import me.eccentric_nz.TARDIS.utility.TARDISStaticUtils; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.entity.Player; diff --git a/src/main/java/me/eccentric_nz/TARDIS/advanced/TARDISConsoleSwitchListener.java b/src/main/java/me/eccentric_nz/TARDIS/advanced/TARDISConsoleSwitchListener.java index 062ceab293..23f69e6675 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/advanced/TARDISConsoleSwitchListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/advanced/TARDISConsoleSwitchListener.java @@ -19,6 +19,7 @@ import me.eccentric_nz.TARDIS.ARS.TARDISARSInventory; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.chameleon.gui.TARDISChameleonInventory; +import me.eccentric_nz.TARDIS.console.telepathic.TARDISTelepathicInventory; import me.eccentric_nz.TARDIS.control.TARDISScanner; import me.eccentric_nz.TARDIS.database.data.Tardis; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardis; @@ -27,7 +28,9 @@ import me.eccentric_nz.TARDIS.travel.TARDISTemporalLocatorInventory; import me.eccentric_nz.TARDIS.travel.TARDISTerminalInventory; import me.eccentric_nz.TARDIS.travel.save.TARDISSavesPlanetInventory; -import net.md_5.bungee.api.ChatColor; +import me.eccentric_nz.TARDIS.upgrades.SystemTree; +import me.eccentric_nz.TARDIS.upgrades.SystemUpgradeChecker; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -52,7 +55,7 @@ public class TARDISConsoleSwitchListener implements Listener { private final TARDIS plugin; - private final List gui_circuits = Arrays.asList(10001966, 10001973, 10001974, 10001975, 10001976, 10001977, 20001966, 20001973, 20001974, 20001975, 20001976, 20001977); + private final List gui_circuits = Arrays.asList(10001962, 10001966, 10001973, 10001974, 10001975, 10001976, 10001977, 20001962, 20001966, 20001973, 20001974, 20001975, 20001976, 20001977); public TARDISConsoleSwitchListener(TARDIS plugin) { this.plugin = plugin; @@ -64,14 +67,15 @@ public void onConsoleInventoryClick(InventoryClickEvent event) { if (!view.getTitle().equals(ChatColor.DARK_RED + "TARDIS Console")) { return; } - Player p = (Player) event.getWhoClicked(); + Player player = (Player) event.getWhoClicked(); + String uuid = player.getUniqueId().toString(); // check they're in the TARDIS HashMap wheret = new HashMap<>(); - wheret.put("uuid", p.getUniqueId().toString()); + wheret.put("uuid", uuid); ResultSetTravellers rst = new ResultSetTravellers(plugin, wheret, false); if (!rst.resultSet()) { event.setCancelled(true); - plugin.getMessenger().send(p, TardisModule.TARDIS, "NOT_IN_TARDIS"); + plugin.getMessenger().send(player, TardisModule.TARDIS, "NOT_IN_TARDIS"); } if (!event.getClick().equals(ClickType.SHIFT_RIGHT)) { return; @@ -91,46 +95,60 @@ public void onConsoleInventoryClick(InventoryClickEvent event) { return; } HashMap where = new HashMap<>(); - where.put("uuid", p.getUniqueId().toString()); + where.put("uuid", uuid); ResultSetTardis rs = new ResultSetTardis(plugin, where, "", false, 0); if (rs.resultSet()) { - plugin.getMessenger().send(p, TardisModule.TARDIS, "NO_TARDIS"); + plugin.getMessenger().send(player, TardisModule.TARDIS, "NO_TARDIS"); return; } Tardis tardis = rs.getTardis(); plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> { ItemStack[] stack = null; Inventory new_inv = null; - switch (cmd) { // Chameleon circuit + switch (cmd) { + // Chameleon circuit case 10001966, 20001966 -> { - new_inv = plugin.getServer().createInventory(p, 27, ChatColor.DARK_RED + "Chameleon Circuit"); + new_inv = plugin.getServer().createInventory(player, 27, ChatColor.DARK_RED + "Chameleon Circuit"); stack = new TARDISChameleonInventory(plugin, tardis.getAdaption(), tardis.getPreset(), tardis.getItemPreset()).getMenu(); - } // ARS circuit + } + // ARS circuit case 10001973, 20001973 -> { - new_inv = plugin.getServer().createInventory(p, 54, ChatColor.DARK_RED + "Architectural Reconfiguration"); - stack = new TARDISARSInventory(plugin, p).getARS(); - } // Temporal circuit + new_inv = plugin.getServer().createInventory(player, 54, ChatColor.DARK_RED + "Architectural Reconfiguration"); + stack = new TARDISARSInventory(plugin, player).getARS(); + } + // Telepathic circuit + case 10001962, 20001962 -> { + new_inv = plugin.getServer().createInventory(player, 54, ChatColor.DARK_RED + "TARDIS Telepathic Circuit"); + stack = new TARDISTelepathicInventory(plugin, player).getButtons(); + } + // Temporal circuit case 10001974, 20001974 -> { - new_inv = plugin.getServer().createInventory(p, 27, ChatColor.DARK_RED + "Temporal Locator"); + new_inv = plugin.getServer().createInventory(player, 27, ChatColor.DARK_RED + "Temporal Locator"); stack = new TARDISTemporalLocatorInventory(plugin).getTemporal(); - } // Memory circuit (saves/areas) + } + // Memory circuit (saves/areas) case 10001975, 20001975 -> { - new_inv = plugin.getServer().createInventory(p, 54, ChatColor.DARK_RED + "TARDIS Dimension Map"); + if (plugin.getConfig().getBoolean("difficulty.system_upgrades") && !new SystemUpgradeChecker(plugin).has(uuid, SystemTree.SAVES)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_NEED", "Saves"); + return; + } + new_inv = plugin.getServer().createInventory(player, 54, ChatColor.DARK_RED + "TARDIS Dimension Map"); stack = new TARDISSavesPlanetInventory(plugin, tardis.getTardisId()).getPlanets(); - } // Input circuit (terminal) + } + // Input circuit (terminal) case 10001976, 20001976 -> { - new_inv = plugin.getServer().createInventory(p, 54, ChatColor.DARK_RED + "Destination Terminal"); + new_inv = plugin.getServer().createInventory(player, 54, ChatColor.DARK_RED + "Destination Terminal"); stack = new TARDISTerminalInventory(plugin).getTerminal(); } // scanner circuit - default -> new TARDISScanner(plugin).scan(tardis.getTardisId(), p, tardis.getRenderer(), tardis.getArtronLevel()); + default -> new TARDISScanner(plugin).scan(tardis.getTardisId(), player, tardis.getRenderer(), tardis.getArtronLevel()); } // close inventory - p.closeInventory(); + player.closeInventory(); if (new_inv != null && stack != null) { // open new inventory new_inv.setContents(stack); - p.openInventory(new_inv); + player.openInventory(new_inv); } }, 1L); } diff --git a/src/main/java/me/eccentric_nz/TARDIS/advanced/TARDISDiskWriterCommand.java b/src/main/java/me/eccentric_nz/TARDIS/advanced/TARDISDiskWriterCommand.java index 73d1b169ba..433a436812 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/advanced/TARDISDiskWriterCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/advanced/TARDISDiskWriterCommand.java @@ -16,20 +16,23 @@ */ package me.eccentric_nz.TARDIS.advanced; -import java.io.IOException; -import java.util.*; -import java.util.regex.Pattern; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.database.data.Tardis; import me.eccentric_nz.TARDIS.database.resultset.*; import me.eccentric_nz.TARDIS.enumeration.ChameleonPreset; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.UUID; +import java.util.regex.Pattern; + /** * @author eccentric_nz */ @@ -49,7 +52,8 @@ public TARDISDiskWriterCommand(TARDIS plugin) { public boolean writeSave(Player player, String[] args) { ItemStack is; - if (plugin.getDifficulty().equals(Difficulty.MEDIUM)) { + boolean makeAndSaveDisk = !plugin.getConfig().getBoolean("difficulty.disk_in_hand_for_write"); + if (makeAndSaveDisk) { is = new ItemStack(Material.MUSIC_DISC_CHIRP, 1); ItemMeta im = is.getItemMeta(); im.setDisplayName("Save Storage Disk"); @@ -114,7 +118,7 @@ public boolean writeSave(Player player, String[] args) { lore.add(7, (rsc.isSubmarine()) ? "true" : "false"); im.setLore(lore); is.setItemMeta(im); - if (plugin.getDifficulty().equals(Difficulty.MEDIUM)) { + if (makeAndSaveDisk) { // save the disk to storage boolean isSpace = saveDiskToStorage(player, is); if (!isSpace) { @@ -257,7 +261,7 @@ public boolean writeSaveToControlDisk(Player player, String[] args) { save = "Home"; } else { HashMap wherename = new HashMap<>(); - wherename.put("tardis_id", rs.getTardis_id()); + wherename.put("tardis_id", rs.getTardisId()); wherename.put("dest_name", args[1]); wherename.put("type", 0); ResultSetDestinations rsd = new ResultSetDestinations(plugin, wherename, false); diff --git a/src/main/java/me/eccentric_nz/TARDIS/advanced/TARDISStorageListener.java b/src/main/java/me/eccentric_nz/TARDIS/advanced/TARDISStorageListener.java index f353056c29..663d81564e 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/advanced/TARDISStorageListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/advanced/TARDISStorageListener.java @@ -24,7 +24,7 @@ import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; import me.eccentric_nz.TARDIS.utility.TARDISStaticUtils; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/src/main/java/me/eccentric_nz/TARDIS/api/TARDII.java b/src/main/java/me/eccentric_nz/TARDIS/api/TARDII.java index dcc804e82c..c0a8544268 100755 --- a/src/main/java/me/eccentric_nz/TARDIS/api/TARDII.java +++ b/src/main/java/me/eccentric_nz/TARDIS/api/TARDII.java @@ -56,7 +56,7 @@ import me.eccentric_nz.tardisweepingangels.utils.Monster; import org.bukkit.*; import org.bukkit.World.Environment; -import org.bukkit.craftbukkit.v1_20_R4.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_21_R1.entity.CraftEntity; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; @@ -181,6 +181,28 @@ public TARDISData getTARDISMapData(int id) { return data; } + @Override + public Location getRandomLocation(List worlds, Environment environment, Parameters param) { + if (environment == null) { + // choose random environment - weighted towards normal! + environment = weightedChoice.next(); + // check if environment is enabled + if ((environment.equals(Environment.NETHER) && !TARDIS.plugin.getConfig().getBoolean("travel.nether")) || (environment.equals(Environment.THE_END) && !TARDIS.plugin.getConfig().getBoolean("travel.the_end"))) { + environment = Environment.NORMAL; + } + } + return switch (environment) { + case NETHER -> new TARDISRandomNether(TARDIS.plugin, worlds, param).getlocation(); + case THE_END -> new TARDISRandomTheEnd(TARDIS.plugin, worlds, param).getlocation(); + default -> new TARDISRandomOverworld(TARDIS.plugin, worlds, param).getlocation(); + }; + } + + @Override + public Location getRandomLocation(List worlds, Environment environment, Player p) { + return getRandomLocation(getWorlds(), null, new Parameters(p, Flag.getAPIFlags())); + } + @Override public Location getRandomLocation(List worlds, Player p) { return getRandomLocation(getWorlds(), null, new Parameters(p, Flag.getAPIFlags())); @@ -320,7 +342,7 @@ public List getPlayersInTARDIS(Player p) { public List getPlayersInTARDIS(UUID uuid) { ResultSetTardisID rs = new ResultSetTardisID(TARDIS.plugin); if (rs.fromUUID(uuid.toString())) { - return getPlayersInTARDIS(rs.getTardis_id()); + return getPlayersInTARDIS(rs.getTardisId()); } else { return new ArrayList<>(); } @@ -627,7 +649,7 @@ public boolean setDestination(UUID uuid, Location location, boolean travel) { // get tardis_id ResultSetTardisID rst = new ResultSetTardisID(TARDIS.plugin); if (rst.fromUUID(uuid.toString())) { - return setDestination(rst.getTardis_id(), location, travel); + return setDestination(rst.getTardisId(), location, travel); } else { return false; } @@ -722,7 +744,7 @@ public boolean setChameleonPreset(UUID uuid, ChameleonPreset preset, boolean reb // get tardis_id ResultSetTardisID rst = new ResultSetTardisID(TARDIS.plugin); if (rst.fromUUID(uuid.toString())) { - return setChameleonPreset(rst.getTardis_id(), preset, rebuild); + return setChameleonPreset(rst.getTardisId(), preset, rebuild); } else { return false; } @@ -1002,26 +1024,4 @@ public ItemStack getHead(Monster monster) { public ItemStack getK9() { return HeadBuilder.getK9(); } - - @Override - public Location getRandomLocation(List worlds, Environment environment, Parameters param) { - if (environment == null) { - // choose random environment - weighted towards normal! - environment = weightedChoice.next(); - // check if environment is enabled - if ((environment.equals(Environment.NETHER) && !TARDIS.plugin.getConfig().getBoolean("travel.nether")) || (environment.equals(Environment.THE_END) && !TARDIS.plugin.getConfig().getBoolean("travel.the_end"))) { - environment = Environment.NORMAL; - } - } - return switch (environment) { - case NETHER -> new TARDISRandomNether(TARDIS.plugin, worlds, param).getlocation(); - case THE_END -> new TARDISRandomTheEnd(TARDIS.plugin, worlds, param).getlocation(); - default -> new TARDISRandomOverworld(TARDIS.plugin, worlds, param).getlocation(); - }; - } - - @Override - public Location getRandomLocation(List worlds, Environment environment, Player p) { - return getRandomLocation(getWorlds(), null, new Parameters(p, Flag.getAPIFlags())); - } } diff --git a/src/main/java/me/eccentric_nz/TARDIS/arch/TARDISArchCommand.java b/src/main/java/me/eccentric_nz/TARDIS/arch/TARDISArchCommand.java index 7ce8acef70..f317d6ec63 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/arch/TARDISArchCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/arch/TARDISArchCommand.java @@ -19,7 +19,7 @@ import java.util.UUID; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.enumeration.TardisModule; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.attribute.Attribute; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; diff --git a/src/main/java/me/eccentric_nz/TARDIS/artron/TARDISCondensables.java b/src/main/java/me/eccentric_nz/TARDIS/artron/TARDISCondensables.java index 6a6229845a..1c21287f82 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/artron/TARDISCondensables.java +++ b/src/main/java/me/eccentric_nz/TARDIS/artron/TARDISCondensables.java @@ -527,7 +527,7 @@ public void makeCondensables() { condensables.put("MAGENTA_TERRACOTTA", 15); condensables.put("MAGENTA_WALL_BANNER", 120); condensables.put("MAGENTA_WOOL", 20); - condensables.put("MAGMA_BLOCK", 600); + condensables.put("MAGMA_BLOCK", 60); condensables.put("MAGMA_CREAM", 150); // 1.19 - Wild Update condensables.put("MANGROVE_BOAT", 3); @@ -799,7 +799,7 @@ public void makeCondensables() { condensables.put("SANDSTONE_STAIRS", 118); condensables.put("SANDSTONE_WALL", 2); condensables.put("SCAFFOLDING", 18); - condensables.put("SCUTE", 20); + condensables.put("TURTLE_SCUTE", 20); condensables.put("SEA_LANTERN", 160); condensables.put("SEA_PICKLE", 6); condensables.put("SEAGRASS", 2); @@ -1158,11 +1158,72 @@ public void makeCondensables() { condensables.put("STRIPPED_BAMBOO_BLOCK", 2); condensables.put("STRIPPED_CHERRY_LOG", 2); condensables.put("STRIPPED_CHERRY_WOOD", 2); -// condensables.put("SUSPICIOUS_GRAVEL", 2); // unobtainable -// condensables.put("SUSPICIOUS_SAND", 2); // unobtainable condensables.put("TORCHFLOWER", 20); condensables.put("TORCHFLOWER_SEEDS", 20); condensables.put("WARPED_HANGING_SIGN", 2); + // 1.20.5 + condensables.put("ARMADILLO_SCUTE", 20); + condensables.put("WOLF_ARMOR", 120); + // 1.21 + condensables.put("BREEZE_ROD", 200); + condensables.put("CHISELED_COPPER", 360); + condensables.put("CHISELED_TUFF", 2); + condensables.put("CHISELED_TUFF_BRICKS", 4); + condensables.put("COPPER_BULB", 700); + condensables.put("COPPER_DOOR", 40); + condensables.put("COPPER_GRATE", 180); + condensables.put("COPPER_TRAPDOOR", 60); + condensables.put("CRAFTER", 210); + condensables.put("EXPOSED_CHISELED_COPPER", 360); + condensables.put("EXPOSED_COPPER_BULB", 700); + condensables.put("EXPOSED_COPPER_DOOR", 40); + condensables.put("EXPOSED_COPPER_GRATE", 180); + condensables.put("EXPOSED_COPPER_TRAPDOOR", 60); + condensables.put("HEAVY_CORE", 300); + condensables.put("OXIDIZED_CHISELED_COPPER", 360); + condensables.put("OXIDIZED_COPPER_BULB", 700); + condensables.put("OXIDIZED_COPPER_DOOR", 40); + condensables.put("OXIDIZED_COPPER_GRATE", 180); + condensables.put("OXIDIZED_COPPER_TRAPDOOR", 60); + condensables.put("POLISHED_TUFF", 2); + condensables.put("POLISHED_TUFF_SLAB", 2); + condensables.put("POLISHED_TUFF_STAIRS", 2); + condensables.put("POLISHED_TUFF_WALL", 2); + condensables.put("TUFF_BRICKS", 4); + condensables.put("TUFF_BRICK_SLAB", 2); + condensables.put("TUFF_BRICK_STAIRS", 2); + condensables.put("TUFF_BRICK_WALL", 2); + condensables.put("TUFF_SLAB", 2); + condensables.put("TUFF_STAIRS", 2); + condensables.put("TUFF_WALL", 2); + condensables.put("WAXED_CHISELED_COPPER", 2); + condensables.put("WAXED_COPPER_BULB", 720); + condensables.put("WAXED_COPPER_DOOR", 60); + condensables.put("WAXED_COPPER_GRATE", 200); + condensables.put("WAXED_COPPER_TRAPDOOR", 80); + condensables.put("WAXED_EXPOSED_CHISELED_COPPER", 380); + condensables.put("WAXED_EXPOSED_COPPER_BULB", 720); + condensables.put("WAXED_EXPOSED_COPPER_DOOR", 60); + condensables.put("WAXED_EXPOSED_COPPER_GRATE", 200); + condensables.put("WAXED_EXPOSED_COPPER_TRAPDOOR", 80); + condensables.put("WAXED_OXIDIZED_CHISELED_COPPER", 380); + condensables.put("WAXED_OXIDIZED_COPPER_BULB", 720); + condensables.put("WAXED_OXIDIZED_COPPER_DOOR", 60); + condensables.put("WAXED_OXIDIZED_COPPER_GRATE", 200); + condensables.put("WAXED_OXIDIZED_COPPER_TRAPDOOR", 80); + condensables.put("WAXED_WEATHERED_CHISELED_COPPER", 380); + condensables.put("WAXED_WEATHERED_COPPER_BULB", 720); + condensables.put("WAXED_WEATHERED_COPPER_DOOR", 60); + condensables.put("WAXED_WEATHERED_COPPER_GRATE", 200); + condensables.put("WAXED_WEATHERED_COPPER_TRAPDOOR", 80); + condensables.put("WEATHERED_CHISELED_COPPER", 360); + condensables.put("WEATHERED_COPPER_BULB", 700); + condensables.put("WEATHERED_COPPER_DOOR", 40); + condensables.put("WEATHERED_COPPER_GRATE", 180); + condensables.put("WEATHERED_COPPER_TRAPDOOR", 60); + condensables.put("FLOW_POTTERY_SHERD", 20); + condensables.put("GUSTER_POTTERY_SHERD", 20); + condensables.put("SCRAPE_POTTERY_SHERD", 20); } else { Set items = plugin.getCondensablesConfig().getKeys(false); items.forEach((item) -> condensables.put(item, plugin.getCondensablesConfig().getInt(item))); diff --git a/src/main/java/me/eccentric_nz/TARDIS/artron/TARDISCondenserListener.java b/src/main/java/me/eccentric_nz/TARDIS/artron/TARDISCondenserListener.java index b870f8dcb4..18850116e0 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/artron/TARDISCondenserListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/artron/TARDISCondenserListener.java @@ -26,7 +26,7 @@ import me.eccentric_nz.TARDIS.enumeration.Advancement; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.utility.TARDISStaticUtils; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; diff --git a/src/main/java/me/eccentric_nz/TARDIS/artron/TARDISLampToggler.java b/src/main/java/me/eccentric_nz/TARDIS/artron/TARDISLampToggler.java index 5b57648870..edc7867683 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/artron/TARDISLampToggler.java +++ b/src/main/java/me/eccentric_nz/TARDIS/artron/TARDISLampToggler.java @@ -54,7 +54,7 @@ public void flickSwitch(int id, UUID uuid, boolean on, TardisLight light) { if (rsp.resultSet()) { // only use player preference if the tardis id of the timelord/companion is the same as the tardis id they are in ResultSetTardisID rs = new ResultSetTardisID(plugin); - if (rs.fromUUID(uuid.toString()) && rs.getTardis_id() == id) { + if (rs.fromUUID(uuid.toString()) && rs.getTardisId() == id) { light = rsp.getLights(); } else { // also force the use of lanterns if that is the tardis owner's preference diff --git a/src/main/java/me/eccentric_nz/TARDIS/autonomous/TARDISAutonomousGUIListener.java b/src/main/java/me/eccentric_nz/TARDIS/autonomous/TARDISAutonomousGUIListener.java index af20a3b2a0..c321578868 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/autonomous/TARDISAutonomousGUIListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/autonomous/TARDISAutonomousGUIListener.java @@ -20,7 +20,7 @@ import me.eccentric_nz.TARDIS.database.resultset.ResultSetAreas; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/src/main/java/me/eccentric_nz/TARDIS/autonomous/TARDISAutonomousInventory.java b/src/main/java/me/eccentric_nz/TARDIS/autonomous/TARDISAutonomousInventory.java index 2ab90fd6f3..77d563e28e 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/autonomous/TARDISAutonomousInventory.java +++ b/src/main/java/me/eccentric_nz/TARDIS/autonomous/TARDISAutonomousInventory.java @@ -20,7 +20,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.custommodeldata.GUIAutonomous; import me.eccentric_nz.TARDIS.database.resultset.ResultSetPlayerPrefs; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; diff --git a/src/main/java/me/eccentric_nz/TARDIS/bStats/PlayerDifficulty.java b/src/main/java/me/eccentric_nz/TARDIS/bStats/PlayerDifficulty.java deleted file mode 100644 index d185586c71..0000000000 --- a/src/main/java/me/eccentric_nz/TARDIS/bStats/PlayerDifficulty.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2024 eccentric_nz - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package me.eccentric_nz.TARDIS.bStats; - -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.HashMap; -import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.database.TARDISDatabaseConnection; - -public class PlayerDifficulty { - - private final TARDISDatabaseConnection service = TARDISDatabaseConnection.getINSTANCE(); - private final Connection connection = service.getConnection(); - private final TARDIS plugin; - private final String prefix; - - /** - * Creates a class instance that can be used to retrieve an SQL ResultSet from the chameleon table. - * - * @param plugin an instance of the main class. - */ - PlayerDifficulty(TARDIS plugin) { - this.plugin = plugin; - prefix = this.plugin.getPrefix(); - } - - /** - * Retrieves an SQL ResultSet from the TARDIS table and maps a player's difficulty preference to the number of times they are used. - * - * @return a map of chameleon keys and count values - */ - public HashMap getModes() { - HashMap data = new HashMap<>(); - Statement statement = null; - ResultSet rs = null; - String query = "SELECT difficulty, count(difficulty) AS count_of FROM " + prefix + "player_prefs GROUP BY difficulty"; - try { - service.testConnection(connection); - statement = connection.createStatement(); - rs = statement.executeQuery(query); - if (rs.isBeforeFirst()) { - while (rs.next()) { - data.put(rs.getInt("difficulty") == 0 ? "hard" : "easy", rs.getInt("count_of")); - } - } - } catch (SQLException e) { - plugin.debug("ResultSet error for player_prefs table getting player difficulty! " + e.getMessage()); - } finally { - try { - if (rs != null) { - rs.close(); - } - if (statement != null) { - statement.close(); - } - } catch (SQLException e) { - plugin.debug("Error closing player_prefs table for player difficulty! " + e.getMessage()); - } - } - return data; - } -} diff --git a/src/main/java/me/eccentric_nz/TARDIS/bStats/TARDISStats.java b/src/main/java/me/eccentric_nz/TARDIS/bStats/TARDISStats.java index 51d31be801..da861600b1 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/bStats/TARDISStats.java +++ b/src/main/java/me/eccentric_nz/TARDIS/bStats/TARDISStats.java @@ -53,9 +53,9 @@ public void startMetrics() { ARSRoomCounts arsRoomCounts = new ARSRoomCounts(plugin); metrics.addCustomChart(new Metrics.AdvancedPie("rooms", arsRoomCounts::getRoomCounts)); metrics.addCustomChart(new Metrics.SimplePie("median_rooms_per_tardis", arsRoomCounts::getMedian)); - // how many servers/players use hard or easy mode - metrics.addCustomChart(new Metrics.SimplePie("server_difficulty", () -> plugin.getConfig().getString("preferences.difficulty", "easy"))); - metrics.addCustomChart(new Metrics.AdvancedPie("player_difficulty", () -> new PlayerDifficulty(plugin).getModes())); + // how many servers use circuits and disks + metrics.addCustomChart(new Metrics.SimplePie("difficulty_circuits", () -> plugin.getConfig().getString("difficulty.circuits", "false"))); + metrics.addCustomChart(new Metrics.SimplePie("difficulty_disks", () -> plugin.getConfig().getString("difficulty.disks", "false"))); // junk tardis enabled metrics.addCustomChart(new Metrics.SimplePie("junk_tardis", () -> plugin.getConfig().getString("junk.enabled", "true"))); } diff --git a/src/main/java/me/eccentric_nz/TARDIS/builders/MaterialisationData.java b/src/main/java/me/eccentric_nz/TARDIS/builders/MaterialisationData.java index 5daed62e85..997b19677e 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/builders/MaterialisationData.java +++ b/src/main/java/me/eccentric_nz/TARDIS/builders/MaterialisationData.java @@ -39,6 +39,7 @@ public class MaterialisationData { private int tardisID; private int exteriorLampLevel; private SpaceTimeThrottle throttle; + private boolean particles; public COMPASS getDirection() { return direction; @@ -114,4 +115,12 @@ public SpaceTimeThrottle getThrottle() { public void setThrottle(SpaceTimeThrottle throttle) { this.throttle = throttle; } + + public boolean hasParticles() { + return particles; + } + + public void setParticles(boolean particles) { + this.particles = particles; + } } diff --git a/src/main/java/me/eccentric_nz/TARDIS/builders/TARDISInteriorPostioning.java b/src/main/java/me/eccentric_nz/TARDIS/builders/TARDISInteriorPostioning.java index ca0628cb13..4e0a5eb39d 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/builders/TARDISInteriorPostioning.java +++ b/src/main/java/me/eccentric_nz/TARDIS/builders/TARDISInteriorPostioning.java @@ -72,7 +72,7 @@ public static int getTARDISIdFromLocation(Location location) { int tips = getTIPSSlot(location); ResultSetTardisID rs = new ResultSetTardisID(TARDIS.plugin); if (rs.fromTIPSSlot(tips)) { - return rs.getTardis_id(); + return rs.getTardisId(); } else { return -1; } diff --git a/src/main/java/me/eccentric_nz/TARDIS/builders/TARDISMaterialisePoliceBox.java b/src/main/java/me/eccentric_nz/TARDIS/builders/TARDISMaterialisePoliceBox.java index 2af8c6d46c..e5c2ad56f5 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/builders/TARDISMaterialisePoliceBox.java +++ b/src/main/java/me/eccentric_nz/TARDIS/builders/TARDISMaterialisePoliceBox.java @@ -19,9 +19,12 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.TARDISConstants; import me.eccentric_nz.TARDIS.customblocks.TARDISDisplayItemUtils; +import me.eccentric_nz.TARDIS.database.data.ParticleData; import me.eccentric_nz.TARDIS.database.resultset.ResultSetColour; +import me.eccentric_nz.TARDIS.database.resultset.ResultSetParticlePrefs; import me.eccentric_nz.TARDIS.enumeration.ChameleonPreset; import me.eccentric_nz.TARDIS.flight.FlightEnd; +import me.eccentric_nz.TARDIS.particles.Emitter; import me.eccentric_nz.TARDIS.utility.TARDISBlockSetters; import me.eccentric_nz.TARDIS.utility.TARDISSounds; import org.bukkit.Color; @@ -41,6 +44,7 @@ import org.bukkit.inventory.meta.LeatherArmorMeta; import java.util.Collections; +import java.util.UUID; public class TARDISMaterialisePoliceBox implements Runnable { @@ -161,6 +165,17 @@ public void run() { colour = Color.fromRGB(rsc.getRed(), rsc.getGreen(), rsc.getBlue()); } } + if (bd.hasParticles()) { + ResultSetParticlePrefs rspp = new ResultSetParticlePrefs(plugin); + UUID uuid = bd.getPlayer().getUniqueId(); + if (rspp.fromUUID(uuid.toString())) { + ParticleData data = rspp.getData(); + // display particles + Emitter emitter = new Emitter(plugin, uuid, bd.getLocation(), data, bd.getThrottle().getFlightTime()); + int task = plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, emitter, 0, data.getShape().getPeriod()); + emitter.setTaskID(task); + } + } } ItemMeta im = is.getItemMeta(); im.setCustomModelData(cmd); diff --git a/src/main/java/me/eccentric_nz/TARDIS/builders/TARDISMaterialisePreset.java b/src/main/java/me/eccentric_nz/TARDIS/builders/TARDISMaterialisePreset.java index b68c94939c..7a1c9ec34f 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/builders/TARDISMaterialisePreset.java +++ b/src/main/java/me/eccentric_nz/TARDIS/builders/TARDISMaterialisePreset.java @@ -23,6 +23,7 @@ import me.eccentric_nz.TARDIS.chameleon.utils.TARDISStainedGlassLookup; import me.eccentric_nz.TARDIS.customblocks.TARDISDisplayItem; import me.eccentric_nz.TARDIS.customblocks.TARDISDisplayItemUtils; +import me.eccentric_nz.TARDIS.database.data.ParticleData; import me.eccentric_nz.TARDIS.database.data.ReplacedBlock; import me.eccentric_nz.TARDIS.database.data.Tardis; import me.eccentric_nz.TARDIS.database.resultset.*; @@ -30,8 +31,13 @@ import me.eccentric_nz.TARDIS.enumeration.ChameleonPreset; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.move.TARDISDoorListener; +import me.eccentric_nz.TARDIS.particles.Emitter; +import me.eccentric_nz.TARDIS.particles.TARDISParticles; import me.eccentric_nz.TARDIS.travel.TARDISDoorLocation; -import me.eccentric_nz.TARDIS.utility.*; +import me.eccentric_nz.TARDIS.utility.TARDISBlockSetters; +import me.eccentric_nz.TARDIS.utility.TARDISSounds; +import me.eccentric_nz.TARDIS.utility.TARDISSponge; +import me.eccentric_nz.TARDIS.utility.TARDISStaticUtils; import me.eccentric_nz.tardischunkgenerator.worldgen.TARDISChunkGenerator; import org.bukkit.*; import org.bukkit.block.Block; @@ -197,6 +203,17 @@ public void run() { world.playSound(bd.getLocation(), Sound.ENTITY_MINECART_INSIDE, 1.0F, 0.0F); } } + if (bd.hasParticles()) { + ResultSetParticlePrefs rspp = new ResultSetParticlePrefs(plugin); + UUID uuid = bd.getPlayer().getUniqueId(); + if (rspp.fromUUID(uuid.toString())) { + ParticleData data = rspp.getData(); + // display particles + Emitter emitter = new Emitter(plugin, uuid, bd.getLocation(), data, bd.getThrottle().getFlightTime()); + int task = plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, emitter, 0, data.getShape().getPeriod()); + emitter.setTaskID(task); + } + } // get direction player is facing from yaw place block under door if block is in list of blocks an iron door cannot go on switch (bd.getDirection().forPreset()) { case SOUTH -> { @@ -321,7 +338,12 @@ public void run() { } TARDISBlockSetters.setBlockAndRemember(world, xx, (y + yy), zz, light, bd.getTardisID()); } - case IRON_DOOR, RAIL, ACACIA_DOOR, ACACIA_TRAPDOOR, BAMBOO_DOOR, BAMBOO_TRAPDOOR, BIRCH_DOOR, BIRCH_TRAPDOOR, CHERRY_DOOR, CHERRY_TRAPDOOR, CRIMSON_DOOR, CRIMSON_TRAPDOOR, DARK_OAK_DOOR, DARK_OAK_TRAPDOOR, JUNGLE_DOOR, JUNGLE_TRAPDOOR, MANGROVE_DOOR, MANGROVE_TRAPDOOR, OAK_DOOR, OAK_TRAPDOOR, SPRUCE_DOOR, SPRUCE_TRAPDOOR, WARPED_DOOR, WARPED_TRAPDOOR -> { // wood, iron & trap doors, rails + case IRON_DOOR, RAIL, ACACIA_DOOR, ACACIA_TRAPDOOR, BAMBOO_DOOR, BAMBOO_TRAPDOOR, + BIRCH_DOOR, BIRCH_TRAPDOOR, CHERRY_DOOR, CHERRY_TRAPDOOR, CRIMSON_DOOR, + CRIMSON_TRAPDOOR, DARK_OAK_DOOR, DARK_OAK_TRAPDOOR, JUNGLE_DOOR, JUNGLE_TRAPDOOR, + MANGROVE_DOOR, MANGROVE_TRAPDOOR, OAK_DOOR, OAK_TRAPDOOR, SPRUCE_DOOR, + SPRUCE_TRAPDOOR, WARPED_DOOR, + WARPED_TRAPDOOR -> { // wood, iron & trap doors, rails boolean door = false; if (Tag.DOORS.isTagged(mat)) { Bisected bisected = (Bisected) colData[yy]; @@ -365,12 +387,15 @@ public void run() { TARDISBlockSetters.setBlockAndRemember(world, xx, (y + yy), zz, colData[yy], bd.getTardisID()); } } - case ACACIA_SIGN, BIRCH_SIGN, CRIMSON_SIGN, DARK_OAK_SIGN, JUNGLE_SIGN, MANGROVE_SIGN, OAK_SIGN, SPRUCE_SIGN, WARPED_SIGN -> { + case ACACIA_SIGN, BIRCH_SIGN, CRIMSON_SIGN, DARK_OAK_SIGN, JUNGLE_SIGN, MANGROVE_SIGN, + OAK_SIGN, SPRUCE_SIGN, WARPED_SIGN -> { if (preset.equals(ChameleonPreset.APPERTURE)) { TARDISBlockSetters.setUnderDoorBlock(world, xx, (y - 1), zz, bd.getTardisID(), false); } } - case ACACIA_WALL_SIGN, BIRCH_WALL_SIGN, CRIMSON_WALL_SIGN, DARK_OAK_WALL_SIGN, JUNGLE_WALL_SIGN, MANGROVE_WALL_SIGN, OAK_WALL_SIGN, SPRUCE_WALL_SIGN, WARPED_WALL_SIGN -> { + case ACACIA_WALL_SIGN, BIRCH_WALL_SIGN, CRIMSON_WALL_SIGN, DARK_OAK_WALL_SIGN, + JUNGLE_WALL_SIGN, MANGROVE_WALL_SIGN, OAK_WALL_SIGN, SPRUCE_WALL_SIGN, + WARPED_WALL_SIGN -> { // sign - if there is one if (preset.equals(ChameleonPreset.JUNK_MODE)) { // add a sign @@ -582,7 +607,13 @@ public void run() { TARDISBlockSetters.setBlock(world, xx, (y + yy), zz, coldatas[yy]); } } - case ACACIA_SAPLING, ALLIUM, AZURE_BLUET, BAMBOO_SAPLING, BEETROOTS, BIRCH_SAPLING, BLUE_ORCHID, CARROTS, CORNFLOWER, CRIMSON_FUNGUS, CRIMSON_ROOTS, DANDELION, DARK_OAK_SAPLING, DEAD_BUSH, FERN, SHORT_GRASS, JUNGLE_SAPLING, LARGE_FERN, LILAC, LILY_OF_THE_VALLEY, OAK_SAPLING, ORANGE_TULIP, OXEYE_DAISY, PEONY, PINK_TULIP, POPPY, POTATOES, RED_TULIP, ROSE_BUSH, SPRUCE_SAPLING, SUGAR_CANE, SUNFLOWER, SWEET_BERRY_BUSH, TALL_GRASS, WARPED_FUNGUS, WARPED_ROOTS, WHEAT, WHITE_TULIP, WITHER_ROSE -> { + case ACACIA_SAPLING, ALLIUM, AZURE_BLUET, BAMBOO_SAPLING, BEETROOTS, BIRCH_SAPLING, + BLUE_ORCHID, CARROTS, CORNFLOWER, CRIMSON_FUNGUS, CRIMSON_ROOTS, DANDELION, + DARK_OAK_SAPLING, DEAD_BUSH, FERN, SHORT_GRASS, JUNGLE_SAPLING, LARGE_FERN, LILAC, + LILY_OF_THE_VALLEY, OAK_SAPLING, ORANGE_TULIP, OXEYE_DAISY, PEONY, PINK_TULIP, POPPY, + POTATOES, RED_TULIP, ROSE_BUSH, SPRUCE_SAPLING, SUGAR_CANE, SUNFLOWER, + SWEET_BERRY_BUSH, TALL_GRASS, WARPED_FUNGUS, WARPED_ROOTS, WHEAT, WHITE_TULIP, + WITHER_ROSE -> { if (i == loops && (preset.equals(ChameleonPreset.GRAVESTONE) || preset.equals(ChameleonPreset.MESA) || preset.equals(ChameleonPreset.PLAINS) || preset.equals(ChameleonPreset.TAIGA) || preset.equals(ChameleonPreset.CONSTRUCT) || preset.equals(ChameleonPreset.CUSTOM))) { TARDISBlockSetters.setBlock(world, xx, (y + yy), zz, coldatas[yy]); } else { @@ -619,7 +650,11 @@ public void run() { TARDISBlockSetters.setBlock(world, xx, (y + yy), zz, lamp); } } - case IRON_DOOR, ACACIA_DOOR, ACACIA_TRAPDOOR, BAMBOO_DOOR, BAMBOO_TRAPDOOR, BIRCH_DOOR, BIRCH_TRAPDOOR, CHERRY_DOOR, CHERRY_TRAPDOOR, CRIMSON_DOOR, CRIMSON_TRAPDOOR, DARK_OAK_DOOR, DARK_OAK_TRAPDOOR, JUNGLE_DOOR, JUNGLE_TRAPDOOR, MANGROVE_DOOR, MANGROVE_TRAPDOOR, OAK_DOOR, OAK_TRAPDOOR, SPRUCE_DOOR, SPRUCE_TRAPDOOR, WARPED_DOOR, WARPED_TRAPDOOR -> { + case IRON_DOOR, ACACIA_DOOR, ACACIA_TRAPDOOR, BAMBOO_DOOR, BAMBOO_TRAPDOOR, BIRCH_DOOR, + BIRCH_TRAPDOOR, CHERRY_DOOR, CHERRY_TRAPDOOR, CRIMSON_DOOR, CRIMSON_TRAPDOOR, + DARK_OAK_DOOR, DARK_OAK_TRAPDOOR, JUNGLE_DOOR, JUNGLE_TRAPDOOR, MANGROVE_DOOR, + MANGROVE_TRAPDOOR, OAK_DOOR, OAK_TRAPDOOR, SPRUCE_DOOR, SPRUCE_TRAPDOOR, WARPED_DOOR, + WARPED_TRAPDOOR -> { // don't change the door } case LEVER -> { diff --git a/src/main/java/me/eccentric_nz/TARDIS/builders/TARDISSeedBlockProcessor.java b/src/main/java/me/eccentric_nz/TARDIS/builders/TARDISSeedBlockProcessor.java index 1d3c5b11fd..f82966a170 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/builders/TARDISSeedBlockProcessor.java +++ b/src/main/java/me/eccentric_nz/TARDIS/builders/TARDISSeedBlockProcessor.java @@ -16,9 +16,6 @@ */ package me.eccentric_nz.TARDIS.builders; -import java.util.HashMap; -import java.util.Locale; -import java.util.UUID; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.TARDISBuilderInstanceKeeper; import me.eccentric_nz.TARDIS.TARDISConstants; @@ -27,11 +24,7 @@ import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; import me.eccentric_nz.TARDIS.customblocks.TARDISDisplayItemUtils; import me.eccentric_nz.TARDIS.database.resultset.*; -import me.eccentric_nz.TARDIS.enumeration.Advancement; -import me.eccentric_nz.TARDIS.enumeration.COMPASS; -import me.eccentric_nz.TARDIS.enumeration.Schematic; -import me.eccentric_nz.TARDIS.enumeration.SpaceTimeThrottle; -import me.eccentric_nz.TARDIS.enumeration.TardisModule; +import me.eccentric_nz.TARDIS.enumeration.*; import me.eccentric_nz.TARDIS.floodgate.TARDISFloodgate; import me.eccentric_nz.TARDIS.planets.TARDISAliasResolver; import me.eccentric_nz.TARDIS.planets.TARDISSpace; @@ -44,6 +37,10 @@ import org.bukkit.block.BlockFace; import org.bukkit.entity.Player; +import java.util.HashMap; +import java.util.Locale; +import java.util.UUID; + /** * TARDISes are bioships that are grown from a species of coral presumably indigenous to Gallifrey. *

@@ -279,7 +276,7 @@ public boolean processBlock(TARDISBuildData seed, Location location, Player play } } else { HashMap wherecl = new HashMap<>(); - wherecl.put("tardis_id", rs.getTardis_id()); + wherecl.put("tardis_id", rs.getTardisId()); ResultSetCurrentLocation rscl = new ResultSetCurrentLocation(plugin, wherecl); if (rscl.resultSet()) { plugin.getMessenger().send(player, TardisModule.TARDIS, "TARDIS_HAVE", rscl.getWorld().getName() + " at x:" + rscl.getX() + " y:" + rscl.getY() + " z:" + rscl.getZ()); diff --git a/src/main/java/me/eccentric_nz/TARDIS/chameleon/construct/ConstructBuilder.java b/src/main/java/me/eccentric_nz/TARDIS/chameleon/construct/ConstructBuilder.java index d586d47f6a..577b5c7c64 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/chameleon/construct/ConstructBuilder.java +++ b/src/main/java/me/eccentric_nz/TARDIS/chameleon/construct/ConstructBuilder.java @@ -7,7 +7,6 @@ import me.eccentric_nz.TARDIS.database.resultset.ResultSetControls; import me.eccentric_nz.TARDIS.enumeration.ChameleonPreset; import me.eccentric_nz.TARDIS.enumeration.Control; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; import me.eccentric_nz.TARDIS.enumeration.DiskCircuit; import me.eccentric_nz.TARDIS.utility.TARDISStaticUtils; import org.bukkit.entity.Player; @@ -54,7 +53,7 @@ public void build(String preset, int id, Player player) { plugin.getTrackerKeeper().getConstructors().remove(player.getUniqueId()); plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> close(player), 2L); // damage the circuit if configured - if (plugin.getConfig().getBoolean("circuits.damage") && !plugin.getDifficulty().equals(Difficulty.EASY) && plugin.getConfig().getInt("circuits.uses.chameleon") > 0) { + if (plugin.getConfig().getBoolean("circuits.damage") && plugin.getConfig().getInt("circuits.uses.chameleon") > 0) { TARDISCircuitChecker tcc = new TARDISCircuitChecker(plugin, id); tcc.getCircuits(); // decrement uses diff --git a/src/main/java/me/eccentric_nz/TARDIS/chameleon/construct/TARDISChameleonConstructorListener.java b/src/main/java/me/eccentric_nz/TARDIS/chameleon/construct/TARDISChameleonConstructorListener.java index 5fcdf2b9fd..ae52c0cdc8 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/chameleon/construct/TARDISChameleonConstructorListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/chameleon/construct/TARDISChameleonConstructorListener.java @@ -32,7 +32,7 @@ import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; import me.eccentric_nz.TARDIS.utility.TARDISMaterials; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.Tag; import org.bukkit.block.BlockFace; diff --git a/src/main/java/me/eccentric_nz/TARDIS/chameleon/construct/TARDISChameleonConstructorOpenCloseListener.java b/src/main/java/me/eccentric_nz/TARDIS/chameleon/construct/TARDISChameleonConstructorOpenCloseListener.java index 838aecf924..3dc15b3d0e 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/chameleon/construct/TARDISChameleonConstructorOpenCloseListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/chameleon/construct/TARDISChameleonConstructorOpenCloseListener.java @@ -17,7 +17,7 @@ package me.eccentric_nz.TARDIS.chameleon.construct; import me.eccentric_nz.TARDIS.TARDIS; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; diff --git a/src/main/java/me/eccentric_nz/TARDIS/chameleon/gui/TARDISChameleonHelpListener.java b/src/main/java/me/eccentric_nz/TARDIS/chameleon/gui/TARDISChameleonHelpListener.java index 0adbd02129..8b7fd3b3fe 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/chameleon/gui/TARDISChameleonHelpListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/chameleon/gui/TARDISChameleonHelpListener.java @@ -21,7 +21,7 @@ import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardis; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTravellers; import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.inventory.InventoryClickEvent; @@ -100,4 +100,4 @@ public void onChameleonConstructorClick(InventoryClickEvent event) { } } } -} \ No newline at end of file +} diff --git a/src/main/java/me/eccentric_nz/TARDIS/chameleon/gui/TARDISChameleonInventory.java b/src/main/java/me/eccentric_nz/TARDIS/chameleon/gui/TARDISChameleonInventory.java index 1d2562a999..2f8e0574de 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/chameleon/gui/TARDISChameleonInventory.java +++ b/src/main/java/me/eccentric_nz/TARDIS/chameleon/gui/TARDISChameleonInventory.java @@ -21,7 +21,7 @@ import me.eccentric_nz.TARDIS.custommodeldata.GUIChameleon; import me.eccentric_nz.TARDIS.enumeration.Adaption; import me.eccentric_nz.TARDIS.enumeration.ChameleonPreset; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; diff --git a/src/main/java/me/eccentric_nz/TARDIS/chameleon/gui/TARDISChameleonListener.java b/src/main/java/me/eccentric_nz/TARDIS/chameleon/gui/TARDISChameleonListener.java index 32724f14ec..75b7e5028c 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/chameleon/gui/TARDISChameleonListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/chameleon/gui/TARDISChameleonListener.java @@ -29,7 +29,7 @@ import me.eccentric_nz.TARDIS.enumeration.*; import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; import me.eccentric_nz.TARDIS.utility.TARDISStaticUtils; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Biome; @@ -122,7 +122,7 @@ public void onChameleonMenuClick(InventoryClickEvent event) { player.performCommand("tardis rebuild"); close(player); // damage the circuit if configured - if (plugin.getConfig().getBoolean("circuits.damage") && !plugin.getDifficulty().equals(Difficulty.EASY) && plugin.getConfig().getInt("circuits.uses.chameleon") > 0) { + if (plugin.getConfig().getBoolean("circuits.damage") && plugin.getConfig().getInt("circuits.uses.chameleon") > 0) { TARDISCircuitChecker tcc = new TARDISCircuitChecker(plugin, id); tcc.getCircuits(); // decrement uses @@ -194,14 +194,12 @@ public void onChameleonMenuClick(InventoryClickEvent event) { // check they have an Invisibility Circuit TARDISCircuitChecker tcc = new TARDISCircuitChecker(plugin, id); tcc.getCircuits(); - if (!plugin.getDifficulty().equals(Difficulty.EASY)) { - if (!plugin.getUtils().inGracePeriod(player, false) && !tcc.hasInvisibility()) { - close(player); - plugin.getMessenger().send(player, TardisModule.TARDIS, "INVISIBILITY_MISSING"); - break; - } + if (plugin.getConfig().getBoolean("difficulty.circuits") && !plugin.getUtils().inGracePeriod(player, false) && !tcc.hasInvisibility()) { + close(player); + plugin.getMessenger().send(player, TardisModule.TARDIS, "INVISIBILITY_MISSING"); + break; } - if (plugin.getConfig().getBoolean("circuits.damage") && !plugin.getDifficulty().equals(Difficulty.EASY) && plugin.getConfig().getInt("circuits.uses.invisibility") > 0) { + if (plugin.getConfig().getBoolean("circuits.damage") && plugin.getConfig().getInt("circuits.uses.invisibility") > 0) { // decrement uses int uses_left = tcc.getInvisibilityUses(); new TARDISCircuitDamager(plugin, DiskCircuit.INVISIBILITY, uses_left, id, player).damage(); diff --git a/src/main/java/me/eccentric_nz/TARDIS/chameleon/gui/TARDISChameleonTemplateListener.java b/src/main/java/me/eccentric_nz/TARDIS/chameleon/gui/TARDISChameleonTemplateListener.java index 716a55a5d9..da47856cf4 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/chameleon/gui/TARDISChameleonTemplateListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/chameleon/gui/TARDISChameleonTemplateListener.java @@ -21,7 +21,7 @@ import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardis; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTravellers; import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.inventory.InventoryClickEvent; diff --git a/src/main/java/me/eccentric_nz/TARDIS/chameleon/gui/TARDISColourPickerListener.java b/src/main/java/me/eccentric_nz/TARDIS/chameleon/gui/TARDISColourPickerListener.java index b8a340ba8c..7b3d1571ae 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/chameleon/gui/TARDISColourPickerListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/chameleon/gui/TARDISColourPickerListener.java @@ -1,11 +1,14 @@ package me.eccentric_nz.TARDIS.chameleon.gui; import me.eccentric_nz.TARDIS.TARDIS; +import me.eccentric_nz.TARDIS.advanced.TARDISCircuitChecker; +import me.eccentric_nz.TARDIS.advanced.TARDISCircuitDamager; import me.eccentric_nz.TARDIS.database.resultset.ResultSetColour; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardisID; +import me.eccentric_nz.TARDIS.enumeration.DiskCircuit; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Color; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -74,7 +77,7 @@ public void onInteract(InventoryClickEvent event) { // get the player's tardis_id ResultSetTardisID rst = new ResultSetTardisID(plugin); if (rst.fromUUID(player.getUniqueId().toString())) { - int id = rst.getTardis_id(); + int id = rst.getTardisId(); // save the colour Color color = getColour(view); HashMap set = new HashMap<>(); @@ -92,6 +95,14 @@ public void onInteract(InventoryClickEvent event) { plugin.getQueryFactory().doInsert("colour", set); } plugin.getMessenger().send(player, TardisModule.TARDIS, "COLOUR_SET"); + // damage the circuit if configured + if (plugin.getConfig().getBoolean("circuits.damage") && plugin.getConfig().getInt("circuits.uses.chameleon") > 0) { + TARDISCircuitChecker tcc = new TARDISCircuitChecker(plugin, id); + tcc.getCircuits(); + // decrement uses + int uses_left = tcc.getChameleonUses(); + new TARDISCircuitDamager(plugin, DiskCircuit.CHAMELEON, uses_left, id, player).damage(); + } } close(player); } diff --git a/src/main/java/me/eccentric_nz/TARDIS/chameleon/gui/TARDISPoliceBoxListener.java b/src/main/java/me/eccentric_nz/TARDIS/chameleon/gui/TARDISPoliceBoxListener.java index bdce444b34..51d07cd1cc 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/chameleon/gui/TARDISPoliceBoxListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/chameleon/gui/TARDISPoliceBoxListener.java @@ -17,6 +17,8 @@ package me.eccentric_nz.TARDIS.chameleon.gui; import me.eccentric_nz.TARDIS.TARDIS; +import me.eccentric_nz.TARDIS.advanced.TARDISCircuitChecker; +import me.eccentric_nz.TARDIS.advanced.TARDISCircuitDamager; import me.eccentric_nz.TARDIS.chameleon.utils.TARDISChameleonFrame; import me.eccentric_nz.TARDIS.database.data.Tardis; import me.eccentric_nz.TARDIS.database.resultset.ResultSetControls; @@ -24,9 +26,10 @@ import me.eccentric_nz.TARDIS.database.resultset.ResultSetTravellers; import me.eccentric_nz.TARDIS.enumeration.ChameleonPreset; import me.eccentric_nz.TARDIS.enumeration.Control; +import me.eccentric_nz.TARDIS.enumeration.DiskCircuit; import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; import me.eccentric_nz.TARDIS.utility.TARDISStaticUtils; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.inventory.InventoryClickEvent; @@ -158,6 +161,14 @@ public void onChameleonPoliceBoxClick(InventoryClickEvent event) { HashMap wheret = new HashMap<>(); wheret.put("tardis_id", id); plugin.getQueryFactory().doUpdate("tardis", set, wheret); + // damage the circuit if configured + if (plugin.getConfig().getBoolean("circuits.damage") && plugin.getConfig().getInt("circuits.uses.chameleon") > 0) { + TARDISCircuitChecker tcc = new TARDISCircuitChecker(plugin, id); + tcc.getCircuits(); + // decrement uses + int uses_left = tcc.getChameleonUses(); + new TARDISCircuitDamager(plugin, DiskCircuit.CHAMELEON, uses_left, id, player).damage(); + } } } diff --git a/src/main/java/me/eccentric_nz/TARDIS/chameleon/gui/TARDISPresetListener.java b/src/main/java/me/eccentric_nz/TARDIS/chameleon/gui/TARDISPresetListener.java index d1a9779716..d4e6fef69e 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/chameleon/gui/TARDISPresetListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/chameleon/gui/TARDISPresetListener.java @@ -17,6 +17,8 @@ package me.eccentric_nz.TARDIS.chameleon.gui; import me.eccentric_nz.TARDIS.TARDIS; +import me.eccentric_nz.TARDIS.advanced.TARDISCircuitChecker; +import me.eccentric_nz.TARDIS.advanced.TARDISCircuitDamager; import me.eccentric_nz.TARDIS.chameleon.utils.TARDISChameleonFrame; import me.eccentric_nz.TARDIS.database.data.Tardis; import me.eccentric_nz.TARDIS.database.resultset.ResultSetControls; @@ -24,9 +26,10 @@ import me.eccentric_nz.TARDIS.database.resultset.ResultSetTravellers; import me.eccentric_nz.TARDIS.enumeration.ChameleonPreset; import me.eccentric_nz.TARDIS.enumeration.Control; +import me.eccentric_nz.TARDIS.enumeration.DiskCircuit; import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; import me.eccentric_nz.TARDIS.utility.TARDISStaticUtils; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.inventory.InventoryClickEvent; @@ -153,6 +156,14 @@ public void onChameleonPresetClick(InventoryClickEvent event) { HashMap wheret = new HashMap<>(); wheret.put("tardis_id", id); plugin.getQueryFactory().doUpdate("tardis", set, wheret); + // damage the circuit if configured + if (plugin.getConfig().getBoolean("circuits.damage") && plugin.getConfig().getInt("circuits.uses.chameleon") > 0) { + TARDISCircuitChecker tcc = new TARDISCircuitChecker(plugin, id); + tcc.getCircuits(); + // decrement uses + int uses_left = tcc.getChameleonUses(); + new TARDISCircuitDamager(plugin, DiskCircuit.CHAMELEON, uses_left, id, player).damage(); + } } } diff --git a/src/main/java/me/eccentric_nz/TARDIS/chameleon/shell/TARDISPlayerShellListener.java b/src/main/java/me/eccentric_nz/TARDIS/chameleon/shell/TARDISPlayerShellListener.java index 8dd5374857..b2b305cc51 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/chameleon/shell/TARDISPlayerShellListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/chameleon/shell/TARDISPlayerShellListener.java @@ -31,7 +31,7 @@ import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; import me.eccentric_nz.TARDIS.utility.TARDISStaticLocationGetters; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.World; diff --git a/src/main/java/me/eccentric_nz/TARDIS/chameleon/shell/TARDISShellInventory.java b/src/main/java/me/eccentric_nz/TARDIS/chameleon/shell/TARDISShellInventory.java index 004412c019..d434e44ed7 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/chameleon/shell/TARDISShellInventory.java +++ b/src/main/java/me/eccentric_nz/TARDIS/chameleon/shell/TARDISShellInventory.java @@ -22,7 +22,7 @@ import me.eccentric_nz.TARDIS.custommodeldata.GUIChameleonPresets; import me.eccentric_nz.TARDIS.database.resultset.ResultSetShells; import me.eccentric_nz.TARDIS.utility.TARDISNumberParsers; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.block.data.BlockData; import org.bukkit.inventory.ItemStack; diff --git a/src/main/java/me/eccentric_nz/TARDIS/chameleon/shell/TARDISShellLoaderListener.java b/src/main/java/me/eccentric_nz/TARDIS/chameleon/shell/TARDISShellLoaderListener.java index 5f53864729..80855d3e05 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/chameleon/shell/TARDISShellLoaderListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/chameleon/shell/TARDISShellLoaderListener.java @@ -33,7 +33,7 @@ import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; import me.eccentric_nz.TARDIS.utility.TARDISNumberParsers; import me.eccentric_nz.TARDIS.utility.TARDISStaticLocationGetters; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.block.Block; diff --git a/src/main/java/me/eccentric_nz/TARDIS/chameleon/shell/TARDISShellRoomConstructor.java b/src/main/java/me/eccentric_nz/TARDIS/chameleon/shell/TARDISShellRoomConstructor.java index 7014283ffd..96c6de838f 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/chameleon/shell/TARDISShellRoomConstructor.java +++ b/src/main/java/me/eccentric_nz/TARDIS/chameleon/shell/TARDISShellRoomConstructor.java @@ -25,7 +25,10 @@ import me.eccentric_nz.TARDIS.database.data.Tardis; import me.eccentric_nz.TARDIS.database.resultset.ResultSetControls; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardis; -import me.eccentric_nz.TARDIS.enumeration.*; +import me.eccentric_nz.TARDIS.enumeration.ChameleonPreset; +import me.eccentric_nz.TARDIS.enumeration.Control; +import me.eccentric_nz.TARDIS.enumeration.DiskCircuit; +import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.utility.TARDISMaterials; import me.eccentric_nz.TARDIS.utility.TARDISStaticUtils; import org.bukkit.Location; @@ -220,7 +223,7 @@ private void buildConstruct(String preset, int id, Player player) { // rebuild player.performCommand("tardis rebuild"); // damage the circuit if configured - if (plugin.getConfig().getBoolean("circuits.damage") && !plugin.getDifficulty().equals(Difficulty.EASY) && plugin.getConfig().getInt("circuits.uses.chameleon") > 0) { + if (plugin.getConfig().getBoolean("circuits.damage") && plugin.getConfig().getInt("circuits.uses.chameleon") > 0) { TARDISCircuitChecker tcc = new TARDISCircuitChecker(plugin, id); tcc.getCircuits(); // decrement uses diff --git a/src/main/java/me/eccentric_nz/TARDIS/chameleon/utils/TARDISStainedGlassLookup.java b/src/main/java/me/eccentric_nz/TARDIS/chameleon/utils/TARDISStainedGlassLookup.java index a39f54539b..27c5638e2c 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/chameleon/utils/TARDISStainedGlassLookup.java +++ b/src/main/java/me/eccentric_nz/TARDIS/chameleon/utils/TARDISStainedGlassLookup.java @@ -21,8 +21,8 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.material.MapColor; import org.bukkit.*; -import org.bukkit.craftbukkit.v1_20_R4.CraftWorld; -import org.bukkit.craftbukkit.v1_20_R4.util.CraftMagicNumbers; +import org.bukkit.craftbukkit.v1_21_R1.CraftWorld; +import org.bukkit.craftbukkit.v1_21_R1.util.CraftMagicNumbers; /** * Lookup for Chameleon preset block materialisation. diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/TARDISRecipeCommands.java b/src/main/java/me/eccentric_nz/TARDIS/commands/TARDISRecipeCommands.java index 4345a58f97..7329ff8694 100755 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/TARDISRecipeCommands.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/TARDISRecipeCommands.java @@ -23,7 +23,7 @@ import me.eccentric_nz.TARDIS.messaging.TARDISRecipeLister; import me.eccentric_nz.TARDIS.recipes.TARDISRecipeCategoryInventory; import me.eccentric_nz.TARDIS.utility.TARDISStringUtils; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/admin/TARDISPurgeCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/admin/TARDISPurgeCommand.java index 6b9edf2342..ef24121801 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/admin/TARDISPurgeCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/admin/TARDISPurgeCommand.java @@ -56,7 +56,7 @@ boolean clearAll(CommandSender sender, String[] args) { plugin.getMessenger().send(sender, TardisModule.TARDIS, "PLAYER_NOT_FOUND_DB", args[1]); return true; } - int id = rs.getTardis_id(); + int id = rs.getTardisId(); TARDISExterminator purger = new TARDISExterminator(plugin); purger.cleanHashMaps(id); purger.cleanDatabase(id); diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/areas/TARDISAreaCommands.java b/src/main/java/me/eccentric_nz/TARDIS/commands/areas/TARDISAreaCommands.java index 16ee910b45..757cb35f62 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/areas/TARDISAreaCommands.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/areas/TARDISAreaCommands.java @@ -25,7 +25,7 @@ import me.eccentric_nz.TARDIS.enumeration.ChameleonPreset; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.planets.TARDISAliasResolver; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.World; diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/areas/TARDISEditAreasGUIListener.java b/src/main/java/me/eccentric_nz/TARDIS/commands/areas/TARDISEditAreasGUIListener.java index d24ec3e955..707391530f 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/areas/TARDISEditAreasGUIListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/areas/TARDISEditAreasGUIListener.java @@ -19,7 +19,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; import me.eccentric_nz.TARDIS.utility.TARDISNumberParsers; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/bind/TARDISBindCommands.java b/src/main/java/me/eccentric_nz/TARDIS/commands/bind/TARDISBindCommands.java index 2b34a0b437..54e00e6c2b 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/bind/TARDISBindCommands.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/bind/TARDISBindCommands.java @@ -77,7 +77,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String plugin.getMessenger().send(player, TardisModule.TARDIS, "NOT_A_TIMELORD"); return false; } - int id = rs.getTardis_id(); + int id = rs.getTardisId(); HashMap wheret = new HashMap<>(); wheret.put("uuid", player.getUniqueId().toString()); ResultSetTravellers rst = new ResultSetTravellers(plugin, wheret, false); diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/config/TARDISConfigCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/config/TARDISConfigCommand.java index 91ea60db5f..e23a26f933 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/config/TARDISConfigCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/config/TARDISConfigCommand.java @@ -19,7 +19,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.commands.TARDISCommandHelper; import me.eccentric_nz.TARDIS.enumeration.ChameleonPreset; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.enumeration.UseClay; import org.bukkit.command.Command; @@ -55,12 +55,12 @@ public TARDISConfigCommand(TARDIS plugin) { // add first arguments firstsStr.put("area", "creation"); firstsStr.put("autonomous_area", ""); + firstsStr.put("crafting", "difficulty"); firstsStr.put("database", "storage"); firstsStr.put("default_key", "preferences"); firstsStr.put("default_model", "sonic"); firstsStr.put("default_preset", "police_box"); firstsStr.put("default_world_name", "creation"); - firstsStr.put("difficulty", "preferences"); firstsStr.put("exclude", ""); firstsStr.put("include", ""); firstsStr.put("inventory_group", "creation"); @@ -94,17 +94,21 @@ public TARDISConfigCommand(TARDIS plugin) { firstsBool.put("any_key", "preferences"); firstsBool.put("archive", ""); firstsBool.put("autonomous", "allow"); + firstsBool.put("biome_reader", "difficulty"); firstsBool.put("blueprints", "modules"); firstsBool.put("chameleon", "travel"); firstsBool.put("charge", "sonic"); firstsBool.put("check_blocks_before_upgrade", "desktop"); firstsBool.put("check_for_home", "creation"); firstsBool.put("chemistry", "modules"); + firstsBool.put("circuits", "difficulty"); firstsBool.put("create_worlds", "creation"); firstsBool.put("create_worlds_with_perms", "creation"); firstsBool.put("damage", "circuits"); firstsBool.put("debug", ""); firstsBool.put("default_world", "creation"); + firstsBool.put("disk_in_hand_for_write", "difficulty"); + firstsBool.put("disks", "difficulty"); firstsBool.put("dynamic_lamps", "allow"); firstsBool.put("emergency_npc", "allow"); firstsBool.put("exile", "travel"); @@ -148,8 +152,11 @@ public TARDISConfigCommand(TARDIS plugin) { firstsBool.put("sonic_blaster", "modules"); firstsBool.put("spawn_eggs", "allow"); firstsBool.put("spawn_random_monsters", "preferences"); + firstsBool.put("stattenheim_remote", "difficulty"); firstsBool.put("strike_lightning", "preferences"); firstsBool.put("switch_resource_packs", ""); + firstsBool.put("system_upgrades", "difficulty"); + firstsBool.put("tardis_locator", "difficulty"); firstsBool.put("terminal.redefine", "travel"); firstsBool.put("the_end", "travel"); firstsBool.put("update.auto_update", "preferences"); @@ -271,7 +278,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String } if (first.equals("provider")) { String provider = args[1]; - if (!provider.equals("dynmap") && !provider.equals("BlueMap")) { + if (!provider.equals("dynmap") && !provider.equals("BlueMap") && !provider.equals("squaremap")) { plugin.getMessenger().send(sender, TardisModule.TARDIS, "ARG_PROVIDER"); return true; } @@ -330,13 +337,13 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String if (first.equals("respect_worldguard")) { return new TARDISSetRespectCommand(plugin).setFlag(sender, args); } - if (first.equals("difficulty")) { - if (!args[1].equalsIgnoreCase("easy") && !args[1].equalsIgnoreCase("medium") && !args[1].equalsIgnoreCase("hard")) { + if (first.equals("crafting")) { + if (!args[1].equalsIgnoreCase("easy") && !args[1].equalsIgnoreCase("hard")) { plugin.getMessenger().send(sender, TardisModule.TARDIS, "ARG_DIFF"); return true; } - plugin.getConfig().set("preferences.difficulty", args[1].toLowerCase(Locale.ENGLISH)); - plugin.setDifficulty(Difficulty.valueOf(args[1].toUpperCase(Locale.ENGLISH))); + plugin.getConfig().set("difficulty.crafting", args[1].toLowerCase(Locale.ENGLISH)); + plugin.setDifficulty(CraftingDifficulty.valueOf(args[1].toUpperCase(Locale.ENGLISH))); } if (first.equals("default_preset")) { if (plugin.getCustomModelConfig().getConfigurationSection("models").getKeys(false).contains(args[1])) { diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/config/TARDISConfigMenuListener.java b/src/main/java/me/eccentric_nz/TARDIS/commands/config/TARDISConfigMenuListener.java index fdcf81265f..e7f1ad3248 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/config/TARDISConfigMenuListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/config/TARDISConfigMenuListener.java @@ -18,7 +18,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.commands.preferences.TARDISPrefsMenuInventory; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/config/TARDISConfigTabComplete.java b/src/main/java/me/eccentric_nz/TARDIS/commands/config/TARDISConfigTabComplete.java index 034ba8632f..f5b62c4dff 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/config/TARDISConfigTabComplete.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/config/TARDISConfigTabComplete.java @@ -40,8 +40,8 @@ public class TARDISConfigTabComplete extends TARDISCompleter implements TabCompl private final ImmutableList COLOURS = ImmutableList.of("AQUA", "BLACK", "BLUE", "DARK_AQUA", "DARK_BLUE", "DARK_GRAY", "DARK_GREEN", "DARK_PURPLE", "DARK_RED", "GOLD", "GRAY", "GREEN", "LIGHT_PURPLE", "RED", "WHITE", "YELLOW"); private final List CONFIG_SUBS = new ArrayList<>(); private final ImmutableList DB_SUBS = ImmutableList.of("mysql", "sqlite"); - private final ImmutableList MAPPING_SUBS = ImmutableList.of("dynmap", "BlueMap"); - private final ImmutableList DIFFICULTY_SUBS = ImmutableList.of("easy", "medium", "hard"); + private final ImmutableList MAPPING_SUBS = ImmutableList.of("dynmap", "BlueMap", "squaremap"); + private final ImmutableList CRAFTING_SUBS = ImmutableList.of("easy", "hard"); private final List FILE_SUBS = new ArrayList<>(); private final ImmutableList FLAG_SUBS; private final ImmutableList KEYS = ImmutableList.of("first", "second", "third", "fifth", "seventh", "ninth", "tenth", "eleventh", "susan", "rose", "sally", "perception", "gold"); @@ -89,8 +89,8 @@ public List onTabComplete(CommandSender sender, Command command, String if (sub.equals("options")) { return partial(lastArg, CONFIG_SUBS); } - if (sub.equals("difficulty")) { - return partial(lastArg, DIFFICULTY_SUBS); + if (sub.equals("crafting")) { + return partial(lastArg, CRAFTING_SUBS); } if (sub.equals("provider")) { return partial(lastArg, MAPPING_SUBS); diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/config/TARDISSetBooleanCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/config/TARDISSetBooleanCommand.java index aa8ced38bf..ab1b8fd288 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/config/TARDISSetBooleanCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/config/TARDISSetBooleanCommand.java @@ -51,7 +51,7 @@ class TARDISSetBooleanCommand { boolean setConfigBool(CommandSender sender, String[] args, String section) { String tolower = args[0].toLowerCase(Locale.ENGLISH); String first = (section.isEmpty()) ? tolower : section + "." + tolower; - // check they typed true of false + // check they typed true or false String tf = args[1].toLowerCase(Locale.ENGLISH); if (!tf.equals("true") && !tf.equals("false")) { plugin.getMessenger().send(sender, TardisModule.TARDIS, "TRUE_FALSE"); diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/dev/SystemTreeCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/dev/SystemTreeCommand.java new file mode 100644 index 0000000000..dddf5ab9b0 --- /dev/null +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/dev/SystemTreeCommand.java @@ -0,0 +1,57 @@ +package me.eccentric_nz.TARDIS.commands.dev; + +import me.eccentric_nz.TARDIS.TARDIS; +import me.eccentric_nz.TARDIS.database.data.SystemUpgrade; +import me.eccentric_nz.TARDIS.database.resultset.ResultSetSystemUpgrades; +import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardis; +import me.eccentric_nz.TARDIS.database.resultset.ResultSetTravellers; +import me.eccentric_nz.TARDIS.enumeration.TardisModule; +import me.eccentric_nz.TARDIS.upgrades.TARDISSystemTreeGUI; +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; + +import java.util.HashMap; + +public class SystemTreeCommand { + + private final TARDIS plugin; + + public SystemTreeCommand(TARDIS plugin) { + this.plugin = plugin; + } + + public boolean open(Player player) { + String uuid = player.getUniqueId().toString(); + // get TARDIS player is in + HashMap where = new HashMap<>(); + where.put("uuid", uuid); + ResultSetTravellers rst = new ResultSetTravellers(plugin, where, false); + if (!rst.resultSet()) { + return true; + } + int id = rst.getTardis_id(); + // must be the owner of the TARDIS + HashMap wheret = new HashMap<>(); + wheret.put("tardis_id", id); + wheret.put("uuid", uuid); + ResultSetTardis rs = new ResultSetTardis(plugin, wheret, "", false, 2); + if (!rs.resultSet()) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "NOT_OWNER"); + return true; + } + // get player's artron energy level + ResultSetSystemUpgrades rsp = new ResultSetSystemUpgrades(plugin, id, uuid); + if (!rsp.resultset()) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_TRAVEL_FIRST"); + return true; + } + SystemUpgrade current = rsp.getData(); + ItemStack[] menu = new TARDISSystemTreeGUI(plugin, current).getInventory(); + Inventory upgrades = plugin.getServer().createInventory(player, 54, ChatColor.DARK_RED + "TARDIS System Upgrades"); + upgrades.setContents(menu); + player.openInventory(upgrades); + return true; + } +} diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/dev/TARDISDevBoxCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/dev/TARDISDevBoxCommand.java index dbaaf8f1f2..c4b5cb3dc0 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/dev/TARDISDevBoxCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/dev/TARDISDevBoxCommand.java @@ -20,8 +20,7 @@ import me.eccentric_nz.TARDIS.builders.TARDISBuilderUtility; import me.eccentric_nz.TARDIS.enumeration.ChameleonPreset; import me.eccentric_nz.TARDIS.enumeration.TardisModule; -import me.eccentric_nz.tardisweepingangels.monsters.weeping_angels.Blink; -import me.eccentric_nz.tardisweepingangels.utils.Vector3D; +import me.eccentric_nz.TARDIS.sonic.actions.TARDISSonicFreeze; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.command.CommandSender; @@ -31,9 +30,9 @@ import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; +import org.bukkit.util.Vector; /** - * * @author eccentric_nz */ public class TARDISDevBoxCommand { @@ -54,17 +53,17 @@ public boolean setPreset(CommandSender sender, String[] args) { if (sender instanceof Player player) { // get the armour stand the player is looking at Location observerPos = player.getEyeLocation(); - Vector3D observerDir = new Vector3D(observerPos.getDirection()); - Vector3D observerStart = new Vector3D(observerPos); - Vector3D observerEnd = observerStart.add(observerDir.multiply(16)); + Vector observerDir = observerPos.getDirection(); + Vector observerStart = observerPos.toVector(); + Vector observerEnd = observerStart.add(observerDir.multiply(16)); ArmorStand as = null; // Get nearby entities for (Entity target : player.getNearbyEntities(8.0d, 8.0d, 8.0d)) { // Bounding box of the given player - Vector3D targetPos = new Vector3D(target.getLocation()); - Vector3D minimum = targetPos.add(-0.5, 0, -0.5); - Vector3D maximum = targetPos.add(0.5, 1.67, 0.5); - if (target.getType().equals(EntityType.ARMOR_STAND) && Blink.hasIntersection(observerStart, observerEnd, minimum, maximum)) { + Vector targetPos = target.getLocation().toVector(); + Vector minimum = targetPos.add(new Vector(-0.5, 0, -0.5)); + Vector maximum = targetPos.add(new Vector(0.5, 1.67, 0.5)); + if (target.getType().equals(EntityType.ARMOR_STAND) && TARDISSonicFreeze.hasIntersection(observerStart, observerEnd, minimum, maximum)) { if (as == null || as.getLocation().distanceSquared(observerPos) > target.getLocation().distanceSquared(observerPos)) { as = (ArmorStand) target; } diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/dev/TARDISDevCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/dev/TARDISDevCommand.java index 995d82b4f4..629ad1d045 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/dev/TARDISDevCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/dev/TARDISDevCommand.java @@ -42,11 +42,9 @@ /** * Command /tardisadmin [arguments]. *

- * The Lord President was the most powerful member of the Time Lord Council and - * had near absolute authority, and used a link to the Matrix, a vast computer - * network containing the knowledge and experiences of all past generations of - * Time Lords, to set Time Lord policy and remain alert to potential threats - * from lesser civilisations. + * The Lord President was the most powerful member of the Time Lord Council and had near absolute authority, and used a + * link to the Matrix, a vast computer network containing the knowledge and experiences of all past generations of Time + * Lords, to set Time Lord policy and remain alert to potential threats from lesser civilisations. * * @author eccentric_nz */ @@ -57,13 +55,14 @@ public class TARDISDevCommand implements CommandExecutor { "box", "brushable", "chunks", "chunky", "circuit", "dismount", "displayitem", + "effect", "frame", "furnace", "interaction", "label", "list", "nms", "plurals", "recipe", - "snapshot", "stats", + "snapshot", "stats", "systree", "tis", "tree" ); private final TARDIS plugin; @@ -87,124 +86,149 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String return false; } if (args.length == 1) { - if (first.equals("add_regions")) { - return new TARDISAddRegionsCommand(plugin).doCheck(sender); + switch (first) { + case "add_regions" -> { + return new TARDISAddRegionsCommand(plugin).doCheck(sender); + } + case "furnace" -> { + return new TARDISFurnaceCommand(plugin).list(sender); + } + case "interaction" -> { + if (sender instanceof Player player) { + return new TARDISInteractionCommand(plugin).process(player.getUniqueId()); + } + return false; + } + case "stats" -> { + ARSRoomCounts arsRoomCounts = new ARSRoomCounts(plugin); + for (Map.Entry entry : arsRoomCounts.getRoomCounts().entrySet()) { + plugin.debug(entry.getKey() + ": " + entry.getValue()); + } + plugin.debug("Median per TARDIS: " + arsRoomCounts.getMedian()); + return true; + } + case "systree" -> { + if (sender instanceof Player player) { + return new SystemTreeCommand(plugin).open(player); + } + return false; + } + default -> { + } + } + } + switch (first) { + case "advancements" -> { + TARDISAchievementFactory.checkAdvancement(args[1]); + return true; } - if (first.equals("furnace")) { - return new TARDISFurnaceCommand(plugin).list(sender); + case "box" -> { + return new TARDISDevBoxCommand(plugin).setPreset(sender, args); } - if (first.equals("interaction")) { - if (sender instanceof Player player) { - return new TARDISInteractionCommand(plugin).process(player.getUniqueId()); - } - return false; + case "label" -> { + return new TARDISDevLabelCommand(plugin).catalog(sender); + } + case "nms" -> { + return new TARDISDevNMSCommand(plugin).spawn(sender, args); + } + case "circuit" -> { + return new TARDISDevCircuitCommand(plugin).give(sender); } - if (first.equals("stats")) { - ARSRoomCounts arsRoomCounts = new ARSRoomCounts(plugin); - for (Map.Entry entry : arsRoomCounts.getRoomCounts().entrySet()) { - plugin.debug(entry.getKey() + ": " + entry.getValue()); + case "tis" -> { + return new TARDISDevInfoCommand(plugin).test(sender); + } + case "list" -> { + return new TARDISDevListCommand(plugin).listStuff(sender, args); + } + case "tree" -> { + return new TARDISTreeCommand(plugin).grow(sender, args); + } + case "recipe" -> { + return new TARDISWikiRecipeCommand(plugin).write(sender, args); + } + case "plurals" -> { + for (Material m : Material.values()) { + String str = m.toString().toLowerCase(Locale.ROOT).replace("_", " "); + plugin.getMessenger().message(plugin.getConsole(), TardisModule.TARDIS, str + " --> " + Pluraliser.pluralise(str)); } - plugin.debug("Median per TARDIS: " + arsRoomCounts.getMedian()); return true; } - } - if (first.equals("advancements")) { - TARDISAchievementFactory.checkAdvancement(args[1]); - return true; - } - if (first.equals("box")) { - return new TARDISDevBoxCommand(plugin).setPreset(sender, args); - } - if (first.equals("label")) { - return new TARDISDevLabelCommand(plugin).catalog(sender); - } - if (first.equals("nms")) { - return new TARDISDevNMSCommand(plugin).spawn(sender, args); - } - if (first.equals("circuit")) { - return new TARDISDevCircuitCommand(plugin).give(sender); - } - if (first.equals("dismount") && sender instanceof Player player) { - if (player.getVehicle() != null) { - player.getVehicle().eject(); + case "chunks" -> { + return new TARDISChunksCommand(plugin).list(sender); } - } - if (first.equals("tis")) { - return new TARDISDevInfoCommand(plugin).test(sender); - } - if (first.equals("list")) { - return new TARDISDevListCommand(plugin).listStuff(sender, args); - } - if (first.equals("tree")) { - return new TARDISTreeCommand(plugin).grow(sender, args); - } - if (first.equals("recipe")) { - return new TARDISWikiRecipeCommand(plugin).write(sender, args); - } - if (first.equals("plurals")) { - for (Material m : Material.values()) { - String str = m.toString().toLowerCase(Locale.ROOT).replace("_", " "); - plugin.getMessenger().message(plugin.getConsole(), TardisModule.TARDIS, str + " --> " + Pluraliser.pluralise(str)); + case "chunky" -> { + if (!plugin.getPM().isPluginEnabled("Chunky")) { + plugin.getMessenger().message(plugin.getConsole(), TardisModule.WARNING, "Chunky plugin is not enabled!"); + return true; + } + String radius = args.length > 2 ? args[2] : "250"; + plugin.getServer().dispatchCommand(plugin.getConsole(), "chunky world " + args[1]); + plugin.getServer().dispatchCommand(plugin.getConsole(), "chunky radius " + radius); + plugin.getServer().dispatchCommand(plugin.getConsole(), "chunky spawn"); + plugin.getServer().dispatchCommand(plugin.getConsole(), "chunky start"); + plugin.getServer().dispatchCommand(plugin.getConsole(), "chunky confirm"); + return true; } - } - if (first.equals("chunks")) { - return new TARDISChunksCommand(plugin).list(sender); - } - if (first.equals("chunky")) { - if (!plugin.getPM().isPluginEnabled("Chunky")) { - plugin.getMessenger().message(plugin.getConsole(), TardisModule.WARNING, "Chunky plugin is not enabled!"); + case "snapshot" -> { + if (sender instanceof Player player) { + if (args[1].equals("c")) { + player.performCommand("minecraft:clear @s minecraft:filled_map"); + } else { + new MonitorSnapshot(plugin).get(args[1].equals("in"), player); + } + } return true; } - String radius = args.length > 2 ? args[2] : "250"; - plugin.getServer().dispatchCommand(plugin.getConsole(), "chunky world " + args[1]); - plugin.getServer().dispatchCommand(plugin.getConsole(), "chunky radius " + radius); - plugin.getServer().dispatchCommand(plugin.getConsole(), "chunky spawn"); - plugin.getServer().dispatchCommand(plugin.getConsole(), "chunky start"); - plugin.getServer().dispatchCommand(plugin.getConsole(), "chunky confirm"); - return true; - } - if (first.equals("snapshot")) { - if (sender instanceof Player player) { - if (args[1].equals("c")) { - player.performCommand("minecraft:clear @s minecraft:filled_map"); + case "displayitem" -> { + if (sender instanceof Player player) { + return new TARDISDisplayItemCommand(plugin).display(player, args); } else { - new MonitorSnapshot(plugin).get(args[1].equals("in"), player); + plugin.getMessenger().send(sender, TardisModule.TARDIS, "CMD_PLAYER"); + return true; } } - } - if (first.equals("displayitem")) { - if (sender instanceof Player player) { - return new TARDISDisplayItemCommand(plugin).display(player, args); - } else { - plugin.getMessenger().send(sender, TardisModule.TARDIS, "CMD_PLAYER"); + case "frame" -> { + if (sender instanceof Player player) { + return new TARDISFrameCommand(plugin).toggle(player, args[1].equalsIgnoreCase("lock"), args.length == 3); + } else { + plugin.getMessenger().send(sender, TardisModule.TARDIS, "CMD_PLAYER"); + return true; + } + } + case "brushable" -> { + if (sender instanceof Player player) { + if (args.length == 2) { + // get target block + Block block = player.getTargetBlock(null, 8); + sender.sendMessage(block.getState().toString()); + } else { + ItemStack sand = new ItemStack(Material.SUSPICIOUS_SAND); + BlockStateMeta sandMeta = (BlockStateMeta) sand.getItemMeta(); + BrushableBlock blockState = (BrushableBlock) sandMeta.getBlockState(); + blockState.setItem(player.getInventory().getItemInMainHand()); + sandMeta.setBlockState(blockState); + sand.setItemMeta(sandMeta); + player.getInventory().addItem(sand); + } + } return true; } - } - if (first.equals("frame")) { - if (sender instanceof Player player) { - return new TARDISFrameCommand(plugin).toggle(player, args[1].equalsIgnoreCase("lock"), args.length == 3); - } else { - plugin.getMessenger().send(sender, TardisModule.TARDIS, "CMD_PLAYER"); + case "dismount" -> { + if (sender instanceof Player player) { + if (player.getVehicle() != null) { + player.getVehicle().eject(); + } + } return true; } - } - if (first.equals("brushable")) { - if (sender instanceof Player player) { - if (args.length == 2) { - // get target block - Block block = player.getTargetBlock(null, 8); - sender.sendMessage(block.getState().toString()); - } else { - ItemStack sand = new ItemStack(Material.SUSPICIOUS_SAND); - BlockStateMeta sandMeta = (BlockStateMeta) sand.getItemMeta(); - BrushableBlock blockState = (BrushableBlock) sandMeta.getBlockState(); - blockState.setItem(player.getInventory().getItemInMainHand()); - sandMeta.setBlockState(blockState); - sand.setItemMeta(sandMeta); - player.getInventory().addItem(sand); + case "effect" -> { + if (sender instanceof Player player) { + return new TARDISDevEffectCommand(plugin).show(player, args); } } - return true; + default -> { + return false; + } } } else { plugin.getMessenger().send(sender, TardisModule.TARDIS, "CMD_ADMIN"); diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/dev/TARDISDevEffectCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/dev/TARDISDevEffectCommand.java new file mode 100644 index 0000000000..50e25bbc17 --- /dev/null +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/dev/TARDISDevEffectCommand.java @@ -0,0 +1,84 @@ +package me.eccentric_nz.TARDIS.commands.dev; + +import me.eccentric_nz.TARDIS.TARDIS; +import me.eccentric_nz.TARDIS.database.data.ParticleData; +import me.eccentric_nz.TARDIS.database.resultset.ResultSetCurrentLocation; +import me.eccentric_nz.TARDIS.database.resultset.ResultSetParticlePrefs; +import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardisID; +import me.eccentric_nz.TARDIS.database.resultset.ResultSetThrottle; +import me.eccentric_nz.TARDIS.enumeration.SpaceTimeThrottle; +import me.eccentric_nz.TARDIS.particles.Emitter; +import me.eccentric_nz.TARDIS.particles.ParticleEffect; +import me.eccentric_nz.TARDIS.particles.ParticleShape; +import me.eccentric_nz.TARDIS.utility.TARDISNumberParsers; +import org.bukkit.Location; +import org.bukkit.entity.Player; + +import java.util.HashMap; +import java.util.Locale; +import java.util.UUID; + +public class TARDISDevEffectCommand { + + private final TARDIS plugin; + + public TARDISDevEffectCommand(TARDIS plugin) { + this.plugin = plugin; + } + + public boolean show(Player player, String[] args) { + if (args.length == 1) { + // use particle prefs + UUID uuid = player.getUniqueId(); + // get players TARDIS id + ResultSetTardisID rst = new ResultSetTardisID(plugin); + if (rst.fromUUID(uuid.toString())) { + // get TARDIS location + HashMap wherec = new HashMap<>(); + wherec.put("tardis_id", rst.getTardisId()); + ResultSetCurrentLocation rsc = new ResultSetCurrentLocation(plugin, wherec); + if (rsc.resultSet()) { + Location current = new Location(rsc.getWorld(), rsc.getX(), rsc.getY(), rsc.getZ()).add(0.5, 0, 0.5); + // get throttle setting + ResultSetThrottle rs = new ResultSetThrottle(plugin); + SpaceTimeThrottle throttle = rs.getSpeedAndParticles(uuid.toString()).getThrottle(); + // get current settings + ResultSetParticlePrefs rspp = new ResultSetParticlePrefs(plugin); + if (rspp.fromUUID(uuid.toString())) { + ParticleData data = rspp.getData(); + // display particles + Emitter emitter = new Emitter(plugin, uuid, current, data, throttle.getFlightTime()); + int task = plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, emitter, 0, data.getShape().getPeriod()); + emitter.setTaskID(task); + } + } + } + } else if (args.length > 2) { + ParticleShape shape; + ParticleEffect particle; + try { + shape = ParticleShape.valueOf(args[1].toUpperCase(Locale.ROOT)); + } catch (IllegalArgumentException e) { + shape = ParticleShape.RANDOM; + } + try { + particle = ParticleEffect.valueOf(args[2].toUpperCase(Locale.ROOT)); + } catch (IllegalArgumentException e) { + particle = ParticleEffect.EFFECT; + } + // get density and speed + int density = 16; + double speed = 0; + if (args.length > 3) { + density = TARDISNumberParsers.parseInt(args[3]); + } + if (args.length > 4) { + speed = TARDISNumberParsers.parseDouble(args[4]); + } + Emitter emitter = new Emitter(plugin, player.getUniqueId(), player.getLocation().add(3, 0, 3), new ParticleData(particle, shape, density, speed, true), SpaceTimeThrottle.RAPID.getFlightTime()); + int task = plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, emitter, 0, shape.getPeriod()); + emitter.setTaskID(task); + } + return true; + } +} diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/dev/TARDISDevTabComplete.java b/src/main/java/me/eccentric_nz/TARDIS/commands/dev/TARDISDevTabComplete.java index ccb846f746..b615ae4de0 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/dev/TARDISDevTabComplete.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/dev/TARDISDevTabComplete.java @@ -21,6 +21,8 @@ import me.eccentric_nz.TARDIS.commands.TARDISCompleter; import me.eccentric_nz.TARDIS.customblocks.TARDISDisplayItem; import me.eccentric_nz.TARDIS.enumeration.ChameleonPreset; +import me.eccentric_nz.TARDIS.particles.ParticleEffect; +import me.eccentric_nz.TARDIS.particles.ParticleShape; import me.eccentric_nz.tardisweepingangels.utils.Monster; import org.bukkit.Material; import org.bukkit.command.Command; @@ -36,7 +38,7 @@ */ public class TARDISDevTabComplete extends TARDISCompleter implements TabCompleter { - private final ImmutableList ROOT_SUBS = ImmutableList.of("add_regions", "advancements", "chunks", "chunky", "dismount", "furnace", "list", "plurals", "stats", "tree", "snapshot", "displayitem", "frame", "brushable", "box", "nms", "circuit", "label", "recipe", "interaction"); + private final ImmutableList ROOT_SUBS = ImmutableList.of("add_regions", "advancements", "chunks", "chunky", "dismount", "furnace", "list", "plurals", "stats", "systree", "tree", "snapshot", "displayitem", "frame", "brushable", "box", "nms", "circuit", "label", "recipe", "interaction", "effect"); private final ImmutableList LIST_SUBS = ImmutableList.of("preset_perms", "perms", "recipes", "blueprints", "commands", "block_colours", "change", "consoles"); private final ImmutableList SNAPSHOT_SUBS = ImmutableList.of("in", "out", "c"); private final ImmutableList STATE_SUBS = ImmutableList.of("closed", "open", "stained", "glass", "fly"); @@ -48,6 +50,8 @@ public class TARDISDevTabComplete extends TARDISCompleter implements TabComplete private final List ITEM_SUBS = new ArrayList<>(); private final List PRESET_SUBS = new ArrayList<>(); private final List MONSTER_SUBS = new ArrayList<>(); + private final List EFFECT_SUBS = new ArrayList<>(); + private final List SHAPE_SUBS = new ArrayList<>(); private final ImmutableList RECIPE_SUBS = ImmutableList.of("shaped", "shapeless", "chest", "chemistry", "custom"); public TARDISDevTabComplete(TARDIS plugin) { @@ -71,6 +75,12 @@ public TARDISDevTabComplete(TARDIS plugin) { for (Monster m : Monster.values()) { MONSTER_SUBS.add(m.toString()); } + for (ParticleEffect e : ParticleEffect.values()) { + EFFECT_SUBS.add(e.toString()); + } + for (ParticleShape s : ParticleShape.values()) { + SHAPE_SUBS.add(s.toString()); + } } @Override @@ -106,11 +116,17 @@ public List onTabComplete(CommandSender sender, Command command, String if (sub.equals("recipe")) { return partial(lastArg, RECIPE_SUBS); } + if (sub.equals("effect")) { + return partial(lastArg, SHAPE_SUBS); + } } case 3 -> { if (sub.equals("box")) { return partial(lastArg, STATE_SUBS); } + if (sub.equals("effect")) { + return partial(lastArg, EFFECT_SUBS); + } } case 4 -> { if (sub.equals("displayitem")) { diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/dev/TARDISDisplayItemCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/dev/TARDISDisplayItemCommand.java index a4d63a1a4c..a19dc63521 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/dev/TARDISDisplayItemCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/dev/TARDISDisplayItemCommand.java @@ -195,7 +195,7 @@ public boolean display(Player player, String[] args) { // get players tardis_id ResultSetTardisID rst = new ResultSetTardisID(plugin); if (rst.fromUUID(player.getUniqueId().toString())) { - int id = rst.getTardis_id(); + int id = rst.getTardisId(); HashMap where = new HashMap<>(); where.put("tardis_id", id); ResultSetARS rsa = new ResultSetARS(plugin, where); @@ -246,7 +246,7 @@ public boolean display(Player player, String[] args) { ResultSetTardisID rs = new ResultSetTardisID(plugin); String uuid = player.getUniqueId().toString(); if (rs.fromUUID(uuid)) { - new ConsoleBuilder(plugin).create(block, colour, rs.getTardis_id(), uuid); + new ConsoleBuilder(plugin).create(block, colour, rs.getTardisId(), uuid); } return true; } diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/dev/TARDISFrameCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/dev/TARDISFrameCommand.java index 4db6c818a0..cb551ad63e 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/dev/TARDISFrameCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/dev/TARDISFrameCommand.java @@ -17,17 +17,16 @@ package me.eccentric_nz.TARDIS.commands.dev; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.tardisweepingangels.monsters.weeping_angels.Blink; -import me.eccentric_nz.tardisweepingangels.utils.Vector3D; +import me.eccentric_nz.TARDIS.sonic.actions.TARDISSonicFreeze; import org.bukkit.Location; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.ItemFrame; import org.bukkit.entity.Player; import org.bukkit.persistence.PersistentDataType; +import org.bukkit.util.Vector; /** - * * @author eccentric_nz */ public class TARDISFrameCommand { @@ -39,22 +38,22 @@ public TARDISFrameCommand(TARDIS plugin) { } public static ItemFrame getItemFrame(Player player) { - ItemFrame frame = null; +// ItemFrame frame = null; // get the item frame player is looking at Location observerPos = player.getEyeLocation(); - Vector3D observerDir = new Vector3D(observerPos.getDirection()); - Vector3D observerStart = new Vector3D(observerPos); - Vector3D observerEnd = observerStart.add(observerDir.multiply(16)); + Vector observerDir = observerPos.getDirection(); + Vector observerStart = observerPos.toVector(); + Vector observerEnd = observerStart.add(observerDir.multiply(16)); // Get nearby entities for (Entity target : player.getNearbyEntities(8.0d, 8.0d, 8.0d)) { // Bounding box of the given player - Vector3D targetPos = new Vector3D(target.getLocation()); - Vector3D minimum = targetPos.add(-0.5, 0, -0.5); - Vector3D maximum = targetPos.add(0.5, 1.67, 0.5); - if (target.getType().equals(EntityType.ITEM_FRAME) && Blink.hasIntersection(observerStart, observerEnd, minimum, maximum)) { - if (frame == null || frame.getLocation().distanceSquared(observerPos) > target.getLocation().distanceSquared(observerPos)) { - return (ItemFrame) target; - } + Vector targetPos = target.getLocation().toVector(); + Vector minimum = targetPos.add(new Vector(-0.5, 0, -0.5)); + Vector maximum = targetPos.add(new Vector(0.5, 1.67, 0.5)); + if (target.getType().equals(EntityType.ITEM_FRAME) && TARDISSonicFreeze.hasIntersection(observerStart, observerEnd, minimum, maximum)) { +// if (frame == null || frame.getLocation().distanceSquared(observerPos) > target.getLocation().distanceSquared(observerPos)) { + return (ItemFrame) target; +// } } } return null; diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/handles/TARDISHandlesDiskCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/handles/TARDISHandlesDiskCommand.java index 22f6a8f6d8..1f472078cc 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/handles/TARDISHandlesDiskCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/handles/TARDISHandlesDiskCommand.java @@ -23,7 +23,7 @@ import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.utility.TARDISNumberParsers; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/handles/TARDISHandlesLandCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/handles/TARDISHandlesLandCommand.java index 272500632a..b264f74b74 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/handles/TARDISHandlesLandCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/handles/TARDISHandlesLandCommand.java @@ -27,7 +27,6 @@ import me.eccentric_nz.TARDIS.database.resultset.ResultSetPlayerPrefs; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardis; import me.eccentric_nz.TARDIS.enumeration.ChameleonPreset; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; import me.eccentric_nz.TARDIS.enumeration.DiskCircuit; import me.eccentric_nz.TARDIS.enumeration.TravelType; import me.eccentric_nz.TARDIS.flight.TARDISHandbrake; @@ -132,12 +131,9 @@ public boolean exitVortex(Player player, int id, String uuid) { plugin.getTrackerKeeper().getHasRandomised().removeAll(Collections.singleton(id)); } // damage the circuit if configured - TARDISCircuitChecker tcc = null; - if (!plugin.getDifficulty().equals(Difficulty.EASY) && !plugin.getUtils().inGracePeriod(player, true)) { - tcc = new TARDISCircuitChecker(plugin, id); + if (plugin.getConfig().getBoolean("circuits.damage") && plugin.getConfig().getInt("circuits.uses.materialisation") > 0) { + TARDISCircuitChecker tcc = new TARDISCircuitChecker(plugin, id);; tcc.getCircuits(); - } - if (tcc != null && plugin.getConfig().getBoolean("circuits.damage") && plugin.getConfig().getInt("circuits.uses.materialisation") > 0) { // decrement uses int uses_left = tcc.getMaterialisationUses(); new TARDISCircuitDamager(plugin, DiskCircuit.MATERIALISATION, uses_left, id, player).damage(); diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/handles/TARDISHandlesRemoveCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/handles/TARDISHandlesRemoveCommand.java index 8aa2320bac..a00afa5034 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/handles/TARDISHandlesRemoveCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/handles/TARDISHandlesRemoveCommand.java @@ -16,12 +16,13 @@ */ package me.eccentric_nz.TARDIS.commands.handles; -import java.util.HashMap; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardisID; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import org.bukkit.entity.Player; +import java.util.HashMap; + class TARDISHandlesRemoveCommand { private final TARDIS plugin; @@ -34,7 +35,7 @@ boolean purge(Player player) { ResultSetTardisID rs = new ResultSetTardisID(plugin); if (rs.fromUUID(player.getUniqueId().toString())) { HashMap whereh = new HashMap<>(); - whereh.put("tardis_id", rs.getTardis_id()); + whereh.put("tardis_id", rs.getTardisId()); whereh.put("type", 26); plugin.getQueryFactory().doDelete("controls", whereh); plugin.getMessenger().send(player, TardisModule.TARDIS, "HANDLES_DELETED"); diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/handles/TARDISHandlesScanCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/handles/TARDISHandlesScanCommand.java index 328dcf197c..3987f44b2f 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/handles/TARDISHandlesScanCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/handles/TARDISHandlesScanCommand.java @@ -24,7 +24,6 @@ import me.eccentric_nz.TARDIS.database.resultset.ResultSetCurrentLocation; import me.eccentric_nz.TARDIS.database.resultset.ResultSetNextLocation; import me.eccentric_nz.TARDIS.enumeration.COMPASS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; import me.eccentric_nz.TARDIS.enumeration.DiskCircuit; import me.eccentric_nz.TARDIS.enumeration.WorldManager; import me.eccentric_nz.TARDIS.planets.TARDISAliasResolver; @@ -230,7 +229,7 @@ boolean sayScan() { plugin.getMessenger().handlesSend(player, "SCAN_NONE"); } // damage the circuit if configured - if (plugin.getConfig().getBoolean("circuits.damage") && !plugin.getDifficulty().equals(Difficulty.EASY) && plugin.getConfig().getInt("circuits.uses.scanner") > 0) { + if (plugin.getConfig().getBoolean("circuits.damage") && plugin.getConfig().getInt("circuits.uses.scanner") > 0) { TARDISCircuitChecker tcc = new TARDISCircuitChecker(plugin, id); tcc.getCircuits(); // decrement uses diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/handles/TARDISHandlesTakeoffCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/handles/TARDISHandlesTakeoffCommand.java index f3189b28e0..d1ec26d731 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/handles/TARDISHandlesTakeoffCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/handles/TARDISHandlesTakeoffCommand.java @@ -18,9 +18,9 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.database.data.Tardis; +import me.eccentric_nz.TARDIS.database.data.Throticle; import me.eccentric_nz.TARDIS.database.resultset.*; import me.eccentric_nz.TARDIS.enumeration.ChameleonPreset; -import me.eccentric_nz.TARDIS.enumeration.SpaceTimeThrottle; import me.eccentric_nz.TARDIS.flight.TARDISTakeoff; import me.eccentric_nz.TARDIS.utility.TARDISNumberParsers; import me.eccentric_nz.TARDIS.utility.TARDISStaticLocationGetters; @@ -92,13 +92,12 @@ public boolean enterVortex(Player player, String[] args) { ResultSetPlayerPrefs rsp = new ResultSetPlayerPrefs(plugin, args[1]); boolean beac_on = true; boolean bar = false; - SpaceTimeThrottle spaceTimeThrottle = SpaceTimeThrottle.NORMAL; if (rsp.resultSet()) { beac_on = rsp.isBeaconOn(); bar = rsp.isTravelbarOn(); - spaceTimeThrottle = SpaceTimeThrottle.getByDelay().get(rsp.getThrottle()); } - new TARDISTakeoff(plugin).run(id, handbrake, location, player, beac_on, tardis.getBeacon(), bar, spaceTimeThrottle); + Throticle throticle = new ResultSetThrottle(plugin).getSpeedAndParticles(args[1]); + new TARDISTakeoff(plugin).run(id, handbrake, location, player, beac_on, tardis.getBeacon(), bar, throticle); } else { plugin.getMessenger().handlesSend(player, "HANDBRAKE_OFF_ERR"); } diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/preferences/TARDISHumListener.java b/src/main/java/me/eccentric_nz/TARDIS/commands/preferences/TARDISHumListener.java index a43dc572a3..4a4c095564 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/preferences/TARDISHumListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/preferences/TARDISHumListener.java @@ -20,7 +20,7 @@ import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; import me.eccentric_nz.TARDIS.utility.TARDISSounds; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.inventory.InventoryClickEvent; diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/preferences/TARDISKeyMenuListener.java b/src/main/java/me/eccentric_nz/TARDIS/commands/preferences/TARDISKeyMenuListener.java index e659768c76..20094337fc 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/preferences/TARDISKeyMenuListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/preferences/TARDISKeyMenuListener.java @@ -19,7 +19,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; import me.eccentric_nz.TARDIS.utility.TARDISStaticUtils; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/preferences/TARDISLabelsCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/preferences/TARDISLabelsCommand.java index e5c78f9737..099fce3d7e 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/preferences/TARDISLabelsCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/preferences/TARDISLabelsCommand.java @@ -40,7 +40,7 @@ boolean toggle(Player player, String[] args) { } ResultSetTardisID rs = new ResultSetTardisID(plugin); if (rs.fromUUID(player.getUniqueId().toString())) { - int id = rs.getTardis_id(); + int id = rs.getTardisId(); boolean on = args[1].equalsIgnoreCase("on"); new LabelAction(plugin).toggle(id, on); } diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/preferences/TARDISParticlePrefsCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/preferences/TARDISParticlePrefsCommand.java new file mode 100644 index 0000000000..3b6b28c7f6 --- /dev/null +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/preferences/TARDISParticlePrefsCommand.java @@ -0,0 +1,71 @@ +package me.eccentric_nz.TARDIS.commands.preferences; + +import me.eccentric_nz.TARDIS.TARDIS; +import me.eccentric_nz.TARDIS.database.resultset.ResultSetParticlePrefs; +import me.eccentric_nz.TARDIS.enumeration.TardisModule; +import me.eccentric_nz.TARDIS.particles.ParticleEffect; +import me.eccentric_nz.TARDIS.particles.ParticleShape; +import me.eccentric_nz.TARDIS.utility.TARDISNumberParsers; +import org.bukkit.entity.Player; + +import java.util.HashMap; +import java.util.Locale; + +public class TARDISParticlePrefsCommand { + + private final TARDIS plugin; + + public TARDISParticlePrefsCommand(TARDIS plugin) { + this.plugin = plugin; + } + + public boolean setPartclePref(Player player, String[] args) { + String which = args[0].toLowerCase(); + Object value; + switch (which) { + case "effect" -> { + try { + ParticleEffect effect = ParticleEffect.valueOf(args[1].toUpperCase(Locale.ROOT)); + value = effect.toString(); + } catch (IllegalArgumentException e) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "ARG_PARTICLE", args[1], "effect"); + return true; + } + } + case "shape" -> { + try { + ParticleShape shape = ParticleShape.valueOf(args[1].toUpperCase(Locale.ROOT)); + value = shape.toString(); + } catch (IllegalArgumentException e) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "ARG_PARTICLE", args[1], "shape"); + return true; + } + } + default -> { + // speed + value = TARDISNumberParsers.parseDouble(args[1]); + if ((Double) value == -1) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "ARG_PARTICLE", args[1], "speed"); + return true; + } + } + } + String uuid = player.getUniqueId().toString(); + HashMap set = new HashMap<>(); + set.put(which, value); + // do they have a particle_prefs record? + HashMap wheres = new HashMap<>(); + wheres.put("uuid", uuid); + ResultSetParticlePrefs rss = new ResultSetParticlePrefs(plugin); + if (rss.fromUUID(uuid)) { + HashMap wherea = new HashMap<>(); + wherea.put("uuid", uuid); + plugin.getQueryFactory().doUpdate("particle_prefs", set, wherea); + } else { + set.put("uuid", uuid); + plugin.getQueryFactory().doInsert("particle_prefs", set); + } + plugin.getMessenger().send(player, TardisModule.TARDIS, "PARTICLE_SAVED"); + return true; + } +} diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/preferences/TARDISPrefsCommands.java b/src/main/java/me/eccentric_nz/TARDIS/commands/preferences/TARDISPrefsCommands.java index e31ab24374..e3a16d0c61 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/preferences/TARDISPrefsCommands.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/preferences/TARDISPrefsCommands.java @@ -25,7 +25,7 @@ import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.forcefield.TARDISForceField; import me.eccentric_nz.TARDIS.sonic.TARDISSonicMenuInventory; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; @@ -52,8 +52,8 @@ public class TARDISPrefsCommands implements CommandExecutor { "announce_repeaters", "auto", "auto_powerup", "auto_rescue", "auto_siege", "beacon", "build", "close_gui", "console_labels", - "difficulty", "dnd", "dynamic_lamps", - "eps", "eps_message", + "dnd", "dynamic_lamps", + "effect", "eps", "eps_message", "farm", "flight", "floor", "forcefield", "hads", "hads_type", "hum", "info", "isomorphic", @@ -63,7 +63,7 @@ public class TARDISPrefsCommands implements CommandExecutor { "minecart", "quotes", "renderer", - "sfx", "siege_floor", "siege_wall", "sign", "sonic", "submarine", + "sfx", "shape", "siege_floor", "siege_wall", "sign", "sonic", "speed", "submarine", "telepathy", "translate", "travelbar", "wall" ); @@ -131,9 +131,6 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String case "console_labels" -> { return new TARDISLabelsCommand(plugin).toggle(player, args); } - case "difficulty" -> { - return new TARDISSetDifficultyCommand(plugin).setDiff(player, args); - } case "eps_message" -> { return new TARDISEPSMessageCommand(plugin).setMessage(player, args); } @@ -161,6 +158,9 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String case "wall", "floor", "siege_wall", "siege_floor" -> { return new TARDISFloorCommand(plugin).setFloorOrWallBlock(player, args); } + case "effect", "shape", "speed" -> { + return new TARDISParticlePrefsCommand(plugin).setPartclePref(player, args); + } default -> { if (args.length < 2 || (!args[1].equalsIgnoreCase("on") && !args[1].equalsIgnoreCase("off"))) { plugin.getMessenger().send(player, TardisModule.TARDIS, "PREF_ON_OFF", pref); diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/preferences/TARDISPrefsMenuInventory.java b/src/main/java/me/eccentric_nz/TARDIS/commands/preferences/TARDISPrefsMenuInventory.java index 5b609f0bbb..aae54ac6a7 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/preferences/TARDISPrefsMenuInventory.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/preferences/TARDISPrefsMenuInventory.java @@ -29,7 +29,10 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.UUID; /** * The Administrator of Solos is the Earth Empire's civilian overseer for that planet. @@ -55,7 +58,7 @@ public TARDISPrefsMenuInventory(TARDIS plugin, UUID uuid) { */ private ItemStack[] getItemStack() { - // get player prefs + // get player preferences ResultSetPlayerPrefs rsp = new ResultSetPlayerPrefs(plugin, uuid.toString()); List values = new ArrayList<>(); if (!rsp.resultSet()) { @@ -102,7 +105,6 @@ private ItemStack[] getItemStack() { values.add(rsp.isAutoPowerUp()); values.add(plugin.getTrackerKeeper().getActiveForceFields().containsKey(uuid)); values.add(rsp.isMinecartOn()); - values.add(rsp.isEasyDifficulty()); if (plugin.isWorldGuardOnServer()) { String chunk = rst.getTardis().getChunk(); String[] split = chunk.split(":"); @@ -130,7 +132,7 @@ private ItemStack[] getItemStack() { if (pref == GUIPlayerPreferences.HADS_TYPE) { im.setLore(List.of(v ? "DISPERSAL" : "DISPLACEMENT")); } else { - im.setLore(List.of(v ? plugin.getLanguage().getString("SET_ON") : plugin.getLanguage().getString("SET_OFF"))); + im.setLore(List.of(v ? plugin.getLanguage().getString("SET_ON", "ON") : plugin.getLanguage().getString("SET_OFF", "OFF"))); } is.setItemMeta(im); stack[pref.getSlot()] = is; @@ -161,7 +163,7 @@ private ItemStack[] getItemStack() { ItemStack hand = new ItemStack(Material.LEVER, 1); ItemMeta brake = hand.getItemMeta(); brake.setDisplayName("Handbrake"); - brake.setLore(List.of((tardis != null && tardis.isHandbrakeOn()) ? plugin.getLanguage().getString("SET_ON") : plugin.getLanguage().getString("SET_OFF"))); + brake.setLore(List.of((tardis != null && tardis.isHandbrakeOn()) ? plugin.getLanguage().getString("SET_ON", "ON") : plugin.getLanguage().getString("SET_OFF", "OFF"))); brake.setCustomModelData(GUIPlayerPreferences.HANDBRAKE.getCustomModelData()); hand.setItemMeta(brake); stack[GUIPlayerPreferences.HANDBRAKE.getSlot()] = hand; @@ -172,20 +174,24 @@ private ItemStack[] getItemStack() { map.setCustomModelData(GUIPlayerPreferences.TARDIS_MAP.getCustomModelData()); tt.setItemMeta(map); stack[GUIPlayerPreferences.TARDIS_MAP.getSlot()] = tt; - // autonomous prefs - ItemStack auto = new ItemStack(Material.BOWL, 1); - ItemMeta prefs = auto.getItemMeta(); - prefs.setDisplayName("Autonomous Preferences"); - prefs.setCustomModelData(GUIPlayerPreferences.AUTONOMOUS_PREFERENCES.getCustomModelData()); - auto.setItemMeta(prefs); - stack[GUIPlayerPreferences.AUTONOMOUS_PREFERENCES.getSlot()] = auto; - // farming prefs - ItemStack farm = new ItemStack(Material.BOWL, 1); - ItemMeta ing = farm.getItemMeta(); - ing.setDisplayName("Farming Preferences"); - ing.setCustomModelData(GUIPlayerPreferences.FARMING_PREFERENCES.getCustomModelData()); - farm.setItemMeta(ing); - stack[GUIPlayerPreferences.FARMING_PREFERENCES.getSlot()] = farm; + if (plugin.getServer().getPlayer(uuid).hasPermission("tardis.autonomous")) { + // autonomous preferences + ItemStack auto = new ItemStack(Material.BOWL, 1); + ItemMeta prefs = auto.getItemMeta(); + prefs.setDisplayName("Autonomous Preferences"); + prefs.setCustomModelData(GUIPlayerPreferences.AUTONOMOUS_PREFERENCES.getCustomModelData()); + auto.setItemMeta(prefs); + stack[GUIPlayerPreferences.AUTONOMOUS_PREFERENCES.getSlot()] = auto; + } + if (plugin.getServer().getPlayer(uuid).hasPermission("tardis.farm")) { + // farming preferences + ItemStack farm = new ItemStack(Material.BOWL, 1); + ItemMeta ing = farm.getItemMeta(); + ing.setDisplayName("Farming Preferences"); + ing.setCustomModelData(GUIPlayerPreferences.FARMING_PREFERENCES.getCustomModelData()); + farm.setItemMeta(ing); + stack[GUIPlayerPreferences.FARMING_PREFERENCES.getSlot()] = farm; + } // sonic configurator ItemStack sonic = new ItemStack(Material.BOWL, 1); ItemMeta config = sonic.getItemMeta(); @@ -193,6 +199,15 @@ private ItemStack[] getItemStack() { config.setCustomModelData(GUIPlayerPreferences.SONIC_CONFIGURATOR.getCustomModelData()); sonic.setItemMeta(config); stack[GUIPlayerPreferences.SONIC_CONFIGURATOR.getSlot()] = sonic; + if (plugin.getServer().getPlayer(uuid).hasPermission("tardis.particles")) { + // particle preferences + ItemStack part = new ItemStack(Material.BOWL, 1); + ItemMeta icles = part.getItemMeta(); + icles.setDisplayName("Materialisation Particles"); + icles.setCustomModelData(GUIPlayerPreferences.PARTICLES.getCustomModelData()); + part.setItemMeta(icles); + stack[GUIPlayerPreferences.PARTICLES.getSlot()] = part; + } if (plugin.getServer().getPlayer(uuid).hasPermission("tardis.admin")) { // admin ItemStack ad = new ItemStack(Material.NETHER_STAR, 1); diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/preferences/TARDISPrefsMenuListener.java b/src/main/java/me/eccentric_nz/TARDIS/commands/preferences/TARDISPrefsMenuListener.java index 97645ded74..ec9f336e13 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/preferences/TARDISPrefsMenuListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/preferences/TARDISPrefsMenuListener.java @@ -28,7 +28,6 @@ import me.eccentric_nz.TARDIS.custommodeldata.GUIPlayerPreferences; import me.eccentric_nz.TARDIS.database.data.Tardis; import me.eccentric_nz.TARDIS.database.resultset.*; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; import me.eccentric_nz.TARDIS.enumeration.DiskCircuit; import me.eccentric_nz.TARDIS.enumeration.FlightMode; import me.eccentric_nz.TARDIS.enumeration.TardisModule; @@ -37,9 +36,10 @@ import me.eccentric_nz.TARDIS.forcefield.TARDISForceField; import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; import me.eccentric_nz.TARDIS.mobfarming.TARDISFarmingInventory; +import me.eccentric_nz.TARDIS.particles.TARDISParticleInventory; import me.eccentric_nz.TARDIS.sonic.TARDISSonicConfiguratorInventory; import me.eccentric_nz.TARDIS.utility.TARDISStaticUtils; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.inventory.InventoryClickEvent; @@ -73,7 +73,6 @@ public TARDISPrefsMenuListener(TARDIS plugin) { lookup.put("Close GUI", "close_gui_on"); lookup.put("Companion Build", "build_on"); lookup.put("Do Not Disturb", "dnd_on"); - lookup.put("Easy Difficulty", "difficulty"); lookup.put("Emergency Programme One", "eps_on"); lookup.put("Exterior Rendering Room", "renderer_on"); lookup.put("Hostile Action Displacement System", "hads_on"); @@ -110,7 +109,7 @@ public void onPrefsMenuClick(InventoryClickEvent event) { // toggle force field on / off if (TARDISPermission.hasPermission(p, "tardis.forcefield")) { List lore = im.getLore(); - boolean bool = (lore.get(0).equals(plugin.getLanguage().getString("SET_OFF"))); + boolean bool = (lore.getFirst().equals(plugin.getLanguage().getString("SET_OFF"))); if (bool) { // check power ResultSetArtronLevel rsal = new ResultSetArtronLevel(plugin, uuid.toString()); @@ -139,9 +138,10 @@ public void onPrefsMenuClick(InventoryClickEvent event) { if (slot == GUIPlayerPreferences.FLIGHT_MODE.getSlot() && im.getDisplayName().equals("Flight Mode")) { List lore = im.getLore(); // cycle through flight modes - FlightMode flight = FlightMode.valueOf(lore.get(0)); + FlightMode flight = FlightMode.valueOf(lore.getFirst()); int mode = flight.getMode() + 1; - if (mode > 3) { + int limit = (plugin.getServer().getPlayer(uuid).hasPermission("tardis.fly")) ? 4 : 3; + if (mode > limit) { mode = 1; } lore.set(0, FlightMode.getByMode().get(mode).toString()); @@ -170,11 +170,11 @@ public void onPrefsMenuClick(InventoryClickEvent event) { if (slot == GUIPlayerPreferences.HANDBRAKE.getSlot() && im.getDisplayName().equals("Handbrake")) { // you can only set it to ON! List lore = im.getLore(); - if (lore.get(0).equals(plugin.getLanguage().getString("SET_OFF"))) { + if (lore.getFirst().equals(plugin.getLanguage().getString("SET_OFF"))) { // get this player's TARDIS ResultSetTardisID rs = new ResultSetTardisID(plugin); if (rs.fromUUID(uuid.toString())) { - int id = rs.getTardis_id(); + int id = rs.getTardisId(); // must not be in the vortex or materialising if (!plugin.getTrackerKeeper().getMaterialising().contains(id) && !plugin.getTrackerKeeper().getInVortex().contains(id)) { // set the handbrake to ON @@ -200,13 +200,10 @@ public void onPrefsMenuClick(InventoryClickEvent event) { if (plugin.getTrackerKeeper().getHasRandomised().contains(id)) { plugin.getTrackerKeeper().getHasRandomised().removeAll(Collections.singleton(id)); } - TARDISCircuitChecker tcc = null; - if (!plugin.getDifficulty().equals(Difficulty.EASY) && !plugin.getUtils().inGracePeriod(p, true)) { - tcc = new TARDISCircuitChecker(plugin, id); - tcc.getCircuits(); - } // damage the circuit if configured - if (tcc != null && plugin.getConfig().getBoolean("circuits.damage") && plugin.getConfig().getInt("circuits.uses.materialisation") > 0) { + if (plugin.getConfig().getBoolean("circuits.damage") && plugin.getConfig().getInt("circuits.uses.materialisation") > 0) { + TARDISCircuitChecker tcc = new TARDISCircuitChecker(plugin, id); + tcc.getCircuits(); // decrement uses int uses_left = tcc.getMaterialisationUses(); new TARDISCircuitDamager(plugin, DiskCircuit.MATERIALISATION, uses_left, id, p).damage(); @@ -282,6 +279,18 @@ public void onPrefsMenuClick(InventoryClickEvent event) { }, 1L); return; } + if (slot == GUIPlayerPreferences.PARTICLES.getSlot() && im.getDisplayName().equals("Materialisation Particles")) { + // close this gui and load the Particle Preferences + plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> { + Inventory particle_inv = plugin.getServer().createInventory(p, 54, ChatColor.DARK_RED + "Particle Preferences"); + // close inventory + p.closeInventory(); + // open new inventory + particle_inv.setContents(new TARDISParticleInventory(plugin, uuid.toString()).getGUI()); + p.openInventory(particle_inv); + }, 1L); + return; + } if (slot == GUIPlayerPreferences.ADMIN_MENU.getSlot() && im.getDisplayName().equals("Admin Config Menu")) { // close this gui and load the Admin Menu plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> { @@ -292,12 +301,12 @@ public void onPrefsMenuClick(InventoryClickEvent event) { return; } List lore = im.getLore(); - boolean bool = (lore.get(0).equals(plugin.getLanguage().getString("SET_ON"))); + boolean bool = (lore.getFirst().equals(plugin.getLanguage().getString("SET_ON"))); String value = (bool) ? plugin.getLanguage().getString("SET_OFF") : plugin.getLanguage().getString("SET_ON"); int b = (bool) ? 0 : 1; switch (im.getDisplayName()) { case "Junk TARDIS" -> { - // must be outside of the TARDIS + // must be on the outside of the TARDIS HashMap wheret = new HashMap<>(); wheret.put("uuid", uuid); ResultSetTravellers rst = new ResultSetTravellers(plugin, wheret, false); @@ -403,7 +412,7 @@ public void onPrefsMenuClick(InventoryClickEvent event) { HashMap where = new HashMap<>(); where.put("uuid", uuid.toString()); if (im.getDisplayName().equals("HADS Type")) { - value = (lore.get(0).equals("DISPLACEMENT")) ? "DISPERSAL" : "DISPLACEMENT"; + value = (lore.getFirst().equals("DISPLACEMENT")) ? "DISPERSAL" : "DISPLACEMENT"; set.put("hads_type", value); } else { set.put(lookup.get(im.getDisplayName()), b); @@ -420,7 +429,7 @@ public void onPrefsMenuClick(InventoryClickEvent event) { // get tardis id ResultSetTardisID rsi = new ResultSetTardisID(plugin); if (rsi.fromUUID(uuid.toString())) { - new TARDISBeaconToggler(plugin).flickSwitch(uuid, rsi.getTardis_id(), !bool); + new TARDISBeaconToggler(plugin).flickSwitch(uuid, rsi.getTardisId(), !bool); } } } diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/preferences/TARDISPrefsTabComplete.java b/src/main/java/me/eccentric_nz/TARDIS/commands/preferences/TARDISPrefsTabComplete.java index f357d53419..de30682069 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/preferences/TARDISPrefsTabComplete.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/preferences/TARDISPrefsTabComplete.java @@ -20,6 +20,8 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.commands.TARDISCompleter; import me.eccentric_nz.TARDIS.enumeration.TardisLight; +import me.eccentric_nz.TARDIS.particles.ParticleEffect; +import me.eccentric_nz.TARDIS.particles.ParticleShape; import me.eccentric_nz.TARDIS.rooms.TARDISWalls; import me.eccentric_nz.TARDIS.universaltranslator.Language; import org.bukkit.Material; @@ -36,7 +38,8 @@ public class TARDISPrefsTabComplete extends TARDISCompleter implements TabCompleter { private final ImmutableList ROOT_SUBS = TARDISPrefsCommands.getRootArgs(); - private final ImmutableList DIFF_SUBS = ImmutableList.of("easy", "hard"); + private final List EFFECT_SUBS = new ArrayList<>(); + private final List SHAPE_SUBS = new ArrayList<>(); private final ImmutableList ONOFF_SUBS = ImmutableList.of("on", "off"); private final ImmutableList HADS_SUBS = ImmutableList.of("DISPLACEMENT", "DISPERSAL"); private final ImmutableList HUM_SUBS = ImmutableList.of("alien", "atmosphere", "computer", "copper", "coral", "galaxy", "learning", "mind", "neon", "sleeping", "void", "random"); @@ -67,6 +70,12 @@ public TARDISPrefsTabComplete(TARDIS plugin) { } KEY_SUBS = ImmutableList.copyOf(keys); } + for (ParticleEffect e : ParticleEffect.values()) { + EFFECT_SUBS.add(e.toString()); + } + for (ParticleShape s : ParticleShape.values()) { + SHAPE_SUBS.add(s.toString()); + } } @Override @@ -77,26 +86,17 @@ public List onTabComplete(CommandSender sender, Command command, String } else if (args.length == 2) { String sub = args[0]; return switch (sub) { - case "add", "remove" -> - null; // return null to default to online player name matching - case "floor", "wall", "siege_floor", "siege_wall" -> - partial(lastArg, MAT_SUBS); - case "key" -> - partial(lastArg, KEY_SUBS); - case "language", "translate" -> - partial(lastArg, LANGUAGE_SUBS); - case "flight" -> - partial(lastArg, FLIGHT_SUBS); - case "difficulty" -> - partial(lastArg, DIFF_SUBS); - case "hads_type" -> - partial(lastArg, HADS_SUBS); - case "hum" -> - partial(lastArg, HUM_SUBS); - case "lights" -> - partial(lastArg, LIGHT_SUBS); - default -> - partial(lastArg, ONOFF_SUBS); + case "add", "remove" -> null; // return null to default to online player name matching + case "floor", "wall", "siege_floor", "siege_wall" -> partial(lastArg, MAT_SUBS); + case "key" -> partial(lastArg, KEY_SUBS); + case "language", "translate" -> partial(lastArg, LANGUAGE_SUBS); + case "flight" -> partial(lastArg, FLIGHT_SUBS); + case "hads_type" -> partial(lastArg, HADS_SUBS); + case "hum" -> partial(lastArg, HUM_SUBS); + case "lights" -> partial(lastArg, LIGHT_SUBS); + case "effect" -> partial(lastArg, EFFECT_SUBS); + case "shape" -> partial(lastArg, SHAPE_SUBS); + default -> partial(lastArg, ONOFF_SUBS); }; } else if (args.length == 3 && args[0].equalsIgnoreCase("translate")) { return partial(lastArg, LANGUAGE_SUBS); diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/preferences/TARDISSetDifficultyCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/preferences/TARDISSetDifficultyCommand.java deleted file mode 100644 index a8a8112c84..0000000000 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/preferences/TARDISSetDifficultyCommand.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2024 eccentric_nz - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package me.eccentric_nz.TARDIS.commands.preferences; - -import java.util.HashMap; -import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; -import me.eccentric_nz.TARDIS.enumeration.TardisModule; -import org.bukkit.entity.Player; - -/** - * @author eccentric_nz - */ -class TARDISSetDifficultyCommand { - - private final TARDIS plugin; - - TARDISSetDifficultyCommand(TARDIS plugin) { - this.plugin = plugin; - } - - boolean setDiff(Player player, String[] args) { - if (!plugin.getConfig().getBoolean("allow.player_difficulty")) { - plugin.getMessenger().send(player, TardisModule.TARDIS, "CMD_DISABLED"); - return true; - } - if (!TARDISPermission.hasPermission(player, "tardis.difficulty")) { - plugin.getMessenger().send(player, TardisModule.TARDIS, "NO_PERMS"); - return true; - } - if (args.length < 2) { - plugin.getMessenger().send(player, TardisModule.TARDIS, "TOO_FEW_ARGS"); - return false; - } - if (!args[1].equalsIgnoreCase("easy") && !args[1].equalsIgnoreCase("hard")) { - plugin.getMessenger().send(player, TardisModule.TARDIS, "ARG_DIFF"); - return true; - } - int diff = (args[1].equalsIgnoreCase("easy")) ? 1 : 0; - HashMap set = new HashMap<>(); - set.put("difficulty", diff); - HashMap where = new HashMap<>(); - where.put("uuid", player.getUniqueId().toString()); - plugin.getQueryFactory().doUpdate("player_prefs", set, where); - plugin.getMessenger().send(player, TardisModule.TARDIS, "DIFF_SAVED"); - return true; - } -} diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/preferences/TARDISSetFlightCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/preferences/TARDISSetFlightCommand.java index c57ac09ba7..2de11b9eb4 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/preferences/TARDISSetFlightCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/preferences/TARDISSetFlightCommand.java @@ -59,7 +59,7 @@ boolean setMode(Player player, String[] args) { setf.put("flying_mode", mode); HashMap where = new HashMap<>(); where.put("uuid", player.getUniqueId().toString()); - TARDIS.plugin.getQueryFactory().doUpdate("player_prefs", setf, where); + plugin.getQueryFactory().doUpdate("player_prefs", setf, where); plugin.getMessenger().send(player, TardisModule.TARDIS, "FLIGHT_SAVED"); return true; } diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/preferences/TARDISToggleOnOffCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/preferences/TARDISToggleOnOffCommand.java index 87b3a52fdf..20d9ebcee7 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/preferences/TARDISToggleOnOffCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/preferences/TARDISToggleOnOffCommand.java @@ -37,7 +37,7 @@ class TARDISToggleOnOffCommand { TARDISToggleOnOffCommand(TARDIS plugin) { this.plugin = plugin; - was = Arrays.asList("announce_repeaters", "auto", "auto_powerup", "auto_siege", "beacon", "build", "difficulty", "dnd", "eps", "farm", "hads", "info", "lock_containers", "minecart", "renderer", "submarine", "travelbar", "telepathy"); + was = Arrays.asList("announce_repeaters", "auto", "auto_powerup", "auto_siege", "beacon", "build", "dnd", "eps", "farm", "hads", "info", "lock_containers", "minecart", "renderer", "submarine", "travelbar", "telepathy"); } public boolean toggle(Player player, String[] args) { @@ -79,7 +79,7 @@ public boolean toggle(Player player, String[] args) { // get tardis id ResultSetTardisID rsi = new ResultSetTardisID(plugin); if (rsi.fromUUID(uuid.toString())) { - new TARDISBeaconToggler(plugin).flickSwitch(uuid, rsi.getTardis_id(), true); + new TARDISBeaconToggler(plugin).flickSwitch(uuid, rsi.getTardisId(), true); } } } @@ -96,7 +96,7 @@ public boolean toggle(Player player, String[] args) { // get tardis id ResultSetTardisID rsi = new ResultSetTardisID(plugin); if (rsi.fromUUID(uuid.toString())) { - new TARDISBeaconToggler(plugin).flickSwitch(uuid, rsi.getTardis_id(), false); + new TARDISBeaconToggler(plugin).flickSwitch(uuid, rsi.getTardisId(), false); } } } diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/remote/TARDISRemoteCommands.java b/src/main/java/me/eccentric_nz/TARDIS/commands/remote/TARDISRemoteCommands.java index 3f7cc099c0..70326d627a 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/remote/TARDISRemoteCommands.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/remote/TARDISRemoteCommands.java @@ -19,6 +19,7 @@ import com.google.common.collect.ImmutableList; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.advanced.TARDISCircuitChecker; +import me.eccentric_nz.TARDIS.advanced.TARDISCircuitDamager; import me.eccentric_nz.TARDIS.api.Parameters; import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; import me.eccentric_nz.TARDIS.commands.TARDISCommandHelper; @@ -87,7 +88,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String boolean hidden = tardis.isHidden(); boolean handbrake = tardis.isHandbrakeOn(); int level = tardis.getArtronLevel(); - if (sender instanceof Player && !sender.hasPermission("tardis.admin")) { + if (sender instanceof Player player && !sender.hasPermission("tardis.admin")) { HashMap wheret = new HashMap<>(); wheret.put("uuid", ((Player) sender).getUniqueId().toString()); ResultSetTardis rst = new ResultSetTardis(plugin, wheret, "", false, 0); @@ -106,15 +107,18 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String return true; } // must have circuits - TARDISCircuitChecker tcc = null; - if (!plugin.getDifficulty().equals(Difficulty.EASY)) { - tcc = new TARDISCircuitChecker(plugin, id); - tcc.getCircuits(); - } - if (tcc != null && !tcc.hasMaterialisation()) { + TARDISCircuitChecker tcc = new TARDISCircuitChecker(plugin, id); + tcc.getCircuits(); + if (plugin.getConfig().getBoolean("difficulty.circuits") && !tcc.hasMaterialisation()) { plugin.getMessenger().send(sender, TardisModule.TARDIS, "NO_MAT_CIRCUIT"); return true; } + // damage circuit if configured + if (plugin.getConfig().getBoolean("circuits.damage") && plugin.getConfig().getInt("circuits.uses.materialisation") > 0) { + // decrement uses + int uses_left = tcc.getMaterialisationUses(); + new TARDISCircuitDamager(plugin, DiskCircuit.MATERIALISATION, uses_left, id, player).damage(); + } } // what are we going to do? try { @@ -227,7 +231,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String } if ((sender instanceof Player && !sender.hasPermission("tardis.admin")) || sender instanceof BlockCommandSender) { // must use advanced console if difficulty hard - if (plugin.getDifficulty().equals(Difficulty.HARD)) { + if (plugin.getConfig().getBoolean("difficulty.disks")) { plugin.getMessenger().send(sender, TardisModule.TARDIS, "ADV_AREA"); return true; } diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/sudo/SudoARS.java b/src/main/java/me/eccentric_nz/TARDIS/commands/sudo/SudoARS.java index c7ff3d82c6..5e8a605314 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/sudo/SudoARS.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/sudo/SudoARS.java @@ -19,7 +19,7 @@ import java.util.UUID; import me.eccentric_nz.TARDIS.ARS.TARDISARSInventory; import me.eccentric_nz.TARDIS.TARDIS; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/sudo/SudoDeadlock.java b/src/main/java/me/eccentric_nz/TARDIS/commands/sudo/SudoDeadlock.java index 07688665f7..66d0b28d83 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/sudo/SudoDeadlock.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/sudo/SudoDeadlock.java @@ -16,14 +16,15 @@ */ package me.eccentric_nz.TARDIS.commands.sudo; -import java.util.HashMap; -import java.util.UUID; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.database.resultset.ResultSetDoors; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardisID; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import org.bukkit.command.CommandSender; +import java.util.HashMap; +import java.util.UUID; + class SudoDeadlock { private final TARDIS plugin; @@ -36,7 +37,7 @@ boolean toggleDeadlock(UUID uuid, CommandSender sender) { ResultSetTardisID rs = new ResultSetTardisID(plugin); // does the player have a TARDIS if (rs.fromUUID(uuid.toString())) { - int id = rs.getTardis_id(); + int id = rs.getTardisId(); HashMap wheret = new HashMap<>(); wheret.put("tardis_id", id); ResultSetDoors rsd = new ResultSetDoors(plugin, wheret, false); diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/sudo/SudoHandbrake.java b/src/main/java/me/eccentric_nz/TARDIS/commands/sudo/SudoHandbrake.java index 902c32da5b..bd1d582b70 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/sudo/SudoHandbrake.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/sudo/SudoHandbrake.java @@ -16,13 +16,14 @@ */ package me.eccentric_nz.TARDIS.commands.sudo; -import java.util.UUID; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.commands.tardis.TARDISHandbrakeCommand; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardisID; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import org.bukkit.command.CommandSender; +import java.util.UUID; + public class SudoHandbrake { private final TARDIS plugin; @@ -38,7 +39,7 @@ public boolean toggle(CommandSender sender, String[] args, UUID uuid) { } ResultSetTardisID rs = new ResultSetTardisID(plugin); if (rs.fromUUID(uuid.toString())) { - return new TARDISHandbrakeCommand(plugin).toggle(null, rs.getTardis_id(), args, true); + return new TARDISHandbrakeCommand(plugin).toggle(null, rs.getTardisId(), args, true); } return true; } diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/sudo/TARDISSudoCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/sudo/TARDISSudoCommand.java index d29732af9b..4831336e94 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/sudo/TARDISSudoCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/sudo/TARDISSudoCommand.java @@ -96,7 +96,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String } // does the player have an ARS record yet? HashMap wherer = new HashMap<>(); - wherer.put("tardis_id", rs.getTardis_id()); + wherer.put("tardis_id", rs.getTardisId()); ResultSetARS rsa = new ResultSetARS(plugin, wherer); if (!rsa.resultSet()) { // create default json @@ -130,7 +130,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String Gson gson = new GsonBuilder().disableHtmlEscaping().create(); JsonArray json = JsonParser.parseString(gson.toJson(empty)).getAsJsonArray(); HashMap seta = new HashMap<>(); - seta.put("tardis_id", rs.getTardis_id()); + seta.put("tardis_id", rs.getTardisId()); seta.put("uuid", uuid); seta.put("json", json.toString()); plugin.getQueryFactory().doInsert("ars", seta); @@ -142,10 +142,10 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String return new SudoAssemble(plugin).restore(sender, uuid, offlinePlayer.getName()); } case "back" -> { - return new TARDISRemoteBackCommand(plugin).sendBack(sender, rs.getTardis_id(), offlinePlayer); + return new TARDISRemoteBackCommand(plugin).sendBack(sender, rs.getTardisId(), offlinePlayer); } case "chameleon" -> { - return new SudoChameleon(plugin).setPreset(sender, rs.getTardis_id(), args, offlinePlayer); + return new SudoChameleon(plugin).setPreset(sender, rs.getTardisId(), args, offlinePlayer); } case "clean" -> { return new SudoRepair(plugin, uuid, true).repair(); @@ -163,7 +163,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String } case "desiege" -> { if (offlinePlayer.isOnline()) { - return new SudoDesiege(plugin).restore(sender, uuid, rs.getTardis_id()); + return new SudoDesiege(plugin).restore(sender, uuid, rs.getTardisId()); } else { plugin.getMessenger().send(sender, TardisModule.TARDIS, "NOT_ONLINE"); return true; @@ -173,14 +173,14 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String return new SudoHandbrake(plugin).toggle(sender, args, uuid); } case "hide" -> { - return new TARDISRemoteHideCommand(plugin).doRemoteHide(sender, rs.getTardis_id()); + return new TARDISRemoteHideCommand(plugin).doRemoteHide(sender, rs.getTardisId()); } case "isomorphic" -> { // toggle isomorphic return new TARDISIsomorphicCommand(plugin).toggleIsomorphicControls(uuid, sender); } case "rebuild" -> { - return new TARDISRemoteRebuildCommand(plugin).doRemoteRebuild(sender, rs.getTardis_id(), offlinePlayer, true); + return new TARDISRemoteRebuildCommand(plugin).doRemoteRebuild(sender, rs.getTardisId(), offlinePlayer, true); } case "repair" -> { return new SudoRepair(plugin, uuid, false).repair(); @@ -194,7 +194,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String plugin.getMessenger().send(sender, TardisModule.TARDIS, "CMD_NO_CONSOLE"); return true; } - return new SudoUpdate(plugin).initiate((Player) sender, args, rs.getTardis_id(), uuid); + return new SudoUpdate(plugin).initiate((Player) sender, args, rs.getTardisId(), uuid); } } } diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISARSRemoveCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISARSRemoveCommand.java index b602150089..fa8d5034ce 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISARSRemoveCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISARSRemoveCommand.java @@ -49,7 +49,7 @@ boolean resetARS(Player player) { plugin.getMessenger().send(player, TardisModule.TARDIS, "NOT_A_TIMELORD"); return true; } - int id = rs.getTardis_id(); + int id = rs.getTardisId(); // get the sign location so we can reset the sign text HashMap wheres = new HashMap<>(); wheres.put("tardis_id", id); diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISAddCompanionCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISAddCompanionCommand.java index f2cf6df781..65cb9020c0 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISAddCompanionCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISAddCompanionCommand.java @@ -25,7 +25,7 @@ import me.eccentric_nz.TARDIS.enumeration.Advancement; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.utility.TARDISStaticLocationGetters; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; import org.bukkit.World; diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISCheckLocCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISCheckLocCommand.java index 9303537e5a..ff581ad9c9 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISCheckLocCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISCheckLocCommand.java @@ -16,7 +16,6 @@ */ package me.eccentric_nz.TARDIS.commands.tardis; -import java.util.HashMap; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.database.resultset.ResultSetCurrentLocation; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardisID; @@ -27,6 +26,8 @@ import org.bukkit.Material; import org.bukkit.entity.Player; +import java.util.HashMap; + /** * @author eccentric_nz */ @@ -52,7 +53,7 @@ boolean doACheckLocation(Player player) { return true; } HashMap wherecl = new HashMap<>(); - wherecl.put("tardis_id", rs.getTardis_id()); + wherecl.put("tardis_id", rs.getTardisId()); ResultSetCurrentLocation rsc = new ResultSetCurrentLocation(plugin, wherecl); if (!rsc.resultSet()) { plugin.getMessenger().send(player, TardisModule.TARDIS, "DIRECTION_NOT_FOUND"); diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISComehereCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISComehereCommand.java index ca6167b6cb..2d84913d1e 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISComehereCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISComehereCommand.java @@ -21,13 +21,19 @@ import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; import me.eccentric_nz.TARDIS.builders.BuildData; import me.eccentric_nz.TARDIS.database.data.Tardis; +import me.eccentric_nz.TARDIS.database.data.Throticle; import me.eccentric_nz.TARDIS.database.resultset.ResultSetCurrentLocation; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardis; import me.eccentric_nz.TARDIS.database.resultset.ResultSetThrottle; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTravellers; import me.eccentric_nz.TARDIS.destroyers.DestroyData; -import me.eccentric_nz.TARDIS.enumeration.*; +import me.eccentric_nz.TARDIS.enumeration.COMPASS; +import me.eccentric_nz.TARDIS.enumeration.Flag; +import me.eccentric_nz.TARDIS.enumeration.SpaceTimeThrottle; +import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.travel.TARDISTimeTravel; +import me.eccentric_nz.TARDIS.upgrades.SystemTree; +import me.eccentric_nz.TARDIS.upgrades.SystemUpgradeChecker; import me.eccentric_nz.TARDIS.utility.TARDISStaticUtils; import me.eccentric_nz.TARDIS.utility.protection.TARDISLWCChecker; import nl.rutgerkok.blocklocker.BlockLockerAPIv2; @@ -56,6 +62,10 @@ boolean doComeHere(Player player) { if (TARDISPermission.hasPermission(player, "tardis.timetravel")) { // check they are a timelord UUID uuid = player.getUniqueId(); + if (plugin.getConfig().getBoolean("difficulty.system_upgrades") && !new SystemUpgradeChecker(plugin).has(uuid.toString(), SystemTree.STATTENHEIM_REMOTE)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_NEED", "Stattenheim Remote"); + return true; + } HashMap where = new HashMap<>(); where.put("uuid", uuid.toString()); ResultSetTardis rs = new ResultSetTardis(plugin, where, "", false, 0); @@ -63,7 +73,7 @@ boolean doComeHere(Player player) { plugin.getMessenger().send(player, TardisModule.TARDIS, "NOT_A_TIMELORD"); return true; } - if (plugin.getDifficulty().equals(Difficulty.EASY) || plugin.getUtils().inGracePeriod(player, true)) { + if (!plugin.getConfig().getBoolean("difficulty.stattenheim_remote") || plugin.getUtils().inGracePeriod(player, true)) { Tardis tardis = rs.getTardis(); int id = tardis.getTardisId(); if (plugin.getConfig().getBoolean("allow.power_down") && !tardis.isPoweredOn()) { @@ -154,8 +164,9 @@ boolean doComeHere(Player player) { plugin.getMessenger().send(player, TardisModule.TARDIS, "WOULD_GRIEF_BLOCKS"); return true; } - // get space time throttle - SpaceTimeThrottle spaceTimeThrottle = new ResultSetThrottle(plugin).getSpeed(uuid.toString()); + // get space-time throttle + Throticle throticle = new ResultSetThrottle(plugin).getSpeedAndParticles(uuid.toString()); + SpaceTimeThrottle spaceTimeThrottle = throticle.getThrottle(); int ch = Math.round(plugin.getArtronConfig().getInt("comehere") * spaceTimeThrottle.getArtronMultiplier()); if (level < ch) { plugin.getMessenger().send(player, TardisModule.TARDIS, "NOT_ENOUGH_ENERGY"); @@ -216,6 +227,7 @@ boolean doComeHere(Player player) { dd.setSubmarine(rsc.isSubmarine()); dd.setTardisID(id); dd.setThrottle(spaceTimeThrottle); + dd.setParticles(throticle.getParticles()); plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> { if (!hid) { plugin.getTrackerKeeper().getDematerialising().add(id); @@ -235,6 +247,7 @@ boolean doComeHere(Player player) { bd.setSubmarine(sub); bd.setTardisID(id); bd.setThrottle(spaceTimeThrottle); + bd.setParticles(throticle.getParticles()); plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> plugin.getPresetBuilder().buildPreset(bd), delay * 2); // remove energy from TARDIS HashMap wheret = new HashMap<>(); diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISCommands.java b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISCommands.java index b01fd28799..c1ed160f5d 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISCommands.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISCommands.java @@ -22,11 +22,12 @@ import me.eccentric_nz.TARDIS.commands.TARDISCommandHelper; import me.eccentric_nz.TARDIS.commands.utils.TARDISAcceptor; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardisID; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; import me.eccentric_nz.TARDIS.enumeration.TardisCommand; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.travel.ComehereAction; import me.eccentric_nz.TARDIS.travel.ComehereRequest; +import me.eccentric_nz.TARDIS.upgrades.SystemTree; +import me.eccentric_nz.TARDIS.upgrades.SystemUpgradeChecker; import org.bukkit.Material; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; @@ -108,7 +109,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String plugin.getMessenger().send(player, TardisModule.TARDIS, "NOT_A_TIMELORD"); return true; } - if (plugin.getTrackerKeeper().getInSiegeMode().contains(rs.getTardis_id()) && tc.noSiege()) { + if (plugin.getTrackerKeeper().getInSiegeMode().contains(rs.getTardisId()) && tc.noSiege()) { plugin.getMessenger().send(player, TardisModule.TARDIS, "SIEGE_NO_CMD"); return true; } @@ -133,7 +134,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String return new TARDISARSRemoveCommand(plugin).resetARS(player); } case bell -> { - return new TARDISBellCommand(plugin).toggle(rs.getTardis_id(), player, args); + return new TARDISBellCommand(plugin).toggle(rs.getTardisId(), player, args); } case check_loc -> { return new TARDISCheckLocCommand(plugin).doACheckLocation(player); @@ -178,7 +179,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String return new TARDISFindCommand(plugin).findTARDIS(player); } case handbrake -> { - return new TARDISHandbrakeCommand(plugin).toggle(player, rs.getTardis_id(), args, false); + return new TARDISHandbrakeCommand(plugin).toggle(player, rs.getTardisId(), args, false); } case hide -> { return new TARDISHideCommand(plugin).hide(player); @@ -205,7 +206,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String return new TARDISMakeHerBlueCommand(plugin).show(player); } case monsters -> { - return new TARDISMonstersCommand(plugin).reset(player, rs.getTardis_id(), args); + return new TARDISMonstersCommand(plugin).reset(player, rs.getTardisId(), args); } case namekey -> { return new TARDISNameKeyCommand(plugin).nameKey(player, args); @@ -271,12 +272,16 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String return new TARDISExterminateCommand(plugin).doExterminate(player, messagePlayer); } case save -> { + if (plugin.getConfig().getBoolean("difficulty.system_upgrades") && !new SystemUpgradeChecker(plugin).has(player.getUniqueId().toString(), SystemTree.SAVES)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_NEED", "Saves"); + return true; + } ItemStack itemStack = player.getInventory().getItemInMainHand(); if (itemStack.getType().equals(Material.MUSIC_DISC_FAR)) { return new TARDISDiskWriterCommand(plugin).writeSaveToControlDisk(player, args); } else { - if (!plugin.getDifficulty().equals(Difficulty.EASY) && !plugin.getUtils().inGracePeriod(player, true)) { - if (plugin.getDifficulty().equals(Difficulty.HARD) && heldDiskIsWrong(itemStack, "Save Storage Disk")) { + if (plugin.getConfig().getBoolean("difficulty.disks") && !plugin.getUtils().inGracePeriod(player, true)) { + if (plugin.getConfig().getBoolean("difficulty.disk_in_hand_for_write") && heldDiskIsWrong(itemStack, "Save Storage Disk")) { plugin.getMessenger().send(player, TardisModule.TARDIS, "DISK_HAND_SAVE"); return true; } diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISConstructCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISConstructCommand.java index 4878d7e0df..fd206bab4d 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISConstructCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISConstructCommand.java @@ -16,17 +16,18 @@ */ package me.eccentric_nz.TARDIS.commands.tardis; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.database.resultset.ResultSetConstructSign; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardisID; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.utility.TARDISNumberParsers; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; + /** * @author eccentric_nz */ @@ -49,7 +50,7 @@ public boolean setLine(Player player, String[] args) { plugin.getMessenger().send(player, TardisModule.TARDIS, "NO_TARDIS"); return true; } - int id = rs.getTardis_id(); + int id = rs.getTardisId(); // must have a construct ResultSetConstructSign rscs = new ResultSetConstructSign(plugin, id); if (!rscs.resultSet()) { diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISCubeCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISCubeCommand.java index e5284cc261..f7541e2186 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISCubeCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISCubeCommand.java @@ -16,14 +16,15 @@ */ package me.eccentric_nz.TARDIS.commands.tardis; -import java.util.Map; -import java.util.UUID; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardisID; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import org.bukkit.entity.Player; +import java.util.Map; +import java.util.UUID; + /** * @author eccentric_nz */ @@ -43,7 +44,7 @@ boolean whoHasCube(Player player) { plugin.getMessenger().send(player, TardisModule.TARDIS, "NO_TARDIS"); return true; } - int id = rs.getTardis_id(); + int id = rs.getTardisId(); if (!plugin.getTrackerKeeper().getIsSiegeCube().contains(id)) { plugin.getMessenger().send(player, TardisModule.TARDIS, "SIEGE_NOT_SIEGED"); return true; diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISDirectionCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISDirectionCommand.java index dfe1619029..e7fa191f18 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISDirectionCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISDirectionCommand.java @@ -18,6 +18,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.advanced.TARDISCircuitChecker; +import me.eccentric_nz.TARDIS.advanced.TARDISCircuitDamager; import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; import me.eccentric_nz.TARDIS.builders.BuildData; import me.eccentric_nz.TARDIS.database.data.Tardis; @@ -80,15 +81,18 @@ public boolean changeDirection(Player player, String[] args) { return true; } int id = tardis.getTardisId(); - TARDISCircuitChecker tcc = null; - if (!plugin.getDifficulty().equals(Difficulty.EASY) && !plugin.getUtils().inGracePeriod(player, true)) { - tcc = new TARDISCircuitChecker(plugin, id); - tcc.getCircuits(); - } - if (tcc != null && !tcc.hasMaterialisation()) { + TARDISCircuitChecker tcc = new TARDISCircuitChecker(plugin, id); + tcc.getCircuits(); + if (plugin.getConfig().getBoolean("difficulty.circuits") && !plugin.getUtils().inGracePeriod(player, true) && !tcc.hasMaterialisation()) { plugin.getMessenger().send(player, TardisModule.TARDIS, "NO_MAT_CIRCUIT"); return true; } + // damage circuit if configured + if (plugin.getConfig().getBoolean("circuits.damage") && plugin.getConfig().getInt("circuits.uses.materialisation") > 0) { + // decrement uses + int uses_left = tcc.getMaterialisationUses(); + new TARDISCircuitDamager(plugin, DiskCircuit.MATERIALISATION, uses_left, id, player).damage(); + } int level = tardis.getArtronLevel(); int amount = plugin.getArtronConfig().getInt("random"); if (level < amount) { diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISDoorCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISDoorCommand.java index 9db700080b..735b9e68ee 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISDoorCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISDoorCommand.java @@ -48,7 +48,7 @@ public boolean toggleDoors(Player player, String[] args) { } boolean open = (args[1].equalsIgnoreCase("close")); // toggle the door - new TARDISDoorToggler(plugin, player.getLocation().getBlock(), player, false, open, rs.getTardis_id()).toggleDoors(); + new TARDISDoorToggler(plugin, player.getLocation().getBlock(), player, false, open, rs.getTardisId()).toggleDoors(); return true; } } diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISEjectCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISEjectCommand.java index 424a4824c6..f7d1456c6c 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISEjectCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISEjectCommand.java @@ -16,7 +16,6 @@ */ package me.eccentric_nz.TARDIS.commands.tardis; -import java.util.HashMap; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardisID; @@ -24,6 +23,8 @@ import me.eccentric_nz.TARDIS.enumeration.TardisModule; import org.bukkit.entity.Player; +import java.util.HashMap; + /** * @author eccentric_nz */ @@ -51,7 +52,7 @@ boolean eject(Player player) { plugin.getMessenger().send(player, TardisModule.TARDIS, "NOT_A_TIMELORD"); return false; } - int ownerid = rs.getTardis_id(); + int ownerid = rs.getTardisId(); HashMap wheret = new HashMap<>(); wheret.put("uuid", player.getUniqueId().toString()); ResultSetTravellers rst = new ResultSetTravellers(plugin, wheret, false); diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISExciteCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISExciteCommand.java index 95e24f5985..f3f697c1c2 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISExciteCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISExciteCommand.java @@ -41,7 +41,7 @@ boolean excite(Player player) { // get TARDIS id ResultSetTardisID rs = new ResultSetTardisID(plugin); if (rs.fromUUID(player.getUniqueId().toString())) { - new TARDISAtmosphericExcitation(plugin).excite(rs.getTardis_id(), player); + new TARDISAtmosphericExcitation(plugin).excite(rs.getTardisId(), player); plugin.getTrackerKeeper().getExcitation().add(player.getUniqueId()); return true; } diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISFindCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISFindCommand.java index 7a3418c15b..e7b6eb12a6 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISFindCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISFindCommand.java @@ -18,12 +18,13 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; +import me.eccentric_nz.TARDIS.upgrades.SystemTree; import me.eccentric_nz.TARDIS.database.resultset.ResultSetCurrentLocation; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardisID; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.enumeration.WorldManager; import me.eccentric_nz.TARDIS.planets.TARDISAliasResolver; +import me.eccentric_nz.TARDIS.upgrades.SystemUpgradeChecker; import org.bukkit.entity.Player; import java.util.HashMap; @@ -41,14 +42,18 @@ class TARDISFindCommand { boolean findTARDIS(Player player) { if (TARDISPermission.hasPermission(player, "tardis.find")) { + if (plugin.getConfig().getBoolean("difficulty.system_upgrades") && !new SystemUpgradeChecker(plugin).has(player.getUniqueId().toString(), SystemTree.TARDIS_LOCATOR)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_NEED", "TARDIS Locator"); + return true; + } ResultSetTardisID rs = new ResultSetTardisID(plugin); if (!rs.fromUUID(player.getUniqueId().toString())) { plugin.getMessenger().send(player, TardisModule.TARDIS, "NO_TARDIS"); return true; } - if (plugin.getDifficulty().equals(Difficulty.EASY) || plugin.getUtils().inGracePeriod(player, true)) { + if (!plugin.getConfig().getBoolean("difficulty.tardis_locator") || plugin.getUtils().inGracePeriod(player, true)) { HashMap wherecl = new HashMap<>(); - wherecl.put("tardis_id", rs.getTardis_id()); + wherecl.put("tardis_id", rs.getTardisId()); ResultSetCurrentLocation rsc = new ResultSetCurrentLocation(plugin, wherecl); if (rsc.resultSet()) { String world = TARDISAliasResolver.getWorldAlias(rsc.getWorld()); diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISHideCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISHideCommand.java index 884290bf2b..f48bef9077 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISHideCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISHideCommand.java @@ -18,6 +18,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.advanced.TARDISCircuitChecker; +import me.eccentric_nz.TARDIS.advanced.TARDISCircuitDamager; import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; import me.eccentric_nz.TARDIS.database.data.Tardis; import me.eccentric_nz.TARDIS.database.resultset.ResultSetCurrentLocation; @@ -25,7 +26,7 @@ import me.eccentric_nz.TARDIS.database.resultset.ResultSetTravellers; import me.eccentric_nz.TARDIS.destroyers.DestroyData; import me.eccentric_nz.TARDIS.enumeration.ChameleonPreset; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.DiskCircuit; import me.eccentric_nz.TARDIS.enumeration.SpaceTimeThrottle; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import org.bukkit.Location; @@ -76,15 +77,18 @@ public boolean hide(OfflinePlayer player) { return true; } id = tardis.getTardisId(); - TARDISCircuitChecker tcc = null; - if (!plugin.getDifficulty().equals(Difficulty.EASY) && !plugin.getUtils().inGracePeriod(player.getPlayer(), true)) { - tcc = new TARDISCircuitChecker(plugin, id); - tcc.getCircuits(); - } - if (tcc != null && !tcc.hasMaterialisation()) { + TARDISCircuitChecker tcc = new TARDISCircuitChecker(plugin, id); + tcc.getCircuits(); + if (plugin.getConfig().getBoolean("difficulty.circuits") && !plugin.getUtils().inGracePeriod(player.getPlayer(), true) && !tcc.hasMaterialisation()) { plugin.getMessenger().send(player.getPlayer(), TardisModule.TARDIS, "NO_MAT_CIRCUIT"); return true; } + // damage circuit if configured + if (plugin.getConfig().getBoolean("circuits.damage") && plugin.getConfig().getInt("circuits.uses.telepathic") > 0) { + // decrement uses + int uses_left = tcc.getTelepathicUses(); + new TARDISCircuitDamager(plugin, DiskCircuit.TELEPATHIC, uses_left, id, player.getPlayer()).damage(); + } HashMap wherein = new HashMap<>(); wherein.put("uuid", uuid.toString()); ResultSetTravellers rst = new ResultSetTravellers(plugin, wherein, false); diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISHomeCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISHomeCommand.java index 2ff509783b..b8f7511e47 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISHomeCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISHomeCommand.java @@ -23,7 +23,10 @@ import me.eccentric_nz.TARDIS.database.resultset.ResultSetHomeLocation; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardisID; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTravellers; -import me.eccentric_nz.TARDIS.enumeration.*; +import me.eccentric_nz.TARDIS.enumeration.COMPASS; +import me.eccentric_nz.TARDIS.enumeration.ChameleonPreset; +import me.eccentric_nz.TARDIS.enumeration.Flag; +import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.utility.TARDISStaticUtils; import org.bukkit.Location; import org.bukkit.Material; @@ -50,7 +53,7 @@ boolean setHome(Player player, String[] args) { plugin.getMessenger().send(player, TardisModule.TARDIS, "NOT_A_TIMELORD"); return false; } - int id = rs.getTardis_id(); + int id = rs.getTardisId(); if (args.length == 3 && args[1].equalsIgnoreCase("set")) { // set the PRESET for the home location String which; @@ -101,7 +104,7 @@ boolean setHome(Player player, String[] args) { return true; } TARDISCircuitChecker tcc = null; - if (!plugin.getDifficulty().equals(Difficulty.EASY) && !plugin.getUtils().inGracePeriod(player, false)) { + if (plugin.getConfig().getBoolean("difficulty.circuits") && !plugin.getUtils().inGracePeriod(player, false)) { tcc = new TARDISCircuitChecker(plugin, id); tcc.getCircuits(); } diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISInsideCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISInsideCommand.java index d63b6c0061..7607dc765d 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISInsideCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISInsideCommand.java @@ -16,15 +16,16 @@ */ package me.eccentric_nz.TARDIS.commands.tardis; -import java.util.HashMap; -import java.util.List; -import java.util.UUID; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardisID; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTravellers; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import org.bukkit.entity.Player; +import java.util.HashMap; +import java.util.List; +import java.util.UUID; + /** * @author eccentric_nz */ @@ -43,7 +44,7 @@ boolean whosInside(Player player) { plugin.getMessenger().send(player, TardisModule.TARDIS, "NOT_A_TIMELORD"); return true; } - int id = rs.getTardis_id(); + int id = rs.getTardisId(); HashMap wheret = new HashMap<>(); wheret.put("tardis_id", id); ResultSetTravellers rst = new ResultSetTravellers(plugin, wheret, true); diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISItemCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISItemCommand.java index 0a6613bdec..170acb83d9 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISItemCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISItemCommand.java @@ -20,7 +20,7 @@ import me.eccentric_nz.TARDIS.enumeration.GlowstoneCircuit; import me.eccentric_nz.TARDIS.enumeration.RecipeItem; import me.eccentric_nz.TARDIS.enumeration.TardisModule; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISJettisonCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISJettisonCommand.java index a2a223f99c..3308c82774 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISJettisonCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISJettisonCommand.java @@ -16,8 +16,6 @@ */ package me.eccentric_nz.TARDIS.commands.tardis; -import java.util.HashMap; -import java.util.Locale; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardisID; @@ -25,6 +23,9 @@ import me.eccentric_nz.TARDIS.enumeration.TardisModule; import org.bukkit.entity.Player; +import java.util.HashMap; +import java.util.Locale; + /** * @author eccentric_nz */ @@ -58,7 +59,7 @@ boolean startJettison(Player player, String[] args) { plugin.getMessenger().send(player, TardisModule.TARDIS, "NOT_A_TIMELORD"); return true; } - int id = rs.getTardis_id(); + int id = rs.getTardisId(); // check they are in the tardis HashMap wheret = new HashMap<>(); wheret.put("uuid", player.getUniqueId().toString()); diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISMakeHerBlueCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISMakeHerBlueCommand.java index f20c3854f4..f8ab499286 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISMakeHerBlueCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISMakeHerBlueCommand.java @@ -18,12 +18,13 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.advanced.TARDISCircuitChecker; +import me.eccentric_nz.TARDIS.advanced.TARDISCircuitDamager; import me.eccentric_nz.TARDIS.builders.BuildData; import me.eccentric_nz.TARDIS.database.data.Tardis; import me.eccentric_nz.TARDIS.database.resultset.ResultSetCurrentLocation; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardis; import me.eccentric_nz.TARDIS.enumeration.ChameleonPreset; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.DiskCircuit; import me.eccentric_nz.TARDIS.enumeration.SpaceTimeThrottle; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import org.bukkit.Location; @@ -76,12 +77,9 @@ public boolean show(Player player) { return true; } int id = tardis.getTardisId(); - TARDISCircuitChecker tcc = null; - if (!plugin.getDifficulty().equals(Difficulty.EASY)) { - tcc = new TARDISCircuitChecker(plugin, id); + TARDISCircuitChecker tcc = new TARDISCircuitChecker(plugin, id); tcc.getCircuits(); - } - if (tcc != null) { + if (plugin.getConfig().getBoolean("difficulty.circuits")) { if (!tcc.hasInvisibility() && !tardis.getPreset().equals(ChameleonPreset.JUNK_MODE)) { plugin.getMessenger().send(player.getPlayer(), TardisModule.TARDIS, "INVISIBILITY_MISSING"); return true; @@ -91,6 +89,19 @@ public boolean show(Player player) { return true; } } + // damage circuits if configured + if (plugin.getConfig().getBoolean("circuits.damage")) { + if (plugin.getConfig().getInt("circuits.uses.invisibility") > 0) { + // decrement uses + int uses_left = tcc.getInvisibilityUses(); + new TARDISCircuitDamager(plugin, DiskCircuit.INVISIBILITY, uses_left, id, player).damage(); + } + if (plugin.getConfig().getInt("circuits.uses.materialisation") > 0) { + // decrement uses + int uses_left = tcc.getMaterialisationUses(); + new TARDISCircuitDamager(plugin, DiskCircuit.MATERIALISATION, uses_left, id, player).damage(); + } + } if (plugin.getTrackerKeeper().getDestinationVortex().containsKey(id)) { plugin.getMessenger().send(player.getPlayer(), TardisModule.TARDIS, "NOT_IN_VORTEX"); return true; diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISOccupyCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISOccupyCommand.java index cafcb06860..9a6dc248e2 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISOccupyCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISOccupyCommand.java @@ -16,16 +16,17 @@ */ package me.eccentric_nz.TARDIS.commands.tardis; -import java.util.HashMap; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; import me.eccentric_nz.TARDIS.builders.TARDISInteriorPostioning; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardisID; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTravellers; import me.eccentric_nz.TARDIS.enumeration.TardisModule; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; +import java.util.HashMap; + /** * @author eccentric_nz */ @@ -67,7 +68,7 @@ boolean toggleOccupancy(Player player) { plugin.getMessenger().send(player, TardisModule.TARDIS, "NOT_A_TIMELORD"); return false; } - int id = rsid.getTardis_id(); + int id = rsid.getTardisId(); HashMap wherei = new HashMap<>(); wherei.put("tardis_id", id); wherei.put("uuid", player.getUniqueId().toString()); diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISRebuildCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISRebuildCommand.java index 3e026aa991..013a371d34 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISRebuildCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISRebuildCommand.java @@ -18,6 +18,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.advanced.TARDISCircuitChecker; +import me.eccentric_nz.TARDIS.advanced.TARDISCircuitDamager; import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; import me.eccentric_nz.TARDIS.builders.BuildData; import me.eccentric_nz.TARDIS.database.data.Tardis; @@ -25,7 +26,7 @@ import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardis; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTravellers; import me.eccentric_nz.TARDIS.enumeration.ChameleonPreset; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.DiskCircuit; import me.eccentric_nz.TARDIS.enumeration.SpaceTimeThrottle; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import org.bukkit.Location; @@ -74,15 +75,18 @@ public boolean rebuildPreset(OfflinePlayer player) { return true; } int id = tardis.getTardisId(); - TARDISCircuitChecker tcc = null; - if (!plugin.getDifficulty().equals(Difficulty.EASY) && !plugin.getUtils().inGracePeriod(player.getPlayer(), true)) { - tcc = new TARDISCircuitChecker(plugin, id); - tcc.getCircuits(); - } - if (tcc != null && !tcc.hasMaterialisation()) { + TARDISCircuitChecker tcc = new TARDISCircuitChecker(plugin, id); + tcc.getCircuits(); + if (plugin.getConfig().getBoolean("difficulty.circuits") && !plugin.getUtils().inGracePeriod(player.getPlayer(), true) && !tcc.hasMaterialisation()) { plugin.getMessenger().send(player.getPlayer(), TardisModule.TARDIS, "NO_MAT_CIRCUIT"); return true; } + // damage circuit if configured + if (plugin.getConfig().getBoolean("circuits.damage") && plugin.getConfig().getInt("circuits.uses.materialisation") > 0) { + // decrement uses + int uses_left = tcc.getMaterialisationUses(); + new TARDISCircuitDamager(plugin, DiskCircuit.MATERIALISATION, uses_left, id, player.getPlayer()).damage(); + } HashMap wherein = new HashMap<>(); wherein.put("uuid", uuid.toString()); ResultSetTravellers rst = new ResultSetTravellers(plugin, wherein, false); diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISRemoveSavedLocationCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISRemoveSavedLocationCommand.java index d5c68243b4..ef01dcd1b3 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISRemoveSavedLocationCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISRemoveSavedLocationCommand.java @@ -16,7 +16,6 @@ */ package me.eccentric_nz.TARDIS.commands.tardis; -import java.util.HashMap; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; import me.eccentric_nz.TARDIS.database.resultset.ResultSetDestinations; @@ -24,6 +23,8 @@ import me.eccentric_nz.TARDIS.enumeration.TardisModule; import org.bukkit.entity.Player; +import java.util.HashMap; + /** * @author eccentric_nz */ @@ -46,7 +47,7 @@ boolean doRemoveSave(Player player, String[] args) { plugin.getMessenger().send(player, TardisModule.TARDIS, "NO_TARDIS"); return false; } - int id = rs.getTardis_id(); + int id = rs.getTardisId(); HashMap whered = new HashMap<>(); whered.put("dest_name", args[1]); whered.put("tardis_id", id); diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISRenameSavedLocationCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISRenameSavedLocationCommand.java index 5aa0b6f13d..65ea3af356 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISRenameSavedLocationCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISRenameSavedLocationCommand.java @@ -49,7 +49,7 @@ boolean doRenameSave(Player player, String[] args) { plugin.getMessenger().send(player, TardisModule.TARDIS, "NO_TARDIS"); return false; } - int id = rs.getTardis_id(); + int id = rs.getTardisId(); HashMap whered = new HashMap<>(); whered.put("dest_name", args[1]); whered.put("tardis_id", id); diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISReorderSavedLocationCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISReorderSavedLocationCommand.java index 7954454ca0..353bb505a2 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISReorderSavedLocationCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISReorderSavedLocationCommand.java @@ -16,7 +16,6 @@ */ package me.eccentric_nz.TARDIS.commands.tardis; -import java.util.HashMap; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; import me.eccentric_nz.TARDIS.database.resultset.ResultSetDestinations; @@ -25,6 +24,8 @@ import me.eccentric_nz.TARDIS.utility.TARDISNumberParsers; import org.bukkit.entity.Player; +import java.util.HashMap; + /** * @author eccentric_nz */ @@ -47,7 +48,7 @@ boolean doReorderSave(Player player, String[] args) { plugin.getMessenger().send(player, TardisModule.TARDIS, "NO_TARDIS"); return false; } - int id = rs.getTardis_id(); + int id = rs.getTardisId(); HashMap whered = new HashMap<>(); whered.put("dest_name", args[1]); whered.put("tardis_id", id); diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISRoomCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISRoomCommand.java index c25b994a5e..81099bcd8b 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISRoomCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISRoomCommand.java @@ -20,14 +20,15 @@ import me.eccentric_nz.TARDIS.advanced.TARDISCircuitChecker; import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; import me.eccentric_nz.TARDIS.builders.TARDISZeroRoomBuilder; +import me.eccentric_nz.TARDIS.upgrades.SystemTree; import me.eccentric_nz.TARDIS.database.data.Tardis; import me.eccentric_nz.TARDIS.database.resultset.*; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; import me.eccentric_nz.TARDIS.enumeration.Schematic; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.messaging.TARDISRoomLister; import me.eccentric_nz.TARDIS.rooms.TARDISCondenserData; import me.eccentric_nz.TARDIS.rooms.TARDISSeedData; +import me.eccentric_nz.TARDIS.upgrades.SystemUpgradeChecker; import org.bukkit.Material; import org.bukkit.entity.Player; @@ -48,6 +49,11 @@ class TARDISRoomCommand { } boolean startRoom(Player player, String[] args) { + UUID uuid = player.getUniqueId(); + if (plugin.getConfig().getBoolean("difficulty.system_upgrades") && !new SystemUpgradeChecker(plugin).has(uuid.toString(), SystemTree.ROOM_GROWING)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_NEED", "Room Growing"); + return true; + } if (args.length < 2) { plugin.getMessenger().send(player, TardisModule.TARDIS, "TOO_FEW_ARGS"); return false; @@ -62,7 +68,6 @@ boolean startRoom(Player player, String[] args) { plugin.getMessenger().send(player, TardisModule.TARDIS, "NO_PERM_ROOM_TYPE"); return true; } - UUID uuid = player.getUniqueId(); HashMap where = new HashMap<>(); where.put("uuid", uuid.toString()); ResultSetTardis rs = new ResultSetTardis(plugin, where, "", false, 0); @@ -85,7 +90,7 @@ boolean startRoom(Player player, String[] args) { } int id = tardis.getTardisId(); TARDISCircuitChecker tcc = null; - if (!plugin.getDifficulty().equals(Difficulty.EASY) && !plugin.getUtils().inGracePeriod(player, true)) { + if (plugin.getConfig().getBoolean("difficulty.circuits") && !plugin.getUtils().inGracePeriod(player, true)) { tcc = new TARDISCircuitChecker(plugin, id); tcc.getCircuits(); } diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISSaveIconCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISSaveIconCommand.java index 7d27cfaef1..960cd3faf2 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISSaveIconCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISSaveIconCommand.java @@ -77,7 +77,7 @@ public boolean changeIcon(CommandSender sender, String[] args) { plugin.getMessenger().send(player, TardisModule.TARDIS, "NO_TARDIS"); return false; } - int id = rs.getTardis_id(); + int id = rs.getTardisId(); HashMap whered = new HashMap<>(); whered.put("dest_name", args[1]); whered.put("tardis_id", id); diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISSaveLocationCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISSaveLocationCommand.java index d26062a01b..6e2f338dd6 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISSaveLocationCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISSaveLocationCommand.java @@ -17,6 +17,7 @@ package me.eccentric_nz.TARDIS.commands.tardis; import me.eccentric_nz.TARDIS.TARDIS; +import me.eccentric_nz.TARDIS.advanced.TARDISCircuitChecker; import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; import me.eccentric_nz.TARDIS.database.resultset.ResultSetCurrentLocation; import me.eccentric_nz.TARDIS.database.resultset.ResultSetDestinations; @@ -60,6 +61,16 @@ boolean doSave(Player player, String[] args) { return false; } else { int id = rs.getTardis().getTardisId(); + // check for memory circuit + TARDISCircuitChecker tcc = null; + if (plugin.getConfig().getBoolean("difficulty.circuits") && !plugin.getUtils().inGracePeriod(player, false)) { + tcc = new TARDISCircuitChecker(plugin, id); + tcc.getCircuits(); + } + if (tcc != null && !tcc.hasMemory()) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "NO_MEM_CIRCUIT"); + return true; + } // check has unique name HashMap wherename = new HashMap<>(); wherename.put("tardis_id", id); diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISSecondaryCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISSecondaryCommand.java index c4c9d2ca8c..9bfb0360ca 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISSecondaryCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISSecondaryCommand.java @@ -16,8 +16,6 @@ */ package me.eccentric_nz.TARDIS.commands.tardis; -import java.util.HashMap; -import java.util.UUID; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardisID; @@ -27,6 +25,9 @@ import me.eccentric_nz.TARDIS.utility.TARDISStringUtils; import org.bukkit.entity.Player; +import java.util.HashMap; +import java.util.UUID; + /** * @author eccentric_nz */ @@ -51,7 +52,7 @@ boolean startSecondary(Player player, String[] args) { return false; } if (args[1].equalsIgnoreCase("remove")) { - plugin.getTrackerKeeper().getSecondaryRemovers().put(player.getUniqueId(), rs.getTardis_id()); + plugin.getTrackerKeeper().getSecondaryRemovers().put(player.getUniqueId(), rs.getTardisId()); plugin.getMessenger().send(player, TardisModule.TARDIS, "SEC_REMOVE_CLICK_BLOCK"); return true; } diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISSetDestinationCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISSetDestinationCommand.java index f7d3c8f517..f70ed60f3a 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISSetDestinationCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISSetDestinationCommand.java @@ -20,11 +20,12 @@ import me.eccentric_nz.TARDIS.advanced.TARDISCircuitChecker; import me.eccentric_nz.TARDIS.api.Parameters; import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; +import me.eccentric_nz.TARDIS.upgrades.SystemTree; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardisID; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTravellers; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; import me.eccentric_nz.TARDIS.enumeration.Flag; import me.eccentric_nz.TARDIS.enumeration.TardisModule; +import me.eccentric_nz.TARDIS.upgrades.SystemUpgradeChecker; import org.bukkit.Location; import org.bukkit.block.Block; import org.bukkit.entity.Player; @@ -46,10 +47,15 @@ class TARDISSetDestinationCommand { boolean doSetDestination(Player player, String[] args) { if (TARDISPermission.hasPermission(player, "tardis.save")) { + String uuid = player.getUniqueId().toString(); ResultSetTardisID rs = new ResultSetTardisID(plugin); - if (!rs.fromUUID(player.getUniqueId().toString())) { + if (!rs.fromUUID(uuid)) { plugin.getMessenger().send(player, TardisModule.TARDIS, "NO_TARDIS"); - return false; + return true; + } + if (plugin.getConfig().getBoolean("difficulty.system_upgrades") && !new SystemUpgradeChecker(plugin).has(uuid, SystemTree.SAVES)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_NEED", "Saves"); + return true; } if (args.length < 2) { plugin.getMessenger().send(player, TardisModule.TARDIS, "TOO_FEW_ARGS"); @@ -62,9 +68,9 @@ boolean doSetDestination(Player player, String[] args) { plugin.getMessenger().sendColouredCommand(player, "SAVE_RESERVED", "/tardis home", plugin); return false; } else { - int id = rs.getTardis_id(); + int id = rs.getTardisId(); TARDISCircuitChecker tcc = null; - if (!plugin.getDifficulty().equals(Difficulty.EASY) && !plugin.getUtils().inGracePeriod(player, true)) { + if (plugin.getConfig().getBoolean("difficulty.circuits") && !plugin.getUtils().inGracePeriod(player, true)) { tcc = new TARDISCircuitChecker(plugin, id); tcc.getCircuits(); } @@ -74,7 +80,7 @@ boolean doSetDestination(Player player, String[] args) { } // check they are not in the tardis HashMap wherettrav = new HashMap<>(); - wherettrav.put("uuid", player.getUniqueId().toString()); + wherettrav.put("uuid", uuid); wherettrav.put("tardis_id", id); ResultSetTravellers rst = new ResultSetTravellers(plugin, wherettrav, false); if (rst.resultSet()) { diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISTransmatCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISTransmatCommand.java index 0492c95bcd..bf69f639f0 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISTransmatCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISTransmatCommand.java @@ -16,8 +16,6 @@ */ package me.eccentric_nz.TARDIS.commands.tardis; -import java.util.HashMap; -import java.util.regex.Pattern; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; import me.eccentric_nz.TARDIS.database.TARDISBoundTransmatRemoval; @@ -28,6 +26,9 @@ import org.bukkit.Sound; import org.bukkit.entity.Player; +import java.util.HashMap; +import java.util.regex.Pattern; + class TARDISTransmatCommand { private static final Pattern LETTERS_NUMBERS = Pattern.compile("[A-Za-z0-9_]{2,16}"); @@ -60,7 +61,7 @@ boolean teleportOrProcess(Player player, String[] args) { plugin.getMessenger().send(player, TardisModule.TARDIS, "NOT_IN_TARDIS"); return false; } - int id = rs.getTardis_id(); + int id = rs.getTardisId(); int thisid = rst.getTardis_id(); if (thisid != id) { plugin.getMessenger().send(player, TardisModule.TARDIS, "CMD_ONLY_TL"); diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISUpdateCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISUpdateCommand.java index c3e97017a2..496b2b6f9d 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISUpdateCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISUpdateCommand.java @@ -95,7 +95,7 @@ boolean startUpdate(Player player, String[] args) { // get players tardis_id ResultSetTardisID rst = new ResultSetTardisID(plugin); if (rst.fromUUID(player.getUniqueId().toString())) { - int id = rst.getTardis_id(); + int id = rst.getTardisId(); HashMap where = new HashMap<>(); where.put("tardis_id", id); ResultSetARS rsa = new ResultSetARS(plugin, where); diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISUpgradeCommand.java b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISUpgradeCommand.java index eee42ba1f0..98b2592775 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISUpgradeCommand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/tardis/TARDISUpgradeCommand.java @@ -20,19 +20,22 @@ import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; import me.eccentric_nz.TARDIS.builders.TARDISInteriorPostioning; import me.eccentric_nz.TARDIS.builders.TARDISTIPSData; +import me.eccentric_nz.TARDIS.upgrades.SystemTree; import me.eccentric_nz.TARDIS.database.data.Tardis; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardis; import me.eccentric_nz.TARDIS.desktop.TARDISPluginThemeInventory; import me.eccentric_nz.TARDIS.desktop.TARDISUpgradeData; import me.eccentric_nz.TARDIS.enumeration.Schematic; import me.eccentric_nz.TARDIS.enumeration.TardisModule; -import net.md_5.bungee.api.ChatColor; +import me.eccentric_nz.TARDIS.upgrades.SystemUpgradeChecker; +import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import java.util.HashMap; +import java.util.UUID; /** * @author eccentric_nz @@ -50,13 +53,18 @@ boolean openUpgradeGUI(Player player) { plugin.getMessenger().send(player, TardisModule.TARDIS, "NO_PERM_UPGRADE"); return true; } + UUID uuid = player.getUniqueId(); // they must have an existing TARDIS HashMap where = new HashMap<>(); - where.put("uuid", player.getUniqueId().toString()); + where.put("uuid", uuid.toString()); ResultSetTardis rs = new ResultSetTardis(plugin, where, "", false, 0); if (!rs.resultSet()) { plugin.getMessenger().send(player, TardisModule.TARDIS, "NO_TARDIS"); - return false; + return true; + } + if (plugin.getConfig().getBoolean("difficulty.system_upgrades") && !new SystemUpgradeChecker(plugin).has(uuid.toString(), SystemTree.DESKTOP_THEME)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_NEED", "Desktop Theme"); + return true; } Tardis tardis = rs.getTardis(); // console must in a TARDIS world @@ -96,7 +104,7 @@ boolean openUpgradeGUI(Player player) { TARDISUpgradeData tud = new TARDISUpgradeData(); tud.setPrevious(current_console); tud.setLevel(level); - plugin.getTrackerKeeper().getUpgrades().put(player.getUniqueId(), tud); + plugin.getTrackerKeeper().getUpgrades().put(uuid, tud); // open the upgrade menu ItemStack[] consoles = new TARDISPluginThemeInventory(plugin, player, current_console.getPermission(), level).getMenu(); Inventory upg = plugin.getServer().createInventory(player, 54, ChatColor.DARK_RED + "TARDIS Upgrade Menu"); diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/travel/TARDISTravelArea.java b/src/main/java/me/eccentric_nz/TARDIS/commands/travel/TARDISTravelArea.java index 9ca115eede..bf5e6f7cbf 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/travel/TARDISTravelArea.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/travel/TARDISTravelArea.java @@ -16,14 +16,12 @@ */ package me.eccentric_nz.TARDIS.commands.travel; -import java.util.HashMap; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.api.event.TARDISTravelEvent; import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; import me.eccentric_nz.TARDIS.database.resultset.ResultSetAreas; import me.eccentric_nz.TARDIS.database.resultset.ResultSetCurrentLocation; import me.eccentric_nz.TARDIS.enumeration.ChameleonPreset; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.enumeration.TravelType; import me.eccentric_nz.TARDIS.flight.TARDISLand; @@ -31,6 +29,8 @@ import org.bukkit.Location; import org.bukkit.entity.Player; +import java.util.HashMap; + /** * * @author eccentric_nz @@ -55,7 +55,7 @@ public boolean action(Player player, String[] args, int id, ChameleonPreset pres plugin.getMessenger().send(player, TardisModule.TARDIS, "TRAVEL_NO_AREA_PERM", args[1]); return true; } - if (!plugin.getDifficulty().equals(Difficulty.EASY) && !plugin.getUtils().inGracePeriod(player, false)) { + if (plugin.getConfig().getBoolean("difficulty.disks") && !plugin.getUtils().inGracePeriod(player, false)) { plugin.getMessenger().send(player, TardisModule.TARDIS, "ADV_AREA"); return true; } diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/travel/TARDISTravelBiome.java b/src/main/java/me/eccentric_nz/TARDIS/commands/travel/TARDISTravelBiome.java index 6a38ea24f9..8dbabfa154 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/travel/TARDISTravelBiome.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/travel/TARDISTravelBiome.java @@ -18,11 +18,11 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.TARDISConstants; +import me.eccentric_nz.TARDIS.advanced.TARDISCircuitChecker; import me.eccentric_nz.TARDIS.advanced.TARDISSerializeInventory; import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; import me.eccentric_nz.TARDIS.database.resultset.ResultSetCurrentLocation; import me.eccentric_nz.TARDIS.database.resultset.ResultSetDiskStorage; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.listeners.TARDISBiomeReaderListener; import me.eccentric_nz.TARDIS.planets.TARDISAliasResolver; @@ -55,9 +55,18 @@ public boolean action(Player player, String[] args, int id) { plugin.getMessenger().send(player, TardisModule.TARDIS, "TRAVEL_NO_PERM_BIOME"); return true; } + // check for telepathic circuit + if (plugin.getConfig().getBoolean("difficulty.circuits") && !plugin.getUtils().inGracePeriod(player, true)) { + TARDISCircuitChecker tcc = new TARDISCircuitChecker(plugin, id); + tcc.getCircuits(); + if (!tcc.hasTelepathic()) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "NO_TELEPATHIC_CIRCUIT"); + return true; + } + } String upper = args[1].toUpperCase(Locale.ENGLISH); - if (!plugin.getDifficulty().equals(Difficulty.EASY) && !plugin.getUtils().inGracePeriod(player, false) && !upper.equals("LIST")) { - if (plugin.getDifficulty().equals(Difficulty.MEDIUM)) { + if (plugin.getConfig().getBoolean("difficulty.disks") && !plugin.getUtils().inGracePeriod(player, false) && !upper.equals("LIST")) { + if (plugin.getConfig().getBoolean("difficulty.biome_reader")) { // check they have a biome disk in storage boolean hasBiomeDisk = false; UUID uuid = player.getUniqueId(); @@ -76,7 +85,7 @@ public boolean action(Player player, String[] args, int id) { } } } catch (IOException ex) { - plugin.debug("Could not serialize inventory!"); + plugin.debug("Could not deserialize inventory!"); } } if (!hasBiomeDisk) { diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/travel/TARDISTravelCave.java b/src/main/java/me/eccentric_nz/TARDIS/commands/travel/TARDISTravelCave.java index 93170c4e39..98dda26e2c 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/travel/TARDISTravelCave.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/travel/TARDISTravelCave.java @@ -17,6 +17,7 @@ package me.eccentric_nz.TARDIS.commands.travel; import me.eccentric_nz.TARDIS.TARDIS; +import me.eccentric_nz.TARDIS.advanced.TARDISCircuitChecker; import me.eccentric_nz.TARDIS.api.Parameters; import me.eccentric_nz.TARDIS.api.event.TARDISTravelEvent; import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; @@ -47,6 +48,15 @@ public boolean action(Player player, int id) { plugin.getMessenger().send(player, TardisModule.TARDIS, "TRAVEL_NO_PERM_CAVE"); return true; } + // check for telepathic circuit + if (plugin.getConfig().getBoolean("difficulty.circuits") && !plugin.getUtils().inGracePeriod(player, true)) { + TARDISCircuitChecker tcc = new TARDISCircuitChecker(plugin, id); + tcc.getCircuits(); + if (!tcc.hasTelepathic()) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "NO_TELEPATHIC_CIRCUIT"); + return true; + } + } // find a cave Location cave = new TARDISCaveFinder(plugin).searchCave(player, id); if (cave == null) { diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/travel/TARDISTravelCommands.java b/src/main/java/me/eccentric_nz/TARDIS/commands/travel/TARDISTravelCommands.java index 9508cc42a5..161a4be467 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/travel/TARDISTravelCommands.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/travel/TARDISTravelCommands.java @@ -33,8 +33,7 @@ /** * Command /tardistravel [arguments]. *

- * Time travel is the process of travelling through time, even in a non-linear - * direction. + * Time travel is the process of travelling through time, even in a non-linear direction. * * @author eccentric_nz */ @@ -130,8 +129,8 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String case "cave" -> { return new TARDISTravelCave(plugin).action(player, id); } - case "village", "structure" -> { - return new TARDISTravelStructure(plugin).action(player, args, id); + case "village", "structure", "biome" -> { + return new TARDISTravelGUI(plugin).open(player,id, args[0].toLowerCase()); } default -> { return new TARDISTravelPlayer(plugin).action(player, args[0], id); @@ -147,7 +146,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String if (args.length == 2 && (args[1].equals("?") || args[1].equalsIgnoreCase("tpa"))) { return new TARDISTravelAsk(plugin).action(player, args); } - if (args[0].equalsIgnoreCase("biome")) { + if (args.length == 2 && args[0].equalsIgnoreCase("biome")) { // we're thinking this is a biome search return new TARDISTravelBiome(plugin).action(player, args, id); } diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/travel/TARDISTravelGUI.java b/src/main/java/me/eccentric_nz/TARDIS/commands/travel/TARDISTravelGUI.java new file mode 100644 index 0000000000..177040e9fb --- /dev/null +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/travel/TARDISTravelGUI.java @@ -0,0 +1,59 @@ +package me.eccentric_nz.TARDIS.commands.travel; + +import me.eccentric_nz.TARDIS.TARDIS; +import me.eccentric_nz.TARDIS.advanced.TARDISCircuitChecker; +import me.eccentric_nz.TARDIS.console.telepathic.TARDISTelepathicBiome; +import me.eccentric_nz.TARDIS.console.telepathic.TARDISTelepathicStructure; +import me.eccentric_nz.TARDIS.enumeration.TardisModule; +import me.eccentric_nz.TARDIS.floodgate.FloodgateBiomesForm; +import me.eccentric_nz.TARDIS.floodgate.FloodgateStructuresForm; +import me.eccentric_nz.TARDIS.floodgate.TARDISFloodgate; +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.ItemStack; + +public class TARDISTravelGUI { + + private final TARDIS plugin; + + public TARDISTravelGUI(TARDIS plugin) { + this.plugin = plugin; + } + + public boolean open(Player player, int id, String which) { + // check for telepathic circuit + if (plugin.getConfig().getBoolean("difficulty.circuits") && !plugin.getUtils().inGracePeriod(player, true)) { + TARDISCircuitChecker tcc = new TARDISCircuitChecker(plugin, id); + tcc.getCircuits(); + if (!tcc.hasTelepathic()) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "NO_TELEPATHIC_CIRCUIT"); + return true; + } + } + if (which.equals("biome")) { + // open biomes GUI + if (TARDISFloodgate.isFloodgateEnabled() && TARDISFloodgate.isBedrockPlayer(player.getUniqueId())) { + new FloodgateBiomesForm(plugin, player.getUniqueId(), id).send(); + } else { + TARDISTelepathicBiome ttb = new TARDISTelepathicBiome(plugin, id); + ItemStack[] gui = ttb.getButtons(); + Inventory biome = plugin.getServer().createInventory(player, 54, ChatColor.DARK_RED + "Telepathic Biome Finder"); + biome.setContents(gui); + player.openInventory(biome); + } + } else { + // open Structure GUI + if (TARDISFloodgate.isFloodgateEnabled() && TARDISFloodgate.isBedrockPlayer(player.getUniqueId())) { + new FloodgateStructuresForm(plugin, player.getUniqueId(), id).send(); + } else { + TARDISTelepathicStructure tts = new TARDISTelepathicStructure(plugin); + ItemStack[] gui = tts.getButtons(); + Inventory structure = plugin.getServer().createInventory(player, 54, ChatColor.DARK_RED + "Telepathic Structure Finder"); + structure.setContents(gui); + player.openInventory(structure); + } + } + return true; + } +} diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/travel/TARDISTravelPlayer.java b/src/main/java/me/eccentric_nz/TARDIS/commands/travel/TARDISTravelPlayer.java index cf12c51c18..68773c0c14 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/travel/TARDISTravelPlayer.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/travel/TARDISTravelPlayer.java @@ -16,16 +16,16 @@ */ package me.eccentric_nz.TARDIS.commands.travel; -import java.util.HashMap; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; import me.eccentric_nz.TARDIS.database.resultset.ResultSetCurrentLocation; import me.eccentric_nz.TARDIS.database.resultset.ResultSetPlayerPrefs; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.travel.TARDISRescue; import org.bukkit.entity.Player; +import java.util.HashMap; + /** * * @author eccentric_nz @@ -40,7 +40,7 @@ public TARDISTravelPlayer(TARDIS plugin) { public boolean action(Player player, String p, int id) { if (TARDISPermission.hasPermission(player, "tardis.timetravel.player")) { - if (!plugin.getDifficulty().equals(Difficulty.EASY) && !plugin.getUtils().inGracePeriod(player, false)) { + if (plugin.getConfig().getBoolean("difficulty.disks") && !plugin.getUtils().inGracePeriod(player, false)) { plugin.getMessenger().send(player, TardisModule.TARDIS, "ADV_PLAYER"); return true; } diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/travel/TARDISTravelSave.java b/src/main/java/me/eccentric_nz/TARDIS/commands/travel/TARDISTravelSave.java index 1611df1435..4aed33d400 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/travel/TARDISTravelSave.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/travel/TARDISTravelSave.java @@ -17,19 +17,20 @@ package me.eccentric_nz.TARDIS.commands.travel; import me.eccentric_nz.TARDIS.TARDIS; +import me.eccentric_nz.TARDIS.advanced.TARDISCircuitChecker; +import me.eccentric_nz.TARDIS.advanced.TARDISCircuitDamager; import me.eccentric_nz.TARDIS.api.Parameters; import me.eccentric_nz.TARDIS.api.event.TARDISTravelEvent; import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; import me.eccentric_nz.TARDIS.database.resultset.ResultSetCurrentLocation; import me.eccentric_nz.TARDIS.database.resultset.ResultSetDestinations; -import me.eccentric_nz.TARDIS.enumeration.ChameleonPreset; -import me.eccentric_nz.TARDIS.enumeration.Flag; -import me.eccentric_nz.TARDIS.enumeration.TardisModule; -import me.eccentric_nz.TARDIS.enumeration.TravelType; +import me.eccentric_nz.TARDIS.enumeration.*; import me.eccentric_nz.TARDIS.flight.TARDISLand; import me.eccentric_nz.TARDIS.planets.TARDISAliasResolver; import me.eccentric_nz.TARDIS.travel.TARDISAreaCheck; import me.eccentric_nz.TARDIS.travel.TravelCostAndType; +import me.eccentric_nz.TARDIS.upgrades.SystemTree; +import me.eccentric_nz.TARDIS.upgrades.SystemUpgradeChecker; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.entity.Player; @@ -51,6 +52,10 @@ public TARDISTravelSave(TARDIS plugin) { public boolean action(Player player, String[] args, int id, ChameleonPreset preset) { // we're thinking this is a saved destination name if (TARDISPermission.hasPermission(player, "tardis.save")) { + if (plugin.getConfig().getBoolean("difficulty.system_upgrades") && !new SystemUpgradeChecker(plugin).has(player.getUniqueId().toString(), SystemTree.SAVES)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_NEED", "Saves"); + return true; + } HashMap whered = new HashMap<>(); whered.put("dest_name", args[1]); whered.put("tardis_id", id); @@ -59,6 +64,19 @@ public boolean action(Player player, String[] args, int id, ChameleonPreset pres plugin.getMessenger().sendColouredCommand(player, "SAVE_NOT_FOUND", "/tardis list saves", plugin); return true; } + // check for memory circuit + TARDISCircuitChecker tcc = new TARDISCircuitChecker(plugin, id); + tcc.getCircuits(); + if (plugin.getConfig().getBoolean("difficulty.circuits") && !plugin.getUtils().inGracePeriod(player, false) && !tcc.hasMemory()) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "NO_MEM_CIRCUIT"); + return true; + } + // damage circuit if configured + if (plugin.getConfig().getBoolean("circuits.damage") && plugin.getConfig().getInt("circuits.uses.memory") > 0) { + // decrement uses + int uses_left = tcc.getMaterialisationUses(); + new TARDISCircuitDamager(plugin, DiskCircuit.MEMORY, uses_left, id, player).damage(); + } World w = TARDISAliasResolver.getWorldFromAlias(rsd.getWorld()); if (w != null) { if (w.getName().startsWith("TARDIS_")) { diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/travel/TARDISTravelStructure.java b/src/main/java/me/eccentric_nz/TARDIS/commands/travel/TARDISTravelStructure.java index bc664d8c06..d09f364806 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/travel/TARDISTravelStructure.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/travel/TARDISTravelStructure.java @@ -16,11 +16,13 @@ */ package me.eccentric_nz.TARDIS.commands.travel; -import java.util.HashMap; import me.eccentric_nz.TARDIS.TARDIS; +import me.eccentric_nz.TARDIS.advanced.TARDISCircuitChecker; +import me.eccentric_nz.TARDIS.advanced.TARDISCircuitDamager; import me.eccentric_nz.TARDIS.api.Parameters; import me.eccentric_nz.TARDIS.api.event.TARDISTravelEvent; import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; +import me.eccentric_nz.TARDIS.enumeration.DiskCircuit; import me.eccentric_nz.TARDIS.enumeration.Flag; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.enumeration.TravelType; @@ -31,8 +33,9 @@ import org.bukkit.Location; import org.bukkit.entity.Player; +import java.util.HashMap; + /** - * * @author eccentric_nz */ public class TARDISTravelStructure { @@ -52,6 +55,19 @@ public boolean action(Player player, String[] args, int id) { plugin.getMessenger().send(player, TardisModule.TARDIS, "TRAVEL_NO_PERM_VILLAGE"); return true; } + TARDISCircuitChecker tcc = new TARDISCircuitChecker(plugin, id); + tcc.getCircuits(); + // check for telepathic circuit + if (plugin.getConfig().getBoolean("difficulty.circuits") && !plugin.getUtils().inGracePeriod(player, true) && !tcc.hasTelepathic()) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "NO_TELEPATHIC_CIRCUIT"); + return true; + } + // damage circuit if configured + if (plugin.getConfig().getBoolean("circuits.damage") && plugin.getConfig().getInt("circuits.uses.telepathic") > 0) { + // decrement uses + int uses_left = tcc.getTelepathicUses(); + new TARDISCircuitDamager(plugin, DiskCircuit.TELEPATHIC, uses_left, id, player).damage(); + } // find a village / nether fortress / end city TARDISStructureLocation randomVillage = new TARDISStructureTravel(plugin).getRandomVillage(player, id, args); if (randomVillage == null) { diff --git a/src/main/java/me/eccentric_nz/TARDIS/commands/utils/TARDISWeatherListener.java b/src/main/java/me/eccentric_nz/TARDIS/commands/utils/TARDISWeatherListener.java index 7ac55414e4..43855fd85d 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/commands/utils/TARDISWeatherListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/commands/utils/TARDISWeatherListener.java @@ -25,7 +25,7 @@ import me.eccentric_nz.TARDIS.database.resultset.ResultSetTravellers; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.inventory.InventoryClickEvent; diff --git a/src/main/java/me/eccentric_nz/TARDIS/companionGUI/TARDISCompanionAddGUIListener.java b/src/main/java/me/eccentric_nz/TARDIS/companionGUI/TARDISCompanionAddGUIListener.java index 4271c98464..3f3982f1de 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/companionGUI/TARDISCompanionAddGUIListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/companionGUI/TARDISCompanionAddGUIListener.java @@ -22,7 +22,7 @@ import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardisCompanions; import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; import me.eccentric_nz.TARDIS.planets.TARDISAliasResolver; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.World; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/src/main/java/me/eccentric_nz/TARDIS/companionGUI/TARDISCompanionGUIListener.java b/src/main/java/me/eccentric_nz/TARDIS/companionGUI/TARDISCompanionGUIListener.java index ec67263c63..fdeea68152 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/companionGUI/TARDISCompanionGUIListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/companionGUI/TARDISCompanionGUIListener.java @@ -21,7 +21,7 @@ import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardis; import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; import me.eccentric_nz.TARDIS.planets.TARDISAliasResolver; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.World; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/src/main/java/me/eccentric_nz/TARDIS/console/ConsoleInteractionListener.java b/src/main/java/me/eccentric_nz/TARDIS/console/ConsoleInteractionListener.java index d9845b274c..7091a99f97 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/console/ConsoleInteractionListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/console/ConsoleInteractionListener.java @@ -51,7 +51,7 @@ public void onConsoleInteractionClick(PlayerInteractAtEntityEvent event) { new RandomiserInteraction(plugin).generateDestination(id, player, interaction); case WAYPOINT_SELECTOR -> new WayPointInteraction(plugin).openSaveGUI(id, player, interaction); case FAST_RETURN -> new FastReturnInteraction(plugin).setBack(id, player, interaction); - case TELEPATHIC_CIRCUIT -> new TelepathicCircuitInteraction(plugin).openGUI(player); + case TELEPATHIC_CIRCUIT -> new TelepathicCircuitInteraction(plugin).process(player); // section three case SONIC_DOCK -> new SonicDockInteraction(plugin).process(player, interaction, id); case DIRECTION -> new DirectionInteraction(plugin).rotate(id, player, interaction); diff --git a/src/main/java/me/eccentric_nz/TARDIS/console/ControlMonitor.java b/src/main/java/me/eccentric_nz/TARDIS/console/ControlMonitor.java index 8b6b4d90cc..f6305d7002 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/console/ControlMonitor.java +++ b/src/main/java/me/eccentric_nz/TARDIS/console/ControlMonitor.java @@ -8,7 +8,7 @@ import me.eccentric_nz.TARDIS.enumeration.WorldManager; import me.eccentric_nz.TARDIS.planets.TARDISAliasResolver; import me.eccentric_nz.TARDIS.utility.TARDISStaticUtils; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Color; import org.bukkit.entity.Display; import org.bukkit.entity.Entity; diff --git a/src/main/java/me/eccentric_nz/TARDIS/console/interaction/FastReturnInteraction.java b/src/main/java/me/eccentric_nz/TARDIS/console/interaction/FastReturnInteraction.java index c3588c9a1a..df66dd7a6c 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/console/interaction/FastReturnInteraction.java +++ b/src/main/java/me/eccentric_nz/TARDIS/console/interaction/FastReturnInteraction.java @@ -6,7 +6,6 @@ import me.eccentric_nz.TARDIS.control.actions.FastReturnAction; import me.eccentric_nz.TARDIS.database.data.Tardis; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardis; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import org.bukkit.entity.Interaction; import org.bukkit.entity.ItemDisplay; @@ -32,7 +31,7 @@ public void setBack(int id, Player player, Interaction interaction) { return; } TARDISCircuitChecker tcc = null; - if (!plugin.getDifficulty().equals(Difficulty.EASY)) { + if (plugin.getConfig().getBoolean("difficulty.circuits")) { tcc = new TARDISCircuitChecker(plugin, id); tcc.getCircuits(); } diff --git a/src/main/java/me/eccentric_nz/TARDIS/console/interaction/FlightModeInteraction.java b/src/main/java/me/eccentric_nz/TARDIS/console/interaction/FlightModeInteraction.java index 7cd4a5217b..08193858b9 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/console/interaction/FlightModeInteraction.java +++ b/src/main/java/me/eccentric_nz/TARDIS/console/interaction/FlightModeInteraction.java @@ -4,6 +4,9 @@ import me.eccentric_nz.TARDIS.console.models.FlightModeModel; import me.eccentric_nz.TARDIS.database.resultset.ResultSetPlayerPrefs; import me.eccentric_nz.TARDIS.enumeration.FlightMode; +import me.eccentric_nz.TARDIS.enumeration.TardisModule; +import me.eccentric_nz.TARDIS.upgrades.SystemTree; +import me.eccentric_nz.TARDIS.upgrades.SystemUpgradeChecker; import me.eccentric_nz.TARDIS.utility.TARDISStringUtils; import org.bukkit.entity.Interaction; import org.bukkit.entity.ItemDisplay; @@ -33,6 +36,11 @@ public void process(Player player, int id, Interaction interaction) { mode = 1; } FlightMode flightMode = FlightMode.getByMode().get(mode); + if (plugin.getConfig().getBoolean("difficulty.system_upgrades") && flightMode == FlightMode.EXTERIOR && !new SystemUpgradeChecker(plugin).has(player.getUniqueId().toString(), SystemTree.EXTERIOR_FLIGHT)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_NEED", "Exterior Flight"); + mode = 1; + flightMode = FlightMode.NORMAL; + } plugin.getMessenger().announceRepeater(player, TARDISStringUtils.capitalise(flightMode.toString())); // update control record HashMap set = new HashMap<>(); diff --git a/src/main/java/me/eccentric_nz/TARDIS/console/interaction/HandbrakeInteraction.java b/src/main/java/me/eccentric_nz/TARDIS/console/interaction/HandbrakeInteraction.java index 211d4c9a48..a425bbceda 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/console/interaction/HandbrakeInteraction.java +++ b/src/main/java/me/eccentric_nz/TARDIS/console/interaction/HandbrakeInteraction.java @@ -10,10 +10,14 @@ import me.eccentric_nz.TARDIS.camera.TARDISCameraTracker; import me.eccentric_nz.TARDIS.console.models.HandbrakeModel; import me.eccentric_nz.TARDIS.database.data.Tardis; +import me.eccentric_nz.TARDIS.database.data.Throticle; import me.eccentric_nz.TARDIS.database.resultset.ResultSetCurrentFromId; import me.eccentric_nz.TARDIS.database.resultset.ResultSetPlayerPrefs; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardis; -import me.eccentric_nz.TARDIS.enumeration.*; +import me.eccentric_nz.TARDIS.database.resultset.ResultSetThrottle; +import me.eccentric_nz.TARDIS.enumeration.ChameleonPreset; +import me.eccentric_nz.TARDIS.enumeration.DiskCircuit; +import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.flight.TARDISExteriorFlight; import me.eccentric_nz.TARDIS.flight.TARDISTakeoff; import me.eccentric_nz.TARDIS.rotors.Rotor; @@ -45,12 +49,9 @@ public void process(int id, int state, Player player, Interaction interaction) { } UUID uuid = player.getUniqueId(); Location handbrake = interaction.getLocation(); - TARDISCircuitChecker tcc = null; - if (!plugin.getDifficulty().equals(Difficulty.EASY) && !plugin.getUtils().inGracePeriod(player, state == 0)) { - tcc = new TARDISCircuitChecker(plugin, id); - tcc.getCircuits(); - } - if (tcc != null && !tcc.hasMaterialisation()) { + TARDISCircuitChecker tcc = new TARDISCircuitChecker(plugin, id); + tcc.getCircuits(); + if (plugin.getConfig().getBoolean("difficulty.circuits") && !tcc.hasMaterialisation() && !plugin.getUtils().inGracePeriod(player, state == 0)) { plugin.getMessenger().send(player, TardisModule.TARDIS, "NO_MAT_CIRCUIT"); return; } @@ -89,11 +90,10 @@ public void process(int id, int state, Player player, Interaction interaction) { ResultSetPlayerPrefs rsp = new ResultSetPlayerPrefs(plugin, uuid.toString()); boolean beac_on = true; boolean bar = false; - SpaceTimeThrottle spaceTimeThrottle = SpaceTimeThrottle.NORMAL; + Throticle throticle = new ResultSetThrottle(plugin).getSpeedAndParticles(uuid.toString()); if (rsp.resultSet()) { beac_on = rsp.isBeaconOn(); bar = rsp.isTravelbarOn(); - spaceTimeThrottle = SpaceTimeThrottle.getByDelay().get(rsp.getThrottle()); } if (state == 1) { if (tardis.isHandbrakeOn()) { @@ -139,7 +139,7 @@ public void process(int id, int state, Player player, Interaction interaction) { new TARDISExteriorFlight(plugin).startFlying(player, id, null, current, beac_on, beacon, preset.equals(ChameleonPreset.PANDORICA)); TARDISSounds.playTARDISSound(handbrake, "tardis_handbrake_release"); } else { - new TARDISTakeoff(plugin).run(id, null, handbrake, player, beac_on, beacon, bar, spaceTimeThrottle); + new TARDISTakeoff(plugin).run(id, null, handbrake, player, beac_on, beacon, bar, throticle); } // start time rotor? if (tardis.getRotor() != null) { @@ -215,7 +215,7 @@ public void process(int id, int state, Player player, Interaction interaction) { // remove energy from TARDIS and set database plugin.getMessenger().sendStatus(player, "HANDBRAKE_ON"); if (plugin.getTrackerKeeper().getHasDestination().containsKey(id)) { - int amount = Math.round(plugin.getTrackerKeeper().getHasDestination().get(id).getCost() * spaceTimeThrottle.getArtronMultiplier()); + int amount = Math.round(plugin.getTrackerKeeper().getHasDestination().get(id).getCost() * throticle.getThrottle().getArtronMultiplier()); HashMap wheret = new HashMap<>(); wheret.put("tardis_id", id); plugin.getQueryFactory().alterEnergyLevel("tardis", -amount, wheret, player); @@ -231,7 +231,7 @@ public void process(int id, int state, Player player, Interaction interaction) { plugin.getTrackerKeeper().getHasRandomised().removeAll(Collections.singleton(id)); } // damage the circuit if configured - if (tcc != null && plugin.getConfig().getBoolean("circuits.damage") && plugin.getConfig().getInt("circuits.uses.materialisation") > 0) { + if (plugin.getConfig().getBoolean("circuits.damage") && plugin.getConfig().getInt("circuits.uses.materialisation") > 0) { // decrement uses int uses_left = tcc.getMaterialisationUses(); new TARDISCircuitDamager(plugin, DiskCircuit.MATERIALISATION, uses_left, id, player).damage(); diff --git a/src/main/java/me/eccentric_nz/TARDIS/console/interaction/HelmicRegulatorInteraction.java b/src/main/java/me/eccentric_nz/TARDIS/console/interaction/HelmicRegulatorInteraction.java index 616dc67a36..7a019b9577 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/console/interaction/HelmicRegulatorInteraction.java +++ b/src/main/java/me/eccentric_nz/TARDIS/console/interaction/HelmicRegulatorInteraction.java @@ -3,6 +3,10 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.console.models.HelmicRegulatorModel; import me.eccentric_nz.TARDIS.database.InteractionStateSaver; +import me.eccentric_nz.TARDIS.enumeration.TardisModule; +import me.eccentric_nz.TARDIS.upgrades.SystemTree; +import me.eccentric_nz.TARDIS.upgrades.SystemUpgradeChecker; +import org.bukkit.World; import org.bukkit.entity.Interaction; import org.bukkit.entity.ItemDisplay; import org.bukkit.entity.Player; @@ -42,11 +46,17 @@ public void selectWorld(int state, int id, Player player, Interaction interactio // get world name which = getWorldFromState(next); } - // show title - plugin.getMessenger().announceRepeater(player, which); if (which.equals("OFF")) { next = 0; + } else if (plugin.getConfig().getBoolean("difficulty.system_upgrades")) { + World world = plugin.getServer().getWorld(which); + if (world != null && (world.getEnvironment() == World.Environment.NETHER || world.getEnvironment() == World.Environment.THE_END) && !new SystemUpgradeChecker(plugin).has(player.getUniqueId().toString(), SystemTree.INTER_DIMENSIONAL_TRAVEL)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_NEED", "Inter Dimensional Travel"); + next = 0; + } } + // show title + plugin.getMessenger().announceRepeater(player, which); // save state new InteractionStateSaver(plugin).write("HELMIC_REGULATOR", next, id); // set custom model data for helmic regulator item display diff --git a/src/main/java/me/eccentric_nz/TARDIS/console/interaction/MultiplierXZInteraction.java b/src/main/java/me/eccentric_nz/TARDIS/console/interaction/MultiplierXZInteraction.java index 10bb47014c..6679cd0ca2 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/console/interaction/MultiplierXZInteraction.java +++ b/src/main/java/me/eccentric_nz/TARDIS/console/interaction/MultiplierXZInteraction.java @@ -4,6 +4,9 @@ import me.eccentric_nz.TARDIS.console.ConsoleInteraction; import me.eccentric_nz.TARDIS.console.models.WXYZModel; import me.eccentric_nz.TARDIS.database.InteractionStateSaver; +import me.eccentric_nz.TARDIS.enumeration.TardisModule; +import me.eccentric_nz.TARDIS.upgrades.SystemTree; +import me.eccentric_nz.TARDIS.upgrades.SystemUpgradeChecker; import org.bukkit.entity.Interaction; import org.bukkit.entity.ItemDisplay; import org.bukkit.entity.Player; @@ -23,21 +26,38 @@ public void setRange(ConsoleInteraction ci, int state, Interaction interaction, return; } int next = state + 1; - if (next > 4) { + boolean missing = false; + if (plugin.getConfig().getBoolean("difficulty.system_upgrades") && ci == ConsoleInteraction.MULTIPLIER) { + if (next == 2 && !new SystemUpgradeChecker(plugin).has(player.getUniqueId().toString(), SystemTree.DISTANCE_1)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_NEED", "Distance 1"); + missing = true; + } + if (next == 3 && !new SystemUpgradeChecker(plugin).has(player.getUniqueId().toString(), SystemTree.DISTANCE_2)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_NEED", "Distance 2"); + missing = true; + } + if (next == 4 && !new SystemUpgradeChecker(plugin).has(player.getUniqueId().toString(), SystemTree.DISTANCE_3)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_NEED", "Distance 3"); + missing = true; + } + } + if (next > 4 || missing) { next = 1; } - // set custom model data for lamp level switch item display - UUID uuid = interaction.getPersistentDataContainer().get(plugin.getModelUuidKey(), plugin.getPersistentDataTypeUUID()); - if (uuid != null) { - ItemDisplay display = (ItemDisplay) plugin.getServer().getEntity(uuid); - int which = switch (ci) { - case X -> 3; - case Z -> 4; - default -> 2; - }; - new WXYZModel().setState(display, plugin, which); + if (!missing) { + // set custom model data for lamp level switch item display + UUID uuid = interaction.getPersistentDataContainer().get(plugin.getModelUuidKey(), plugin.getPersistentDataTypeUUID()); + if (uuid != null) { + ItemDisplay display = (ItemDisplay) plugin.getServer().getEntity(uuid); + int which = switch (ci) { + case X -> 3; + case Z -> 4; + default -> 2; + }; + new WXYZModel().setState(display, plugin, which); + } + new InteractionStateSaver(plugin).write(ci.toString(), next, id); } - new InteractionStateSaver(plugin).write(ci.toString(), next, id); plugin.getMessenger().announceRepeater(player, ci + ": " + next); } } diff --git a/src/main/java/me/eccentric_nz/TARDIS/console/interaction/RandomiserInteraction.java b/src/main/java/me/eccentric_nz/TARDIS/console/interaction/RandomiserInteraction.java index 3770bfc86d..6ddc4be868 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/console/interaction/RandomiserInteraction.java +++ b/src/main/java/me/eccentric_nz/TARDIS/console/interaction/RandomiserInteraction.java @@ -12,7 +12,6 @@ import me.eccentric_nz.TARDIS.database.resultset.ResultSetRandomInteractions; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardis; import me.eccentric_nz.TARDIS.enumeration.COMPASS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.travel.TARDISTimeTravel; import org.bukkit.Location; @@ -42,7 +41,7 @@ public void generateDestination(int id, Player player, Interaction interaction) } // get circuit checker TARDISCircuitChecker tcc = null; - if (!plugin.getDifficulty().equals(Difficulty.EASY)) { + if (plugin.getConfig().getBoolean("difficulty.circuits")) { tcc = new TARDISCircuitChecker(plugin, id); tcc.getCircuits(); } diff --git a/src/main/java/me/eccentric_nz/TARDIS/console/interaction/TelepathicCircuitInteraction.java b/src/main/java/me/eccentric_nz/TARDIS/console/interaction/TelepathicCircuitInteraction.java index 0daf4780da..42a3470c36 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/console/interaction/TelepathicCircuitInteraction.java +++ b/src/main/java/me/eccentric_nz/TARDIS/console/interaction/TelepathicCircuitInteraction.java @@ -2,11 +2,18 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.console.telepathic.TARDISTelepathicInventory; -import net.md_5.bungee.api.ChatColor; +import me.eccentric_nz.TARDIS.database.resultset.ResultSetPlayerPrefs; +import me.eccentric_nz.TARDIS.enumeration.TardisModule; +import me.eccentric_nz.TARDIS.upgrades.SystemTree; +import me.eccentric_nz.TARDIS.upgrades.SystemUpgradeChecker; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; +import java.util.HashMap; +import java.util.UUID; + public class TelepathicCircuitInteraction { private final TARDIS plugin; @@ -15,19 +22,37 @@ public TelepathicCircuitInteraction(TARDIS plugin) { this.plugin = plugin; } - public void openGUI(Player player) { - if (plugin.getTrackerKeeper().getFlight().containsKey(player.getUniqueId())) { + public void process(Player player) { + UUID uuid = player.getUniqueId(); + if (plugin.getTrackerKeeper().getFlight().containsKey(uuid)) { + return; + } + if (plugin.getConfig().getBoolean("difficulty.system_upgrades") && !new SystemUpgradeChecker(plugin).has(uuid.toString(), SystemTree.TELEPATHIC_CIRCUIT)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_NEED", "Telepathic Circuit"); return; } - // open GUI for - // toggling telepathic circuit on/off - // cave finder - // structure finder - // biome finder - TARDISTelepathicInventory tti = new TARDISTelepathicInventory(plugin, player); - ItemStack[] gui = tti.getButtons(); - Inventory telepathic = plugin.getServer().createInventory(player, 54, ChatColor.DARK_RED + "TARDIS Telepathic Circuit"); - telepathic.setContents(gui); - player.openInventory(telepathic); + if (player.isSneaking()) { + // get current telepathic setting + ResultSetPlayerPrefs rsp = new ResultSetPlayerPrefs(plugin, uuid.toString()); + int b = (rsp.resultSet() && rsp.isTelepathyOn()) ? 0 : 1; + // update database + HashMap set = new HashMap<>(); + HashMap whereu = new HashMap<>(); + whereu.put("uuid", uuid.toString()); + set.put("telepathy_on", b); + plugin.getQueryFactory().doUpdate("player_prefs", set, whereu); + plugin.getMessenger().announceRepeater(player, "Telepathic Circuit " + (b == 1 ? "ON" : "OFF")); + } else { + // open GUI for + // toggling telepathic circuit on/off + // cave finder + // structure finder + // biome finder + TARDISTelepathicInventory tti = new TARDISTelepathicInventory(plugin, player); + ItemStack[] gui = tti.getButtons(); + Inventory telepathic = plugin.getServer().createInventory(player, 54, ChatColor.DARK_RED + "TARDIS Telepathic Circuit"); + telepathic.setContents(gui); + player.openInventory(telepathic); + } } } diff --git a/src/main/java/me/eccentric_nz/TARDIS/console/interaction/WayPointInteraction.java b/src/main/java/me/eccentric_nz/TARDIS/console/interaction/WayPointInteraction.java index 988d66cc3c..8b8edf8dc9 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/console/interaction/WayPointInteraction.java +++ b/src/main/java/me/eccentric_nz/TARDIS/console/interaction/WayPointInteraction.java @@ -2,8 +2,11 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.console.models.ButtonModel; +import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.travel.save.TARDISSavesPlanetInventory; -import net.md_5.bungee.api.ChatColor; +import me.eccentric_nz.TARDIS.upgrades.SystemTree; +import me.eccentric_nz.TARDIS.upgrades.SystemUpgradeChecker; +import org.bukkit.ChatColor; import org.bukkit.entity.Interaction; import org.bukkit.entity.ItemDisplay; import org.bukkit.entity.Player; @@ -24,6 +27,10 @@ public void openSaveGUI(int id, Player player, Interaction interaction) { if (plugin.getTrackerKeeper().getFlight().containsKey(player.getUniqueId())) { return; } + if (plugin.getConfig().getBoolean("difficulty.system_upgrades") && !new SystemUpgradeChecker(plugin).has(player.getUniqueId().toString(), SystemTree.SAVES)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_NEED", "Saves"); + return; + } // set custom model data for saves button item display UUID uuid = interaction.getPersistentDataContainer().get(plugin.getModelUuidKey(), plugin.getPersistentDataTypeUUID()); if (uuid != null) { diff --git a/src/main/java/me/eccentric_nz/TARDIS/console/interaction/WorldInteraction.java b/src/main/java/me/eccentric_nz/TARDIS/console/interaction/WorldInteraction.java index d618e208f0..c50bf536e1 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/console/interaction/WorldInteraction.java +++ b/src/main/java/me/eccentric_nz/TARDIS/console/interaction/WorldInteraction.java @@ -4,6 +4,9 @@ import me.eccentric_nz.TARDIS.console.InteractionResponse; import me.eccentric_nz.TARDIS.console.models.WXYZModel; import me.eccentric_nz.TARDIS.database.InteractionStateSaver; +import me.eccentric_nz.TARDIS.enumeration.TardisModule; +import me.eccentric_nz.TARDIS.upgrades.SystemTree; +import me.eccentric_nz.TARDIS.upgrades.SystemUpgradeChecker; import org.bukkit.entity.Interaction; import org.bukkit.entity.ItemDisplay; import org.bukkit.entity.Player; @@ -28,17 +31,24 @@ public void selectWorld(int state, Player player, Interaction interaction, int i NETHER => 3, THE_END => 4 */ + boolean missing = false; int next = state + 1; - if (next > 4) { + if (plugin.getConfig().getBoolean("difficulty.system_upgrades") && (next == 3 || next == 4) && !new SystemUpgradeChecker(plugin).has(player.getUniqueId().toString(), SystemTree.INTER_DIMENSIONAL_TRAVEL)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_NEED", "Inter Dimensional Travel"); + missing = true; + } + if (next > 4 || missing) { next = 1; } - // set custom model data for lamp level switch item display - UUID uuid = interaction.getPersistentDataContainer().get(plugin.getModelUuidKey(), plugin.getPersistentDataTypeUUID()); - if (uuid != null) { - ItemDisplay display = (ItemDisplay) plugin.getServer().getEntity(uuid); - new WXYZModel().setState(display, plugin, 1); + if (!missing) { + // set custom model data for lamp level switch item display + UUID uuid = interaction.getPersistentDataContainer().get(plugin.getModelUuidKey(), plugin.getPersistentDataTypeUUID()); + if (uuid != null) { + ItemDisplay display = (ItemDisplay) plugin.getServer().getEntity(uuid); + new WXYZModel().setState(display, plugin, 1); + } + new InteractionStateSaver(plugin).write("WORLD", next, id); } - new InteractionStateSaver(plugin).write("WORLD", next, id); plugin.getMessenger().announceRepeater(player, InteractionResponse.environment.get(next)); } } diff --git a/src/main/java/me/eccentric_nz/TARDIS/console/telepathic/TARDISTelepathicInventory.java b/src/main/java/me/eccentric_nz/TARDIS/console/telepathic/TARDISTelepathicInventory.java index 1170172221..5bbfb2b342 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/console/telepathic/TARDISTelepathicInventory.java +++ b/src/main/java/me/eccentric_nz/TARDIS/console/telepathic/TARDISTelepathicInventory.java @@ -1,6 +1,7 @@ package me.eccentric_nz.TARDIS.console.telepathic; import me.eccentric_nz.TARDIS.TARDIS; +import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; import me.eccentric_nz.TARDIS.custommodeldata.GUIMap; import me.eccentric_nz.TARDIS.database.resultset.ResultSetPlayerPrefs; import org.bukkit.ChatColor; @@ -36,7 +37,7 @@ public ItemStack[] getButtons() { toggle.setItemMeta(tim); stack[0] = toggle; // cave finder - if (player.hasPermission("tardis.timetravel.cave")) { + if (TARDISPermission.hasPermission(player, "tardis.timetravel.cave")) { ItemStack cave = new ItemStack(Material.DRIPSTONE_BLOCK); ItemMeta cim = cave.getItemMeta(); cim.setDisplayName("Cave Finder"); @@ -45,7 +46,7 @@ public ItemStack[] getButtons() { stack[2] = cave; } // structure finder - if (player.hasPermission("tardis.timetravel.village")) { + if (TARDISPermission.hasPermission(player, "tardis.timetravel.village")) { ItemStack structure = new ItemStack(Material.HAY_BLOCK); ItemMeta sim = structure.getItemMeta(); sim.setDisplayName("Structure Finder"); @@ -54,7 +55,7 @@ public ItemStack[] getButtons() { stack[4] = structure; } // biome finder - if (player.hasPermission("tardis.timetravel.biome")) { + if (TARDISPermission.hasPermission(player, "tardis.timetravel.biome")) { ItemStack biome = new ItemStack(Material.BAMBOO_MOSAIC); ItemMeta bim = biome.getItemMeta(); bim.setDisplayName("Biome Finder"); diff --git a/src/main/java/me/eccentric_nz/TARDIS/console/telepathic/TelepathicBiomeListener.java b/src/main/java/me/eccentric_nz/TARDIS/console/telepathic/TelepathicBiomeListener.java index cf6a3082cb..a3373ad0f9 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/console/telepathic/TelepathicBiomeListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/console/telepathic/TelepathicBiomeListener.java @@ -3,7 +3,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; import me.eccentric_nz.TARDIS.utility.TARDISStringUtils; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.block.Biome; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -21,7 +21,6 @@ public class TelepathicBiomeListener extends TARDISMenuListener { - private final TARDIS plugin; private final HashMap scroll = new HashMap<>(); private final List scrolling = new ArrayList<>(); private final ItemStack[][] biomes; @@ -29,7 +28,6 @@ public class TelepathicBiomeListener extends TARDISMenuListener { public TelepathicBiomeListener(TARDIS plugin) { super(plugin); - this.plugin = plugin; rows = EnvironmentBiomes.OVERWORLD.size() / 8 + 1; biomes = getBiomes(); } diff --git a/src/main/java/me/eccentric_nz/TARDIS/console/telepathic/TelepathicGUIListener.java b/src/main/java/me/eccentric_nz/TARDIS/console/telepathic/TelepathicGUIListener.java index 1f9d434c9a..998c6cb18c 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/console/telepathic/TelepathicGUIListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/console/telepathic/TelepathicGUIListener.java @@ -1,9 +1,11 @@ package me.eccentric_nz.TARDIS.console.telepathic; import me.eccentric_nz.TARDIS.TARDIS; +import me.eccentric_nz.TARDIS.advanced.TARDISCircuitChecker; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTravellers; +import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.inventory.ClickType; @@ -32,62 +34,70 @@ public void onTelepathicMenuClick(InventoryClickEvent event) { return; } Player player = (Player) event.getWhoClicked(); - int slot = event.getRawSlot(); - if (slot < 0 || slot > 53) { - ClickType click = event.getClick(); - if (click.equals(ClickType.SHIFT_RIGHT) || click.equals(ClickType.SHIFT_LEFT) || click.equals(ClickType.DOUBLE_CLICK)) { + // get id of TARDIS player is in + HashMap where = new HashMap<>(); + where.put("uuid", player.getUniqueId().toString()); + ResultSetTravellers rs = new ResultSetTravellers(plugin, where, false); + if (rs.resultSet()) { + // check for telepathic circuit + TARDISCircuitChecker tcc = null; + if (plugin.getConfig().getBoolean("difficulty.circuits") && !plugin.getUtils().inGracePeriod(player, true)) { + tcc = new TARDISCircuitChecker(plugin, rs.getTardis_id()); + tcc.getCircuits(); + } + if (tcc != null && !tcc.hasTelepathic()) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "NO_TELEPATHIC_CIRCUIT"); event.setCancelled(true); + return; } - return; - } - event.setCancelled(true); - ItemStack choice = view.getItem(slot); - switch (slot) { - // toggle telepathy on/off - case 0 -> { - ItemMeta im = choice.getItemMeta(); - int b = (im.hasLore() && im.getLore().get(0).endsWith("ON")) ? 0 : 1; - // update database - HashMap set = new HashMap<>(); - HashMap where = new HashMap<>(); - where.put("uuid", player.getUniqueId().toString()); - set.put("telepathy_on", b); - plugin.getQueryFactory().doUpdate("player_prefs", set, where); - // set item model - int cmd = im.getCustomModelData(); - im.setCustomModelData((cmd > 100) ? cmd - 100 : cmd + 100); - choice.setItemMeta(im); - plugin.getMessenger().announceRepeater(player, "Telepathic Circuit " + (b == 1 ? "ON" : "OFF")); - close(player); + int slot = event.getRawSlot(); + if (slot < 0 || slot > 53) { + ClickType click = event.getClick(); + if (click.equals(ClickType.SHIFT_RIGHT) || click.equals(ClickType.SHIFT_LEFT) || click.equals(ClickType.DOUBLE_CLICK)) { + event.setCancelled(true); + } + return; } - // cave finder - case 2 -> { - if (choice != null) { - player.performCommand("tardistravel cave"); + event.setCancelled(true); + ItemStack choice = view.getItem(slot); + switch (slot) { + // toggle telepathy on/off + case 0 -> { + ItemMeta im = choice.getItemMeta(); + int b = (im.hasLore() && im.getLore().get(0).endsWith("ON")) ? 0 : 1; + // update database + HashMap set = new HashMap<>(); + HashMap whereu = new HashMap<>(); + whereu.put("uuid", player.getUniqueId().toString()); + set.put("telepathy_on", b); + plugin.getQueryFactory().doUpdate("player_prefs", set, whereu); + // set item model + int cmd = im.getCustomModelData(); + im.setCustomModelData((cmd > 100) ? cmd - 100 : cmd + 100); + choice.setItemMeta(im); + plugin.getMessenger().announceRepeater(player, "Telepathic Circuit " + (b == 1 ? "ON" : "OFF")); close(player); } - } - // structure finder - case 4 -> { - if (choice != null) { - if (!plugin.getUtils().inTARDISWorld(player)) { - return; + // cave finder + case 2 -> { + if (choice != null) { + player.performCommand("tardistravel cave"); + close(player); } - TARDISTelepathicStructure tts = new TARDISTelepathicStructure(plugin); - ItemStack[] gui = tts.getButtons(); - Inventory structure = plugin.getServer().createInventory(player, 54, ChatColor.DARK_RED + "Telepathic Structure Finder"); - structure.setContents(gui); - player.openInventory(structure); } - } - // biome finder - case 6 -> { - if (choice != null) { - // get id of TARDIS player is in - HashMap where = new HashMap<>(); - where.put("uuid", player.getUniqueId().toString()); - ResultSetTravellers rs = new ResultSetTravellers(plugin, where, false); - if (rs.resultSet()) { + // structure finder + case 4 -> { + if (choice != null) { + TARDISTelepathicStructure tts = new TARDISTelepathicStructure(plugin); + ItemStack[] gui = tts.getButtons(); + Inventory structure = plugin.getServer().createInventory(player, 54, ChatColor.DARK_RED + "Telepathic Structure Finder"); + structure.setContents(gui); + player.openInventory(structure); + } + } + // biome finder + case 6 -> { + if (choice != null) { TARDISTelepathicBiome ttb = new TARDISTelepathicBiome(plugin, rs.getTardis_id()); ItemStack[] gui = ttb.getButtons(); Inventory biome = plugin.getServer().createInventory(player, 54, ChatColor.DARK_RED + "Telepathic Biome Finder"); @@ -95,11 +105,11 @@ public void onTelepathicMenuClick(InventoryClickEvent event) { player.openInventory(biome); } } - } - // close - case 8 -> close(player); - // do nothing - default -> { + // close + case 8 -> close(player); + // do nothing + default -> { + } } } } diff --git a/src/main/java/me/eccentric_nz/TARDIS/console/telepathic/TelepathicStructureListener.java b/src/main/java/me/eccentric_nz/TARDIS/console/telepathic/TelepathicStructureListener.java index 2631547ba8..149e37b8e2 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/console/telepathic/TelepathicStructureListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/console/telepathic/TelepathicStructureListener.java @@ -1,9 +1,12 @@ package me.eccentric_nz.TARDIS.console.telepathic; import me.eccentric_nz.TARDIS.TARDIS; +import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardisArtron; +import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardisID; +import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; import me.eccentric_nz.TARDIS.utility.TARDISStringUtils; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.inventory.ClickType; @@ -14,12 +17,15 @@ public class TelepathicStructureListener extends TARDISMenuListener { + private final TARDIS plugin; + public TelepathicStructureListener(TARDIS plugin) { super(plugin); + this.plugin = plugin; } @EventHandler(ignoreCancelled = true) - public void onBiomeMenuClick(InventoryClickEvent event) { + public void onStructureMenuClick(InventoryClickEvent event) { InventoryView view = event.getView(); String name = view.getTitle(); if (!name.equals(ChatColor.DARK_RED + "Telepathic Structure Finder")) { @@ -40,6 +46,21 @@ public void onBiomeMenuClick(InventoryClickEvent event) { } else { ItemStack choice = view.getItem(slot); if (choice != null) { + // get TARDIS id + ResultSetTardisID rst = new ResultSetTardisID(plugin); + if (!rst.fromUUID(player.getUniqueId().toString())) { + return; + } + // get tardis artron level + ResultSetTardisArtron rs = new ResultSetTardisArtron(plugin); + if (!rs.fromID(rst.getTardisId())) { + return; + } + int travel = plugin.getArtronConfig().getInt("travel"); + if (rs.getArtronLevel() < travel) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "NOT_ENOUGH_ENERGY"); + return; + } // get the structure ItemMeta im = choice.getItemMeta(); String enumStr = TARDISStringUtils.toEnumUppercase(im.getDisplayName()); diff --git a/src/main/java/me/eccentric_nz/TARDIS/control/TARDISChameleonControl.java b/src/main/java/me/eccentric_nz/TARDIS/control/TARDISChameleonControl.java index f5a9628296..7f3e2b0a57 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/control/TARDISChameleonControl.java +++ b/src/main/java/me/eccentric_nz/TARDIS/control/TARDISChameleonControl.java @@ -21,9 +21,8 @@ import me.eccentric_nz.TARDIS.chameleon.gui.TARDISChameleonInventory; import me.eccentric_nz.TARDIS.enumeration.Adaption; import me.eccentric_nz.TARDIS.enumeration.ChameleonPreset; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; import me.eccentric_nz.TARDIS.enumeration.TardisModule; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; @@ -38,7 +37,7 @@ public TARDISChameleonControl(TARDIS plugin) { public void openGUI(Player player, int id, Adaption adapt, ChameleonPreset preset, String model) { TARDISCircuitChecker tcc = null; - if (!plugin.getDifficulty().equals(Difficulty.EASY) && !plugin.getUtils().inGracePeriod(player, false)) { + if (plugin.getConfig().getBoolean("difficulty.circuits") && !plugin.getUtils().inGracePeriod(player, false)) { tcc = new TARDISCircuitChecker(plugin, id); tcc.getCircuits(); } diff --git a/src/main/java/me/eccentric_nz/TARDIS/control/TARDISControlInventory.java b/src/main/java/me/eccentric_nz/TARDIS/control/TARDISControlInventory.java index 940565e53d..263a277d0c 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/control/TARDISControlInventory.java +++ b/src/main/java/me/eccentric_nz/TARDIS/control/TARDISControlInventory.java @@ -25,12 +25,11 @@ import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardis; import me.eccentric_nz.TARDIS.enumeration.SpaceTimeThrottle; import me.eccentric_nz.TARDIS.move.TARDISBlackWoolToggler; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; -import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -283,6 +282,15 @@ private ItemStack[] getItemStack() { list.setDisplayName(plugin.getLanguage().getString("COMPANIONS_MENU")); list.setCustomModelData(GUIControlCentre.COMPANIONS_MENU.getCustomModelData()); companion.setItemMeta(list); + // system_upgrades + ItemStack system = null; + if (plugin.getConfig().getBoolean("difficulty.system_upgrades")) { + system = new ItemStack(Material.BOWL, 1); + ItemMeta upgrades = system.getItemMeta(); + upgrades.setDisplayName(plugin.getLanguage().getString("SYS_MENU")); + upgrades.setCustomModelData(GUIControlCentre.BUTTON_SYSTEM_UPGRADES.getCustomModelData()); + system.setItemMeta(upgrades); + } // close ItemStack close = new ItemStack(Material.BOWL, 1); ItemMeta can = close.getItemMeta(); @@ -294,7 +302,7 @@ private ItemStack[] getItemStack() { ran, null, ars, null, cham, null, art, null, zero, save, null, upg, null, siege, null, scan, null, player, own, null, pow, null, hide, null, info, null, companion, - fast, null, lig, null, reb, null, tran, null, null, + fast, null, lig, null, reb, null, tran, null, system, area, null, tog, null, dir, null, null, null, null, ter, null, map, null, temp, null, thro, null, close }; diff --git a/src/main/java/me/eccentric_nz/TARDIS/control/TARDISControlListener.java b/src/main/java/me/eccentric_nz/TARDIS/control/TARDISControlListener.java index 34da67d0fd..372d0f6543 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/control/TARDISControlListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/control/TARDISControlListener.java @@ -25,11 +25,12 @@ import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardis; import me.eccentric_nz.TARDIS.enumeration.ChameleonPreset; import me.eccentric_nz.TARDIS.enumeration.Control; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.floodgate.FloodgateSavesForm; import me.eccentric_nz.TARDIS.floodgate.TARDISFloodgate; import me.eccentric_nz.TARDIS.move.TARDISBlackWoolToggler; +import me.eccentric_nz.TARDIS.upgrades.SystemTree; +import me.eccentric_nz.TARDIS.upgrades.SystemUpgradeChecker; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Tag; @@ -150,7 +151,7 @@ public void onControlInteract(PlayerInteractEvent event) { UUID ownerUUID = tardis.getUuid(); UUID playerUUID = player.getUniqueId(); TARDISCircuitChecker tcc = null; - if (!plugin.getDifficulty().equals(Difficulty.EASY)) { + if (plugin.getConfig().getBoolean("difficulty.circuits")) { tcc = new TARDISCircuitChecker(plugin, id); tcc.getCircuits(); } @@ -204,6 +205,10 @@ public void onControlInteract(PlayerInteractEvent event) { case 31 -> new ChameleonSignAction(plugin).openGUI(player, tardis, id); case 32 -> { // save_sign + if (plugin.getConfig().getBoolean("difficulty.system_upgrades") && !new SystemUpgradeChecker(plugin).has(playerUUID.toString(), SystemTree.SAVES)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_NEED", "Saves"); + return; + } if (TARDISFloodgate.isFloodgateEnabled() && TARDISFloodgate.isBedrockPlayer(playerUUID)) { new FloodgateSavesForm(plugin, playerUUID, id).send(); } else { @@ -219,7 +224,7 @@ public void onControlInteract(PlayerInteractEvent event) { // space/time throttle case 39 -> new ThrottleAction(plugin).setSpaceTime(block, player); // relativity differentiator - case 47 -> new DifferentiatorAction(plugin).bleep(block, id); + case 47 -> new DifferentiatorAction(plugin).bleep(block, id, player); default -> { } } diff --git a/src/main/java/me/eccentric_nz/TARDIS/control/TARDISControlMenuListener.java b/src/main/java/me/eccentric_nz/TARDIS/control/TARDISControlMenuListener.java index dea152440b..a6c69ba4d0 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/control/TARDISControlMenuListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/control/TARDISControlMenuListener.java @@ -22,6 +22,7 @@ import me.eccentric_nz.TARDIS.advanced.TARDISCircuitChecker; import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; import me.eccentric_nz.TARDIS.chameleon.gui.TARDISChameleonInventory; +import me.eccentric_nz.TARDIS.commands.dev.SystemTreeCommand; import me.eccentric_nz.TARDIS.commands.preferences.TARDISPrefsMenuInventory; import me.eccentric_nz.TARDIS.commands.tardis.TARDISHideCommand; import me.eccentric_nz.TARDIS.commands.tardis.TARDISRebuildCommand; @@ -37,7 +38,6 @@ import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardisID; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTravellers; import me.eccentric_nz.TARDIS.enumeration.COMPASS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; import me.eccentric_nz.TARDIS.enumeration.SpaceTimeThrottle; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; @@ -48,8 +48,10 @@ import me.eccentric_nz.TARDIS.travel.TARDISTemporalLocatorInventory; import me.eccentric_nz.TARDIS.travel.TARDISTerminalInventory; import me.eccentric_nz.TARDIS.travel.save.TARDISSavesPlanetInventory; +import me.eccentric_nz.TARDIS.upgrades.SystemTree; +import me.eccentric_nz.TARDIS.upgrades.SystemUpgradeChecker; import me.eccentric_nz.TARDIS.utility.TARDISStaticLocationGetters; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -131,7 +133,7 @@ public void onControlMenuInteract(InventoryClickEvent event) { boolean lights = tardis.isLightsOn(); int level = tardis.getArtronLevel(); TARDISCircuitChecker tcc = null; - if (!plugin.getDifficulty().equals(Difficulty.EASY)) { + if (plugin.getConfig().getBoolean("difficulty.circuits")) { tcc = new TARDISCircuitChecker(plugin, id); tcc.getCircuits(); } @@ -152,6 +154,10 @@ public void onControlMenuInteract(InventoryClickEvent event) { } case 2 -> { // ars + if (plugin.getConfig().getBoolean("difficulty.system_upgrades") && !new SystemUpgradeChecker(plugin).has(uuid.toString(), SystemTree.ROOM_GROWING)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_NEED", "Room Growing"); + return; + } if (plugin.getTrackerKeeper().getInSiegeMode().contains(id)) { plugin.getMessenger().send(player, TardisModule.TARDIS, "SIEGE_NO_CONTROL"); return; @@ -177,6 +183,10 @@ public void onControlMenuInteract(InventoryClickEvent event) { } case 4 -> { // chameleon circuit + if (plugin.getConfig().getBoolean("difficulty.system_upgrades") && !new SystemUpgradeChecker(plugin).has(uuid.toString(), SystemTree.CHAMELEON_CIRCUIT)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_NEED", "Chameleon Circuit"); + return; + } if (tcc != null && !tcc.hasChameleon()) { plugin.getMessenger().send(player, TardisModule.TARDIS, "CHAM_MISSING"); return; @@ -226,6 +236,10 @@ public void onControlMenuInteract(InventoryClickEvent event) { } case 9, 18 -> { // saves + if (plugin.getConfig().getBoolean("difficulty.system_upgrades") && !new SystemUpgradeChecker(plugin).has(uuid.toString(), SystemTree.SAVES)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_NEED", "Saves"); + return; + } // 9 = saves for the TARDIS the player is in // 18 = saves for the player's TARDIS (if they're not in their own) // so, determine player's TARDIS id vs occupied TARDIS id @@ -233,7 +247,7 @@ public void onControlMenuInteract(InventoryClickEvent event) { if (slot == 18) { ResultSetTardisID tstid = new ResultSetTardisID(plugin); if (tstid.fromUUID(uuid.toString())) { - int pid = tstid.getTardis_id(); + int pid = tstid.getTardisId(); if (whichId != pid) { whichId = pid; plugin.getTrackerKeeper().getSavesIds().put(uuid, pid); @@ -258,6 +272,10 @@ public void onControlMenuInteract(InventoryClickEvent event) { } case 11 -> { // desktop theme + if (plugin.getConfig().getBoolean("difficulty.system_upgrades") && !new SystemUpgradeChecker(plugin).has(uuid.toString(), SystemTree.DESKTOP_THEME)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_NEED", "Desktop Theme"); + return; + } if (plugin.getTrackerKeeper().getInSiegeMode().contains(id)) { plugin.getMessenger().send(player, TardisModule.TARDIS, "SIEGE_NO_CONTROL"); return; @@ -323,7 +341,6 @@ public void onControlMenuInteract(InventoryClickEvent event) { presetinv.setContents(items); player.openInventory(presetinv); }, 2L); -// plugin.getMessenger().send(player, TardisModule.TARDIS, "COMPANIONS_NONE"); return; } String[] companionData = comps.split(":"); @@ -374,6 +391,7 @@ public void onControlMenuInteract(InventoryClickEvent event) { smat.setContents(tran); player.openInventory(smat); } + case 35 -> new SystemTreeCommand(plugin).open(player); // system upgrades case 36 -> { // areas if (plugin.getTrackerKeeper().getInSiegeMode().contains(id)) { diff --git a/src/main/java/me/eccentric_nz/TARDIS/control/TARDISControlRunnable.java b/src/main/java/me/eccentric_nz/TARDIS/control/TARDISControlRunnable.java index 00654a20b1..7e3fd5489a 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/control/TARDISControlRunnable.java +++ b/src/main/java/me/eccentric_nz/TARDIS/control/TARDISControlRunnable.java @@ -22,7 +22,7 @@ import me.eccentric_nz.TARDIS.enumeration.WorldManager; import me.eccentric_nz.TARDIS.planets.TARDISAliasResolver; import me.eccentric_nz.TARDIS.utility.TARDISStaticUtils; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Tag; import org.bukkit.block.Sign; import org.bukkit.block.sign.Side; diff --git a/src/main/java/me/eccentric_nz/TARDIS/control/TARDISExcitationRunnable.java b/src/main/java/me/eccentric_nz/TARDIS/control/TARDISExcitationRunnable.java index 270b99f454..a7b011e042 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/control/TARDISExcitationRunnable.java +++ b/src/main/java/me/eccentric_nz/TARDIS/control/TARDISExcitationRunnable.java @@ -16,16 +16,17 @@ */ package me.eccentric_nz.TARDIS.control; -import java.util.ArrayList; -import java.util.List; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.TARDISConstants; -import me.eccentric_nz.TARDIS.utility.TARDISParticles; +import me.eccentric_nz.TARDIS.particles.TARDISParticles; import org.bukkit.Location; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.entity.Player; +import java.util.ArrayList; +import java.util.List; + /** * @author eccentric_nz *

diff --git a/src/main/java/me/eccentric_nz/TARDIS/control/TARDISInfoMenuButton.java b/src/main/java/me/eccentric_nz/TARDIS/control/TARDISInfoMenuButton.java index 25d4791c45..570045248e 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/control/TARDISInfoMenuButton.java +++ b/src/main/java/me/eccentric_nz/TARDIS/control/TARDISInfoMenuButton.java @@ -22,7 +22,7 @@ import me.eccentric_nz.TARDIS.floodgate.TARDISFloodgate; import me.eccentric_nz.TARDIS.info.TARDISIndexFileInventory; import me.eccentric_nz.TARDIS.info.TARDISInfoMenu; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; diff --git a/src/main/java/me/eccentric_nz/TARDIS/control/TARDISSaveSign.java b/src/main/java/me/eccentric_nz/TARDIS/control/TARDISSaveSign.java index 197cd87ca4..b6541a927e 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/control/TARDISSaveSign.java +++ b/src/main/java/me/eccentric_nz/TARDIS/control/TARDISSaveSign.java @@ -18,19 +18,21 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.advanced.TARDISCircuitChecker; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.enumeration.TravelType; import me.eccentric_nz.TARDIS.travel.TravelCostAndType; import me.eccentric_nz.TARDIS.travel.save.TARDISSavesPlanetInventory; +import me.eccentric_nz.TARDIS.upgrades.SystemTree; +import me.eccentric_nz.TARDIS.upgrades.SystemUpgradeChecker; import me.eccentric_nz.TARDIS.utility.TARDISNumberParsers; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import java.util.HashMap; import java.util.List; +import java.util.UUID; class TARDISSaveSign { @@ -41,8 +43,13 @@ class TARDISSaveSign { } void openGUI(Player player, int id) { + UUID uuid = player.getUniqueId(); + if (plugin.getConfig().getBoolean("difficulty.system_upgrades") && !new SystemUpgradeChecker(plugin).has(uuid.toString(), SystemTree.SAVES)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_NEED", "Saves"); + return; + } TARDISCircuitChecker tcc = null; - if (!plugin.getDifficulty().equals(Difficulty.EASY) && !plugin.getUtils().inGracePeriod(player, false)) { + if (plugin.getConfig().getBoolean("difficulty.circuits") && !plugin.getUtils().inGracePeriod(player, false)) { tcc = new TARDISCircuitChecker(plugin, id); tcc.getCircuits(); } @@ -50,7 +57,7 @@ void openGUI(Player player, int id) { plugin.getMessenger().send(player, TardisModule.TARDIS, "NO_MEM_CIRCUIT"); return; } - if (plugin.getTrackerKeeper().getJunkPlayers().containsKey(player.getUniqueId()) && plugin.getDifficulty().equals(Difficulty.HARD)) { + if (plugin.getTrackerKeeper().getJunkPlayers().containsKey(uuid) && plugin.getConfig().getBoolean("difficulty.disks")) { ItemStack disk = player.getInventory().getItemInMainHand(); if (disk.hasItemMeta() && disk.getItemMeta().hasDisplayName() && disk.getItemMeta().getDisplayName().equals("Save Storage Disk")) { List lore = disk.getItemMeta().getLore(); diff --git a/src/main/java/me/eccentric_nz/TARDIS/control/TARDISScanner.java b/src/main/java/me/eccentric_nz/TARDIS/control/TARDISScanner.java index 4607d5a0dc..208f14e6ea 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/control/TARDISScanner.java +++ b/src/main/java/me/eccentric_nz/TARDIS/control/TARDISScanner.java @@ -25,7 +25,10 @@ import me.eccentric_nz.TARDIS.database.resultset.ResultSetCurrentLocation; import me.eccentric_nz.TARDIS.database.resultset.ResultSetNextLocation; import me.eccentric_nz.TARDIS.database.resultset.ResultSetPlayerPrefs; -import me.eccentric_nz.TARDIS.enumeration.*; +import me.eccentric_nz.TARDIS.enumeration.COMPASS; +import me.eccentric_nz.TARDIS.enumeration.DiskCircuit; +import me.eccentric_nz.TARDIS.enumeration.TardisModule; +import me.eccentric_nz.TARDIS.enumeration.WorldManager; import me.eccentric_nz.TARDIS.planets.TARDISAliasResolver; import me.eccentric_nz.TARDIS.rooms.TARDISExteriorRenderer; import me.eccentric_nz.TARDIS.utility.TARDISSounds; @@ -275,7 +278,7 @@ public TARDISScannerData getScannerData(Player player, int id, BukkitScheduler b plugin.getMessenger().send(player, TardisModule.TARDIS, "SCAN_NONE"); } // damage the circuit if configured - if (plugin.getConfig().getBoolean("circuits.damage") && !plugin.getDifficulty().equals(Difficulty.EASY) && plugin.getConfig().getInt("circuits.uses.scanner") > 0) { + if (plugin.getConfig().getBoolean("circuits.damage") && plugin.getConfig().getInt("circuits.uses.scanner") > 0) { TARDISCircuitChecker tcc = new TARDISCircuitChecker(plugin, id); tcc.getCircuits(); // decrement uses @@ -287,12 +290,9 @@ public TARDISScannerData getScannerData(Player player, int id, BukkitScheduler b } public void scan(int id, Player player, String renderer, int level) { - TARDISCircuitChecker tcc = null; - if (!plugin.getDifficulty().equals(Difficulty.EASY) && !plugin.getUtils().inGracePeriod(player, false)) { - tcc = new TARDISCircuitChecker(plugin, id); - tcc.getCircuits(); - } - if (tcc != null && !tcc.hasScanner()) { + TARDISCircuitChecker tcc = new TARDISCircuitChecker(plugin, id); + tcc.getCircuits(); + if (plugin.getConfig().getBoolean("difficulty.circuits") && !plugin.getUtils().inGracePeriod(player, false) && !tcc.hasScanner()) { plugin.getMessenger().send(player, TardisModule.TARDIS, "SCAN_MISSING"); return; } @@ -300,6 +300,12 @@ public void scan(int id, Player player, String renderer, int level) { plugin.getMessenger().send(player, TardisModule.TARDIS, "SCAN_NO_RANDOM"); return; } + // damage circuit if configured + if (plugin.getConfig().getBoolean("circuits.damage") && plugin.getConfig().getInt("circuits.uses.scanner") > 0) { + // decrement uses + int uses_left = tcc.getScannerUses(); + new TARDISCircuitDamager(plugin, DiskCircuit.SCANNER, uses_left, id, player).damage(); + } BukkitScheduler scheduler = plugin.getServer().getScheduler(); TARDISScannerData data = getScannerData(player, id, scheduler); if (data != null) { diff --git a/src/main/java/me/eccentric_nz/TARDIS/control/TARDISThemeButton.java b/src/main/java/me/eccentric_nz/TARDIS/control/TARDISThemeButton.java index f29e91eafd..cb9b061ed0 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/control/TARDISThemeButton.java +++ b/src/main/java/me/eccentric_nz/TARDIS/control/TARDISThemeButton.java @@ -24,11 +24,15 @@ import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.floodgate.FloodgateDestinationTerminalForm; import me.eccentric_nz.TARDIS.floodgate.TARDISFloodgate; -import net.md_5.bungee.api.ChatColor; +import me.eccentric_nz.TARDIS.upgrades.SystemTree; +import me.eccentric_nz.TARDIS.upgrades.SystemUpgradeChecker; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; +import java.util.UUID; + /** * @author eccentric_nz */ @@ -52,14 +56,15 @@ public static int getTardisId(String uuid) { int tid = 0; ResultSetTardisID rs = new ResultSetTardisID(TARDIS.plugin); if (rs.fromUUID(uuid)) { - tid = rs.getTardis_id(); + tid = rs.getTardisId(); } return tid; } public void clickButton() { // check player is in own TARDIS - int p_tid = getTardisId(player.getUniqueId().toString()); + UUID uuid = player.getUniqueId(); + int p_tid = getTardisId(uuid.toString()); if (p_tid != id) { plugin.getMessenger().send(player, TardisModule.TARDIS, "UPGRADE_OWN"); return; @@ -69,14 +74,18 @@ public void clickButton() { plugin.getMessenger().send(player, TardisModule.TARDIS, "NO_UPGRADE_WHILE_GROWING"); return; } + if (plugin.getConfig().getBoolean("difficulty.system_upgrades") && !new SystemUpgradeChecker(plugin).has(uuid.toString(), SystemTree.DESKTOP_THEME)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_NEED", "Desktop Theme"); + return; + } // get player's current console TARDISUpgradeData tud = new TARDISUpgradeData(); tud.setPrevious(current_console); tud.setLevel(level); - plugin.getTrackerKeeper().getUpgrades().put(player.getUniqueId(), tud); + plugin.getTrackerKeeper().getUpgrades().put(uuid, tud); // open the upgrade menu - if (TARDISFloodgate.isFloodgateEnabled() && TARDISFloodgate.isBedrockPlayer(player.getUniqueId())) { - new FloodgateDestinationTerminalForm(plugin, player.getUniqueId()).send(); + if (TARDISFloodgate.isFloodgateEnabled() && TARDISFloodgate.isBedrockPlayer(uuid)) { + new FloodgateDestinationTerminalForm(plugin, uuid).send(); } else { ItemStack[] consoles = new TARDISPluginThemeInventory(plugin, player, current_console.getPermission(), level).getMenu(); Inventory upg = plugin.getServer().createInventory(player, 54, ChatColor.DARK_RED + "TARDIS Upgrade Menu"); diff --git a/src/main/java/me/eccentric_nz/TARDIS/control/actions/ARSAction.java b/src/main/java/me/eccentric_nz/TARDIS/control/actions/ARSAction.java index 3fab6e82f2..63e6390580 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/control/actions/ARSAction.java +++ b/src/main/java/me/eccentric_nz/TARDIS/control/actions/ARSAction.java @@ -5,9 +5,11 @@ import me.eccentric_nz.TARDIS.advanced.TARDISCircuitChecker; import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; import me.eccentric_nz.TARDIS.control.TARDISThemeButton; +import me.eccentric_nz.TARDIS.upgrades.SystemTree; import me.eccentric_nz.TARDIS.database.data.Tardis; import me.eccentric_nz.TARDIS.enumeration.TardisModule; -import net.md_5.bungee.api.ChatColor; +import me.eccentric_nz.TARDIS.upgrades.SystemUpgradeChecker; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; @@ -20,6 +22,10 @@ public ARSAction(TARDIS plugin) { } public void openGUI(Player player, Tardis tardis, TARDISCircuitChecker tcc, int id) { + if (plugin.getConfig().getBoolean("difficulty.system_upgrades") && !new SystemUpgradeChecker(plugin).has(player.getUniqueId().toString(), SystemTree.ROOM_GROWING)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_NEED", "Room Growing"); + return; + } if (!tardis.isHandbrakeOn()) { plugin.getMessenger().send(player, TardisModule.TARDIS, "ARS_NO_TRAVEL"); return; diff --git a/src/main/java/me/eccentric_nz/TARDIS/control/actions/ChameleonSignAction.java b/src/main/java/me/eccentric_nz/TARDIS/control/actions/ChameleonSignAction.java index 68754ec4f5..effb48dc46 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/control/actions/ChameleonSignAction.java +++ b/src/main/java/me/eccentric_nz/TARDIS/control/actions/ChameleonSignAction.java @@ -3,8 +3,11 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.control.TARDISChameleonControl; import me.eccentric_nz.TARDIS.database.data.Tardis; +import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.floodgate.FloodgateChameleonCircuitForm; import me.eccentric_nz.TARDIS.floodgate.TARDISFloodgate; +import me.eccentric_nz.TARDIS.upgrades.SystemTree; +import me.eccentric_nz.TARDIS.upgrades.SystemUpgradeChecker; import org.bukkit.entity.Player; import java.util.UUID; @@ -18,9 +21,13 @@ public ChameleonSignAction(TARDIS plugin) { } public void openGUI(Player player, Tardis tardis, int id) { - UUID playerUUID = player.getUniqueId(); - if (TARDISFloodgate.isFloodgateEnabled() && TARDISFloodgate.isBedrockPlayer(playerUUID)) { - new FloodgateChameleonCircuitForm(plugin, playerUUID, id, tardis.getPreset()).send(); + UUID uuid = player.getUniqueId(); + if (plugin.getConfig().getBoolean("difficulty.system_upgrades") && !new SystemUpgradeChecker(plugin).has(uuid.toString(), SystemTree.CHAMELEON_CIRCUIT)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_NEED", "Chameleon Circuit"); + return; + } + if (TARDISFloodgate.isFloodgateEnabled() && TARDISFloodgate.isBedrockPlayer(uuid)) { + new FloodgateChameleonCircuitForm(plugin, uuid, id, tardis.getPreset()).send(); } else { new TARDISChameleonControl(plugin).openGUI(player, id, tardis.getAdaption(), tardis.getPreset(), tardis.getItemPreset()); } diff --git a/src/main/java/me/eccentric_nz/TARDIS/control/actions/ControlMenuAction.java b/src/main/java/me/eccentric_nz/TARDIS/control/actions/ControlMenuAction.java index 5d3b7463ea..a0a5aa31f2 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/control/actions/ControlMenuAction.java +++ b/src/main/java/me/eccentric_nz/TARDIS/control/actions/ControlMenuAction.java @@ -3,7 +3,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.control.TARDISControlInventory; import me.eccentric_nz.TARDIS.floodgate.TARDISFloodgate; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; diff --git a/src/main/java/me/eccentric_nz/TARDIS/control/actions/DifferentiatorAction.java b/src/main/java/me/eccentric_nz/TARDIS/control/actions/DifferentiatorAction.java index 15803ccf32..09a5c681d2 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/control/actions/DifferentiatorAction.java +++ b/src/main/java/me/eccentric_nz/TARDIS/control/actions/DifferentiatorAction.java @@ -17,9 +17,13 @@ package me.eccentric_nz.TARDIS.control.actions; import me.eccentric_nz.TARDIS.TARDIS; +import me.eccentric_nz.TARDIS.enumeration.TardisModule; +import me.eccentric_nz.TARDIS.upgrades.SystemTree; +import me.eccentric_nz.TARDIS.upgrades.SystemUpgradeChecker; import me.eccentric_nz.TARDIS.utility.TARDISSounds; import org.bukkit.block.Block; import org.bukkit.block.data.type.Comparator; +import org.bukkit.entity.Player; import java.util.HashMap; @@ -35,12 +39,18 @@ public DifferentiatorAction(TARDIS plugin) { this.plugin = plugin; } - public void bleep(Block block, int id) { - Comparator comparator = (Comparator) block.getBlockData(); - String sound = comparator.getMode().equals(Comparator.Mode.SUBTRACT) ? "differentiator_off" : "differentiator_on"; - TARDISSounds.playTARDISSound(block.getLocation(), sound); - // save control state - int mode = comparator.getMode().equals(Comparator.Mode.SUBTRACT) ? 0 : 1; + public void bleep(Block block, int id, Player player) { + int mode; + if (plugin.getConfig().getBoolean("difficulty.system_upgrades") && !new SystemUpgradeChecker(plugin).has(player.getUniqueId().toString(), SystemTree.EXTERIOR_FLIGHT)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_NEED", "Exterior Flight"); + mode = 0; + } else { + Comparator comparator = (Comparator) block.getBlockData(); + String sound = comparator.getMode().equals(Comparator.Mode.SUBTRACT) ? "differentiator_off" : "differentiator_on"; + TARDISSounds.playTARDISSound(block.getLocation(), sound); + // save control state + mode = comparator.getMode().equals(Comparator.Mode.SUBTRACT) ? 0 : 1; + } HashMap set = new HashMap<>(); set.put("secondary", mode); HashMap where = new HashMap<>(); diff --git a/src/main/java/me/eccentric_nz/TARDIS/control/actions/ForceFieldAction.java b/src/main/java/me/eccentric_nz/TARDIS/control/actions/ForceFieldAction.java index ab0ca2f2e6..52e05b51a5 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/control/actions/ForceFieldAction.java +++ b/src/main/java/me/eccentric_nz/TARDIS/control/actions/ForceFieldAction.java @@ -2,8 +2,10 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; +import me.eccentric_nz.TARDIS.upgrades.SystemTree; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.forcefield.TARDISForceField; +import me.eccentric_nz.TARDIS.upgrades.SystemUpgradeChecker; import me.eccentric_nz.TARDIS.utility.TARDISSounds; import org.bukkit.Location; import org.bukkit.entity.Player; @@ -18,6 +20,10 @@ public ForceFieldAction(TARDIS plugin) { public void toggleSheilds(Player player, Location blockLocation, int level) { if (TARDISPermission.hasPermission(player, "tardis.forcefield")) { + if (plugin.getConfig().getBoolean("difficulty.system_upgrades") && !new SystemUpgradeChecker(plugin).has(player.getUniqueId().toString(), SystemTree.FORCE_FIELD)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_NEED", "Force Field"); + return; + } if (plugin.getTrackerKeeper().getActiveForceFields().containsKey(player.getUniqueId())) { plugin.getTrackerKeeper().getActiveForceFields().remove(player.getUniqueId()); TARDISSounds.playTARDISSound(blockLocation, "tardis_force_field_down"); diff --git a/src/main/java/me/eccentric_nz/TARDIS/control/actions/HandlesAction.java b/src/main/java/me/eccentric_nz/TARDIS/control/actions/HandlesAction.java index 684e093466..330f727469 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/control/actions/HandlesAction.java +++ b/src/main/java/me/eccentric_nz/TARDIS/control/actions/HandlesAction.java @@ -8,7 +8,7 @@ import me.eccentric_nz.TARDIS.handles.TARDISHandlesProgramInventory; import me.eccentric_nz.TARDIS.utility.TARDISNumberParsers; import me.eccentric_nz.TARDIS.utility.TARDISSounds; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; diff --git a/src/main/java/me/eccentric_nz/TARDIS/control/actions/RepeaterAction.java b/src/main/java/me/eccentric_nz/TARDIS/control/actions/RepeaterAction.java index 5bd7dbdafd..c5db4568c7 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/control/actions/RepeaterAction.java +++ b/src/main/java/me/eccentric_nz/TARDIS/control/actions/RepeaterAction.java @@ -3,6 +3,9 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.database.resultset.ResultSetPlayerPrefs; import me.eccentric_nz.TARDIS.enumeration.RepeaterControl; +import me.eccentric_nz.TARDIS.enumeration.TardisModule; +import me.eccentric_nz.TARDIS.upgrades.SystemTree; +import me.eccentric_nz.TARDIS.upgrades.SystemUpgradeChecker; import org.bukkit.block.Block; import org.bukkit.block.data.type.Repeater; import org.bukkit.entity.Player; @@ -16,15 +19,45 @@ public RepeaterAction(TARDIS plugin) { } public void announce(Player player, Block block, int type) { + Repeater repeater = (Repeater) block.getBlockData(); + RepeaterControl rc = RepeaterControl.getControl(type); + int delay = repeater.getDelay(); + boolean missing = false; + // check if player/tardis has system upgrade + if (plugin.getConfig().getBoolean("difficulty.system_upgrades")) { + if (rc == RepeaterControl.WORLD) { + if ((delay == 2 || delay == 3) && !new SystemUpgradeChecker(plugin).has(player.getUniqueId().toString(), SystemTree.INTER_DIMENSIONAL_TRAVEL)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_NEED", "Inter Dimensional Travel"); + missing = true; + } + } + if (rc == RepeaterControl.MULTIPLIER) { + if (delay == 1 && !new SystemUpgradeChecker(plugin).has(player.getUniqueId().toString(), SystemTree.DISTANCE_1)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_NEED", "Distance 1"); + missing = true; + } + if (delay == 2 && !new SystemUpgradeChecker(plugin).has(player.getUniqueId().toString(), SystemTree.DISTANCE_2)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_NEED", "Distance 2"); + missing = true; + } + if (delay == 3 && !new SystemUpgradeChecker(plugin).has(player.getUniqueId().toString(), SystemTree.DISTANCE_3)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_NEED", "Distance 3"); + missing = true; + } + } + if (missing) { + plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> { + repeater.setDelay(1); + block.setBlockData(repeater); + }, 2L); + } + } // message setting when clicked ResultSetPlayerPrefs rsp = new ResultSetPlayerPrefs(plugin, player.getUniqueId().toString()); if (rsp.resultSet() && rsp.isAnnounceRepeatersOn()) { - Repeater repeater = (Repeater) block.getBlockData(); - int delay = repeater.getDelay(); - if (delay == 4) { + if (delay == 4 || missing) { delay = 0; } - RepeaterControl rc = RepeaterControl.getControl(type); plugin.getMessenger().announceRepeater(player, rc.getDescriptions().get(delay)); } } diff --git a/src/main/java/me/eccentric_nz/TARDIS/control/actions/ShellRoomAction.java b/src/main/java/me/eccentric_nz/TARDIS/control/actions/ShellRoomAction.java index 35ced51a5f..4d2c8b0fdb 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/control/actions/ShellRoomAction.java +++ b/src/main/java/me/eccentric_nz/TARDIS/control/actions/ShellRoomAction.java @@ -4,10 +4,12 @@ import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; import me.eccentric_nz.TARDIS.chameleon.shell.TARDISShellInventory; import me.eccentric_nz.TARDIS.chameleon.shell.TARDISShellPresetInventory; +import me.eccentric_nz.TARDIS.upgrades.SystemTree; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.floodgate.FloodgateShellLoaderForm; import me.eccentric_nz.TARDIS.floodgate.TARDISFloodgate; -import net.md_5.bungee.api.ChatColor; +import me.eccentric_nz.TARDIS.upgrades.SystemUpgradeChecker; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; @@ -23,6 +25,10 @@ public ShellRoomAction(TARDIS plugin) { } public void openGUI(Player player, int id) { + if (plugin.getConfig().getBoolean("difficulty.system_upgrades") && !new SystemUpgradeChecker(plugin).has(player.getUniqueId().toString(), SystemTree.CHAMELEON_CIRCUIT)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_NEED", "Chameleon Circuit"); + return; + } if (plugin.getConfig().getBoolean("police_box.load_shells") && player.isSneaking()) { if (!TARDISPermission.hasPermission(player, "tardis.load_shells")) { plugin.getMessenger().send(player, TardisModule.TARDIS, "NO_PERMS"); diff --git a/src/main/java/me/eccentric_nz/TARDIS/control/actions/TemporarlLocatorAction.java b/src/main/java/me/eccentric_nz/TARDIS/control/actions/TemporarlLocatorAction.java index 67cfb5d098..dc344aefe1 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/control/actions/TemporarlLocatorAction.java +++ b/src/main/java/me/eccentric_nz/TARDIS/control/actions/TemporarlLocatorAction.java @@ -7,7 +7,7 @@ import me.eccentric_nz.TARDIS.floodgate.FloodgateTemporalForm; import me.eccentric_nz.TARDIS.floodgate.TARDISFloodgate; import me.eccentric_nz.TARDIS.travel.TARDISTemporalLocatorInventory; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; diff --git a/src/main/java/me/eccentric_nz/TARDIS/control/actions/TerminalAction.java b/src/main/java/me/eccentric_nz/TARDIS/control/actions/TerminalAction.java index 110ae7f5e6..d8e84ab705 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/control/actions/TerminalAction.java +++ b/src/main/java/me/eccentric_nz/TARDIS/control/actions/TerminalAction.java @@ -7,7 +7,7 @@ import me.eccentric_nz.TARDIS.floodgate.FloodgateDestinationTerminalForm; import me.eccentric_nz.TARDIS.floodgate.TARDISFloodgate; import me.eccentric_nz.TARDIS.travel.TARDISTerminalInventory; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; diff --git a/src/main/java/me/eccentric_nz/TARDIS/control/actions/WeatherAction.java b/src/main/java/me/eccentric_nz/TARDIS/control/actions/WeatherAction.java index 96d161247e..ba2cb7face 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/control/actions/WeatherAction.java +++ b/src/main/java/me/eccentric_nz/TARDIS/control/actions/WeatherAction.java @@ -4,7 +4,7 @@ import me.eccentric_nz.TARDIS.commands.utils.TARDISWeatherInventory; import me.eccentric_nz.TARDIS.floodgate.FloodgateWeatherForm; import me.eccentric_nz.TARDIS.floodgate.TARDISFloodgate; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; diff --git a/src/main/java/me/eccentric_nz/TARDIS/custommodeldata/GUIControlCentre.java b/src/main/java/me/eccentric_nz/TARDIS/custommodeldata/GUIControlCentre.java index cbccbc9116..fc26efb78b 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/custommodeldata/GUIControlCentre.java +++ b/src/main/java/me/eccentric_nz/TARDIS/custommodeldata/GUIControlCentre.java @@ -22,32 +22,39 @@ public enum GUIControlCentre { // Control Centre - BUTTON_CLOSE(1, 53, Material.BOWL), + // 1st column + BUTTON_RANDOM(24, 0, Material.BOWL), + BUTTON_SAVES(26, 9, Material.BOWL), + BUTTON_BACK(15, 18, Material.BOWL), BUTTON_AREAS(12, 27, Material.BOWL), + BUTTON_TERM(30, 36, Material.BOWL), + BUTTON_THROTTLE(149, 45, Material.BOWL), + // 2nd column, BUTTON_ARS(13, 2, Material.BOWL), - BUTTON_ARTRON(14, 6, Material.BOWL), - BUTTON_BACK(15, 18, Material.BOWL), + BUTTON_THEME(31, 11, Material.BOWL), + BUTTON_POWER(17, 20, Material.REPEATER), + BUTTON_LIGHTS(16, 29, Material.REPEATER), + BUTTON_TOGGLE(19, 38, Material.REPEATER), + BUTTON_TARDIS_MAP(3, 47, Material.MAP), + // 3rd column BUTTON_CHAMELEON(17, 4, Material.BOWL), - BUTTON_DIRECTION(19, 40, Material.BOWL), + BUTTON_SIEGE(18, 13, Material.REPEATER), BUTTON_HIDE(20, 22, Material.BOWL), - BUTTON_INFO(21, 24, Material.BOWL), - BUTTON_PREFS(23, 17, Material.BOWL), - BUTTON_RANDOM(24, 0, Material.BOWL), BUTTON_REBUILD(25, 31, Material.BOWL), - BUTTON_SAVES(26, 9, Material.BOWL), - BUTTON_SCANNER(27, 15, Material.BOWL), - BUTTON_TARDIS_MAP(3, 47, Material.MAP), + BUTTON_DIRECTION(19, 40, Material.BOWL), BUTTON_TEMP(29, 49, Material.BOWL), - BUTTON_TERM(30, 36, Material.BOWL), - BUTTON_THEME(31, 11, Material.BOWL), - BUTTON_THROTTLE(149, 45, Material.BOWL), + // 4th column + BUTTON_ARTRON(14, 6, Material.BOWL), + BUTTON_SCANNER(27, 15, Material.BOWL), + BUTTON_INFO(21, 24, Material.BOWL), BUTTON_TRANSMAT(133, 33, Material.BOWL), + // 5th column BUTTON_ZERO(32, 8, Material.BOWL), + BUTTON_PREFS(23, 17, Material.BOWL), COMPANIONS_MENU(45, 26, Material.BOWL), - BUTTON_LIGHTS(16, 29, Material.REPEATER), - BUTTON_POWER(17, 20, Material.REPEATER), - BUTTON_SIEGE(18, 13, Material.REPEATER), - BUTTON_TOGGLE(19, 38, Material.REPEATER); + BUTTON_SYSTEM_UPGRADES(156, 35, Material.BOWL), + BUTTON_CLOSE(1, 53, Material.BOWL); + private final int customModelData; private final int slot; diff --git a/src/main/java/me/eccentric_nz/TARDIS/custommodeldata/GUIParticle.java b/src/main/java/me/eccentric_nz/TARDIS/custommodeldata/GUIParticle.java new file mode 100644 index 0000000000..30cf9c9937 --- /dev/null +++ b/src/main/java/me/eccentric_nz/TARDIS/custommodeldata/GUIParticle.java @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2024 eccentric_nz + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package me.eccentric_nz.TARDIS.custommodeldata; + +import org.bukkit.Material; + +public enum GUIParticle { + + // TARDIS Autonomous + SHAPE_INFO(2, 0, Material.LAPIS_BLOCK), + SHAPE(1, -1, Material.LAPIS_LAZULI), + EFFECT_INFO(2, 9, Material.REDSTONE_BLOCK), + EFFECT(1, -1, Material.REDSTONE), + TOGGLE(19, 27, Material.REPEATER), + TEST(1, 35, Material.COPPER_INGOT), + MINUS(40, -1, Material.PAPER), + PLUS(39, -1, Material.PAPER), + DENSITY(5, 46, Material.IRON_INGOT), + SPEED(1, 50, Material.GOLD_INGOT), + CLOSE(1, 54, Material.BOWL); + + private final int customModelData; + private final int slot; + private final Material material; + + GUIParticle(int customModelData, int slot, Material material) { + this.customModelData = customModelData; + this.slot = slot; + this.material = material; + } + + public int getCustomModelData() { + return customModelData; + } + + public int getSlot() { + return slot; + } + + public Material getMaterial() { + return material; + } +} diff --git a/src/main/java/me/eccentric_nz/TARDIS/custommodeldata/GUIPlayerPreferences.java b/src/main/java/me/eccentric_nz/TARDIS/custommodeldata/GUIPlayerPreferences.java index c2304488f7..92d53917d7 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/custommodeldata/GUIPlayerPreferences.java +++ b/src/main/java/me/eccentric_nz/TARDIS/custommodeldata/GUIPlayerPreferences.java @@ -37,25 +37,25 @@ public enum GUIPlayerPreferences { EXTERIOR_RENDERING_ROOM(29, 11, Material.REPEATER), INTERIOR_SFX(30, 12, Material.REPEATER), SUBMARINE_MODE(31, 13, Material.REPEATER), - COMPANION_BUILD(33, 15, Material.REPEATER), - PRESET_SIGN(36, 16, Material.REPEATER), - TRAVEL_BAR(37, 17, Material.REPEATER), - MOB_FARMING(39, 18, Material.REPEATER), - TELEPATHIC_CIRCUIT(40, 19, Material.REPEATER), - JUNK_TARDIS(41, 20, Material.REPEATER), - AUTO_POWER_UP(42, 21, Material.REPEATER), - FORCE_FIELD(43, 22, Material.REPEATER), - MINECART_SOUNDS(45, 23, Material.REPEATER), - EASY_DIFFICULTY(46, 24, Material.REPEATER), - LOCK_CONTAINERS(49, 25, Material.REPEATER), - INFO_GUI(56, 26, Material.REPEATER), + COMPANION_BUILD(33, 14, Material.REPEATER), + PRESET_SIGN(36, 15, Material.REPEATER), + TRAVEL_BAR(37, 16, Material.REPEATER), + MOB_FARMING(39, 17, Material.REPEATER), + TELEPATHIC_CIRCUIT(40, 18, Material.REPEATER), + JUNK_TARDIS(41, 19, Material.REPEATER), + AUTO_POWER_UP(42, 20, Material.REPEATER), + FORCE_FIELD(43, 21, Material.REPEATER), + MINECART_SOUNDS(45, 22, Material.REPEATER), + LOCK_CONTAINERS(49, 23, Material.REPEATER), + INFO_GUI(56, 24, Material.REPEATER), FLIGHT_MODE(1, 27, Material.ELYTRA), INTERIOR_HUM_SOUND(58, 28, Material.BOWL), - HANDBRAKE(1, 29, Material.LEVER), - TARDIS_MAP(3, 30, Material.MAP), - AUTONOMOUS_PREFERENCES(145, 31, Material.BOWL), - FARMING_PREFERENCES(155, 32, Material.BOWL), - SONIC_CONFIGURATOR(135, 33, Material.BOWL), + AUTONOMOUS_PREFERENCES(145, 29, Material.BOWL), + FARMING_PREFERENCES(155, 30, Material.BOWL), + PARTICLES(157, 31, Material.BOWL), + SONIC_CONFIGURATOR(135, 32, Material.BOWL), + HANDBRAKE(1, 33, Material.LEVER), + TARDIS_MAP(3, 34, Material.MAP), ADMIN_MENU(1, 35, Material.NETHER_STAR); private final int customModelData; diff --git a/src/main/java/me/eccentric_nz/TARDIS/database/TARDISMySQLDatabaseUpdater.java b/src/main/java/me/eccentric_nz/TARDIS/database/TARDISMySQLDatabaseUpdater.java index a934189211..339c4dacd3 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/database/TARDISMySQLDatabaseUpdater.java +++ b/src/main/java/me/eccentric_nz/TARDIS/database/TARDISMySQLDatabaseUpdater.java @@ -84,7 +84,6 @@ class TARDISMySQLDatabaseUpdater { prefsupdates.add("auto_siege_on int(1) DEFAULT '0'"); prefsupdates.add("build_on int(1) DEFAULT '1'"); prefsupdates.add("close_gui_on int(1) DEFAULT '1'"); - prefsupdates.add("difficulty int(1) DEFAULT '0'"); prefsupdates.add("dnd_on int(1) DEFAULT '0'"); prefsupdates.add("dynamic_lamps_on int(1) DEFAULT '0'"); prefsupdates.add("farm_on int(1) DEFAULT '0'"); diff --git a/src/main/java/me/eccentric_nz/TARDIS/database/TARDISSQLiteDatabase.java b/src/main/java/me/eccentric_nz/TARDIS/database/TARDISSQLiteDatabase.java index ec66771990..d1fc58f27a 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/database/TARDISSQLiteDatabase.java +++ b/src/main/java/me/eccentric_nz/TARDIS/database/TARDISSQLiteDatabase.java @@ -27,9 +27,8 @@ /** * SQLite database creator and updater. *

- * Many facts, figures, and formulas are contained within the Matrix - a - * supercomputer and micro-universe used by the High Council of the Time Lords - * as a storehouse of knowle + * Many facts, figures, and formulas are contained within the Matrix - a supercomputer and micro-universe used by the + * High Council of the Time Lords as a storehouse of knowle */ public class TARDISSQLiteDatabase { @@ -188,8 +187,12 @@ public void createTables() { String queryPaperBag = "CREATE TABLE IF NOT EXISTS " + prefix + "paper_bag (paper_bag_id INTEGER PRIMARY KEY NOT NULL, uuid TEXT DEFAULT '', flavour_1 TEXT DEFAULT '', amount_1 INTEGER, flavour_2 TEXT DEFAULT '', amount_2 INTEGER, flavour_3 TEXT DEFAULT '', amount_3 INTEGER, flavour_4 TEXT DEFAULT '', amount_4 INTEGER)"; statement.executeUpdate(queryPaperBag); + // Table structure for table 'particle_prefs' + String queryParticlePrefs = "CREATE TABLE IF NOT EXISTS " + prefix + "particle_prefs (pp_id INTEGER PRIMARY KEY NOT NULL, uuid TEXT DEFAULT '', effect TEXT DEFAULT 'ASH', shape TEXT DEFAULT 'RANDOM', density INTEGER DEFAULT 16, speed INTEGER DEFAULT 0, particles_on INTEGER DEFAULT 0)"; + statement.executeUpdate(queryParticlePrefs); + // Table structure for table 'player_prefs' - String queryPlayers = "CREATE TABLE IF NOT EXISTS " + prefix + "player_prefs (pp_id INTEGER PRIMARY KEY NOT NULL, uuid TEXT DEFAULT '', player TEXT COLLATE NOCASE DEFAULT '', key TEXT DEFAULT '', sfx_on INTEGER DEFAULT 0, quotes_on INTEGER DEFAULT 0, artron_level INTEGER DEFAULT 0, wall TEXT DEFAULT 'ORANGE_WOOL', floor TEXT DEFAULT 'LIGHT_GRAY_WOOL', siege_wall TEXT DEFAULT 'GRAY_TERRACOTTA', siege_floor TEXT DEFAULT 'BLACK_TERRACOTTA', announce_repeaters_on INTEGER DEFAULT 0, auto_on INTEGER DEFAULT 0, auto_type TEXT DEFAULT 'CLOSEST', auto_default TEXT DEFAULT 'HOME', beacon_on INTEGER DEFAULT 1, hads_on INTEGER DEFAULT 1, hads_type TEXT DEFAULT 'DISPLACEMENT', build_on INTEGER DEFAULT 1, close_gui_on INTEGER DEFAULT 1, eps_on INTEGER DEFAULT 0, eps_message TEXT DEFAULT '', language TEXT DEFAULT 'ENGLISH', submarine_on INTEGER DEFAULT 0, dnd_on INTEGER DEFAULT 0, dynamic_lamps_on INTEGER DEFAULT 0, minecart_on INTEGER DEFAULT 0, renderer_on INTEGER DEFAULT 1, sign_on INTEGER DEFAULT 1, telepathy_on INTEGER DEFAULT 0, travelbar_on INTEGER DEFAULT 0, info_on INTEGER DEFAULT 0, farm_on INTEGER DEFAULT 1, lights TEXT DEFAULT 'TENTH', auto_siege_on INTEGER DEFAULT 0, flying_mode INTEGER DEFAULT 1, throttle INTEGER DEFAULT 4, difficulty INTEGER DEFAULT 0, auto_powerup_on INTEGER DEFAULT 0, auto_phandbrake_on INTEGER DEFAULT 0, auto_rescue_on INTEGER DEFAULT 0, hum TEXT DEFAULT '')"; + String queryPlayers = "CREATE TABLE IF NOT EXISTS " + prefix + "player_prefs (pp_id INTEGER PRIMARY KEY NOT NULL, uuid TEXT DEFAULT '', player TEXT COLLATE NOCASE DEFAULT '', key TEXT DEFAULT '', sfx_on INTEGER DEFAULT 0, quotes_on INTEGER DEFAULT 0, artron_level INTEGER DEFAULT 0, wall TEXT DEFAULT 'ORANGE_WOOL', floor TEXT DEFAULT 'LIGHT_GRAY_WOOL', siege_wall TEXT DEFAULT 'GRAY_TERRACOTTA', siege_floor TEXT DEFAULT 'BLACK_TERRACOTTA', announce_repeaters_on INTEGER DEFAULT 0, auto_on INTEGER DEFAULT 0, auto_type TEXT DEFAULT 'CLOSEST', auto_default TEXT DEFAULT 'HOME', beacon_on INTEGER DEFAULT 1, hads_on INTEGER DEFAULT 1, hads_type TEXT DEFAULT 'DISPLACEMENT', build_on INTEGER DEFAULT 1, close_gui_on INTEGER DEFAULT 1, eps_on INTEGER DEFAULT 0, eps_message TEXT DEFAULT '', language TEXT DEFAULT 'ENGLISH', submarine_on INTEGER DEFAULT 0, dnd_on INTEGER DEFAULT 0, dynamic_lamps_on INTEGER DEFAULT 0, minecart_on INTEGER DEFAULT 0, renderer_on INTEGER DEFAULT 1, sign_on INTEGER DEFAULT 1, telepathy_on INTEGER DEFAULT 0, travelbar_on INTEGER DEFAULT 0, info_on INTEGER DEFAULT 0, farm_on INTEGER DEFAULT 1, lights TEXT DEFAULT 'TENTH', auto_siege_on INTEGER DEFAULT 0, flying_mode INTEGER DEFAULT 1, throttle INTEGER DEFAULT 4, auto_powerup_on INTEGER DEFAULT 0, auto_phandbrake_on INTEGER DEFAULT 0, auto_rescue_on INTEGER DEFAULT 0, hum TEXT DEFAULT '')"; statement.executeUpdate(queryPlayers); // Table structure for table 'portals' @@ -239,6 +242,10 @@ public void createTables() { String queryStorage = "CREATE TABLE IF NOT EXISTS " + prefix + "storage (storage_id INTEGER PRIMARY KEY NOT NULL, tardis_id INTEGER, uuid TEXT DEFAULT '', owner TEXT DEFAULT '', saves_one TEXT DEFAULT '', saves_two TEXT DEFAULT '', areas TEXT DEFAULT '', presets_one TEXT DEFAULT '', presets_two TEXT DEFAULT '', biomes_one TEXT DEFAULT '', biomes_two TEXT DEFAULT '', players TEXT DEFAULT '', circuits TEXT DEFAULT '', console TEXT DEFAULT '')"; statement.executeUpdate(queryStorage); + // Table structure for table 'system_upgrades' + String querySystem = "CREATE TABLE IF NOT EXISTS " + prefix + "system_upgrades (sys_id INTEGER PRIMARY KEY NOT NULL, tardis_id INTEGER, uuid TEXT DEFAULT '', architecture INTEGER DEFAULT 0, chameleon INTEGER DEFAULT 0, rooms INTEGER DEFAULT 0, desktop INTEGER DEFAULT 0, navigation INTEGER DEFAULT 0, saves INTEGER DEFAULT 0, distance_1 INTEGER DEFAULT 0, distance_2 INTEGER DEFAULT 0, distance_3 INTEGER DEFAULT 0, telepathic INTEGER DEFAULT 0, inter_dimension INTEGER DEFAULT 0, flight INTEGER DEFAULT 0, tools INTEGER DEFAULT 0, locator INTEGER DEFAULT 0, biome_reader INTEGER DEFAULT 0, force_field INTEGER DEFAULT 0, monitor INTEGER DEFAULT 0, stattenheim_remote INTEGER DEFAULT 0)"; + statement.executeUpdate(querySystem); + // Table structure for table 'tag' String queryTag = "CREATE TABLE IF NOT EXISTS " + prefix + "tag (tag_id INTEGER PRIMARY KEY NOT NULL, player TEXT COLLATE NOCASE DEFAULT '', time INTEGER)"; statement.executeUpdate(queryTag); diff --git a/src/main/java/me/eccentric_nz/TARDIS/database/TARDISSQLiteDatabaseUpdater.java b/src/main/java/me/eccentric_nz/TARDIS/database/TARDISSQLiteDatabaseUpdater.java index 67e84c2d2b..375b3e4ea6 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/database/TARDISSQLiteDatabaseUpdater.java +++ b/src/main/java/me/eccentric_nz/TARDIS/database/TARDISSQLiteDatabaseUpdater.java @@ -86,7 +86,6 @@ class TARDISSQLiteDatabaseUpdater { prefsupdates.add("beacon_on INTEGER DEFAULT 1"); prefsupdates.add("build_on INTEGER DEFAULT 1"); prefsupdates.add("close_gui_on INTEGER DEFAULT 1"); - prefsupdates.add("difficulty INTEGER DEFAULT 0"); prefsupdates.add("dnd_on INTEGER DEFAULT 0"); prefsupdates.add("dynamic_lamps_on INTEGER DEFAULT 0"); prefsupdates.add("eps_message TEXT DEFAULT ''"); diff --git a/src/main/java/me/eccentric_nz/TARDIS/database/data/ParticleData.java b/src/main/java/me/eccentric_nz/TARDIS/database/data/ParticleData.java new file mode 100644 index 0000000000..dab773aa6f --- /dev/null +++ b/src/main/java/me/eccentric_nz/TARDIS/database/data/ParticleData.java @@ -0,0 +1,41 @@ +package me.eccentric_nz.TARDIS.database.data; + +import me.eccentric_nz.TARDIS.particles.ParticleEffect; +import me.eccentric_nz.TARDIS.particles.ParticleShape; + +public class ParticleData { + + private final ParticleEffect effect; + private final ParticleShape shape; + private final int density; + private final double speed; + private final boolean on; + + public ParticleData(ParticleEffect effect, ParticleShape shape, int density, double speed, boolean on) { + this.effect = effect; + this.shape = shape; + this.density = density; + this.speed = speed; + this.on = on; + } + + public ParticleEffect getEffect() { + return effect; + } + + public ParticleShape getShape() { + return shape; + } + + public int getDensity() { + return density; + } + + public double getSpeed() { + return speed; + } + + public boolean isOn() { + return on; + } +} diff --git a/src/main/java/me/eccentric_nz/TARDIS/database/data/SystemUpgrade.java b/src/main/java/me/eccentric_nz/TARDIS/database/data/SystemUpgrade.java new file mode 100644 index 0000000000..a8073efd92 --- /dev/null +++ b/src/main/java/me/eccentric_nz/TARDIS/database/data/SystemUpgrade.java @@ -0,0 +1,42 @@ +package me.eccentric_nz.TARDIS.database.data; + +import me.eccentric_nz.TARDIS.upgrades.SystemTree; + +import java.util.HashMap; + +public class SystemUpgrade { + + private final int artronLevel; + private final HashMap upgrades = new HashMap<>(); + + public SystemUpgrade(int artronLevel, boolean architecture, boolean chameleon, boolean rooms, boolean desktop, boolean navigation, boolean saves, boolean distance1, boolean distance2, boolean distance3, boolean telepathic, boolean interDimension, boolean flight, boolean tools, boolean locator, boolean biomeReader, boolean forceField, boolean monitor, boolean stattenheimRemote) { + this.artronLevel = artronLevel; + this.upgrades.put(SystemTree.UPGRADE_TREE, true); + this.upgrades.put(SystemTree.ARCHITECTURE, architecture); + this.upgrades.put(SystemTree.CHAMELEON_CIRCUIT, chameleon); + this.upgrades.put(SystemTree.ROOM_GROWING, rooms); + this.upgrades.put(SystemTree.DESKTOP_THEME, desktop); + this.upgrades.put(SystemTree.NAVIGATION, navigation); + this.upgrades.put(SystemTree.SAVES, saves); + this.upgrades.put(SystemTree.DISTANCE_1, distance1); + this.upgrades.put(SystemTree.DISTANCE_2, distance2); + this.upgrades.put(SystemTree.DISTANCE_3 , distance3); + this.upgrades.put(SystemTree.TELEPATHIC_CIRCUIT , telepathic); + this.upgrades.put(SystemTree.INTER_DIMENSIONAL_TRAVEL, interDimension); + this.upgrades.put(SystemTree.EXTERIOR_FLIGHT, flight); + this.upgrades.put(SystemTree.TOOLS, tools); + this.upgrades.put(SystemTree.TARDIS_LOCATOR, locator); + this.upgrades.put(SystemTree.BIOME_READER, biomeReader); + this.upgrades.put(SystemTree.FORCE_FIELD, forceField); + this.upgrades.put(SystemTree.MONITOR, monitor); + this.upgrades.put(SystemTree.STATTENHEIM_REMOTE, stattenheimRemote); + } + + public int getArtronLevel() { + return artronLevel; + } + + public HashMap getUpgrades() { + return upgrades; + } +} diff --git a/src/main/java/me/eccentric_nz/TARDIS/database/data/Throticle.java b/src/main/java/me/eccentric_nz/TARDIS/database/data/Throticle.java new file mode 100644 index 0000000000..d20a27127b --- /dev/null +++ b/src/main/java/me/eccentric_nz/TARDIS/database/data/Throticle.java @@ -0,0 +1,22 @@ +package me.eccentric_nz.TARDIS.database.data; + +import me.eccentric_nz.TARDIS.enumeration.SpaceTimeThrottle; + +public class Throticle { + + private final SpaceTimeThrottle throttle; + private final boolean particles; + + public Throticle(SpaceTimeThrottle throttle, boolean particles) { + this.throttle = throttle; + this.particles = particles; + } + + public SpaceTimeThrottle getThrottle() { + return throttle; + } + + public boolean getParticles() { + return particles; + } +} diff --git a/src/main/java/me/eccentric_nz/TARDIS/database/resultset/ResultSetParticlePrefs.java b/src/main/java/me/eccentric_nz/TARDIS/database/resultset/ResultSetParticlePrefs.java new file mode 100644 index 0000000000..582a8a5524 --- /dev/null +++ b/src/main/java/me/eccentric_nz/TARDIS/database/resultset/ResultSetParticlePrefs.java @@ -0,0 +1,72 @@ +package me.eccentric_nz.TARDIS.database.resultset; + +import me.eccentric_nz.TARDIS.TARDIS; +import me.eccentric_nz.TARDIS.database.TARDISDatabaseConnection; +import me.eccentric_nz.TARDIS.database.data.ParticleData; +import me.eccentric_nz.TARDIS.particles.ParticleEffect; +import me.eccentric_nz.TARDIS.particles.ParticleShape; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +public class ResultSetParticlePrefs { + + private final TARDISDatabaseConnection service = TARDISDatabaseConnection.getINSTANCE(); + private final Connection connection = service.getConnection(); + private final TARDIS plugin; + private final String prefix; + private ParticleData data; + + /** + * Creates a class instance that can be used to retrieve an SQL ResultSet from the player_prefs table. + * + * @param plugin an instance of the main class. + */ + public ResultSetParticlePrefs(TARDIS plugin) { + this.plugin = plugin; + prefix = this.plugin.getPrefix(); + } + + public boolean fromUUID(String uuid) { + PreparedStatement statement = null; + ResultSet rs = null; + String query = "SELECT * FROM " + prefix + "particle_prefs WHERE uuid = ?"; + try { + service.testConnection(connection); + statement = connection.prepareStatement(query); + statement.setString(1, uuid); + rs = statement.executeQuery(); + if (rs.isBeforeFirst()) { + rs.next(); + try { + ParticleEffect effect = ParticleEffect.valueOf(rs.getString("effect")); + ParticleShape shape = ParticleShape.valueOf(rs.getString("shape")); + data = new ParticleData(effect, shape, rs.getInt("density"), rs.getDouble("speed")/10.0d, rs.getBoolean("particles_on")); + return true; + } catch (IllegalArgumentException ignored) { + } + } + return false; + } catch (SQLException e) { + plugin.debug("ResultSet error for particle prefs fromUUID! " + e.getMessage()); + return false; + } finally { + try { + if (rs != null) { + rs.close(); + } + if (statement != null) { + statement.close(); + } + } catch (SQLException e) { + plugin.debug("Error closing particle prefs fromUUID! " + e.getMessage()); + } + } + } + + public ParticleData getData() { + return data; + } +} diff --git a/src/main/java/me/eccentric_nz/TARDIS/database/resultset/ResultSetPlayerPrefs.java b/src/main/java/me/eccentric_nz/TARDIS/database/resultset/ResultSetPlayerPrefs.java index dbc8c8c94c..b9472d6eef 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/database/resultset/ResultSetPlayerPrefs.java +++ b/src/main/java/me/eccentric_nz/TARDIS/database/resultset/ResultSetPlayerPrefs.java @@ -54,7 +54,6 @@ public class ResultSetPlayerPrefs { private boolean buildOn; private boolean closeGUIOn; private boolean DND; - private boolean easyDifficulty; private boolean dynamicLightsOn; private boolean epsOn; private boolean farmOn; @@ -167,7 +166,6 @@ public boolean resultSet() { } flightMode = rs.getInt("flying_mode"); throttle = rs.getInt("throttle"); - easyDifficulty = rs.getBoolean("difficulty"); autoPowerUp = rs.getBoolean("auto_powerup_on"); hum = rs.getString("hum"); } else { @@ -325,10 +323,6 @@ public int getThrottle() { return throttle; } - public boolean isEasyDifficulty() { - return easyDifficulty; - } - public boolean isAutoPowerUp() { return autoPowerUp; } diff --git a/src/main/java/me/eccentric_nz/TARDIS/database/resultset/ResultSetSystemUpgrades.java b/src/main/java/me/eccentric_nz/TARDIS/database/resultset/ResultSetSystemUpgrades.java new file mode 100644 index 0000000000..23fc77cc9d --- /dev/null +++ b/src/main/java/me/eccentric_nz/TARDIS/database/resultset/ResultSetSystemUpgrades.java @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 eccentric_nz + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with plugin program. If not, see . + */ +package me.eccentric_nz.TARDIS.database.resultset; + +import me.eccentric_nz.TARDIS.TARDIS; +import me.eccentric_nz.TARDIS.database.TARDISDatabaseConnection; +import me.eccentric_nz.TARDIS.database.data.SystemUpgrade; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +public class ResultSetSystemUpgrades { + + private final TARDISDatabaseConnection service = TARDISDatabaseConnection.getINSTANCE(); + private final Connection connection = service.getConnection(); + private final TARDIS plugin; + private final int id; + private final String uuid; + private final String prefix; + private SystemUpgrade data; + + public ResultSetSystemUpgrades(TARDIS plugin, int id, String uuid) { + this.plugin = plugin; + this.id = id; + this.uuid = uuid; + prefix = this.plugin.getPrefix(); + } + + public boolean resultset() { + PreparedStatement statement = null; + ResultSet rs = null; + String query = "SELECT " + prefix + "player_prefs.artron_level, " + prefix + "system_upgrades.* FROM " + prefix + "player_prefs, " + prefix + "system_upgrades WHERE " + prefix + "system_upgrades.uuid = ? AND " + prefix + "system_upgrades.tardis_id = ? AND " + prefix + "system_upgrades.uuid = " + prefix + "player_prefs.uuid"; + try { + service.testConnection(connection); + statement = connection.prepareStatement(query); + statement.setString(1, uuid); + statement.setInt(2, id); + rs = statement.executeQuery(); + if (rs.isBeforeFirst()) { + rs.next(); + data = new SystemUpgrade( + rs.getInt("artron_level"), + rs.getBoolean("architecture"), + rs.getBoolean("chameleon"), + rs.getBoolean("rooms"), + rs.getBoolean("desktop"), + rs.getBoolean("navigation"), + rs.getBoolean("saves"), + rs.getBoolean("distance_1"), + rs.getBoolean("distance_2"), + rs.getBoolean("distance_3"), + rs.getBoolean("telepathic"), + rs.getBoolean("inter_dimension"), + rs.getBoolean("flight"), + rs.getBoolean("tools"), + rs.getBoolean("locator"), + rs.getBoolean("biome_reader"), + rs.getBoolean("force_field"), + rs.getBoolean("monitor"), + rs.getBoolean("stattenheim_remote") + ); + } else { + return false; + } + } catch (SQLException e) { + plugin.debug("ResultSet error for player_prefs (artron level from UUID) table! " + e.getMessage()); + return false; + } finally { + try { + if (rs != null) { + rs.close(); + } + if (statement != null) { + statement.close(); + } + } catch (SQLException e) { + plugin.debug("Error closing player_prefs (artron level from UUID) statement! " + e.getMessage()); + } + } + return true; + } + + public SystemUpgrade getData() { + return data; + } +} diff --git a/src/main/java/me/eccentric_nz/TARDIS/database/resultset/ResultSetTardisID.java b/src/main/java/me/eccentric_nz/TARDIS/database/resultset/ResultSetTardisID.java index d62acd2719..93ea9c917f 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/database/resultset/ResultSetTardisID.java +++ b/src/main/java/me/eccentric_nz/TARDIS/database/resultset/ResultSetTardisID.java @@ -16,12 +16,13 @@ */ package me.eccentric_nz.TARDIS.database.resultset; +import me.eccentric_nz.TARDIS.TARDIS; +import me.eccentric_nz.TARDIS.database.TARDISDatabaseConnection; + import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; -import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.database.TARDISDatabaseConnection; /** * Many facts, figures, and formulas are contained within the Matrix, including... the locations of the TARDIS vaults. @@ -34,7 +35,7 @@ public class ResultSetTardisID { private final Connection connection = service.getConnection(); private final TARDIS plugin; private final String prefix; - private int tardis_id; + private int tardisId; /** * Creates a class instance that can be used to retrieve an SQL ResultSet from the vaults table. @@ -64,7 +65,7 @@ public boolean fromUUID(String uuid) { rs = statement.executeQuery(); if (rs.isBeforeFirst()) { rs.next(); - tardis_id = rs.getInt("tardis_id"); + tardisId = rs.getInt("tardis_id"); return true; } return false; @@ -103,7 +104,7 @@ public boolean fromTIPSSlot(int slot) { rs = statement.executeQuery(); if (rs.isBeforeFirst()) { rs.next(); - tardis_id = rs.getInt("tardis_id"); + tardisId = rs.getInt("tardis_id"); return true; } return false; @@ -124,7 +125,7 @@ public boolean fromTIPSSlot(int slot) { } } - public int getTardis_id() { - return tardis_id; + public int getTardisId() { + return tardisId; } } diff --git a/src/main/java/me/eccentric_nz/TARDIS/database/resultset/ResultSetThrottle.java b/src/main/java/me/eccentric_nz/TARDIS/database/resultset/ResultSetThrottle.java index e3b39475c8..b1904a58c0 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/database/resultset/ResultSetThrottle.java +++ b/src/main/java/me/eccentric_nz/TARDIS/database/resultset/ResultSetThrottle.java @@ -16,13 +16,15 @@ */ package me.eccentric_nz.TARDIS.database.resultset; +import me.eccentric_nz.TARDIS.TARDIS; +import me.eccentric_nz.TARDIS.database.TARDISDatabaseConnection; +import me.eccentric_nz.TARDIS.database.data.Throticle; +import me.eccentric_nz.TARDIS.enumeration.SpaceTimeThrottle; + import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; -import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.database.TARDISDatabaseConnection; -import me.eccentric_nz.TARDIS.enumeration.SpaceTimeThrottle; /** * Many facts, figures, and formulas are contained within the Matrix, including... the personal preferences of the Time @@ -54,23 +56,29 @@ public ResultSetThrottle(TARDIS plugin) { * @param uuid the unique id of the player to get the setting for * @return the Space Time Throttle setting */ - public SpaceTimeThrottle getSpeed(String uuid) { + public Throticle getSpeedAndParticles(String uuid) { + SpaceTimeThrottle throttle = SpaceTimeThrottle.NORMAL; + boolean particles = false; PreparedStatement statement = null; ResultSet rs = null; - String query = "SELECT throttle FROM " + prefix + "player_prefs WHERE uuid = ?"; + String throttleQuery = "SELECT throttle FROM " + prefix + "player_prefs WHERE uuid = ?"; + String particleQuery = "SELECT particles_on FROM " + prefix + "particle_prefs WHERE uuid = ?"; try { service.testConnection(connection); - statement = connection.prepareStatement(query); + statement = connection.prepareStatement(throttleQuery); + statement.setString(1, uuid); + rs = statement.executeQuery(); + if (rs.next()) { + throttle = SpaceTimeThrottle.getByDelay().get(rs.getInt("throttle")); + } + statement = connection.prepareStatement(particleQuery); statement.setString(1, uuid); rs = statement.executeQuery(); if (rs.next()) { - return SpaceTimeThrottle.getByDelay().get(rs.getInt("throttle")); - } else { - return SpaceTimeThrottle.NORMAL; + particles = rs.getBoolean("particles_on"); } } catch (SQLException e) { plugin.debug("ResultSet error for throttle table! " + e.getMessage()); - return SpaceTimeThrottle.NORMAL; } finally { try { if (rs != null) { @@ -83,5 +91,6 @@ public SpaceTimeThrottle getSpeed(String uuid) { plugin.debug("Error closing throttle table! " + e.getMessage()); } } + return new Throticle(throttle, particles); } } diff --git a/src/main/java/me/eccentric_nz/TARDIS/database/tool/Converter.java b/src/main/java/me/eccentric_nz/TARDIS/database/tool/Converter.java index cd11420fb9..90312fdb83 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/database/tool/Converter.java +++ b/src/main/java/me/eccentric_nz/TARDIS/database/tool/Converter.java @@ -229,8 +229,12 @@ public void run() { str = String.format(SQL.VALUES.get(i), rs.getInt("paper_bag_id"), rs.getString("uuid"), rs.getString("flavour_1"), rs.getInt("amount_1"), rs.getString("flavour_2"), rs.getInt("amount_2"), rs.getString("flavour_3"), rs.getInt("amount_3"), rs.getString("flavour_4"), rs.getInt("amount_4")) + end; sb.append(str); } + case particle_prefs -> { + str = String.format(SQL.VALUES.get(i), rs.getInt("pp_id"), rs.getString("uuid"), rs.getString("effect"), rs.getString("shape"), rs.getInt("density"), rs.getInt("speed"), rs.getInt("particles_on")) + end; + sb.append(str); + } case player_prefs -> { - str = String.format(SQL.VALUES.get(i), rs.getInt("pp_id"), rs.getString("uuid"), rs.getString("player"), rs.getString("key"), rs.getInt("sfx_on"), rs.getInt("quotes_on"), rs.getInt("artron_level"), rs.getString("wall"), rs.getString("floor"), rs.getString("siege_wall"), rs.getString("siege_floor"), rs.getInt("announce_repeaters_on"), rs.getInt("auto_on"), rs.getString("auto_type"), rs.getString("auto_default"), rs.getInt("beacon_on"), rs.getInt("hads_on"), rs.getString("hads_type"), rs.getInt("build_on"), rs.getInt("close_gui_on"), rs.getInt("eps_on"), rs.getString("eps_message").replace("'", "\\'"), rs.getString("language"), rs.getInt("submarine_on"), rs.getInt("dnd_on"), rs.getInt("dynamic_lamps_on"), rs.getInt("minecart_on"), rs.getInt("renderer_on"), rs.getInt("sign_on"), rs.getInt("telepathy_on"), rs.getInt("travelbar_on"), rs.getInt("info_on"), rs.getInt("farm_on"), rs.getString("lights"), rs.getInt("auto_siege_on"), rs.getInt("flying_mode"), rs.getInt("throttle"), rs.getInt("difficulty"), rs.getInt("auto_powerup_on"), rs.getInt("auto_rescue_on"), rs.getString("hum")) + end; + str = String.format(SQL.VALUES.get(i), rs.getInt("pp_id"), rs.getString("uuid"), rs.getString("player"), rs.getString("key"), rs.getInt("sfx_on"), rs.getInt("quotes_on"), rs.getInt("artron_level"), rs.getString("wall"), rs.getString("floor"), rs.getString("siege_wall"), rs.getString("siege_floor"), rs.getInt("announce_repeaters_on"), rs.getInt("auto_on"), rs.getString("auto_type"), rs.getString("auto_default"), rs.getInt("beacon_on"), rs.getInt("hads_on"), rs.getString("hads_type"), rs.getInt("build_on"), rs.getInt("close_gui_on"), rs.getInt("eps_on"), rs.getString("eps_message").replace("'", "\\'"), rs.getString("language"), rs.getInt("submarine_on"), rs.getInt("dnd_on"), rs.getInt("dynamic_lamps_on"), rs.getInt("minecart_on"), rs.getInt("renderer_on"), rs.getInt("sign_on"), rs.getInt("telepathy_on"), rs.getInt("travelbar_on"), rs.getInt("info_on"), rs.getInt("farm_on"), rs.getString("lights"), rs.getInt("auto_siege_on"), rs.getInt("flying_mode"), rs.getInt("throttle"), rs.getInt("auto_powerup_on"), rs.getInt("auto_rescue_on"), rs.getString("hum")) + end; sb.append(str); } case portals -> { @@ -269,6 +273,10 @@ public void run() { str = String.format(SQL.VALUES.get(i), rs.getInt("storage_id"), rs.getInt("tardis_id"), rs.getString("uuid"), rs.getString("owner"), rs.getString("saves_one"), rs.getString("saves_two"), rs.getString("areas"), rs.getString("presets_one"), rs.getString("presets_two"), rs.getString("biomes_one"), rs.getString("biomes_two"), rs.getString("players"), rs.getString("circuits"), rs.getString("console")) + end; sb.append(str); } + case system_upgrades -> { + str = String.format(SQL.VALUES.get(i), rs.getInt("sys_id"), rs.getInt("tardis_id"), rs.getString("uuid"), rs.getInt("architecture"), rs.getInt("chameleon"), rs.getInt("rooms"), rs.getInt("desktop"), rs.getInt("navigation"), rs.getInt("saves"), rs.getInt("distance_1"), rs.getInt("distance_2"), rs.getInt("distance_3"), rs.getInt("telepathic"), rs.getInt("inter_dimension"), rs.getInt("flight"), rs.getInt("tools"), rs.getInt("locator"), rs.getInt("biome_reader"), rs.getInt("force_field"), rs.getInt("monitor"), rs.getInt("stattenheim_remote")) + end; + sb.append(str); + } case t_count -> { str = String.format(SQL.VALUES.get(i), rs.getInt("t_id"), rs.getString("uuid"), rs.getString("player"), rs.getInt("count"), rs.getInt("grace"), rs.getInt("repair")) + end; sb.append(str); diff --git a/src/main/java/me/eccentric_nz/TARDIS/database/tool/Main.java b/src/main/java/me/eccentric_nz/TARDIS/database/tool/Main.java index 108546b768..f05692dd1e 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/database/tool/Main.java +++ b/src/main/java/me/eccentric_nz/TARDIS/database/tool/Main.java @@ -266,8 +266,12 @@ public static void process(PrintWriter console, File sqlite, File mysql, String str = String.format(SQL.VALUES.get(i), rs.getInt("paper_bag_id"), rs.getString("uuid"), rs.getString("flavour_1"), rs.getInt("amount_1"), rs.getString("flavour_2"), rs.getInt("amount_2"), rs.getString("flavour_3"), rs.getInt("amount_3"), rs.getString("flavour_4"), rs.getInt("amount_4")) + end; bw.write(str); } + case particle_prefs -> { + str = String.format(SQL.VALUES.get(i), rs.getInt("pp_id"), rs.getString("uuid"), rs.getString("effect"), rs.getString("shape"), rs.getInt("density"), rs.getInt("speed"), rs.getInt("particles_on")) + end; + bw.write(str); + } case player_prefs -> { - str = String.format(SQL.VALUES.get(i), rs.getInt("pp_id"), rs.getString("uuid"), rs.getString("player"), rs.getString("key"), rs.getInt("sfx_on"), rs.getInt("quotes_on"), rs.getInt("artron_level"), rs.getString("wall"), rs.getString("floor"), rs.getString("siege_wall"), rs.getString("siege_floor"), rs.getInt("announce_repeaters_on"), rs.getInt("auto_on"), rs.getString("auto_type"), rs.getString("auto_default"), rs.getInt("beacon_on"), rs.getInt("hads_on"), rs.getString("hads_type"), rs.getInt("build_on"), rs.getInt("close_gui_on"), rs.getInt("eps_on"), rs.getString("eps_message").replace("'", "\\'"), rs.getString("language"), rs.getInt("submarine_on"), rs.getInt("dnd_on"), rs.getInt("dynamic_lamps_on"), rs.getInt("minecart_on"), rs.getInt("renderer_on"), rs.getInt("sign_on"), rs.getInt("telepathy_on"), rs.getInt("travelbar_on"), rs.getInt("info_on"), rs.getInt("farm_on"), rs.getString("lights"), rs.getInt("auto_siege_on"), rs.getInt("flying_mode"), rs.getInt("throttle"), rs.getInt("difficulty"), rs.getInt("auto_powerup_on"), rs.getInt("auto_rescue_on"), rs.getString("hum")) + end; + str = String.format(SQL.VALUES.get(i), rs.getInt("pp_id"), rs.getString("uuid"), rs.getString("player"), rs.getString("key"), rs.getInt("sfx_on"), rs.getInt("quotes_on"), rs.getInt("artron_level"), rs.getString("wall"), rs.getString("floor"), rs.getString("siege_wall"), rs.getString("siege_floor"), rs.getInt("announce_repeaters_on"), rs.getInt("auto_on"), rs.getString("auto_type"), rs.getString("auto_default"), rs.getInt("beacon_on"), rs.getInt("hads_on"), rs.getString("hads_type"), rs.getInt("build_on"), rs.getInt("close_gui_on"), rs.getInt("eps_on"), rs.getString("eps_message").replace("'", "\\'"), rs.getString("language"), rs.getInt("submarine_on"), rs.getInt("dnd_on"), rs.getInt("dynamic_lamps_on"), rs.getInt("minecart_on"), rs.getInt("renderer_on"), rs.getInt("sign_on"), rs.getInt("telepathy_on"), rs.getInt("travelbar_on"), rs.getInt("info_on"), rs.getInt("farm_on"), rs.getString("lights"), rs.getInt("auto_siege_on"), rs.getInt("flying_mode"), rs.getInt("throttle"), rs.getInt("auto_powerup_on"), rs.getInt("auto_rescue_on"), rs.getString("hum")) + end; bw.write(str); } case portals -> { @@ -306,6 +310,10 @@ public static void process(PrintWriter console, File sqlite, File mysql, String str = String.format(SQL.VALUES.get(i), rs.getInt("storage_id"), rs.getInt("tardis_id"), rs.getString("uuid"), rs.getString("owner"), rs.getString("saves_one"), rs.getString("saves_two"), rs.getString("areas"), rs.getString("presets_one"), rs.getString("presets_two"), rs.getString("biomes_one"), rs.getString("biomes_two"), rs.getString("players"), rs.getString("circuits"), rs.getString("console")) + end; bw.write(str); } + case system_upgrades -> { + str = String.format(SQL.VALUES.get(i), rs.getInt("sys_id"), rs.getInt("tardis_id"), rs.getString("uuid"), rs.getInt("architecture"), rs.getInt("chameleon"), rs.getInt("rooms"), rs.getInt("desktop"), rs.getInt("navigation"), rs.getInt("saves"), rs.getInt("distance_1"), rs.getInt("distance_2"), rs.getInt("distance_3"), rs.getInt("telepathic"), rs.getInt("inter_dimension"), rs.getInt("flight"), rs.getInt("tools"), rs.getInt("locator"), rs.getInt("biome_reader"), rs.getInt("force_field"), rs.getInt("monitor"), rs.getInt("stattenheim_remote")) + end; + bw.write(str); + } case t_count -> { str = String.format(SQL.VALUES.get(i), rs.getInt("t_id"), rs.getString("uuid"), rs.getString("player"), rs.getInt("count"), rs.getInt("grace"), rs.getInt("repair")) + end; bw.write(str); diff --git a/src/main/java/me/eccentric_nz/TARDIS/database/tool/SQL.java b/src/main/java/me/eccentric_nz/TARDIS/database/tool/SQL.java index d0c6980de8..d883ef8216 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/database/tool/SQL.java +++ b/src/main/java/me/eccentric_nz/TARDIS/database/tool/SQL.java @@ -94,7 +94,9 @@ public class SQL { "CREATE TABLE IF NOT EXISTS %spaper_bag (paper_bag_id int(11) NOT NULL AUTO_INCREMENT, uuid varchar(48) DEFAULT '', flavour_1 varchar(12) DEFAULT '', amount_1 int(2) DEFAULT '0', flavour_2 varchar(12) DEFAULT '', amount_2 int(2) DEFAULT '0', flavour_3 varchar(12) DEFAULT '', amount_3 int(2) DEFAULT '0', flavour_4 varchar(12) DEFAULT '', amount_4 int(2) DEFAULT '0', PRIMARY KEY (paper_bag_id)) DEFAULT CHARSET=utf8 COLLATE utf8_general_ci;", - "CREATE TABLE IF NOT EXISTS %splayer_prefs (pp_id int(11) NOT NULL AUTO_INCREMENT, uuid varchar(48) DEFAULT '', player varchar(32), `key_item` varchar(32) DEFAULT '', sfx_on int(1) DEFAULT '0', quotes_on int(1) DEFAULT '0', artron_level int(11) DEFAULT '0', wall varchar(64) DEFAULT 'ORANGE_WOOL', floor varchar(64) DEFAULT 'LIGHT_GRAY_WOOL', siege_wall varchar(64) DEFAULT 'GRAY_TERRACOTTA', siege_floor varchar(64) DEFAULT 'BLACK_TERRACOTTA', announce_repeaters_on int(1) DEFAULT '0', auto_on int(1) DEFAULT '0', auto_type varchar(32) DEFAULT 'CLOSEST', auto_default varchar(12) DEFAULT 'HOME', beacon_on int(1) DEFAULT '1', hads_on int(1) DEFAULT '1', hads_type varchar(12) DEFAULT 'DISPLACEMENT', build_on int(1) DEFAULT '1', close_gui_on int(1) DEFAULT '1', eps_on int(1) DEFAULT '0', eps_message text, language varchar(32) DEFAULT 'ENGLISH', submarine_on int(1) DEFAULT '0', dnd_on int(1) DEFAULT '0', dynamic_lamps_on int(1) DEFAULT '0', minecart_on int(1) DEFAULT '0', renderer_on int(1) DEFAULT '1', sign_on int(1) DEFAULT '1', telepathy_on int(1) DEFAULT '0', travelbar_on int(1) DEFAULT '0', info_on int(1) DEFAULT '0', farm_on int(1) DEFAULT '1', lights varchar(32) DEFAULT 'TENTH', auto_siege_on int(1) DEFAULT '0', flying_mode int(1) DEFAULT '1', throttle int(1) DEFAULT '4', difficulty int(1) DEFAULT '0', auto_powerup_on int(1) DEFAULT '0', auto_rescue_on int(1) DEFAULT '0', hum varchar(24) DEFAULT '', PRIMARY KEY (pp_id)) DEFAULT CHARSET=utf8 COLLATE utf8_general_ci;", + "CREATE TABLE IF NOT EXISTS %sparticle_prefs (pp_id int(11) NOT NULL AUTO_INCREMENT, uuid varchar(48) DEFAULT '', `effect` varchar(32) DEFAULT 'ASH', `shape` varchar(32) DEFAULT 'RANDOM', `density` int(2) DEFAULT '16', `speed` int(2) DEFAULT '0', particles_on int(1) DEFAULT '0', PRIMARY KEY (pp_id)) DEFAULT CHARSET=utf8 COLLATE utf8_general_ci;", + + "CREATE TABLE IF NOT EXISTS %splayer_prefs (pp_id int(11) NOT NULL AUTO_INCREMENT, uuid varchar(48) DEFAULT '', player varchar(32), `key_item` varchar(32) DEFAULT '', sfx_on int(1) DEFAULT '0', quotes_on int(1) DEFAULT '0', artron_level int(11) DEFAULT '0', wall varchar(64) DEFAULT 'ORANGE_WOOL', floor varchar(64) DEFAULT 'LIGHT_GRAY_WOOL', siege_wall varchar(64) DEFAULT 'GRAY_TERRACOTTA', siege_floor varchar(64) DEFAULT 'BLACK_TERRACOTTA', announce_repeaters_on int(1) DEFAULT '0', auto_on int(1) DEFAULT '0', auto_type varchar(32) DEFAULT 'CLOSEST', auto_default varchar(12) DEFAULT 'HOME', beacon_on int(1) DEFAULT '1', hads_on int(1) DEFAULT '1', hads_type varchar(12) DEFAULT 'DISPLACEMENT', build_on int(1) DEFAULT '1', close_gui_on int(1) DEFAULT '1', eps_on int(1) DEFAULT '0', eps_message text, language varchar(32) DEFAULT 'ENGLISH', submarine_on int(1) DEFAULT '0', dnd_on int(1) DEFAULT '0', dynamic_lamps_on int(1) DEFAULT '0', minecart_on int(1) DEFAULT '0', renderer_on int(1) DEFAULT '1', sign_on int(1) DEFAULT '1', telepathy_on int(1) DEFAULT '0', travelbar_on int(1) DEFAULT '0', info_on int(1) DEFAULT '0', farm_on int(1) DEFAULT '1', lights varchar(32) DEFAULT 'TENTH', auto_siege_on int(1) DEFAULT '0', flying_mode int(1) DEFAULT '1', throttle int(1) DEFAULT '4', auto_powerup_on int(1) DEFAULT '0', auto_rescue_on int(1) DEFAULT '0', hum varchar(24) DEFAULT '', PRIMARY KEY (pp_id)) DEFAULT CHARSET=utf8 COLLATE utf8_general_ci;", "CREATE TABLE IF NOT EXISTS %sportals (portal_id int(11) NOT NULL AUTO_INCREMENT, portal varchar(512) DEFAULT '', teleport varchar(512) DEFAULT '', direction varchar(5) DEFAULT '', tardis_id int(11) DEFAULT '0', abandoned int(1) DEFAULT '0', PRIMARY KEY (portal_id)) DEFAULT CHARSET=utf8 COLLATE utf8_general_ci;", @@ -114,6 +116,8 @@ public class SQL { "CREATE TABLE IF NOT EXISTS %sstorage (storage_id int(11) NOT NULL AUTO_INCREMENT, tardis_id int(11) DEFAULT '0', uuid varchar(48) DEFAULT '', owner varchar(32) DEFAULT '', saves_one text NULL, saves_two text NULL, areas text NULL, presets_one text NULL, presets_two text NULL, biomes_one text NULL, biomes_two text NULL, players text NULL, circuits text NULL, console text NULL, PRIMARY KEY (storage_id)) DEFAULT CHARSET=utf8 COLLATE utf8_general_ci;", + "CREATE TABLE IF NOT EXISTS %ssystem_upgrades (sys_id int(11) NOT NULL AUTO_INCREMENT, tardis_id int(11) DEFAULT '0', uuid varchar(48) DEFAULT '', architecture int(1) DEFAULT '0', chameleon int(1) DEFAULT '0', rooms int(1) DEFAULT '0', desktop int(1) DEFAULT '0', navigation int(1) DEFAULT '0', saves int(1) DEFAULT '0', distance_1 int(1) DEFAULT '0', distance_2 int(1) DEFAULT '0', distance_3 int(1) DEFAULT '0', telepathic int(1) DEFAULT '0', inter_dimension int(1) DEFAULT '0', flight int(1) DEFAULT '0', tools int(1) DEFAULT '0', locator int(1) DEFAULT '0', biome_reader int(1) DEFAULT '0', force_field int(1) DEFAULT '0', monitor int(1) DEFAULT '0', stattenheim_remote int(1) DEFAULT '0', PRIMARY KEY (sys_id)) DEFAULT CHARSET=utf8 COLLATE utf8_general_ci;", + "CREATE TABLE IF NOT EXISTS %st_count (t_id int(11) NOT NULL AUTO_INCREMENT, uuid varchar(48) DEFAULT '', player varchar(32) DEFAULT '', count int(3) DEFAULT '0', grace int(3) DEFAULT '0', repair int(3) DEFAULT '0', PRIMARY KEY (t_id)) DEFAULT CHARSET=utf8 COLLATE utf8_general_ci;", "CREATE TABLE IF NOT EXISTS %stag (tag_id int(11) NOT NULL AUTO_INCREMENT, player varchar(32) DEFAULT '', `time` bigint(20) DEFAULT '0', PRIMARY KEY (tag_id)) DEFAULT CHARSET=utf8 COLLATE utf8_general_ci;", @@ -217,8 +221,10 @@ public class SQL { "(%s, %s, '%s', %s, %s, %s, '%s', %s)", "(%s, '%s', '%s', %s, '%s', %s, '%s', %s, '%s', %s)", + + "(%s, '%s', '%s', '%s', %s, %s, %s)", // player prefs - "(%s, '%s', '%s', '%s', %s, %s, %s, '%s', '%s', '%s', '%s', %s, %s, '%s', '%s', %s, %s, '%s', %s, %s, %s, '%s', '%s', %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, '%s', %s, %s, %s, %s, %s, %s, '%s')", + "(%s, '%s', '%s', '%s', %s, %s, %s, '%s', '%s', '%s', '%s', %s, %s, '%s', '%s', %s, %s, '%s', %s, %s, %s, '%s', '%s', %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, '%s', %s, %s, %s, %s, %s, '%s')", "(%s, '%s', '%s', '%s', %s, %s)", @@ -238,6 +244,8 @@ public class SQL { "(%s, %s, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')", + "(%s, %s, '%s', %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", + "(%s, '%s', '%s', %s, %s, %s)", "(%s, '%s', %s)", @@ -342,7 +350,9 @@ public class SQL { "INSERT INTO `%spaper_bag` (`paper_bag_id`, `uuid`, `flavour_1`, `amount_1`, `flavour_2`, `amount_2`, `flavour_3`, `amount_3`, `flavour_4`, `amount_4`) VALUES ", - "INSERT INTO `%splayer_prefs` (`pp_id`, `uuid`, `player`, `key_item`, `sfx_on`, `quotes_on`, `artron_level`, `wall`, `floor`, `siege_wall`, `siege_floor`, `announce_repeaters_on`, `auto_on`, `auto_type`, `auto_default`, `beacon_on`, `hads_on`, `hads_type`, `build_on`, `close_gui_on`, `eps_on`, `eps_message`, `language`, `submarine_on`, `dnd_on`, `dynamic_lamps_on`, `minecart_on`, `renderer_on`, `sign_on`, `telepathy_on`, `travelbar_on`, `info_on`, `farm_on`, `lights`, `auto_siege_on`, `flying_mode`, `throttle`, `difficulty`, `auto_powerup_on`, `auto_rescue_on`, `hum`) VALUES ", + "INSERT INTO `%sparticle_prefs` (`pp_id`, `uuid`, `effect`, `shape`, `density`, `speed`, `particles_on`) VALUES ", + + "INSERT INTO `%splayer_prefs` (`pp_id`, `uuid`, `player`, `key_item`, `sfx_on`, `quotes_on`, `artron_level`, `wall`, `floor`, `siege_wall`, `siege_floor`, `announce_repeaters_on`, `auto_on`, `auto_type`, `auto_default`, `beacon_on`, `hads_on`, `hads_type`, `build_on`, `close_gui_on`, `eps_on`, `eps_message`, `language`, `submarine_on`, `dnd_on`, `dynamic_lamps_on`, `minecart_on`, `renderer_on`, `sign_on`, `telepathy_on`, `travelbar_on`, `info_on`, `farm_on`, `lights`, `auto_siege_on`, `flying_mode`, `throttle`, `auto_powerup_on`, `auto_rescue_on`, `hum`) VALUES ", "INSERT INTO `%sportals` (`portal_id`, `portal`, `teleport`, `direction`, `tardis_id`, `abandoned`) VALUES ", @@ -362,6 +372,8 @@ public class SQL { "INSERT INTO `%sstorage` (`storage_id`, `tardis_id`, `uuid`, `owner`, `saves_one`, `saves_two`, `areas`, `presets_one`, `presets_two`, `biomes_one`, `biomes_two`, `players`, `circuits`, `console`) VALUES ", + "INSERT INTO `%ssystem_upgrades` (`sys_id`, `tardis_id`, `uuid`, `architecture`, `chameleon`, `rooms`, `desktop`, `navigation`, `saves`, `distance_1`, `distance_2`, `distance_3`, `telepathic`, `inter_dimension`, `flight`, `tools`, `locator`, `biome_reader`, `force_field`, `monitor`, `stattenheim_remote`) VALUES ", + "INSERT INTO `%st_count` (`t_id`, `uuid`, `player`, `count`, `grace`, `repair`) VALUES ", "INSERT INTO `%stag` (`tag_id`, `player`, `time`) VALUES ", diff --git a/src/main/java/me/eccentric_nz/TARDIS/database/tool/Table.java b/src/main/java/me/eccentric_nz/TARDIS/database/tool/Table.java index 3ac3b8b970..a8bfbe423e 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/database/tool/Table.java +++ b/src/main/java/me/eccentric_nz/TARDIS/database/tool/Table.java @@ -53,6 +53,7 @@ public enum Table { movers("uuid"), next, paper_bag, + particle_prefs("pp_id"), player_prefs("pp_id"), portals, programs, @@ -63,6 +64,7 @@ public enum Table { siege, sonic, storage, + system_upgrades("sys_id"), t_count("t_id"), tag, tardis("tardis_id"), diff --git a/src/main/java/me/eccentric_nz/TARDIS/desktop/TARDISArchiveInventory.java b/src/main/java/me/eccentric_nz/TARDIS/desktop/TARDISArchiveInventory.java index 560ddd7232..c393631190 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/desktop/TARDISArchiveInventory.java +++ b/src/main/java/me/eccentric_nz/TARDIS/desktop/TARDISArchiveInventory.java @@ -22,7 +22,7 @@ import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardisSize; import me.eccentric_nz.TARDIS.enumeration.ConsoleSize; import me.eccentric_nz.TARDIS.schematic.ResultSetArchiveButtons; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; diff --git a/src/main/java/me/eccentric_nz/TARDIS/desktop/TARDISArchiveMenuListener.java b/src/main/java/me/eccentric_nz/TARDIS/desktop/TARDISArchiveMenuListener.java index 5259dfc532..e8af7e5938 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/desktop/TARDISArchiveMenuListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/desktop/TARDISArchiveMenuListener.java @@ -27,7 +27,7 @@ import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; import me.eccentric_nz.TARDIS.schematic.ArchiveUpdate; import me.eccentric_nz.TARDIS.utility.TARDISNumberParsers; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.inventory.ClickType; diff --git a/src/main/java/me/eccentric_nz/TARDIS/desktop/TARDISThemeInventory.java b/src/main/java/me/eccentric_nz/TARDIS/desktop/TARDISThemeInventory.java index a1abfd3306..e15b562b75 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/desktop/TARDISThemeInventory.java +++ b/src/main/java/me/eccentric_nz/TARDIS/desktop/TARDISThemeInventory.java @@ -21,7 +21,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; import me.eccentric_nz.TARDIS.enumeration.Schematic; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; diff --git a/src/main/java/me/eccentric_nz/TARDIS/desktop/TARDISThemeMenuListener.java b/src/main/java/me/eccentric_nz/TARDIS/desktop/TARDISThemeMenuListener.java index 58ebc668c1..3eded7a10e 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/desktop/TARDISThemeMenuListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/desktop/TARDISThemeMenuListener.java @@ -24,7 +24,7 @@ import me.eccentric_nz.TARDIS.enumeration.Schematic; import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; import me.eccentric_nz.TARDIS.schematic.ArchiveUpdate; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.inventory.ClickType; diff --git a/src/main/java/me/eccentric_nz/TARDIS/desktop/TARDISWallMenuListener.java b/src/main/java/me/eccentric_nz/TARDIS/desktop/TARDISWallMenuListener.java index 969d65610b..360ea8958d 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/desktop/TARDISWallMenuListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/desktop/TARDISWallMenuListener.java @@ -20,7 +20,7 @@ import me.eccentric_nz.TARDIS.database.resultset.ResultSetPlayerPrefs; import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; import me.eccentric_nz.TARDIS.rooms.TARDISWalls; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/src/main/java/me/eccentric_nz/TARDIS/destroyers/TARDISDematerialisePoliceBox.java b/src/main/java/me/eccentric_nz/TARDIS/destroyers/TARDISDematerialisePoliceBox.java index d1c34e2250..1eecde3e2a 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/destroyers/TARDISDematerialisePoliceBox.java +++ b/src/main/java/me/eccentric_nz/TARDIS/destroyers/TARDISDematerialisePoliceBox.java @@ -20,9 +20,12 @@ import me.eccentric_nz.TARDIS.TARDISConstants; import me.eccentric_nz.TARDIS.builders.TARDISBuilderUtility; import me.eccentric_nz.TARDIS.customblocks.TARDISDisplayItemUtils; +import me.eccentric_nz.TARDIS.database.data.ParticleData; +import me.eccentric_nz.TARDIS.database.resultset.ResultSetParticlePrefs; import me.eccentric_nz.TARDIS.database.resultset.ResultSetPlayerPrefs; import me.eccentric_nz.TARDIS.enumeration.ChameleonPreset; import me.eccentric_nz.TARDIS.enumeration.SpaceTimeThrottle; +import me.eccentric_nz.TARDIS.particles.Emitter; import me.eccentric_nz.TARDIS.utility.TARDISSounds; import org.bukkit.Material; import org.bukkit.Sound; @@ -34,6 +37,8 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; +import java.util.UUID; + public class TARDISDematerialisePoliceBox implements Runnable { private final TARDIS plugin; @@ -101,7 +106,7 @@ public void run() { frame.remove(); } // spawn armour stand - stand = (ArmorStand) world.spawnEntity(dd.getLocation().clone().add(0.5d, 0,0.5d), EntityType.ARMOR_STAND); + stand = (ArmorStand) world.spawnEntity(dd.getLocation().clone().add(0.5d, 0, 0.5d), EntityType.ARMOR_STAND); } stand.setRotation(dd.getDirection().getYaw(), 0.0f); Material dye = TARDISBuilderUtility.getMaterialForArmourStand(preset, dd.getTardisID(), false); @@ -117,16 +122,26 @@ public void run() { } if (!minecart) { String sound = switch (spaceTimeThrottle) { - case WARP, RAPID, FASTER -> - "tardis_takeoff_" + spaceTimeThrottle.toString().toLowerCase(); + case WARP, RAPID, FASTER -> "tardis_takeoff_" + spaceTimeThrottle.toString().toLowerCase(); default -> // NORMAL - "tardis_takeoff"; + "tardis_takeoff"; }; TARDISSounds.playTARDISSound(dd.getLocation(), sound); } else { world.playSound(dd.getLocation(), Sound.ENTITY_MINECART_INSIDE, 1.0F, 0.0F); } } + if (dd.hasParticles()) { + ResultSetParticlePrefs rspp = new ResultSetParticlePrefs(plugin); + UUID uuid = dd.getPlayer().getUniqueId(); + if (rspp.fromUUID(uuid.toString())) { + ParticleData data = rspp.getData(); + // display particles + Emitter emitter = new Emitter(plugin, uuid, dd.getLocation(), data, dd.getThrottle().getFlightTime()); + int task = plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, emitter, 0, data.getShape().getPeriod()); + emitter.setTaskID(task); + } + } } if (is != null) { ItemMeta im = is.getItemMeta(); diff --git a/src/main/java/me/eccentric_nz/TARDIS/destroyers/TARDISDematerialisePreset.java b/src/main/java/me/eccentric_nz/TARDIS/destroyers/TARDISDematerialisePreset.java index 7a605435b3..0e980a61e7 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/destroyers/TARDISDematerialisePreset.java +++ b/src/main/java/me/eccentric_nz/TARDIS/destroyers/TARDISDematerialisePreset.java @@ -21,12 +21,14 @@ import me.eccentric_nz.TARDIS.chameleon.utils.TARDISChameleonColumn; import me.eccentric_nz.TARDIS.chameleon.utils.TARDISStainedGlassLookup; import me.eccentric_nz.TARDIS.customblocks.TARDISDisplayItemUtils; +import me.eccentric_nz.TARDIS.database.data.ParticleData; import me.eccentric_nz.TARDIS.database.resultset.ResultSetDoors; +import me.eccentric_nz.TARDIS.database.resultset.ResultSetParticlePrefs; import me.eccentric_nz.TARDIS.database.resultset.ResultSetPlayerPrefs; import me.eccentric_nz.TARDIS.enumeration.ChameleonPreset; -import me.eccentric_nz.TARDIS.enumeration.SpaceTimeThrottle; +import me.eccentric_nz.TARDIS.particles.Emitter; +import me.eccentric_nz.TARDIS.particles.TARDISParticles; import me.eccentric_nz.TARDIS.utility.TARDISBlockSetters; -import me.eccentric_nz.TARDIS.utility.TARDISParticles; import me.eccentric_nz.TARDIS.utility.TARDISSounds; import me.eccentric_nz.TARDIS.utility.TARDISStaticLocationGetters; import org.bukkit.*; @@ -40,6 +42,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; +import java.util.UUID; /** * A dematerialisation circuit was an essential part of a Type 40 TARDIS which enabled it to dematerialise from normal @@ -199,18 +202,16 @@ public void run() { if (dd.isOutside()) { ResultSetPlayerPrefs rsp = new ResultSetPlayerPrefs(plugin, dd.getPlayer().getUniqueId().toString()); boolean minecart = false; - SpaceTimeThrottle spaceTimeThrottle = SpaceTimeThrottle.NORMAL; if (rsp.resultSet()) { minecart = rsp.isMinecartOn(); - spaceTimeThrottle = SpaceTimeThrottle.getByDelay().get(rsp.getThrottle()); } if (!minecart) { String sound; if (preset.equals(ChameleonPreset.JUNK_MODE)) { sound = "junk_takeoff"; } else { - sound = switch (spaceTimeThrottle) { - case WARP, RAPID, FASTER -> "tardis_takeoff_" + spaceTimeThrottle.toString().toLowerCase(); + sound = switch (dd.getThrottle()) { + case WARP, RAPID, FASTER -> "tardis_takeoff_" + dd.getThrottle().toString().toLowerCase(); default -> "tardis_takeoff"; // NORMAL }; } @@ -219,6 +220,17 @@ public void run() { world.playSound(dd.getLocation(), Sound.ENTITY_MINECART_INSIDE, 1.0F, 0.0F); } } + if (dd.hasParticles()) { + ResultSetParticlePrefs rspp = new ResultSetParticlePrefs(plugin); + UUID uuid = dd.getPlayer().getUniqueId(); + if (rspp.fromUUID(uuid.toString())) { + ParticleData particleData = rspp.getData(); + // display particles + Emitter emitter = new Emitter(plugin, uuid, dd.getLocation(), particleData, dd.getThrottle().getFlightTime()); + int task = plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, emitter, 0, particleData.getShape().getPeriod()); + emitter.setTaskID(task); + } + } getColours(dd.getTardisID(), preset); } else if (preset.equals(ChameleonPreset.JUNK_MODE) && plugin.getConfig().getBoolean("junk.particles")) { // animate particles @@ -285,7 +297,13 @@ public void run() { BlockData chaw = (preset.equals(ChameleonPreset.FLOWER)) ? the_colour : colData[yy]; TARDISBlockSetters.setBlock(world, xx, (y + yy), zz, chaw); } - case ACACIA_SAPLING, ALLIUM, AZURE_BLUET, BAMBOO_SAPLING, BEETROOTS, BIRCH_SAPLING, BLUE_ORCHID, CARROTS, CORNFLOWER, CRIMSON_FUNGUS, CRIMSON_ROOTS, DANDELION, DARK_OAK_SAPLING, DEAD_BUSH, FERN, SHORT_GRASS, JUNGLE_SAPLING, LARGE_FERN, LILAC, LILY_OF_THE_VALLEY, OAK_SAPLING, ORANGE_TULIP, OXEYE_DAISY, PEONY, PINK_TULIP, POPPY, POTATOES, RED_TULIP, ROSE_BUSH, SPRUCE_SAPLING, SUGAR_CANE, SUNFLOWER, SWEET_BERRY_BUSH, TALL_GRASS, WARPED_FUNGUS, WARPED_ROOTS, WHEAT, WHITE_TULIP, WITHER_ROSE -> { + case ACACIA_SAPLING, ALLIUM, AZURE_BLUET, BAMBOO_SAPLING, BEETROOTS, BIRCH_SAPLING, + BLUE_ORCHID, CARROTS, CORNFLOWER, CRIMSON_FUNGUS, CRIMSON_ROOTS, DANDELION, + DARK_OAK_SAPLING, DEAD_BUSH, FERN, SHORT_GRASS, JUNGLE_SAPLING, LARGE_FERN, LILAC, + LILY_OF_THE_VALLEY, OAK_SAPLING, ORANGE_TULIP, OXEYE_DAISY, PEONY, PINK_TULIP, POPPY, + POTATOES, RED_TULIP, ROSE_BUSH, SPRUCE_SAPLING, SUGAR_CANE, SUNFLOWER, + SWEET_BERRY_BUSH, TALL_GRASS, WARPED_FUNGUS, WARPED_ROOTS, WHEAT, WHITE_TULIP, + WITHER_ROSE -> { } // lamps, glowstone and torches case TORCH, GLOWSTONE, REDSTONE_LAMP -> { @@ -298,7 +316,13 @@ public void run() { TARDISBlockSetters.setBlock(world, xx, (y + yy), zz, light); } // wood, iron & trap doors - case IRON_DOOR, ACACIA_DOOR, ACACIA_TRAPDOOR, ACACIA_WALL_SIGN, BAMBOO_DOOR, BAMBOO_TRAPDOOR, BAMBOO_WALL_SIGN, BIRCH_DOOR, BIRCH_TRAPDOOR, BIRCH_WALL_SIGN, CHERRY_DOOR, CHERRY_TRAPDOOR, CHERRY_WALL_SIGN, CRIMSON_DOOR, CRIMSON_TRAPDOOR, CRIMSON_WALL_SIGN, DARK_OAK_DOOR, DARK_OAK_TRAPDOOR, DARK_OAK_WALL_SIGN, JUNGLE_DOOR, JUNGLE_TRAPDOOR, JUNGLE_WALL_SIGN, MANGROVE_DOOR, MANGROVE_TRAPDOOR, MANGROVE_WALL_SIGN, OAK_DOOR, OAK_TRAPDOOR, OAK_WALL_SIGN, SPRUCE_DOOR, SPRUCE_TRAPDOOR, SPRUCE_WALL_SIGN, WARPED_DOOR, WARPED_TRAPDOOR, WARPED_WALL_SIGN -> { + case IRON_DOOR, ACACIA_DOOR, ACACIA_TRAPDOOR, ACACIA_WALL_SIGN, BAMBOO_DOOR, + BAMBOO_TRAPDOOR, BAMBOO_WALL_SIGN, BIRCH_DOOR, BIRCH_TRAPDOOR, BIRCH_WALL_SIGN, + CHERRY_DOOR, CHERRY_TRAPDOOR, CHERRY_WALL_SIGN, CRIMSON_DOOR, CRIMSON_TRAPDOOR, + CRIMSON_WALL_SIGN, DARK_OAK_DOOR, DARK_OAK_TRAPDOOR, DARK_OAK_WALL_SIGN, JUNGLE_DOOR, + JUNGLE_TRAPDOOR, JUNGLE_WALL_SIGN, MANGROVE_DOOR, MANGROVE_TRAPDOOR, + MANGROVE_WALL_SIGN, OAK_DOOR, OAK_TRAPDOOR, OAK_WALL_SIGN, SPRUCE_DOOR, + SPRUCE_TRAPDOOR, SPRUCE_WALL_SIGN, WARPED_DOOR, WARPED_TRAPDOOR, WARPED_WALL_SIGN -> { if (preset.equals(ChameleonPreset.SWAMP) || preset.equals(ChameleonPreset.TOPSYTURVEY) || preset.equals(ChameleonPreset.JAIL)) { TARDISBlockSetters.setBlock(world, xx, (y + yy), zz, Material.AIR); } diff --git a/src/main/java/me/eccentric_nz/TARDIS/doors/DoorLockAction.java b/src/main/java/me/eccentric_nz/TARDIS/doors/DoorLockAction.java index b4c64e2df8..8ec35cd926 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/doors/DoorLockAction.java +++ b/src/main/java/me/eccentric_nz/TARDIS/doors/DoorLockAction.java @@ -34,7 +34,7 @@ public void lockUnlock(Player player, Material m, int id, boolean isLocked, bool if (rs.fromUUID(playerUUID.toString())) { // must use key to lock / unlock door if (material.equals(m) || plugin.getConfig().getBoolean("preferences.any_key")) { - if (rs.getTardis_id() != id) { + if (rs.getTardisId() != id) { plugin.getMessenger().sendStatus(player, "DOOR_LOCK_UNLOCK"); return; } @@ -48,7 +48,7 @@ public void lockUnlock(Player player, Material m, int id, boolean isLocked, bool plugin.getQueryFactory().doUpdate("doors", setl, wherel); plugin.getMessenger().send(player, TardisModule.TARDIS, "DOOR_LOCK", message); } else if (material.isAir()) { - if (checkId && rs.getTardis_id() == id) { + if (checkId && rs.getTardisId() == id) { return; } // knock with hand if it's not their TARDIS diff --git a/src/main/java/me/eccentric_nz/TARDIS/enumeration/Adaption.java b/src/main/java/me/eccentric_nz/TARDIS/enumeration/Adaption.java index 90620cc80b..6fc7170a9f 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/enumeration/Adaption.java +++ b/src/main/java/me/eccentric_nz/TARDIS/enumeration/Adaption.java @@ -16,7 +16,7 @@ */ package me.eccentric_nz.TARDIS.enumeration; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; /** * @author eccentric_nz diff --git a/src/main/java/me/eccentric_nz/TARDIS/enumeration/ChameleonOption.java b/src/main/java/me/eccentric_nz/TARDIS/enumeration/ChameleonOption.java index 98dfc835ea..86e80691d6 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/enumeration/ChameleonOption.java +++ b/src/main/java/me/eccentric_nz/TARDIS/enumeration/ChameleonOption.java @@ -16,7 +16,7 @@ */ package me.eccentric_nz.TARDIS.enumeration; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; /** * @author eccentric_nz diff --git a/src/main/java/me/eccentric_nz/TARDIS/enumeration/Difficulty.java b/src/main/java/me/eccentric_nz/TARDIS/enumeration/CraftingDifficulty.java similarity index 95% rename from src/main/java/me/eccentric_nz/TARDIS/enumeration/Difficulty.java rename to src/main/java/me/eccentric_nz/TARDIS/enumeration/CraftingDifficulty.java index 7ff8eb1980..0dd29ebb3d 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/enumeration/Difficulty.java +++ b/src/main/java/me/eccentric_nz/TARDIS/enumeration/CraftingDifficulty.java @@ -19,9 +19,8 @@ /** * @author eccentric_nz */ -public enum Difficulty { +public enum CraftingDifficulty { EASY, - MEDIUM, HARD } diff --git a/src/main/java/me/eccentric_nz/TARDIS/enumeration/DiskCircuit.java b/src/main/java/me/eccentric_nz/TARDIS/enumeration/DiskCircuit.java index cc78171fa8..700dc02523 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/enumeration/DiskCircuit.java +++ b/src/main/java/me/eccentric_nz/TARDIS/enumeration/DiskCircuit.java @@ -46,6 +46,7 @@ public enum DiskCircuit { SAVE("Save Storage Disk", Material.MUSIC_DISC_CHIRP), SCANNER("TARDIS Scanner Circuit", Material.GLOWSTONE_DUST), SONIC("Sonic Screwdriver", Material.BLAZE_ROD), + TELEPATHIC("TARDIS Telepathic Circuit", Material.GLOWSTONE_DUST), TEMPORAL("TARDIS Temporal Circuit", Material.GLOWSTONE_DUST); static final List circuitNames = new ArrayList<>(); diff --git a/src/main/java/me/eccentric_nz/TARDIS/enumeration/GlowstoneCircuit.java b/src/main/java/me/eccentric_nz/TARDIS/enumeration/GlowstoneCircuit.java index 3290f148ac..bcb8c171b4 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/enumeration/GlowstoneCircuit.java +++ b/src/main/java/me/eccentric_nz/TARDIS/enumeration/GlowstoneCircuit.java @@ -48,6 +48,7 @@ public enum GlowstoneCircuit { SCANNER("TARDIS Scanner Circuit", 10001977), SONIC("Sonic Oscillator", 10001967), STATTENHEIM("TARDIS Stattenheim Circuit", 10001963), + TELEPATHIC("TARDIS Telepathic Circuit", 10001962), TEMPORAL("TARDIS Temporal Circuit", 10001974); private static final HashMap BY_NAME = new HashMap<>(); diff --git a/src/main/java/me/eccentric_nz/TARDIS/enumeration/RecipeItem.java b/src/main/java/me/eccentric_nz/TARDIS/enumeration/RecipeItem.java index cdd1d820a9..174cc675fd 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/enumeration/RecipeItem.java +++ b/src/main/java/me/eccentric_nz/TARDIS/enumeration/RecipeItem.java @@ -71,7 +71,7 @@ public enum RecipeItem { TARDIS_REMOTE_KEY(15, RecipeCategory.ITEMS), TARDIS_SCANNER_CIRCUIT(10001977, RecipeCategory.CONSOLE_CIRCUITS), TARDIS_STATTENHEIM_CIRCUIT(10001963, RecipeCategory.ITEM_CIRCUITS), - TARDIS_TELEPATHIC_CIRCUIT(10000001, RecipeCategory.CONSOLE_CIRCUITS), + TARDIS_TELEPATHIC_CIRCUIT(10001962, RecipeCategory.CONSOLE_CIRCUITS), TARDIS_TEMPORAL_CIRCUIT(10001974, RecipeCategory.CONSOLE_CIRCUITS), // rotors TIME_ROTOR_CONSOLE(10000100, RecipeCategory.ROTORS), diff --git a/src/main/java/me/eccentric_nz/TARDIS/files/TARDISBlocksUpdater.java b/src/main/java/me/eccentric_nz/TARDIS/files/TARDISBlocksUpdater.java index 0007f2e82c..0cbe233547 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/files/TARDISBlocksUpdater.java +++ b/src/main/java/me/eccentric_nz/TARDIS/files/TARDISBlocksUpdater.java @@ -478,6 +478,91 @@ public void checkBlocksConfig() { blocks_config.set("version", 13); i += 3; } + if (!tbs.contains("CHISELED_COPPER")) { + // 1.21 + List blocks = new ArrayList<>(); + blocks.add("CHISELED_COPPER"); + blocks.add("CHISELED_TUFF"); + blocks.add("CHISELED_TUFF_BRICKS"); + blocks.add("COPPER_BULB"); + blocks.add("COPPER_GRATE"); + blocks.add("EXPOSED_CHISELED_COPPER"); + blocks.add("EXPOSED_COPPER_BULB"); + blocks.add("EXPOSED_COPPER_GRATE"); + blocks.add("OXIDIZED_CHISELED_COPPER"); + blocks.add("OXIDIZED_COPPER_BULB"); + blocks.add("OXIDIZED_COPPER_GRATE"); + blocks.add("POLISHED_TUFF"); + blocks.add("TUFF_BRICKS"); + blocks.add("WAXED_CHISELED_COPPER"); + blocks.add("WAXED_COPPER_BULB"); + blocks.add("WAXED_COPPER_GRATE"); + blocks.add("WAXED_EXPOSED_CHISELED_COPPER"); + blocks.add("WAXED_EXPOSED_COPPER_BULB"); + blocks.add("WAXED_EXPOSED_COPPER_GRATE"); + blocks.add("WAXED_OXIDIZED_CHISELED_COPPER"); + blocks.add("WAXED_OXIDIZED_COPPER_BULB"); + blocks.add("WAXED_OXIDIZED_COPPER_GRATE"); + blocks.add("WAXED_WEATHERED_CHISELED_COPPER"); + blocks.add("WAXED_WEATHERED_COPPER_BULB"); + blocks.add("WAXED_WEATHERED_COPPER_GRATE"); + blocks.add("WEATHERED_CHISELED_COPPER"); + blocks.add("WEATHERED_COPPER_BULB"); + blocks.add("WEATHERED_COPPER_GRATE"); + // tardis blocks + tbs.addAll(blocks); + tbs.sort(Comparator.naturalOrder()); + blocks_config.set("tardis_blocks", tbs); + // under door blocks + List under = blocks_config.getStringList("under_door_blocks"); + under.add("COPPER_DOOR"); + under.add("COPPER_TRAPDOOR"); + under.add("EXPOSED_COPPER_DOOR"); + under.add("EXPOSED_COPPER_TRAPDOOR"); + under.add("HEAVY_CORE"); + under.add("OXIDIZED_COPPER_DOOR"); + under.add("OXIDIZED_COPPER_TRAPDOOR"); + under.add("POLISHED_TUFF_SLAB"); + under.add("POLISHED_TUFF_STAIRS"); + under.add("POLISHED_TUFF_WALL"); + under.add("TUFF_BRICK_SLAB"); + under.add("TUFF_BRICK_STAIRS"); + under.add("TUFF_BRICK_WALL"); + under.add("TUFF_SLAB"); + under.add("TUFF_STAIRS"); + under.add("TUFF_WALL"); + under.add("WAXED_COPPER_DOOR"); + under.add("WAXED_COPPER_TRAPDOOR"); + under.add("WAXED_EXPOSED_COPPER_DOOR"); + under.add("WAXED_EXPOSED_COPPER_TRAPDOOR"); + under.add("WAXED_OXIDIZED_COPPER_DOOR"); + under.add("WAXED_OXIDIZED_COPPER_TRAPDOOR"); + under.add("WAXED_WEATHERED_COPPER_DOOR"); + under.add("WAXED_WEATHERED_COPPER_TRAPDOOR"); + under.add("WEATHERED_COPPER_DOOR"); + under.add("WEATHERED_COPPER_TRAPDOOR"); + under.sort(Comparator.naturalOrder()); + blocks_config.set("under_door_blocks", under); + // chameleon blocks + List chameleon = blocks_config.getStringList("chameleon_blocks"); + chameleon.addAll(blocks); + chameleon.sort(Comparator.naturalOrder()); + blocks_config.set("chameleon_blocks", chameleon); + // lamp blocks + List lamps = blocks_config.getStringList("lamp_blocks"); + lamps.add("COPPER_BULB"); + lamps.add("EXPOSED_COPPER_BULB"); + lamps.add("OXIDIZED_COPPER_BULB"); + lamps.add("WAXED_COPPER_BULB"); + lamps.add("WAXED_EXPOSED_COPPER_BULB"); + lamps.add("WAXED_OXIDIZED_COPPER_BULB"); + lamps.add("WAXED_WEATHERED_COPPER_BULB"); + lamps.add("WEATHERED_COPPER_BULB"); + lamps.sort(Comparator.naturalOrder()); + blocks_config.set("lamp_blocks", lamps); + blocks_config.set("version", 15); + i += 4; + } try { blocks_config.save(new File(plugin.getDataFolder(), "blocks.yml")); if (i > 0) { diff --git a/src/main/java/me/eccentric_nz/TARDIS/files/TARDISCondensablesUpdater.java b/src/main/java/me/eccentric_nz/TARDIS/files/TARDISCondensablesUpdater.java index 8a47174a84..1237d6962b 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/files/TARDISCondensablesUpdater.java +++ b/src/main/java/me/eccentric_nz/TARDIS/files/TARDISCondensablesUpdater.java @@ -585,6 +585,72 @@ public void checkCondensables() { plugin.getCondensablesConfig().set("ARMS_POTTERY_SHERD UP", null); i++; } + if (!plugin.getCondensablesConfig().contains("ARMADILLO_SCUTE")) { + // 1.20.5 + plugin.getCondensablesConfig().set("ARMADILLO_SCUTE", 20); + plugin.getCondensablesConfig().set("WOLF_ARMOR", 120); + // 1.21 + plugin.getCondensablesConfig().set("BREEZE_ROD", 200); + plugin.getCondensablesConfig().set("CHISELED_COPPER", 360); + plugin.getCondensablesConfig().set("CHISELED_TUFF", 2); + plugin.getCondensablesConfig().set("CHISELED_TUFF_BRICKS", 4); + plugin.getCondensablesConfig().set("COPPER_BULB", 700); + plugin.getCondensablesConfig().set("COPPER_DOOR", 40); + plugin.getCondensablesConfig().set("COPPER_GRATE", 180); + plugin.getCondensablesConfig().set("COPPER_TRAPDOOR", 60); + plugin.getCondensablesConfig().set("CRAFTER", 210); + plugin.getCondensablesConfig().set("EXPOSED_CHISELED_COPPER", 360); + plugin.getCondensablesConfig().set("EXPOSED_COPPER_BULB", 700); + plugin.getCondensablesConfig().set("EXPOSED_COPPER_DOOR", 40); + plugin.getCondensablesConfig().set("EXPOSED_COPPER_GRATE", 180); + plugin.getCondensablesConfig().set("EXPOSED_COPPER_TRAPDOOR", 60); + plugin.getCondensablesConfig().set("HEAVY_CORE", 300); + plugin.getCondensablesConfig().set("OXIDIZED_CHISELED_COPPER", 360); + plugin.getCondensablesConfig().set("OXIDIZED_COPPER_BULB", 700); + plugin.getCondensablesConfig().set("OXIDIZED_COPPER_DOOR", 40); + plugin.getCondensablesConfig().set("OXIDIZED_COPPER_GRATE", 180); + plugin.getCondensablesConfig().set("OXIDIZED_COPPER_TRAPDOOR", 60); + plugin.getCondensablesConfig().set("POLISHED_TUFF", 2); + plugin.getCondensablesConfig().set("POLISHED_TUFF_SLAB", 2); + plugin.getCondensablesConfig().set("POLISHED_TUFF_STAIRS", 2); + plugin.getCondensablesConfig().set("POLISHED_TUFF_WALL", 2); + plugin.getCondensablesConfig().set("TUFF_BRICKS", 4); + plugin.getCondensablesConfig().set("TUFF_BRICK_SLAB", 2); + plugin.getCondensablesConfig().set("TUFF_BRICK_STAIRS", 2); + plugin.getCondensablesConfig().set("TUFF_BRICK_WALL", 2); + plugin.getCondensablesConfig().set("TUFF_SLAB", 2); + plugin.getCondensablesConfig().set("TUFF_STAIRS", 2); + plugin.getCondensablesConfig().set("TUFF_WALL", 2); + plugin.getCondensablesConfig().set("WAXED_CHISELED_COPPER", 2); + plugin.getCondensablesConfig().set("WAXED_COPPER_BULB", 720); + plugin.getCondensablesConfig().set("WAXED_COPPER_DOOR", 60); + plugin.getCondensablesConfig().set("WAXED_COPPER_GRATE", 200); + plugin.getCondensablesConfig().set("WAXED_COPPER_TRAPDOOR", 80); + plugin.getCondensablesConfig().set("WAXED_EXPOSED_CHISELED_COPPER", 380); + plugin.getCondensablesConfig().set("WAXED_EXPOSED_COPPER_BULB", 720); + plugin.getCondensablesConfig().set("WAXED_EXPOSED_COPPER_DOOR", 60); + plugin.getCondensablesConfig().set("WAXED_EXPOSED_COPPER_GRATE", 200); + plugin.getCondensablesConfig().set("WAXED_EXPOSED_COPPER_TRAPDOOR", 80); + plugin.getCondensablesConfig().set("WAXED_OXIDIZED_CHISELED_COPPER", 380); + plugin.getCondensablesConfig().set("WAXED_OXIDIZED_COPPER_BULB", 720); + plugin.getCondensablesConfig().set("WAXED_OXIDIZED_COPPER_DOOR", 60); + plugin.getCondensablesConfig().set("WAXED_OXIDIZED_COPPER_GRATE", 200); + plugin.getCondensablesConfig().set("WAXED_OXIDIZED_COPPER_TRAPDOOR", 80); + plugin.getCondensablesConfig().set("WAXED_WEATHERED_CHISELED_COPPER", 380); + plugin.getCondensablesConfig().set("WAXED_WEATHERED_COPPER_BULB", 720); + plugin.getCondensablesConfig().set("WAXED_WEATHERED_COPPER_DOOR", 60); + plugin.getCondensablesConfig().set("WAXED_WEATHERED_COPPER_GRATE", 200); + plugin.getCondensablesConfig().set("WAXED_WEATHERED_COPPER_TRAPDOOR", 80); + plugin.getCondensablesConfig().set("WEATHERED_CHISELED_COPPER", 360); + plugin.getCondensablesConfig().set("WEATHERED_COPPER_BULB", 700); + plugin.getCondensablesConfig().set("WEATHERED_COPPER_DOOR", 40); + plugin.getCondensablesConfig().set("WEATHERED_COPPER_GRATE", 180); + plugin.getCondensablesConfig().set("WEATHERED_COPPER_TRAPDOOR", 60); + plugin.getCondensablesConfig().set("FLOW_POTTERY_SHERD", 20); + plugin.getCondensablesConfig().set("GUSTER_POTTERY_SHERD", 20); + plugin.getCondensablesConfig().set("SCRAPE_POTTERY_SHERD", 20); + i++; + } if (i > 0) { try { String listPath = plugin.getDataFolder() + File.separator + "condensables.yml"; diff --git a/src/main/java/me/eccentric_nz/TARDIS/files/TARDISConfiguration.java b/src/main/java/me/eccentric_nz/TARDIS/files/TARDISConfiguration.java index abbe454298..90695a64ea 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/files/TARDISConfiguration.java +++ b/src/main/java/me/eccentric_nz/TARDIS/files/TARDISConfiguration.java @@ -23,7 +23,10 @@ import org.bukkit.configuration.file.YamlConfiguration; import java.io.File; -import java.util.*; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; /** * The Alpha Centauran Table Tennis Club is a club established by the Alpha Centaurans for the play of table tennis. The @@ -61,7 +64,6 @@ public TARDISConfiguration(TARDIS plugin) { booleanOptions.put("allow.invisibility", true); booleanOptions.put("allow.mob_farming", true); booleanOptions.put("allow.perception_filter", true); - booleanOptions.put("allow.player_difficulty", true); booleanOptions.put("allow.power_down", true); booleanOptions.put("allow.power_down_on_quit", false); booleanOptions.put("allow.repair", true); @@ -107,6 +109,12 @@ public TARDISConfiguration(TARDIS plugin) { booleanOptions.put("creation.seed_block.legacy", true); booleanOptions.put("debug", false); booleanOptions.put("desktop.check_blocks_before_upgrade", false); + booleanOptions.put("difficulty.circuits", false); + booleanOptions.put("difficulty.disks", false); + booleanOptions.put("difficulty.disk_in_hand_for_write", true); + booleanOptions.put("difficulty.biome_reader", true); + booleanOptions.put("difficulty.stattenheim_remote", false); + booleanOptions.put("difficulty.tardis_locator", false); booleanOptions.put("growth.return_room_seed", true); booleanOptions.put("growth.rooms_require_blocks", false); booleanOptions.put("junk.enabled", true); @@ -170,7 +178,9 @@ public TARDISConfiguration(TARDIS plugin) { integerOptions.put("circuits.uses.memory", 20); integerOptions.put("circuits.uses.randomiser", 50); integerOptions.put("circuits.uses.scanner", 20); + integerOptions.put("circuits.uses.telepathic", 20); integerOptions.put("circuits.uses.temporal", 20); + integerOptions.put("circuits.uses.stattenheim", 15); integerOptions.put("creation.border_radius", 256); integerOptions.put("creation.count", 0); integerOptions.put("creation.inventory_group", 0); @@ -220,11 +230,11 @@ public TARDISConfiguration(TARDIS plugin) { stringOptions.put("creation.seed_block.easy", "REDSTONE_TORCH"); stringOptions.put("creation.seed_block.normal", "SOUL_LANTERN"); stringOptions.put("creation.seed_block.hard", "DRAGON_BREATH"); + stringOptions.put("difficulty.crafting", "easy"); stringOptions.put("display.all", "&6X&7%X% &6Y&7%Y% &6Z&7%Z% &6F&7%FACING% (%FACING_XZ%) %TARGET_BLOCK%"); stringOptions.put("police_box.default_preset", "FACTORY"); stringOptions.put("police_box.sign_colour", "WHITE"); stringOptions.put("preferences.default_key", "eleventh"); - stringOptions.put("preferences.difficulty", "hard"); stringOptions.put("preferences.key", "GOLD_NUGGET"); stringOptions.put("preferences.language", "en"); stringOptions.put("preferences.respect_towny", "nation"); @@ -343,6 +353,39 @@ public void checkConfig() { plugin.getConfig().set("storage.mysql.url", null); i++; } + // transfer / remove difficulty settings + if (config.contains("preferences.difficulty")) { + switch (config.getString("preferences.difficulty", "easy").toLowerCase()) { + case "medium" -> { + plugin.getConfig().set("difficulty.crafting", "easy"); + plugin.getConfig().set("difficulty.circuits", false); + plugin.getConfig().set("difficulty.disks", false); + plugin.getConfig().set("difficulty.biome_reader", true); + plugin.getConfig().set("difficulty.stattenheim_remote", true); + plugin.getConfig().set("difficulty.tardis_locator", true); + } + case "hard" -> { + plugin.getConfig().set("difficulty.crafting", "hard"); + plugin.getConfig().set("difficulty.circuits", true); + plugin.getConfig().set("difficulty.disks", true); + plugin.getConfig().set("difficulty.biome_reader", false); + plugin.getConfig().set("difficulty.stattenheim_remote", true); + plugin.getConfig().set("difficulty.tardis_locator", true); + } + default -> { + plugin.getConfig().set("difficulty.crafting", "easy"); + plugin.getConfig().set("difficulty.circuits", false); + plugin.getConfig().set("difficulty.disks", false); + plugin.getConfig().set("difficulty.biome_reader", true); + plugin.getConfig().set("difficulty.stattenheim_remote", false); + plugin.getConfig().set("difficulty.tardis_locator", false); + } + } + plugin.getConfig().set("difficulty.disk_in_hand_for_write", true); + plugin.getConfig().set("difficulty.system_upgrades", true); + plugin.getConfig().set("preferences.difficulty", null); + i++; + } // check / transfer dynmap settings if (config.contains("preferences.enable_dynmap")) { plugin.getConfig().set("modules.mapping", config.getBoolean("preferences.enable_dynmap")); diff --git a/src/main/java/me/eccentric_nz/TARDIS/flight/FlightVisibility.java b/src/main/java/me/eccentric_nz/TARDIS/flight/FlightVisibility.java index 07b82d6710..0ad6970a11 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/flight/FlightVisibility.java +++ b/src/main/java/me/eccentric_nz/TARDIS/flight/FlightVisibility.java @@ -8,8 +8,8 @@ import net.minecraft.network.protocol.game.ClientboundSetEquipmentPacket; import net.minecraft.server.network.ServerGamePacketListenerImpl; import net.minecraft.world.entity.EquipmentSlot; -import org.bukkit.craftbukkit.v1_20_R4.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_20_R4.inventory.CraftItemStack; +import org.bukkit.craftbukkit.v1_21_R1.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_21_R1.inventory.CraftItemStack; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; diff --git a/src/main/java/me/eccentric_nz/TARDIS/flight/TARDISDematerialiseToVortex.java b/src/main/java/me/eccentric_nz/TARDIS/flight/TARDISDematerialiseToVortex.java index ff93bd3536..c1bd85eae9 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/flight/TARDISDematerialiseToVortex.java +++ b/src/main/java/me/eccentric_nz/TARDIS/flight/TARDISDematerialiseToVortex.java @@ -19,6 +19,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.api.event.TARDISDematerialisationEvent; import me.eccentric_nz.TARDIS.database.data.Tardis; +import me.eccentric_nz.TARDIS.database.data.Throticle; import me.eccentric_nz.TARDIS.database.resultset.ResultSetCurrentFromId; import me.eccentric_nz.TARDIS.database.resultset.ResultSetNextLocation; import me.eccentric_nz.TARDIS.database.resultset.ResultSetPlayerPrefs; @@ -45,14 +46,14 @@ public class TARDISDematerialiseToVortex implements Runnable { private final int id; private final Player player; private final Location handbrake; - private final SpaceTimeThrottle spaceTimeThrottle; + private final Throticle throticle; - public TARDISDematerialiseToVortex(TARDIS plugin, int id, Player player, Location handbrake, SpaceTimeThrottle spaceTimeThrottle) { + public TARDISDematerialiseToVortex(TARDIS plugin, int id, Player player, Location handbrake, Throticle throticle) { this.plugin = plugin; this.id = id; this.player = player; this.handbrake = handbrake; - this.spaceTimeThrottle = spaceTimeThrottle; + this.throticle = throticle; } @Override @@ -98,7 +99,8 @@ public void run() { dd.setOutside(false); dd.setSubmarine(sub); dd.setTardisID(id); - dd.setThrottle(spaceTimeThrottle); + dd.setThrottle(throticle.getThrottle()); + dd.setParticles(throticle.getParticles()); ChameleonPreset preset = tardis.getPreset(); if (preset.equals(ChameleonPreset.JUNK_MODE)) { HashMap wherenl = new HashMap<>(); @@ -121,7 +123,7 @@ public void run() { if (plugin.getTrackerKeeper().getMalfunction().get(id) && plugin.getTrackerKeeper().getHasDestination().containsKey(id)) { sound = "tardis_malfunction_takeoff"; } else { - sound = switch (spaceTimeThrottle) { + sound = switch (throticle.getThrottle()) { case WARP -> "tardis_takeoff_warp"; case RAPID -> "tardis_takeoff_rapid"; case FASTER -> "tardis_takeoff_faster"; diff --git a/src/main/java/me/eccentric_nz/TARDIS/flight/TARDISHandbrakeListener.java b/src/main/java/me/eccentric_nz/TARDIS/flight/TARDISHandbrakeListener.java index 36eb2493ab..3e95c30a35 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/flight/TARDISHandbrakeListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/flight/TARDISHandbrakeListener.java @@ -25,8 +25,11 @@ import me.eccentric_nz.TARDIS.builders.TARDISSculkShrieker; import me.eccentric_nz.TARDIS.camera.TARDISCameraTracker; import me.eccentric_nz.TARDIS.database.data.Tardis; +import me.eccentric_nz.TARDIS.database.data.Throticle; import me.eccentric_nz.TARDIS.database.resultset.*; -import me.eccentric_nz.TARDIS.enumeration.*; +import me.eccentric_nz.TARDIS.enumeration.ChameleonPreset; +import me.eccentric_nz.TARDIS.enumeration.DiskCircuit; +import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.rotors.Rotor; import me.eccentric_nz.TARDIS.rotors.TARDISTimeRotor; import me.eccentric_nz.TARDIS.utility.Handbrake; @@ -111,12 +114,9 @@ public void onInteract(PlayerInteractEvent event) { if (found) { event.setCancelled(true); int id = tmp_id; - TARDISCircuitChecker tcc = null; - if (!plugin.getDifficulty().equals(Difficulty.EASY) && !plugin.getUtils().inGracePeriod(player, event.getAction().equals(Action.LEFT_CLICK_BLOCK))) { - tcc = new TARDISCircuitChecker(plugin, id); - tcc.getCircuits(); - } - if (tcc != null && !tcc.hasMaterialisation()) { + TARDISCircuitChecker tcc = new TARDISCircuitChecker(plugin, id); + tcc.getCircuits(); + if (plugin.getConfig().getBoolean("difficulty.circuits") && !plugin.getUtils().inGracePeriod(player, event.getAction().equals(Action.LEFT_CLICK_BLOCK)) && !tcc.hasMaterialisation()) { plugin.getMessenger().send(player, TardisModule.TARDIS, "NO_MAT_CIRCUIT"); return; } @@ -156,11 +156,10 @@ public void onInteract(PlayerInteractEvent event) { ResultSetPlayerPrefs rsp = new ResultSetPlayerPrefs(plugin, uuid.toString()); boolean beac_on = true; boolean bar = false; - SpaceTimeThrottle spaceTimeThrottle = SpaceTimeThrottle.NORMAL; + Throticle throticle = new ResultSetThrottle(plugin).getSpeedAndParticles(uuid.toString()); if (rsp.resultSet()) { beac_on = rsp.isBeaconOn(); bar = rsp.isTravelbarOn(); - spaceTimeThrottle = SpaceTimeThrottle.getByDelay().get(rsp.getThrottle()); } if (action == Action.RIGHT_CLICK_BLOCK) { if (tardis.isHandbrakeOn()) { @@ -205,7 +204,7 @@ public void onInteract(PlayerInteractEvent event) { Location current = new Location(rsc.getWorld(), rsc.getX(), rsc.getY(), rsc.getZ(), player.getLocation().getYaw(), player.getLocation().getPitch()); new TARDISExteriorFlight(plugin).startFlying(player, id, block, current, beac_on, beacon, preset.equals(ChameleonPreset.PANDORICA)); } else { - new TARDISTakeoff(plugin).run(id, block, handbrake_loc, player, beac_on, beacon, bar, spaceTimeThrottle); + new TARDISTakeoff(plugin).run(id, block, handbrake_loc, player, beac_on, beacon, bar, throticle); } // start time rotor? if (tardis.getRotor() != null) { @@ -262,7 +261,7 @@ public void onInteract(PlayerInteractEvent event) { // Remove energy from TARDIS and sets database plugin.getMessenger().sendStatus(player, "HANDBRAKE_ON"); if (plugin.getTrackerKeeper().getHasDestination().containsKey(id)) { - int amount = Math.round(plugin.getTrackerKeeper().getHasDestination().get(id).getCost() * spaceTimeThrottle.getArtronMultiplier()); + int amount = Math.round(plugin.getTrackerKeeper().getHasDestination().get(id).getCost() * throticle.getThrottle().getArtronMultiplier()); HashMap wheret = new HashMap<>(); wheret.put("tardis_id", id); plugin.getQueryFactory().alterEnergyLevel("tardis", -amount, wheret, player); @@ -278,7 +277,7 @@ public void onInteract(PlayerInteractEvent event) { plugin.getTrackerKeeper().getHasRandomised().removeAll(Collections.singleton(id)); } // damage the circuit if configured - if (tcc != null && plugin.getConfig().getBoolean("circuits.damage") && plugin.getConfig().getInt("circuits.uses.materialisation") > 0) { + if (plugin.getConfig().getBoolean("circuits.damage") && plugin.getConfig().getInt("circuits.uses.materialisation") > 0) { // decrement uses int uses_left = tcc.getMaterialisationUses(); new TARDISCircuitDamager(plugin, DiskCircuit.MATERIALISATION, uses_left, id, player).damage(); diff --git a/src/main/java/me/eccentric_nz/TARDIS/flight/TARDISLand.java b/src/main/java/me/eccentric_nz/TARDIS/flight/TARDISLand.java index 331c8c9bac..cd726c25e2 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/flight/TARDISLand.java +++ b/src/main/java/me/eccentric_nz/TARDIS/flight/TARDISLand.java @@ -16,15 +16,16 @@ */ package me.eccentric_nz.TARDIS.flight; -import java.util.HashMap; import me.eccentric_nz.TARDIS.TARDIS; +import me.eccentric_nz.TARDIS.database.data.Throticle; import me.eccentric_nz.TARDIS.database.resultset.ResultSetControls; import me.eccentric_nz.TARDIS.database.resultset.ResultSetThrottle; -import me.eccentric_nz.TARDIS.enumeration.SpaceTimeThrottle; import me.eccentric_nz.TARDIS.utility.TARDISStaticLocationGetters; import org.bukkit.Location; import org.bukkit.entity.Player; +import java.util.HashMap; + /** * @author eccentric_nz */ @@ -33,13 +34,13 @@ public class TARDISLand { private final TARDIS plugin; private final int id; private final Player player; - private final SpaceTimeThrottle spaceTimeThrottle; + private final Throticle throticle; public TARDISLand(TARDIS plugin, int id, Player player) { this.plugin = plugin; this.id = id; this.player = player; - spaceTimeThrottle = getThrottle(this.player); + throticle = getThrottle(this.player); } public void exitVortex() { @@ -52,11 +53,11 @@ public void exitVortex() { if (rsh.resultSet()) { Location handbrake = TARDISStaticLocationGetters.getLocationFromBukkitString(rsh.getLocation()); // materialise - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new TARDISMaterialseFromVortex(plugin, id, player, handbrake, spaceTimeThrottle), 10L); + plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new TARDISMaterialseFromVortex(plugin, id, player, handbrake, throticle), 10L); } } - private SpaceTimeThrottle getThrottle(Player player) { - return new ResultSetThrottle(plugin).getSpeed(player.getUniqueId().toString()); + private Throticle getThrottle(Player player) { + return new ResultSetThrottle(plugin).getSpeedAndParticles(player.getUniqueId().toString()); } } diff --git a/src/main/java/me/eccentric_nz/TARDIS/flight/TARDISMaterialseFromVortex.java b/src/main/java/me/eccentric_nz/TARDIS/flight/TARDISMaterialseFromVortex.java index 025c54a0af..a5f3f7531a 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/flight/TARDISMaterialseFromVortex.java +++ b/src/main/java/me/eccentric_nz/TARDIS/flight/TARDISMaterialseFromVortex.java @@ -23,6 +23,7 @@ import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; import me.eccentric_nz.TARDIS.builders.BuildData; import me.eccentric_nz.TARDIS.database.data.Tardis; +import me.eccentric_nz.TARDIS.database.data.Throticle; import me.eccentric_nz.TARDIS.database.resultset.*; import me.eccentric_nz.TARDIS.enumeration.*; import me.eccentric_nz.TARDIS.hads.TARDISCloisterBell; @@ -52,14 +53,14 @@ public class TARDISMaterialseFromVortex implements Runnable { private final int id; private final Player player; private final Location handbrake; - private final SpaceTimeThrottle spaceTimeThrottle; + private final Throticle throticle; - public TARDISMaterialseFromVortex(TARDIS plugin, int id, Player player, Location handbrake, SpaceTimeThrottle spaceTimeThrottle) { + public TARDISMaterialseFromVortex(TARDIS plugin, int id, Player player, Location handbrake, Throticle throticle) { this.plugin = plugin; this.id = id; this.player = player; this.handbrake = handbrake; - this.spaceTimeThrottle = spaceTimeThrottle; + this.throticle = throticle; } @Override @@ -100,7 +101,7 @@ public void run() { setsave.put("submarine", 0); plugin.getQueryFactory().doSyncUpdate("next", setsave, wheress); if (plugin.getTrackerKeeper().getHasDestination().containsKey(id)) { - int amount = Math.round(plugin.getTrackerKeeper().getHasDestination().get(id).getCost() * spaceTimeThrottle.getArtronMultiplier()); + int amount = Math.round(plugin.getTrackerKeeper().getHasDestination().get(id).getCost() * throticle.getThrottle().getArtronMultiplier()); HashMap wheret = new HashMap<>(); wheret.put("tardis_id", id); plugin.getQueryFactory().alterEnergyLevel("tardis", -amount, wheret, player); @@ -161,6 +162,7 @@ public void run() { bd.setSubmarine(is_next_sub); bd.setTardisID(id); bd.setThrottle(spaceTimeThrottle); + bd.setParticles(throticle.getParticles()); // determine delay values long flight_mode_delay; long travel_time; diff --git a/src/main/java/me/eccentric_nz/TARDIS/flight/TARDISTakeoff.java b/src/main/java/me/eccentric_nz/TARDIS/flight/TARDISTakeoff.java index 9750f271c1..5eea054866 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/flight/TARDISTakeoff.java +++ b/src/main/java/me/eccentric_nz/TARDIS/flight/TARDISTakeoff.java @@ -18,9 +18,10 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.api.event.TARDISTravelEvent; +import me.eccentric_nz.TARDIS.database.data.Throticle; import me.eccentric_nz.TARDIS.database.resultset.ResultSetControls; import me.eccentric_nz.TARDIS.database.resultset.ResultSetPlayerPrefs; -import me.eccentric_nz.TARDIS.enumeration.SpaceTimeThrottle; +import me.eccentric_nz.TARDIS.database.resultset.ResultSetThrottle; import me.eccentric_nz.TARDIS.enumeration.TravelType; import me.eccentric_nz.TARDIS.travel.TARDISMalfunction; import me.eccentric_nz.TARDIS.utility.Handbrake; @@ -43,7 +44,7 @@ public TARDISTakeoff(TARDIS plugin) { this.plugin = plugin; } - public void run(int id, Block block, Location handbrake, Player player, boolean beac_on, String beacon, boolean bar, SpaceTimeThrottle spaceTimeThrottle) { + public void run(int id, Block block, Location handbrake, Player player, boolean beac_on, String beacon, boolean bar, Throticle throticle) { if (block != null) { // set the handbrake TARDISHandbrake.setLevers(block, false, true, handbrake.toString(), id, plugin); @@ -70,19 +71,19 @@ public void run(int id, Block block, Location handbrake, Player player, boolean plugin.getTrackerKeeper().getMalfunction().put(id, malfunction); } // dematerialise - new TARDISDematerialiseToVortex(plugin, id, player, handbrake, spaceTimeThrottle).run(); + new TARDISDematerialiseToVortex(plugin, id, player, handbrake, throticle).run(); if (plugin.getTrackerKeeper().getHasDestination().containsKey(id)) { plugin.getPM().callEvent(new TARDISTravelEvent(player, null, plugin.getTrackerKeeper().getHasDestination().get(id).getTravelType(), id)); // materialise - new TARDISMaterialseFromVortex(plugin, id, player, handbrake, spaceTimeThrottle).run(); + new TARDISMaterialseFromVortex(plugin, id, player, handbrake, throticle).run(); } else { if (!plugin.getTrackerKeeper().getDestinationVortex().containsKey(id)) { - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new TARDISLoopingFlightSound(plugin, handbrake, id), spaceTimeThrottle.getFlightTime()); + plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new TARDISLoopingFlightSound(plugin, handbrake, id), throticle.getThrottle().getFlightTime()); } plugin.getPM().callEvent(new TARDISTravelEvent(player, null, TravelType.VORTEX, id)); } if (bar) { - new TARDISTravelBar(plugin, id).showTravelRemaining(player, spaceTimeThrottle.getFlightTime(), true); + new TARDISTravelBar(plugin, id).showTravelRemaining(player, throticle.getThrottle().getFlightTime(), true); } } @@ -95,15 +96,15 @@ public void run(int id, Player player, String beacon) { if (rs.resultSet()) { Location handbrake = TARDISStaticLocationGetters.getLocationFromBukkitString(rs.getLocation()); // should the beacon turn on - ResultSetPlayerPrefs rsp = new ResultSetPlayerPrefs(plugin, player.getUniqueId().toString()); + String uuid = player.getUniqueId().toString(); + ResultSetPlayerPrefs rsp = new ResultSetPlayerPrefs(plugin, uuid); boolean beac_on = true; boolean bar = false; - SpaceTimeThrottle spaceTimeThrottle = SpaceTimeThrottle.NORMAL; if (rsp.resultSet()) { beac_on = rsp.isBeaconOn(); bar = rsp.isTravelbarOn(); - spaceTimeThrottle = SpaceTimeThrottle.getByDelay().get(rsp.getThrottle()); } + Throticle throticle = new ResultSetThrottle(plugin).getSpeedAndParticles(uuid); // set the handbrake TARDISHandbrake.setLevers(handbrake.getBlock(), false, true, rs.getLocation(), rs.getTardis_id(), plugin); if (plugin.getConfig().getBoolean("circuits.damage")) { @@ -126,17 +127,17 @@ public void run(int id, Player player, String beacon) { boolean malfunction = new TARDISMalfunction(plugin).isMalfunction(); plugin.getTrackerKeeper().getMalfunction().put(id, malfunction); // dematerialise - new TARDISDematerialiseToVortex(plugin, id, player, handbrake, spaceTimeThrottle).run(); + new TARDISDematerialiseToVortex(plugin, id, player, handbrake, throticle).run(); if (plugin.getTrackerKeeper().getHasDestination().containsKey(id)) { // materialise - new TARDISMaterialseFromVortex(plugin, id, player, handbrake, spaceTimeThrottle).run(); + new TARDISMaterialseFromVortex(plugin, id, player, handbrake, throticle).run(); } else { if (!plugin.getTrackerKeeper().getDestinationVortex().containsKey(id)) { - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new TARDISLoopingFlightSound(plugin, handbrake, id), spaceTimeThrottle.getFlightTime()); + plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new TARDISLoopingFlightSound(plugin, handbrake, id), throticle.getThrottle().getFlightTime()); } } if (bar) { - new TARDISTravelBar(plugin, id).showTravelRemaining(player, spaceTimeThrottle.getFlightTime(), true); + new TARDISTravelBar(plugin, id).showTravelRemaining(player, throticle.getThrottle().getFlightTime(), true); } } } diff --git a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateAddCompanionsForm.java b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateAddCompanionsForm.java index c1f8cf5b19..104492bbd2 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateAddCompanionsForm.java +++ b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateAddCompanionsForm.java @@ -48,7 +48,7 @@ public void send() { } } builder.button("Everyone"); - builder.validResultHandler(response -> handleResponse(response)); + builder.validResultHandler(this::handleResponse); SimpleForm form = builder.build(); FloodgatePlayer player = FloodgateApi.getInstance().getPlayer(uuid); player.sendForm(form); diff --git a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateAreasForm.java b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateAreasForm.java index 5f8a74fb30..58f1b53722 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateAreasForm.java +++ b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateAreasForm.java @@ -43,11 +43,11 @@ public void send() { for (Area a : rsa.getData()) { String name = a.getAreaName(); if (TARDISPermission.hasPermission(player, "tardis.area." + name) || TARDISPermission.hasPermission(player, "tardis.area.*")) { - builder.button(name, FormImage.Type.URL, String.format(path, FloodgateColouredBlocks.IMAGES.get(i))); + builder.button(name, FormImage.Type.PATH, String.format(path, FloodgateColouredBlocks.IMAGES.get(i))); i++; } } - builder.validResultHandler(response -> handleResponse(response)); + builder.validResultHandler(this::handleResponse); SimpleForm form = builder.build(); FloodgatePlayer player = FloodgateApi.getInstance().getPlayer(uuid); player.sendForm(form); diff --git a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateBiomes.java b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateBiomes.java new file mode 100644 index 0000000000..827bd8df6a --- /dev/null +++ b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateBiomes.java @@ -0,0 +1,75 @@ +package me.eccentric_nz.TARDIS.floodgate; + +import org.bukkit.block.Biome; + +import java.util.HashMap; + +public class FloodgateBiomes { + + public static HashMap BIOME_BLOCKS = new HashMap<>() {{ + put(Biome.BADLANDS, "blocks/red_sand.png"); + put(Biome.BAMBOO_JUNGLE, "blocks/bamboo_block.png"); + put(Biome.BEACH, "blocks/sand.png"); + put(Biome.BIRCH_FOREST, "blocks/planks_birch.png"); + put(Biome.CHERRY_GROVE, "blocks/cherry_planks.png"); + put(Biome.CRIMSON_FOREST, "blocks/crimson_planks.png"); + put(Biome.CUSTOM, "blocks/barrier.png"); + put(Biome.COLD_OCEAN, "items/fish_salmon_raw.png"); + put(Biome.DARK_FOREST, "blocks/planks_big_oak.png"); + put(Biome.DEEP_COLD_OCEAN, "items/sea_pickle.png"); + put(Biome.DEEP_DARK, "blocks/sculk_catalyst_top.png"); + put(Biome.DEEP_FROZEN_OCEAN, "blocks/seagrass_carried.png"); + put(Biome.DEEP_LUKEWARM_OCEAN, "blocks/coral_blue.png"); + put(Biome.DEEP_OCEAN, "blocks/prismarine_bricks.png"); + put(Biome.DESERT, "blocks/sandstone_normal.png"); + put(Biome.DRIPSTONE_CAVES, "blocks/dripstone_block.png"); + put(Biome.END_BARRENS, "blocks/end_bricks.png"); + put(Biome.END_HIGHLANDS, "blocks/chorus_plant.png"); + put(Biome.END_MIDLANDS, "blocks/purpur_block.png"); + put(Biome.ERODED_BADLANDS, "blocks/hardened_clay_stained_yellow.png"); + put(Biome.FLOWER_FOREST, "blocks/flower_tulip_orange.png"); + put(Biome.FOREST, "blocks/planks_oak.png"); + put(Biome.FROZEN_OCEAN, "blocks/blue_ice.png"); + put(Biome.FROZEN_PEAKS, "items/bucket_powder_snow.png"); + put(Biome.FROZEN_RIVER, "blocks/ice.png"); + put(Biome.GROVE, "blocks/grass_block_snow.png"); + put(Biome.ICE_SPIKES, "blocks/ice_packed.png"); + put(Biome.JAGGED_PEAKS, "items/goat_horn.png"); + put(Biome.JUNGLE, "blocks/planks_jungle.png"); + put(Biome.LUKEWARM_OCEAN, "blocks/coral_red.png"); + put(Biome.LUSH_CAVES, "blocks/moss_block.png"); + put(Biome.MANGROVE_SWAMP, "blocks/mangrove_planks.png"); + put(Biome.MEADOW, "blocks/flower_tulip_red.png"); + put(Biome.MUSHROOM_FIELDS, "blocks/mycelium_side.png"); + put(Biome.NETHER_WASTES, "blocks/netherrack.png"); + put(Biome.OCEAN, "items/kelp.png"); + put(Biome.OLD_GROWTH_BIRCH_FOREST, "blocks/stripped_birch_log.png"); + put(Biome.OLD_GROWTH_PINE_TAIGA, "blocks/log_spruce.png"); + put(Biome.OLD_GROWTH_SPRUCE_TAIGA, "blocks/stripped_spruce_log.png"); + put(Biome.PLAINS, "blocks/grass_side_carried.png"); + put(Biome.RIVER, "items/fishing_rod_uncast.png"); + put(Biome.SAVANNA, "blocks/planks_acacia.png"); + put(Biome.SAVANNA_PLATEAU, "blocks/leaves_acacia_carried.tga"); + put(Biome.SMALL_END_ISLANDS, "blocks/end_stone.png"); + put(Biome.SNOWY_BEACH, "blocks/sandstone_smooth.png"); + put(Biome.SNOWY_PLAINS, "blocks/snow.png"); + put(Biome.SNOWY_SLOPES, "items/snowball.png"); + put(Biome.SNOWY_TAIGA, "blocks/leaves_spruce_carried.tga"); + put(Biome.SOUL_SAND_VALLEY, "blocks/soul_sand.png"); + put(Biome.SPARSE_JUNGLE, "items/dye_powder_brown.png"); + put(Biome.STONY_PEAKS, "blocks/calcite.png"); + put(Biome.STONY_SHORE, "blocks/stone.png"); + put(Biome.SUNFLOWER_PLAINS, "blocks/double_plant_sunflower_front.png"); + put(Biome.SWAMP, "blocks/carried_waterlily.png"); + put(Biome.TAIGA, "blocks/planks_spruce.png"); + put(Biome.THE_END, "blocks/obsidian.png"); + put(Biome.THE_VOID, "blocks/barrier.png"); + put(Biome.WARM_OCEAN, "blocks/coral_pink.png"); + put(Biome.WARPED_FOREST, "blocks/warped_planks.png"); + put(Biome.WINDSWEPT_FOREST, "blocks/leaves_oak_carried.tga"); + put(Biome.WINDSWEPT_GRAVELLY_HILLS, "blocks/gravel.png"); + put(Biome.WINDSWEPT_HILLS, "blocks/emerald_ore.png"); + put(Biome.WINDSWEPT_SAVANNA, "blocks/log_acacia.png"); + put(Biome.WOODED_BADLANDS, "blocks/coarse_dirt.png"); + }}; +} diff --git a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateBiomesForm.java b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateBiomesForm.java new file mode 100644 index 0000000000..ab39257512 --- /dev/null +++ b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateBiomesForm.java @@ -0,0 +1,76 @@ +package me.eccentric_nz.TARDIS.floodgate; + +import me.eccentric_nz.TARDIS.TARDIS; +import me.eccentric_nz.TARDIS.console.telepathic.EnvironmentBiomes; +import me.eccentric_nz.TARDIS.database.resultset.ResultSetCurrentFromId; +import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardisArtron; +import me.eccentric_nz.TARDIS.enumeration.TardisModule; +import me.eccentric_nz.TARDIS.utility.TARDISStringUtils; +import org.bukkit.Bukkit; +import org.bukkit.World; +import org.bukkit.block.Biome; +import org.bukkit.entity.Player; +import org.geysermc.cumulus.form.SimpleForm; +import org.geysermc.cumulus.response.SimpleFormResponse; +import org.geysermc.cumulus.util.FormImage; +import org.geysermc.floodgate.api.FloodgateApi; +import org.geysermc.floodgate.api.player.FloodgatePlayer; + +import java.util.List; +import java.util.UUID; + +public class FloodgateBiomesForm { + + private final TARDIS plugin; + private final UUID uuid; + private final int id; + + public FloodgateBiomesForm(TARDIS plugin, UUID uuid, int id) { + this.plugin = plugin; + this.uuid = uuid; + this.id = id; + } + + public void send() { + // get biomes + SimpleForm.Builder builder = SimpleForm.builder(); + builder.title("Telepathic Biome Finder"); + // only show biomes for the environment the TARDIS is currently in + ResultSetCurrentFromId rsc = new ResultSetCurrentFromId(plugin, id); + if (rsc.resultSet()) { + World.Environment environment = rsc.getWorld().getEnvironment(); + // biome finder + List biomes; + switch (environment) { + case NETHER -> biomes = EnvironmentBiomes.NETHER; + case THE_END -> biomes = EnvironmentBiomes.END; + default -> biomes = EnvironmentBiomes.OVERWORLD; + } + for (Biome biome : biomes) { + String path = FloodgateBiomes.BIOME_BLOCKS.get(biome); + builder.button(TARDISStringUtils.capitalise(biome.toString()), FormImage.Type.PATH, String.format("textures/%s", path)); + } + } + builder.validResultHandler(this::handleResponse); + SimpleForm form = builder.build(); + FloodgatePlayer player = FloodgateApi.getInstance().getPlayer(uuid); + player.sendForm(form); + } + + private void handleResponse(SimpleFormResponse response) { + Player player = Bukkit.getPlayer(uuid); + // get tardis artron level + ResultSetTardisArtron rs = new ResultSetTardisArtron(plugin); + if (!rs.fromID(id)) { + return; + } + int level = rs.getArtronLevel(); + int travel = plugin.getArtronConfig().getInt("travel"); + if (level < travel) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "NOT_ENOUGH_ENERGY"); + return; + } + String enumStr = TARDISStringUtils.toEnumUppercase(response.clickedButton().text()); + player.performCommand("tardistravel biome " + enumStr); + } +} diff --git a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateChameleonCircuitForm.java b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateChameleonCircuitForm.java index 7ddf219baf..28d1be8cad 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateChameleonCircuitForm.java +++ b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateChameleonCircuitForm.java @@ -1,8 +1,5 @@ package me.eccentric_nz.TARDIS.floodgate; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.UUID; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.advanced.TARDISCircuitChecker; import me.eccentric_nz.TARDIS.advanced.TARDISCircuitDamager; @@ -21,6 +18,10 @@ import org.geysermc.floodgate.api.FloodgateApi; import org.geysermc.floodgate.api.player.FloodgatePlayer; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.UUID; + public class FloodgateChameleonCircuitForm { private final TARDIS plugin; @@ -36,8 +37,7 @@ public FloodgateChameleonCircuitForm(TARDIS plugin, UUID uuid, int id, Chameleon } public void send() { - SimpleForm form = SimpleForm.builder() - .title("TARDIS Chameleon Circuit") + SimpleForm form = SimpleForm.builder().title("TARDIS Chameleon Circuit") .button("Apply", FormImage.Type.URL, "https://github.com/eccentricdevotion/TARDIS-Resource-Pack/raw/master/assets/tardis/textures/item/gui/control/apply_button.png") .button("Chameleon Circuit", FormImage.Type.URL, "https://github.com/eccentricdevotion/TARDIS-Resource-Pack/raw/master/assets/tardis/textures/item/gui/control/chameleon_button.png") .button("Adaptive Biome", FormImage.Type.URL, "https://github.com/eccentricdevotion/TARDIS-Resource-Pack/raw/master/assets/tardis/textures/item/gui/chameleon/adapt_button.png") @@ -46,7 +46,7 @@ public void send() { .button("Shorted out", FormImage.Type.URL, "https://github.com/eccentricdevotion/TARDIS-Resource-Pack/raw/master/assets/tardis/textures/item/gui/chameleon/shorted_button.png") .button("Construct", FormImage.Type.URL, "https://github.com/eccentricdevotion/TARDIS-Resource-Pack/raw/master/assets/tardis/textures/item/gui/chameleon/construct_button.png") .button("Lock", FormImage.Type.URL, "https://github.com/eccentricdevotion/TARDIS-Resource-Pack/raw/master/assets/tardis/textures/item/gui/chameleon/lock_button.png") - .validResultHandler(response -> handleResponse(response)) + .validResultHandler(this::handleResponse) .build(); FloodgatePlayer player = FloodgateApi.getInstance().getPlayer(uuid); player.sendForm(form); @@ -75,7 +75,7 @@ private void handleResponse(SimpleFormResponse response) { // rebuild player.performCommand("tardis rebuild"); // damage the circuit if configured - if (plugin.getConfig().getBoolean("circuits.damage") && !plugin.getDifficulty().equals(Difficulty.EASY) && plugin.getConfig().getInt("circuits.uses.chameleon") > 0) { + if (plugin.getConfig().getBoolean("circuits.damage") && plugin.getConfig().getInt("circuits.uses.chameleon") > 0) { TARDISCircuitChecker tcc = new TARDISCircuitChecker(plugin, id); tcc.getCircuits(); // decrement uses @@ -107,13 +107,11 @@ private void handleResponse(SimpleFormResponse response) { // check they have an Invisibility Circuit TARDISCircuitChecker tcc = new TARDISCircuitChecker(plugin, id); tcc.getCircuits(); - if (!plugin.getDifficulty().equals(Difficulty.EASY)) { - if (!plugin.getUtils().inGracePeriod(player, false) && !tcc.hasInvisibility()) { - plugin.getMessenger().send(player, TardisModule.TARDIS, "INVISIBILITY_MISSING"); - break; - } + if (plugin.getConfig().getBoolean("difficulty.circuits") && !plugin.getUtils().inGracePeriod(player, false) && !tcc.hasInvisibility()) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "INVISIBILITY_MISSING"); + break; } - if (plugin.getConfig().getBoolean("circuits.damage") && !plugin.getDifficulty().equals(Difficulty.EASY) && plugin.getConfig().getInt("circuits.uses.invisibility") > 0) { + if (plugin.getConfig().getBoolean("circuits.damage") && plugin.getConfig().getInt("circuits.uses.invisibility") > 0) { // decrement uses int uses_left = tcc.getInvisibilityUses(); new TARDISCircuitDamager(plugin, DiskCircuit.INVISIBILITY, uses_left, id, player).damage(); diff --git a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateChameleonPresetForm.java b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateChameleonPresetForm.java index 2e66db906c..f6b1ea7911 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateChameleonPresetForm.java +++ b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateChameleonPresetForm.java @@ -1,6 +1,8 @@ package me.eccentric_nz.TARDIS.floodgate; import me.eccentric_nz.TARDIS.TARDIS; +import me.eccentric_nz.TARDIS.advanced.TARDISCircuitChecker; +import me.eccentric_nz.TARDIS.advanced.TARDISCircuitDamager; import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; import me.eccentric_nz.TARDIS.chameleon.utils.TARDISChameleonFrame; import me.eccentric_nz.TARDIS.database.resultset.ResultSetControls; @@ -8,6 +10,7 @@ import me.eccentric_nz.TARDIS.database.resultset.ResultSetTravellers; import me.eccentric_nz.TARDIS.enumeration.ChameleonPreset; import me.eccentric_nz.TARDIS.enumeration.Control; +import me.eccentric_nz.TARDIS.enumeration.DiskCircuit; import me.eccentric_nz.TARDIS.utility.TARDISStaticUtils; import org.bukkit.entity.Player; import org.geysermc.cumulus.form.SimpleForm; @@ -42,7 +45,7 @@ public void send() { builder.button(preset.toString(), FormImage.Type.PATH, path); } } - builder.validResultHandler(response -> handleResponse(response)); + builder.validResultHandler(this::handleResponse); SimpleForm form = builder.build(); FloodgatePlayer player = FloodgateApi.getInstance().getPlayer(uuid); player.sendForm(form); @@ -87,6 +90,14 @@ private void handleResponse(SimpleFormResponse response) { HashMap wheret = new HashMap<>(); wheret.put("tardis_id", id); plugin.getQueryFactory().doUpdate("tardis", set, wheret); + // damage the circuit if configured + if (plugin.getConfig().getBoolean("circuits.damage") && plugin.getConfig().getInt("circuits.uses.chameleon") > 0) { + TARDISCircuitChecker tcc = new TARDISCircuitChecker(plugin, id); + tcc.getCircuits(); + // decrement uses + int uses_left = tcc.getChameleonUses(); + new TARDISCircuitDamager(plugin, DiskCircuit.CHAMELEON, uses_left, id, player).damage(); + } } } } diff --git a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateCompanionsForm.java b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateCompanionsForm.java index 59ef786eeb..42171275e4 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateCompanionsForm.java +++ b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateCompanionsForm.java @@ -1,7 +1,5 @@ package me.eccentric_nz.TARDIS.floodgate; -import java.util.HashMap; -import java.util.UUID; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.companionGUI.TARDISCompanionGUIListener; import me.eccentric_nz.TARDIS.database.data.Tardis; @@ -16,6 +14,9 @@ import org.geysermc.floodgate.api.FloodgateApi; import org.geysermc.floodgate.api.player.FloodgatePlayer; +import java.util.HashMap; +import java.util.UUID; + public class FloodgateCompanionsForm { private final TARDIS plugin; @@ -47,7 +48,7 @@ public void send() { } } builder.button("Add"); - builder.validResultHandler(response -> handleResponse(response)); + builder.validResultHandler(this::handleResponse); SimpleForm form = builder.build(); FloodgatePlayer player = FloodgateApi.getInstance().getPlayer(uuid); player.sendForm(form); diff --git a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateControlForm.java b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateControlForm.java index 2eb8f77aed..cc178e6757 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateControlForm.java +++ b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateControlForm.java @@ -11,18 +11,19 @@ import me.eccentric_nz.TARDIS.control.actions.FastReturnAction; import me.eccentric_nz.TARDIS.control.actions.LightSwitchAction; import me.eccentric_nz.TARDIS.control.actions.SiegeAction; +import me.eccentric_nz.TARDIS.upgrades.SystemTree; import me.eccentric_nz.TARDIS.database.data.Tardis; import me.eccentric_nz.TARDIS.database.resultset.ResultSetCurrentLocation; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardis; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTravellers; import me.eccentric_nz.TARDIS.desktop.TARDISUpgradeData; import me.eccentric_nz.TARDIS.enumeration.COMPASS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.move.TARDISBlackWoolToggler; import me.eccentric_nz.TARDIS.rooms.TARDISExteriorRenderer; +import me.eccentric_nz.TARDIS.upgrades.SystemUpgradeChecker; import me.eccentric_nz.TARDIS.utility.TARDISStaticLocationGetters; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.entity.Player; @@ -74,15 +75,16 @@ public void send() { .button("Zero Room", FormImage.Type.URL, "https://github.com/eccentricdevotion/TARDIS-Resource-Pack/raw/master/assets/tardis/textures/item/gui/control/zero_button.png") .button("Player Preferences", FormImage.Type.URL, "https://github.com/eccentricdevotion/TARDIS-Resource-Pack/raw/master/assets/tardis/textures/item/gui/control/prefs_button.png") .button("Companions", FormImage.Type.URL, "https://github.com/eccentricdevotion/TARDIS-Resource-Pack/raw/master/assets/tardis/textures/item/gui/control/companions_button.png") - .validResultHandler(response -> handleResponse(response)) + .button("System Upgrades", FormImage.Type.URL, "https://github.com/eccentricdevotion/TARDIS-Resource-Pack/raw/master/assets/tardis/textures/item/gui/control/system_upgrades_button.png") + .validResultHandler(this::handleResponse) .build(); FloodgatePlayer player = FloodgateApi.getInstance().getPlayer(uuid); player.sendForm(form); } private void handleResponse(SimpleFormResponse response) { - int buttonId = response.clickedButtonId(); Player player = Bukkit.getPlayer(uuid); + int buttonId = response.clickedButtonId(); // get the TARDIS the player is in HashMap wheres = new HashMap<>(); wheres.put("uuid", uuid.toString()); @@ -121,7 +123,7 @@ private void handleResponse(SimpleFormResponse response) { boolean lights = tardis.isLightsOn(); int level = tardis.getArtronLevel(); TARDISCircuitChecker tcc = null; - if (!plugin.getDifficulty().equals(Difficulty.EASY)) { + if (plugin.getConfig().getBoolean("difficulty.circuits")) { tcc = new TARDISCircuitChecker(plugin, id); tcc.getCircuits(); } @@ -138,6 +140,10 @@ private void handleResponse(SimpleFormResponse response) { plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> new TARDISRandomButton(plugin, player, id, level, 0, tardis.getCompanions(), tardis.getUuid()).clickButton(), 2L); } case 1 -> { // saves gui + if (plugin.getConfig().getBoolean("difficulty.system_upgrades") && !new SystemUpgradeChecker(plugin).has(uuid.toString(), SystemTree.SAVES)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_NEED", "Saves"); + return; + } if (plugin.getTrackerKeeper().getInSiegeMode().contains(id)) { plugin.getMessenger().send(player, TardisModule.TARDIS, "SIEGE_NO_CONTROL"); return; @@ -186,6 +192,10 @@ private void handleResponse(SimpleFormResponse response) { new FloodgateDestinationTerminalForm(plugin, uuid).send(); } case 5 -> { // ars + if (plugin.getConfig().getBoolean("difficulty.system_upgrades") && !new SystemUpgradeChecker(plugin).has(uuid.toString(), SystemTree.ROOM_GROWING)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_NEED", "Room Growing"); + return; + } if (plugin.getTrackerKeeper().getInSiegeMode().contains(id)) { plugin.getMessenger().send(player, TardisModule.TARDIS, "SIEGE_NO_CONTROL"); return; @@ -213,6 +223,10 @@ private void handleResponse(SimpleFormResponse response) { }, 100); } case 6 -> { // desktop theme + if (plugin.getConfig().getBoolean("difficulty.system_upgrades") && !new SystemUpgradeChecker(plugin).has(uuid.toString(), SystemTree.DESKTOP_THEME)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_NEED", "Desktop Theme"); + return; + } // check player is in own TARDIS int p_tid = TARDISThemeButton.getTardisId(uuid.toString()); if (p_tid != id) { @@ -258,6 +272,10 @@ private void handleResponse(SimpleFormResponse response) { } case 10 -> new FloodgateMapForm(plugin, uuid, id).send(); // map case 11 -> { // chameleon circuit + if (plugin.getConfig().getBoolean("difficulty.system_upgrades") && !new SystemUpgradeChecker(plugin).has(uuid.toString(), SystemTree.CHAMELEON_CIRCUIT)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_NEED", "Chameleon Circuit"); + return; + } if (tcc != null && !tcc.hasChameleon()) { plugin.getMessenger().send(player, TardisModule.TARDIS, "CHAM_MISSING"); return; @@ -362,12 +380,17 @@ private void handleResponse(SimpleFormResponse response) { if (comps == null || comps.isEmpty()) { // open companions add gui new FloodgateAddCompanionsForm(plugin, uuid).send(); -// plugin.getMessenger().send(player, TardisModule.TARDIS, "COMPANIONS_NONE"); return; } String[] companionData = comps.split(":"); new FloodgateCompanionsForm(plugin, uuid, companionData).send(); } + case 24 -> { // system upgrades + if (!plugin.getConfig().getBoolean("difficulty.system_upgrades")) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_DISABLED"); + return; + } + new FloodgateSystemUpgradesForm(plugin, uuid, id).send(); } default -> { // do nothing } } diff --git a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateDesktopArchiveForm.java b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateDesktopArchiveForm.java index 6d132975ec..6806187e07 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateDesktopArchiveForm.java +++ b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateDesktopArchiveForm.java @@ -1,8 +1,5 @@ package me.eccentric_nz.TARDIS.floodgate; -import java.util.HashMap; -import java.util.Locale; -import java.util.UUID; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.database.data.Archive; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardisSize; @@ -25,6 +22,10 @@ import org.geysermc.floodgate.api.FloodgateApi; import org.geysermc.floodgate.api.player.FloodgatePlayer; +import java.util.HashMap; +import java.util.Locale; +import java.util.UUID; + public class FloodgateDesktopArchiveForm { private final TARDIS plugin; @@ -47,7 +48,7 @@ public void send() { builder.title("TARDIS Archive"); for (ItemStack is : rs.getButtons()) { ItemMeta im = is.getItemMeta(); - builder.button(im.getDisplayName(), FormImage.Type.URL, String.format(path, FloodgateColouredBlocks.IMAGES.get(i))); + builder.button(im.getDisplayName(), FormImage.Type.PATH, String.format(path, FloodgateColouredBlocks.IMAGES.get(i))); i++; } } @@ -57,7 +58,7 @@ public void send() { builder.button(c.toString(), FormImage.Type.URL, url); } } - builder.validResultHandler(response -> handleResponse(response)); + builder.validResultHandler(this::handleResponse); SimpleForm form = builder.build(); FloodgatePlayer player = FloodgateApi.getInstance().getPlayer(uuid); player.sendForm(form); diff --git a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateDesktopThemeForm.java b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateDesktopThemeForm.java index 9fbc299ba1..69f47eb700 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateDesktopThemeForm.java +++ b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateDesktopThemeForm.java @@ -77,7 +77,7 @@ public void send() { } } builder.button("Archive Consoles", FormImage.Type.URL, "https://raw.githubusercontent.com/eccentricdevotion/TARDIS-Resource-Pack/master/assets/tardis/textures/item/gui/theme/archive.png"); - builder.validResultHandler(response -> handleResponse(response)); + builder.validResultHandler(this::handleResponse); SimpleForm form = builder.build(); FloodgatePlayer player = FloodgateApi.getInstance().getPlayer(uuid); player.sendForm(form); diff --git a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateDestinationTerminalForm.java b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateDestinationTerminalForm.java index 9f54253c22..2ea2dc7d7f 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateDestinationTerminalForm.java +++ b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateDestinationTerminalForm.java @@ -9,7 +9,10 @@ import me.eccentric_nz.TARDIS.builders.TARDISEmergencyRelocation; import me.eccentric_nz.TARDIS.database.resultset.ResultSetCurrentLocation; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTravellers; -import me.eccentric_nz.TARDIS.enumeration.*; +import me.eccentric_nz.TARDIS.enumeration.DiskCircuit; +import me.eccentric_nz.TARDIS.enumeration.Flag; +import me.eccentric_nz.TARDIS.enumeration.TardisModule; +import me.eccentric_nz.TARDIS.enumeration.TravelType; import me.eccentric_nz.TARDIS.flight.TARDISLand; import me.eccentric_nz.TARDIS.travel.TARDISTimeTravel; import me.eccentric_nz.TARDIS.travel.TravelCostAndType; @@ -48,7 +51,7 @@ public void send() { .dropdown("World", worlds) .toggle("Submarine", false) .toggle("Just check calculated destination", false) - .validResultHandler(response -> handleResponse(response)) + .validResultHandler(this::handleResponse) .build(); FloodgatePlayer player = FloodgateApi.getInstance().getPlayer(uuid); player.sendForm(form); @@ -178,7 +181,7 @@ private void handleResponse(CustomFormResponse response) { plugin.getPM().callEvent(new TARDISTravelEvent(player, null, TravelType.TERMINAL, id)); } // damage the circuit if configured - if (plugin.getConfig().getBoolean("circuits.damage") && !plugin.getDifficulty().equals(Difficulty.EASY) && plugin.getConfig().getInt("circuits.uses.input") > 0) { + if (plugin.getConfig().getBoolean("circuits.damage") && plugin.getConfig().getInt("circuits.uses.input") > 0) { TARDISCircuitChecker tcc = new TARDISCircuitChecker(plugin, id); tcc.getCircuits(); // decrement uses diff --git a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateExterminateForm.java b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateExterminateForm.java index 9232590608..75b75ec436 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateExterminateForm.java +++ b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateExterminateForm.java @@ -1,6 +1,5 @@ package me.eccentric_nz.TARDIS.floodgate; -import java.util.UUID; import me.eccentric_nz.TARDIS.TARDIS; import org.bukkit.entity.Player; import org.geysermc.cumulus.form.SimpleForm; @@ -8,6 +7,8 @@ import org.geysermc.floodgate.api.FloodgateApi; import org.geysermc.floodgate.api.player.FloodgatePlayer; +import java.util.UUID; + public class FloodgateExterminateForm { private final TARDIS plugin; @@ -23,7 +24,7 @@ public void send() { builder.title("Delete TARDIS"); builder.content(plugin.getLanguage().getString("EXTERMINATE_CONFIRM")); builder.button("Exterminate"); - builder.validResultHandler(response -> handleResponse(response)); + builder.validResultHandler(this::handleResponse); SimpleForm form = builder.build(); FloodgatePlayer player = FloodgateApi.getInstance().getPlayer(uuid); player.sendForm(form); diff --git a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateGeneticManipulatorForm.java b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateGeneticManipulatorForm.java index 04dafeb189..d4e6d97a39 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateGeneticManipulatorForm.java +++ b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateGeneticManipulatorForm.java @@ -46,7 +46,7 @@ public void send() { builder.button(m.toString().replace("_SPAWN_EGG", ""), FormImage.Type.URL, String.format(path, m.toString().toLowerCase(Locale.ROOT))); } builder.button("Master's Reverse Polarity"); - builder.validResultHandler(response -> handleResponse(response)); + builder.validResultHandler(this::handleResponse); builder.closedOrInvalidResultHandler(response -> handleClose()); SimpleForm form = builder.build(); FloodgatePlayer player = FloodgateApi.getInstance().getPlayer(uuid); @@ -110,12 +110,16 @@ private void handleResponse(SimpleFormResponse response) { Object[] options = null; switch (dt) { case AXOLOTL -> { - if (!plugin.isDisguisesOnServer()) { + if (plugin.isDisguisesOnServer()) { + new TARDISLazarusLibs(player, label, Axolotl.Variant.LUCY, false, false).createDisguise(); + } else { options = new Object[]{Axolotl.Variant.WILD, AGE.ADULT}; } } case FROG -> { - if (!plugin.isDisguisesOnServer()) { + if (plugin.isDisguisesOnServer()) { + new TARDISLazarusLibs(player, label, Frog.Variant.TEMPERATE, false, false).createDisguise(); + } else { options = new Object[]{Frog.Variant.TEMPERATE, AGE.ADULT}; } } diff --git a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateIndexEntryForm.java b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateIndexEntryForm.java index e422505afd..767de09d19 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateIndexEntryForm.java +++ b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateIndexEntryForm.java @@ -32,7 +32,7 @@ public void send() { for (String key : TARDISInfoMenu.getChildren(tardisInfoMenu.toString()).keySet()) { builder.button(key, FormImage.Type.PATH, "textures/items/book.png"); } - builder.validResultHandler(response -> handleResponse(response)); + builder.validResultHandler(this::handleResponse); SimpleForm form = builder.build(); FloodgatePlayer player = FloodgateApi.getInstance().getPlayer(uuid); player.sendForm(form); diff --git a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateIndexFileForm.java b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateIndexFileForm.java index a46ecd25eb..d4753e4165 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateIndexFileForm.java +++ b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateIndexFileForm.java @@ -27,7 +27,7 @@ public void send() { for (TISCategory category : TISCategory.values()) { builder.button(category.getName(), FormImage.Type.PATH, "textures/items/bookshelf.png"); } - builder.validResultHandler(response -> handleResponse(response)); + builder.validResultHandler(this::handleResponse); SimpleForm form = builder.build(); FloodgatePlayer player = FloodgateApi.getInstance().getPlayer(uuid); player.sendForm(form); diff --git a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateIndexSectionForm.java b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateIndexSectionForm.java index 1cece94851..b3d061d0d0 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateIndexSectionForm.java +++ b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateIndexSectionForm.java @@ -62,7 +62,7 @@ public void send() { builder.button(TARDISStringUtils.capitalise(tim.toString()), FormImage.Type.PATH, "textures/items/written_book.png"); } } - builder.validResultHandler(response -> handleResponse(response)); + builder.validResultHandler(this::handleResponse); SimpleForm form = builder.build(); FloodgatePlayer player = FloodgateApi.getInstance().getPlayer(uuid); player.sendForm(form); diff --git a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateMapForm.java b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateMapForm.java index 51668a31ef..2fd71f90b4 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateMapForm.java +++ b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateMapForm.java @@ -1,11 +1,5 @@ package me.eccentric_nz.TARDIS.floodgate; -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.*; -import java.util.regex.Pattern; import me.eccentric_nz.TARDIS.ARS.TARDISARS; import me.eccentric_nz.TARDIS.ARS.TARDISARSMethods; import me.eccentric_nz.TARDIS.ARS.TARDISARSSlot; @@ -27,6 +21,13 @@ import org.geysermc.floodgate.api.FloodgateApi; import org.geysermc.floodgate.api.player.FloodgatePlayer; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.*; +import java.util.regex.Pattern; + public class FloodgateMapForm { private static final Pattern JSON_FLUFF = Pattern.compile("[\"\\[\\]]"); @@ -55,7 +56,7 @@ public void send() { for (String room : getRooms(id)) { builder.button(room, FormImage.Type.URL, String.format(path, room.toLowerCase())); } - builder.validResultHandler(response -> handleResponse(response)); + builder.validResultHandler(this::handleResponse); SimpleForm form = builder.build(); FloodgatePlayer player = FloodgateApi.getInstance().getPlayer(uuid); player.sendForm(form); diff --git a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgatePlayerPrefsForm.java b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgatePlayerPrefsForm.java index cfaaf6f4c9..f014bf73dc 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgatePlayerPrefsForm.java +++ b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgatePlayerPrefsForm.java @@ -61,7 +61,7 @@ public void send() { .dropdown("Flight Mode", flightmodes) .dropdown("Interior Hum Sound", hums) .dropdown("Autonomus Mode", automodes) - .validResultHandler(response -> handleResponse(response)) + .validResultHandler(this::handleResponse) .build(); FloodgatePlayer player = FloodgateApi.getInstance().getPlayer(uuid); player.sendForm(form); diff --git a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateSavesForm.java b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateSavesForm.java index 17e30ec2c2..283c29806d 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateSavesForm.java +++ b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateSavesForm.java @@ -1,13 +1,12 @@ package me.eccentric_nz.TARDIS.floodgate; import me.eccentric_nz.TARDIS.TARDIS; +import me.eccentric_nz.TARDIS.advanced.TARDISCircuitChecker; +import me.eccentric_nz.TARDIS.advanced.TARDISCircuitDamager; import me.eccentric_nz.TARDIS.api.Parameters; import me.eccentric_nz.TARDIS.api.event.TARDISTravelEvent; import me.eccentric_nz.TARDIS.database.resultset.*; -import me.eccentric_nz.TARDIS.enumeration.ChameleonPreset; -import me.eccentric_nz.TARDIS.enumeration.Flag; -import me.eccentric_nz.TARDIS.enumeration.TardisModule; -import me.eccentric_nz.TARDIS.enumeration.TravelType; +import me.eccentric_nz.TARDIS.enumeration.*; import me.eccentric_nz.TARDIS.flight.TARDISLand; import me.eccentric_nz.TARDIS.planets.TARDISAliasResolver; import me.eccentric_nz.TARDIS.travel.TARDISAreaCheck; @@ -50,11 +49,11 @@ public void send() { builder.button("Home", FormImage.Type.PATH, "textures/blocks/beehive_front.png"); if (rsd.resultSet()) { for (HashMap map : rsd.getData()) { - builder.button(map.get("dest_name") + " ~ " + map.get("dest_id"), FormImage.Type.URL, String.format(path, FloodgateColouredBlocks.IMAGES.get(i))); + builder.button(map.get("dest_name") + " ~ " + map.get("dest_id"), FormImage.Type.PATH, String.format(path, FloodgateColouredBlocks.IMAGES.get(i))); i++; } } - builder.validResultHandler(response -> handleResponse(response)); + builder.validResultHandler(this::handleResponse); SimpleForm form = builder.build(); FloodgatePlayer player = FloodgateApi.getInstance().getPlayer(uuid); player.sendForm(form); @@ -138,6 +137,14 @@ private void handleResponse(SimpleFormResponse response) { } } if (!save_dest.equals(current) || plugin.getTrackerKeeper().getDestinationVortex().containsKey(id)) { + // damage circuit if configured + if (plugin.getConfig().getBoolean("circuits.damage") && plugin.getConfig().getInt("circuits.uses.materialisation") > 0) { + TARDISCircuitChecker tcc = new TARDISCircuitChecker(plugin, id); + tcc.getCircuits(); + // decrement uses + int uses_left = tcc.getMemoryUses(); + new TARDISCircuitDamager(plugin, DiskCircuit.MEMORY, uses_left, id, player).damage(); + } HashMap set = new HashMap<>(); set.put("world", rsd.getWorld()); set.put("x", rsd.getX()); diff --git a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateShellLoaderForm.java b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateShellLoaderForm.java index 72cec24169..f9c2756073 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateShellLoaderForm.java +++ b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateShellLoaderForm.java @@ -58,7 +58,7 @@ public void send() { } } } - builder.validResultHandler(response -> handleResponse(response)); + builder.validResultHandler(this::handleResponse); SimpleForm form = builder.build(); FloodgatePlayer player = FloodgateApi.getInstance().getPlayer(uuid); player.sendForm(form); diff --git a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateSpawnEgg.java b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateSpawnEgg.java index 8d12cc7847..7a0847dbd1 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateSpawnEgg.java +++ b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateSpawnEgg.java @@ -1,14 +1,16 @@ package me.eccentric_nz.TARDIS.floodgate; +import org.bukkit.Material; + import java.util.ArrayList; import java.util.List; -import org.bukkit.Material; public class FloodgateSpawnEgg { public static final List disguises = new ArrayList<>(); static { disguises.add(Material.ALLAY_SPAWN_EGG); + disguises.add(Material.ARMADILLO_SPAWN_EGG); disguises.add(Material.AXOLOTL_SPAWN_EGG); disguises.add(Material.BAT_SPAWN_EGG); disguises.add(Material.BEE_SPAWN_EGG); diff --git a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateStructuresForm.java b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateStructuresForm.java new file mode 100644 index 0000000000..0f8db2a7bf --- /dev/null +++ b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateStructuresForm.java @@ -0,0 +1,64 @@ +package me.eccentric_nz.TARDIS.floodgate; + +import me.eccentric_nz.TARDIS.TARDIS; +import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardisArtron; +import me.eccentric_nz.TARDIS.enumeration.TardisModule; +import me.eccentric_nz.TARDIS.travel.TARDISStructureTravel; +import me.eccentric_nz.TARDIS.utility.TARDISStringUtils; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.bukkit.generator.structure.Structure; +import org.geysermc.cumulus.form.SimpleForm; +import org.geysermc.cumulus.response.SimpleFormResponse; +import org.geysermc.cumulus.util.FormImage; +import org.geysermc.floodgate.api.FloodgateApi; +import org.geysermc.floodgate.api.player.FloodgatePlayer; + +import java.util.UUID; + +public class FloodgateStructuresForm { + + private final TARDIS plugin; + private final UUID uuid; + private final int id; + + public FloodgateStructuresForm(TARDIS plugin, UUID uuid, int id) { + this.plugin = plugin; + this.uuid = uuid; + this.id = id; + } + + public void send() { + // get structures + SimpleForm.Builder builder = SimpleForm.builder(); + builder.title("Telepathic Structure Finder"); + for (Structure structure : TARDISStructureTravel.overworldStructures) { + builder.button(TARDISStringUtils.capitalise(structure.getKey().getKey()), FormImage.Type.PATH, "textures/blocks/grass_side_carried.png"); + } + for (Structure structure : TARDISStructureTravel.netherStructures) { + builder.button(TARDISStringUtils.capitalise(structure.getKey().getKey()), FormImage.Type.PATH, "textures/blocks/crimson_nylium_side.png"); + } + builder.button(TARDISStringUtils.capitalise(Structure.END_CITY.getKey().getKey()), FormImage.Type.PATH, "textures/blocks/purpur_block.png"); + builder.validResultHandler(this::handleResponse); + SimpleForm form = builder.build(); + FloodgatePlayer player = FloodgateApi.getInstance().getPlayer(uuid); + player.sendForm(form); + } + + private void handleResponse(SimpleFormResponse response) { + Player player = Bukkit.getPlayer(uuid); + // get tardis artron level + ResultSetTardisArtron rs = new ResultSetTardisArtron(plugin); + if (!rs.fromID(id)) { + return; + } + int level = rs.getArtronLevel(); + int travel = plugin.getArtronConfig().getInt("travel"); + if (level < travel) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "NOT_ENOUGH_ENERGY"); + return; + } + String enumStr = TARDISStringUtils.toEnumUppercase(response.clickedButton().text()); + player.performCommand("tardistravel structure " + enumStr); + } +} diff --git a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateSystemUpgradesForm.java b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateSystemUpgradesForm.java new file mode 100644 index 0000000000..272b11c493 --- /dev/null +++ b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateSystemUpgradesForm.java @@ -0,0 +1,159 @@ +package me.eccentric_nz.TARDIS.floodgate; + +import me.eccentric_nz.TARDIS.TARDIS; +import me.eccentric_nz.TARDIS.upgrades.SystemTree; +import me.eccentric_nz.TARDIS.database.data.SystemUpgrade; +import me.eccentric_nz.TARDIS.database.resultset.ResultSetSystemUpgrades; +import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardis; +import me.eccentric_nz.TARDIS.database.resultset.ResultSetTravellers; +import me.eccentric_nz.TARDIS.enumeration.TardisModule; +import me.eccentric_nz.TARDIS.upgrades.SystemUpgradeUpdate; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.geysermc.cumulus.form.SimpleForm; +import org.geysermc.cumulus.response.SimpleFormResponse; +import org.geysermc.cumulus.util.FormImage; +import org.geysermc.floodgate.api.FloodgateApi; +import org.geysermc.floodgate.api.player.FloodgatePlayer; + +import java.util.HashMap; +import java.util.UUID; + +public class FloodgateSystemUpgradesForm { + + private final TARDIS plugin; + private final UUID uuid; + private final int id; + private SystemUpgrade sysData; + + public FloodgateSystemUpgradesForm(TARDIS plugin, UUID uuid, int id) { + this.plugin = plugin; + this.uuid = uuid; + this.id = id; + } + + public void send() { + Player p = plugin.getServer().getPlayer(uuid); + // get TARDIS player is in + HashMap where = new HashMap<>(); + where.put("uuid", uuid); + ResultSetTravellers rst = new ResultSetTravellers(plugin, where, false); + if (!rst.resultSet()) { + return; + } + int id = rst.getTardis_id(); + // must be the owner of the TARDIS + HashMap wheret = new HashMap<>(); + wheret.put("tardis_id", id); + wheret.put("uuid", uuid.toString()); + ResultSetTardis rs = new ResultSetTardis(plugin, wheret, "", false, 2); + if (!rs.resultSet()) { + plugin.getMessenger().send(p, TardisModule.TARDIS, "NOT_OWNER"); + return; + } + // get player's artron energy level + ResultSetSystemUpgrades rsp = new ResultSetSystemUpgrades(plugin, id, uuid.toString()); + if (!rsp.resultset()) { + plugin.getMessenger().send(p, TardisModule.TARDIS, "SYS_TRAVEL_FIRST"); + return; + } + sysData = rsp.getData(); + SimpleForm.Builder builder = SimpleForm.builder(); + builder.title("TARDIS System Upgrades"); + builder.content("Artron Level: " + sysData.getArtronLevel()); + // add buttons + for (SystemTree g : SystemTree.values()) { + if (g.getSlot() != -1 && g != SystemTree.UPGRADE_TREE) { + boolean has = sysData.getUpgrades().get(g); + boolean branch = g.getBranch().equals("branch"); + String prefix = (branch) ? ChatColor.GOLD + "" + ChatColor.ITALIC : ""; + String suffix; + String image = "sys_locked"; + // does the player have this system upgrade? + if (!has) { + String cost; + if (branch) { + cost = plugin.getSystemUpgradesConfig().getString("branch"); + image = "sys_branch_locked"; + } else { + cost = plugin.getSystemUpgradesConfig().getString(g.getBranch() + "." + g.toString().toLowerCase()); + } + suffix = " " + ChatColor.BLUE + ChatColor.ITALIC + "Cost: " + cost; + } else { + suffix = " " + ChatColor.GREEN + ChatColor.ITALIC + "Unlocked"; + image = (branch) ? "sys_branch_unlocked" : "sys_unlocked"; + } + builder.button(prefix + g.getName() + suffix, FormImage.Type.URL, String.format("https://github.com/eccentricdevotion/TARDIS-Resource-Pack/raw/master/assets/tardis/textures/item/circuit/%s.png", image)); + } + } + builder.validResultHandler(this::handleResponse); + SimpleForm form = builder.build(); + FloodgatePlayer player = FloodgateApi.getInstance().getPlayer(uuid); + player.sendForm(form); + } + + private void handleResponse(SimpleFormResponse response) { + Player player = Bukkit.getPlayer(uuid); + int button = response.clickedButtonId(); + SystemTree clicked; + switch (button) { + case 0 -> clicked = SystemTree.ARCHITECTURE; + case 1 -> clicked = SystemTree.CHAMELEON_CIRCUIT; + case 2 -> clicked = SystemTree.ROOM_GROWING; + case 3 -> clicked = SystemTree.DESKTOP_THEME; + case 4 -> clicked = SystemTree.NAVIGATION; + case 5 -> clicked = SystemTree.SAVES; + case 6 -> clicked = SystemTree.DISTANCE_1; + case 7 -> clicked = SystemTree.DISTANCE_2; + case 8 -> clicked = SystemTree.DISTANCE_3; + case 9 -> clicked = SystemTree.INTER_DIMENSIONAL_TRAVEL; + case 10 -> clicked = SystemTree.TOOLS; + case 11 -> clicked = SystemTree.TARDIS_LOCATOR; + case 12 -> clicked = SystemTree.BIOME_READER; + case 13 -> clicked = SystemTree.FORCE_FIELD; + case 14 -> clicked = SystemTree.STATTENHEIM_REMOTE; + default -> clicked = SystemTree.UPGRADE_TREE; + } + try { + SystemTree required = SystemTree.valueOf(clicked.getRequired()); + if (!sysData.getUpgrades().get(required)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_REQUIRED", required.getName()); + player.playSound(player.getLocation(), Sound.ENTITY_WARDEN_TENDRIL_CLICKS, 1.0f, 1.0f); + } else { + // check if they have upgrade already + if (sysData.getUpgrades().get(clicked)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_HAS", clicked.getName()); + player.playSound(player.getLocation(), Sound.ENTITY_WARDEN_STEP, 1.0f, 1.0f); + return; + } + // check artron + int cost; + if (clicked.getBranch().equals("branch")) { + cost = plugin.getSystemUpgradesConfig().getInt("branch"); + } else { + cost = plugin.getSystemUpgradesConfig().getInt(clicked.getBranch() + "." + clicked.toString().toLowerCase()); + } + if (cost > sysData.getArtronLevel()) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_COST", clicked.getName()); + player.playSound(player.getLocation(), Sound.ENTITY_CAT_EAT, 1.0f, 1.0f); + return; + } + // debit + HashMap wheretl = new HashMap<>(); + wheretl.put("uuid", uuid); + plugin.getQueryFactory().alterEnergyLevel("player_prefs", -cost, wheretl, player); + // play sound + player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1.0f, 1.0f); + // message + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_SUCCESS", clicked.getName()); + // update system upgrade record + new SystemUpgradeUpdate(plugin).set(uuid.toString(), id, clicked); + } + } catch (IllegalArgumentException e) { + // clicked upgrade tree + plugin.debug("IllegalArgumentException for " + clicked.getRequired()); + } + } +} diff --git a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateTelepathicForm.java b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateTelepathicForm.java new file mode 100644 index 0000000000..bc6bde0259 --- /dev/null +++ b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateTelepathicForm.java @@ -0,0 +1,86 @@ +package me.eccentric_nz.TARDIS.floodgate; + +import me.eccentric_nz.TARDIS.TARDIS; +import me.eccentric_nz.TARDIS.advanced.TARDISCircuitChecker; +import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; +import me.eccentric_nz.TARDIS.database.resultset.ResultSetPlayerPrefs; +import me.eccentric_nz.TARDIS.enumeration.TardisModule; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; +import org.geysermc.cumulus.form.SimpleForm; +import org.geysermc.cumulus.response.SimpleFormResponse; +import org.geysermc.cumulus.util.FormImage; +import org.geysermc.floodgate.api.FloodgateApi; +import org.geysermc.floodgate.api.player.FloodgatePlayer; + +import java.util.HashMap; +import java.util.UUID; + +public class FloodgateTelepathicForm { + + private final TARDIS plugin; + private final UUID uuid; + private final int id; + + public FloodgateTelepathicForm(TARDIS plugin, UUID uuid, int id) { + this.plugin = plugin; + this.uuid = uuid; + this.id = id; + } + + public void send() { + // get biomes + SimpleForm.Builder builder = SimpleForm.builder(); + builder.title("Telepathic Biome Finder"); + builder.button("Toggle telepathic circuit", FormImage.Type.PATH, "textures/block/daylight_detector_top.png"); + Player player = Bukkit.getPlayer(uuid); + if (TARDISPermission.hasPermission(player, "tardis.timetravel.cave")) { + builder.button("Cave finder", FormImage.Type.PATH, "textures/block/dripstone_block.png"); + } + if (TARDISPermission.hasPermission(player, "tardis.timetravel.village")) { + builder.button("Structure finder", FormImage.Type.PATH, "textures/block/hay_block_side.png"); + } + if (TARDISPermission.hasPermission(player, "tardis.timetravel.biome")) { + builder.button("Biome finder", FormImage.Type.PATH, "textures/block/bamboo_mosaic.png"); + } + builder.validResultHandler(this::handleResponse); + SimpleForm form = builder.build(); + FloodgatePlayer fplayer = FloodgateApi.getInstance().getPlayer(uuid); + fplayer.sendForm(form); + } + + private void handleResponse(SimpleFormResponse response) { + Player player = Bukkit.getPlayer(uuid); + if (player == null) { + return; + } + // check for telepathic circuit + TARDISCircuitChecker tcc = null; + if (plugin.getConfig().getBoolean("difficulty.circuits") && !plugin.getUtils().inGracePeriod(player, true)) { + tcc = new TARDISCircuitChecker(plugin, id); + tcc.getCircuits(); + } + if (tcc != null && !tcc.hasTelepathic()) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "NO_TELEPATHIC_CIRCUIT"); + return; + } + String label = response.clickedButton().text(); + switch (label) { + case "Cave finder" -> player.performCommand("tardistravel cave"); + case "Structure finder" -> new FloodgateStructuresForm(plugin, player.getUniqueId(), id).send(); + case "Biome finder" -> new FloodgateBiomesForm(plugin, player.getUniqueId(), id).send(); + default -> { + // get current telepathic setting + ResultSetPlayerPrefs rsp = new ResultSetPlayerPrefs(plugin, player.getUniqueId().toString()); + int b = (rsp.resultSet() && rsp.isTelepathyOn()) ? 0 : 1; + // update database + HashMap set = new HashMap<>(); + HashMap whereu = new HashMap<>(); + whereu.put("uuid", player.getUniqueId().toString()); + set.put("telepathy_on", b); + plugin.getQueryFactory().doUpdate("player_prefs", set, whereu); + plugin.getMessenger().announceRepeater(player, "Telepathic Circuit " + (b == 1 ? "ON" : "OFF")); + } + } + } +} diff --git a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateTemporalForm.java b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateTemporalForm.java index fd81410d54..1459aea66f 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateTemporalForm.java +++ b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateTemporalForm.java @@ -1,11 +1,9 @@ package me.eccentric_nz.TARDIS.floodgate; -import java.util.UUID; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.advanced.TARDISCircuitChecker; import me.eccentric_nz.TARDIS.advanced.TARDISCircuitDamager; import me.eccentric_nz.TARDIS.custommodeldata.GUITemporalLocator; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; import me.eccentric_nz.TARDIS.enumeration.DiskCircuit; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.utility.TARDISNumberParsers; @@ -17,6 +15,8 @@ import org.geysermc.floodgate.api.FloodgateApi; import org.geysermc.floodgate.api.player.FloodgatePlayer; +import java.util.UUID; + public class FloodgateTemporalForm { private final TARDIS plugin; @@ -33,7 +33,7 @@ public void send() { for (GUITemporalLocator clock : GUITemporalLocator.values()) { builder.button(clock.getName()+" ~"+clock.getLore(), FormImage.Type.PATH, "textures/items/clock_item.png"); } - builder.validResultHandler(response -> handleResponse(response)); + builder.validResultHandler(this::handleResponse); SimpleForm form = builder.build(); FloodgatePlayer player = FloodgateApi.getInstance().getPlayer(uuid); player.sendForm(form); @@ -46,7 +46,7 @@ private void handleResponse(SimpleFormResponse response) { plugin.getTrackerKeeper().getSetTime().put(player.getUniqueId(), ticks); plugin.getMessenger().send(player, TardisModule.TARDIS, "TEMPORAL_SET", String.format("%d", ticks)); // damage the circuit if configured - if (plugin.getConfig().getBoolean("circuits.damage") && !plugin.getDifficulty().equals(Difficulty.EASY) && plugin.getConfig().getInt("circuits.uses.temporal") > 0) { + if (plugin.getConfig().getBoolean("circuits.damage") && plugin.getConfig().getInt("circuits.uses.temporal") > 0) { int id = plugin.getTardisAPI().getIdOfTARDISPlayerIsIn(player.getUniqueId()); TARDISCircuitChecker tcc = new TARDISCircuitChecker(plugin, id); tcc.getCircuits(); diff --git a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateTransmatForm.java b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateTransmatForm.java index cc17582d3d..7e7c689669 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateTransmatForm.java +++ b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateTransmatForm.java @@ -36,7 +36,7 @@ public void send() { for (Transmat t : rslist.getData()) { builder.button(t.getName()); } - builder.validResultHandler(response -> handleResponse(response)); + builder.validResultHandler(this::handleResponse); SimpleForm form = builder.build(); FloodgatePlayer player = FloodgateApi.getInstance().getPlayer(uuid); player.sendForm(form); diff --git a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateWallFloorForm.java b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateWallFloorForm.java index d059dc9c83..60f78cedb9 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateWallFloorForm.java +++ b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateWallFloorForm.java @@ -1,8 +1,5 @@ package me.eccentric_nz.TARDIS.floodgate; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.desktop.TARDISThemeProcessor; import me.eccentric_nz.TARDIS.desktop.TARDISUpgradeData; @@ -13,6 +10,10 @@ import org.geysermc.floodgate.api.FloodgateApi; import org.geysermc.floodgate.api.player.FloodgatePlayer; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + public class FloodgateWallFloorForm { private final TARDIS plugin; @@ -34,7 +35,7 @@ public void send() { CustomForm form = CustomForm.builder() .title("TARDIS " + which + " Menu") .dropdown("Material", blocks) - .validResultHandler(response -> handleResponse(response)) + .validResultHandler(this::handleResponse) .build(); FloodgatePlayer player = FloodgateApi.getInstance().getPlayer(uuid); player.sendForm(form); diff --git a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateWeatherForm.java b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateWeatherForm.java index c58757f25a..c2844e4b6b 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateWeatherForm.java +++ b/src/main/java/me/eccentric_nz/TARDIS/floodgate/FloodgateWeatherForm.java @@ -1,7 +1,5 @@ package me.eccentric_nz.TARDIS.floodgate; -import java.util.HashMap; -import java.util.UUID; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; import me.eccentric_nz.TARDIS.commands.utils.TARDISWeather; @@ -19,6 +17,9 @@ import org.geysermc.floodgate.api.FloodgateApi; import org.geysermc.floodgate.api.player.FloodgatePlayer; +import java.util.HashMap; +import java.util.UUID; + public class FloodgateWeatherForm { private final TARDIS plugin; @@ -35,7 +36,7 @@ public void send() { .button("rain", FormImage.Type.URL, "https://github.com/eccentricdevotion/TARDIS-Resource-Pack/raw/master/assets/tardis/textures/item/gui/rain.png") .button("thunder", FormImage.Type.URL, "https://github.com/eccentricdevotion/TARDIS-Resource-Pack/raw/master/assets/tardis/textures/item/gui/thunder.png") .button("excite", FormImage.Type.URL, "https://github.com/eccentricdevotion/TARDIS-Resource-Pack/raw/master/assets/tardis/textures/item/gui/excite.png") - .validResultHandler(response -> handleResponse(response)) + .validResultHandler(this::handleResponse) .build(); FloodgatePlayer player = FloodgateApi.getInstance().getPlayer(uuid); player.sendForm(form); diff --git a/src/main/java/me/eccentric_nz/TARDIS/hads/TARDISHadsPersister.java b/src/main/java/me/eccentric_nz/TARDIS/hads/TARDISHadsPersister.java index 2548cdc3d9..2c22499476 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/hads/TARDISHadsPersister.java +++ b/src/main/java/me/eccentric_nz/TARDIS/hads/TARDISHadsPersister.java @@ -16,12 +16,6 @@ */ package me.eccentric_nz.TARDIS.hads; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.Map; -import java.util.UUID; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.database.TARDISDatabaseConnection; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardisID; @@ -30,6 +24,13 @@ import org.bukkit.Location; import org.bukkit.World; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Map; +import java.util.UUID; + /** * @author eccentric_nz */ @@ -63,7 +64,7 @@ public void save() { // get tardis_id ResultSetTardisID rst = new ResultSetTardisID(plugin); rst.fromUUID(uuid); - ps.setInt(6, rst.getTardis_id()); + ps.setInt(6, rst.getTardisId()); count += ps.executeUpdate(); } if (count > 0) { diff --git a/src/main/java/me/eccentric_nz/TARDIS/handles/TARDISHandlesProcessor.java b/src/main/java/me/eccentric_nz/TARDIS/handles/TARDISHandlesProcessor.java index 47b4897dc5..525380531d 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/handles/TARDISHandlesProcessor.java +++ b/src/main/java/me/eccentric_nz/TARDIS/handles/TARDISHandlesProcessor.java @@ -465,7 +465,7 @@ void processCommand(int pos) { if (goto_loc != null) { plugin.getTrackerKeeper().getHasDestination().put(id, new TravelCostAndType(travel, travelType)); plugin.getTrackerKeeper().getRescue().remove(id); - if (plugin.getConfig().getBoolean("circuits.damage") && !plugin.getDifficulty().equals(Difficulty.EASY) && plugin.getConfig().getInt("circuits.uses.memory") > 0 && !plugin.getTrackerKeeper().getHasNotClickedHandbrake().contains(id)) { + if (plugin.getConfig().getBoolean("circuits.damage") && plugin.getConfig().getInt("circuits.uses.memory") > 0 && !plugin.getTrackerKeeper().getHasNotClickedHandbrake().contains(id)) { plugin.getTrackerKeeper().getHasNotClickedHandbrake().add(id); TARDISCircuitChecker tcc = new TARDISCircuitChecker(plugin, id); tcc.getCircuits(); diff --git a/src/main/java/me/eccentric_nz/TARDIS/handles/TARDISHandlesProgramListener.java b/src/main/java/me/eccentric_nz/TARDIS/handles/TARDISHandlesProgramListener.java index 67e9099b43..6ae79b2498 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/handles/TARDISHandlesProgramListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/handles/TARDISHandlesProgramListener.java @@ -19,7 +19,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.advanced.TARDISSerializeInventory; import me.eccentric_nz.TARDIS.enumeration.TardisModule; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/src/main/java/me/eccentric_nz/TARDIS/handles/TARDISHandlesRequest.java b/src/main/java/me/eccentric_nz/TARDIS/handles/TARDISHandlesRequest.java index 615aa575b9..b67bb8aa34 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/handles/TARDISHandlesRequest.java +++ b/src/main/java/me/eccentric_nz/TARDIS/handles/TARDISHandlesRequest.java @@ -68,7 +68,7 @@ public void process(UUID uuid, String chat) { // must have a TARDIS ResultSetTardisID rs = new ResultSetTardisID(plugin); if (rs.fromUUID(uuid.toString())) { - int id = rs.getTardis_id(); + int id = rs.getTardisId(); // check for placed Handles HashMap where = new HashMap<>(); where.put("tardis_id", id); diff --git a/src/main/java/me/eccentric_nz/TARDIS/handles/TARDISHandlesSavedInventory.java b/src/main/java/me/eccentric_nz/TARDIS/handles/TARDISHandlesSavedInventory.java index 735443e4f9..3fd9d40fce 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/handles/TARDISHandlesSavedInventory.java +++ b/src/main/java/me/eccentric_nz/TARDIS/handles/TARDISHandlesSavedInventory.java @@ -21,7 +21,7 @@ import me.eccentric_nz.TARDIS.custommodeldata.GUISavedPrograms; import me.eccentric_nz.TARDIS.database.data.Program; import me.eccentric_nz.TARDIS.database.resultset.ResultSetPrograms; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.inventory.ItemFlag; import org.bukkit.inventory.ItemStack; diff --git a/src/main/java/me/eccentric_nz/TARDIS/handles/TARDISHandlesSavedListener.java b/src/main/java/me/eccentric_nz/TARDIS/handles/TARDISHandlesSavedListener.java index ba7656f41d..9c540ad5d0 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/handles/TARDISHandlesSavedListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/handles/TARDISHandlesSavedListener.java @@ -20,7 +20,7 @@ import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; import me.eccentric_nz.TARDIS.utility.TARDISNumberParsers; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/src/main/java/me/eccentric_nz/TARDIS/howto/TARDISRecipeMenuListener.java b/src/main/java/me/eccentric_nz/TARDIS/howto/TARDISRecipeMenuListener.java index 0b304be89d..f9c6c01cfb 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/howto/TARDISRecipeMenuListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/howto/TARDISRecipeMenuListener.java @@ -18,7 +18,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.inventory.ClickType; diff --git a/src/main/java/me/eccentric_nz/TARDIS/howto/TARDISSeedMenuListener.java b/src/main/java/me/eccentric_nz/TARDIS/howto/TARDISSeedMenuListener.java index c00d929d68..47ea0725c1 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/howto/TARDISSeedMenuListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/howto/TARDISSeedMenuListener.java @@ -18,7 +18,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.inventory.ClickType; diff --git a/src/main/java/me/eccentric_nz/TARDIS/howto/TARDISWallFloorMenuListener.java b/src/main/java/me/eccentric_nz/TARDIS/howto/TARDISWallFloorMenuListener.java index 2e809fe3ad..4908773001 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/howto/TARDISWallFloorMenuListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/howto/TARDISWallFloorMenuListener.java @@ -19,7 +19,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; import me.eccentric_nz.TARDIS.rooms.TARDISWalls; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/src/main/java/me/eccentric_nz/TARDIS/info/TARDISDescription.java b/src/main/java/me/eccentric_nz/TARDIS/info/TARDISDescription.java index 50227d9c51..ab32a9ad12 100755 --- a/src/main/java/me/eccentric_nz/TARDIS/info/TARDISDescription.java +++ b/src/main/java/me/eccentric_nz/TARDIS/info/TARDISDescription.java @@ -44,8 +44,8 @@ public enum TARDISDescription { READER_INFO("The TARDIS Biome Reader is a craftable item used to quickly create Biome Storage Disks. It is only available in Medium and Easy difficulty modes."), REMOTE_KEY_INFO("The TARDIS Remote Key is a craftable item used to deadlock and unlock the Police Box door (LEFT-click air), and also show and hide the TARDIS (RIGHT-click air)."), LOCATOR_CIRCUIT_INFO("The Locator Circuit is used in crafting the TARDIS Locator."), - MATERIALISATION_CIRCUIT_INFO("The Materialisation Circuit enables a TARDIS to dematerialize. It is used in crafting a Stattenhiem Circuit, and is a component of the TARDIS Advanced Console."), - STATTENHEIM_CIRCUIT_INFO("The Stattenheim Circuit is used in the crafting of a Stattenhiem Remote. This circuit combines the Materialization Circuit and the Locator Circuit to allow the two to fit in the remote's casing."), + MATERIALISATION_CIRCUIT_INFO("The Materialisation Circuit enables a TARDIS to dematerialize. It is used in crafting a Stattenheim Circuit, and is a component of the TARDIS Advanced Console."), + STATTENHEIM_CIRCUIT_INFO("The Stattenheim Circuit is used in the crafting of a Stattenheim Remote. This circuit combines the Materialization Circuit and the Locator Circuit to allow the two to fit in the remote's casing."), SONIC_OSCILLATOR_INFO("The Oscillator Circuit is used in crafting the Sonic Screwdriver."), BIO_SCANNER_CIRCUIT_INFO("The Bio-scanner Circuit is used to upgrade the Sonic Screwdriver."), BRUSH_CIRCUIT_INFO("The Brush Circuit is used to upgrade the Sonic Screwdriver."), diff --git a/src/main/java/me/eccentric_nz/TARDIS/info/TARDISIndexFileEntryListener.java b/src/main/java/me/eccentric_nz/TARDIS/info/TARDISIndexFileEntryListener.java index 3be0994c24..dbb5dc44cf 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/info/TARDISIndexFileEntryListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/info/TARDISIndexFileEntryListener.java @@ -3,7 +3,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; import me.eccentric_nz.TARDIS.utility.TARDISStringUtils; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.inventory.InventoryClickEvent; diff --git a/src/main/java/me/eccentric_nz/TARDIS/info/TARDISIndexFileListener.java b/src/main/java/me/eccentric_nz/TARDIS/info/TARDISIndexFileListener.java index f59dd9cb0d..b334e14f12 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/info/TARDISIndexFileListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/info/TARDISIndexFileListener.java @@ -3,7 +3,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; import me.eccentric_nz.TARDIS.utility.TARDISStringUtils; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.inventory.InventoryClickEvent; diff --git a/src/main/java/me/eccentric_nz/TARDIS/info/TARDISIndexFileSectionListener.java b/src/main/java/me/eccentric_nz/TARDIS/info/TARDISIndexFileSectionListener.java index 13d98729a4..4cec0cc612 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/info/TARDISIndexFileSectionListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/info/TARDISIndexFileSectionListener.java @@ -3,7 +3,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; import me.eccentric_nz.TARDIS.utility.TARDISStringUtils; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.inventory.InventoryClickEvent; diff --git a/src/main/java/me/eccentric_nz/TARDIS/info/TARDISInformationSystemListener.java b/src/main/java/me/eccentric_nz/TARDIS/info/TARDISInformationSystemListener.java index 0358ebd6a9..e6b936cb7d 100755 --- a/src/main/java/me/eccentric_nz/TARDIS/info/TARDISInformationSystemListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/info/TARDISInformationSystemListener.java @@ -18,7 +18,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.enumeration.TardisModule; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; diff --git a/src/main/java/me/eccentric_nz/TARDIS/junk/TARDISJunkBuilder.java b/src/main/java/me/eccentric_nz/TARDIS/junk/TARDISJunkBuilder.java index f4093a1d21..a85565cf9b 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/junk/TARDISJunkBuilder.java +++ b/src/main/java/me/eccentric_nz/TARDIS/junk/TARDISJunkBuilder.java @@ -18,15 +18,18 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import java.util.HashMap; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.TARDISConstants; import me.eccentric_nz.TARDIS.builders.BuildData; import me.eccentric_nz.TARDIS.customblocks.TARDISDisplayItem; import me.eccentric_nz.TARDIS.customblocks.TARDISDisplayItemUtils; import me.eccentric_nz.TARDIS.database.resultset.ResultSetPlayerPrefs; +import me.eccentric_nz.TARDIS.particles.TARDISParticles; import me.eccentric_nz.TARDIS.schematic.TARDISSchematicGZip; -import me.eccentric_nz.TARDIS.utility.*; +import me.eccentric_nz.TARDIS.utility.TARDISBlockSetters; +import me.eccentric_nz.TARDIS.utility.TARDISMaterials; +import me.eccentric_nz.TARDIS.utility.TARDISSounds; +import me.eccentric_nz.TARDIS.utility.TARDISStaticLocationGetters; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Tag; @@ -41,6 +44,8 @@ import org.bukkit.block.sign.Side; import org.bukkit.entity.Player; +import java.util.HashMap; + /** * @author eccentric_nz */ diff --git a/src/main/java/me/eccentric_nz/TARDIS/junk/TARDISJunkDelete.java b/src/main/java/me/eccentric_nz/TARDIS/junk/TARDISJunkDelete.java index 1404f1eaed..eb4a51cda6 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/junk/TARDISJunkDelete.java +++ b/src/main/java/me/eccentric_nz/TARDIS/junk/TARDISJunkDelete.java @@ -47,7 +47,7 @@ public boolean delete(CommandSender sender) { } ResultSetTardisID rs = new ResultSetTardisID(plugin); if (rs.fromUUID("00000000-aaaa-bbbb-cccc-000000000000")) { - int id = rs.getTardis_id(); + int id = rs.getTardisId(); // get the current location Location bb_loc = null; ResultSetCurrentFromId rsc = new ResultSetCurrentFromId(plugin, id); diff --git a/src/main/java/me/eccentric_nz/TARDIS/junk/TARDISJunkDestroyer.java b/src/main/java/me/eccentric_nz/TARDIS/junk/TARDISJunkDestroyer.java index 62997ceebc..176b78342e 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/junk/TARDISJunkDestroyer.java +++ b/src/main/java/me/eccentric_nz/TARDIS/junk/TARDISJunkDestroyer.java @@ -16,16 +16,14 @@ */ package me.eccentric_nz.TARDIS.junk; -import java.util.HashMap; -import java.util.List; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.TARDISConstants; import me.eccentric_nz.TARDIS.customblocks.TARDISDisplayItemUtils; import me.eccentric_nz.TARDIS.database.resultset.ResultSetBlocks; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardis; import me.eccentric_nz.TARDIS.destroyers.DestroyData; +import me.eccentric_nz.TARDIS.particles.TARDISParticles; import me.eccentric_nz.TARDIS.utility.TARDISBlockSetters; -import me.eccentric_nz.TARDIS.utility.TARDISParticles; import me.eccentric_nz.TARDIS.utility.TARDISSounds; import me.eccentric_nz.TARDIS.utility.TARDISStaticLocationGetters; import org.bukkit.Location; @@ -35,6 +33,9 @@ import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; +import java.util.HashMap; +import java.util.List; + /** * @author eccentric_nz */ diff --git a/src/main/java/me/eccentric_nz/TARDIS/junk/TARDISJunkFind.java b/src/main/java/me/eccentric_nz/TARDIS/junk/TARDISJunkFind.java index ddca488e0a..2d173d72f9 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/junk/TARDISJunkFind.java +++ b/src/main/java/me/eccentric_nz/TARDIS/junk/TARDISJunkFind.java @@ -46,7 +46,7 @@ public boolean find(CommandSender sender) { ResultSetTardisID rs = new ResultSetTardisID(plugin); if (rs.fromUUID("00000000-aaaa-bbbb-cccc-000000000000")) { // get current location - ResultSetCurrentFromId rsc = new ResultSetCurrentFromId(plugin, rs.getTardis_id()); + ResultSetCurrentFromId rsc = new ResultSetCurrentFromId(plugin, rs.getTardisId()); if (rsc.resultSet()) { String world = TARDISAliasResolver.getWorldAlias(rsc.getWorld()); if (!plugin.getPlanetsConfig().getBoolean("planets." + rsc.getWorld().getName() + ".enabled") && plugin.getWorldManager().equals(WorldManager.MULTIVERSE)) { diff --git a/src/main/java/me/eccentric_nz/TARDIS/junk/TARDISJunkLocation.java b/src/main/java/me/eccentric_nz/TARDIS/junk/TARDISJunkLocation.java index 83ab891819..70b8665930 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/junk/TARDISJunkLocation.java +++ b/src/main/java/me/eccentric_nz/TARDIS/junk/TARDISJunkLocation.java @@ -42,7 +42,7 @@ boolean isNotHome() { // check the Junk TARDIS is not home already ResultSetTardisID rs = new ResultSetTardisID(plugin); if (rs.fromUUID("00000000-aaaa-bbbb-cccc-000000000000")) { - id = rs.getTardis_id(); + id = rs.getTardisId(); // get current location ResultSetCurrentFromId rsc = new ResultSetCurrentFromId(plugin, id); if (rsc.resultSet()) { diff --git a/src/main/java/me/eccentric_nz/TARDIS/junk/TARDISJunkVortexRunnable.java b/src/main/java/me/eccentric_nz/TARDIS/junk/TARDISJunkVortexRunnable.java index 42d111293e..b45e58226d 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/junk/TARDISJunkVortexRunnable.java +++ b/src/main/java/me/eccentric_nz/TARDIS/junk/TARDISJunkVortexRunnable.java @@ -16,12 +16,11 @@ */ package me.eccentric_nz.TARDIS.junk; -import java.util.List; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.builders.BuildData; import me.eccentric_nz.TARDIS.enumeration.COMPASS; import me.eccentric_nz.TARDIS.enumeration.SpaceTimeThrottle; -import me.eccentric_nz.TARDIS.utility.TARDISParticles; +import me.eccentric_nz.TARDIS.particles.TARDISParticles; import me.eccentric_nz.TARDIS.utility.TARDISSounds; import org.bukkit.Location; import org.bukkit.OfflinePlayer; @@ -29,6 +28,8 @@ import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; +import java.util.List; + /** * @author eccentric_nz */ diff --git a/src/main/java/me/eccentric_nz/TARDIS/lazarus/TARDISLazarusGUIListener.java b/src/main/java/me/eccentric_nz/TARDIS/lazarus/TARDISLazarusGUIListener.java index 15c4420243..c6a4808865 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/lazarus/TARDISLazarusGUIListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/lazarus/TARDISLazarusGUIListener.java @@ -25,7 +25,7 @@ import me.eccentric_nz.TARDIS.utility.TARDISNumberParsers; import me.eccentric_nz.TARDIS.utility.TARDISSounds; import me.eccentric_nz.tardischunkgenerator.disguise.*; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.DyeColor; import org.bukkit.Material; import org.bukkit.block.Block; @@ -279,12 +279,16 @@ public void onLazarusClick(InventoryClickEvent event) { Object[] options = null; switch (dt) { case AXOLOTL -> { - if (!plugin.isDisguisesOnServer()) { + if (plugin.isDisguisesOnServer()) { + new TARDISLazarusLibs(player, disguise, getAxolotlVariant(view), getBoolean(view), getBaby(view)).createDisguise(); + } else { options = new Object[]{getAxolotlVariant(view), AGE.getFromBoolean(getBaby(view))}; } } case FROG -> { - if (!plugin.isDisguisesOnServer()) { + if (plugin.isDisguisesOnServer()) { + new TARDISLazarusLibs(player, disguise, getFrogVariant(view), getBoolean(view), getBaby(view)).createDisguise(); + } else { options = new Object[]{getFrogVariant(view), AGE.getFromBoolean(getBaby(view))}; } } diff --git a/src/main/java/me/eccentric_nz/TARDIS/lazarus/TARDISLazarusInventory.java b/src/main/java/me/eccentric_nz/TARDIS/lazarus/TARDISLazarusInventory.java index 9f9bfed97f..cd11f26ed3 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/lazarus/TARDISLazarusInventory.java +++ b/src/main/java/me/eccentric_nz/TARDIS/lazarus/TARDISLazarusInventory.java @@ -19,7 +19,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.custommodeldata.GUIChameleonPresets; import me.eccentric_nz.TARDIS.custommodeldata.GUIGeneticManipulator; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; diff --git a/src/main/java/me/eccentric_nz/TARDIS/lazarus/TARDISLazarusLibs.java b/src/main/java/me/eccentric_nz/TARDIS/lazarus/TARDISLazarusLibs.java index 553662b48a..b9f51b0842 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/lazarus/TARDISLazarusLibs.java +++ b/src/main/java/me/eccentric_nz/TARDIS/lazarus/TARDISLazarusLibs.java @@ -73,6 +73,11 @@ public void createDisguise() { return; } switch (dt) { + case AXOLOTL -> { + AxolotlWatcher axolotlWatcher = (AxolotlWatcher) livingWatcher; + axolotlWatcher.setVariant((Axolotl.Variant) choice); + axolotlWatcher.setBaby(isBaby); + } case CAT -> { CatWatcher catWatcher = (CatWatcher) livingWatcher; catWatcher.setType((Cat.Type) choice); @@ -81,6 +86,11 @@ public void createDisguise() { } catWatcher.setBaby(isBaby); } + case FROG -> { + FrogWatcher frogWatcher = (FrogWatcher) livingWatcher; + frogWatcher.setVariant((Frog.Variant) choice); + frogWatcher.setBaby(isBaby); + } case PANDA -> { PandaWatcher pandaWatcher = (PandaWatcher) livingWatcher; Panda.Gene gene = (Panda.Gene) choice; diff --git a/src/main/java/me/eccentric_nz/TARDIS/lazarus/TARDISLazarusListener.java b/src/main/java/me/eccentric_nz/TARDIS/lazarus/TARDISLazarusListener.java index 8773bdc482..53def2ac4e 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/lazarus/TARDISLazarusListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/lazarus/TARDISLazarusListener.java @@ -25,7 +25,7 @@ import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.floodgate.FloodgateGeneticManipulatorForm; import me.eccentric_nz.TARDIS.floodgate.TARDISFloodgate; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; diff --git a/src/main/java/me/eccentric_nz/TARDIS/lazarus/TARDISLazarusPageTwoInventory.java b/src/main/java/me/eccentric_nz/TARDIS/lazarus/TARDISLazarusPageTwoInventory.java index 8922d5e308..bb1795a1f3 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/lazarus/TARDISLazarusPageTwoInventory.java +++ b/src/main/java/me/eccentric_nz/TARDIS/lazarus/TARDISLazarusPageTwoInventory.java @@ -19,7 +19,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.custommodeldata.GUIChameleonPoliceBoxes; import me.eccentric_nz.TARDIS.custommodeldata.GUIGeneticManipulator; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; diff --git a/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISBiomeReaderListener.java b/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISBiomeReaderListener.java index afea1964d2..509d857b09 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISBiomeReaderListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISBiomeReaderListener.java @@ -16,16 +16,13 @@ */ package me.eccentric_nz.TARDIS.listeners; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.UUID; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.advanced.TARDISSerializeInventory; +import me.eccentric_nz.TARDIS.upgrades.SystemTree; import me.eccentric_nz.TARDIS.database.resultset.ResultSetDiskStorage; import me.eccentric_nz.TARDIS.enumeration.Storage; import me.eccentric_nz.TARDIS.enumeration.TardisModule; +import me.eccentric_nz.TARDIS.upgrades.SystemUpgradeChecker; import org.bukkit.Material; import org.bukkit.block.Biome; import org.bukkit.entity.Player; @@ -37,6 +34,12 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.UUID; + /** * @author eccentric_nz */ @@ -79,12 +82,16 @@ public void onInteract(PlayerInteractEvent event) { if (is.getType().equals(Material.BRICK) && is.hasItemMeta()) { ItemMeta im = is.getItemMeta(); if (im.hasDisplayName() && im.getDisplayName().equals("TARDIS Biome Reader")) { + UUID uuid = player.getUniqueId(); + if (plugin.getConfig().getBoolean("difficulty.system_upgrades") && !new SystemUpgradeChecker(plugin).has(uuid.toString(), SystemTree.BIOME_READER)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_NEED", "Biome Reader"); + return; + } Biome biome = event.getClickedBlock().getBiome(); if (biome.equals(Biome.THE_VOID)) { plugin.getMessenger().send(player, TardisModule.TARDIS, "BIOME_READER_NOT_VALID"); return; } - UUID uuid = player.getUniqueId(); // check if they have this biome disk yet HashMap where = new HashMap<>(); where.put("uuid", uuid.toString()); diff --git a/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISBonemealListener.java b/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISBonemealListener.java index 31516b3acf..52819940ad 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISBonemealListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISBonemealListener.java @@ -43,7 +43,7 @@ public void onBonemeal(BlockFertilizeEvent event) { } // is it the player's garden? ResultSetTardisID rst = new ResultSetTardisID(plugin); - if (rst.fromUUID(event.getPlayer().getUniqueId().toString()) && rst.getTardis_id() == id) { + if (rst.fromUUID(event.getPlayer().getUniqueId().toString()) && rst.getTardisId() == id) { int y = location.getBlockY() + 1; for (BlockState state : event.getBlocks()) { Block block = state.getBlock(); diff --git a/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISChatListener.java b/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISChatListener.java index 36900be402..885c19aee3 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISChatListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISChatListener.java @@ -24,7 +24,7 @@ import me.eccentric_nz.TARDIS.howto.TARDISSeedsInventory; import me.eccentric_nz.TARDIS.travel.ComehereAction; import me.eccentric_nz.TARDIS.travel.ComehereRequest; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; diff --git a/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISCraftListener.java b/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISCraftListener.java index 4833acde95..fcebad83a8 100755 --- a/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISCraftListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISCraftListener.java @@ -19,7 +19,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.enumeration.DiskCircuit; import me.eccentric_nz.TARDIS.enumeration.TardisModule; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Color; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; @@ -182,6 +182,11 @@ public void onCraftTARDISItem(PrepareItemCraftEvent event) { im.getPersistentDataContainer().set(plugin.getCustomBlockKey(), PersistentDataType.INTEGER, 10000); is.setItemMeta(im); ci.setResult(is); + } else if (dn.contains("Stattenheim")) { + int uses = plugin.getConfig().getInt("circuits.uses.stattenheim"); + im.getPersistentDataContainer().set(plugin.getCustomBlockKey(), PersistentDataType.INTEGER, uses > 0 ? uses : 1000); + is.setItemMeta(im); + ci.setResult(is); } } } diff --git a/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISGravityWellListener.java b/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISGravityWellListener.java index 221af3d76d..480aff6e6f 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISGravityWellListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISGravityWellListener.java @@ -16,8 +16,6 @@ */ package me.eccentric_nz.TARDIS.listeners; -import java.util.HashMap; -import java.util.UUID; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.database.resultset.ResultSetGravity; import me.eccentric_nz.TARDIS.database.resultset.ResultSetPlayerPrefs; @@ -39,6 +37,9 @@ import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.inventory.EquipmentSlot; +import java.util.HashMap; +import java.util.UUID; + /** * Air corridors projected by TARDISes had the option to use anti-gravity, allowing the occupant of the corridor to * float through the corridor instead of walk. @@ -208,7 +209,7 @@ public void onWoolInteract(PlayerInteractEvent event) { plugin.getMessenger().send(player, TardisModule.TARDIS, "NOT_A_TIMELORD"); return; } - int id = rs.getTardis_id(); + int id = rs.getTardisId(); String loc = b.getLocation().toString(); if (values[0] == 6) { // find record and delete it diff --git a/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISHotbarListener.java b/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISHotbarListener.java index 55d08375ee..73940085b9 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISHotbarListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISHotbarListener.java @@ -66,7 +66,7 @@ public void onSelectTARDISItem(PlayerItemHeldEvent event) { ResultSetTardisID rs = new ResultSetTardisID(plugin); if (rs.fromUUID(player.getUniqueId().toString())) { HashMap wherecl = new HashMap<>(); - wherecl.put("tardis_id", rs.getTardis_id()); + wherecl.put("tardis_id", rs.getTardisId()); ResultSetCurrentLocation rsc = new ResultSetCurrentLocation(plugin, wherecl); if (!rsc.resultSet()) { return; diff --git a/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISJoinListener.java b/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISJoinListener.java index 1903731943..75b6444fed 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISJoinListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISJoinListener.java @@ -26,7 +26,6 @@ import me.eccentric_nz.TARDIS.database.data.Tardis; import me.eccentric_nz.TARDIS.database.resultset.*; import me.eccentric_nz.TARDIS.enumeration.ChameleonPreset; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; import me.eccentric_nz.TARDIS.flight.FlightReturnData; import me.eccentric_nz.TARDIS.flight.FlyingAnimation; import me.eccentric_nz.TARDIS.floodgate.TARDISFloodgate; @@ -113,7 +112,7 @@ public void onJoin(PlayerJoinEvent event) { } } } - if (!plugin.getDifficulty().equals(Difficulty.EASY) && ((plugin.getConfig().getBoolean("allow.player_difficulty") && TARDISPermission.hasPermission(player, "tardis.difficulty")) || (plugin.getConfig().getInt("travel.grace_period") > 0 && TARDISPermission.hasPermission(player, "tardis.create")))) { + if (plugin.getConfig().getInt("travel.grace_period") > 0 && TARDISPermission.hasPermission(player, "tardis.create")) { // check if they have t_count record - create one if not ResultSetCount rsc = new ResultSetCount(plugin, uuid); if (!rsc.resultSet()) { @@ -253,7 +252,7 @@ public void onJoin(PlayerJoinEvent event) { } else if (!rsid.fromUUID(player.getUniqueId().toString())) { return; } - int id = rsid.getTardis_id(); + int id = rsid.getTardisId(); HashMap wherei = new HashMap<>(); wherei.put("tardis_id", id); wherei.put("uuid", player.getUniqueId().toString()); diff --git a/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISMenuListener.java b/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISMenuListener.java index e09debabbd..588ef6625c 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISMenuListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISMenuListener.java @@ -20,7 +20,7 @@ import me.eccentric_nz.TARDIS.commands.sudo.TARDISSudoTracker; import me.eccentric_nz.TARDIS.enumeration.Storage; import me.eccentric_nz.TARDIS.utility.TARDISNumberParsers; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -111,6 +111,7 @@ private HashMap getTitleMap() { map.put(ChatColor.DARK_RED + "Genetic Manipulator", 54); // TODO should Handles Program GUI be in here? // map.put(ChatColor.DARK_RED + "Handles Program", 54); + map.put(ChatColor.DARK_RED + "Particle Preferences", 54); map.put(ChatColor.DARK_RED + "Player Prefs Menu", 36); map.put(ChatColor.DARK_RED + "Recipe Categories", 27); map.put(ChatColor.DARK_RED + "TARDIS Recipes", 27); @@ -135,6 +136,7 @@ private HashMap getTitleMap() { map.put(ChatColor.DARK_RED + "TARDIS Seeds Menu", 90); map.put(ChatColor.DARK_RED + "TARDIS Seeds Recipe", 90); map.put(ChatColor.DARK_RED + "TARDIS Shell Loader", 54); + map.put(ChatColor.DARK_RED + "TARDIS System Upgrades", 54); map.put(ChatColor.DARK_RED + "TARDIS Telepathic Circuit", 54); map.put(ChatColor.DARK_RED + "TARDIS Upgrade Menu", 54); map.put(ChatColor.DARK_RED + "TARDIS Wall & Floor Menu", 90); diff --git a/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISSeedBlockListener.java b/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISSeedBlockListener.java index 6508008a5c..4714dc3afc 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISSeedBlockListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISSeedBlockListener.java @@ -127,7 +127,7 @@ public void onSeedBlockPlace(BlockPlaceEvent event) { ResultSetTardisID rs = new ResultSetTardisID(plugin); String uuid = player.getUniqueId().toString(); if (rs.fromUUID(uuid)) { - new ConsoleBuilder(plugin).create(event.getBlockPlaced(), colour, rs.getTardis_id(), uuid); + new ConsoleBuilder(plugin).create(event.getBlockPlaced(), colour, rs.getTardisId(), uuid); } } } diff --git a/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISStattenheimListener.java b/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISStattenheimListener.java index 5092840d6a..87b7b382a0 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISStattenheimListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISStattenheimListener.java @@ -18,6 +18,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.advanced.TARDISCircuitChecker; +import me.eccentric_nz.TARDIS.advanced.TARDISCircuitDamager; import me.eccentric_nz.TARDIS.api.Parameters; import me.eccentric_nz.TARDIS.artron.TARDISAdaptiveBoxLampToggler; import me.eccentric_nz.TARDIS.artron.TARDISBeaconToggler; @@ -26,16 +27,20 @@ import me.eccentric_nz.TARDIS.builders.BuildData; import me.eccentric_nz.TARDIS.control.SensorToggle; import me.eccentric_nz.TARDIS.database.data.Tardis; +import me.eccentric_nz.TARDIS.database.data.Throticle; import me.eccentric_nz.TARDIS.database.resultset.*; import me.eccentric_nz.TARDIS.destroyers.DestroyData; import me.eccentric_nz.TARDIS.enumeration.*; import me.eccentric_nz.TARDIS.travel.TARDISTimeTravel; +import me.eccentric_nz.TARDIS.upgrades.SystemTree; +import me.eccentric_nz.TARDIS.upgrades.SystemUpgradeChecker; import me.eccentric_nz.TARDIS.utility.TARDISMaterials; import me.eccentric_nz.TARDIS.utility.TARDISStaticUtils; import me.eccentric_nz.TARDIS.utility.protection.TARDISLWCChecker; import nl.rutgerkok.blocklocker.BlockLockerAPIv2; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.Sound; import org.bukkit.Tag; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; @@ -49,6 +54,7 @@ import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.persistence.PersistentDataType; import java.util.ArrayList; import java.util.HashMap; @@ -86,10 +92,32 @@ public void onStattenheimInteract(PlayerInteractEvent event) { ItemStack is = player.getInventory().getItemInMainHand(); if (is.getType().equals(Material.FLINT) && is.hasItemMeta()) { ItemMeta im = is.getItemMeta(); + int uses; if (im.getDisplayName().equals("Stattenheim Remote")) { + UUID uuid = player.getUniqueId(); + if (plugin.getConfig().getBoolean("difficulty.system_upgrades") && !new SystemUpgradeChecker(plugin).has(uuid.toString(), SystemTree.STATTENHEIM_REMOTE)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_NEED", "Stattenheim Remote"); + return; + } + // check uses + if (im.getPersistentDataContainer().has(plugin.getCustomBlockKey(), PersistentDataType.INTEGER)) { + uses = im.getPersistentDataContainer().get(plugin.getCustomBlockKey(), PersistentDataType.INTEGER); + if (uses <= 0) { + // break the remote + player.getInventory().setItemInMainHand(null); + player.playSound(player.getLocation(), Sound.ITEM_SHIELD_BREAK, 1.0f, 1.0f); + plugin.getMessenger().send(player, TardisModule.TARDIS, "STATTENHEIM_USED"); + return; + } + } else { + // add uses + int u = plugin.getConfig().getInt("circuits.uses.stattenheim"); + uses = u > 0 ? u : 1000; + im.getPersistentDataContainer().set(plugin.getCustomBlockKey(), PersistentDataType.INTEGER, uses); + is.setItemMeta(im); + } Action action = event.getAction(); // check they are a Time Lord - UUID uuid = player.getUniqueId(); HashMap where = new HashMap<>(); where.put("uuid", uuid.toString()); ResultSetTardis rs = new ResultSetTardis(plugin, where, "", false, 0); @@ -148,15 +176,21 @@ public void onStattenheimInteract(PlayerInteractEvent event) { plugin.getMessenger().send(player, TardisModule.TARDIS, "POWER_DOWN"); return; } - TARDISCircuitChecker tcc = null; - if (!plugin.getDifficulty().equals(Difficulty.EASY) && !plugin.getUtils().inGracePeriod(player, true)) { - tcc = new TARDISCircuitChecker(plugin, id); - tcc.getCircuits(); - } - if (tcc != null && !tcc.hasMaterialisation()) { + TARDISCircuitChecker tcc = new TARDISCircuitChecker(plugin, id); + tcc.getCircuits(); + if (plugin.getConfig().getBoolean("difficulty.circuits") && !plugin.getUtils().inGracePeriod(player, true) && !tcc.hasMaterialisation()) { plugin.getMessenger().send(player, TardisModule.TARDIS, "NO_MAT_CIRCUIT"); return; } + // damage circuit if configured + if (plugin.getConfig().getBoolean("circuits.damage") && plugin.getConfig().getInt("circuits.uses.materialisation") > 0) { + // decrement uses + int uses_left = tcc.getMaterialisationUses(); + new TARDISCircuitDamager(plugin, DiskCircuit.MATERIALISATION, uses_left, id, player).damage(); + } + // decrement uses + im.getPersistentDataContainer().set(plugin.getCustomBlockKey(), PersistentDataType.INTEGER, uses - 1); + is.setItemMeta(im); boolean hidden = tardis.isHidden(); int level = tardis.getArtronLevel(); // check they are not in the tardis @@ -205,8 +239,8 @@ public void onStattenheimInteract(PlayerInteractEvent event) { plugin.getMessenger().send(player, TardisModule.TARDIS, "WOULD_GRIEF_BLOCKS"); return; } - SpaceTimeThrottle spaceTimeThrottle = new ResultSetThrottle(plugin).getSpeed(uuid.toString()); - int ch = Math.round(plugin.getArtronConfig().getInt("comehere") * spaceTimeThrottle.getArtronMultiplier()); + Throticle throticle = new ResultSetThrottle(plugin).getSpeedAndParticles(uuid.toString()); + int ch = Math.round(plugin.getArtronConfig().getInt("comehere") * throticle.getThrottle().getArtronMultiplier()); if (level < ch) { plugin.getMessenger().send(player, TardisModule.TARDIS, "NOT_ENOUGH_ENERGY"); return; @@ -266,7 +300,8 @@ public void onStattenheimInteract(PlayerInteractEvent event) { dd.setOutside(true); dd.setSubmarine(rsc.isSubmarine()); dd.setTardisID(id); - dd.setThrottle(spaceTimeThrottle); + dd.setThrottle(throticle.getThrottle()); + dd.setParticles(throticle.getParticles()); plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> { if (!hid) { plugin.getTrackerKeeper().getDematerialising().add(id); @@ -285,7 +320,8 @@ public void onStattenheimInteract(PlayerInteractEvent event) { bd.setRebuild(false); bd.setSubmarine(sub); bd.setTardisID(id); - bd.setThrottle(spaceTimeThrottle); + bd.setThrottle(throticle.getThrottle()); + bd.setParticles(throticle.getParticles()); plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> plugin.getPresetBuilder().buildPreset(bd), delay * 2); // remove energy from TARDIS HashMap wheret = new HashMap<>(); diff --git a/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISTagListener.java b/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISTagListener.java index c4d69a7069..d11578fe6c 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISTagListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISTagListener.java @@ -27,7 +27,7 @@ import me.eccentric_nz.TARDIS.TARDISConstants; import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; import me.eccentric_nz.TARDIS.enumeration.TardisModule; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; diff --git a/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISTeleportListener.java b/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISTeleportListener.java index a0898a2e95..3c8e31c9a1 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISTeleportListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISTeleportListener.java @@ -16,9 +16,6 @@ */ package me.eccentric_nz.TARDIS.listeners; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.builders.TARDISInteriorPostioning; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardisID; @@ -30,6 +27,10 @@ import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + /** * Teleportation is a form of matter transmission and can be either a process of physical/psychological will or a * technological one. @@ -94,7 +95,7 @@ public void onTeleport(PlayerTeleportEvent event) { plugin.getQueryFactory().doDelete("travellers", wherer); plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> { HashMap wherei = new HashMap<>(); - wherei.put("tardis_id", rsid.getTardis_id()); + wherei.put("tardis_id", rsid.getTardisId()); wherei.put("uuid", uuid); plugin.getQueryFactory().doInsert("travellers", wherei); }, 2L); diff --git a/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISTemporalLocatorListener.java b/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISTemporalLocatorListener.java index 61bc612600..8afaccc7cc 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISTemporalLocatorListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/listeners/TARDISTemporalLocatorListener.java @@ -19,11 +19,10 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.advanced.TARDISCircuitChecker; import me.eccentric_nz.TARDIS.advanced.TARDISCircuitDamager; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; import me.eccentric_nz.TARDIS.enumeration.DiskCircuit; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.utility.TARDISNumberParsers; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.inventory.InventoryClickEvent; @@ -71,7 +70,7 @@ public void onTemporalTerminalClick(InventoryClickEvent event) { plugin.getTrackerKeeper().getSetTime().put(player.getUniqueId(), time); plugin.getMessenger().send(player, TardisModule.TARDIS, "TEMPORAL_SET", String.format("%d", time)); // damage the circuit if configured - if (plugin.getConfig().getBoolean("circuits.damage") && !plugin.getDifficulty().equals(Difficulty.EASY) && plugin.getConfig().getInt("circuits.uses.temporal") > 0) { + if (plugin.getConfig().getBoolean("circuits.damage") && plugin.getConfig().getInt("circuits.uses.temporal") > 0) { int id = plugin.getTardisAPI().getIdOfTARDISPlayerIsIn(player.getUniqueId()); TARDISCircuitChecker tcc = new TARDISCircuitChecker(plugin, id); tcc.getCircuits(); diff --git a/src/main/java/me/eccentric_nz/TARDIS/listeners/controls/TARDISHandlesFrameListener.java b/src/main/java/me/eccentric_nz/TARDIS/listeners/controls/TARDISHandlesFrameListener.java index 6b3eecba6e..e2360b80b0 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/listeners/controls/TARDISHandlesFrameListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/listeners/controls/TARDISHandlesFrameListener.java @@ -16,9 +16,6 @@ */ package me.eccentric_nz.TARDIS.listeners.controls; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; import me.eccentric_nz.TARDIS.database.resultset.ResultSetControls; @@ -29,7 +26,7 @@ import me.eccentric_nz.TARDIS.handles.TARDISHandlesProgramInventory; import me.eccentric_nz.TARDIS.utility.TARDISNumberParsers; import me.eccentric_nz.TARDIS.utility.TARDISSounds; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.ItemFrame; @@ -42,6 +39,10 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + /** * @author eccentric_nz */ @@ -138,12 +139,12 @@ public void onHandlesFrameClick(PlayerInteractEntityEvent event) { if (rst.fromUUID(player.getUniqueId().toString())) { // check if they have a handles block HashMap wherec = new HashMap<>(); - wherec.put("tardis_id", rst.getTardis_id()); + wherec.put("tardis_id", rst.getTardisId()); wherec.put("type", 26); ResultSetControls rsc = new ResultSetControls(plugin, wherec, false); if (!rsc.resultSet()) { String newLocation = frame.getLocation().toString(); - plugin.getQueryFactory().insertControl(rst.getTardis_id(), 26, newLocation, 0); + plugin.getQueryFactory().insertControl(rst.getTardisId(), 26, newLocation, 0); } else { event.setCancelled(true); plugin.getMessenger().send(event.getPlayer(), TardisModule.TARDIS, "HANDLES_PLACED"); @@ -201,7 +202,7 @@ public void onItemFrameDamage(EntityDamageByEntityEvent event) { } // is it the players handles? ResultSetTardisID rst = new ResultSetTardisID(plugin); - if (rst.fromUUID(player.getUniqueId().toString()) && rsc.getTardis_id() == rst.getTardis_id()) { + if (rst.fromUUID(player.getUniqueId().toString()) && rsc.getTardis_id() == rst.getTardisId()) { // remove control record HashMap wherec = new HashMap<>(); wherec.put("c_id", rsc.getC_id()); diff --git a/src/main/java/me/eccentric_nz/TARDIS/listeners/controls/TARDISItemFrameUpdateListener.java b/src/main/java/me/eccentric_nz/TARDIS/listeners/controls/TARDISItemFrameUpdateListener.java index 771646e501..bd097c3b54 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/listeners/controls/TARDISItemFrameUpdateListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/listeners/controls/TARDISItemFrameUpdateListener.java @@ -18,7 +18,6 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; -import me.eccentric_nz.TARDIS.rotors.TARDISTimeRotor; import me.eccentric_nz.TARDIS.control.TARDISScannerMap; import me.eccentric_nz.TARDIS.database.resultset.ResultSetControls; import me.eccentric_nz.TARDIS.database.resultset.ResultSetCurrentLocation; @@ -28,6 +27,7 @@ import me.eccentric_nz.TARDIS.monitor.MonitorSnapshot; import me.eccentric_nz.TARDIS.monitor.MonitorUtils; import me.eccentric_nz.TARDIS.monitor.Snapshot; +import me.eccentric_nz.TARDIS.rotors.TARDISTimeRotor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Rotation; @@ -87,7 +87,7 @@ public void onItemFrameUpdate(PlayerInteractEntityEvent event) { plugin.getMessenger().send(player, TardisModule.TARDIS, "NO_TARDIS"); return; } - int id = rst.getTardis_id(); + int id = rst.getTardisId(); if (control == Control.ROTOR) { UUID rotorId = frame.getUniqueId(); TARDISTimeRotor.updateRotorRecord(id, rotorId.toString()); diff --git a/src/main/java/me/eccentric_nz/TARDIS/listeners/controls/TARDISKeyboardListener.java b/src/main/java/me/eccentric_nz/TARDIS/listeners/controls/TARDISKeyboardListener.java index 320703ff5f..1d6d90b4ff 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/listeners/controls/TARDISKeyboardListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/listeners/controls/TARDISKeyboardListener.java @@ -20,7 +20,6 @@ import me.eccentric_nz.TARDIS.advanced.TARDISCircuitChecker; import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; import me.eccentric_nz.TARDIS.database.resultset.*; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.planets.TARDISAliasResolver; import org.bukkit.Tag; @@ -81,7 +80,7 @@ public void onSignChange(SignChangeEvent event) { } Player p = event.getPlayer(); TARDISCircuitChecker tcc = null; - if (!plugin.getDifficulty().equals(Difficulty.EASY) && !plugin.getUtils().inGracePeriod(p, false)) { + if (plugin.getConfig().getBoolean("difficulty.circuits") && !plugin.getUtils().inGracePeriod(p, false)) { tcc = new TARDISCircuitChecker(plugin, rsc.getTardis_id()); tcc.getCircuits(); } diff --git a/src/main/java/me/eccentric_nz/TARDIS/listeners/controls/TARDISMonitorFrameListener.java b/src/main/java/me/eccentric_nz/TARDIS/listeners/controls/TARDISMonitorFrameListener.java index d4393cec78..71db9960ef 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/listeners/controls/TARDISMonitorFrameListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/listeners/controls/TARDISMonitorFrameListener.java @@ -27,6 +27,8 @@ import me.eccentric_nz.TARDIS.monitor.MonitorSnapshot; import me.eccentric_nz.TARDIS.monitor.MonitorUtils; import me.eccentric_nz.TARDIS.monitor.Snapshot; +import me.eccentric_nz.TARDIS.upgrades.SystemTree; +import me.eccentric_nz.TARDIS.upgrades.SystemUpgradeChecker; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.ItemFrame; @@ -38,6 +40,7 @@ import org.bukkit.inventory.meta.ItemMeta; import java.util.HashMap; +import java.util.UUID; /** * @author eccentric_nz @@ -61,6 +64,11 @@ public void onMonitorFrameClick(PlayerInteractEntityEvent event) { where.put("type", 46); ResultSetControls rs = new ResultSetControls(plugin, where, false); if (rs.resultSet()) { + UUID uuid = player.getUniqueId(); + if (plugin.getConfig().getBoolean("difficulty.system_upgrades") && !new SystemUpgradeChecker(plugin).has(uuid.toString(), SystemTree.MONITOR)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_NEED", "TARDIS Monitor"); + return; + } if (player.isSneaking() && TARDISPermission.hasPermission(player, "tardis.camera")) { // not while travelling if (isTravelling(rs.getTardis_id())) { @@ -92,7 +100,7 @@ public void onMonitorFrameClick(PlayerInteractEntityEvent event) { if (map.getType() == Material.FILLED_MAP) { // get the TARDIS the player is inside HashMap wheret = new HashMap<>(); - wheret.put("uuid", player.getUniqueId().toString()); + wheret.put("uuid", uuid.toString()); ResultSetTravellers rst = new ResultSetTravellers(plugin, wheret, false); if (rst.resultSet()) { int id = rst.getTardis_id(); diff --git a/src/main/java/me/eccentric_nz/TARDIS/listeners/controls/TARDISTelepathicListener.java b/src/main/java/me/eccentric_nz/TARDIS/listeners/controls/TARDISTelepathicListener.java index d33eca92df..94d6468a8e 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/listeners/controls/TARDISTelepathicListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/listeners/controls/TARDISTelepathicListener.java @@ -16,17 +16,21 @@ */ package me.eccentric_nz.TARDIS.listeners.controls; -import java.util.Arrays; -import java.util.HashMap; -import java.util.UUID; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.TARDISConstants; +import me.eccentric_nz.TARDIS.console.telepathic.TARDISTelepathicInventory; import me.eccentric_nz.TARDIS.database.resultset.ResultSetControls; import me.eccentric_nz.TARDIS.database.resultset.ResultSetPlayerPrefs; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardis; import me.eccentric_nz.TARDIS.enumeration.TardisModule; +import me.eccentric_nz.TARDIS.floodgate.FloodgateTelepathicForm; +import me.eccentric_nz.TARDIS.floodgate.TARDISFloodgate; +import me.eccentric_nz.TARDIS.upgrades.SystemTree; +import me.eccentric_nz.TARDIS.upgrades.SystemUpgradeChecker; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -35,9 +39,15 @@ import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.inventory.EquipmentSlot; +import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.UUID; + /** * @author eccentric_nz */ @@ -55,39 +65,80 @@ public void onTelepathicCircuit(PlayerInteractEvent event) { return; } Block block = event.getClickedBlock(); - if (!block.getType().equals(Material.DAYLIGHT_DETECTOR)) { - return; - } - String location = block.getLocation().toString(); - // get tardis from saved location - HashMap where = new HashMap<>(); - where.put("type", 23); - where.put("location", location); - ResultSetControls rsc = new ResultSetControls(plugin, where, false); - if (rsc.resultSet()) { - int id = rsc.getTardis_id(); - // get the Time Lord of this TARDIS - HashMap wheret = new HashMap<>(); - wheret.put("tardis_id", id); - ResultSetTardis rs = new ResultSetTardis(plugin, wheret, "", false, 0); - if (rs.resultSet()) { - UUID o_uuid = rs.getTardis().getUuid(); - String owner = o_uuid.toString(); - // get Time Lord player prefs - ResultSetPlayerPrefs rsp = new ResultSetPlayerPrefs(plugin, owner); - if (rsp.resultSet()) { - Player player = event.getPlayer(); - UUID uuid = player.getUniqueId(); - if (rsp.isTelepathyOn()) { - // track player - plugin.getTrackerKeeper().getTelepaths().put(uuid, o_uuid); - plugin.getMessenger().send(player, TardisModule.TARDIS, "TELEPATHIC_COMMAND"); + if (block != null && block.getType().equals(Material.DAYLIGHT_DETECTOR)) { + String location = block.getLocation().toString(); + // get tardis from saved location + HashMap where = new HashMap<>(); + where.put("type", 23); + where.put("location", location); + ResultSetControls rsc = new ResultSetControls(plugin, where, false); + if (rsc.resultSet()) { + Player player = event.getPlayer(); + UUID uuid = player.getUniqueId(); + if (plugin.getConfig().getBoolean("difficulty.system_upgrades") && !new SystemUpgradeChecker(plugin).has(uuid.toString(), SystemTree.TELEPATHIC_CIRCUIT)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_NEED", "Telepathic Circuit"); + return; + } + int id = rsc.getTardis_id(); + if (player.isSneaking()) { + // get the Time Lord of this TARDIS + HashMap wheret = new HashMap<>(); + wheret.put("tardis_id", id); + ResultSetTardis rs = new ResultSetTardis(plugin, wheret, "", false, 0); + if (rs.resultSet()) { + UUID o_uuid = rs.getTardis().getUuid(); + String owner = o_uuid.toString(); + // get Time Lord player prefs + ResultSetPlayerPrefs rsp = new ResultSetPlayerPrefs(plugin, owner); + if (rsp.resultSet()) { + if (rsp.isTelepathyOn()) { + // track player + plugin.getTrackerKeeper().getTelepaths().put(uuid, o_uuid); + plugin.getMessenger().send(player, TardisModule.TARDIS, "TELEPATHIC_COMMAND"); + } else { + plugin.getMessenger().send(player, TardisModule.TARDIS, "TELEPATHIC_OFF"); + } + } + plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> block.setBlockData(TARDISConstants.DAYLIGHT), 3L); + } + } else { + if (TARDISFloodgate.isFloodgateEnabled() && TARDISFloodgate.isBedrockPlayer(uuid)) { + new FloodgateTelepathicForm(plugin, uuid, id).send(); } else { - plugin.getMessenger().send(player, TardisModule.TARDIS, "TELEPATHIC_OFF"); + // open the Telepathic GUI + TARDISTelepathicInventory tti = new TARDISTelepathicInventory(plugin, player); + ItemStack[] gui = tti.getButtons(); + Inventory telepathic = plugin.getServer().createInventory(player, 54, ChatColor.DARK_RED + "TARDIS Telepathic Circuit"); + telepathic.setContents(gui); + player.openInventory(telepathic); } } } - plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> block.setBlockData(TARDISConstants.DAYLIGHT), 3L); + } else { + ItemStack is = event.getItem(); + if (is == null) { + return; + } + if (!is.getType().equals(Material.GLOWSTONE_DUST) || !is.hasItemMeta()) { + return; + } + ItemMeta im = is.getItemMeta(); + if (im.hasDisplayName() && im.getDisplayName().equals("TARDIS Telepathic Circuit")) { + Block up = event.getClickedBlock().getRelative(BlockFace.UP); + if (!up.getType().isAir()) { + return; + } + up.setType(Material.DAYLIGHT_DETECTOR); + int amount = is.getAmount(); + if (amount > 1) { + is.setAmount(amount - 1); + } else { + event.getPlayer().getInventory().setItemInMainHand(null); + } + UUID uuid = event.getPlayer().getUniqueId(); + String l = up.getLocation().toString(); + plugin.getTrackerKeeper().getTelepathicPlacements().put(uuid, l); + } } } @@ -108,11 +159,14 @@ public void onTelepathicCircuitBreak(BlockBreakEvent event) { event.setCancelled(true); // set block to AIR b.setBlockData(TARDISConstants.AIR); - // drop a custom DAYLIGHT_DETECTOR - ItemStack is = new ItemStack(Material.DAYLIGHT_DETECTOR, 1); + // drop a custom GLOWSTONE_DUST + ItemStack is = new ItemStack(Material.GLOWSTONE_DUST, 1); ItemMeta im = is.getItemMeta(); im.setDisplayName("TARDIS Telepathic Circuit"); - im.setLore(Arrays.asList("Allow companions to", "use TARDIS commands")); + im.setCustomModelData(10001962); + String uses = (plugin.getConfig().getString("circuits.uses.telepathic").equals("0") || !plugin.getConfig().getBoolean("circuits.damage")) ? ChatColor.YELLOW + "unlimited" : ChatColor.YELLOW + plugin.getConfig().getString("circuits.uses.telepathic"); + List lore = Arrays.asList("Uses left", uses); + im.setLore(lore); is.setItemMeta(im); b.getWorld().dropItemNaturally(b.getLocation(), is); } diff --git a/src/main/java/me/eccentric_nz/TARDIS/mapping/TARDISBlueMap.java b/src/main/java/me/eccentric_nz/TARDIS/mapping/TARDISBlueMap.java index 0db41d23a1..b9d8fa8a2f 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/mapping/TARDISBlueMap.java +++ b/src/main/java/me/eccentric_nz/TARDIS/mapping/TARDISBlueMap.java @@ -53,7 +53,6 @@ public void enable() { // if enabled, activate if (bluemap != null && bluemap.isEnabled()) { activate(); - checkIcon(); } } @@ -70,10 +69,6 @@ public void updateMarkerSet(long period) { plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new BlueMapMarkerUpdate(), period); } - private void checkIcon() { - - } - private class BlueMapMarkerUpdate implements Runnable { // build new map Map newmap = new HashMap<>(); diff --git a/src/main/java/me/eccentric_nz/TARDIS/mapping/TARDISSquareMap.java b/src/main/java/me/eccentric_nz/TARDIS/mapping/TARDISSquareMap.java new file mode 100644 index 0000000000..09d18046cb --- /dev/null +++ b/src/main/java/me/eccentric_nz/TARDIS/mapping/TARDISSquareMap.java @@ -0,0 +1,120 @@ +package me.eccentric_nz.TARDIS.mapping; + +import me.eccentric_nz.TARDIS.TARDIS; +import me.eccentric_nz.TARDIS.api.TARDISData; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.plugin.Plugin; +import org.bukkit.scheduler.BukkitRunnable; +import xyz.jpenilla.squaremap.api.*; +import xyz.jpenilla.squaremap.api.marker.Icon; +import xyz.jpenilla.squaremap.api.marker.Marker; +import xyz.jpenilla.squaremap.api.marker.MarkerOptions; + +import javax.imageio.ImageIO; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.logging.Level; + +public class TARDISSquareMap implements TARDISMapper { + + public static final Key TARDIS_ICON_KEY = Key.key("tardis_icon"); + private static final Key TARDIS_LAYER_KEY = Key.key("tardis"); + private final TARDIS plugin; + private final Map tasks = new HashMap<>(); + + public TARDISSquareMap(TARDIS plugin) { + this.plugin = plugin; + } + + @Override + public void disable() { + tasks.values().forEach(SquaremapTask::disable); + tasks.clear(); + } + + @Override + public void enable() { + Plugin squaremap = plugin.getPM().getPlugin("squaremap"); + plugin.getPM().registerEvents(new TARDISServerListener("squaremap", this), plugin); + // if enabled, activate + if (squaremap != null && squaremap.isEnabled()) { + activate(); + } + } + + @Override + public void activate() { + try { + BufferedImage image = ImageIO.read(new File(plugin.getDataFolder(), "tardis.png")); + SquaremapProvider.get().iconRegistry().register(TARDIS_ICON_KEY, image); + } catch (IOException e) { + plugin.getLogger().log(Level.WARNING, "Failed to register TARDIS icon", e); + } + updateMarkerSet(plugin.getConfig().getLong("mapping.update_period")); + } + + @Override + public void updateMarkerSet(long period) { + for (MapWorld world : SquaremapProvider.get().mapWorlds()) { + if (!plugin.getPlanetsConfig().getBoolean("planets." + world.identifier() + "time_travel")) { + continue; + } + SimpleLayerProvider provider = SimpleLayerProvider.builder("TARDIS") + .showControls(true) + .defaultHidden(false) + .build(); + world.layerRegistry().register(TARDIS_LAYER_KEY, provider); + SquaremapTask task = new SquaremapTask(world, provider, plugin); + task.runTaskTimerAsynchronously(plugin, 0, 20L * period); + tasks.put(world.identifier(), task); + } + } + + private class SquaremapTask extends BukkitRunnable { + + private final MapWorld world; + private final SimpleLayerProvider provider; + private final TARDIS plugin; + + private boolean stop; + + public SquaremapTask(MapWorld world, SimpleLayerProvider provider, TARDIS plugin) { + this.world = world; + this.provider = provider; + this.plugin = plugin; + } + + @Override + public void run() { + if (stop) { + cancel(); + } + provider.clearMarkers(); + final World bukkitWorld = BukkitAdapter.bukkitWorld(world); + TARDISGetter getter = new TARDISGetter(plugin, bukkitWorld); + getter.resultSetAsync(results -> { + for (TARDISData data : results) { + handle(data.getOwner(), data.getLocation()); + } + }); + } + + private void handle(String name, Location location) { + Icon icon = Marker.icon(BukkitAdapter.point(location), TARDISSquareMap.TARDIS_ICON_KEY, 16); + String label = String.format("%s (TARDIS)", name); + icon.markerOptions(MarkerOptions.builder().hoverTooltip(label)); + String markerid = "tardis_" + name; + provider.addMarker(Key.of(markerid), icon); + } + + public void disable() { + cancel(); + stop = true; + provider.clearMarkers(); + } + } +} diff --git a/src/main/java/me/eccentric_nz/TARDIS/messaging/SpigotComponents.java b/src/main/java/me/eccentric_nz/TARDIS/messaging/SpigotComponents.java index 67b6e89e99..374b5309d9 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/messaging/SpigotComponents.java +++ b/src/main/java/me/eccentric_nz/TARDIS/messaging/SpigotComponents.java @@ -251,12 +251,12 @@ public static TextComponent getSign() { public static TextComponent getUpdate(String first, String value, String split) { TextComponent textComponent = new TextComponent(first); - textComponent.setColor(net.md_5.bungee.api.ChatColor.GOLD); + textComponent.setColor(ChatColor.GOLD); TextComponent tck = new TextComponent(value); - tck.setColor(net.md_5.bungee.api.ChatColor.WHITE); + tck.setColor(ChatColor.WHITE); textComponent.addExtra(tck); TextComponent tcl = new TextComponent(split); - tcl.setColor(net.md_5.bungee.api.ChatColor.GOLD); + tcl.setColor(ChatColor.GOLD); textComponent.addExtra(tcl); textComponent.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new Text("Click me!"))); textComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tardisinfo " + value)); diff --git a/src/main/java/me/eccentric_nz/TARDIS/messaging/TARDISChatPaginator.java b/src/main/java/me/eccentric_nz/TARDIS/messaging/TARDISChatPaginator.java index 838b91f01c..3334161d6f 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/messaging/TARDISChatPaginator.java +++ b/src/main/java/me/eccentric_nz/TARDIS/messaging/TARDISChatPaginator.java @@ -20,7 +20,7 @@ import java.util.LinkedList; import java.util.List; import me.eccentric_nz.TARDIS.TARDIS; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; /** * The TARDISChatPaginator takes a raw string of arbitrary length and breaks it down into an array of strings diff --git a/src/main/java/me/eccentric_nz/TARDIS/messaging/TARDISLister.java b/src/main/java/me/eccentric_nz/TARDIS/messaging/TARDISLister.java index 7df2ddf953..e2de33127e 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/messaging/TARDISLister.java +++ b/src/main/java/me/eccentric_nz/TARDIS/messaging/TARDISLister.java @@ -31,7 +31,7 @@ import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.enumeration.WorldManager; import me.eccentric_nz.TARDIS.planets.TARDISAliasResolver; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; diff --git a/src/main/java/me/eccentric_nz/TARDIS/mobfarming/TARDISFarmingInventory.java b/src/main/java/me/eccentric_nz/TARDIS/mobfarming/TARDISFarmingInventory.java index d8a7c18d49..f91fce7c3d 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/mobfarming/TARDISFarmingInventory.java +++ b/src/main/java/me/eccentric_nz/TARDIS/mobfarming/TARDISFarmingInventory.java @@ -4,7 +4,7 @@ import me.eccentric_nz.TARDIS.custommodeldata.GUIFarming; import me.eccentric_nz.TARDIS.database.data.FarmPrefs; import me.eccentric_nz.TARDIS.database.resultset.ResultSetFarmingPrefs; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; diff --git a/src/main/java/me/eccentric_nz/TARDIS/mobfarming/TARDISFarmingMenuListener.java b/src/main/java/me/eccentric_nz/TARDIS/mobfarming/TARDISFarmingMenuListener.java index 0eaa2ff376..ea2bd98068 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/mobfarming/TARDISFarmingMenuListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/mobfarming/TARDISFarmingMenuListener.java @@ -18,7 +18,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/src/main/java/me/eccentric_nz/TARDIS/monitor/MonitorSnapshot.java b/src/main/java/me/eccentric_nz/TARDIS/monitor/MonitorSnapshot.java index 39d49955bd..add56fc335 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/monitor/MonitorSnapshot.java +++ b/src/main/java/me/eccentric_nz/TARDIS/monitor/MonitorSnapshot.java @@ -16,7 +16,6 @@ */ package me.eccentric_nz.TARDIS.monitor; -import java.util.HashMap; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.database.resultset.ResultSetChunks; import me.eccentric_nz.TARDIS.database.resultset.ResultSetDoors; @@ -29,6 +28,8 @@ import org.bukkit.Material; import org.bukkit.entity.Player; +import java.util.HashMap; + /** * * @author eccentric_nz @@ -123,7 +124,7 @@ public void get(boolean in, Player player) { // get interior door location ResultSetTardisID rst = new ResultSetTardisID(plugin); if (rst.fromUUID(player.getUniqueId().toString())) { - int id = rst.getTardis_id(); + int id = rst.getTardisId(); HashMap whered = new HashMap<>(); whered.put("tardis_id", id); whered.put("door_type", which); diff --git a/src/main/java/me/eccentric_nz/TARDIS/move/TARDISDoorClickListener.java b/src/main/java/me/eccentric_nz/TARDIS/move/TARDISDoorClickListener.java index 535f8bf549..733c355566 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/move/TARDISDoorClickListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/move/TARDISDoorClickListener.java @@ -157,7 +157,7 @@ public void onDoorInteract(PlayerInteractEvent event) { // must be the owner ResultSetTardisID rs = new ResultSetTardisID(plugin); if (rs.fromUUID(playerUUID.toString())) { - if (rs.getTardis_id() != id) { + if (rs.getTardisId() != id) { plugin.getMessenger().sendStatus(player, "DOOR_LOCK_UNLOCK"); return; } diff --git a/src/main/java/me/eccentric_nz/TARDIS/move/TARDISDoorListener.java b/src/main/java/me/eccentric_nz/TARDIS/move/TARDISDoorListener.java index 6a2a4cab41..80c7b756b8 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/move/TARDISDoorListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/move/TARDISDoorListener.java @@ -26,6 +26,7 @@ import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.mobfarming.TARDISPet; import me.eccentric_nz.TARDIS.travel.TARDISDoorLocation; +import me.eccentric_nz.TARDIS.upgrades.SystemUpgradeRecord; import me.eccentric_nz.TARDIS.utility.TARDISItemRenamer; import me.eccentric_nz.TARDIS.utility.TARDISSounds; import me.eccentric_nz.TARDIS.utility.TARDISStaticLocationGetters; @@ -192,6 +193,8 @@ private void doPlayerMove(Player player, Location location, boolean exit, World if (plugin.getTrackerKeeper().getHasTravelled().contains(uuid)) { plugin.getQueryFactory().alterEnergyLevel("player_prefs", player_artron, where, player); plugin.getTrackerKeeper().getHasTravelled().remove(uuid); + // make a system upgrade record if necessary + new SystemUpgradeRecord(plugin).make(uuid.toString()); } // set player time when exiting TARDIS if (plugin.getTrackerKeeper().getSetTime().containsKey(uuid)) { diff --git a/src/main/java/me/eccentric_nz/TARDIS/move/TARDISDoorWalkListener.java b/src/main/java/me/eccentric_nz/TARDIS/move/TARDISDoorWalkListener.java index 7860e60238..aea60f6fd6 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/move/TARDISDoorWalkListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/move/TARDISDoorWalkListener.java @@ -551,8 +551,8 @@ public void onDoorInteract(PlayerInteractEvent event) { plugin.getQueryFactory().alterEnergyLevel("tardis", costa, wherea, player); } default -> { + // do nothing } - // do nothing } } } diff --git a/src/main/java/me/eccentric_nz/TARDIS/move/TARDISSpectaclesRunnable.java b/src/main/java/me/eccentric_nz/TARDIS/move/TARDISSpectaclesRunnable.java index ca757b39b0..8d86bbf40e 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/move/TARDISSpectaclesRunnable.java +++ b/src/main/java/me/eccentric_nz/TARDIS/move/TARDISSpectaclesRunnable.java @@ -60,7 +60,7 @@ public void run() { if (b.equals(value.toString())) { ResultSetTardisID rs = new ResultSetTardisID(plugin); if (rs.fromUUID(key.toString())) { - ResultSetCurrentFromId rsc = new ResultSetCurrentFromId(plugin, rs.getTardis_id()); + ResultSetCurrentFromId rsc = new ResultSetCurrentFromId(plugin, rs.getTardisId()); if (rsc.resultSet()) { p.sendBlockChange(value.getLocation(), lower.get(rsc.getDirection())); p.sendBlockChange(value.getRelative(BlockFace.UP).getLocation(), upper); diff --git a/src/main/java/me/eccentric_nz/TARDIS/particles/Beam.java b/src/main/java/me/eccentric_nz/TARDIS/particles/Beam.java new file mode 100644 index 0000000000..0ec90253bc --- /dev/null +++ b/src/main/java/me/eccentric_nz/TARDIS/particles/Beam.java @@ -0,0 +1,38 @@ +package me.eccentric_nz.TARDIS.particles; + +import me.eccentric_nz.TARDIS.TARDIS; +import org.bukkit.Location; +import org.bukkit.util.Vector; + +import java.util.UUID; + +public class Beam extends TARDISParticleRunnable { + + private final ParticleEffect particle; + private final Location location; + private final Vector[] directions; + + public Beam(TARDIS plugin, UUID uuid, ParticleEffect particle, Location location) { + super(plugin, uuid); + this.particle = particle; + this.location = location; + this.directions = generateVectors(false); + } + + @Override + public void run() { + t = t + 0.1; + for (int v = 0; v < 10; v++) { + double x = t * directions[v].getX() + 0.5d; + double y = t * directions[v].getY(); + double z = t * directions[v].getZ() + 0.5d; + location.add(x, y, z); + // spawn particle + spawnParticle(particle.getParticle(), location, 1, speed); + location.subtract(x, y, z); + } + if (t > 6) { + cancel(); + } + } +} diff --git a/src/main/java/me/eccentric_nz/TARDIS/particles/Emitter.java b/src/main/java/me/eccentric_nz/TARDIS/particles/Emitter.java new file mode 100644 index 0000000000..37ce73f1da --- /dev/null +++ b/src/main/java/me/eccentric_nz/TARDIS/particles/Emitter.java @@ -0,0 +1,45 @@ +package me.eccentric_nz.TARDIS.particles; + +import me.eccentric_nz.TARDIS.TARDIS; +import me.eccentric_nz.TARDIS.database.data.ParticleData; +import org.bukkit.Location; + +import java.util.UUID; + +public class Emitter extends TARDISParticleRunnable implements Runnable { + + private final TARDIS plugin; + private final UUID uuid; + private final Location location; + private final ParticleData particle; + private final long loops; + + public Emitter(TARDIS plugin, UUID uuid, Location location, ParticleData particle, long end) { + super(plugin, uuid); + this.plugin = plugin; + this.uuid = uuid; + this.location = location.add(0.5d, particle.getShape().getY(), 0.5d); + this.particle = particle; + this.loops = end / particle.getShape().getPeriod() + 1; + } + + @Override + public void run() { + if (t < loops) { + TARDISParticleRunnable runnable; + switch (particle.getShape()) { + case BEAM -> runnable = new Beam(plugin, uuid, particle.getEffect(), location); + case HELIX -> runnable = new Helix(plugin, uuid, particle.getEffect(), location); + case RINGS -> runnable = new Rings(plugin, uuid, particle, location); + case VACUUM -> runnable = new Vacuum(plugin, uuid, particle, location); + case WAVE -> runnable = new Wave(plugin, uuid, particle, location); + default -> runnable = new Randomish(plugin, uuid, particle.getEffect(), location); + } + int task = plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, runnable, 0, 1); + runnable.setTaskID(task); + t++; + } else { + cancel(); + } + } +} diff --git a/src/main/java/me/eccentric_nz/TARDIS/particles/Helix.java b/src/main/java/me/eccentric_nz/TARDIS/particles/Helix.java new file mode 100644 index 0000000000..f0440c10f0 --- /dev/null +++ b/src/main/java/me/eccentric_nz/TARDIS/particles/Helix.java @@ -0,0 +1,34 @@ +package me.eccentric_nz.TARDIS.particles; + +import me.eccentric_nz.TARDIS.TARDIS; +import org.bukkit.Location; + +import java.util.UUID; + +public class Helix extends TARDISParticleRunnable { + + private final ParticleEffect particle; + private final Location location; + + public Helix(TARDIS plugin, UUID uuid, ParticleEffect particle, Location location) { + super(plugin, uuid); + this.particle = particle; + this.location = location; + } + + @Override + public void run() { + t = t + Math.PI / 16; + double radius = 2; + double x = radius * Math.cos(t); + double y = 0.25 * t; + double z = radius * Math.sin(t); + location.add(x, y, z); + // spawn particle + spawnParticle(particle.getParticle(), location, 1, speed); + location.subtract(x, y, z); + if (t > Math.PI * 8) { + cancel(); + } + } +} diff --git a/src/main/java/me/eccentric_nz/TARDIS/particles/ParticleEffect.java b/src/main/java/me/eccentric_nz/TARDIS/particles/ParticleEffect.java new file mode 100644 index 0000000000..c8285086a0 --- /dev/null +++ b/src/main/java/me/eccentric_nz/TARDIS/particles/ParticleEffect.java @@ -0,0 +1,42 @@ +package me.eccentric_nz.TARDIS.particles; + +import org.bukkit.Particle; + +public enum ParticleEffect { + + ASH(Particle.ASH), + BOOM(Particle.SONIC_BOOM), + BREATH(Particle.DRAGON_BREATH), + BUBBLES(Particle.BUBBLE_POP), + CLOUDS(Particle.CLOUD), + DUST(Particle.DUST), + EFFECT(Particle.EFFECT), + FLAMES(Particle.FLAME), + GLOW(Particle.GLOW), + GUST(Particle.SMALL_GUST), + HEART(Particle.HEART), + HIT(Particle.ENCHANTED_HIT), + HONEY(Particle.DRIPPING_HONEY), + INFESTED(Particle.INFESTED), + MUSIC(Particle.NOTE), + OMEN(Particle.TRIAL_OMEN), + PETALS(Particle.CHERRY_LEAVES), + SCULK(Particle.SCULK_CHARGE), + SHRIEK(Particle.SHRIEK), + SNOWY(Particle.ITEM_SNOWBALL), + SPARK(Particle.ELECTRIC_SPARK), + SPLASH(Particle.SPLASH), + SPAWNER(Particle.TRIAL_SPAWNER_DETECTION), + SPELL(Particle.WITCH), + SPORE(Particle.CRIMSON_SPORE); + + private final Particle particle; + + ParticleEffect(Particle particle) { + this.particle = particle; + } + + public Particle getParticle() { + return particle; + } +} diff --git a/src/main/java/me/eccentric_nz/TARDIS/particles/ParticleShape.java b/src/main/java/me/eccentric_nz/TARDIS/particles/ParticleShape.java new file mode 100644 index 0000000000..e84e5c86c4 --- /dev/null +++ b/src/main/java/me/eccentric_nz/TARDIS/particles/ParticleShape.java @@ -0,0 +1,27 @@ +package me.eccentric_nz.TARDIS.particles; + +public enum ParticleShape { + + BEAM(25L, 0.5d), + HELIX(60L, 0), + RANDOM(20L, 1.0d), + RINGS(10L, 2.0d), + VACUUM(12L, 0.5d), + WAVE(32L, 0.5d); + + private final long period; + private final double y; + + ParticleShape(long period, double y) { + this.period = period; + this.y = y; + } + + public long getPeriod() { + return period; + } + + public double getY() { + return y; + } +} diff --git a/src/main/java/me/eccentric_nz/TARDIS/particles/Randomish.java b/src/main/java/me/eccentric_nz/TARDIS/particles/Randomish.java new file mode 100644 index 0000000000..438cc12a02 --- /dev/null +++ b/src/main/java/me/eccentric_nz/TARDIS/particles/Randomish.java @@ -0,0 +1,38 @@ +package me.eccentric_nz.TARDIS.particles; + +import me.eccentric_nz.TARDIS.TARDIS; +import org.bukkit.Location; +import org.bukkit.util.Vector; + +import java.util.UUID; + +public class Randomish extends TARDISParticleRunnable implements Runnable { + + private final ParticleEffect particle; + private final Location location; + + public Randomish(TARDIS plugin, UUID uuid, ParticleEffect particle, Location location) { + super(plugin, uuid); + this.particle = particle; + this.location = location; + } + + @Override + public void run() { + t = t + 0.5; + for (double theta = 0; theta <= 2 * Math.PI; theta += Math.PI / 4) { + for (Vector vector : generateVectors(true)) { + double x = t * vector.getX() + 0.5d; + double y = t * vector.getY() + 1.5d; + double z = t * vector.getZ() + 0.5d; + location.add(x, y, z); + // spawn particle + spawnParticle(particle.getParticle(), location, 1, speed); + location.subtract(x, y, z); + } + } + if (t > 10) { + cancel(); + } + } +} diff --git a/src/main/java/me/eccentric_nz/TARDIS/particles/Rings.java b/src/main/java/me/eccentric_nz/TARDIS/particles/Rings.java new file mode 100644 index 0000000000..a743ad8ace --- /dev/null +++ b/src/main/java/me/eccentric_nz/TARDIS/particles/Rings.java @@ -0,0 +1,37 @@ +package me.eccentric_nz.TARDIS.particles; + +import me.eccentric_nz.TARDIS.TARDIS; +import me.eccentric_nz.TARDIS.database.data.ParticleData; +import org.bukkit.Location; + +import java.util.UUID; + +public class Rings extends TARDISParticleRunnable { + + private final ParticleData data; + private final Location location; + + public Rings(TARDIS plugin, UUID uuid, ParticleData data, Location location) { + super(plugin, uuid); + this.data = data; + this.location = location; + } + + @Override + public void run() { + t += Math.PI / 10; + for (double theta = 0; theta <= 2 * Math.PI; theta += Math.PI / data.getDensity()) { + double radius = 1.5d; + double x = radius * Math.cos(theta); + double y = radius * Math.cos(t); + double z = radius * Math.sin(theta); + location.add(x, y, z); + // spawn particle + spawnParticle(data.getEffect().getParticle(), location, 1, speed); + location.subtract(x, y, z); + } + if (t > Math.PI) { + cancel(); + } + } +} diff --git a/src/main/java/me/eccentric_nz/TARDIS/utility/TARDISFirework.java b/src/main/java/me/eccentric_nz/TARDIS/particles/TARDISFirework.java similarity index 96% rename from src/main/java/me/eccentric_nz/TARDIS/utility/TARDISFirework.java rename to src/main/java/me/eccentric_nz/TARDIS/particles/TARDISFirework.java index add1e1703c..104e36b3c6 100755 --- a/src/main/java/me/eccentric_nz/TARDIS/utility/TARDISFirework.java +++ b/src/main/java/me/eccentric_nz/TARDIS/particles/TARDISFirework.java @@ -16,10 +16,8 @@ * * Rocket code borrowed from com.darkblade12.itemslotmachine.rocket.Rocket.java */ -package me.eccentric_nz.TARDIS.utility; +package me.eccentric_nz.TARDIS.particles; -import java.util.ArrayList; -import java.util.List; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.TARDISConstants; import org.bukkit.*; @@ -29,6 +27,9 @@ import org.bukkit.inventory.meta.FireworkMeta; import org.bukkit.scheduler.BukkitRunnable; +import java.util.ArrayList; +import java.util.List; + public class TARDISFirework { private static final Color[] COLORS; diff --git a/src/main/java/me/eccentric_nz/TARDIS/particles/TARDISParticleGUIListener.java b/src/main/java/me/eccentric_nz/TARDIS/particles/TARDISParticleGUIListener.java new file mode 100644 index 0000000000..fddf5e72b0 --- /dev/null +++ b/src/main/java/me/eccentric_nz/TARDIS/particles/TARDISParticleGUIListener.java @@ -0,0 +1,245 @@ +/* + * Copyright (C) 2024 eccentric_nz + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package me.eccentric_nz.TARDIS.particles; + +import me.eccentric_nz.TARDIS.TARDIS; +import me.eccentric_nz.TARDIS.custommodeldata.GUIParticle; +import me.eccentric_nz.TARDIS.database.data.ParticleData; +import me.eccentric_nz.TARDIS.database.data.Throticle; +import me.eccentric_nz.TARDIS.database.resultset.ResultSetCurrentLocation; +import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardisID; +import me.eccentric_nz.TARDIS.database.resultset.ResultSetThrottle; +import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; +import me.eccentric_nz.TARDIS.utility.TARDISNumberParsers; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.inventory.InventoryView; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; + +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.UUID; + +/** + * @author eccentric_nz + */ +public class TARDISParticleGUIListener extends TARDISMenuListener { + + private final TARDIS plugin; + + public TARDISParticleGUIListener(TARDIS plugin) { + super(plugin); + this.plugin = plugin; + } + + /** + * Listens for player clicking inside an inventory. If the inventory is a TARDIS GUI, then the click is processed + * accordingly. + * + * @param event a player clicking an inventory slot + */ + @EventHandler(ignoreCancelled = true) + public void onParticleClick(InventoryClickEvent event) { + InventoryView view = event.getView(); + if (!view.getTitle().equals(ChatColor.DARK_RED + "Particle Preferences")) { + return; + } + event.setCancelled(true); + int slot = event.getRawSlot(); + Player player = (Player) event.getWhoClicked(); + UUID uuid = player.getUniqueId(); + if (slot >= 0 && slot < 54) { + // get selection + ItemStack is = view.getItem(slot); + if (is != null) { + ItemMeta im = is.getItemMeta(); + String display = im.getDisplayName(); + switch (slot) { + case 2, 3, 4, 5, 6, 7 -> setShape(view, slot, display, uuid); // particle shape + case 11, 12, 13, 14, 15, 16, + 20, 21, 22, 23, 24, 25, + 29, 30, 31, 32, 33, 34, + 38, 39, 40, 41, 42, 43 -> setEffect(view, slot, display, uuid); // particle effect + case 27 -> toggle(view, is, uuid); // set enabled/disabled + case 35 -> test(view, player, uuid); // test + case 45 -> less(view, true, uuid); // less density + case 47 -> more(view, true, uuid); // more density + case 49 -> less(view, false, uuid); // less speed + case 51 -> more(view, false, uuid); // more speed + case 53 -> close(player); + default -> { + } // do nothing + } + } + } + } + + private void setShape(InventoryView view, int slot, String display, UUID uuid) { + for (int s = 2; s < 8; s++) { + ItemStack is = view.getItem(s); + if (is != null) { + is.setType(s == slot ? Material.LAPIS_ORE : Material.LAPIS_LAZULI); + view.setItem(s, is); + } + } + HashMap set = new HashMap<>(); + set.put("shape", display.toUpperCase(Locale.ROOT)); + HashMap where = new HashMap<>(); + where.put("uuid", uuid.toString()); + plugin.getQueryFactory().doSyncUpdate("particle_prefs", set, where); + } + + private void setEffect(InventoryView view, int slot, String display, UUID uuid) { + for (int s = 11; s < 44; s++) { + ItemStack is = view.getItem(s); + if (is != null && s != GUIParticle.TOGGLE.getSlot() && s != GUIParticle.TEST.getSlot()) { + is.setType(s == slot ? Material.REDSTONE_ORE : Material.REDSTONE); + view.setItem(s, is); + } + } + HashMap set = new HashMap<>(); + set.put("effect", display.toUpperCase(Locale.ROOT)); + HashMap where = new HashMap<>(); + where.put("uuid", uuid.toString()); + plugin.getQueryFactory().doSyncUpdate("particle_prefs", set, where); + } + + private void toggle(InventoryView view, ItemStack is, UUID uuid) { + ItemMeta im = is.getItemMeta(); + int cmd = im.getCustomModelData(); + im.setCustomModelData(cmd > 100 ? 19 : 119); + List lore = im.getLore(); + lore.set(0, cmd > 100 ? "ON" : "OFF"); + im.setLore(lore); + is.setItemMeta(im); + view.setItem(27, is); + HashMap set = new HashMap<>(); + set.put("particles_on", cmd > 100 ? 1 : 0); + HashMap where = new HashMap<>(); + where.put("uuid", uuid.toString()); + plugin.getQueryFactory().doSyncUpdate("particle_prefs", set, where); + } + + private void test(InventoryView view, Player player, UUID uuid) { + if (plugin.getUtils().inTARDISWorld(player)) { + // must be outside the TARDIS + return; + } + // get players TARDIS id + ResultSetTardisID rst = new ResultSetTardisID(plugin); + if (rst.fromUUID(uuid.toString())) { + // get TARDIS location + HashMap wherec = new HashMap<>(); + wherec.put("tardis_id", rst.getTardisId()); + ResultSetCurrentLocation rsc = new ResultSetCurrentLocation(plugin, wherec); + if (rsc.resultSet()) { + Location current = new Location(rsc.getWorld(), rsc.getX(), rsc.getY(), rsc.getZ()).add(0.5, 0, 0.5); + // get throttle setting + ResultSetThrottle rs = new ResultSetThrottle(plugin); + Throticle throticle = rs.getSpeedAndParticles(uuid.toString()); + // read current settings + ParticleData data = getParticleData(view); + // display particles + Emitter emitter = new Emitter(plugin, uuid, current, data, throticle.getThrottle().getFlightTime()); + int task = plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, emitter, 0, data.getShape().getPeriod()); + emitter.setTaskID(task); + // close GUI + close(player); + } + } + } + + private ParticleData getParticleData(InventoryView view) { + ParticleEffect effect = ParticleEffect.ASH; + ParticleShape shape = ParticleShape.RANDOM; + int density = 16; + double speed = 0; + boolean b = false; + try { + for (int s = 11; s < 44; s++) { + ItemStack eis = view.getItem(s); + if (eis != null && eis.getType() == Material.REDSTONE_ORE) { + effect = ParticleEffect.valueOf(eis.getItemMeta().getDisplayName().toUpperCase(Locale.ROOT)); + } + } + for (int s = 2; s < 8; s++) { + ItemStack sis = view.getItem(s); + if (sis != null && sis.getType() == Material.LAPIS_ORE) { + shape = ParticleShape.valueOf(sis.getItemMeta().getDisplayName().toUpperCase(Locale.ROOT)); + } + } + } catch (IllegalArgumentException ignored) { + } + ItemStack dis = view.getItem(GUIParticle.DENSITY.getSlot()); + String d = ChatColor.stripColor(dis.getItemMeta().getLore().getFirst()); + density = TARDISNumberParsers.parseInt(d); + ItemStack spis = view.getItem(GUIParticle.SPEED.getSlot()); + String s = ChatColor.stripColor(spis.getItemMeta().getLore().getFirst()); + speed = TARDISNumberParsers.parseInt(s) / 10.0d; + return new ParticleData(effect, shape, density, speed, b); + } + + private void less(InventoryView view, boolean b, UUID uuid) { + int min = b ? 8 : 0; + int slot = b ? GUIParticle.DENSITY.getSlot() : GUIParticle.SPEED.getSlot(); + ItemStack is = view.getItem(slot); + ItemMeta im = is.getItemMeta(); + List lore = im.getLore(); + int level = TARDISNumberParsers.parseInt(ChatColor.stripColor(lore.get(0))); + level -= 1; + if (level >= min) { + lore.set(0, ChatColor.AQUA + "" + level); + im.setLore(lore); + is.setItemMeta(im); + view.setItem(slot, is); + String f = b ? "density" : "speed"; + HashMap set = new HashMap<>(); + set.put(f, b ? (int) level : level); + HashMap where = new HashMap<>(); + where.put("uuid", uuid.toString()); + plugin.getQueryFactory().doSyncUpdate("particle_prefs", set, where); + } + } + + private void more(InventoryView view, boolean b, UUID uuid) { + int max = b ? 32 : 10; + int slot = b ? GUIParticle.DENSITY.getSlot() : GUIParticle.SPEED.getSlot(); + ItemStack is = view.getItem(slot); + ItemMeta im = is.getItemMeta(); + List lore = im.getLore(); + int level = TARDISNumberParsers.parseInt(ChatColor.stripColor(lore.get(0))); + level += 1; + if (level <= max) { + lore.set(0, ChatColor.AQUA + "" + level); + im.setLore(lore); + is.setItemMeta(im); + view.setItem(slot, is); + String f = b ? "density" : "speed"; + HashMap set = new HashMap<>(); + set.put(f, b ? (int) level : level); + HashMap where = new HashMap<>(); + where.put("uuid", uuid.toString()); + plugin.getQueryFactory().doSyncUpdate("particle_prefs", set, where); + } + } +} diff --git a/src/main/java/me/eccentric_nz/TARDIS/particles/TARDISParticleInventory.java b/src/main/java/me/eccentric_nz/TARDIS/particles/TARDISParticleInventory.java new file mode 100644 index 0000000000..08766c2fed --- /dev/null +++ b/src/main/java/me/eccentric_nz/TARDIS/particles/TARDISParticleInventory.java @@ -0,0 +1,176 @@ +/* + * Copyright (C) 2024 eccentric_nz + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package me.eccentric_nz.TARDIS.particles; + +import me.eccentric_nz.TARDIS.TARDIS; +import me.eccentric_nz.TARDIS.custommodeldata.GUIParticle; +import me.eccentric_nz.TARDIS.database.data.ParticleData; +import me.eccentric_nz.TARDIS.database.resultset.ResultSetParticlePrefs; +import me.eccentric_nz.TARDIS.utility.TARDISStringUtils; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; + +import java.util.HashMap; +import java.util.List; + +/** + * Retro-genitor particles are a type of radiation that can stop Time Lords from regenerating. They can prevent an + * individual from travelling in time without a time capsule. Proximity to someone who is infused with retro-genitor + * particles can cause their eyes to turn dark periodically. + * + * @author eccentric_nz + */ +public class TARDISParticleInventory { + + private final ItemStack[] GUI; + private final TARDIS plugin; + private final String uuid; + + public TARDISParticleInventory(TARDIS plugin, String uuid) { + this.plugin = plugin; + this.uuid = uuid; + GUI = getItemStack(); + } + + /** + * Constructs an inventory for the Particle Preferences GUI. + * + * @return an Array of itemStacks (an inventory) + */ + private ItemStack[] getItemStack() { + ItemStack[] stacks = new ItemStack[54]; + // get particle prefs + ParticleData data; + ResultSetParticlePrefs rs = new ResultSetParticlePrefs(plugin); + if (rs.fromUUID(uuid)) { + data = rs.getData(); + } else { + // make a record + HashMap set = new HashMap<>(); + set.put("uuid", uuid); + plugin.getQueryFactory().doSyncInsert("particle_prefs", set); + data = new ParticleData(ParticleEffect.ASH, ParticleShape.RANDOM, 16, 0, false); + } + // shape + ItemStack shape = new ItemStack(GUIParticle.SHAPE_INFO.getMaterial(), 1); + ItemMeta sim = shape.getItemMeta(); + sim.setDisplayName("Effect Shape"); + sim.setLore(List.of("Choose a shape", "from the options", "on the right.")); + sim.setCustomModelData(GUIParticle.SHAPE_INFO.getCustomModelData()); + shape.setItemMeta(sim); + stacks[GUIParticle.SHAPE_INFO.getSlot()] = shape; + int i = 2; + // shapes + for (ParticleShape ps : ParticleShape.values()) { + Material sm = (data.getShape() == ps) ? Material.LAPIS_ORE : GUIParticle.SHAPE.getMaterial(); + ItemStack pshape = new ItemStack(sm, 1); + ItemMeta me = pshape.getItemMeta(); + me.setDisplayName(TARDISStringUtils.capitalise(ps.toString())); + me.setCustomModelData(GUIParticle.SHAPE.getCustomModelData()); + pshape.setItemMeta(me); + stacks[i] = pshape; + i++; + } + // effect + ItemStack effect = new ItemStack(GUIParticle.EFFECT_INFO.getMaterial(), 1); + ItemMeta eim = effect.getItemMeta(); + eim.setDisplayName("Effect Particle"); + eim.setLore(List.of("Choose a particle", "from the options", "on the right.")); + eim.setCustomModelData(GUIParticle.EFFECT_INFO.getCustomModelData()); + effect.setItemMeta(eim); + stacks[GUIParticle.EFFECT_INFO.getSlot()] = effect; + i = 11; + // effects + for (ParticleEffect pe : ParticleEffect.values()) { + Material pm = (data.getEffect() == pe) ? Material.REDSTONE_ORE : GUIParticle.EFFECT.getMaterial(); + ItemStack peffect = new ItemStack(pm, 1); + ItemMeta pim = peffect.getItemMeta(); + pim.setDisplayName(TARDISStringUtils.capitalise(pe.toString())); + pim.setCustomModelData(GUIParticle.EFFECT.getCustomModelData()); + peffect.setItemMeta(pim); + stacks[i] = peffect; + if (i % 9 == 7) { + i += 4; + } else { + i++; + } + } + // toggle on/off + ItemStack toggle = new ItemStack(GUIParticle.TOGGLE.getMaterial(), 1); + ItemMeta tim = toggle.getItemMeta(); + tim.setDisplayName("Particles Enabled"); + tim.setLore(List.of(data.isOn() ? "ON" : "OFF")); + int cmd = (data.isOn()) ? GUIParticle.TOGGLE.getCustomModelData() : 119; + tim.setCustomModelData(cmd); + toggle.setItemMeta(tim); + stacks[GUIParticle.TOGGLE.getSlot()] = toggle; + // test + ItemStack test = new ItemStack(GUIParticle.TEST.getMaterial(), 1); + ItemMeta xim = test.getItemMeta(); + xim.setDisplayName("Test"); + xim.setLore(List.of("Display particles", "around your TARDIS", "with the current settings.")); + xim.setCustomModelData(GUIParticle.TEST.getCustomModelData()); + test.setItemMeta(xim); + stacks[GUIParticle.TEST.getSlot()] = test; + // density + ItemStack density = new ItemStack(GUIParticle.DENSITY.getMaterial(), 1); + ItemMeta dim = density.getItemMeta(); + dim.setDisplayName("Particle Density"); + dim.setLore(List.of(ChatColor.AQUA + "" + data.getDensity(), "Has no effect", "on some shapes.", "Range: 8 - 32.")); + dim.setCustomModelData(GUIParticle.DENSITY.getCustomModelData()); + density.setItemMeta(dim); + stacks[GUIParticle.DENSITY.getSlot()] = density; + // speed + ItemStack speed = new ItemStack(GUIParticle.SPEED.getMaterial(), 1); + ItemMeta spim = speed.getItemMeta(); + spim.setDisplayName("Particle Speed"); + spim.setLore(List.of(ChatColor.AQUA + "" + String.format("%.0f", data.getSpeed() * 10), "Range: 0 - 10.")); + spim.setCustomModelData(GUIParticle.SPEED.getCustomModelData()); + speed.setItemMeta(spim); + stacks[GUIParticle.SPEED.getSlot()] = speed; + // minus + ItemStack minus = new ItemStack(GUIParticle.MINUS.getMaterial(), 1); + ItemMeta mim = minus.getItemMeta(); + mim.setDisplayName(plugin.getLanguage().getString("BUTTON_LESS")); + mim.setCustomModelData(GUIParticle.MINUS.getCustomModelData()); + minus.setItemMeta(mim); + stacks[45] = minus; + stacks[49] = minus; + // plus + ItemStack plus = new ItemStack(GUIParticle.PLUS.getMaterial(), 1); + ItemMeta pim = plus.getItemMeta(); + pim.setDisplayName(plugin.getLanguage().getString("BUTTON_MORE")); + pim.setCustomModelData(GUIParticle.PLUS.getCustomModelData()); + plus.setItemMeta(pim); + stacks[47] = plus; + stacks[51] = plus; + // close + ItemStack close = new ItemStack(Material.BOWL, 1); + ItemMeta cim = close.getItemMeta(); + cim.setDisplayName(plugin.getLanguage().getString("BUTTON_CLOSE")); + cim.setCustomModelData(GUIParticle.CLOSE.getCustomModelData()); + close.setItemMeta(cim); + stacks[53] = close; + return stacks; + } + + public ItemStack[] getGUI() { + return GUI; + } +} diff --git a/src/main/java/me/eccentric_nz/TARDIS/particles/TARDISParticleRunnable.java b/src/main/java/me/eccentric_nz/TARDIS/particles/TARDISParticleRunnable.java new file mode 100644 index 0000000000..073d3b68de --- /dev/null +++ b/src/main/java/me/eccentric_nz/TARDIS/particles/TARDISParticleRunnable.java @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2024 eccentric_nz + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package me.eccentric_nz.TARDIS.particles; + +import me.eccentric_nz.TARDIS.TARDIS; +import me.eccentric_nz.TARDIS.TARDISConstants; +import me.eccentric_nz.TARDIS.database.resultset.ResultSetParticlePrefs; +import org.bukkit.Color; +import org.bukkit.Location; +import org.bukkit.Particle; +import org.bukkit.util.Vector; + +import java.util.UUID; + +/** + * @author eccentric_nz + */ +public class TARDISParticleRunnable implements Runnable { + + protected final UUID uuid; + protected double t = 0; + protected double speed = 0; + int taskID; + + public TARDISParticleRunnable(TARDIS plugin, UUID uuid) { + this.uuid = uuid; + ResultSetParticlePrefs rs = new ResultSetParticlePrefs(plugin); + if (rs.fromUUID(uuid.toString())) { + this.speed = rs.getData().getSpeed(); + } + } + + public void setTaskID(int taskID) { + this.taskID = taskID; + } + + public void spawnParticle(Particle particle, Location location, int count, double speed) { + if (particle == Particle.DUST) { + Particle.DustOptions options = new Particle.DustOptions(Color.BLUE, 1.0f); + location.getWorld().spawnParticle(particle, location, count, speed, speed, speed, speed, options, false); + } else if (particle == Particle.SHRIEK) { + location.getWorld().spawnParticle(particle, location, count, speed, speed, speed, speed, 1, false); + } else if (particle == Particle.SCULK_CHARGE) { + location.getWorld().spawnParticle(particle, location, count, speed, speed, speed, speed, 1.0f, false); + } else { + location.getWorld().spawnParticle(particle, location, count, speed, speed, speed, speed, null, false); + } + } + + public Vector[] generateVectors(boolean full) { + Vector[] vectors = new Vector[10]; + for (int i = 0; i < 10; i++) { + double vx = TARDISConstants.RANDOM.nextDouble(-1, 1); + double vy = TARDISConstants.RANDOM.nextDouble(full ? -1 : 0, 1); + double vz = TARDISConstants.RANDOM.nextDouble(-1, 1); + vectors[i] = new Vector(vx, vy, vz); + } + return vectors; + } + + public void cancel() { + TARDIS.plugin.getServer().getScheduler().cancelTask(taskID); + taskID = 0; + } + + @Override + public void run() { + throw new UnsupportedOperationException("Not supported yet."); + } +} diff --git a/src/main/java/me/eccentric_nz/TARDIS/utility/TARDISParticles.java b/src/main/java/me/eccentric_nz/TARDIS/particles/TARDISParticles.java similarity index 98% rename from src/main/java/me/eccentric_nz/TARDIS/utility/TARDISParticles.java rename to src/main/java/me/eccentric_nz/TARDIS/particles/TARDISParticles.java index 5b622f562b..208c51bd85 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/utility/TARDISParticles.java +++ b/src/main/java/me/eccentric_nz/TARDIS/particles/TARDISParticles.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package me.eccentric_nz.TARDIS.utility; +package me.eccentric_nz.TARDIS.particles; import me.eccentric_nz.TARDIS.TARDISConstants; import org.bukkit.Location; diff --git a/src/main/java/me/eccentric_nz/TARDIS/particles/Vacuum.java b/src/main/java/me/eccentric_nz/TARDIS/particles/Vacuum.java new file mode 100644 index 0000000000..a777b8f94a --- /dev/null +++ b/src/main/java/me/eccentric_nz/TARDIS/particles/Vacuum.java @@ -0,0 +1,38 @@ +package me.eccentric_nz.TARDIS.particles; + +import me.eccentric_nz.TARDIS.TARDIS; +import me.eccentric_nz.TARDIS.database.data.ParticleData; +import org.bukkit.Location; + +import java.util.UUID; + +public class Vacuum extends TARDISParticleRunnable { + + private final ParticleData data; + private final Location location; + double radius = 2.5d; + + public Vacuum(TARDIS plugin, UUID uuid, ParticleData data, Location location) { + super(plugin, uuid); + this.data = data; + this.location = location; + } + + @Override + public void run() { + t += Math.PI / 10; + for (double theta = 0; theta <= 2 * Math.PI; theta += Math.PI / data.getDensity()) { + double x = radius * Math.cos(theta) * Math.sin(t); + double y = radius * Math.cos(t); + double z = radius * Math.sin(theta) * Math.sin(t); + location.add(x, y, z); + // spawn particle + spawnParticle(data.getEffect().getParticle(), location, 1, speed); + location.subtract(x, y, z); + } + radius -= 1; + if (t > Math.PI) { + cancel(); + } + } +} diff --git a/src/main/java/me/eccentric_nz/TARDIS/particles/Wave.java b/src/main/java/me/eccentric_nz/TARDIS/particles/Wave.java new file mode 100644 index 0000000000..4b2f1ecd40 --- /dev/null +++ b/src/main/java/me/eccentric_nz/TARDIS/particles/Wave.java @@ -0,0 +1,36 @@ +package me.eccentric_nz.TARDIS.particles; + +import me.eccentric_nz.TARDIS.TARDIS; +import me.eccentric_nz.TARDIS.database.data.ParticleData; +import org.bukkit.Location; + +import java.util.UUID; + +public class Wave extends TARDISParticleRunnable implements Runnable { + + private final ParticleData particle; + private final Location location; + + public Wave(TARDIS plugin, UUID uuid, ParticleData particle, Location location) { + super(plugin, uuid); + this.particle = particle; + this.location = location; + } + + @Override + public void run() { + t = t + 0.1 * Math.PI; + for (double theta = 0; theta <= 2 * Math.PI; theta += Math.PI / particle.getDensity()) { + double x = t * Math.cos(theta) * 0.5; + double y = 1.5 * Math.exp(-0.1 * t) * Math.sin(t) + 1.5; + double z = t * Math.sin(theta) * 0.5; + location.add(x, y, z); + // spawn particle + spawnParticle(particle.getEffect().getParticle(), location, 3, speed); + location.subtract(x, y, z); + } + if (t > 10) { + cancel(); + } + } +} diff --git a/src/main/java/me/eccentric_nz/TARDIS/placeholders/TARDISPlaceholderExpansion.java b/src/main/java/me/eccentric_nz/TARDIS/placeholders/TARDISPlaceholderExpansion.java index 96280d871c..16eaddd187 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/placeholders/TARDISPlaceholderExpansion.java +++ b/src/main/java/me/eccentric_nz/TARDIS/placeholders/TARDISPlaceholderExpansion.java @@ -98,7 +98,7 @@ public String onRequest(OfflinePlayer player, String identifier) { case "any" -> result = "true"; case "own" -> { rsti = new ResultSetTardisID(plugin); - if (rsti.fromUUID(uuid) && rsti.getTardis_id() == rsv.getTardis_id()) { + if (rsti.fromUUID(uuid) && rsti.getTardisId() == rsv.getTardis_id()) { result = "true"; } } @@ -119,7 +119,7 @@ public String onRequest(OfflinePlayer player, String identifier) { OfflinePlayer offlinePlayer = plugin.getServer().getPlayer(split[2]); if (offlinePlayer != null) { rsti = new ResultSetTardisID(plugin); - if (rsti.fromUUID(offlinePlayer.getUniqueId().toString()) && rsti.getTardis_id() == rsv.getTardis_id()) { + if (rsti.fromUUID(offlinePlayer.getUniqueId().toString()) && rsti.getTardisId() == rsv.getTardis_id()) { result = "true"; } } @@ -176,7 +176,7 @@ public String onRequest(OfflinePlayer player, String identifier) { case "current_location" -> { rsti = new ResultSetTardisID(plugin); if (rsti.fromUUID(uuid)) { - where.put("tardis_id", rsti.getTardis_id()); + where.put("tardis_id", rsti.getTardisId()); rscl = new ResultSetCurrentLocation(plugin, where); if (rscl.resultSet()) { result = "TARDIS was left at " + rscl.getWorld().getName() + " at " + "x: " + rscl.getX() + " y: " + rscl.getY() + " z: " + rscl.getZ(); @@ -190,7 +190,7 @@ public String onRequest(OfflinePlayer player, String identifier) { case "current_location_x" -> { rsti = new ResultSetTardisID(plugin); if (rsti.fromUUID(uuid)) { - where.put("tardis_id", rsti.getTardis_id()); + where.put("tardis_id", rsti.getTardisId()); rscl = new ResultSetCurrentLocation(plugin, where); if (rscl.resultSet()) { result = Integer.toString(rscl.getX()); @@ -204,7 +204,7 @@ public String onRequest(OfflinePlayer player, String identifier) { case "current_location_y" -> { rsti = new ResultSetTardisID(plugin); if (rsti.fromUUID(uuid)) { - where.put("tardis_id", rsti.getTardis_id()); + where.put("tardis_id", rsti.getTardisId()); rscl = new ResultSetCurrentLocation(plugin, where); if (rscl.resultSet()) { result = Integer.toString(rscl.getY()); @@ -218,7 +218,7 @@ public String onRequest(OfflinePlayer player, String identifier) { case "current_location_z" -> { rsti = new ResultSetTardisID(plugin); if (rsti.fromUUID(uuid)) { - where.put("tardis_id", rsti.getTardis_id()); + where.put("tardis_id", rsti.getTardisId()); rscl = new ResultSetCurrentLocation(plugin, where); if (rscl.resultSet()) { result = Integer.toString(rscl.getZ()); @@ -232,7 +232,7 @@ public String onRequest(OfflinePlayer player, String identifier) { case "current_location_world" -> { rsti = new ResultSetTardisID(plugin); if (rsti.fromUUID(uuid)) { - where.put("tardis_id", rsti.getTardis_id()); + where.put("tardis_id", rsti.getTardisId()); rscl = new ResultSetCurrentLocation(plugin, where); if (rscl.resultSet()) { result = rscl.getWorld().getName(); @@ -246,7 +246,7 @@ public String onRequest(OfflinePlayer player, String identifier) { case "current_location_direction" -> { rsti = new ResultSetTardisID(plugin); if (rsti.fromUUID(uuid)) { - where.put("tardis_id", rsti.getTardis_id()); + where.put("tardis_id", rsti.getTardisId()); rscl = new ResultSetCurrentLocation(plugin, where); if (rscl.resultSet()) { result = rscl.getDirection().toString(); @@ -260,7 +260,7 @@ public String onRequest(OfflinePlayer player, String identifier) { case "current_location_biome" -> { rsti = new ResultSetTardisID(plugin); if (rsti.fromUUID(uuid)) { - where.put("tardis_id", rsti.getTardis_id()); + where.put("tardis_id", rsti.getTardisId()); rscl = new ResultSetCurrentLocation(plugin, where); if (rscl.resultSet()) { // get from current location diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/TARDISDisplayItemRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/TARDISDisplayItemRecipe.java index a6509935fc..3585e01930 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/TARDISDisplayItemRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/TARDISDisplayItemRecipe.java @@ -18,7 +18,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.customblocks.TARDISDisplayItem; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -56,8 +56,7 @@ public void addDisplayItemRecipes() { NamespacedKey key = new NamespacedKey(plugin, tdi.getName()); ShapedRecipe r = new ShapedRecipe(key, is); r.shape("#A#", "#D#", "###"); - boolean hard = (plugin.getDifficulty().equals(Difficulty.HARD)); - r.setIngredient('#', (hard) ? Material.GLASS : Material.GLASS_PANE); + r.setIngredient('#', plugin.getCraftingDifficulty() == CraftingDifficulty.HARD ? Material.GLASS : Material.GLASS_PANE); r.setIngredient('A', tdi.getCraftMaterial()); r.setIngredient('D', tdi.getMaterial()); plugin.getServer().addRecipe(r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/TARDISRecipeCategoryListener.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/TARDISRecipeCategoryListener.java index 0a32649d57..28b703d2f0 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/TARDISRecipeCategoryListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/TARDISRecipeCategoryListener.java @@ -21,7 +21,7 @@ import me.eccentric_nz.TARDIS.howto.TARDISSeedsInventory; import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; import me.eccentric_nz.TARDIS.utility.TARDISStringUtils; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.inventory.InventoryClickEvent; diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/TARDISRecipeInventoryListener.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/TARDISRecipeInventoryListener.java index 09d7172c56..a834b10034 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/TARDISRecipeInventoryListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/TARDISRecipeInventoryListener.java @@ -18,7 +18,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.inventory.InventoryClickEvent; diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/TARDISSeedRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/TARDISSeedRecipe.java index 92d1c3ddc5..01fd33fe53 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/TARDISSeedRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/TARDISSeedRecipe.java @@ -22,7 +22,7 @@ import me.eccentric_nz.TARDIS.enumeration.Schematic; import me.eccentric_nz.TARDIS.rooms.TARDISWalls; import me.eccentric_nz.TARDIS.utility.TARDISStringUtils; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.World; diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/AcidBatteryRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/AcidBatteryRecipe.java index ebd18fec69..9818816e7a 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/AcidBatteryRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/AcidBatteryRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import me.eccentric_nz.TARDIS.enumeration.RecipeItem; import org.bukkit.Material; import org.bukkit.NamespacedKey; @@ -42,7 +42,7 @@ public void addRecipe() { em.setDisplayName("Acid Bucket"); em.setCustomModelData(RecipeItem.RUST_BUCKET.getCustomModelData()); exact.setItemMeta(em); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape(" A ", "ARA", " A "); r.setIngredient('A', new RecipeChoice.ExactChoice(exact)); r.setIngredient('R', Material.REDSTONE_BLOCK); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/ArtronStorageCellRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/ArtronStorageCellRecipe.java index ff40d2ed34..2c17ba6d75 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/ArtronStorageCellRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/ArtronStorageCellRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -41,7 +41,7 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "artron_storage_cell"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape(" B ", "LRL", " L "); r.setIngredient('B', Material.BUCKET); r.setIngredient('R', Material.REDSTONE_BLOCK); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/AuthorisedControlDiskRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/AuthorisedControlDiskRecipe.java index d946a284bd..b5274a7bb1 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/AuthorisedControlDiskRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/AuthorisedControlDiskRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -37,16 +37,16 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "authorised_control_disk"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("QRQ", "RGR", "QRQ"); r.setIngredient('Q', Material.QUARTZ); r.setIngredient('R', Material.REDSTONE); - r.setIngredient('G', Material.GOLDEN_HELMET); + r.setIngredient('G', Material.GOLDEN_HELMET); } else { r.shape("QRQ", "RLR", "QRQ"); r.setIngredient('Q', Material.QUARTZ); r.setIngredient('R', Material.REDSTONE); - r.setIngredient('L', Material.GLASS_PANE); + r.setIngredient('L', Material.GLASS_PANE); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("Authorised Control Disk", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/BioscannerCircuitRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/BioscannerCircuitRecipe.java index f7342035b8..6c5a4938a1 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/BioscannerCircuitRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/BioscannerCircuitRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -37,16 +37,16 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "bio-scanner_circuit"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape(" E ", "BRB", " E "); r.setIngredient('R', Material.REPEATER); r.setIngredient('E', Material.SPIDER_EYE); - r.setIngredient('B', Material.BONE); + r.setIngredient('B', Material.BONE); } else { r.shape(" E ", "BRB", " E "); r.setIngredient('R', Material.REDSTONE); r.setIngredient('E', Material.SPIDER_EYE); - r.setIngredient('B', Material.BONE); + r.setIngredient('B', Material.BONE); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("Bio-scanner Circuit", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/BlackBowTieRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/BlackBowTieRecipe.java index a75e071fbf..d62eb8f8e9 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/BlackBowTieRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/BlackBowTieRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -41,7 +41,7 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "black_bow_tie"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("STS", "L L", "WWW"); r.setIngredient('S', Material.STRING); r.setIngredient('T', Material.GLOWSTONE_DUST); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/BlankStorageDiskRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/BlankStorageDiskRecipe.java index ae0946d408..e9f7da91f4 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/BlankStorageDiskRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/BlankStorageDiskRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -33,12 +33,12 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "blank_storage_disk"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("QQQ", "Q Q", "QQQ"); - r.setIngredient('Q', Material.QUARTZ); + r.setIngredient('Q', Material.QUARTZ); } else { r.shape("QQQ", "Q Q", "QQQ"); - r.setIngredient('Q', Material.QUARTZ); + r.setIngredient('Q', Material.QUARTZ); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("Blank Storage Disk", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/BlueBowTieRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/BlueBowTieRecipe.java index d9170d2cfa..552a2c77ba 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/BlueBowTieRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/BlueBowTieRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -41,16 +41,16 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "blue_bow_tie"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("STS", "L L", "WWW"); r.setIngredient('S', Material.STRING); r.setIngredient('T', Material.GLOWSTONE_DUST); r.setIngredient('L', Material.LEATHER); - r.setIngredient('W', Material.BLUE_WOOL); + r.setIngredient('W', Material.BLUE_WOOL); } else { r.shape(" ", "SWS", " "); r.setIngredient('S', Material.STRING); - r.setIngredient('W', Material.BLUE_WOOL); + r.setIngredient('W', Material.BLUE_WOOL); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("Blue Bow Tie", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/BrownBowTieRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/BrownBowTieRecipe.java index fd297e199d..0412b5886e 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/BrownBowTieRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/BrownBowTieRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -41,16 +41,16 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "brown_bow_tie"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("STS", "L L", "WWW"); r.setIngredient('S', Material.STRING); r.setIngredient('T', Material.GLOWSTONE_DUST); r.setIngredient('L', Material.LEATHER); - r.setIngredient('W', Material.BROWN_WOOL); + r.setIngredient('W', Material.BROWN_WOOL); } else { r.shape(" ", "SWS", " "); r.setIngredient('S', Material.STRING); - r.setIngredient('W', Material.BROWN_WOOL); + r.setIngredient('W', Material.BROWN_WOOL); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("Brown Bow Tie", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/BrushCircuitRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/BrushCircuitRecipe.java index 4c066b0e6d..bd6df2b3f1 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/BrushCircuitRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/BrushCircuitRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -37,16 +37,16 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "brush_circuit"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape(" K ", "RSR", " R "); r.setIngredient('K', Material.BRUSH); r.setIngredient('R', Material.REDSTONE); - r.setIngredient('S', Material.COPPER_BLOCK); + r.setIngredient('S', Material.COPPER_BLOCK); } else { r.shape(" K ", "RSR", " R "); r.setIngredient('K', Material.FEATHER); r.setIngredient('R', Material.REDSTONE); - r.setIngredient('S', Material.COPPER_INGOT); + r.setIngredient('S', Material.COPPER_INGOT); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("Brush Circuit", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/ConsoleRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/ConsoleRecipe.java index 77d4be13be..e93bcd2bc0 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/ConsoleRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/ConsoleRecipe.java @@ -2,7 +2,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.console.models.ColourType; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import me.eccentric_nz.TARDIS.utility.TARDISStringUtils; import org.bukkit.Material; import org.bukkit.NamespacedKey; @@ -53,7 +53,7 @@ public void addRecipes() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, name.toLowerCase() + "_console"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("CBC", "LRL", "CBC"); r.setIngredient('C', colour.getKey()); r.setIngredient('B', Material.BAMBOO_BUTTON); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/ConversionCircuitRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/ConversionCircuitRecipe.java index 27419cdad0..de489fe035 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/ConversionCircuitRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/ConversionCircuitRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -41,20 +41,20 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "conversion_circuit"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("RDR", "PWP", "RCR"); r.setIngredient('R', Material.REDSTONE_BLOCK); r.setIngredient('D', Material.DISPENSER); r.setIngredient('W', Material.WATER_BUCKET); r.setIngredient('P', Material.PHANTOM_MEMBRANE); - r.setIngredient('C', Material.COMPARATOR); + r.setIngredient('C', Material.COMPARATOR); } else { r.shape("RDR", "LWL", "RCR"); r.setIngredient('R', Material.REDSTONE); r.setIngredient('D', Material.DISPENSER); r.setIngredient('L', Material.LEATHER); r.setIngredient('W', Material.WATER_BUCKET); - r.setIngredient('C', Material.COMPARATOR); + r.setIngredient('C', Material.COMPARATOR); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("Conversion Circuit", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/CustardCreamRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/CustardCreamRecipe.java index 4d3f70d025..4a0d391f96 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/CustardCreamRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/CustardCreamRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -35,14 +35,14 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "custard_cream"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape(" ", "WYW", " "); r.setIngredient('W', Material.WHEAT); - r.setIngredient('Y', Material.YELLOW_DYE); + r.setIngredient('Y', Material.YELLOW_DYE); } else { r.shape(" ", "WYW", " "); r.setIngredient('W', Material.WHEAT); - r.setIngredient('Y', Material.YELLOW_DYE); + r.setIngredient('Y', Material.YELLOW_DYE); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("Custard Cream", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/CyanBowTieRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/CyanBowTieRecipe.java index e99280c715..ea9e1976ae 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/CyanBowTieRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/CyanBowTieRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -41,16 +41,16 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "cyan_bow_tie"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("STS", "L L", "WWW"); r.setIngredient('S', Material.STRING); r.setIngredient('T', Material.GLOWSTONE_DUST); r.setIngredient('L', Material.LEATHER); - r.setIngredient('W', Material.CYAN_WOOL); + r.setIngredient('W', Material.CYAN_WOOL); } else { r.shape(" ", "SWS", " "); r.setIngredient('S', Material.STRING); - r.setIngredient('W', Material.CYAN_WOOL); + r.setIngredient('W', Material.CYAN_WOOL); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("Cyan Bow Tie", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/DiamondDisruptorCircuitRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/DiamondDisruptorCircuitRecipe.java index 9bddbaaac3..127b34e42a 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/DiamondDisruptorCircuitRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/DiamondDisruptorCircuitRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -37,16 +37,16 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "diamond_disruptor_circuit"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape(" O ", "DSD", " O "); r.setIngredient('O', Material.OBSIDIAN); r.setIngredient('D', Material.DIAMOND); - r.setIngredient('S', Material.SHEARS); + r.setIngredient('S', Material.SHEARS); } else { r.shape(" R ", "DSD", " R "); r.setIngredient('R', Material.REDSTONE); r.setIngredient('D', Material.DIAMOND); - r.setIngredient('S', Material.SHEARS); + r.setIngredient('S', Material.SHEARS); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("Diamond Disruptor Circuit", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/DoorCustomRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/DoorCustomRecipe.java index c41241db93..8f28c66fc9 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/DoorCustomRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/DoorCustomRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import me.eccentric_nz.TARDIS.utility.TARDISStringUtils; import org.bukkit.Material; import org.bukkit.NamespacedKey; @@ -30,8 +30,7 @@ public void addRecipes() { NamespacedKey key = new NamespacedKey(plugin, "door_" + r); ShapedRecipe recipe = new ShapedRecipe(key, is); recipe.shape("#A#", "#D#", "###"); - boolean hard = (plugin.getDifficulty().equals(Difficulty.HARD)); - recipe.setIngredient('#', (hard) ? Material.GLASS : Material.GLASS_PANE); + recipe.setIngredient('#', plugin.getCraftingDifficulty() == CraftingDifficulty.HARD ? Material.GLASS : Material.GLASS_PANE); recipe.setIngredient('A', material); recipe.setIngredient('D', Material.IRON_DOOR); plugin.getServer().addRecipe(recipe); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/EmeraldEnvironmentCircuitRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/EmeraldEnvironmentCircuitRecipe.java index 1d8ad67d2f..7e6f558d66 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/EmeraldEnvironmentCircuitRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/EmeraldEnvironmentCircuitRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -37,16 +37,16 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "emerald_environment_circuit"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape(" S ", "LEL", " S "); r.setIngredient('E', Material.EMERALD); r.setIngredient('L', Material.OAK_LEAVES); - r.setIngredient('S', Material.STONE); + r.setIngredient('S', Material.STONE); } else { r.shape(" D ", "LEL", " D "); r.setIngredient('E', Material.EMERALD); r.setIngredient('D', Material.DIRT); - r.setIngredient('L', Material.OAK_LEAVES); + r.setIngredient('L', Material.OAK_LEAVES); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("Emerald Environment Circuit", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/ExteriorLampLevelSwitchRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/ExteriorLampLevelSwitchRecipe.java index 6c86f0f215..549dc18b5f 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/ExteriorLampLevelSwitchRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/ExteriorLampLevelSwitchRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import me.eccentric_nz.TARDIS.enumeration.RecipeItem; import org.bukkit.Material; import org.bukkit.NamespacedKey; @@ -44,7 +44,7 @@ public void addRecipe() { r.setIngredient('L', Material.LEVER); r.setIngredient('B', Material.BAMBOO_BUTTON); r.setIngredient('M', Material.MANGROVE_BUTTON); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.setIngredient('C', Material.COPPER_BLOCK); } else { r.setIngredient('C', Material.COPPER_INGOT); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/FishFingerRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/FishFingerRecipe.java index 545c1d1e05..7c19711f1b 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/FishFingerRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/FishFingerRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -39,14 +39,14 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "fish_finger"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape(" B ", " F ", " B "); r.setIngredient('B', Material.BREAD); - r.setIngredient('F', Material.COD); + r.setIngredient('F', Material.COD); } else { r.shape(" B ", " F ", " B "); r.setIngredient('B', Material.BREAD); - r.setIngredient('F', Material.COD); + r.setIngredient('F', Material.COD); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("Fish Finger", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/FobWatchRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/FobWatchRecipe.java index bc91a091f2..63d52e44f2 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/FobWatchRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/FobWatchRecipe.java @@ -1,9 +1,9 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import me.eccentric_nz.TARDIS.enumeration.RecipeItem; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -56,7 +56,7 @@ public void addRecipe() { circuit = Arrays.asList("Uses left", uses); em.setLore(circuit); exact.setItemMeta(em); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape(" C ", "IWI", "R R"); r.setIngredient('C', new RecipeChoice.ExactChoice(exact)); r.setIngredient('I', Material.IRON_INGOT); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/GreenBowTieRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/GreenBowTieRecipe.java index 5cc4edff49..2af0521319 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/GreenBowTieRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/GreenBowTieRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -41,16 +41,16 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "green_bow_tie"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("STS", "L L", "WWW"); r.setIngredient('S', Material.STRING); r.setIngredient('T', Material.GLOWSTONE_DUST); r.setIngredient('L', Material.LEATHER); - r.setIngredient('W', Material.GREEN_WOOL); + r.setIngredient('W', Material.GREEN_WOOL); } else { r.shape(" ", "SWS", " "); r.setIngredient('S', Material.STRING); - r.setIngredient('W', Material.GREEN_WOOL); + r.setIngredient('W', Material.GREEN_WOOL); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("Green Bow Tie", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/GreyBowTieRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/GreyBowTieRecipe.java index 1a9e2b0d96..cb68031494 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/GreyBowTieRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/GreyBowTieRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -41,16 +41,16 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "grey_bow_tie"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("STS", "L L", "WWW"); r.setIngredient('S', Material.STRING); r.setIngredient('T', Material.GLOWSTONE_DUST); r.setIngredient('L', Material.LEATHER); - r.setIngredient('W', Material.GRAY_WOOL); + r.setIngredient('W', Material.GRAY_WOOL); } else { r.shape(" ", "SWS", " "); r.setIngredient('S', Material.STRING); - r.setIngredient('W', Material.GRAY_WOOL); + r.setIngredient('W', Material.GRAY_WOOL); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("Grey Bow Tie", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/HandlesRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/HandlesRecipe.java index 1cf2651b5a..58b1f25954 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/HandlesRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/HandlesRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -42,7 +42,7 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "handles"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("IDI", "ISI", "IRI"); r.setIngredient('I', Material.IRON_INGOT); r.setIngredient('D', Material.DIAMOND); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/IgniteCircuitRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/IgniteCircuitRecipe.java index e1278173d8..6a8acb0ad9 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/IgniteCircuitRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/IgniteCircuitRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -36,15 +36,15 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "ignite_circuit"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("LN ", "NFN", " NL"); r.setIngredient('N', Material.NETHERRACK); r.setIngredient('F', Material.FLINT_AND_STEEL); - r.setIngredient('L', Material.LAVA_BUCKET); + r.setIngredient('L', Material.LAVA_BUCKET); } else { r.shape(" N ", "NFN", " N "); r.setIngredient('N', Material.NETHERRACK); - r.setIngredient('F', Material.FLINT_AND_STEEL); + r.setIngredient('F', Material.FLINT_AND_STEEL); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("Ignite Circuit", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/InteriorLightLevelSwitchRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/InteriorLightLevelSwitchRecipe.java index 3670b3cbd6..da896f72e8 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/InteriorLightLevelSwitchRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/InteriorLightLevelSwitchRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import me.eccentric_nz.TARDIS.enumeration.RecipeItem; import org.bukkit.Material; import org.bukkit.NamespacedKey; @@ -45,7 +45,7 @@ public void addRecipe() { r.setIngredient('W', Material.WARPED_BUTTON); r.setIngredient('L', Material.LEVER); r.setIngredient('A', Material.ACACIA_BUTTON); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.setIngredient('C', Material.COPPER_BLOCK); } else { r.setIngredient('C', Material.COPPER_INGOT); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/JammyDodgerRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/JammyDodgerRecipe.java index 2c8ad6ec03..7f95f5f0ad 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/JammyDodgerRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/JammyDodgerRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -38,14 +38,14 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "jammy_dodger"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape(" ", "WRW", " "); r.setIngredient('W', Material.WHEAT); - r.setIngredient('R', Material.SWEET_BERRIES); + r.setIngredient('R', Material.SWEET_BERRIES); } else { r.shape(" ", "WRW", " "); r.setIngredient('W', Material.WHEAT); - r.setIngredient('R', Material.SWEET_BERRIES); + r.setIngredient('R', Material.SWEET_BERRIES); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("Jammy Dodger", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/KnockbackCircuitRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/KnockbackCircuitRecipe.java index af44cf3f13..bf775c3810 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/KnockbackCircuitRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/KnockbackCircuitRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.enchantments.Enchantment; @@ -40,7 +40,7 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "knockback_circuit"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape(" K ", "RSR", " R "); ItemStack book = new ItemStack(Material.ENCHANTED_BOOK, 1); EnchantmentStorageMeta pm = (EnchantmentStorageMeta) book.getItemMeta(); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/LightBlueBowTieRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/LightBlueBowTieRecipe.java index 39659182b3..ca1f6cab9b 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/LightBlueBowTieRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/LightBlueBowTieRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -41,16 +41,16 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "light_blue_bow_tie"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("STS", "L L", "WWW"); r.setIngredient('S', Material.STRING); r.setIngredient('T', Material.GLOWSTONE_DUST); r.setIngredient('L', Material.LEATHER); - r.setIngredient('W', Material.LIGHT_BLUE_WOOL); + r.setIngredient('W', Material.LIGHT_BLUE_WOOL); } else { r.shape(" ", "SWS", " "); r.setIngredient('S', Material.STRING); - r.setIngredient('W', Material.LIGHT_BLUE_WOOL); + r.setIngredient('W', Material.LIGHT_BLUE_WOOL); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("Light Blue Bow Tie", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/LightGreyBowTieRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/LightGreyBowTieRecipe.java index f5eb01aec3..597f9ad15c 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/LightGreyBowTieRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/LightGreyBowTieRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -41,16 +41,16 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "light_grey_bow_tie"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("STS", "L L", "WWW"); r.setIngredient('S', Material.STRING); r.setIngredient('T', Material.GLOWSTONE_DUST); r.setIngredient('L', Material.LEATHER); - r.setIngredient('W', Material.LIGHT_GRAY_WOOL); + r.setIngredient('W', Material.LIGHT_GRAY_WOOL); } else { r.shape(" ", "SWS", " "); r.setIngredient('S', Material.STRING); - r.setIngredient('W', Material.LIGHT_GRAY_WOOL); + r.setIngredient('W', Material.LIGHT_GRAY_WOOL); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("Light Grey Bow Tie", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/LimeBowTieRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/LimeBowTieRecipe.java index 796f740afb..1f4c4f4ac1 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/LimeBowTieRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/LimeBowTieRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -41,16 +41,16 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "lime_bow_tie"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("STS", "L L", "WWW"); r.setIngredient('S', Material.STRING); r.setIngredient('T', Material.GLOWSTONE_DUST); r.setIngredient('L', Material.LEATHER); - r.setIngredient('W', Material.LIME_WOOL); + r.setIngredient('W', Material.LIME_WOOL); } else { r.shape(" ", "SWS", " "); r.setIngredient('S', Material.STRING); - r.setIngredient('W', Material.LIME_WOOL); + r.setIngredient('W', Material.LIME_WOOL); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("Lime Bow Tie", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/MagentaBowTieRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/MagentaBowTieRecipe.java index c61c86bb2f..92341287d2 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/MagentaBowTieRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/MagentaBowTieRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -41,16 +41,16 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "magenta_bow_tie"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("STS", "L L", "WWW"); r.setIngredient('S', Material.STRING); r.setIngredient('T', Material.GLOWSTONE_DUST); r.setIngredient('L', Material.LEATHER); - r.setIngredient('W', Material.MAGENTA_WOOL); + r.setIngredient('W', Material.MAGENTA_WOOL); } else { r.shape(" ", "SWS", " "); r.setIngredient('S', Material.STRING); - r.setIngredient('W', Material.MAGENTA_WOOL); + r.setIngredient('W', Material.MAGENTA_WOOL); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("Magenta Bow Tie", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/MonitorFrameRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/MonitorFrameRecipe.java index b1e4e79f9d..42749210d4 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/MonitorFrameRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/MonitorFrameRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -41,7 +41,7 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "monitor_frame"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("BBB", "BGB", "BRB"); r.setIngredient('B', Material.BLACKSTONE); r.setIngredient('G', Material.TINTED_GLASS); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/OrangeBowTieRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/OrangeBowTieRecipe.java index 4c9b35917d..2cbb58d46e 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/OrangeBowTieRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/OrangeBowTieRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -41,16 +41,16 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "orange_bow_tie"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("STS", "L L", "WWW"); r.setIngredient('S', Material.STRING); r.setIngredient('T', Material.GLOWSTONE_DUST); r.setIngredient('L', Material.LEATHER); - r.setIngredient('W', Material.ORANGE_WOOL); + r.setIngredient('W', Material.ORANGE_WOOL); } else { r.shape(" ", "SWS", " "); r.setIngredient('S', Material.STRING); - r.setIngredient('W', Material.ORANGE_WOOL); + r.setIngredient('W', Material.ORANGE_WOOL); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("Orange Bow Tie", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/PainterCircuitRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/PainterCircuitRecipe.java index 9497449686..0802c6c8df 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/PainterCircuitRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/PainterCircuitRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -37,16 +37,16 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "painter_circuit"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape(" I ", "DGD", " I "); r.setIngredient('I', Material.BLACK_DYE); r.setIngredient('D', Material.PURPLE_DYE); - r.setIngredient('G', Material.GOLD_BLOCK); + r.setIngredient('G', Material.GOLD_BLOCK); } else { r.shape(" I ", "DGD", " I "); r.setIngredient('I', Material.BLACK_DYE); r.setIngredient('D', Material.PURPLE_DYE); - r.setIngredient('G', Material.GOLD_NUGGET); + r.setIngredient('G', Material.GOLD_NUGGET); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("Painter Circuit", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/PaperBagRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/PaperBagRecipe.java index 32e2564cc2..0d693464f0 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/PaperBagRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/PaperBagRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -41,7 +41,7 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "paper_bag"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape(" LC", "PSP", " P "); r.setIngredient('L', Material.LAPIS_BLOCK); r.setIngredient('C', Material.COMPARATOR); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/PerceptionCircuitRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/PerceptionCircuitRecipe.java index 7697c25a4a..12317c5f21 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/PerceptionCircuitRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/PerceptionCircuitRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -43,14 +43,14 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "perception_circuit"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("IGI", "CEC", "DTD"); r.setIngredient('I', Material.IRON_INGOT); r.setIngredient('G', Material.GOLDEN_CARROT); r.setIngredient('C', Material.COMPARATOR); r.setIngredient('E', Material.FERMENTED_SPIDER_EYE); r.setIngredient('D', Material.REPEATER); - r.setIngredient('T', Material.REDSTONE_TORCH); + r.setIngredient('T', Material.REDSTONE_TORCH); } else { r.shape("IGI", "CEC", "DTD"); r.setIngredient('I', Material.IRON_INGOT); @@ -58,7 +58,7 @@ public void addRecipe() { r.setIngredient('C', Material.COMPARATOR); r.setIngredient('E', Material.FERMENTED_SPIDER_EYE); r.setIngredient('D', Material.REPEATER); - r.setIngredient('T', Material.REDSTONE_TORCH); + r.setIngredient('T', Material.REDSTONE_TORCH); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("Perception Circuit", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/PerceptionFilterRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/PerceptionFilterRecipe.java index 191f2b54d7..85c64828f4 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/PerceptionFilterRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/PerceptionFilterRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import me.eccentric_nz.TARDIS.enumeration.RecipeItem; import org.bukkit.Material; import org.bukkit.NamespacedKey; @@ -41,7 +41,7 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "perception_filter"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("S S", " S ", "RGC"); r.setIngredient('S', Material.STRING); r.setIngredient('R', Material.REDSTONE); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/PickupArrowsCircuitRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/PickupArrowsCircuitRecipe.java index 74f013df29..5f5b8313ec 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/PickupArrowsCircuitRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/PickupArrowsCircuitRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -35,14 +35,14 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "pickup_arrows_circuit"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape(" S ", "SRS", " S "); r.setIngredient('S', Material.SPECTRAL_ARROW); - r.setIngredient('R', Material.REDSTONE_BLOCK); + r.setIngredient('R', Material.REDSTONE_BLOCK); } else { r.shape(" A ", "ARA", " A "); r.setIngredient('A', Material.ARROW); - r.setIngredient('R', Material.REDSTONE); + r.setIngredient('R', Material.REDSTONE); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("Pickup Arrows Circuit", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/PinkBowTieRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/PinkBowTieRecipe.java index 5b10bdfecd..a5f22756d1 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/PinkBowTieRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/PinkBowTieRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -41,16 +41,16 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "pink_bow_tie"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("STS", "L L", "WWW"); r.setIngredient('S', Material.STRING); r.setIngredient('T', Material.GLOWSTONE_DUST); r.setIngredient('L', Material.LEATHER); - r.setIngredient('W', Material.PINK_WOOL); + r.setIngredient('W', Material.PINK_WOOL); } else { r.shape(" ", "SWS", " "); r.setIngredient('S', Material.STRING); - r.setIngredient('W', Material.PINK_WOOL); + r.setIngredient('W', Material.PINK_WOOL); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("Pink Bow Tie", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/PurpleBowTieRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/PurpleBowTieRecipe.java index cbf24468e7..a9e09b7fd1 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/PurpleBowTieRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/PurpleBowTieRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -41,16 +41,16 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "purple_bow_tie"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("STS", "L L", "WWW"); r.setIngredient('S', Material.STRING); r.setIngredient('T', Material.GLOWSTONE_DUST); r.setIngredient('L', Material.LEATHER); - r.setIngredient('W', Material.PURPLE_WOOL); + r.setIngredient('W', Material.PURPLE_WOOL); } else { r.shape(" ", "SWS", " "); r.setIngredient('S', Material.STRING); - r.setIngredient('W', Material.PURPLE_WOOL); + r.setIngredient('W', Material.PURPLE_WOOL); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("Purple Bow Tie", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/RedBowTieRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/RedBowTieRecipe.java index 27b6c673d7..41811354b8 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/RedBowTieRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/RedBowTieRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -41,16 +41,16 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "red_bow_tie"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("STS", "L L", "WWW"); r.setIngredient('S', Material.STRING); r.setIngredient('T', Material.GLOWSTONE_DUST); r.setIngredient('L', Material.LEATHER); - r.setIngredient('W', Material.RED_WOOL); + r.setIngredient('W', Material.RED_WOOL); } else { r.shape(" ", "SWS", " "); r.setIngredient('S', Material.STRING); - r.setIngredient('W', Material.RED_WOOL); + r.setIngredient('W', Material.RED_WOOL); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("Red Bow Tie", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/RedstoneActivatorCircuitRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/RedstoneActivatorCircuitRecipe.java index b4fe62e125..89c375384b 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/RedstoneActivatorCircuitRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/RedstoneActivatorCircuitRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -37,16 +37,16 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "redstone_activator_circuit"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("RCR", " I ", "RCR"); r.setIngredient('R', Material.REPEATER); r.setIngredient('C', Material.COMPARATOR); - r.setIngredient('I', Material.IRON_INGOT); + r.setIngredient('I', Material.IRON_INGOT); } else { r.shape("RCR", " I ", "RCR"); r.setIngredient('R', Material.REDSTONE); r.setIngredient('C', Material.COMPARATOR); - r.setIngredient('I', Material.IRON_INGOT); + r.setIngredient('I', Material.IRON_INGOT); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("Redstone Activator Circuit", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/RiftCircuitRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/RiftCircuitRecipe.java index 0e568e9b9b..b136f319fe 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/RiftCircuitRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/RiftCircuitRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -35,14 +35,14 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "rift_circuit"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape(" D ", "DND", " D "); r.setIngredient('D', Material.DIAMOND); - r.setIngredient('N', Material.NETHER_STAR); + r.setIngredient('N', Material.NETHER_STAR); } else { r.shape(" D ", "DND", " D "); r.setIngredient('D', Material.DIAMOND); - r.setIngredient('N', Material.NETHER_STAR); + r.setIngredient('N', Material.NETHER_STAR); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("Rift Circuit", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/RiftManipulatorRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/RiftManipulatorRecipe.java index c33b8523ce..039d537cdf 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/RiftManipulatorRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/RiftManipulatorRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import me.eccentric_nz.TARDIS.enumeration.RecipeItem; import org.bukkit.Material; import org.bukkit.NamespacedKey; @@ -49,7 +49,7 @@ public void addRecipe() { aim.setDisplayName("Acid Battery"); aim.setCustomModelData(RecipeItem.ACID_BATTERY.getCustomModelData()); acid.setItemMeta(aim); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape(" A ", "ACA", "NAN"); r.setIngredient('A', new RecipeChoice.ExactChoice(acid)); r.setIngredient('C', new RecipeChoice.ExactChoice(rift)); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/RustPlagueSwordRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/RustPlagueSwordRecipe.java index 254d2eb72c..6e17a55bdd 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/RustPlagueSwordRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/RustPlagueSwordRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import me.eccentric_nz.TARDIS.enumeration.RecipeItem; import org.bukkit.Material; import org.bukkit.NamespacedKey; @@ -49,7 +49,7 @@ public void addRecipe() { em.setDisplayName("Rust Bucket"); em.setCustomModelData(RecipeItem.RUST_BUCKET.getCustomModelData()); exact.setItemMeta(em); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("RIR", "RIR", "DSD"); r.setIngredient('R', new RecipeChoice.ExactChoice(exact)); r.setIngredient('I', Material.IRON_INGOT); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/ServerAdminCircuitRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/ServerAdminCircuitRecipe.java index 33955c8c7a..4b5ca48105 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/ServerAdminCircuitRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/ServerAdminCircuitRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import me.eccentric_nz.TARDIS.enumeration.RecipeItem; import org.bukkit.Material; import org.bukkit.NamespacedKey; @@ -42,14 +42,14 @@ public void addRecipe() { em.setDisplayName("Sonic Oscillator"); em.setCustomModelData(RecipeItem.SONIC_OSCILLATOR.getCustomModelData()); exact.setItemMeta(em); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("BBB", "BOB", "BBB"); r.setIngredient('B', Material.BEDROCK); - r.setIngredient('O', new RecipeChoice.ExactChoice(exact)); + r.setIngredient('O', new RecipeChoice.ExactChoice(exact)); } else { r.shape("BBB", "BOB", "BBB"); r.setIngredient('B', Material.BEDROCK); - r.setIngredient('O', new RecipeChoice.ExactChoice(exact)); + r.setIngredient('O', new RecipeChoice.ExactChoice(exact)); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("Server Admin Circuit", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/SonicDockRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/SonicDockRecipe.java index 6a15e9352a..38e1367f64 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/SonicDockRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/SonicDockRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import me.eccentric_nz.TARDIS.enumeration.RecipeItem; import org.bukkit.Material; import org.bukkit.NamespacedKey; @@ -41,7 +41,7 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "sonic_dock"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("RGR", "GSG", "BGB"); r.setIngredient('R', Material.REDSTONE); r.setIngredient('G', Material.GOLD_INGOT); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/SonicGeneratorRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/SonicGeneratorRecipe.java index 1301202987..636f228e28 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/SonicGeneratorRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/SonicGeneratorRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -39,18 +39,18 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "sonic_generator"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape(" S ", " F ", "GRG"); r.setIngredient('G', Material.GOLD_INGOT); r.setIngredient('R', Material.REDSTONE_BLOCK); r.setIngredient('F', Material.FLOWER_POT); - r.setIngredient('S', Material.BLAZE_ROD); + r.setIngredient('S', Material.BLAZE_ROD); } else { r.shape(" S ", " F ", "GRG"); r.setIngredient('G', Material.GOLD_NUGGET); r.setIngredient('R', Material.REDSTONE); r.setIngredient('F', Material.FLOWER_POT); - r.setIngredient('S', Material.BLAZE_ROD); + r.setIngredient('S', Material.BLAZE_ROD); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("Sonic Generator", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/SonicOscillatorRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/SonicOscillatorRecipe.java index b5ca1cf40f..10f9b86a63 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/SonicOscillatorRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/SonicOscillatorRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -36,15 +36,15 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "sonic_oscillator"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("RQR", "RBR", "RQR"); r.setIngredient('Q', Material.QUARTZ); r.setIngredient('R', Material.REDSTONE); - r.setIngredient('B', Material.STONE_BUTTON); + r.setIngredient('B', Material.STONE_BUTTON); } else { r.shape("RQR", "R R", "RQR"); r.setIngredient('Q', Material.QUARTZ); - r.setIngredient('R', Material.REDSTONE); + r.setIngredient('R', Material.REDSTONE); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("Sonic Oscillator", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/SonicScrewdriverRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/SonicScrewdriverRecipe.java index d38f0f886d..862a6f3412 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/SonicScrewdriverRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/SonicScrewdriverRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import me.eccentric_nz.TARDIS.enumeration.RecipeItem; import org.bukkit.Material; import org.bukkit.NamespacedKey; @@ -65,7 +65,7 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "sonic_screwdriver"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape(" Q ", " I ", " O "); r.setIngredient('Q', Material.QUARTZ); r.setIngredient('I', Material.IRON_INGOT); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/StattenheimRemoteRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/StattenheimRemoteRecipe.java index ada3cf5960..86b9e01909 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/StattenheimRemoteRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/StattenheimRemoteRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import me.eccentric_nz.TARDIS.enumeration.RecipeItem; import org.bukkit.Material; import org.bukkit.NamespacedKey; @@ -45,7 +45,7 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "stattenheim_remote"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("OBO", "OLO", "RRR"); r.setIngredient('O', Material.OBSIDIAN); r.setIngredient('B', Material.STONE_BUTTON); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISARSCircuitRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISARSCircuitRecipe.java index 0ea9bc1c29..c4b80aab19 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISARSCircuitRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISARSCircuitRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -43,18 +43,18 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "tardis_ars_circuit"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("SSS", "DPT", "RRR"); r.setIngredient('S', Material.WHEAT_SEEDS); r.setIngredient('D', Material.REPEATER); r.setIngredient('P', Material.PISTON); r.setIngredient('T', Material.REDSTONE_TORCH); - r.setIngredient('R', Material.REDSTONE); + r.setIngredient('R', Material.REDSTONE); } else { r.shape("SSS", "T T", "RRR"); r.setIngredient('S', Material.WHEAT_SEEDS); r.setIngredient('T', Material.REDSTONE_TORCH); - r.setIngredient('R', Material.REDSTONE); + r.setIngredient('R', Material.REDSTONE); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("TARDIS ARS Circuit", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISArtronFurnaceRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISArtronFurnaceRecipe.java index 77ee3ce750..edc6cc2bb7 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISArtronFurnaceRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISArtronFurnaceRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -37,16 +37,16 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "tardis_artron_furnace"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape(" ", "OFO", "RRR"); r.setIngredient('O', Material.OBSIDIAN); r.setIngredient('F', Material.FURNACE); - r.setIngredient('R', Material.REDSTONE); + r.setIngredient('R', Material.REDSTONE); } else { r.shape(" ", "OFO", "RRR"); r.setIngredient('O', Material.OBSIDIAN); r.setIngredient('F', Material.FURNACE); - r.setIngredient('R', Material.REDSTONE); + r.setIngredient('R', Material.REDSTONE); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("TARDIS Artron Furnace", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISBiomeReaderRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISBiomeReaderRecipe.java index a695e5ed64..e890111c64 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISBiomeReaderRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISBiomeReaderRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import me.eccentric_nz.TARDIS.enumeration.RecipeItem; import org.bukkit.Material; import org.bukkit.NamespacedKey; @@ -49,7 +49,7 @@ public void addRecipe() { em.setDisplayName("Emerald Environment Circuit"); em.setCustomModelData(RecipeItem.EMERALD_ENVIRONMENT_CIRCUIT.getCustomModelData()); exact.setItemMeta(em); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape(" C ", "SDT", "LWN"); r.setIngredient('C', new RecipeChoice.ExactChoice(exact)); r.setIngredient('S', Material.SAND); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISChameleonCircuitRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISChameleonCircuitRecipe.java index dc1b590bcf..faee0a66c1 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISChameleonCircuitRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISChameleonCircuitRecipe.java @@ -1,9 +1,9 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import me.eccentric_nz.TARDIS.enumeration.RecipeItem; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -47,7 +47,7 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "tardis_chameleon_circuit"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("DGD", "GEG", "RMR"); r.setIngredient('D', Material.REPEATER); r.setIngredient('G', Material.GOLD_INGOT); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISCommunicatorRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISCommunicatorRecipe.java index ca0176114d..f4ef483f9d 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISCommunicatorRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISCommunicatorRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -38,17 +38,17 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "tardis_communicator"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("N ", "IIH", " D"); r.setIngredient('N', Material.NOTE_BLOCK); r.setIngredient('I', Material.IRON_INGOT); r.setIngredient('H', Material.HOPPER); - r.setIngredient('D', Material.DIAMOND); + r.setIngredient('D', Material.DIAMOND); } else { r.shape("N ", "IIH", " I"); r.setIngredient('N', Material.NOTE_BLOCK); r.setIngredient('I', Material.IRON_INGOT); - r.setIngredient('H', Material.HOPPER); + r.setIngredient('H', Material.HOPPER); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("TARDIS Communicator", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISInputCircuitRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISInputCircuitRecipe.java index e960173557..a1fe07c50e 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISInputCircuitRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISInputCircuitRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -39,14 +39,14 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "tardis_input_circuit"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape(" R ", " S ", " R "); r.setIngredient('R', Material.REDSTONE); - r.setIngredient('S', Material.OAK_SIGN); + r.setIngredient('S', Material.OAK_SIGN); } else { r.shape(" R ", " S ", " R "); r.setIngredient('R', Material.REDSTONE); - r.setIngredient('S', Material.OAK_SIGN); + r.setIngredient('S', Material.OAK_SIGN); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("TARDIS Input Circuit", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISInvisibilityCircuitRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISInvisibilityCircuitRecipe.java index b3b74b0aff..5f6181ecf0 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISInvisibilityCircuitRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISInvisibilityCircuitRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import me.eccentric_nz.TARDIS.enumeration.RecipeItem; import org.bukkit.Material; import org.bukkit.NamespacedKey; @@ -56,7 +56,7 @@ public void addRecipe() { PotionMeta pm = (PotionMeta) potion.getItemMeta(); pm.setBasePotionType(PotionType.INVISIBILITY); potion.setItemMeta(pm); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape(" D ", "P E", " W "); r.setIngredient('D', Material.DIAMOND); r.setIngredient('P', new RecipeChoice.ExactChoice(exact)); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISKeyRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISKeyRecipe.java index 08ceed8b77..7fcce69d4d 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISKeyRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISKeyRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -56,7 +56,7 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "tardis_key"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape(" C ", " G ", " "); r.setIngredient('C', Material.COMPARATOR); r.setIngredient('G', Material.GOLD_NUGGET); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISLocatorCircuitRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISLocatorCircuitRecipe.java index e1ee086843..cbbd0acfc8 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISLocatorCircuitRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISLocatorCircuitRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -41,20 +41,20 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "tardis_locator_circuit"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("RQR", "RIR", "DRL"); r.setIngredient('R', Material.REDSTONE); r.setIngredient('Q', Material.QUARTZ); r.setIngredient('I', Material.IRON_INGOT); r.setIngredient('D', Material.REPEATER); - r.setIngredient('L', Material.BLUE_DYE); + r.setIngredient('L', Material.BLUE_DYE); } else { r.shape("RQR", "RIR", "DRL"); r.setIngredient('R', Material.REDSTONE); r.setIngredient('Q', Material.QUARTZ); r.setIngredient('I', Material.IRON_INGOT); r.setIngredient('D', Material.REPEATER); - r.setIngredient('L', Material.BLUE_DYE); + r.setIngredient('L', Material.BLUE_DYE); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("TARDIS Locator Circuit", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISLocatorRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISLocatorRecipe.java index 849e2b5cf7..4f1339aca5 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISLocatorRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISLocatorRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import me.eccentric_nz.TARDIS.enumeration.RecipeItem; import org.bukkit.Material; import org.bukkit.NamespacedKey; @@ -39,7 +39,7 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "tardis_locator"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("OIO", "ICI", "OIO"); r.setIngredient('O', Material.OBSIDIAN); r.setIngredient('I', Material.IRON_INGOT); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISMaterialisationCircuitRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISMaterialisationCircuitRecipe.java index b6154d5a46..c03b9791ec 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISMaterialisationCircuitRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISMaterialisationCircuitRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -44,19 +44,19 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "tardis_materialisation_circuit"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("IDI", "DLD", "QRQ"); r.setIngredient('I', Material.ENDER_EYE); r.setIngredient('D', Material.REPEATER); r.setIngredient('R', Material.REDSTONE); r.setIngredient('L', Material.BLUE_DYE); - r.setIngredient('Q', Material.QUARTZ); + r.setIngredient('Q', Material.QUARTZ); } else { r.shape("IRI", " L ", "QRQ"); r.setIngredient('I', Material.IRON_INGOT); r.setIngredient('R', Material.REDSTONE); r.setIngredient('L', Material.BLUE_DYE); - r.setIngredient('Q', Material.QUARTZ); + r.setIngredient('Q', Material.QUARTZ); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("TARDIS Materialisation Circuit", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISMemoryCircuitRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISMemoryCircuitRecipe.java index 7455cad2d1..80e4e9ebad 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISMemoryCircuitRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISMemoryCircuitRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -40,15 +40,15 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "tardis_memory_circuit"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("RTR", "TCT", "RTR"); r.setIngredient('R', Material.RED_SAND); r.setIngredient('T', Material.REDSTONE_TORCH); - r.setIngredient('C', Material.TRAPPED_CHEST); + r.setIngredient('C', Material.TRAPPED_CHEST); } else { r.shape(" T ", "TCT", " T "); r.setIngredient('T', Material.REDSTONE_TORCH); - r.setIngredient('C', Material.CHEST); + r.setIngredient('C', Material.CHEST); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("TARDIS Memory Circuit", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISMonitorRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISMonitorRecipe.java index 11e17872dd..17244c599c 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISMonitorRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISMonitorRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -37,16 +37,16 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "tardis_monitor"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("MRM", "RGR", "MRM"); r.setIngredient('M', Material.MAP); r.setIngredient('G', Material.TINTED_GLASS); - r.setIngredient('R', Material.REDSTONE_BLOCK); + r.setIngredient('R', Material.REDSTONE_BLOCK); } else { r.shape("MRM", "RGR", "MRM"); r.setIngredient('M', Material.MAP); r.setIngredient('G', Material.GLASS_PANE); - r.setIngredient('R', Material.REDSTONE); + r.setIngredient('R', Material.REDSTONE); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("TARDIS Monitor", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISRandomiserCircuitRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISRandomiserCircuitRecipe.java index 21717b14ee..39feea8c92 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISRandomiserCircuitRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISRandomiserCircuitRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -45,7 +45,7 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "tardis_randomiser_circuit"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape(" D ", "NCE", " W "); r.setIngredient('D', Material.DIRT); r.setIngredient('N', Material.NETHERRACK); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISRemoteKeyRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISRemoteKeyRecipe.java index e7c9849034..4761eacf58 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISRemoteKeyRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISRemoteKeyRecipe.java @@ -1,9 +1,9 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import me.eccentric_nz.TARDIS.enumeration.RecipeItem; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -47,7 +47,7 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "tardis_remote_key"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("RCR", " K ", " T "); r.setIngredient('R', Material.REDSTONE); r.setIngredient('C', Material.COMPARATOR); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISScannerCircuitRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISScannerCircuitRecipe.java index 1e6f54fef0..7b30061c3c 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISScannerCircuitRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISScannerCircuitRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -40,7 +40,7 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "tardis_scanner_circuit"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("GRG", "RER", "GRG"); r.setIngredient('G', Material.GLASS); r.setIngredient('E', Material.SPIDER_EYE); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISStattenheimCircuitRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISStattenheimCircuitRecipe.java index 0cf97b62ae..f31db9696e 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISStattenheimCircuitRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISStattenheimCircuitRecipe.java @@ -1,9 +1,9 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import me.eccentric_nz.TARDIS.enumeration.RecipeItem; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -62,7 +62,7 @@ public void addRecipe() { lim.setDisplayName("TARDIS Locator Circuit"); lim.setCustomModelData(RecipeItem.TARDIS_LOCATOR_CIRCUIT.getCustomModelData()); locator.setItemMeta(lim); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape(" ", "LRM", "QQQ"); r.setIngredient('L', new RecipeChoice.ExactChoice(locator)); r.setIngredient('R', Material.REDSTONE); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISTelepathicCircuitRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISTelepathicCircuitRecipe.java index 5a6838686a..1b4748ca6a 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISTelepathicCircuitRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISTelepathicCircuitRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -11,8 +11,6 @@ import org.bukkit.inventory.meta.PotionMeta; import org.bukkit.potion.PotionType; -import java.util.List; - /* easy_shape:-S-,SES,-S- easy_ingredients.S:SLIME_BALL @@ -35,15 +33,14 @@ public TARDISTelepathicCircuitRecipe(TARDIS plugin) { } public void addRecipe() { - ItemStack is = new ItemStack(Material.DAYLIGHT_DETECTOR, 1); + ItemStack is = new ItemStack(Material.GLOWSTONE_DUST, 1); ItemMeta im = is.getItemMeta(); im.setDisplayName("TARDIS Telepathic Circuit"); - im.setCustomModelData(10000001); - im.setLore(List.of("Allow companions to", "use TARDIS commands")); + im.setCustomModelData(10001962); is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "tardis_telepathic_circuit"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape(" S ", "SPS", "ESE"); r.setIngredient('S', Material.SLIME_BALL); ItemStack potion = new ItemStack(Material.POTION, 1); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISTemporalCircuitRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISTemporalCircuitRecipe.java index bcee58ca62..1a9b591d09 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISTemporalCircuitRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TARDISTemporalCircuitRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -42,17 +42,17 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "tardis_temporal_circuit"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape(" I ", "RWR", "QIQ"); r.setIngredient('I', Material.IRON_INGOT); r.setIngredient('R', Material.REDSTONE); r.setIngredient('W', Material.CLOCK); - r.setIngredient('Q', Material.QUARTZ); + r.setIngredient('Q', Material.QUARTZ); } else { r.shape(" I ", "RWR", " I "); r.setIngredient('I', Material.IRON_INGOT); r.setIngredient('R', Material.REDSTONE); - r.setIngredient('W', Material.CLOCK); + r.setIngredient('W', Material.CLOCK); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("TARDIS Temporal Circuit", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/ThreeDGlassesRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/ThreeDGlassesRecipe.java index 85586a35bd..bdd05f4351 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/ThreeDGlassesRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/ThreeDGlassesRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -39,18 +39,18 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "3-d_glasses"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("R T", "P P", "CPM"); r.setIngredient('R', Material.COMPARATOR); r.setIngredient('T', Material.REDSTONE_TORCH); r.setIngredient('P', Material.PAPER); r.setIngredient('C', Material.CYAN_STAINED_GLASS_PANE); - r.setIngredient('M', Material.MAGENTA_STAINED_GLASS_PANE); + r.setIngredient('M', Material.MAGENTA_STAINED_GLASS_PANE); } else { r.shape(" ", "P P", "CPM"); r.setIngredient('P', Material.PAPER); r.setIngredient('C', Material.CYAN_STAINED_GLASS_PANE); - r.setIngredient('M', Material.MAGENTA_STAINED_GLASS_PANE); + r.setIngredient('M', Material.MAGENTA_STAINED_GLASS_PANE); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("3-D Glasses", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TimeEngineRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TimeEngineRecipe.java index ca9a3b01f5..86e2fa8e95 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TimeEngineRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TimeEngineRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -39,7 +39,7 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "time_engine"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("LRL", "GAG", "GRG"); r.setIngredient('L', Material.LIGHT_BLUE_DYE); r.setIngredient('R', Material.REDSTONE_BLOCK); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TimeRotorConsoleRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TimeRotorConsoleRecipe.java index 4fb17c27a6..11a00c79ab 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TimeRotorConsoleRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TimeRotorConsoleRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -39,18 +39,18 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "time_rotor_console"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("CRC", "GWG", "GRG"); r.setIngredient('C', Material.RED_DYE); r.setIngredient('R', Material.REDSTONE_BLOCK); r.setIngredient('W', Material.CLOCK); - r.setIngredient('G', Material.GLASS_PANE); + r.setIngredient('G', Material.GLASS_PANE); } else { r.shape("CRC", "GWG", "GRG"); r.setIngredient('C', Material.RED_DYE); r.setIngredient('R', Material.REDSTONE); r.setIngredient('W', Material.CLOCK); - r.setIngredient('G', Material.GLASS_PANE); + r.setIngredient('G', Material.GLASS_PANE); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("Time Rotor Console", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TimeRotorCustomRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TimeRotorCustomRecipe.java index 0307fad8a4..2330e8a646 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TimeRotorCustomRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TimeRotorCustomRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import me.eccentric_nz.TARDIS.utility.TARDISStringUtils; import org.bukkit.Material; import org.bukkit.NamespacedKey; @@ -44,7 +44,7 @@ public void addRecipes() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "time_rotor_" + r); ShapedRecipe recipe = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { recipe.shape("CRC", "GWG", "GRG"); recipe.setIngredient('C', material); recipe.setIngredient('R', Material.REDSTONE_BLOCK); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TimeRotorDeltaRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TimeRotorDeltaRecipe.java index 84bedc79a9..17ec19957a 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TimeRotorDeltaRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TimeRotorDeltaRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -39,18 +39,18 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "time_rotor_delta"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("CRC", "GWG", "GRG"); r.setIngredient('C', Material.PURPLE_DYE); r.setIngredient('R', Material.REDSTONE_BLOCK); r.setIngredient('W', Material.CLOCK); - r.setIngredient('G', Material.GLASS_PANE); + r.setIngredient('G', Material.GLASS_PANE); } else { r.shape("CRC", "GWG", "GRG"); r.setIngredient('C', Material.PURPLE_DYE); r.setIngredient('R', Material.REDSTONE); r.setIngredient('W', Material.CLOCK); - r.setIngredient('G', Material.GLASS_PANE); + r.setIngredient('G', Material.GLASS_PANE); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("Time Rotor Delta", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TimeRotorEarlyRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TimeRotorEarlyRecipe.java index 0f96d79a0f..6d918b7aa0 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TimeRotorEarlyRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TimeRotorEarlyRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -39,18 +39,18 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "time_rotor_early"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("CRC", "GWG", "GRG"); r.setIngredient('C', Material.GRAY_DYE); r.setIngredient('R', Material.REDSTONE_BLOCK); r.setIngredient('W', Material.CLOCK); - r.setIngredient('G', Material.GLASS_PANE); + r.setIngredient('G', Material.GLASS_PANE); } else { r.shape("CRC", "GWG", "GRG"); r.setIngredient('C', Material.GRAY_DYE); r.setIngredient('R', Material.REDSTONE); r.setIngredient('W', Material.CLOCK); - r.setIngredient('G', Material.GLASS_PANE); + r.setIngredient('G', Material.GLASS_PANE); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("Time Rotor Early", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TimeRotorEleventhRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TimeRotorEleventhRecipe.java index f1e0f3f1ef..847f77da82 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TimeRotorEleventhRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TimeRotorEleventhRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -39,18 +39,18 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "time_rotor_eleventh"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("CRC", "GWG", "GRG"); r.setIngredient('C', Material.BROWN_DYE); r.setIngredient('R', Material.REDSTONE_BLOCK); r.setIngredient('W', Material.CLOCK); - r.setIngredient('G', Material.GLASS_PANE); + r.setIngredient('G', Material.GLASS_PANE); } else { r.shape("CRC", "GWG", "GRG"); r.setIngredient('C', Material.BROWN_DYE); r.setIngredient('R', Material.REDSTONE); r.setIngredient('W', Material.CLOCK); - r.setIngredient('G', Material.GLASS_PANE); + r.setIngredient('G', Material.GLASS_PANE); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("Time Rotor Eleventh", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TimeRotorEngineRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TimeRotorEngineRecipe.java index b62da1c023..5c6b50d5a9 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TimeRotorEngineRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TimeRotorEngineRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -39,18 +39,18 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "time_rotor_engine"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("BRB", "GWG", "GRG"); r.setIngredient('B', Material.BLUE_DYE); r.setIngredient('R', Material.REDSTONE_BLOCK); r.setIngredient('W', Material.CLOCK); - r.setIngredient('G', Material.GLASS_PANE); + r.setIngredient('G', Material.GLASS_PANE); } else { r.shape("BRB", "GWG", "GRG"); r.setIngredient('B', Material.BLUE_DYE); r.setIngredient('R', Material.REDSTONE); r.setIngredient('W', Material.CLOCK); - r.setIngredient('G', Material.GLASS_PANE); + r.setIngredient('G', Material.GLASS_PANE); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("Time Rotor Engine", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TimeRotorHospitalRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TimeRotorHospitalRecipe.java index 28bb2d8762..842cfa9f03 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TimeRotorHospitalRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TimeRotorHospitalRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -39,18 +39,18 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "time_rotor_hospital"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("CRC", "GWG", "GRG"); r.setIngredient('C', Material.WHITE_DYE); r.setIngredient('R', Material.REDSTONE_BLOCK); r.setIngredient('W', Material.CLOCK); - r.setIngredient('G', Material.GLASS_PANE); + r.setIngredient('G', Material.GLASS_PANE); } else { r.shape("CRC", "GWG", "GRG"); r.setIngredient('C', Material.WHITE_DYE); r.setIngredient('R', Material.REDSTONE); r.setIngredient('W', Material.CLOCK); - r.setIngredient('G', Material.GLASS_PANE); + r.setIngredient('G', Material.GLASS_PANE); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("Time Rotor Hospital", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TimeRotorTenthRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TimeRotorTenthRecipe.java index e15c15bd40..297edd4121 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TimeRotorTenthRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TimeRotorTenthRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -39,18 +39,18 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "time_rotor_tenth"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("CRC", "GWG", "GRG"); r.setIngredient('C', Material.CYAN_DYE); r.setIngredient('R', Material.REDSTONE_BLOCK); r.setIngredient('W', Material.CLOCK); - r.setIngredient('G', Material.GLASS_PANE); + r.setIngredient('G', Material.GLASS_PANE); } else { r.shape("CRC", "GWG", "GRG"); r.setIngredient('C', Material.CYAN_DYE); r.setIngredient('R', Material.REDSTONE); r.setIngredient('W', Material.CLOCK); - r.setIngredient('G', Material.GLASS_PANE); + r.setIngredient('G', Material.GLASS_PANE); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("Time Rotor Tenth", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TimeRotorTwelfthRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TimeRotorTwelfthRecipe.java index 38b091d2cc..893d3bd18b 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TimeRotorTwelfthRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TimeRotorTwelfthRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -39,7 +39,7 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "time_rotor_twelfth"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("CRC", "GWG", "GRG"); r.setIngredient('C', Material.ORANGE_DYE); r.setIngredient('R', Material.REDSTONE_BLOCK); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/WhiteBowTieRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/WhiteBowTieRecipe.java index 24458e06df..02c5088745 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/WhiteBowTieRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/WhiteBowTieRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -41,16 +41,16 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "white_bow_tie"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("STS", "L L", "WWW"); r.setIngredient('S', Material.STRING); r.setIngredient('T', Material.GLOWSTONE_DUST); r.setIngredient('L', Material.LEATHER); - r.setIngredient('W', Material.WHITE_WOOL); + r.setIngredient('W', Material.WHITE_WOOL); } else { r.shape(" ", "SWS", " "); r.setIngredient('S', Material.STRING); - r.setIngredient('W', Material.WHITE_WOOL); + r.setIngredient('W', Material.WHITE_WOOL); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("White Bow Tie", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/YellowBowTieRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/YellowBowTieRecipe.java index 993ec889d4..8e9ce4f8c9 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/YellowBowTieRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/YellowBowTieRecipe.java @@ -1,7 +1,7 @@ package me.eccentric_nz.TARDIS.recipes.shaped; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; @@ -41,16 +41,16 @@ public void addRecipe() { is.setItemMeta(im); NamespacedKey key = new NamespacedKey(plugin, "yellow_bow_tie"); ShapedRecipe r = new ShapedRecipe(key, is); - if (plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { r.shape("STS", "L L", "WWW"); r.setIngredient('S', Material.STRING); r.setIngredient('T', Material.GLOWSTONE_DUST); r.setIngredient('L', Material.LEATHER); - r.setIngredient('W', Material.YELLOW_WOOL); + r.setIngredient('W', Material.YELLOW_WOOL); } else { r.shape(" ", "SWS", " "); r.setIngredient('S', Material.STRING); - r.setIngredient('W', Material.YELLOW_WOOL); + r.setIngredient('W', Material.YELLOW_WOOL); } plugin.getServer().addRecipe(r); plugin.getFigura().getShapedRecipes().put("Yellow Bow Tie", r); diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shapeless/PlayerStorageDiskRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shapeless/PlayerStorageDiskRecipe.java index 2bb091faa1..feae120f34 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shapeless/PlayerStorageDiskRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shapeless/PlayerStorageDiskRecipe.java @@ -1,14 +1,12 @@ package me.eccentric_nz.TARDIS.recipes.shapeless; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ShapelessRecipe; import org.bukkit.inventory.meta.ItemMeta; -import java.util.Arrays; import java.util.List; /* diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shapeless/PresetStorageDiskRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shapeless/PresetStorageDiskRecipe.java index f8bbdc62fd..1c1fbb1413 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shapeless/PresetStorageDiskRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shapeless/PresetStorageDiskRecipe.java @@ -2,7 +2,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.enumeration.RecipeItem; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shapeless/SaveStorageDiskRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shapeless/SaveStorageDiskRecipe.java index 3c1d5feaaf..7c9121610e 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shapeless/SaveStorageDiskRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shapeless/SaveStorageDiskRecipe.java @@ -1,14 +1,12 @@ package me.eccentric_nz.TARDIS.recipes.shapeless; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ShapelessRecipe; import org.bukkit.inventory.meta.ItemMeta; -import java.util.Arrays; import java.util.List; /* diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shapeless/VodkaJellyBabyRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shapeless/VodkaJellyBabyRecipe.java index 0ecc4b126d..7e4ee1062c 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shapeless/VodkaJellyBabyRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shapeless/VodkaJellyBabyRecipe.java @@ -1,15 +1,12 @@ package me.eccentric_nz.TARDIS.recipes.shapeless; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ShapelessRecipe; import org.bukkit.inventory.meta.ItemMeta; -import java.util.Arrays; - /* recipe:SUGAR,SLIME_BALL,LIGHT_GRAY_DYE result:MELON_SLICE diff --git a/src/main/java/me/eccentric_nz/TARDIS/recipes/shapeless/WatermelonJellyBabyRecipe.java b/src/main/java/me/eccentric_nz/TARDIS/recipes/shapeless/WatermelonJellyBabyRecipe.java index 4e11461c97..04f6597f02 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/recipes/shapeless/WatermelonJellyBabyRecipe.java +++ b/src/main/java/me/eccentric_nz/TARDIS/recipes/shapeless/WatermelonJellyBabyRecipe.java @@ -1,15 +1,12 @@ package me.eccentric_nz.TARDIS.recipes.shapeless; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ShapelessRecipe; import org.bukkit.inventory.meta.ItemMeta; -import java.util.Arrays; - /* recipe:SUGAR,SLIME_BALL,MAGENTA_DYE result:MELON_SLICE diff --git a/src/main/java/me/eccentric_nz/TARDIS/rooms/RoomRequiredLister.java b/src/main/java/me/eccentric_nz/TARDIS/rooms/RoomRequiredLister.java index 9b2f1e9b14..60317fc0a0 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/rooms/RoomRequiredLister.java +++ b/src/main/java/me/eccentric_nz/TARDIS/rooms/RoomRequiredLister.java @@ -16,8 +16,6 @@ */ package me.eccentric_nz.TARDIS.rooms; -import java.util.HashMap; -import java.util.Map; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.database.resultset.ResultSetCondenser; import me.eccentric_nz.TARDIS.database.resultset.ResultSetPlayerPrefs; @@ -25,6 +23,9 @@ import me.eccentric_nz.TARDIS.enumeration.TardisModule; import org.bukkit.entity.Player; +import java.util.HashMap; +import java.util.Map; + public class RoomRequiredLister { public static void listCondensables(TARDIS plugin, String name, Player player) { @@ -62,7 +63,7 @@ public static void listCondensables(TARDIS plugin, String name, Player player) { for (Map.Entry map : item_counts.entrySet()) { // get the amount of this block that the player has condensed HashMap wherec = new HashMap<>(); - wherec.put("tardis_id", rs.getTardis_id()); + wherec.put("tardis_id", rs.getTardisId()); wherec.put("block_data", map.getKey()); ResultSetCondenser rsc = new ResultSetCondenser(plugin, wherec); int has = (rsc.resultSet()) ? rsc.getBlock_count() : 0; diff --git a/src/main/java/me/eccentric_nz/TARDIS/rooms/TARDISJettisonSeeder.java b/src/main/java/me/eccentric_nz/TARDIS/rooms/TARDISJettisonSeeder.java index d8d859e46e..89b5d2267e 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/rooms/TARDISJettisonSeeder.java +++ b/src/main/java/me/eccentric_nz/TARDIS/rooms/TARDISJettisonSeeder.java @@ -99,7 +99,7 @@ public void onRoomSeedBlockInteract(PlayerInteractEvent event) { // get the TARDIS id ResultSetTardisID rs = new ResultSetTardisID(plugin); if (rs.fromUUID(player.getUniqueId().toString())) { - int id = rs.getTardis_id(); + int id = rs.getTardisId(); TARDISRoomRemover remover = new TARDISRoomRemover(plugin, room, l, d, id); if (remover.remove()) { plugin.getTrackerKeeper().getJettison().remove(uuid); diff --git a/src/main/java/me/eccentric_nz/TARDIS/rooms/TARDISRoomBuilder.java b/src/main/java/me/eccentric_nz/TARDIS/rooms/TARDISRoomBuilder.java index d036176c6c..83322982c5 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/rooms/TARDISRoomBuilder.java +++ b/src/main/java/me/eccentric_nz/TARDIS/rooms/TARDISRoomBuilder.java @@ -17,12 +17,14 @@ package me.eccentric_nz.TARDIS.rooms; import com.google.gson.JsonObject; -import java.util.Locale; import me.eccentric_nz.TARDIS.TARDIS; +import me.eccentric_nz.TARDIS.advanced.TARDISCircuitChecker; +import me.eccentric_nz.TARDIS.advanced.TARDISCircuitDamager; import me.eccentric_nz.TARDIS.api.event.TARDISRoomGrowEvent; import me.eccentric_nz.TARDIS.database.resultset.ResultSetPlayerPrefs; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardisID; import me.eccentric_nz.TARDIS.enumeration.COMPASS; +import me.eccentric_nz.TARDIS.enumeration.DiskCircuit; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.schematic.TARDISSchematicGZip; import org.bukkit.Location; @@ -30,6 +32,8 @@ import org.bukkit.block.Block; import org.bukkit.entity.Player; +import java.util.Locale; + /** * There were at least fourteen bathrooms in the TARDIS, one of which had had a * leaky tap for three centuries. Because he had misplaced his washers, the @@ -68,7 +72,7 @@ public boolean build() { if (rs.fromUUID(p.getUniqueId().toString())) { ResultSetPlayerPrefs rsp = new ResultSetPlayerPrefs(plugin, p.getUniqueId().toString()); TARDISRoomData roomData = new TARDISRoomData(); - roomData.setTardis_id(rs.getTardis_id()); + roomData.setTardis_id(rs.getTardisId()); // get wall data, default to orange wool if not set Material wall_type, floor_type; if (rsp.resultSet()) { @@ -117,6 +121,15 @@ public boolean build() { runnable.setTask(taskID); plugin.getTrackerKeeper().getRoomTasks().put(taskID, roomData); plugin.getMessenger().send(p, TardisModule.TARDIS, "ROOM_CANCEL", String.format("%d", taskID)); + // damage the ARS circuit if configured + if (plugin.getConfig().getBoolean("circuits.damage") && plugin.getConfig().getInt("circuits.uses.ars") > 0) { + // get the id of the TARDIS this player is in + TARDISCircuitChecker tcc = new TARDISCircuitChecker(plugin, rs.getTardisId()); + tcc.getCircuits(); + // decrement uses + int uses_left = tcc.getArsUses(); + new TARDISCircuitDamager(plugin, DiskCircuit.ARS, uses_left, rs.getTardisId(), p).damage(); + } } return true; } diff --git a/src/main/java/me/eccentric_nz/TARDIS/schematic/ResultSetArchiveButtons.java b/src/main/java/me/eccentric_nz/TARDIS/schematic/ResultSetArchiveButtons.java index f4426ef912..68ad8f310a 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/schematic/ResultSetArchiveButtons.java +++ b/src/main/java/me/eccentric_nz/TARDIS/schematic/ResultSetArchiveButtons.java @@ -27,7 +27,7 @@ import java.util.regex.Pattern; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.database.TARDISDatabaseConnection; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; diff --git a/src/main/java/me/eccentric_nz/TARDIS/sonic/TARDISSonicActivatorInventory.java b/src/main/java/me/eccentric_nz/TARDIS/sonic/TARDISSonicActivatorInventory.java index 953e62554a..e82da5acb8 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/sonic/TARDISSonicActivatorInventory.java +++ b/src/main/java/me/eccentric_nz/TARDIS/sonic/TARDISSonicActivatorInventory.java @@ -18,7 +18,8 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.custommodeldata.GUISonicActivator; -import net.md_5.bungee.api.ChatColor; +import me.eccentric_nz.TARDIS.enumeration.CraftingDifficulty; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; @@ -51,7 +52,7 @@ private ItemStack[] getItemStack() { lore.add("add 1 of each of the following"); lore.add("items to this inventory:"); // get the Sonic Generator recipe - if (plugin.getConfig().getString("preferences.difficulty").equalsIgnoreCase("hard")) { + if (plugin.getCraftingDifficulty() == CraftingDifficulty.HARD) { lore.add(ChatColor.AQUA + "GOLD_INGOT"); lore.add(ChatColor.AQUA + "REDSTONE_BLOCK"); } else { diff --git a/src/main/java/me/eccentric_nz/TARDIS/sonic/TARDISSonicActivatorListener.java b/src/main/java/me/eccentric_nz/TARDIS/sonic/TARDISSonicActivatorListener.java index c071e94528..5e8fdfcc76 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/sonic/TARDISSonicActivatorListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/sonic/TARDISSonicActivatorListener.java @@ -20,7 +20,7 @@ import me.eccentric_nz.TARDIS.database.resultset.ResultSetSonic; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.World; diff --git a/src/main/java/me/eccentric_nz/TARDIS/sonic/TARDISSonicConfiguratorMenuListener.java b/src/main/java/me/eccentric_nz/TARDIS/sonic/TARDISSonicConfiguratorMenuListener.java index d8b65d0777..5678e064e7 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/sonic/TARDISSonicConfiguratorMenuListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/sonic/TARDISSonicConfiguratorMenuListener.java @@ -22,7 +22,7 @@ import me.eccentric_nz.TARDIS.enumeration.SonicConfig; import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; import me.eccentric_nz.TARDIS.utility.TARDISStaticUtils; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/src/main/java/me/eccentric_nz/TARDIS/sonic/TARDISSonicDock.java b/src/main/java/me/eccentric_nz/TARDIS/sonic/TARDISSonicDock.java index af34d656e1..83d95db01d 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/sonic/TARDISSonicDock.java +++ b/src/main/java/me/eccentric_nz/TARDIS/sonic/TARDISSonicDock.java @@ -3,12 +3,14 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.TARDISConstants; import me.eccentric_nz.TARDIS.advanced.TARDISCircuitChecker; +import me.eccentric_nz.TARDIS.advanced.TARDISCircuitDamager; import me.eccentric_nz.TARDIS.api.Parameters; import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; import me.eccentric_nz.TARDIS.builders.TARDISSculkShrieker; import me.eccentric_nz.TARDIS.console.interaction.SonicConsoleRecharge; import me.eccentric_nz.TARDIS.customblocks.TARDISDisplayItemUtils; import me.eccentric_nz.TARDIS.database.data.Tardis; +import me.eccentric_nz.TARDIS.database.data.Throticle; import me.eccentric_nz.TARDIS.database.resultset.*; import me.eccentric_nz.TARDIS.enumeration.*; import me.eccentric_nz.TARDIS.flight.TARDISTakeoff; @@ -52,7 +54,7 @@ public void dock(int id, Interaction interaction, Player player, ItemStack sonic ItemDisplay display = doDocking(sonic, interaction.getLocation(), new Vector(0, 0.75d, 0.1d), player, id); display.setRotation(0.0f, 15.0f); // start charging - if (plugin.getConfig().getBoolean("sonic.charge") || plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getConfig().getBoolean("sonic.charge")) { long delay = plugin.getConfig().getLong("sonic.charge_level") / plugin.getConfig().getLong("sonic.charge_interval"); SonicConsoleRecharge recharge = new SonicConsoleRecharge(plugin, display.getUniqueId(), interaction, id, player); int task = plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, recharge, 1L, delay); @@ -70,7 +72,7 @@ public void dock(int id, ItemFrame frame, Player player, ItemStack sonic) { // change the dock model updateModel(frame, 1001, false); // start charging - if (plugin.getConfig().getBoolean("sonic.charge") || plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getConfig().getBoolean("sonic.charge")) { long delay = plugin.getConfig().getLong("sonic.charge_level") / plugin.getConfig().getLong("sonic.charge_interval"); SonicRecharge recharge = new SonicRecharge(plugin, display.getUniqueId(), frame, id, player); int task = plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, recharge, 1L, delay); @@ -143,15 +145,18 @@ private ItemDisplay doDocking(ItemStack sonic, Location location, Vector vector, plugin.getMessenger().send(player, TardisModule.TARDIS, "POWER_DOWN"); return display; } - TARDISCircuitChecker tcc = null; - if (!plugin.getDifficulty().equals(Difficulty.EASY) && !plugin.getUtils().inGracePeriod(player, true)) { - tcc = new TARDISCircuitChecker(plugin, id); - tcc.getCircuits(); - } - if (tcc != null && !tcc.hasMaterialisation()) { + TARDISCircuitChecker tcc = new TARDISCircuitChecker(plugin, id); + tcc.getCircuits(); + if (plugin.getConfig().getBoolean("difficulty.circuits") && !plugin.getUtils().inGracePeriod(player, true) && !tcc.hasMaterialisation()) { plugin.getMessenger().send(player, TardisModule.TARDIS, "NO_MAT_CIRCUIT"); return display; } + // damage circuit if configured + if (plugin.getConfig().getBoolean("circuits.damage") && plugin.getConfig().getInt("circuits.uses.materialisation") > 0) { + // decrement uses + int uses_left = tcc.getMaterialisationUses(); + new TARDISCircuitDamager(plugin, DiskCircuit.MATERIALISATION, uses_left, id, player).damage(); + } COMPASS player_direction = COMPASS.valueOf(TARDISStaticUtils.getPlayersDirection(player, false)); int[] start_loc = TARDISTimeTravel.getStartLocation(dest, player_direction); int count = TARDISTimeTravel.safeLocation(start_loc[0], dest.getBlockY(), start_loc[2], start_loc[1], start_loc[3], dest.getWorld(), player_direction); @@ -166,8 +171,8 @@ private ItemDisplay doDocking(ItemStack sonic, Location location, Vector vector, plugin.getMessenger().send(player, TardisModule.TARDIS, "WOULD_GRIEF_BLOCKS"); return display; } - SpaceTimeThrottle spaceTimeThrottle = new ResultSetThrottle(plugin).getSpeed(player.getUniqueId().toString()); - int ch = Math.round(plugin.getArtronConfig().getInt("comehere") * spaceTimeThrottle.getArtronMultiplier()); + Throticle throticle = new ResultSetThrottle(plugin).getSpeedAndParticles(player.getUniqueId().toString()); + int ch = Math.round(plugin.getArtronConfig().getInt("comehere") * throticle.getThrottle().getArtronMultiplier()); if (tardis.getArtronLevel() < ch) { plugin.getMessenger().send(player, TardisModule.TARDIS, "NOT_ENOUGH_ENERGY"); return display; @@ -209,7 +214,7 @@ private ItemDisplay doDocking(ItemStack sonic, Location location, Vector vector, if (rsp.resultSet()) { Location handbrake_loc = TARDISStaticLocationGetters.getLocationFromBukkitString(rsh.getLocation()); // take off - new TARDISTakeoff(plugin).run(id, handbrake_loc.getBlock(), handbrake_loc, player, rsp.isBeaconOn(), tardis.getBeacon(), rsp.isTravelbarOn(), spaceTimeThrottle); + new TARDISTakeoff(plugin).run(id, handbrake_loc.getBlock(), handbrake_loc, player, rsp.isBeaconOn(), tardis.getBeacon(), rsp.isTravelbarOn(), throticle); // start time rotor? if (tardis.getRotor() != null) { if (tardis.getRotor() == TARDISConstants.UUID_ZERO) { diff --git a/src/main/java/me/eccentric_nz/TARDIS/sonic/TARDISSonicEntityListener.java b/src/main/java/me/eccentric_nz/TARDIS/sonic/TARDISSonicEntityListener.java index 40dc394fc8..8032716e41 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/sonic/TARDISSonicEntityListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/sonic/TARDISSonicEntityListener.java @@ -21,7 +21,7 @@ import me.eccentric_nz.TARDIS.database.resultset.ResultSetControls; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.sonic.actions.TARDISSonicSound; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.attribute.Attribute; import org.bukkit.entity.Entity; diff --git a/src/main/java/me/eccentric_nz/TARDIS/sonic/TARDISSonicGeneratorListener.java b/src/main/java/me/eccentric_nz/TARDIS/sonic/TARDISSonicGeneratorListener.java index 068ec8974c..ff7c33cc9c 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/sonic/TARDISSonicGeneratorListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/sonic/TARDISSonicGeneratorListener.java @@ -26,7 +26,7 @@ import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardisArtron; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTravellers; import me.eccentric_nz.TARDIS.enumeration.TardisModule; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; diff --git a/src/main/java/me/eccentric_nz/TARDIS/sonic/TARDISSonicListener.java b/src/main/java/me/eccentric_nz/TARDIS/sonic/TARDISSonicListener.java index 11c6c36258..afd8d4c875 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/sonic/TARDISSonicListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/sonic/TARDISSonicListener.java @@ -19,11 +19,10 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; import me.eccentric_nz.TARDIS.commands.preferences.TARDISPrefsMenuInventory; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.sonic.actions.*; import me.eccentric_nz.TARDIS.utility.TARDISMaterials; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Tag; @@ -104,7 +103,7 @@ public void onInteract(PlayerInteractEvent event) { ItemMeta im = is.getItemMeta(); if (im.getDisplayName().endsWith("Sonic Screwdriver")) { // check they have charge - if (plugin.getConfig().getBoolean("sonic.charge") || plugin.getDifficulty() == Difficulty.HARD) { + if (plugin.getConfig().getBoolean("sonic.charge")) { // get sonic UUID PersistentDataContainer pdc = im.getPersistentDataContainer(); int needs = plugin.getConfig().getInt("sonic.usage"); diff --git a/src/main/java/me/eccentric_nz/TARDIS/sonic/TARDISSonicMenuListener.java b/src/main/java/me/eccentric_nz/TARDIS/sonic/TARDISSonicMenuListener.java index 93ce6fc0f3..4900f7da52 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/sonic/TARDISSonicMenuListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/sonic/TARDISSonicMenuListener.java @@ -20,7 +20,7 @@ import me.eccentric_nz.TARDIS.commands.preferences.TARDISKeyMenuListener; import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; import me.eccentric_nz.TARDIS.utility.TARDISStaticUtils; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/src/main/java/me/eccentric_nz/TARDIS/sonic/actions/TARDISSonicAtmospheric.java b/src/main/java/me/eccentric_nz/TARDIS/sonic/actions/TARDISSonicAtmospheric.java index 50e002e04e..296be42e5c 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/sonic/actions/TARDISSonicAtmospheric.java +++ b/src/main/java/me/eccentric_nz/TARDIS/sonic/actions/TARDISSonicAtmospheric.java @@ -20,7 +20,7 @@ import me.eccentric_nz.TARDIS.control.TARDISAtmosphericExcitation; import me.eccentric_nz.TARDIS.database.resultset.ResultSetCurrentLocation; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardisID; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; @@ -45,7 +45,7 @@ public static void makeItSnow(TARDIS plugin, Player player, Block b) { // get TARDIS id ResultSetTardisID rs = new ResultSetTardisID(plugin); if (rs.fromUUID(player.getUniqueId().toString())) { - int tid = rs.getTardis_id(); + int tid = rs.getTardisId(); Block blockbehind = null; Directional directional = (Directional) b.getBlockData(); if (directional.getFacing().equals(BlockFace.WEST)) { diff --git a/src/main/java/me/eccentric_nz/TARDIS/sonic/actions/TARDISSonicDispersed.java b/src/main/java/me/eccentric_nz/TARDIS/sonic/actions/TARDISSonicDispersed.java index c5160dd444..195a891c31 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/sonic/actions/TARDISSonicDispersed.java +++ b/src/main/java/me/eccentric_nz/TARDIS/sonic/actions/TARDISSonicDispersed.java @@ -16,12 +16,13 @@ */ package me.eccentric_nz.TARDIS.sonic.actions; -import java.util.UUID; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardisID; import org.bukkit.Location; import org.bukkit.entity.Player; +import java.util.UUID; + public class TARDISSonicDispersed { public static void assemble(TARDIS plugin, Player player) { @@ -36,7 +37,7 @@ public static void assemble(TARDIS plugin, Player player) { if (rs.fromUUID(uuid.toString())) { // rebuild plugin.getTrackerKeeper().getDispersed().remove(uuid); - plugin.getTrackerKeeper().getDispersedTARDII().remove(rs.getTardis_id()); + plugin.getTrackerKeeper().getDispersedTARDII().remove(rs.getTardisId()); player.performCommand("tardis rebuild"); } } diff --git a/src/main/java/me/eccentric_nz/TARDIS/sonic/actions/TARDISSonicFreeze.java b/src/main/java/me/eccentric_nz/TARDIS/sonic/actions/TARDISSonicFreeze.java index 3556a62f9a..ef63f61f0a 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/sonic/actions/TARDISSonicFreeze.java +++ b/src/main/java/me/eccentric_nz/TARDIS/sonic/actions/TARDISSonicFreeze.java @@ -18,9 +18,9 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.enumeration.TardisModule; -import me.eccentric_nz.TARDIS.utility.TARDISVector3D; import org.bukkit.Location; import org.bukkit.entity.Player; +import org.bukkit.util.Vector; import java.util.UUID; @@ -28,16 +28,16 @@ public class TARDISSonicFreeze { public static Player getTargetPlayer(Player player) { Location observerPos = player.getEyeLocation(); - TARDISVector3D observerDir = new TARDISVector3D(observerPos.getDirection()); - TARDISVector3D observerStart = new TARDISVector3D(observerPos); - TARDISVector3D observerEnd = observerStart.add(observerDir.multiply(16)); + Vector observerDir = observerPos.getDirection(); + Vector observerStart = observerPos.toVector(); + Vector observerEnd = observerStart.add(observerDir.multiply(16)); Player hit = null; // Get nearby players for (Player target : player.getWorld().getPlayers()) { // Bounding box of the given player - TARDISVector3D targetPos = new TARDISVector3D(target.getLocation()); - TARDISVector3D minimum = targetPos.add(-0.5, 0, -0.5); - TARDISVector3D maximum = targetPos.add(0.5, 1.67, 0.5); + Vector targetPos = target.getLocation().toVector(); + Vector minimum = targetPos.add(new Vector(-0.5, 0, -0.5)); + Vector maximum = targetPos.add(new Vector(0.5, 1.67, 0.5)); if (target != player && hasIntersection(observerStart, observerEnd, minimum, maximum)) { if (hit == null || hit.getLocation().distanceSquared(observerPos) > target.getLocation().distanceSquared(observerPos)) { hit = target; @@ -61,27 +61,31 @@ public static void immobilise(TARDIS plugin, Player player, Player target) { } } - static boolean hasIntersection(TARDISVector3D p1, TARDISVector3D p2, TARDISVector3D min, TARDISVector3D max) { + public static boolean hasIntersection(Vector p1, Vector p2, Vector min, Vector max) { double epsilon = 0.0001f; - TARDISVector3D d = p2.subtract(p1).multiply(0.5); - TARDISVector3D e = max.subtract(min).multiply(0.5); - TARDISVector3D c = p1.add(d).subtract(min.add(max).multiply(0.5)); - TARDISVector3D ad = d.abs(); - if (Math.abs(c.x) > e.x + ad.x) { + Vector d = p2.subtract(p1).multiply(0.5); + Vector e = max.subtract(min).multiply(0.5); + Vector c = p1.add(d).subtract(min.add(max).multiply(0.5)); + Vector ad = abs(d); + if (Math.abs(c.getX()) > e.getX() + ad.getX()) { return false; } - if (Math.abs(c.y) > e.y + ad.y) { + if (Math.abs(c.getY()) > e.getY() + ad.getY()) { return false; } - if (Math.abs(c.z) > e.z + ad.z) { + if (Math.abs(c.getZ()) > e.getZ() + ad.getZ()) { return false; } - if (Math.abs(d.y * c.z - d.z * c.y) > e.y * ad.z + e.z * ad.y + epsilon) { + if (Math.abs(d.getY() * c.getZ() - d.getZ() * c.getY()) > e.getY() * ad.getZ() + e.getZ() * ad.getY() + epsilon) { return false; } - if (Math.abs(d.z * c.x - d.x * c.z) > e.z * ad.x + e.x * ad.z + epsilon) { + if (Math.abs(d.getZ() * c.getX() - d.getX() * c.getZ()) > e.getZ() * ad.getX() + e.getX() * ad.getZ() + epsilon) { return false; } - return Math.abs(d.x * c.y - d.y * c.x) <= e.x * ad.y + e.y * ad.x + epsilon; + return Math.abs(d.getX() * c.getY() - d.getY() * c.getX()) <= e.getX() * ad.getY() + e.getY() * ad.getX() + epsilon; + } + + private static Vector abs(Vector v) { + return new Vector(Math.abs(v.getX()), Math.abs(v.getY()), Math.abs(v.getZ())); } } diff --git a/src/main/java/me/eccentric_nz/TARDIS/sonic/actions/TARDISSonicKnockback.java b/src/main/java/me/eccentric_nz/TARDIS/sonic/actions/TARDISSonicKnockback.java index 6b3dfc0872..dd8e8ea6d8 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/sonic/actions/TARDISSonicKnockback.java +++ b/src/main/java/me/eccentric_nz/TARDIS/sonic/actions/TARDISSonicKnockback.java @@ -17,11 +17,11 @@ package me.eccentric_nz.TARDIS.sonic.actions; import me.eccentric_nz.TARDIS.forcefield.TARDISForceField; -import me.eccentric_nz.TARDIS.utility.TARDISVector3D; import org.bukkit.Location; import org.bukkit.entity.Entity; import org.bukkit.entity.Monster; import org.bukkit.entity.Player; +import org.bukkit.util.Vector; /** * @author eccentric_nz @@ -30,18 +30,18 @@ public class TARDISSonicKnockback { public static Entity getTargetEntity(Player player) { Location observerPos = player.getEyeLocation(); - TARDISVector3D observerDir = new TARDISVector3D(observerPos.getDirection()); - TARDISVector3D observerStart = new TARDISVector3D(observerPos); - TARDISVector3D observerEnd = observerStart.add(observerDir.multiply(16)); + Vector observerDir = observerPos.getDirection(); + Vector observerStart = observerPos.toVector(); + Vector observerEnd = observerStart.add(observerDir.multiply(16)); Entity hit = null; // Get nearby players for (Entity target : player.getWorld().getNearbyEntities(observerPos, 8.0d, 8.0d, 8.0d)) { // only monsters if (target instanceof Monster) { // Bounding box of the given player - TARDISVector3D targetPos = new TARDISVector3D(target.getLocation()); - TARDISVector3D minimum = targetPos.add(-0.5, 0, -0.5); - TARDISVector3D maximum = targetPos.add(0.5, 1.67, 0.5); + Vector targetPos = target.getLocation().toVector(); + Vector minimum = targetPos.add(new Vector(-0.5, 0, -0.5)); + Vector maximum = targetPos.add(new Vector(0.5, 1.67, 0.5)); if (target != player && TARDISSonicFreeze.hasIntersection(observerStart, observerEnd, minimum, maximum)) { if (hit == null || hit.getLocation().distanceSquared(observerPos) > target.getLocation().distanceSquared(observerPos)) { hit = target; diff --git a/src/main/java/me/eccentric_nz/TARDIS/transmat/TARDISTransmatGUIListener.java b/src/main/java/me/eccentric_nz/TARDIS/transmat/TARDISTransmatGUIListener.java index b070c6e1f7..4eb5627f84 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/transmat/TARDISTransmatGUIListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/transmat/TARDISTransmatGUIListener.java @@ -21,7 +21,7 @@ import me.eccentric_nz.TARDIS.database.resultset.ResultSetTravellers; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Sound; import org.bukkit.entity.Player; diff --git a/src/main/java/me/eccentric_nz/TARDIS/travel/ComehereAction.java b/src/main/java/me/eccentric_nz/TARDIS/travel/ComehereAction.java index cb2652b128..5f8aa118ec 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/travel/ComehereAction.java +++ b/src/main/java/me/eccentric_nz/TARDIS/travel/ComehereAction.java @@ -16,15 +16,16 @@ */ package me.eccentric_nz.TARDIS.travel; -import java.util.HashMap; import me.eccentric_nz.TARDIS.TARDIS; +import me.eccentric_nz.TARDIS.database.data.Throticle; import me.eccentric_nz.TARDIS.database.resultset.ResultSetThrottle; -import me.eccentric_nz.TARDIS.enumeration.SpaceTimeThrottle; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.enumeration.TravelType; import org.bukkit.World; import org.bukkit.entity.Player; +import java.util.HashMap; + public class ComehereAction { private final TARDIS plugin; @@ -38,9 +39,9 @@ public void doTravel(ComehereRequest request) { Player acceptor = plugin.getServer().getPlayer(request.getAccepter()); Player requester = plugin.getServer().getPlayer(request.getRequester()); boolean hidden = request.isHidden(); - // get space time throttle - SpaceTimeThrottle spaceTimeThrottle = new ResultSetThrottle(plugin).getSpeed(request.getAccepter().toString()); - int ch = Math.round(plugin.getArtronConfig().getInt("comehere") * spaceTimeThrottle.getArtronMultiplier()); + // get space-time throttle + Throticle throticle = new ResultSetThrottle(plugin).getSpeedAndParticles(request.getAccepter().toString()); + int ch = Math.round(plugin.getArtronConfig().getInt("comehere") * throticle.getThrottle().getArtronMultiplier()); if (request.getLevel() < ch) { plugin.getMessenger().send(acceptor, TardisModule.TARDIS, "NOT_ENOUGH_ENERGY"); plugin.getMessenger().send(requester, TardisModule.TARDIS, "NOT_ENOUGH_ENERGY"); diff --git a/src/main/java/me/eccentric_nz/TARDIS/travel/TARDISAreaSignListener.java b/src/main/java/me/eccentric_nz/TARDIS/travel/TARDISAreaSignListener.java index 73dc0e5608..6943f67831 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/travel/TARDISAreaSignListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/travel/TARDISAreaSignListener.java @@ -22,7 +22,9 @@ import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; import me.eccentric_nz.TARDIS.travel.save.TARDISSavesPlanetInventory; -import net.md_5.bungee.api.ChatColor; +import me.eccentric_nz.TARDIS.upgrades.SystemTree; +import me.eccentric_nz.TARDIS.upgrades.SystemUpgradeChecker; +import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -61,10 +63,11 @@ public void onAreaTerminalClick(InventoryClickEvent event) { event.setCancelled(true); int slot = event.getRawSlot(); Player player = (Player) event.getWhoClicked(); + String uuid = player.getUniqueId().toString(); if (slot >= 0 && slot < 45) { // get the TARDIS the player is in HashMap wheres = new HashMap<>(); - wheres.put("uuid", player.getUniqueId().toString()); + wheres.put("uuid", uuid); ResultSetTravellers rst = new ResultSetTravellers(plugin, wheres, false); if (!rst.resultSet()) { return; @@ -101,11 +104,15 @@ public void onAreaTerminalClick(InventoryClickEvent event) { return; } if (slot == 49) { + if (plugin.getConfig().getBoolean("difficulty.system_upgrades") && !new SystemUpgradeChecker(plugin).has(uuid, SystemTree.SAVES)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_NEED", "Saves"); + return; + } // load TARDIS saves plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> { // get the TARDIS the player is in HashMap wheres = new HashMap<>(); - wheres.put("uuid", player.getUniqueId().toString()); + wheres.put("uuid", uuid); ResultSetTravellers rs = new ResultSetTravellers(plugin, wheres, false); if (rs.resultSet()) { TARDISSavesPlanetInventory sst = new TARDISSavesPlanetInventory(plugin, rs.getTardis_id()); diff --git a/src/main/java/me/eccentric_nz/TARDIS/travel/TARDISMalfunction.java b/src/main/java/me/eccentric_nz/TARDIS/travel/TARDISMalfunction.java index f5375bff37..69abd2f487 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/travel/TARDISMalfunction.java +++ b/src/main/java/me/eccentric_nz/TARDIS/travel/TARDISMalfunction.java @@ -26,7 +26,6 @@ import me.eccentric_nz.TARDIS.customblocks.TARDISDisplayItemUtils; import me.eccentric_nz.TARDIS.database.resultset.*; import me.eccentric_nz.TARDIS.enumeration.COMPASS; -import me.eccentric_nz.TARDIS.enumeration.Difficulty; import me.eccentric_nz.TARDIS.enumeration.DiskCircuit; import me.eccentric_nz.TARDIS.enumeration.TardisLight; import org.bukkit.Location; @@ -115,7 +114,7 @@ private void doMalfunction(int id, Player p, String eps, String creeper, Locatio if (rsl.resultSet()) { // should we damage circuits? int malfunctionDamage = plugin.getConfig().getInt("circuits.malfunction_damage"); - if (plugin.getConfig().getBoolean("circuits.damage") && malfunctionDamage > 0 && !plugin.getDifficulty().equals(Difficulty.EASY)) { + if (plugin.getConfig().getBoolean("circuits.damage") && malfunctionDamage > 0 && !plugin.getConfig().getBoolean("difficulty.circuits")) { // choose a random circuit DiskCircuit circuit = DiskCircuit.getTardisCircuits().get(TARDISConstants.RANDOM.nextInt(DiskCircuit.getTardisCircuits().size())); // is the circuit in the advanced console? diff --git a/src/main/java/me/eccentric_nz/TARDIS/travel/TARDISMalfunctionExplosion.java b/src/main/java/me/eccentric_nz/TARDIS/travel/TARDISMalfunctionExplosion.java index b2b6238140..b170f39bb3 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/travel/TARDISMalfunctionExplosion.java +++ b/src/main/java/me/eccentric_nz/TARDIS/travel/TARDISMalfunctionExplosion.java @@ -22,7 +22,7 @@ import me.eccentric_nz.TARDIS.database.resultset.ResultSetFlightControls; import me.eccentric_nz.TARDIS.database.resultset.ResultSetRepeaters; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardis; -import me.eccentric_nz.TARDIS.utility.TARDISFirework; +import me.eccentric_nz.TARDIS.particles.TARDISFirework; import org.bukkit.Location; import java.util.HashMap; diff --git a/src/main/java/me/eccentric_nz/TARDIS/travel/TARDISTerminalListener.java b/src/main/java/me/eccentric_nz/TARDIS/travel/TARDISTerminalListener.java index 110db63b7b..3e32c5d936 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/travel/TARDISTerminalListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/travel/TARDISTerminalListener.java @@ -31,7 +31,7 @@ import me.eccentric_nz.TARDIS.planets.TARDISAliasResolver; import me.eccentric_nz.TARDIS.utility.TARDISStaticLocationGetters; import me.eccentric_nz.TARDIS.utility.TARDISStaticUtils; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.World; @@ -157,7 +157,7 @@ public void onDestTerminalClick(InventoryClickEvent event) { plugin.getPM().callEvent(new TARDISTravelEvent(player, null, TravelType.TERMINAL, terminalIDs.get(uuid))); } // damage the circuit if configured - if (plugin.getConfig().getBoolean("circuits.damage") && !plugin.getDifficulty().equals(Difficulty.EASY) && plugin.getConfig().getInt("circuits.uses.input") > 0) { + if (plugin.getConfig().getBoolean("circuits.damage") && plugin.getConfig().getInt("circuits.uses.input") > 0) { TARDISCircuitChecker tcc = new TARDISCircuitChecker(plugin, terminalIDs.get(uuid)); tcc.getCircuits(); // decrement uses diff --git a/src/main/java/me/eccentric_nz/TARDIS/travel/save/TARDISSavesListener.java b/src/main/java/me/eccentric_nz/TARDIS/travel/save/TARDISSavesListener.java index 3add19a356..373f7e65e0 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/travel/save/TARDISSavesListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/travel/save/TARDISSavesListener.java @@ -17,20 +17,19 @@ package me.eccentric_nz.TARDIS.travel.save; import me.eccentric_nz.TARDIS.TARDIS; +import me.eccentric_nz.TARDIS.advanced.TARDISCircuitChecker; +import me.eccentric_nz.TARDIS.advanced.TARDISCircuitDamager; import me.eccentric_nz.TARDIS.api.Parameters; import me.eccentric_nz.TARDIS.api.event.TARDISTravelEvent; import me.eccentric_nz.TARDIS.database.resultset.*; -import me.eccentric_nz.TARDIS.enumeration.ChameleonPreset; -import me.eccentric_nz.TARDIS.enumeration.Flag; -import me.eccentric_nz.TARDIS.enumeration.TardisModule; -import me.eccentric_nz.TARDIS.enumeration.TravelType; +import me.eccentric_nz.TARDIS.enumeration.*; import me.eccentric_nz.TARDIS.flight.TARDISLand; import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; import me.eccentric_nz.TARDIS.planets.TARDISAliasResolver; import me.eccentric_nz.TARDIS.travel.TARDISAreaCheck; import me.eccentric_nz.TARDIS.travel.TravelCostAndType; import me.eccentric_nz.TARDIS.utility.TARDISNumberParsers; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.World; @@ -201,6 +200,14 @@ public void onSaveTerminalClick(InventoryClickEvent event) { } } if (!save_dest.equals(current) || plugin.getTrackerKeeper().getDestinationVortex().containsKey(occupiedTardisId)) { + // damage circuit if configured + if (plugin.getConfig().getBoolean("circuits.damage") && plugin.getConfig().getInt("circuits.uses.materialisation") > 0) { + TARDISCircuitChecker tcc = new TARDISCircuitChecker(plugin, occupiedTardisId); + tcc.getCircuits(); + // decrement uses + int uses_left = tcc.getMemoryUses(); + new TARDISCircuitDamager(plugin, DiskCircuit.MEMORY, uses_left, occupiedTardisId, player).damage(); + } HashMap set = new HashMap<>(); set.put("world", lore.get(0)); set.put("x", TARDISNumberParsers.parseInt(lore.get(1))); diff --git a/src/main/java/me/eccentric_nz/TARDIS/travel/save/TARDISSavesPlanetListener.java b/src/main/java/me/eccentric_nz/TARDIS/travel/save/TARDISSavesPlanetListener.java index 8bbbeb262a..ec595eac51 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/travel/save/TARDISSavesPlanetListener.java +++ b/src/main/java/me/eccentric_nz/TARDIS/travel/save/TARDISSavesPlanetListener.java @@ -28,7 +28,7 @@ import me.eccentric_nz.TARDIS.planets.TARDISAliasResolver; import me.eccentric_nz.TARDIS.travel.TravelCostAndType; import me.eccentric_nz.TARDIS.utility.TARDISNumberParsers; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.entity.Player; diff --git a/src/main/java/me/eccentric_nz/TARDIS/upgrades/SystemTree.java b/src/main/java/me/eccentric_nz/TARDIS/upgrades/SystemTree.java new file mode 100644 index 0000000000..e845663934 --- /dev/null +++ b/src/main/java/me/eccentric_nz/TARDIS/upgrades/SystemTree.java @@ -0,0 +1,130 @@ +/* + * Copyright (C) 2024 eccentric_nz + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package me.eccentric_nz.TARDIS.upgrades; + +import me.eccentric_nz.TARDIS.utility.TARDISStringUtils; +import org.bukkit.Material; + +import java.util.List; + +public enum SystemTree { + + // TARDIS System Upgrades + T_UP(1), + T_RIGHT(2), + H_LINE(3), + D_RIGHT(4), + BLANK(5), + CLOSE(6), + CROSS(7), + UPGRADE_TREE(1001, 2, Material.LIME_GLAZED_TERRACOTTA, List.of("Unlock upgrades using", "your Time Lord", "Artron Energy."), "", ""), + ARCHITECTURE(1002, 9, Material.LIME_GLAZED_TERRACOTTA, List.of("Unlocks the", "architecture branch."), "UPGRADE_TREE", "branch"), + CHAMELEON_CIRCUIT(1005, 19, Material.LIME_GLAZED_TERRACOTTA, List.of("Allows the TARDIS", "exterior to be changed."), "ARCHITECTURE", "architecture"), + ROOM_GROWING(1005, 28, Material.LIME_GLAZED_TERRACOTTA, List.of("Allows rooms", "to be grown."), "CHAMELEON_CIRCUIT", "architecture"), + DESKTOP_THEME(1005, 37, Material.LIME_GLAZED_TERRACOTTA, List.of("Allows the desktop", "theme to be reconfigured."), "ROOM_GROWING", "architecture"), + NAVIGATION(1003, 13, Material.LIME_GLAZED_TERRACOTTA, List.of("Unlocks the", "navigation branch."), "UPGRADE_TREE", "branch"), + SAVES(1005, 23, Material.LIME_GLAZED_TERRACOTTA, List.of("Allows you", "to create", "saved locations"), "NAVIGATION", "navigation"), + DISTANCE_1(1006, 21, Material.LIME_GLAZED_TERRACOTTA, List.of("Unlocks the 2x", "distance multiplier."), "SAVES", "navigation"), + DISTANCE_2(1006, 30, Material.LIME_GLAZED_TERRACOTTA, List.of("Unlocks the 3x", "distance multiplier."), "DISTANCE_1", "navigation"), + DISTANCE_3(1006, 39, Material.LIME_GLAZED_TERRACOTTA, List.of("Unlocks the 4x", "distance multiplier."), "DISTANCE_2", "navigation"), + TELEPATHIC_CIRCUIT(1005, 32, Material.LIME_GLAZED_TERRACOTTA, List.of("Unlocks cave,", "structure and", "biome travel."), "DISTANCE_3", "navigation"), + INTER_DIMENSIONAL_TRAVEL(1005, 41, Material.LIME_GLAZED_TERRACOTTA, List.of("Unlocks travel to", "the Nether and End."), "DISTANCE_3", "navigation"), + EXTERIOR_FLIGHT(1005, 50, Material.LIME_GLAZED_TERRACOTTA, List.of("Unlocks flying the", "TARDIS exterior."), "INTER_DIMENSIONAL_TRAVEL", "navigation"), + TOOLS(1004, 16, Material.LIME_GLAZED_TERRACOTTA, List.of("Unlocks the", "tools branch."), "UPGRADE_TREE", "branch"), + TARDIS_LOCATOR(1005, 26, Material.LIME_GLAZED_TERRACOTTA, List.of("Allows the TARDIS", "to be found."), "TOOLS", "tools"), + BIOME_READER(1005, 35, Material.LIME_GLAZED_TERRACOTTA, List.of("Allows biomes", "to be stored", "for travel."), "TARDIS_LOCATOR", "tools"), + FORCE_FIELD(1005, 44, Material.LIME_GLAZED_TERRACOTTA, List.of("Allows the TARDIS", "to have a monster", "repelling force field."), "BIOME_READER", "tools"), + STATTENHEIM_REMOTE(1005, 53, Material.LIME_GLAZED_TERRACOTTA, List.of("Allows the TARDIS", "to be remotely", "called to a location."), "FORCE_FIELD", "tools"), + MONITOR(1006, 42, Material.LIME_GLAZED_TERRACOTTA, List.of("View the", "TARDIS exterior."), "FORCE_FIELD", "tools"); + + private final int customModelData; + private final int slot; + private final Material material; + private final List lore; + private final String required; + private final String branch; + + SystemTree(int customModelData, int slot, Material material, List lore, String required, String branch) { + this.customModelData = customModelData; + this.slot = slot; + this.material = material; + this.required = required; + this.lore = lore; + this.branch = branch; + } + + SystemTree(int customModelData) { + this.customModelData = customModelData; + this.slot = -1; + this.material = Material.MAGENTA_GLAZED_TERRACOTTA; + this.lore = null; + this.required = ""; + this.branch = ""; + } + + public int getCustomModelData() { + return customModelData; + } + + public int getSlot() { + return slot; + } + + public Material getMaterial() { + return material; + } + + public List getLore() { + return lore; + } + + public String getRequired() { + return required; + } + + public String getBranch() { + return branch; + } + + public String getName() { + String s = toString(); + return TARDISStringUtils.sentenceCase(s); + } + + public String getDatabaseName() { + switch (this) { + case CHAMELEON_CIRCUIT -> { + return "chameleon"; + } + case ROOM_GROWING -> { + return "rooms"; + } + case DESKTOP_THEME -> { + return "desktop"; + } + case INTER_DIMENSIONAL_TRAVEL -> { + return "inter_dimension"; + } + case TARDIS_LOCATOR -> { + return "locator"; + } + default -> { + return toString().toLowerCase(); + } + } + } +} diff --git a/src/main/java/me/eccentric_nz/TARDIS/upgrades/SystemUpgradeChecker.java b/src/main/java/me/eccentric_nz/TARDIS/upgrades/SystemUpgradeChecker.java new file mode 100644 index 0000000000..772822918f --- /dev/null +++ b/src/main/java/me/eccentric_nz/TARDIS/upgrades/SystemUpgradeChecker.java @@ -0,0 +1,27 @@ +package me.eccentric_nz.TARDIS.upgrades; + +import me.eccentric_nz.TARDIS.TARDIS; +import me.eccentric_nz.TARDIS.database.resultset.ResultSetSystemUpgrades; +import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardisID; + +public class SystemUpgradeChecker { + + private final TARDIS plugin; + + public SystemUpgradeChecker(TARDIS plugin) { + this.plugin = plugin; + } + + public boolean has(String uuid, SystemTree upgrade) { + ResultSetTardisID rs = new ResultSetTardisID(plugin); + if (!rs.fromUUID(uuid)) { + return false; + } + // get player's artron energy level + ResultSetSystemUpgrades rsp = new ResultSetSystemUpgrades(plugin, rs.getTardisId(), uuid); + if (!rsp.resultset()) { + return false; + } + return rsp.getData().getUpgrades().get(upgrade); + } +} diff --git a/src/main/java/me/eccentric_nz/TARDIS/upgrades/SystemUpgradeRecord.java b/src/main/java/me/eccentric_nz/TARDIS/upgrades/SystemUpgradeRecord.java new file mode 100644 index 0000000000..1ee5b9e632 --- /dev/null +++ b/src/main/java/me/eccentric_nz/TARDIS/upgrades/SystemUpgradeRecord.java @@ -0,0 +1,31 @@ +package me.eccentric_nz.TARDIS.upgrades; + +import me.eccentric_nz.TARDIS.TARDIS; +import me.eccentric_nz.TARDIS.database.resultset.ResultSetSystemUpgrades; +import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardisID; + +import java.util.HashMap; + +public class SystemUpgradeRecord { + + private final TARDIS plugin; + + public SystemUpgradeRecord(TARDIS plugin) { + this.plugin = plugin; + } + + public void make(String uuid) { + ResultSetTardisID rs = new ResultSetTardisID(plugin); + if (!rs.fromUUID(uuid)) { + return; + } + // get player's artron energy level + ResultSetSystemUpgrades rsp = new ResultSetSystemUpgrades(plugin, rs.getTardisId(), uuid); + if (!rsp.resultset()) { + HashMap set = new HashMap<>(); + set.put("tardis_id", rs.getTardisId()); + set.put("uuid", uuid); + plugin.getQueryFactory().doInsert("system_upgrades", set); + } + } +} diff --git a/src/main/java/me/eccentric_nz/TARDIS/upgrades/SystemUpgradeUpdate.java b/src/main/java/me/eccentric_nz/TARDIS/upgrades/SystemUpgradeUpdate.java new file mode 100644 index 0000000000..4814345b3c --- /dev/null +++ b/src/main/java/me/eccentric_nz/TARDIS/upgrades/SystemUpgradeUpdate.java @@ -0,0 +1,44 @@ +package me.eccentric_nz.TARDIS.upgrades; + +import me.eccentric_nz.TARDIS.TARDIS; +import me.eccentric_nz.TARDIS.database.TARDISDatabaseConnection; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class SystemUpgradeUpdate { + + private final TARDIS plugin; + private final TARDISDatabaseConnection service = TARDISDatabaseConnection.getINSTANCE(); + private final Connection connection = service.getConnection(); + private final String prefix; + + public SystemUpgradeUpdate(TARDIS plugin) { + this.plugin = plugin; + this.prefix = this.plugin.getPrefix(); + } + + public void set(String uuid, int id, SystemTree clicked) { + PreparedStatement ps = null; + String query = "UPDATE " + prefix + "system_upgrades SET " + clicked.getDatabaseName() + " = 1 WHERE uuid = ? AND tardis_id = ?"; + try { + service.testConnection(connection); + ps = connection.prepareStatement(query); + int s = 1; + ps.setString(1, uuid); + ps.setInt(2, id); + ps.executeUpdate(); + } catch (SQLException e) { + plugin.debug("Update error for system upgrades table! " + e.getMessage()); + } finally { + try { + if (ps != null) { + ps.close(); + } + } catch (SQLException e) { + plugin.debug("Error closing system upgrades table! " + e.getMessage()); + } + } + } +} diff --git a/src/main/java/me/eccentric_nz/TARDIS/upgrades/TARDISSystemTreeGUI.java b/src/main/java/me/eccentric_nz/TARDIS/upgrades/TARDISSystemTreeGUI.java new file mode 100644 index 0000000000..ff7345bb6b --- /dev/null +++ b/src/main/java/me/eccentric_nz/TARDIS/upgrades/TARDISSystemTreeGUI.java @@ -0,0 +1,128 @@ +package me.eccentric_nz.TARDIS.upgrades; + +import me.eccentric_nz.TARDIS.TARDIS; +import me.eccentric_nz.TARDIS.database.data.SystemUpgrade; +import org.bukkit.ChatColor; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; + +import java.util.ArrayList; +import java.util.List; + +public class TARDISSystemTreeGUI { + + private final TARDIS plugin; + private final SystemUpgrade sysData; + private final ItemStack[] inventory; + + public TARDISSystemTreeGUI(TARDIS plugin, SystemUpgrade sysData) { + this.plugin = plugin; + this.sysData = sysData; + inventory = getItemStacks(); + } + + /** + * Constructs an inventory for the TARDIS Upgrades GUI. + * + * @return an Array of itemStacks (an inventory) + */ + private ItemStack[] getItemStacks() { + ItemStack[] stacks = new ItemStack[54]; + for (SystemTree g : SystemTree.values()) { + if (g.getSlot() != -1) { + ItemStack is = new ItemStack(g.getMaterial(), 1); + ItemMeta im = is.getItemMeta(); + String prefix = (g.getBranch().equals("branch")) ? ChatColor.GOLD + "" + ChatColor.ITALIC : ""; + im.setDisplayName(prefix + g.getName()); + List lore = new ArrayList<>(g.getLore()); + boolean has = sysData.getUpgrades().get(g); + if (!has) { + String cost; + if (g.getBranch().equals("branch")) { + cost = plugin.getSystemUpgradesConfig().getString("branch"); + } else { + cost = plugin.getSystemUpgradesConfig().getString(g.getBranch() + "." + g.toString().toLowerCase()); + } + lore.add(ChatColor.AQUA + "" + ChatColor.ITALIC + "Cost: " + cost); + } else if (g != SystemTree.UPGRADE_TREE) { + lore.add(ChatColor.GREEN + "" + ChatColor.ITALIC + "Unlocked"); + } else { + // add players current Artron level to UPGRADE_TREE + lore.add(ChatColor.AQUA + "" + ChatColor.ITALIC + "Artron Level: " + sysData.getArtronLevel()); + } + im.setLore(lore); + // does the player have this system upgrade? + int cmd = (has) ? g.getCustomModelData() + 1000 : g.getCustomModelData(); + im.setCustomModelData(cmd); + is.setItemMeta(im); + stacks[g.getSlot()] = is; + } + } + // horizontal + int[] horizontal = new int[]{10, 12, 14, 15}; + for (int h : horizontal) { + ItemStack is = new ItemStack(SystemTree.H_LINE.getMaterial(), 1); + ItemMeta im = is.getItemMeta(); + im.setDisplayName(ChatColor.RESET + ""); + im.setCustomModelData(SystemTree.H_LINE.getCustomModelData()); + is.setItemMeta(im); + stacks[h] = is; + } + // t_right + int[] t_right = new int[]{18, 25, 27, 34, 43}; + for (int r : t_right) { + ItemStack is = new ItemStack(SystemTree.T_RIGHT.getMaterial(), 1); + ItemMeta im = is.getItemMeta(); + im.setDisplayName(ChatColor.RESET + ""); + im.setCustomModelData(SystemTree.T_RIGHT.getCustomModelData()); + is.setItemMeta(im); + stacks[r] = is; + } + // t_up + ItemStack ist = new ItemStack(SystemTree.T_UP.getMaterial(), 1); + ItemMeta up = ist.getItemMeta(); + up.setDisplayName(ChatColor.RESET + ""); + up.setCustomModelData(SystemTree.T_UP.getCustomModelData()); + ist.setItemMeta(up); + stacks[11] = ist; + // down_right + int[] down_right = new int[]{36, 49, 52}; + for (int d : down_right) { + ItemStack is = new ItemStack(SystemTree.D_RIGHT.getMaterial(), 1); + ItemMeta im = is.getItemMeta(); + im.setDisplayName(ChatColor.RESET + ""); + im.setCustomModelData(SystemTree.D_RIGHT.getCustomModelData()); + is.setItemMeta(im); + stacks[d] = is; + } + // cross + int[] cross = new int[]{22, 31, 40, 43}; + for (int c : cross) { + ItemStack cr = new ItemStack(SystemTree.CROSS.getMaterial(), 1); + ItemMeta oss = cr.getItemMeta(); + oss.setDisplayName(ChatColor.RESET + ""); + oss.setCustomModelData(SystemTree.CROSS.getCustomModelData()); + cr.setItemMeta(oss); + stacks[c] = cr; + } + // background + ItemStack is = new ItemStack(SystemTree.BLANK.getMaterial(), 1); + ItemMeta im = is.getItemMeta(); + im.setDisplayName(ChatColor.RESET + ""); + im.setCustomModelData(SystemTree.BLANK.getCustomModelData()); + is.setItemMeta(im); + stacks[0] = is; + // close + ItemStack close = new ItemStack(SystemTree.CLOSE.getMaterial(), 1); + ItemMeta close_im = close.getItemMeta(); + close_im.setDisplayName(plugin.getLanguage().getString("BUTTON_CLOSE")); + close_im.setCustomModelData(SystemTree.CLOSE.getCustomModelData()); + close.setItemMeta(close_im); + stacks[8] = close; + return stacks; + } + + public ItemStack[] getInventory() { + return inventory; + } +} diff --git a/src/main/java/me/eccentric_nz/TARDIS/upgrades/TARDISSystemTreeListener.java b/src/main/java/me/eccentric_nz/TARDIS/upgrades/TARDISSystemTreeListener.java new file mode 100644 index 0000000000..9d064e3ac2 --- /dev/null +++ b/src/main/java/me/eccentric_nz/TARDIS/upgrades/TARDISSystemTreeListener.java @@ -0,0 +1,160 @@ +package me.eccentric_nz.TARDIS.upgrades; + +import me.eccentric_nz.TARDIS.TARDIS; +import me.eccentric_nz.TARDIS.database.data.SystemUpgrade; +import me.eccentric_nz.TARDIS.database.resultset.ResultSetSystemUpgrades; +import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardis; +import me.eccentric_nz.TARDIS.database.resultset.ResultSetTravellers; +import me.eccentric_nz.TARDIS.enumeration.TardisModule; +import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.inventory.InventoryView; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; + +import java.util.HashMap; +import java.util.List; + +public class TARDISSystemTreeListener extends TARDISMenuListener { + + private final TARDIS plugin; + + public TARDISSystemTreeListener(TARDIS plugin) { + super(plugin); + this.plugin = plugin; + } + + @EventHandler(ignoreCancelled = true) + public void onSystemInventoryClick(InventoryClickEvent event) { + InventoryView view = event.getView(); + if (!view.getTitle().equals(ChatColor.DARK_RED + "TARDIS System Upgrades")) { + return; + } + event.setCancelled(true); + int slot = event.getRawSlot(); + if (slot < 0 || slot >= 63) { + return; + } + ItemStack is = view.getItem(slot); + if (is == null) { + return; + } + if (is.getType() != Material.LIME_GLAZED_TERRACOTTA && slot != 8) { + return; + } + Player player = (Player) event.getWhoClicked(); + String uuid = player.getUniqueId().toString(); + // get TARDIS player is in + HashMap where = new HashMap<>(); + where.put("uuid", uuid); + ResultSetTravellers rst = new ResultSetTravellers(plugin, where, false); + if (!rst.resultSet()) { + return; + } + int id = rst.getTardis_id(); + // must be the owner of the TARDIS + HashMap wheret = new HashMap<>(); + wheret.put("tardis_id", id); + wheret.put("uuid", uuid); + ResultSetTardis rs = new ResultSetTardis(plugin, wheret, "", false, 2); + if (!rs.resultSet()) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "NOT_OWNER"); + close(player); + return; + } + // get player's artron energy level + ResultSetSystemUpgrades rsp = new ResultSetSystemUpgrades(plugin, id, uuid); + if (!rsp.resultset()) { + close(player); + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_TRAVEL_FIRST"); + return; + } + if (slot == 8) { + close(player); + return; + } + SystemUpgrade current = rsp.getData(); + SystemTree clicked; + switch (slot) { + case 9 -> clicked = SystemTree.ARCHITECTURE; + case 13 -> clicked = SystemTree.NAVIGATION; + case 16 -> clicked = SystemTree.TOOLS; + case 19 -> clicked = SystemTree.CHAMELEON_CIRCUIT; + case 21 -> clicked = SystemTree.DISTANCE_1; + case 23 -> clicked = SystemTree.SAVES; + case 26 -> clicked = SystemTree.TARDIS_LOCATOR; + case 28 -> clicked = SystemTree.ROOM_GROWING; + case 30 -> clicked = SystemTree.DISTANCE_2; + case 32 -> clicked = SystemTree.TELEPATHIC_CIRCUIT; + case 35 -> clicked = SystemTree.BIOME_READER; + case 37 -> clicked = SystemTree.DESKTOP_THEME; + case 39 -> clicked = SystemTree.DISTANCE_3; + case 41 -> clicked = SystemTree.INTER_DIMENSIONAL_TRAVEL; + case 42 -> clicked = SystemTree.MONITOR; + case 44 -> clicked = SystemTree.FORCE_FIELD; + case 50 -> clicked = SystemTree.EXTERIOR_FLIGHT; + case 53 -> clicked = SystemTree.STATTENHEIM_REMOTE; + default -> clicked = SystemTree.UPGRADE_TREE; + } + try { + SystemTree required = SystemTree.valueOf(clicked.getRequired()); + if (!current.getUpgrades().get(required)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_REQUIRED", required.getName()); + player.playSound(player.getLocation(), Sound.ENTITY_WARDEN_TENDRIL_CLICKS, 1.0f, 1.0f); + } else { + // check if they have upgrade already + if (current.getUpgrades().get(clicked)) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_HAS", clicked.getName()); + player.playSound(player.getLocation(), Sound.ENTITY_WARDEN_STEP, 1.0f, 1.0f); + return; + } + // check artron + int cost; + if (clicked.getBranch().equals("branch")) { + cost = plugin.getSystemUpgradesConfig().getInt("branch"); + } else { + cost = plugin.getSystemUpgradesConfig().getInt(clicked.getBranch() + "." + clicked.toString().toLowerCase()); + } + if (cost > current.getArtronLevel()) { + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_COST", clicked.getName()); + player.playSound(player.getLocation(), Sound.ENTITY_CAT_EAT, 1.0f, 1.0f); + return; + } + // debit + HashMap wheretl = new HashMap<>(); + wheretl.put("uuid", uuid); + plugin.getQueryFactory().alterEnergyLevel("player_prefs", -cost, wheretl, player); + // play sound + player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1.0f, 1.0f); + // message + plugin.getMessenger().send(player, TardisModule.TARDIS, "SYS_SUCCESS", clicked.getName()); + // update system upgrade record + new SystemUpgradeUpdate(plugin).set(uuid, id, clicked); + // set custom model data for clicked upgrade + ItemMeta im = is.getItemMeta(); + im.setCustomModelData(im.getCustomModelData() + 1000); + List lore = im.getLore(); + lore.set(lore.size() - 1, ChatColor.GREEN + "" + org.bukkit.ChatColor.ITALIC + "Unlocked"); + im.setLore(lore); + is.setItemMeta(im); + // set artron level remaining for item in system tree slot + int remaining = current.getArtronLevel() - cost; + ItemStack st = view.getItem(SystemTree.UPGRADE_TREE.getSlot()); + ItemMeta stim = st.getItemMeta(); + List stlore = stim.getLore(); + stlore.set(3, ChatColor.AQUA + "" + ChatColor.ITALIC + "Artron Level: " + remaining); + stim.setLore(stlore); + st.setItemMeta(stim); + } + } catch (IllegalArgumentException e) { + // clicked upgrade tree + plugin.debug("IllegalArgumentException for " + clicked.getRequired()); + close(player); + } + } +} diff --git a/src/main/java/me/eccentric_nz/TARDIS/utility/TARDISChecker.java b/src/main/java/me/eccentric_nz/TARDIS/utility/TARDISChecker.java index efa73d46e8..e07f795c4c 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/utility/TARDISChecker.java +++ b/src/main/java/me/eccentric_nz/TARDIS/utility/TARDISChecker.java @@ -90,7 +90,7 @@ public void checkAdvancements() { copy("pack.mcmeta", mcmeta); write(dataPacksRoot, false); } else { - // update the format - 41 is the latest for 1.20.6 + // update the format - 48 is the latest for 1.21 // it's a json file, so load it and check the value Gson gson = new GsonBuilder().create(); try { @@ -102,11 +102,11 @@ public void checkAdvancements() { for (Map.Entry data : values.entrySet()) { if (data.getKey().equals("pack_format")) { Double d = (Double) data.getValue(); - if (d < 41.0D) { + if (d < 48.0D) { Map> mcmap = new HashMap<>(); Map pack = new HashMap<>(); pack.put("description", "Data pack for the TARDIS plugin"); - pack.put("pack_format", 41); + pack.put("pack_format", 48); mcmap.put("pack", pack); FileWriter writer = new FileWriter(mcmeta); gson.toJson(mcmap, writer); diff --git a/src/main/java/me/eccentric_nz/TARDIS/utility/TARDISItemRenamer.java b/src/main/java/me/eccentric_nz/TARDIS/utility/TARDISItemRenamer.java index 55e19f06d2..d263698be9 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/utility/TARDISItemRenamer.java +++ b/src/main/java/me/eccentric_nz/TARDIS/utility/TARDISItemRenamer.java @@ -19,7 +19,7 @@ import java.util.ArrayList; import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.enumeration.RecipeItem; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; diff --git a/src/main/java/me/eccentric_nz/TARDIS/utility/TARDISSpigotChecker.java b/src/main/java/me/eccentric_nz/TARDIS/utility/TARDISSpigotChecker.java index d48cf4e141..b0a44aeedf 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/utility/TARDISSpigotChecker.java +++ b/src/main/java/me/eccentric_nz/TARDIS/utility/TARDISSpigotChecker.java @@ -19,13 +19,14 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; +import me.eccentric_nz.TARDIS.TARDIS; +import me.eccentric_nz.TARDIS.enumeration.TardisModule; + import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.time.Duration; -import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.enumeration.TardisModule; public class TARDISSpigotChecker implements Runnable { @@ -46,8 +47,8 @@ public void run() { return; } int name = spigotBuild.getAsJsonPrimitive("name").getAsInt(); - // 3777 is the latest 1.20 build (as of 9-06-2023) - String[] split = spigotVersion.split("-"); // something like '3777-Spigot-723951c-f3b2b22 (MC: 1.20)' + // 4213 is the latest 1.21 build (as of 15-06-2024) + String[] split = spigotVersion.split("-"); // something like '4213-Spigot-146439e-f5a63f7 (MC: 1.21)' int current = TARDISNumberParsers.parseInt(split[0]); if (name > current) { JsonObject refs = spigotBuild.get("refs").getAsJsonObject(); @@ -82,7 +83,7 @@ private JsonObject fetchLatestSpigotBuild() { .uri(uri) .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); - JsonElement root = JsonParser.parseString((String) response.body()); + JsonElement root = JsonParser.parseString(response.body()); return root.getAsJsonObject(); } catch (Exception ex) { plugin.debug("Failed to check for the latest build info from Spigot."); diff --git a/src/main/java/me/eccentric_nz/TARDIS/utility/TARDISStaticUtils.java b/src/main/java/me/eccentric_nz/TARDIS/utility/TARDISStaticUtils.java index eac41079aa..b82cfa1833 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/utility/TARDISStaticUtils.java +++ b/src/main/java/me/eccentric_nz/TARDIS/utility/TARDISStaticUtils.java @@ -25,7 +25,7 @@ import me.eccentric_nz.TARDIS.database.resultset.ResultSetPlayerPrefs; import me.eccentric_nz.TARDIS.database.resultset.ResultSetTardis; import me.eccentric_nz.TARDIS.enumeration.TardisModule; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.*; import org.bukkit.block.Biome; import org.bukkit.block.Block; diff --git a/src/main/java/me/eccentric_nz/TARDIS/utility/TARDISUpdateChecker.java b/src/main/java/me/eccentric_nz/TARDIS/utility/TARDISUpdateChecker.java index 711b558d3f..3ac46bc801 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/utility/TARDISUpdateChecker.java +++ b/src/main/java/me/eccentric_nz/TARDIS/utility/TARDISUpdateChecker.java @@ -161,7 +161,7 @@ private String getLastestServerVersion() { org.spigotmc spigot - 1.20.6-R0.1-SNAPSHOT + 1.21-R0.1-SNAPSHOT */ NodeList list = doc.getElementsByTagName("dependencies"); Node root = list.item(0); // there's only one node diff --git a/src/main/java/me/eccentric_nz/TARDIS/utility/TARDISUtils.java b/src/main/java/me/eccentric_nz/TARDIS/utility/TARDISUtils.java index 79e24d5da9..a499534901 100644 --- a/src/main/java/me/eccentric_nz/TARDIS/utility/TARDISUtils.java +++ b/src/main/java/me/eccentric_nz/TARDIS/utility/TARDISUtils.java @@ -16,13 +16,9 @@ */ package me.eccentric_nz.TARDIS.utility; -import java.util.HashMap; -import java.util.List; import me.eccentric_nz.TARDIS.TARDIS; -import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; import me.eccentric_nz.TARDIS.database.resultset.ResultSetCount; import me.eccentric_nz.TARDIS.database.resultset.ResultSetDiskStorage; -import me.eccentric_nz.TARDIS.database.resultset.ResultSetPlayerPrefs; import me.eccentric_nz.TARDIS.display.TARDISDisplayType; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.tardischunkgenerator.worldgen.TARDISChunkGenerator; @@ -38,6 +34,9 @@ import org.bukkit.generator.ChunkGenerator; import org.bukkit.inventory.ItemStack; +import java.util.HashMap; +import java.util.List; + /** * Various utility methods. *

@@ -180,20 +179,8 @@ public boolean inGracePeriod(Player p, boolean update) { set.put("grace", (grace_count + 1)); plugin.getQueryFactory().doUpdate("t_count", set, where); } - } else if (plugin.getConfig().getBoolean("allow.player_difficulty") && TARDISPermission.hasPermission(p, "tardis.difficulty")) { - // check player difficulty preference - ResultSetPlayerPrefs rsp = new ResultSetPlayerPrefs(plugin, p.getUniqueId().toString()); - if (rsp.resultSet()) { - inGracePeriod = rsp.isEasyDifficulty(); - } } } - } else if (plugin.getConfig().getBoolean("allow.player_difficulty") && TARDISPermission.hasPermission(p, "tardis.difficulty")) { - // check player difficulty preference - ResultSetPlayerPrefs rsp = new ResultSetPlayerPrefs(plugin, p.getUniqueId().toString()); - if (rsp.resultSet()) { - inGracePeriod = rsp.isEasyDifficulty(); - } } return inGracePeriod; } diff --git a/src/main/java/me/eccentric_nz/TARDIS/utility/TARDISVector3D.java b/src/main/java/me/eccentric_nz/TARDIS/utility/TARDISVector3D.java deleted file mode 100644 index defc185ab3..0000000000 --- a/src/main/java/me/eccentric_nz/TARDIS/utility/TARDISVector3D.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Freeze players - * - * Copyright 2012 Kristian S. Stangeland (Comphenix) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ -package me.eccentric_nz.TARDIS.utility; - -import org.bukkit.Location; -import org.bukkit.util.Vector; - -public class TARDISVector3D { - - // Use protected members, like Bukkit - public final double x; - public final double y; - public final double z; - - /** - * Construct an immutable 3D vector. - * - * @param x the x coordinate - * @param y the y coordinate - * @param z the z coordinate - */ - private TARDISVector3D(double x, double y, double z) { - this.x = x; - this.y = y; - this.z = z; - } - - /** - * Construct an immutable floating point 3D vector from a location object. - * - * @param location - the location to copy. - */ - public TARDISVector3D(Location location) { - this(location.toVector()); - } - - /** - * Construct an immutable floating point 3D vector from a mutable Bukkit vector. - * - * @param vector - the mutable real Bukkit vector to copy. - */ - public TARDISVector3D(Vector vector) { - if (vector == null) { - throw new IllegalArgumentException("Vector cannot be NULL."); - } - x = vector.getX(); - y = vector.getY(); - z = vector.getZ(); - } - - /** - * Adds the current vector and a given position vector, producing a result vector. - * - * @param other - the other vector. - * @return The new result vector. - */ - public TARDISVector3D add(TARDISVector3D other) { - if (other == null) { - throw new IllegalArgumentException("other cannot be NULL"); - } - return new TARDISVector3D(x + other.x, y + other.y, z + other.z); - } - - /** - * Adds the current vector and a given vector together, producing a result vector. - * - * @param x the x coordinate to add - * @param y the y coordinate to add - * @param z the z coordinate to add - * @return The new result vector. - */ - public TARDISVector3D add(double x, double y, double z) { - return new TARDISVector3D(this.x + x, this.y + y, this.z + z); - } - - /** - * Substracts the current vector and a given vector, producing a result position. - * - * @param other - the other position. - * @return The new result position. - */ - public TARDISVector3D subtract(TARDISVector3D other) { - if (other == null) { - throw new IllegalArgumentException("other cannot be NULL"); - } - return new TARDISVector3D(x - other.x, y - other.y, z - other.z); - } - - /** - * Multiply each dimension in the current vector by the given factor. - * - * @param factor - multiplier. - * @return The new result. - */ - public TARDISVector3D multiply(int factor) { - return new TARDISVector3D(x * factor, y * factor, z * factor); - } - - /** - * Multiply each dimension in the current vector by the given factor. - * - * @param factor - multiplier. - * @return The new result. - */ - public TARDISVector3D multiply(double factor) { - return new TARDISVector3D(x * factor, y * factor, z * factor); - } - - /** - * Retrieve the absolute value of this vector. - * - * @return The new result. - */ - public TARDISVector3D abs() { - return new TARDISVector3D(Math.abs(x), Math.abs(y), Math.abs(z)); - } - - @Override - public String toString() { - return String.format("[x: %s, y: %s, z: %s]", x, y, z); - } -} diff --git a/src/main/java/me/eccentric_nz/tardischemistry/TARDISChemistryCommand.java b/src/main/java/me/eccentric_nz/tardischemistry/TARDISChemistryCommand.java index 19bb1882f3..79f2d85676 100755 --- a/src/main/java/me/eccentric_nz/tardischemistry/TARDISChemistryCommand.java +++ b/src/main/java/me/eccentric_nz/tardischemistry/TARDISChemistryCommand.java @@ -28,7 +28,7 @@ import me.eccentric_nz.tardischemistry.lab.LabCommand; import me.eccentric_nz.tardischemistry.product.ProductCommand; import me.eccentric_nz.tardischemistry.reducer.ReduceCommand; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; diff --git a/src/main/java/me/eccentric_nz/tardischemistry/block/ChemistryBlockListener.java b/src/main/java/me/eccentric_nz/tardischemistry/block/ChemistryBlockListener.java index ff61314c56..17ca93d2db 100755 --- a/src/main/java/me/eccentric_nz/tardischemistry/block/ChemistryBlockListener.java +++ b/src/main/java/me/eccentric_nz/tardischemistry/block/ChemistryBlockListener.java @@ -29,7 +29,7 @@ import me.eccentric_nz.tardischemistry.lab.LabInventory; import me.eccentric_nz.tardischemistry.product.ProductInventory; import me.eccentric_nz.tardischemistry.reducer.ReducerInventory; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.GameMode; import org.bukkit.Material; import org.bukkit.block.Block; diff --git a/src/main/java/me/eccentric_nz/tardischemistry/compound/CompoundCommand.java b/src/main/java/me/eccentric_nz/tardischemistry/compound/CompoundCommand.java index 5f590d13f6..5a6374496e 100755 --- a/src/main/java/me/eccentric_nz/tardischemistry/compound/CompoundCommand.java +++ b/src/main/java/me/eccentric_nz/tardischemistry/compound/CompoundCommand.java @@ -19,7 +19,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; import me.eccentric_nz.TARDIS.enumeration.TardisModule; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; diff --git a/src/main/java/me/eccentric_nz/tardischemistry/compound/CompoundGUIListener.java b/src/main/java/me/eccentric_nz/tardischemistry/compound/CompoundGUIListener.java index aa8470c52f..e847b6ecb0 100644 --- a/src/main/java/me/eccentric_nz/tardischemistry/compound/CompoundGUIListener.java +++ b/src/main/java/me/eccentric_nz/tardischemistry/compound/CompoundGUIListener.java @@ -19,7 +19,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; import me.eccentric_nz.tardischemistry.element.Element; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; diff --git a/src/main/java/me/eccentric_nz/tardischemistry/compound/CompoundInventory.java b/src/main/java/me/eccentric_nz/tardischemistry/compound/CompoundInventory.java index ac36d42de7..b0ea933ee9 100644 --- a/src/main/java/me/eccentric_nz/tardischemistry/compound/CompoundInventory.java +++ b/src/main/java/me/eccentric_nz/tardischemistry/compound/CompoundInventory.java @@ -18,7 +18,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.custommodeldata.GUIChemistry; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; diff --git a/src/main/java/me/eccentric_nz/tardischemistry/constructor/ConstructCommand.java b/src/main/java/me/eccentric_nz/tardischemistry/constructor/ConstructCommand.java index 66198fff03..52fb9136d4 100755 --- a/src/main/java/me/eccentric_nz/tardischemistry/constructor/ConstructCommand.java +++ b/src/main/java/me/eccentric_nz/tardischemistry/constructor/ConstructCommand.java @@ -19,7 +19,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; import me.eccentric_nz.TARDIS.enumeration.TardisModule; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; diff --git a/src/main/java/me/eccentric_nz/tardischemistry/constructor/ConstructorGUIListener.java b/src/main/java/me/eccentric_nz/tardischemistry/constructor/ConstructorGUIListener.java index 5972b2eef2..8f4f371f46 100644 --- a/src/main/java/me/eccentric_nz/tardischemistry/constructor/ConstructorGUIListener.java +++ b/src/main/java/me/eccentric_nz/tardischemistry/constructor/ConstructorGUIListener.java @@ -20,7 +20,7 @@ import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; import me.eccentric_nz.tardischemistry.element.Element; import me.eccentric_nz.tardischemistry.element.ElementBuilder; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/src/main/java/me/eccentric_nz/tardischemistry/creative/CreativeCommand.java b/src/main/java/me/eccentric_nz/tardischemistry/creative/CreativeCommand.java index 30b538cacd..de671a84ba 100755 --- a/src/main/java/me/eccentric_nz/tardischemistry/creative/CreativeCommand.java +++ b/src/main/java/me/eccentric_nz/tardischemistry/creative/CreativeCommand.java @@ -20,7 +20,7 @@ import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.tardischemistry.element.ElementInventory; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; diff --git a/src/main/java/me/eccentric_nz/tardischemistry/creative/CreativeGUIListener.java b/src/main/java/me/eccentric_nz/tardischemistry/creative/CreativeGUIListener.java index e851dd8885..35bf07f375 100644 --- a/src/main/java/me/eccentric_nz/tardischemistry/creative/CreativeGUIListener.java +++ b/src/main/java/me/eccentric_nz/tardischemistry/creative/CreativeGUIListener.java @@ -18,7 +18,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.tardischemistry.element.ElementInventory; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; diff --git a/src/main/java/me/eccentric_nz/tardischemistry/element/ElementGUIListener.java b/src/main/java/me/eccentric_nz/tardischemistry/element/ElementGUIListener.java index 1e2d67b154..ea9647c579 100644 --- a/src/main/java/me/eccentric_nz/tardischemistry/element/ElementGUIListener.java +++ b/src/main/java/me/eccentric_nz/tardischemistry/element/ElementGUIListener.java @@ -19,7 +19,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.tardischemistry.creative.CompoundsCreativeInventory; import me.eccentric_nz.tardischemistry.creative.ProductsCreativeInventory; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; diff --git a/src/main/java/me/eccentric_nz/tardischemistry/formula/FormulaViewer.java b/src/main/java/me/eccentric_nz/tardischemistry/formula/FormulaViewer.java index 342e385389..c90f783c71 100644 --- a/src/main/java/me/eccentric_nz/tardischemistry/formula/FormulaViewer.java +++ b/src/main/java/me/eccentric_nz/tardischemistry/formula/FormulaViewer.java @@ -26,7 +26,7 @@ import me.eccentric_nz.tardischemistry.lab.LabBuilder; import me.eccentric_nz.tardischemistry.product.Product; import me.eccentric_nz.tardischemistry.product.ProductBuilder; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; diff --git a/src/main/java/me/eccentric_nz/tardischemistry/inventory/InventoryHelper.java b/src/main/java/me/eccentric_nz/tardischemistry/inventory/InventoryHelper.java index 8ff6acaef9..85978dbbe0 100644 --- a/src/main/java/me/eccentric_nz/tardischemistry/inventory/InventoryHelper.java +++ b/src/main/java/me/eccentric_nz/tardischemistry/inventory/InventoryHelper.java @@ -17,7 +17,7 @@ package me.eccentric_nz.tardischemistry.inventory; import me.eccentric_nz.TARDIS.TARDIS; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/src/main/java/me/eccentric_nz/tardischemistry/lab/LabCommand.java b/src/main/java/me/eccentric_nz/tardischemistry/lab/LabCommand.java index dfdf923693..6cef852da1 100755 --- a/src/main/java/me/eccentric_nz/tardischemistry/lab/LabCommand.java +++ b/src/main/java/me/eccentric_nz/tardischemistry/lab/LabCommand.java @@ -19,7 +19,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; import me.eccentric_nz.TARDIS.enumeration.TardisModule; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; diff --git a/src/main/java/me/eccentric_nz/tardischemistry/lab/LabGUIListener.java b/src/main/java/me/eccentric_nz/tardischemistry/lab/LabGUIListener.java index 7043a66105..40637dda1b 100644 --- a/src/main/java/me/eccentric_nz/tardischemistry/lab/LabGUIListener.java +++ b/src/main/java/me/eccentric_nz/tardischemistry/lab/LabGUIListener.java @@ -18,7 +18,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; diff --git a/src/main/java/me/eccentric_nz/tardischemistry/lab/LabInventory.java b/src/main/java/me/eccentric_nz/tardischemistry/lab/LabInventory.java index e79d1d6da7..756bd83237 100644 --- a/src/main/java/me/eccentric_nz/tardischemistry/lab/LabInventory.java +++ b/src/main/java/me/eccentric_nz/tardischemistry/lab/LabInventory.java @@ -18,7 +18,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.custommodeldata.GUIChemistry; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; diff --git a/src/main/java/me/eccentric_nz/tardischemistry/product/ProductCommand.java b/src/main/java/me/eccentric_nz/tardischemistry/product/ProductCommand.java index 249deacd3b..8521f1cc35 100755 --- a/src/main/java/me/eccentric_nz/tardischemistry/product/ProductCommand.java +++ b/src/main/java/me/eccentric_nz/tardischemistry/product/ProductCommand.java @@ -19,7 +19,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; import me.eccentric_nz.TARDIS.enumeration.TardisModule; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; diff --git a/src/main/java/me/eccentric_nz/tardischemistry/product/ProductGUIListener.java b/src/main/java/me/eccentric_nz/tardischemistry/product/ProductGUIListener.java index 46e0cb8a15..907d0d086e 100644 --- a/src/main/java/me/eccentric_nz/tardischemistry/product/ProductGUIListener.java +++ b/src/main/java/me/eccentric_nz/tardischemistry/product/ProductGUIListener.java @@ -18,7 +18,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; diff --git a/src/main/java/me/eccentric_nz/tardischemistry/product/ProductInventory.java b/src/main/java/me/eccentric_nz/tardischemistry/product/ProductInventory.java index 5f7fbe8a14..dce10d8bee 100644 --- a/src/main/java/me/eccentric_nz/tardischemistry/product/ProductInventory.java +++ b/src/main/java/me/eccentric_nz/tardischemistry/product/ProductInventory.java @@ -18,7 +18,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.custommodeldata.GUIChemistry; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; diff --git a/src/main/java/me/eccentric_nz/tardischemistry/product/SparklerListener.java b/src/main/java/me/eccentric_nz/tardischemistry/product/SparklerListener.java index e7751c09d9..90e7c2421d 100644 --- a/src/main/java/me/eccentric_nz/tardischemistry/product/SparklerListener.java +++ b/src/main/java/me/eccentric_nz/tardischemistry/product/SparklerListener.java @@ -17,7 +17,7 @@ package me.eccentric_nz.tardischemistry.product; import me.eccentric_nz.TARDIS.TARDIS; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.data.BlockData; diff --git a/src/main/java/me/eccentric_nz/tardischemistry/reducer/ReduceCommand.java b/src/main/java/me/eccentric_nz/tardischemistry/reducer/ReduceCommand.java index c566655d5f..63dbeb5a65 100755 --- a/src/main/java/me/eccentric_nz/tardischemistry/reducer/ReduceCommand.java +++ b/src/main/java/me/eccentric_nz/tardischemistry/reducer/ReduceCommand.java @@ -19,7 +19,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.blueprints.TARDISPermission; import me.eccentric_nz.TARDIS.enumeration.TardisModule; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; diff --git a/src/main/java/me/eccentric_nz/tardischemistry/reducer/ReducerGUIListener.java b/src/main/java/me/eccentric_nz/tardischemistry/reducer/ReducerGUIListener.java index 990a86f942..66e4d43e46 100644 --- a/src/main/java/me/eccentric_nz/tardischemistry/reducer/ReducerGUIListener.java +++ b/src/main/java/me/eccentric_nz/tardischemistry/reducer/ReducerGUIListener.java @@ -21,7 +21,7 @@ import me.eccentric_nz.tardischemistry.compound.Compound; import me.eccentric_nz.tardischemistry.element.Element; import me.eccentric_nz.tardischemistry.element.ElementBuilder; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Player; diff --git a/src/main/java/me/eccentric_nz/tardischunkgenerator/TARDISHelper.java b/src/main/java/me/eccentric_nz/tardischunkgenerator/TARDISHelper.java index 20eac21d85..6ceda3dc07 100644 --- a/src/main/java/me/eccentric_nz/tardischunkgenerator/TARDISHelper.java +++ b/src/main/java/me/eccentric_nz/tardischunkgenerator/TARDISHelper.java @@ -48,9 +48,9 @@ import org.bukkit.block.Biome; import org.bukkit.block.Block; import org.bukkit.block.data.Directional; -import org.bukkit.craftbukkit.v1_20_R4.CraftWorld; -import org.bukkit.craftbukkit.v1_20_R4.block.CraftBlock; -import org.bukkit.craftbukkit.v1_20_R4.entity.CraftVillager; +import org.bukkit.craftbukkit.v1_21_R1.CraftWorld; +import org.bukkit.craftbukkit.v1_21_R1.block.CraftBlock; +import org.bukkit.craftbukkit.v1_21_R1.entity.CraftVillager; import org.bukkit.entity.*; import org.bukkit.map.MapView; import org.bukkit.util.Vector; diff --git a/src/main/java/me/eccentric_nz/tardischunkgenerator/custombiome/BiomeHelper.java b/src/main/java/me/eccentric_nz/tardischunkgenerator/custombiome/BiomeHelper.java index 474ca1c1f8..ce71c97bd4 100644 --- a/src/main/java/me/eccentric_nz/tardischunkgenerator/custombiome/BiomeHelper.java +++ b/src/main/java/me/eccentric_nz/tardischunkgenerator/custombiome/BiomeHelper.java @@ -15,9 +15,9 @@ import org.bukkit.Bukkit; import org.bukkit.Chunk; import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_20_R4.CraftChunk; -import org.bukkit.craftbukkit.v1_20_R4.CraftServer; -import org.bukkit.craftbukkit.v1_20_R4.CraftWorld; +import org.bukkit.craftbukkit.v1_21_R1.CraftChunk; +import org.bukkit.craftbukkit.v1_21_R1.CraftServer; +import org.bukkit.craftbukkit.v1_21_R1.CraftWorld; import java.util.List; @@ -33,11 +33,11 @@ public class BiomeHelper { */ public void setCustomBiome(String newBiomeName, Chunk chunk) { WritableRegistry registryWritable = (WritableRegistry) dedicatedServer.registryAccess().registry(Registries.BIOME).get(); - ResourceKey key = ResourceKey.create(Registries.BIOME, new ResourceLocation(newBiomeName.toLowerCase())); + ResourceKey key = ResourceKey.create(Registries.BIOME, ResourceLocation.withDefaultNamespace(newBiomeName.toLowerCase())); Biome base = registryWritable.get(key); if (base == null) { if (newBiomeName.contains(":")) { - ResourceKey newKey = ResourceKey.create(Registries.BIOME, new ResourceLocation(newBiomeName.split(":")[0].toLowerCase(), newBiomeName.split(":")[1].toLowerCase())); + ResourceKey newKey = ResourceKey.create(Registries.BIOME, ResourceLocation.fromNamespaceAndPath(newBiomeName.split(":")[0].toLowerCase(), newBiomeName.split(":")[1].toLowerCase())); base = registryWritable.get(newKey); if (base == null) { return; @@ -68,11 +68,11 @@ public void setCustomBiome(String newBiomeName, Chunk chunk) { public boolean setCustomBiome(String newBiomeName, Location location) { Biome base; WritableRegistry registrywritable = (WritableRegistry) dedicatedServer.registryAccess().registry(Registries.BIOME).get(); - ResourceKey key = ResourceKey.create(Registries.BIOME, new ResourceLocation(newBiomeName.toLowerCase())); + ResourceKey key = ResourceKey.create(Registries.BIOME, ResourceLocation.withDefaultNamespace(newBiomeName.toLowerCase())); base = registrywritable.get(key); if (base == null) { if (newBiomeName.contains(":")) { - ResourceKey newKey = ResourceKey.create(Registries.BIOME, new ResourceLocation(newBiomeName.split(":")[0].toLowerCase(), newBiomeName.split(":")[1].toLowerCase())); + ResourceKey newKey = ResourceKey.create(Registries.BIOME, ResourceLocation.fromNamespaceAndPath(newBiomeName.split(":")[0].toLowerCase(), newBiomeName.split(":")[1].toLowerCase())); base = registrywritable.get(newKey); if (base == null) { return false; diff --git a/src/main/java/me/eccentric_nz/tardischunkgenerator/custombiome/CubicMaterial.java b/src/main/java/me/eccentric_nz/tardischunkgenerator/custombiome/CubicMaterial.java index 9657a7796f..deefe363b4 100644 --- a/src/main/java/me/eccentric_nz/tardischunkgenerator/custombiome/CubicMaterial.java +++ b/src/main/java/me/eccentric_nz/tardischunkgenerator/custombiome/CubicMaterial.java @@ -1,8 +1,9 @@ package me.eccentric_nz.tardischunkgenerator.custombiome; +import org.bukkit.Material; + import java.util.Arrays; import java.util.List; -import org.bukkit.Material; public class CubicMaterial { @@ -406,7 +407,29 @@ public class CubicMaterial { Material.STRIPPED_BAMBOO_BLOCK, Material.STRIPPED_CHERRY_LOG, Material.STRIPPED_CHERRY_WOOD, -// Material.SUSPICIOUS_GRAVEL, - Material.SUSPICIOUS_SAND + Material.SUSPICIOUS_GRAVEL, + Material.SUSPICIOUS_SAND, + // 1.21 blocks + Material.CHISELED_COPPER, + Material.CHISELED_TUFF, + Material.CHISELED_TUFF_BRICKS, + Material.COPPER_BULB, + Material.CRAFTER, + Material.EXPOSED_CHISELED_COPPER, + Material.EXPOSED_COPPER_BULB, + Material.OXIDIZED_CHISELED_COPPER, + Material.OXIDIZED_COPPER_BULB, + Material.POLISHED_TUFF, + Material.TUFF_BRICKS, + Material.WAXED_CHISELED_COPPER, + Material.WAXED_COPPER_BULB, + Material.WAXED_EXPOSED_CHISELED_COPPER, + Material.WAXED_EXPOSED_COPPER_BULB, + Material.WAXED_OXIDIZED_CHISELED_COPPER, + Material.WAXED_OXIDIZED_COPPER_BULB, + Material.WAXED_WEATHERED_CHISELED_COPPER, + Material.WAXED_WEATHERED_COPPER_BULB, + Material.WEATHERED_CHISELED_COPPER, + Material.WEATHERED_COPPER_BULB ); } diff --git a/src/main/java/me/eccentric_nz/tardischunkgenerator/custombiome/CustomBiome.java b/src/main/java/me/eccentric_nz/tardischunkgenerator/custombiome/CustomBiome.java index 22941f1b8e..450e081bc4 100644 --- a/src/main/java/me/eccentric_nz/tardischunkgenerator/custombiome/CustomBiome.java +++ b/src/main/java/me/eccentric_nz/tardischunkgenerator/custombiome/CustomBiome.java @@ -15,7 +15,7 @@ import net.minecraft.world.level.biome.BiomeSpecialEffects; import net.minecraft.world.level.biome.MobSpawnSettings; import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_20_R4.CraftServer; +import org.bukkit.craftbukkit.v1_21_R1.CraftServer; import java.lang.reflect.Field; import java.util.IdentityHashMap; @@ -24,8 +24,8 @@ public class CustomBiome { public static void addCustomBiome(CustomBiomeData data) { DedicatedServer dedicatedServer = ((CraftServer) Bukkit.getServer()).getServer(); - ResourceKey minecraftKey = ResourceKey.create(Registries.BIOME, new ResourceLocation("minecraft", data.getMinecraftName())); - ResourceKey customKey = ResourceKey.create(Registries.BIOME, new ResourceLocation("tardis", data.getCustomName())); + ResourceKey minecraftKey = ResourceKey.create(Registries.BIOME, ResourceLocation.withDefaultNamespace(data.getMinecraftName())); + ResourceKey customKey = ResourceKey.create(Registries.BIOME, ResourceLocation.fromNamespaceAndPath("tardis", data.getCustomName())); WritableRegistry registrywritable = (WritableRegistry) dedicatedServer.registryAccess().registryOrThrow(Registries.BIOME); Biome minecraftbiome = registrywritable.get(minecraftKey); Biome.BiomeBuilder newBiome = new Biome.BiomeBuilder(); diff --git a/src/main/java/me/eccentric_nz/tardischunkgenerator/disguise/TARDISArmourStandDisguiser.java b/src/main/java/me/eccentric_nz/tardischunkgenerator/disguise/TARDISArmourStandDisguiser.java index 58187003e9..6407f49d0d 100644 --- a/src/main/java/me/eccentric_nz/tardischunkgenerator/disguise/TARDISArmourStandDisguiser.java +++ b/src/main/java/me/eccentric_nz/tardischunkgenerator/disguise/TARDISArmourStandDisguiser.java @@ -16,9 +16,6 @@ */ package me.eccentric_nz.tardischunkgenerator.disguise; -import java.util.Map; -import java.util.UUID; - import net.minecraft.commands.arguments.EntityAnchorArgument; import net.minecraft.network.protocol.game.ClientboundAddEntityPacket; import net.minecraft.network.protocol.game.ClientboundPlayerLookAtPacket; @@ -26,20 +23,16 @@ import net.minecraft.network.protocol.game.ClientboundSetEntityDataPacket; import net.minecraft.server.network.ServerGamePacketListenerImpl; import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; import org.bukkit.Bukkit; import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_20_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_21_R1.entity.CraftPlayer; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; -; -//ClientboundRemoveEntitiesPacket -; -//ClientboundSetEntityDataPacket -; +import java.util.Map; +import java.util.UUID; public class TARDISArmourStandDisguiser { @@ -64,7 +57,7 @@ public static void disguiseToPlayer(Player to, org.bukkit.World world) { // set location setEntityLocationIdAndName(mob, stand.getLocation(), stand); ClientboundRemoveEntitiesPacket packetPlayOutEntityDestroy = new ClientboundRemoveEntitiesPacket(stand.getEntityId()); - ClientboundAddEntityPacket packetPlayOutSpawnEntityLiving = new ClientboundAddEntityPacket((LivingEntity) mob); + ClientboundAddEntityPacket packetPlayOutSpawnEntityLiving = new ClientboundAddEntityPacket(mob, 0, mob.blockPosition()); ClientboundSetEntityDataPacket packetPlayOutEntityMetadata = new ClientboundSetEntityDataPacket(mob.getId(), mob.getEntityData().getNonDefaultValues()); ClientboundPlayerLookAtPacket packetPlayOutEntityLook = new ClientboundPlayerLookAtPacket(EntityAnchorArgument.Anchor.FEET, mob.blockPosition().getX(), mob.blockPosition().getY(), mob.blockPosition().getZ()); ServerGamePacketListenerImpl connection = ((CraftPlayer) to).getHandle().connection; @@ -85,7 +78,7 @@ public static void redisguise(ArmorStand stand, org.bukkit.World world) { setEntityLocationIdAndName(mob, stand.getLocation(), stand); TARDISDisguiseTracker.DISGUISED_AS_MOB.put(stand.getUniqueId(), new TARDISDisguise(disguise.getEntityType(), disguise.getOptions())); ClientboundRemoveEntitiesPacket packetPlayOutEntityDestroy = new ClientboundRemoveEntitiesPacket(stand.getEntityId()); - ClientboundAddEntityPacket packetPlayOutSpawnEntityLiving = new ClientboundAddEntityPacket((LivingEntity) mob); + ClientboundAddEntityPacket packetPlayOutSpawnEntityLiving = new ClientboundAddEntityPacket(mob, 0, mob.blockPosition()); ClientboundSetEntityDataPacket packetPlayOutEntityMetadata = new ClientboundSetEntityDataPacket(mob.getId(), mob.getEntityData().getNonDefaultValues()); ClientboundPlayerLookAtPacket packetPlayOutEntityLook = new ClientboundPlayerLookAtPacket(EntityAnchorArgument.Anchor.FEET, mob.blockPosition().getX(), mob.blockPosition().getY(), mob.blockPosition().getZ()); for (Player p : Bukkit.getOnlinePlayers()) { @@ -140,7 +133,7 @@ private void createDisguise() { public void disguiseToAll() { TARDISDisguiseTracker.DISGUISED_AS_MOB.put(stand.getUniqueId(), new TARDISDisguise(entityType, options)); ClientboundRemoveEntitiesPacket packetPlayOutEntityDestroy = new ClientboundRemoveEntitiesPacket(stand.getEntityId()); - ClientboundAddEntityPacket packetPlayOutSpawnEntityLiving = new ClientboundAddEntityPacket((LivingEntity) entity); + ClientboundAddEntityPacket packetPlayOutSpawnEntityLiving = new ClientboundAddEntityPacket(entity, 0, entity.blockPosition()); ClientboundSetEntityDataPacket packetPlayOutEntityMetadata = new ClientboundSetEntityDataPacket(entity.getId(), entity.getEntityData().getNonDefaultValues()); ClientboundPlayerLookAtPacket packetPlayOutEntityLook = new ClientboundPlayerLookAtPacket(EntityAnchorArgument.Anchor.FEET, entity.blockPosition().getX(), entity.blockPosition().getY(), entity.blockPosition().getZ()); for (Player p : Bukkit.getOnlinePlayers()) { diff --git a/src/main/java/me/eccentric_nz/tardischunkgenerator/disguise/TARDISChameleonArchDisguiser.java b/src/main/java/me/eccentric_nz/tardischunkgenerator/disguise/TARDISChameleonArchDisguiser.java index b96fc21053..d60aa71099 100644 --- a/src/main/java/me/eccentric_nz/tardischunkgenerator/disguise/TARDISChameleonArchDisguiser.java +++ b/src/main/java/me/eccentric_nz/tardischunkgenerator/disguise/TARDISChameleonArchDisguiser.java @@ -28,7 +28,7 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.player.Player; import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_20_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_21_R1.entity.CraftPlayer; import java.lang.reflect.Field; import java.util.Arrays; @@ -59,7 +59,7 @@ public void changeSkin(String name) { GameProfile arch = new GameProfile(player.getUniqueId(), name); arch.getProperties().removeAll("textures"); arch.getProperties().put("textures", new Property("textures", archSkin, archSignature)); - Field gpField = Player.class.getDeclaredField("cC"); // cC = GameProfile + Field gpField = Player.class.getDeclaredField("cD"); // cD = GameProfile gpField.setAccessible(true); gpField.set(entityPlayer, arch); gpField.setAccessible(false); @@ -69,7 +69,7 @@ public void changeSkin(String name) { } ClientboundPlayerInfoUpdatePacket packetPlayOutPlayerInfo = new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, entityPlayer); // a = ADD_PLAYER ClientboundRemoveEntitiesPacket packetPlayOutEntityDestroy = new ClientboundRemoveEntitiesPacket(player.getEntityId()); - ClientboundAddEntityPacket packetPlayOutNamedEntitySpawn = new ClientboundAddEntityPacket(entityPlayer); + ClientboundAddEntityPacket packetPlayOutNamedEntitySpawn = new ClientboundAddEntityPacket(entityPlayer, 0, entityPlayer.blockPosition()); for (org.bukkit.entity.Player p : Bukkit.getOnlinePlayers()) { ServerPlayer ep = ((CraftPlayer) p).getHandle(); if (ep != entityPlayer && p.getWorld() == player.getWorld() && p.canSee(player)) { @@ -103,7 +103,7 @@ public void resetSkin() { nameField.set(arch, oldName); nameField.setAccessible(false); arch.getProperties().putAll(properties); - Field gpField = Player.class.getDeclaredField("cC"); // cC = GameProfile + Field gpField = Player.class.getDeclaredField("cD"); // cD = GameProfile gpField.setAccessible(true); gpField.set(entityPlayer, arch); gpField.setAccessible(false); @@ -114,7 +114,7 @@ public void resetSkin() { } ClientboundPlayerInfoUpdatePacket packetPlayOutPlayerInfo = new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, entityPlayer); ClientboundRemoveEntitiesPacket packetPlayOutEntityDestroy = new ClientboundRemoveEntitiesPacket(player.getEntityId()); - ClientboundAddEntityPacket packetPlayOutNamedEntitySpawn = new ClientboundAddEntityPacket(entityPlayer); + ClientboundAddEntityPacket packetPlayOutNamedEntitySpawn = new ClientboundAddEntityPacket(entityPlayer, 0, entityPlayer.blockPosition()); for (org.bukkit.entity.Player p : Bukkit.getOnlinePlayers()) { ServerPlayer ep = ((CraftPlayer) p).getHandle(); if (ep != entityPlayer && p.getWorld() == player.getWorld() && p.canSee(player)) { diff --git a/src/main/java/me/eccentric_nz/tardischunkgenerator/disguise/TARDISDisguise.java b/src/main/java/me/eccentric_nz/tardischunkgenerator/disguise/TARDISDisguise.java index 2f7a31ea9f..a46044b2b3 100644 --- a/src/main/java/me/eccentric_nz/tardischunkgenerator/disguise/TARDISDisguise.java +++ b/src/main/java/me/eccentric_nz/tardischunkgenerator/disguise/TARDISDisguise.java @@ -36,10 +36,10 @@ import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; import org.bukkit.World; -import org.bukkit.craftbukkit.v1_20_R4.CraftWorld; -import org.bukkit.craftbukkit.v1_20_R4.entity.CraftWolf; -import org.bukkit.craftbukkit.v1_20_R4.inventory.CraftItemStack; -import org.bukkit.craftbukkit.v1_20_R4.util.CraftNamespacedKey; +import org.bukkit.craftbukkit.v1_21_R1.CraftWorld; +import org.bukkit.craftbukkit.v1_21_R1.entity.CraftWolf; +import org.bukkit.craftbukkit.v1_21_R1.inventory.CraftItemStack; +import org.bukkit.craftbukkit.v1_21_R1.util.CraftNamespacedKey; import org.bukkit.entity.Axolotl; import org.bukkit.entity.EntityType; import org.bukkit.entity.Frog; @@ -188,9 +188,9 @@ public static Entity createMobDisguise(TARDISDisguise disguise, World w) { } try { String entityPackage = packagePath + ((hasEntityStr) ? "Entity" : "") + str; - Class entityClass = Class.forName(entityPackage); - Constructor constructor = entityClass.getConstructor(net.minecraft.world.entity.EntityType.class, net.minecraft.world.level.Level.class); - net.minecraft.world.entity.EntityType type = BuiltInRegistries.ENTITY_TYPE.get(CraftNamespacedKey.toMinecraft(disguise.getEntityType().getKey())); + Class entityClass = Class.forName(entityPackage); + Constructor constructor = entityClass.getConstructor(net.minecraft.world.entity.EntityType.class, net.minecraft.world.level.Level.class); + net.minecraft.world.entity.EntityType type = BuiltInRegistries.ENTITY_TYPE.get(CraftNamespacedKey.toMinecraft(disguise.getEntityType().getKey())); net.minecraft.world.level.Level world = ((CraftWorld) w).getHandle(); Entity entity = (Entity) constructor.newInstance(type, world); if (disguise.getOptions() != null) { diff --git a/src/main/java/me/eccentric_nz/tardischunkgenerator/disguise/TARDISDisguiser.java b/src/main/java/me/eccentric_nz/tardischunkgenerator/disguise/TARDISDisguiser.java index b4cd911c82..b76aa54606 100644 --- a/src/main/java/me/eccentric_nz/tardischunkgenerator/disguise/TARDISDisguiser.java +++ b/src/main/java/me/eccentric_nz/tardischunkgenerator/disguise/TARDISDisguiser.java @@ -20,15 +20,19 @@ import net.minecraft.network.protocol.game.ClientboundAddEntityPacket; import net.minecraft.network.protocol.game.ClientboundRemoveEntitiesPacket; import net.minecraft.network.protocol.game.ClientboundSetEntityDataPacket; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.network.ServerGamePacketListenerImpl; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; import org.bukkit.Bukkit; import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_20_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_21_R1.CraftWorld; +import org.bukkit.craftbukkit.v1_21_R1.entity.CraftPlayer; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; +import org.bukkit.event.entity.CreatureSpawnEvent; public class TARDISDisguiser { @@ -69,11 +73,13 @@ public static void disguiseToPlayer(Player to, org.bukkit.World world) { // set location setEntityLocationIdAndName(mob, p.getLocation(), p); ClientboundRemoveEntitiesPacket packetPlayOutEntityDestroy = new ClientboundRemoveEntitiesPacket(p.getEntityId()); - ClientboundAddEntityPacket packetPlayOutSpawnLivingEntity = new ClientboundAddEntityPacket(mob); + ServerLevel level = ((CraftWorld)world).getHandle(); + level.addFreshEntity(mob, CreatureSpawnEvent.SpawnReason.CUSTOM); + ClientboundAddEntityPacket packetPlayOutSpawnLivingEntity = new ClientboundAddEntityPacket(mob, 0, mob.blockPosition()); ClientboundSetEntityDataPacket packetPlayOutEntityMetadata = new ClientboundSetEntityDataPacket(mob.getId(), mob.getEntityData().getNonDefaultValues()); ServerGamePacketListenerImpl connection = ((CraftPlayer) to).getHandle().connection; connection.send(packetPlayOutEntityDestroy); - connection.send(packetPlayOutSpawnLivingEntity); +// connection.send(packetPlayOutSpawnLivingEntity); connection.send(packetPlayOutEntityMetadata); } } @@ -89,13 +95,13 @@ public static void redisguise(Player player, org.bukkit.World world) { setEntityLocationIdAndName(mob, player.getLocation(), player); TARDISDisguiseTracker.DISGUISED_AS_MOB.put(player.getUniqueId(), new TARDISDisguise(disguise.getEntityType(), disguise.getOptions())); ClientboundRemoveEntitiesPacket packetPlayOutEntityDestroy = new ClientboundRemoveEntitiesPacket(player.getEntityId()); - ClientboundAddEntityPacket packetPlayOutSpawnLivingEntity = new ClientboundAddEntityPacket((LivingEntity) mob); + ClientboundAddEntityPacket packetPlayOutSpawnLivingEntity = new ClientboundAddEntityPacket((LivingEntity) mob, 0, mob.blockPosition()); ClientboundSetEntityDataPacket packetPlayOutEntityMetadata = new ClientboundSetEntityDataPacket(mob.getId(), mob.getEntityData().getNonDefaultValues()); for (Player p : Bukkit.getOnlinePlayers()) { if (p != player && player.getWorld() == p.getWorld()) { ServerGamePacketListenerImpl connection = ((CraftPlayer) p).getHandle().connection; connection.send(packetPlayOutEntityDestroy); - connection.send(packetPlayOutSpawnLivingEntity); +// connection.send(packetPlayOutSpawnLivingEntity); connection.send(packetPlayOutEntityMetadata); } } @@ -137,7 +143,8 @@ public void removeDisguise() { } else { TARDISDisguiseTracker.DISGUISED_AS_MOB.remove(player.getUniqueId()); ClientboundRemoveEntitiesPacket packetPlayOutEntityDestroy = new ClientboundRemoveEntitiesPacket(player.getEntityId()); - ClientboundAddEntityPacket packetPlayOutNamedEntitySpawn = new ClientboundAddEntityPacket(((CraftPlayer) player).getHandle()); + ServerPlayer cp = ((CraftPlayer) player).getHandle(); + ClientboundAddEntityPacket packetPlayOutNamedEntitySpawn = new ClientboundAddEntityPacket(cp, 0, cp.blockPosition()); for (Player p : Bukkit.getOnlinePlayers()) { if (p != player && player.getWorld() == p.getWorld()) { ServerGamePacketListenerImpl connection = ((CraftPlayer) p).getHandle().connection; @@ -151,7 +158,7 @@ public void removeDisguise() { public void disguiseToAll() { TARDISDisguiseTracker.DISGUISED_AS_MOB.put(player.getUniqueId(), new TARDISDisguise(entityType, options)); ClientboundRemoveEntitiesPacket packetPlayOutEntityDestroy = new ClientboundRemoveEntitiesPacket(player.getEntityId()); - ClientboundAddEntityPacket packetPlayOutSpawnLivingEntity = new ClientboundAddEntityPacket((LivingEntity) entity); + ClientboundAddEntityPacket packetPlayOutSpawnLivingEntity = new ClientboundAddEntityPacket(entity, 0, entity.blockPosition()); ClientboundSetEntityDataPacket packetPlayOutEntityMetadata = new ClientboundSetEntityDataPacket(entity.getId(), entity.getEntityData().getNonDefaultValues()); for (Player p : Bukkit.getOnlinePlayers()) { if (p != player && player.getWorld() == p.getWorld()) { diff --git a/src/main/java/me/eccentric_nz/tardischunkgenerator/disguise/TARDISEPSDisguiser.java b/src/main/java/me/eccentric_nz/tardischunkgenerator/disguise/TARDISEPSDisguiser.java index 462bb28324..5f72fd8cba 100644 --- a/src/main/java/me/eccentric_nz/tardischunkgenerator/disguise/TARDISEPSDisguiser.java +++ b/src/main/java/me/eccentric_nz/tardischunkgenerator/disguise/TARDISEPSDisguiser.java @@ -28,10 +28,10 @@ import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.World; -import org.bukkit.craftbukkit.v1_20_R4.CraftServer; -import org.bukkit.craftbukkit.v1_20_R4.CraftWorld; -import org.bukkit.craftbukkit.v1_20_R4.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_20_R4.inventory.CraftItemStack; +import org.bukkit.craftbukkit.v1_21_R1.CraftServer; +import org.bukkit.craftbukkit.v1_21_R1.CraftWorld; +import org.bukkit.craftbukkit.v1_21_R1.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_21_R1.inventory.CraftItemStack; import org.bukkit.entity.Player; import java.util.Map; @@ -61,7 +61,7 @@ public static void disguiseToPlayer(Player player, World world) { setEntityLocation(npc, new Location(world, stand.getX(), stand.getY(), stand.getZ())); // send packets ClientboundPlayerInfoUpdatePacket packetPlayOutPlayerInfo = new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, npc); // a = ADD_PLAYER - ClientboundAddEntityPacket packetPlayOutNamedEntitySpawn = new ClientboundAddEntityPacket(npc); + ClientboundAddEntityPacket packetPlayOutNamedEntitySpawn = new ClientboundAddEntityPacket(npc, 0, npc.blockPosition()); ClientboundRotateHeadPacket packetPlayOutEntityHeadRotation = new ClientboundRotateHeadPacket(npc, (byte) npc.getYRot()); ClientboundPlayerLookAtPacket packetPlayOutEntityLook = new ClientboundPlayerLookAtPacket(EntityAnchorArgument.Anchor.FEET, npc.blockPosition().getX(), npc.blockPosition().getY(), npc.blockPosition().getZ()); ServerGamePacketListenerImpl connection = ((CraftPlayer) player).getHandle().connection; @@ -123,8 +123,8 @@ public void disguiseStand() { public int showToAll() { TARDISDisguiseTracker.DISGUISED_NPCS.put(npc.getId(), player.getUniqueId()); - ClientboundPlayerInfoUpdatePacket packetPlayOutPlayerInfo = new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, npc); // a = ADD_PLAYER - ClientboundAddEntityPacket packetPlayOutNamedEntitySpawn = new ClientboundAddEntityPacket(npc); + ClientboundPlayerInfoUpdatePacket packetPlayOutPlayerInfo = new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, npc); + ClientboundAddEntityPacket packetPlayOutNamedEntitySpawn = new ClientboundAddEntityPacket(npc, 0, npc.blockPosition()); ClientboundRotateHeadPacket packetPlayOutEntityHeadRotation = new ClientboundRotateHeadPacket(npc, (byte) npc.getYRot()); ClientboundPlayerLookAtPacket packetPlayOutEntityLook = new ClientboundPlayerLookAtPacket(EntityAnchorArgument.Anchor.FEET, npc.blockPosition().getX(), npc.blockPosition().getY(), npc.blockPosition().getZ()); for (Player p : Bukkit.getOnlinePlayers()) { diff --git a/src/main/java/me/eccentric_nz/tardischunkgenerator/disguise/TARDISPlayerDisguiser.java b/src/main/java/me/eccentric_nz/tardischunkgenerator/disguise/TARDISPlayerDisguiser.java index d76d556659..4224f713c7 100644 --- a/src/main/java/me/eccentric_nz/tardischunkgenerator/disguise/TARDISPlayerDisguiser.java +++ b/src/main/java/me/eccentric_nz/tardischunkgenerator/disguise/TARDISPlayerDisguiser.java @@ -26,7 +26,7 @@ import me.eccentric_nz.TARDIS.enumeration.TardisModule; import net.minecraft.server.level.ServerPlayer; import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_20_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_21_R1.entity.CraftPlayer; import org.bukkit.entity.Player; import javax.net.ssl.HttpsURLConnection; diff --git a/src/main/java/me/eccentric_nz/tardischunkgenerator/helpers/GetBlockColours.java b/src/main/java/me/eccentric_nz/tardischunkgenerator/helpers/GetBlockColours.java index c4de33b7a3..6ae1a9554c 100644 --- a/src/main/java/me/eccentric_nz/tardischunkgenerator/helpers/GetBlockColours.java +++ b/src/main/java/me/eccentric_nz/tardischunkgenerator/helpers/GetBlockColours.java @@ -5,7 +5,7 @@ import net.minecraft.world.level.material.MapColor; import org.bukkit.Color; import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_20_R4.util.CraftMagicNumbers; +import org.bukkit.craftbukkit.v1_21_R1.util.CraftMagicNumbers; import java.util.logging.Level; diff --git a/src/main/java/me/eccentric_nz/tardischunkgenerator/helpers/Shrieker.java b/src/main/java/me/eccentric_nz/tardischunkgenerator/helpers/Shrieker.java index 6dad0ce92b..24b5177fec 100644 --- a/src/main/java/me/eccentric_nz/tardischunkgenerator/helpers/Shrieker.java +++ b/src/main/java/me/eccentric_nz/tardischunkgenerator/helpers/Shrieker.java @@ -7,8 +7,8 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.gameevent.GameEvent; import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_20_R4.CraftWorld; -import org.bukkit.craftbukkit.v1_20_R4.block.CraftBlockState; +import org.bukkit.craftbukkit.v1_21_R1.CraftWorld; +import org.bukkit.craftbukkit.v1_21_R1.block.CraftBlockState; public class Shrieker { diff --git a/src/main/java/me/eccentric_nz/tardischunkgenerator/helpers/TARDISItemFrameFaker.java b/src/main/java/me/eccentric_nz/tardischunkgenerator/helpers/TARDISItemFrameFaker.java index c2bed3492d..50fdcf5a1a 100644 --- a/src/main/java/me/eccentric_nz/tardischunkgenerator/helpers/TARDISItemFrameFaker.java +++ b/src/main/java/me/eccentric_nz/tardischunkgenerator/helpers/TARDISItemFrameFaker.java @@ -8,9 +8,9 @@ import net.minecraft.server.network.ServerGamePacketListenerImpl; import net.minecraft.world.entity.decoration.ItemFrame; import net.minecraft.world.level.Level; -import org.bukkit.craftbukkit.v1_20_R4.CraftWorld; -import org.bukkit.craftbukkit.v1_20_R4.entity.CraftItemFrame; -import org.bukkit.craftbukkit.v1_20_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_21_R1.CraftWorld; +import org.bukkit.craftbukkit.v1_21_R1.entity.CraftItemFrame; +import org.bukkit.craftbukkit.v1_21_R1.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.util.Vector; @@ -28,7 +28,7 @@ public static int cast(org.bukkit.entity.ItemFrame frame, Player player, Vector fake.setInvisible(true); fake.fixed = true; id = fake.getId(); - ClientboundAddEntityPacket addEntityPacket = new ClientboundAddEntityPacket(fake, fake.getDirection().ordinal()); + ClientboundAddEntityPacket addEntityPacket = new ClientboundAddEntityPacket(fake, fake.getDirection().ordinal(), fake.blockPosition()); ClientboundSetEntityDataPacket entityDataPacket = new ClientboundSetEntityDataPacket(id, real.getEntityData().getNonDefaultValues()); ServerGamePacketListenerImpl connection = ((CraftPlayer) player).getHandle().connection; connection.send(addEntityPacket); diff --git a/src/main/java/me/eccentric_nz/tardischunkgenerator/helpers/TARDISMapUpdater.java b/src/main/java/me/eccentric_nz/tardischunkgenerator/helpers/TARDISMapUpdater.java index b694534ace..00a7be1635 100644 --- a/src/main/java/me/eccentric_nz/tardischunkgenerator/helpers/TARDISMapUpdater.java +++ b/src/main/java/me/eccentric_nz/tardischunkgenerator/helpers/TARDISMapUpdater.java @@ -1,20 +1,19 @@ package me.eccentric_nz.tardischunkgenerator.helpers; import com.mojang.authlib.GameProfile; - -import java.lang.reflect.Field; -import java.util.UUID; - import net.minecraft.core.BlockPos; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Items; import net.minecraft.world.item.MapItem; import net.minecraft.world.level.saveddata.maps.MapItemSavedData; import org.bukkit.World; -import org.bukkit.craftbukkit.v1_20_R4.CraftWorld; -import org.bukkit.craftbukkit.v1_20_R4.map.CraftMapView; +import org.bukkit.craftbukkit.v1_21_R1.CraftWorld; +import org.bukkit.craftbukkit.v1_21_R1.map.CraftMapView; import org.bukkit.map.MapView; +import java.lang.reflect.Field; +import java.util.UUID; + public final class TARDISMapUpdater extends Player { public static final UUID ID = UUID.randomUUID(); diff --git a/src/main/java/me/eccentric_nz/tardischunkgenerator/helpers/TARDISPacketListener.java b/src/main/java/me/eccentric_nz/tardischunkgenerator/helpers/TARDISPacketListener.java index 3360af897b..6324118cb0 100644 --- a/src/main/java/me/eccentric_nz/tardischunkgenerator/helpers/TARDISPacketListener.java +++ b/src/main/java/me/eccentric_nz/tardischunkgenerator/helpers/TARDISPacketListener.java @@ -38,8 +38,8 @@ import net.minecraft.world.ticks.LevelChunkTicks; import org.bukkit.Bukkit; import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_20_R4.CraftChunk; -import org.bukkit.craftbukkit.v1_20_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_21_R1.CraftChunk; +import org.bukkit.craftbukkit.v1_21_R1.entity.CraftPlayer; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; diff --git a/src/main/java/me/eccentric_nz/tardischunkgenerator/worldgen/feature/CustomTree.java b/src/main/java/me/eccentric_nz/tardischunkgenerator/worldgen/feature/CustomTree.java index 7c90aa7f4f..fc1df3b51a 100644 --- a/src/main/java/me/eccentric_nz/tardischunkgenerator/worldgen/feature/CustomTree.java +++ b/src/main/java/me/eccentric_nz/tardischunkgenerator/worldgen/feature/CustomTree.java @@ -6,8 +6,8 @@ import net.minecraft.world.level.chunk.ChunkGenerator; import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_20_R4.CraftRegionAccessor; -import org.bukkit.craftbukkit.v1_20_R4.CraftWorld; +import org.bukkit.craftbukkit.v1_21_R1.CraftRegionAccessor; +import org.bukkit.craftbukkit.v1_21_R1.CraftWorld; import org.bukkit.generator.LimitedRegion; public class CustomTree { diff --git a/src/main/java/me/eccentric_nz/tardischunkgenerator/worldgen/feature/TreePlacer.java b/src/main/java/me/eccentric_nz/tardischunkgenerator/worldgen/feature/TreePlacer.java index c70bd98049..4b3dc6f3d3 100644 --- a/src/main/java/me/eccentric_nz/tardischunkgenerator/worldgen/feature/TreePlacer.java +++ b/src/main/java/me/eccentric_nz/tardischunkgenerator/worldgen/feature/TreePlacer.java @@ -13,7 +13,7 @@ import net.minecraft.world.level.levelgen.blockpredicates.BlockPredicate; import net.minecraft.world.level.levelgen.feature.WeepingVinesFeature; import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_20_R4.block.data.CraftBlockData; +import org.bukkit.craftbukkit.v1_21_R1.block.data.CraftBlockData; public class TreePlacer { diff --git a/src/main/java/me/eccentric_nz/tardischunkgenerator/worldgen/populators/GallifreyGrassPopulator.java b/src/main/java/me/eccentric_nz/tardischunkgenerator/worldgen/populators/GallifreyGrassPopulator.java index a0319643a7..ceec693cbd 100644 --- a/src/main/java/me/eccentric_nz/tardischunkgenerator/worldgen/populators/GallifreyGrassPopulator.java +++ b/src/main/java/me/eccentric_nz/tardischunkgenerator/worldgen/populators/GallifreyGrassPopulator.java @@ -1,17 +1,17 @@ package me.eccentric_nz.tardischunkgenerator.worldgen.populators; -import java.util.Random; - import me.eccentric_nz.tardischunkgenerator.worldgen.feature.GrassPlacer; import me.eccentric_nz.tardischunkgenerator.worldgen.feature.TARDISFeatures; import net.minecraft.core.BlockPos; import net.minecraft.world.level.WorldGenLevel; import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_20_R4.CraftRegionAccessor; +import org.bukkit.craftbukkit.v1_21_R1.CraftRegionAccessor; import org.bukkit.generator.BlockPopulator; import org.bukkit.generator.LimitedRegion; import org.bukkit.generator.WorldInfo; +import java.util.Random; + public class GallifreyGrassPopulator extends BlockPopulator { @Override diff --git a/src/main/java/me/eccentric_nz/tardisshop/ShopItem.java b/src/main/java/me/eccentric_nz/tardisshop/ShopItem.java index 2d43cb4de0..9f0386e593 100644 --- a/src/main/java/me/eccentric_nz/tardisshop/ShopItem.java +++ b/src/main/java/me/eccentric_nz/tardisshop/ShopItem.java @@ -133,7 +133,7 @@ public enum ShopItem { TARDIS_REMOTE_KEY("TARDIS Remote Key", Material.GOLD_NUGGET, 15), TARDIS_SCANNER_CIRCUIT("TARDIS Scanner Circuit", Material.GLOWSTONE_DUST, 10001977), TARDIS_STATTENHEIM_CIRCUIT("TARDIS Stattenheim Circuit", Material.GLOWSTONE_DUST, 10001963), - TARDIS_TELEPATHIC_CIRCUIT("TARDIS Telepathic Circuit", Material.DAYLIGHT_DETECTOR, 10000001), + TARDIS_TELEPATHIC_CIRCUIT("TARDIS Telepathic Circuit", Material.GLOWSTONE_DUST, 10001962), TARDIS_TEMPORAL_CIRCUIT("TARDIS Temporal Circuit", Material.GLOWSTONE_DUST, 10001974), THIRTEENTH_SEED("Thirteenth Seed", Material.HORN_CORAL_BLOCK, 10001, ShopItemRecipe.SEED), THREE_D_GLASSES("3-D Glasses", Material.LEATHER_HELMET, 10000039), diff --git a/src/main/java/me/eccentric_nz/tardisshop/TARDISShopCommand.java b/src/main/java/me/eccentric_nz/tardisshop/TARDISShopCommand.java index 35a7da8e9c..b6c131c94f 100755 --- a/src/main/java/me/eccentric_nz/tardisshop/TARDISShopCommand.java +++ b/src/main/java/me/eccentric_nz/tardisshop/TARDISShopCommand.java @@ -12,7 +12,7 @@ import me.eccentric_nz.tardisshop.database.InsertShopItem; import me.eccentric_nz.tardisshop.database.ResultSetUpdateShop; import me.eccentric_nz.tardisshop.database.UpdateShopItem; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; diff --git a/src/main/java/me/eccentric_nz/tardisshop/TARDISShopItemSpawner.java b/src/main/java/me/eccentric_nz/tardisshop/TARDISShopItemSpawner.java index 9e621eee73..e64a5b5d80 100644 --- a/src/main/java/me/eccentric_nz/tardisshop/TARDISShopItemSpawner.java +++ b/src/main/java/me/eccentric_nz/tardisshop/TARDISShopItemSpawner.java @@ -3,7 +3,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.TARDISConstants; import me.eccentric_nz.TARDIS.utility.TARDISStringUtils; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Display; diff --git a/src/main/java/me/eccentric_nz/tardisvortexmanipulator/command/TVMCommandGUI.java b/src/main/java/me/eccentric_nz/tardisvortexmanipulator/command/TVMCommandGUI.java index 5c43c4ddbf..af8aa85f32 100644 --- a/src/main/java/me/eccentric_nz/tardisvortexmanipulator/command/TVMCommandGUI.java +++ b/src/main/java/me/eccentric_nz/tardisvortexmanipulator/command/TVMCommandGUI.java @@ -19,7 +19,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.tardisvortexmanipulator.database.TVMResultSetManipulator; import me.eccentric_nz.tardisvortexmanipulator.gui.TVMGUI; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; diff --git a/src/main/java/me/eccentric_nz/tardisvortexmanipulator/gui/TVMGUIListener.java b/src/main/java/me/eccentric_nz/tardisvortexmanipulator/gui/TVMGUIListener.java index a5ae5ce959..15e2f06882 100644 --- a/src/main/java/me/eccentric_nz/tardisvortexmanipulator/gui/TVMGUIListener.java +++ b/src/main/java/me/eccentric_nz/tardisvortexmanipulator/gui/TVMGUIListener.java @@ -12,7 +12,7 @@ import me.eccentric_nz.TARDIS.listeners.TARDISMenuListener; import me.eccentric_nz.tardisvortexmanipulator.TVMUtils; import me.eccentric_nz.tardisvortexmanipulator.database.TVMQueryFactory; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.World; diff --git a/src/main/java/me/eccentric_nz/tardisvortexmanipulator/gui/TVMMessageGUIListener.java b/src/main/java/me/eccentric_nz/tardisvortexmanipulator/gui/TVMMessageGUIListener.java index 9bdd6f7bdc..0a4280c17e 100644 --- a/src/main/java/me/eccentric_nz/tardisvortexmanipulator/gui/TVMMessageGUIListener.java +++ b/src/main/java/me/eccentric_nz/tardisvortexmanipulator/gui/TVMMessageGUIListener.java @@ -10,7 +10,7 @@ import me.eccentric_nz.tardisvortexmanipulator.TVMUtils; import me.eccentric_nz.tardisvortexmanipulator.database.TVMQueryFactory; import me.eccentric_nz.tardisvortexmanipulator.database.TVMResultSetMessageById; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.inventory.InventoryClickEvent; diff --git a/src/main/java/me/eccentric_nz/tardisvortexmanipulator/gui/TVMSavesGUIListener.java b/src/main/java/me/eccentric_nz/tardisvortexmanipulator/gui/TVMSavesGUIListener.java index d60ce9abca..9c558cfef7 100644 --- a/src/main/java/me/eccentric_nz/tardisvortexmanipulator/gui/TVMSavesGUIListener.java +++ b/src/main/java/me/eccentric_nz/tardisvortexmanipulator/gui/TVMSavesGUIListener.java @@ -9,7 +9,7 @@ import me.eccentric_nz.tardisvortexmanipulator.TVMUtils; import me.eccentric_nz.tardisvortexmanipulator.database.TVMQueryFactory; import me.eccentric_nz.tardisvortexmanipulator.database.TVMResultSetWarpByName; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/src/main/java/me/eccentric_nz/tardisvortexmanipulator/listeners/TVMEquipListener.java b/src/main/java/me/eccentric_nz/tardisvortexmanipulator/listeners/TVMEquipListener.java index 0bc8d3da17..ec6723f66d 100644 --- a/src/main/java/me/eccentric_nz/tardisvortexmanipulator/listeners/TVMEquipListener.java +++ b/src/main/java/me/eccentric_nz/tardisvortexmanipulator/listeners/TVMEquipListener.java @@ -13,7 +13,7 @@ import me.eccentric_nz.tardisvortexmanipulator.database.TVMQueryFactory; import me.eccentric_nz.tardisvortexmanipulator.database.TVMResultSetManipulator; import me.eccentric_nz.tardisvortexmanipulator.gui.TVMGUI; -import net.md_5.bungee.api.ChatColor; +import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/src/main/java/me/eccentric_nz/tardisweepingangels/commands/EquipCommand.java b/src/main/java/me/eccentric_nz/tardisweepingangels/commands/EquipCommand.java index e08e6b9307..c987db1cdc 100644 --- a/src/main/java/me/eccentric_nz/tardisweepingangels/commands/EquipCommand.java +++ b/src/main/java/me/eccentric_nz/tardisweepingangels/commands/EquipCommand.java @@ -18,12 +18,11 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.enumeration.TardisModule; +import me.eccentric_nz.TARDIS.sonic.actions.TARDISSonicFreeze; import me.eccentric_nz.tardisweepingangels.TARDISWeepingAngels; import me.eccentric_nz.tardisweepingangels.equip.ArmourStandEquipment; import me.eccentric_nz.tardisweepingangels.monsters.headless_monks.HeadlessFlameRunnable; -import me.eccentric_nz.tardisweepingangels.monsters.weeping_angels.Blink; import me.eccentric_nz.tardisweepingangels.utils.Monster; -import me.eccentric_nz.tardisweepingangels.utils.Vector3D; import org.bukkit.Location; import org.bukkit.command.CommandSender; import org.bukkit.entity.ArmorStand; @@ -34,6 +33,7 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.persistence.PersistentDataType; +import org.bukkit.util.Vector; public class EquipCommand { @@ -66,17 +66,17 @@ public boolean equip(CommandSender sender, String[] args) { } // get the armour stand player is looking at Location observerPos = player.getEyeLocation(); - Vector3D observerDir = new Vector3D(observerPos.getDirection()); - Vector3D observerStart = new Vector3D(observerPos); - Vector3D observerEnd = observerStart.add(observerDir.multiply(16)); + Vector observerDir = observerPos.getDirection(); + Vector observerStart = observerPos.toVector(); + Vector observerEnd = observerStart.add(observerDir.multiply(16)); ArmorStand as = null; // Get nearby entities for (Entity target : player.getNearbyEntities(8.0d, 8.0d, 8.0d)) { // Bounding box of the given player - Vector3D targetPos = new Vector3D(target.getLocation()); - Vector3D minimum = targetPos.add(-0.5, 0, -0.5); - Vector3D maximum = targetPos.add(0.5, 1.67, 0.5); - if (target.getType().equals(EntityType.ARMOR_STAND) && Blink.hasIntersection(observerStart, observerEnd, minimum, maximum)) { + Vector targetPos = target.getLocation().toVector(); + Vector minimum = targetPos.add(new Vector(-0.5, 0, -0.5)); + Vector maximum = targetPos.add(new Vector(0.5, 1.67, 0.5)); + if (target.getType().equals(EntityType.ARMOR_STAND) && TARDISSonicFreeze.hasIntersection(observerStart, observerEnd, minimum, maximum)) { if (as == null || as.getLocation().distanceSquared(observerPos) > target.getLocation().distanceSquared(observerPos)) { as = (ArmorStand) target; } diff --git a/src/main/java/me/eccentric_nz/tardisweepingangels/commands/FollowCommand.java b/src/main/java/me/eccentric_nz/tardisweepingangels/commands/FollowCommand.java index 5a2f7d886b..a30b6fb3d0 100644 --- a/src/main/java/me/eccentric_nz/tardisweepingangels/commands/FollowCommand.java +++ b/src/main/java/me/eccentric_nz/tardisweepingangels/commands/FollowCommand.java @@ -23,13 +23,12 @@ import me.eccentric_nz.tardisweepingangels.utils.Follow; import me.eccentric_nz.tardisweepingangels.utils.FollowerFinder; import org.bukkit.command.CommandSender; -import org.bukkit.craftbukkit.v1_20_R4.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_21_R1.entity.CraftEntity; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.Husk; import org.bukkit.entity.Player; import org.bukkit.persistence.PersistentDataContainer; -import org.bukkit.persistence.PersistentDataType; public class FollowCommand { diff --git a/src/main/java/me/eccentric_nz/tardisweepingangels/commands/StayCommand.java b/src/main/java/me/eccentric_nz/tardisweepingangels/commands/StayCommand.java index 669407d051..e2cea5c535 100644 --- a/src/main/java/me/eccentric_nz/tardisweepingangels/commands/StayCommand.java +++ b/src/main/java/me/eccentric_nz/tardisweepingangels/commands/StayCommand.java @@ -23,7 +23,7 @@ import me.eccentric_nz.tardisweepingangels.utils.Follow; import me.eccentric_nz.tardisweepingangels.utils.FollowerFinder; import org.bukkit.command.CommandSender; -import org.bukkit.craftbukkit.v1_20_R4.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_21_R1.entity.CraftEntity; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; diff --git a/src/main/java/me/eccentric_nz/tardisweepingangels/death/Death.java b/src/main/java/me/eccentric_nz/tardisweepingangels/death/Death.java index 36487fdbc0..ae122b7008 100644 --- a/src/main/java/me/eccentric_nz/tardisweepingangels/death/Death.java +++ b/src/main/java/me/eccentric_nz/tardisweepingangels/death/Death.java @@ -28,7 +28,7 @@ import net.citizensnpcs.api.CitizensAPI; import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_20_R4.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_21_R1.entity.CraftEntity; import org.bukkit.entity.*; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; diff --git a/src/main/java/me/eccentric_nz/tardisweepingangels/monsters/judoon/JudoonGuardRunnable.java b/src/main/java/me/eccentric_nz/tardisweepingangels/monsters/judoon/JudoonGuardRunnable.java index eaaa4b97dd..8d00ed0615 100644 --- a/src/main/java/me/eccentric_nz/tardisweepingangels/monsters/judoon/JudoonGuardRunnable.java +++ b/src/main/java/me/eccentric_nz/tardisweepingangels/monsters/judoon/JudoonGuardRunnable.java @@ -22,7 +22,7 @@ import me.eccentric_nz.tardisweepingangels.nms.TWAJudoon; import org.bukkit.Bukkit; import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_20_R4.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_21_R1.entity.CraftEntity; import org.bukkit.entity.*; import org.bukkit.util.BlockIterator; import org.bukkit.util.Vector; diff --git a/src/main/java/me/eccentric_nz/tardisweepingangels/monsters/judoon/JudoonListener.java b/src/main/java/me/eccentric_nz/tardisweepingangels/monsters/judoon/JudoonListener.java index d845f6573a..37a886fb85 100644 --- a/src/main/java/me/eccentric_nz/tardisweepingangels/monsters/judoon/JudoonListener.java +++ b/src/main/java/me/eccentric_nz/tardisweepingangels/monsters/judoon/JudoonListener.java @@ -26,7 +26,7 @@ import org.bukkit.Material; import org.bukkit.Tag; import org.bukkit.block.ShulkerBox; -import org.bukkit.craftbukkit.v1_20_R4.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_21_R1.entity.CraftEntity; import org.bukkit.entity.Husk; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/src/main/java/me/eccentric_nz/tardisweepingangels/monsters/ood/OodEquipment.java b/src/main/java/me/eccentric_nz/tardisweepingangels/monsters/ood/OodEquipment.java index c43e692f41..5d4fd82816 100644 --- a/src/main/java/me/eccentric_nz/tardisweepingangels/monsters/ood/OodEquipment.java +++ b/src/main/java/me/eccentric_nz/tardisweepingangels/monsters/ood/OodEquipment.java @@ -23,7 +23,7 @@ import me.eccentric_nz.tardisweepingangels.utils.Monster; import org.bukkit.Material; import org.bukkit.OfflinePlayer; -import org.bukkit.craftbukkit.v1_20_R4.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_21_R1.entity.CraftEntity; import org.bukkit.entity.Entity; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; diff --git a/src/main/java/me/eccentric_nz/tardisweepingangels/monsters/ood/OodListener.java b/src/main/java/me/eccentric_nz/tardisweepingangels/monsters/ood/OodListener.java index f5eea2ff55..ee323a3488 100644 --- a/src/main/java/me/eccentric_nz/tardisweepingangels/monsters/ood/OodListener.java +++ b/src/main/java/me/eccentric_nz/tardisweepingangels/monsters/ood/OodListener.java @@ -21,7 +21,7 @@ import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.tardisweepingangels.TARDISWeepingAngels; import me.eccentric_nz.tardisweepingangels.nms.TWAOod; -import org.bukkit.craftbukkit.v1_20_R4.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_21_R1.entity.CraftEntity; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/src/main/java/me/eccentric_nz/tardisweepingangels/monsters/toclafane/ToclafaneListener.java b/src/main/java/me/eccentric_nz/tardisweepingangels/monsters/toclafane/ToclafaneListener.java index 27a5fe617c..a1a99c9908 100644 --- a/src/main/java/me/eccentric_nz/tardisweepingangels/monsters/toclafane/ToclafaneListener.java +++ b/src/main/java/me/eccentric_nz/tardisweepingangels/monsters/toclafane/ToclafaneListener.java @@ -24,7 +24,7 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.attribute.Attribute; -import org.bukkit.craftbukkit.v1_20_R4.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_21_R1.entity.CraftEntity; import org.bukkit.entity.*; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; diff --git a/src/main/java/me/eccentric_nz/tardisweepingangels/monsters/weeping_angels/Blink.java b/src/main/java/me/eccentric_nz/tardisweepingangels/monsters/weeping_angels/Blink.java index 6746c6cede..037e12cff8 100755 --- a/src/main/java/me/eccentric_nz/tardisweepingangels/monsters/weeping_angels/Blink.java +++ b/src/main/java/me/eccentric_nz/tardisweepingangels/monsters/weeping_angels/Blink.java @@ -19,8 +19,8 @@ import me.eccentric_nz.TARDIS.TARDIS; import me.eccentric_nz.TARDIS.TARDISConstants; import me.eccentric_nz.TARDIS.enumeration.TardisModule; +import me.eccentric_nz.TARDIS.sonic.actions.TARDISSonicFreeze; import me.eccentric_nz.tardisweepingangels.utils.Monster; -import me.eccentric_nz.tardisweepingangels.utils.Vector3D; import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.entity.Skeleton; @@ -31,6 +31,7 @@ import org.bukkit.inventory.EntityEquipment; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; +import org.bukkit.util.Vector; import java.util.ArrayList; import java.util.List; @@ -48,46 +49,22 @@ public Blink(TARDIS plugin) { message.add("And don't blink. Good Luck."); } - public static boolean hasIntersection(Vector3D p1, Vector3D p2, Vector3D min, Vector3D max) { - double epsilon = 0.0001f; - Vector3D d = p2.subtract(p1).multiply(0.5); - Vector3D e = max.subtract(min).multiply(0.5); - Vector3D c = p1.add(d).subtract(min.add(max).multiply(0.5)); - Vector3D ad = d.abs(); - if (Math.abs(c.x) > e.x + ad.x) { - return false; - } - if (Math.abs(c.y) > e.y + ad.y) { - return false; - } - if (Math.abs(c.z) > e.z + ad.z) { - return false; - } - if (Math.abs(d.y * c.z - d.z * c.y) > e.y * ad.z + e.z * ad.y + epsilon) { - return false; - } - if (Math.abs(d.z * c.x - d.x * c.z) > e.z * ad.x + e.x * ad.z + epsilon) { - return false; - } - return Math.abs(d.x * c.y - d.y * c.x) <= e.x * ad.y + e.y * ad.x + epsilon; - } - @EventHandler(priority = EventPriority.NORMAL) public void onToggleSneak(PlayerToggleSneakEvent event) { Player player = event.getPlayer(); Location observerPos = player.getEyeLocation(); - Vector3D observerDir = new Vector3D(observerPos.getDirection()); - Vector3D observerStart = new Vector3D(observerPos); - Vector3D observerEnd = observerStart.add(observerDir.multiply(16)); + Vector observerDir = observerPos.getDirection(); + Vector observerStart = observerPos.toVector(); + Vector observerEnd = observerStart.add(observerDir.multiply(16)); Skeleton skeleton = null; // Get nearby entities for (Skeleton target : player.getWorld().getEntitiesByClass(Skeleton.class)) { // Bounding box of the given player - Vector3D targetPos = new Vector3D(target.getLocation()); - Vector3D minimum = targetPos.add(-0.5, 0, -0.5); - Vector3D maximum = targetPos.add(0.5, 1.67, 0.5); - if (hasIntersection(observerStart, observerEnd, minimum, maximum)) { + Vector targetPos = target.getLocation().toVector(); + Vector minimum = targetPos.add(new Vector(-0.5, 0, -0.5)); + Vector maximum = targetPos.add(new Vector(0.5, 1.67, 0.5)); + if (TARDISSonicFreeze.hasIntersection(observerStart, observerEnd, minimum, maximum)) { if (skeleton == null || skeleton.getLocation().distanceSquared(observerPos) > target.getLocation().distanceSquared(observerPos)) { // is it an angel? EntityEquipment ee = target.getEquipment(); diff --git a/src/main/java/me/eccentric_nz/tardisweepingangels/nms/EntityRegistry.java b/src/main/java/me/eccentric_nz/tardisweepingangels/nms/EntityRegistry.java index 6a617509b4..c5df11acc3 100644 --- a/src/main/java/me/eccentric_nz/tardisweepingangels/nms/EntityRegistry.java +++ b/src/main/java/me/eccentric_nz/tardisweepingangels/nms/EntityRegistry.java @@ -50,7 +50,7 @@ public void init() { try { unfreezeEntityRegistry(); for (String ENTITY_ID : all) { - ResourceLocation mcKey = new ResourceLocation(ENTITY_ID); + ResourceLocation mcKey = ResourceLocation.withDefaultNamespace(ENTITY_ID); if (BuiltInRegistries.ENTITY_TYPE.getOptional(mcKey).isEmpty()) { @SuppressWarnings("unchecked") Map> types = (Map>) DataFixers.getDataFixer().getSchema(DataFixUtils.makeKey(SharedConstants.getCurrentVersion().getDataVersion().getVersion())).findChoiceType(References.ENTITY).types(); types.put(mcKey.toString(), types.get(BuiltInRegistries.ENTITY_TYPE.getKey(EntityType.HUSK).toString())); diff --git a/src/main/java/me/eccentric_nz/tardisweepingangels/nms/FollowPathFinder.java b/src/main/java/me/eccentric_nz/tardisweepingangels/nms/FollowPathFinder.java index 951c50def1..f3bbc6e210 100644 --- a/src/main/java/me/eccentric_nz/tardisweepingangels/nms/FollowPathFinder.java +++ b/src/main/java/me/eccentric_nz/tardisweepingangels/nms/FollowPathFinder.java @@ -9,7 +9,7 @@ import net.minecraft.world.level.pathfinder.PathType; import net.minecraft.world.level.pathfinder.WalkNodeEvaluator; import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_20_R4.event.CraftEventFactory; +import org.bukkit.craftbukkit.v1_21_R1.event.CraftEventFactory; import org.bukkit.event.entity.EntityTeleportEvent; import java.util.EnumSet; diff --git a/src/main/java/me/eccentric_nz/tardisweepingangels/nms/FollowerSaver.java b/src/main/java/me/eccentric_nz/tardisweepingangels/nms/FollowerSaver.java index 866029f61e..fcbded0ca4 100644 --- a/src/main/java/me/eccentric_nz/tardisweepingangels/nms/FollowerSaver.java +++ b/src/main/java/me/eccentric_nz/tardisweepingangels/nms/FollowerSaver.java @@ -2,7 +2,7 @@ import me.eccentric_nz.TARDIS.TARDIS; import org.bukkit.World; -import org.bukkit.craftbukkit.v1_20_R4.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_21_R1.entity.CraftEntity; import org.bukkit.entity.Entity; import org.bukkit.entity.Husk; diff --git a/src/main/java/me/eccentric_nz/tardisweepingangels/nms/MonsterSpawner.java b/src/main/java/me/eccentric_nz/tardisweepingangels/nms/MonsterSpawner.java index 869f112e5d..77a2bfd953 100644 --- a/src/main/java/me/eccentric_nz/tardisweepingangels/nms/MonsterSpawner.java +++ b/src/main/java/me/eccentric_nz/tardisweepingangels/nms/MonsterSpawner.java @@ -8,7 +8,7 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.EntityType; import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_20_R4.CraftWorld; +import org.bukkit.craftbukkit.v1_21_R1.CraftWorld; import org.bukkit.entity.LivingEntity; import org.bukkit.event.entity.CreatureSpawnEvent; diff --git a/src/main/java/me/eccentric_nz/tardisweepingangels/nms/TWADrowned.java b/src/main/java/me/eccentric_nz/tardisweepingangels/nms/TWADrowned.java index 76ffb79937..e7a7ab0018 100644 --- a/src/main/java/me/eccentric_nz/tardisweepingangels/nms/TWADrowned.java +++ b/src/main/java/me/eccentric_nz/tardisweepingangels/nms/TWADrowned.java @@ -21,7 +21,7 @@ import net.minecraft.world.entity.monster.Drowned; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; -import org.bukkit.craftbukkit.v1_20_R4.inventory.CraftItemStack; +import org.bukkit.craftbukkit.v1_21_R1.inventory.CraftItemStack; import org.bukkit.inventory.meta.ItemMeta; /** diff --git a/src/main/java/me/eccentric_nz/tardisweepingangels/nms/TWAFollower.java b/src/main/java/me/eccentric_nz/tardisweepingangels/nms/TWAFollower.java index 221c16186e..40ca859407 100644 --- a/src/main/java/me/eccentric_nz/tardisweepingangels/nms/TWAFollower.java +++ b/src/main/java/me/eccentric_nz/tardisweepingangels/nms/TWAFollower.java @@ -16,7 +16,7 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_20_R4.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_21_R1.entity.CraftPlayer; import org.jetbrains.annotations.Nullable; import java.util.Optional; diff --git a/src/main/java/me/eccentric_nz/tardisweepingangels/nms/TWAJudoon.java b/src/main/java/me/eccentric_nz/tardisweepingangels/nms/TWAJudoon.java index 4d57cb17a8..34130ac969 100644 --- a/src/main/java/me/eccentric_nz/tardisweepingangels/nms/TWAJudoon.java +++ b/src/main/java/me/eccentric_nz/tardisweepingangels/nms/TWAJudoon.java @@ -3,7 +3,7 @@ import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; -import org.bukkit.craftbukkit.v1_20_R4.inventory.CraftItemStack; +import org.bukkit.craftbukkit.v1_21_R1.inventory.CraftItemStack; import org.bukkit.inventory.meta.ItemMeta; import java.util.UUID; diff --git a/src/main/java/me/eccentric_nz/tardisweepingangels/nms/TWAK9.java b/src/main/java/me/eccentric_nz/tardisweepingangels/nms/TWAK9.java index 7c9cba9030..e5ccad3ee9 100644 --- a/src/main/java/me/eccentric_nz/tardisweepingangels/nms/TWAK9.java +++ b/src/main/java/me/eccentric_nz/tardisweepingangels/nms/TWAK9.java @@ -3,7 +3,7 @@ import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; -import org.bukkit.craftbukkit.v1_20_R4.inventory.CraftItemStack; +import org.bukkit.craftbukkit.v1_21_R1.inventory.CraftItemStack; import org.bukkit.inventory.meta.ItemMeta; import java.util.UUID; diff --git a/src/main/java/me/eccentric_nz/tardisweepingangels/nms/TWAOod.java b/src/main/java/me/eccentric_nz/tardisweepingangels/nms/TWAOod.java index 1972215b19..e8785586fe 100644 --- a/src/main/java/me/eccentric_nz/tardisweepingangels/nms/TWAOod.java +++ b/src/main/java/me/eccentric_nz/tardisweepingangels/nms/TWAOod.java @@ -4,7 +4,7 @@ import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; -import org.bukkit.craftbukkit.v1_20_R4.inventory.CraftItemStack; +import org.bukkit.craftbukkit.v1_21_R1.inventory.CraftItemStack; import org.bukkit.inventory.meta.ItemMeta; import java.util.UUID; diff --git a/src/main/java/me/eccentric_nz/tardisweepingangels/nms/TWAPiglinBrute.java b/src/main/java/me/eccentric_nz/tardisweepingangels/nms/TWAPiglinBrute.java index 8258f4870f..0385d340ec 100644 --- a/src/main/java/me/eccentric_nz/tardisweepingangels/nms/TWAPiglinBrute.java +++ b/src/main/java/me/eccentric_nz/tardisweepingangels/nms/TWAPiglinBrute.java @@ -21,7 +21,7 @@ import net.minecraft.world.entity.monster.piglin.PiglinBrute; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; -import org.bukkit.craftbukkit.v1_20_R4.inventory.CraftItemStack; +import org.bukkit.craftbukkit.v1_21_R1.inventory.CraftItemStack; import org.bukkit.inventory.meta.ItemMeta; /** diff --git a/src/main/java/me/eccentric_nz/tardisweepingangels/nms/TWASkeleton.java b/src/main/java/me/eccentric_nz/tardisweepingangels/nms/TWASkeleton.java index 222c66d2ce..e1c98a453e 100644 --- a/src/main/java/me/eccentric_nz/tardisweepingangels/nms/TWASkeleton.java +++ b/src/main/java/me/eccentric_nz/tardisweepingangels/nms/TWASkeleton.java @@ -23,7 +23,7 @@ import net.minecraft.world.entity.monster.Skeleton; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; -import org.bukkit.craftbukkit.v1_20_R4.inventory.CraftItemStack; +import org.bukkit.craftbukkit.v1_21_R1.inventory.CraftItemStack; import org.bukkit.inventory.meta.ItemMeta; /** diff --git a/src/main/java/me/eccentric_nz/tardisweepingangels/nms/TWAZombie.java b/src/main/java/me/eccentric_nz/tardisweepingangels/nms/TWAZombie.java index ceab742b07..fa3ffbb2a1 100644 --- a/src/main/java/me/eccentric_nz/tardisweepingangels/nms/TWAZombie.java +++ b/src/main/java/me/eccentric_nz/tardisweepingangels/nms/TWAZombie.java @@ -21,7 +21,7 @@ import net.minecraft.world.entity.monster.Zombie; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; -import org.bukkit.craftbukkit.v1_20_R4.inventory.CraftItemStack; +import org.bukkit.craftbukkit.v1_21_R1.inventory.CraftItemStack; import org.bukkit.inventory.meta.ItemMeta; /** diff --git a/src/main/java/me/eccentric_nz/tardisweepingangels/nms/TWAZombifiedPiglin.java b/src/main/java/me/eccentric_nz/tardisweepingangels/nms/TWAZombifiedPiglin.java index dc47999c2b..ef1da759af 100644 --- a/src/main/java/me/eccentric_nz/tardisweepingangels/nms/TWAZombifiedPiglin.java +++ b/src/main/java/me/eccentric_nz/tardisweepingangels/nms/TWAZombifiedPiglin.java @@ -21,7 +21,7 @@ import net.minecraft.world.entity.monster.ZombifiedPiglin; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; -import org.bukkit.craftbukkit.v1_20_R4.inventory.CraftItemStack; +import org.bukkit.craftbukkit.v1_21_R1.inventory.CraftItemStack; import org.bukkit.inventory.meta.ItemMeta; /** diff --git a/src/main/java/me/eccentric_nz/tardisweepingangels/utils/ChunkListener.java b/src/main/java/me/eccentric_nz/tardisweepingangels/utils/ChunkListener.java index c549de4d88..8c875ddf71 100644 --- a/src/main/java/me/eccentric_nz/tardisweepingangels/utils/ChunkListener.java +++ b/src/main/java/me/eccentric_nz/tardisweepingangels/utils/ChunkListener.java @@ -25,7 +25,7 @@ import me.eccentric_nz.tardisweepingangels.nms.FollowerPersister; import me.eccentric_nz.tardisweepingangels.nms.TWAFollower; import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_20_R4.entity.CraftZombie; +import org.bukkit.craftbukkit.v1_21_R1.entity.CraftZombie; import org.bukkit.entity.*; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -48,65 +48,73 @@ public ChunkListener(TARDIS plugin) { public void onChunkLoad(ChunkLoadEvent event) { for (Entity d : event.getChunk().getEntities()) { PersistentDataContainer pdc = d.getPersistentDataContainer(); - if (d instanceof Skeleton skeleton) { - if (pdc.has(TARDISWeepingAngels.DALEK, PersistentDataType.INTEGER)) { - DalekEquipment.set(skeleton, false); - } else if (pdc.has(TARDISWeepingAngels.ANGEL, PersistentDataType.INTEGER)) { - new Equipper(Monster.WEEPING_ANGEL, skeleton, false, false).setHelmetAndInvisibilty(); - } else if (pdc.has(TARDISWeepingAngels.SILURIAN, PersistentDataType.INTEGER)) { - new Equipper(Monster.SILURIAN, skeleton, false, false).setHelmetAndInvisibilty(); - } else if (pdc.has(TARDISWeepingAngels.MONK, PersistentDataType.INTEGER)) { - new Equipper(Monster.HEADLESS_MONK, skeleton, false, false).setHelmetAndInvisibilty(); - // restart flame runnable? - int flameID = plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, new HeadlessFlameRunnable(skeleton), 1, 20); - pdc.set(TARDISWeepingAngels.FLAME_TASK, PersistentDataType.INTEGER, flameID); + switch (d) { + case Skeleton skeleton -> { + if (pdc.has(TARDISWeepingAngels.DALEK, PersistentDataType.INTEGER)) { + DalekEquipment.set(skeleton, false); + } else if (pdc.has(TARDISWeepingAngels.ANGEL, PersistentDataType.INTEGER)) { + new Equipper(Monster.WEEPING_ANGEL, skeleton, false, false).setHelmetAndInvisibilty(); + } else if (pdc.has(TARDISWeepingAngels.SILURIAN, PersistentDataType.INTEGER)) { + new Equipper(Monster.SILURIAN, skeleton, false, false).setHelmetAndInvisibilty(); + } else if (pdc.has(TARDISWeepingAngels.MONK, PersistentDataType.INTEGER)) { + new Equipper(Monster.HEADLESS_MONK, skeleton, false, false).setHelmetAndInvisibilty(); + // restart flame runnable? + int flameID = plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, new HeadlessFlameRunnable(skeleton), 1, 20); + pdc.set(TARDISWeepingAngels.FLAME_TASK, PersistentDataType.INTEGER, flameID); + } } - } else if (d instanceof PigZombie pigZombie) { - if (pdc.has(TARDISWeepingAngels.WARRIOR, PersistentDataType.INTEGER)) { - new Equipper(Monster.ICE_WARRIOR, pigZombie, false, false).setHelmetAndInvisibilty(); - } else if (pdc.has(TARDISWeepingAngels.STRAX, PersistentDataType.INTEGER)) { - new Equipper(Monster.STRAX, pigZombie, false, false).setHelmetAndInvisibilty(); - } else if (pdc.has(TARDISWeepingAngels.HATH, PersistentDataType.INTEGER)) { - new Equipper(Monster.HATH, pigZombie, false, false).setHelmetAndInvisibilty(); - } else if (pdc.has(TARDISWeepingAngels.DALEK_SEC, PersistentDataType.INTEGER)) { - new Equipper(Monster.DALEK_SEC, pigZombie, false, false).setHelmetAndInvisibilty(); - } else if (pdc.has(TARDISWeepingAngels.DAVROS, PersistentDataType.INTEGER)) { - new Equipper(Monster.DAVROS, pigZombie, false, false).setHelmetAndInvisibilty(); + case PigZombie pigZombie -> { + if (pdc.has(TARDISWeepingAngels.WARRIOR, PersistentDataType.INTEGER)) { + new Equipper(Monster.ICE_WARRIOR, pigZombie, false, false).setHelmetAndInvisibilty(); + } else if (pdc.has(TARDISWeepingAngels.STRAX, PersistentDataType.INTEGER)) { + new Equipper(Monster.STRAX, pigZombie, false, false).setHelmetAndInvisibilty(); + } else if (pdc.has(TARDISWeepingAngels.HATH, PersistentDataType.INTEGER)) { + new Equipper(Monster.HATH, pigZombie, false, false).setHelmetAndInvisibilty(); + } else if (pdc.has(TARDISWeepingAngels.DALEK_SEC, PersistentDataType.INTEGER)) { + new Equipper(Monster.DALEK_SEC, pigZombie, false, false).setHelmetAndInvisibilty(); + } else if (pdc.has(TARDISWeepingAngels.DAVROS, PersistentDataType.INTEGER)) { + new Equipper(Monster.DAVROS, pigZombie, false, false).setHelmetAndInvisibilty(); + } } - } else if (d instanceof Drowned drowned) { - if (drowned.getEquipment().getHelmet() != null) { - ItemMeta im = drowned.getEquipment().getHelmet().getItemMeta(); - if (im != null && im.hasDisplayName() && im.getDisplayName().endsWith(" Head")) { - if (pdc.has(TARDISWeepingAngels.DEVIL, PersistentDataType.INTEGER)) { - new Equipper(Monster.SEA_DEVIL, drowned, false, false, true).setHelmetAndInvisibilty(); - } else { - Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, drowned::remove, 2L); + case Drowned drowned -> { + if (drowned.getEquipment().getHelmet() != null) { + ItemMeta im = drowned.getEquipment().getHelmet().getItemMeta(); + if (im != null && im.hasDisplayName() && im.getDisplayName().endsWith(" Head" )) { + if (pdc.has(TARDISWeepingAngels.DEVIL, PersistentDataType.INTEGER)) { + new Equipper(Monster.SEA_DEVIL, drowned, false, false, true).setHelmetAndInvisibilty(); + } else { + Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, drowned::remove, 2L); + } } } } - } else if (d instanceof Zombie zombie) { - if (d instanceof Husk husk) { - new ResetMonster(plugin, husk).reset(); - } else { - if (pdc.has(TARDISWeepingAngels.CYBERMAN, PersistentDataType.INTEGER)) { - new Equipper(Monster.CYBERMAN, zombie, false, false).setHelmetAndInvisibilty(); - } else if (pdc.has(TARDISWeepingAngels.EMPTY, PersistentDataType.INTEGER)) { - new Equipper(Monster.EMPTY_CHILD, zombie, false, false).setHelmetAndInvisibilty(); - EmptyChildEquipment.setSpeed(zombie); - } else if (zombie.getPersistentDataContainer().has(TARDISWeepingAngels.SLITHEEN, PersistentDataType.INTEGER)) { - new Equipper(Monster.SLITHEEN, zombie, false).setHelmetAndInvisibilty(); - } else if (pdc.has(TARDISWeepingAngels.SONTARAN, PersistentDataType.INTEGER)) { - new Equipper(Monster.SONTARAN, zombie, false, false).setHelmetAndInvisibilty(); - } else if (pdc.has(TARDISWeepingAngels.VASHTA, PersistentDataType.INTEGER)) { - new Equipper(Monster.VASHTA_NERADA, zombie, false, false).setHelmetAndInvisibilty(); - } else if (pdc.has(TARDISWeepingAngels.ZYGON, PersistentDataType.INTEGER)) { - new Equipper(Monster.ZYGON, zombie, false, false).setHelmetAndInvisibilty(); + case Zombie zombie -> { + if (d instanceof Husk husk) { + new ResetMonster(plugin, husk).reset(); + } else { + if (pdc.has(TARDISWeepingAngels.CYBERMAN, PersistentDataType.INTEGER)) { + new Equipper(Monster.CYBERMAN, zombie, false, false).setHelmetAndInvisibilty(); + } else if (pdc.has(TARDISWeepingAngels.EMPTY, PersistentDataType.INTEGER)) { + new Equipper(Monster.EMPTY_CHILD, zombie, false, false).setHelmetAndInvisibilty(); + EmptyChildEquipment.setSpeed(zombie); + } else if (zombie.getPersistentDataContainer().has(TARDISWeepingAngels.SLITHEEN, PersistentDataType.INTEGER)) { + new Equipper(Monster.SLITHEEN, zombie, false).setHelmetAndInvisibilty(); + } else if (pdc.has(TARDISWeepingAngels.SONTARAN, PersistentDataType.INTEGER)) { + new Equipper(Monster.SONTARAN, zombie, false, false).setHelmetAndInvisibilty(); + } else if (pdc.has(TARDISWeepingAngels.VASHTA, PersistentDataType.INTEGER)) { + new Equipper(Monster.VASHTA_NERADA, zombie, false, false).setHelmetAndInvisibilty(); + } else if (pdc.has(TARDISWeepingAngels.ZYGON, PersistentDataType.INTEGER)) { + new Equipper(Monster.ZYGON, zombie, false, false).setHelmetAndInvisibilty(); + } } } - } else if (d instanceof ArmorStand stand && stand.getPersistentDataContainer().has(TARDISWeepingAngels.FLAME_TASK, PersistentDataType.INTEGER)) { - // restart flame runnable - int flameID = plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, new HeadlessFlameRunnable(stand), 1, 20); - pdc.set(TARDISWeepingAngels.FLAME_TASK, PersistentDataType.INTEGER, flameID); + case ArmorStand stand when stand.getPersistentDataContainer().has(TARDISWeepingAngels.FLAME_TASK, PersistentDataType.INTEGER) -> { + // restart flame runnable + int flameID = plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, new HeadlessFlameRunnable(stand), 1, 20); + pdc.set(TARDISWeepingAngels.FLAME_TASK, PersistentDataType.INTEGER, flameID); + } + default -> { + } } } } diff --git a/src/main/java/me/eccentric_nz/tardisweepingangels/utils/Follow.java b/src/main/java/me/eccentric_nz/tardisweepingangels/utils/Follow.java index 21d8cf6807..6e57a1fdbb 100644 --- a/src/main/java/me/eccentric_nz/tardisweepingangels/utils/Follow.java +++ b/src/main/java/me/eccentric_nz/tardisweepingangels/utils/Follow.java @@ -21,7 +21,7 @@ import me.eccentric_nz.TARDIS.enumeration.TardisModule; import me.eccentric_nz.tardisweepingangels.TARDISWeepingAngels; import me.eccentric_nz.tardisweepingangels.nms.TWAFollower; -import org.bukkit.craftbukkit.v1_20_R4.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_21_R1.entity.CraftEntity; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; diff --git a/src/main/java/me/eccentric_nz/tardisweepingangels/utils/FollowerChecker.java b/src/main/java/me/eccentric_nz/tardisweepingangels/utils/FollowerChecker.java index f73ead7855..4b088dfa54 100644 --- a/src/main/java/me/eccentric_nz/tardisweepingangels/utils/FollowerChecker.java +++ b/src/main/java/me/eccentric_nz/tardisweepingangels/utils/FollowerChecker.java @@ -22,7 +22,7 @@ import me.eccentric_nz.tardisweepingangels.nms.TWAFollower; import me.eccentric_nz.tardisweepingangels.nms.TWAJudoon; import me.eccentric_nz.tardisweepingangels.nms.TWAOod; -import org.bukkit.craftbukkit.v1_20_R4.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_21_R1.entity.CraftEntity; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.persistence.PersistentDataContainer; diff --git a/src/main/java/me/eccentric_nz/tardisweepingangels/utils/FollowerFinder.java b/src/main/java/me/eccentric_nz/tardisweepingangels/utils/FollowerFinder.java index ad89bb53ef..c6ed053a90 100644 --- a/src/main/java/me/eccentric_nz/tardisweepingangels/utils/FollowerFinder.java +++ b/src/main/java/me/eccentric_nz/tardisweepingangels/utils/FollowerFinder.java @@ -16,31 +16,32 @@ */ package me.eccentric_nz.tardisweepingangels.utils; -import me.eccentric_nz.tardisweepingangels.monsters.weeping_angels.Blink; +import me.eccentric_nz.TARDIS.sonic.actions.TARDISSonicFreeze; import org.bukkit.Location; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; +import org.bukkit.util.Vector; public class FollowerFinder { public static Entity getEntity(Player player, EntityType type) { - Entity entity = null; +// Entity entity = null; // get the entity the player is looking at Location observerPos = player.getEyeLocation(); - Vector3D observerDir = new Vector3D(observerPos.getDirection()); - Vector3D observerStart = new Vector3D(observerPos); - Vector3D observerEnd = observerStart.add(observerDir.multiply(16)); + Vector observerDir = observerPos.getDirection(); + Vector observerStart = observerPos.toVector(); + Vector observerEnd = observerStart.add(observerDir.multiply(16)); // Get nearby entities for (Entity target : player.getNearbyEntities(8.0d, 8.0d, 8.0d)) { // Bounding box of the given player - Vector3D targetPos = new Vector3D(target.getLocation()); - Vector3D minimum = targetPos.add(-0.5, 0, -0.5); - Vector3D maximum = targetPos.add(0.5, 1.67, 0.5); - if (target.getType().equals(type) && Blink.hasIntersection(observerStart, observerEnd, minimum, maximum)) { - if (entity == null || entity.getLocation().distanceSquared(observerPos) > target.getLocation().distanceSquared(observerPos)) { - return target; - } + Vector targetPos = target.getLocation().toVector(); + Vector minimum = targetPos.add(new Vector(-0.5, 0, -0.5)); + Vector maximum = targetPos.add(new Vector(0.5, 1.67, 0.5)); + if (target.getType().equals(type) && TARDISSonicFreeze.hasIntersection(observerStart, observerEnd, minimum, maximum)) { +// if (entity == null || entity.getLocation().distanceSquared(observerPos) > target.getLocation().distanceSquared(observerPos)) { + return target; +// } } } return null; diff --git a/src/main/java/me/eccentric_nz/tardisweepingangels/utils/MonsterInteractListener.java b/src/main/java/me/eccentric_nz/tardisweepingangels/utils/MonsterInteractListener.java index 280d6877f6..431d32a933 100644 --- a/src/main/java/me/eccentric_nz/tardisweepingangels/utils/MonsterInteractListener.java +++ b/src/main/java/me/eccentric_nz/tardisweepingangels/utils/MonsterInteractListener.java @@ -25,7 +25,7 @@ import me.eccentric_nz.tardisweepingangels.nms.TWAFollower; import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_20_R4.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_21_R1.entity.CraftEntity; import org.bukkit.entity.*; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; diff --git a/src/main/java/me/eccentric_nz/tardisweepingangels/utils/MonsterLoadUnloadListener.java b/src/main/java/me/eccentric_nz/tardisweepingangels/utils/MonsterLoadUnloadListener.java index 5960311ef4..63b9bd5b81 100644 --- a/src/main/java/me/eccentric_nz/tardisweepingangels/utils/MonsterLoadUnloadListener.java +++ b/src/main/java/me/eccentric_nz/tardisweepingangels/utils/MonsterLoadUnloadListener.java @@ -21,7 +21,7 @@ import me.eccentric_nz.tardisweepingangels.equip.MonsterEquipment; import me.eccentric_nz.tardisweepingangels.nms.FollowerPersister; import me.eccentric_nz.tardisweepingangels.nms.TWAFollower; -import org.bukkit.craftbukkit.v1_20_R4.entity.CraftZombie; +import org.bukkit.craftbukkit.v1_21_R1.entity.CraftZombie; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.event.EventHandler; diff --git a/src/main/java/me/eccentric_nz/tardisweepingangels/utils/ResetMonster.java b/src/main/java/me/eccentric_nz/tardisweepingangels/utils/ResetMonster.java index 2d57c596e9..5962f3e81d 100644 --- a/src/main/java/me/eccentric_nz/tardisweepingangels/utils/ResetMonster.java +++ b/src/main/java/me/eccentric_nz/tardisweepingangels/utils/ResetMonster.java @@ -17,7 +17,7 @@ import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.OfflinePlayer; -import org.bukkit.craftbukkit.v1_20_R4.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_21_R1.entity.CraftEntity; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; diff --git a/src/main/resources/blocks.yml b/src/main/resources/blocks.yml index c5532b065b..159b1a13a9 100644 --- a/src/main/resources/blocks.yml +++ b/src/main/resources/blocks.yml @@ -32,6 +32,7 @@ tardis_blocks: - CHERRY_LOG - CHERRY_PLANKS - CHISELED_BOOKSHELF + - CHISELED_COPPER - CHISELED_DEEPSLATE - CHISELED_NETHER_BRICKS - CHISELED_POLISHED_BLACKSTONE @@ -39,11 +40,15 @@ tardis_blocks: - CHISELED_RED_SANDSTONE - CHISELED_SANDSTONE - CHISELED_STONE_BRICKS + - CHISELED_TUFF + - CHISELED_TUFF_BRICKS - CLAY - COARSE_DIRT - COBBLED_DEEPSLATE - COBBLESTONE - COPPER_BLOCK + - COPPER_BULB + - COPPER_GRATE - CRACKED_DEEPSLATE_BRICKS - CRACKED_DEEPSLATE_TILES - CRACKED_NETHER_BRICKS @@ -69,7 +74,9 @@ tardis_blocks: - DRIPSTONE_BLOCK - END_STONE - END_STONE_BRICKS + - EXPOSED_CHISELED_COPPER - EXPOSED_COPPER + - EXPOSED_COPPER_GRATE - EXPOSED_CUT_COPPER - GRANITE - GRAY_CONCRETE @@ -117,7 +124,10 @@ tardis_blocks: - ORANGE_GLAZED_TERRACOTTA - ORANGE_TERRACOTTA - ORANGE_WOOL + - OXIDIZED_CHISELED_COPPER - OXIDIZED_COPPER + - OXIDIZED_COPPER_BULB + - OXIDIZED_COPPER_GRATE - OXIDIZED_CUT_COPPER - PACKED_ICE - PACKED_MUD @@ -133,6 +143,7 @@ tardis_blocks: - POLISHED_DEEPSLATE - POLISHED_DIORITE - POLISHED_GRANITE + - POLISHED_TUFF - PRISMARINE - PRISMARINE_BRICKS - PURPLE_CONCRETE @@ -178,20 +189,35 @@ tardis_blocks: - STRIPPED_WARPED_STEM - TERRACOTTA - TUFF + - TUFF_BRICKS - WARPED_HYPHAE - WARPED_NYLIUM - WARPED_PLANKS - WARPED_STEM - WARPED_WART_BLOCK + - WAXED_CHISELED_COPPER - WAXED_COPPER_BLOCK + - WAXED_COPPER_BULB + - WAXED_COPPER_GRATE - WAXED_CUT_COPPER + - WAXED_EXPOSED_CHISELED_COPPER - WAXED_EXPOSED_COPPER + - WAXED_EXPOSED_COPPER_BULB + - WAXED_EXPOSED_COPPER_GRATE - WAXED_EXPOSED_CUT_COPPER + - WAXED_OXIDIZED_CHISELED_COPPER - WAXED_OXIDIZED_COPPER + - WAXED_OXIDIZED_COPPER_BULB + - WAXED_OXIDIZED_COPPER_GRATE - WAXED_OXIDIZED_CUT_COPPER + - WAXED_WEATHERED_CHISELED_COPPER - WAXED_WEATHERED_COPPER + - WAXED_WEATHERED_COPPER_BULB + - WAXED_WEATHERED_COPPER_GRATE - WAXED_WEATHERED_CUT_COPPER + - WEATHERED_CHISELED_COPPER - WEATHERED_COPPER + - WEATHERED_COPPER_GRATE - WEATHERED_CUT_COPPER - WHITE_CONCRETE - WHITE_GLAZED_TERRACOTTA @@ -243,9 +269,12 @@ chameleon_blocks: - CHERRY_LOG - CHERRY_PLANKS - CHISELED_BOOKSHELF + - CHISELED_COPPER - CHISELED_DEEPSLATE - CHISELED_NETHER_BRICKS - CHISELED_POLISHED_BLACKSTONE + - CHISELED_TUFF + - CHISELED_TUFF_BRICKS - CLAY - COAL_BLOCK - COAL_ORE @@ -253,6 +282,9 @@ chameleon_blocks: - COBBLED_DEEPSLATE - COBBLESTONE - COPPER_BLOCK + - COPPER_BULB + - COPPER_BULB + - COPPER_GRATE - CRACKED_DEEPSLATE_BRICKS - CRACKED_DEEPSLATE_TILES - CRACKED_NETHER_BRICKS @@ -284,7 +316,10 @@ chameleon_blocks: - EMERALD_ORE - END_STONE - END_STONE_BRICKS + - EXPOSED_CHISELED_COPPER - EXPOSED_COPPER + - EXPOSED_COPPER_BULB + - EXPOSED_COPPER_GRATE - EXPOSED_CUT_COPPER - GLASS - GLOWSTONE @@ -361,7 +396,11 @@ chameleon_blocks: - ORANGE_STAINED_GLASS - ORANGE_TERRACOTTA - ORANGE_WOOL + - OXIDIZED_CHISELED_COPPER - OXIDIZED_COPPER + - OXIDIZED_COPPER_BULB + - OXIDIZED_COPPER_BULB + - OXIDIZED_COPPER_GRATE - OXIDIZED_CUT_COPPER - PACKED_ICE - PACKED_MUD @@ -376,6 +415,7 @@ chameleon_blocks: - POLISHED_BLACKSTONE - POLISHED_BLACKSTONE_BRICKS - POLISHED_DEEPSLATE + - POLISHED_TUFF - PRISMARINE - PUMPKIN - PURPLE_CARPET @@ -427,20 +467,40 @@ chameleon_blocks: - TERRACOTTA - TNT - TUFF + - TUFF_BRICKS - WARPED_HYPHAE - WARPED_NYLIUM - WARPED_PLANKS - WARPED_STEM - WARPED_WART_BLOCK + - WAXED_CHISELED_COPPER - WAXED_COPPER_BLOCK + - WAXED_COPPER_BULB + - WAXED_COPPER_BULB + - WAXED_COPPER_GRATE - WAXED_CUT_COPPER + - WAXED_EXPOSED_CHISELED_COPPER - WAXED_EXPOSED_COPPER + - WAXED_EXPOSED_COPPER_BULB + - WAXED_EXPOSED_COPPER_BULB + - WAXED_EXPOSED_COPPER_GRATE - WAXED_EXPOSED_CUT_COPPER + - WAXED_OXIDIZED_CHISELED_COPPER - WAXED_OXIDIZED_COPPER + - WAXED_OXIDIZED_COPPER_BULB + - WAXED_OXIDIZED_COPPER_BULB + - WAXED_OXIDIZED_COPPER_GRATE - WAXED_OXIDIZED_CUT_COPPER + - WAXED_WEATHERED_CHISELED_COPPER - WAXED_WEATHERED_COPPER + - WAXED_WEATHERED_COPPER_BULB + - WAXED_WEATHERED_COPPER_BULB + - WAXED_WEATHERED_COPPER_GRATE - WAXED_WEATHERED_CUT_COPPER + - WEATHERED_CHISELED_COPPER - WEATHERED_COPPER + - WEATHERED_COPPER_BULB + - WEATHERED_COPPER_GRATE - WEATHERED_CUT_COPPER - WHITE_CARPET - WHITE_CONCRETE @@ -455,11 +515,14 @@ chameleon_blocks: - YELLOW_TERRACOTTA - YELLOW_WOOL lamp_blocks: + - COPPER_BULB + - EXPOSED_COPPER_BULB - GLOWSTONE - JACK_O_LANTERN - LANTERN - LIGHT - OCHRE_FROGLIGHT + - OXIDIZED_COPPER_BULB - PEARLESCENT_FROGLIGHT - REDSTONE_LAMP - REDSTONE_TORCH @@ -468,6 +531,11 @@ lamp_blocks: - SOUL_LANTERN - TORCH - VERDANT_FROGLIGHT + - WAXED_COPPER_BULB + - WAXED_EXPOSED_COPPER_BULB + - WAXED_OXIDIZED_COPPER_BULB + - WAXED_WEATHERED_COPPER_BULB + - WEATHERED_COPPER_BULB under_door_blocks: - ACACIA_BUTTON - ACACIA_DOOR @@ -577,6 +645,8 @@ under_door_blocks: - COBBLESTONE_STAIRS - COBBLESTONE_WALL - COBWEB + - COPPER_DOOR + - COPPER_TRAPDOOR - CRIMSON_BUTTON - CRIMSON_DOOR - CRIMSON_FENCE @@ -629,6 +699,8 @@ under_door_blocks: - END_PORTAL_FRAME - END_ROD - END_STONE_BRICK_WALL + - EXPOSED_COPPER_DOOR + - EXPOSED_COPPER_TRAPDOOR - EXPOSED_CUT_COPPER_SLAB - EXPOSED_CUT_COPPER_STAIRS - FARMLAND @@ -658,6 +730,7 @@ under_door_blocks: - GREEN_SHULKER_BOX - GREEN_WALL_BANNER - HANGING_ROOTS + - HEAVY_CORE - HEAVY_WEIGHTED_PRESSURE_PLATE - ICE - IRON_BARS @@ -760,6 +833,8 @@ under_door_blocks: - ORANGE_TULIP - ORANGE_WALL_BANNER - OXEYE_DAISY + - OXIDIZED_COPPER_DOOR + - OXIDIZED_COPPER_TRAPDOOR - OXIDIZED_CUT_COPPER_SLAB - OXIDIZED_CUT_COPPER_STAIRS - PEONY @@ -785,6 +860,9 @@ under_door_blocks: - POLISHED_DEEPSLATE_SLAB - POLISHED_DEEPSLATE_STAIRS - POLISHED_DEEPSLATE_WALL + - POLISHED_TUFF_SLAB + - POLISHED_TUFF_STAIRS + - POLISHED_TUFF_WALL - POPPY - POWDER_SNOW - POWDER_SNOW_CAULDRON @@ -858,6 +936,12 @@ under_door_blocks: - TORCHFLOWER_CROP - TRIPWIRE - TRIPWIRE_HOOK + - TUFF_BRICK_SLAB + - TUFF_BRICK_STAIRS + - TUFF_BRICK_WALL + - TUFF_SLAB + - TUFF_STAIRS + - TUFF_WALL - TWISTING_VINES - VINE - VOID_AIR @@ -878,14 +962,24 @@ under_door_blocks: - WARPED_WALL_SIGN - WATER - WATER_CAULDRON + - WAXED_COPPER_DOOR + - WAXED_COPPER_TRAPDOOR - WAXED_CUT_COPPER_SLAB - WAXED_CUT_COPPER_STAIRS + - WAXED_EXPOSED_COPPER_DOOR + - WAXED_EXPOSED_COPPER_TRAPDOOR - WAXED_EXPOSED_CUT_COPPER_SLAB - WAXED_EXPOSED_CUT_COPPER_STAIRS + - WAXED_OXIDIZED_COPPER_DOOR + - WAXED_OXIDIZED_COPPER_TRAPDOOR - WAXED_OXIDIZED_CUT_COPPER_SLAB - WAXED_OXIDIZED_CUT_COPPER_STAIRS + - WAXED_WEATHERED_COPPER_DOOR + - WAXED_WEATHERED_COPPER_TRAPDOOR - WAXED_WEATHERED_CUT_COPPER_SLAB - WAXED_WEATHERED_CUT_COPPER_STAIRS + - WEATHERED_COPPER_DOOR + - WEATHERED_COPPER_TRAPDOOR - WEATHERED_CUT_COPPER_SLAB - WEATHERED_CUT_COPPER_STAIRS - WEEPING_VINES diff --git a/src/main/resources/condensables.yml b/src/main/resources/condensables.yml index f3d9d35bb6..fc2d081106 100644 --- a/src/main/resources/condensables.yml +++ b/src/main/resources/condensables.yml @@ -28,6 +28,7 @@ ANGLER_POTTERY_SHERD: 20 ANVIL: 200 APPLE: 10 ARCHER_POTTERY_SHERD: 20 +ARMADILLO_SCUTE: 20 ARMOR_STAND: 8 ARMS_UP_POTTERY_SHERD: 20 ARROW: 4 @@ -131,6 +132,7 @@ BRAIN_CORAL: 2 BRAIN_CORAL_BLOCK: 2 BRAIN_CORAL_FAN: 2 BREAD: 30 +BREEZE_ROD: 200 BREWER_POTTERY_SHERD: 20 BREWING_STAND: 200 BRICK: 5 @@ -193,6 +195,7 @@ CHEST_MINECART: 30 CHICKEN: 5 CHIPPED_ANVIL: 180 CHISELED_BOOKSHELF: 20 +CHISELED_COPPER: 360 CHISELED_DEEPSLATE: 3 CHISELED_NETHER_BRICKS: 1 CHISELED_POLISHED_BLACKSTONE: 1 @@ -200,6 +203,8 @@ CHISELED_QUARTZ_BLOCK: 60 CHISELED_RED_SANDSTONE: 3 CHISELED_SANDSTONE: 3 CHISELED_STONE_BRICKS: 4 +CHISELED_TUFF: 2 +CHISELED_TUFF_BRICKS: 4 CHORUS_FLOWER: 12 CHORUS_FRUIT: 4 CHORUS_PLANT: 4 @@ -236,13 +241,18 @@ COOKED_RABBIT: 7 COOKED_SALMON: 7 COOKIE: 3 COPPER_BLOCK: 180 +COPPER_BULB: 700 +COPPER_DOOR: 40 +COPPER_GRATE: 180 COPPER_INGOT: 20 +COPPER_TRAPDOOR: 60 CORNFLOWER: 2 CRACKED_DEEPSLATE_BRICKS: 4 CRACKED_DEEPSLATE_TILES: 2 CRACKED_NETHER_BRICKS: 1 CRACKED_POLISHED_BLACKSTONE_BRICKS: 2 CRACKED_STONE_BRICKS: 4 +CRAFTER: 210 CRAFTING_TABLE: 3 CREEPER_HEAD: 200 CRIMSON_BUTTON: 1 @@ -372,7 +382,12 @@ END_STONE_BRICK_SLAB: 21 END_STONE_BRICK_WALL: 21 EXPERIENCE_BOTTLE: 800 EXPLORER_POTTERY_SHERD: 20 +EXPOSED_CHISELED_COPPER: 360 EXPOSED_COPPER: 180 +EXPOSED_COPPER_BULB: 700 +EXPOSED_COPPER_DOOR: 40 +EXPOSED_COPPER_GRATE: 180 +EXPOSED_COPPER_TRAPDOOR: 60 EXPOSED_CUT_COPPER: 180 EXPOSED_CUT_COPPER_SLAB: 90 EXPOSED_CUT_COPPER_STAIRS: 120 @@ -393,6 +408,7 @@ FLINT_AND_STEEL: 24 FLOWERING_AZALEA: 2 FLOWERING_AZALEA_LEAVES: 2 FLOWER_POT: 15 +FLOW_POTTERY_SHERD: 20 FRIEND_POTTERY_SHERD: 20 FROSTED_ICE: 4 FURNACE: 9 @@ -430,7 +446,6 @@ GRANITE: 1 GRANITE_SLAB: 2 GRANITE_STAIRS: 2 GRANITE_WALL: 2 -SHORT_GRASS: 1 GRASS_BLOCK: 1 GRAVEL: 1 GRAY_BANNER: 120 @@ -463,11 +478,13 @@ GREEN_WALL_BANNER: 120 GREEN_WOOL: 20 GRINDSTONE: 30 GUNPOWDER: 20 +GUSTER_POTTERY_SHERD: 20 HANGING_ROOTS: 2 HAY_BLOCK: 81 HEARTBREAK_POTTERY_SHERD: 20 HEART_OF_THE_SEA: 200 HEART_POTTERY_SHERD: 20 +HEAVY_CORE: 300 HEAVY_WEIGHTED_PRESSURE_PLATE: 144 HONEYCOMB_BLOCK: 80 HOPPER: 110 @@ -603,7 +620,7 @@ MAGENTA_STAINED_GLASS_PANE: 6 MAGENTA_TERRACOTTA: 15 MAGENTA_WALL_BANNER: 120 MAGENTA_WOOL: 20 -MAGMA_BLOCK: 600 +MAGMA_BLOCK: 60 MAGMA_CREAM: 150 MANGROVE_BOAT: 3 MANGROVE_BUTTON: 1 @@ -720,7 +737,12 @@ ORANGE_TULIP: 2 ORANGE_WALL_BANNER: 120 ORANGE_WOOL: 20 OXEYE_DAISY: 2 +OXIDIZED_CHISELED_COPPER: 360 OXIDIZED_COPPER: 180 +OXIDIZED_COPPER_BULB: 700 +OXIDIZED_COPPER_DOOR: 40 +OXIDIZED_COPPER_GRATE: 180 +OXIDIZED_COPPER_TRAPDOOR: 60 OXIDIZED_CUT_COPPER: 180 OXIDIZED_CUT_COPPER_SLAB: 90 OXIDIZED_CUT_COPPER_STAIRS: 120 @@ -779,6 +801,10 @@ POLISHED_DIORITE_STAIRS: 1 POLISHED_GRANITE: 1 POLISHED_GRANITE_SLAB: 1 POLISHED_GRANITE_STAIRS: 1 +POLISHED_TUFF: 2 +POLISHED_TUFF_SLAB: 2 +POLISHED_TUFF_STAIRS: 2 +POLISHED_TUFF_WALL: 2 POPPED_CHORUS_FRUIT: 8 POPPY: 2 PORKCHOP: 3 @@ -880,12 +906,12 @@ SANDSTONE_SLAB: 2 SANDSTONE_STAIRS: 118 SANDSTONE_WALL: 2 SCAFFOLDING: 18 +SCRAPE_POTTERY_SHERD: 20 SCULK: 2 SCULK_CATALYST: 2 SCULK_SENSOR: 2 SCULK_SHRIEKER: 2 SCULK_VEIN: 2 -SCUTE: 20 SEAGRASS: 2 SEA_LANTERN: 160 SEA_PICKLE: 6 @@ -895,6 +921,7 @@ SHEAF_POTTERY_SHERD: 20 SHEARS: 44 SHELTER_POTTERY_SHERD: 20 SHIELD: 28 +SHORT_GRASS: 1 SHROOMLIGHT: 20 SHULKER_SHELL: 50 SILENCE_ARMOR_TRIM_SMITHING_TEMPLATE: 1400 @@ -1017,6 +1044,13 @@ TUBE_CORAL: 2 TUBE_CORAL_BLOCK: 2 TUBE_CORAL_FAN: 2 TUFF: 2 +TUFF_BRICKS: 4 +TUFF_BRICK_SLAB: 2 +TUFF_BRICK_STAIRS: 2 +TUFF_BRICK_WALL: 2 +TUFF_SLAB: 2 +TUFF_STAIRS: 2 +TUFF_WALL: 2 TURTLE_HELMET: 100 TWISTING_VINES: 1 VERDANT_FROGLIGHT: 150 @@ -1042,24 +1076,49 @@ WARPED_STEM: 1 WARPED_TRAPDOOR: 6 WARPED_WART_BLOCK: 24 WATER_BUCKET: 40 +WAXED_CHISELED_COPPER: 2 WAXED_COPPER_BLOCK: 180 +WAXED_COPPER_BULB: 720 +WAXED_COPPER_DOOR: 60 +WAXED_COPPER_GRATE: 200 +WAXED_COPPER_TRAPDOOR: 80 WAXED_CUT_COPPER: 180 WAXED_CUT_COPPER_SLAB: 90 WAXED_CUT_COPPER_STAIRS: 120 +WAXED_EXPOSED_CHISELED_COPPER: 380 WAXED_EXPOSED_COPPER: 180 +WAXED_EXPOSED_COPPER_BULB: 720 +WAXED_EXPOSED_COPPER_DOOR: 60 +WAXED_EXPOSED_COPPER_GRATE: 200 +WAXED_EXPOSED_COPPER_TRAPDOOR: 80 WAXED_EXPOSED_CUT_COPPER: 180 WAXED_EXPOSED_CUT_COPPER_SLAB: 90 WAXED_EXPOSED_CUT_COPPER_STAIRS: 120 +WAXED_OXIDIZED_CHISELED_COPPER: 380 WAXED_OXIDIZED_COPPER: 180 +WAXED_OXIDIZED_COPPER_BULB: 720 +WAXED_OXIDIZED_COPPER_DOOR: 60 +WAXED_OXIDIZED_COPPER_GRATE: 200 +WAXED_OXIDIZED_COPPER_TRAPDOOR: 80 WAXED_OXIDIZED_CUT_COPPER: 180 WAXED_OXIDIZED_CUT_COPPER_SLAB: 90 WAXED_OXIDIZED_CUT_COPPER_STAIRS: 120 +WAXED_WEATHERED_CHISELED_COPPER: 380 WAXED_WEATHERED_COPPER: 180 +WAXED_WEATHERED_COPPER_BULB: 720 +WAXED_WEATHERED_COPPER_DOOR: 60 +WAXED_WEATHERED_COPPER_GRATE: 200 +WAXED_WEATHERED_COPPER_TRAPDOOR: 80 WAXED_WEATHERED_CUT_COPPER: 180 WAXED_WEATHERED_CUT_COPPER_SLAB: 90 WAXED_WEATHERED_CUT_COPPER_STAIRS: 120 WAYFINDER_ARMOR_TRIM_SMITHING_TEMPLATE: 1400 +WEATHERED_CHISELED_COPPER: 360 WEATHERED_COPPER: 180 +WEATHERED_COPPER_BULB: 700 +WEATHERED_COPPER_DOOR: 40 +WEATHERED_COPPER_GRATE: 180 +WEATHERED_COPPER_TRAPDOOR: 60 WEATHERED_CUT_COPPER: 180 WEATHERED_CUT_COPPER_SLAB: 90 WEATHERED_CUT_COPPER_STAIRS: 120 @@ -1085,6 +1144,7 @@ WHITE_WOOL: 20 WILD_ARMOR_TRIM_SMITHING_TEMPLATE: 1400 WITHER_ROSE: 2 WITHER_SKELETON_SKULL: 200 +WOLF_ARMOR: 120 WOODEN_AXE: 2 WOODEN_HOE: 2 WOODEN_PICKAXE: 2 diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 8325c9f412..6d09e3250f 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -87,6 +87,17 @@ travel: x: 5000 z: 5000 no_destination_malfunctions: true +# difficulty preferences +# https://tardis.pages.dev/configuration/difficulty +difficulty: + crafting: easy + circuits: false + disks: false + disk_in_hand_for_write: true + biome_reader: true + stattenheim_remote: false + tardis_locator: false + system_upgrades: false # general preferences # https://tardis.pages.dev/configuration/prefs preferences: @@ -106,7 +117,6 @@ preferences: respect_grief_prevention: true respect_red_protect: true sfx_volume: 10 - difficulty: easy strike_lightning: true hads_damage: 10 hads_distance: 10 @@ -152,7 +162,9 @@ circuits: memory: 20 randomiser: 50 scanner: 20 + telepathic: 20 temporal: 20 + stattenheim: 15 # restrictions # https://tardis.pages.dev/configuration/allow allow: @@ -173,7 +185,6 @@ allow: external_gravity: false power_down: true power_down_on_quit: false - player_difficulty: true 3d_doors: false village_travel: false perception_filter: true diff --git a/src/main/resources/en.yml b/src/main/resources/en.yml index 62fad3bc4d..cfa31d0971 100644 --- a/src/main/resources/en.yml +++ b/src/main/resources/en.yml @@ -23,13 +23,13 @@ ADVANCEMENT_COPYING: "Attempting to copy advancement file (%s) to the correct di ADVANCEMENT_DIRECTORIES: "Attempting to create TARDIS advancement directories..." ADVANCEMENT_NOT_FOUND: "Could not find the %s TARDIS advancement file..." ADVANCEMENT_RELOAD: "Custom advancements not found, forcing server advancements to reload!" -ADV_AREA: "The TARDIS difficulty level on this server requires you to use the Advanced Console! See the TARDIS Information System for help with using Area Disks." -ADV_BIOME: "The TARDIS difficulty level on this server requires you to use the Advanced Console! See the TARDIS Information System for help with using Biome Disks, or type %s to see how to craft a Biome Storage Disk." +ADV_AREA: "This server requires you to use TARDIS travel disks in the Advanced Console! See the TARDIS Information System for help with using Area Disks." +ADV_BIOME: "This server requires you to use TARDIS travel disks in the Advanced Console! See the TARDIS Information System for help with using Biome Disks, or type %s to see how to craft a Biome Storage Disk." ADV_BLANK: "The console cannot process blank disks!" ADV_NO_DROP: "You cannot drop Area Storage Disks!" ADV_NO_STORE: "You cannot store Area Storage Disks here!" ADV_OPEN: "You can only open the Advanced Console with the TARDIS key, a sonic screwdriver, a circuit or a disk." -ADV_PLAYER: "The TARDIS difficulty level on this server requires you to use the Advanced Console! See the TARDIS Information System for help with using Player Disks." +ADV_PLAYER: "This server requires you to use TARDIS travel disks in the Advanced Console! See the TARDIS Information System for help with using Player Disks." AIR_NOT_FOUND: "There doesn't seem to be empty space to grow the room! Check you have placed the room seed block correctly." ANCIENT: "The ancient, dusty senators of Gallifrey have disabled time travel to The %s!" ANTIBUILD: "You can't do that because the TARDIS has placed this area in a stasis field!" @@ -110,6 +110,7 @@ ARG_MATERIAL: "Invalid block name specified!" ARG_MAX: "You can only give a maximum of 64 items at once!" ARG_NOT_BLOCK: "The materials must be solid blocks!" ARG_NOT_VALID: "TARDIS does not recognise that command argument!" +ARG_PARTICLE: "%s is not a valid particle %s preference!" ARG_PLAYER: "You must specify a player name when using this command from the console!" ARG_PRESET: "The last argument must be a valid preset name!" ARG_PROVIDER: "The last argument must be a valid mapping plugin name! Try 'dynmap' or 'BlueMap'" @@ -217,6 +218,7 @@ BUTTON_INFO: "TARDIS Information System" BUTTON_INVISIBLE: "Invisible" BUTTON_JETT: "Jettison" BUTTON_LEFT: "Left" +BUTTON_LESS: "Less" BUTTON_LEVEL: "Main level" BUTTON_LEVEL_B: "Bottom level" BUTTON_LEVEL_T: "Top level" @@ -227,6 +229,7 @@ BUTTON_MAP: "Load map" BUTTON_MAP_NO: "Load the map!" BUTTON_MASTER: "The Master's reverse polarity button" BUTTON_MID: "Midnight" +BUTTON_MORE: "More" BUTTON_MORN: "Morning" BUTTON_MULTI: "Multiplier" BUTTON_NEG: "-ve" @@ -736,6 +739,7 @@ NO_PERM_UPGRADE_CONSOLE: "You do not have permission to upgrade your TARDIS to a NO_PLACE: "You cannot place a block there!" NO_RENAME: "You cannot name the item that!" NO_TARDIS: "You have not created a TARDIS yet!" +NO_TELEPATHIC_CIRCUIT: "The Telepathic Circuit is missing from the console!" NO_UPGRADE_WHILE_GROWING: "You cannot update the desktop theme while the TARDIS is growing rooms!" NO_WORLD_RELATIVE: "For relative travel, you do not need to specify a world argument!" NO_WORLD_TRAVEL: "The server does not allow time travel to this world!" @@ -752,6 +756,7 @@ OCCUPY_SET: "TARDIS occupation was set to: %s" DECOMMISSIONED: "The TARDIS control was unregistered successfully." PAPER_BAG_EMPTY: "The paper bag doesn't have any Jelly Babies in it! SHIFT-click the bag to put some in." PAPER_BAG_SLOT: "There is no room in your inventory for a Jelly Bean!" +PARTICLE_SAVED: "Particle preference saved." PLATE_NOT_FOUND: "Could not find the door pressure plate! Check the seed block position." PLAYER_IN_AREA: "The player is in a TARDIS area! Please use %s." PLAYER_NOT_FOUND: "That player can not be found on this server." @@ -984,6 +989,7 @@ SONIC_SCAN: "Sonic Screwdriver environmental scan started..." SPAM_WAIT: "Patience is a virtue, spam clicking won't work!" STANDBY_START: "Starting the standby power mode task." STANDBY_STOP: "Cancelling the standby power mode task." +STATTENHEIM_USED: "Your Stattenheim Remote's durability has been exhausted!" SUB_NO_CMD: "You cannot use this command while under water!" SUB_SEARCH: "Searching for underwater location..." SUB_UNSUITED: "Selected preset unsuitable for submarine mode - changed to Yellow Submarine." @@ -991,6 +997,14 @@ SUCCESS_N: "unsuccessful!" SUCCESS_Y: "successful." SUDO_OFF: "Sudo off! Put your cape away, you're no longer super." SUDO_ON: "Sudo on! You will now be running TARDIS commands as '%s'. Use '/tardissudo off' to resume normal service." +SYS_COST: "You don't have enough Time Lord energy to unlock the %s upgrade!" +SYS_DISABLED: "System Upgrades are disabled on this server!" +SYS_HAS: "You already have the %s upgrade!" +SYS_MENU: "System Upgrades" +SYS_NEED: "You need to enable the %s System Upgrade!" +SYS_REQUIRED: "You need to unlock the %s upgrade first!" +SYS_SUCCESS: "The %s upgrade was successfully applied." +SYS_TRAVEL_FIRST: "You need to travel and exit your TARDIS to start unlocking System upgrades!" TARDIS_BREAK: "You cannot break the TARDIS blocks!" TARDIS_COMING: "The TARDIS is coming..." TARDIS_EXTERMINATED: "The TARDIS was removed from the world and database successfully." diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index e14a248ce4..78b7fb43c6 100755 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -9,7 +9,7 @@ dev-url: http://github.com/eccentricdevotion/TARDIS/ url: http://tardis.pages.dev/ version: ${project.version}-b${project.build.number} build-number: ${project.build.number} -api-version: '1.20.5' +api-version: '1.21' libraries: - org.jsoup:jsoup:1.16.1 permissions: @@ -596,6 +596,9 @@ permissions: tardis.load_shells: description: Allows a player to load Chameleon presets into the Shell room. default: op + tardis.particles: + description: Allows the player to display TARDIS materialisation particles. + default: op tardis.gamemode.bypass: description: Allows a player to bypass gamemode switching when changing worlds. default: false @@ -1194,50 +1197,67 @@ commands: biome: description: Get the biome the player is looking at. usage: / biome - list: - description: Lists various options to aid documentation - possible listings are preset_perms, perms, recipes, blueprints, commands. - usage: / list [which] [html|all] - stats: - description: Display ARS room counts. - usage: / stats - tree: - description: Grows a Huge Fungus Tree on the block the player is targeting. If no further arguments are specified, random blocks are used to grow the tree. You can also specify a block for the stem, hat and decor. - usage: / tree [stem] [hat] [decor] - plurals: - description: Displays a list of block and item names in plural form. - usage: / plurals - chunky: - description: Pre-generates chunks using the Chunky plugin - usage: / chunky [world] - snapshot: - description: Creates a TARDIS Monitor map snapshot. Using the c arguments clears the player's inventory of filled maps. Use in or out to determine which view (interior/exterior) to capture. - usage: / snapshot [in|out|c] - frame: - description: Lock and unlock TARDIS item frames. - usage: / frame [lock|unlock] - brushable: - description: Adds a suspicious sand block to the player's inventory. - usage: / brushable box: description: Set the state of the armour stand police box between open/closed/stained/glass/flying. usage: / box [open|closed|stained|glass|flying] - nms: - description: Spawn a custom NMS monster. - usage: / nms [monster] + brushable: + description: Adds a suspicious sand block to the player's inventory. + usage: / brushable + chunks: + description: Lists the chunks used by the TARDIS interior. + usage: / chunks + chunky: + description: Pre-generates chunks using the Chunky plugin + usage: / chunky [world] circuit: description: Give a player a random used TARDIS circuit. usage: / circuit - tis: - description: Checks and lists TARDIS Information System entries. - usage: / tis + dismount: + description: Dismounts a player from their vehicle. + usage: / dismount + displayitem: + description: Various commands to test Item Display custom blocks and lights - subcommands are add, remove, place, break, convert, chunk, block, console + effect: + description: Shows TARDIS materialisation particles. + usage: / effect [shape] [effect] [density] [speed] + frame: + description: Lock and unlock TARDIS item frames. + usage: / frame [lock|unlock] + furnace: + description: Lists server furnace recipes. + interaction: + description: Sets an interaction entity at the TARDIS's exterior location. + usage: / interaction label: description: Generates Text displays for the Library room. usage: / label + list: + description: Lists various options to aid documentation - possible listings are preset_perms, perms, recipes, blueprints, commands. + usage: / list [which] [html|all] + nms: + description: Spawn a custom NMS monster. + usage: / nms [monster] + plurals: + description: Displays a list of block and item names in plural form. + usage: / plurals recipe: description: Generates TARDIS item pages with recipes. usage: / recipe [shaped|shapeless|item] - displayitem: - description: Various commands to test Item Display custom blocks and lights - subcommands are add, remove, place, break, convert, chunk, block, console + snapshot: + description: Creates a TARDIS Monitor map snapshot. Using the c arguments clears the player's inventory of filled maps. Use in or out to determine which view (interior/exterior) to capture. + usage: / snapshot [in|out|c] + stats: + description: Display ARS room counts. + usage: / stats + systree: + description: Opens the System Upgrades GUI + usage: / systree + tis: + description: Checks and lists TARDIS Information System entries. + usage: / tis + tree: + description: Grows a Huge Fungus Tree on the block the player is targeting. If no further arguments are specified, random blocks are used to grow the tree. You can also specify a block for the stem, hat and decor. + usage: / tree [stem] [hat] [decor] tardisgive: aliases: tgive description: Give TARDIS items, Artron energy, Seed blocks, kits, knowledge books, or recipe discoveries to a player. diff --git a/src/main/resources/system_upgrades.yml b/src/main/resources/system_upgrades.yml new file mode 100644 index 0000000000..f0e6b8f8bd --- /dev/null +++ b/src/main/resources/system_upgrades.yml @@ -0,0 +1,22 @@ +branch: 100 +# architecture branch +architecture: + chameleon_circuit: 1000 + room_growing: 1000 + desktop_theme: 2000 +# navigation branch +navigation: + saves: 1000 + distance_1: 1000 + distance_2: 2000 + distance_3: 3000 + telepathic_circuit: 2000 + inter_dimensional_travel: 4000 + exterior_flight: 3000 +# tools branch +tools: + tardis_locator: 500 + biome_reader: 2000 + force_field: 3000 + monitor: 2000 + stattenheim_remote: 4000 diff --git a/todo.md b/todo.md index 088716b742..12bb4fb393 100644 --- a/todo.md +++ b/todo.md @@ -2,19 +2,20 @@ ## Current version `5.6.0` -1. Fix fifteenth console redstone piston door -2. Fix follower persistence -3. Custom Control models [#703](https://github.com/eccentricdevotion/TARDIS/issues/703) - [#355](https://github.com/eccentricdevotion/TARDIS/issues/355) -4. Add doors to shop item -5. ? +1. ? ## Next version `5.7.0` -1. Allow 3D Police Boxes to land on slabs [#777](https://github.com/eccentricdevotion/TARDIS/issues/777) -2. Animated models for TWA player disguises -3. Rework difficulty [#754](https://github.com/eccentricdevotion/TARDIS/issues/754) -4. ? +1. Fix fifteenth console redstone piston door +2. Fix follower persistence +3. Add doors to shop items +4. Allow 3D Police Boxes to land on slabs [#777](https://github.com/eccentricdevotion/TARDIS/issues/777) +5. Animated models for TWA player disguises +6. Modelled controls [#836](https://github.com/eccentricdevotion/TARDIS/issues/836) +7. Exterior button door control [#839](https://github.com/eccentricdevotion/TARDIS/issues/839) +8. Console lamp [#837](https://github.com/eccentricdevotion/TARDIS/issues/837) +9. New RUSTIC console using 1.21 blocks +10. ? ## Future versions @@ -29,6 +30,7 @@ * Make all images tabbed * Vanilla/TARDIS screenshots for TabbedImage views +* Add new difficulty and system upgrades * ? ## Resource Pack / Monsters