mirror of
https://github.com/Zrips/Jobs.git
synced 2024-12-30 21:07:48 +01:00
petpay and nearspawner new permissions to control bonus
This commit is contained in:
parent
1af4c554b3
commit
54ce64d13b
@ -915,7 +915,7 @@ public class Jobs extends JavaPlugin {
|
||||
player.giveExp(expInt);
|
||||
}
|
||||
}
|
||||
Boost boost = Jobs.getPlayerManager().getFinalBonus(jPlayer, prog.getJob(), ent, victim, false);
|
||||
Boost boost = Jobs.getPlayerManager().getFinalBonus(jPlayer, prog.getJob(), ent, victim);
|
||||
|
||||
// Calculate income
|
||||
if (income != 0D) {
|
||||
|
@ -51,7 +51,8 @@ public class PermissionManager {
|
||||
jobs_boost_all_exp_AMOUNT(remade("jobs.boost.all.exp.%AMOUNT%"), 60 * 1000),
|
||||
jobs_boost_all_points_AMOUNT(remade("jobs.boost.all.points.%AMOUNT%"), 60 * 1000),
|
||||
jobs_boost_all_all_AMOUNT(remade("jobs.boost.all.all.%AMOUNT%"), 60 * 1000),
|
||||
jobs_max_AMOUNT(remade("jobs.max.%AMOUNT%"), 60 * 1000),
|
||||
jobs_spawner_AMOUNT(remade("jobs.nearspawner.%AMOUNT%"), 60 * 1000),
|
||||
jobs_petpay_AMOUNT(remade("jobs.petpay.%AMOUNT%"), 60 * 1000),
|
||||
// jobs_world_WORLDNAME(remade("jobs.world.%WORLDNAME%"), 60 * 1000)
|
||||
;
|
||||
|
||||
|
@ -734,15 +734,23 @@ public class PlayerManager {
|
||||
McMMO, PetPay, NearSpawner, Permission, Global, Dynamic, Item, Area
|
||||
}
|
||||
|
||||
public Boost getFinalBonus(JobsPlayer player, Job prog, boolean force, boolean getall) {
|
||||
return getFinalBonus(player, prog, null, null, force, getall);
|
||||
}
|
||||
|
||||
public Boost getFinalBonus(JobsPlayer player, Job prog, boolean force) {
|
||||
return getFinalBonus(player, prog, null, null, force);
|
||||
return getFinalBonus(player, prog, null, null, force, false);
|
||||
}
|
||||
|
||||
public Boost getFinalBonus(JobsPlayer player, Job prog) {
|
||||
return getFinalBonus(player, prog, null, null, false);
|
||||
return getFinalBonus(player, prog, null, null, false, false);
|
||||
}
|
||||
|
||||
public Boost getFinalBonus(JobsPlayer player, Job prog, Entity ent, LivingEntity victim, boolean force) {
|
||||
public Boost getFinalBonus(JobsPlayer player, Job prog, Entity ent, LivingEntity victim) {
|
||||
return getFinalBonus(player, prog, ent, victim, false, false);
|
||||
}
|
||||
|
||||
public Boost getFinalBonus(JobsPlayer player, Job prog, Entity ent, LivingEntity victim, boolean force, boolean getall) {
|
||||
Boost boost = new Boost();
|
||||
|
||||
if (player == null || prog == null)
|
||||
@ -754,18 +762,19 @@ public class PlayerManager {
|
||||
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));
|
||||
boost.add(BoostOf.PetPay, new BoostMultiplier().add(Jobs.getPermissionManager().getMaxPermission(player, "jobs.petpay")));
|
||||
}
|
||||
}
|
||||
|
||||
if (victim != null && victim.hasMetadata(this.getMobSpawnerMetadata()))
|
||||
boost.add(BoostOf.NearSpawner, new BoostMultiplier().add(player.getVipSpawnerMultiplier()));
|
||||
if (victim != null && victim.hasMetadata(this.getMobSpawnerMetadata())) {
|
||||
boost.add(BoostOf.NearSpawner, new BoostMultiplier().add(Jobs.getPermissionManager().getMaxPermission(player, "jobs.nearspawner")));
|
||||
}
|
||||
|
||||
if (getall) {
|
||||
boost.add(BoostOf.PetPay, new BoostMultiplier().add(Jobs.getPermissionManager().getMaxPermission(player, "jobs.petpay", force)));
|
||||
boost.add(BoostOf.NearSpawner, new BoostMultiplier().add(Jobs.getPermissionManager().getMaxPermission(player, "jobs.nearspawner", force)));
|
||||
}
|
||||
|
||||
boost.add(BoostOf.Permission, Jobs.getPlayerManager().getBoost(player, prog, force));
|
||||
boost.add(BoostOf.Global, prog.getBoost());
|
||||
if (Jobs.getGCManager().useDynamicPayment)
|
||||
|
@ -6,6 +6,7 @@ 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.ActionType;
|
||||
import com.gamingmesh.jobs.container.Boost;
|
||||
import com.gamingmesh.jobs.container.CurrencyType;
|
||||
import com.gamingmesh.jobs.container.Job;
|
||||
@ -41,7 +42,7 @@ public class bonus implements Cmd {
|
||||
if (jPlayer == null)
|
||||
return false;
|
||||
|
||||
Boost boost = Jobs.getPlayerManager().getFinalBonus(jPlayer, job, true);
|
||||
Boost boost = Jobs.getPlayerManager().getFinalBonus(jPlayer, job, true, true);
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.bonus.output.topline"));
|
||||
|
||||
@ -55,6 +56,20 @@ public class bonus implements Cmd {
|
||||
"%points%", ChatColor.GOLD.toString() + formatText(boost.get(BoostOf.Item, CurrencyType.POINTS, true)),
|
||||
"%exp%", ChatColor.YELLOW.toString() + formatText(boost.get(BoostOf.Item, CurrencyType.EXP, true))));
|
||||
|
||||
if (!job.getJobInfo(ActionType.KILL).isEmpty() || !job.getJobInfo(ActionType.MMKILL).isEmpty()) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.bonus.output.nearspawner",
|
||||
"%money%", ChatColor.DARK_GREEN.toString() + formatText(boost.get(BoostOf.NearSpawner, CurrencyType.MONEY, true)),
|
||||
"%points%", ChatColor.GOLD.toString() + formatText(boost.get(BoostOf.NearSpawner, CurrencyType.POINTS, true)),
|
||||
"%exp%", ChatColor.YELLOW.toString() + formatText(boost.get(BoostOf.NearSpawner, CurrencyType.EXP, true))));
|
||||
}
|
||||
|
||||
if (!job.getJobInfo(ActionType.KILL).isEmpty() || !job.getJobInfo(ActionType.MMKILL).isEmpty()) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.bonus.output.petpay",
|
||||
"%money%", ChatColor.DARK_GREEN.toString() + formatText(boost.get(BoostOf.PetPay, CurrencyType.MONEY, true)),
|
||||
"%points%", ChatColor.GOLD.toString() + formatText(boost.get(BoostOf.PetPay, CurrencyType.POINTS, true)),
|
||||
"%exp%", ChatColor.YELLOW.toString() + formatText(boost.get(BoostOf.PetPay, CurrencyType.EXP, true))));
|
||||
}
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.bonus.output.global",
|
||||
"%money%", ChatColor.DARK_GREEN.toString() + formatText(boost.get(BoostOf.Global, CurrencyType.MONEY, true)),
|
||||
"%points%", ChatColor.GOLD.toString() + formatText(boost.get(BoostOf.Global, CurrencyType.POINTS, true)),
|
||||
|
@ -11,6 +11,7 @@ import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.container.ExploreChunk;
|
||||
import com.gamingmesh.jobs.container.ExploreRegion;
|
||||
import com.gamingmesh.jobs.container.ExploreRespond;
|
||||
import com.gamingmesh.jobs.stuff.Debug;
|
||||
|
||||
public class ExploreManager {
|
||||
|
||||
|
@ -79,7 +79,7 @@ public class GeneralConfigManager {
|
||||
UseJobsBrowse, PreventSlimeSplit, PreventMagmaCubeSplit;
|
||||
public int globalblocktimer, CowMilkingTimer,
|
||||
CoreProtectInterval, BlockPlaceInterval, InfoUpdateInterval;
|
||||
public Double payNearSpawnerMultiplier, VIPpayNearSpawnerMultiplier, TreeFellerMultiplier, gigaDrillMultiplier, superBreakerMultiplier, PetPay, VipPetPay;
|
||||
public Double TreeFellerMultiplier, gigaDrillMultiplier, superBreakerMultiplier;
|
||||
public String localeString = "EN";
|
||||
|
||||
public boolean useBlockProtection;
|
||||
@ -482,14 +482,6 @@ public class GeneralConfigManager {
|
||||
c.getW().addComment("enable-pay-near-spawner", "Option to allow payment to be made when killing mobs from a spawner");
|
||||
payNearSpawner = c.get("enable-pay-near-spawner", false);
|
||||
|
||||
c.getW().addComment("pay-near-spawner-multiplier", "enable-pay-near-spawner should be enabled for this to work",
|
||||
"0.5 means that players will get only 50% exp/money from monsters spawned from spawner");
|
||||
payNearSpawnerMultiplier = c.get("pay-near-spawner-multiplier", 1.0);
|
||||
|
||||
c.getW().addComment("VIP-pay-near-spawner-multiplier", "VIP multiplier to pay for monsters from spawners, this will ignore global multiplier",
|
||||
"Use jobs.vipspawner permission node for this to be enabled");
|
||||
VIPpayNearSpawnerMultiplier = c.get("VIP-pay-near-spawner-multiplier", 1.0);
|
||||
|
||||
c.getW().addComment("enable-pay-creative", "Option to allow payment to be made in creative mode");
|
||||
payInCreative = c.get("enable-pay-creative", false);
|
||||
|
||||
@ -713,11 +705,6 @@ public class GeneralConfigManager {
|
||||
"With this enabled players wont get paid for breaked blocks from restrictedblocks list with silk touch tool.");
|
||||
useSilkTouchProtection = c.get("ExploitProtections.General.SilkTouchProtection", false);
|
||||
|
||||
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) - 1D;
|
||||
VipPetPay = c.get("ExploitProtections.General.VipPetPay", 1.0) - 1D;
|
||||
|
||||
c.getW().addComment("ExploitProtections.General.MonsterDamage.Use", "This section controls how much damage player should do to monster for player to get paid",
|
||||
"This prevents from killing monsters in one hit when they suffer in example fall damage");
|
||||
MonsterDamageUse = c.get("ExploitProtections.General.MonsterDamage.Use", false);
|
||||
@ -747,13 +734,7 @@ public class GeneralConfigManager {
|
||||
"If you are not using breeding payment, you can disable this to save little resources. Really little.");
|
||||
useBreederFinder = c.get("use-breeder-finder", true);
|
||||
|
||||
c.getW().addComment("old-job", "------------------------------------------------------------------------", "[Section Removed] Now its all permission based", "Money exp boost with special permision.",
|
||||
"You will need to add special permision for groups or players to have money/exp/points boost.",
|
||||
"Use: jobs.boost.[jobname].money.[amount] or jobs.boost.[jobname].exp.[amount] or jobs.boost.[jobname].points.[amount] or jobs.boost.[jobname].all.[amount] for all of them with specific jobs name.",
|
||||
"Use: jobs.boost.all.money.[amount] or jobs.boost.all.exp.[amount] or jobs.boost.all.points.[amount] or jobs.boost.all.all.[amount] to get boost for all jobs",
|
||||
"In example: jobs.boost.miner.exp.0.25 means that player will get 25% more than others, you can set less than 0 to get less from anothers",
|
||||
"jobs.boost.all.all.-0.5, jobs.boost.miner.all.1",
|
||||
"------------------------------------------------------------------------",
|
||||
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");
|
||||
levelLossPercentage = c.get("old-job.level-loss-percentage", 30);
|
||||
|
@ -111,10 +111,12 @@ public class LanguageManager {
|
||||
c.get("command.bonus.help.args", "[jobname]");
|
||||
Jobs.getGCManager().commandArgs.put("bonus", Arrays.asList("[jobname]"));
|
||||
c.get("command.bonus.output.topline", "&7**************** &2[money] &6[points] &e[exp] &7****************");
|
||||
c.get("command.bonus.output.permission", " &ePermission bonus: %money% %points% %exp%");
|
||||
c.get("command.bonus.output.permission", " &ePerm bonus: %money% %points% %exp%");
|
||||
c.get("command.bonus.output.item", " &eItem bonus: %money% %points% %exp%");
|
||||
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.dynamic", " &eDynamic bonus: %money% %points% %exp%");
|
||||
c.get("command.bonus.output.nearspawner", " &eSpawner bonus: %money% %points% %exp%");
|
||||
c.get("command.bonus.output.petpay", " &ePetPay 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%");
|
||||
|
@ -33,7 +33,6 @@ import com.gamingmesh.jobs.dao.JobsDAO;
|
||||
import com.gamingmesh.jobs.economy.PaymentData;
|
||||
import com.gamingmesh.jobs.resources.jfep.Parser;
|
||||
import com.gamingmesh.jobs.stuff.ChatColor;
|
||||
import com.gamingmesh.jobs.stuff.Debug;
|
||||
import com.gamingmesh.jobs.stuff.Perm;
|
||||
import com.gamingmesh.jobs.stuff.TimeManage;
|
||||
|
||||
@ -58,8 +57,6 @@ public class JobsPlayer {
|
||||
private OfflinePlayer OffPlayer = null;
|
||||
private Player player = null;
|
||||
|
||||
private double VipSpawnerMultiplier = 0D;
|
||||
|
||||
private HashMap<CurrencyType, Integer> limits = new HashMap<CurrencyType, Integer>();
|
||||
|
||||
private int userid = -1;
|
||||
@ -174,25 +171,6 @@ public class JobsPlayer {
|
||||
return this.player;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the VipSpawnerMultiplier
|
||||
* @return the Multiplier
|
||||
*/
|
||||
public double getVipSpawnerMultiplier() {
|
||||
if (this.getPlayer() == null || !this.getPlayer().isOnline())
|
||||
return 0D;
|
||||
if (VipSpawnerMultiplier < 0)
|
||||
updateVipSpawnerMultiplier();
|
||||
return this.VipSpawnerMultiplier;
|
||||
}
|
||||
|
||||
public void updateVipSpawnerMultiplier() {
|
||||
if (Perm.hasPermission(this.player, "jobs.vipspawner"))
|
||||
this.VipSpawnerMultiplier = Jobs.getGCManager().VIPpayNearSpawnerMultiplier - 1;
|
||||
else
|
||||
this.VipSpawnerMultiplier = Jobs.getGCManager().payNearSpawnerMultiplier - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Boost
|
||||
* @return the Boost
|
||||
|
@ -87,6 +87,7 @@ 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.Debug;
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
public class JobsPaymentListener implements Listener {
|
||||
|
Loading…
Reference in New Issue
Block a user