Skip to content

Commit

Permalink
fix #248
Browse files Browse the repository at this point in the history
  • Loading branch information
xGinko committed Dec 31, 2024
1 parent b985498 commit e680a47
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ public void onEnable() {
return;
}

try {
Files.createDirectories(getDataFolder().toPath());
} catch (Exception e) {
prefixedLogger.error("Unable to create plugin directory.", e);
return;
}

instance = this;
cachingPermTool = CachingPermTool.enable(this);
metrics = new Metrics(this, 8700);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import org.bukkit.Sound;

import java.io.File;
import java.nio.file.Files;
import java.time.Duration;
import java.util.List;
import java.util.Locale;
Expand All @@ -31,7 +30,6 @@ public class Config {

public Config() throws Exception {
AnarchyExploitFixes plugin = AnarchyExploitFixes.getInstance();
Files.createDirectories(plugin.getDataFolder().toPath());
// Load config.yml with ConfigMaster
this.config = ConfigFile.loadConfig(new File(plugin.getDataFolder(), "config.yml"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockDispenseEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.player.PlayerInteractEvent;

Expand Down Expand Up @@ -125,7 +123,7 @@ public BlockLimit() {
Map<String, Object> compatible = new TreeMap<>();
for (Map.Entry<XMaterial, Integer> entry : universal.entrySet()) {
if (entry.getKey().isSupported()) {
compatible.put(entry.getKey().parseMaterial().name(), entry.getValue());
compatible.put(entry.getKey().get().name(), entry.getValue());
}
}

Expand Down Expand Up @@ -176,6 +174,7 @@ private boolean exceedsPerChunkLimit(Material material, Chunk chunk) {
final int materialLimit = blockLimits.get(material);
final int minY = chunk.getWorld().getMinHeight();
final int maxY = chunk.getWorld().getMaxHeight();

int count = 0;
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ public void onEnable() {
return;
}

try {
Files.createDirectories(getDataFolder().toPath());
} catch (Exception e) {
prefixedLogger.error("Unable to create plugin directory.", e);
return;
}

instance = this;
cachingPermTool = CachingPermTool.enable(this);
metrics = new Metrics(this, 8700);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import org.bukkit.Sound;

import java.io.File;
import java.nio.file.Files;
import java.time.Duration;
import java.util.Collections;
import java.util.HashMap;
Expand All @@ -36,7 +35,6 @@ public class Config {

public Config() throws Exception {
AnarchyExploitFixes plugin = AnarchyExploitFixes.getInstance();
Files.createDirectories(plugin.getDataFolder().toPath());
// Load config.yml with ConfigMaster
this.config = ConfigFile.loadConfig(new File(plugin.getDataFolder(), "config.yml"));

Expand Down

0 comments on commit e680a47

Please sign in to comment.