Skip to content

Commit

Permalink
Added GUIShop Economy coversion
Browse files Browse the repository at this point in the history
+ Added GUIShop Economy conversion
+ Added option to add increased buy value weight when converting GUIShop to Auto-Tune
+ Properly format when converting economies.
+ Added another page to the shop
+ Updated to 0.10.2
  • Loading branch information
noahbclarkson committed Nov 12, 2020
1 parent ed9dd49 commit 355bc44
Show file tree
Hide file tree
Showing 7 changed files with 191 additions and 46 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.1</version>
<version>0.10.2</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.1</version>
<version>0.10.2</version>
<!-- Info -->
<name>Auto-Tune</name>
<url>https://github.com/Unprotesting/Auto-Tune</url>
Expand Down
9 changes: 7 additions & 2 deletions Auto-Tune/src/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ debug-enabled: false
checksum-header-bypass: false

## Use another economies shop settings for prices (don't change this without deleting data.db and resetting)
## Options: Default | Essentials
## This will convert the shops file from another economy to a compatible Auto-Tune shops.yml
## Options: Default | Essentials | GUIShop
## Instructions for use: Turn this on, stop your server, delete data.db, start server, available data-transfers will appear in shops.yml, reset this option to default and restart your server again
economy-shop-config: 'default'
## Remove GUI-Shop once done to avoid incompatiability errors
economy-shop-config: 'default'

## Percentage value sell prices have on new price when converting GUIShop to Auto-Tune
shop-config-guishop-sell-value: 20.00
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@

public class AutoTuneGUIShopUserCommand implements CommandExecutor {

static DecimalFormat df2 = new DecimalFormat("###,###,###,##0.00");
public static DecimalFormat df1 = new DecimalFormat("###########0.00");
public static DecimalFormat df2 = new DecimalFormat("###,###,###,##0.00");
static DecimalFormat df3 = new DecimalFormat("###,###,###,##0.00000");

public Economy economy = Main.getEconomy();
Expand Down Expand Up @@ -74,6 +75,7 @@ public void loadGUIMAIN(Player player, CommandSender senderpub) {
StaticPane pageTwo = new StaticPane(1, 1, 7, menuRows - 2);
StaticPane pageThree = new StaticPane(1, 1, 7, menuRows - 2);
StaticPane pageFour = new StaticPane(1, 1, 7, menuRows - 2);
StaticPane pageFive = new StaticPane(1, 1, 7, menuRows - 2);
StaticPane back = new StaticPane(0, menuRows - 1, 1, 1);
StaticPane forward = new StaticPane(8, menuRows - 1, 1, 1);

Expand All @@ -95,6 +97,10 @@ public void loadGUIMAIN(Player player, CommandSender senderpub) {
pageAmount = 5;
pane.addPane(3, pageFour);
}
if (size > paneSize * 4) {
pageAmount = 6;
pane.addPane(4, pageFive);
}

final Integer finalPageAmount = pageAmount;

Expand Down Expand Up @@ -131,6 +137,9 @@ public void loadGUIMAIN(Player player, CommandSender senderpub) {
if (finalPageAmount == 5) {
pane.setPage(4);
}
if (finalPageAmount == 6) {
pane.setPage(5);
}
gui.update();
playernew.setItemOnCursor(null);
event.setCancelled(true);
Expand All @@ -156,115 +165,142 @@ public void loadGUIMAIN(Player player, CommandSender senderpub) {
if (i<7) {
pageOne.addItem(a, i, 0);
}
if (i >= 7 && i<14) {
else if (i >= 7 && i<14) {
pageOne.addItem(a, i - 7, 1);
}
if (i >= 14 && i<21) {
else if (i >= 14 && i<21) {
pageTwo.addItem(a, i - 14, 0);
}
if (i >= 21 && i<28) {
else if (i >= 21 && i<28) {
pageTwo.addItem(a, i - 21, 1);
}
if (i >= 28 && i<35) {
else if (i >= 28 && i<35) {
pageThree.addItem(a, i - 28, 0);
}
if (i >= 35 && i<42) {
else if (i >= 35 && i<42) {
pageThree.addItem(a, i - 35, 1);
}
if (i >= 42 && i<49) {
else if (i >= 42 && i<49) {
pageFour.addItem(a, i - 42, 0);
}
if (i >= 49 && i<56) {
else if (i >= 49 && i<56) {
pageFour.addItem(a, i - 49, 1);
}
else if (i >= 56 && i<63) {
pageFive.addItem(a, i - 56, 0);
}
else if (i >= 63 && i<70) {
pageFive.addItem(a, i - 63, 1);
}
}
if (Config.getMenuRows() == 5) {
if (i<7) {
pageOne.addItem(a, i, 0);
}
if (i >= 7 && i<14) {
else if (i >= 7 && i<14) {
pageOne.addItem(a, i - 7, 1);
}
if (i >= 14 && i<21) {
else if (i >= 14 && i<21) {
pageOne.addItem(a, i - 14, 2);
}
if (i >= 21 && i<28) {
else if (i >= 21 && i<28) {
pageTwo.addItem(a, i - 21, 0);
}
if (i >= 28 && i<35) {
else if (i >= 28 && i<35) {
pageTwo.addItem(a, i - 28, 1);
}
if (i >= 35 && i<42) {
else if (i >= 35 && i<42) {
pageTwo.addItem(a, i - 35, 2);
}
if (i >= 42 && i<49) {
else if (i >= 42 && i<49) {
pageThree.addItem(a, i - 42, 0);
}
if (i >= 49 && i<56) {
else if (i >= 49 && i<56) {
pageThree.addItem(a, i - 49, 1);
}
if (i >= 56 && i<63) {
else if (i >= 56 && i<63) {
pageThree.addItem(a, i - 56, 2);
}
if (i >= 63 && i<70) {
else if (i >= 63 && i<70) {
pageFour.addItem(a, i - 63, 0);
}
if (i >= 70 && i<77) {
else if (i >= 70 && i<77) {
pageFour.addItem(a, i - 70, 1);
}
if (i >= 77 && i<84) {
else if (i >= 77 && i<84) {
pageFour.addItem(a, i - 77, 2);
}
else if (i >= 84 && i<91) {
pageFive.addItem(a, i - 84, 0);
}
else if (i >= 91 && i<98) {
pageFive.addItem(a, i - 91, 1);
}
else if (i >= 98 && i<105) {
pageFive.addItem(a, i - 98, 2);
}
}
if (Config.getMenuRows() == 6) {
if (i<7) {
pageOne.addItem(a, i, 0);
}
if (i >= 7 && i<14) {
else if (i >= 7 && i<14) {
pageOne.addItem(a, i - 7, 1);
}
if (i >= 14 && i<21) {
else if (i >= 14 && i<21) {
pageOne.addItem(a, i - 14, 2);
}
if (i >= 21 && i<28) {
else if (i >= 21 && i<28) {
pageOne.addItem(a, i - 21, 3);
}
if (i >= 28 && i<35) {
else if (i >= 28 && i<35) {
pageTwo.addItem(a, i - 28, 0);
}
if (i >= 35 && i<42) {
else if (i >= 35 && i<42) {
pageTwo.addItem(a, i - 35, 1);
}
if (i >= 42 && i<49) {
else if (i >= 42 && i<49) {
pageTwo.addItem(a, i - 42, 2);
}
if (i >= 49 && i<56) {
else if (i >= 49 && i<56) {
pageTwo.addItem(a, i - 49, 3);
}
if (i >= 56 && i<63) {
else if (i >= 56 && i<63) {
pageThree.addItem(a, i - 56, 0);
}
if (i >= 63 && i<70) {
else if (i >= 63 && i<70) {
pageThree.addItem(a, i - 63, 1);
}
if (i >= 70 && i<77) {
else if (i >= 70 && i<77) {
pageThree.addItem(a, i - 70, 2);
}
if (i >= 77 && i<84) {
else if (i >= 77 && i<84) {
pageThree.addItem(a, i - 77, 3);
}
if (i >= 84 && i<91) {
else if (i >= 84 && i<91) {
pageFour.addItem(a, i - 84, 0);
}
if (i >= 91 && i<98) {
else if (i >= 91 && i<98) {
pageFour.addItem(a, i - 91, 1);
}
if (i >= 98 && i<105) {
else if (i >= 98 && i<105) {
pageFour.addItem(a, i - 98, 2);
}
if (i >= 105 && i<112) {
else if (i >= 105 && i<112) {
pageFour.addItem(a, i - 105, 3);
}
else if (i >= 112 && i<119) {
pageFive.addItem(a, i - 112, 0);
}
else if (i >= 119 && i<126) {
pageFive.addItem(a, i - 119, 1);
}
else if (i >= 126 && i<135) {
pageFive.addItem(a, i - 126, 2);
}
else if (i >= 135 && i<142) {
pageFive.addItem(a, i - 135, 3);
}

}

Expand All @@ -288,6 +324,13 @@ public void loadGUIMAIN(Player player, CommandSender senderpub) {
pane.addPane(3, pageFour);
pane.addPane(4, SBPane);
}
if (finalPageAmount == 6) {
pane.addPane(1, pageTwo);
pane.addPane(2, pageThree);
pane.addPane(3, pageFour);
pane.addPane(4, pageFive);
pane.addPane(5, SBPane);
}
else {
pane.addPane(1, SBPane);
}
Expand All @@ -306,6 +349,11 @@ public void loadGUIMAIN(Player player, CommandSender senderpub) {
imforward.setLore(Arrays.asList(ChatColor.BOLD + "Click to go to the next page"));
isforward.setItemMeta(imforward);

if (pane.getPage() == 0 && finalPageAmount == 6) {
back.setVisible(false);
forward.setVisible(true);
}

if (pane.getPage() == 0 && finalPageAmount == 5) {
back.setVisible(false);
forward.setVisible(true);
Expand All @@ -329,6 +377,10 @@ public void loadGUIMAIN(Player player, CommandSender senderpub) {
if (pane.getPage() != 0) {
pane.setPage(pane.getPage() - 1);
}
if (pane.getPage() == 0 && finalPageAmount == 6) {
back.setVisible(false);
forward.setVisible(true);
}
if (pane.getPage() == 0 && finalPageAmount == 5) {
back.setVisible(false);
forward.setVisible(true);
Expand Down
11 changes: 11 additions & 0 deletions Auto-Tune/src/unprotesting/com/github/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,17 @@ public static FileConfiguration saveEssentialsFiles(){
return worthyml;
}

public static FileConfiguration saveGUIShopFiles(){
FileConfiguration shopsyml;
shopsyml = YamlConfiguration.loadConfiguration(new File("plugins/GUIShop/shops.yml"));
try {
shopsyml.save(new File("plugins/GUIShop/", "shops.yml"));
} catch (IOException e) {
plugin.getLogger().warning("Unable to save shops.yml"); // shouldn't really happen
}
return shopsyml;
}

public static void setupDataFiles() {
if (Config.isChecksumHeaderBypass()) {
Main.debugLog("Enabling checksum-header-bypass");
Expand Down
4 changes: 3 additions & 1 deletion Auto-Tune/src/unprotesting/com/github/util/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ public final class Config {
dynamicInflationValue,
inflationValue,
intrestRate,
maxDebt;
maxDebt,
shopConfigGUIShopSellValue;


public static void loadDefaults() {
Expand Down Expand Up @@ -104,6 +105,7 @@ public static void loadDefaults() {
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-difference-variation-start", 25.0));
Config.setShopConfigGUIShopSellValue(Main.getMainConfig().getDouble("shop-config-guishop-sell-value", 20.00));
}

}
Loading

0 comments on commit 355bc44

Please sign in to comment.