Skip to content

Commit

Permalink
Inventory fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kadotcom committed Jul 7, 2024
1 parent de915d8 commit aa85574
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.18.1-R0.1-SNAPSHOT</version>
<version>1.21-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/me/kadotcom/lifestolen/Events/GUIEvent.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package me.kadotcom.lifestolen.Events;

import me.kadotcom.lifestolen.LifeStolen;
import me.kadotcom.lifestolen.Utils.InventoryUtil;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
Expand All @@ -14,7 +15,7 @@ public GUIEvent(LifeStolen ls){

@EventHandler
public void ClickEvent(InventoryClickEvent e){
if(e.getView().getTitle().equalsIgnoreCase(plugin.getConfig().getString("translation.serverName") + " Crafting View")){
if(InventoryUtil.getInventoryTitle(e).equalsIgnoreCase(plugin.getConfig().getString("translation.serverName") + " Crafting View")){
e.setCancelled(true);
}
}
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/me/kadotcom/lifestolen/Utils/InventoryUtil.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package me.kadotcom.lifestolen.Utils;

import org.bukkit.event.inventory.InventoryEvent;

public class InventoryUtil {

public static String getInventoryTitle(InventoryEvent e){
return e.getView().getTitle();
}
}

0 comments on commit aa85574

Please sign in to comment.