mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-30 03:51:53 +01:00
Fix for issue with passing over noneJob for JobsPrePaymentEvent event
This commit is contained in:
parent
11972ffe1d
commit
613be4780e
Binary file not shown.
BIN
libs/CMILib1.4.3.1.jar
Normal file
BIN
libs/CMILib1.4.3.1.jar
Normal file
Binary file not shown.
2
pom.xml
2
pom.xml
@ -199,7 +199,7 @@
|
||||
<artifactId>CMILib</artifactId>
|
||||
<version>latest</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/libs/CMILib1.4.0.0.jar</systemPath>
|
||||
<systemPath>${basedir}/libs/CMILib1.4.3.1.jar</systemPath>
|
||||
</dependency>
|
||||
<!-- WildStacker -->
|
||||
<dependency>
|
||||
|
@ -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) {
|
||||
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);
|
||||
Bukkit.getServer().getPluginManager().callEvent(jobsPrePaymentEvent);
|
||||
// If event is canceled, don't do anything
|
||||
|
@ -6,8 +6,11 @@ import com.gamingmesh.jobs.container.TopList;
|
||||
import com.gamingmesh.jobs.i18n.Language;
|
||||
import net.Zrips.CMILib.Container.PageInfo;
|
||||
import net.Zrips.CMILib.Locale.LC;
|
||||
import net.Zrips.CMILib.Logs.CMIDebug;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
import net.Zrips.CMILib.Scoreboards.CMIScoreboard;
|
||||
import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -52,14 +55,14 @@ public class gtop implements Cmd {
|
||||
int amount = Jobs.getGCManager().JobsTopAmount;
|
||||
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;
|
||||
}
|
||||
|
||||
private static void showGlobalTop(CommandSender sender, PageInfo pi, int amount) {
|
||||
Player player = (Player) sender;
|
||||
List<TopList> FullList = Jobs.getJobsDAO().getGlobalTopList(pi.getStart())
|
||||
.stream().filter(gtop::hasToBeSeenInGlobalTop).collect(Collectors.toList());
|
||||
.stream().filter(gtop::hasToBeSeenInGlobalTop).collect(Collectors.toList());
|
||||
if (FullList.isEmpty()) {
|
||||
Language.sendMessage(sender, "command.gtop.error.nojob");
|
||||
return;
|
||||
@ -74,11 +77,11 @@ public class gtop implements Cmd {
|
||||
break;
|
||||
|
||||
Language.sendMessage(sender, "command.gtop.output.list",
|
||||
"%number%", pi.getPositionForOutput(i),
|
||||
"%playername%", One.getPlayerInfo().getName(),
|
||||
"%playerdisplayname%", One.getPlayerInfo().getDisplayName(),
|
||||
"%level%", One.getLevel(),
|
||||
"%exp%", One.getExp());
|
||||
"%number%", pi.getPositionForOutput(i),
|
||||
"%playername%", One.getPlayerInfo().getName(),
|
||||
"%playerdisplayname%", One.getPlayerInfo().getDisplayName(),
|
||||
"%level%", One.getLevel(),
|
||||
"%exp%", One.getExp());
|
||||
++i;
|
||||
}
|
||||
} else {
|
||||
@ -89,13 +92,13 @@ public class gtop implements Cmd {
|
||||
break;
|
||||
|
||||
ls.add(Jobs.getLanguage().getMessage("scoreboard.line",
|
||||
"%number%", pi.getPositionForOutput(i),
|
||||
"%playername%", one.getPlayerInfo().getName(),
|
||||
"%playerdisplayname%", one.getPlayerInfo().getDisplayName(),
|
||||
"%level%", one.getLevel()));
|
||||
"%number%", pi.getPositionForOutput(i),
|
||||
"%playername%", one.getPlayerInfo().getName(),
|
||||
"%playerdisplayname%", one.getPlayerInfo().getDisplayName(),
|
||||
"%level%", one.getLevel()));
|
||||
++i;
|
||||
}
|
||||
|
||||
|
||||
CMIScoreboard.show(player, Jobs.getLanguage().getMessage("scoreboard.gtopline"), ls, Jobs.getGCManager().ToplistInScoreboardInterval);
|
||||
}
|
||||
|
||||
@ -105,11 +108,10 @@ public class gtop implements Cmd {
|
||||
private static boolean hasToBeSeenInGlobalTop(TopList topList) {
|
||||
Player player = topList.getPlayerInfo().getJobsPlayer().getPlayer();
|
||||
if (player != null)
|
||||
return !player.hasPermission("jobs.hidegtop");
|
||||
return !player.isPermissionSet("jobs.hidegtop");
|
||||
return !Jobs.getVaultPermission().playerHas(
|
||||
null,
|
||||
Bukkit.getOfflinePlayer(topList.getPlayerInfo().getUuid()),
|
||||
"jobs.hidegtop"
|
||||
);
|
||||
null,
|
||||
Bukkit.getOfflinePlayer(topList.getPlayerInfo().getUuid()),
|
||||
"jobs.hidegtop");
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,8 @@ import net.Zrips.CMILib.Container.PageInfo;
|
||||
import net.Zrips.CMILib.Locale.LC;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
import net.Zrips.CMILib.Scoreboards.CMIScoreboard;
|
||||
import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -58,14 +60,14 @@ public class top implements Cmd {
|
||||
int workingIn = Jobs.getUsedSlots(job);
|
||||
PageInfo pi = new PageInfo(Jobs.getGCManager().JobsTopAmount, workingIn, page);
|
||||
final int finalPage = page;
|
||||
Bukkit.getScheduler().runTaskAsynchronously(Jobs.getInstance(), () ->showTop(sender, job, pi, finalPage) );
|
||||
CMIScheduler.runTaskAsynchronously(() -> showTop(sender, job, pi, finalPage));
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void showTop(CommandSender sender, Job job, PageInfo pi, int page) {
|
||||
Player player = (Player) sender;
|
||||
List<TopList> fullList = Jobs.getJobsDAO().toplist(job.getName(), pi.getStart())
|
||||
.stream().filter(topList -> hasToBeSeenInTop(topList, job)).collect(Collectors.toList());
|
||||
.stream().filter(topList -> hasToBeSeenInTop(topList, job)).collect(Collectors.toList());
|
||||
|
||||
if (fullList.isEmpty()) {
|
||||
CMIMessages.sendMessage(sender, LC.info_NoInformation);
|
||||
@ -83,11 +85,11 @@ public class top implements Cmd {
|
||||
break;
|
||||
|
||||
Language.sendMessage(sender, "command.top.output.list",
|
||||
"%number%", ((page - 1) * Jobs.getGCManager().JobsTopAmount) + place,
|
||||
"%playername%", one.getPlayerInfo().getName(),
|
||||
"%playerdisplayname%", one.getPlayerInfo().getDisplayName(),
|
||||
"%level%", one.getLevel(),
|
||||
"%exp%", one.getExp());
|
||||
"%number%", ((page - 1) * Jobs.getGCManager().JobsTopAmount) + place,
|
||||
"%playername%", one.getPlayerInfo().getName(),
|
||||
"%playerdisplayname%", one.getPlayerInfo().getDisplayName(),
|
||||
"%level%", one.getLevel(),
|
||||
"%exp%", one.getExp());
|
||||
place++;
|
||||
}
|
||||
pi.autoPagination(sender, "jobs top " + job.getName());
|
||||
@ -98,7 +100,7 @@ public class top implements Cmd {
|
||||
if (place > Jobs.getGCManager().JobsTopAmount)
|
||||
break;
|
||||
ls.add(Jobs.getLanguage().getMessage("scoreboard.line", "%number%", ((page - 1) * Jobs.getGCManager().JobsTopAmount) + place,
|
||||
"%playername%", one.getPlayerInfo().getName(), "%playerdisplayname%", one.getPlayerInfo().getDisplayName(), "%level%", one.getLevel()));
|
||||
"%playername%", one.getPlayerInfo().getName(), "%playerdisplayname%", one.getPlayerInfo().getDisplayName(), "%level%", one.getLevel()));
|
||||
place++;
|
||||
}
|
||||
|
||||
@ -111,11 +113,11 @@ public class top implements Cmd {
|
||||
private static boolean hasToBeSeenInTop(TopList topList, Job job) {
|
||||
Player player = topList.getPlayerInfo().getJobsPlayer().getPlayer();
|
||||
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());
|
||||
return !
|
||||
(Jobs.getVaultPermission().playerHas(null, offlinePlayer, "jobs.hidetop.*")
|
||||
|| Jobs.getVaultPermission().playerHas(null, offlinePlayer, "jobs.hidetop." + job.getName().toLowerCase()));
|
||||
return !(Jobs.getVaultPermission().playerHas(null, offlinePlayer, "jobs.hidetop.*")
|
||||
|| Jobs.getVaultPermission().playerHas(null, offlinePlayer, "jobs.hidetop." + job.getName().toLowerCase()));
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user