1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 03:35:51 +00:00

Merge pull request #551 from Poslovitch/security

Explicitly disallow registering two SFItems with same ID
This commit is contained in:
TheBusyBiscuit 2017-12-27 13:55:14 +01:00 committed by GitHub
commit 0c76e1978f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -221,6 +221,7 @@ public class SlimefunItem {
public void register(boolean slimefun) {
this.addon = !slimefun;
try {
if (map_id.containsKey(this.id)) throw new IllegalArgumentException("ID \"" + this.id + "\" already exists");
if (this.recipe.length < 9) this.recipe = new ItemStack[] {null, null, null, null, null, null, null, null, null};
all.add(this);
@ -273,6 +274,7 @@ public class SlimefunItem {
}
} catch(Exception x) {
System.err.println("[Slimefun] Item Registration failed: " + this.id);
x.printStackTrace();
}
}