1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-25 20:16:13 +01:00

Returning back basic chat payment messages

This commit is contained in:
Zrips 2024-09-28 17:19:13 +03:00
parent 8cc7a25778
commit 4d94195146
3 changed files with 51 additions and 7 deletions

View File

@ -294,7 +294,7 @@ public class LanguageManager {
c.get("command.recalculatepermissions.help.info", "Reset players permission cache");
c.get("command.recalculatepermissions.help.args", "(playername)");
c.get("command.stats.help.info", "Show the level you are in each job you are part of.");
c.get("command.stats.help.args", "[playername]");
Jobs.getGCManager().getCommandArgs().put("stats", Arrays.asList("[playername]"));
@ -561,7 +561,7 @@ public class LanguageManager {
c.get("command.area.output.removed", "&eRemoved the restricted area &6%name%");
c.get("command.area.output.lists", "&7%number%&f. &7%areaname% &f%worldname% &7(&a%x1%:%y1%:%z1%&7/&e%x2%:%y2%:%z2%&7) &2%money% &6%points% &e%exp%");
c.get("command.area.output.wgLists", "&7%number%&f. WorldGuard: &7%areaname% &2%money% &6%points% &e%exp%");
c.get("command.area.output.noAreas", "&eThere are no saved restricted areas");
c.get("command.area.output.noAreas", "&eThere are no saved restricted areas");
c.get("command.area.output.noAreasByLoc", "&eThere are no restricted areas in this location");
c.get("command.area.output.areaList", "&eRestricted areas by your location: &6%list%");
c.get("command.area.output.selected1", "&eSelected the first point: &6%x%:%y%:%z%");
@ -648,11 +648,16 @@ public class LanguageManager {
c.get("command.toggle.help.args", "actionbar/bossbar");
Jobs.getGCManager().getCommandArgs().put("toggle", Arrays.asList("actionbar%%bossbar"));
c.get("command.toggle.output.turnedoff", "&4This feature is turned off!");
c.get("command.toggle.output.paid.main", "&aYou got:");
c.get("command.toggle.output.paid.money", "&e[amount] money");
c.get("command.toggle.output.paid.exp", "&7[exp] exp");
c.get("command.toggle.output.paid.points", "&6[points] points");
c.get("command.toggle.output.paid.ACmoney", "&e+[amount]$ ");
c.get("command.toggle.output.paid.ACexp", "&7+[exp]XP ");
c.get("command.toggle.output.paid.ACpoints", "&6+[points]pts ");
c.get("command.toggle.output.on", "&aToggled: &aON");
c.get("command.toggle.output.off", "&aToggled: &4OFF");

View File

@ -37,6 +37,7 @@ import com.gamingmesh.jobs.stuff.ToggleBarHandling;
import com.gamingmesh.jobs.tasks.BufferedPaymentTask;
import net.Zrips.CMILib.ActionBar.CMIActionBar;
import net.Zrips.CMILib.Logs.CMIDebug;
import net.Zrips.CMILib.Version.Version;
import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
@ -207,9 +208,6 @@ public class BufferedEconomy {
if (jobsPaymentEvent.isCancelled())
continue;
// Do we need this?
payment.getPayment().putAll(jobsPaymentEvent.getPayment());
if (Jobs.getGCManager().UseServerAccount && !hasMoney) {
CMIActionBar.send(payment.getOfflinePlayer().getPlayer(), Jobs.getLanguage().getMessage("economy.error.nomoney"));
continue;

View File

@ -31,10 +31,13 @@ import org.bukkit.event.player.PlayerQuitEvent;
import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.api.JobsInstancePaymentEvent;
import com.gamingmesh.jobs.api.JobsPaymentEvent;
import com.gamingmesh.jobs.container.CurrencyType;
import com.gamingmesh.jobs.economy.BufferedPayment;
import com.gamingmesh.jobs.stuff.ToggleBarHandling;
import net.Zrips.CMILib.ActionBar.CMIActionBar;
import net.Zrips.CMILib.Logs.CMIDebug;
import net.Zrips.CMILib.Version.Version;
public class JobsPaymentVisualizationListener implements Listener {
@ -90,6 +93,44 @@ public class JobsPaymentVisualizationListener implements Listener {
paymentCaches.remove(event.getPlayer().getUniqueId());
}
@EventHandler(priority = EventPriority.MONITOR)
public void onJobsPaymentEvent(JobsPaymentEvent event) {
if (event.isCancelled())
return;
showPayment(event);
}
private static void showPayment(JobsPaymentEvent event) {
if (event.getPlayer() == null || !event.getPlayer().isOnline() || event.getPayment().isEmpty())
return;
UUID playerUUID = event.getPlayer().getUniqueId();
Player abp = Bukkit.getPlayer(playerUUID);
if (abp == null)
return;
if (ToggleBarHandling.getActionBarToggle().getOrDefault(playerUUID, Jobs.getGCManager().ActionBarsMessageByDefault))
return;
String message = Jobs.getLanguage().getMessage("command.toggle.output.paid.main");
double money = event.getPayment().get(CurrencyType.MONEY);
if (money != 0D)
message += " " + Jobs.getLanguage().getMessage("command.toggle.output.paid.money", "[amount]", String.format(Jobs.getGCManager().getDecimalPlacesMoney(), money));
double points = event.getPayment().get(CurrencyType.POINTS);
if (points != 0D)
message += " " + Jobs.getLanguage().getMessage("command.toggle.output.paid.points", "[points]", String.format(Jobs.getGCManager().getDecimalPlacesPoints(), points));
double exp = event.getPayment().get(CurrencyType.EXP);
if (exp != 0D)
message += " " + Jobs.getLanguage().getMessage("command.toggle.output.paid.exp", "[exp]", String.format(Jobs.getGCManager().getDecimalPlacesExp(), exp));
if (!message.isEmpty())
abp.sendMessage(message);
}
@EventHandler(priority = EventPriority.MONITOR)
public void onJobsInstancePaymentBossEvent(JobsInstancePaymentEvent event) {