mirror of
https://github.com/darksaid98/AlathranWars.git
synced 2026-12-01 14:38:55 +00:00
broken commit, recipes wont load
This commit is contained in:
1 parent
60b425b056
commit
1dbb69c3bd
6 files changed
+16
-9
No files matched your search
@@ -98,10 +98,10 @@ public class Main extends JavaPlugin {
|
||||
getServer().getPluginManager().registerEvents(new BlockBreakListener(), (Plugin) this);
|
||||
getServer().getPluginManager().registerEvents(new PlayerInteractListener(), this);
|
||||
|
||||
//run first
|
||||
// //run first
|
||||
new WarItemRegistry();
|
||||
//run second
|
||||
new WarRecipeRegistry();
|
||||
// //run second
|
||||
// new WarRecipeRegistry();
|
||||
|
||||
initData();
|
||||
initAPIs();
|
||||
|
||||
@@ -191,7 +191,6 @@ public class AdminTabCompletion implements TabCompleter {
|
||||
} else if (args.length == 1) {
|
||||
return NameUtil.filterByStart(base, args[0]);
|
||||
} else {
|
||||
|
||||
if (args[0].equalsIgnoreCase("purgebars")) {
|
||||
return empty;
|
||||
} else if (args[0].equalsIgnoreCase("save")) {
|
||||
|
||||
@@ -9,6 +9,6 @@ public interface IWarItem {
|
||||
|
||||
public ItemStack getItemStack();
|
||||
|
||||
public Set<Recipe> getRecipes();
|
||||
public Recipe getRecipe();
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package me.ShermansWorld.AlathraWar.items;
|
||||
import me.ShermansWorld.AlathraWar.Helper;
|
||||
import me.ShermansWorld.AlathraWar.Main;
|
||||
import me.ShermansWorld.AlathraWar.items.item.RamItem;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
@@ -30,6 +31,8 @@ public class WarItemRegistry {
|
||||
Main.warLogger.log(Helper.chatLabel() + "Registering AlathraWar items.");
|
||||
|
||||
itemRegistry.put(registryName("ram"), new RamItem());
|
||||
//THIS BREAKS EVERYTHING???? TODO
|
||||
// Bukkit.getServer().addRecipe(new RamItem().getRecipe());
|
||||
|
||||
Main.warLogger.log(Helper.chatLabel() + "Registered AlathraWar items.");
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package me.ShermansWorld.AlathraWar.items;
|
||||
import me.ShermansWorld.AlathraWar.AlathraWarLogger;
|
||||
import me.ShermansWorld.AlathraWar.Helper;
|
||||
import me.ShermansWorld.AlathraWar.Main;
|
||||
import me.ShermansWorld.AlathraWar.War;
|
||||
import me.ShermansWorld.AlathraWar.items.item.RamItem;
|
||||
import org.bukkit.inventory.Recipe;
|
||||
|
||||
@@ -20,18 +21,22 @@ public class WarRecipeRegistry {
|
||||
|
||||
Main.warLogger.log(Helper.chatLabel() + "Registering AlathraWar recipes.");
|
||||
|
||||
register(WarItemRegistry.registryName("ram"), WarItemRegistry.getInstance().getWarItem("ram").getRecipes());
|
||||
// register(WarItemRegistry.registryName("ram"), new RamItem().getRecipes());
|
||||
|
||||
Main.warLogger.log(Helper.chatLabel() + "Registered AlathraWar recipes.");
|
||||
}
|
||||
|
||||
public void register(String name, Set<Recipe> recipes) {
|
||||
for (Recipe recipe : recipes) {
|
||||
Main.getInstance().getServer().addRecipe(recipe);
|
||||
// Bukkit.getServer().addRecipe(recipe);
|
||||
recipeRegistry.put(name, recipe);
|
||||
}
|
||||
}
|
||||
|
||||
public static WarRecipeRegistry getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public HashMap<String, Recipe> getRecipeRegistry() {
|
||||
return recipeRegistry;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public class RamItem implements IWarItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Recipe> getRecipes() {
|
||||
public Recipe getRecipe() {
|
||||
ItemStack output = WarItemRegistry.getInstance().getOrNull("ram");
|
||||
NamespacedKey key = new NamespacedKey(Main.getInstance(), "ram");
|
||||
ShapedRecipe recipe = new ShapedRecipe(key, output);
|
||||
@@ -42,6 +42,6 @@ public class RamItem implements IWarItem {
|
||||
recipe.setIngredient('$', Material.IRON_INGOT);
|
||||
recipe.setIngredient('B', Material.IRON_BLOCK);
|
||||
recipe.setIngredient('%', new RecipeChoice.MaterialChoice(Tag.LOGS));
|
||||
return Set.of(recipe);
|
||||
return recipe;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user