mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-03 14:58:34 +01:00
Wrong penalty amount
This commit is contained in:
parent
18112d6129
commit
f7c4afc8dc
@ -405,7 +405,11 @@ public class Jobs extends JavaPlugin {
|
|||||||
* Get the Data Access Object
|
* Get the Data Access Object
|
||||||
* @return the DAO
|
* @return the DAO
|
||||||
*/
|
*/
|
||||||
|
static int ii = 0;
|
||||||
|
|
||||||
public static JobsDAO getJobsDAO() {
|
public static JobsDAO getJobsDAO() {
|
||||||
|
ii++;
|
||||||
|
Debug.D("db access " + ii);
|
||||||
return dao;
|
return dao;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import com.gamingmesh.jobs.Jobs;
|
import com.gamingmesh.jobs.Jobs;
|
||||||
import com.gamingmesh.jobs.resources.jfep.Parser;
|
import com.gamingmesh.jobs.resources.jfep.Parser;
|
||||||
import com.gamingmesh.jobs.stuff.ChatColor;
|
import com.gamingmesh.jobs.stuff.ChatColor;
|
||||||
|
import com.gamingmesh.jobs.stuff.Debug;
|
||||||
|
|
||||||
public class Job {
|
public class Job {
|
||||||
// job info
|
// job info
|
||||||
@ -69,7 +70,7 @@ public class Job {
|
|||||||
private ItemStack GUIitem;
|
private ItemStack GUIitem;
|
||||||
|
|
||||||
private int totalPlayers = -1;
|
private int totalPlayers = -1;
|
||||||
private double bonus = 0.0;
|
private Double bonus = null;
|
||||||
|
|
||||||
private BoostMultiplier boost = new BoostMultiplier();
|
private BoostMultiplier boost = new BoostMultiplier();
|
||||||
|
|
||||||
@ -117,15 +118,15 @@ public class Job {
|
|||||||
public void addBoost(BoostType type, double Point) {
|
public void addBoost(BoostType type, double Point) {
|
||||||
this.boost.add(type, Point - 1D);
|
this.boost.add(type, Point - 1D);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBoost(BoostMultiplier BM) {
|
public void setBoost(BoostMultiplier BM) {
|
||||||
this.boost = BM;
|
this.boost = BM;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BoostMultiplier getBoost() {
|
public BoostMultiplier getBoost() {
|
||||||
return this.boost;
|
return this.boost;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSame(Job job) {
|
public boolean isSame(Job job) {
|
||||||
return this.getName().equalsIgnoreCase(job.getName());
|
return this.getName().equalsIgnoreCase(job.getName());
|
||||||
}
|
}
|
||||||
@ -147,22 +148,21 @@ public class Job {
|
|||||||
if (!Jobs.getGCManager().useDynamicPayment)
|
if (!Jobs.getGCManager().useDynamicPayment)
|
||||||
return;
|
return;
|
||||||
Parser eq = Jobs.getGCManager().DynamicPaymentEquation;
|
Parser eq = Jobs.getGCManager().DynamicPaymentEquation;
|
||||||
eq.setVariable("totalworkers", this.totalPlayers);
|
eq.setVariable("totalworkers", Jobs.getJobsDAO().getTotalPlayers());
|
||||||
eq.setVariable("totaljobs", Jobs.getJobs().size());
|
eq.setVariable("totaljobs", Jobs.getJobs().size());
|
||||||
eq.setVariable("jobstotalplayers", getTotalPlayers());
|
eq.setVariable("jobstotalplayers", getTotalPlayers());
|
||||||
|
|
||||||
double now = eq.getValue();
|
double now = eq.getValue();
|
||||||
if (now > Jobs.getGCManager().DynamicPaymentMaxBonus)
|
if (now > Jobs.getGCManager().DynamicPaymentMaxBonus)
|
||||||
now = Jobs.getGCManager().DynamicPaymentMaxBonus;
|
now = Jobs.getGCManager().DynamicPaymentMaxBonus;
|
||||||
if (now < Jobs.getGCManager().DynamicPaymentMaxPenalty * -1)
|
if (now < Jobs.getGCManager().DynamicPaymentMaxPenalty * -1)
|
||||||
now = Jobs.getGCManager().DynamicPaymentMaxPenalty * -1;
|
now = Jobs.getGCManager().DynamicPaymentMaxPenalty * -1;
|
||||||
this.bonus = now;
|
this.bonus = (now / 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getBonus() {
|
public double getBonus() {
|
||||||
if (this.bonus == 0.0)
|
if (this.bonus == null)
|
||||||
updateBonus();
|
updateBonus();
|
||||||
return this.bonus;
|
return this.bonus == null ? 1D : this.bonus;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getCmdOnJoin() {
|
public List<String> getCmdOnJoin() {
|
||||||
|
Loading…
Reference in New Issue
Block a user