Skip to content

Commit

Permalink
weeeeeee
Browse files Browse the repository at this point in the history
  • Loading branch information
Dueris committed Jul 19, 2024
1 parent 757bf01 commit af512f5
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ public class OrbOfOrigins {
public static ItemStack orb;

public static void init() {
createOrb();
if (!OriginConfiguration.getConfiguration().getBoolean("orb-of-origins", false)) return;
orb = createOrb();
}

private static void createOrb() {
public static ItemStack createOrb() {
ItemStack item = new ItemStack(Material.MAGMA_CREAM);
ItemMeta meta = item.getItemMeta();
meta.addItemFlags(ItemFlag.HIDE_UNBREAKABLE);
Expand All @@ -40,28 +41,26 @@ private static void createOrb() {

try {
//Shaped Recipe for ORB_OF_ORIGINS
if (OriginConfiguration.getConfiguration().getString("orb-of-origins").equalsIgnoreCase("true")) {
ShapedRecipe sr = new ShapedRecipe(new NamespacedKey("origins", "orb_of_origins"), item);
sr.shape("123",
"456",
"789");
sr.setIngredient('1', Material.valueOf(getOrbConfiguration().get("crafting.top.left").toString()));
sr.setIngredient('2', Material.valueOf(getOrbConfiguration().get("crafting.top.middle").toString()));
sr.setIngredient('3', Material.valueOf(getOrbConfiguration().get("crafting.top.right").toString()));
sr.setIngredient('4', Material.valueOf(getOrbConfiguration().get("crafting.middle.left").toString()));
sr.setIngredient('5', Material.valueOf(getOrbConfiguration().get("crafting.middle.middle").toString()));
sr.setIngredient('6', Material.valueOf(getOrbConfiguration().get("crafting.middle.right").toString()));
sr.setIngredient('7', Material.valueOf(getOrbConfiguration().get("crafting.bottom.left").toString()));
sr.setIngredient('8', Material.valueOf(getOrbConfiguration().get("crafting.bottom.middle").toString()));
sr.setIngredient('9', Material.valueOf(getOrbConfiguration().get("crafting.bottom.right").toString()));
Bukkit.getServer().addRecipe(sr);
orb = sr.getResult().clone();
ShapedRecipe sr = new ShapedRecipe(new NamespacedKey("origins", "orb_of_origins"), item);
sr.shape("123",
"456",
"789");
sr.setIngredient('1', Material.valueOf(getOrbConfiguration().get("crafting.top.left").toString()));
sr.setIngredient('2', Material.valueOf(getOrbConfiguration().get("crafting.top.middle").toString()));
sr.setIngredient('3', Material.valueOf(getOrbConfiguration().get("crafting.top.right").toString()));
sr.setIngredient('4', Material.valueOf(getOrbConfiguration().get("crafting.middle.left").toString()));
sr.setIngredient('5', Material.valueOf(getOrbConfiguration().get("crafting.middle.middle").toString()));
sr.setIngredient('6', Material.valueOf(getOrbConfiguration().get("crafting.middle.right").toString()));
sr.setIngredient('7', Material.valueOf(getOrbConfiguration().get("crafting.bottom.left").toString()));
sr.setIngredient('8', Material.valueOf(getOrbConfiguration().get("crafting.bottom.middle").toString()));
sr.setIngredient('9', Material.valueOf(getOrbConfiguration().get("crafting.bottom.right").toString()));
Bukkit.getServer().addRecipe(sr);

RecipePower.taggedRegistry.put(sr.key().asString(), sr);
}
RecipePower.taggedRegistry.put(sr.key().asString(), sr);
return sr.getResult().clone();
} catch (Exception exception) {
Bukkit.getServer().getLogger().warning("An unexpected error occured when trying to load the orb of origins! : " + exception.getLocalizedMessage());
exception.printStackTrace();
throw exception;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public void run() {
this.cancel();
} else {
if (!power.getHudRender().condition().isEmpty()) {
if (player == null) return;
bossBar.setVisible(ConditionExecutor.testEntity(power.getHudRender().condition(), player));
} else {
bossBar.setVisible(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ public ItemStack[] createDisplay(Player player, Layer layer) {

@Override
public ItemStack getChoosingStack(Player player) {
if (OrbOfOrigins.orb == null) OrbOfOrigins.init();
ItemStack orb = OrbOfOrigins.orb;
ItemStack orb = OrbOfOrigins.orb == null ? OrbOfOrigins.createOrb() : OrbOfOrigins.orb;
ItemMeta meta = orb.getItemMeta();
meta.displayName(Component.text("Random Origin").color(TextColor.color(0x28A7B5)));
orb.setItemMeta(meta);
Expand Down

0 comments on commit af512f5

Please sign in to comment.