mirror of
https://github.com/Zrips/Jobs.git
synced 2024-12-01 15:03:36 +01:00
UI item dupe glitch fix
This commit is contained in:
parent
954c38be82
commit
a91a041be4
@ -81,6 +81,7 @@ import com.gamingmesh.jobs.container.JobProgression;
|
|||||||
import com.gamingmesh.jobs.container.JobsArmorChangeEvent;
|
import com.gamingmesh.jobs.container.JobsArmorChangeEvent;
|
||||||
import com.gamingmesh.jobs.container.JobsArmorChangeEvent.EquipMethod;
|
import com.gamingmesh.jobs.container.JobsArmorChangeEvent.EquipMethod;
|
||||||
import com.gamingmesh.jobs.container.JobsPlayer;
|
import com.gamingmesh.jobs.container.JobsPlayer;
|
||||||
|
import com.gamingmesh.jobs.stuff.Debug;
|
||||||
import com.gamingmesh.jobs.stuff.Util;
|
import com.gamingmesh.jobs.stuff.Util;
|
||||||
|
|
||||||
public class JobsListener implements Listener {
|
public class JobsListener implements Listener {
|
||||||
@ -218,18 +219,19 @@ public class JobsListener implements Listener {
|
|||||||
Jobs.getGUIManager().GuiList.remove(player.getUniqueId());
|
Jobs.getGUIManager().GuiList.remove(player.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onGuiLeftClick(InventoryClickEvent event) {
|
public void onGuiLeftClick(InventoryClickEvent event) {
|
||||||
|
|
||||||
if (Jobs.getGUIManager().GuiList.isEmpty())
|
if (Jobs.getGUIManager().GuiList.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player player = (Player) event.getWhoClicked();
|
final Player player = (Player) event.getWhoClicked();
|
||||||
|
|
||||||
if (!Jobs.getGUIManager().GuiList.containsKey(player.getUniqueId()))
|
if (!Jobs.getGUIManager().GuiList.containsKey(player.getUniqueId()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
final ItemStack clicked = event.getCurrentItem();
|
||||||
|
|
||||||
GuiInfoList joblist = Jobs.getGUIManager().GuiList.get(player.getUniqueId());
|
GuiInfoList joblist = Jobs.getGUIManager().GuiList.get(player.getUniqueId());
|
||||||
|
|
||||||
@ -261,6 +263,16 @@ public class JobsListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
player.updateInventory();
|
||||||
|
|
||||||
|
if (event.getClick().isShiftClick() && clicked != null && !clicked.getType().equals(Material.AIR))
|
||||||
|
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
player.getInventory().remove(clicked);
|
||||||
|
player.updateInventory();
|
||||||
|
}
|
||||||
|
}, 1L);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
|
Loading…
Reference in New Issue
Block a user