Skip to content

Commit

Permalink
Merge pull request #25 from LM-Wolfert/issues_21
Browse files Browse the repository at this point in the history
#21: Disable the tracking of skulls with config option
  • Loading branch information
kiranhart authored Dec 14, 2023
2 parents 2428c94 + 396021c commit 52236ba
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
4 changes: 3 additions & 1 deletion src/main/java/ca/tweetzy/skulls/Skulls.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ protected void onFlight() {
// events
getServer().getPluginManager().registerEvents(new PlayerJoinQuitListener(), this);
getServer().getPluginManager().registerEvents(new PlayerDeathListener(), this);
getServer().getPluginManager().registerEvents(new SkullBlockListener(), this);
if (Settings.SKULL_TRACKING.getBoolean()) {
getServer().getPluginManager().registerEvents(new SkullBlockListener(), this);
}
}

public static Skulls getInstance() {
Expand Down
17 changes: 10 additions & 7 deletions src/main/java/ca/tweetzy/skulls/manager/SkullManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import ca.tweetzy.skulls.api.interfaces.Skull;
import ca.tweetzy.skulls.impl.InsertHistory;
import ca.tweetzy.skulls.impl.TexturedSkull;
import ca.tweetzy.skulls.settings.Settings;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
Expand Down Expand Up @@ -299,14 +300,16 @@ public void load() {
}
});

Skulls.getDataManager().getPlacedSkulls((error, all) -> {
if (error != null) {
error.printStackTrace();
return;
}
if (Settings.SKULL_TRACKING.getBoolean()) {
Skulls.getDataManager().getPlacedSkulls((error, all) -> {
if (error != null) {
error.printStackTrace();
return;
}

all.forEach(placedSkull -> this.placedSkulls.put(placedSkull.getLocation(), placedSkull));
});
all.forEach(placedSkull -> this.placedSkulls.put(placedSkull.getLocation(), placedSkull));
});
}

Skulls.getDataManager().getHistories((error, all) -> {
if (error != null) {
Expand Down
1 change: 1 addition & 0 deletions src/main/java/ca/tweetzy/skulls/settings/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public final class Settings extends FlightSettings {
public static final ConfigEntry MAIN_MENU_REQUIRES_NO_PERM = create("main menu requires no permission", true);
public static final ConfigEntry GENERAL_USAGE_REQUIRES_NO_PERM = create("general usage requires no permission", false, "If true, no permission is required to use except for admin stuff");
public static final ConfigEntry TELL_OP_PATREON_LINK = create("tell ops patron on join", true);
public static final ConfigEntry SKULL_TRACKING = create("track skull placement", true, "If disabled skulls will no longer drop in creative");

public static final ConfigEntry CATEGORIES_ALPHABET_ENABLED = create("enabled categories.alphabet", true);
public static final ConfigEntry CATEGORIES_ANIMALS_ENABLED = create("enabled categories.animals", true);
Expand Down

0 comments on commit 52236ba

Please sign in to comment.