1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-01-02 14:29:07 +01:00

Exclude petpay ant nearspawner bonus to avoid confusion

This commit is contained in:
Zrips 2017-01-16 12:13:00 +02:00
parent 29a9b9dee9
commit ded9324c72
8 changed files with 43 additions and 31 deletions

View File

@ -1,15 +1,13 @@
package com.gamingmesh.jobs.api; package com.gamingmesh.jobs.api;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import com.gamingmesh.jobs.container.CuboidArea; 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 static final HandlerList handlers = new HandlerList();
private boolean cancelled;
private CuboidArea area; private CuboidArea area;
private Player player; private Player player;
@ -26,16 +24,6 @@ public final class JobsAreaSelectionEvent extends Event implements Cancellable {
return area; return area;
} }
@Override
public boolean isCancelled() {
return cancelled;
}
@Override
public void setCancelled(boolean cancel) {
cancelled = cancel;
}
@Override @Override
public HandlerList getHandlers() { public HandlerList getHandlers() {
return handlers; return handlers;

View File

@ -1,5 +1,6 @@
package com.gamingmesh.jobs.commands.list; package com.gamingmesh.jobs.commands.list;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.Jobs;
@ -47,20 +48,29 @@ public class bonus implements Cmd {
printBoost(sender, boost, BoostOf.Permission); printBoost(sender, boost, BoostOf.Permission);
printBoost(sender, boost, BoostOf.Item); printBoost(sender, boost, BoostOf.Item);
printBoost(sender, boost, BoostOf.NearSpawner);
printBoost(sender, boost, BoostOf.PetPay);
printBoost(sender, boost, BoostOf.Global); printBoost(sender, boost, BoostOf.Global);
printBoost(sender, boost, BoostOf.Dynamic); if (Jobs.getGCManager().useDynamicPayment)
printBoost(sender, boost, BoostOf.Dynamic);
printBoost(sender, boost, BoostOf.Area); 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) if (Jobs.getMcMMOlistener().mcMMOPresent && boost.get(BoostOf.McMMO, CurrencyType.EXP) != 0D)
printBoost(sender, boost, BoostOf.McMMO); printBoost(sender, boost, BoostOf.McMMO);
sender.sendMessage(Jobs.getLanguage().getMessage("general.info.separator")); 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)), String msg = Jobs.getLanguage().getMessage("command.bonus.output.final",
"%points%", pc + formatText(boost.getFinal(CurrencyType.POINTS, true)), "%money%", mc + formatText(boost.getFinal(CurrencyType.MONEY, true, true)),
"%exp%", ec + formatText(boost.getFinal(CurrencyType.EXP, 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; return true;
} }
@ -70,10 +80,18 @@ public class bonus implements Cmd {
String ec = ChatColor.YELLOW.toString(); String ec = ChatColor.YELLOW.toString();
private void printBoost(CommandSender sender, Boost boost, BoostOf type) { 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)), "%money%", mc + formatText(boost.get(type, CurrencyType.MONEY, true)),
"%points%", pc + formatText(boost.get(type, CurrencyType.POINTS, 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) { private static String formatText(double amount) {

View File

@ -414,7 +414,8 @@ public class GeneralConfigManager {
"Player data is always periodically auto-saved and autosaved during a clean shutdown.", "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."); "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); saveOnDisconnect = c.get("save-on-disconnect", false);
c.getW().addComment("selectionTool", "Tool used when selecting bounds for restricted area");
getSelectionTooldID = c.get("selectionTool", 294); getSelectionTooldID = c.get("selectionTool", 294);
if (Material.getMaterial(Jobs.getGCManager().getSelectionTooldID) == null) if (Material.getMaterial(Jobs.getGCManager().getSelectionTooldID) == null)
getSelectionTooldID = 294; getSelectionTooldID = 294;

View File

@ -120,6 +120,7 @@ public class LanguageManager {
c.get("command.bonus.output.area", " &eArea 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.mcmmo", " &eMcMMO bonus: %money% %points% %exp%");
c.get("command.bonus.output.final", " &eFinal 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", 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."); "Converts data base system from one system to another. if you currently running sqlite, this will convert to Mysql and vise versa.");

View File

@ -112,14 +112,15 @@ public class RestrictedAreaManager {
return areas; return areas;
} }
private StringBuilder addHeader(StringBuilder header) { private static StringBuilder addHeader(StringBuilder header) {
header.append("Restricted area configuration"); header.append("Restricted area configuration");
header.append(System.getProperty("line.separator")) header.append(System.getProperty("line.separator"))
.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("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("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("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(System.getProperty("line.separator"))
.append("restrictedareas:").append(System.getProperty("line.separator")) .append("restrictedareas:").append(System.getProperty("line.separator"))
.append(" area1:").append(System.getProperty("line.separator")) .append(" area1:").append(System.getProperty("line.separator"))

View File

@ -35,25 +35,27 @@ public class Boost {
if (r < -1) if (r < -1)
r = -1; r = -1;
if (percent) if (percent)
return (int)(r * 100); return (int) (r * 100);
return r; return r;
} }
public double getFinal(CurrencyType BT) { 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; double r = 0D;
for (BoostOf one : BoostOf.values()) { for (BoostOf one : BoostOf.values()) {
if (!map.containsKey(one)) if (!map.containsKey(one))
continue; continue;
if (excludeExtra && (one == BoostOf.NearSpawner || one == BoostOf.PetPay))
continue;
r += map.get(one).get(BT); r += map.get(one).get(BT);
} }
if (r < -1) if (r < -1)
r = -1; r = -1;
if (percent) if (percent)
return (int)(r * 100); return (int) (r * 100);
return r; return r;
} }
} }

View File

@ -90,6 +90,7 @@ public class JobsListener implements Listener {
ItemStack iih = Jobs.getNms().getItemInMainHand(player); ItemStack iih = Jobs.getNms().getItemInMainHand(player);
if (iih == null || iih.getType() == Material.AIR) if (iih == null || iih.getType() == Material.AIR)
return; return;
@SuppressWarnings("deprecation")
int heldItemId = iih.getTypeId(); int heldItemId = iih.getTypeId();
if (heldItemId != Jobs.getGCManager().getSelectionTooldID()) if (heldItemId != Jobs.getGCManager().getSelectionTooldID())
return; return;

View File

@ -1,9 +1,9 @@
name: Jobs name: Jobs
description: Jobs Plugin for the BukkitAPI description: Jobs Plugin for the BukkitAPI
main: com.gamingmesh.jobs.Jobs main: com.gamingmesh.jobs.Jobs
version: 3.7.7 version: 3.8.0
author: phrstbrn author: phrstbrn
softdepend: [Vault, iConomy, MythicMobs, McMMO, WorldEdit] softdepend: [Vault, iConomy, MythicMobs, McMMO]
commands: commands:
jobs: jobs:
description: Jobs description: Jobs