Skip to content

Commit

Permalink
GUI interact event
Browse files Browse the repository at this point in the history
Work for Issue #76
  • Loading branch information
Dart2112 committed Oct 20, 2024
1 parent 5c4e035 commit 6035194
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/modules/Users.benja.IdeaProjects.AFKPlus.main.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/main/java/net/lapismc/afkplus/AFKPlus.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public final class AFKPlus extends LapisCorePlugin {
@Override
public void onEnable() {
saveDefaultConfig();
registerConfiguration(new AFKPlusConfiguration(this, 15, 5));
registerConfiguration(new AFKPlusConfiguration(this, 16, 5));
registerPermissions(new AFKPlusPermissions(this));
registerLuckPermsContext();
update();
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/net/lapismc/afkplus/AFKPlusListeners.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.*;
import org.bukkit.event.inventory.InventoryInteractEvent;
import org.bukkit.event.player.*;
import org.bukkit.scheduler.BukkitTask;

Expand Down Expand Up @@ -124,6 +125,16 @@ public void onPlayerInteract(PlayerInteractEvent e) {
}
}

@EventHandler
public void onPlayerInventoryInteract(InventoryInteractEvent e) {
if (!(e.getWhoClicked() instanceof Player)) {
return;
}
if (plugin.getConfig().getBoolean("EnabledDetections.GUI")) {
plugin.getPlayer(e.getWhoClicked().getUniqueId()).interact();
}
}

@EventHandler
public void onPlayerBlockPlace(BlockPlaceEvent e) {
if (plugin.getConfig().getBoolean("EnabledDetections.BlockPlace")) {
Expand Down
4 changes: 3 additions & 1 deletion src/main/resources/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ConfigVersion: 15
ConfigVersion: 16

#Should the plugin check for new updates, UpdateDownload will not work if this is set to false
UpdateCheck: true
Expand Down Expand Up @@ -53,6 +53,8 @@ EnabledDetections:
Command: true
#Right-clicking blocks
Interact: true
#Intertacting with an inventory or entity GUI
GUI: true
#Placing blocks
BlockPlace: true
#Breaking blocks
Expand Down

0 comments on commit 6035194

Please sign in to comment.