mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-26 04:25:15 +01:00
Merge pull request #320 from AddstarMC/master
Add Feature that makes the cap still give reward but exponentially less
This commit is contained in:
commit
18d49a8553
@ -708,7 +708,7 @@ public class Jobs extends JavaPlugin {
|
||||
|
||||
/**
|
||||
* Sets the permission handler
|
||||
* @param h - the permission handler
|
||||
* @param permissionHandler - the permission handler
|
||||
*/
|
||||
public void setPermissionHandler(PermissionHandler permissionHandler) {
|
||||
Jobs.permissionHandler = permissionHandler;
|
||||
@ -907,8 +907,7 @@ public class Jobs extends JavaPlugin {
|
||||
*
|
||||
* Give correct experience and income
|
||||
* @param jPlayer - the player
|
||||
* @param action - the action
|
||||
* @param multiplier - the payment/xp multiplier
|
||||
* @param info - the action
|
||||
*/
|
||||
|
||||
public static void action(JobsPlayer jPlayer, ActionInfo info) {
|
||||
@ -979,9 +978,15 @@ public class Jobs extends JavaPlugin {
|
||||
pointAmount = maxLimit;
|
||||
}
|
||||
}
|
||||
|
||||
if (!jPlayer.isUnderLimit(CurrencyType.MONEY, income)) {
|
||||
if(GconfigManager.useMaxPaymentCurve ){
|
||||
double percentOver =jPlayer.percentOverLimit(CurrencyType.MONEY);
|
||||
float factor = GconfigManager.maxPaymentCurveFactor;
|
||||
double percentLoss = 100/((1/factor*percentOver*percentOver)+1);
|
||||
income = income - (income*percentLoss/100);
|
||||
}else {
|
||||
income = 0D;
|
||||
}
|
||||
if (GconfigManager.getLimit(CurrencyType.MONEY).getStopWith().contains(CurrencyType.POINTS))
|
||||
pointAmount = 0D;
|
||||
}
|
||||
|
@ -25,6 +25,8 @@ import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import com.gamingmesh.jobs.economy.Economy;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
@ -122,9 +124,10 @@ public class GeneralConfigManager {
|
||||
|
||||
public boolean MonsterDamageUse = false;
|
||||
public double MonsterDamagePercentage;
|
||||
|
||||
public double DynamicPaymentMaxPenalty;
|
||||
public double DynamicPaymentMaxBonus;
|
||||
public boolean useMaxPaymentCurve;
|
||||
public float maxPaymentCurveFactor;
|
||||
public double TaxesAmount;
|
||||
public String SoundLevelupSound, SoundTitleChangeSound, ServerAcountName, ServertaxesAcountName;
|
||||
public ArrayList<String> keys;
|
||||
@ -614,7 +617,11 @@ public class GeneralConfigManager {
|
||||
|
||||
DynamicPaymentMaxPenalty = c.get("Economy.DynamicPayment.MaxPenalty", 25.0);
|
||||
DynamicPaymentMaxBonus = c.get("Economy.DynamicPayment.MaxBonus", 100.0);
|
||||
|
||||
c.getW().addComment("Economy.MaxPayment.curve.use", "Enabling this feature will mean players will still earn once they reach cap but " +
|
||||
"will loose a percentage the higher over cap they go. Controlled by a factor. math is ```100/((1/factor*percentOver^2)+1)```");
|
||||
useMaxPaymentCurve = c.get("Economy.MaxPayment.curve.use",false);
|
||||
int temp = c.get("Economy.MaxPayment.curve.factor",10);
|
||||
maxPaymentCurveFactor = ((float)temp)/1000;
|
||||
c.getW().addComment("Economy.UseServerAcount", "Server economy account", "With this enabled, players will get money from defined user (server account)",
|
||||
"If this account don't have enough money to pay for players for, player will get message");
|
||||
UseServerAccount = c.get("Economy.UseServerAcount", false);
|
||||
|
@ -240,6 +240,7 @@ public class LanguageManager {
|
||||
c.get("command.limit.output.pointsLimit", "&ePoint limit: &2%current%&e/&2%total%");
|
||||
c.get("command.limit.output.reachedmoneylimit", "&4You have reached money limit in given time!");
|
||||
c.get("command.limit.output.reachedmoneylimit2", "&eYou can check your limit with &2/jobs limit &ecommand");
|
||||
c.get("command.limit.output.reachedmoneylimit3", "&eMoney earned is now reduced exponentially...but you still earn a little!!");
|
||||
c.get("command.limit.output.reachedexplimit", "&4You have reached exp limit in given time!");
|
||||
c.get("command.limit.output.reachedexplimit2", "&eYou can check your limit with &2/jobs limit &ecommand");
|
||||
c.get("command.limit.output.reachedpointslimit", "&4You have reached exp limit in given time!");
|
||||
|
@ -25,6 +25,7 @@ import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.gamingmesh.jobs.commands.list.info;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -125,9 +126,16 @@ public class JobsPlayer {
|
||||
Integer value = this.limits.get(type);
|
||||
if (data.IsReachedLimit(type, value == null ? 0 : value)) {
|
||||
if (player.isOnline() && !data.isInformed() && !data.isReseted()) {
|
||||
if(Jobs.getGCManager().useMaxPaymentCurve) {
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.limit.output.reached" + type.getName().toLowerCase() + "limit"));
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.limit.output.reached" + type.getName().toLowerCase() + "limit2"));
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.limit.output.reached" + type.getName().toLowerCase() + "limit3"));
|
||||
}else {
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.limit.output.reached" + type.getName().toLowerCase() + "limit"));
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.limit.output.reached" + type.getName().toLowerCase() + "limit2"));
|
||||
}
|
||||
data.setInformed();
|
||||
|
||||
}
|
||||
if (data.IsAnnounceTime(limit.getAnnouncementDelay()) && player.isOnline()) {
|
||||
Jobs.getActionBar().send(player, Jobs.getLanguage().getMessage("command.limit.output." + type.getName().toLowerCase() + "time", "%time%", TimeManage.to24hourShort(data.GetLeftTime(type))));
|
||||
@ -139,6 +147,11 @@ public class JobsPlayer {
|
||||
data.AddAmount(type, amount);
|
||||
return true;
|
||||
}
|
||||
public double percentOverLimit(CurrencyType type){
|
||||
Integer value = this.limits.get(type);
|
||||
PaymentData data = getPaymentLimit();
|
||||
return data.percentOverLimit(type,value == null ? 0 : value);
|
||||
}
|
||||
|
||||
public void loadLogFromDao() {
|
||||
Jobs.getJobsDAO().loadLog(this);
|
||||
@ -684,7 +697,6 @@ public class JobsPlayer {
|
||||
|
||||
/**
|
||||
* Performs player save
|
||||
* @param dao
|
||||
*/
|
||||
public void save() {
|
||||
// synchronized (saveLock) {
|
||||
|
@ -107,6 +107,9 @@ public class PaymentData {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
public double percentOverLimit(CurrencyType type,int limit){
|
||||
return ((this.payments.get(type) / limit)-1)*100;
|
||||
}
|
||||
|
||||
public boolean IsOverTimeLimit(CurrencyType type) {
|
||||
if (this.GetTime(type) + (Jobs.getGCManager().getLimit(type).getTimeLimit() * 1000) > System.currentTimeMillis())
|
||||
|
Loading…
Reference in New Issue
Block a user