diff --git a/.run/ShulkerPacks.run.xml b/.run/ShulkerPacks.run.xml
new file mode 100644
index 0000000..16cc78a
--- /dev/null
+++ b/.run/ShulkerPacks.run.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 9ab6915..75d12b6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
me.Darkolythe
ShulkerPacks
- 1.6.4
+ 1.6.6
jar
@@ -27,10 +27,16 @@
+
+ org.projectlombok
+ lombok
+ 1.18.20
+ provided
+
org.spigotmc
spigot-api
- 1.13.2-R0.1-SNAPSHOT
+ 1.19.4-R0.1-SNAPSHOT
provided
@@ -42,13 +48,14 @@
+ install
org.apache.maven.plugins
maven-jar-plugin
2.3.1
- C:\Users\ChrisWalker\Desktop\1.18server\plugins
+ C:\Users\dinob\Documents\plugins
diff --git a/src/main/java/me/darkolythe/shulkerpacks/OpenShulker.java b/src/main/java/me/darkolythe/shulkerpacks/OpenShulker.java
new file mode 100644
index 0000000..e9ce86a
--- /dev/null
+++ b/src/main/java/me/darkolythe/shulkerpacks/OpenShulker.java
@@ -0,0 +1,41 @@
+package me.darkolythe.shulkerpacks;
+
+import lombok.Data;
+import lombok.RequiredArgsConstructor;
+import org.bukkit.Location;
+import org.bukkit.entity.HumanEntity;
+import org.bukkit.entity.Player;
+import org.bukkit.event.inventory.InventoryType;
+import org.bukkit.inventory.Inventory;
+import org.bukkit.inventory.ItemStack;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+@Data
+@RequiredArgsConstructor
+public class OpenShulker {
+ private ShulkerPacks plugin;
+ private HashMap openShulkerInventories = new HashMap<>();
+ private HashMap lastOpened = new HashMap<>();
+
+ private ItemStack itemStack;
+ private Location openLocation;
+ private InventoryType.SlotType slotType;
+ private int rawSlot;
+
+ public OpenShulker(ItemStack itemStack) {
+ this.itemStack = itemStack;
+ }
+ public boolean doesPlayerShulkerOpen(UUID uuid) {
+ for (Inventory inv : openShulkerInventories.keySet()) {
+ for (HumanEntity he : inv.getViewers()) {
+ if (he.getUniqueId().equals(uuid)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+}
diff --git a/src/main/java/me/darkolythe/shulkerpacks/ShulkerListener.java b/src/main/java/me/darkolythe/shulkerpacks/ShulkerListener.java
index c5e1d2e..7d1cf34 100644
--- a/src/main/java/me/darkolythe/shulkerpacks/ShulkerListener.java
+++ b/src/main/java/me/darkolythe/shulkerpacks/ShulkerListener.java
@@ -8,11 +8,13 @@
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
+import org.bukkit.event.Cancellable;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.inventory.*;
+import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
@@ -22,10 +24,15 @@
import java.util.List;
public class ShulkerListener implements Listener {
+ private OpenShulker os;
+ private ShulkerPacks plugin;
public ShulkerPacks main;
+
public ShulkerListener(ShulkerPacks plugin) {
+
this.main = plugin; //set it equal to an instance of main
+ plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
/*
@@ -68,10 +75,10 @@ public void onInventoryMoveItem(InventoryMoveItemEvent event) {
*/
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
- if (event.isCancelled()) {
- return;
- }
-
+ if (event.isCancelled()) {
+ return;
+ }
+
Player player = (Player) event.getWhoClicked();
if (ShulkerPacks.openshulkers.containsKey(player)) {
@@ -118,7 +125,7 @@ public void onInventoryClick(InventoryClickEvent event) {
// prevent the player from opening it in the inventory if they have no permission
if ((player.getInventory() == event.getClickedInventory())) {
if (!main.canopenininventory || !player.hasPermission("shulkerpacks.open_in_inventory")) {
- return;
+ return;
}
}
@@ -128,7 +135,7 @@ public void onInventoryClick(InventoryClickEvent event) {
}
if(event.getClickedInventory() != null && event.getClickedInventory().getHolder() != null && event.getClickedInventory().getHolder().getClass().toString().endsWith(".CraftBarrel") && !main.canopeninbarrels) {
- return;
+ return;
}
if (!main.canopeninenderchest && type == InventoryType.ENDER_CHEST) {
@@ -224,9 +231,11 @@ public void onClickAir(PlayerInteractEvent event) {
}
@EventHandler
- public void onShulkerPlace(BlockPlaceEvent event) {
+ public void onShulkerPlace(BlockPlaceEvent event, Player player) {
+ onPlayerPlackets(event.getPlayer(), event);
if (event.getBlockPlaced().getType().toString().contains("SHULKER_BOX")) {
if (!main.canplaceshulker) {
+ player.sendMessage(main.prefix + main.noplaceshulker);
event.setCancelled(true);
}
}
@@ -298,7 +307,7 @@ public boolean openInventoryIfShulker(ItemStack item, Player player) {
if (item.getAmount() == 1 && item.getType().toString().contains("SHULKER")) {
if (main.getPvpTimer(player)) {
- player.sendMessage(main.prefix + ChatColor.RED + "You cannot open shulkerboxes in combat!");
+ player.sendMessage(main.prefix + main.notinpvp);
return false;
}
@@ -355,4 +364,15 @@ public void run() {
}
}, 1L, 1L);
}
+ public void onPlayerPlackets(Player p, Cancellable c) {
+ if (p.getOpenInventory().getType() != InventoryType.SHULKER_BOX) return;
+ if(p.getOpenInventory().getTopInventory().getLocation() != null) return;
+ if(!os.doesPlayerShulkerOpen(p.getUniqueId())) return;
+ c.setCancelled(true);
+ }
+ @EventHandler
+ public void onItemFrameInteract(PlayerInteractEntityEvent e){
+ onPlayerPlackets(e.getPlayer(), e);
+ }
}
+
diff --git a/src/main/java/me/darkolythe/shulkerpacks/ShulkerPacks.java b/src/main/java/me/darkolythe/shulkerpacks/ShulkerPacks.java
index af543fe..099061b 100644
--- a/src/main/java/me/darkolythe/shulkerpacks/ShulkerPacks.java
+++ b/src/main/java/me/darkolythe/shulkerpacks/ShulkerPacks.java
@@ -19,7 +19,10 @@ public final class ShulkerPacks extends JavaPlugin {
String prefix = ChatColor.WHITE.toString() + ChatColor.BOLD.toString() + "[" + ChatColor.BLUE.toString() + "ShulkerPacks" + ChatColor.WHITE.toString() + ChatColor.BOLD.toString() + "] ";
static Map openshulkers = new HashMap<>();
- Map fromhand = new HashMap<>();
+ Map fromhand = new HashMap<>();;
+ private HashMap openShulkerInventories = new HashMap<>();
+ private HashMap lastOpened = new HashMap<>();
+
Map openinventories = new HashMap<>();
Map opencontainer = new HashMap<>();
private Map pvp_timer = new HashMap<>();
@@ -27,6 +30,8 @@ public final class ShulkerPacks extends JavaPlugin {
boolean openpreviousinv = false;
List blacklist = new ArrayList<>();
String defaultname = ChatColor.BLUE + "Shulker Pack";
+ String notinpvp = ChatColor.RED +"You cannot open shulkerboxes in combat!";
+ String noplaceshulker = ChatColor.RED + "you cannot place the shulker.";
boolean pvp_timer_enabled = false;
boolean shiftclicktoopen = false;
boolean canopeninenderchest, canopeninbarrels, canplaceshulker, canopenininventory, canopeninair;
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index f933d5e..7129393 100644
--- a/src/main/resources/config.yml
+++ b/src/main/resources/config.yml
@@ -15,9 +15,13 @@ canplaceshulker: true #false will prevent users from placing shulkerboxe
#true will prevent users from opening shulkerboxes within 7 seconds of being hit by a player
disable-in-combat: false
-defaultname: "&9Shulker Pack"
+defaultname: '&9Shulker Pack'
shiftclicktoopen: false
shulkervolume: 1 #0.1 is quiet, 1 is loud
#shift click to open applies to both ingame and in inventory
open-previous-inventory: false
+
+#lang
+notinpvp: '&4You cannot open shulkerboxes in combat!'
+noplaceshulker: '&4you cannot place the shulker!'
\ No newline at end of file
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index 157c917..b33b14c 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -1,7 +1,7 @@
name: ShulkerPacks
-version: 1.6.4
+version: 1.6.6
main: me.darkolythe.shulkerpacks.ShulkerPacks
-api-version: 1.13
+api-version: 1.19
commands:
shulkerpacks:
diff --git a/target/classes/config.yml b/target/classes/config.yml
new file mode 100644
index 0000000..7129393
--- /dev/null
+++ b/target/classes/config.yml
@@ -0,0 +1,27 @@
+# BLACKLIST AUCTION INVENTORIES HERE
+# blacklist works as follows:
+# if you include the word "a" in the blacklist, every inventory with the letter "a" will be blocked.
+# because of this, try to be as precise as possible.
+# If your inventory contains extra characters, such as "Auction Page 8", simply blacklisting "Auction Page" will block every page
+blacklistedinventories: ["&4&lMineXChange", "test inventory"]
+
+canopeninair: true #false will prevent users from opening shulkerboxes by clicking the air
+canopenininventory: true #false will prevent users from opening shulkerboxes in their inventory
+canopeninchests: true #false will prevent users from opening shulkerboxes in chests
+canopeninenderchest: true #false will prevent users from opening shulkerboxes in enderchests
+canopeninbarrels: true #false will prevent users from opening shulkerboxes in barrels
+canplaceshulker: true #false will prevent users from placing shulkerboxes by accident
+
+#true will prevent users from opening shulkerboxes within 7 seconds of being hit by a player
+disable-in-combat: false
+
+defaultname: '&9Shulker Pack'
+shiftclicktoopen: false
+shulkervolume: 1 #0.1 is quiet, 1 is loud
+#shift click to open applies to both ingame and in inventory
+
+open-previous-inventory: false
+
+#lang
+notinpvp: '&4You cannot open shulkerboxes in combat!'
+noplaceshulker: '&4you cannot place the shulker!'
\ No newline at end of file
diff --git a/target/classes/me/darkolythe/shulkerpacks/CommandReload.class b/target/classes/me/darkolythe/shulkerpacks/CommandReload.class
new file mode 100644
index 0000000..dc89c26
Binary files /dev/null and b/target/classes/me/darkolythe/shulkerpacks/CommandReload.class differ
diff --git a/target/classes/me/darkolythe/shulkerpacks/ConfigHandler.class b/target/classes/me/darkolythe/shulkerpacks/ConfigHandler.class
new file mode 100644
index 0000000..e2d277a
Binary files /dev/null and b/target/classes/me/darkolythe/shulkerpacks/ConfigHandler.class differ
diff --git a/target/classes/me/darkolythe/shulkerpacks/ShulkerHolder.class b/target/classes/me/darkolythe/shulkerpacks/ShulkerHolder.class
new file mode 100644
index 0000000..69f6e8a
Binary files /dev/null and b/target/classes/me/darkolythe/shulkerpacks/ShulkerHolder.class differ
diff --git a/target/classes/me/darkolythe/shulkerpacks/ShulkerListener$1.class b/target/classes/me/darkolythe/shulkerpacks/ShulkerListener$1.class
new file mode 100644
index 0000000..2384858
Binary files /dev/null and b/target/classes/me/darkolythe/shulkerpacks/ShulkerListener$1.class differ
diff --git a/target/classes/me/darkolythe/shulkerpacks/ShulkerListener$2.class b/target/classes/me/darkolythe/shulkerpacks/ShulkerListener$2.class
new file mode 100644
index 0000000..cbbc3e2
Binary files /dev/null and b/target/classes/me/darkolythe/shulkerpacks/ShulkerListener$2.class differ
diff --git a/target/classes/me/darkolythe/shulkerpacks/ShulkerListener$3.class b/target/classes/me/darkolythe/shulkerpacks/ShulkerListener$3.class
new file mode 100644
index 0000000..f08f750
Binary files /dev/null and b/target/classes/me/darkolythe/shulkerpacks/ShulkerListener$3.class differ
diff --git a/target/classes/me/darkolythe/shulkerpacks/ShulkerListener$4.class b/target/classes/me/darkolythe/shulkerpacks/ShulkerListener$4.class
new file mode 100644
index 0000000..ac7eff6
Binary files /dev/null and b/target/classes/me/darkolythe/shulkerpacks/ShulkerListener$4.class differ
diff --git a/target/classes/me/darkolythe/shulkerpacks/ShulkerListener$5.class b/target/classes/me/darkolythe/shulkerpacks/ShulkerListener$5.class
new file mode 100644
index 0000000..b95ba65
Binary files /dev/null and b/target/classes/me/darkolythe/shulkerpacks/ShulkerListener$5.class differ
diff --git a/target/classes/me/darkolythe/shulkerpacks/ShulkerListener.class b/target/classes/me/darkolythe/shulkerpacks/ShulkerListener.class
new file mode 100644
index 0000000..c3737fa
Binary files /dev/null and b/target/classes/me/darkolythe/shulkerpacks/ShulkerListener.class differ
diff --git a/target/classes/me/darkolythe/shulkerpacks/ShulkerPacks.class b/target/classes/me/darkolythe/shulkerpacks/ShulkerPacks.class
new file mode 100644
index 0000000..81eaedf
Binary files /dev/null and b/target/classes/me/darkolythe/shulkerpacks/ShulkerPacks.class differ
diff --git a/target/classes/plugin.yml b/target/classes/plugin.yml
new file mode 100644
index 0000000..b33b14c
--- /dev/null
+++ b/target/classes/plugin.yml
@@ -0,0 +1,24 @@
+name: ShulkerPacks
+version: 1.6.6
+main: me.darkolythe.shulkerpacks.ShulkerPacks
+api-version: 1.19
+
+commands:
+ shulkerpacks:
+ usage: / reload
+ description: reloads the shulkerpacks config
+ permission: op
+
+permissions:
+ shulkerpacks.use:
+ description: gives player permission to open shulker boxes in their inventory
+ default: op
+ shulkerpacks.open_in_air:
+ description: allows the player to open the shulkerbox in the air (if config enables it) if the player has "shulkerpacks.use"
+ default: true
+ shulkerpacks.open_in_inventory:
+ description: allows the player to open the shulkerbox in their inventory (if config enables it) if the player has "shulkerpacks.use"
+ default: true
+ shulkerpacks.open_in_chests:
+ description: allows the player to open the shulkerbox in a chest (if config enables it) if the player has "shulkerpacks.use"
+ default: true
diff --git a/target/maven-archiver/pom.properties b/target/maven-archiver/pom.properties
new file mode 100644
index 0000000..0d4d4d0
--- /dev/null
+++ b/target/maven-archiver/pom.properties
@@ -0,0 +1,5 @@
+#Generated by Maven
+#Mon Apr 24 18:29:21 UYT 2023
+artifactId=ShulkerPacks
+groupId=me.Darkolythe
+version=1.6.6
diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
new file mode 100644
index 0000000..da30708
--- /dev/null
+++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
@@ -0,0 +1,11 @@
+me\darkolythe\shulkerpacks\OpenShulker.class
+me\darkolythe\shulkerpacks\ShulkerHolder.class
+me\darkolythe\shulkerpacks\ShulkerPacks.class
+me\darkolythe\shulkerpacks\ConfigHandler.class
+me\darkolythe\shulkerpacks\ShulkerListener$1.class
+me\darkolythe\shulkerpacks\CommandReload.class
+me\darkolythe\shulkerpacks\ShulkerListener$5.class
+me\darkolythe\shulkerpacks\ShulkerListener$3.class
+me\darkolythe\shulkerpacks\ShulkerListener$2.class
+me\darkolythe\shulkerpacks\ShulkerListener$4.class
+me\darkolythe\shulkerpacks\ShulkerListener.class
diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
new file mode 100644
index 0000000..582aed0
--- /dev/null
+++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
@@ -0,0 +1,5 @@
+C:\Users\dinob\IdeaProjects\ShulkerPacks\src\main\java\me\darkolythe\shulkerpacks\CommandReload.java
+C:\Users\dinob\IdeaProjects\ShulkerPacks\src\main\java\me\darkolythe\shulkerpacks\ShulkerListener.java
+C:\Users\dinob\IdeaProjects\ShulkerPacks\src\main\java\me\darkolythe\shulkerpacks\ShulkerHolder.java
+C:\Users\dinob\IdeaProjects\ShulkerPacks\src\main\java\me\darkolythe\shulkerpacks\ShulkerPacks.java
+C:\Users\dinob\IdeaProjects\ShulkerPacks\src\main\java\me\darkolythe\shulkerpacks\ConfigHandler.java
diff --git a/target/original-ShulkerPacks-1.6.5.jar b/target/original-ShulkerPacks-1.6.5.jar
new file mode 100644
index 0000000..fe0851d
Binary files /dev/null and b/target/original-ShulkerPacks-1.6.5.jar differ