1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-12-29 04:18:07 +01:00

Fix for lore duplication

This commit is contained in:
Zrips 2023-11-16 17:05:51 +02:00
parent 0ee8b59401
commit c5863bb121
5 changed files with 12 additions and 16 deletions

View File

@ -7,7 +7,7 @@ import net.Zrips.CMILib.Container.CMINumber;
public class GuiItem {
private ItemStack guiItem = null;
private int guiSlot = 0;
private int guiSlot = -1;
public ItemStack getGuiItem() {
return guiItem;
@ -23,7 +23,7 @@ public class GuiItem {
}
public GuiItem setGuiSlot(int guiSlot) {
this.guiSlot = CMINumber.clamp(guiSlot, 0, 54);
this.guiSlot = CMINumber.clamp(guiSlot, -1, 54);
return this;
}

View File

@ -168,16 +168,7 @@ public class GuiManager {
lore.add(Jobs.getLanguage().getMessage("command.info.gui.rightClick"));
}
ItemStack guiItem = job.getGuiItem();
// ItemMeta meta = guiItem.getItemMeta();
// meta.setDisplayName(job.getDisplayName());
// meta.setLore(lore);
//
// if (Jobs.getGCManager().hideItemAttributes) {
// meta.addItemFlags(org.bukkit.inventory.ItemFlag.HIDE_ATTRIBUTES, org.bukkit.inventory.ItemFlag.HIDE_ENCHANTS);
// }
//
// guiItem.setItemMeta(meta);
ItemStack guiItem = job.getGuiItem().clone();
CMIGuiButton button = new CMIGuiButton(job.getGuiSlot() >= 0 ? job.getGuiSlot() : pos, guiItem) {
@ -222,6 +213,7 @@ public class GuiManager {
};
button.setName(job.getDisplayName());
button.clearLore();
button.addLore(lore);
if (Jobs.getGCManager().hideItemAttributes) {
button.hideItemFlags();
@ -277,7 +269,7 @@ public class GuiManager {
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
Boost boost = Jobs.getPlayerManager().getFinalBonus(jPlayer, job);
JobProgression prog = jPlayer.getJobProgression(job);
ItemStack guiItem = job.getGuiItem();
ItemStack guiItem = job.getGuiItem().clone();
int level = prog != null ? prog.getLevel() : 1;
int numjobs = jPlayer.progression.size();
@ -499,7 +491,7 @@ public class GuiManager {
int numjobs = jPlayer.progression.size();
int level = jPlayer.getJobProgression(job) != null ? jPlayer.getJobProgression(job).getLevel() : 1;
ItemStack guiItem = job.getGuiItem();
ItemStack guiItem = job.getGuiItem().clone();
int i = 0;
for (ActionType actionType : jobsRemained) {
List<JobInfo> info = job.getJobInfo(actionType);

View File

@ -34,7 +34,9 @@ public class browse implements Cmd {
try {
plugin.getGUIManager().openJobsBrowseGUI((Player) sender);
} catch (Throwable e) {
((Player) sender).closeInventory();
e.printStackTrace();
}
return true;

View File

@ -64,6 +64,7 @@ import net.Zrips.CMILib.FileHandler.ConfigReader;
import net.Zrips.CMILib.Items.CMIAsyncHead;
import net.Zrips.CMILib.Items.CMIItemStack;
import net.Zrips.CMILib.Items.CMIMaterial;
import net.Zrips.CMILib.Logs.CMIDebug;
import net.Zrips.CMILib.Messages.CMIMessages;
import net.Zrips.CMILib.Version.Version;
@ -1245,10 +1246,11 @@ public class ConfigManager {
if (!customSkull.isEmpty()) {
guiItem = Util.getSkull(customSkull);
}
gItem.setGuiSlot(guiSection.getInt("slot", -1));
}
gItem.setGuiItem(guiItem);
job.setGuiItem(gItem);
// Permissions

View File

@ -287,7 +287,7 @@ public class Job {
}
public int getGuiSlot() {
return guiItem == null ? 0 : guiItem.getGuiSlot();
return guiItem == null ? -1 : guiItem.getGuiSlot();
}
/**