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

Implementing postRegister() and doing the requested change.

This commit is contained in:
ajan-12 2019-09-01 23:07:16 +03:00
parent 5ed152b1e7
commit 9c9a3bb6ba
2 changed files with 11 additions and 1 deletions

View File

@ -261,6 +261,8 @@ public class SlimefunItem {
if (this instanceof VanillaItem) this.state = State.VANILLA; if (this instanceof VanillaItem) this.state = State.VANILLA;
else this.state = State.DISABLED; else this.state = State.DISABLED;
} }
postRegister();
} catch(Exception x) { } catch(Exception x) {
Slimefun.getLogger().log(Level.WARNING, "Registering the Item '" + id + "' for Slimefun " + Slimefun.getVersion() + " has failed", x); Slimefun.getLogger().log(Level.WARNING, "Registering the Item '" + id + "' for Slimefun " + Slimefun.getVersion() + " has failed", x);
} }
@ -506,6 +508,8 @@ public class SlimefunItem {
ChargableBlock.registerCapacitor(id, capacity); ChargableBlock.registerCapacitor(id, capacity);
} }
public void postRegister() {}
protected void setItem(ItemStack stack) { protected void setItem(ItemStack stack) {
this.item = stack; this.item = stack;
} }

View File

@ -25,6 +25,7 @@ import me.mrCookieSlime.Slimefun.utils.Utilities;
import java.util.UUID; import java.util.UUID;
public class GrapplingHook extends SimpleSlimefunItem<ItemInteractionHandler> { public class GrapplingHook extends SimpleSlimefunItem<ItemInteractionHandler> {
private long despawnTicks;
public GrapplingHook(Category category, ItemStack item, String id, RecipeType recipeType, ItemStack[] recipe, String[] keys, Object[] values) { public GrapplingHook(Category category, ItemStack item, String id, RecipeType recipeType, ItemStack[] recipe, String[] keys, Object[] values) {
super(category, item, id, recipeType, recipe, keys, values); super(category, item, id, recipeType, recipe, keys, values);
@ -76,11 +77,16 @@ public class GrapplingHook extends SimpleSlimefunItem<ItemInteractionHandler> {
utilities.remove.remove(uuid); utilities.remove.remove(uuid);
}, 20L); }, 20L);
} }
}, (int) Slimefun.getItemValue("GRAPPLING_HOOK", "despawn-seconds") * 20); }, despawnTicks);
} }
return true; return true;
} }
else return false; else return false;
}; };
} }
@Override
public void postRegister() {
despawnTicks = (int) Slimefun.getItemValue("GRAPPLING_HOOK", "despawn-seconds") * 20;
}
} }