diff --git a/pom.xml b/pom.xml
index ce5e289e..a18ba9b1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -119,12 +119,6 @@
a2c4b6d
provided
-
- org.jetbrains
- annotations
- LATEST
- compile
-
io.github.mooy1
InfinityLib
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/CrystamaeHistoria.java b/src/main/java/io/github/sefiraat/crystamaehistoria/CrystamaeHistoria.java
index 5e448e26..0ef8c79a 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/CrystamaeHistoria.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/CrystamaeHistoria.java
@@ -2,6 +2,7 @@
import de.slikey.effectlib.EffectManager;
import io.github.mooy1.infinitylib.core.AbstractAddon;
+import io.github.sefiraat.crystamaehistoria.commands.GetRanks;
import io.github.sefiraat.crystamaehistoria.commands.OpenSpellCompendium;
import io.github.sefiraat.crystamaehistoria.commands.OpenStoryCompendium;
import io.github.sefiraat.crystamaehistoria.commands.TestSpell;
@@ -13,6 +14,7 @@
import io.github.sefiraat.crystamaehistoria.magic.spells.spellobjects.MagicFallingBlock;
import io.github.sefiraat.crystamaehistoria.magic.spells.spellobjects.MagicProjectile;
import io.github.sefiraat.crystamaehistoria.magic.spells.spellobjects.MagicSummon;
+import io.github.sefiraat.crystamaehistoria.player.PlayerStatistics;
import io.github.sefiraat.crystamaehistoria.runnables.RunnableManager;
import io.github.sefiraat.crystamaehistoria.runnables.spells.SpellTickRunnable;
import io.github.sefiraat.crystamaehistoria.slimefun.Gadgets;
@@ -22,7 +24,6 @@
import io.github.sefiraat.crystamaehistoria.slimefun.Tools;
import io.github.sefiraat.crystamaehistoria.stories.BlockDefinition;
import io.github.sefiraat.crystamaehistoria.stories.StoriesManager;
-import io.github.sefiraat.crystamaehistoria.utils.PlayerStatUtils;
import io.github.thebusybiscuit.slimefun4.libraries.dough.collections.Pair;
import org.apache.commons.lang.Validate;
import org.bstats.bukkit.Metrics;
@@ -157,6 +158,7 @@ public void enable() {
getAddonCommand().addSub(new TestSpell());
getAddonCommand().addSub(new OpenSpellCompendium());
getAddonCommand().addSub(new OpenStoryCompendium());
+ getAddonCommand().addSub(new GetRanks());
}
private void setupBstats() {
@@ -178,7 +180,7 @@ private void setupBstats() {
int timesCast = 0;
for (String string : CrystamaeHistoria.getConfigManager().getPlayerStats().getKeys(false)) {
UUID uuid = UUID.fromString(string);
- timesCast += PlayerStatUtils.getUsages(uuid, spellType);
+ timesCast += PlayerStatistics.getUsages(uuid, spellType);
}
values.put(spell.getId(), timesCast);
}
@@ -191,7 +193,7 @@ private void setupBstats() {
int timesChronicled = 0;
for (String string : CrystamaeHistoria.getConfigManager().getPlayerStats().getKeys(false)) {
UUID uuid = UUID.fromString(string);
- timesChronicled += PlayerStatUtils.getChronicle(uuid, definition);
+ timesChronicled += PlayerStatistics.getChronicle(uuid, definition);
}
values.put(definition.getMaterial().toString(), timesChronicled);
}
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/commands/GetRanks.java b/src/main/java/io/github/sefiraat/crystamaehistoria/commands/GetRanks.java
new file mode 100644
index 00000000..eccb9bb8
--- /dev/null
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/commands/GetRanks.java
@@ -0,0 +1,32 @@
+package io.github.sefiraat.crystamaehistoria.commands;
+
+import io.github.mooy1.infinitylib.commands.SubCommand;
+import io.github.sefiraat.crystamaehistoria.player.PlayerStatistics;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+
+import javax.annotation.ParametersAreNonnullByDefault;
+import java.util.List;
+
+public class GetRanks extends SubCommand {
+
+ public GetRanks() {
+ super("rank", "Displays your Crystamae ranks", false);
+ }
+
+ @Override
+ @ParametersAreNonnullByDefault
+ protected void execute(CommandSender sender, String[] args) {
+ if (sender instanceof Player) {
+ Player player = (Player) sender;
+ player.sendMessage(PlayerStatistics.getSpellRankString(player.getUniqueId()));
+ player.sendMessage(PlayerStatistics.getStoryRankString(player.getUniqueId()));
+ }
+ }
+
+ @Override
+ @ParametersAreNonnullByDefault
+ protected void complete(CommandSender commandSender, String[] strings, List list) {
+ // Not required
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/config/ConfigManager.java b/src/main/java/io/github/sefiraat/crystamaehistoria/config/ConfigManager.java
index 9092d379..593951e2 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/config/ConfigManager.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/config/ConfigManager.java
@@ -9,8 +9,11 @@
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
+import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
@Getter
public class ConfigManager {
@@ -22,35 +25,42 @@ public class ConfigManager {
private final FileConfiguration spells;
public ConfigManager() {
- this.blocks = getConfig("blocks.yml");
- this.blocks.options().copyDefaults(true);
- this.stories = getConfig("generic-stories.yml");
- this.stories.options().copyDefaults(true);
- this.playerStats = getConfig("player_stats.yml");
- this.playerStats.options().copyDefaults(true);
- this.blockColors = getConfig("block_colors.yml");
- this.blockColors.options().copyDefaults(true);
- this.spells = getConfig("spells.yml");
- this.spells.options().copyDefaults(true);
+ this.blocks = getConfig("blocks.yml", true);
+ this.stories = getConfig("generic-stories.yml", true);
+ this.playerStats = getConfig("player_stats.yml", false);
+ this.blockColors = getConfig("block_colors.yml", false);
+ this.spells = getConfig("spells.yml", false);
}
/**
* @noinspection ResultOfMethodCallIgnored
*/
- private FileConfiguration getConfig(String fileName) {
- CrystamaeHistoria plugin = CrystamaeHistoria.getInstance();
- File file = new File(plugin.getDataFolder(), fileName);
+ private FileConfiguration getConfig(String fileName, boolean updateWithDefaults) {
+ final CrystamaeHistoria plugin = CrystamaeHistoria.getInstance();
+ final File file = new File(plugin.getDataFolder(), fileName);
if (!file.exists()) {
file.getParentFile().mkdirs();
plugin.saveResource(fileName, true);
}
- YamlConfiguration yaml = new YamlConfiguration();
+ final FileConfiguration config = new YamlConfiguration();
try {
- yaml.load(file);
+ config.load(file);
+ if (updateWithDefaults) {
+ updateConfig(config, file, fileName);
+ }
} catch (IOException | InvalidConfigurationException e) {
e.printStackTrace();
}
- return yaml;
+ return config;
+ }
+
+ private void updateConfig(FileConfiguration config, File file, String fileName) throws IOException {
+ final InputStream inputStream = CrystamaeHistoria.getInstance().getResource(fileName);
+ final BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
+ final YamlConfiguration defaults = YamlConfiguration.loadConfiguration(reader);
+ config.addDefaults(defaults);
+ config.options().copyDefaults(true);
+ config.save(file);
}
public boolean spellEnabled(Spell spell) {
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/listeners/CrystalBreakListener.java b/src/main/java/io/github/sefiraat/crystamaehistoria/listeners/CrystalBreakListener.java
index 351cabbc..d7321a23 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/listeners/CrystalBreakListener.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/listeners/CrystalBreakListener.java
@@ -11,12 +11,13 @@
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
public class CrystalBreakListener implements Listener {
- @EventHandler
+ @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onBreakCrystal(BlockBreakEvent event) {
Block block = event.getBlock();
if (block.getType() == Material.LARGE_AMETHYST_BUD) {
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/listeners/DisplayItemListener.java b/src/main/java/io/github/sefiraat/crystamaehistoria/listeners/DisplayItemListener.java
index 4f2bc1dc..87359a10 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/listeners/DisplayItemListener.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/listeners/DisplayItemListener.java
@@ -4,14 +4,23 @@
import io.github.thebusybiscuit.slimefun4.libraries.dough.data.persistent.PersistentDataAPI;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
+import org.bukkit.event.entity.ItemDespawnEvent;
import org.bukkit.event.inventory.InventoryPickupItemEvent;
public class DisplayItemListener implements Listener {
@EventHandler
- public void onArmorStandManipulate(InventoryPickupItemEvent e) {
+ public void onItemPickup(InventoryPickupItemEvent e) {
if (PersistentDataAPI.hasBoolean(e.getItem(), Keys.PDC_IS_DISPLAY_ITEM)) {
e.setCancelled(true);
}
}
+
+ @EventHandler
+ public void onItemDespawn(ItemDespawnEvent e) {
+ if (PersistentDataAPI.hasBoolean(e.getEntity(), Keys.PDC_IS_DISPLAY_ITEM)) {
+ e.setCancelled(true);
+ e.getEntity().setTicksLived(1);
+ }
+ }
}
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/listeners/MiscListener.java b/src/main/java/io/github/sefiraat/crystamaehistoria/listeners/MiscListener.java
index 452be015..0d1f816f 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/listeners/MiscListener.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/listeners/MiscListener.java
@@ -1,13 +1,19 @@
package io.github.sefiraat.crystamaehistoria.listeners;
import io.github.sefiraat.crystamaehistoria.slimefun.gadgets.MysteriousTicker;
+import io.github.sefiraat.crystamaehistoria.utils.GeneralUtils;
+import io.github.sefiraat.crystamaehistoria.utils.StoryUtils;
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import me.mrCookieSlime.Slimefun.api.BlockStorage;
+import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
+import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.player.PlayerInteractEvent;
+import org.bukkit.inventory.ItemStack;
public class MiscListener implements Listener {
@@ -21,4 +27,24 @@ public void onDontTouchMyCrap(PlayerInteractEvent e) {
}
}
}
+
+ @EventHandler
+ public void onPlaceStoriedBlock(BlockPlaceEvent e) {
+ ItemStack itemStack = e.getItemInHand();
+ if (StoryUtils.isStoried(itemStack)) {
+ e.setCancelled(true);
+ }
+ }
+
+ @EventHandler(priority = EventPriority.LOWEST)
+ public void checkCooldown(PlayerInteractEvent event) {
+ ItemStack itemStack = event.getPlayer().getInventory().getItemInMainHand();
+ if (itemStack.getType() != Material.AIR
+ && (event.getAction() == Action.RIGHT_CLICK_AIR
+ || event.getAction() == Action.RIGHT_CLICK_BLOCK)
+ && GeneralUtils.isOnCooldown(itemStack)
+ ) {
+ event.setCancelled(true);
+ }
+ }
}
\ No newline at end of file
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/listeners/RefractingLensListener.java b/src/main/java/io/github/sefiraat/crystamaehistoria/listeners/RefractingLensListener.java
index 3fca8279..86909692 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/listeners/RefractingLensListener.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/listeners/RefractingLensListener.java
@@ -6,6 +6,7 @@
import io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.liquefactionbasin.LiquefactionBasin;
import io.github.sefiraat.crystamaehistoria.slimefun.tools.RefactingLens;
import io.github.sefiraat.crystamaehistoria.stories.definition.StoryType;
+import io.github.sefiraat.crystamaehistoria.utils.GeneralUtils;
import io.github.sefiraat.crystamaehistoria.utils.ParticleUtils;
import io.github.sefiraat.crystamaehistoria.utils.theme.ThemeType;
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
@@ -18,6 +19,7 @@
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
@@ -28,7 +30,7 @@
public class RefractingLensListener implements Listener {
- @EventHandler
+ @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onInteract(PlayerInteractEvent e) {
final Player player = e.getPlayer();
final SlimefunItem slimefunItem = SlimefunItem.getByItem(player.getInventory().getItemInMainHand());
@@ -38,6 +40,7 @@ public void onInteract(PlayerInteractEvent e) {
&& slimefunItem instanceof RefactingLens
) {
e.setCancelled(true);
+ GeneralUtils.putOnCooldown(player.getInventory().getItemInMainHand(), 3);
SlimefunItem item = BlockStorage.check(block);
if (item instanceof LiquefactionBasin) {
liquefactionBasin(player, item, block);
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/SpellType.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/SpellType.java
index e28f9614..637e3db3 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/SpellType.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/SpellType.java
@@ -1,6 +1,5 @@
package io.github.sefiraat.crystamaehistoria.magic;
-import io.github.sefiraat.crystamaehistoria.CrystamaeHistoria;
import io.github.sefiraat.crystamaehistoria.magic.spells.core.Spell;
import io.github.sefiraat.crystamaehistoria.magic.spells.tier1.AbstractVoid;
import io.github.sefiraat.crystamaehistoria.magic.spells.tier1.AirNova;
@@ -71,7 +70,6 @@
import io.github.sefiraat.crystamaehistoria.magic.spells.tier1.Tracer;
import io.github.sefiraat.crystamaehistoria.magic.spells.tier1.Vacuum;
import io.github.sefiraat.crystamaehistoria.magic.spells.tier1.WitherWeather;
-import io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.liquefactionbasin.LiquefactionBasinCache;
import lombok.Getter;
import javax.annotation.Nonnull;
@@ -175,6 +173,12 @@ public static Spell getById(String id) {
return null;
}
+ public static void setupEnabledSpells() {
+ enabledSpells = Arrays.stream(values())
+ .filter(spellType -> spellType.getSpell().isEnabled())
+ .toArray(SpellType[]::new);
+ }
+
@Nonnull
public String getId() {
return spell.getId();
@@ -190,10 +194,4 @@ public void cast(CastInformation castInformation) {
this.spell.castSpell(castInformation);
}
- public static void setupEnabledSpells() {
- enabledSpells = Arrays.stream(values())
- .filter(spellType -> spellType.getSpell().isEnabled())
- .toArray(SpellType[]::new);
- }
-
}
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/core/InstancePlate.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/core/InstancePlate.java
index e76822cb..23b5eb92 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/core/InstancePlate.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/core/InstancePlate.java
@@ -4,7 +4,7 @@
import io.github.sefiraat.crystamaehistoria.magic.CastInformation;
import io.github.sefiraat.crystamaehistoria.magic.CastResult;
import io.github.sefiraat.crystamaehistoria.magic.SpellType;
-import io.github.sefiraat.crystamaehistoria.utils.PlayerStatUtils;
+import io.github.sefiraat.crystamaehistoria.player.PlayerStatistics;
import io.github.sefiraat.crystamaehistoria.utils.theme.ThemeType;
import lombok.Getter;
import lombok.Setter;
@@ -80,7 +80,7 @@ public CastResult tryCastSpell(CastInformation castInformation) {
this.crysta -= crystaCost;
final long cdSeconds = (long) (spell.getCooldownSeconds(castInformation) * 1000);
this.cooldown = System.currentTimeMillis() + cdSeconds;
- PlayerStatUtils.addUsage(castInformation.getCaster(), storedSpell);
+ PlayerStatistics.addUsage(castInformation.getCaster(), storedSpell);
return CastResult.CAST_SUCCESS;
}
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/AbstractVoid.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/AbstractVoid.java
index 5626454e..45211896 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/AbstractVoid.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/AbstractVoid.java
@@ -11,7 +11,6 @@
import org.bukkit.Material;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import java.util.ArrayList;
@@ -70,7 +69,7 @@ public Material getMaterial() {
return Material.GREEN_DYE;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/AirNova.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/AirNova.java
index 7856c82d..48c0425c 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/AirNova.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/AirNova.java
@@ -14,7 +14,6 @@
import org.bukkit.Particle;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -83,7 +82,7 @@ public Material getMaterial() {
return Material.FEATHER;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/AirSprite.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/AirSprite.java
index dd53e400..49096e33 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/AirSprite.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/AirSprite.java
@@ -13,7 +13,6 @@
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.entity.EntityType;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -74,7 +73,7 @@ public Material getMaterial() {
return Material.VEX_SPAWN_EGG;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/AncientDefence.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/AncientDefence.java
index 3f739697..6e02a175 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/AncientDefence.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/AncientDefence.java
@@ -10,7 +10,6 @@
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -66,7 +65,7 @@ public Material getMaterial() {
return Material.CRYING_OBSIDIAN;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Animaniacs.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Animaniacs.java
index eee78c38..54a56c6c 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Animaniacs.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Animaniacs.java
@@ -14,7 +14,6 @@
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -107,7 +106,7 @@ public Material getMaterial() {
return Material.AXOLOTL_SPAWN_EGG;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/AntiPrism.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/AntiPrism.java
index 951e5fb0..b2df84e6 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/AntiPrism.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/AntiPrism.java
@@ -16,7 +16,6 @@
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.potion.PotionEffectType;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -97,7 +96,7 @@ public Material getMaterial() {
return Material.POTION;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/BatteringRam.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/BatteringRam.java
index a52710c4..227c7715 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/BatteringRam.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/BatteringRam.java
@@ -13,7 +13,6 @@
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Mob;
import org.bukkit.util.Vector;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -70,7 +69,7 @@ public Material getMaterial() {
return Material.GOAT_SPAWN_EGG;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/BloodMagics.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/BloodMagics.java
index cc576d76..0088b71c 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/BloodMagics.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/BloodMagics.java
@@ -13,7 +13,6 @@
import org.bukkit.Particle;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -81,7 +80,7 @@ public Material getMaterial() {
return Material.RED_DYE;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Bobulate.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Bobulate.java
index 855d8d26..cbe9ebf2 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Bobulate.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Bobulate.java
@@ -19,7 +19,6 @@
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.material.Colorable;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -134,7 +133,7 @@ public Material getMaterial() {
return Material.CYAN_WOOL;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Break.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Break.java
index 4ad21b30..5e5e0d2f 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Break.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Break.java
@@ -9,7 +9,6 @@
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -49,7 +48,7 @@ public Material getMaterial() {
return Material.CRACKED_STONE_BRICKS;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Bright.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Bright.java
index aa1e7280..f2d81223 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Bright.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Bright.java
@@ -11,7 +11,6 @@
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.entity.Player;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -55,7 +54,7 @@ public Material getMaterial() {
return Material.SUNFLOWER;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/CallLightning.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/CallLightning.java
index 897e9591..94d22395 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/CallLightning.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/CallLightning.java
@@ -13,7 +13,6 @@
import org.bukkit.entity.LightningStrike;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -76,7 +75,7 @@ public Material getMaterial() {
return Material.LIGHTNING_ROD;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Cascada.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Cascada.java
index 490d9f34..43ecc54c 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Cascada.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Cascada.java
@@ -16,7 +16,6 @@
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.util.Vector;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -95,7 +94,7 @@ public Material getMaterial() {
return Material.PODZOL;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Chaos.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Chaos.java
index 219bffd3..ec8f74e7 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Chaos.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Chaos.java
@@ -13,10 +13,10 @@
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Particle;
+import org.bukkit.block.Block;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -52,10 +52,13 @@ public void cast(CastInformation castInformation) {
.add(new Vector(x, y, 0))
.rotateAroundY(-(location.getYaw() * alessioMath));
final Location pointLocation = location.clone().add(pointVector);
- if (location.getBlock().isEmpty()) {
+ final Block block = pointLocation.getBlock();
+ if (pointLocation.getBlock().isEmpty()) {
final MagicProjectile projectile = SpellUtils.summonMagicProjectile(castInformation, EntityType.SPECTRAL_ARROW, pointLocation, this::onTick);
projectile.getProjectile().setGravity(false);
projectile.setVelocity(caster.getEyeLocation().getDirection(), 1);
+ } else {
+ GeneralUtils.tryBreakBlock(castInformation.getCaster(), block);
}
}
}
@@ -100,7 +103,7 @@ public Material getMaterial() {
return Material.SOUL_LANTERN;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/ChillWind.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/ChillWind.java
index 6fae0340..d3447235 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/ChillWind.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/ChillWind.java
@@ -12,7 +12,6 @@
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.potion.PotionEffectType;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -81,7 +80,7 @@ public Material getMaterial() {
return Material.BLUE_ICE;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Compass.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Compass.java
index ce63a2de..f4213701 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Compass.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Compass.java
@@ -14,7 +14,6 @@
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -91,7 +90,7 @@ public Material getMaterial() {
return Material.COMPASS;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/CurificationRitual.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/CurificationRitual.java
index 51281c89..c542b23c 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/CurificationRitual.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/CurificationRitual.java
@@ -13,7 +13,6 @@
import org.bukkit.entity.Player;
import org.bukkit.entity.Zombie;
import org.bukkit.entity.ZombieVillager;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -72,7 +71,7 @@ public Material getMaterial() {
return Material.GOLDEN_APPLE;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Deity.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Deity.java
index 1a8873a3..abefb373 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Deity.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Deity.java
@@ -12,7 +12,6 @@
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.potion.PotionEffectType;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -68,7 +67,7 @@ public Material getMaterial() {
return Material.END_CRYSTAL;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/EarthNova.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/EarthNova.java
index 2663706a..12bd034f 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/EarthNova.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/EarthNova.java
@@ -15,7 +15,6 @@
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.potion.PotionEffectType;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -82,7 +81,7 @@ public Material getMaterial() {
return Material.CLAY_BALL;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/EasterEgg.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/EasterEgg.java
index 89775bff..a4d2dd98 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/EasterEgg.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/EasterEgg.java
@@ -15,7 +15,6 @@
import org.bukkit.Particle;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -74,7 +73,7 @@ public Material getMaterial() {
return Material.ZOGLIN_SPAWN_EGG;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/EndermansVeil.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/EndermansVeil.java
index 5e8b5386..83c7cd04 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/EndermansVeil.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/EndermansVeil.java
@@ -12,7 +12,6 @@
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.entity.Player;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -93,7 +92,7 @@ public Material getMaterial() {
return Material.ENDER_PEARL;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/EscapeRope.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/EscapeRope.java
index 4f9ff202..f18a8543 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/EscapeRope.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/EscapeRope.java
@@ -10,7 +10,6 @@
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.entity.Player;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -54,7 +53,7 @@ public Material getMaterial() {
return Material.LEAD;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/EtherealFlow.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/EtherealFlow.java
index dd500d95..eadfa3d9 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/EtherealFlow.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/EtherealFlow.java
@@ -8,7 +8,6 @@
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -49,7 +48,7 @@ public Material getMaterial() {
return Material.CLOCK;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/FanOfArrows.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/FanOfArrows.java
index 5953af9f..9ba451d1 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/FanOfArrows.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/FanOfArrows.java
@@ -11,7 +11,6 @@
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -40,8 +39,10 @@ public void fireProjectiles(CastInformation castInformation) {
int dz = (int) (sizeEnd * Math.sin(angle));
Location spawn = middle.clone().add(sx, 0, sz);
Location destination = middle.clone().add(dx, 5, dz);
- MagicProjectile magicProjectile = SpellUtils.summonMagicProjectile(castInformation, EntityType.ARROW, spawn);
- magicProjectile.setVelocity(destination, 1);
+ if (spawn.getBlock().isEmpty()) {
+ MagicProjectile magicProjectile = SpellUtils.summonMagicProjectile(castInformation, EntityType.ARROW, spawn);
+ magicProjectile.setVelocity(destination, 1);
+ }
}
}
@@ -71,7 +72,7 @@ public Material getMaterial() {
return Material.SPECTRAL_ARROW;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/FireNova.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/FireNova.java
index cc6ab5b5..a5722327 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/FireNova.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/FireNova.java
@@ -14,7 +14,6 @@
import org.bukkit.Particle;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -82,7 +81,7 @@ public Material getMaterial() {
return Material.FIRE_CHARGE;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Fireball.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Fireball.java
index cdaca26a..a30f1035 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Fireball.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Fireball.java
@@ -12,7 +12,6 @@
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -76,7 +75,7 @@ public Material getMaterial() {
return Material.FIRE_CHARGE;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/FlameSprite.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/FlameSprite.java
index 7b177af7..7de168d4 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/FlameSprite.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/FlameSprite.java
@@ -13,7 +13,6 @@
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.entity.EntityType;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -74,7 +73,7 @@ public Material getMaterial() {
return Material.BLAZE_SPAWN_EGG;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/FrostNova.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/FrostNova.java
index b7c80164..a336b6a1 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/FrostNova.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/FrostNova.java
@@ -14,7 +14,6 @@
import org.bukkit.Particle;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -79,7 +78,7 @@ public Material getMaterial() {
return Material.SNOWBALL;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Gravity.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Gravity.java
index 42f72d56..12b7c9bd 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Gravity.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Gravity.java
@@ -11,7 +11,6 @@
import org.bukkit.Particle;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -63,7 +62,7 @@ public Material getMaterial() {
return Material.FIREWORK_STAR;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/GrowUp.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/GrowUp.java
index 4c8c8cb1..0c67b29d 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/GrowUp.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/GrowUp.java
@@ -13,7 +13,6 @@
import org.bukkit.entity.Entity;
import org.bukkit.entity.Phantom;
import org.bukkit.entity.Slime;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -67,7 +66,7 @@ public Material getMaterial() {
return Material.SLIME_BLOCK;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Gyroscopic.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Gyroscopic.java
index 3656762a..5fc06ac9 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Gyroscopic.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Gyroscopic.java
@@ -13,7 +13,6 @@
import org.bukkit.Particle;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -76,7 +75,7 @@ public Material getMaterial() {
return Material.MUSIC_DISC_CAT;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/HarmonysSonata.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/HarmonysSonata.java
index c5d5c772..77a0a872 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/HarmonysSonata.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/HarmonysSonata.java
@@ -16,7 +16,6 @@
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.Bisected;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -92,7 +91,7 @@ public Material getMaterial() {
return Material.GRASS;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/HarvestMoon.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/HarvestMoon.java
index db911ec4..e48ae651 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/HarvestMoon.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/HarvestMoon.java
@@ -12,7 +12,6 @@
import org.bukkit.Tag;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -77,7 +76,7 @@ public Material getMaterial() {
return Material.WHEAT;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Heal.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Heal.java
index 3f61c7c3..c47f6915 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Heal.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Heal.java
@@ -11,7 +11,6 @@
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.entity.Player;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -52,7 +51,7 @@ public Material getMaterial() {
return Material.POTION;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/HealingMist.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/HealingMist.java
index 49229e8b..3ed15dc4 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/HealingMist.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/HealingMist.java
@@ -12,7 +12,6 @@
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffectType;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -61,7 +60,7 @@ public Material getMaterial() {
return Material.GOLDEN_APPLE;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Hearthstone.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Hearthstone.java
index 576d6263..cfb4f7f6 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Hearthstone.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Hearthstone.java
@@ -12,7 +12,6 @@
import org.bukkit.Particle;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerTeleportEvent;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -74,7 +73,7 @@ public Material getMaterial() {
return Material.RED_BED;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Hellscape.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Hellscape.java
index 8d9c6a2e..bbc10a8b 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Hellscape.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Hellscape.java
@@ -14,7 +14,6 @@
import org.bukkit.Particle;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -93,7 +92,7 @@ public Material getMaterial() {
return Material.FLINT_AND_STEEL;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/HolyCow.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/HolyCow.java
index b32d35e8..f842341f 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/HolyCow.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/HolyCow.java
@@ -13,7 +13,6 @@
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.entity.EntityType;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -74,7 +73,7 @@ public Material getMaterial() {
return Material.COW_SPAWN_EGG;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/ImbueVoid.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/ImbueVoid.java
index 08648347..a7258373 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/ImbueVoid.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/ImbueVoid.java
@@ -11,7 +11,6 @@
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.potion.PotionEffectType;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -70,7 +69,7 @@ public Material getMaterial() {
return Material.ENDERMITE_SPAWN_EGG;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/KnowledgeShare.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/KnowledgeShare.java
index 451ec017..d02425a5 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/KnowledgeShare.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/KnowledgeShare.java
@@ -12,7 +12,6 @@
import org.bukkit.entity.EntityType;
import org.bukkit.entity.ExperienceOrb;
import org.bukkit.entity.Player;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -73,7 +72,7 @@ public Material getMaterial() {
return Material.EXPERIENCE_BOTTLE;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Launch.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Launch.java
index 7e0f7d24..d26b4e98 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Launch.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Launch.java
@@ -7,7 +7,6 @@
import io.github.sefiraat.crystamaehistoria.stories.definition.StoryType;
import org.bukkit.Material;
import org.bukkit.entity.Player;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -49,7 +48,7 @@ public Material getMaterial() {
return Material.BRAIN_CORAL;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/LavaLake.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/LavaLake.java
index dfe0c4ba..aae391a4 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/LavaLake.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/LavaLake.java
@@ -10,7 +10,6 @@
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -70,7 +69,7 @@ public Material getMaterial() {
return Material.LAVA_BUCKET;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/LeechBomb.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/LeechBomb.java
index f2f4a47a..10730204 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/LeechBomb.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/LeechBomb.java
@@ -17,7 +17,6 @@
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Mob;
import org.bukkit.entity.Player;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -96,7 +95,7 @@ public Material getMaterial() {
return Material.CARVED_PUMPKIN;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/LovePotion.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/LovePotion.java
index 2b2080ce..b46e612e 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/LovePotion.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/LovePotion.java
@@ -12,7 +12,6 @@
import org.bukkit.entity.Animals;
import org.bukkit.entity.Breedable;
import org.bukkit.entity.Entity;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -58,7 +57,7 @@ public Material getMaterial() {
return Material.POTION;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Oviparous.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Oviparous.java
index a5a2b271..58b66acf 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Oviparous.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Oviparous.java
@@ -17,7 +17,6 @@
import org.bukkit.entity.Turtle;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -83,7 +82,7 @@ public Material getMaterial() {
return Material.EGG;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/PhantomsFlight.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/PhantomsFlight.java
index b633e1fb..9cc033bf 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/PhantomsFlight.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/PhantomsFlight.java
@@ -14,7 +14,6 @@
import org.bukkit.Particle;
import org.bukkit.entity.Bat;
import org.bukkit.entity.EntityType;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -78,7 +77,7 @@ public Material getMaterial() {
return Material.DRAGON_EGG;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/PhilosophersStone.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/PhilosophersStone.java
index 6791d8c9..823e4e63 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/PhilosophersStone.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/PhilosophersStone.java
@@ -18,7 +18,6 @@
import org.bukkit.Tag;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -102,7 +101,7 @@ public Material getMaterial() {
return Material.GOLD_BLOCK;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/PlutosDecent.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/PlutosDecent.java
index d3371609..718c57ad 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/PlutosDecent.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/PlutosDecent.java
@@ -13,7 +13,6 @@
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import java.util.ArrayList;
@@ -131,7 +130,7 @@ public Material getMaterial() {
return Material.COBBLED_DEEPSLATE;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/PoisonNova.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/PoisonNova.java
index 30e08629..37f6afaf 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/PoisonNova.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/PoisonNova.java
@@ -16,7 +16,6 @@
import org.bukkit.entity.LivingEntity;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -97,7 +96,7 @@ public Material getMaterial() {
return Material.SLIME_BALL;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Prism.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Prism.java
index 93377da3..a8eeadea 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Prism.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Prism.java
@@ -12,7 +12,6 @@
import org.bukkit.Particle;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffectType;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -74,7 +73,7 @@ public Material getMaterial() {
return Material.POTION;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Protectorate.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Protectorate.java
index a5c264da..87b9e3fd 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Protectorate.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Protectorate.java
@@ -13,7 +13,6 @@
import org.bukkit.Particle;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -73,7 +72,7 @@ public Material getMaterial() {
return Material.SHIELD;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Push.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Push.java
index 49531e22..6101a063 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Push.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Push.java
@@ -12,7 +12,6 @@
import org.bukkit.Particle;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -70,7 +69,7 @@ public Material getMaterial() {
return Material.PISTON;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Quake.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Quake.java
index bd784946..d59e6c27 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Quake.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Quake.java
@@ -13,7 +13,6 @@
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.potion.PotionEffectType;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -80,7 +79,7 @@ public Material getMaterial() {
return Material.CRACKED_DEEPSLATE_BRICKS;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/RainOfFire.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/RainOfFire.java
index c7e3546e..a0335248 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/RainOfFire.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/RainOfFire.java
@@ -12,7 +12,6 @@
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -95,7 +94,7 @@ public Material getMaterial() {
return Material.FIRE_CHARGE;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Ravage.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Ravage.java
index 82acc924..a0aa01c5 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Ravage.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Ravage.java
@@ -14,7 +14,6 @@
import org.bukkit.Particle;
import org.bukkit.entity.EntityType;
import org.bukkit.potion.PotionEffectType;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -80,7 +79,7 @@ public Material getMaterial() {
return Material.RAVAGER_SPAWN_EGG;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/RemnantOfWar.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/RemnantOfWar.java
index 1c6884d6..3774fac0 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/RemnantOfWar.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/RemnantOfWar.java
@@ -16,7 +16,6 @@
import org.bukkit.entity.Zombie;
import org.bukkit.inventory.EntityEquipment;
import org.bukkit.inventory.ItemStack;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -130,7 +129,7 @@ public Material getMaterial() {
return Material.ZOMBIE_SPAWN_EGG;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Shroud.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Shroud.java
index 6065d5bb..d60156c6 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Shroud.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Shroud.java
@@ -12,7 +12,6 @@
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.potion.PotionEffectType;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -64,7 +63,7 @@ public Material getMaterial() {
return Material.BLACK_CANDLE;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/SpawnFiends.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/SpawnFiends.java
index 83f622bf..4b0aa88c 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/SpawnFiends.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/SpawnFiends.java
@@ -11,7 +11,6 @@
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Phantom;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -69,7 +68,7 @@ public Material getMaterial() {
return Material.PHANTOM_SPAWN_EGG;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Squall.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Squall.java
index 4a68c060..739850e7 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Squall.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Squall.java
@@ -11,7 +11,6 @@
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.entity.Player;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -56,7 +55,7 @@ public Material getMaterial() {
return Material.BUCKET;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/StarFall.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/StarFall.java
index b55d7010..34b34b76 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/StarFall.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/StarFall.java
@@ -15,7 +15,6 @@
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -102,7 +101,7 @@ public Material getMaterial() {
return Material.NETHER_STAR;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/StripMine.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/StripMine.java
index beafbe9d..eb4cfb60 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/StripMine.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/StripMine.java
@@ -10,7 +10,6 @@
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.util.Vector;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -72,7 +71,7 @@ public Material getMaterial() {
return Material.MINECART;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/SummonGolem.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/SummonGolem.java
index c0de1f14..468f92c2 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/SummonGolem.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/SummonGolem.java
@@ -16,7 +16,6 @@
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Mob;
import org.bukkit.entity.Player;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -84,7 +83,7 @@ public Material getMaterial() {
return Material.CARVED_PUMPKIN;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Teleport.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Teleport.java
index 52110666..399089b6 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Teleport.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Teleport.java
@@ -12,7 +12,6 @@
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.entity.Player;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -87,7 +86,7 @@ public Material getMaterial() {
return Material.ENDER_PEARL;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Tempest.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Tempest.java
index d086339a..cf691820 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Tempest.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Tempest.java
@@ -10,7 +10,6 @@
import org.bukkit.Material;
import org.bukkit.entity.LightningStrike;
import org.bukkit.entity.LivingEntity;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -86,7 +85,7 @@ public Material getMaterial() {
return Material.END_ROD;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/TimeCompression.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/TimeCompression.java
index e260539f..1b6f62cf 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/TimeCompression.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/TimeCompression.java
@@ -13,7 +13,6 @@
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.potion.PotionEffectType;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -79,7 +78,7 @@ public Material getMaterial() {
return Material.WAXED_CUT_COPPER;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/TimeDilation.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/TimeDilation.java
index b1948de1..7806a3eb 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/TimeDilation.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/TimeDilation.java
@@ -13,7 +13,6 @@
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.potion.PotionEffectType;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -79,7 +78,7 @@ public Material getMaterial() {
return Material.CUT_COPPER;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Tracer.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Tracer.java
index e7c9c23e..c1f79b33 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Tracer.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Tracer.java
@@ -19,7 +19,6 @@
import org.bukkit.entity.NPC;
import org.bukkit.entity.Player;
import org.bukkit.entity.WaterMob;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -109,7 +108,7 @@ public Material getMaterial() {
return Material.LEAD;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/TunnelBore.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/TunnelBore.java
index 57a0ec79..cf5a52f3 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/TunnelBore.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/TunnelBore.java
@@ -13,7 +13,6 @@
import org.bukkit.entity.EntityType;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.util.Vector;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -75,7 +74,7 @@ public Material getMaterial() {
return Material.GOAT_SPAWN_EGG;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Vacuum.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Vacuum.java
index 2965a525..7b559785 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Vacuum.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/Vacuum.java
@@ -14,7 +14,6 @@
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -67,13 +66,13 @@ public String[] getLore() {
};
}
- @NotNull
+ @Nonnull
@Override
public Material getMaterial() {
return Material.FISHING_ROD;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/WitherWeather.java b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/WitherWeather.java
index 728bcea1..33ef2018 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/WitherWeather.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/magic/spells/tier1/WitherWeather.java
@@ -11,7 +11,6 @@
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.WitherSkeleton;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -65,7 +64,7 @@ public Material getMaterial() {
return Material.WITHER_SKELETON_SKULL;
}
- @NotNull
+ @Nonnull
@Override
public RecipeSpell getRecipe() {
return new RecipeSpell(
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/player/BlockRank.java b/src/main/java/io/github/sefiraat/crystamaehistoria/player/BlockRank.java
new file mode 100644
index 00000000..87ff61a4
--- /dev/null
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/player/BlockRank.java
@@ -0,0 +1,45 @@
+package io.github.sefiraat.crystamaehistoria.player;
+
+import io.github.sefiraat.crystamaehistoria.utils.theme.ThemeType;
+import lombok.Getter;
+
+public enum BlockRank {
+
+ SME(100, ThemeType.RANK_BLOCK_SME),
+ MASTER_OF(90, ThemeType.RANK_BLOCK_MASTER_OF),
+ EXPERT_OF(70, ThemeType.RANK_BLOCK_EXPERT_OF),
+ RESEARCHED(50, ThemeType.RANK_BLOCK_RESEARCHED),
+ DETAILED(30, ThemeType.RANK_BLOCK_DETAILED),
+ KNOWN(20, ThemeType.RANK_BLOCK_KNOWN),
+ HEARD_OF(10, ThemeType.RANK_BLOCK_HEARD_OF),
+ UNKNOWN(0, ThemeType.RANK_BLOCK_UNKNOWN);
+
+ private final double numberRequired;
+ @Getter
+ private final ThemeType theme;
+
+ BlockRank(double numberRequired, ThemeType themeType) {
+ this.numberRequired = numberRequired;
+ this.theme = themeType;
+ }
+
+ public static BlockRank getByAmount(double percent) {
+ if (percent >= SME.numberRequired) {
+ return SME;
+ } else if (percent >= MASTER_OF.numberRequired) {
+ return MASTER_OF;
+ } else if (percent >= EXPERT_OF.numberRequired) {
+ return EXPERT_OF;
+ } else if (percent >= RESEARCHED.numberRequired) {
+ return RESEARCHED;
+ } else if (percent >= DETAILED.numberRequired) {
+ return DETAILED;
+ } else if (percent >= KNOWN.numberRequired) {
+ return KNOWN;
+ } else if (percent >= HEARD_OF.numberRequired) {
+ return HEARD_OF;
+ } else {
+ return UNKNOWN;
+ }
+ }
+}
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/player/PlayerStatistics.java b/src/main/java/io/github/sefiraat/crystamaehistoria/player/PlayerStatistics.java
new file mode 100644
index 00000000..71003b08
--- /dev/null
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/player/PlayerStatistics.java
@@ -0,0 +1,194 @@
+package io.github.sefiraat.crystamaehistoria.player;
+
+import io.github.sefiraat.crystamaehistoria.CrystamaeHistoria;
+import io.github.sefiraat.crystamaehistoria.magic.SpellType;
+import io.github.sefiraat.crystamaehistoria.stories.BlockDefinition;
+import io.github.sefiraat.crystamaehistoria.utils.theme.ThemeType;
+import org.bukkit.Material;
+import org.bukkit.configuration.ConfigurationSection;
+import org.bukkit.entity.Player;
+
+import javax.annotation.Nonnull;
+import javax.annotation.ParametersAreNonnullByDefault;
+import java.text.MessageFormat;
+import java.util.UUID;
+
+public class PlayerStatistics {
+
+ public static void unlockSpell(Player player, SpellType spellType) {
+ unlockSpell(player.getUniqueId(), spellType);
+ }
+
+ public static void unlockSpell(UUID player, SpellType spellType) {
+ String path = MessageFormat.format("{0}.{1}.{2}.UNLOCKED", player, StatType.SPELL, spellType.getId());
+ CrystamaeHistoria.getConfigManager().getPlayerStats().set(path, true);
+ }
+
+ public static boolean hasUnlockedSpell(Player player, SpellType spellType) {
+ return hasUnlockedSpell(player.getUniqueId(), spellType);
+ }
+
+ public static boolean hasUnlockedSpell(UUID player, SpellType spellType) {
+ String path = MessageFormat.format("{0}.{1}.{2}.UNLOCKED", player, StatType.SPELL, spellType.getId());
+ return CrystamaeHistoria.getConfigManager().getPlayerStats().getBoolean(path);
+ }
+
+ public static void addUsage(Player player, SpellType spellType) {
+ addUsage(player.getUniqueId(), spellType);
+ }
+
+ public static void addUsage(UUID player, SpellType spellType) {
+ int uses = getUsages(player, spellType);
+ uses++;
+ String path = MessageFormat.format("{0}.{1}.{2}.TIMES_CAST", player, StatType.SPELL, spellType.getId());
+ CrystamaeHistoria.getConfigManager().getPlayerStats().set(path, uses);
+ }
+
+ public static int getUsages(Player player, SpellType spellType) {
+ return getUsages(player.getUniqueId(), spellType);
+ }
+
+ public static int getUsages(UUID player, SpellType spellType) {
+ String path = MessageFormat.format("{0}.{1}.{2}.TIMES_CAST", player, StatType.SPELL, spellType.getId());
+ return CrystamaeHistoria.getConfigManager().getPlayerStats().getInt(path);
+ }
+
+ public static void unlockUniqueStory(Player player, BlockDefinition definition) {
+ unlockUniqueStory(player.getUniqueId(), definition);
+ }
+
+ public static void unlockUniqueStory(UUID player, BlockDefinition definition) {
+ String path = MessageFormat.format("{0}.{1}.{2}.UNLOCKED", player, StatType.STORY, definition.getMaterial());
+ CrystamaeHistoria.getConfigManager().getPlayerStats().set(path, true);
+ }
+
+ public static boolean hasUnlockedUniqueStory(Player player, BlockDefinition definition) {
+ return hasUnlockedUniqueStory(player.getUniqueId(), definition);
+ }
+
+ public static boolean hasUnlockedUniqueStory(UUID player, BlockDefinition definition) {
+ return hasUnlockedUniqueStory(player, definition.getMaterial());
+ }
+
+ public static boolean hasUnlockedUniqueStory(UUID player, Material material) {
+ String path = MessageFormat.format("{0}.{1}.{2}.UNLOCKED", player, StatType.STORY, material);
+ return CrystamaeHistoria.getConfigManager().getPlayerStats().getBoolean(path);
+ }
+
+ public static void addChronicle(Player player, BlockDefinition definition) {
+ addChronicle(player.getUniqueId(), definition);
+ }
+
+ public static void addChronicle(UUID player, BlockDefinition definition) {
+ int uses = getChronicle(player, definition);
+ uses++;
+ String path = MessageFormat.format("{0}.{1}.{2}.TIMES_CHRONICLED", player, StatType.STORY, definition.getMaterial());
+ CrystamaeHistoria.getConfigManager().getPlayerStats().set(path, uses);
+ }
+
+ public static int getChronicle(Player player, BlockDefinition definition) {
+ return getChronicle(player.getUniqueId(), definition);
+ }
+
+ public static int getChronicle(UUID player, BlockDefinition definition) {
+ String path = MessageFormat.format("{0}.{1}.{2}.TIMES_CHRONICLED", player, StatType.STORY, definition.getMaterial());
+ return CrystamaeHistoria.getConfigManager().getPlayerStats().getInt(path);
+ }
+
+ public static void addRealisation(Player player, BlockDefinition definition) {
+ addChronicle(player.getUniqueId(), definition);
+ }
+
+ public static void addRealisation(UUID player, BlockDefinition definition) {
+ int uses = getRealisation(player, definition);
+ uses++;
+ String path = MessageFormat.format("{0}.{1}.{2}.TIMES_REALISED", player, StatType.STORY, definition.getMaterial());
+ CrystamaeHistoria.getConfigManager().getPlayerStats().set(path, uses);
+ }
+
+ public static int getRealisation(Player player, BlockDefinition definition) {
+ return getChronicle(player.getUniqueId(), definition);
+ }
+
+ public static int getRealisation(UUID player, BlockDefinition definition) {
+ String path = MessageFormat.format("{0}.{1}.{2}.TIMES_REALISED", player, StatType.STORY, definition.getMaterial());
+ return CrystamaeHistoria.getConfigManager().getPlayerStats().getInt(path);
+ }
+
+ @ParametersAreNonnullByDefault
+ public static BlockRank getBlockRank(UUID uuid, BlockDefinition definition) {
+ final int chronicleAmount = Math.min(getChronicle(uuid, definition), 100);
+ final int realisedAmount = Math.min(getRealisation(uuid, definition), 100);
+ final int blockValue = (chronicleAmount + realisedAmount) / 2;
+ return BlockRank.getByAmount(blockValue);
+ }
+
+
+ public static int getStoriesUnlocked(@Nonnull UUID uuid) {
+ String path = MessageFormat.format("{0}.{1}", uuid, StatType.STORY);
+ ConfigurationSection section = CrystamaeHistoria.getConfigManager().getPlayerStats().getConfigurationSection(path);
+ int unlocked = 0;
+ for (String story : section.getKeys(false)) {
+ String storyPath = MessageFormat.format("{0}.{1}.{2}.UNLOCKED", uuid, StatType.STORY, story);
+ if (CrystamaeHistoria.getConfigManager().getPlayerStats().getBoolean(storyPath)) unlocked++;
+ }
+ return unlocked;
+ }
+
+ public static StoryRank getStoryRank(@Nonnull UUID uuid) {
+ int total = CrystamaeHistoria.getStoriesManager().getBlockDefinitionMap().size();
+ final int unlocked = getStoriesUnlocked(uuid);
+ return StoryRank.getByPercent(((double) unlocked / total) * 100);
+ }
+
+ public static String getStoryRankString(@Nonnull UUID uuid) {
+ int total = CrystamaeHistoria.getStoriesManager().getBlockDefinitionMap().size();
+ int unlocked = getStoriesUnlocked(uuid);
+ StoryRank storyRank = StoryRank.getByPercent(((double) unlocked / total) * 100);
+ return MessageFormat.format(
+ "{0}Chronicler Rank: {1}{2}{0} ({3}/{4})",
+ ThemeType.PASSIVE.getColor(),
+ storyRank.getTheme().getColor(),
+ storyRank.getTheme().getLoreLine(),
+ unlocked,
+ total
+ );
+ }
+
+ public static int getSpellsUnlocked(@Nonnull UUID uuid) {
+ String path = MessageFormat.format("{0}.{1}", uuid, StatType.SPELL);
+ ConfigurationSection section = CrystamaeHistoria.getConfigManager().getPlayerStats().getConfigurationSection(path);
+ int unlocked = 0;
+ for (String spell : section.getKeys(false)) {
+ String storyPath = MessageFormat.format("{0}.{1}.{2}.UNLOCKED", uuid, StatType.SPELL, spell);
+ if (CrystamaeHistoria.getConfigManager().getPlayerStats().getBoolean(storyPath)) unlocked++;
+ }
+ return unlocked;
+ }
+
+ public static SpellRank getSpellRank(@Nonnull UUID uuid) {
+ int total = SpellType.getEnabledSpells().length;
+ int unlocked = getSpellsUnlocked(uuid);
+ return SpellRank.getByPercent(((double) unlocked / total) * 100);
+ }
+
+ public static String getSpellRankString(@Nonnull UUID uuid) {
+ int total = SpellType.getEnabledSpells().length;
+ int unlocked = getSpellsUnlocked(uuid);
+ SpellRank spellRank = SpellRank.getByPercent(((double) unlocked / total) * 100);
+ return MessageFormat.format(
+ "{0}Crystamae Rank: {1}{2}{0} ({3}/{4})",
+ ThemeType.PASSIVE.getColor(),
+ spellRank.getTheme().getColor(),
+ spellRank.getTheme().getLoreLine(),
+ unlocked,
+ total
+ );
+ }
+
+ enum StatType {
+ SPELL,
+ STORY
+ }
+}
+
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/player/SpellRank.java b/src/main/java/io/github/sefiraat/crystamaehistoria/player/SpellRank.java
new file mode 100644
index 00000000..9b8466b5
--- /dev/null
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/player/SpellRank.java
@@ -0,0 +1,45 @@
+package io.github.sefiraat.crystamaehistoria.player;
+
+import io.github.sefiraat.crystamaehistoria.utils.theme.ThemeType;
+import lombok.Getter;
+
+public enum SpellRank {
+
+ GRANDMASTER_MAGI(100, ThemeType.RANK_SPELL_GRANDMASTER_MAGI),
+ MASTER_MAGI(90, ThemeType.RANK_SPELL_MASTER_MAGI),
+ MAGI(70, ThemeType.RANK_SPELL_MAGI),
+ SORCERER(50, ThemeType.RANK_SPELL_SORCERER),
+ CONJURER(30, ThemeType.RANK_SPELL_CONJURER),
+ WIZARD(20, ThemeType.RANK_SPELL_WIZARD),
+ MAGE(10, ThemeType.RANK_SPELL_MAGE),
+ APPRENTICE(0, ThemeType.RANK_SPELL_APPRENTICE);
+
+ private final double percentRequired;
+ @Getter
+ private final ThemeType theme;
+
+ SpellRank(double percentRequired, ThemeType themeType) {
+ this.percentRequired = percentRequired;
+ this.theme = themeType;
+ }
+
+ public static SpellRank getByPercent(double percent) {
+ if (percent >= GRANDMASTER_MAGI.percentRequired) {
+ return GRANDMASTER_MAGI;
+ } else if (percent >= MASTER_MAGI.percentRequired) {
+ return MASTER_MAGI;
+ } else if (percent >= MAGI.percentRequired) {
+ return MAGI;
+ } else if (percent >= SORCERER.percentRequired) {
+ return SORCERER;
+ } else if (percent >= CONJURER.percentRequired) {
+ return CONJURER;
+ } else if (percent >= WIZARD.percentRequired) {
+ return WIZARD;
+ } else if (percent >= MAGE.percentRequired) {
+ return MAGE;
+ } else {
+ return APPRENTICE;
+ }
+ }
+}
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/player/StoryRank.java b/src/main/java/io/github/sefiraat/crystamaehistoria/player/StoryRank.java
new file mode 100644
index 00000000..b6c0e383
--- /dev/null
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/player/StoryRank.java
@@ -0,0 +1,45 @@
+package io.github.sefiraat.crystamaehistoria.player;
+
+import io.github.sefiraat.crystamaehistoria.utils.theme.ThemeType;
+import lombok.Getter;
+
+public enum StoryRank {
+
+ EMERITUS_PROFESSOR(100, ThemeType.RANK_STORY_EMERITUS_PROFESSOR),
+ ADJUNCT_PROFESSOR(90, ThemeType.RANK_STORY_ADJUNCT_PROFESSOR),
+ PROFESSOR(70, ThemeType.RANK_STORY_PROFESSOR),
+ LECTURER(50, ThemeType.RANK_STORY_LECTURER),
+ READER(30, ThemeType.RANK_STORY_READER),
+ RESEARCHER(20, ThemeType.RANK_STORY_RESEARCHER),
+ STUDENT(10, ThemeType.RANK_STORY_STUDENT),
+ PUPIL(0, ThemeType.RANK_STORY_PUPIL);
+
+ private final double percentRequired;
+ @Getter
+ private final ThemeType theme;
+
+ StoryRank(double percentRequired, ThemeType themeType) {
+ this.percentRequired = percentRequired;
+ this.theme = themeType;
+ }
+
+ public static StoryRank getByPercent(double percent) {
+ if (percent >= EMERITUS_PROFESSOR.percentRequired) {
+ return EMERITUS_PROFESSOR;
+ } else if (percent >= ADJUNCT_PROFESSOR.percentRequired) {
+ return ADJUNCT_PROFESSOR;
+ } else if (percent >= PROFESSOR.percentRequired) {
+ return PROFESSOR;
+ } else if (percent >= LECTURER.percentRequired) {
+ return LECTURER;
+ } else if (percent >= READER.percentRequired) {
+ return READER;
+ } else if (percent >= RESEARCHER.percentRequired) {
+ return RESEARCHER;
+ } else if (percent >= STUDENT.percentRequired) {
+ return STUDENT;
+ } else {
+ return PUPIL;
+ }
+ }
+}
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/Gadgets.java b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/Gadgets.java
index e87ad1ff..00b297d1 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/Gadgets.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/Gadgets.java
@@ -10,6 +10,8 @@
import io.github.sefiraat.crystamaehistoria.slimefun.gadgets.MobLamp;
import io.github.sefiraat.crystamaehistoria.slimefun.gadgets.MobMat;
import io.github.sefiraat.crystamaehistoria.slimefun.gadgets.MysteriousTicker;
+import io.github.sefiraat.crystamaehistoria.slimefun.gadgets.TrophyDisplay;
+import io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.DisplayStandHolder;
import io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.liquefactionbasin.DummyLiquefactionBasinCrafting;
import io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.liquefactionbasin.LiquefactionBasinCache;
import io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.liquefactionbasin.RecipeItem;
@@ -74,6 +76,8 @@ public class Gadgets {
private static GreenHouseGlass greenHouseGlass;
@Getter
private static GreenHouseGlass focusedGreenHouseGlass;
+ @Getter
+ private static TrophyDisplay trophyDisplay;
public static void setup() {
@@ -378,7 +382,7 @@ public static void setup() {
ThemeType.themedSlimefunItemStack(
"CRY_EXP_COLLECTOR_2",
new ItemStack(Material.LIGHTNING_ROD),
- ThemeType.MECHANISM,
+ ThemeType.GADGET,
"Infused Exp Collector",
"Further infusion has made the",
"collector even more powerful.",
@@ -624,6 +628,30 @@ amalgamateDustEpic, new ItemStack(Material.GLASS), amalgamateDustEpic,
10
);
+ // Trophy Stand
+ RecipeItem trophyDisplayRecipe = new RecipeItem(
+ new ItemStack(Material.POLISHED_BLACKSTONE_BRICK_WALL),
+ StoryType.MECHANICAL, 10,
+ StoryType.HUMAN, 10,
+ StoryType.PHILOSOPHICAL, 10
+ );
+ trophyDisplay = new TrophyDisplay(
+ ItemGroups.GADGETS,
+ ThemeType.themedSlimefunItemStack(
+ "CRY_TROPHY_DISPLAY_1",
+ new ItemStack(Material.POLISHED_BLACKSTONE_BRICK_WALL),
+ ThemeType.GADGET,
+ "Trophy Display",
+ "Used to place your trophies on to show",
+ "off to the world.",
+ "",
+ "Currently allowable trophies include:",
+ ThemeType.CLICK_INFO.getColor() + "A block in which you have a S.M.E. rank"
+ ),
+ DummyLiquefactionBasinCrafting.TYPE,
+ trophyDisplayRecipe.getDisplayRecipe()
+ );
+
// Slimefun Registry
abstractionLamp.register(plugin);
dispersionLamp.register(plugin);
@@ -645,6 +673,7 @@ amalgamateDustEpic, new ItemStack(Material.GLASS), amalgamateDustEpic,
mysteriousPlant.register(plugin);
greenHouseGlass.register(plugin);
focusedGreenHouseGlass.register(plugin);
+ trophyDisplay.register(plugin);
// Liquefaction Recipes
LiquefactionBasinCache.addCraftingRecipe(abstractionLamp, abstractionLampRecipe);
@@ -669,5 +698,7 @@ amalgamateDustEpic, new ItemStack(Material.GLASS), amalgamateDustEpic,
LiquefactionBasinCache.addCraftingRecipe(mysteriousPlant, mysteriousPlantRecipe);
LiquefactionBasinCache.addCraftingRecipe(focusedGreenHouseGlass, focusedGreenHouseGlassRecipe);
+
+ LiquefactionBasinCache.addCraftingRecipe(trophyDisplay, trophyDisplayRecipe);
}
}
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/ItemGroups.java b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/ItemGroups.java
index 401a6e91..f20649bd 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/ItemGroups.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/ItemGroups.java
@@ -1,11 +1,15 @@
package io.github.sefiraat.crystamaehistoria.slimefun;
import io.github.sefiraat.crystamaehistoria.CrystamaeHistoria;
+import io.github.sefiraat.crystamaehistoria.slimefun.itemgroups.DummyGuideOnly;
import io.github.sefiraat.crystamaehistoria.slimefun.itemgroups.DummyItemGroup;
+import io.github.sefiraat.crystamaehistoria.slimefun.itemgroups.MainFlexGroup;
import io.github.sefiraat.crystamaehistoria.slimefun.itemgroups.SpellCollectionFlexGroup;
import io.github.sefiraat.crystamaehistoria.slimefun.itemgroups.StoryCollectionFlexGroup;
import io.github.sefiraat.crystamaehistoria.utils.Keys;
import io.github.sefiraat.crystamaehistoria.utils.theme.ThemeType;
+import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.api.items.groups.NestedItemGroup;
import io.github.thebusybiscuit.slimefun4.api.items.groups.SubItemGroup;
import io.github.thebusybiscuit.slimefun4.libraries.dough.items.CustomItemStack;
@@ -16,59 +20,62 @@
@UtilityClass
public final class ItemGroups {
- public static final NestedItemGroup MAIN = new NestedItemGroup(
+ public static final DummyItemGroup DUMMY_ITEM_GROUP = new DummyItemGroup(
+ Keys.newKey("dummy"),
+ new CustomItemStack(
+ new ItemStack(Material.FIRE_CHARGE),
+ ThemeType.MAIN.getColor() + "Dummy Crystamae Historia"
+ )
+ );
+ public static final MainFlexGroup MAIN = new MainFlexGroup(
Keys.newKey("main"),
new CustomItemStack(
new ItemStack(Material.AMETHYST_CLUSTER),
ThemeType.MAIN.getColor() + "Crystamae Historia"
)
);
-
- public static final SubItemGroup MECHANISMS = new SubItemGroup(
+ public static final DummyItemGroup MECHANISMS = new DummyItemGroup(
Keys.newKey("mechanisms"),
- MAIN,
new CustomItemStack(
new ItemStack(Material.DEEPSLATE_TILE_SLAB),
ThemeType.MAIN.getColor() + "Historia Mechanisms"
)
);
-
- public static final SubItemGroup CRYSTALS = new SubItemGroup(
+ public static final DummyItemGroup CRYSTALS = new DummyItemGroup(
Keys.newKey("crystals"),
- MAIN,
new CustomItemStack(
new ItemStack(Material.AMETHYST_CLUSTER),
ThemeType.MAIN.getColor() + "Historia Crystals"
)
);
-
- public static final SubItemGroup TOOLS = new SubItemGroup(
+ public static final DummyItemGroup TOOLS = new DummyItemGroup(
Keys.newKey("tools"),
- MAIN,
new CustomItemStack(
new ItemStack(Material.STICK),
- ThemeType.MAIN.getColor() + "Historia Staves and Materials"
+ ThemeType.MAIN.getColor() + "Historia Staves and Tool"
)
);
-
- public static final SubItemGroup GADGETS = new SubItemGroup(
+ public static final DummyItemGroup GADGETS = new DummyItemGroup(
Keys.newKey("gadgets"),
- MAIN,
new CustomItemStack(
new ItemStack(Material.REDSTONE_LAMP),
ThemeType.MAIN.getColor() + "Magical Tech and Gadgets"
)
);
-
- public static final SubItemGroup MATERIALS = new SubItemGroup(
+ public static final DummyItemGroup MATERIALS = new DummyItemGroup(
Keys.newKey("materials"),
- MAIN,
new CustomItemStack(
new ItemStack(Material.GOLD_INGOT),
ThemeType.MAIN.getColor() + "Crystamae Raw Materials"
)
);
-
+ public static final DummyItemGroup GUIDE = new DummyItemGroup(
+ Keys.newKey("guide"),
+ new CustomItemStack(
+ new ItemStack(Material.BOOK),
+ ThemeType.MAIN.getColor() + "Crystamae Misc Guides"
+ )
+ );
public static final StoryCollectionFlexGroup STORY_COLLECTION = new StoryCollectionFlexGroup(
Keys.newKey("story_collection"),
new CustomItemStack(
@@ -76,7 +83,6 @@ public final class ItemGroups {
ThemeType.MAIN.getColor() + "Story Collection"
)
);
-
public static final SpellCollectionFlexGroup SPELL_COLLECTION = new SpellCollectionFlexGroup(
Keys.newKey("spell_collection"),
new CustomItemStack(
@@ -85,19 +91,152 @@ public final class ItemGroups {
)
);
- public static final DummyItemGroup DUMMY_ITEM_GROUP = new DummyItemGroup(
- Keys.newKey("dummy"),
- new CustomItemStack(
- new ItemStack(Material.FIRE_CHARGE),
- ThemeType.MAIN.getColor() + "Dummy Crystamae Historia"
- )
- );
public static void setup() {
final CrystamaeHistoria plugin = CrystamaeHistoria.getInstance();
+ /*
+ These items are for the misc guide which serves to inform players
+ how the more abstract mechanics work where a true recipe doesn't
+ suit or would be detrimental to the process.
+ */
+
+ // Chronicler
+ SlimefunItem guideChronicler = new SlimefunItem(
+ ItemGroups.GUIDE,
+ ThemeType.themedSlimefunItemStack(
+ "CRY_GUIDE_CHRONICLER",
+ new ItemStack(Material.DEEPSLATE_TILE_SLAB),
+ ThemeType.GUIDE,
+ "Chronicler Panel Guide",
+ "The chronicler panel will take a block",
+ "and 'learn' the stories it has. The type of",
+ "stories is determined by the block and the",
+ "amount is random but based on tier.",
+ "",
+ "A chronicler can only work on blocks of",
+ "a matching tier + 1.",
+ "",
+ "A block is finished when it's unique",
+ "story has been chronicled and the block",
+ "stops floating."
+ ),
+ DummyGuideOnly.TYPE,
+ new ItemStack[]{}
+ );
+
+ // Realisation
+ SlimefunItem guideRealisation = new SlimefunItem(
+ ItemGroups.GUIDE,
+ ThemeType.themedSlimefunItemStack(
+ "CRY_GUIDE_REALISATION",
+ new ItemStack(Material.CHISELED_DEEPSLATE),
+ ThemeType.GUIDE,
+ "Realisation Altar Guide",
+ "Place a fully chronicled block onto",
+ "the Realisation Altar and it will start",
+ "to consume it's stories and turn them",
+ "into a crystalline structure on the ground",
+ "nearby.",
+ "",
+ "These crystal will slowly grow",
+ "and, when fully formed, can be broken",
+ "into Crystamae."
+ ),
+ DummyGuideOnly.TYPE,
+ new ItemStack[]{}
+ );
+
+ // Liquefaction
+ SlimefunItem guideLiquefaction = new SlimefunItem(
+ ItemGroups.GUIDE,
+ ThemeType.themedSlimefunItemStack(
+ "CRY_GUIDE_LIQUEFACTION",
+ new ItemStack(Material.CAULDRON),
+ ThemeType.GUIDE,
+ "Liquefaction Basin Guide",
+ "The Liquefaction Basin is where you",
+ "can finally make cool things.",
+ "",
+ "Any Crystamae crystal you throw in",
+ "will be melted down into a liquid.",
+ "When you throw in an item that is",
+ "not a crystal, it will use that to try",
+ "to make an item.",
+ "",
+ "Get it wrong and you lose your Crysta."
+ ),
+ DummyGuideOnly.TYPE,
+ new ItemStack[]{}
+ );
+
+ // Stave Configurator
+ SlimefunItem guideStave = new SlimefunItem(
+ ItemGroups.GUIDE,
+ ThemeType.themedSlimefunItemStack(
+ "CRY_GUIDE_STAVE_CONFIGURATOR",
+ new ItemStack(Material.CAULDRON),
+ ThemeType.GUIDE,
+ "Stave Configurator",
+ "Put a stave into the input slot of the",
+ "configurator. Add charged spell plates",
+ "into the four spell slots then click",
+ "'Add Plates'. Click 'Remove' to remove",
+ "them again.",
+ "",
+ "Spells can be changed freely without cost."
+ ),
+ DummyGuideOnly.TYPE,
+ new ItemStack[]{}
+ );
+
+ // Make a Spell
+ SlimefunItem guideMakeSpell = new SlimefunItem(
+ ItemGroups.GUIDE,
+ ThemeType.themedSlimefunItemStack(
+ "CRY_GUIDE_MAKE_SPELL",
+ new ItemStack(Material.PAPER),
+ ThemeType.GUIDE,
+ "How To: Make a spell",
+ "To make a spell, first craft a Basic",
+ "Spell Plate. The in the Liquefaction",
+ "Basin, fill with at least 3 different",
+ "types of Crystamae - then throw in the",
+ "Plate"
+ ),
+ DummyGuideOnly.TYPE,
+ new ItemStack[]{}
+ );
+
+ // Recharge a Spell
+ SlimefunItem guideChargeSpell = new SlimefunItem(
+ ItemGroups.GUIDE,
+ ThemeType.themedSlimefunItemStack(
+ "CRY_GUIDE_CHARGE_SPELL",
+ new ItemStack(Material.PAPER),
+ ThemeType.GUIDE,
+ "How To: Recharge a spell",
+ "To refill a plate with crysta first",
+ "take it off of the stave using the",
+ "configurator. then in the Liquefaction",
+ "Basin, make the spell recipe and throw",
+ "the charged plate in. It will refill",
+ "the Crysta inside."
+ ),
+ DummyGuideOnly.TYPE,
+ new ItemStack[]{}
+ );
+
// Slimefun Registry
- ItemGroups.STORY_COLLECTION.register(plugin);
- ItemGroups.SPELL_COLLECTION.register(plugin);
+ ItemGroups.MAIN.register(plugin);
+ //ItemGroups.STORY_COLLECTION.register(plugin);
+ //ItemGroups.SPELL_COLLECTION.register(plugin);
+
+ guideChronicler.register(plugin);
+ guideRealisation.register(plugin);
+ guideLiquefaction.register(plugin);
+ guideStave.register(plugin);
+ guideMakeSpell.register(plugin);
+ guideChargeSpell.register(plugin);
}
}
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/EnderInhibitor.java b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/EnderInhibitor.java
index 9b9d88b7..9bbba7a4 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/EnderInhibitor.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/EnderInhibitor.java
@@ -16,8 +16,8 @@
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.inventory.ItemStack;
-import org.jetbrains.annotations.NotNull;
+import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
import java.util.List;
@@ -33,7 +33,7 @@ public EnderInhibitor(ItemGroup category, SlimefunItemStack item, RecipeType rec
this.addItemHandler(
new BlockPlaceHandler(false) {
@Override
- public void onPlayerPlace(@NotNull BlockPlaceEvent event) {
+ public void onPlayerPlace(@Nonnull BlockPlaceEvent event) {
BlockStorage.addBlockInfo(event.getBlock(), "CH_UUID", event.getPlayer().getUniqueId().toString());
}
},
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/GreenHouseGlass.java b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/GreenHouseGlass.java
index 6ad7cbbd..2d77294f 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/GreenHouseGlass.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/GreenHouseGlass.java
@@ -22,8 +22,8 @@
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.RayTraceResult;
-import org.jetbrains.annotations.NotNull;
+import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
import java.util.HashMap;
import java.util.List;
@@ -45,7 +45,7 @@ public GreenHouseGlass(ItemGroup category, SlimefunItemStack item, RecipeType re
}
@Override
- protected void onTick(@NotNull Block block, @NotNull SlimefunItem slimefunItem, @NotNull Config config) {
+ protected void onTick(@Nonnull Block block, @Nonnull SlimefunItem slimefunItem, @Nonnull Config config) {
if (!GeneralUtils.testChance(this.rate, 100) || TimePeriod.isLight(block.getWorld())) {
return;
}
@@ -84,7 +84,7 @@ protected void onTick(@NotNull Block block, @NotNull SlimefunItem slimefunItem,
}
@Override
- protected void onFirstTick(@NotNull Block block, @NotNull SlimefunItem slimefunItem, @NotNull Config config) {
+ protected void onFirstTick(@Nonnull Block block, @Nonnull SlimefunItem slimefunItem, @Nonnull Config config) {
blockOwnerMap.put(
block.getLocation(),
UUID.fromString(BlockStorage.getLocationInfo(block.getLocation(), "CH_UUID"))
@@ -92,14 +92,14 @@ protected void onFirstTick(@NotNull Block block, @NotNull SlimefunItem slimefunI
}
@Override
- protected void onPlace(@NotNull BlockPlaceEvent event) {
+ protected void onPlace(@Nonnull BlockPlaceEvent event) {
final UUID uuid = event.getPlayer().getUniqueId();
BlockStorage.addBlockInfo(event.getBlock(), "CH_UUID", uuid.toString());
blockOwnerMap.put(event.getBlock().getLocation(), uuid);
}
@Override
- protected void onBreak(@NotNull BlockBreakEvent blockBreakEvent, @NotNull ItemStack itemStack, @NotNull List list) {
+ protected void onBreak(@Nonnull BlockBreakEvent blockBreakEvent, @Nonnull ItemStack itemStack, @Nonnull List list) {
// No on break
}
}
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/MobCandle.java b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/MobCandle.java
index 56010f3f..d9f5d321 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/MobCandle.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/MobCandle.java
@@ -19,8 +19,8 @@
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.BoundingBox;
-import org.jetbrains.annotations.NotNull;
+import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
import java.util.HashMap;
import java.util.List;
@@ -43,7 +43,7 @@ public MobCandle(ItemGroup category, SlimefunItemStack item, RecipeType recipeTy
}
@Override
- protected void onFirstTick(@NotNull Block block, @NotNull SlimefunItem slimefunItem, @NotNull Config config) {
+ protected void onFirstTick(@Nonnull Block block, @Nonnull SlimefunItem slimefunItem, @Nonnull Config config) {
Long expiry = Long.valueOf(BlockStorage.getLocationInfo(block.getLocation(), "EXPIRY"));
expiryMap.put(block.getLocation(), expiry);
Candle candle = (Candle) block.getBlockData();
@@ -57,7 +57,7 @@ protected void onFirstTick(@NotNull Block block, @NotNull SlimefunItem slimefunI
}
@Override
- protected void onTick(@NotNull Block block, @NotNull SlimefunItem slimefunItem, @NotNull Config config) {
+ protected void onTick(@Nonnull Block block, @Nonnull SlimefunItem slimefunItem, @Nonnull Config config) {
Location location = block.getLocation();
BoundingBox boundingBox = new BoundingBox(
location.getX() - radius,
@@ -82,14 +82,14 @@ protected void onTick(@NotNull Block block, @NotNull SlimefunItem slimefunItem,
}
@Override
- protected void onPlace(@NotNull BlockPlaceEvent event) {
+ protected void onPlace(@Nonnull BlockPlaceEvent event) {
Long expiry = System.currentTimeMillis() + (duration * 1000L);
BlockStorage.addBlockInfo(event.getBlock(), "EXPIRY", String.valueOf(expiry));
expiryMap.put(event.getBlock().getLocation(), expiry);
}
@Override
- protected void onBreak(@NotNull BlockBreakEvent blockBreakEvent, @NotNull ItemStack itemStack, @NotNull List list) {
+ protected void onBreak(@Nonnull BlockBreakEvent blockBreakEvent, @Nonnull ItemStack itemStack, @Nonnull List list) {
BlockStorage.clearBlockInfo(blockBreakEvent.getBlock());
}
}
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/MobFan.java b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/MobFan.java
index d903fc76..6c742777 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/MobFan.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/MobFan.java
@@ -24,8 +24,8 @@
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.RayTraceResult;
import org.bukkit.util.Vector;
-import org.jetbrains.annotations.NotNull;
+import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
import java.util.List;
import java.util.UUID;
@@ -55,7 +55,7 @@ public MobFan(ItemGroup category, SlimefunItemStack item, RecipeType recipeType,
this.addItemHandler(
new BlockPlaceHandler(false) {
@Override
- public void onPlayerPlace(@NotNull BlockPlaceEvent event) {
+ public void onPlayerPlace(@Nonnull BlockPlaceEvent event) {
BlockStorage.addBlockInfo(event.getBlock(), ID_UUID, event.getPlayer().getUniqueId().toString());
BlockStorage.addBlockInfo(event.getBlock(), ID_DIRECTION, BlockFace.SELF.name());
}
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/MobLamp.java b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/MobLamp.java
index 7dfbdd69..8359cf7c 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/MobLamp.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/MobLamp.java
@@ -16,8 +16,8 @@
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.inventory.ItemStack;
-import org.jetbrains.annotations.NotNull;
+import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
import java.util.List;
import java.util.UUID;
@@ -37,7 +37,7 @@ public MobLamp(ItemGroup category, SlimefunItemStack item, RecipeType recipeType
this.addItemHandler(
new BlockPlaceHandler(false) {
@Override
- public void onPlayerPlace(@NotNull BlockPlaceEvent event) {
+ public void onPlayerPlace(@Nonnull BlockPlaceEvent event) {
BlockStorage.addBlockInfo(event.getBlock(), "CH_UUID", event.getPlayer().getUniqueId().toString());
}
},
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/MobMat.java b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/MobMat.java
index d7e7f747..16687141 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/MobMat.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/MobMat.java
@@ -20,7 +20,6 @@
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.inventory.ItemStack;
-import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@@ -81,14 +80,14 @@ protected void onTick(@Nonnull Block block, @Nonnull SlimefunItem slimefunItem,
}
@Override
- protected void onPlace(@NotNull BlockPlaceEvent event) {
+ protected void onPlace(@Nonnull BlockPlaceEvent event) {
final UUID uuid = event.getPlayer().getUniqueId();
BlockStorage.addBlockInfo(event.getBlock(), "CH_UUID", uuid.toString());
blockOwnerMap.put(event.getBlock().getLocation(), uuid);
}
@Override
- protected void onBreak(@NotNull BlockBreakEvent blockBreakEvent, @NotNull ItemStack itemStack, @NotNull List list) {
+ protected void onBreak(@Nonnull BlockBreakEvent blockBreakEvent, @Nonnull ItemStack itemStack, @Nonnull List list) {
BlockStorage.clearBlockInfo(blockBreakEvent.getBlock());
}
}
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/TrophyDisplay.java b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/TrophyDisplay.java
new file mode 100644
index 00000000..a53440ec
--- /dev/null
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/gadgets/TrophyDisplay.java
@@ -0,0 +1,170 @@
+package io.github.sefiraat.crystamaehistoria.slimefun.gadgets;
+
+import io.github.sefiraat.crystamaehistoria.CrystamaeHistoria;
+import io.github.sefiraat.crystamaehistoria.player.BlockRank;
+import io.github.sefiraat.crystamaehistoria.player.PlayerStatistics;
+import io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.TickingBlockNoGui;
+import io.github.sefiraat.crystamaehistoria.stories.BlockDefinition;
+import io.github.sefiraat.crystamaehistoria.utils.GeneralUtils;
+import io.github.sefiraat.crystamaehistoria.utils.ParticleUtils;
+import io.github.sefiraat.crystamaehistoria.utils.TextUtils;
+import io.github.thebusybiscuit.slimefun4.api.events.PlayerRightClickEvent;
+import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
+import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;
+import io.github.thebusybiscuit.slimefun4.core.handlers.BlockUseHandler;
+import lombok.Getter;
+import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
+import me.mrCookieSlime.Slimefun.api.BlockStorage;
+import net.md_5.bungee.api.ChatColor;
+import org.bukkit.Bukkit;
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.Particle;
+import org.bukkit.block.Block;
+import org.bukkit.entity.Item;
+import org.bukkit.entity.Player;
+import org.bukkit.event.block.BlockBreakEvent;
+import org.bukkit.event.block.BlockPlaceEvent;
+import org.bukkit.inventory.ItemStack;
+import org.jetbrains.annotations.NotNull;
+
+import javax.annotation.ParametersAreNonnullByDefault;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.UUID;
+import java.util.concurrent.ThreadLocalRandom;
+
+public class TrophyDisplay extends TickingBlockNoGui {
+
+ private static final String PDC_ITEM = "itemUUID";
+
+ @Getter
+ private final Map itemMap = new HashMap<>();
+ @Getter
+ private final Map currentTickMap = new HashMap<>();
+
+ @ParametersAreNonnullByDefault
+ public TrophyDisplay(ItemGroup category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
+ super(category, item, recipeType, recipe);
+ this.addItemHandler((BlockUseHandler) this::onRightClick);
+ }
+
+ @Override
+ protected void onFirstTick(@NotNull Block block, @NotNull SlimefunItem slimefunItem, @NotNull Config config) {
+ final Location blockLocation = block.getLocation();
+ String itemUuidString = BlockStorage.getLocationInfo(block.getLocation(), PDC_ITEM);
+ if (itemUuidString != null) {
+ itemMap.put(block.getLocation(), UUID.fromString(itemUuidString));
+ }
+ // Set a random current tick
+ TrophyDisplay.this.currentTickMap.put(
+ blockLocation,
+ ThreadLocalRandom.current().nextInt(3, 7)
+ );
+ }
+
+ @Override
+ protected void onTick(@NotNull Block block, @NotNull SlimefunItem slimefunItem, @NotNull Config config) {
+ final Location blockLocation = block.getLocation();
+ final UUID currentItemUuid = itemMap.get(blockLocation);
+
+ // If an item isn't in place, then don't do anything
+ if (currentItemUuid != null) {
+ int currentTick = currentTickMap.get(blockLocation);
+
+ // Only tick periodically
+ if (currentTick <= 0 && TrophyDisplay.this.itemMap.containsKey(blockLocation)) {
+ final Item currentItem = (Item) Bukkit.getEntity(currentItemUuid);
+ final Location itemLocation = currentItem.getLocation();
+ final Location desiredLocation = blockLocation.clone().add(0.5, 1.5, 0.5);
+
+ // Check if item has moved off the platform
+ if (itemLocation.distance(desiredLocation) > 0.3) {
+ final ItemStack itemStack = currentItem.getItemStack();
+ blockLocation.getWorld().dropItemNaturally(blockLocation, itemStack);
+ BlockStorage.addBlockInfo(block, PDC_ITEM, null);
+ itemMap.remove(blockLocation);
+ currentItem.remove();
+ }
+
+ ParticleUtils.displayParticleEffect(itemLocation.add(0, 0.2, 0), Particle.WAX_ON, 0.2, 3);
+ TrophyDisplay.this.currentTickMap.put(blockLocation, ThreadLocalRandom.current().nextInt(4, 8));
+ } else {
+ currentTick--;
+ TrophyDisplay.this.currentTickMap.put(blockLocation, currentTick);
+ }
+ }
+ }
+
+ @Override
+ protected void onPlace(@NotNull BlockPlaceEvent event) {
+ TrophyDisplay.this.currentTickMap.put(
+ event.getBlock().getLocation(),
+ ThreadLocalRandom.current().nextInt(3, 7)
+ );
+ }
+
+ @Override
+ protected void onBreak(@NotNull BlockBreakEvent blockBreakEvent, @NotNull ItemStack itemStack, @NotNull List list) {
+ Location location = blockBreakEvent.getBlock().getLocation();
+ final UUID currentItemUuid = itemMap.get(location);
+ if (currentItemUuid != null) {
+ final Item currentItem = (Item) Bukkit.getEntity(currentItemUuid);
+ final ItemStack displayStack = currentItem.getItemStack();
+ location.getWorld().dropItemNaturally(location, displayStack);
+ BlockStorage.clearBlockInfo(location);
+ currentItem.remove();
+ }
+ }
+
+ private void onRightClick(PlayerRightClickEvent e) {
+ final Player player = e.getPlayer();
+
+ Optional optionalBlock = e.getClickedBlock();
+
+ if (!optionalBlock.isPresent()) {
+ return;
+ }
+
+ e.cancel();
+
+ final Block blockClicked = optionalBlock.get();
+ final UUID currentItemUuid = itemMap.get(blockClicked.getLocation());
+
+ // Stand already has an item, we try to remove this then return;
+ if (currentItemUuid != null) {
+ final Item currentItem = (Item) Bukkit.getEntity(currentItemUuid);
+ final ItemStack itemStack = currentItem.getItemStack();
+ final HashMap rejected = player.getInventory().addItem(itemStack);
+ BlockStorage.addBlockInfo(blockClicked, PDC_ITEM, null);
+ itemMap.remove(blockClicked.getLocation());
+ if (rejected.isEmpty()) {
+ currentItem.remove();
+ }
+ return;
+ }
+
+ final ItemStack itemStack = e.getItem();
+ final Material material = itemStack.getType();
+ final BlockDefinition definition = CrystamaeHistoria.getStoriesManager().getBlockDefinitionMap().get(material);
+
+ if (definition != null && material != Material.AIR) {
+ final BlockRank blockRank = PlayerStatistics.getBlockRank(
+ player.getUniqueId(),
+ definition
+ );
+ if (blockRank == BlockRank.SME) {
+ final Location location = blockClicked.getLocation().add(0.5, 1.5, 0.5);
+ final String name = ChatColor.of("#FFD100") + TextUtils.toTitleCase(material.toString());
+ Item item = GeneralUtils.spawnDisplayItem(itemStack.asQuantity(1), location, name);
+ itemStack.setAmount(itemStack.getAmount() - 1);
+ BlockStorage.addBlockInfo(blockClicked, PDC_ITEM, item.getUniqueId().toString());
+ itemMap.put(blockClicked.getLocation(), item.getUniqueId());
+ }
+ }
+ }
+}
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/itemgroups/DummyGuideOnly.java b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/itemgroups/DummyGuideOnly.java
new file mode 100644
index 00000000..d471bb4c
--- /dev/null
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/itemgroups/DummyGuideOnly.java
@@ -0,0 +1,25 @@
+package io.github.sefiraat.crystamaehistoria.slimefun.itemgroups;
+
+import io.github.sefiraat.crystamaehistoria.utils.Keys;
+import io.github.sefiraat.crystamaehistoria.utils.theme.ThemeType;
+import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
+import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;
+import lombok.experimental.UtilityClass;
+import org.bukkit.Material;
+import org.bukkit.inventory.ItemStack;
+
+@UtilityClass
+public class DummyGuideOnly {
+
+ public static final SlimefunItemStack STACK = ThemeType.themedSlimefunItemStack(
+ "CRY_GUIDE_DUMMY",
+ new ItemStack(Material.BOOK),
+ ThemeType.MECHANISM,
+ "Guide",
+ "This is a guide only.",
+ "Some crafts in Crystamae are very",
+ "different compared to other addons",
+ "so these are here just for clarification."
+ );
+ public static final RecipeType TYPE = new RecipeType(Keys.GUIDE_ONLY, STACK);
+}
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/itemgroups/MainFlexGroup.java b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/itemgroups/MainFlexGroup.java
new file mode 100644
index 00000000..299da602
--- /dev/null
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/itemgroups/MainFlexGroup.java
@@ -0,0 +1,132 @@
+package io.github.sefiraat.crystamaehistoria.slimefun.itemgroups;
+
+import io.github.sefiraat.crystamaehistoria.slimefun.ItemGroups;
+import io.github.sefiraat.crystamaehistoria.utils.theme.ThemeType;
+import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup;
+import io.github.thebusybiscuit.slimefun4.api.items.groups.FlexItemGroup;
+import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
+import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide;
+import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideMode;
+import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
+import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
+import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
+import org.bukkit.NamespacedKey;
+import org.bukkit.entity.Item;
+import org.bukkit.entity.Player;
+import org.bukkit.inventory.ItemStack;
+
+import javax.annotation.Nonnull;
+
+/**
+ * @noinspection deprecation
+ */
+public class MainFlexGroup extends FlexItemGroup {
+
+ private static final int PAGE_SIZE = 36;
+
+ private static final int GUIDE_BACK = 1;
+
+ private static final int MECHANISMS = 9;
+ private static final int CRYSTALS = 10;
+ private static final int TOOLS = 11;
+ private static final int GADGETS = 12;
+ private static final int MATERIALS = 13;
+ private static final int GUIDE = 14;
+ private static final int STORY = 15;
+ private static final int SPELL = 16;
+
+ private static final int[] HEADER = new int[]{
+ 0, 1, 2, 3, 4, 5, 6, 7, 8
+ };
+ private static final int[] FOOTER = new int[]{
+ 45, 46, 47, 48, 49, 50, 51, 52, 53
+ };
+
+ public MainFlexGroup(NamespacedKey key, ItemStack item) {
+ super(key, item);
+ }
+
+ @Override
+ public boolean isVisible(@Nonnull Player player, @Nonnull PlayerProfile playerProfile, @Nonnull SlimefunGuideMode guideMode) {
+ return true;
+ }
+
+ @Override
+ public void open(Player p, PlayerProfile profile, SlimefunGuideMode mode) {
+ final ChestMenu chestMenu = new ChestMenu(ThemeType.MAIN.getColor() + "Crystamae Magic Compendium");
+
+ for (int slot : HEADER) {
+ chestMenu.addItem(slot, ChestMenuUtils.getBackground(), (player1, i1, itemStack, clickAction) -> false);
+ }
+
+ for (int slot : FOOTER) {
+ chestMenu.addItem(slot, ChestMenuUtils.getBackground(), (player1, i1, itemStack, clickAction) -> false);
+ }
+
+ chestMenu.setEmptySlotsClickable(false);
+ setupPage(p, profile, mode, chestMenu);
+ chestMenu.open(p);
+ }
+
+
+
+ private void setupPage(@Nonnull Player player, @Nonnull PlayerProfile profile, @Nonnull SlimefunGuideMode mode, @Nonnull ChestMenu menu) {
+ for (int slot : FOOTER) {
+ menu.replaceExistingItem(slot, ChestMenuUtils.getBackground());
+ menu.addMenuClickHandler(slot, ((player1, i, itemStack, clickAction) -> false));
+ }
+
+ // Back
+ menu.replaceExistingItem(GUIDE_BACK, ChestMenuUtils.getBackButton(player, Slimefun.getLocalization().getMessage("guide.back.guide")));
+ menu.addMenuClickHandler(GUIDE_BACK, (player1, slot, itemStack, clickAction) -> {
+ SlimefunGuide.openMainMenu(profile, mode, 1);
+ return false;
+ });
+
+ // Mechanisms
+ menu.replaceExistingItem(MECHANISMS, ItemGroups.MECHANISMS.getItem(player));
+ menu.addMenuClickHandler(MECHANISMS, (player1, i1, itemStack1, clickAction) ->
+ openPage(profile, ItemGroups.MECHANISMS, mode, 1));
+
+ // Crystals
+ menu.replaceExistingItem(CRYSTALS, ItemGroups.CRYSTALS.getItem(player));
+ menu.addMenuClickHandler(CRYSTALS, (player1, i1, itemStack1, clickAction) ->
+ openPage(profile, ItemGroups.CRYSTALS, mode, 1));
+
+ // Tools
+ menu.replaceExistingItem(TOOLS, ItemGroups.TOOLS.getItem(player));
+ menu.addMenuClickHandler(TOOLS, (player1, i1, itemStack1, clickAction) ->
+ openPage(profile, ItemGroups.TOOLS, mode, 1));
+
+ // Gadgets
+ menu.replaceExistingItem(GADGETS, ItemGroups.GADGETS.getItem(player));
+ menu.addMenuClickHandler(GADGETS, (player1, i1, itemStack1, clickAction) ->
+ openPage(profile, ItemGroups.GADGETS, mode, 1));
+
+ // Materials
+ menu.replaceExistingItem(MATERIALS, ItemGroups.MATERIALS.getItem(player));
+ menu.addMenuClickHandler(MATERIALS, (player1, i1, itemStack1, clickAction) ->
+ openPage(profile, ItemGroups.MATERIALS, mode, 1));
+
+ // Story
+ menu.replaceExistingItem(STORY, ItemGroups.STORY_COLLECTION.getItem(player));
+ menu.addMenuClickHandler(STORY, (player1, i1, itemStack1, clickAction) ->
+ openPage(profile, ItemGroups.STORY_COLLECTION, mode, 1));
+
+ // Spell
+ menu.replaceExistingItem(SPELL, ItemGroups.SPELL_COLLECTION.getItem(player));
+ menu.addMenuClickHandler(SPELL, (player1, i1, itemStack1, clickAction) ->
+ openPage(profile, ItemGroups.SPELL_COLLECTION, mode, 1));
+
+ // Guide
+ menu.replaceExistingItem(GUIDE, ItemGroups.GUIDE.getItem(player));
+ menu.addMenuClickHandler(GUIDE, (player1, i1, itemStack1, clickAction) ->
+ openPage(profile, ItemGroups.GUIDE, mode, 1));
+ }
+
+ public boolean openPage(PlayerProfile profile, ItemGroup itemGroup, SlimefunGuideMode mode, int page) {
+ profile.getGuideHistory().add(this, 1);
+ SlimefunGuide.openItemGroup(profile, itemGroup, mode, page);
+ return false;
+ }
+}
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/itemgroups/SpellCollectionFlexGroup.java b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/itemgroups/SpellCollectionFlexGroup.java
index c49ce6ff..9a1e14a8 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/itemgroups/SpellCollectionFlexGroup.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/itemgroups/SpellCollectionFlexGroup.java
@@ -3,10 +3,11 @@
import io.github.sefiraat.crystamaehistoria.magic.SpellType;
import io.github.sefiraat.crystamaehistoria.magic.spells.core.Spell;
import io.github.sefiraat.crystamaehistoria.magic.spells.core.SpellCore;
+import io.github.sefiraat.crystamaehistoria.player.PlayerStatistics;
+import io.github.sefiraat.crystamaehistoria.player.SpellRank;
import io.github.sefiraat.crystamaehistoria.slimefun.ItemGroups;
import io.github.sefiraat.crystamaehistoria.slimefun.Materials;
import io.github.sefiraat.crystamaehistoria.stories.definition.StoryType;
-import io.github.sefiraat.crystamaehistoria.utils.PlayerStatUtils;
import io.github.sefiraat.crystamaehistoria.utils.theme.GuiElements;
import io.github.sefiraat.crystamaehistoria.utils.theme.ThemeType;
import io.github.thebusybiscuit.slimefun4.api.items.groups.FlexItemGroup;
@@ -39,6 +40,7 @@ public class SpellCollectionFlexGroup extends FlexItemGroup {
private static final int PAGE_SIZE = 36;
private static final int GUIDE_BACK = 1;
+ private static final int GUIDE_STATS = 7;
private static final int PAGE_PREVIOUS = 46;
private static final int PAGE_NEXT = 52;
@@ -89,7 +91,7 @@ public void open(Player p, PlayerProfile profile, SlimefunGuideMode mode) {
chestMenu.open(p);
}
- private void setupPage(@Nonnull Player p, @Nonnull PlayerProfile profile, @Nonnull SlimefunGuideMode mode, @Nonnull ChestMenu menu, int page) {
+ private void setupPage(@Nonnull Player player, @Nonnull PlayerProfile profile, @Nonnull SlimefunGuideMode mode, @Nonnull ChestMenu menu, int page) {
final List spellTypes = Arrays.asList(SpellType.getEnabledSpells());
final int numberOfBlocks = spellTypes.size();
final int totalPages = (int) Math.ceil(numberOfBlocks / (double) PAGE_SIZE);
@@ -100,21 +102,25 @@ private void setupPage(@Nonnull Player p, @Nonnull PlayerProfile profile, @Nonnu
final List spellTypeSubList = spellTypes.subList(start, end);
- reapplyFooter(p, profile, mode, menu, page, totalPages);
+ reapplyFooter(player, profile, mode, menu, page, totalPages);
// Back
- menu.replaceExistingItem(GUIDE_BACK, ChestMenuUtils.getBackButton(p, Slimefun.getLocalization().getMessage("guide.back.guide")));
+ menu.replaceExistingItem(GUIDE_BACK, ChestMenuUtils.getBackButton(player, Slimefun.getLocalization().getMessage("guide.back.guide")));
menu.addMenuClickHandler(GUIDE_BACK, (player1, slot, itemStack, clickAction) -> {
SlimefunGuide.openItemGroup(profile, ItemGroups.MAIN, mode, 1);
return false;
});
+ // Stats
+ menu.replaceExistingItem(GUIDE_STATS, getStatsStack(player));
+ menu.addMenuClickHandler(GUIDE_STATS, (player1, slot, itemStack, clickAction) -> false);
+
for (int i = 0; i < 36; i++) {
final int slot = i + 9;
if (i + 1 <= spellTypeSubList.size()) {
final SpellType spellType = spellTypeSubList.get(i);
- final boolean researched = PlayerStatUtils.hasUnlockedSpell(p, spellType);
+ final boolean researched = PlayerStatistics.hasUnlockedSpell(player, spellType);
if (mode == SlimefunGuideMode.CHEAT_MODE || researched) {
menu.replaceExistingItem(slot, new ItemStack(spellType.getSpell().getThemedStack()));
@@ -480,4 +486,20 @@ private ItemStack getEffectsStack(Spell spell) {
lore
);
}
+
+ private ItemStack getStatsStack(Player player) {
+ final ChatColor color = ThemeType.CLICK_INFO.getColor();
+ final ChatColor passive = ThemeType.PASSIVE.getColor();
+ final List lore = new ArrayList<>();
+ final SpellRank spellRank = PlayerStatistics.getSpellRank(player.getUniqueId());
+
+ lore.add(MessageFormat.format("{0}Spells Unlocked: {1}{2}", color, passive, PlayerStatistics.getSpellsUnlocked(player.getUniqueId())));
+ lore.add(MessageFormat.format("{0}Rank: {1}{2}", color, spellRank.getTheme().getColor(), spellRank.getTheme().getLoreLine()));
+
+ return new CustomItemStack(
+ Material.TARGET,
+ ThemeType.MAIN.getColor() + "Spell Statistics",
+ lore
+ );
+ }
}
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/itemgroups/StoryCollectionFlexGroup.java b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/itemgroups/StoryCollectionFlexGroup.java
index 6eb18a3f..5718079a 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/itemgroups/StoryCollectionFlexGroup.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/itemgroups/StoryCollectionFlexGroup.java
@@ -1,11 +1,13 @@
package io.github.sefiraat.crystamaehistoria.slimefun.itemgroups;
import io.github.sefiraat.crystamaehistoria.CrystamaeHistoria;
+import io.github.sefiraat.crystamaehistoria.player.BlockRank;
+import io.github.sefiraat.crystamaehistoria.player.PlayerStatistics;
+import io.github.sefiraat.crystamaehistoria.player.StoryRank;
import io.github.sefiraat.crystamaehistoria.slimefun.ItemGroups;
import io.github.sefiraat.crystamaehistoria.slimefun.Materials;
import io.github.sefiraat.crystamaehistoria.stories.BlockDefinition;
import io.github.sefiraat.crystamaehistoria.stories.definition.StoryType;
-import io.github.sefiraat.crystamaehistoria.utils.PlayerStatUtils;
import io.github.sefiraat.crystamaehistoria.utils.theme.GuiElements;
import io.github.sefiraat.crystamaehistoria.utils.theme.ThemeType;
import io.github.thebusybiscuit.slimefun4.api.items.groups.FlexItemGroup;
@@ -16,17 +18,21 @@
import io.github.thebusybiscuit.slimefun4.libraries.dough.items.CustomItemStack;
import io.github.thebusybiscuit.slimefun4.utils.ChestMenuUtils;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
+import net.md_5.bungee.api.ChatColor;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import javax.annotation.Nonnull;
+import javax.annotation.ParametersAreNonnullByDefault;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
+import java.util.UUID;
import java.util.stream.Collectors;
/**
@@ -37,6 +43,7 @@ public class StoryCollectionFlexGroup extends FlexItemGroup {
private static final int PAGE_SIZE = 36;
private static final int GUIDE_BACK = 1;
+ private static final int GUIDE_STATS = 7;
private static final int PAGE_PREVIOUS = 46;
private static final int PAGE_NEXT = 52;
@@ -50,6 +57,7 @@ public class StoryCollectionFlexGroup extends FlexItemGroup {
private static final int CHRONICLING_SLOT = 20;
private static final int TIER_SLOT = 22;
+ private static final int STATS_SLOT = 24;
private static final int UNIQUE_SLOT = 40;
private static final int[] DIVIDER = new int[]{
@@ -85,7 +93,7 @@ public void open(Player p, PlayerProfile profile, SlimefunGuideMode mode) {
chestMenu.open(p);
}
- private void setupPage(@Nonnull Player p, @Nonnull PlayerProfile profile, @Nonnull SlimefunGuideMode mode, @Nonnull ChestMenu menu, int page) {
+ private void setupPage(@Nonnull Player player, @Nonnull PlayerProfile profile, @Nonnull SlimefunGuideMode mode, @Nonnull ChestMenu menu, int page) {
final List blockDefinitions = new ArrayList<>(CrystamaeHistoria.getStoriesManager().getBlockDefinitionMap().values());
final int numberOfBlocks = CrystamaeHistoria.getStoriesManager().getBlockDefinitionMap().size();
final int totalPages = (int) Math.ceil(numberOfBlocks / (double) PAGE_SIZE);
@@ -96,21 +104,25 @@ private void setupPage(@Nonnull Player p, @Nonnull PlayerProfile profile, @Nonnu
final List blockDefinitionSubList = blockDefinitions.subList(start, end);
- reapplyFooter(p, profile, mode, menu, page, totalPages);
+ reapplyFooter(player, profile, mode, menu, page, totalPages);
// Back
- menu.replaceExistingItem(GUIDE_BACK, ChestMenuUtils.getBackButton(p, Slimefun.getLocalization().getMessage("guide.back.guide")));
+ menu.replaceExistingItem(GUIDE_BACK, ChestMenuUtils.getBackButton(player, Slimefun.getLocalization().getMessage("guide.back.guide")));
menu.addMenuClickHandler(GUIDE_BACK, (player1, slot, itemStack, clickAction) -> {
SlimefunGuide.openItemGroup(profile, ItemGroups.MAIN, mode, 1);
return false;
});
+ // Stats
+ menu.replaceExistingItem(GUIDE_STATS, getPlayerInfoStack(player));
+ menu.addMenuClickHandler(GUIDE_STATS, (player1, slot, itemStack, clickAction) -> false);
+
for (int i = 0; i < 36; i++) {
final int slot = i + 9;
if (i + 1 <= blockDefinitionSubList.size()) {
final BlockDefinition definition = blockDefinitionSubList.get(i);
- final boolean researched = PlayerStatUtils.hasUnlockedUniqueStory(p, definition);
+ final boolean researched = PlayerStatistics.hasUnlockedUniqueStory(player, definition);
if (mode == SlimefunGuideMode.CHEAT_MODE || researched) {
menu.replaceExistingItem(slot, GuiElements.getUniqueStoryIcon(definition.getMaterial()));
@@ -152,6 +164,9 @@ private void displayDefinition(@Nonnull Player p, @Nonnull PlayerProfile profile
menu.replaceExistingItem(TIER_SLOT, getTierItemStack(definition));
menu.addMenuClickHandler(TIER_SLOT, (player, i, itemStack, clickAction) -> false);
+ menu.replaceExistingItem(STATS_SLOT, getStatsStack(p.getUniqueId(), definition));
+ menu.addMenuClickHandler(STATS_SLOT, (player, i, itemStack, clickAction) -> false);
+
menu.replaceExistingItem(UNIQUE_SLOT, getUniqueStoryItemStack(definition));
menu.addMenuClickHandler(UNIQUE_SLOT, (player, i, itemStack, clickAction) -> false);
@@ -243,4 +258,45 @@ private ItemStack getTierItemStack(@Nonnull BlockDefinition definition) {
throw new IllegalStateException("Inapplicable tier provided: " + definition.getTier().tier);
}
}
+
+ @ParametersAreNonnullByDefault
+ private ItemStack getStatsStack(UUID player, BlockDefinition definition) {
+ final ChatColor color = ThemeType.CLICK_INFO.getColor();
+ final ChatColor passive = ThemeType.PASSIVE.getColor();
+ final List lore = new ArrayList<>();
+ final BlockRank blockRank = PlayerStatistics.getBlockRank(player, definition);
+
+ final int timesChronicled = PlayerStatistics.getChronicle(player, definition);
+ final int timesRealised = PlayerStatistics.getRealisation(player, definition);
+
+ final String chronicleCap = timesChronicled > 100 ? "(Capped at 100)" : "";
+ final String realisationCap = timesRealised > 100 ? "(Capped at 100)" : "";
+
+ lore.add(MessageFormat.format("{0}Rank: {1}{2}", color, blockRank.getTheme().getColor(), blockRank.getTheme().getLoreLine()));
+ lore.add("");
+ lore.add(MessageFormat.format("{0}Times Chronicled: {1}{2} {3}", color, passive, timesChronicled, chronicleCap));
+ lore.add(MessageFormat.format("{0}Times Realised: {1}{2} {3}", color, passive, timesRealised, realisationCap));
+
+ return new CustomItemStack(
+ Material.TARGET,
+ ThemeType.MAIN.getColor() + "Item Statistics",
+ lore
+ );
+ }
+
+ private ItemStack getPlayerInfoStack(Player player) {
+ final ChatColor color = ThemeType.CLICK_INFO.getColor();
+ final ChatColor passive = ThemeType.PASSIVE.getColor();
+ final List lore = new ArrayList<>();
+ final StoryRank storyRank = PlayerStatistics.getStoryRank(player.getUniqueId());
+
+ lore.add(MessageFormat.format("{0}Stories Chronicled: {1}{2}", color, passive, PlayerStatistics.getStoriesUnlocked(player.getUniqueId())));
+ lore.add(MessageFormat.format("{0}Rank: {1}{2}", color, storyRank.getTheme().getColor(), storyRank.getTheme().getLoreLine()));
+
+ return new CustomItemStack(
+ Material.TARGET,
+ ThemeType.MAIN.getColor() + "Story Statistics",
+ lore
+ );
+ }
}
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/TickingBlockNoGui.java b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/TickingBlockNoGui.java
index 4ed8afc7..7f21b6bc 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/TickingBlockNoGui.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/TickingBlockNoGui.java
@@ -9,19 +9,21 @@
import io.github.thebusybiscuit.slimefun4.core.handlers.BlockPlaceHandler;
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
import me.mrCookieSlime.Slimefun.Objects.handlers.BlockTicker;
+import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.inventory.ItemStack;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
public abstract class TickingBlockNoGui extends SlimefunItem {
- protected boolean firstTick = true;
+ protected final Map firstTickMap = new HashMap<>();
protected TickingBlockNoGui(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(itemGroup, item, recipeType, recipe);
@@ -50,16 +52,16 @@ public boolean isSynchronized() {
@Override
public void tick(Block block, SlimefunItem slimefunItem, Config config) {
- if (firstTick) {
+ if (!firstTickMap.containsKey(block.getLocation())) {
onFirstTick(block, slimefunItem, config);
- firstTick = false;
+ firstTickMap.put(block.getLocation(), true);
}
onTick(block, slimefunItem, config);
}
},
new BlockPlaceHandler(false) {
@Override
- public void onPlayerPlace(@NotNull BlockPlaceEvent event) {
+ public void onPlayerPlace(@Nonnull BlockPlaceEvent event) {
onPlace(event);
}
},
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/chroniclerpanel/ChroniclerPanel.java b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/chroniclerpanel/ChroniclerPanel.java
index 1acac6ba..c1465902 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/chroniclerpanel/ChroniclerPanel.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/chroniclerpanel/ChroniclerPanel.java
@@ -14,8 +14,8 @@
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.inventory.ItemStack;
-import org.jetbrains.annotations.NotNull;
+import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
import java.util.HashMap;
import java.util.Map;
@@ -39,7 +39,7 @@ public ChroniclerPanel(ItemGroup itemGroup, SlimefunItemStack item, RecipeType r
this.tier = tier;
this.addItemHandler(new BlockPlaceHandler(false) {
@Override
- public void onPlayerPlace(@NotNull BlockPlaceEvent event) {
+ public void onPlayerPlace(@Nonnull BlockPlaceEvent event) {
final Location location = event.getBlockPlaced().getLocation();
final ChroniclerPanelCache cache = new ChroniclerPanelCache(BlockStorage.getInventory(location), tier);
cache.setActivePlayer(event.getPlayer());
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/chroniclerpanel/ChroniclerPanelCache.java b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/chroniclerpanel/ChroniclerPanelCache.java
index 5a57085c..2bcfa39f 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/chroniclerpanel/ChroniclerPanelCache.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/chroniclerpanel/ChroniclerPanelCache.java
@@ -1,6 +1,7 @@
package io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.chroniclerpanel;
import io.github.sefiraat.crystamaehistoria.CrystamaeHistoria;
+import io.github.sefiraat.crystamaehistoria.player.PlayerStatistics;
import io.github.sefiraat.crystamaehistoria.runnables.spells.FloatingHeadAnimation;
import io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.AbstractCache;
import io.github.sefiraat.crystamaehistoria.stories.BlockDefinition;
@@ -8,7 +9,6 @@
import io.github.sefiraat.crystamaehistoria.utils.ArmourStandUtils;
import io.github.sefiraat.crystamaehistoria.utils.GeneralUtils;
import io.github.sefiraat.crystamaehistoria.utils.Keys;
-import io.github.sefiraat.crystamaehistoria.utils.PlayerStatUtils;
import io.github.sefiraat.crystamaehistoria.utils.StoryUtils;
import lombok.Getter;
import me.mrCookieSlime.Slimefun.api.BlockStorage;
@@ -174,10 +174,10 @@ private void processStack(ItemStack i) {
// That was the last story, unlock unique and set research
StoryUtils.requestUniqueStory(i);
if (activePlayer != null) {
- if (!PlayerStatUtils.hasUnlockedUniqueStory(activePlayer, blockDefinition)) {
- PlayerStatUtils.unlockUniqueStory(activePlayer, blockDefinition);
+ if (!PlayerStatistics.hasUnlockedUniqueStory(activePlayer, blockDefinition)) {
+ PlayerStatistics.unlockUniqueStory(activePlayer, blockDefinition);
}
- PlayerStatUtils.addChronicle(activePlayer, blockDefinition);
+ PlayerStatistics.addChronicle(activePlayer, blockDefinition);
}
}
StoriesManager.rebuildStoriedStack(i);
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/liquefactionbasin/DummyLiquefactionBasinCrafting.java b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/liquefactionbasin/DummyLiquefactionBasinCrafting.java
index 56d5e234..5185bbf9 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/liquefactionbasin/DummyLiquefactionBasinCrafting.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/liquefactionbasin/DummyLiquefactionBasinCrafting.java
@@ -4,9 +4,11 @@
import io.github.sefiraat.crystamaehistoria.utils.theme.ThemeType;
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;
+import lombok.experimental.UtilityClass;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
+@UtilityClass
public class DummyLiquefactionBasinCrafting {
public static final SlimefunItemStack STACK = ThemeType.themedSlimefunItemStack(
@@ -18,9 +20,5 @@ public class DummyLiquefactionBasinCrafting {
"into a filled Liquefaction Basin containing",
"the correct Crystamae."
);
- public static final RecipeType TYPE = new RecipeType(Keys.LIQUEFACTION_DUMMY_CRYSTAL, STACK);
-
- private DummyLiquefactionBasinCrafting() {
- throw new IllegalStateException("Utility class");
- }
+ public static final RecipeType TYPE = new RecipeType(Keys.LIQUEFACTION_DUMMY_CRAFTING, STACK);
}
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/liquefactionbasin/DummyLiquefactionBasinSpell.java b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/liquefactionbasin/DummyLiquefactionBasinSpell.java
index 8857022e..23765587 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/liquefactionbasin/DummyLiquefactionBasinSpell.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/liquefactionbasin/DummyLiquefactionBasinSpell.java
@@ -4,9 +4,11 @@
import io.github.sefiraat.crystamaehistoria.utils.theme.ThemeType;
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;
+import lombok.experimental.UtilityClass;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
+@UtilityClass
public class DummyLiquefactionBasinSpell {
public static final SlimefunItemStack STACK = ThemeType.themedSlimefunItemStack(
@@ -18,9 +20,5 @@ public class DummyLiquefactionBasinSpell {
"filled Liquefaction Basin containing",
"the correct Crystamae."
);
- public static final RecipeType TYPE = new RecipeType(Keys.LIQUEFACTION_DUMMY_CRYSTAL, STACK);
-
- private DummyLiquefactionBasinSpell() {
- throw new IllegalStateException("Utility class");
- }
+ public static final RecipeType TYPE = new RecipeType(Keys.LIQUEFACTION_DUMMY_SPELL, STACK);
}
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/liquefactionbasin/LiquefactionBasin.java b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/liquefactionbasin/LiquefactionBasin.java
index 1173b42b..fb1345e3 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/liquefactionbasin/LiquefactionBasin.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/liquefactionbasin/LiquefactionBasin.java
@@ -21,8 +21,8 @@
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.inventory.ItemStack;
-import org.jetbrains.annotations.NotNull;
+import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
import java.util.HashMap;
import java.util.Map;
@@ -51,7 +51,7 @@ public LiquefactionBasin(ItemGroup itemGroup,
this.color = color;
this.addItemHandler(new BlockPlaceHandler(false) {
@Override
- public void onPlayerPlace(@NotNull BlockPlaceEvent event) {
+ public void onPlayerPlace(@Nonnull BlockPlaceEvent event) {
final Location location = event.getBlockPlaced().getLocation();
final LiquefactionBasinCache cache = new LiquefactionBasinCache(BlockStorage.getInventory(location), maxVolume);
cache.setActivePlayer(event.getPlayer());
@@ -67,7 +67,7 @@ protected void tick(Block block, BlockMenu blockMenu) {
if (cache != null) {
cache.consumeItems();
Particle.DustOptions dustOptions = new Particle.DustOptions(color, 1);
- ParticleUtils.displayParticleEffect(block.getLocation(), 1, 4, dustOptions);
+ ParticleUtils.displayParticleEffect(block.getLocation().add(0.5, 0.5, 0.5), 1, 4, dustOptions);
}
if (block.getType() != Material.CAULDRON) {
block.setType(Material.CAULDRON);
@@ -108,7 +108,6 @@ protected void onBreak(BlockBreakEvent event, BlockMenu blockMenu) {
blockMenu.dropItems(location, INPUT_SLOT);
if (punish) {
blockMenu.getLocation().getWorld().createExplosion(
- event.getPlayer(),
event.getBlock().getLocation(),
2,
true,
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/liquefactionbasin/LiquefactionBasinCache.java b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/liquefactionbasin/LiquefactionBasinCache.java
index a2a765b5..6c6d13a2 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/liquefactionbasin/LiquefactionBasinCache.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/liquefactionbasin/LiquefactionBasinCache.java
@@ -4,6 +4,7 @@
import io.github.sefiraat.crystamaehistoria.CrystamaeHistoria;
import io.github.sefiraat.crystamaehistoria.magic.SpellType;
import io.github.sefiraat.crystamaehistoria.magic.spells.core.InstancePlate;
+import io.github.sefiraat.crystamaehistoria.player.PlayerStatistics;
import io.github.sefiraat.crystamaehistoria.slimefun.materials.Crystal;
import io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.DisplayStandHolder;
import io.github.sefiraat.crystamaehistoria.slimefun.tools.plates.BlankPlate;
@@ -14,7 +15,6 @@
import io.github.sefiraat.crystamaehistoria.utils.ArmourStandUtils;
import io.github.sefiraat.crystamaehistoria.utils.GeneralUtils;
import io.github.sefiraat.crystamaehistoria.utils.Keys;
-import io.github.sefiraat.crystamaehistoria.utils.PlayerStatUtils;
import io.github.sefiraat.crystamaehistoria.utils.datatypes.DataTypeMethods;
import io.github.sefiraat.crystamaehistoria.utils.datatypes.PersistentPlateDataType;
import io.github.sefiraat.crystamaehistoria.utils.theme.ThemeType;
@@ -227,9 +227,9 @@ private void processBlankPlate(Item item, BlankPlate plate) {
}
summonCatalystParticles();
if (activePlayer != null
- && !PlayerStatUtils.hasUnlockedSpell(activePlayer, spellType)
+ && !PlayerStatistics.hasUnlockedSpell(activePlayer, spellType)
) {
- PlayerStatUtils.unlockSpell(activePlayer, spellType);
+ PlayerStatistics.unlockSpell(activePlayer, spellType);
}
}
emptyBasin();
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/realisationaltar/DummyRealisationAltar.java b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/realisationaltar/DummyRealisationAltar.java
index f0173a37..88001684 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/realisationaltar/DummyRealisationAltar.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/realisationaltar/DummyRealisationAltar.java
@@ -4,13 +4,15 @@
import io.github.sefiraat.crystamaehistoria.utils.theme.ThemeType;
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;
+import lombok.experimental.UtilityClass;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
+@UtilityClass
public class DummyRealisationAltar {
public static final SlimefunItemStack STACK = ThemeType.themedSlimefunItemStack(
- "CRY_CHRONICLER_PANEL_DUMMY_CRYSTAL",
+ "CRY_REALISATION_ALTAR_DUMMY_CRYSTAL",
new ItemStack(Material.CHISELED_DEEPSLATE),
ThemeType.MECHANISM,
"Realisation Altar",
@@ -20,10 +22,4 @@ public class DummyRealisationAltar {
"produce crystals."
);
public static final RecipeType TYPE = new RecipeType(Keys.REALISATION_DUMMY_CRYSTAL, STACK);
-
- private DummyRealisationAltar() {
- throw new IllegalStateException("Utility class");
- }
-
-
}
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/realisationaltar/RealisationAltar.java b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/realisationaltar/RealisationAltar.java
index 09b08a4e..76a6e4bd 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/realisationaltar/RealisationAltar.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/realisationaltar/RealisationAltar.java
@@ -1,18 +1,23 @@
package io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.realisationaltar;
import io.github.mooy1.infinitylib.machines.TickingMenuBlock;
+import io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.chroniclerpanel.ChroniclerPanelCache;
import io.github.sefiraat.crystamaehistoria.utils.theme.GuiElements;
import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup;
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;
+import io.github.thebusybiscuit.slimefun4.core.handlers.BlockPlaceHandler;
import lombok.Getter;
+import me.mrCookieSlime.Slimefun.api.BlockStorage;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.event.block.BlockBreakEvent;
+import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.inventory.ItemStack;
+import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
import java.util.HashMap;
import java.util.Map;
@@ -27,7 +32,7 @@ public class RealisationAltar extends TickingMenuBlock {
};
protected static final int INPUT_SLOT = 22;
- protected static final Map CACHE_MAP = new HashMap<>();
+ protected static final Map CACHES = new HashMap<>();
@Getter
private final int tier;
@@ -36,16 +41,25 @@ public class RealisationAltar extends TickingMenuBlock {
public RealisationAltar(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe, int tier) {
super(itemGroup, item, recipeType, recipe);
this.tier = tier;
+ this.addItemHandler(new BlockPlaceHandler(false) {
+ @Override
+ public void onPlayerPlace(@Nonnull BlockPlaceEvent event) {
+ final Location location = event.getBlockPlaced().getLocation();
+ final RealisationAltarCache cache = new RealisationAltarCache(BlockStorage.getInventory(location), tier);
+ cache.setActivePlayer(event.getPlayer());
+ CACHES.put(location, cache);
+ }
+ });
}
public static Map getCaches() {
- return CACHE_MAP;
+ return CACHES;
}
@Override
@ParametersAreNonnullByDefault
protected void tick(Block block, BlockMenu blockMenu) {
- RealisationAltarCache cache = RealisationAltar.CACHE_MAP.get(block.getLocation());
+ RealisationAltarCache cache = RealisationAltar.CACHES.get(block.getLocation());
if (cache != null) {
cache.process();
}
@@ -73,7 +87,7 @@ protected int[] getOutputSlots() {
protected void onBreak(BlockBreakEvent event, BlockMenu blockMenu) {
super.onBreak(event, blockMenu);
Location location = blockMenu.getLocation();
- RealisationAltarCache realisationAltarCache = CACHE_MAP.remove(location);
+ RealisationAltarCache realisationAltarCache = CACHES.remove(location);
if (realisationAltarCache != null) {
realisationAltarCache.kill();
}
@@ -84,14 +98,15 @@ protected void onBreak(BlockBreakEvent event, BlockMenu blockMenu) {
@ParametersAreNonnullByDefault
protected void onNewInstance(BlockMenu blockMenu, Block b) {
super.onNewInstance(blockMenu, b);
- RealisationAltarCache cache = new RealisationAltarCache(blockMenu, this.tier);
- cache.loadMap();
- CACHE_MAP.put(blockMenu.getLocation(), cache);
+ if (!CACHES.containsKey(blockMenu.getLocation())) {
+ RealisationAltarCache cache = new RealisationAltarCache(blockMenu, this.tier);
+ cache.loadMap();
+ CACHES.put(blockMenu.getLocation(), cache);
+ }
}
@Override
protected boolean synchronous() {
return true;
}
-
}
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/realisationaltar/RealisationAltarCache.java b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/realisationaltar/RealisationAltarCache.java
index 9e934a74..f848eebe 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/realisationaltar/RealisationAltarCache.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/slimefun/mechanisms/realisationaltar/RealisationAltarCache.java
@@ -1,6 +1,7 @@
package io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.realisationaltar;
import io.github.sefiraat.crystamaehistoria.CrystamaeHistoria;
+import io.github.sefiraat.crystamaehistoria.player.PlayerStatistics;
import io.github.sefiraat.crystamaehistoria.slimefun.mechanisms.AbstractCache;
import io.github.sefiraat.crystamaehistoria.stories.BlockDefinition;
import io.github.sefiraat.crystamaehistoria.stories.StoriesManager;
@@ -16,6 +17,7 @@
import io.github.thebusybiscuit.slimefun4.libraries.dough.collections.Pair;
import io.github.thebusybiscuit.slimefun4.libraries.dough.data.persistent.PersistentDataAPI;
import lombok.Getter;
+import me.mrCookieSlime.Slimefun.api.BlockStorage;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
import org.bukkit.Chunk;
import org.bukkit.Location;
@@ -33,6 +35,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom;
public class RealisationAltarCache extends AbstractCache {
@@ -45,6 +48,11 @@ public class RealisationAltarCache extends AbstractCache {
public RealisationAltarCache(BlockMenu blockMenu, int tier) {
super(blockMenu);
this.maxTier = tier + 1;
+
+ final String activePlayerString = BlockStorage.getLocationInfo(blockMenu.getLocation(), Keys.BS_CP_ACTIVE_PLAYER);
+ if (activePlayerString != null) {
+ this.activePlayer = UUID.fromString(activePlayerString);
+ }
}
protected void process() {
@@ -94,6 +102,7 @@ private boolean processItem(ItemStack itemStack) {
potentialBlock.setType(Material.SMALL_AMETHYST_BUD);
crystalStoryMap.put(new BlockPosition(potentialBlock.getLocation()), new Pair<>(story.getRarity(), story.getId()));
if (StoryUtils.removeStory(itemStack, story) == 0) {
+ PlayerStatistics.addRealisation(activePlayer, definition);
itemStack.setAmount(0);
} else {
StoriesManager.rebuildStoriedStack(itemStack);
diff --git a/src/main/java/io/github/sefiraat/crystamaehistoria/stories/StoriesManager.java b/src/main/java/io/github/sefiraat/crystamaehistoria/stories/StoriesManager.java
index af7f878b..0a8497fb 100644
--- a/src/main/java/io/github/sefiraat/crystamaehistoria/stories/StoriesManager.java
+++ b/src/main/java/io/github/sefiraat/crystamaehistoria/stories/StoriesManager.java
@@ -10,6 +10,7 @@
import net.md_5.bungee.api.chat.TextComponent;
import org.apache.commons.lang.Validate;
import org.bukkit.Material;
+import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
@@ -154,68 +155,84 @@ private void fillBlockTierMap() {
);
}
- /**
- * @noinspection unchecked
- */
private void fillStories() {
FileConfiguration stories = CrystamaeHistoria.getConfigManager().getStories();
- List