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