Version 2.0.1:
* Added temporary fix for a bug where discounts are invisible on some servers, due to a race condition. See the new "TradeDelay" option in config.yml
This commit is contained in:
parent
78b7220914
commit
40a237adc1
|
@ -3,7 +3,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.pretzel.dev</groupId>
|
||||
<artifactId>VillagerTradeLimiter</artifactId>
|
||||
<version>2.0.0</version>
|
||||
<version>2.0.1</version>
|
||||
<build>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<plugins>
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -3,7 +3,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.pretzel.dev</groupId>
|
||||
<artifactId>VillagerTradeLimiter</artifactId>
|
||||
<version>2.0.0</version>
|
||||
<version>2.0.1</version>
|
||||
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.pretzel.dev.villagertradelimiter.data;
|
||||
|
||||
import com.pretzel.dev.villagertradelimiter.VillagerTradeLimiter;
|
||||
import com.pretzel.dev.villagertradelimiter.lib.Util;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Villager;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
|
|
@ -124,10 +124,18 @@ public class PlayerListener implements Listener {
|
|||
}
|
||||
customRecipes.put(villager, recipes);
|
||||
|
||||
player.openMerchant(villager, false);
|
||||
//Opens the trading window
|
||||
int delay = instance.getSettings().getTradeDelay();
|
||||
if(delay >= 0) {
|
||||
Bukkit.getScheduler().runTaskLater(instance, () -> player.openMerchant(villager, true), delay);
|
||||
} else {
|
||||
player.openMerchant(villager, true);
|
||||
}
|
||||
|
||||
//Updates the prices
|
||||
for(int i = 0; i < villager.getRecipes().size(); i++) {
|
||||
villager.getRecipe(i).setSpecialPrice(recipes.get(i).getDiscount(totalReputation, hotvDiscount));
|
||||
int discount = recipes.get(i).getDiscount(totalReputation, hotvDiscount);
|
||||
villager.getRecipe(i).setSpecialPrice(discount);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ public class Config {
|
|||
private final List<String> disableTrading;
|
||||
private final List<String> disableProfessions;
|
||||
private final String restock;
|
||||
private final int tradeDelay;
|
||||
|
||||
public Config(final ConfigurationSection config) {
|
||||
this.database = config.getConfigurationSection("Database");
|
||||
|
@ -28,6 +29,7 @@ public class Config {
|
|||
this.disableTrading = config.getStringList("DisableTrading");
|
||||
this.disableProfessions = config.getStringList("DisableProfessions");
|
||||
this.restock = config.getString("Restock", "0h");
|
||||
this.tradeDelay = config.getInt("TradeDelay", -1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -51,4 +53,5 @@ public class Config {
|
|||
public List<String> getDisableTrading() { return this.disableTrading; }
|
||||
public List<String> getDisableProfessions() { return this.disableProfessions; }
|
||||
public String getRestock() { return this.restock; }
|
||||
public int getTradeDelay() { return this.tradeDelay; }
|
||||
}
|
|
@ -51,3 +51,6 @@ DisableProfessions: []
|
|||
# d = days ("3d" = 3 days)
|
||||
# w = weeks ("2w" = 2 weeks)
|
||||
Restock: 0h
|
||||
|
||||
# Setting this to 0 or 1 may fix some issues with discounts not showing up. Set to -1 to disable
|
||||
TradeDelay: -1
|
|
@ -1,7 +1,7 @@
|
|||
name: VillagerTradeLimiter
|
||||
author: PretzelJohn
|
||||
main: com.pretzel.dev.villagertradelimiter.VillagerTradeLimiter
|
||||
version: 2.0.0
|
||||
version: 2.0.1
|
||||
api-version: 1.14
|
||||
|
||||
commands:
|
||||
|
|
Loading…
Reference in New Issue