Skip to content

Commit

Permalink
Fix EmptyHitBoxExceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerS1066 committed Mar 15, 2021
1 parent c8464e9 commit 54714b7
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>net.countercraft.movecraft.worldguard</groupId>
<artifactId>Movecraft-WorldGuard</artifactId>
<version>0.1.0</version>
<version>0.1.1</version>
<packaging>jar</packaging>

<name>Movecraft-WorldGuard</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
public class CombatReleaseListener implements Listener {
@EventHandler
public void onCombatRelease(CombatReleaseEvent e) {
if(e.getCraft().getHitBox().isEmpty())
return;

// If in a region with TNT or PVP denied, cancel the combat release
if(!MovecraftWorldGuard.getInstance().getWGUtils().isPVPAllowed(e.getCraft().getW(), e.getCraft().getHitBox()))
e.setCancelled(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public void onCraftRotateEvent(CraftRotateEvent e){
if(!Config.WorldGuardBlockMoveOnBuildPerm)
return;

if(e.getCraft().getNotificationPlayer() == null)
if(e.getCraft().getNotificationPlayer() == null || e.getNewHitBox().isEmpty())
return;

if(MovecraftWorldGuard.getInstance().getWGUtils().canRotate(e.getCraft().getNotificationPlayer(), e.getCraft().getW(), e.getNewHitBox()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ public void onCraftSink(CraftSinkEvent e) {
if(!Config.WorldGuardBlockSinkOnPVPPerm)
return;

if(e.getCraft().getHitBox().isEmpty())
return;

if(MovecraftWorldGuard.getInstance().getWGUtils().isPVPAllowed(e.getCraft().getW(), e.getCraft().getHitBox()))
return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public void onCraftTranslate(CraftTranslateEvent e) {
if(!Config.WorldGuardBlockMoveOnBuildPerm)
return;

if(e.getCraft().getNotificationPlayer() == null)
if(e.getCraft().getNotificationPlayer() == null || e.getNewHitBox().isEmpty())
return;

if(MovecraftWorldGuard.getInstance().getWGUtils().canTranslate(e.getCraft().getNotificationPlayer(), e.getCraft().getW(), e.getNewHitBox()))
Expand Down

0 comments on commit 54714b7

Please sign in to comment.