mirror of
https://github.com/Zrips/Jobs.git
synced 2025-02-27 09:43:22 +01:00
points -> pts
Same formating for info in chat and GUI for payment Decimal value limits
This commit is contained in:
parent
f79526f711
commit
23d32d0765
2
pom.xml
2
pom.xml
@ -5,7 +5,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>Jobs</groupId>
|
<groupId>Jobs</groupId>
|
||||||
<artifactId>jobs</artifactId>
|
<artifactId>jobs</artifactId>
|
||||||
<version>4.3.0</version>
|
<version>4.3.1</version>
|
||||||
<name>Jobs</name>
|
<name>Jobs</name>
|
||||||
<url>http://maven.apache.org</url>
|
<url>http://maven.apache.org</url>
|
||||||
<properties>
|
<properties>
|
||||||
|
@ -192,22 +192,36 @@ public class GuiManager {
|
|||||||
int y = 1;
|
int y = 1;
|
||||||
for (int z = 0; z < info.size(); z++) {
|
for (int z = 0; z < info.size(); z++) {
|
||||||
|
|
||||||
String itemName = info.get(z).getName().toLowerCase().replace('_', ' ');
|
String itemName = info.get(z).getRealisticName();
|
||||||
itemName = Character.toUpperCase(itemName.charAt(0)) + itemName.substring(1);
|
|
||||||
itemName = Jobs.getNameTranslatorManager().Translate(itemName, info.get(z));
|
|
||||||
itemName = org.bukkit.ChatColor.translateAlternateColorCodes('&', itemName);
|
|
||||||
|
|
||||||
double income = info.get(z).getIncome(level, numjobs);
|
double income = info.get(z).getIncome(level, numjobs);
|
||||||
income = income + (income * boost.getFinal(CurrencyType.MONEY));
|
|
||||||
ChatColor incomeColor = income >= 0 ? ChatColor.GREEN : ChatColor.DARK_RED;
|
income = boost.getFinalAmount(CurrencyType.MONEY, income);
|
||||||
|
String incomeColor = income >= 0 ? "" : ChatColor.DARK_RED.toString();
|
||||||
|
|
||||||
double xp = info.get(z).getExperience(level, numjobs);
|
double xp = info.get(z).getExperience(level, numjobs);
|
||||||
xp = xp + (xp * boost.getFinal(CurrencyType.EXP));
|
xp = boost.getFinalAmount(CurrencyType.EXP, xp);
|
||||||
ChatColor xpColor = xp >= 0 ? ChatColor.YELLOW : ChatColor.GRAY;
|
String xpColor = xp >= 0 ? "" : ChatColor.GRAY.toString();
|
||||||
|
|
||||||
String xpString = String.format("%.2fxp", xp);
|
double points = info.get(z).getPoints(level, numjobs);
|
||||||
|
points = boost.getFinalAmount(CurrencyType.POINTS, points);
|
||||||
|
String pointsColor = xp >= 0 ? "" : ChatColor.RED.toString();
|
||||||
|
|
||||||
Lore.add(ChatColor.translateAlternateColorCodes('&', "&7" + itemName + " " + xpColor + xpString + " " + incomeColor + Jobs.getEconomy().format(income)));
|
if (income == 0D && points == 0D && xp == 0D)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
String val = "";
|
||||||
|
|
||||||
|
if (income != 0.0)
|
||||||
|
val += Jobs.getLanguage().getMessage("command.info.help.money", "%money%", incomeColor + String.format(Jobs.getGCManager().getDecimalPlacesMoney(), income));
|
||||||
|
|
||||||
|
if (points != 0.0)
|
||||||
|
val += Jobs.getLanguage().getMessage("command.info.help.points", "%points%", pointsColor + String.format(Jobs.getGCManager().getDecimalPlacesPoints(), points));
|
||||||
|
|
||||||
|
if (xp != 0.0)
|
||||||
|
val += Jobs.getLanguage().getMessage("command.info.help.exp", "%exp%", xpColor + String.format(Jobs.getGCManager().getDecimalPlacesExp(), xp));
|
||||||
|
|
||||||
|
Lore.add(Jobs.getLanguage().getMessage("command.info.help.material", "%material%", itemName) + val);
|
||||||
|
|
||||||
if (y >= 10) {
|
if (y >= 10) {
|
||||||
y = 1;
|
y = 1;
|
||||||
|
@ -138,7 +138,7 @@ public class JobsCommands implements CommandExecutor {
|
|||||||
cmdString = cmdString.replace("[arguments]", " " + Jobs.getLanguage().getMessage(key));
|
cmdString = cmdString.replace("[arguments]", " " + Jobs.getLanguage().getMessage(key));
|
||||||
} else {
|
} else {
|
||||||
cmdString = cmdString.replace("[arguments]", "");
|
cmdString = cmdString.replace("[arguments]", "");
|
||||||
}
|
}
|
||||||
return cmdString;
|
return cmdString;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -448,10 +448,7 @@ public class JobsCommands implements CommandExecutor {
|
|||||||
List<JobInfo> jobInfo = job.getJobInfo(type);
|
List<JobInfo> jobInfo = job.getJobInfo(type);
|
||||||
for (JobInfo info : jobInfo) {
|
for (JobInfo info : jobInfo) {
|
||||||
|
|
||||||
String materialName = info.getName().toLowerCase().replace('_', ' ');
|
String materialName = info.getRealisticName();
|
||||||
materialName = Character.toUpperCase(materialName.charAt(0)) + materialName.substring(1);
|
|
||||||
materialName = Jobs.getNameTranslatorManager().Translate(materialName, info);
|
|
||||||
materialName = org.bukkit.ChatColor.translateAlternateColorCodes('&', materialName);
|
|
||||||
|
|
||||||
double income = info.getIncome(level, numjobs);
|
double income = info.getIncome(level, numjobs);
|
||||||
|
|
||||||
@ -478,13 +475,13 @@ public class JobsCommands implements CommandExecutor {
|
|||||||
message.append(" -> ");
|
message.append(" -> ");
|
||||||
|
|
||||||
if (income != 0.0)
|
if (income != 0.0)
|
||||||
message.append(Jobs.getLanguage().getMessage("command.info.help.money", "%money%", incomeColor + String.format("%.2f", income)));
|
message.append(Jobs.getLanguage().getMessage("command.info.help.money", "%money%", incomeColor + String.format(Jobs.getGCManager().getDecimalPlacesMoney(), income)));
|
||||||
|
|
||||||
if (points != 0.0)
|
if (points != 0.0)
|
||||||
message.append(Jobs.getLanguage().getMessage("command.info.help.points", "%points%", pointsColor + String.format("%.2f", points)));
|
message.append(Jobs.getLanguage().getMessage("command.info.help.points", "%points%", pointsColor + String.format(Jobs.getGCManager().getDecimalPlacesPoints(), points)));
|
||||||
|
|
||||||
if (xp != 0.0)
|
if (xp != 0.0)
|
||||||
message.append(Jobs.getLanguage().getMessage("command.info.help.exp", "%exp%", xpColor + String.format("%.2f", xp)));
|
message.append(Jobs.getLanguage().getMessage("command.info.help.exp", "%exp%", xpColor + String.format(Jobs.getGCManager().getDecimalPlacesExp(), xp)));
|
||||||
|
|
||||||
if (info.getFromLevel() > 1 && info.getUntilLevel() != -1)
|
if (info.getFromLevel() > 1 && info.getUntilLevel() != -1)
|
||||||
message.append(Jobs.getLanguage().getMessage("command.info.help.levelRange", "%levelFrom%", info.getFromLevel(), "%levelUntil%", info.getUntilLevel()));
|
message.append(Jobs.getLanguage().getMessage("command.info.help.levelRange", "%levelFrom%", info.getFromLevel(), "%levelUntil%", info.getUntilLevel()));
|
||||||
|
@ -103,6 +103,8 @@ public class GeneralConfigManager {
|
|||||||
EmptyServerAcountActionBar, ActionBarsMessageByDefault, ShowTotalWorkers, ShowPenaltyBonus, useDynamicPayment,
|
EmptyServerAcountActionBar, ActionBarsMessageByDefault, ShowTotalWorkers, ShowPenaltyBonus, useDynamicPayment,
|
||||||
useGlobalBoostScheduler, JobsGUIOpenOnBrowse, JobsGUIShowChatBrowse, JobsGUISwitcheButtons, JobsGUIOpenOnJoin;
|
useGlobalBoostScheduler, JobsGUIOpenOnBrowse, JobsGUIShowChatBrowse, JobsGUISwitcheButtons, JobsGUIOpenOnJoin;
|
||||||
|
|
||||||
|
private String DecimalPlacesMoney, DecimalPlacesExp, DecimalPlacesPoints;
|
||||||
|
|
||||||
public ItemStack guiBackButton;
|
public ItemStack guiBackButton;
|
||||||
public ItemStack guiFiller;
|
public ItemStack guiFiller;
|
||||||
|
|
||||||
@ -451,6 +453,12 @@ public class GeneralConfigManager {
|
|||||||
"When set to true staff will be informed about new Jobs plugin version", "You need to have jobs.versioncheck permission node");
|
"When set to true staff will be informed about new Jobs plugin version", "You need to have jobs.versioncheck permission node");
|
||||||
ShowNewVersion = c.get("Optimizations.NewVersion", true);
|
ShowNewVersion = c.get("Optimizations.NewVersion", true);
|
||||||
|
|
||||||
|
c.getW().addComment("Optimizations.DecimalPlaces.Money",
|
||||||
|
"Decimal places to be shown");
|
||||||
|
DecimalPlacesMoney = "%." + c.get("Optimizations.DecimalPlaces.Money", 2) + "f";
|
||||||
|
DecimalPlacesExp = "%." + c.get("Optimizations.DecimalPlaces.Exp", 2) + "f";
|
||||||
|
DecimalPlacesPoints = "%." + c.get("Optimizations.DecimalPlaces.Points", 2) + "f";
|
||||||
|
|
||||||
c.getW().addComment("Optimizations.DBCleaning.Jobs.Use",
|
c.getW().addComment("Optimizations.DBCleaning.Jobs.Use",
|
||||||
"Warning!!! before enabling this feature, please make data base backup, just in case there will be some issues with data base cleaning",
|
"Warning!!! before enabling this feature, please make data base backup, just in case there will be some issues with data base cleaning",
|
||||||
"When set to true, jobs data base will be cleaned on each startup to avoid having not used jobs",
|
"When set to true, jobs data base will be cleaned on each startup to avoid having not used jobs",
|
||||||
@ -944,4 +952,17 @@ public class GeneralConfigManager {
|
|||||||
public int getBrowseAmountToShow() {
|
public int getBrowseAmountToShow() {
|
||||||
return BrowseAmountToShow;
|
return BrowseAmountToShow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDecimalPlacesMoney() {
|
||||||
|
return DecimalPlacesMoney;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDecimalPlacesExp() {
|
||||||
|
return DecimalPlacesExp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDecimalPlacesPoints() {
|
||||||
|
return DecimalPlacesPoints;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -333,7 +333,7 @@ public class LanguageManager {
|
|||||||
c.get("command.info.help.levelUntil", " &a(until &e%levelUntil% &alevel)");
|
c.get("command.info.help.levelUntil", " &a(until &e%levelUntil% &alevel)");
|
||||||
|
|
||||||
c.get("command.info.help.money", " &2%money%\u0024");
|
c.get("command.info.help.money", " &2%money%\u0024");
|
||||||
c.get("command.info.help.points", " &6%points%points");
|
c.get("command.info.help.points", " &6%points%pts");
|
||||||
c.get("command.info.help.exp", " &e%exp%xp");
|
c.get("command.info.help.exp", " &e%exp%xp");
|
||||||
|
|
||||||
c.get("command.info.gui.pickjob", "&ePick your job!");
|
c.get("command.info.gui.pickjob", "&ePick your job!");
|
||||||
@ -436,7 +436,7 @@ public class LanguageManager {
|
|||||||
|
|
||||||
c.get("command.quests.help.info", "List available quests");
|
c.get("command.quests.help.info", "List available quests");
|
||||||
c.get("command.quests.help.args", "(playername)");
|
c.get("command.quests.help.args", "(playername)");
|
||||||
c.get("command.quests.error.noquests", "There are no quests");
|
c.get("command.quests.error.noquests", "&cThere are no quests");
|
||||||
c.get("command.quests.toplineseparator", "&7*********************** &6[playerName]&2(&f[questsDone]&2) &7***********************");
|
c.get("command.quests.toplineseparator", "&7*********************** &6[playerName]&2(&f[questsDone]&2) &7***********************");
|
||||||
c.get("command.quests.output.completed", "&2 !Completed!&r ");
|
c.get("command.quests.output.completed", "&2 !Completed!&r ");
|
||||||
c.get("command.quests.output.questLine", "[progress] &7[questName] &f[done]&7/&8[required]");
|
c.get("command.quests.output.questLine", "[progress] &7[questName] &f[done]&7/&8[required]");
|
||||||
|
@ -24,7 +24,7 @@ import com.gamingmesh.jobs.resources.jfep.Parser;
|
|||||||
public class JobInfo {
|
public class JobInfo {
|
||||||
private ActionType actionType;
|
private ActionType actionType;
|
||||||
private int id;
|
private int id;
|
||||||
private String meta;
|
private String meta;
|
||||||
private String name;
|
private String name;
|
||||||
private double baseIncome, baseXp, basePoints;
|
private double baseIncome, baseXp, basePoints;
|
||||||
private Parser moneyEquation, xpEquation, pointsEquation;
|
private Parser moneyEquation, xpEquation, pointsEquation;
|
||||||
@ -77,6 +77,14 @@ public class JobInfo {
|
|||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getRealisticName() {
|
||||||
|
String materialName = getName().toLowerCase().replace('_', ' ');
|
||||||
|
materialName = Character.toUpperCase(materialName.charAt(0)) + materialName.substring(1);
|
||||||
|
materialName = Jobs.getNameTranslatorManager().Translate(materialName, this);
|
||||||
|
materialName = org.bukkit.ChatColor.translateAlternateColorCodes('&', materialName);
|
||||||
|
return materialName;
|
||||||
|
}
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ public class ActionBar {
|
|||||||
private Class<?> ChatMessageclz;
|
private Class<?> ChatMessageclz;
|
||||||
private Class<?> sub;
|
private Class<?> sub;
|
||||||
private Object[] consts;
|
private Object[] consts;
|
||||||
|
|
||||||
public ActionBar() {
|
public ActionBar() {
|
||||||
try {
|
try {
|
||||||
version = Jobs.getVersionCheckManager().getVersion();
|
version = Jobs.getVersionCheckManager().getVersion();
|
||||||
@ -58,7 +58,7 @@ public class ActionBar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void ShowActionBar(BufferedPayment payment) {
|
public void ShowActionBar(BufferedPayment payment) {
|
||||||
|
|
||||||
if (!payment.getOfflinePlayer().isOnline())
|
if (!payment.getOfflinePlayer().isOnline())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -78,11 +78,12 @@ public class ActionBar {
|
|||||||
if (abp != null && show) {
|
if (abp != null && show) {
|
||||||
String Message = Jobs.getLanguage().getMessage("command.toggle.output.paid.main");
|
String Message = Jobs.getLanguage().getMessage("command.toggle.output.paid.main");
|
||||||
if (payment.getAmount() != 0D)
|
if (payment.getAmount() != 0D)
|
||||||
Message = Message + " " + Jobs.getLanguage().getMessage("command.toggle.output.paid.money", "[amount]", String.format("%.2f", payment.getAmount()));
|
Message = Message + " " + Jobs.getLanguage().getMessage("command.toggle.output.paid.money", "[amount]", String.format(Jobs.getGCManager().getDecimalPlacesMoney(), payment
|
||||||
|
.getAmount()));
|
||||||
if (payment.getPoints() != 0D)
|
if (payment.getPoints() != 0D)
|
||||||
Message = Message + " " + Jobs.getLanguage().getMessage("command.toggle.output.paid.points", "[points]", String.format("%.2f", payment.getPoints()));
|
Message = Message + " " + Jobs.getLanguage().getMessage("command.toggle.output.paid.points", "[points]", String.format(Jobs.getGCManager().getDecimalPlacesPoints(), payment.getPoints()));
|
||||||
if (payment.getExp() != 0D)
|
if (payment.getExp() != 0D)
|
||||||
Message = Message + " " + Jobs.getLanguage().getMessage("command.toggle.output.paid.exp", "[exp]", String.format("%.2f", payment.getExp()));
|
Message = Message + " " + Jobs.getLanguage().getMessage("command.toggle.output.paid.exp", "[exp]", String.format(Jobs.getGCManager().getDecimalPlacesExp(), payment.getExp()));
|
||||||
send(abp, ChatColor.GREEN + Message);
|
send(abp, ChatColor.GREEN + Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -94,7 +95,7 @@ public class ActionBar {
|
|||||||
|
|
||||||
if (receivingPacket == null)
|
if (receivingPacket == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (version.isLower(Version.v1_8_R1) || !(receivingPacket instanceof Player)) {
|
if (version.isLower(Version.v1_8_R1) || !(receivingPacket instanceof Player)) {
|
||||||
receivingPacket.sendMessage(ChatColor.translateAlternateColorCodes('&', msg));
|
receivingPacket.sendMessage(ChatColor.translateAlternateColorCodes('&', msg));
|
||||||
return;
|
return;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
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: 4.3.0
|
version: 4.3.1
|
||||||
website: https://www.spigotmc.org/resources/jobs-reborn.4216/
|
website: https://www.spigotmc.org/resources/jobs-reborn.4216/
|
||||||
author: phrstbrn
|
author: phrstbrn
|
||||||
softdepend: [Vault, iConomy, MythicMobs, McMMO, WorldGuard, MyPet]
|
softdepend: [Vault, iConomy, MythicMobs, McMMO, WorldGuard, MyPet]
|
||||||
|
Loading…
Reference in New Issue
Block a user