Skip to content

Commit

Permalink
update getter for main class
Browse files Browse the repository at this point in the history
  • Loading branch information
ryderbelserion committed Aug 20, 2024
1 parent 132b45c commit 44370d4
Show file tree
Hide file tree
Showing 32 changed files with 33 additions and 54 deletions.
4 changes: 4 additions & 0 deletions src/main/java/com/badbones69/crazycrates/CrazyCrates.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@

public class CrazyCrates extends JavaPlugin {

public static CrazyCrates getPlugin() {
return JavaPlugin.getPlugin(CrazyCrates.class);
}

private final Timer timer;
private final long startTime;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;
import com.badbones69.crazycrates.api.utils.MiscUtils;
import com.badbones69.crazycrates.api.utils.MsgUtils;
Expand All @@ -26,7 +25,7 @@

public class PrizeManager {

private static @NotNull final CrazyCrates plugin = JavaPlugin.getPlugin(CrazyCrates.class);
private static @NotNull final CrazyCrates plugin = CrazyCrates.getPlugin();

/**
* Gets the prize for the player.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;
import us.crazycrew.crazycrates.api.enums.types.CrateType;
import us.crazycrew.crazycrates.api.enums.types.KeyType;
Expand All @@ -28,7 +27,7 @@

public abstract class CrateBuilder extends FoliaRunnable {

protected @NotNull final CrazyCrates plugin = JavaPlugin.getPlugin(CrazyCrates.class);
protected @NotNull final CrazyCrates plugin = CrazyCrates.getPlugin();

protected @NotNull final CrateManager crateManager = this.plugin.getCrateManager();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.plugin.java.JavaPlugin;
import com.badbones69.crazycrates.config.ConfigManager;
import com.badbones69.crazycrates.config.impl.ConfigKeys;
import me.clip.placeholderapi.PlaceholderAPI;
Expand All @@ -36,7 +35,7 @@

public abstract class InventoryBuilder implements InventoryHolder, Listener {

protected @NotNull final CrazyCrates plugin = JavaPlugin.getPlugin(CrazyCrates.class);
protected @NotNull final CrazyCrates plugin = CrazyCrates.getPlugin();

protected @NotNull final BukkitUserManager userManager = this.plugin.getUserManager();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public enum Files {

private final String fileName;

private @NotNull final CrazyCrates plugin = JavaPlugin.getPlugin(CrazyCrates.class);
private @NotNull final CrazyCrates plugin = CrazyCrates.getPlugin();

private @NotNull final FileManager fileManager = this.plugin.getFileManager();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public enum PersistentKeys {
crate_tier("crate_tier", PersistentDataType.STRING),
crate_key("crate_key", PersistentDataType.STRING);

private @NotNull final CrazyCrates plugin = JavaPlugin.getPlugin(CrazyCrates.class);
private @NotNull final CrazyCrates plugin = CrazyCrates.getPlugin();

private final String NamespacedKey;
private final PersistentDataType type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.persistence.PersistentDataContainer;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.Nullable;
import us.crazycrew.crazycrates.api.enums.types.CrateType;
import com.badbones69.crazycrates.CrazyCrates;
Expand Down Expand Up @@ -84,7 +83,7 @@ public class Crate {

private List<String> prizeCommands = new ArrayList<>();

private @NotNull final CrazyCrates plugin = JavaPlugin.getPlugin(CrazyCrates.class);
private @NotNull final CrazyCrates plugin = CrazyCrates.getPlugin();

private @NotNull final CrateManager crateManager = this.plugin.getCrateManager();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
Expand All @@ -27,7 +26,7 @@

public class Prize {

private final CrazyCrates plugin = JavaPlugin.getPlugin(CrazyCrates.class);
private final CrazyCrates plugin = CrazyCrates.getPlugin();

private final ConfigurationSection section;
private final List<ItemBuilder> builders;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
import com.badbones69.crazycrates.CrazyCrates;
import com.badbones69.crazycrates.api.objects.Crate;
import org.bukkit.Location;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public class BrokeLocation {

private @NotNull final CrazyCrates plugin = JavaPlugin.getPlugin(CrazyCrates.class);
private @NotNull final CrazyCrates plugin = CrazyCrates.getPlugin();

/**
* Empty values that get instantiated below.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.badbones69.crazycrates.config.impl.ConfigKeys;
import com.ryderbelserion.vital.common.utils.FileUtil;
import com.ryderbelserion.vital.paper.VitalPaper;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import us.crazycrew.crazycrates.CratesProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import org.bukkit.inventory.ItemStack;
import org.bukkit.persistence.PersistentDataContainer;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;
import java.util.List;
import java.util.Optional;
Expand All @@ -27,7 +26,7 @@

public class ItemUtils {

private static @NotNull final CrazyCrates plugin = JavaPlugin.getPlugin(CrazyCrates.class);
private static @NotNull final CrazyCrates plugin = CrazyCrates.getPlugin();

private static @NotNull final CrateManager crateManager = plugin.getCrateManager();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.badbones69.crazycrates.api.enums.Permissions;
import com.badbones69.crazycrates.api.builders.ItemBuilder;
import org.bukkit.permissions.Permission;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.Nullable;
import com.badbones69.crazycrates.config.ConfigManager;
import com.badbones69.crazycrates.config.impl.ConfigKeys;
Expand Down Expand Up @@ -35,7 +34,7 @@

public class MiscUtils {

private static @NotNull final CrazyCrates plugin = JavaPlugin.getPlugin(CrazyCrates.class);
private static @NotNull final CrazyCrates plugin = CrazyCrates.getPlugin();

public static void sendCommand(@NotNull final String command) {
if (command.isEmpty()) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

public class CommandManager {

private final static @NotNull CrazyCrates plugin = JavaPlugin.getPlugin(CrazyCrates.class);
private final static @NotNull CrazyCrates plugin = CrazyCrates.getPlugin();
private final static @NotNull CrateManager crateManager = plugin.getCrateManager();

private final static @NotNull BukkitCommandManager<CommandSender> commandManager = BukkitCommandManager.create(plugin);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand All @@ -29,7 +28,7 @@
@Command(value = "crazycrates", alias = {"crates", "crate"})
public abstract class BaseCommand {

protected @NotNull final CrazyCrates plugin = JavaPlugin.getPlugin(CrazyCrates.class);
protected @NotNull final CrazyCrates plugin = CrazyCrates.getPlugin();

protected @NotNull final InventoryManager inventoryManager = this.plugin.getInventoryManager();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
Expand All @@ -25,7 +24,7 @@

public abstract class ICrateMigrator {

protected final CrazyCrates plugin = JavaPlugin.getPlugin(CrazyCrates.class);
protected final CrazyCrates plugin = CrazyCrates.getPlugin();

protected final CrateManager crateManager = this.plugin.getCrateManager();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
@Description("Views the amount of keys you/others have.")
public class CommandKey {

private @NotNull final CrazyCrates plugin = JavaPlugin.getPlugin(CrazyCrates.class);
private @NotNull final CrazyCrates plugin = CrazyCrates.getPlugin();

private @NotNull final BukkitUserManager userManager = this.plugin.getUserManager();
private @NotNull final CrateManager crateManager = this.plugin.getCrateManager();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.world.WorldLoadEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;
import com.badbones69.crazycrates.tasks.crates.CrateManager;
import java.util.ArrayList;
Expand All @@ -19,7 +18,7 @@
// Only use for this class is to check if for broken locations and to try and fix them when the server loads the world.
public class BrokeLocationsListener implements Listener {

private @NotNull final CrazyCrates plugin = JavaPlugin.getPlugin(CrazyCrates.class);
private @NotNull final CrazyCrates plugin = CrazyCrates.getPlugin();

private @NotNull final CrateManager crateManager = this.plugin.getCrateManager();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
import us.crazycrew.crazycrates.api.enums.types.CrateType;
Expand All @@ -39,7 +38,7 @@

public class CrateControlListener implements Listener {

private @NotNull final CrazyCrates plugin = JavaPlugin.getPlugin(CrazyCrates.class);
private @NotNull final CrazyCrates plugin = CrazyCrates.getPlugin();

private @NotNull final InventoryManager inventoryManager = this.plugin.getInventoryManager();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,13 @@
import org.bukkit.event.Listener;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;
import com.badbones69.crazycrates.tasks.crates.CrateManager;
import us.crazycrew.crazycrates.api.enums.types.CrateType;

public class MiscListener implements Listener {

private @NotNull final CrazyCrates plugin = JavaPlugin.getPlugin(CrazyCrates.class);
private @NotNull final CrazyCrates plugin = CrazyCrates.getPlugin();

private @NotNull final CrateManager crateManager = this.plugin.getCrateManager();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import me.clip.placeholderapi.PlaceholderAPI;
import net.kyori.adventure.sound.Sound;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.plugin.java.JavaPlugin;
import com.badbones69.crazycrates.config.ConfigManager;
import com.badbones69.crazycrates.config.impl.ConfigKeys;
import com.badbones69.crazycrates.api.PrizeManager;
Expand Down Expand Up @@ -48,7 +47,7 @@

public class CosmicCrateListener implements Listener {

private @NotNull final CrazyCrates plugin = JavaPlugin.getPlugin(CrazyCrates.class);
private @NotNull final CrazyCrates plugin = CrazyCrates.getPlugin();

private @NotNull final CrateManager crateManager = this.plugin.getCrateManager();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;
import us.crazycrew.crazycrates.api.enums.types.CrateType;
import com.badbones69.crazycrates.api.utils.MsgUtils;
import java.util.List;

public class CrateOpenListener implements Listener {

private @NotNull final CrazyCrates plugin = JavaPlugin.getPlugin(CrazyCrates.class);
private @NotNull final CrazyCrates plugin = CrazyCrates.getPlugin();

private @NotNull final CrateManager crateManager = this.plugin.getCrateManager();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,14 @@
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.persistence.PersistentDataContainer;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;
import us.crazycrew.crazycrates.api.enums.types.CrateType;
import com.badbones69.crazycrates.api.utils.ItemUtils;
import com.badbones69.crazycrates.api.utils.MiscUtils;

public class MobileCrateListener implements Listener {

private @NotNull final CrazyCrates plugin = JavaPlugin.getPlugin(CrazyCrates.class);
private @NotNull final CrazyCrates plugin = CrazyCrates.getPlugin();

private @NotNull final CrateManager crateManager = this.plugin.getCrateManager();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
import java.util.HashMap;
Expand All @@ -41,7 +39,7 @@

public class QuadCrateListener implements Listener {

private @NotNull final CrazyCrates plugin = JavaPlugin.getPlugin(CrazyCrates.class);
private @NotNull final CrazyCrates plugin = CrazyCrates.getPlugin();

private @NotNull final SessionManager sessionManager = new SessionManager();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;
import us.crazycrew.crazycrates.api.enums.types.CrateType;
import com.badbones69.crazycrates.CrazyCrates;
Expand All @@ -23,7 +22,7 @@

public class WarCrateListener implements Listener {

private @NotNull final CrazyCrates plugin = JavaPlugin.getPlugin(CrazyCrates.class);
private @NotNull final CrazyCrates plugin = CrazyCrates.getPlugin();

private @NotNull final CrateManager crateManager = this.plugin.getCrateManager();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.badbones69.crazycrates.api.objects.Crate;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand All @@ -19,7 +18,7 @@
@SuppressWarnings("deprecation")
public abstract class HologramManager {

protected CrazyCrates plugin = JavaPlugin.getPlugin(CrazyCrates.class);
protected CrazyCrates plugin = CrazyCrates.getPlugin();

public abstract void createHologram(final Location location, final Crate crate, final String id);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;
import com.badbones69.crazycrates.tasks.BukkitUserManager;
import java.text.NumberFormat;
Expand All @@ -18,7 +17,7 @@

public class PlaceholderAPISupport extends PlaceholderExpansion {

private @NotNull final CrazyCrates plugin = JavaPlugin.getPlugin(CrazyCrates.class);
private @NotNull final CrazyCrates plugin = CrazyCrates.getPlugin();

private @NotNull final BukkitUserManager userManager = this.plugin.getUserManager();

Expand Down
Loading

0 comments on commit 44370d4

Please sign in to comment.