1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-01-30 20:11:23 +01:00

Fix for issue with passing over noneJob for JobsPrePaymentEvent event

This commit is contained in:
Zrips 2023-11-15 13:21:09 +02:00
parent 11972ffe1d
commit 613be4780e
6 changed files with 35 additions and 31 deletions

Binary file not shown.

BIN
libs/CMILib1.4.3.1.jar Normal file

Binary file not shown.

View File

@ -199,7 +199,7 @@
<artifactId>CMILib</artifactId> <artifactId>CMILib</artifactId>
<version>latest</version> <version>latest</version>
<scope>system</scope> <scope>system</scope>
<systemPath>${basedir}/libs/CMILib1.4.0.0.jar</systemPath> <systemPath>${basedir}/libs/CMILib1.4.3.1.jar</systemPath>
</dependency> </dependency>
<!-- WildStacker --> <!-- WildStacker -->
<dependency> <dependency>

View File

@ -1386,7 +1386,7 @@ public final class Jobs extends JavaPlugin {
public static void perform(JobsPlayer jPlayer, ActionInfo info, BufferedPayment payment, Job job, Block block, Entity ent, LivingEntity victim) { public static void perform(JobsPlayer jPlayer, ActionInfo info, BufferedPayment payment, Job job, Block block, Entity ent, LivingEntity victim) {
double expPayment = payment.get(CurrencyType.EXP); double expPayment = payment.get(CurrencyType.EXP);
JobsPrePaymentEvent jobsPrePaymentEvent = new JobsPrePaymentEvent(jPlayer.getPlayer(), noneJob, payment.get(CurrencyType.MONEY), JobsPrePaymentEvent jobsPrePaymentEvent = new JobsPrePaymentEvent(jPlayer.getPlayer(), job, payment.get(CurrencyType.MONEY),
payment.get(CurrencyType.POINTS), block, ent, victim, info); payment.get(CurrencyType.POINTS), block, ent, victim, info);
Bukkit.getServer().getPluginManager().callEvent(jobsPrePaymentEvent); Bukkit.getServer().getPluginManager().callEvent(jobsPrePaymentEvent);
// If event is canceled, don't do anything // If event is canceled, don't do anything

View File

@ -6,8 +6,11 @@ import com.gamingmesh.jobs.container.TopList;
import com.gamingmesh.jobs.i18n.Language; import com.gamingmesh.jobs.i18n.Language;
import net.Zrips.CMILib.Container.PageInfo; import net.Zrips.CMILib.Container.PageInfo;
import net.Zrips.CMILib.Locale.LC; import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Logs.CMIDebug;
import net.Zrips.CMILib.Messages.CMIMessages; import net.Zrips.CMILib.Messages.CMIMessages;
import net.Zrips.CMILib.Scoreboards.CMIScoreboard; import net.Zrips.CMILib.Scoreboards.CMIScoreboard;
import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -52,7 +55,7 @@ public class gtop implements Cmd {
int amount = Jobs.getGCManager().JobsTopAmount; int amount = Jobs.getGCManager().JobsTopAmount;
PageInfo pi = new PageInfo(amount, Jobs.getPlayerManager().getPlayersCache().size(), page); PageInfo pi = new PageInfo(amount, Jobs.getPlayerManager().getPlayersCache().size(), page);
Bukkit.getScheduler().runTaskAsynchronously(Jobs.getInstance(), () -> showGlobalTop(sender, pi, amount)); CMIScheduler.runTaskAsynchronously(() -> showGlobalTop(sender, pi, amount));
return true; return true;
} }
@ -105,11 +108,10 @@ public class gtop implements Cmd {
private static boolean hasToBeSeenInGlobalTop(TopList topList) { private static boolean hasToBeSeenInGlobalTop(TopList topList) {
Player player = topList.getPlayerInfo().getJobsPlayer().getPlayer(); Player player = topList.getPlayerInfo().getJobsPlayer().getPlayer();
if (player != null) if (player != null)
return !player.hasPermission("jobs.hidegtop"); return !player.isPermissionSet("jobs.hidegtop");
return !Jobs.getVaultPermission().playerHas( return !Jobs.getVaultPermission().playerHas(
null, null,
Bukkit.getOfflinePlayer(topList.getPlayerInfo().getUuid()), Bukkit.getOfflinePlayer(topList.getPlayerInfo().getUuid()),
"jobs.hidegtop" "jobs.hidegtop");
);
} }
} }

View File

@ -9,6 +9,8 @@ import net.Zrips.CMILib.Container.PageInfo;
import net.Zrips.CMILib.Locale.LC; import net.Zrips.CMILib.Locale.LC;
import net.Zrips.CMILib.Messages.CMIMessages; import net.Zrips.CMILib.Messages.CMIMessages;
import net.Zrips.CMILib.Scoreboards.CMIScoreboard; import net.Zrips.CMILib.Scoreboards.CMIScoreboard;
import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -58,7 +60,7 @@ public class top implements Cmd {
int workingIn = Jobs.getUsedSlots(job); int workingIn = Jobs.getUsedSlots(job);
PageInfo pi = new PageInfo(Jobs.getGCManager().JobsTopAmount, workingIn, page); PageInfo pi = new PageInfo(Jobs.getGCManager().JobsTopAmount, workingIn, page);
final int finalPage = page; final int finalPage = page;
Bukkit.getScheduler().runTaskAsynchronously(Jobs.getInstance(), () ->showTop(sender, job, pi, finalPage) ); CMIScheduler.runTaskAsynchronously(() -> showTop(sender, job, pi, finalPage));
return true; return true;
} }
@ -111,10 +113,10 @@ public class top implements Cmd {
private static boolean hasToBeSeenInTop(TopList topList, Job job) { private static boolean hasToBeSeenInTop(TopList topList, Job job) {
Player player = topList.getPlayerInfo().getJobsPlayer().getPlayer(); Player player = topList.getPlayerInfo().getJobsPlayer().getPlayer();
if (player != null) if (player != null)
return !player.hasPermission("jobs.hidetop.*") || !player.hasPermission("jobs.hidetop." + job.getName().toLowerCase()); return !player.isPermissionSet("jobs.hidetop.*") || !player.isPermissionSet("jobs.hidetop." + job.getName().toLowerCase());
OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(topList.getPlayerInfo().getUuid()); OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(topList.getPlayerInfo().getUuid());
return ! return !(Jobs.getVaultPermission().playerHas(null, offlinePlayer, "jobs.hidetop.*")
(Jobs.getVaultPermission().playerHas(null, offlinePlayer, "jobs.hidetop.*")
|| Jobs.getVaultPermission().playerHas(null, offlinePlayer, "jobs.hidetop." + job.getName().toLowerCase())); || Jobs.getVaultPermission().playerHas(null, offlinePlayer, "jobs.hidetop." + job.getName().toLowerCase()));
} }