Skip to content

Commit

Permalink
Fix the case of SlimefunItem#itemhandlers
Browse files Browse the repository at this point in the history
  • Loading branch information
JustAHuman-xD authored Nov 19, 2023
1 parent 563ebec commit f48665d
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public class SlimefunItem implements Placeable {

private Optional<String> wikiURL = Optional.empty();

private final OptionalMap<Class<? extends ItemHandler>, ItemHandler> itemhandlers = new OptionalMap<>(HashMap::new);
private final OptionalMap<Class<? extends ItemHandler>, ItemHandler> itemHandlers = new OptionalMap<>(HashMap::new);
private final Set<ItemSetting<?>> itemSettings = new HashSet<>();

private boolean ticking = false;
Expand Down Expand Up @@ -477,12 +477,12 @@ public void register(@Nonnull SlimefunAddon addon) {
onEnable();
} else {
// Clear item handlers if we are disabled so that calling them isn't possible later on
for (ItemHandler handler : this.itemhandlers.values()) {
for (ItemHandler handler : this.itemHandlers.values()) {
if (handler instanceof BlockTicker) {
Slimefun.getRegistry().getTickerBlocks().remove(getId());
}
}
this.itemhandlers.clear();
this.itemHandlers.clear();
}

// Lock the SlimefunItemStack from any accidental manipulations
Expand Down Expand Up @@ -540,7 +540,7 @@ private final void onEnable() {
}

private void loadItemHandlers() {
for (ItemHandler handler : itemhandlers.values()) {
for (ItemHandler handler : itemHandlers.values()) {
Optional<IncompatibleItemHandlerException> exception = handler.validate(this);

// Check if the validation caused an exception.
Expand Down Expand Up @@ -802,7 +802,7 @@ public final void addItemHandler(ItemHandler... handlers) {
}

for (ItemHandler handler : handlers) {
itemhandlers.put(handler.getIdentifier(), handler);
itemHandlers.put(handler.getIdentifier(), handler);

// Tickers are a special case (at the moment at least)
if (handler instanceof BlockTicker ticker) {
Expand Down Expand Up @@ -914,7 +914,7 @@ public final void addOfficialWikipage(@Nonnull String page) {
* @return The Set of item handlers
*/
public @Nonnull Collection<ItemHandler> getHandlers() {
return itemhandlers.values();
return itemHandlers.values();
}

/**
Expand All @@ -932,7 +932,7 @@ public final void addOfficialWikipage(@Nonnull String page) {
*/
@ParametersAreNonnullByDefault
public <T extends ItemHandler> boolean callItemHandler(Class<T> c, Consumer<T> callable) {
Optional<ItemHandler> handler = itemhandlers.get(c);
Optional<ItemHandler> handler = itemHandlers.get(c);

if (handler.isPresent()) {
try {
Expand Down

0 comments on commit f48665d

Please sign in to comment.