Raxen/src/main/java/gq/unurled/raxen/manager/ResourcePackManager.java
unurled 0b861e39bd 0.4.7
update to 1.18.2, and bug fixes
2022-03-20 00:35:06 +01:00

46 lines
1.6 KiB
Java

package gq.unurled.raxen.manager;
import gq.unurled.raxen.Raxen;
import gq.unurled.raxen.components.resourcepack.ResourcePack;
import lombok.Getter;
import org.bukkit.configuration.file.FileConfiguration;
import java.util.Objects;
import static gq.unurled.raxen.utils.Utils.debug;
import static gq.unurled.raxen.utils.Utils.error;
public class ResourcePackManager {
private Raxen main;
@Getter
private ResourcePack resourcePack;
private FileConfiguration config;
@Getter
private boolean useRP;
public ResourcePackManager(Raxen main) {
this.main = main;
this.resourcePack = new ResourcePack(main, this);
this.config = main.getConfig();
this.useRP = this.config.getBoolean("useResourcePack");
enable();
}
private void enable() {
if(useRP) {
if(config.getString("resource_pack_url") == null || Objects.equals(config.getString("rssource_pack_url"), "") ||
config.getString("resource_pack_sha1") == null || Objects.equals(config.getString("resource_pack_sha1"), "") ||
Objects.equals(config.getString("resource_pack_url"), "https://mc-packs.net/") || Objects.equals(config.getString("resource_pack_sha1"), "sha1hallo")) {
error(main, "You must specify an resource_pack_url and resource_pack_sha1!");
debug(main, "Resource pack not enabled.");
useRP = false;
} else {
debug(main, "Ressource Pack enabled.");
}
} else {
debug(main, "Resource pack not enabled.");
}
}
}