Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the case of SlimefunItem#itemhandlers #4025

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading