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 * Added config option to allow multiple players to trade with the same villager at the same time
This commit is contained in:
parent
40a237adc1
commit
e066603ce5
|
@ -125,11 +125,12 @@ public class PlayerListener implements Listener {
|
|||
customRecipes.put(villager, recipes);
|
||||
|
||||
//Opens the trading window
|
||||
boolean multipleTraders = instance.getSettings().getMultipleTraders();
|
||||
int delay = instance.getSettings().getTradeDelay();
|
||||
if(delay >= 0) {
|
||||
Bukkit.getScheduler().runTaskLater(instance, () -> player.openMerchant(villager, true), delay);
|
||||
Bukkit.getScheduler().runTaskLater(instance, () -> player.openMerchant(villager, multipleTraders), delay);
|
||||
} else {
|
||||
player.openMerchant(villager, true);
|
||||
player.openMerchant(villager, multipleTraders);
|
||||
}
|
||||
|
||||
//Updates the prices
|
||||
|
|
|
@ -17,6 +17,7 @@ public class Config {
|
|||
private final List<String> disableTrading;
|
||||
private final List<String> disableProfessions;
|
||||
private final String restock;
|
||||
private final boolean multipleTraders;
|
||||
private final int tradeDelay;
|
||||
|
||||
public Config(final ConfigurationSection config) {
|
||||
|
@ -29,6 +30,7 @@ public class Config {
|
|||
this.disableTrading = config.getStringList("DisableTrading");
|
||||
this.disableProfessions = config.getStringList("DisableProfessions");
|
||||
this.restock = config.getString("Restock", "0h");
|
||||
this.multipleTraders = config.getBoolean("MultipleTraders", false);
|
||||
this.tradeDelay = config.getInt("TradeDelay", -1);
|
||||
}
|
||||
|
||||
|
@ -53,5 +55,6 @@ public class Config {
|
|||
public List<String> getDisableTrading() { return this.disableTrading; }
|
||||
public List<String> getDisableProfessions() { return this.disableProfessions; }
|
||||
public String getRestock() { return this.restock; }
|
||||
public boolean getMultipleTraders() { return this.multipleTraders; }
|
||||
public int getTradeDelay() { return this.tradeDelay; }
|
||||
}
|
|
@ -52,5 +52,8 @@ DisableProfessions: []
|
|||
# w = weeks ("2w" = 2 weeks)
|
||||
Restock: 0h
|
||||
|
||||
# Set this to true to allow multiple players to trade with the same villager at the same time
|
||||
MultipleTraders: false
|
||||
|
||||
# Setting this to 0 or 1 may fix some issues with discounts not showing up. Set to -1 to disable
|
||||
TradeDelay: -1
|
Loading…
Reference in New Issue