From 790f1a13e1ff678e6713ac181d5cba098d2c931f Mon Sep 17 00:00:00 2001 From: Angelillo15 Date: Sun, 10 Sep 2023 14:55:07 +0200 Subject: [PATCH 1/3] Fix on chest open --- .../listener/staffmode/OnOpenChest.java | 53 +++++++++---------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/MAStaff-Bukkit/src/main/java/es/angelillo15/mast/bukkit/listener/staffmode/OnOpenChest.java b/MAStaff-Bukkit/src/main/java/es/angelillo15/mast/bukkit/listener/staffmode/OnOpenChest.java index ccc005e0..46967c0d 100644 --- a/MAStaff-Bukkit/src/main/java/es/angelillo15/mast/bukkit/listener/staffmode/OnOpenChest.java +++ b/MAStaff-Bukkit/src/main/java/es/angelillo15/mast/bukkit/listener/staffmode/OnOpenChest.java @@ -14,39 +14,38 @@ import org.bukkit.inventory.Inventory; public class OnOpenChest implements Listener { - @Inject - private StaffManager staffManager; + @Inject + private StaffManager staffManager; - @EventHandler(priority = EventPriority.HIGHEST) - public void onPlayerInteract(PlayerInteractEvent event) { - Player player = event.getPlayer(); + @EventHandler(priority = EventPriority.HIGHEST) + public void onPlayerInteract(PlayerInteractEvent event) { + Player player = event.getPlayer(); - if (!staffManager.isStaffPlayer(player)) { - return; - } + if (!staffManager.isStaffPlayer(player)) { + return; + } - IStaffPlayer staffPlayer = staffManager.getStaffPlayer(player); + IStaffPlayer staffPlayer = staffManager.getStaffPlayer(player); - if (!staffPlayer.isStaffMode()) { - return; - } + if (!staffPlayer.isStaffMode()) { + return; + } - if (event.getClickedBlock() == null) { - return; - } + if (event.getClickedBlock() == null) { + return; + } - if (!event.getClickedBlock().getType().name().contains("CHEST")) { - return; - } + if (!event.getClickedBlock().getType().name().contains("CHEST")) { + return; + } - Container container = (Container) event.getClickedBlock().getState(); + Container container = (Container) event.getClickedBlock().getState(); - if (container instanceof Chest chest) { - Inventory cInv = Bukkit.createInventory(null, chest.getInventory().getSize(), chest.getInventory().getType().name()); - - player.openInventory(cInv); - - event.setCancelled(true); - } - } + if (container instanceof Chest chest) { + Inventory cInv = Bukkit.createInventory(null, chest.getInventory().getSize(), chest.getInventory().getType().name()); + cInv.setContents(chest.getInventory().getContents()); + player.openInventory(cInv); + event.setCancelled(true); + } + } } From 505f06c0eeb6b23f84174c9353e7520d0b1e8525 Mon Sep 17 00:00:00 2001 From: Angelillo15 Date: Sun, 10 Sep 2023 14:58:21 +0200 Subject: [PATCH 2/3] Refactor to 2 spaces --- .../listener/staffmode/OnOpenChest.java | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/MAStaff-Bukkit/src/main/java/es/angelillo15/mast/bukkit/listener/staffmode/OnOpenChest.java b/MAStaff-Bukkit/src/main/java/es/angelillo15/mast/bukkit/listener/staffmode/OnOpenChest.java index 46967c0d..428d294b 100644 --- a/MAStaff-Bukkit/src/main/java/es/angelillo15/mast/bukkit/listener/staffmode/OnOpenChest.java +++ b/MAStaff-Bukkit/src/main/java/es/angelillo15/mast/bukkit/listener/staffmode/OnOpenChest.java @@ -14,38 +14,38 @@ import org.bukkit.inventory.Inventory; public class OnOpenChest implements Listener { - @Inject - private StaffManager staffManager; + @Inject + private StaffManager staffManager; - @EventHandler(priority = EventPriority.HIGHEST) - public void onPlayerInteract(PlayerInteractEvent event) { - Player player = event.getPlayer(); + @EventHandler(priority = EventPriority.HIGHEST) + public void onPlayerInteract(PlayerInteractEvent event) { + Player player = event.getPlayer(); - if (!staffManager.isStaffPlayer(player)) { - return; - } + if (!staffManager.isStaffPlayer(player)) { + return; + } - IStaffPlayer staffPlayer = staffManager.getStaffPlayer(player); + IStaffPlayer staffPlayer = staffManager.getStaffPlayer(player); - if (!staffPlayer.isStaffMode()) { - return; - } + if (!staffPlayer.isStaffMode()) { + return; + } - if (event.getClickedBlock() == null) { - return; - } + if (event.getClickedBlock() == null) { + return; + } - if (!event.getClickedBlock().getType().name().contains("CHEST")) { - return; - } + if (!event.getClickedBlock().getType().name().contains("CHEST")) { + return; + } - Container container = (Container) event.getClickedBlock().getState(); + Container container = (Container) event.getClickedBlock().getState(); - if (container instanceof Chest chest) { - Inventory cInv = Bukkit.createInventory(null, chest.getInventory().getSize(), chest.getInventory().getType().name()); - cInv.setContents(chest.getInventory().getContents()); - player.openInventory(cInv); - event.setCancelled(true); - } - } + if (container instanceof Chest chest) { + Inventory cInv = Bukkit.createInventory(null, chest.getInventory().getSize(), chest.getInventory().getType().name()); + cInv.setContents(chest.getInventory().getContents()); + player.openInventory(cInv); + event.setCancelled(true); + } + } } From e49d3d2f8113c23ce7f6bb27b36c538674277282 Mon Sep 17 00:00:00 2001 From: Angelillo15 Date: Sun, 10 Sep 2023 15:00:40 +0200 Subject: [PATCH 3/3] Change CI/CD --- .github/workflows/Javadoc.yml | 2 -- .github/workflows/build.yml | 2 +- .github/workflows/publish-api.yml | 28 ---------------------------- 3 files changed, 1 insertion(+), 31 deletions(-) delete mode 100644 .github/workflows/publish-api.yml diff --git a/.github/workflows/Javadoc.yml b/.github/workflows/Javadoc.yml index 8d932ad3..4e4cc4f6 100644 --- a/.github/workflows/Javadoc.yml +++ b/.github/workflows/Javadoc.yml @@ -10,8 +10,6 @@ name: JavaDoc Generator on: push: branches: [ 2.x ] - pull_request: - branches: [ 2.x ] jobs: build-on-ubuntu: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0d0f2dc9..a3d6f3a0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,7 +24,7 @@ jobs: - name: Seting up JDK 1.8 uses: actions/setup-java@v1 with: - java-version: 11 + java-version: 17 - name: Setup Gradle uses: gradle/gradle-build-action@v2 diff --git a/.github/workflows/publish-api.yml b/.github/workflows/publish-api.yml deleted file mode 100644 index a2e0a808..00000000 --- a/.github/workflows/publish-api.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Publish to nexus - -on: [ push ] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 - with: - java-version: 11 - - name: Grant perms to gradlew - run: chmod +x ./gradlew - - name: build - run: ./gradlew shadowJar - - name: Nexus Repo Publish - uses: sonatype-nexus-community/nexus-repo-github-action@master - with: - serverUrl: https://repo.nookure.com/ - username: admin - password: ${{ secrets.NEXUS_PASSWORD }} - format: maven2 - repository: maven-releases - coordinates: groupId=es.angelillo15 artifactId=mast-api version=2.0.0b - assets: extension=jar - filename: ./MAStaff-API/build/libs/MAStaff-API.jar