mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-30 12:01:22 +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>
|
<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>
|
||||||
|
@ -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
|
||||||
|
@ -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,14 +55,14 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void showGlobalTop(CommandSender sender, PageInfo pi, int amount) {
|
private static void showGlobalTop(CommandSender sender, PageInfo pi, int amount) {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
List<TopList> FullList = Jobs.getJobsDAO().getGlobalTopList(pi.getStart())
|
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()) {
|
if (FullList.isEmpty()) {
|
||||||
Language.sendMessage(sender, "command.gtop.error.nojob");
|
Language.sendMessage(sender, "command.gtop.error.nojob");
|
||||||
return;
|
return;
|
||||||
@ -74,11 +77,11 @@ public class gtop implements Cmd {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
Language.sendMessage(sender, "command.gtop.output.list",
|
Language.sendMessage(sender, "command.gtop.output.list",
|
||||||
"%number%", pi.getPositionForOutput(i),
|
"%number%", pi.getPositionForOutput(i),
|
||||||
"%playername%", One.getPlayerInfo().getName(),
|
"%playername%", One.getPlayerInfo().getName(),
|
||||||
"%playerdisplayname%", One.getPlayerInfo().getDisplayName(),
|
"%playerdisplayname%", One.getPlayerInfo().getDisplayName(),
|
||||||
"%level%", One.getLevel(),
|
"%level%", One.getLevel(),
|
||||||
"%exp%", One.getExp());
|
"%exp%", One.getExp());
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -89,13 +92,13 @@ public class gtop implements Cmd {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
ls.add(Jobs.getLanguage().getMessage("scoreboard.line",
|
ls.add(Jobs.getLanguage().getMessage("scoreboard.line",
|
||||||
"%number%", pi.getPositionForOutput(i),
|
"%number%", pi.getPositionForOutput(i),
|
||||||
"%playername%", one.getPlayerInfo().getName(),
|
"%playername%", one.getPlayerInfo().getName(),
|
||||||
"%playerdisplayname%", one.getPlayerInfo().getDisplayName(),
|
"%playerdisplayname%", one.getPlayerInfo().getDisplayName(),
|
||||||
"%level%", one.getLevel()));
|
"%level%", one.getLevel()));
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
CMIScoreboard.show(player, Jobs.getLanguage().getMessage("scoreboard.gtopline"), ls, Jobs.getGCManager().ToplistInScoreboardInterval);
|
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) {
|
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");
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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,14 +60,14 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void showTop(CommandSender sender, Job job, PageInfo pi, int page) {
|
private static void showTop(CommandSender sender, Job job, PageInfo pi, int page) {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
List<TopList> fullList = Jobs.getJobsDAO().toplist(job.getName(), pi.getStart())
|
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()) {
|
if (fullList.isEmpty()) {
|
||||||
CMIMessages.sendMessage(sender, LC.info_NoInformation);
|
CMIMessages.sendMessage(sender, LC.info_NoInformation);
|
||||||
@ -83,11 +85,11 @@ public class top implements Cmd {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
Language.sendMessage(sender, "command.top.output.list",
|
Language.sendMessage(sender, "command.top.output.list",
|
||||||
"%number%", ((page - 1) * Jobs.getGCManager().JobsTopAmount) + place,
|
"%number%", ((page - 1) * Jobs.getGCManager().JobsTopAmount) + place,
|
||||||
"%playername%", one.getPlayerInfo().getName(),
|
"%playername%", one.getPlayerInfo().getName(),
|
||||||
"%playerdisplayname%", one.getPlayerInfo().getDisplayName(),
|
"%playerdisplayname%", one.getPlayerInfo().getDisplayName(),
|
||||||
"%level%", one.getLevel(),
|
"%level%", one.getLevel(),
|
||||||
"%exp%", one.getExp());
|
"%exp%", one.getExp());
|
||||||
place++;
|
place++;
|
||||||
}
|
}
|
||||||
pi.autoPagination(sender, "jobs top " + job.getName());
|
pi.autoPagination(sender, "jobs top " + job.getName());
|
||||||
@ -98,7 +100,7 @@ public class top implements Cmd {
|
|||||||
if (place > Jobs.getGCManager().JobsTopAmount)
|
if (place > Jobs.getGCManager().JobsTopAmount)
|
||||||
break;
|
break;
|
||||||
ls.add(Jobs.getLanguage().getMessage("scoreboard.line", "%number%", ((page - 1) * Jobs.getGCManager().JobsTopAmount) + place,
|
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++;
|
place++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,11 +113,11 @@ 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()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user