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) { 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, ""); Inventory tempInv = Bukkit.createInventory(player, 54, "");
JobsPlayer JPlayer = Jobs.getPlayerManager().getJobsPlayer(player); JobsPlayer JPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
@ -295,6 +299,10 @@ public class GuiManager {
gui.addButton(new CMIGuiButton(i1, items.get(i1))); gui.addButton(new CMIGuiButton(i1, items.get(i1)));
} }
if (fromCommand) {
return;
}
ItemStack skull = Jobs.getGCManager().guiBackButton; ItemStack skull = Jobs.getGCManager().guiBackButton;
ItemMeta skullMeta = skull.getItemMeta(); ItemMeta skullMeta = skull.getItemMeta();

View File

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

View File

@ -111,13 +111,9 @@ public class GeneralConfigManager {
public boolean useBlockProtection; public boolean useBlockProtection;
public int BlockProtectionDays; public int BlockProtectionDays;
public boolean applyToNegativeIncome;
public boolean useMinimumOveralPayment;
public boolean useMinimumOveralPoints;
public boolean useBreederFinder = false;
private boolean useTnTFinder = false; private boolean useTnTFinder = false;
public boolean CancelCowMilking; public boolean applyToNegativeIncome, useMinimumOveralPayment, useMinimumOveralPoints, useBreederFinder = false,
public boolean fixAtMaxLevel, TitleChangeChat, TitleChangeActionBar, LevelChangeChat, CancelCowMilking, fixAtMaxLevel, TitleChangeChat, TitleChangeActionBar, LevelChangeChat,
LevelChangeActionBar, SoundLevelupUse, SoundTitleChangeUse, UseServerAccount, EmptyServerAccountChat, LevelChangeActionBar, SoundLevelupUse, SoundTitleChangeUse, UseServerAccount, EmptyServerAccountChat,
EmptyServerAccountActionBar, ActionBarsMessageByDefault, ShowTotalWorkers, ShowPenaltyBonus, useDynamicPayment, EmptyServerAccountActionBar, ActionBarsMessageByDefault, ShowTotalWorkers, ShowPenaltyBonus, useDynamicPayment,
JobsGUIOpenOnBrowse, JobsGUIShowChatBrowse, JobsGUISwitcheButtons, UseInversedClickToLeave, ShowActionNames, JobsGUIOpenOnBrowse, JobsGUIShowChatBrowse, JobsGUISwitcheButtons, UseInversedClickToLeave, ShowActionNames,
@ -137,7 +133,7 @@ public class GeneralConfigManager {
public ItemStack guiBackButton; public ItemStack guiBackButton;
public ItemStack guiFiller; public ItemStack guiFiller;
public boolean UsePerPermissionForLeaving, EnableConfirmation, FilterHiddenPlayerFromTabComplete; public boolean UsePerPermissionForLeaving, EnableConfirmation, FilterHiddenPlayerFromTabComplete, jobsInfoOpensBrowse;
public int JobsTopAmount, PlaceholdersPage, ConfirmExpiryTime; public int JobsTopAmount, PlaceholdersPage, ConfirmExpiryTime;
public Integer levelLossPercentageFromMax, levelLossPercentage, SoundLevelupVolume, SoundLevelupPitch, SoundTitleChangeVolume, public Integer levelLossPercentageFromMax, levelLossPercentage, SoundLevelupVolume, SoundLevelupPitch, SoundTitleChangeVolume,
@ -1053,6 +1049,8 @@ public class GeneralConfigManager {
EnableConfirmation = c.get("Commands.JobsLeave.EnableConfirmation", false); EnableConfirmation = c.get("Commands.JobsLeave.EnableConfirmation", false);
c.addComment("Commands.JobsLeave.ConfirmExpiryTime", "Specify the confirm expiry time.", "Time in seconds."); c.addComment("Commands.JobsLeave.ConfirmExpiryTime", "Specify the confirm expiry time.", "Time in seconds.");
ConfirmExpiryTime = c.get("Commands.JobsLeave.ConfirmExpiryTime", 10); 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; CMIMaterial tmat = null;
tmat = CMIMaterial.get(c.get("JobsGUI.BackButton.Material", "JACK_O_LANTERN").toUpperCase()); 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); JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
if (jPlayer == null) if (jPlayer == null)
return; return;