mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2025-01-23 09:41:20 +01:00
No longer clears other plugins recipes when reloading
This commit is contained in:
parent
12ca93b8ca
commit
489039965e
@ -1,11 +1,13 @@
|
||||
package net.Indyuce.mmoitems.manager.recipe;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Keyed;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
@ -65,12 +67,19 @@ public abstract class RecipeManager {
|
||||
}
|
||||
|
||||
public NamespacedKey getRecipeKey(Type type, String id, String recipeType, String number) {
|
||||
return new NamespacedKey(MMOItems.plugin, "mmorecipe_" + recipeType + "_" + type.getId() + "_" + id + "_" + number);
|
||||
return new NamespacedKey(MMOItems.plugin, "mmoitems:" + recipeType + "_" + type.getId() + "_" + id + "_" + number);
|
||||
}
|
||||
|
||||
public void reloadRecipes() {
|
||||
Bukkit.getScheduler().runTask(MMOItems.plugin, () -> {
|
||||
Bukkit.resetRecipes();
|
||||
|
||||
Iterator<Recipe> iterator = Bukkit.recipeIterator();
|
||||
while (iterator.hasNext()) {
|
||||
Recipe recipe = iterator.next();
|
||||
if (recipe instanceof Keyed && ((Keyed) recipe).getKey().getKey().startsWith("mmoitems:"))
|
||||
iterator.remove();
|
||||
}
|
||||
|
||||
loadedRecipes.clear();
|
||||
load();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user