Skip to content

Commit

Permalink
Merge branch 'main' into update
Browse files Browse the repository at this point in the history
  • Loading branch information
SrBedrock committed Feb 12, 2024
2 parents cd5ef77 + c67fb90 commit 40b0f4c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.badbones69.crazycrates.api.enums.PersistentKeys;
import com.badbones69.crazycrates.api.objects.other.ItemBuilder;
import com.badbones69.crazycrates.api.utils.MiscUtils;
import org.apache.commons.lang.WordUtils;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.Registry;
Expand All @@ -25,11 +26,11 @@ public class Prize {

private List<String> permissions = new ArrayList<>();
private ItemBuilder displayItem = new ItemBuilder();
private List<String> commands = new ArrayList<>();
private List<String> messages = new ArrayList<>();
private final List<String> commands;
private final List<String> messages;
private boolean firework = false;
private String crateName = "";
private String prizeName = "";
private final String prizeName;
private ItemStack itemStack;
private int maxRange = 100;
private final String prizeNumber;
Expand Down Expand Up @@ -58,13 +59,11 @@ public Prize(ConfigurationSection section, List<Tier> tierPrizes, String crateNa

this.builders = ItemBuilder.convertStringList(this.section.getStringList("Items"), this.prizeNumber);

this.displayItem = display();

this.tiers = tierPrizes;

this.alternativePrize = alternativePrize;

this.prizeName = section.getString("DisplayName", "&4Name not found.exe!");
this.prizeName = section.getString("DisplayName", WordUtils.capitalizeFully(section.getString("DisplayItem", "STONE").replaceAll("_", " ")));
this.maxRange = section.getInt("MaxRange", 100);
this.chance = section.getInt("Chance", 100);
this.firework = section.getBoolean("Firework", false);
Expand All @@ -77,6 +76,8 @@ public Prize(ConfigurationSection section, List<Tier> tierPrizes, String crateNa
if (!this.permissions.isEmpty()) {
this.permissions.replaceAll(String::toLowerCase);
}

this.displayItem = display();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ public void run() {
public void run() {
if (crateManager.hasCrateTask(player)) crateManager.endCrate(player);

crateManager.removePlayerFromOpeningList(player);

player.closeInventory();
}
}.runTaskLater(plugin, 30));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.apache.commons.lang.WordUtils;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Entity;
Expand Down Expand Up @@ -129,7 +130,7 @@ public void reloadCrate(Crate crate) {
boolean isEnabled = alternativeSection.getBoolean("Toggle");

if (isEnabled) {
alternativePrize = new Prize(prizeSection.getString("DisplayName", "&4Name not found.exe!"), prizeSection.getName(), alternativeSection);
alternativePrize = new Prize(prizeSection.getString("DisplayName", WordUtils.capitalizeFully(prizeSection.getString("DisplayItem", "STONE").replaceAll("_", " "))), prizeSection.getName(), alternativeSection);
}
}

Expand Down Expand Up @@ -249,7 +250,7 @@ public void loadCrates() {
boolean isEnabled = alternativeSection.getBoolean("Toggle");

if (isEnabled) {
alternativePrize = new Prize(prizeSection.getString("DisplayName", "&4Name not found.exe!"), prizeSection.getName(), alternativeSection);
alternativePrize = new Prize(prizeSection.getString("DisplayName", WordUtils.capitalizeFully(prizeSection.getString("DisplayItem", "STONE").replaceAll("_", " "))), prizeSection.getName(), alternativeSection);
}
}

Expand Down

0 comments on commit 40b0f4c

Please sign in to comment.