mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-03 09:30:17 +01:00
Fixed another bunch of code smells
This commit is contained in:
parent
5073d9cf5c
commit
70749b0d16
@ -1,8 +1,5 @@
|
||||
package world.bentobox.bentobox.hooks;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
import world.bentobox.bentobox.BentoBox;
|
||||
import world.bentobox.bentobox.api.addons.Addon;
|
||||
@ -11,6 +8,9 @@ import world.bentobox.bentobox.api.placeholders.PlaceholderReplacer;
|
||||
import world.bentobox.bentobox.api.placeholders.placeholderapi.AddonPlaceholderExpansion;
|
||||
import world.bentobox.bentobox.api.placeholders.placeholderapi.BentoBoxPlaceholderExpansion;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Provides implementations and interfacing needed to register and get placeholders from PlaceholderAPI.
|
||||
*
|
||||
@ -112,10 +112,10 @@ public class PlaceholderAPIHook extends Hook {
|
||||
* Checks if a placeholder with this name is already registered
|
||||
* @param addon the addon, not null
|
||||
* @param placeholder - name of placeholder
|
||||
* @return <tt>true</tt> if a placeholder with this name is already registered
|
||||
* @return {@code true} if a placeholder with this name is already registered
|
||||
* @since 1.4.0
|
||||
*/
|
||||
public boolean isPlaceholder(@NonNull Addon addon, @NonNull String placeholder) {
|
||||
return addonsExpansions.containsKey(addon) ? addonsExpansions.get(addon).isPlaceholder(placeholder) : false;
|
||||
return addonsExpansions.containsKey(addon) && addonsExpansions.get(addon).isPlaceholder(placeholder);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package world.bentobox.bentobox.managers;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import world.bentobox.bentobox.BentoBox;
|
||||
import world.bentobox.bentobox.api.addons.Addon;
|
||||
import world.bentobox.bentobox.api.placeholders.PlaceholderReplacer;
|
||||
@ -7,9 +9,6 @@ import world.bentobox.bentobox.hooks.PlaceholderAPIHook;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNull;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Manages placeholder integration.
|
||||
*
|
||||
@ -91,10 +90,10 @@ public class PlaceholdersManager {
|
||||
* Checks if a placeholder with this name is already registered
|
||||
* @param addon the addon, not null
|
||||
* @param placeholder - name of placeholder
|
||||
* @return <tt>true</tt> if a placeholder with this name is already registered
|
||||
* @return {@code true} if a placeholder with this name is already registered
|
||||
* @since 1.4.0
|
||||
*/
|
||||
public boolean isPlaceholder(@NonNull Addon addon, @NonNull String placeholder) {
|
||||
return addon == null ? false : getPlaceholderAPIHook().map(h -> h.isPlaceholder(addon, placeholder)).orElse(false);
|
||||
return getPlaceholderAPIHook().map(h -> h.isPlaceholder(addon, placeholder)).orElse(false);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user