Skip to content

Commit

Permalink
Fix an issue with FileNotFoundException if you deleted a file from `c…
Browse files Browse the repository at this point in the history
…rates` folder (#732)

* bump vital api

* extend new vital class, make use of verbose logging

* update CHANGELOG.md

* bump version

* Nuke and repopulate custom files every time on reload
  • Loading branch information
ryderbelserion authored Jun 3, 2024
1 parent 0129642 commit 49aeffb
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 11 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## Fixes:
* Updates how lore is handled when using /cc additem
* Fixed an issue where if you removed a file and ran /crazycrates reload, It would tell about file not found
* I didn't remove the file from the cache... It should now.

## Other:
* [Feature Requests](https://github.com/Crazy-Crew/CrazyCrates/discussions/categories/features)
Expand Down
1 change: 1 addition & 0 deletions buildSrc/src/main/kotlin/java-plugin.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ repositories {
flatDir { dirs("libs") }

mavenCentral()
//mavenLocal()
}

dependencies {
Expand Down
14 changes: 10 additions & 4 deletions core/src/main/java/com/badbones69/crazycrates/Server.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.badbones69.crazycrates;

import com.ryderbelserion.vital.core.AbstractPlugin;
import com.badbones69.crazycrates.config.impl.ConfigKeys;
import com.ryderbelserion.vital.core.Vital;
import com.ryderbelserion.vital.core.util.FileUtil;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
Expand All @@ -13,7 +14,7 @@
import java.util.List;
import java.util.logging.Logger;

public class Server extends AbstractPlugin implements IServer {
public class Server extends Vital implements IServer {

private final File directory;
private final Logger logger;
Expand All @@ -26,15 +27,15 @@ public Server(@NotNull final File directory, @NotNull final Logger logger) {
this.directory = directory;
this.crates = new File(this.directory, "crates");
this.logger = logger;

ConfigManager.load(this.directory);
}

/**
* Loads the plugin.
*/
@ApiStatus.Internal
public void apply() {
ConfigManager.load(this.directory);

this.settings = new Settings();

// Register default provider.
Expand Down Expand Up @@ -112,4 +113,9 @@ public void reload() {
public @NotNull final Logger getLogger() {
return this.logger;
}

@Override
public boolean isLogging() {
return ConfigManager.getConfig().getProperty(ConfigKeys.verbose_logging);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ public static void refresh() {
config.reload();
messages.reload();

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

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

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

/**
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ authors=["ryderbelserion", "BadBones69", "TDL"]
description=Create unlimited crates with multiple crate types to choose from!
website=https://modrinth.com/plugin/crazycrates

version=3.0.1
version=3.0.2
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ oraxen = "1.171.0"
annotations = "24.1.0"
crazycrates = "0.6"
gson = "2.10.1"
vital = "1.2"
vital = "1.5.1"

decentholograms = "2.8.8"
fancyholograms = "2.0.6"
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
#Mon Jun 03 12:01:59 EDT 2024
#Mon Jun 03 15:51:13 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 @@ -247,6 +247,8 @@ public void loadCrates() {

final CrateType crateType = CrateType.getFromName(file.getString("Crate.CrateType", "CSGO"));

this.plugin.getLogger().warning("Type: " + crateType.getName());

final ArrayList<Prize> prizes = new ArrayList<>();
final List<Tier> tiers = new ArrayList<>();

Expand Down

0 comments on commit 49aeffb

Please sign in to comment.