Skip to content

Commit

Permalink
Move entry point stuff to main package
Browse files Browse the repository at this point in the history
  • Loading branch information
OliverSchlueter committed Dec 27, 2024
1 parent d1400fa commit eae4118
Show file tree
Hide file tree
Showing 42 changed files with 58 additions and 56 deletions.
6 changes: 3 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ dependencies {
}

paper {
main = "de.oliver.fancyholograms.FancyHolograms"
bootstrapper = "de.oliver.fancyholograms.loaders.FancyHologramsBootstrapper"
loader = "de.oliver.fancyholograms.loaders.FancyHologramsLoader"
main = "de.oliver.fancyholograms.main.FancyHolograms"
bootstrapper = "de.oliver.fancyholograms.main.FancyHologramsBootstrapper"
loader = "de.oliver.fancyholograms.main.FancyHologramsLoader"
foliaSupported = true
version = rootProject.version.toString()
description = "Simple, lightweight and fast hologram plugin using display entities"
Expand Down
1 change: 1 addition & 0 deletions src/main/java/de/oliver/fancyholograms/FHFeatureFlags.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package de.oliver.fancyholograms;

import de.oliver.fancyholograms.main.FancyHolograms;
import de.oliver.fancylib.featureFlags.FeatureFlag;
import de.oliver.fancylib.featureFlags.FeatureFlagConfig;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import de.oliver.fancyholograms.api.FancyHologramsPlugin;
import de.oliver.fancyholograms.api.HologramConfiguration;
import de.oliver.fancyholograms.main.FancyHolograms;
import de.oliver.fancylib.ConfigHelper;
import org.jetbrains.annotations.NotNull;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import de.oliver.fancyholograms.api.events.HologramsLoadedEvent;
import de.oliver.fancyholograms.api.events.HologramsUnloadedEvent;
import de.oliver.fancyholograms.api.hologram.Hologram;
import de.oliver.fancyholograms.main.FancyHolograms;
import de.oliver.fancynpcs.api.FancyNpcsPlugin;
import org.bukkit.Bukkit;
import org.bukkit.World;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
package de.oliver.fancyholograms.commands;

import de.oliver.fancyholograms.FancyHolograms;
import de.oliver.fancyholograms.main.FancyHolograms;
import de.oliver.fancyholograms.api.data.HologramData;
import de.oliver.fancyholograms.api.hologram.Hologram;
import de.oliver.fancyholograms.storage.converter.ConverterTarget;
import de.oliver.fancyholograms.storage.converter.FHConversionRegistry;
import de.oliver.fancyholograms.storage.converter.HologramConversionSession;
import de.oliver.fancyholograms.util.Constants;
import de.oliver.fancylib.MessageHelper;
import de.oliver.fancylib.translations.message.Message;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;

import java.util.*;
import java.util.regex.Pattern;
import java.util.stream.Stream;

public final class FancyHologramsCMD extends Command {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.oliver.fancyholograms.commands;

import de.oliver.fancyholograms.FancyHolograms;
import de.oliver.fancyholograms.main.FancyHolograms;
import de.oliver.fancyholograms.api.hologram.Hologram;
import de.oliver.fancyholograms.api.data.TextHologramData;
import de.oliver.fancylib.MessageHelper;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package de.oliver.fancyholograms.commands;

import com.google.common.primitives.Ints;
import de.oliver.fancyholograms.FancyHolograms;
import de.oliver.fancyholograms.main.FancyHolograms;
import de.oliver.fancyholograms.api.data.DisplayHologramData;
import de.oliver.fancyholograms.api.data.HologramData;
import de.oliver.fancyholograms.api.data.TextHologramData;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.oliver.fancyholograms.commands.hologram;

import de.oliver.fancyholograms.FancyHolograms;
import de.oliver.fancyholograms.main.FancyHolograms;
import de.oliver.fancyholograms.api.hologram.Hologram;
import de.oliver.fancyholograms.api.data.TextHologramData;
import de.oliver.fancyholograms.api.events.HologramUpdateEvent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package de.oliver.fancyholograms.commands.hologram;

import com.google.common.base.Enums;
import de.oliver.fancyholograms.FancyHolograms;
import de.oliver.fancyholograms.main.FancyHolograms;
import de.oliver.fancyholograms.api.hologram.Hologram;
import de.oliver.fancyholograms.api.data.DisplayHologramData;
import de.oliver.fancyholograms.api.events.HologramUpdateEvent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.oliver.fancyholograms.commands.hologram;

import de.oliver.fancyholograms.FancyHolograms;
import de.oliver.fancyholograms.main.FancyHolograms;
import de.oliver.fancyholograms.api.hologram.Hologram;
import de.oliver.fancyholograms.api.data.BlockHologramData;
import de.oliver.fancyholograms.api.events.HologramUpdateEvent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.oliver.fancyholograms.commands.hologram;

import de.oliver.fancyholograms.FancyHolograms;
import de.oliver.fancyholograms.main.FancyHolograms;
import de.oliver.fancyholograms.api.data.DisplayHologramData;
import de.oliver.fancyholograms.api.hologram.Hologram;
import de.oliver.fancyholograms.commands.Subcommand;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.oliver.fancyholograms.commands.hologram;

import de.oliver.fancyholograms.FancyHolograms;
import de.oliver.fancyholograms.main.FancyHolograms;
import de.oliver.fancyholograms.api.hologram.Hologram;
import de.oliver.fancyholograms.commands.Subcommand;
import de.oliver.fancyholograms.util.Constants;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.oliver.fancyholograms.commands.hologram;

import de.oliver.fancyholograms.FancyHolograms;
import de.oliver.fancyholograms.main.FancyHolograms;
import de.oliver.fancyholograms.api.hologram.Hologram;
import de.oliver.fancyholograms.api.events.HologramCreateEvent;
import de.oliver.fancyholograms.commands.Subcommand;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.oliver.fancyholograms.commands.hologram;

import de.oliver.fancyholograms.FancyHolograms;
import de.oliver.fancyholograms.main.FancyHolograms;
import de.oliver.fancyholograms.api.hologram.Hologram;
import de.oliver.fancyholograms.api.hologram.HologramType;
import de.oliver.fancyholograms.api.data.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package de.oliver.fancyholograms.commands.hologram;

import com.google.common.primitives.Ints;
import de.oliver.fancyholograms.FancyHolograms;
import de.oliver.fancyholograms.main.FancyHolograms;
import de.oliver.fancyholograms.api.hologram.Hologram;
import de.oliver.fancyholograms.api.data.TextHologramData;
import de.oliver.fancyholograms.api.events.HologramUpdateEvent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package de.oliver.fancyholograms.commands.hologram;

import com.google.common.primitives.Ints;
import de.oliver.fancyholograms.FancyHolograms;
import de.oliver.fancyholograms.main.FancyHolograms;
import de.oliver.fancyholograms.api.hologram.Hologram;
import de.oliver.fancyholograms.api.data.TextHologramData;
import de.oliver.fancyholograms.api.events.HologramUpdateEvent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.oliver.fancyholograms.commands.hologram;

import de.oliver.fancyholograms.FancyHolograms;
import de.oliver.fancyholograms.main.FancyHolograms;
import de.oliver.fancyholograms.api.hologram.Hologram;
import de.oliver.fancyholograms.api.data.ItemHologramData;
import de.oliver.fancyholograms.api.events.HologramUpdateEvent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.oliver.fancyholograms.commands.hologram;

import de.oliver.fancyholograms.FancyHolograms;
import de.oliver.fancyholograms.main.FancyHolograms;
import de.oliver.fancyholograms.api.hologram.Hologram;
import de.oliver.fancyholograms.commands.Subcommand;
import de.oliver.fancyholograms.util.PluginUtils;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package de.oliver.fancyholograms.commands.hologram;

import com.google.common.primitives.Ints;
import de.oliver.fancyholograms.FancyHolograms;
import de.oliver.fancyholograms.main.FancyHolograms;
import de.oliver.fancyholograms.api.hologram.Hologram;
import de.oliver.fancyholograms.commands.Subcommand;
import de.oliver.fancyholograms.util.Constants;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package de.oliver.fancyholograms.commands.hologram;

import com.google.common.primitives.Doubles;
import de.oliver.fancyholograms.FancyHolograms;
import de.oliver.fancyholograms.main.FancyHolograms;
import de.oliver.fancyholograms.api.hologram.Hologram;
import de.oliver.fancyholograms.api.events.HologramUpdateEvent;
import de.oliver.fancyholograms.commands.HologramCMD;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.oliver.fancyholograms.commands.hologram;

import de.oliver.fancyholograms.FancyHolograms;
import de.oliver.fancyholograms.main.FancyHolograms;
import de.oliver.fancyholograms.api.hologram.Hologram;
import de.oliver.fancyholograms.commands.Subcommand;
import de.oliver.fancyholograms.util.Constants;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.oliver.fancyholograms.commands.hologram;

import de.oliver.fancyholograms.FancyHolograms;
import de.oliver.fancyholograms.main.FancyHolograms;
import de.oliver.fancyholograms.api.FancyHologramsPlugin;
import de.oliver.fancyholograms.api.events.HologramDeleteEvent;
import de.oliver.fancyholograms.api.hologram.Hologram;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package de.oliver.fancyholograms.commands.hologram;

import com.google.common.primitives.Floats;
import de.oliver.fancyholograms.FancyHolograms;
import de.oliver.fancyholograms.main.FancyHolograms;
import de.oliver.fancyholograms.api.hologram.Hologram;
import de.oliver.fancyholograms.api.data.DisplayHologramData;
import de.oliver.fancyholograms.api.events.HologramUpdateEvent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.oliver.fancyholograms.commands.hologram;

import de.oliver.fancyholograms.FancyHolograms;
import de.oliver.fancyholograms.main.FancyHolograms;
import de.oliver.fancyholograms.api.hologram.Hologram;
import de.oliver.fancyholograms.api.data.TextHologramData;
import de.oliver.fancyholograms.api.events.HologramUpdateEvent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package de.oliver.fancyholograms.commands.hologram;

import com.google.common.primitives.Ints;
import de.oliver.fancyholograms.FancyHolograms;
import de.oliver.fancyholograms.main.FancyHolograms;
import de.oliver.fancyholograms.api.hologram.Hologram;
import de.oliver.fancyholograms.api.data.TextHologramData;
import de.oliver.fancyholograms.api.events.HologramUpdateEvent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package de.oliver.fancyholograms.commands.hologram;

import com.google.common.primitives.Floats;
import de.oliver.fancyholograms.FancyHolograms;
import de.oliver.fancyholograms.main.FancyHolograms;
import de.oliver.fancyholograms.api.hologram.Hologram;
import de.oliver.fancyholograms.api.data.DisplayHologramData;
import de.oliver.fancyholograms.api.events.HologramUpdateEvent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package de.oliver.fancyholograms.commands.hologram;

import com.google.common.primitives.Floats;
import de.oliver.fancyholograms.FancyHolograms;
import de.oliver.fancyholograms.main.FancyHolograms;
import de.oliver.fancyholograms.api.hologram.Hologram;
import de.oliver.fancyholograms.api.data.DisplayHologramData;
import de.oliver.fancyholograms.api.events.HologramUpdateEvent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package de.oliver.fancyholograms.commands.hologram;

import com.google.common.base.Enums;
import de.oliver.fancyholograms.FancyHolograms;
import de.oliver.fancyholograms.main.FancyHolograms;
import de.oliver.fancyholograms.api.hologram.Hologram;
import de.oliver.fancyholograms.api.data.TextHologramData;
import de.oliver.fancyholograms.api.events.HologramUpdateEvent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.oliver.fancyholograms.commands.hologram;

import de.oliver.fancyholograms.FancyHolograms;
import de.oliver.fancyholograms.main.FancyHolograms;
import de.oliver.fancyholograms.api.hologram.Hologram;
import de.oliver.fancyholograms.api.data.TextHologramData;
import de.oliver.fancyholograms.api.events.HologramUpdateEvent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package de.oliver.fancyholograms.commands.hologram;

import com.google.common.primitives.Floats;
import de.oliver.fancyholograms.FancyHolograms;
import de.oliver.fancyholograms.main.FancyHolograms;
import de.oliver.fancyholograms.api.hologram.Hologram;
import de.oliver.fancyholograms.api.data.DisplayHologramData;
import de.oliver.fancyholograms.api.events.HologramUpdateEvent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.oliver.fancyholograms.commands.hologram;

import de.oliver.fancyholograms.FancyHolograms;
import de.oliver.fancyholograms.main.FancyHolograms;
import de.oliver.fancyholograms.api.hologram.Hologram;
import de.oliver.fancyholograms.commands.Subcommand;
import de.oliver.fancyholograms.util.PluginUtils;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package de.oliver.fancyholograms.commands.hologram;

import com.google.common.primitives.Ints;
import de.oliver.fancyholograms.FancyHolograms;
import de.oliver.fancyholograms.main.FancyHolograms;
import de.oliver.fancyholograms.api.hologram.Hologram;
import de.oliver.fancyholograms.api.data.TextHologramData;
import de.oliver.fancyholograms.api.events.HologramUpdateEvent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.oliver.fancyholograms.commands.hologram;

import de.oliver.fancyholograms.FancyHolograms;
import de.oliver.fancyholograms.main.FancyHolograms;
import de.oliver.fancyholograms.api.hologram.Hologram;
import de.oliver.fancyholograms.api.data.property.Visibility;
import de.oliver.fancyholograms.commands.Subcommand;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package de.oliver.fancyholograms.commands.hologram;

import com.google.common.primitives.Ints;
import de.oliver.fancyholograms.FancyHolograms;
import de.oliver.fancyholograms.main.FancyHolograms;
import de.oliver.fancyholograms.api.hologram.Hologram;
import de.oliver.fancyholograms.api.events.HologramUpdateEvent;
import de.oliver.fancyholograms.commands.HologramCMD;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.oliver.fancyholograms.listeners;

import de.oliver.fancyholograms.FancyHolograms;
import de.oliver.fancyholograms.main.FancyHolograms;
import de.oliver.fancyholograms.api.data.HologramData;
import de.oliver.fancyholograms.api.hologram.Hologram;
import de.oliver.fancylib.FancyLib;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package de.oliver.fancyholograms.listeners;

import de.oliver.fancyholograms.FancyHolograms;
import de.oliver.fancyholograms.main.FancyHolograms;
import de.oliver.fancyholograms.api.hologram.Hologram;
import net.kyori.adventure.resource.ResourcePackStatus;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
Expand All @@ -28,6 +27,17 @@ public PlayerListener(@NotNull final FancyHolograms plugin) {
this.loadingResourcePacks = new HashMap<>();
}

// For 1.20.2 and higher this method returns actual pack identifier, while for older versions, the identifier is a dummy UUID full of zeroes.
// Versions prior 1.20.2 supports sending and receiving only one resource-pack and a dummy, constant identifier can be used as a key.
private static @NotNull UUID getResourcePackID(final @NotNull PlayerResourcePackStatusEvent event) {
try {
event.getClass().getMethod("getID");
return event.getID();
} catch (final @NotNull NoSuchMethodException e) {
return new UUID(0,0);
}
}

@EventHandler(priority = EventPriority.MONITOR)
public void onJoin(@NotNull final PlayerJoinEvent event) {
for (final var hologram : this.plugin.getHologramsManager().getHolograms()) {
Expand Down Expand Up @@ -84,15 +94,4 @@ else if (event.getStatus() == Status.SUCCESSFULLY_LOADED || event.getStatus() ==
}
}

// For 1.20.2 and higher this method returns actual pack identifier, while for older versions, the identifier is a dummy UUID full of zeroes.
// Versions prior 1.20.2 supports sending and receiving only one resource-pack and a dummy, constant identifier can be used as a key.
private static @NotNull UUID getResourcePackID(final @NotNull PlayerResourcePackStatusEvent event) {
try {
event.getClass().getMethod("getID");
return event.getID();
} catch (final @NotNull NoSuchMethodException e) {
return new UUID(0,0);
}
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.oliver.fancyholograms.listeners;

import de.oliver.fancyholograms.FancyHolograms;
import de.oliver.fancyholograms.main.FancyHolograms;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.world.WorldLoadEvent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.oliver.fancyholograms;
package de.oliver.fancyholograms.main;

import com.google.common.util.concurrent.ThreadFactoryBuilder;
import de.oliver.fancyanalytics.api.FancyAnalyticsAPI;
Expand All @@ -8,6 +8,9 @@
import de.oliver.fancyanalytics.logger.appender.Appender;
import de.oliver.fancyanalytics.logger.appender.ConsoleAppender;
import de.oliver.fancyanalytics.logger.appender.JsonAppender;
import de.oliver.fancyholograms.FHFeatureFlags;
import de.oliver.fancyholograms.FancyHologramsConfiguration;
import de.oliver.fancyholograms.HologramManagerImpl;
import de.oliver.fancyholograms.api.FancyHologramsPlugin;
import de.oliver.fancyholograms.api.HologramConfiguration;
import de.oliver.fancyholograms.api.HologramManager;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.oliver.fancyholograms.loaders;
package de.oliver.fancyholograms.main;

import io.papermc.paper.plugin.bootstrap.BootstrapContext;
import io.papermc.paper.plugin.bootstrap.PluginBootstrap;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.oliver.fancyholograms.loaders;
package de.oliver.fancyholograms.main;

import io.papermc.paper.plugin.loader.PluginClasspathBuilder;
import io.papermc.paper.plugin.loader.PluginLoader;
Expand Down
Loading

0 comments on commit eae4118

Please sign in to comment.