Skip to content

Commit 63a2e4e

Browse files
committed
Merge branch 'master' into copilot/suggest-use-q-to-unload-weapon
2 parents 57b976f + 9c2bf15 commit 63a2e4e

File tree

6 files changed

+18
-6
lines changed

6 files changed

+18
-6
lines changed

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<modelVersion>4.0.0</modelVersion>
66
<groupId>me.zombie_striker</groupId>
77
<artifactId>QualityArmory</artifactId>
8-
<version>2.1.0-SNAPSHOT</version>
8+
<version>2.1.1-SNAPSHOT</version>
99
<name>QualityArmory</name>
1010

1111
<properties>
@@ -75,13 +75,13 @@
7575
<dependency>
7676
<groupId>com.github.cryptomorin</groupId>
7777
<artifactId>XSeries</artifactId>
78-
<version>13.5.1</version>
78+
<version>13.6.0</version>
7979
</dependency>
8080

8181
<dependency>
8282
<groupId>de.tr7zw</groupId>
8383
<artifactId>item-nbt-api</artifactId>
84-
<version>2.15.3</version>
84+
<version>2.15.5</version>
8585
</dependency>
8686

8787
<!-- WorldGuard Wrapper -->

src/main/java/me/zombie_striker/qg/QAMain.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ public class QAMain extends JavaPlugin {
169169
public static boolean preventHiddenPlayers = true;
170170
public static boolean anticheatFix = false;
171171
public static boolean preventGunsInHoppers = true;
172+
public static int hitDistance = 5;
172173

173174
public static String S_NOPERM = "&c You do not have permission to do that.";
174175

@@ -868,6 +869,7 @@ public void reloadVals() {
868869

869870
allowGunHitEntities = (boolean) a("allowGunHitEntities", true);
870871
preventHiddenPlayers = (boolean) a("preventHiddenPlayers", true);
872+
hitDistance = (int) a("hitDistance", hitDistance);
871873

872874
preventGunsInHoppers = (boolean) a("preventGunsInHoppers", true);
873875

src/main/java/me/zombie_striker/qg/guns/Gun.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,11 @@ private boolean onClick(final Player player, ItemStack usedItem, boolean fire) {
912912
if (GunUtil.rapidfireshooters.containsKey(player.getUniqueId()))
913913
GunUtil.rapidfireshooters.remove(player.getUniqueId()).cancel();
914914

915-
player.playSound(player.getLocation(), WeaponSounds.OUT_OF_AMMO_CLICK.getSoundName(), 1f, 1f);
915+
try {
916+
player.getWorld().playSound(player.getLocation(), WeaponSounds.OUT_OF_AMMO_CLICK.getSoundName(), 1f, 1f);
917+
} catch (Exception | Error ignored) {
918+
player.playSound(player.getLocation(), WeaponSounds.OUT_OF_AMMO_CLICK.getSoundName(), 1f, 1f);
919+
}
916920

917921
if (QAMain.enableReloadWhenOutOfAmmo) {
918922
if (offhand) {

src/main/java/me/zombie_striker/qg/listener/QAListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public void onHit(EntityDamageByEntityEvent e) {
7777
if (g == null || !d.getLocation().getWorld().equals(e.getEntity().getLocation().getWorld())) return;
7878

7979
double distance = d.getLocation().distance(e.getEntity().getLocation());
80-
if (distance > 5) return;
80+
if (distance >= QAMain.hitDistance) return;
8181

8282
ignoreClick.add(d.getUniqueId());
8383

src/main/resources/changelog.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2.1.1
2+
- 1.21.11 support
3+
- Made out of ammo sound public
4+
- Fixed direct entities hit
5+
16
2.1.0
27
- 1.21.10 support
38
- Added new fully customizable menu

wiki/config/main.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,5 @@ Below you can find a list of all the options that you can configure and their ex
9797
* **enable_lore_gun-bullets**: `false` - If `true`, displays the bullet amount in the item's lore text. This will make the gun go "up and down" when shooting.
9898
* **weaponSwitchDelay**: `0` - The delay in seconds before a player can fire after switching weapon. A value of `0` means no delay.
9999
* **DefaultResourcepack**: Defines the resource pack URLs. Refer to [ResourcePack Configuration](resourcepack.md) for more information.
100-
* **restoreOffHand**: `false` - If `true`, restores the off-hand item after iron sights are unaimed.
100+
* **restoreOffHand**: `false` - If `true`, restores the off-hand item after iron sights are unaimed.
101+
* **hitDistance**: `5` - The maximum distance (in blocks) at which a gun can register melee hits on entities when using the gun to hit directly.

0 commit comments

Comments
 (0)