Skip to content

Commit

Permalink
minor docs and cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Aug 4, 2022
1 parent 241be02 commit 31375b8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
Expand Up @@ -19,7 +19,7 @@ public class ServerResourcesReloadedScriptEvent extends BukkitScriptEvent implem
//
// @Switch cause:<cause> to only process the event if the cause of the resource reload matches the specified cause.
//
// @Triggers when vanilla resources (such as datapacks) are reloaded (by vanilla commands or by plugins).
// @Triggers when vanilla resources (such as datapacks) are reloaded (by vanilla commands or by plugins). If you mess with datapacks often, it may be helpful to run <@link command reload> in this event.
//
// @Context
// <context.cause> Returns the cause of the resource reload. Refer to <@link url https://jd.papermc.io/paper/1.19/io/papermc/paper/event/server/ServerResourcesReloadedEvent.Cause.html>
Expand Down
Expand Up @@ -64,6 +64,8 @@ public AdvancementCommand() {
//
// WARNING: Failure to re-create advancements on every server start may result in loss of data - use <@link event server prestart>.
//
// If you mess with datapacks, you will also need to re-create advancements during <@link event server resources reloaded>
//
// @Tags
// <PlayerTag.has_advancement[<advancement>]>
// <PlayerTag.advancements>
Expand Down
Expand Up @@ -55,7 +55,7 @@ public static void removeDenizenRecipes() {
NMSHandler.itemHelper.clearDenizenRecipes();
}

public String getIdFor(ItemScriptContainer container, String type, int id) {
public static String getIdFor(ItemScriptContainer container, String type, int id) {
String basicId = type + "_" + Utilities.cleanseNamespaceID(container.getName()) + "_" + id;
if (!recipeIdToItemScript.containsKey(basicId)) {
recipeIdToItemScript.put("denizen:" + basicId, container);
Expand Down Expand Up @@ -91,7 +91,7 @@ else if (c == '/' && !brackets) {
return output;
}

public ItemStack[] textToItemArray(ItemScriptContainer container, String text, boolean exact) {
public static ItemStack[] textToItemArray(ItemScriptContainer container, String text, boolean exact) {
if (CoreUtilities.toLowerCase(text).equals("air")) {
return new ItemStack[0];
}
Expand Down Expand Up @@ -132,7 +132,7 @@ public ItemStack[] textToItemArray(ItemScriptContainer container, String text, b
return outputItems.toArray(new ItemStack[0]);
}

public void registerShapedRecipe(ItemScriptContainer container, ItemStack item, List<String> recipeList, String internalId, String group) {
public static void registerShapedRecipe(ItemScriptContainer container, ItemStack item, List<String> recipeList, String internalId, String group) {
for (int n = 0; n < recipeList.size(); n++) {
recipeList.set(n, TagManager.tag(ScriptBuilder.stripLinePrefix(recipeList.get(n)), new BukkitTagContext(null, null, new ScriptTag(container))));
}
Expand Down Expand Up @@ -185,7 +185,7 @@ else if (recipeList.size() == 2) {
Bukkit.addRecipe(recipe);
}

public void registerShapelessRecipe(ItemScriptContainer container, ItemStack item, String shapelessString, String internalId, String group) {
public static void registerShapelessRecipe(ItemScriptContainer container, ItemStack item, String shapelessString, String internalId, String group) {
TagContext context = new BukkitTagContext(null, null, new ScriptTag(container));
String list = TagManager.tag(shapelessString, context);
List<ItemStack[]> ingredients = new ArrayList<>();
Expand All @@ -210,7 +210,7 @@ public void registerShapelessRecipe(ItemScriptContainer container, ItemStack ite
NMSHandler.itemHelper.registerShapelessRecipe(internalId, group, item, ingredients, bools);
}

public void registerFurnaceRecipe(ItemScriptContainer container, ItemStack item, String furnaceItemString, float exp, int time, String type, String internalId, String group) {
public static void registerFurnaceRecipe(ItemScriptContainer container, ItemStack item, String furnaceItemString, float exp, int time, String type, String internalId, String group) {
boolean exact = true;
if (furnaceItemString.startsWith("material:")) {
exact = false;
Expand All @@ -223,7 +223,7 @@ public void registerFurnaceRecipe(ItemScriptContainer container, ItemStack item,
NMSHandler.itemHelper.registerFurnaceRecipe(internalId, group, item, items, exp, time, type, exact);
}

public void registerStonecuttingRecipe(ItemScriptContainer container, ItemStack item, String inputItemString, String internalId, String group) {
public static void registerStonecuttingRecipe(ItemScriptContainer container, ItemStack item, String inputItemString, String internalId, String group) {
boolean exact = true;
if (inputItemString.startsWith("material:")) {
exact = false;
Expand All @@ -236,7 +236,7 @@ public void registerStonecuttingRecipe(ItemScriptContainer container, ItemStack
NMSHandler.itemHelper.registerStonecuttingRecipe(internalId, group, item, items, exact);
}

public void registerSmithingRecipe(ItemScriptContainer container, ItemStack item, String baseItemString, String upgradeItemString, String internalId, String retain) {
public static void registerSmithingRecipe(ItemScriptContainer container, ItemStack item, String baseItemString, String upgradeItemString, String internalId, String retain) {
boolean baseExact = true;
if (baseItemString.startsWith("material:")) {
baseExact = false;
Expand All @@ -259,7 +259,7 @@ public void registerSmithingRecipe(ItemScriptContainer container, ItemStack item
NMSHandler.itemHelper.registerSmithingRecipe(internalId, item, baseItems, baseExact, upgradeItems, upgradeExact);
}

public void rebuildRecipes() {
public static void rebuildRecipes() {
for (ItemScriptContainer container : item_scripts.values()) {
try {
if (container.contains("recipes", Map.class)) {
Expand Down

0 comments on commit 31375b8

Please sign in to comment.