diff --git a/.github/graph.png b/.github/graph.png
index fe3d0bb..15b9c2a 100644
Binary files a/.github/graph.png and b/.github/graph.png differ
diff --git a/Auto-Tune/.project b/Auto-Tune/.project
index 6755740..e96248e 100644
--- a/Auto-Tune/.project
+++ b/Auto-Tune/.project
@@ -20,4 +20,15 @@
org.eclipse.jdt.core.javanature
org.eclipse.m2e.core.maven2Nature
-
\ No newline at end of file
+
+
+ 1599074862940
+
+ 30
+
+ org.eclipse.core.resources.regexFilterMatcher
+ node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
+
+
+
+
diff --git a/Auto-Tune/dependency-reduced-pom.xml b/Auto-Tune/dependency-reduced-pom.xml
index c2f670b..87b0fe9 100644
--- a/Auto-Tune/dependency-reduced-pom.xml
+++ b/Auto-Tune/dependency-reduced-pom.xml
@@ -4,7 +4,7 @@
unprotesting.com.github
Auto-Tune
Auto-Tune
- 0.8.5
+ 0.9.0
The automatic pricing plugin for minecraft
https://github.com/Unprotesting/Auto-Tune
diff --git a/Auto-Tune/pom.xml b/Auto-Tune/pom.xml
index 2050d32..bf7de9e 100644
--- a/Auto-Tune/pom.xml
+++ b/Auto-Tune/pom.xml
@@ -8,7 +8,7 @@
unprotesting.com.github
Auto-Tune
- 0.8.5
+ 0.9.0
jar
Auto-Tune
diff --git a/Auto-Tune/src/resources/config.yml b/Auto-Tune/src/resources/config.yml
index d3010f3..80f1869 100644
--- a/Auto-Tune/src/resources/config.yml
+++ b/Auto-Tune/src/resources/config.yml
@@ -16,7 +16,7 @@ email: 'xyz@gmail.com'
## Enable//Disable integrated Web Server.
web-server-enabled: true
-## Port for integrated Web Server (If enabled and on correct plan)
+## Port for integrated Web Server (If enabled)
port: 8123
## The maximum length in data points that the trade-short.html will show (this doesn't affect data)
@@ -90,7 +90,7 @@ currency-symbol: '$'
## Enable sell price difference variation to ease out sell price varition
sell-price-difference-variation-enabled: false
## Starting percententage sell price difference for sell price varition
-sell-price-differnence-variation-start: 25.0
+sell-price-difference-variation-start: 25.0
## 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
@@ -113,7 +113,7 @@ static-inflation-value: 0.1
## Intrest rate per intrest-rate-update-period
## Info: This is the increase in the current debt payment per-time period
-intrest-rate: 0.01
+intrest-rate: 0.001
## Time period in ticks between updates of the intrest rate for users loans
intrest-rate-update-period: 1200
diff --git a/Auto-Tune/src/resources/plugin.yml b/Auto-Tune/src/resources/plugin.yml
index 8085615..63a942b 100644
--- a/Auto-Tune/src/resources/plugin.yml
+++ b/Auto-Tune/src/resources/plugin.yml
@@ -15,7 +15,7 @@ api-version: 1.16
commands:
at:
description: Auto-Tune Command.
- usage: /
+ usage: /
trade:
description: Trade Online with other players.
usage: /
@@ -40,9 +40,13 @@ commands:
payloan:
description: Payback one of your loans
usage:
+ gdp:
+ description: View GDP info
+ usage:
permssions:
at.help:
description: Displays Auto-Tune help information
+ default: true
at.login:
description: Login to an Auto-Tune account |(active soon)|
at.shop:
@@ -53,6 +57,12 @@ permssions:
description: Open the Auto-Sell GUI and Auto-Sell
at.loan:
description: Loan money from the bank
+ at.increase:
+ description: Increase price of an item
+ at.decrease:
+ description: Decrease price of an item
+ at.gdp:
+ description: View GDP info
diff --git a/Auto-Tune/src/unprotesting/com/github/Commands/AutoTuneAutoSellCommand.java b/Auto-Tune/src/unprotesting/com/github/Commands/AutoTuneAutoSellCommand.java
index 73a469c..5ab416a 100644
--- a/Auto-Tune/src/unprotesting/com/github/Commands/AutoTuneAutoSellCommand.java
+++ b/Auto-Tune/src/unprotesting/com/github/Commands/AutoTuneAutoSellCommand.java
@@ -231,22 +231,6 @@ public void loadGUIMAIN(Player player, CommandSender senderpub) {
pane.addPane(1, SBPane);
}
- // page two
- // **if (size > menuRows*7){
- // OutlinePane pageTwo = new OutlinePane(1, 1, 7, menuRows-2);
- // pageTwo.addItem(new GuiItem(new ItemStack(Material.GLASS), event ->
- // event.getWhoClicked().sendMessage("Glass")));
- // pane.addPane(1, pageTwo);
- // }
-
- // page three
- // if (size > menuRows*14){
- // OutlinePane pageThree = new OutlinePane(1, 1, 7, menuRows-2);
- // pageThree.addItem(new GuiItem(new ItemStack(Material.BLAZE_ROD),event ->
- // event.getWhoClicked().sendMessage("Blaze rod")));
- // pane.addPane(2, pageThree);
- // }
-
gui1.addPane(pane);
// page selection
diff --git a/Auto-Tune/src/unprotesting/com/github/Commands/AutoTuneCommand.java b/Auto-Tune/src/unprotesting/com/github/Commands/AutoTuneCommand.java
index 23a9ebf..cc9a306 100644
--- a/Auto-Tune/src/unprotesting/com/github/Commands/AutoTuneCommand.java
+++ b/Auto-Tune/src/unprotesting/com/github/Commands/AutoTuneCommand.java
@@ -10,11 +10,13 @@
import net.md_5.bungee.api.ChatColor;
import unprotesting.com.github.Main;
+import unprotesting.com.github.util.Config;
+import unprotesting.com.github.util.InflationEventHandler;
import unprotesting.com.github.util.TextHandler;
public class AutoTuneCommand implements CommandExecutor {
- static Logger log = Logger.getLogger("Minecraft");
+ public static Logger log = Logger.getLogger("Minecraft");
@Override
public boolean onCommand(CommandSender sender, Command command, String at, String[] args) {
@@ -30,32 +32,96 @@ public boolean onCommand(CommandSender sender, Command command, String at, Strin
Main.playerDataConfig.set(uuid + ".autotuneID", AutoTunePlayerID);
Main.saveplayerdata();
player.sendMessage(ChatColor.YELLOW + "Creating one for you..");
- player.sendMessage(ChatColor.YELLOW + "Created Auto-Tune Account with Unique ID: " + AutoTunePlayerID);}
+ player.sendMessage(ChatColor.YELLOW + "Created Auto-Tune Account with Unique ID: " + AutoTunePlayerID);return true;}
else if (LoggedIn != null){
player.sendMessage(ChatColor.YELLOW + "Already Logged in!");
player.sendMessage(ChatColor.YELLOW + "Your unique ID is " + Main.playerDataConfig
.getString(uuid + ".autotuneID"));
+ return true;
}
}
else if (!(player.hasPermission("at.login")) && !(player.isOp())){
TextHandler.noPermssion(player);
+ return true;
}
- }
+
else {
if (player.hasPermission("at.help") || player.isOp()){
player.sendMessage(ChatColor.YELLOW + "\"/at\" command usage:");
- player.sendMessage(ChatColor.YELLOW + "/at login | Login to trading plaform");
- player.sendMessage(ChatColor.YELLOW + "/at Register | Register to trading plaform");
+ player.sendMessage(ChatColor.YELLOW + "- /at login | Login to trading plaform");
+ player.sendMessage(ChatColor.YELLOW + "- /at Register | Register to trading plaform");
+ player.sendMessage(ChatColor.YELLOW + "- /at Increase | Increase Item Price");
+ player.sendMessage(ChatColor.YELLOW + "- /at Decrease | Decrease Item Price");
+ return true;
}
else if (!(player.hasPermission("at.help")) && !(player.isOp())){
TextHandler.noPermssion(player);
+ return true;
}
}
- }
- return true;
-
+ }
+ if (args[0].equalsIgnoreCase("increase")) {
+ if (player.hasPermission("at.increase") || player.isOp()){
+ Double value = Double.valueOf(args[2]);
+ if (!(value == 0 || value == 0.0 || value == 0f || value > 99999999 || args[1] == null || args[2] == null)){
+ if (args[1].contains("%")){
+ args[1].replace("%", "");
+ Double newPrice = InflationEventHandler.increaseItemPrice(args[1].toUpperCase(), value, true);
+ player.sendMessage(ChatColor.YELLOW + "Increased " + args[1].toUpperCase() + " price to " + ChatColor.GREEN + Config.getCurrencySymbol() + newPrice);
+ return true;
+ }
+ else {
+ Double newPrice = InflationEventHandler.increaseItemPrice(args[1].toUpperCase(), value, true);
+ player.sendMessage(ChatColor.YELLOW + "Increased " + args[1].toUpperCase() + " price to " + ChatColor.GREEN + Config.getCurrencySymbol() + newPrice);
+ return true;
+ }
+ }
+ }
+ else if (!(player.hasPermission("at.increase")) && !(player.isOp())){
+ TextHandler.noPermssion(player);
+ return true;
+ }
+ }
+ if (args[0].equalsIgnoreCase("decrease")) {
+ if (player.hasPermission("at.decrease") || player.isOp()){
+ Double value = Double.valueOf(args[2]);
+ if (!(value == 0 || value == 0.0 || value == 0f || value > 99999999 || args[1] == null || args[2] == null)){
+ if (args[1].contains("%")){
+ args[1].replace("%", "");
+ Double newPrice = InflationEventHandler.decreaseItemPrice(args[1].toUpperCase(), value, true);
+ player.sendMessage(ChatColor.YELLOW + "Decreased " + args[1].toUpperCase() + " price to " + ChatColor.GREEN + Config.getCurrencySymbol() + newPrice);
+ return true;
+ }
+ else {
+ Double newPrice = InflationEventHandler.decreaseItemPrice(args[1].toUpperCase(), value, true);
+ player.sendMessage(ChatColor.YELLOW + "Decreased " + args[1].toUpperCase() + " price to " + ChatColor.GREEN + Config.getCurrencySymbol() + newPrice);
+ return true;
+ }
+ }
+ }
+ else if (!(player.hasPermission("at.decrease")) && !(player.isOp())){
+ TextHandler.noPermssion(player);
+ return true;
+ }
+ }
+ else{
+ if (player.hasPermission("at.help") || player.isOp()){
+ player.sendMessage(ChatColor.YELLOW + "\"/at\" command usage:");
+ player.sendMessage(ChatColor.YELLOW + "- /at login | Login to trading plaform");
+ player.sendMessage(ChatColor.YELLOW + "- /at Register | Register to trading plaform");
+ player.sendMessage(ChatColor.YELLOW + "- /at Increase | Increase Item Price");
+ player.sendMessage(ChatColor.YELLOW + "- /at Decrease | Decrease Item Price");
+ return true;
+ }
+ else if (!(player.hasPermission("at.help")) && !(player.isOp())){
+ TextHandler.noPermssion(player);
+ return true;
+ }
+ }
+ }
+ return false;
}
}
diff --git a/Auto-Tune/src/unprotesting/com/github/Commands/AutoTuneGDPCommand.java b/Auto-Tune/src/unprotesting/com/github/Commands/AutoTuneGDPCommand.java
new file mode 100644
index 0000000..37c0f80
--- /dev/null
+++ b/Auto-Tune/src/unprotesting/com/github/Commands/AutoTuneGDPCommand.java
@@ -0,0 +1,58 @@
+package unprotesting.com.github.Commands;
+
+import org.bukkit.Bukkit;
+import org.bukkit.OfflinePlayer;
+import org.bukkit.command.Command;
+import org.bukkit.command.CommandExecutor;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+
+import net.md_5.bungee.api.ChatColor;
+import unprotesting.com.github.Main;
+import unprotesting.com.github.util.TextHandler;
+
+public class AutoTuneGDPCommand implements CommandExecutor {
+ @Override
+ public boolean onCommand(CommandSender sender, Command command, String gdp, String[] args) {
+ Player p = (Player) sender;
+ if (command.getName().equalsIgnoreCase("gdp")){
+ if (p.hasPermission("at.gdp") || p.isOp()){
+ String GDP = AutoTuneGUIShopUserCommand.df2.format(Main.tempdatadata.get("GDP"));
+ double returnedGDP = Double.parseDouble(GDP);
+ double[] serverBalance = getServerBalance();
+ double loanBalance = getLoanBalance();
+ returnedGDP += serverBalance[0];
+ returnedGDP -= loanBalance;
+ p.sendMessage(ChatColor.GOLD + "The Current GDP is: " + ChatColor.GREEN + AutoTuneGUIShopUserCommand.df2.format(returnedGDP));
+ p.sendMessage(ChatColor.GOLD + "The Current GDP per capita is: " + ChatColor.GREEN + AutoTuneGUIShopUserCommand.df2.format(returnedGDP/serverBalance[1]));
+ }
+ else if (!(p.hasPermission("at.gdp")) && !(p.isOp())){
+ TextHandler.noPermssion(p);
+ return true;
+ }
+ }
+ return true;
+ }
+
+ public double[] getServerBalance(){
+ double [] output = new double[2];
+ output[0] = 0.0;
+ output[1] = 0.0;
+ for (OfflinePlayer player : Bukkit.getOfflinePlayers()){
+ double x = Main.getEconomy().getBalance(player);
+ output[0] += x;
+ output[1] += 1;
+ }
+ return output;
+ }
+
+ public double getLoanBalance(){
+ double output = 0.0;
+ for (String str : Main.loanMap.keySet()){
+ double[] arr = Main.loanMap.get(str);
+ output += arr[0];
+ }
+ return output;
+ }
+
+}
diff --git a/Auto-Tune/src/unprotesting/com/github/Commands/AutoTuneGUIShopUserCommand.java b/Auto-Tune/src/unprotesting/com/github/Commands/AutoTuneGUIShopUserCommand.java
index e4d4512..740742b 100644
--- a/Auto-Tune/src/unprotesting/com/github/Commands/AutoTuneGUIShopUserCommand.java
+++ b/Auto-Tune/src/unprotesting/com/github/Commands/AutoTuneGUIShopUserCommand.java
@@ -251,22 +251,6 @@ public void loadGUIMAIN(Player player, CommandSender senderpub) {
pane.addPane(1, SBPane);
}
- // page two
- // **if (size > menuRows*7){
- // OutlinePane pageTwo = new OutlinePane(1, 1, 7, menuRows-2);
- // pageTwo.addItem(new GuiItem(new ItemStack(Material.GLASS), event ->
- // event.getWhoClicked().sendMessage("Glass")));
- // pane.addPane(1, pageTwo);
- // }
-
- // page three
- // if (size > menuRows*14){
- // OutlinePane pageThree = new OutlinePane(1, 1, 7, menuRows-2);
- // pageThree.addItem(new GuiItem(new ItemStack(Material.BLAZE_ROD),event ->
- // event.getWhoClicked().sendMessage("Blaze rod")));
- // pane.addPane(2, pageThree);
- // }
-
gui1.addPane(pane);
// page selection
@@ -419,7 +403,7 @@ public void createTradingPanel(Gui gui, String matClickedString, Player player,
if (hasAvaliableSlot(player) == true) {
Main.econ.withdrawPlayer(player, price);
player.getInventory().addItem(new ItemStack(Material.matchMaterial(matClickedString), 1));
- player.sendMessage(ChatColor.GOLD + "Purchased 1x " + matClickedString + " for " + ChatColor.GREEN + Config.getCurrencySymbol() + df2.format(price));
+ sendPlayerShopMessageAndUpdateGDP(1, price, player, matClickedString, false);
} else {
player.sendMessage(ChatColor.GOLD + "Cannot purchased 1x " + matClickedString + " for " + ChatColor.GREEN + Config.getCurrencySymbol() + df2.format(price));
player.sendMessage(ChatColor.GOLD + "Inventory Full!");
@@ -450,7 +434,7 @@ public void createTradingPanel(Gui gui, String matClickedString, Player player,
if (hasAvaliableSlot(player) == true) {
Main.econ.withdrawPlayer(player, price * 2);
player.getInventory().addItem(new ItemStack(Material.matchMaterial(matClickedString), 2));
- player.sendMessage(ChatColor.GOLD + "Purchased 2x " + matClickedString + " for " + ChatColor.GREEN + Config.getCurrencySymbol() + df2.format(price * 2));
+ sendPlayerShopMessageAndUpdateGDP(2, price, player, matClickedString, false);
} else {
player.sendMessage(ChatColor.GOLD + "Cannot purchased 2x " + matClickedString + " for " + ChatColor.GREEN + Config.getCurrencySymbol() + df2.format(price * 2));
player.sendMessage(ChatColor.GOLD + "Inventory Full!");
@@ -481,7 +465,7 @@ public void createTradingPanel(Gui gui, String matClickedString, Player player,
if (hasAvaliableSlot(player) == true) {
Main.econ.withdrawPlayer(player, price * 4);
player.getInventory().addItem(new ItemStack(Material.matchMaterial(matClickedString), 4));
- player.sendMessage(ChatColor.GOLD + "Purchased 4x " + matClickedString + " for " + ChatColor.GREEN + Config.getCurrencySymbol() + df2.format(price * 4));
+ sendPlayerShopMessageAndUpdateGDP(4, price, player, matClickedString, false);
} else {
player.sendMessage(ChatColor.GOLD + "Cannot purchased 4x " + matClickedString + " for " + ChatColor.GREEN + Config.getCurrencySymbol() + df2.format(price * 4));
player.sendMessage(ChatColor.GOLD + "Inventory Full!");
@@ -511,7 +495,7 @@ public void createTradingPanel(Gui gui, String matClickedString, Player player,
if (hasAvaliableSlot(player) == true) {
Main.econ.withdrawPlayer(player, price * 8);
player.getInventory().addItem(new ItemStack(Material.matchMaterial(matClickedString), 8));
- player.sendMessage(ChatColor.GOLD + "Purchased 8x " + matClickedString + " for " + ChatColor.GREEN + Config.getCurrencySymbol() + df2.format(price * 8));
+ sendPlayerShopMessageAndUpdateGDP(8, price, player, matClickedString, false);
} else {
player.sendMessage(ChatColor.GOLD + "Cannot purchased 8x " + matClickedString + " for " + ChatColor.GREEN + Config.getCurrencySymbol() + df2.format(price * 8));
player.sendMessage(ChatColor.GOLD + "Inventory Full!");
@@ -542,7 +526,7 @@ public void createTradingPanel(Gui gui, String matClickedString, Player player,
if (hasAvaliableSlot(player) == true) {
Main.econ.withdrawPlayer(player, price * 16);
player.getInventory().addItem(new ItemStack(Material.matchMaterial(matClickedString), 16));
- player.sendMessage(ChatColor.GOLD + "Purchased 16x " + matClickedString + " for " + ChatColor.GREEN + Config.getCurrencySymbol() + df2.format(price * 16));
+ sendPlayerShopMessageAndUpdateGDP(16, price, player, matClickedString, false);
} else {
player.sendMessage(ChatColor.GOLD + "Cannot purchased 16x " + matClickedString + " for " + ChatColor.GREEN + Config.getCurrencySymbol() + df2.format(price * 16));
player.sendMessage(ChatColor.GOLD + "Inventory Full!");
@@ -573,7 +557,7 @@ public void createTradingPanel(Gui gui, String matClickedString, Player player,
if (hasAvaliableSlot(player) == true) {
Main.econ.withdrawPlayer(player, price * 32);
player.getInventory().addItem(new ItemStack(Material.matchMaterial(matClickedString), 32));
- player.sendMessage(ChatColor.GOLD + "Purchased 32x " + matClickedString + " for " + ChatColor.GREEN + Config.getCurrencySymbol() + df2.format(price * 32));
+ sendPlayerShopMessageAndUpdateGDP(32, price, player, matClickedString, false);
} else {
player.sendMessage(ChatColor.GOLD + "Cannot purchased 32x " + matClickedString + " for " + ChatColor.GREEN + Config.getCurrencySymbol() + df2.format(price * 32));
player.sendMessage(ChatColor.GOLD + "Inventory Full!");
@@ -604,7 +588,7 @@ public void createTradingPanel(Gui gui, String matClickedString, Player player,
if (hasAvaliableSlot(player) == true) {
Main.econ.withdrawPlayer(player, price * 64);
player.getInventory().addItem(new ItemStack(Material.matchMaterial(matClickedString), 64));
- player.sendMessage(ChatColor.GOLD + "Purchased 64x " + matClickedString + " for " + ChatColor.GREEN + Config.getCurrencySymbol() + df2.format(price * 64));
+ sendPlayerShopMessageAndUpdateGDP(64, price, player, matClickedString, false);
} else {
player.sendMessage(ChatColor.GOLD + "Cannot purchased 64x " + matClickedString + " for " + ChatColor.GREEN + Config.getCurrencySymbol() + df2.format(price * 64));
player.sendMessage(ChatColor.GOLD + "Inventory Full!");
@@ -682,7 +666,7 @@ public void createTradingPanel(Gui gui, String matClickedString, Player player,
tempMap2.put(tempMap2Size - 1, tempDArray);
Main.map.put(matClickedString, tempMap2);
- player.sendMessage(ChatColor.GOLD + "Sold 1x " + matClickedString + " for " + ChatColor.GREEN + Config.getCurrencySymbol() + df2.format((price - price * 0.01 * sellpricedif) * 1));
+ sendPlayerShopMessageAndUpdateGDP(1, (price - price * 0.01 * sellpricedif), player, matClickedString, true);
Main.econ.depositPlayer(player, (price - price * 0.01 * sellpricedif));
sellable = false;
}
@@ -728,7 +712,7 @@ public void createTradingPanel(Gui gui, String matClickedString, Player player,
tempMap2.put(tempMap2Size - 1, tempDArray);
Main.map.put(matClickedString, tempMap2);
- player.sendMessage(ChatColor.GOLD + "Sold 2x " + matClickedString + " for " + ChatColor.GREEN + Config.getCurrencySymbol() + df2.format((price - price * 0.01 * sellpricedif) * 2));
+ sendPlayerShopMessageAndUpdateGDP(2, (price - price * 0.01 * sellpricedif), player, matClickedString, true);
Main.econ.depositPlayer(player, ((price - price * 0.01 * sellpricedif) * 2));
sellable = false;
}
@@ -774,7 +758,7 @@ public void createTradingPanel(Gui gui, String matClickedString, Player player,
tempMap2.put(tempMap2Size - 1, tempDArray);
Main.map.put(matClickedString, tempMap2);
- player.sendMessage(ChatColor.GOLD + "Sold 4x " + matClickedString + " for " + ChatColor.GREEN + Config.getCurrencySymbol() + df2.format((price - price * 0.01 * sellpricedif) * 4));
+ sendPlayerShopMessageAndUpdateGDP(4, (price - price * 0.01 * sellpricedif), player, matClickedString, true);
Main.econ.depositPlayer(player, ((price - price * 0.01 * sellpricedif) * 4));
sellable = false;
}
@@ -820,7 +804,7 @@ public void createTradingPanel(Gui gui, String matClickedString, Player player,
tempMap2.put(tempMap2Size - 1, tempDArray);
Main.map.put(matClickedString, tempMap2);
- player.sendMessage(ChatColor.GOLD + "Sold 8x " + matClickedString + " for " + ChatColor.GREEN + Config.getCurrencySymbol() + df2.format((price - price * 0.01 * sellpricedif) * 8));
+ sendPlayerShopMessageAndUpdateGDP(8, (price - price * 0.01 * sellpricedif), player, matClickedString, true);
Main.econ.depositPlayer(player, ((price - price * 0.01 * sellpricedif) * 8));
sellable = false;
}
@@ -866,7 +850,7 @@ public void createTradingPanel(Gui gui, String matClickedString, Player player,
tempMap2.put(tempMap2Size - 1, tempDArray);
Main.map.put(matClickedString, tempMap2);
- player.sendMessage(ChatColor.GOLD + "Sold 16x " + matClickedString + " for " + ChatColor.GREEN + Config.getCurrencySymbol() + df2.format((price - price * 0.01 * sellpricedif) * 16));
+ sendPlayerShopMessageAndUpdateGDP(16, (price - price * 0.01 * sellpricedif), player, matClickedString, true);
Main.econ.depositPlayer(player, ((price - price * 0.01 * sellpricedif) * 16));
sellable = false;
}
@@ -912,7 +896,7 @@ public void createTradingPanel(Gui gui, String matClickedString, Player player,
tempMap2.put(tempMap2Size - 1, tempDArray);
Main.map.put(matClickedString, tempMap2);
- player.sendMessage(ChatColor.GOLD + "Sold 32x " + matClickedString + " for " + ChatColor.GREEN + Config.getCurrencySymbol() + df2.format((price - price * 0.01 * sellpricedif) * 32));
+ sendPlayerShopMessageAndUpdateGDP(32, (price - price * 0.01 * sellpricedif), player, matClickedString, true);
Main.econ.depositPlayer(player, ((price - price * 0.01 * sellpricedif)) * 32);
sellable = false;
}
@@ -957,7 +941,7 @@ public void createTradingPanel(Gui gui, String matClickedString, Player player,
tempMap2.put(tempMap2Size - 1, tempDArray);
Main.map.put(matClickedString, tempMap2);
- player.sendMessage(ChatColor.GOLD + "Sold 64x " + matClickedString + " for " + ChatColor.GREEN + Config.getCurrencySymbol() + df2.format((price - price * 0.01 * sellpricedif) * 64));
+ sendPlayerShopMessageAndUpdateGDP(64, (price - price * 0.01 * sellpricedif), player, matClickedString, true);
Main.econ.depositPlayer(player, ((price - price * 0.01 * sellpricedif)) * 64);
sellable = false;
}
@@ -1003,4 +987,16 @@ public boolean hasAvaliableSlot(Player player) {
return check;
}
+ public static void sendPlayerShopMessageAndUpdateGDP(int amount, double price, Player player, String matClickedString, boolean sell){
+ if (!sell){
+ Main.tempdatadata.put("GDP", (Main.tempdatadata.get("GDP")+(price*amount)));
+ player.sendMessage(ChatColor.GOLD + "Purchased " + amount + "x " + matClickedString + " for " + ChatColor.GREEN + Config.getCurrencySymbol() + df2.format(price*amount));
+
+ }
+ else if (sell){
+ Main.tempdatadata.put("GDP", (Main.tempdatadata.get("GDP")-(price*amount)));
+ player.sendMessage(ChatColor.GOLD + "Sold " + amount + "x " + matClickedString + " for " + ChatColor.GREEN + Config.getCurrencySymbol() + df2.format(price*amount));
+ }
+ }
+
}
\ No newline at end of file
diff --git a/Auto-Tune/src/unprotesting/com/github/Commands/AutoTuneLoanCommand.java b/Auto-Tune/src/unprotesting/com/github/Commands/AutoTuneLoanCommand.java
index 207068f..5da657a 100644
--- a/Auto-Tune/src/unprotesting/com/github/Commands/AutoTuneLoanCommand.java
+++ b/Auto-Tune/src/unprotesting/com/github/Commands/AutoTuneLoanCommand.java
@@ -26,10 +26,10 @@ public boolean onCommand(CommandSender sender, Command command, String loan, Str
if (command.getName().equalsIgnoreCase("loan")){
Player p = (Player) sender;
if (p.hasPermission("at.loan") || p.isOp()){
- if (args[0] == null || args[0] == " " || args[0] == ""){
+ if (args[0] == null || args[0] == " " || args[0] == "" || args[1]!=null){
return false;
}
- else if (args[0] != null){
+ else{
try {
double amount = Double.parseDouble(args[0]);
UUID uuid = p.getUniqueId();
diff --git a/Auto-Tune/src/unprotesting/com/github/Commands/AutoTunePaybackLoanCommand.java b/Auto-Tune/src/unprotesting/com/github/Commands/AutoTunePaybackLoanCommand.java
index c39117d..55af90c 100644
--- a/Auto-Tune/src/unprotesting/com/github/Commands/AutoTunePaybackLoanCommand.java
+++ b/Auto-Tune/src/unprotesting/com/github/Commands/AutoTunePaybackLoanCommand.java
@@ -19,7 +19,7 @@ public class AutoTunePaybackLoanCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String payloan, String[] args) {
if (sender instanceof Player && command.getName().equalsIgnoreCase("payloan")){
- if (args[0] == null || args[0] == " " || args[0] == ""){
+ if (args[0] == null || args[0].equals(" ") || args[0].equals("")) {
return false;
}
Player p = (Player) sender;
@@ -46,7 +46,7 @@ public static void paybackLoan(OfflinePlayer p, String args){
double[] arr = Main.loanMap.get(uuid.toString() + args);
double curVal = arr[0];
Main.loanMap.remove(uuid.toString() + args);
- Main.getEconomy().withdrawPlayer(p, (Math.round(curVal*10000)/10000));
+ Main.getEconomy().withdrawPlayer(p, (Math.round(curVal*1000)/1000));
if (p.isOnline()){
Player player = (Player)p;
player.sendMessage(ChatColor.YELLOW + "Removed loan No: "+ ChatColor.GREEN + args + ChatColor.YELLOW + ". Withdrew " + ChatColor.GREEN + Config.getCurrencySymbol() + AutoTuneGUIShopUserCommand.df2.format(curVal) + ChatColor.YELLOW + " from your balance.");
diff --git a/Auto-Tune/src/unprotesting/com/github/Commands/AutoTuneSellCommand.java b/Auto-Tune/src/unprotesting/com/github/Commands/AutoTuneSellCommand.java
index fc3ac20..7d3aee1 100644
--- a/Auto-Tune/src/unprotesting/com/github/Commands/AutoTuneSellCommand.java
+++ b/Auto-Tune/src/unprotesting/com/github/Commands/AutoTuneSellCommand.java
@@ -132,6 +132,7 @@ public static void roundAndGiveMoney(Player player, double moneyToGive, Boolean
if (autoSell == false){
Main.econ.depositPlayer(player, moneyToGiveRounded);
player.sendMessage(ChatColor.GOLD + "Your items were sold, and "+ Config.getCurrencySymbol() + moneyToGiveRounded + " was added to your account.");
+ if (Config.isCalculateGlobalGDP()){Main.tempdatadata.put("GDP", (Main.tempdatadata.get("GDP")-moneyToGiveRounded));}
}
if (autoSell == true){
if (Main.tempdatadata.get(player.getUniqueId().toString()) == null){
diff --git a/Auto-Tune/src/unprotesting/com/github/Main.java b/Auto-Tune/src/unprotesting/com/github/Main.java
index 7ffb97c..c6e4ddc 100644
--- a/Auto-Tune/src/unprotesting/com/github/Main.java
+++ b/Auto-Tune/src/unprotesting/com/github/Main.java
@@ -50,6 +50,7 @@
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent;
import net.milkbowl.vault.economy.Economy;
+import unprotesting.com.github.Commands.AutoTuneGDPCommand;
import unprotesting.com.github.Commands.AutoTuneAutoSellCommand;
import unprotesting.com.github.Commands.AutoTuneCommand;
import unprotesting.com.github.Commands.AutoTuneGUIShopUserCommand;
@@ -184,7 +185,7 @@ public void onEnable() {
return;
}
if (vaildAPIKey) {
- log("API-Key found in database. Continuing to load Auto-Tune..");
+ log("API-Key found in database. Continuing to load Auto-Tune on " + Config.getServerName());
}
this.getCommand("at").setExecutor(new AutoTuneCommand());
this.getCommand("shop").setExecutor(new AutoTuneGUIShopUserCommand());
@@ -193,6 +194,7 @@ public void onEnable() {
this.getCommand("loan").setExecutor(new AutoTuneLoanCommand());
this.getCommand("loans").setExecutor(new AutoTuneLoansCommand());
this.getCommand("payloan").setExecutor(new AutoTunePaybackLoanCommand());
+ this.getCommand("gdp").setExecutor(new AutoTuneGDPCommand());
basicVolatilityAlgorithim = Config.getBasicVolatilityAlgorithim();
priceModel = Config.getPricingModel().toString();
TextHandler.sendPriceModelData(priceModel);
@@ -292,18 +294,13 @@ public void run() {
}
public static void loadItemPricesAndCalculate() throws ParseException {
- System.out.println("Loading item prices");
tempbuys = 0.0;
tempsells = 0.0;
buys = 0.0;
sells = 0.0;
- System.out.println("Loading item prices1");
if (priceModel.contains("Basic") || priceModel.contains("Advanced") || priceModel.contains("Exponential")) {
- System.out.println("Loading item prices2");
TextHandler.sendDataBeforePriceCalculation(priceModel, basicVolatilityAlgorithim);
- System.out.println("Loading item prices3");
Set strSet = map.keySet();
- System.out.println("Loading item prices4");
for (String str : strSet) {
ConcurrentHashMap tempMap = map.get(str);
Integer expvalues = 0;
@@ -610,6 +607,9 @@ public static void setupDataFiles() {
tempdatadata = tempDB.hashMap("tempdatadata", Serializer.STRING, Serializer.DOUBLE).createOrOpen();
loanDB = DBMaker.fileDB("plugins/Auto-Tune/temp/loandata.db").checksumHeaderBypass().closeOnJvmShutdown().make();
loanMap = loanDB.hashMap("loanMap", Serializer.STRING, Serializer.DOUBLE_ARRAY).createOrOpen();
+ if (tempdatadata.get("GDP")==null){
+ tempdatadata.put("GDP", 0.0);
+ }
}
public boolean onCommand(CommandSender sender, Command testcmd, String trade, String[] help) {
diff --git a/Auto-Tune/src/unprotesting/com/github/util/AutoTunePlayerAutoSellEventHandler.java b/Auto-Tune/src/unprotesting/com/github/util/AutoTunePlayerAutoSellEventHandler.java
index 756247d..d1e3fdc 100644
--- a/Auto-Tune/src/unprotesting/com/github/util/AutoTunePlayerAutoSellEventHandler.java
+++ b/Auto-Tune/src/unprotesting/com/github/util/AutoTunePlayerAutoSellEventHandler.java
@@ -13,7 +13,7 @@ public class AutoTunePlayerAutoSellEventHandler implements Runnable{
@Override
public void run() {
for (String uuid : Main.tempdatadata.keySet()){
- if (uuid == "SellPriceDifferenceDifference"){
+ if (uuid.equals("SellPriceDifferenceDifference") || uuid.equals("GDP")){
continue;
}
Player p;
diff --git a/Auto-Tune/src/unprotesting/com/github/util/CSVHandler.java b/Auto-Tune/src/unprotesting/com/github/util/CSVHandler.java
index 88159c4..9376960 100644
--- a/Auto-Tune/src/unprotesting/com/github/util/CSVHandler.java
+++ b/Auto-Tune/src/unprotesting/com/github/util/CSVHandler.java
@@ -23,7 +23,7 @@ public static void writeCSV() throws InterruptedException,
csvWriter.append(",");
csvWriter.append("\n");
- for (int i = 0; i > -100; i++) {
+ for (int i = 0; i > -10; i++) {
String k = String.valueOf(i);
csvWriter.append(k);
Double[] l = (item.get(i));
@@ -71,7 +71,7 @@ public static void writeShortCSV() throws InterruptedException,
int size = item.size();
- for (int i = size-Config.getMaximumShortTradeLength(); i > -100; i++) {
+ for (int i = size-Config.getMaximumShortTradeLength(); i > -10; i++) {
String k = String.valueOf(i);
csvWriter.append(k);
Double[] l = (item.get(i));
diff --git a/Auto-Tune/src/unprotesting/com/github/util/Config.java b/Auto-Tune/src/unprotesting/com/github/util/Config.java
index 85ab02a..f206cbb 100644
--- a/Auto-Tune/src/unprotesting/com/github/util/Config.java
+++ b/Auto-Tune/src/unprotesting/com/github/util/Config.java
@@ -15,7 +15,8 @@ public final class Config {
checksumHeaderBypass,
sellPriceDifferenceVariationEnabled,
inflationEnabled,
- autoSellEnabled;
+ autoSellEnabled,
+ calculateGlobalGDP;
@Getter
@Setter
@@ -62,6 +63,7 @@ public final class Config {
public static void loadDefaults() {
Config.setSellPriceDifferenceVariationEnabled(Main.getMainConfig().getBoolean("sell-price-difference-variation-enabled", false));
Config.setWebServer(Main.getMainConfig().getBoolean("web-server-enabled", false));
+ Config.setCalculateGlobalGDP(Main.getMainConfig().getBoolean("calculate-global-GDP", true));
Config.setAutoSellEnabled(Main.getMainConfig().getBoolean("auto-sell-enabled", true));
Config.setInflationEnabled(Main.getMainConfig().getBoolean("inflation-enabled", true));
Config.setChecksumHeaderBypass(Main.getMainConfig().getBoolean("checksum-header-bypass", false));
@@ -97,9 +99,9 @@ public static void loadDefaults() {
Config.setInflationValue(Main.getMainConfig().getDouble("static-inflation-value", 0.1));
Config.setDataSelectionZ(Main.getMainConfig().getDouble("data-selection-z", 1.6));
Config.setSellPriceDifference(Main.getMainConfig().getDouble("sell-price-difference", 2.5));
- Config.setIntrestRate(Main.getMainConfig().getDouble("intrest-rate", 0.01));
+ Config.setIntrestRate(Main.getMainConfig().getDouble("intrest-rate", 0.001));
Config.setMaxDebt(Main.getMainConfig().getDouble("max-debt-value", -1000.00));
- Config.setSellPriceDifferenceVariationStart(Main.getMainConfig().getDouble("sell-price-differnence-variation-start", 25.0));
+ Config.setSellPriceDifferenceVariationStart(Main.getMainConfig().getDouble("sell-price-difference-variation-start", 25.0));
}
}
\ No newline at end of file
diff --git a/Auto-Tune/src/unprotesting/com/github/util/HttpPostRequestor.java b/Auto-Tune/src/unprotesting/com/github/util/HttpPostRequestor.java
index fdebd69..e38692e 100644
--- a/Auto-Tune/src/unprotesting/com/github/util/HttpPostRequestor.java
+++ b/Auto-Tune/src/unprotesting/com/github/util/HttpPostRequestor.java
@@ -27,7 +27,7 @@ public static Double sendPostRequestUsingHttpClient(String model, String algorit
Double newPrice = price;
CloseableHttpClient client = HttpClients.createDefault();
HttpPost httpPost = new HttpPost("https://safe-refuge-09383.herokuapp.com");
- JSONObject json = JSONManager.returnJSONFromParams(model, algorithm, price, averageBuy, averageSell,
+ JSONObject json = JsonManager.returnJSONFromParams(model, algorithm, price, averageBuy, averageSell,
maxVolatility, minVolatility);
Main.debugLog("Sending data to API for " + item + ": - " + "model: " + model + ", price: " + price
+ ", averageBuy: " + averageBuy + ", averageSell: " + averageSell + ", maxVolatility: " + maxVolatility
diff --git a/Auto-Tune/src/unprotesting/com/github/util/InflationEventHandler.java b/Auto-Tune/src/unprotesting/com/github/util/InflationEventHandler.java
index 2967376..ffc420e 100644
--- a/Auto-Tune/src/unprotesting/com/github/util/InflationEventHandler.java
+++ b/Auto-Tune/src/unprotesting/com/github/util/InflationEventHandler.java
@@ -9,17 +9,47 @@ public class InflationEventHandler implements Runnable {
@Override
public void run() {
for (String str : Main.map.keySet()){
- ConcurrentHashMap retMap = Main.map.get(str);
- int size = retMap.size();
- Double[] arr = retMap.get(size-1);
- Double price = arr[0];
- Double newPrice = price+price*0.01*Config.getDynamicInflationValue();
- arr[0] = newPrice;
- retMap.put(size-1, arr);
- Main.map.put(str, retMap);
- Main.debugLog("Increased item price of: " + str + " from " + price + " to " + newPrice);
+ increaseItemPrice(str, Config.getDynamicInflationValue(), true);
}
Main.debugLog("Dynamic Inflation Value: " + Config.getDynamicInflationValue());
}
+
+ public static Double increaseItemPrice(String item, Double value, boolean percentage){
+ ConcurrentHashMap retMap = Main.map.get(item);
+ int size = retMap.size();
+ Double[] arr = retMap.get(size-1);
+ Double price = arr[0];
+ Double newPrice = 0.0;
+ if (percentage){
+ newPrice = price+price*0.01*value;
+ }
+ if (!percentage){
+ newPrice = price+value;
+ }
+ arr[0] = newPrice;
+ retMap.put(size-1, arr);
+ Main.map.put(item, retMap);
+ Main.debugLog("Increased item price of: " + item + " from " + price + " to " + newPrice);
+ return newPrice;
+ }
+
+ public static Double decreaseItemPrice(String item, Double value, boolean percentage){
+ ConcurrentHashMap retMap = Main.map.get(item);
+ int size = retMap.size();
+ Double[] arr = retMap.get(size-1);
+ Double price = arr[0];
+ Double newPrice = 0.0;
+ if (percentage){
+ newPrice = price-price*0.01*value;
+ }
+ if (!percentage){
+ newPrice = price-value;
+ }
+ arr[0] = newPrice;
+ retMap.put(size-1, arr);
+ Main.map.put(item, retMap);
+ Main.debugLog("Increased item price of: " + item + " from " + price + " to " + newPrice);
+ return newPrice;
+ }
}
\ No newline at end of file
diff --git a/Auto-Tune/src/unprotesting/com/github/util/JSONManager.java b/Auto-Tune/src/unprotesting/com/github/util/JSONManager.java
index 0041a31..4066baa 100644
--- a/Auto-Tune/src/unprotesting/com/github/util/JSONManager.java
+++ b/Auto-Tune/src/unprotesting/com/github/util/JSONManager.java
@@ -2,7 +2,7 @@
import org.json.simple.JSONObject;
-public class JSONManager {
+public class JsonManager {
public static JSONObject returnJSONFromParams(String model, String algorithm, Double price, Double averageBuy, Double averageSell, Double maxVolatility, Double minVolatility){
JSONObject obj = new JSONObject();
diff --git a/Auto-Tune/src/unprotesting/com/github/util/JoinEventHandler.java b/Auto-Tune/src/unprotesting/com/github/util/JoinEventHandler.java
index 444ea97..1179ebd 100644
--- a/Auto-Tune/src/unprotesting/com/github/util/JoinEventHandler.java
+++ b/Auto-Tune/src/unprotesting/com/github/util/JoinEventHandler.java
@@ -12,7 +12,7 @@
public class JoinEventHandler implements Listener {
- static Logger log = Logger.getLogger("Minecraft");
+ public static Logger log = Logger.getLogger("Minecraft");
@EventHandler
public void onPlayerJoin(PlayerLoginEvent e) {
@@ -21,5 +21,6 @@ public void onPlayerJoin(PlayerLoginEvent e) {
Main.playerDataConfig.set(uuid + ".name", p.getName());
Main.saveplayerdata();
}
+ }
- }
\ No newline at end of file
+
\ No newline at end of file
diff --git a/Auto-Tune/src/unprotesting/com/github/util/TextHandler.java b/Auto-Tune/src/unprotesting/com/github/util/TextHandler.java
index f0624f0..f367d66 100644
--- a/Auto-Tune/src/unprotesting/com/github/util/TextHandler.java
+++ b/Auto-Tune/src/unprotesting/com/github/util/TextHandler.java
@@ -6,21 +6,21 @@
public class TextHandler {
public static void sendPriceModelData(String priceModel){
- if (priceModel.contains("Basic") == true) {
+ if (priceModel.contains("Basic")) {
Main.log("Loaded Basic Price Algorithim");
- if (Main.basicVolatilityAlgorithim.contains("Variable") == true) {
+ if (Main.basicVolatilityAlgorithim.contains("Variable")) {
Main.log("Loaded Algorithim under Variable Configuration");
}
- if (Main.basicVolatilityAlgorithim.contains("Fixed") == true) {
+ if (Main.basicVolatilityAlgorithim.contains("Fixed")) {
Main.log("Loaded Algorithim under Variable Configuration");
}
}
- if (priceModel.contains("Advanced") == true) {
+ if (priceModel.contains("Advanced")) {
Main.log("Loaded Advanced Price Algorithim");
- if (Main.basicVolatilityAlgorithim.contains("Variable") == true) {
+ if (Main.basicVolatilityAlgorithim.contains("Variable")) {
Main.log("Loaded Advanced Algorithim under Variable Configuration");
}
- if (Main.basicVolatilityAlgorithim.contains("Fixed") == true) {
+ if (Main.basicVolatilityAlgorithim.contains("Fixed")) {
Main.log("Loaded Advanced Algorithim under Variable Configuration");
}
}
@@ -29,23 +29,23 @@ public static void sendPriceModelData(String priceModel){
public static void sendDataBeforePriceCalculation(String priceModel, String basicVolatilityAlgorithim){
Main.debugLog("Starting price calculation task... ");
Main.debugLog("Price algorithim settings: ");
- if (priceModel.contains("Basic") == true && basicVolatilityAlgorithim.contains("Fixed") == true) {
+ if (priceModel.contains("Basic") && basicVolatilityAlgorithim.contains("Fixed")) {
Main.debugLog("Basic Max Fixed Volatility: " + Config.getBasicMaxFixedVolatility());
Main.debugLog("Basic Min Fixed Volatility: " + Config.getBasicMinFixedVolatility());
}
- if (priceModel.contains("Basic") == true && basicVolatilityAlgorithim.contains("Variable") == true) {
+ if (priceModel.contains("Basic") && basicVolatilityAlgorithim.contains("Variable")) {
Main.debugLog("Basic Max Variable Volatility: " + Config.getBasicMaxVariableVolatility());
Main.debugLog("Basic Min Variable Volatility: " + Config.getBasicMinVariableVolatility());
}
- if (priceModel.contains("Advanced") == true && basicVolatilityAlgorithim.contains("Fixed") == true) {
+ if (priceModel.contains("Advanced") && basicVolatilityAlgorithim.contains("Fixed")) {
Main.debugLog("Advanced Max Fixed Volatility: " + Config.getBasicMaxFixedVolatility());
Main.debugLog("Advanced Min Fixed Volatility: " + Config.getBasicMinFixedVolatility());
}
- if (priceModel.contains("Advanced") == true && basicVolatilityAlgorithim.contains("Variable") == true) {
+ if (priceModel.contains("Advanced") && basicVolatilityAlgorithim.contains("Variable")) {
Main.debugLog("Advanced Max Variable Volatility: " + Config.getBasicMaxVariableVolatility());
Main.debugLog("Advanced Min Variable Volatility: " + Config.getBasicMinVariableVolatility());
}
- if (priceModel.contains("Exponential") == true && basicVolatilityAlgorithim.contains("Variable") == true) {
+ if (priceModel.contains("Exponential") && basicVolatilityAlgorithim.contains("Variable")) {
Main.debugLog("Exponential Max Variable Volatility: " + Config.getBasicMaxVariableVolatility());
Main.debugLog("Exponential Min Variable Volatility: " + Config.getBasicMinVariableVolatility());
Main.debugLog("Exponential data selection algorithim: y = " + Config.getDataSelectionM() + "(x^" + Config.getDataSelectionZ() + ") + " + Config.getDataSelectionC());
diff --git a/README.md b/README.md
index c27342e..4927bc5 100644
--- a/README.md
+++ b/README.md
@@ -46,6 +46,7 @@ An example of a shop setup using Auto-Tune:
- Player loaning [/loan, /loans, /payloan, easy to use]
- Configurable interest rates [Update period, amount and more]
- Debt settings
+ - GDP and GDP per capita calculation [factors in buying/selling, debt, and loaning, using /gdp]
- Incredibly fast data-collection and creation [50000 data insertions and retrevals a second when in memory, 5000 data insertions and retrievals a second when in storage (in our tests)]
- Data corruption protection
- And more!
@@ -76,7 +77,7 @@ An example of a shop setup using Auto-Tune:
Config.yml
- Auto-Tune's config.yml file:
+ Auto-Tune's Config.yml file:
-- General Settings --
@@ -205,9 +206,9 @@ An example of a shop setup using Auto-Tune:
#### Configuring shops.yml
- shops.yml
+ Shops.yml
- Auto-Tune's shops.yml file:
+ Auto-Tune's Shops.yml file:
Set the default / starting prices for the items you want available in the shop
Info: Make sure you put a decimal point and two digits to create a double for the shop algorithim to accept and parse to a price-value
@@ -244,7 +245,7 @@ However, pricing will roughly be at around:
- Advanced: £1.00 per 20,000 - 40,000 API requests
- Exponential: £1.00 per 8,000 - 25,000 API requests
- #### How to access the Auto-Tune API without the Auto-Tune plugin
+#### How to access the Auto-Tune API without the Auto-Tune plugin
For Auto-Tune users this is not neccessary to worry about, however, those who want to access the API without the need for the Auto-Tune plugin can do so.