Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 52 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

<groupId>com.magmaguy</groupId>
<artifactId>ResourcePackManager</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.6.0</version>

<properties>
<maven.compiler.source>22</maven.compiler.source>
<maven.compiler.target>22</maven.compiler.target>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

Expand All @@ -22,6 +22,11 @@
<id>central</id>
<url>https://repo1.maven.org/maven2/</url>
</repository>
<repository>
<id>magmaguy-repo-releases</id>
<name>MagmaGuy's Repository</name>
<url>https://repo.magmaguy.com/releases</url>
</repository>
</repositories>

<dependencies>
Expand All @@ -47,10 +52,39 @@
<artifactId>httpclient5</artifactId>
<version>5.3.1</version>
</dependency>
<dependency>
<groupId>com.magmaguy</groupId>
<artifactId>MagmaCore</artifactId>
<version>1.18-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.magmaguy</groupId>
<artifactId>FreeMinecraftModels</artifactId>
<version>1.4.0</version>
<scope>provided</scope>
</dependency>
<!-- Bstats -->
<dependency>
<groupId>org.bstats</groupId>
<artifactId>bstats-bukkit</artifactId>
<version>3.0.2</version>
<scope>compile</scope>
</dependency>
</dependencies>

<build>
<finalName>ResourcePackManager</finalName>

<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>17</source>
<target>17</target>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
Expand All @@ -68,11 +102,26 @@
<pattern>org.apache.hc</pattern>
<shadedPattern>com.magmaguy.resourcepackmanager.org.apache.hc</shadedPattern>
</relocation>
<relocation>
<pattern>org.bstats</pattern>
<shadedPattern>com.magmaguy.freeminecraftmodels</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<distributionManagement>
<snapshotRepository>
<id>magmaguy-repo-snapshots</id>
<url>https://magmaguy.com/snapshots</url>
</snapshotRepository>
<repository>
<id>magmaguy-repo-snapshots</id>
<name>MagmaGuy's Repository</name>
<url>https://repo.magmaguy.com/releases</url>
</repository>
</distributionManagement>
</project>

This file was deleted.

14 changes: 0 additions & 14 deletions src/main/java/com/magmaguy/resourcepackmanager/Logger.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
package com.magmaguy.resourcepackmanager;

import com.magmaguy.freeminecraftmodels.bukkit.Metrics;
import com.magmaguy.magmacore.MagmaCore;
import com.magmaguy.magmacore.command.CommandManager;
import com.magmaguy.magmacore.util.Logger;
import com.magmaguy.resourcepackmanager.autohost.AutoHost;
import com.magmaguy.resourcepackmanager.commands.CommandManager;
import com.magmaguy.resourcepackmanager.commands.DataComplianceRequestCommand;
import com.magmaguy.resourcepackmanager.commands.ReloadCommand;
import com.magmaguy.resourcepackmanager.config.BlueprintFolder;
import com.magmaguy.resourcepackmanager.config.DataConfig;
import com.magmaguy.resourcepackmanager.config.DefaultConfig;
import com.magmaguy.resourcepackmanager.mixer.Mix;
import com.magmaguy.resourcepackmanager.config.compatibleplugins.CompatiblePluginConfig;
import com.magmaguy.resourcepackmanager.playermanager.PlayerManager;
import com.magmaguy.resourcepackmanager.thirdparty.ThirdPartyResourcePack;
import com.magmaguy.resourcepackmanager.utils.VersionChecker;
import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin;
import org.bukkit.event.HandlerList;
import org.bukkit.plugin.java.JavaPlugin;

public class ResourcePackManager extends JavaPlugin {

public static Plugin plugin;
public static JavaPlugin plugin;

@Override
public void onEnable() {
Expand All @@ -20,17 +30,39 @@ public void onEnable() {
" | /\\__ \\ _/ |\\/| / _` | ' \\/ _` / _` / -_) '_|\n" +
" |_|_\\|___/_| |_| |_\\__,_|_||_\\__,_\\__, \\___|_| \n" +
" |___/ ");
Logger.info("Enabling ResourcePackManager v." + this.getDescription().getVersion());
Bukkit.getLogger().info("ResourcePackManager v." + this.getDescription().getVersion());
MagmaCore.onEnable();

plugin = this;
DefaultConfig.initializeConfig();
Mix.initialize();
AutoHost.initialize();
new CommandManager(this);
new DataConfig();
new DefaultConfig();
new CompatiblePluginConfig();

BlueprintFolder.initialize();
//This starts a watchdog to see if the resource packs change and updates the mixer if htey do.
ThirdPartyResourcePack.startResourcePackChangeWatchdog();
if (DefaultConfig.isAutoHost())
Bukkit.getPluginManager().registerEvents(new PlayerManager(), this);
CommandManager commandManager = new CommandManager(this, "resourcepackmanager");
commandManager.registerCommand(new ReloadCommand());
commandManager.registerCommand(new DataComplianceRequestCommand());
Bukkit.getPluginManager().registerEvents(new VersionChecker.VersionCheckerEvents(), this);
// AutoHost.initialize();

Metrics metrics = new Metrics(this, 22867);
MagmaCore.checkVersionUpdate("118574", "https://www.spigotmc.org/resources/resource-pack-manager.118574/");
}

@Override
public void onLoad() {
MagmaCore.createInstance(this);
}

@Override
public void onDisable() {
Logger.info("Disabling ResourcePackManager");
ThirdPartyResourcePack.shutdown();
AutoHost.shutdown();
HandlerList.unregisterAll(this);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
package com.magmaguy.resourcepackmanager.api;

import com.magmaguy.resourcepackmanager.commands.ReloadCommand;
import com.magmaguy.resourcepackmanager.thirdparty.ThirdPartyResourcePack;
import org.bukkit.Bukkit;

import java.util.HashMap;

public class ResourcePackManagerAPI {
public static HashMap<String, ThirdPartyResourcePack> thirdPartyResourcePackHashMap = new HashMap<>();

/**
* Registers a resource pack with the ResourcePackManager.
* Either localPath or url must be provided (non-null), but not both.
*
* @param pluginName The name of the plugin as it appears in the plugin list. Case-sensitive.
* @param localPath The relative path to the resource pack file (zipped or folder) from the plugins directory, or null if using URL.
* @param url The URL to download the resource pack from, or null if using local path.
* @param encrypts Whether the pack can be encrypted by the plugin. Currently does nothing.
* @param distributes Whether the plugin can distribute the pack. Currently does nothing.
* @param zips Whether the resource pack is already zipped. If false, ResourcePackManager will zip it.
* @param reloadCommand The reload command of the plugin adding a pack. Currently does nothing.
*/
public static void registerResourcePack(String pluginName,
String localPath,
String url,
boolean encrypts,
boolean distributes,
boolean zips,
String reloadCommand) {
thirdPartyResourcePackHashMap.put(pluginName,
new ThirdPartyResourcePack(pluginName, localPath, url, encrypts, distributes, zips, reloadCommand));
}

/**
* Registers a local resource pack with the ResourcePackManager.
*
* @param pluginName The name of the plugin as it appears in the plugin list. Case-sensitive.
* @param localPath The relative path to the resource pack file (zipped or folder) from the plugins directory.
* @param encrypts Whether the pack can be encrypted by the plugin. Currently does nothing.
* @param distributes Whether the plugin can distribute the pack. Currently does nothing.
* @param zips Whether the resource pack is already zipped. If false, ResourcePackManager will zip it.
* @param reloadCommand The reload command of the plugin adding a pack. Currently does nothing.
*/
public static void registerLocalResourcePack(String pluginName,
String localPath,
boolean encrypts,
boolean distributes,
boolean zips,
String reloadCommand) {
thirdPartyResourcePackHashMap.put(pluginName,
new ThirdPartyResourcePack(pluginName, localPath, null, encrypts, distributes, zips, reloadCommand));
}

/**
* Registers a remote resource pack with the ResourcePackManager.
* The resource pack will be downloaded from the provided URL.
*
* @param pluginName The name of the plugin as it appears in the plugin list. Case-sensitive.
* @param url The URL to download the resource pack from.
* @param encrypts Whether the pack can be encrypted by the plugin. Currently does nothing.
* @param distributes Whether the plugin can distribute the pack. Currently does nothing.
* @param zips Whether the resource pack from the URL is already zipped. If false, ResourcePackManager will zip it.
* @param reloadCommand The reload command of the plugin adding a pack. Currently does nothing.
*/
public static void registerRemoteResourcePack(String pluginName,
String url,
boolean encrypts,
boolean distributes,
boolean zips,
String reloadCommand) {
thirdPartyResourcePackHashMap.put(pluginName,
new ThirdPartyResourcePack(pluginName, null, url, encrypts, distributes, zips, reloadCommand));
}

/**
* Reloads the plugin, thereby redoing everything necessary to merge and host the resource pack
*/
public static void reloadResourcePack() {
ReloadCommand.reloadPlugin(Bukkit.getConsoleSender());
}
}
Loading