13
0
geforkt von Mirrors/Paper

SPIGOT-6851: removeRecipe not unregistering recipe ID

By: md_5 <git@md-5.net>
Dieser Commit ist enthalten in:
CraftBukkit/Spigot 2021-12-13 11:25:22 +11:00
Ursprung 667cb32115
Commit ef17571a38
2 geänderte Dateien mit 10 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -116,7 +116,7 @@
}); });
MinecraftKey minecraftkey = irecipe.getId(); MinecraftKey minecraftkey = irecipe.getId();
IRecipe<?> irecipe1 = (IRecipe) map1.put(minecraftkey, irecipe); IRecipe<?> irecipe1 = (IRecipe) map1.put(minecraftkey, irecipe);
@@ -160,6 +186,18 @@ @@ -160,6 +186,26 @@
} }
}); });
this.recipes = ImmutableMap.copyOf(map); this.recipes = ImmutableMap.copyOf(map);
@ -125,6 +125,14 @@
+ } + }
+ +
+ // CraftBukkit start + // CraftBukkit start
+ public boolean removeRecipe(MinecraftKey mcKey) {
+ for (Object2ObjectLinkedOpenHashMap<MinecraftKey, IRecipe<?>> recipes : recipes.values()) {
+ recipes.remove(mcKey);
+ }
+
+ return byName.remove(mcKey) != null;
+ }
+
+ public void clearRecipes() { + public void clearRecipes() {
+ this.recipes = Maps.newHashMap(); + this.recipes = Maps.newHashMap();
+ +

Datei anzeigen

@ -1364,13 +1364,7 @@ public final class CraftServer implements Server {
Preconditions.checkArgument(recipeKey != null, "recipeKey == null"); Preconditions.checkArgument(recipeKey != null, "recipeKey == null");
MinecraftKey mcKey = CraftNamespacedKey.toMinecraft(recipeKey); MinecraftKey mcKey = CraftNamespacedKey.toMinecraft(recipeKey);
for (Object2ObjectLinkedOpenHashMap<MinecraftKey, IRecipe<?>> recipes : getServer().getRecipeManager().recipes.values()) { return getServer().getRecipeManager().removeRecipe(mcKey);
if (recipes.remove(mcKey) != null) {
return true;
}
}
return false;
} }
@Override @Override