Deprecated PluginDependent

This commit is contained in:
Auxilor
2022-10-02 01:56:45 +01:00
parent 29b63a2ebb
commit 048982c74a
5 changed files with 66 additions and 14 deletions

View File

@@ -13,7 +13,9 @@ import org.jetbrains.annotations.NotNull;
* in the constructor.
*
* @param <T> The eco plugin type.
* @deprecated Leaky inheritance, shouldn't exist.
*/
@Deprecated(since = "6.43.0", forRemoval = true)
public abstract class PluginDependent<T extends EcoPlugin> {
/**
* The {@link EcoPlugin} that is stored.

View File

@@ -1,7 +1,6 @@
package com.willfp.eco.core.display;
import com.willfp.eco.core.EcoPlugin;
import com.willfp.eco.core.PluginDependent;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
@@ -10,12 +9,17 @@ import org.jetbrains.annotations.Nullable;
/**
* Class for all plugin-specific client-side item display modules.
*/
public abstract class DisplayModule extends PluginDependent<EcoPlugin> {
public abstract class DisplayModule {
/**
* The priority of the module.
*/
private final int weight;
/**
* The plugin.
*/
private final EcoPlugin plugin;
/**
* Create a new display module.
*
@@ -24,7 +28,7 @@ public abstract class DisplayModule extends PluginDependent<EcoPlugin> {
*/
protected DisplayModule(@NotNull final EcoPlugin plugin,
@NotNull final DisplayPriority priority) {
super(plugin);
this.plugin = plugin;
this.weight = priority.getWeight();
}
@@ -132,4 +136,13 @@ public abstract class DisplayModule extends PluginDependent<EcoPlugin> {
public int getWeight() {
return this.weight;
}
/**
* Get the plugin.
*
* @return The plugin.
*/
public EcoPlugin getPlugin() {
return plugin;
}
}

View File

@@ -2,7 +2,6 @@ package com.willfp.eco.core.recipe.recipes;
import com.willfp.eco.core.Eco;
import com.willfp.eco.core.EcoPlugin;
import com.willfp.eco.core.PluginDependent;
import com.willfp.eco.core.items.TestableItem;
import com.willfp.eco.core.recipe.Recipes;
import com.willfp.eco.core.recipe.parts.EmptyTestableItem;
@@ -25,7 +24,12 @@ import java.util.List;
/**
* Shaped 3x3 crafting recipe.
*/
public final class ShapedCraftingRecipe extends PluginDependent<EcoPlugin> implements CraftingRecipe {
public final class ShapedCraftingRecipe implements CraftingRecipe {
/**
* The plugin.
*/
private final EcoPlugin plugin;
/**
* Recipe parts.
*/
@@ -56,8 +60,7 @@ public final class ShapedCraftingRecipe extends PluginDependent<EcoPlugin> imple
@NotNull final List<TestableItem> parts,
@NotNull final ItemStack output,
@Nullable final String permission) {
super(plugin);
this.plugin = plugin;
this.parts = parts;
this.key = plugin.getNamespacedKeyFactory().create(key);
this.displayedKey = plugin.getNamespacedKeyFactory().create(key + "_displayed");
@@ -145,6 +148,15 @@ public final class ShapedCraftingRecipe extends PluginDependent<EcoPlugin> imple
Bukkit.getServer().addRecipe(shapedRecipe);
}
/**
* Get the plugin.
*
* @return The plugin.
*/
public EcoPlugin getPlugin() {
return plugin;
}
/**
* Create a new recipe builder.
*

View File

@@ -3,7 +3,6 @@ package com.willfp.eco.core.recipe.recipes;
import com.google.common.annotations.Beta;
import com.willfp.eco.core.Eco;
import com.willfp.eco.core.EcoPlugin;
import com.willfp.eco.core.PluginDependent;
import com.willfp.eco.core.items.TestableItem;
import com.willfp.eco.core.recipe.Recipes;
import com.willfp.eco.core.recipe.parts.EmptyTestableItem;
@@ -26,7 +25,12 @@ import java.util.Optional;
* Shapeless crafting recipe.
*/
@Beta
public final class ShapelessCraftingRecipe extends PluginDependent<EcoPlugin> implements CraftingRecipe {
public final class ShapelessCraftingRecipe implements CraftingRecipe {
/**
* The plugin.
*/
private final EcoPlugin plugin;
/**
* Recipe parts.
*/
@@ -57,8 +61,7 @@ public final class ShapelessCraftingRecipe extends PluginDependent<EcoPlugin> im
@NotNull final List<TestableItem> parts,
@NotNull final ItemStack output,
@Nullable final String permission) {
super(plugin);
this.plugin = plugin;
this.parts = parts;
this.key = plugin.getNamespacedKeyFactory().create(key);
this.displayedKey = plugin.getNamespacedKeyFactory().create(key + "_displayed");
@@ -143,6 +146,15 @@ public final class ShapelessCraftingRecipe extends PluginDependent<EcoPlugin> im
Bukkit.getServer().addRecipe(shapelessRecipe);
}
/**
* Get the plugin.
*
* @return The plugin.
*/
public EcoPlugin getPlugin() {
return plugin;
}
/**
* Create a new recipe builder.
*

View File

@@ -1,7 +1,6 @@
package com.willfp.eco.core.web;
import com.willfp.eco.core.EcoPlugin;
import com.willfp.eco.core.PluginDependent;
import org.bukkit.util.Consumer;
import org.jetbrains.annotations.NotNull;
@@ -13,14 +12,19 @@ import java.util.Scanner;
/**
* Class to check for updates of a plugin on spigot.
*/
public class UpdateChecker extends PluginDependent<EcoPlugin> {
public class UpdateChecker {
/**
* The plugin.
*/
private final EcoPlugin plugin;
/**
* Create an update checker for the specified spigot resource id.
*
* @param plugin The plugin to check.
*/
public UpdateChecker(@NotNull final EcoPlugin plugin) {
super(plugin);
this.plugin = plugin;
}
/**
@@ -44,4 +48,13 @@ public class UpdateChecker extends PluginDependent<EcoPlugin> {
}
});
}
/**
* Get the plugin.
*
* @return The plugin.
*/
public EcoPlugin getPlugin() {
return plugin;
}
}