Skip to content

Commit

Permalink
Merge pull request #552 from DansPlugins/fixing-bugs
Browse files Browse the repository at this point in the history
Fixing bugs
  • Loading branch information
dmccoystephenson authored Aug 24, 2020
2 parents 5465e4a + 554c6b3 commit 172f145
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 9 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>KingdomProgrammers</groupId>
<artifactId>Medieval-Factions</artifactId>
<version>v3.4.2</version>
<version>v3.4.3</version>
<packaging>jar</packaging>

<name>Medieval Factions</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import java.util.UUID;

import static factionsystem.Subsystems.UtilitySubsystem.*;
import static org.bukkit.Material.LADDER;
import static org.bukkit.Material.*;

public class PlayerInteractEventHandler {

Expand Down Expand Up @@ -254,7 +254,7 @@ private void handleClaimedChunk(PlayerInteractEvent event, ClaimedChunk chunk) {
// if enemy territory
if (faction.isEnemy(chunk.getHolder())) {
// if not interacting with chest
if (!interactingWithChest(event)) {
if (isBlockInteractable(event)) {
// allow placing ladders
if (main.getConfig().getBoolean("laddersPlaceableInEnemyFactionTerritory")) {
if (event.getMaterial() == LADDER) {
Expand All @@ -279,11 +279,46 @@ private void handleClaimedChunk(PlayerInteractEvent event, ClaimedChunk chunk) {
}
}

public boolean interactingWithChest(PlayerInteractEvent event) {
if (event.getClickedBlock() != null && main.utilities.isChest(event.getClickedBlock())) {
return true;
public boolean isBlockInteractable(PlayerInteractEvent event) {
if (event.getClickedBlock() != null) {
// CHEST
if (main.utilities.isChest(event.getClickedBlock())) {
return false;
}
switch(event.getClickedBlock().getType()) {
case ACACIA_DOOR:
case BIRCH_DOOR:
case DARK_OAK_DOOR:
case IRON_DOOR:
case JUNGLE_DOOR:
case OAK_DOOR:
case SPRUCE_DOOR:
case ACACIA_TRAPDOOR:
case BIRCH_TRAPDOOR:
case DARK_OAK_TRAPDOOR:
case IRON_TRAPDOOR:
case JUNGLE_TRAPDOOR:
case OAK_TRAPDOOR:
case SPRUCE_TRAPDOOR:
case ACACIA_FENCE_GATE:
case BIRCH_FENCE_GATE:
case DARK_OAK_FENCE_GATE:
case JUNGLE_FENCE_GATE:
case OAK_FENCE_GATE:
case SPRUCE_FENCE_GATE:
case BARREL:
case LEVER:
case ACACIA_BUTTON:
case BIRCH_BUTTON:
case DARK_OAK_BUTTON:
case JUNGLE_BUTTON:
case OAK_BUTTON:
case SPRUCE_BUTTON:
case STONE_BUTTON:
return false;
}
}
return false;
return true;
}

public boolean materialAllowed(Material material) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/factionsystem/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
public class Main extends JavaPlugin implements Listener {

// version
public static String version = "v3.4.2";
public static String version = "v3.4.3";

// subsystems
public StorageSubsystem storage = new StorageSubsystem(this);
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: MedievalFactions
version: 3.4.2
version: 3.4.3
author: KingdomProgrammers
main: factionsystem.Main
api-version: 1.13
Expand Down

0 comments on commit 172f145

Please sign in to comment.