Skip to content

Commit

Permalink
Fix the hologram stacking during quickcrate usage (#723)
Browse files Browse the repository at this point in the history
* chore: update dependency imports
* fix: hologram double stacking
* fix: display name above quickcrate having [] around it
* chore: update import
  • Loading branch information
ryderbelserion authored May 20, 2024
1 parent 875ab77 commit 5a22448
Show file tree
Hide file tree
Showing 53 changed files with 158 additions and 188 deletions.
6 changes: 3 additions & 3 deletions buildSrc/src/main/kotlin/java-plugin.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ plugins {
}

repositories {
maven("https://repo.codemc.io/repository/maven-public/")
maven("https://repo.codemc.io/repository/maven-public")

maven("https://repo.crazycrew.us/releases/")
maven("https://repo.crazycrew.us/snapshots")

maven("https://jitpack.io/")
maven("https://jitpack.io")

flatDir { dirs("libs") }

Expand Down
8 changes: 4 additions & 4 deletions buildSrc/src/main/kotlin/paper-plugin.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ plugins {
}

repositories {
maven("https://repo.extendedclip.com/content/repositories/placeholderapi/")
maven("https://repo.extendedclip.com/content/repositories/placeholderapi")

maven("https://repo.papermc.io/repository/maven-public/")
maven("https://repo.papermc.io/repository/maven-public")

maven("https://repo.triumphteam.dev/snapshots/")
maven("https://repo.triumphteam.dev/snapshots")

maven("https://repo.oraxen.com/releases/")
maven("https://repo.oraxen.com/releases")
}

paperweight.reobfArtifactConfiguration = io.papermc.paperweight.userdev.ReobfArtifactConfiguration.MOJANG_PRODUCTION
Expand Down
6 changes: 3 additions & 3 deletions common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ plugins {
}

dependencies {
compileOnly(libs.vital.common)
api(project(":crazycrates-api"))

compileOnly(libs.annotations)
compileOnly(libs.vital.core)

api(project(":crazycrates-api"))
compileOnly(libs.annotations)
}
6 changes: 3 additions & 3 deletions common/src/main/java/com/badbones69/crazycrates/Server.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.badbones69.crazycrates;

import com.ryderbelserion.vital.common.AbstractPlugin;
import com.ryderbelserion.vital.common.util.FileUtil;
import com.ryderbelserion.vital.core.AbstractPlugin;
import com.ryderbelserion.vital.core.util.FileUtil;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import us.crazycrew.crazycrates.CratesProvider;
Expand Down Expand Up @@ -33,7 +33,7 @@ public Server(@NotNull final File directory, @NotNull final Logger logger) {
*/
@ApiStatus.Internal
public void apply() {
ConfigManager.load();
ConfigManager.load(this.directory);

this.settings = new Settings();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package com.badbones69.crazycrates.api.enums;

import ch.jalu.configme.SettingsManager;
import com.badbones69.crazycrates.config.ConfigManager;
import com.ryderbelserion.vital.core.config.YamlFile;
import org.jetbrains.annotations.NotNull;

public enum CustomFiles {

messages("messages.yml"),
config("config.yml");
locations("locations.yml"),
data("data.yml");

private final SettingsManager settingsManager;
private final String fileName;
private final YamlFile yamlFile;

/**
* A constructor to build a file
Expand All @@ -19,34 +19,24 @@ public enum CustomFiles {
*/
CustomFiles(@NotNull final String fileName) {
this.fileName = fileName;
this.settingsManager = ConfigManager.getYamlManager().getFile(this.fileName);
this.yamlFile = ConfigManager.getYamlManager().getFile(this.fileName);
}

/**
* @return the file name
* @return {@link String}
*/
public @NotNull final String getFileName() {
return this.fileName;
}

/**
* @return the file configuration
* @return {@link YamlFile}
*/
public @NotNull final SettingsManager getSettingsManager() {
return this.settingsManager;
public @NotNull final YamlFile getYamlFile() {
return this.yamlFile;
}

/**
* Save the file
*/
public void save() {
getSettingsManager().save();
}

/**
* Reload the file
*/
public void reload() {
getSettingsManager().reload();
ConfigManager.getYamlManager().saveFile(getFileName());
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package com.badbones69.crazycrates.config;

import ch.jalu.configme.SettingsManager;
import com.badbones69.crazycrates.api.enums.CustomFiles;
import ch.jalu.configme.SettingsManagerBuilder;
import ch.jalu.configme.resource.YamlFileResourceOptions;
import com.badbones69.crazycrates.config.migrate.ConfigMigration;
import com.badbones69.crazycrates.config.migrate.LocaleMigration;
import com.badbones69.crazycrates.config.impl.ConfigKeys;
Expand All @@ -10,27 +11,44 @@
import com.badbones69.crazycrates.config.impl.messages.ErrorKeys;
import com.badbones69.crazycrates.config.impl.messages.MiscKeys;
import com.badbones69.crazycrates.config.impl.messages.PlayerKeys;
import com.ryderbelserion.vital.common.configuration.YamlManager;
import com.ryderbelserion.vital.core.config.YamlManager;
import org.jetbrains.annotations.ApiStatus;
import java.io.File;

public class ConfigManager {

private static YamlManager yamlManager;

private static SettingsManager config;

private static SettingsManager messages;

/**
* Loads configuration files.
*/
@ApiStatus.Internal
public static void load() {
public static void load(File dataFolder) {
YamlFileResourceOptions builder = YamlFileResourceOptions.builder().indentationSize(2).build();

config = SettingsManagerBuilder
.withYamlFile(new File(dataFolder, "config.yml"), builder)
.migrationService(new ConfigMigration())
.configurationData(ConfigKeys.class)
.create();

messages = SettingsManagerBuilder
.withYamlFile(new File(dataFolder, "messages.yml"), builder)
.migrationService(new LocaleMigration())
.configurationData(MiscKeys.class, ErrorKeys.class, PlayerKeys.class, CrateKeys.class, CommandKeys.class)
.create();

if (yamlManager == null) yamlManager = new YamlManager();

// Create directory
yamlManager.createPluginDirectory();

// Add files
yamlManager.addFile("messages.yml", new LocaleMigration(), MiscKeys.class, ErrorKeys.class, PlayerKeys.class, CrateKeys.class, CommandKeys.class).addFile("config.yml", new ConfigMigration(), ConfigKeys.class)
.addStaticFile("locations.yml")
.addStaticFile("data.yml")
yamlManager.addFile("locations.yml").addFile("data.yml")
.addFolder("crates")
.addFolder("schematics")
.init();
Expand All @@ -40,28 +58,28 @@ public static void load() {
* Refreshes configuration files.
*/
public static void refresh() {
// Refresh configme files.
config.reload();
messages.reload();

// Refresh static files.
getYamlManager().reloadFiles();

// Refresh custom files.
getYamlManager().reloadCustomFiles();

// Refresh other files.
getYamlManager().reloadStaticFiles();
}

/**
* @return gets config.yml
*/
public static SettingsManager getConfig() {
return CustomFiles.config.getSettingsManager();
return config;
}

/**
* @return gets messages.yml
*/
public static SettingsManager getMessages() {
return CustomFiles.messages.getSettingsManager();
return messages;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
import ch.jalu.configme.configurationdata.ConfigurationData;
import ch.jalu.configme.migration.PlainMigrationService;
import ch.jalu.configme.resource.PropertyReader;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import com.badbones69.crazycrates.api.enums.FileProperty;

@ApiStatus.Internal
public class ConfigMigration extends PlainMigrationService {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
import ch.jalu.configme.configurationdata.ConfigurationData;
import ch.jalu.configme.migration.PlainMigrationService;
import ch.jalu.configme.resource.PropertyReader;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import com.badbones69.crazycrates.api.enums.FileProperty;

@ApiStatus.Internal
public class LocaleMigration extends PlainMigrationService {

@Override
Expand Down
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
run-paper = { id = "xyz.jpenilla.run-paper", version = "2.3.0" }

[versions]
vital = "1.1"
vital = "1.0-snapshot"

[libraries]
itemsadder-api = { group = "com.github.LoneDev6", name = "api-itemsadder", version = "3.6.1" }
oraxen-api = { group = "io.th0rgal", name = "oraxen", version = "1.171.0" }
placeholder-api = { group = "me.clip", name = "placeholderapi", version = "2.11.5" }
head-database-api = { group = "com.arcaniax", name = "HeadDatabase-API", version = "1.3.1" }

vital-common = { group = "com.ryderbelserion", name = "vital-common", version.ref = "vital" }
vital-paper = { group = "com.ryderbelserion", name = "vital-paper", version.ref = "vital" }
vital-paper = { group = "com.ryderbelserion.vital", name = "paper", version.ref = "vital" }
vital-core = { group = "com.ryderbelserion.vital", name = "core", version.ref = "vital" }

annotations = { group = "org.jetbrains", name = "annotations", version = "24.1.0" }

Expand Down
8 changes: 4 additions & 4 deletions paper/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ plugins {
}

repositories {
maven("https://repo.fancyplugins.de/releases/")
maven("https://repo.fancyplugins.de/releases")
}

dependencies {
implementation(project(":crazycrates-common"))
api(project(":crazycrates-common"))

implementation(libs.triumph.cmds)

Expand All @@ -21,10 +21,10 @@ dependencies {

compileOnly(libs.decent.holograms)

compileOnly(libs.fancy.holograms)

compileOnly(libs.placeholder.api)

compileOnly(libs.fancy.holograms)

compileOnly(libs.oraxen.api)
}

Expand Down
2 changes: 1 addition & 1 deletion paper/run/server.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Minecraft server properties
#Tue May 14 17:54:04 EDT 2024
#Sun May 19 16:52:58 EDT 2024
accepts-transfers=false
allow-flight=false
allow-nether=false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import com.badbones69.crazycrates.tasks.BukkitUserManager;
import com.badbones69.crazycrates.tasks.InventoryManager;
import com.badbones69.crazycrates.tasks.crates.CrateManager;
import com.ryderbelserion.vital.enums.Support;
import com.ryderbelserion.vital.paper.enums.Support;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.badbones69.crazycrates.api;

import com.badbones69.crazycrates.api.objects.Tier;
import com.ryderbelserion.vital.enums.Support;
import com.ryderbelserion.vital.util.builders.items.ItemBuilder;
import com.ryderbelserion.vital.paper.builders.items.ItemBuilder;
import com.ryderbelserion.vital.paper.enums.Support;
import com.badbones69.crazycrates.CrazyCrates;
import com.badbones69.crazycrates.api.events.PlayerPrizeEvent;
import com.badbones69.crazycrates.api.objects.Crate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import com.badbones69.crazycrates.api.objects.Crate;
import com.badbones69.crazycrates.api.objects.Tier;
import com.badbones69.crazycrates.tasks.crates.CrateManager;
import com.ryderbelserion.vital.util.builders.items.ItemBuilder;
import com.ryderbelserion.vital.util.scheduler.FoliaRunnable;
import com.ryderbelserion.vital.paper.builders.items.ItemBuilder;
import com.ryderbelserion.vital.paper.util.scheduler.FoliaRunnable;
import com.badbones69.crazycrates.tasks.crates.effects.SoundEffect;
import com.google.common.base.Preconditions;
import io.papermc.paper.threadedregions.scheduler.ScheduledTask;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import com.badbones69.crazycrates.tasks.BukkitUserManager;
import com.badbones69.crazycrates.tasks.InventoryManager;
import com.badbones69.crazycrates.tasks.crates.CrateManager;
import com.ryderbelserion.vital.enums.Support;
import com.ryderbelserion.vital.util.MiscUtil;
import com.ryderbelserion.vital.paper.enums.Support;
import com.ryderbelserion.vital.paper.util.MiscUtil;
import net.kyori.adventure.text.serializer.json.JSONComponentSerializer;
import net.minecraft.network.protocol.game.ClientboundOpenScreenPacket;
import net.minecraft.server.level.ServerPlayer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import com.badbones69.crazycrates.api.enums.Messages;
import com.badbones69.crazycrates.api.enums.Permissions;
import com.badbones69.crazycrates.api.objects.Crate;
import com.ryderbelserion.vital.util.MiscUtil;
import com.ryderbelserion.vital.util.builders.items.ItemBuilder;
import com.ryderbelserion.vital.paper.builders.items.ItemBuilder;
import com.ryderbelserion.vital.paper.util.MiscUtil;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
Expand Down
Loading

0 comments on commit 5a22448

Please sign in to comment.