1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-29 05:55:27 +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

@ -649,6 +649,11 @@ public class LanguageManager {
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 ");

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) {