Refactored -Wrapper suffix to -Integration

This commit is contained in:
Auxilor
2022-04-27 12:42:20 +01:00
parent 47c8ea3341
commit 01bcb62b31
66 changed files with 443 additions and 345 deletions

View File

@@ -0,0 +1,18 @@
package com.willfp.eco.core.integrations.afk;
import com.willfp.eco.core.integrations.Integration;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
/**
* AFK Integration.
*/
public interface AFKIntegration extends Integration {
/**
* Get if a player is afk.
*
* @param player The player.
* @return If afk.
*/
boolean isAfk(@NotNull Player player);
}

View File

@@ -13,14 +13,14 @@ public final class AFKManager {
/**
* A set of all registered integrations.
*/
private static final Set<AFKWrapper> REGISTERED = new HashSet<>();
private static final Set<AFKIntegration> REGISTERED = new HashSet<>();
/**
* Register a new integration.
*
* @param integration The integration to register.
*/
public static void register(@NotNull final AFKWrapper integration) {
public static void register(@NotNull final AFKIntegration integration) {
REGISTERED.add(integration);
}
@@ -31,8 +31,8 @@ public final class AFKManager {
* @return If afk.
*/
public static boolean isAfk(@NotNull final Player player) {
for (AFKWrapper afkWrapper : REGISTERED) {
if (afkWrapper.isAfk(player)) {
for (AFKIntegration AFKIntegration : REGISTERED) {
if (AFKIntegration.isAfk(player)) {
return true;
}
}

View File

@@ -1,18 +1,11 @@
package com.willfp.eco.core.integrations.afk;
import com.willfp.eco.core.integrations.Integration;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
/**
* Wrapper class for afk integrations.
*
* @deprecated Use AFKIntegration instead.
*/
public interface AFKWrapper extends Integration {
/**
* Get if a player is afk.
*
* @param player The player.
* @return If afk.
*/
boolean isAfk(@NotNull Player player);
@Deprecated(since = "6.35.0", forRemoval = true)
public interface AFKWrapper extends AFKIntegration {
}

View File

@@ -0,0 +1,24 @@
package com.willfp.eco.core.integrations.anticheat;
import com.willfp.eco.core.integrations.Integration;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
/**
* Wrapper class for anticheat integrations.
*/
public interface AnticheatIntegration extends Integration {
/**
* Exempt a player from checks.
*
* @param player The player to exempt.
*/
void exempt(@NotNull Player player);
/**
* Unexempt a player from checks.
*
* @param player The player to unexempt.
*/
void unexempt(@NotNull Player player);
}

View File

@@ -15,7 +15,7 @@ public final class AnticheatManager {
/**
* A set of all registered anticheats.
*/
private static final Set<AnticheatWrapper> ANTICHEATS = new HashSet<>();
private static final Set<AnticheatIntegration> ANTICHEATS = new HashSet<>();
/**
* Register a new anticheat.
@@ -24,7 +24,7 @@ public final class AnticheatManager {
* @param anticheat The anticheat to register.
*/
public static void register(@NotNull final EcoPlugin plugin,
@NotNull final AnticheatWrapper anticheat) {
@NotNull final AnticheatIntegration anticheat) {
if (anticheat instanceof Listener) {
plugin.getEventManager().registerListener((Listener) anticheat);
}

View File

@@ -1,24 +1,11 @@
package com.willfp.eco.core.integrations.anticheat;
import com.willfp.eco.core.integrations.Integration;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
/**
* Wrapper class for anticheat integrations.
*
* @deprecated Use AnticheatIntegration instead.
*/
public interface AnticheatWrapper extends Integration {
/**
* Exempt a player from checks.
*
* @param player The player to exempt.
*/
void exempt(@NotNull Player player);
@Deprecated(since = "6.35.0", forRemoval = true)
public interface AnticheatWrapper extends AnticheatIntegration {
/**
* Unexempt a player from checks.
*
* @param player The player to unexempt.
*/
void unexempt(@NotNull Player player);
}

View File

@@ -0,0 +1,60 @@
package com.willfp.eco.core.integrations.antigrief;
import com.willfp.eco.core.integrations.Integration;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
/**
* Wrapper class for antigrief integrations.
*/
public interface AntigriefIntegration extends Integration {
/**
* Can player break block.
*
* @param player The player.
* @param block The block.
* @return If player can break block.
*/
boolean canBreakBlock(@NotNull Player player, @NotNull Block block);
/**
* Can player create explosion at location.
*
* @param player The player.
* @param location The location.
* @return If player can create explosion.
*/
boolean canCreateExplosion(@NotNull Player player, @NotNull Location location);
/**
* Can player place block.
*
* @param player The player.
* @param block The block.
* @return If player can place block.
*/
boolean canPlaceBlock(@NotNull Player player, @NotNull Block block);
/**
* Can player injure living entity.
*
* @param player The player.
* @param victim The victim.
* @return If player can injure.
*/
boolean canInjure(@NotNull Player player, @NotNull LivingEntity victim);
/**
* Can player pick up item.
*
* @param player The player.
* @param location The location.
* @return If player can pick up item.
*/
default boolean canPickupItem(@NotNull Player player, @NotNull Location location) {
return true;
}
}

View File

@@ -16,14 +16,14 @@ public final class AntigriefManager {
/**
* Registered antigriefs.
*/
private static final Set<AntigriefWrapper> REGISTERED = new HashSet<>();
private static final Set<AntigriefIntegration> REGISTERED = new HashSet<>();
/**
* Register a new AntiGrief/Land Management integration.
*
* @param antigrief The integration to register.
*/
public static void register(@NotNull final AntigriefWrapper antigrief) {
public static void register(@NotNull final AntigriefIntegration antigrief) {
REGISTERED.add(antigrief);
}
@@ -32,7 +32,7 @@ public final class AntigriefManager {
*
* @param antigrief The integration to unregister.
*/
public static void unregister(@NotNull final AntigriefWrapper antigrief) {
public static void unregister(@NotNull final AntigriefIntegration antigrief) {
REGISTERED.removeIf(it -> it.getPluginName().equalsIgnoreCase(antigrief.getPluginName()));
REGISTERED.remove(antigrief);
}
@@ -46,7 +46,7 @@ public final class AntigriefManager {
*/
public static boolean canPickupItem(@NotNull final Player player,
@NotNull final Location location) {
return REGISTERED.stream().allMatch(antigriefWrapper -> antigriefWrapper.canPickupItem(player, location));
return REGISTERED.stream().allMatch(antigriefIntegration -> antigriefIntegration.canPickupItem(player, location));
}
/**
@@ -58,7 +58,7 @@ public final class AntigriefManager {
*/
public static boolean canBreakBlock(@NotNull final Player player,
@NotNull final Block block) {
return REGISTERED.stream().allMatch(antigriefWrapper -> antigriefWrapper.canBreakBlock(player, block));
return REGISTERED.stream().allMatch(antigriefIntegration -> antigriefIntegration.canBreakBlock(player, block));
}
/**
@@ -70,7 +70,7 @@ public final class AntigriefManager {
*/
public static boolean canCreateExplosion(@NotNull final Player player,
@NotNull final Location location) {
return REGISTERED.stream().allMatch(antigriefWrapper -> antigriefWrapper.canCreateExplosion(player, location));
return REGISTERED.stream().allMatch(antigriefIntegration -> antigriefIntegration.canCreateExplosion(player, location));
}
/**
@@ -82,7 +82,7 @@ public final class AntigriefManager {
*/
public static boolean canPlaceBlock(@NotNull final Player player,
@NotNull final Block block) {
return REGISTERED.stream().allMatch(antigriefWrapper -> antigriefWrapper.canPlaceBlock(player, block));
return REGISTERED.stream().allMatch(antigriefIntegration -> antigriefIntegration.canPlaceBlock(player, block));
}
/**
@@ -94,7 +94,7 @@ public final class AntigriefManager {
*/
public static boolean canInjure(@NotNull final Player player,
@NotNull final LivingEntity victim) {
return REGISTERED.stream().allMatch(antigriefWrapper -> antigriefWrapper.canInjure(player, victim));
return REGISTERED.stream().allMatch(antigriefIntegration -> antigriefIntegration.canInjure(player, victim));
}
private AntigriefManager() {

View File

@@ -1,60 +1,11 @@
package com.willfp.eco.core.integrations.antigrief;
import com.willfp.eco.core.integrations.Integration;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
/**
* Wrapper class for antigrief integrations.
*
* @deprecated Use AntigriefIntegration instead.
*/
public interface AntigriefWrapper extends Integration {
/**
* Can player break block.
*
* @param player The player.
* @param block The block.
* @return If player can break block.
*/
boolean canBreakBlock(@NotNull Player player, @NotNull Block block);
@Deprecated(since = "6.35.0", forRemoval = true)
public interface AntigriefWrapper extends AntigriefIntegration {
/**
* Can player create explosion at location.
*
* @param player The player.
* @param location The location.
* @return If player can create explosion.
*/
boolean canCreateExplosion(@NotNull Player player, @NotNull Location location);
/**
* Can player place block.
*
* @param player The player.
* @param block The block.
* @return If player can place block.
*/
boolean canPlaceBlock(@NotNull Player player, @NotNull Block block);
/**
* Can player injure living entity.
*
* @param player The player.
* @param victim The victim.
* @return If player can injure.
*/
boolean canInjure(@NotNull Player player, @NotNull LivingEntity victim);
/**
* Can player pick up item.
*
* @param player The player.
* @param location The location.
* @return If player can pick up item.
*/
default boolean canPickupItem(@NotNull Player player, @NotNull Location location) {
return true;
}
}

View File

@@ -0,0 +1,15 @@
package com.willfp.eco.core.integrations.customentities;
import com.willfp.eco.core.integrations.Integration;
/**
* Wrapper class for custom item integrations.
*/
public interface CustomEntitiesIntegration extends Integration {
/**
* Register all the custom entities for a specific plugin into eco.
*
* @see com.willfp.eco.core.entities.Entities
*/
void registerAllEntities();
}

View File

@@ -12,14 +12,14 @@ public final class CustomEntitiesManager {
/**
* A set of all registered integrations.
*/
private static final Set<CustomEntitiesWrapper> REGISTERED = new HashSet<>();
private static final Set<CustomEntitiesIntegration> REGISTERED = new HashSet<>();
/**
* Register a new integration.
*
* @param integration The integration to register.
*/
public static void register(@NotNull final CustomEntitiesWrapper integration) {
public static void register(@NotNull final CustomEntitiesIntegration integration) {
REGISTERED.add(integration);
}
@@ -29,8 +29,8 @@ public final class CustomEntitiesManager {
* @see com.willfp.eco.core.entities.Entities
*/
public static void registerAllEntities() {
for (CustomEntitiesWrapper wrapper : REGISTERED) {
wrapper.registerAllEntities();
for (CustomEntitiesIntegration Integration : REGISTERED) {
Integration.registerAllEntities();
}
}

View File

@@ -1,15 +1,11 @@
package com.willfp.eco.core.integrations.customentities;
import com.willfp.eco.core.integrations.Integration;
/**
* Wrapper class for custom item integrations.
*
* @deprecated Use CustomEntitiesIntegration instead.
*/
public interface CustomEntitiesWrapper extends Integration {
/**
* Register all the custom entities for a specific plugin into eco.
*
* @see com.willfp.eco.core.entities.Entities
*/
void registerAllEntities();
@Deprecated(since = "6.35.0", forRemoval = true)
public interface CustomEntitiesWrapper extends CustomEntitiesIntegration {
}

View File

@@ -0,0 +1,24 @@
package com.willfp.eco.core.integrations.customitems;
import com.willfp.eco.core.integrations.Integration;
/**
* Wrapper class for custom item integrations.
*/
public interface CustomItemsIntegration extends Integration {
/**
* Register all the custom items for a specific plugin into eco.
*
* @see com.willfp.eco.core.items.Items
*/
default void registerAllItems() {
// Override when needed.
}
/**
* Register {@link com.willfp.eco.core.items.provider.ItemProvider}s.
*/
default void registerProvider() {
// Override when needed.
}
}

View File

@@ -12,14 +12,14 @@ public final class CustomItemsManager {
/**
* A set of all registered integrations.
*/
private static final Set<CustomItemsWrapper> REGISTERED = new HashSet<>();
private static final Set<CustomItemsIntegration> REGISTERED = new HashSet<>();
/**
* Register a new integration.
*
* @param integration The integration to register.
*/
public static void register(@NotNull final CustomItemsWrapper integration) {
public static void register(@NotNull final CustomItemsIntegration integration) {
REGISTERED.add(integration);
}
@@ -29,8 +29,8 @@ public final class CustomItemsManager {
* @see com.willfp.eco.core.items.Items
*/
public static void registerAllItems() {
for (CustomItemsWrapper customItemsWrapper : REGISTERED) {
customItemsWrapper.registerAllItems();
for (CustomItemsIntegration customItemsIntegration : REGISTERED) {
customItemsIntegration.registerAllItems();
}
}
@@ -40,8 +40,8 @@ public final class CustomItemsManager {
* @see com.willfp.eco.core.items.Items
*/
public static void registerProviders() {
for (CustomItemsWrapper customItemsWrapper : REGISTERED) {
customItemsWrapper.registerProvider();
for (CustomItemsIntegration customItemsIntegration : REGISTERED) {
customItemsIntegration.registerProvider();
}
}

View File

@@ -1,24 +1,11 @@
package com.willfp.eco.core.integrations.customitems;
import com.willfp.eco.core.integrations.Integration;
/**
* Wrapper class for custom item integrations.
*
* @deprecated Use CustomItemsIntegration instead.
*/
public interface CustomItemsWrapper extends Integration {
/**
* Register all the custom items for a specific plugin into eco.
*
* @see com.willfp.eco.core.items.Items
*/
default void registerAllItems() {
// Override when needed.
}
@Deprecated(since = "6.35.0", forRemoval = true)
public interface CustomItemsWrapper extends CustomItemsIntegration {
/**
* Register {@link com.willfp.eco.core.items.provider.ItemProvider}s.
*/
default void registerProvider() {
// Override when needed.
}
}

View File

@@ -0,0 +1,48 @@
package com.willfp.eco.core.integrations.economy;
import com.willfp.eco.core.integrations.Integration;
import org.bukkit.OfflinePlayer;
import org.jetbrains.annotations.NotNull;
/**
* Wrapper class for economy integrations.
*/
public interface EconomyIntegration extends Integration {
/**
* Get if a player has a certain amount.
*
* @param player The player.
* @param amount The amount.
* @return If the player has the amount.
*/
boolean hasAmount(@NotNull OfflinePlayer player,
double amount);
/**
* Give money to a player.
*
* @param player The player.
* @param amount The amount to give.
* @return If the transaction was a success.
*/
boolean giveMoney(@NotNull OfflinePlayer player,
double amount);
/**
* Remove money from a player.
*
* @param player The player.
* @param amount The amount to remove.
* @return If the transaction was a success.
*/
boolean removeMoney(@NotNull OfflinePlayer player,
double amount);
/**
* Get the balance of a player.
*
* @param player The player.
* @return The balance.
*/
double getBalance(@NotNull OfflinePlayer player);
}

View File

@@ -13,14 +13,14 @@ public final class EconomyManager {
/**
* A set of all registered integrations.
*/
private static final Set<EconomyWrapper> REGISTERED = new HashSet<>();
private static final Set<EconomyIntegration> REGISTERED = new HashSet<>();
/**
* Register a new integration.
*
* @param integration The integration to register.
*/
public static void register(@NotNull final EconomyWrapper integration) {
public static void register(@NotNull final EconomyIntegration integration) {
REGISTERED.add(integration);
}
@@ -42,8 +42,8 @@ public final class EconomyManager {
*/
public static boolean hasAmount(@NotNull final OfflinePlayer player,
final double amount) {
for (EconomyWrapper wrapper : REGISTERED) {
return wrapper.hasAmount(player, amount);
for (EconomyIntegration Integration : REGISTERED) {
return Integration.hasAmount(player, amount);
}
return false;
@@ -58,8 +58,8 @@ public final class EconomyManager {
*/
public static boolean giveMoney(@NotNull final OfflinePlayer player,
final double amount) {
for (EconomyWrapper wrapper : REGISTERED) {
return wrapper.giveMoney(player, amount);
for (EconomyIntegration Integration : REGISTERED) {
return Integration.giveMoney(player, amount);
}
return false;
@@ -74,8 +74,8 @@ public final class EconomyManager {
*/
public static boolean removeMoney(@NotNull final OfflinePlayer player,
final double amount) {
for (EconomyWrapper wrapper : REGISTERED) {
return wrapper.removeMoney(player, amount);
for (EconomyIntegration Integration : REGISTERED) {
return Integration.removeMoney(player, amount);
}
return false;
@@ -88,8 +88,8 @@ public final class EconomyManager {
* @return The balance.
*/
public static double getBalance(@NotNull final OfflinePlayer player) {
for (EconomyWrapper wrapper : REGISTERED) {
return wrapper.getBalance(player);
for (EconomyIntegration Integration : REGISTERED) {
return Integration.getBalance(player);
}
return 0;

View File

@@ -1,48 +1,11 @@
package com.willfp.eco.core.integrations.economy;
import com.willfp.eco.core.integrations.Integration;
import org.bukkit.OfflinePlayer;
import org.jetbrains.annotations.NotNull;
/**
* Wrapper class for economy integrations.
*
* @deprecated Use EconomyIntegration instead.
*/
public interface EconomyWrapper extends Integration {
/**
* Get if a player has a certain amount.
*
* @param player The player.
* @param amount The amount.
* @return If the player has the amount.
*/
boolean hasAmount(@NotNull OfflinePlayer player,
double amount);
@Deprecated(since = "6.35.0", forRemoval = true)
public interface EconomyWrapper extends EconomyIntegration {
/**
* Give money to a player.
*
* @param player The player.
* @param amount The amount to give.
* @return If the transaction was a success.
*/
boolean giveMoney(@NotNull OfflinePlayer player,
double amount);
/**
* Remove money from a player.
*
* @param player The player.
* @param amount The amount to remove.
* @return If the transaction was a success.
*/
boolean removeMoney(@NotNull OfflinePlayer player,
double amount);
/**
* Get the balance of a player.
*
* @param player The player.
* @return The balance.
*/
double getBalance(@NotNull OfflinePlayer player);
}

View File

@@ -0,0 +1,22 @@
package com.willfp.eco.core.integrations.hologram;
import com.willfp.eco.core.integrations.Integration;
import org.bukkit.Location;
import org.jetbrains.annotations.NotNull;
import java.util.List;
/**
* Wrapper class for hologram integrations.
*/
public interface HologramIntegration extends Integration {
/**
* Create hologram.
*
* @param location The location.
* @param contents The contents for the hologram.
* @return The hologram.
*/
Hologram createHologram(@NotNull Location location,
@NotNull List<String> contents);
}

View File

@@ -14,14 +14,14 @@ public final class HologramManager {
/**
* A set of all registered integrations.
*/
private static final Set<HologramWrapper> REGISTERED = new HashSet<>();
private static final Set<HologramIntegration> REGISTERED = new HashSet<>();
/**
* Register a new integration.
*
* @param integration The integration to register.
*/
public static void register(@NotNull final HologramWrapper integration) {
public static void register(@NotNull final HologramIntegration integration) {
REGISTERED.add(integration);
}
@@ -34,8 +34,8 @@ public final class HologramManager {
*/
public static Hologram createHologram(@NotNull final Location location,
@NotNull final List<String> contents) {
for (HologramWrapper wrapper : REGISTERED) {
return wrapper.createHologram(location, contents);
for (HologramIntegration Integration : REGISTERED) {
return Integration.createHologram(location, contents);
}
return new DummyHologram();

View File

@@ -1,22 +1,10 @@
package com.willfp.eco.core.integrations.hologram;
import com.willfp.eco.core.integrations.Integration;
import org.bukkit.Location;
import org.jetbrains.annotations.NotNull;
import java.util.List;
/**
* Wrapper class for hologram integrations.
*
* @deprecated Use HologramIntegration instead.
*/
public interface HologramWrapper extends Integration {
/**
* Create hologram.
*
* @param location The location.
* @param contents The contents for the hologram.
* @return The hologram.
*/
Hologram createHologram(@NotNull Location location,
@NotNull List<String> contents);
public interface HologramWrapper extends HologramIntegration {
}

View File

@@ -0,0 +1,27 @@
package com.willfp.eco.core.integrations.mcmmo;
import com.willfp.eco.core.integrations.Integration;
import org.bukkit.block.Block;
import org.bukkit.event.Event;
import org.jetbrains.annotations.NotNull;
/**
* Wrapper class for mcmmo integrations.
*/
public interface McmmoIntegration extends Integration {
/**
* Get bonus drop count of block.
*
* @param block The block.
* @return The drop multiplier.
*/
int getBonusDropCount(@NotNull Block block);
/**
* Get if event is fake.
*
* @param event The event.
* @return If is fake.
*/
boolean isFake(@NotNull Event event);
}

View File

@@ -14,14 +14,14 @@ public final class McmmoManager {
/**
* A set of all registered integrations.
*/
private static final Set<McmmoWrapper> REGISTERED = new HashSet<>();
private static final Set<McmmoIntegration> REGISTERED = new HashSet<>();
/**
* Register a new integration.
*
* @param integration The integration to register.
*/
public static void register(@NotNull final McmmoWrapper integration) {
public static void register(@NotNull final McmmoIntegration integration) {
REGISTERED.add(integration);
}
@@ -32,8 +32,8 @@ public final class McmmoManager {
* @return The bonus drop count.
*/
public static int getBonusDropCount(@NotNull final Block block) {
for (McmmoWrapper mcmmoWrapper : REGISTERED) {
return mcmmoWrapper.getBonusDropCount(block);
for (McmmoIntegration mcmmoIntegration : REGISTERED) {
return mcmmoIntegration.getBonusDropCount(block);
}
return 0;
}
@@ -45,8 +45,8 @@ public final class McmmoManager {
* @return If the event is fake.
*/
public static boolean isFake(@NotNull final Event event) {
for (McmmoWrapper mcmmoWrapper : REGISTERED) {
return mcmmoWrapper.isFake(event);
for (McmmoIntegration mcmmoIntegration : REGISTERED) {
return mcmmoIntegration.isFake(event);
}
return false;
}

View File

@@ -1,27 +1,11 @@
package com.willfp.eco.core.integrations.mcmmo;
import com.willfp.eco.core.integrations.Integration;
import org.bukkit.block.Block;
import org.bukkit.event.Event;
import org.jetbrains.annotations.NotNull;
/**
* Wrapper class for mcmmo integrations.
*
* @deprecated Use McmmoIntegration instead.
*/
public interface McmmoWrapper extends Integration {
/**
* Get bonus drop count of block.
*
* @param block The block.
* @return The drop multiplier.
*/
int getBonusDropCount(@NotNull Block block);
@Deprecated(since = "6.35.0", forRemoval = true)
public interface McmmoWrapper extends McmmoIntegration {
/**
* Get if event is fake.
*
* @param event The event.
* @return If is fake.
*/
boolean isFake(@NotNull Event event);
}

View File

@@ -0,0 +1,28 @@
package com.willfp.eco.core.integrations.shop;
import com.willfp.eco.core.integrations.Integration;
import org.bukkit.event.Listener;
import org.jetbrains.annotations.Nullable;
/**
* Wrapper class for shop integrations.
*/
public interface ShopIntegration extends Integration {
/**
* Register eco item provider for shop plugins.
*/
default void registerEcoProvider() {
// Do nothing unless overridden.
}
/**
* Get the sell event adapter.
*
* @return The listener.
*/
@Nullable
default Listener getSellEventAdapter() {
// Do nothing unless overridden.
return null;
}
}

View File

@@ -15,14 +15,14 @@ public final class ShopManager {
/**
* A set of all registered integrations.
*/
private static final Set<ShopWrapper> REGISTERED = new HashSet<>();
private static final Set<ShopIntegration> REGISTERED = new HashSet<>();
/**
* Register a new integration.
*
* @param integration The integration to register.
*/
public static void register(@NotNull final ShopWrapper integration) {
public static void register(@NotNull final ShopIntegration integration) {
REGISTERED.add(integration);
}
@@ -33,8 +33,8 @@ public final class ShopManager {
*/
@ApiStatus.Internal
public static void registerEvents(@NotNull final EcoPlugin plugin) {
for (ShopWrapper wrapper : REGISTERED) {
Listener listener = wrapper.getSellEventAdapter();
for (ShopIntegration Integration : REGISTERED) {
Listener listener = Integration.getSellEventAdapter();
if (listener != null) {
plugin.getEventManager().registerListener(listener);
@@ -46,8 +46,8 @@ public final class ShopManager {
* Register eco item provider for shop plugins.
*/
public static void registerEcoProvider() {
for (ShopWrapper shopWrapper : REGISTERED) {
shopWrapper.registerEcoProvider();
for (ShopIntegration shopIntegration : REGISTERED) {
shopIntegration.registerEcoProvider();
}
}

View File

@@ -1,28 +1,11 @@
package com.willfp.eco.core.integrations.shop;
import com.willfp.eco.core.integrations.Integration;
import org.bukkit.event.Listener;
import org.jetbrains.annotations.Nullable;
/**
* Wrapper class for shop integrations.
*
* @deprecated Use AFKIntegration instead.
*/
public interface ShopWrapper extends Integration {
/**
* Register eco item provider for shop plugins.
*/
default void registerEcoProvider() {
// Do nothing unless overridden.
}
@Deprecated(since = "6.35.0", forRemoval = true)
public interface ShopWrapper extends ShopIntegration {
/**
* Get the sell event adapter.
*
* @return The listener.
*/
@Nullable
default Listener getSellEventAdapter() {
// Do nothing unless overridden.
return null;
}
}