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

Added option to open up the jobs browse actions when you performed jobs info command

This commit is contained in:
montlikadani 2020-06-14 21:11:21 +02:00
parent a897c43a5c
commit ae2b04f565
4 changed files with 39 additions and 18 deletions

View File

@ -177,6 +177,10 @@ public class GuiManager {
}
public void openJobsBrowseGUI(Player player, Job job) {
openJobsBrowseGUI(player, job, false);
}
public void openJobsBrowseGUI(Player player, Job job, boolean fromCommand) {
Inventory tempInv = Bukkit.createInventory(player, 54, "");
JobsPlayer JPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
@ -295,6 +299,10 @@ public class GuiManager {
gui.addButton(new CMIGuiButton(i1, items.get(i1)));
}
if (fromCommand) {
return;
}
ItemStack skull = Jobs.getGCManager().guiBackButton;
ItemMeta skullMeta = skull.getItemMeta();

View File

@ -27,19 +27,26 @@ public class info implements Cmd {
Player pSender = (Player) sender;
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(pSender);
String jobName = args[0];
Job job = Jobs.getJob(jobName);
if (job == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
if (jPlayer == null) {
pSender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", pSender.getName()));
return true;
}
if (Jobs.getGCManager().hideJobsInfoWithoutPermission)
if (!Jobs.getCommandManager().hasJobPermission(pSender, job)) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.permission"));
return true;
}
Job job = Jobs.getJob(args[0]);
if (job == null) {
pSender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
return true;
}
if (Jobs.getGCManager().hideJobsInfoWithoutPermission && !Jobs.getCommandManager().hasJobPermission(pSender, job)) {
pSender.sendMessage(Jobs.getLanguage().getMessage("general.error.permission"));
return true;
}
if (Jobs.getGCManager().jobsInfoOpensBrowse) {
Jobs.getGUIManager().openJobsBrowseGUI(pSender, job, true);
return true;
}
String type = "";
if (args.length >= 2) {
@ -55,7 +62,7 @@ public class info implements Cmd {
} catch (NumberFormatException e) {
}
Jobs.getCommandManager().jobInfoMessage(sender, jPlayer, job, type, page);
Jobs.getCommandManager().jobInfoMessage(pSender, jPlayer, job, type, page);
return true;
}

View File

@ -111,13 +111,9 @@ public class GeneralConfigManager {
public boolean useBlockProtection;
public int BlockProtectionDays;
public boolean applyToNegativeIncome;
public boolean useMinimumOveralPayment;
public boolean useMinimumOveralPoints;
public boolean useBreederFinder = false;
private boolean useTnTFinder = false;
public boolean CancelCowMilking;
public boolean fixAtMaxLevel, TitleChangeChat, TitleChangeActionBar, LevelChangeChat,
public boolean applyToNegativeIncome, useMinimumOveralPayment, useMinimumOveralPoints, useBreederFinder = false,
CancelCowMilking, fixAtMaxLevel, TitleChangeChat, TitleChangeActionBar, LevelChangeChat,
LevelChangeActionBar, SoundLevelupUse, SoundTitleChangeUse, UseServerAccount, EmptyServerAccountChat,
EmptyServerAccountActionBar, ActionBarsMessageByDefault, ShowTotalWorkers, ShowPenaltyBonus, useDynamicPayment,
JobsGUIOpenOnBrowse, JobsGUIShowChatBrowse, JobsGUISwitcheButtons, UseInversedClickToLeave, ShowActionNames,
@ -137,7 +133,7 @@ public class GeneralConfigManager {
public ItemStack guiBackButton;
public ItemStack guiFiller;
public boolean UsePerPermissionForLeaving, EnableConfirmation, FilterHiddenPlayerFromTabComplete;
public boolean UsePerPermissionForLeaving, EnableConfirmation, FilterHiddenPlayerFromTabComplete, jobsInfoOpensBrowse;
public int JobsTopAmount, PlaceholdersPage, ConfirmExpiryTime;
public Integer levelLossPercentageFromMax, levelLossPercentage, SoundLevelupVolume, SoundLevelupPitch, SoundTitleChangeVolume,
@ -1053,6 +1049,8 @@ public class GeneralConfigManager {
EnableConfirmation = c.get("Commands.JobsLeave.EnableConfirmation", false);
c.addComment("Commands.JobsLeave.ConfirmExpiryTime", "Specify the confirm expiry time.", "Time in seconds.");
ConfirmExpiryTime = c.get("Commands.JobsLeave.ConfirmExpiryTime", 10);
c.addComment("Commands.JobsInfo.open-browse", "Open up the jobs browse action list, when your performed /jobs info command?");
jobsInfoOpensBrowse = c.get("Commands.JobsInfo.open-browse", false);
CMIMaterial tmat = null;
tmat = CMIMaterial.get(c.get("JobsGUI.BackButton.Material", "JACK_O_LANTERN").toUpperCase());

View File

@ -411,6 +411,14 @@ public class JobsPaymentListener implements Listener {
}
}
// Prevent money duplication when breaking plant blocks
Material brokenBlock = block.getRelative(BlockFace.DOWN).getType();
if (Jobs.getGCManager().preventCropResizePayment && (brokenBlock == CMIMaterial.SUGAR_CANE.getMaterial()
|| brokenBlock == CMIMaterial.KELP.getMaterial()
|| brokenBlock == CMIMaterial.CACTUS.getMaterial() || brokenBlock == CMIMaterial.BAMBOO.getMaterial())) {
return;
}
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
if (jPlayer == null)
return;