mirror of
https://github.com/Zrips/Jobs.git
synced 2024-12-01 15:03:36 +01:00
GUI info button
This commit is contained in:
parent
f1537befde
commit
31fc886b2c
@ -21,6 +21,7 @@ import com.gamingmesh.jobs.container.JobProgression;
|
||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||
|
||||
import net.Zrips.CMILib.CMILib;
|
||||
import net.Zrips.CMILib.Container.CMICommands;
|
||||
import net.Zrips.CMILib.GUI.CMIGui;
|
||||
import net.Zrips.CMILib.GUI.CMIGuiButton;
|
||||
import net.Zrips.CMILib.GUI.GUIManager.GUIClickType;
|
||||
@ -205,6 +206,25 @@ public class GuiManager {
|
||||
i++;
|
||||
}
|
||||
|
||||
ItemStack next = Jobs.getGCManager().guiInfoButton;
|
||||
ItemMeta meta = next.getItemMeta();
|
||||
|
||||
meta.setDisplayName(LC.info_nextPageHover.getLocale());
|
||||
next.setItemMeta(meta);
|
||||
|
||||
gui.addButton(new CMIGuiButton(Jobs.getGCManager().InfoButtonSlot - 1, next) {
|
||||
@Override
|
||||
public void click(GUIClickType type) {
|
||||
for (String one : Jobs.getGCManager().InfoButtonCommands) {
|
||||
if (one.equalsIgnoreCase("closeinv!")) {
|
||||
player.closeInventory();
|
||||
continue;
|
||||
}
|
||||
CMICommands.performCommand(Bukkit.getConsoleSender(), one.replace("[playerName]", player.getName()));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
gui.fillEmptyButtons();
|
||||
gui.open();
|
||||
}
|
||||
@ -222,10 +242,10 @@ public class GuiManager {
|
||||
JobProgression prog = jPlayer.getJobProgression(job);
|
||||
ItemStack guiItem = job.getGuiItem();
|
||||
|
||||
int level = prog != null ? prog.getLevel() : 1,
|
||||
numjobs = jPlayer.progression.size(),
|
||||
nextButton = Jobs.getGCManager().getJobsGUINextButton(),
|
||||
backButton = Jobs.getGCManager().getJobsGUIBackButton();
|
||||
int level = prog != null ? prog.getLevel() : 1;
|
||||
int numjobs = jPlayer.progression.size();
|
||||
int nextButton = Jobs.getGCManager().getJobsGUINextButton();
|
||||
int backButton = Jobs.getGCManager().getJobsGUIBackButton();
|
||||
|
||||
final List<ActionType> jobsRemained = new ArrayList<>();
|
||||
|
||||
|
@ -39,10 +39,12 @@ import com.gamingmesh.jobs.CMILib.CMIEnchantment;
|
||||
import com.gamingmesh.jobs.container.CurrencyLimit;
|
||||
import com.gamingmesh.jobs.container.CurrencyType;
|
||||
|
||||
import net.Zrips.CMILib.CMILib;
|
||||
import net.Zrips.CMILib.Container.CMIArray;
|
||||
import net.Zrips.CMILib.Container.CMIList;
|
||||
import net.Zrips.CMILib.Equations.Parser;
|
||||
import net.Zrips.CMILib.FileHandler.ConfigReader;
|
||||
import net.Zrips.CMILib.Items.CMIItemStack;
|
||||
import net.Zrips.CMILib.Items.CMIMaterial;
|
||||
import net.Zrips.CMILib.Version.Version;
|
||||
|
||||
@ -107,7 +109,9 @@ public class GeneralConfigManager {
|
||||
LoggingUse, payForCombiningItems, BlastFurnacesReassign = false, SmokerReassign = false, payForStackedEntities, payForAbove = false,
|
||||
payForEachVTradeItem, allowEnchantingBoostedItems, bossBarAsync = false, preventShopItemEnchanting;
|
||||
|
||||
public ItemStack guiBackButton, guiNextButton;
|
||||
public ItemStack guiBackButton, guiNextButton, guiInfoButton;
|
||||
public int InfoButtonSlot = 9;
|
||||
public List<String> InfoButtonCommands = new ArrayList<String>();
|
||||
|
||||
public Parser DynamicPaymentEquation;
|
||||
|
||||
@ -1043,12 +1047,26 @@ public class GeneralConfigManager {
|
||||
c.addComment("JobsGUI.SkipAmount", "Defines by how many slots we need to skip after group");
|
||||
JobsGUISkipAmount = c.get("JobsGUI.SkipAmount", 2);
|
||||
|
||||
CMIItemStack item = CMILib.getInstance().getItemManager().getItem(c.get("JobsGUI.BackButton.Material", "JACK_O_LANTERN"));
|
||||
guiBackButton = item.getCMIType() == CMIMaterial.NONE ? CMIMaterial.JACK_O_LANTERN.newItemStack() : item.getItemStack();
|
||||
|
||||
item = CMILib.getInstance().getItemManager().getItem(c.get("JobsGUI.NextButton.Material", "ARROW"));
|
||||
guiNextButton = item.getCMIType() == CMIMaterial.NONE ? CMIMaterial.ARROW.newItemStack() : item.getItemStack();
|
||||
|
||||
InfoButtonSlot = c.get("JobsGUI.InfoButton.Slot", 9);
|
||||
guiInfoButton = item.getCMIType() == CMIMaterial.NONE ? CMIMaterial.ARROW.newItemStack() : item.getItemStack();
|
||||
item = CMILib.getInstance().getItemManager().getItem(c.get("JobsGUI.InfoButton.Material",
|
||||
"head:eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMjcwNWZkOTRhMGM0MzE5MjdmYjRlNjM5YjBmY2ZiNDk3MTdlNDEyMjg1YTAyYjQzOWUwMTEyZGEyMmIyZTJlYyJ9fX0="));
|
||||
guiInfoButton = item.getCMIType() == CMIMaterial.NONE ? CMIMaterial.ARROW.newItemStack() : item.getItemStack();
|
||||
|
||||
c.addComment("JobsGUI.InfoButton.Commands", "closeinv! can be used to close players inventory when you click this icon");
|
||||
InfoButtonCommands = c.get("JobsGUI.InfoButton.Commands", Arrays.asList("closeinv!"));
|
||||
|
||||
c.addComment("Commands.Jobs", "What should happen when performing clean /jobs command", "Options:",
|
||||
"Default - behaves like before and will open jobs help page with list of commands player can access",
|
||||
"Browse - will open jobs browse GUI where player can check existing jobs and their actions",
|
||||
"Last option is to define command you want to perform, use [playerName] variable to replace it with players name who performed it. Multiple commands can be provided too. Commands will be performed from console.");
|
||||
|
||||
|
||||
helpPageBehavior.clear();
|
||||
if (c.getC().isList("Commands.Jobs")) {
|
||||
helpPageBehavior.addAll(c.get("Commands.Jobs", Arrays.asList("Default")));
|
||||
@ -1078,12 +1096,6 @@ public class GeneralConfigManager {
|
||||
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 = CMIMaterial.get(c.get("JobsGUI.BackButton.Material", "JACK_O_LANTERN"));
|
||||
guiBackButton = (tmat == CMIMaterial.NONE ? CMIMaterial.JACK_O_LANTERN : tmat).newItemStack();
|
||||
|
||||
tmat = CMIMaterial.get(c.get("JobsGUI.NextButton.Material", "ARROW"));
|
||||
guiNextButton = (tmat == CMIMaterial.NONE ? CMIMaterial.ARROW : tmat).newItemStack();
|
||||
|
||||
c.addComment("BlockOwnership.Range", "Set to 0 or lower if you want to disable this. Setting to positive number will mean that player needs to be in this range from owner block to get paid");
|
||||
blockOwnershipRange = c.get("BlockOwnership.Range", 0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user