mirror of
https://github.com/Zrips/Jobs.git
synced 2024-12-30 21:07:48 +01:00
Exclude petpay ant nearspawner bonus to avoid confusion
This commit is contained in:
parent
29a9b9dee9
commit
ded9324c72
@ -1,15 +1,13 @@
|
||||
package com.gamingmesh.jobs.api;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import com.gamingmesh.jobs.container.CuboidArea;
|
||||
|
||||
public final class JobsAreaSelectionEvent extends Event implements Cancellable {
|
||||
public final class JobsAreaSelectionEvent extends Event {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
private CuboidArea area;
|
||||
private Player player;
|
||||
|
||||
@ -26,16 +24,6 @@ public final class JobsAreaSelectionEvent extends Event implements Cancellable {
|
||||
return area;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
cancelled = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.gamingmesh.jobs.commands.list;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
@ -47,20 +48,29 @@ public class bonus implements Cmd {
|
||||
|
||||
printBoost(sender, boost, BoostOf.Permission);
|
||||
printBoost(sender, boost, BoostOf.Item);
|
||||
printBoost(sender, boost, BoostOf.NearSpawner);
|
||||
printBoost(sender, boost, BoostOf.PetPay);
|
||||
printBoost(sender, boost, BoostOf.Global);
|
||||
printBoost(sender, boost, BoostOf.Dynamic);
|
||||
if (Jobs.getGCManager().useDynamicPayment)
|
||||
printBoost(sender, boost, BoostOf.Dynamic);
|
||||
printBoost(sender, boost, BoostOf.Area);
|
||||
if (Jobs.getGCManager().payNearSpawner())
|
||||
printBoost(sender, boost, BoostOf.NearSpawner);
|
||||
printBoost(sender, boost, BoostOf.PetPay);
|
||||
|
||||
if (Jobs.getMcMMOlistener().mcMMOPresent && boost.get(BoostOf.McMMO, CurrencyType.EXP) != 0D)
|
||||
printBoost(sender, boost, BoostOf.McMMO);
|
||||
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.info.separator"));
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.bonus.output.final",
|
||||
"%money%", mc + formatText(boost.getFinal(CurrencyType.MONEY, true)),
|
||||
"%points%", pc + formatText(boost.getFinal(CurrencyType.POINTS, true)),
|
||||
"%exp%", ec + formatText(boost.getFinal(CurrencyType.EXP, true))));
|
||||
|
||||
String msg = Jobs.getLanguage().getMessage("command.bonus.output.final",
|
||||
"%money%", mc + formatText(boost.getFinal(CurrencyType.MONEY, true, true)),
|
||||
"%points%", pc + formatText(boost.getFinal(CurrencyType.POINTS, true, true)),
|
||||
"%exp%", ec + formatText(boost.getFinal(CurrencyType.EXP, true, true)));
|
||||
|
||||
String txt = "[\"\",{\"text\":\"" + msg
|
||||
+ "\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[{\"text\":\"" + Jobs.getLanguage().getMessage(
|
||||
"command.bonus.output.finalExplanation") + "\"}]}}}]";
|
||||
|
||||
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "tellraw " + player.getName() + " " + txt);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -70,10 +80,18 @@ public class bonus implements Cmd {
|
||||
String ec = ChatColor.YELLOW.toString();
|
||||
|
||||
private void printBoost(CommandSender sender, Boost boost, BoostOf type) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.bonus.output." + type.name().toLowerCase(),
|
||||
String prefix = ChatColor.GOLD + "*";
|
||||
if (type != BoostOf.NearSpawner && type != BoostOf.PetPay)
|
||||
prefix = "";
|
||||
String msg = Jobs.getLanguage().getMessage("command.bonus.output." + type.name().toLowerCase(),
|
||||
"%money%", mc + formatText(boost.get(type, CurrencyType.MONEY, true)),
|
||||
"%points%", pc + formatText(boost.get(type, CurrencyType.POINTS, true)),
|
||||
"%exp%", ec + formatText(boost.get(type, CurrencyType.EXP, true))));
|
||||
"%exp%", ec + formatText(boost.get(type, CurrencyType.EXP, true)));
|
||||
|
||||
if (msg.startsWith(" ") && (type == BoostOf.NearSpawner || type == BoostOf.PetPay))
|
||||
msg = msg.substring(1, msg.length());
|
||||
|
||||
sender.sendMessage(prefix + msg);
|
||||
}
|
||||
|
||||
private static String formatText(double amount) {
|
||||
|
@ -414,7 +414,8 @@ public class GeneralConfigManager {
|
||||
"Player data is always periodically auto-saved and autosaved during a clean shutdown.",
|
||||
"Only enable this if you have a multi-server setup, or have a really good reason for enabling this.", "Turning this on will decrease database performance.");
|
||||
saveOnDisconnect = c.get("save-on-disconnect", false);
|
||||
|
||||
|
||||
c.getW().addComment("selectionTool", "Tool used when selecting bounds for restricted area");
|
||||
getSelectionTooldID = c.get("selectionTool", 294);
|
||||
if (Material.getMaterial(Jobs.getGCManager().getSelectionTooldID) == null)
|
||||
getSelectionTooldID = 294;
|
||||
|
@ -120,6 +120,7 @@ public class LanguageManager {
|
||||
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.bonus.output.finalExplanation", " &eDoes not include Petpay and Near spawner bonus/penalty");
|
||||
|
||||
c.get("command.convert.help.info",
|
||||
"Converts data base system from one system to another. if you currently running sqlite, this will convert to Mysql and vise versa.");
|
||||
|
@ -112,14 +112,15 @@ public class RestrictedAreaManager {
|
||||
return areas;
|
||||
}
|
||||
|
||||
private StringBuilder addHeader(StringBuilder header) {
|
||||
private static StringBuilder addHeader(StringBuilder header) {
|
||||
header.append("Restricted area configuration");
|
||||
header.append(System.getProperty("line.separator"))
|
||||
.append(System.getProperty("line.separator"))
|
||||
.append("Configures restricted areas where you cannot get experience or money").append(System.getProperty("line.separator"))
|
||||
.append("when performing a job.").append(System.getProperty("line.separator")).append(System.getProperty("line.separator"))
|
||||
.append("The multiplier changes the experience/money gains in an area.").append(System.getProperty("line.separator"))
|
||||
.append("A multiplier of 0.0 means no money or xp, while 0.5 means you will get half the normal money/exp").append(System.getProperty("line.separator"))
|
||||
.append("A multiplier of 0.0 means no bonus, while 0.5 means you will get 50% more the normal income").append(System.getProperty("line.separator"))
|
||||
.append("While -0.5 means that you will get 50% less the normal income").append(System.getProperty("line.separator"))
|
||||
.append(System.getProperty("line.separator"))
|
||||
.append("restrictedareas:").append(System.getProperty("line.separator"))
|
||||
.append(" area1:").append(System.getProperty("line.separator"))
|
||||
|
@ -35,25 +35,27 @@ public class Boost {
|
||||
if (r < -1)
|
||||
r = -1;
|
||||
if (percent)
|
||||
return (int)(r * 100);
|
||||
return (int) (r * 100);
|
||||
return r;
|
||||
}
|
||||
|
||||
public double getFinal(CurrencyType BT) {
|
||||
return getFinal(BT, false);
|
||||
return getFinal(BT, false, false);
|
||||
}
|
||||
|
||||
public double getFinal(CurrencyType BT, boolean percent) {
|
||||
public double getFinal(CurrencyType BT, boolean percent, boolean excludeExtra) {
|
||||
double r = 0D;
|
||||
for (BoostOf one : BoostOf.values()) {
|
||||
if (!map.containsKey(one))
|
||||
continue;
|
||||
if (excludeExtra && (one == BoostOf.NearSpawner || one == BoostOf.PetPay))
|
||||
continue;
|
||||
r += map.get(one).get(BT);
|
||||
}
|
||||
if (r < -1)
|
||||
r = -1;
|
||||
if (percent)
|
||||
return (int)(r * 100);
|
||||
return (int) (r * 100);
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
@ -90,6 +90,7 @@ public class JobsListener implements Listener {
|
||||
ItemStack iih = Jobs.getNms().getItemInMainHand(player);
|
||||
if (iih == null || iih.getType() == Material.AIR)
|
||||
return;
|
||||
@SuppressWarnings("deprecation")
|
||||
int heldItemId = iih.getTypeId();
|
||||
if (heldItemId != Jobs.getGCManager().getSelectionTooldID())
|
||||
return;
|
||||
|
@ -1,9 +1,9 @@
|
||||
name: Jobs
|
||||
description: Jobs Plugin for the BukkitAPI
|
||||
main: com.gamingmesh.jobs.Jobs
|
||||
version: 3.7.7
|
||||
version: 3.8.0
|
||||
author: phrstbrn
|
||||
softdepend: [Vault, iConomy, MythicMobs, McMMO, WorldEdit]
|
||||
softdepend: [Vault, iConomy, MythicMobs, McMMO]
|
||||
commands:
|
||||
jobs:
|
||||
description: Jobs
|
||||
|
Loading…
Reference in New Issue
Block a user