Skip to content

Commit

Permalink
Merge pull request #9 from Unprotesting/WIP/Loan-Overhaul
Browse files Browse the repository at this point in the history
WIP/Loan-Overhaul
  • Loading branch information
noahbclarkson authored Dec 17, 2020
2 parents 78bd1ae + baa9689 commit 5f0532c
Show file tree
Hide file tree
Showing 23 changed files with 517 additions and 360 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ hs_err_pid*
.settings/
dependency-reduced-pom.xml
Auto-Tune/target/classes/config.yml
Auto-Tune/target/classes/enchantments.yml
Auto-Tune/target/classes/plugin.yml
Auto-Tune/target/classes/shops.yml
Auto-Tune/target/classes/web/trade.html
Expand Down
11 changes: 5 additions & 6 deletions Auto-Tune/.classpath
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry including="**/*.java" kind="src" output="target/classes" path="src">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
Expand All @@ -21,5 +15,10 @@
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
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.12.0-pre-release-4</version>
<version>0.12.0-pre-release-5</version>
<description>The automatic pricing plugin for minecraft</description>
<url>https://github.com/Unprotesting/Auto-Tune</url>
<issueManagement>
Expand Down
7 changes: 6 additions & 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.12.0-pre-release-4</version>
<version>0.12.0-pre-release-5</version>
<!-- Info -->
<name>Auto-Tune</name>
<url>https://github.com/Unprotesting/Auto-Tune</url>
Expand Down Expand Up @@ -46,6 +46,11 @@
<artifactId>mapdb</artifactId>
<version>3.0.8</version>
</dependency>
<dependency>
<groupId>net.jpountz.lz4</groupId>
<artifactId>lz4</artifactId>
<version>1.3.0</version>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
Expand Down
20 changes: 18 additions & 2 deletions Auto-Tune/src/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,13 @@ 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: 0.75

## Minimum Volatility per Time Period for the Fixed Volatility price calculation algorithim in economy units
Variable-Min-Volatility: 0.025

Expand All @@ -88,8 +90,10 @@ Variable-Min-Volatility: 0.025

## 'm' in equation: y=m(x^z)+c
data-selection-m: 0.05

## 'z' in equation: y=m(x^z)+c
data-selection-z: 1.6

## 'c' in equation: y=m(x^z)+c
data-selection-c: 1.05

Expand All @@ -103,33 +107,45 @@ 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: 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
## Info: Must be a factor of sell-price-variation-time-period or it wont work!
sell-price-variation-update-period: 30

## Enable forced inflation in the economy
inflation-enabled: true

## Inflation method can be Dynamic, Static or Mixed.
## Info: The dynamic method increases the prices of items in the economy by a percentage each time period
## Info: The static method adds extra values to buys
## Info: Mixed uses both methods
inflation-method: 'Mixed'

## Time period in ticks between dynamic price increases
dynamic-inflation-time-period: 5000

## Percentage increase in prices per time-period.
dynamic-inflation-value: 0.00025

## Percentage increase for buy value per price calculation update period.
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.005
interest-rate: 0.005

## Intrest rate for compound-intrest loans
## Info: Compound intrest loans grow faster so should have a lower initial intrest rate
compound-interest-rate: 0.0025

## Time period in ticks between updates of the intrest rate for users loans
intrest-rate-update-period: 1200
interest-rate-update-period: 1200

## lowest value in $ a player can go into debt
## Example: -10.00
Expand Down
8 changes: 1 addition & 7 deletions Auto-Tune/src/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,7 @@ commands:
usage: /<autosell>
loan:
description: Auto-Tune Auto Loan Command
usage: /<loan> <amount>
loans:
description: View all of your active loans
usage: <loans>
payloan:
description: Payback one of your loans
usage: <payloan> <loanNo.>
usage: /<loan> <amount> (Optional)<compound-interest-enabled>
gdp:
description: View GDP info
usage: <GDP>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
import org.bukkit.inventory.ItemStack;

import unprotesting.com.github.Main;
import unprotesting.com.github.util.ChatHandler;
import unprotesting.com.github.util.Config;
import unprotesting.com.github.util.EnchantmentAlgorithm;
import unprotesting.com.github.util.EnchantmentSetting;
import unprotesting.com.github.util.TextHandler;

public class AutoTuneBuyCommand implements CommandExecutor {

Expand All @@ -28,6 +30,10 @@ public class AutoTuneBuyCommand implements CommandExecutor {
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player){
Player player = (Player) sender;
if (!(player.hasPermission("at.buy") || player.isOp())){
TextHandler.noPermssion(player);
return true;
}
if (args.length == 0){
player.sendMessage(ChatColor.YELLOW + "Command Usage: ");
player.sendMessage(ChatColor.YELLOW + "/buy: <shop-type> <shop>");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package unprotesting.com.github.Commands;

import java.util.ArrayList;
import java.util.UUID;

import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command;
Expand All @@ -9,6 +12,7 @@

import net.md_5.bungee.api.ChatColor;
import unprotesting.com.github.Main;
import unprotesting.com.github.util.Loan;
import unprotesting.com.github.util.TextHandler;

public class AutoTuneGDPCommand implements CommandExecutor {
Expand Down Expand Up @@ -64,9 +68,12 @@ public double[] getServerBalance(){

public double getLoanBalance(){
double output = 0.0;
for (String str : Main.loanMap.keySet()){
double[] arr = Main.loanMap.get(str);
output += arr[0];
for (UUID uuid : Main.loanMap.keySet()){
ArrayList<Loan> map = Main.loanMap.get(uuid);
for (Loan loan : map){
output += loan.current_value;
}

}
return output;
}
Expand Down
Loading

0 comments on commit 5f0532c

Please sign in to comment.