mirror of
https://github.com/songoda/EpicBuckets.git
synced 2024-11-22 10:15:49 +01:00
Fixed bulk shop bug + added customization to infinite use charge
This commit is contained in:
parent
1d58d31a2b
commit
3c5983651f
2
pom.xml
2
pom.xml
@ -122,7 +122,7 @@
|
||||
<url>http://nexus.hc.to/content/repositories/pub_releases</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>3_aikar</id>
|
||||
<id>33_aikar</id>
|
||||
<url>https://repo.aikar.co/content/groups/aikar/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
|
@ -51,7 +51,7 @@ public class ConfigManager {
|
||||
|
||||
private boolean infiniteUse;
|
||||
private boolean chargeInfiniteUse;
|
||||
private int infiniteUseCost;
|
||||
private HashMap<GenbucketType, Double> infiniteUseCost;
|
||||
|
||||
private int genbucketDelay;
|
||||
private CooldownMap<Player> cooldownMap;
|
||||
@ -92,6 +92,7 @@ public class ConfigManager {
|
||||
ignoredMaterials = new ArrayList<>();
|
||||
psuedoMaterials = new ArrayList<>();
|
||||
genbucketGroups = new LinkedHashMap<>();
|
||||
infiniteUseCost = new HashMap<>();
|
||||
|
||||
loadValidFaces();
|
||||
|
||||
@ -116,7 +117,11 @@ public class ConfigManager {
|
||||
fillInventory = epicBuckets.getConfig().getBoolean(menuItemsPath + ".fill");
|
||||
epicBuckets.getConfig().getConfigurationSection("CUSTOM-ACTIVE-GEN-PER-PLAY").getKeys(false).forEach(s -> genbucketGroups.put(epicBuckets.getConfig().getString("CUSTOM-ACTIVE-GEN-PER-PLAY." + s).split(":")[1], Integer.parseInt(epicBuckets.getConfig().getString("CUSTOM-ACTIVE-GEN-PER-PLAY." + s).split(":")[0])));
|
||||
chargeInfiniteUse = epicBuckets.getConfig().getBoolean("CHARGE-FOR-INFINITE-USE");
|
||||
infiniteUseCost = epicBuckets.getConfig().getInt("COST-FOR-INFINITE-USE");
|
||||
|
||||
epicBuckets.getConfig().getConfigurationSection("COST-FOR-INFINITE-USE").getKeys(false)
|
||||
.forEach(cost -> this.infiniteUseCost.put(GenbucketType.valueOf(cost),
|
||||
epicBuckets.getConfig().getDouble("COST-FOR-INFINITE-USE." + cost)));
|
||||
|
||||
genbucketDelay = epicBuckets.getConfig().getInt("GENBUCKET-DELAY");
|
||||
|
||||
if (getGenbucketDelay() > 0) {
|
||||
@ -308,8 +313,8 @@ public class ConfigManager {
|
||||
return chargeInfiniteUse;
|
||||
}
|
||||
|
||||
public int getInfiniteUseCost() {
|
||||
return infiniteUseCost;
|
||||
public double getInfiniteUseCostForGenbucketType(GenbucketType genbucketType) {
|
||||
return infiniteUseCost.get(genbucketType);
|
||||
}
|
||||
|
||||
public int getGenbucketDelay() {
|
||||
|
@ -89,18 +89,19 @@ public class GenbucketPlaceListener implements Listener {
|
||||
if (e.getItem().getAmount() > 1) {
|
||||
e.getItem().setAmount(e.getItem().getAmount() - 1);
|
||||
} else {
|
||||
System.out.println("hi");
|
||||
e.getPlayer().getInventory().remove(e.getItem());
|
||||
}
|
||||
}
|
||||
|
||||
if (EpicBuckets.getInstance().getConfigManager().isInfiniteUse() && EpicBuckets.getInstance().getConfigManager().isChargeInfiniteUse()) {
|
||||
if (EpicBuckets.getInstance().getEcon().getBalance(Bukkit.getOfflinePlayer(e.getPlayer().getUniqueId())) < EpicBuckets.getInstance().getConfigManager().getInfiniteUseCost()) {
|
||||
if (EpicBuckets.getInstance().getEcon().getBalance(Bukkit.getOfflinePlayer(e.getPlayer().getUniqueId())) < EpicBuckets.getInstance().getConfigManager().getInfiniteUseCostForGenbucketType(genbucket.getGenbucketType())) {
|
||||
e.getPlayer().sendMessage(EpicBuckets.getInstance().getLocale().getMessage("event.genbucket.infiniteuse.notenough"));
|
||||
return;
|
||||
}
|
||||
EpicBuckets.getInstance().getEcon().withdrawPlayer(Bukkit.getOfflinePlayer(e.getPlayer().getUniqueId()), EpicBuckets.getInstance().getConfigManager().getInfiniteUseCost());
|
||||
e.getPlayer().sendMessage(EpicBuckets.getInstance().getLocale().getMessage("event.genbucket.infiniteuse.charge").replace("%charge%", EpicBuckets.getInstance().getConfigManager().getInfiniteUseCost() + ""));
|
||||
if (EpicBuckets.getInstance().getConfigManager().getInfiniteUseCostForGenbucketType(genbucket.getGenbucketType()) > 0) {
|
||||
EpicBuckets.getInstance().getEcon().withdrawPlayer(Bukkit.getOfflinePlayer(e.getPlayer().getUniqueId()), EpicBuckets.getInstance().getConfigManager().getInfiniteUseCostForGenbucketType(genbucket.getGenbucketType()));
|
||||
e.getPlayer().sendMessage(EpicBuckets.getInstance().getLocale().getMessage("event.genbucket.infiniteuse.charge").replace("%charge%", EpicBuckets.getInstance().getConfigManager().getInfiniteUseCostForGenbucketType(genbucket.getGenbucketType()) + ""));
|
||||
}
|
||||
}
|
||||
|
||||
EpicBuckets.getInstance().getGenbucketManager().registerGenbucketForPlayer(e.getPlayer(), genbucket);
|
||||
|
@ -116,7 +116,7 @@ public class ShopManager {
|
||||
}
|
||||
|
||||
public void buyFromShop(Player buyer, SubShop s, int amount) {
|
||||
epicBuckets.getEcon().withdrawPlayer(Bukkit.getOfflinePlayer(buyer.getUniqueId()), s.getPrice());
|
||||
epicBuckets.getEcon().withdrawPlayer(Bukkit.getOfflinePlayer(buyer.getUniqueId()), s.getPrice() * amount);
|
||||
giveGenbucketToPlayer(buyer, s, amount);
|
||||
}
|
||||
|
||||
|
@ -16,13 +16,18 @@ GRIEFPREVENTION-SUPPORT: false # GriefPrevention is needed
|
||||
|
||||
ENABLE-GENS-IN-WILDERNESS: true
|
||||
|
||||
ENCHANT: false # Enchant genbuckets in all guis
|
||||
|
||||
CLOSE-GUI-AFTER-PURCHASE: false # Close the inventory after purchase
|
||||
|
||||
INFINITE-USE: false # If enabled, you won't lose a genbucket when you place it down
|
||||
|
||||
CHARGE-FOR-INFINITE-USE: false # This requires infinite use to be enabled and will charge the player when placing a genbucket
|
||||
COST-FOR-INFINITE-USE: 400 # Money charged for placing a genbucket when the above is enabled
|
||||
|
||||
# Money charged for placing a genbucket when the above is enabled, put 0 if you want no charge
|
||||
COST-FOR-INFINITE-USE:
|
||||
HORIZONTAL: 0
|
||||
VERTICAL: 0
|
||||
PSUEDO: 0
|
||||
INFUSED: 0
|
||||
|
||||
GENBUCKET-DELAY: 10 # Ticks delay between genbucket placements, 20 ticks = 1 second, set to 0 for no delay
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user