mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-03 14:58:34 +01:00
Changing boost calculation to more clean way and more accurate
This commit is contained in:
parent
d2847dd2fe
commit
e44b208fad
1
com/gamingmesh/jobs/.gitignore
vendored
1
com/gamingmesh/jobs/.gitignore
vendored
@ -7,3 +7,4 @@
|
||||
/PlayerManager$1.class
|
||||
/NMS.class
|
||||
/JobsPlugin.class
|
||||
/PlayerManager$BoostOf.class
|
||||
|
@ -15,6 +15,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.container.ActionType;
|
||||
import com.gamingmesh.jobs.container.Boost;
|
||||
import com.gamingmesh.jobs.container.BoostType;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
import com.gamingmesh.jobs.container.JobInfo;
|
||||
@ -149,9 +150,8 @@ public class GuiManager {
|
||||
ItemStack GuiItem = job.getGuiItem();
|
||||
JobsPlayer JPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
|
||||
|
||||
// money exp boost
|
||||
Double MoneyBoost = JPlayer.getBoost(job.getName(), BoostType.MONEY);
|
||||
Double ExpBoost = JPlayer.getBoost(job.getName(), BoostType.EXP);
|
||||
|
||||
Boost boost = Jobs.getPlayerManager().getFinalBonus(JPlayer, job);
|
||||
|
||||
int level = 1;
|
||||
JobProgression prog = JPlayer.getJobProgression(job);
|
||||
@ -176,11 +176,11 @@ public class GuiManager {
|
||||
String itemName = Jobs.getNameTranslatorManager().Translate(info.get(z).getName(), info.get(z));
|
||||
|
||||
double income = info.get(z).getIncome(level, numjobs);
|
||||
income = income + ((income * MoneyBoost) - income) + ((income * job.getMoneyBoost()) - income);
|
||||
income = income + (income * boost.getFinal(BoostType.MONEY));
|
||||
ChatColor incomeColor = income >= 0 ? ChatColor.GREEN : ChatColor.DARK_RED;
|
||||
|
||||
double xp = info.get(z).getExperience(level, numjobs);
|
||||
xp = xp + ((xp * ExpBoost) - xp) + ((xp * job.getExpBoost()) - xp);
|
||||
xp = xp + (xp * boost.getFinal(BoostType.EXP));
|
||||
ChatColor xpColor = xp >= 0 ? ChatColor.YELLOW : ChatColor.GRAY;
|
||||
|
||||
String xpString = String.format("%.2fxp", xp);
|
||||
|
@ -32,6 +32,8 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
@ -56,7 +58,8 @@ import com.gamingmesh.jobs.config.YmlMaker;
|
||||
import com.gamingmesh.jobs.container.ActionInfo;
|
||||
import com.gamingmesh.jobs.container.ActionType;
|
||||
import com.gamingmesh.jobs.container.BlockProtection;
|
||||
import com.gamingmesh.jobs.container.BoostMultiplier;
|
||||
import com.gamingmesh.jobs.container.Boost;
|
||||
import com.gamingmesh.jobs.container.BoostType;
|
||||
import com.gamingmesh.jobs.container.DBAction;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
import com.gamingmesh.jobs.container.JobInfo;
|
||||
@ -127,11 +130,11 @@ public class Jobs extends JavaPlugin {
|
||||
public static BufferedPaymentThread paymentThread = null;
|
||||
private static DatabaseSaveThread saveTask = null;
|
||||
|
||||
public final static HashMap<String, PaymentData> paymentLimit = new HashMap<String, PaymentData>();
|
||||
public final static HashMap<String, PaymentData> ExpLimit = new HashMap<String, PaymentData>();
|
||||
public final static HashMap<String, PaymentData> PointLimit = new HashMap<String, PaymentData>();
|
||||
public static HashMap<String, PaymentData> paymentLimit = new HashMap<String, PaymentData>();
|
||||
public static HashMap<String, PaymentData> ExpLimit = new HashMap<String, PaymentData>();
|
||||
public static HashMap<String, PaymentData> PointLimit = new HashMap<String, PaymentData>();
|
||||
|
||||
public final static HashMap<String, FastPayment> FastPayment = new HashMap<String, FastPayment>();
|
||||
public static HashMap<String, FastPayment> FastPayment = new HashMap<String, FastPayment>();
|
||||
|
||||
private static NMS nms;
|
||||
|
||||
@ -759,11 +762,24 @@ public class Jobs extends JavaPlugin {
|
||||
* @param action - the action
|
||||
* @param multiplier - the payment/xp multiplier
|
||||
*/
|
||||
public static void action(JobsPlayer jPlayer, ActionInfo info, double multiplier) {
|
||||
action(jPlayer, info, multiplier, null);
|
||||
|
||||
public static void action(JobsPlayer jPlayer, ActionInfo info) {
|
||||
action(jPlayer, info, null, null, null);
|
||||
}
|
||||
|
||||
public static void action(JobsPlayer jPlayer, ActionInfo info, double multiplier, Block block) {
|
||||
public static void action(JobsPlayer jPlayer, ActionInfo info, Block block) {
|
||||
action(jPlayer, info, block, null, null);
|
||||
}
|
||||
|
||||
public static void action(JobsPlayer jPlayer, ActionInfo info, Entity ent) {
|
||||
action(jPlayer, info, null, ent, null);
|
||||
}
|
||||
|
||||
public static void action(JobsPlayer jPlayer, ActionInfo info, Entity ent, LivingEntity victim) {
|
||||
action(jPlayer, info, null, ent, victim);
|
||||
}
|
||||
|
||||
public static void action(JobsPlayer jPlayer, ActionInfo info, Block block, Entity ent, LivingEntity victim) {
|
||||
|
||||
if (jPlayer == null)
|
||||
return;
|
||||
@ -774,76 +790,75 @@ public class Jobs extends JavaPlugin {
|
||||
|
||||
if (numjobs == 0) {
|
||||
|
||||
if (noneJob != null) {
|
||||
JobInfo jobinfo = noneJob.getJobInfo(info, 1);
|
||||
if (noneJob == null)
|
||||
return;
|
||||
JobInfo jobinfo = noneJob.getJobInfo(info, 1);
|
||||
|
||||
if (jobinfo == null)
|
||||
return;
|
||||
if (jobinfo == null)
|
||||
return;
|
||||
|
||||
Double income = jobinfo.getIncome(1, numjobs);
|
||||
Double points = jobinfo.getPoints(1, numjobs);
|
||||
Double income = jobinfo.getIncome(1, numjobs);
|
||||
Double pointAmount = jobinfo.getPoints(1, numjobs);
|
||||
|
||||
if (income != 0D || points != 0D) {
|
||||
if (income != 0D || pointAmount != 0D) {
|
||||
|
||||
// jPlayer
|
||||
BoostMultiplier FinalBoost = pManager.getFinalBonus(jPlayer, Jobs.getNoneJob());
|
||||
Boost boost = pManager.getFinalBonus(jPlayer, Jobs.getNoneJob());
|
||||
|
||||
// Calculate income
|
||||
// Calculate income
|
||||
|
||||
Double amount = 0D;
|
||||
if (income != 0D) {
|
||||
amount = income + (income * FinalBoost.getMoneyBoost() / 100);
|
||||
if (GconfigManager.useMinimumOveralPayment && income > 0) {
|
||||
double maxLimit = income * GconfigManager.MinimumOveralPaymentLimit;
|
||||
if (amount < maxLimit) {
|
||||
amount = maxLimit;
|
||||
}
|
||||
if (income != 0D) {
|
||||
income = income + (income * boost.getFinal(BoostType.MONEY));
|
||||
if (GconfigManager.useMinimumOveralPayment && income > 0) {
|
||||
double maxLimit = income * GconfigManager.MinimumOveralPaymentLimit;
|
||||
if (income < maxLimit) {
|
||||
income = maxLimit;
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate points
|
||||
|
||||
Double pointAmount = 0D;
|
||||
if (points != 0D) {
|
||||
pointAmount = points + (points * FinalBoost.getPointsBoost() / 100);
|
||||
if (GconfigManager.useMinimumOveralPoints && points > 0) {
|
||||
double maxLimit = points * GconfigManager.MinimumOveralPaymentLimit;
|
||||
if (pointAmount < maxLimit) {
|
||||
pointAmount = maxLimit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!isUnderMoneyLimit(jPlayer, amount)) {
|
||||
amount = 0D;
|
||||
if (GconfigManager.MoneyStopPoint)
|
||||
pointAmount = 0D;
|
||||
}
|
||||
|
||||
if (!isUnderPointLimit(jPlayer, pointAmount)) {
|
||||
pointAmount = 0D;
|
||||
if (GconfigManager.PointStopMoney)
|
||||
amount = 0D;
|
||||
}
|
||||
|
||||
if (!isBpOk(jPlayer, info, block))
|
||||
return;
|
||||
|
||||
if (amount == 0D && pointAmount == 0D)
|
||||
return;
|
||||
|
||||
if (info.getType() == ActionType.BREAK && block != null)
|
||||
Jobs.getBpManager().remove(block);
|
||||
|
||||
if (pointAmount != 0D)
|
||||
jPlayer.setSaved(false);
|
||||
|
||||
Jobs.getEconomy().pay(jPlayer, amount, pointAmount, 0.0);
|
||||
|
||||
if (GconfigManager.LoggingUse)
|
||||
loging.recordToLog(jPlayer, info, amount, 0);
|
||||
}
|
||||
|
||||
// Calculate points
|
||||
|
||||
if (pointAmount != 0D) {
|
||||
pointAmount = pointAmount + (pointAmount * boost.getFinal(BoostType.POINTS));
|
||||
if (GconfigManager.useMinimumOveralPoints && pointAmount > 0) {
|
||||
double maxLimit = pointAmount * GconfigManager.MinimumOveralPaymentLimit;
|
||||
if (pointAmount < maxLimit) {
|
||||
pointAmount = maxLimit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!isUnderMoneyLimit(jPlayer, income)) {
|
||||
income = 0D;
|
||||
if (GconfigManager.MoneyStopPoint)
|
||||
pointAmount = 0D;
|
||||
}
|
||||
|
||||
if (!isUnderPointLimit(jPlayer, pointAmount)) {
|
||||
pointAmount = 0D;
|
||||
if (GconfigManager.PointStopMoney)
|
||||
income = 0D;
|
||||
}
|
||||
|
||||
if (!isBpOk(jPlayer, info, block))
|
||||
return;
|
||||
|
||||
if (income == 0D && pointAmount == 0D)
|
||||
return;
|
||||
|
||||
if (info.getType() == ActionType.BREAK && block != null)
|
||||
Jobs.getBpManager().remove(block);
|
||||
|
||||
if (pointAmount != 0D)
|
||||
jPlayer.setSaved(false);
|
||||
|
||||
Jobs.getEconomy().pay(jPlayer, income, pointAmount, 0.0);
|
||||
|
||||
if (GconfigManager.LoggingUse)
|
||||
loging.recordToLog(jPlayer, info, income, 0);
|
||||
}
|
||||
|
||||
} else {
|
||||
for (JobProgression prog : progression) {
|
||||
int level = prog.getLevel();
|
||||
@ -853,10 +868,10 @@ public class Jobs extends JavaPlugin {
|
||||
continue;
|
||||
|
||||
Double income = jobinfo.getIncome(level, numjobs);
|
||||
Double points = jobinfo.getPoints(level, numjobs);
|
||||
Double exp = jobinfo.getExperience(level, numjobs);
|
||||
Double pointAmount = jobinfo.getPoints(level, numjobs);
|
||||
Double expAmount = jobinfo.getExperience(level, numjobs);
|
||||
|
||||
if (income == 0D && points == 0D && exp == 0D)
|
||||
if (income == 0D && pointAmount == 0D && expAmount == 0D)
|
||||
continue;
|
||||
|
||||
if (GconfigManager.addXpPlayer()) {
|
||||
@ -868,10 +883,10 @@ public class Jobs extends JavaPlugin {
|
||||
* That way jobs that give fractions of experience points will slowly give
|
||||
* experience in the aggregate
|
||||
*/
|
||||
int expInt = exp.intValue();
|
||||
double remainder = exp.doubleValue() - expInt;
|
||||
int expInt = expAmount.intValue();
|
||||
double remainder = expAmount.doubleValue() - expInt;
|
||||
if (Math.abs(remainder) > Math.random()) {
|
||||
if (exp.doubleValue() < 0) {
|
||||
if (expAmount.doubleValue() < 0) {
|
||||
expInt--;
|
||||
} else {
|
||||
expInt++;
|
||||
@ -887,35 +902,26 @@ public class Jobs extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
BoostMultiplier FinalBoost = Jobs.getPlayerManager().getFinalBonus(jPlayer, prog.getJob());
|
||||
Boost boost = Jobs.getPlayerManager().getFinalBonus(jPlayer, prog.getJob(), ent, victim);
|
||||
|
||||
if (multiplier != 0.0)
|
||||
FinalBoost = new BoostMultiplier(FinalBoost.getMoneyBoost() + multiplier,
|
||||
FinalBoost.getPointsBoost() + multiplier,
|
||||
FinalBoost.getExpBoost() + multiplier);
|
||||
|
||||
// OfflinePlayer dude = jPlayer.getPlayer();
|
||||
// Debug.D(FinalBoost.getMoneyBoost() + " : " + FinalBoost.getPointsBoost() + " : " + FinalBoost.getExpBoost());
|
||||
|
||||
// Calculate income
|
||||
|
||||
Double amount = 0D;
|
||||
if (income != 0D) {
|
||||
amount = income + (income * FinalBoost.getMoneyBoost() / 100);
|
||||
income = income + (income * boost.getFinal(BoostType.MONEY));
|
||||
if (GconfigManager.useMinimumOveralPayment && income > 0) {
|
||||
double maxLimit = income * GconfigManager.MinimumOveralPaymentLimit;
|
||||
if (amount < maxLimit) {
|
||||
amount = maxLimit;
|
||||
if (income < maxLimit) {
|
||||
income = maxLimit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate points
|
||||
|
||||
Double pointAmount = 0D;
|
||||
if (points != 0D) {
|
||||
pointAmount = points + (points * FinalBoost.getPointsBoost() / 100);
|
||||
if (GconfigManager.useMinimumOveralPoints && points > 0) {
|
||||
double maxLimit = points * GconfigManager.MinimumOveralPaymentLimit;
|
||||
if (pointAmount != 0D) {
|
||||
pointAmount = pointAmount + (pointAmount * boost.getFinal(BoostType.POINTS));
|
||||
if (GconfigManager.useMinimumOveralPoints && pointAmount > 0) {
|
||||
double maxLimit = pointAmount * GconfigManager.MinimumOveralPaymentLimit;
|
||||
if (pointAmount < maxLimit) {
|
||||
pointAmount = maxLimit;
|
||||
}
|
||||
@ -923,17 +929,17 @@ public class Jobs extends JavaPlugin {
|
||||
}
|
||||
|
||||
// Calculate exp
|
||||
double expAmount = exp + (exp * FinalBoost.getExpBoost() / 100);
|
||||
expAmount = expAmount + (expAmount * boost.getFinal(BoostType.EXP));
|
||||
|
||||
if (GconfigManager.useMinimumOveralPayment && exp > 0) {
|
||||
double maxLimit = exp * GconfigManager.MinimumOveralPaymentLimit;
|
||||
if (exp < maxLimit) {
|
||||
exp = maxLimit;
|
||||
if (GconfigManager.useMinimumOveralPayment && expAmount > 0) {
|
||||
double maxLimit = expAmount * GconfigManager.MinimumOveralPaymentLimit;
|
||||
if (expAmount < maxLimit) {
|
||||
expAmount = maxLimit;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isUnderMoneyLimit(jPlayer, amount)) {
|
||||
amount = 0D;
|
||||
if (!isUnderMoneyLimit(jPlayer, income)) {
|
||||
income = 0D;
|
||||
if (GconfigManager.MoneyStopExp)
|
||||
expAmount = 0D;
|
||||
if (GconfigManager.MoneyStopPoint)
|
||||
@ -943,7 +949,7 @@ public class Jobs extends JavaPlugin {
|
||||
if (!isUnderExpLimit(jPlayer, expAmount)) {
|
||||
expAmount = 0D;
|
||||
if (GconfigManager.ExpStopMoney)
|
||||
amount = 0D;
|
||||
income = 0D;
|
||||
if (GconfigManager.ExpStopPoint)
|
||||
pointAmount = 0D;
|
||||
}
|
||||
@ -951,7 +957,7 @@ public class Jobs extends JavaPlugin {
|
||||
if (!isUnderPointLimit(jPlayer, pointAmount)) {
|
||||
pointAmount = 0D;
|
||||
if (GconfigManager.PointStopMoney)
|
||||
amount = 0D;
|
||||
income = 0D;
|
||||
if (GconfigManager.PointStopExp)
|
||||
expAmount = 0D;
|
||||
}
|
||||
@ -959,7 +965,7 @@ public class Jobs extends JavaPlugin {
|
||||
if (!isBpOk(jPlayer, info, block))
|
||||
return;
|
||||
|
||||
if (amount == 0D && pointAmount == 0D && expAmount == 0D)
|
||||
if (income == 0D && pointAmount == 0D && expAmount == 0D)
|
||||
continue;
|
||||
|
||||
try {
|
||||
@ -981,17 +987,19 @@ public class Jobs extends JavaPlugin {
|
||||
else
|
||||
expAmount = JobsExpGainEvent.getExp();
|
||||
|
||||
economy.pay(jPlayer, amount, pointAmount, expAmount);
|
||||
FastPayment.clear();
|
||||
FastPayment.put(jPlayer.getUserName(), new FastPayment(jPlayer, info, new BufferedPayment(jPlayer.getPlayer(), income, pointAmount, expAmount), prog
|
||||
.getJob()));
|
||||
|
||||
economy.pay(jPlayer, income, pointAmount, expAmount);
|
||||
int oldLevel = prog.getLevel();
|
||||
|
||||
if (GconfigManager.LoggingUse)
|
||||
loging.recordToLog(jPlayer, info, amount, expAmount);
|
||||
loging.recordToLog(jPlayer, info, income, expAmount);
|
||||
|
||||
if (prog.addExperience(expAmount))
|
||||
pManager.performLevelUp(jPlayer, prog.getJob(), oldLevel);
|
||||
|
||||
FastPayment.clear();
|
||||
FastPayment.put(jPlayer.getUserName(), new FastPayment(jPlayer, info, new BufferedPayment(jPlayer.getPlayer(), amount, points, exp), prog.getJob()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,12 +30,16 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Tameable;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import com.gamingmesh.jobs.api.JobsJoinEvent;
|
||||
import com.gamingmesh.jobs.api.JobsLeaveEvent;
|
||||
import com.gamingmesh.jobs.api.JobsLevelUpEvent;
|
||||
import com.gamingmesh.jobs.container.Boost;
|
||||
import com.gamingmesh.jobs.container.BoostMultiplier;
|
||||
import com.gamingmesh.jobs.container.BoostType;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
@ -48,6 +52,7 @@ import com.gamingmesh.jobs.dao.JobsDAO;
|
||||
import com.gamingmesh.jobs.dao.JobsDAOData;
|
||||
import com.gamingmesh.jobs.economy.PointsData;
|
||||
import com.gamingmesh.jobs.stuff.ChatColor;
|
||||
import com.gamingmesh.jobs.stuff.Debug;
|
||||
import com.gamingmesh.jobs.stuff.PerformCommands;
|
||||
import com.gamingmesh.jobs.stuff.Perm;
|
||||
|
||||
@ -56,6 +61,7 @@ public class PlayerManager {
|
||||
private ConcurrentHashMap<String, JobsPlayer> playersCache = new ConcurrentHashMap<String, JobsPlayer>();
|
||||
private ConcurrentHashMap<String, JobsPlayer> players = new ConcurrentHashMap<String, JobsPlayer>();
|
||||
private PointsData PointsDatabase = new PointsData();
|
||||
private final String mobSpawnerMetadata = "jobsMobSpawner";
|
||||
|
||||
private HashMap<String, PlayerInfo> PlayerMap = new HashMap<String, PlayerInfo>();
|
||||
Jobs plugin;
|
||||
@ -560,13 +566,20 @@ public class PlayerManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
public double GetBoostInPerc(JobsPlayer player, Job job, BoostType type) {
|
||||
return GetBoostInPerc(player, job, type, false);
|
||||
public BoostMultiplier getBoost(JobsPlayer player, Job job) {
|
||||
BoostMultiplier b = new BoostMultiplier();
|
||||
for (BoostType one : BoostType.values()) {
|
||||
b.add(one, getBoost(player, job, one, false));
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
public double GetBoostInPerc(JobsPlayer player, Job job, BoostType type, boolean force) {
|
||||
double Boost = player.getBoost(job.getName(), type, force) * 100.0 - 100.0;
|
||||
return Boost;
|
||||
public double getBoost(JobsPlayer player, Job job, BoostType type) {
|
||||
return getBoost(player, job, type, false);
|
||||
}
|
||||
|
||||
public double getBoost(JobsPlayer player, Job job, BoostType type, boolean force) {
|
||||
return player.getBoost(job.getName(), type, force);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -590,35 +603,25 @@ public class PlayerManager {
|
||||
}
|
||||
|
||||
public BoostMultiplier getItemBoost(Player player, Job prog) {
|
||||
BoostMultiplier data = new BoostMultiplier(1D, 1D, 1D);
|
||||
BoostMultiplier data = new BoostMultiplier();
|
||||
if (player == null)
|
||||
return data;
|
||||
|
||||
ItemStack iih = Jobs.getNms().getItemInMainHand(player);
|
||||
|
||||
if (iih == null || prog == null)
|
||||
return data;
|
||||
|
||||
BoostMultiplier itemboost = Jobs.getPlayerManager().getItemBoost(prog, iih);
|
||||
|
||||
data = new BoostMultiplier(data.getMoneyBoost() + itemboost.getMoneyBoost(),
|
||||
data.getPointsBoost() + itemboost.getPointsBoost(),
|
||||
data.getExpBoost() + itemboost.getExpBoost());
|
||||
|
||||
data = Jobs.getPlayerManager().getItemBoost(prog, iih);
|
||||
for (ItemStack OneArmor : player.getInventory().getArmorContents()) {
|
||||
BoostMultiplier armorboost = Jobs.getPlayerManager().getItemBoost(prog, OneArmor);
|
||||
data = new BoostMultiplier(data.getMoneyBoost() + armorboost.getMoneyBoost(),
|
||||
data.getPointsBoost() + armorboost.getPointsBoost(),
|
||||
data.getExpBoost() + armorboost.getExpBoost());
|
||||
data.add(armorboost);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public BoostMultiplier getItemBoost(Job prog, ItemStack item) {
|
||||
BoostMultiplier bonus = new BoostMultiplier();
|
||||
if (item == null)
|
||||
return new BoostMultiplier(0D, 0D, 0D);
|
||||
return bonus;
|
||||
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
String name = null;
|
||||
@ -655,52 +658,53 @@ public class PlayerManager {
|
||||
continue main;
|
||||
}
|
||||
|
||||
return new BoostMultiplier(oneItem.getMoneyBoost() - 1D, oneItem.getPointBoost() - 1D, oneItem.getExpBoost() - 1D);
|
||||
return oneItem.getBoost();
|
||||
}
|
||||
|
||||
return new BoostMultiplier(0D, 0D, 0D);
|
||||
return bonus;
|
||||
}
|
||||
|
||||
public BoostMultiplier getFinalBonus(JobsPlayer player, Job prog) {
|
||||
BoostMultiplier multiplier = new BoostMultiplier(0D, 0D, 0D);
|
||||
public enum BoostOf {
|
||||
McMMO, PetPay, NearSpawner, Permission, Global, Dynamic, Item, Area
|
||||
}
|
||||
|
||||
public Boost getFinalBonus(JobsPlayer player, Job prog) {
|
||||
return getFinalBonus(player, prog, null, null);
|
||||
}
|
||||
|
||||
public Boost getFinalBonus(JobsPlayer player, Job prog, Entity ent, LivingEntity victim) {
|
||||
Boost boost = new Boost();
|
||||
|
||||
if (player == null || prog == null)
|
||||
return multiplier;
|
||||
return boost;
|
||||
|
||||
double PMoneyBoost = Jobs.getPlayerManager().GetBoostInPerc(player, prog, BoostType.MONEY);
|
||||
PMoneyBoost = (int) (PMoneyBoost * 100D) / 100D;
|
||||
double PPointBoost = Jobs.getPlayerManager().GetBoostInPerc(player, prog, BoostType.POINTS);
|
||||
PPointBoost = (int) (PPointBoost * 100D) / 100D;
|
||||
double PExpBoost = Jobs.getPlayerManager().GetBoostInPerc(player, prog, BoostType.EXP);
|
||||
PExpBoost = (int) (PExpBoost * 100D) / 100D;
|
||||
if (Jobs.getMcMMOlistener().mcMMOPresent)
|
||||
boost.add(BoostOf.McMMO, new BoostMultiplier().add(Jobs.getMcMMOlistener().getMultiplier(player.getPlayer())));
|
||||
|
||||
double GMoneyBoost = prog.getMoneyBoost() * 100.0 - 100.0;
|
||||
GMoneyBoost = (int) (GMoneyBoost * 100D) / 100D;
|
||||
double GPointBoost = prog.getPointBoost() * 100.0 - 100.0;
|
||||
GPointBoost = (int) (GPointBoost * 100D) / 100D;
|
||||
double GExpBoost = prog.getExpBoost() * 100.0 - 100.0;
|
||||
GExpBoost = (int) (GExpBoost * 100D) / 100D;
|
||||
if (ent != null && ent instanceof Tameable) {
|
||||
Tameable t = (Tameable) ent;
|
||||
if (t.isTamed() && t.getOwner() instanceof Player) {
|
||||
Player pDamager = (Player) t.getOwner();
|
||||
double PetPayMultiplier = 0D;
|
||||
if (Perm.hasPermission(pDamager, "jobs.petpay") || Perm.hasPermission(pDamager, "jobs.vippetpay"))
|
||||
PetPayMultiplier = Jobs.getGCManager().VipPetPay;
|
||||
else
|
||||
PetPayMultiplier = Jobs.getGCManager().PetPay;
|
||||
boost.add(BoostOf.PetPay, new BoostMultiplier().add(PetPayMultiplier));
|
||||
}
|
||||
}
|
||||
|
||||
double DBoost = (int) (prog.getBonus() * 100D) / 100D;
|
||||
if (!Jobs.getGCManager().useDynamicPayment)
|
||||
DBoost = 0.0;
|
||||
if (victim != null && victim.hasMetadata(this.getMobSpawnerMetadata()))
|
||||
boost.add(BoostOf.NearSpawner, new BoostMultiplier().add(player.getVipSpawnerMultiplier()));
|
||||
boost.add(BoostOf.Permission, Jobs.getPlayerManager().getBoost(player, prog));
|
||||
boost.add(BoostOf.Global, prog.getBoost());
|
||||
if (Jobs.getGCManager().useDynamicPayment)
|
||||
boost.add(BoostOf.Dynamic, new BoostMultiplier().add(prog.getBonus()));
|
||||
boost.add(BoostOf.Item, Jobs.getPlayerManager().getItemBoost(player.getPlayer(), prog));
|
||||
boost.add(BoostOf.Item, Jobs.getPlayerManager().getItemBoost(player.getPlayer(), prog));
|
||||
boost.add(BoostOf.Area, new BoostMultiplier().add(Jobs.getRestrictedAreaManager().getRestrictedMultiplier(player.getPlayer())));
|
||||
|
||||
BoostMultiplier itemboost = Jobs.getPlayerManager().getItemBoost(player.getPlayer(), prog);
|
||||
|
||||
double IMoneyBoost = itemboost.getMoneyBoost() * 100.0 - 100.0;
|
||||
IMoneyBoost = (int) (IMoneyBoost * 100D) / 100D;
|
||||
double IPointBoost = itemboost.getPointsBoost() * 100.0 - 100.0;
|
||||
IPointBoost = (int) (IPointBoost * 100D) / 100D;
|
||||
double IExpBoost = itemboost.getExpBoost() * 100.0 - 100.0;
|
||||
IExpBoost = (int) (IExpBoost * 100D) / 100D;
|
||||
|
||||
double RBoost = Jobs.getRestrictedAreaManager().getRestrictedMultiplier(player.getPlayer()) * 100.0 - 100.0;
|
||||
RBoost = (int) (RBoost * 100D) / 100D;
|
||||
|
||||
double Fmoney = (int) ((IMoneyBoost + DBoost + GMoneyBoost + PMoneyBoost + RBoost) * 100) / 100D;
|
||||
double Fpoints = (int) ((IPointBoost + DBoost + GPointBoost + PPointBoost + RBoost) * 100) / 100D;
|
||||
double Fexp = (int) ((IExpBoost + DBoost + GExpBoost + PExpBoost + RBoost) * 100) / 100D;
|
||||
|
||||
return new BoostMultiplier(Fmoney, Fpoints, Fexp);
|
||||
return boost;
|
||||
}
|
||||
|
||||
public void AutoJoinJobs(final Player player) {
|
||||
@ -736,4 +740,8 @@ public class PlayerManager {
|
||||
}
|
||||
}, Jobs.getGCManager().AutoJobJoinDelay * 20L);
|
||||
}
|
||||
|
||||
public String getMobSpawnerMetadata() {
|
||||
return mobSpawnerMetadata;
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,8 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.container.ActionType;
|
||||
import com.gamingmesh.jobs.container.BoostMultiplier;
|
||||
import com.gamingmesh.jobs.container.Boost;
|
||||
import com.gamingmesh.jobs.container.BoostType;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
import com.gamingmesh.jobs.container.JobInfo;
|
||||
import com.gamingmesh.jobs.container.JobProgression;
|
||||
@ -374,14 +375,14 @@ public class JobsCommands implements CommandExecutor {
|
||||
}
|
||||
}
|
||||
|
||||
if (job.getExpBoost() != 1.0)
|
||||
message.append(ChatColor.GOLD + Jobs.getLanguage().getMessage("command.expboost.output.infostats", "%boost%", job.getExpBoost()) + "\n");
|
||||
if (job.getBoost().get(BoostType.EXP) != 1.0)
|
||||
message.append(ChatColor.GOLD + Jobs.getLanguage().getMessage("command.expboost.output.infostats", "%boost%", job.getBoost().get(BoostType.EXP)) + "\n");
|
||||
|
||||
if (job.getMoneyBoost() != 1.0)
|
||||
message.append(ChatColor.GOLD + Jobs.getLanguage().getMessage("command.moneyboost.output.infostats", "%boost%", job.getMoneyBoost()) + "\n");
|
||||
if (job.getBoost().get(BoostType.MONEY) != 1.0)
|
||||
message.append(ChatColor.GOLD + Jobs.getLanguage().getMessage("command.moneyboost.output.infostats", "%boost%", job.getBoost().get(BoostType.MONEY)) + "\n");
|
||||
|
||||
if (job.getPointBoost() != 1.0)
|
||||
message.append(ChatColor.GOLD + Jobs.getLanguage().getMessage("command.pointboost.output.infostats", "%boost%", job.getPointBoost()) + "\n");
|
||||
if (job.getBoost().get(BoostType.POINTS) != 1.0)
|
||||
message.append(ChatColor.GOLD + Jobs.getLanguage().getMessage("command.pointboost.output.infostats", "%boost%", job.getBoost().get(BoostType.POINTS)) + "\n");
|
||||
|
||||
if (Jobs.getGCManager().useDynamicPayment)
|
||||
if (job.getBonus() < 0)
|
||||
@ -486,7 +487,7 @@ public class JobsCommands implements CommandExecutor {
|
||||
public static String jobInfoMessage(JobsPlayer player, Job job, ActionType type) {
|
||||
|
||||
// money exp boost
|
||||
BoostMultiplier finalBoost = Jobs.getPlayerManager().getFinalBonus(player, job);
|
||||
Boost boost = Jobs.getPlayerManager().getFinalBonus(player, job);
|
||||
|
||||
StringBuilder message = new StringBuilder();
|
||||
|
||||
@ -511,15 +512,15 @@ public class JobsCommands implements CommandExecutor {
|
||||
|
||||
// Jobs.getPlayerManager().getFinalBonus(player, prog)
|
||||
|
||||
income = income + (income * finalBoost.getMoneyBoost() / 100);
|
||||
income = income + (income * boost.getFinal(BoostType.MONEY));
|
||||
String incomeColor = income >= 0 ? "" : ChatColor.DARK_RED.toString();
|
||||
|
||||
double xp = info.getExperience(level, numjobs);
|
||||
xp = xp + (xp * finalBoost.getExpBoost() / 100);
|
||||
xp = xp + (xp * boost.getFinal(BoostType.EXP));
|
||||
String xpColor = xp >= 0 ? "" : ChatColor.GRAY.toString();
|
||||
|
||||
double points = info.getPoints(level, numjobs);
|
||||
points = points + (points * finalBoost.getPointsBoost() / 100);
|
||||
points = points + (points * boost.getFinal(BoostType.POINTS));
|
||||
String pointsColor = xp >= 0 ? "" : ChatColor.RED.toString();
|
||||
|
||||
if (income == 0D && points == 0D && xp == 0D)
|
||||
|
@ -3,8 +3,10 @@ package com.gamingmesh.jobs.commands.list;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.PlayerManager.BoostOf;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.commands.JobCommand;
|
||||
import com.gamingmesh.jobs.container.Boost;
|
||||
import com.gamingmesh.jobs.container.BoostMultiplier;
|
||||
import com.gamingmesh.jobs.container.BoostType;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
@ -40,71 +42,46 @@ public class bonus implements Cmd {
|
||||
if (jPlayer == null)
|
||||
return false;
|
||||
|
||||
// sender.sendMessage(Jobs.getLanguage().getMessage("general.info.toplineseparator", "%playername%", job.getChatColor() + job.getName()));
|
||||
double PMoneyBoost = Jobs.getPlayerManager().GetBoostInPerc(jPlayer, job, BoostType.MONEY, true);
|
||||
PMoneyBoost = (int) (PMoneyBoost * 100D) / 100D;
|
||||
double PPointBoost = Jobs.getPlayerManager().GetBoostInPerc(jPlayer, job, BoostType.POINTS, true);
|
||||
PPointBoost = (int) (PPointBoost * 100D) / 100D;
|
||||
double PExpBoost = Jobs.getPlayerManager().GetBoostInPerc(jPlayer, job, BoostType.EXP, true);
|
||||
PExpBoost = (int) (PExpBoost * 100D) / 100D;
|
||||
|
||||
double GMoneyBoost = job.getMoneyBoost() * 100.0 - 100.0;
|
||||
GMoneyBoost = (int) (GMoneyBoost * 100D) / 100D;
|
||||
double GPointBoost = job.getPointBoost() * 100.0 - 100.0;
|
||||
GPointBoost = (int) (GPointBoost * 100D) / 100D;
|
||||
double GExpBoost = job.getExpBoost() * 100.0 - 100.0;
|
||||
GExpBoost = (int) (GExpBoost * 100D) / 100D;
|
||||
|
||||
double DBoost = (int) (job.getBonus() * 100D) / 100D;
|
||||
|
||||
BoostMultiplier itemboost = Jobs.getPlayerManager().getItemBoost(player, job);
|
||||
|
||||
double IMoneyBoost = itemboost.getMoneyBoost() * 100.0 - 100.0;
|
||||
IMoneyBoost = (int) (IMoneyBoost * 100D) / 100D;
|
||||
double IPointBoost = itemboost.getPointsBoost() * 100.0 - 100.0;
|
||||
IPointBoost = (int) (IPointBoost * 100D) / 100D;
|
||||
double IExpBoost = itemboost.getExpBoost() * 100.0 - 100.0;
|
||||
IExpBoost = (int) (IExpBoost * 100D) / 100D;
|
||||
|
||||
double RBoost = Jobs.getRestrictedAreaManager().getRestrictedMultiplier(player) * 100.0 - 100.0;
|
||||
RBoost = (int) (RBoost * 100D) / 100D;
|
||||
Boost boost = Jobs.getPlayerManager().getFinalBonus(jPlayer, job);
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.bonus.output.topline"));
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.bonus.output.permission",
|
||||
"%money%", ChatColor.DARK_GREEN.toString() + formatText(PMoneyBoost),
|
||||
"%points%", ChatColor.GOLD.toString() + formatText(PPointBoost),
|
||||
"%exp%", ChatColor.YELLOW.toString() + formatText(PExpBoost)));
|
||||
"%money%", ChatColor.DARK_GREEN.toString() + formatText(boost.get(BoostOf.Permission, BoostType.MONEY, true)),
|
||||
"%points%", ChatColor.GOLD.toString() + formatText(boost.get(BoostOf.Permission, BoostType.POINTS, true)),
|
||||
"%exp%", ChatColor.YELLOW.toString() + formatText(boost.get(BoostOf.Permission, BoostType.EXP, true))));
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.bonus.output.item",
|
||||
"%money%", ChatColor.DARK_GREEN.toString() + formatText(IMoneyBoost),
|
||||
"%points%", ChatColor.GOLD.toString() + formatText(IPointBoost),
|
||||
"%exp%", ChatColor.YELLOW.toString() + formatText(IExpBoost)));
|
||||
"%money%", ChatColor.DARK_GREEN.toString() + formatText(boost.get(BoostOf.Item, BoostType.MONEY, true)),
|
||||
"%points%", ChatColor.GOLD.toString() + formatText(boost.get(BoostOf.Item, BoostType.POINTS, true)),
|
||||
"%exp%", ChatColor.YELLOW.toString() + formatText(boost.get(BoostOf.Item, BoostType.EXP, true))));
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.bonus.output.global",
|
||||
"%money%", ChatColor.DARK_GREEN.toString() + formatText(GMoneyBoost),
|
||||
"%points%", ChatColor.GOLD.toString() + formatText(GPointBoost),
|
||||
"%exp%", ChatColor.YELLOW.toString() + formatText(GExpBoost)));
|
||||
"%money%", ChatColor.DARK_GREEN.toString() + formatText(boost.get(BoostOf.Global, BoostType.MONEY, true)),
|
||||
"%points%", ChatColor.GOLD.toString() + formatText(boost.get(BoostOf.Global, BoostType.POINTS, true)),
|
||||
"%exp%", ChatColor.YELLOW.toString() + formatText(boost.get(BoostOf.Global, BoostType.EXP, true))));
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.bonus.output.dynamic",
|
||||
"%money%", ChatColor.DARK_GREEN.toString() + formatText(DBoost),
|
||||
"%points%", ChatColor.GOLD.toString() + formatText(DBoost),
|
||||
"%exp%", ChatColor.YELLOW.toString() + formatText(DBoost)));
|
||||
"%money%", ChatColor.DARK_GREEN.toString() + formatText(boost.get(BoostOf.Dynamic, BoostType.MONEY, true)),
|
||||
"%points%", ChatColor.GOLD.toString() + formatText(boost.get(BoostOf.Dynamic, BoostType.POINTS, true)),
|
||||
"%exp%", ChatColor.YELLOW.toString() + formatText(boost.get(BoostOf.Dynamic, BoostType.EXP, true))));
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.bonus.output.area",
|
||||
"%money%", ChatColor.DARK_GREEN.toString() + formatText(RBoost),
|
||||
"%points%", ChatColor.GOLD.toString() + formatText(RBoost),
|
||||
"%exp%", ChatColor.YELLOW.toString() + formatText(RBoost)));
|
||||
"%money%", ChatColor.DARK_GREEN.toString() + formatText(boost.get(BoostOf.Area, BoostType.MONEY, true)),
|
||||
"%points%", ChatColor.GOLD.toString() + formatText(boost.get(BoostOf.Area, BoostType.POINTS, true)),
|
||||
"%exp%", ChatColor.YELLOW.toString() + formatText(boost.get(BoostOf.Area, BoostType.EXP, true))));
|
||||
|
||||
double Fmoney = Math.rint((IMoneyBoost + DBoost + GMoneyBoost + PMoneyBoost + RBoost) * 100) / 100;
|
||||
double Fpoints = Math.rint((IPointBoost + DBoost + GPointBoost + PPointBoost + RBoost) * 100) / 100;
|
||||
double Fexp = Math.rint((IExpBoost + DBoost + GExpBoost + PExpBoost + RBoost) * 100) / 100;
|
||||
if (Jobs.getMcMMOlistener().mcMMOPresent && boost.get(BoostOf.McMMO, BoostType.EXP) != 0D)
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.bonus.output.mcmmo",
|
||||
"%money%", ChatColor.DARK_GREEN.toString() + formatText(boost.get(BoostOf.McMMO, BoostType.MONEY, true)),
|
||||
"%points%", ChatColor.GOLD.toString() + formatText(boost.get(BoostOf.McMMO, BoostType.POINTS, true)),
|
||||
"%exp%", ChatColor.YELLOW.toString() + formatText(boost.get(BoostOf.McMMO, BoostType.EXP, true))));
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.info.separator"));
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.bonus.output.final",
|
||||
"%money%", ChatColor.DARK_GREEN.toString() + formatText(Fmoney),
|
||||
"%points%", ChatColor.GOLD.toString() + formatText(Fpoints),
|
||||
"%exp%", ChatColor.YELLOW.toString() + formatText(Fexp)));
|
||||
"%money%", ChatColor.DARK_GREEN.toString() + formatText(boost.getFinal(BoostType.MONEY, true)),
|
||||
"%points%", ChatColor.GOLD.toString() + formatText(boost.getFinal(BoostType.POINTS, true)),
|
||||
"%exp%", ChatColor.YELLOW.toString() + formatText(boost.getFinal(BoostType.EXP, true))));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import org.bukkit.command.CommandSender;
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.commands.JobCommand;
|
||||
import com.gamingmesh.jobs.container.BoostType;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
import com.gamingmesh.jobs.stuff.ChatColor;
|
||||
|
||||
@ -38,7 +39,7 @@ public class expboost implements Cmd {
|
||||
|
||||
if (args[0].equalsIgnoreCase("reset") && args[1].equalsIgnoreCase("all")) {
|
||||
for (Job one : Jobs.getJobs()) {
|
||||
one.setExpBoost(1.0);
|
||||
one.addBoost(BoostType.EXP, 1.0);
|
||||
}
|
||||
sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.expboost.output.allreset"));
|
||||
return true;
|
||||
@ -46,7 +47,7 @@ public class expboost implements Cmd {
|
||||
boolean found = false;
|
||||
for (Job one : Jobs.getJobs()) {
|
||||
if (one.getName().equalsIgnoreCase(args[1])) {
|
||||
one.setExpBoost(1.0);
|
||||
one.addBoost(BoostType.EXP, 1.0);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
@ -61,7 +62,7 @@ public class expboost implements Cmd {
|
||||
if (args[0].equalsIgnoreCase("all")) {
|
||||
|
||||
for (Job one : Jobs.getJobs()) {
|
||||
one.setExpBoost(rate);
|
||||
one.addBoost(BoostType.EXP, rate);
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.expboost.output.boostalladded", "%boost%", rate));
|
||||
@ -71,7 +72,7 @@ public class expboost implements Cmd {
|
||||
sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("general.error.job"));
|
||||
return true;
|
||||
}
|
||||
job.setExpBoost(rate);
|
||||
job.addBoost(BoostType.EXP, rate);
|
||||
sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.expboost.output.boostadded", "%boost%", rate, "%jobname%", job.getName()));
|
||||
return true;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import org.bukkit.command.CommandSender;
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.commands.JobCommand;
|
||||
import com.gamingmesh.jobs.container.BoostType;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
import com.gamingmesh.jobs.stuff.ChatColor;
|
||||
|
||||
@ -39,7 +40,7 @@ public class moneyboost implements Cmd {
|
||||
|
||||
if (args[0].equalsIgnoreCase("reset") && args[1].equalsIgnoreCase("all")) {
|
||||
for (Job one : Jobs.getJobs()) {
|
||||
one.setMoneyBoost(1.0);
|
||||
one.addBoost(BoostType.MONEY, 1.0);
|
||||
}
|
||||
sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.moneyboost.output.allreset"));
|
||||
return true;
|
||||
@ -47,7 +48,7 @@ public class moneyboost implements Cmd {
|
||||
boolean found = false;
|
||||
for (Job one : Jobs.getJobs()) {
|
||||
if (one.getName().equalsIgnoreCase(args[1])) {
|
||||
one.setMoneyBoost(1.0);
|
||||
one.addBoost(BoostType.MONEY, 1.0);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
@ -62,7 +63,7 @@ public class moneyboost implements Cmd {
|
||||
if (args[0].equalsIgnoreCase("all")) {
|
||||
|
||||
for (Job one : Jobs.getJobs()) {
|
||||
one.setMoneyBoost(rate);
|
||||
one.addBoost(BoostType.MONEY, rate);
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.moneyboost.output.boostalladded", "%boost%", rate));
|
||||
@ -72,7 +73,7 @@ public class moneyboost implements Cmd {
|
||||
sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("general.error.job"));
|
||||
return true;
|
||||
}
|
||||
job.setMoneyBoost(rate);
|
||||
job.addBoost(BoostType.MONEY, rate);
|
||||
sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.moneyboost.output.boostadded", "%boost%", rate, "%jobname%", job.getName()));
|
||||
return true;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import org.bukkit.command.CommandSender;
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.commands.JobCommand;
|
||||
import com.gamingmesh.jobs.container.BoostType;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
import com.gamingmesh.jobs.stuff.ChatColor;
|
||||
|
||||
@ -39,7 +40,7 @@ public class pointboost implements Cmd {
|
||||
|
||||
if (args[0].equalsIgnoreCase("reset") && args[1].equalsIgnoreCase("all")) {
|
||||
for (Job one : Jobs.getJobs()) {
|
||||
one.setPointBoost(1.0);
|
||||
one.addBoost(BoostType.POINTS, 1.0);
|
||||
}
|
||||
sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.pointboost.output.allreset"));
|
||||
return true;
|
||||
@ -47,7 +48,7 @@ public class pointboost implements Cmd {
|
||||
boolean found = false;
|
||||
for (Job one : Jobs.getJobs()) {
|
||||
if (one.getName().equalsIgnoreCase(args[1])) {
|
||||
one.setPointBoost(1.0);
|
||||
one.addBoost(BoostType.POINTS, 1.0);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
@ -62,7 +63,7 @@ public class pointboost implements Cmd {
|
||||
if (args[0].equalsIgnoreCase("all")) {
|
||||
|
||||
for (Job one : Jobs.getJobs()) {
|
||||
one.setPointBoost(rate);
|
||||
one.addBoost(BoostType.POINTS, rate);
|
||||
}
|
||||
|
||||
sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.pointboost.output.boostalladded", "%boost%", rate));
|
||||
@ -72,7 +73,7 @@ public class pointboost implements Cmd {
|
||||
sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("general.error.job"));
|
||||
return true;
|
||||
}
|
||||
job.setPointBoost(rate);
|
||||
job.addBoost(BoostType.POINTS, rate);
|
||||
sender.sendMessage(ChatColor.GREEN + Jobs.getLanguage().getMessage("command.pointboost.output.boostadded", "%boost%", rate, "%jobname%", job.getName()));
|
||||
return true;
|
||||
}
|
||||
|
@ -37,6 +37,8 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.container.ActionType;
|
||||
import com.gamingmesh.jobs.container.BoostMultiplier;
|
||||
import com.gamingmesh.jobs.container.BoostType;
|
||||
import com.gamingmesh.jobs.container.DisplayMethod;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
import com.gamingmesh.jobs.container.JobCommands;
|
||||
@ -47,6 +49,7 @@ import com.gamingmesh.jobs.container.JobLimitedItems;
|
||||
import com.gamingmesh.jobs.container.JobPermission;
|
||||
import com.gamingmesh.jobs.resources.jfep.Parser;
|
||||
import com.gamingmesh.jobs.stuff.ChatColor;
|
||||
import com.gamingmesh.jobs.stuff.Debug;
|
||||
|
||||
public class ConfigManager {
|
||||
private Jobs plugin;
|
||||
@ -341,19 +344,15 @@ public class ConfigManager {
|
||||
enchants.put(ench, level);
|
||||
}
|
||||
|
||||
Double moneyBoost = 1D;
|
||||
BoostMultiplier b = new BoostMultiplier();
|
||||
if (itemSection.isDouble("moneyBoost"))
|
||||
moneyBoost = itemSection.getDouble("moneyBoost");
|
||||
|
||||
Double pointBoost = 1D;
|
||||
b.add(BoostType.MONEY, itemSection.getDouble("moneyBoost") - 1);
|
||||
if (itemSection.isDouble("pointBoost"))
|
||||
pointBoost = itemSection.getDouble("pointBoost");
|
||||
|
||||
Double expBoost = 1D;
|
||||
b.add(BoostType.POINTS, itemSection.getDouble("pointBoost") - 1);
|
||||
if (itemSection.isDouble("expBoost"))
|
||||
expBoost = itemSection.getDouble("expBoost");
|
||||
b.add(BoostType.EXP, itemSection.getDouble("expBoost") - 1);
|
||||
|
||||
jobItems.add(new JobItems(node, id, 0, 1, name, lore, enchants, moneyBoost, pointBoost, expBoost));
|
||||
jobItems.add(new JobItems(node, id, 0, 1, name, lore, enchants, b));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -709,8 +709,8 @@ public class GeneralConfigManager {
|
||||
|
||||
c.getW().addComment("ExploitProtections.General.PetPay", "Do you want to pay when players pet kills monster/player", "Can be exploited with mob farms",
|
||||
"0.2 means 20% of original reward", "Optionaly you can give jobs.petpay permission node for specific players/ranks to get paid by VipPetPay multiplier");
|
||||
PetPay = c.get("ExploitProtections.General.PetPay", 0.1);
|
||||
VipPetPay = c.get("ExploitProtections.General.VipPetPay", 1.0);
|
||||
PetPay = c.get("ExploitProtections.General.PetPay", 0.1) - 1D;
|
||||
VipPetPay = c.get("ExploitProtections.General.VipPetPay", 1.0) - 1D;
|
||||
|
||||
c.getW().addComment("ExploitProtections.McMMO", "McMMO abilities");
|
||||
c.getW().addComment("ExploitProtections.McMMO.TreeFellerMultiplier", "Players will get part of money from cutting trees with treefeller ability enabled.",
|
||||
@ -741,9 +741,9 @@ public class GeneralConfigManager {
|
||||
"Use: jobs.boost.[jobname].money or jobs.boost.[jobname].exp or jobs.boost.[jobname].points or jobs.boost.[jobname].all for all of them with specific jobs name.",
|
||||
"Use: jobs.boost.all.money or jobs.boost.all.exp or jobs.boost.all.points or jobs.boost.all.all to get boost for all jobs",
|
||||
"1.25 means that player will get 25% more than others, you can set less than 1 to get less from anothers");
|
||||
Boost.put(BoostType.EXP, c.get("boost.exp", 1.00));
|
||||
Boost.put(BoostType.MONEY, c.get("boost.money", 1.00));
|
||||
Boost.put(BoostType.POINTS, c.get("boost.points", 1.00));
|
||||
Boost.put(BoostType.EXP, c.get("boost.exp", 1D) - 1D);
|
||||
Boost.put(BoostType.MONEY, c.get("boost.money", 1D) - 1D);
|
||||
Boost.put(BoostType.POINTS, c.get("boost.points", 1D) - 1D);
|
||||
|
||||
c.getW().addComment("old-job", "Old job save", "Players can leave job and return later with some level loss during that",
|
||||
"You can fix players level if hes job level is at max level");
|
||||
|
@ -112,6 +112,7 @@ public class LanguageManager {
|
||||
c.get("command.bonus.output.global", " &eGlobal bonus: %money% %points% %exp%");
|
||||
c.get("command.bonus.output.dynamic", " &eDynamic payment bonus: %money% %points% %exp%");
|
||||
c.get("command.bonus.output.area", " &eArea bonus: %money% %points% %exp%");
|
||||
c.get("command.bonus.output.mcmmo", " &eMcMMO bonus: %money% %points% %exp%");
|
||||
c.get("command.bonus.output.final", " &eFinal bonus: %money% %points% %exp%");
|
||||
|
||||
c.get("command.convert.help.info",
|
||||
|
@ -35,7 +35,7 @@ public class RestrictedAreaManager {
|
||||
if (area.inRestrictedArea(player))
|
||||
return area.getMultiplier();
|
||||
}
|
||||
return 1.0;
|
||||
return 0D;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -13,6 +13,8 @@ import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.container.BoostMultiplier;
|
||||
import com.gamingmesh.jobs.container.BoostType;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
import com.gamingmesh.jobs.container.Schedule;
|
||||
import com.gamingmesh.jobs.stuff.ChatColor;
|
||||
@ -90,8 +92,7 @@ public class ScheduleManager {
|
||||
}
|
||||
|
||||
for (Job onejob : one.GetJobs()) {
|
||||
onejob.setExpBoost(one.GetExpBoost());
|
||||
onejob.setMoneyBoost(one.GetMoneyBoost());
|
||||
onejob.setBoost(one.getBoost());
|
||||
}
|
||||
|
||||
one.setBroadcastInfoOn(System.currentTimeMillis() + one.GetBroadcastInterval() * 60 * 1000);
|
||||
@ -109,8 +110,7 @@ public class ScheduleManager {
|
||||
Bukkit.broadcastMessage(oneMsg);
|
||||
}
|
||||
for (Job onejob : one.GetJobs()) {
|
||||
onejob.setExpBoost(1.0);
|
||||
onejob.setMoneyBoost(1.0);
|
||||
onejob.setBoost(new BoostMultiplier());
|
||||
}
|
||||
one.setStoped(true);
|
||||
one.setStarted(false);
|
||||
@ -191,12 +191,6 @@ public class ScheduleManager {
|
||||
if (!path.contains("Jobs") || !path.isList("Jobs"))
|
||||
continue;
|
||||
|
||||
if (!path.contains("Exp") || !path.isDouble("Exp"))
|
||||
continue;
|
||||
|
||||
if (!path.contains("Money") || !path.isDouble("Money"))
|
||||
continue;
|
||||
|
||||
sched.setDays(path.getStringList("Days"));
|
||||
sched.setJobs(path.getStringList("Jobs"));
|
||||
sched.setFrom(Integer.valueOf(path.getString("From").replace(":", "")));
|
||||
@ -220,8 +214,12 @@ public class ScheduleManager {
|
||||
if (path.contains("BroadcastMessage") && path.isList("BroadcastMessage"))
|
||||
sched.setMessageToBroadcast(path.getStringList("BroadcastMessage"), path.getString("From"), path.getString("Until"));
|
||||
|
||||
sched.setExpBoost(path.getDouble("Exp"));
|
||||
sched.setMoneyBoost(path.getDouble("Money"));
|
||||
if (path.contains("Exp") && path.isDouble("Exp"))
|
||||
sched.setBoost(BoostType.EXP, path.getDouble("Exp", 0D));
|
||||
if (path.contains("Money") && path.isDouble("Money"))
|
||||
sched.setBoost(BoostType.MONEY, path.getDouble("Money", 0D));
|
||||
if (path.contains("Points") && path.isDouble("Points"))
|
||||
sched.setBoost(BoostType.POINTS, path.getDouble("Points", 0D));
|
||||
Jobs.getGCManager().BoostSchedule.add(sched);
|
||||
}
|
||||
Bukkit.getConsoleSender().sendMessage(ChatColor.YELLOW + "[Jobs] Loaded " + Jobs.getGCManager().BoostSchedule.size() + " schedulers!");
|
||||
|
@ -20,6 +20,7 @@ import org.bukkit.inventory.meta.EnchantmentStorageMeta;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.container.BoostMultiplier;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
import com.gamingmesh.jobs.container.JobItems;
|
||||
import com.gamingmesh.jobs.container.JobProgression;
|
||||
@ -441,7 +442,7 @@ public class ShopManager {
|
||||
enchants.put(ench, level);
|
||||
}
|
||||
|
||||
items.add(new JobItems(node, id, data, amount, name, lore, enchants, 0, 0, 0));
|
||||
items.add(new JobItems(node, id, data, amount, name, lore, enchants, new BoostMultiplier()));
|
||||
}
|
||||
Sitem.setitems(items);
|
||||
}
|
||||
|
1
com/gamingmesh/jobs/container/.gitignore
vendored
1
com/gamingmesh/jobs/container/.gitignore
vendored
@ -41,3 +41,4 @@
|
||||
/BlockProtection.class
|
||||
/BpDBAction.class
|
||||
/DBAction.class
|
||||
/Boost.class
|
||||
|
59
com/gamingmesh/jobs/container/Boost.java
Normal file
59
com/gamingmesh/jobs/container/Boost.java
Normal file
@ -0,0 +1,59 @@
|
||||
package com.gamingmesh.jobs.container;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.gamingmesh.jobs.PlayerManager.BoostOf;
|
||||
|
||||
public class Boost {
|
||||
|
||||
HashMap<BoostOf, BoostMultiplier> map = new HashMap<BoostOf, BoostMultiplier>();
|
||||
|
||||
public Boost() {
|
||||
for (BoostOf one : BoostOf.values()) {
|
||||
map.put(one, new BoostMultiplier());
|
||||
}
|
||||
}
|
||||
|
||||
public void add(BoostOf boostoff, BoostMultiplier BM) {
|
||||
map.put(boostoff, BM);
|
||||
}
|
||||
|
||||
public BoostMultiplier get(BoostOf boostoff) {
|
||||
if (!map.containsKey(boostoff))
|
||||
return new BoostMultiplier();
|
||||
return map.get(boostoff);
|
||||
}
|
||||
|
||||
public double get(BoostOf boostoff, BoostType BT) {
|
||||
return get(boostoff, BT, false);
|
||||
}
|
||||
|
||||
public double get(BoostOf boostoff, BoostType BT, boolean percent) {
|
||||
if (!map.containsKey(boostoff))
|
||||
return 0D;
|
||||
double r = map.get(boostoff).get(BT);
|
||||
if (r < -1)
|
||||
r = -1;
|
||||
if (percent)
|
||||
return (int)(r * 100);
|
||||
return r;
|
||||
}
|
||||
|
||||
public double getFinal(BoostType BT) {
|
||||
return getFinal(BT, false);
|
||||
}
|
||||
|
||||
public double getFinal(BoostType BT, boolean percent) {
|
||||
double r = 0D;
|
||||
for (BoostOf one : BoostOf.values()) {
|
||||
if (!map.containsKey(one))
|
||||
continue;
|
||||
r += map.get(one).get(BT);
|
||||
}
|
||||
if (r < -1)
|
||||
r = -1;
|
||||
if (percent)
|
||||
return (int)(r * 100);
|
||||
return r;
|
||||
}
|
||||
}
|
@ -1,25 +1,39 @@
|
||||
package com.gamingmesh.jobs.container;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class BoostMultiplier {
|
||||
double money;
|
||||
double points;
|
||||
double exp;
|
||||
|
||||
public BoostMultiplier(double money, double points, double exp) {
|
||||
this.money = money;
|
||||
this.points = points;
|
||||
this.exp = exp;
|
||||
HashMap<BoostType, Double> map = new HashMap<BoostType, Double>();
|
||||
|
||||
public BoostMultiplier() {
|
||||
for (BoostType one : BoostType.values()) {
|
||||
map.put(one, 0D);
|
||||
}
|
||||
}
|
||||
|
||||
public double getMoneyBoost() {
|
||||
return this.money;
|
||||
public BoostMultiplier add(BoostType type, double amount) {
|
||||
map.put(type, amount);
|
||||
return this;
|
||||
}
|
||||
|
||||
public double getPointsBoost() {
|
||||
return this.points;
|
||||
public BoostMultiplier add(double amount) {
|
||||
for (BoostType one : BoostType.values()) {
|
||||
map.put(one, amount);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public double getExpBoost() {
|
||||
return this.exp;
|
||||
public double get(BoostType type) {
|
||||
if (!map.containsKey(type))
|
||||
return 0D;
|
||||
return this.map.get(type);
|
||||
}
|
||||
|
||||
public void add(BoostMultiplier armorboost) {
|
||||
for (BoostType one : BoostType.values()) {
|
||||
double r = armorboost.get(one);
|
||||
map.put(one, get(one) + r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -71,11 +71,7 @@ public class Job {
|
||||
private int totalPlayers = -1;
|
||||
private double bonus = 0.0;
|
||||
|
||||
private double ExpBoost = 1.0;
|
||||
|
||||
private double MoneyBoost = 1.0;
|
||||
|
||||
private double PointBoost = 1.0;
|
||||
private BoostMultiplier boost = new BoostMultiplier();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@ -118,34 +114,22 @@ public class Job {
|
||||
this.GUIitem = GUIitem;
|
||||
}
|
||||
|
||||
public void setPointBoost(double Point) {
|
||||
this.PointBoost = Point;
|
||||
public void addBoost(BoostType type, double Point) {
|
||||
this.boost.add(type, Point - 1D);
|
||||
}
|
||||
|
||||
public void setBoost(BoostMultiplier BM) {
|
||||
this.boost = BM;
|
||||
}
|
||||
|
||||
public BoostMultiplier getBoost() {
|
||||
return this.boost;
|
||||
}
|
||||
|
||||
public boolean isSame(Job job) {
|
||||
return this.getName().equalsIgnoreCase(job.getName());
|
||||
}
|
||||
|
||||
public double getPointBoost() {
|
||||
return this.PointBoost;
|
||||
}
|
||||
|
||||
public void setMoneyBoost(double amount) {
|
||||
this.MoneyBoost = amount;
|
||||
}
|
||||
|
||||
public double getMoneyBoost() {
|
||||
return this.MoneyBoost;
|
||||
}
|
||||
|
||||
public void setExpBoost(double amount) {
|
||||
this.ExpBoost = amount;
|
||||
}
|
||||
|
||||
public double getExpBoost() {
|
||||
return this.ExpBoost;
|
||||
}
|
||||
|
||||
public int getTotalPlayers() {
|
||||
if (this.totalPlayers == -1) {
|
||||
this.totalPlayers = Jobs.getJobsDAO().getTotalPlayerAmountByJobName(this.jobName);
|
||||
@ -223,7 +207,7 @@ public class Job {
|
||||
|
||||
public JobInfo getJobInfo(ActionInfo action, int level) {
|
||||
for (JobInfo info : getJobInfo(action.getType())) {
|
||||
if (info.getName().equalsIgnoreCase(action.getName()) || info.getName().equalsIgnoreCase(action.getNameWithSub())){
|
||||
if (info.getName().equalsIgnoreCase(action.getName()) || info.getName().equalsIgnoreCase(action.getNameWithSub())) {
|
||||
if (!info.isInLevelRange(level))
|
||||
break;
|
||||
return info;
|
||||
|
@ -31,12 +31,9 @@ public class JobItems {
|
||||
private String name;
|
||||
private List<String> lore;
|
||||
private HashMap<Enchantment, Integer> enchants;
|
||||
private Double moneyBoost = 0D;
|
||||
private Double pointBoost = 0D;
|
||||
private Double expBoost = 0D;
|
||||
private BoostMultiplier boostMultiplier = new BoostMultiplier();
|
||||
|
||||
public JobItems(String node, int id, int data, int amount, String name, List<String> lore, HashMap<Enchantment, Integer> enchants, double moneyBoost,
|
||||
double pointBoost, double expBoost) {
|
||||
public JobItems(String node, int id, int data, int amount, String name, List<String> lore, HashMap<Enchantment, Integer> enchants, BoostMultiplier boostMultiplier) {
|
||||
this.node = node;
|
||||
this.id = id;
|
||||
this.data = data;
|
||||
@ -44,9 +41,7 @@ public class JobItems {
|
||||
this.name = name;
|
||||
this.lore = lore;
|
||||
this.enchants = enchants;
|
||||
this.moneyBoost = moneyBoost;
|
||||
this.pointBoost = pointBoost;
|
||||
this.expBoost = expBoost;
|
||||
this.boostMultiplier = boostMultiplier;
|
||||
}
|
||||
|
||||
public String getNode() {
|
||||
@ -77,15 +72,7 @@ public class JobItems {
|
||||
return this.enchants;
|
||||
}
|
||||
|
||||
public Double getMoneyBoost() {
|
||||
return this.moneyBoost;
|
||||
}
|
||||
|
||||
public Double getPointBoost() {
|
||||
return this.pointBoost;
|
||||
}
|
||||
|
||||
public Double getExpBoost() {
|
||||
return this.expBoost;
|
||||
public BoostMultiplier getBoost() {
|
||||
return this.boostMultiplier;
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ public class JobsPlayer {
|
||||
private OfflinePlayer OffPlayer = null;
|
||||
private Player player = null;
|
||||
|
||||
private double VipSpawnerMultiplier = -1;
|
||||
private double VipSpawnerMultiplier = 0D;
|
||||
|
||||
private int MoneyLimit = 0;
|
||||
private int ExpLimit = 0;
|
||||
@ -131,7 +131,7 @@ public class JobsPlayer {
|
||||
*/
|
||||
public double getVipSpawnerMultiplier() {
|
||||
if (this.getPlayer() == null || !this.getPlayer().isOnline())
|
||||
return 1.0;
|
||||
return 0D;
|
||||
if (VipSpawnerMultiplier < 0)
|
||||
updateVipSpawnerMultiplier();
|
||||
return this.VipSpawnerMultiplier;
|
||||
@ -139,9 +139,9 @@ public class JobsPlayer {
|
||||
|
||||
public void updateVipSpawnerMultiplier() {
|
||||
if (Perm.hasPermission(this.player, "jobs.vipspawner"))
|
||||
this.VipSpawnerMultiplier = Jobs.getGCManager().VIPpayNearSpawnerMultiplier;
|
||||
this.VipSpawnerMultiplier = Jobs.getGCManager().VIPpayNearSpawnerMultiplier - 1;
|
||||
else
|
||||
this.VipSpawnerMultiplier = Jobs.getGCManager().payNearSpawnerMultiplier;
|
||||
this.VipSpawnerMultiplier = Jobs.getGCManager().payNearSpawnerMultiplier - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -35,9 +35,9 @@ public class RestrictedArea {
|
||||
private double multiplier;
|
||||
|
||||
public RestrictedArea(Location location1, Location location2, double multiplier) {
|
||||
this.location1 = location1;
|
||||
this.location2 = location2;
|
||||
this.multiplier = multiplier;
|
||||
this.location1 = location1;
|
||||
this.location2 = location2;
|
||||
this.multiplier = multiplier;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -46,7 +46,7 @@ public class RestrictedArea {
|
||||
*/
|
||||
|
||||
public double getMultiplier() {
|
||||
return this.multiplier;
|
||||
return this.multiplier - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -56,14 +56,14 @@ public class RestrictedArea {
|
||||
* @return false - the location is outside the restricted area
|
||||
*/
|
||||
public boolean inRestrictedArea(Player player) {
|
||||
if(isBetween(player.getLocation().getX(), this.location1.getX(), this.location2.getX()) &&
|
||||
isBetween(player.getLocation().getY(), this.location1.getY(), this.location2.getY()) &&
|
||||
isBetween(player.getLocation().getZ(), this.location1.getZ(), this.location2.getZ()) &&
|
||||
this.location1.getWorld().equals(player.getLocation().getWorld()) &&
|
||||
this.location2.getWorld().equals(player.getLocation().getWorld())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
if (isBetween(player.getLocation().getX(), this.location1.getX(), this.location2.getX()) &&
|
||||
isBetween(player.getLocation().getY(), this.location1.getY(), this.location2.getY()) &&
|
||||
isBetween(player.getLocation().getZ(), this.location1.getZ(), this.location2.getZ()) &&
|
||||
this.location1.getWorld().equals(player.getLocation().getWorld()) &&
|
||||
this.location2.getWorld().equals(player.getLocation().getWorld())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -75,11 +75,11 @@ public class RestrictedArea {
|
||||
* @return false - number is out of bounds
|
||||
*/
|
||||
private static boolean isBetween(double number, double bound1, double bound2) {
|
||||
if(bound1 < bound2 && number > bound1 && number < bound2) {
|
||||
return true;
|
||||
} else if (bound1 > bound2 && number < bound1 && number > bound2) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
if (bound1 < bound2 && number > bound1 && number < bound2) {
|
||||
return true;
|
||||
} else if (bound1 > bound2 && number < bound1 && number > bound2) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -18,8 +18,7 @@ public class Schedule {
|
||||
|
||||
boolean nextDay = false;
|
||||
|
||||
double MoneyBoost = 1.0;
|
||||
double ExpBoost = 1.0;
|
||||
BoostMultiplier BM = new BoostMultiplier();
|
||||
|
||||
String Name = null;
|
||||
|
||||
@ -83,20 +82,16 @@ public class Schedule {
|
||||
return this.stoped;
|
||||
}
|
||||
|
||||
public void setMoneyBoost(double MoneyBoost) {
|
||||
this.MoneyBoost = MoneyBoost;
|
||||
public void setBoost(BoostType type, double amount) {
|
||||
this.BM.add(type, amount - 1);
|
||||
}
|
||||
|
||||
public double GetMoneyBoost() {
|
||||
return this.MoneyBoost;
|
||||
public double getBoost(BoostType type) {
|
||||
return this.BM.get(type);
|
||||
}
|
||||
|
||||
public void setExpBoost(double ExpBoost) {
|
||||
this.ExpBoost = ExpBoost;
|
||||
}
|
||||
|
||||
public double GetExpBoost() {
|
||||
return this.ExpBoost;
|
||||
public BoostMultiplier getBoost() {
|
||||
return this.BM;
|
||||
}
|
||||
|
||||
public void setName(String Name) {
|
||||
|
@ -83,14 +83,12 @@ import com.gamingmesh.jobs.container.FastPayment;
|
||||
import com.gamingmesh.jobs.container.JobProgression;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.stuff.ChatColor;
|
||||
import com.gamingmesh.jobs.stuff.Perm;
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
public class JobsPaymentListener implements Listener {
|
||||
private Jobs plugin;
|
||||
private final String furnaceOwnerMetadata = "jobsFurnaceOwner";
|
||||
public final static String brewingOwnerMetadata = "jobsBrewingOwner";
|
||||
private final String mobSpawnerMetadata = "jobsMobSpawner";
|
||||
public static final String BlockMetadata = "BlockOwner";
|
||||
public static final String PlacedBlockMetadata = "JobsBlockOwner";
|
||||
public static final String VegyMetadata = "VegyTimer";
|
||||
@ -157,7 +155,7 @@ public class JobsPaymentListener implements Listener {
|
||||
if (jPlayer == null)
|
||||
return;
|
||||
|
||||
Jobs.action(jPlayer, new EntityActionInfo(cow, ActionType.MILK), 0.0);
|
||||
Jobs.action(jPlayer, new EntityActionInfo(cow, ActionType.MILK));
|
||||
|
||||
Long Timer = System.currentTimeMillis();
|
||||
|
||||
@ -175,8 +173,8 @@ public class JobsPaymentListener implements Listener {
|
||||
Sheep sheep = (Sheep) event.getEntity();
|
||||
|
||||
// mob spawner, no payment or experience
|
||||
if (sheep.hasMetadata(this.mobSpawnerMetadata)) {
|
||||
sheep.removeMetadata(this.mobSpawnerMetadata, this.plugin);
|
||||
if (sheep.hasMetadata(Jobs.getPlayerManager().getMobSpawnerMetadata())) {
|
||||
sheep.removeMetadata(Jobs.getPlayerManager().getMobSpawnerMetadata(), this.plugin);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -201,7 +199,7 @@ public class JobsPaymentListener implements Listener {
|
||||
if (jDamager == null)
|
||||
return;
|
||||
|
||||
Jobs.action(jDamager, new CustomKillInfo(sheep.getColor().name(), ActionType.SHEAR), 0.0);
|
||||
Jobs.action(jDamager, new CustomKillInfo(sheep.getColor().name(), ActionType.SHEAR));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
@ -239,7 +237,7 @@ public class JobsPaymentListener implements Listener {
|
||||
if (contents == null)
|
||||
return;
|
||||
|
||||
Jobs.action(jPlayer, new ItemActionInfo(contents, ActionType.BREW), 0.0);
|
||||
Jobs.action(jPlayer, new ItemActionInfo(contents, ActionType.BREW));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
@ -280,10 +278,6 @@ public class JobsPaymentListener implements Listener {
|
||||
}
|
||||
|
||||
// restricted area multiplier
|
||||
double multiplier = 0.0;
|
||||
|
||||
if (Jobs.getMcMMOlistener().mcMMOPresent)
|
||||
multiplier = Jobs.getMcMMOlistener().getMultiplier(player) * 100 - 100;
|
||||
|
||||
// Item in hand
|
||||
ItemStack item = Jobs.getNms().getItemInMainHand(player);
|
||||
@ -299,7 +293,7 @@ public class JobsPaymentListener implements Listener {
|
||||
return;
|
||||
|
||||
BlockActionInfo bInfo = new BlockActionInfo(block, ActionType.BREAK);
|
||||
Jobs.action(jPlayer, bInfo, multiplier, block);
|
||||
Jobs.action(jPlayer, bInfo, block);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
@ -342,7 +336,7 @@ public class JobsPaymentListener implements Listener {
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
|
||||
if (jPlayer == null)
|
||||
return;
|
||||
Jobs.action(jPlayer, new BlockActionInfo(block, ActionType.PLACE), 0.0, block);
|
||||
Jobs.action(jPlayer, new BlockActionInfo(block, ActionType.PLACE), block);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
@ -368,7 +362,7 @@ public class JobsPaymentListener implements Listener {
|
||||
if (jPlayer == null)
|
||||
return;
|
||||
ItemStack items = ((Item) event.getCaught()).getItemStack();
|
||||
Jobs.action(jPlayer, new ItemActionInfo(items, ActionType.FISH), 0.0);
|
||||
Jobs.action(jPlayer, new ItemActionInfo(items, ActionType.FISH));
|
||||
}
|
||||
}
|
||||
|
||||
@ -382,8 +376,8 @@ public class JobsPaymentListener implements Listener {
|
||||
LivingEntity animal = event.getEntity();
|
||||
|
||||
// mob spawner, no payment or experience
|
||||
if (animal.hasMetadata(this.mobSpawnerMetadata)) {
|
||||
animal.removeMetadata(this.mobSpawnerMetadata, this.plugin);
|
||||
if (animal.hasMetadata(Jobs.getPlayerManager().getMobSpawnerMetadata())) {
|
||||
animal.removeMetadata(Jobs.getPlayerManager().getMobSpawnerMetadata(), this.plugin);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -406,7 +400,7 @@ public class JobsPaymentListener implements Listener {
|
||||
JobsPlayer jDamager = Jobs.getPlayerManager().getJobsPlayer(player);
|
||||
if (jDamager == null)
|
||||
return;
|
||||
Jobs.action(jDamager, new EntityActionInfo(animal, ActionType.TAME), 0.0);
|
||||
Jobs.action(jDamager, new EntityActionInfo(animal, ActionType.TAME));
|
||||
|
||||
}
|
||||
|
||||
@ -460,8 +454,6 @@ public class JobsPaymentListener implements Listener {
|
||||
if (player.getGameMode().equals(GameMode.CREATIVE) && !Jobs.getGCManager().payInCreative())
|
||||
return;
|
||||
|
||||
double multiplier = 0.0;
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
|
||||
|
||||
// Checking if item is been repaired, not crafted. Combining 2 items
|
||||
@ -497,7 +489,7 @@ public class JobsPaymentListener implements Listener {
|
||||
|
||||
if (y == 2) {
|
||||
if (first == second && third == second) {
|
||||
Jobs.action(jPlayer, new ItemActionInfo(resultStack, ActionType.REPAIR), multiplier);
|
||||
Jobs.action(jPlayer, new ItemActionInfo(resultStack, ActionType.REPAIR));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -505,9 +497,9 @@ public class JobsPaymentListener implements Listener {
|
||||
// Check Dyes
|
||||
if (y >= 2) {
|
||||
if ((third == 351 || second == 351) && leather) {
|
||||
Jobs.action(jPlayer, new ItemActionInfo(sourceItems[0], ActionType.DYE), multiplier);
|
||||
Jobs.action(jPlayer, new ItemActionInfo(sourceItems[0], ActionType.DYE));
|
||||
for (ItemStack OneDye : DyeStack) {
|
||||
Jobs.action(jPlayer, new ItemActionInfo(OneDye, ActionType.DYE), multiplier);
|
||||
Jobs.action(jPlayer, new ItemActionInfo(OneDye, ActionType.DYE));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -515,7 +507,7 @@ public class JobsPaymentListener implements Listener {
|
||||
|
||||
// If we need to pay only by each craft action we will skip calculation how much was crafted
|
||||
if (!Jobs.getGCManager().PayForEachCraft) {
|
||||
Jobs.action(jPlayer, new ItemActionInfo(resultStack, ActionType.CRAFT), multiplier);
|
||||
Jobs.action(jPlayer, new ItemActionInfo(resultStack, ActionType.CRAFT));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -525,14 +517,14 @@ public class JobsPaymentListener implements Listener {
|
||||
// Make sure we are actually crafting anything
|
||||
if (hasItems(toCraft))
|
||||
if (event.isShiftClick())
|
||||
schedulePostDetection(player, toCraft, jPlayer, resultStack, multiplier);
|
||||
schedulePostDetection(player, toCraft, jPlayer, resultStack);
|
||||
else {
|
||||
// The items are stored in the cursor. Make sure there's enough space.
|
||||
if (isStackSumLegal(toCraft, toStore)) {
|
||||
int newItemsCount = toCraft.getAmount();
|
||||
while (newItemsCount >= 0) {
|
||||
newItemsCount--;
|
||||
Jobs.action(jPlayer, new ItemActionInfo(resultStack, ActionType.CRAFT), multiplier);
|
||||
Jobs.action(jPlayer, new ItemActionInfo(resultStack, ActionType.CRAFT));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -541,8 +533,7 @@ public class JobsPaymentListener implements Listener {
|
||||
|
||||
// HACK! The API doesn't allow us to easily determine the resulting number of
|
||||
// crafted items, so we're forced to compare the inventory before and after.
|
||||
private Integer schedulePostDetection(final HumanEntity player, final ItemStack compareItem, final JobsPlayer jPlayer, final ItemStack resultStack,
|
||||
final double multiplier) {
|
||||
private Integer schedulePostDetection(final HumanEntity player, final ItemStack compareItem, final JobsPlayer jPlayer, final ItemStack resultStack) {
|
||||
final ItemStack[] preInv = player.getInventory().getContents();
|
||||
// Clone the array. The content may (was for me) be mutable.
|
||||
for (int i = 0; i < preInv.length; i++) {
|
||||
@ -566,7 +557,7 @@ public class JobsPaymentListener implements Listener {
|
||||
if (newItemsCount > 0) {
|
||||
while (newItemsCount >= 0) {
|
||||
newItemsCount--;
|
||||
Jobs.action(jPlayer, new ItemActionInfo(resultStack, ActionType.CRAFT), multiplier);
|
||||
Jobs.action(jPlayer, new ItemActionInfo(resultStack, ActionType.CRAFT));
|
||||
}
|
||||
}
|
||||
return;
|
||||
@ -668,7 +659,7 @@ public class JobsPaymentListener implements Listener {
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
|
||||
if (jPlayer == null)
|
||||
return;
|
||||
Jobs.action(jPlayer, new ItemActionInfo(resultStack, ActionType.REPAIR), 0.0);
|
||||
Jobs.action(jPlayer, new ItemActionInfo(resultStack, ActionType.REPAIR));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
@ -721,9 +712,9 @@ public class JobsPaymentListener implements Listener {
|
||||
if (level == null)
|
||||
continue;
|
||||
|
||||
Jobs.action(jPlayer, new EnchantActionInfo(enchantName, level, ActionType.ENCHANT), 0.0);
|
||||
Jobs.action(jPlayer, new EnchantActionInfo(enchantName, level, ActionType.ENCHANT));
|
||||
}
|
||||
Jobs.action(jPlayer, new ItemActionInfo(resultStack, ActionType.ENCHANT), 0.0);
|
||||
Jobs.action(jPlayer, new ItemActionInfo(resultStack, ActionType.ENCHANT));
|
||||
|
||||
}
|
||||
|
||||
@ -757,7 +748,7 @@ public class JobsPaymentListener implements Listener {
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
|
||||
if (jPlayer == null)
|
||||
return;
|
||||
Jobs.action(jPlayer, new ItemActionInfo(event.getResult(), ActionType.SMELT), 0.0);
|
||||
Jobs.action(jPlayer, new ItemActionInfo(event.getResult(), ActionType.SMELT));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
@ -788,7 +779,7 @@ public class JobsPaymentListener implements Listener {
|
||||
}
|
||||
|
||||
// mob spawner, no payment or experience
|
||||
if (lVictim.hasMetadata(this.mobSpawnerMetadata) && !Jobs.getGCManager().payNearSpawner()) {
|
||||
if (lVictim.hasMetadata(Jobs.getPlayerManager().getMobSpawnerMetadata()) && !Jobs.getGCManager().payNearSpawner()) {
|
||||
//lVictim.removeMetadata(mobSpawnerMetadata, plugin);
|
||||
return;
|
||||
}
|
||||
@ -799,20 +790,11 @@ public class JobsPaymentListener implements Listener {
|
||||
|
||||
Player pDamager = null;
|
||||
|
||||
Double PetPayMultiplier = 0.0;
|
||||
// Checking if killer is player
|
||||
if (e.getDamager() instanceof Player) {
|
||||
pDamager = (Player) e.getDamager();
|
||||
// Checking if killer is tamed animal
|
||||
} else if (e.getDamager() instanceof Tameable) {
|
||||
Tameable t = (Tameable) (e).getDamager();
|
||||
if (t.isTamed() && t.getOwner() instanceof Player) {
|
||||
pDamager = (Player) t.getOwner();
|
||||
if (Perm.hasPermission(pDamager, "jobs.petpay") || Perm.hasPermission(pDamager, "jobs.vippetpay"))
|
||||
PetPayMultiplier = Jobs.getGCManager().VipPetPay * 100 - 100;
|
||||
else
|
||||
PetPayMultiplier = Jobs.getGCManager().PetPay * 100 - 100;
|
||||
}
|
||||
} else if (e.getDamager() instanceof Projectile) {
|
||||
Projectile pr = (Projectile) e.getDamager();
|
||||
if (pr.getShooter() instanceof Player)
|
||||
@ -835,20 +817,13 @@ public class JobsPaymentListener implements Listener {
|
||||
if (jDamager == null)
|
||||
return;
|
||||
|
||||
Double NearSpawnerMultiplier = 0.0;
|
||||
if (lVictim.hasMetadata(this.mobSpawnerMetadata))
|
||||
NearSpawnerMultiplier = jDamager.getVipSpawnerMultiplier() * 100 - 100;
|
||||
|
||||
// Calulating multiplaier
|
||||
double multiplier = NearSpawnerMultiplier + PetPayMultiplier;
|
||||
|
||||
if (lVictim instanceof Player && !lVictim.hasMetadata("NPC")) {
|
||||
Player VPlayer = (Player) lVictim;
|
||||
if (jDamager.getUserName().equalsIgnoreCase(VPlayer.getName()))
|
||||
return;
|
||||
}
|
||||
|
||||
Jobs.action(jDamager, new EntityActionInfo(lVictim, ActionType.KILL), multiplier);
|
||||
Jobs.action(jDamager, new EntityActionInfo(lVictim, ActionType.KILL), e.getDamager(), lVictim);
|
||||
|
||||
// Payment for killing player with particular job, except NPC's
|
||||
if (lVictim instanceof Player && !lVictim.hasMetadata("NPC")) {
|
||||
@ -860,7 +835,7 @@ public class JobsPaymentListener implements Listener {
|
||||
if (jobs == null)
|
||||
return;
|
||||
for (JobProgression job : jobs) {
|
||||
Jobs.action(jDamager, new CustomKillInfo(job.getJob().getName(), ActionType.CUSTOMKILL), multiplier);
|
||||
Jobs.action(jDamager, new CustomKillInfo(job.getJob().getName(), ActionType.CUSTOMKILL), e.getDamager(), lVictim);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -872,7 +847,7 @@ public class JobsPaymentListener implements Listener {
|
||||
return;
|
||||
if (event.getSpawnReason() == SpawnReason.SPAWNER) {
|
||||
LivingEntity creature = event.getEntity();
|
||||
creature.setMetadata(this.mobSpawnerMetadata, new FixedMetadataValue(this.plugin, true));
|
||||
creature.setMetadata(Jobs.getPlayerManager().getMobSpawnerMetadata(), new FixedMetadataValue(this.plugin, true));
|
||||
}
|
||||
}
|
||||
|
||||
@ -881,7 +856,7 @@ public class JobsPaymentListener implements Listener {
|
||||
//disabling plugin in world
|
||||
if (event.getEntity() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getEntity().getWorld()))
|
||||
return;
|
||||
if (!event.getEntity().hasMetadata(this.mobSpawnerMetadata))
|
||||
if (!event.getEntity().hasMetadata(Jobs.getPlayerManager().getMobSpawnerMetadata()))
|
||||
return;
|
||||
|
||||
EntityType type = event.getEntityType();
|
||||
@ -941,7 +916,7 @@ public class JobsPaymentListener implements Listener {
|
||||
JobsPlayer jDamager = Jobs.getPlayerManager().getJobsPlayer(player);
|
||||
if (jDamager == null)
|
||||
return;
|
||||
Jobs.action(jDamager, new EntityActionInfo(animal, ActionType.BREED), 0.0);
|
||||
Jobs.action(jDamager, new EntityActionInfo(animal, ActionType.BREED));
|
||||
}
|
||||
|
||||
}
|
||||
@ -983,7 +958,7 @@ public class JobsPaymentListener implements Listener {
|
||||
if (jPlayer == null)
|
||||
return;
|
||||
|
||||
Jobs.action(jPlayer, new ItemActionInfo(item, ActionType.EAT), 0.0);
|
||||
Jobs.action(jPlayer, new ItemActionInfo(item, ActionType.EAT));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
@ -1045,7 +1020,7 @@ public class JobsPaymentListener implements Listener {
|
||||
return;
|
||||
|
||||
BlockActionInfo bInfo = new BlockActionInfo(block, ActionType.TNTBREAK);
|
||||
Jobs.action(jPlayer, bInfo, 0.0);
|
||||
Jobs.action(jPlayer, bInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1112,6 +1087,6 @@ public class JobsPaymentListener implements Listener {
|
||||
if (jPlayer == null)
|
||||
return;
|
||||
|
||||
Jobs.action(jPlayer, new ExploreActionInfo(String.valueOf(respond.getCount()), ActionType.EXPLORE), 0.0);
|
||||
Jobs.action(jPlayer, new ExploreActionInfo(String.valueOf(respond.getCount()), ActionType.EXPLORE));
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.actions.ItemActionInfo;
|
||||
import com.gamingmesh.jobs.container.ActionType;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.stuff.Debug;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityActivateEvent;
|
||||
import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityDeactivateEvent;
|
||||
@ -56,10 +57,10 @@ public class McMMOlistener implements Listener {
|
||||
return;
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
|
||||
Jobs.action(jPlayer, new ItemActionInfo(resultStack, ActionType.REPAIR), 0.0);
|
||||
Jobs.action(jPlayer, new ItemActionInfo(resultStack, ActionType.REPAIR));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void OnAbilityOn(McMMOPlayerAbilityActivateEvent event) {
|
||||
HashMap<AbilityType, Long> InfoMap = new HashMap<AbilityType, Long>();
|
||||
if (map.containsKey(event.getPlayer().getName()))
|
||||
@ -68,7 +69,7 @@ public class McMMOlistener implements Listener {
|
||||
map.put(event.getPlayer().getName(), InfoMap);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void OnAbilityOff(McMMOPlayerAbilityDeactivateEvent event) {
|
||||
if (map.containsKey(event.getPlayer().getName())) {
|
||||
HashMap<AbilityType, Long> InfoMap = map.get(event.getPlayer().getName());
|
||||
@ -81,30 +82,32 @@ public class McMMOlistener implements Listener {
|
||||
public double getMultiplier(Player player) {
|
||||
|
||||
HashMap<AbilityType, Long> InfoMap = map.get(player.getName());
|
||||
if (InfoMap == null)
|
||||
return 1.0;
|
||||
if (InfoMap == null) {
|
||||
return 0D;
|
||||
}
|
||||
|
||||
Long t = InfoMap.get(AbilityType.TREE_FELLER);
|
||||
if (t != null) {
|
||||
if (t < System.currentTimeMillis())
|
||||
return Jobs.getGCManager().TreeFellerMultiplier;
|
||||
return -(1-Jobs.getGCManager().TreeFellerMultiplier);
|
||||
map.remove(AbilityType.TREE_FELLER);
|
||||
}
|
||||
|
||||
t = InfoMap.get(AbilityType.GIGA_DRILL_BREAKER);
|
||||
if (t != null) {
|
||||
if (t < System.currentTimeMillis())
|
||||
return Jobs.getGCManager().gigaDrillMultiplier;
|
||||
return -(1-Jobs.getGCManager().gigaDrillMultiplier);
|
||||
map.remove(AbilityType.GIGA_DRILL_BREAKER);
|
||||
}
|
||||
|
||||
t = InfoMap.get(AbilityType.SUPER_BREAKER);
|
||||
if (t != null) {
|
||||
if (t < System.currentTimeMillis())
|
||||
return Jobs.getGCManager().superBreakerMultiplier;
|
||||
return -(1-Jobs.getGCManager().superBreakerMultiplier);
|
||||
map.remove(AbilityType.SUPER_BREAKER);
|
||||
}
|
||||
return 1.0;
|
||||
|
||||
return 0D;
|
||||
}
|
||||
|
||||
public boolean CheckmcMMO() {
|
||||
|
@ -3,9 +3,9 @@ package com.gamingmesh.jobs.listeners;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Tameable;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
@ -15,8 +15,6 @@ import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.actions.MMKillInfo;
|
||||
import com.gamingmesh.jobs.container.ActionType;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
import com.gamingmesh.jobs.stuff.Perm;
|
||||
|
||||
import net.elseland.xikage.MythicMobs.MythicMobs;
|
||||
import net.elseland.xikage.MythicMobs.API.MythicMobsAPI;
|
||||
import net.elseland.xikage.MythicMobs.API.Bukkit.Events.MythicMobDeathEvent;
|
||||
@ -47,22 +45,13 @@ public class MythicMobsListener implements Listener {
|
||||
|
||||
Player pDamager = null;
|
||||
|
||||
Double PetPayMultiplier = 0.0;
|
||||
// Checking if killer is player
|
||||
Entity ent = null;
|
||||
if (event.getKiller() instanceof Player)
|
||||
pDamager = (Player) event.getKiller();
|
||||
// Checking if killer is tamed animal
|
||||
else if (event.getEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent) {
|
||||
if (((EntityDamageByEntityEvent) event.getEntity().getLastDamageCause()).getDamager() instanceof Tameable) {
|
||||
Tameable t = (Tameable) ((EntityDamageByEntityEvent) event.getEntity().getLastDamageCause()).getDamager();
|
||||
if (t.isTamed() && t.getOwner() instanceof Player) {
|
||||
pDamager = (Player) t.getOwner();
|
||||
if (Perm.hasPermission(pDamager, "jobs.petpay") || Perm.hasPermission(pDamager, "jobs.vippetpay"))
|
||||
PetPayMultiplier = Jobs.getGCManager().VipPetPay;
|
||||
else
|
||||
PetPayMultiplier = Jobs.getGCManager().PetPay;
|
||||
}
|
||||
}
|
||||
ent = ((EntityDamageByEntityEvent) event.getEntity().getLastDamageCause()).getDamager();
|
||||
} else
|
||||
return;
|
||||
|
||||
@ -81,7 +70,7 @@ public class MythicMobsListener implements Listener {
|
||||
if (jDamager == null)
|
||||
return;
|
||||
|
||||
Jobs.action(jDamager, new MMKillInfo(lVictim.getInternalName(), ActionType.MMKILL), PetPayMultiplier);
|
||||
Jobs.action(jDamager, new MMKillInfo(lVictim.getInternalName(), ActionType.MMKILL), ent);
|
||||
}
|
||||
|
||||
public boolean Check() {
|
||||
|
@ -416,7 +416,9 @@ Jobs:
|
||||
# Money boost: 1.1 is equals 10% more income when 0.9 is equals 10% less from base income
|
||||
moneyBoost: 1.1
|
||||
# Exp boost
|
||||
expBoost: 1.1
|
||||
expBoost: 1.2
|
||||
# Point boost
|
||||
pointBoost: 1.3
|
||||
helmet:
|
||||
# Armor id. This one works with all jobs
|
||||
id: 310
|
||||
|
@ -1,7 +1,7 @@
|
||||
name: Jobs
|
||||
description: Jobs Plugin for the BukkitAPI
|
||||
main: com.gamingmesh.jobs.Jobs
|
||||
version: 3.6.3
|
||||
version: 3.7.0
|
||||
author: phrstbrn
|
||||
depend: [Vault]
|
||||
softdepend: [MythicMobs, McMMO]
|
||||
|
Loading…
Reference in New Issue
Block a user