Skip to content

Commit

Permalink
Added new option to allow players to pick up items
Browse files Browse the repository at this point in the history
  • Loading branch information
Despical committed Jul 10, 2024
1 parent bda4822 commit 6c732d5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/main/java/me/despical/kotl/ConfigPreferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ public enum Option {
SEPARATE_COOLDOWNS("King-Settings.Separate-Cooldowns"),
UPDATE_GAME_MODE((config) -> !config.getStringList("Inventory-Manager.Do-Not-Restore").contains("game-mode")),
UPDATE_HUNGER((config) -> !config.getStringList("Inventory-Manager.Do-Not-Restore").contains("hunger")),
UPDATE_NOTIFIER_ENABLED(false);
UPDATE_NOTIFIER_ENABLED(false),
PICK_UP_ITEMS(false);

private final String path;
private final boolean def;
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/me/despical/kotl/events/Events.java
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,11 @@ public void onDrop(PlayerDropItemEvent event) {

@EventHandler
public void onPickUpItem(PlayerPickupItemEvent event) {
if (plugin.getArenaRegistry().isInArena(event.getPlayer())) {
if (!plugin.getArenaRegistry().isInArena(event.getPlayer())) {
return;
}

if (!plugin.getOption(ConfigPreferences.Option.PICK_UP_ITEMS)) {
event.setCancelled(true);
event.getItem().remove();
}
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ Damage-Enabled: true
# When players click these blocks should we remove them from the game?
Death-Blocks-Enabled: true

# Should players can be able to pick up items in-game?
Pick-Up-Items: false

# Blocks which you should not click in game, remove all of them to disable.
# If player interacts with a death block they will be kicked from the game.
Death-Blocks:
Expand Down

0 comments on commit 6c732d5

Please sign in to comment.