Skip to content

Commit

Permalink
Added option to enable arrow pickups (Resolves #10)
Browse files Browse the repository at this point in the history
  • Loading branch information
Despical committed Dec 17, 2023
1 parent b2c2b7f commit a4584e8
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ The project isn't in the Central Repository yet, so specifying a repository is n
<dependency>
<groupId>com.github.Despical</groupId>
<artifactId>OITC</artifactId>
<version>2.5.2</version>
<version>LATEST</version>
<scope>compile</scope>
</dependency>
```
Expand All @@ -53,7 +53,7 @@ repositories {
```
```
dependencies {
compileOnly group: "com.github.Despical", name: "OITC", version: "2.5.2";
compileOnly group: "com.github.Despical", name: "OITC", version: "LATEST";
}
```
</details>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>me.despical</groupId>
<artifactId>one-in-the-chamber</artifactId>
<version>2.5.2</version>
<version>2.5.3</version>
<packaging>jar</packaging>

<name>One In The Chamber</name>
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/me/despical/oitc/ConfigPreferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ public enum Option {
BLOCK_COMMANDS, BOSS_BAR_ENABLED, BUNGEE_ENABLED(false), CHAT_FORMAT_ENABLED, DATABASE_ENABLED(false),
DISABLE_FALL_DAMAGE(false), DISABLE_LEAVE_COMMAND(false), DISABLE_SEPARATE_CHAT(false),
ENABLE_SHORT_COMMANDS, IGNORE_WARNING_MESSAGES(false), INVENTORY_MANAGER_ENABLED("Inventory-Manager.Enabled"),
NAME_TAGS_HIDDEN, UPDATE_NOTIFIER_ENABLED, REGEN_ENABLED(false), HIDE_PLAYERS,
LEVEL_COUNTDOWN_ENABLED(false), DISABLE_SPECTATING_ON_BUNGEE(false), INSTANT_LEAVE(false),
NAME_TAGS_HIDDEN, UPDATE_NOTIFIER_ENABLED, REGEN_ENABLED(false), HIDE_PLAYERS, ENABLE_ARROW_PICKUPS(false),
LEVEL_COUNTDOWN_ENABLED(false), DISABLE_SPECTATING_ON_BUNGEE(false), INSTANT_LEAVE(false),

HEAL_PLAYER((config) -> {
final List<String> list = config.getStringList("Inventory-Manager.Do-Not-Restore");
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/me/despical/oitc/events/Events.java
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,8 @@ public void onFallDamage(EntityDamageEvent event) {

@EventHandler
public void onPickupItem(PlayerPickupItemEvent event) {
if (!plugin.getOption(ConfigPreferences.Option.ENABLE_ARROW_PICKUPS)) return;

if (!arenaRegistry.isInArena(event.getPlayer())) {
return;
}
Expand Down Expand Up @@ -510,6 +512,8 @@ public void onItemSwap(PlayerSwapHandItemsEvent event) {

@EventHandler
public void onArrowPickup(PlayerPickupArrowEvent event) {
if (!plugin.getOption(ConfigPreferences.Option.ENABLE_ARROW_PICKUPS)) return;

if (arenaRegistry.isInArena(event.getPlayer())) {
event.getItem().remove();
event.setCancelled(true);
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 @@ -111,6 +111,9 @@ Name-Tags-Hidden: true
# Should we hide in-game players to other online players?
Hide-Players: true

# Should we allow players to pick up arrows from ground?
Enable-Arrow-Pickups: false

# Should we check for updates on plugin start/after admin join?
Update-Notifier-Enabled: true

Expand Down

0 comments on commit a4584e8

Please sign in to comment.