Skip to content

Commit

Permalink
A host of fixes and changes
Browse files Browse the repository at this point in the history
+ Further edited config values
+ Fixed cannot purchase being gold and green to red and green
+ Fixed an exception when parsing shop and config values
+ Fixed a Javascript folder being created for no reason
+ Fixed inflation increasing when no players are online and update-prices-when-inactive is set to false
+ Fixed some grammatical mistakes
+ Updated to 0.10.5
  • Loading branch information
noahbclarkson committed Nov 17, 2020
1 parent e845a86 commit 8d88625
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 27 deletions.
2 changes: 1 addition & 1 deletion Auto-Tune/dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>unprotesting.com.github</groupId>
<artifactId>Auto-Tune</artifactId>
<name>Auto-Tune</name>
<version>0.10.4</version>
<version>0.10.5</version>
<description>The automatic pricing plugin for minecraft</description>
<url>https://github.com/Unprotesting/Auto-Tune</url>
<issueManagement>
Expand Down
2 changes: 1 addition & 1 deletion Auto-Tune/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<!-- Project information -->
<groupId>unprotesting.com.github</groupId>
<artifactId>Auto-Tune</artifactId>
<version>0.10.4</version>
<version>0.10.5</version>
<!-- Info -->
<name>Auto-Tune</name>
<url>https://github.com/Unprotesting/Auto-Tune</url>
Expand Down
8 changes: 4 additions & 4 deletions Auto-Tune/src/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ auto-sell-profit-update-period: 1200
Volatility-Algorithim: 'Variable'

## Percentage difference in sell price to buy price
sell-price-difference: 5.0
sell-price-difference: 10.0

## Maximum Volatility per Time Period for the Fixed Volatility price calculation algorithim in economy units
Fixed-Max-Volatility: 2.00
## Minimum Volatility per Time Period for the Fixed Volatility price calculation algorithim in economy units
Fixed-Min-Volatility: 0.05

## Maximum Volatility per Time Period for the Variable Volatility price calculation algorithim as a percentage of total price
Variable-Max-Volatility: 1.50
Variable-Max-Volatility: 1.00
## Minimum Volatility per Time Period for the Fixed Volatility price calculation algorithim in economy units
Variable-Min-Volatility: 0.05

Expand Down Expand Up @@ -102,7 +102,7 @@ currency-symbol: '$'
## Enable sell price difference variation to ease out sell price varition
sell-price-difference-variation-enabled: true
## Starting percententage sell price difference for sell price varition
sell-price-difference-variation-start: 15.0
sell-price-difference-variation-start: 22.5
## Time in minutes until sell price reaches sell-price-difference set in pricing model settings (default 7 days)
sell-price-variation-time-period: 10080
## Time in minutes that the sell-price-difference updates
Expand Down Expand Up @@ -156,4 +156,4 @@ shop-config-guishop-sell-value: 20.00
tutorial: true

## Time in seconds between messages
tutorial-message-period: 300
tutorial-message-period: 325
11 changes: 4 additions & 7 deletions Auto-Tune/src/resources/shops.yml
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ shops:
max-buy: 16
max-sell: 40
NETHER_STAR:
price: 3000.00
price: 12000.00
max-buy: 1
max-sell: 1
GHAST_TEAR:
Expand Down Expand Up @@ -498,10 +498,10 @@ shops:
CAKE:
price: 160.0
max-buy: 8
max-sell: 12
max-sell: 10
MILK_BUCKET:
price: 10.00
max-buy: 16
max-buy: 12
max-sell: 20
STICK:
price: 0.2
Expand All @@ -510,7 +510,4 @@ shops:
BOOK:
price: 28.0
max-buy: 32
max-sell: 48

##locked: true <- Example of a locked item
##sell-difference: 0.0 <- Example of a set sell-difference item
max-sell: 48
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public void loadGUIMAIN(Player player, CommandSender senderpub) {
price1 = tempDoublearray[0];
String priceString = df2.format(price1);
String fullprice = "Price: " + Config.getCurrencySymbol() + priceString;
im.setLore(Arrays.asList((ChatColor.GOLD + fullprice), (ChatColor.WHITE + "Maximum Buys: " + (Integer)Main.getShopConfig().get("shops." + Main.memMap.get(i) + "." + "max-sell")), (ChatColor.WHITE + "Maximum Buys: " + (Integer)Main.getShopConfig().get("shops." + Main.memMap.get(i) + "." + "max-buy"))));
im.setLore(Arrays.asList((ChatColor.GOLD + fullprice), (ChatColor.WHITE + "Maximum Buys: " + (Integer)Main.getShopConfig().get("shops." + Main.memMap.get(i) + "." + "max-buy") + " per " + Config.getTimePeriod() + "min"), (ChatColor.WHITE + "Maximum Sells: " + (Integer)Main.getShopConfig().get("shops." + Main.memMap.get(i) + "." + "max-sell") + " per " + Config.getTimePeriod() + "min")));
is.setItemMeta(im);
if (Config.getMenuRows() == 4) {
if (i<7) {
Expand Down Expand Up @@ -502,7 +502,7 @@ public void createTradingPanel(Gui gui, String matClickedString, Player player,
player.getInventory().addItem(new ItemStack(Material.matchMaterial(matClickedString), 1));
sendPlayerShopMessageAndUpdateGDP(1, price, player, matClickedString, false);
} else {
player.sendMessage(ChatColor.GOLD + "Cannot purchase 1x " + matClickedString + " for " + ChatColor.GREEN + Config.getCurrencySymbol() + df2.format(price));
player.sendMessage(ChatColor.RED + "Cannot purchase 1x " + matClickedString + " for " + ChatColor.GREEN + Config.getCurrencySymbol() + df2.format(price));

}
player.setItemOnCursor(null);
Expand Down Expand Up @@ -543,7 +543,7 @@ public void createTradingPanel(Gui gui, String matClickedString, Player player,
player.getInventory().addItem(new ItemStack(Material.matchMaterial(matClickedString), 2));
sendPlayerShopMessageAndUpdateGDP(2, price, player, matClickedString, false);
} else {
player.sendMessage(ChatColor.GOLD + "Cannot purchase 2x " + matClickedString + " for " + ChatColor.GREEN + Config.getCurrencySymbol() + df2.format(price * 2));
player.sendMessage(ChatColor.RED + "Cannot purchase 2x " + matClickedString + " for " + ChatColor.GREEN + Config.getCurrencySymbol() + df2.format(price * 2));

}
player.setItemOnCursor(null);
Expand Down Expand Up @@ -584,7 +584,7 @@ public void createTradingPanel(Gui gui, String matClickedString, Player player,
player.getInventory().addItem(new ItemStack(Material.matchMaterial(matClickedString), 4));
sendPlayerShopMessageAndUpdateGDP(4, price, player, matClickedString, false);
} else {
player.sendMessage(ChatColor.GOLD + "Cannot purchase 4x " + matClickedString + " for " + ChatColor.GREEN + Config.getCurrencySymbol() + df2.format(price * 4));
player.sendMessage(ChatColor.RED + "Cannot purchase 4x " + matClickedString + " for " + ChatColor.GREEN + Config.getCurrencySymbol() + df2.format(price * 4));

}
player.setItemOnCursor(null);
Expand Down Expand Up @@ -625,7 +625,7 @@ public void createTradingPanel(Gui gui, String matClickedString, Player player,
player.getInventory().addItem(new ItemStack(Material.matchMaterial(matClickedString), 8));
sendPlayerShopMessageAndUpdateGDP(8, price, player, matClickedString, false);
} else {
player.sendMessage(ChatColor.GOLD + "Cannot purchase 8x " + matClickedString + " for " + ChatColor.GREEN + Config.getCurrencySymbol() + df2.format(price * 8));
player.sendMessage(ChatColor.RED + "Cannot purchase 8x " + matClickedString + " for " + ChatColor.GREEN + Config.getCurrencySymbol() + df2.format(price * 8));

}
player.setItemOnCursor(null);
Expand Down Expand Up @@ -666,7 +666,7 @@ public void createTradingPanel(Gui gui, String matClickedString, Player player,
player.getInventory().addItem(new ItemStack(Material.matchMaterial(matClickedString), 16));
sendPlayerShopMessageAndUpdateGDP(16, price, player, matClickedString, false);
} else {
player.sendMessage(ChatColor.GOLD + "Cannot purchase 16x " + matClickedString + " for " + ChatColor.GREEN + Config.getCurrencySymbol() + df2.format(price * 16));
player.sendMessage(ChatColor.RED + "Cannot purchase 16x " + matClickedString + " for " + ChatColor.GREEN + Config.getCurrencySymbol() + df2.format(price * 16));

}
player.setItemOnCursor(null);
Expand Down Expand Up @@ -707,7 +707,7 @@ public void createTradingPanel(Gui gui, String matClickedString, Player player,
player.getInventory().addItem(new ItemStack(Material.matchMaterial(matClickedString), 32));
sendPlayerShopMessageAndUpdateGDP(32, price, player, matClickedString, false);
} else {
player.sendMessage(ChatColor.GOLD + "Cannot purchase 32x " + matClickedString + " for " + ChatColor.GREEN + Config.getCurrencySymbol() + df2.format(price * 32));
player.sendMessage(ChatColor.RED + "Cannot purchase 32x " + matClickedString + " for " + ChatColor.GREEN + Config.getCurrencySymbol() + df2.format(price * 32));

}
player.setItemOnCursor(null);
Expand Down Expand Up @@ -748,7 +748,7 @@ public void createTradingPanel(Gui gui, String matClickedString, Player player,
player.getInventory().addItem(new ItemStack(Material.matchMaterial(matClickedString), 64));
sendPlayerShopMessageAndUpdateGDP(64, price, player, matClickedString, false);
} else {
player.sendMessage(ChatColor.GOLD + "Cannot purchase 64x " + matClickedString + " for " + ChatColor.GREEN + Config.getCurrencySymbol() + df2.format(price * 64));
player.sendMessage(ChatColor.RED + "Cannot purchase 64x " + matClickedString + " for " + ChatColor.GREEN + Config.getCurrencySymbol() + df2.format(price * 64));
}
player.setItemOnCursor(null);
SBPane.clear();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,13 @@ public static void sellItems(Player player, ItemStack[] items, Boolean autoSell)
Main.getINSTANCE();
ConfigurationSection config = Main.getShopConfig().getConfigurationSection("shops")
.getConfigurationSection((itemString));
Double sellpricedif2 = config.getDouble("sell-difference", sellpricedif);
Double sellpricedif2 = Config.getSellPriceDifference();
try{
sellpricedif2 = config.getDouble("sell-difference", sellpricedif);
}
catch(NullPointerException ex){
sellpricedif2 = Config.getSellPriceDifference();
}
Double sellPrice = (tempDoublearray[0]) - (tempDoublearray[0]*0.01*sellpricedif2);
Double buyAmount = tempDoublearray[1];
Double sellAmount = tempDoublearray[2];
Expand Down
4 changes: 1 addition & 3 deletions Auto-Tune/src/unprotesting/com/github/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,6 @@ public void onEnable() {
createFiles();
File folderfileTemp = new File("plugins/Auto-Tune/temp/");
folderfileTemp.mkdirs();
File folderfileJS = new File("plugins/Auto-Tune/Javascript/");
folderfileJS.mkdirs();
INSTANCE = this;
plugin = this;
if (!setupEconomy()) {
Expand Down Expand Up @@ -326,7 +324,7 @@ public void run() {
+ Double.toString(Config.getSellPriceDifference()));
if (Config.getSellPriceDifference() <= Main.getMainConfig().getDouble("sell-price-difference", 2.5)) {
Config.setSellPriceDifference(Main.getMainConfig().getDouble("sell-price-difference", 2.5));
debugLog("Finished sell difference change task as sell differnce has reached: "
debugLog("Finished sell difference change task as sell difference has reached: "
+ Main.getMainConfig().getDouble("sell-price-difference", 2.5));
cancel();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,19 @@

import java.util.concurrent.ConcurrentHashMap;

import org.bukkit.Bukkit;

import unprotesting.com.github.Main;

public class InflationEventHandler implements Runnable {

@Override
public void run() {
for (String str : Main.map.keySet()){
increaseItemPrice(str, Config.getDynamicInflationValue(), true);
Integer playerCount = Bukkit.getServer().getOnlinePlayers().size();
if (Config.isUpdatePricesWhenInactive() || (!Config.isUpdatePricesWhenInactive() && playerCount > 0)){
increaseItemPrice(str, Config.getDynamicInflationValue(), true);
}
}
Main.debugLog("Dynamic Inflation Value: " + Config.getDynamicInflationValue());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static void loadMessages(){
messages.add(ChatColor.YELLOW + "There are big profits to be made when prices change..");
messages.add(ChatColor.YELLOW + "Loan money to take leverage of the rise in prices.");
messages.add(ChatColor.YELLOW + "Sell items that have high demand to make the most money selling.");
messages.add(ChatColor.YELLOW + "Using /autosell is an easy way to make money quickly and easily");
messages.add(ChatColor.YELLOW + "Using /autosell allows you to make money quickly and easily");
messages.add(ChatColor.YELLOW + "Viewing prices with /trade allows you to judge the markets.");
}
}

0 comments on commit 8d88625

Please sign in to comment.