mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-17 21:51:20 +01:00
Fix for lore duplication
This commit is contained in:
parent
0ee8b59401
commit
c5863bb121
@ -7,7 +7,7 @@ import net.Zrips.CMILib.Container.CMINumber;
|
|||||||
public class GuiItem {
|
public class GuiItem {
|
||||||
|
|
||||||
private ItemStack guiItem = null;
|
private ItemStack guiItem = null;
|
||||||
private int guiSlot = 0;
|
private int guiSlot = -1;
|
||||||
|
|
||||||
public ItemStack getGuiItem() {
|
public ItemStack getGuiItem() {
|
||||||
return guiItem;
|
return guiItem;
|
||||||
@ -23,7 +23,7 @@ public class GuiItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public GuiItem setGuiSlot(int guiSlot) {
|
public GuiItem setGuiSlot(int guiSlot) {
|
||||||
this.guiSlot = CMINumber.clamp(guiSlot, 0, 54);
|
this.guiSlot = CMINumber.clamp(guiSlot, -1, 54);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,16 +168,7 @@ public class GuiManager {
|
|||||||
lore.add(Jobs.getLanguage().getMessage("command.info.gui.rightClick"));
|
lore.add(Jobs.getLanguage().getMessage("command.info.gui.rightClick"));
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack guiItem = job.getGuiItem();
|
ItemStack guiItem = job.getGuiItem().clone();
|
||||||
// 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);
|
|
||||||
|
|
||||||
CMIGuiButton button = new CMIGuiButton(job.getGuiSlot() >= 0 ? job.getGuiSlot() : pos, guiItem) {
|
CMIGuiButton button = new CMIGuiButton(job.getGuiSlot() >= 0 ? job.getGuiSlot() : pos, guiItem) {
|
||||||
|
|
||||||
@ -222,6 +213,7 @@ public class GuiManager {
|
|||||||
};
|
};
|
||||||
|
|
||||||
button.setName(job.getDisplayName());
|
button.setName(job.getDisplayName());
|
||||||
|
button.clearLore();
|
||||||
button.addLore(lore);
|
button.addLore(lore);
|
||||||
if (Jobs.getGCManager().hideItemAttributes) {
|
if (Jobs.getGCManager().hideItemAttributes) {
|
||||||
button.hideItemFlags();
|
button.hideItemFlags();
|
||||||
@ -277,7 +269,7 @@ public class GuiManager {
|
|||||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
|
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
|
||||||
Boost boost = Jobs.getPlayerManager().getFinalBonus(jPlayer, job);
|
Boost boost = Jobs.getPlayerManager().getFinalBonus(jPlayer, job);
|
||||||
JobProgression prog = jPlayer.getJobProgression(job);
|
JobProgression prog = jPlayer.getJobProgression(job);
|
||||||
ItemStack guiItem = job.getGuiItem();
|
ItemStack guiItem = job.getGuiItem().clone();
|
||||||
|
|
||||||
int level = prog != null ? prog.getLevel() : 1;
|
int level = prog != null ? prog.getLevel() : 1;
|
||||||
int numjobs = jPlayer.progression.size();
|
int numjobs = jPlayer.progression.size();
|
||||||
@ -499,7 +491,7 @@ public class GuiManager {
|
|||||||
int numjobs = jPlayer.progression.size();
|
int numjobs = jPlayer.progression.size();
|
||||||
int level = jPlayer.getJobProgression(job) != null ? jPlayer.getJobProgression(job).getLevel() : 1;
|
int level = jPlayer.getJobProgression(job) != null ? jPlayer.getJobProgression(job).getLevel() : 1;
|
||||||
|
|
||||||
ItemStack guiItem = job.getGuiItem();
|
ItemStack guiItem = job.getGuiItem().clone();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (ActionType actionType : jobsRemained) {
|
for (ActionType actionType : jobsRemained) {
|
||||||
List<JobInfo> info = job.getJobInfo(actionType);
|
List<JobInfo> info = job.getJobInfo(actionType);
|
||||||
|
@ -34,7 +34,9 @@ public class browse implements Cmd {
|
|||||||
try {
|
try {
|
||||||
plugin.getGUIManager().openJobsBrowseGUI((Player) sender);
|
plugin.getGUIManager().openJobsBrowseGUI((Player) sender);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
|
||||||
((Player) sender).closeInventory();
|
((Player) sender).closeInventory();
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -64,6 +64,7 @@ import net.Zrips.CMILib.FileHandler.ConfigReader;
|
|||||||
import net.Zrips.CMILib.Items.CMIAsyncHead;
|
import net.Zrips.CMILib.Items.CMIAsyncHead;
|
||||||
import net.Zrips.CMILib.Items.CMIItemStack;
|
import net.Zrips.CMILib.Items.CMIItemStack;
|
||||||
import net.Zrips.CMILib.Items.CMIMaterial;
|
import net.Zrips.CMILib.Items.CMIMaterial;
|
||||||
|
import net.Zrips.CMILib.Logs.CMIDebug;
|
||||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||||
import net.Zrips.CMILib.Version.Version;
|
import net.Zrips.CMILib.Version.Version;
|
||||||
|
|
||||||
@ -1245,10 +1246,11 @@ public class ConfigManager {
|
|||||||
if (!customSkull.isEmpty()) {
|
if (!customSkull.isEmpty()) {
|
||||||
guiItem = Util.getSkull(customSkull);
|
guiItem = Util.getSkull(customSkull);
|
||||||
}
|
}
|
||||||
|
|
||||||
gItem.setGuiSlot(guiSection.getInt("slot", -1));
|
gItem.setGuiSlot(guiSection.getInt("slot", -1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gItem.setGuiItem(guiItem);
|
||||||
|
|
||||||
job.setGuiItem(gItem);
|
job.setGuiItem(gItem);
|
||||||
|
|
||||||
// Permissions
|
// Permissions
|
||||||
|
@ -287,7 +287,7 @@ public class Job {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getGuiSlot() {
|
public int getGuiSlot() {
|
||||||
return guiItem == null ? 0 : guiItem.getGuiSlot();
|
return guiItem == null ? -1 : guiItem.getGuiSlot();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user