diff --git a/.gradle/8.8/executionHistory/executionHistory.bin b/.gradle/8.8/executionHistory/executionHistory.bin index 71a57ba..f4d8cd9 100644 Binary files a/.gradle/8.8/executionHistory/executionHistory.bin and b/.gradle/8.8/executionHistory/executionHistory.bin differ diff --git a/.gradle/8.8/executionHistory/executionHistory.lock b/.gradle/8.8/executionHistory/executionHistory.lock index 224b28c..b2ca78e 100644 Binary files a/.gradle/8.8/executionHistory/executionHistory.lock and b/.gradle/8.8/executionHistory/executionHistory.lock differ diff --git a/.gradle/8.8/fileHashes/fileHashes.bin b/.gradle/8.8/fileHashes/fileHashes.bin index bfe406a..f38443e 100644 Binary files a/.gradle/8.8/fileHashes/fileHashes.bin and b/.gradle/8.8/fileHashes/fileHashes.bin differ diff --git a/.gradle/8.8/fileHashes/fileHashes.lock b/.gradle/8.8/fileHashes/fileHashes.lock index 83a6756..b7bce9c 100644 Binary files a/.gradle/8.8/fileHashes/fileHashes.lock and b/.gradle/8.8/fileHashes/fileHashes.lock differ diff --git a/.gradle/8.8/fileHashes/resourceHashesCache.bin b/.gradle/8.8/fileHashes/resourceHashesCache.bin index 48cb62f..a197375 100644 Binary files a/.gradle/8.8/fileHashes/resourceHashesCache.bin and b/.gradle/8.8/fileHashes/resourceHashesCache.bin differ diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock index 665b07e..64f0367 100644 Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/build/classes/java/main/CoswayUtil/BlockShop.class b/build/classes/java/main/CoswayUtil/BlockShop.class index c22aa14..81c0991 100644 Binary files a/build/classes/java/main/CoswayUtil/BlockShop.class and b/build/classes/java/main/CoswayUtil/BlockShop.class differ diff --git a/build/classes/java/main/CoswayUtil/CoswayUtil$2.class b/build/classes/java/main/CoswayUtil/CoswayUtil$2.class index f645ab1..928c380 100644 Binary files a/build/classes/java/main/CoswayUtil/CoswayUtil$2.class and b/build/classes/java/main/CoswayUtil/CoswayUtil$2.class differ diff --git a/build/classes/java/main/CoswayUtil/CoswayUtil$AnchorShield$1.class b/build/classes/java/main/CoswayUtil/CoswayUtil$AnchorShield$1.class index 0a33398..06c73e0 100644 Binary files a/build/classes/java/main/CoswayUtil/CoswayUtil$AnchorShield$1.class and b/build/classes/java/main/CoswayUtil/CoswayUtil$AnchorShield$1.class differ diff --git a/build/classes/java/main/CoswayUtil/CoswayUtil$AnchorShield$2.class b/build/classes/java/main/CoswayUtil/CoswayUtil$AnchorShield$2.class index 992f0ac..a8a8349 100644 Binary files a/build/classes/java/main/CoswayUtil/CoswayUtil$AnchorShield$2.class and b/build/classes/java/main/CoswayUtil/CoswayUtil$AnchorShield$2.class differ diff --git a/build/classes/java/main/CoswayUtil/CoswayUtil$AnchorShield$3.class b/build/classes/java/main/CoswayUtil/CoswayUtil$AnchorShield$3.class index 826d738..ccc1052 100644 Binary files a/build/classes/java/main/CoswayUtil/CoswayUtil$AnchorShield$3.class and b/build/classes/java/main/CoswayUtil/CoswayUtil$AnchorShield$3.class differ diff --git a/build/classes/java/main/CoswayUtil/CoswayUtil$AnchorShield$4.class b/build/classes/java/main/CoswayUtil/CoswayUtil$AnchorShield$4.class index 4169ecc..8d63bfb 100644 Binary files a/build/classes/java/main/CoswayUtil/CoswayUtil$AnchorShield$4.class and b/build/classes/java/main/CoswayUtil/CoswayUtil$AnchorShield$4.class differ diff --git a/build/classes/java/main/CoswayUtil/CoswayUtil$AnchorShield.class b/build/classes/java/main/CoswayUtil/CoswayUtil$AnchorShield.class index 1bd0131..8519da6 100644 Binary files a/build/classes/java/main/CoswayUtil/CoswayUtil$AnchorShield.class and b/build/classes/java/main/CoswayUtil/CoswayUtil$AnchorShield.class differ diff --git a/build/classes/java/main/CoswayUtil/CoswayUtil.class b/build/classes/java/main/CoswayUtil/CoswayUtil.class index 952156c..1c9f7d6 100644 Binary files a/build/classes/java/main/CoswayUtil/CoswayUtil.class and b/build/classes/java/main/CoswayUtil/CoswayUtil.class differ diff --git a/build/libs/CoswayUtil-1.12-RELEASE.jar b/build/libs/CoswayUtil-1.12-RELEASE.jar index 387bd2d..b52f4ac 100644 Binary files a/build/libs/CoswayUtil-1.12-RELEASE.jar and b/build/libs/CoswayUtil-1.12-RELEASE.jar differ diff --git a/build/resources/main/config.yml b/build/resources/main/config.yml index af471fd..7458b3d 100644 --- a/build/resources/main/config.yml +++ b/build/resources/main/config.yml @@ -7,11 +7,13 @@ shop: price: 192 quantity: 64 display_name: "Stone Block" + available: true smooth_stone: material: SMOOTH_STONE price: 320 quantity: 64 display_name: "Smooth Stone" + available: true wood_blocks: items: oak_planks: @@ -19,6 +21,7 @@ shop: price: 960 quantity: 64 display_name: "Oak Planks" + available: true pvp: items: iron_helmet: @@ -26,41 +29,49 @@ shop: price: 110 quantity: 1 display_name: "Iron Helmet" + available: true iron_chestplate: material: IRON_CHESTPLATE price: 176 quantity: 1 display_name: "Iron Chestplate" + available: true iron_leggings: material: IRON_LEGGINGS price: 154 quantity: 1 display_name: "Iron Leggings" + available: true iron_boots: material: IRON_BOOTS price: 88 quantity: 1 display_name: "Iron Boots" + available: true iron_sword: material: IRON_SWORD price: 44 quantity: 1 display_name: "Iron Sword" + available: true iron_PICKAXE: material: IRON_PICKAXE price: 66 quantity: 1 display_name: "Iron Pick" + available: true iron_axe: material: IRON_AXE price: 66 quantity: 1 display_name: "Iron Axe" + available: true iron_shovel: material: IRON_SHOVEL price: 22 quantity: 1 display_name: "Iron Spoon" + available: true redstone: items: repeater: @@ -68,11 +79,13 @@ shop: price: 900 quantity: 18 display_name: "Repeater" + available: true redstone: material: REDSTONE price: 2048 quantity: 64 display_name: "Redstone Dust" + available: true nether: items: obsidian: @@ -80,6 +93,7 @@ shop: price: 1300 quantity: 10 display_name: "Obsidian" + available: true utilities: items: ASK: @@ -87,26 +101,37 @@ shop: price: 450000 quantity: 1 display_name: "Anchor Shield Kit" + available: true gravity_gauntlet: material: KNOWLEDGE_BOOK price: 200000 quantity: 1 display_name: "Gravity Gauntlet" + available: true levitation_wand: material: KNOWLEDGE_BOOK price: 1000000 quantity: 1 display_name: "Levitation Wand" + available: true launch_stick: material: KNOWLEDGE_BOOK price: 1234567 quantity: 1 display_name: "Launch Stick" + available: true rapid_fire_bow: material: KNOWLEDGE_BOOK price: 9000000 quantity: 1 display_name: "Rapid Fire Bow" + available: true + illumination_wand: + material: KNOWLEDGE_BOOK + price: 9000000 + quantity: 1 + display_name: "Illumination Wand" + available: true poor: "you're too poor for that, get gooder..." inventory_full: "you got too much clutter, cant fit your purchase into that mess..." pagination: diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$1.class.uniqueId0 b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$1.class.uniqueId0 new file mode 100644 index 0000000..17690f8 Binary files /dev/null and b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$1.class.uniqueId0 differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$1.class.uniqueId8 b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$1.class.uniqueId8 new file mode 100644 index 0000000..06c73e0 Binary files /dev/null and b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$1.class.uniqueId8 differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$2.class.uniqueId2 b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$2.class.uniqueId2 new file mode 100644 index 0000000..a8a8349 Binary files /dev/null and b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$2.class.uniqueId2 differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$3.class.uniqueId3 b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$3.class.uniqueId5 similarity index 88% rename from build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$3.class.uniqueId3 rename to build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$3.class.uniqueId5 index 826d738..ccc1052 100644 Binary files a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$3.class.uniqueId3 and b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$3.class.uniqueId5 differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$4.class.uniqueId4 b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$4.class.uniqueId4 new file mode 100644 index 0000000..8d63bfb Binary files /dev/null and b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$4.class.uniqueId4 differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield.class.uniqueId7 b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield.class.uniqueId7 new file mode 100644 index 0000000..8519da6 Binary files /dev/null and b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield.class.uniqueId7 differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil.class.uniqueId1 b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil.class.uniqueId1 new file mode 100644 index 0000000..1c9f7d6 Binary files /dev/null and b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil.class.uniqueId1 differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/GiveWandCommand.class.uniqueId9 b/build/tmp/compileJava/compileTransaction/stash-dir/GiveWandCommand.class.uniqueId9 deleted file mode 100644 index 5746ceb..0000000 Binary files a/build/tmp/compileJava/compileTransaction/stash-dir/GiveWandCommand.class.uniqueId9 and /dev/null differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/PhantomDodge$1.class.uniqueId10 b/build/tmp/compileJava/compileTransaction/stash-dir/PhantomDodge$1.class.uniqueId10 deleted file mode 100644 index b8ab886..0000000 Binary files a/build/tmp/compileJava/compileTransaction/stash-dir/PhantomDodge$1.class.uniqueId10 and /dev/null differ diff --git a/build/tmp/compileJava/previous-compilation-data.bin b/build/tmp/compileJava/previous-compilation-data.bin index c5d320c..4bb8369 100644 Binary files a/build/tmp/compileJava/previous-compilation-data.bin and b/build/tmp/compileJava/previous-compilation-data.bin differ diff --git a/src/main/java/CoswayUtil/BlockShop.java b/src/main/java/CoswayUtil/BlockShop.java index 80ec39f..086172d 100644 --- a/src/main/java/CoswayUtil/BlockShop.java +++ b/src/main/java/CoswayUtil/BlockShop.java @@ -103,8 +103,8 @@ public class BlockShop implements Listener { String materialName = config.getString("shop.categories." + category + ".items." + itemKey + ".material"); int price = config.getInt("shop.categories." + category + ".items." + itemKey + ".price"); String displayName = config.getString("shop.categories." + category + ".items." + itemKey + ".display_name"); - boolean locked = config.getBoolean("shop.categories." + category + ".items." + itemKey + ".available"); - if (!locked) { + boolean available = config.getBoolean("shop.categories." + category + ".items." + itemKey + ".available"); + if (available) { if (materialName != null) { Material material = Material.matchMaterial(materialName.toUpperCase()); if (material != null) { diff --git a/src/main/java/CoswayUtil/CoswayUtil.java b/src/main/java/CoswayUtil/CoswayUtil.java index 7ebd1cc..0722daa 100644 --- a/src/main/java/CoswayUtil/CoswayUtil.java +++ b/src/main/java/CoswayUtil/CoswayUtil.java @@ -139,9 +139,13 @@ public final class CoswayUtil extends JavaPlugin implements Listener { if(removeCustomKnowledgeBook(player,ChatColor.GREEN+"Rapid Fire Bow")) { player.getInventory().addItem(RapidFireBow.createRapidFireBow()); } + if(removeCustomKnowledgeBook(player,ChatColor.GREEN+"Illumination Wand")) { + player.getInventory().addItem(IlluminationWand.getIlluminationWand()); + } } } }.runTaskTimer(this,0,2); + new IlluminationWand(this); } @@ -174,6 +178,9 @@ public final class CoswayUtil extends JavaPlugin implements Listener { if (cmd.getName().equalsIgnoreCase("shopbook") && sender instanceof Player player) { player.getInventory().addItem(BlockShop.createShopItem()); } + if (cmd.getName().equalsIgnoreCase("Illumination Wand") && sender instanceof Player player) { + player.getInventory().addItem(IlluminationWand.getIlluminationWand()); + } if (cmd.getName().equalsIgnoreCase("throw") && sender instanceof Player player) { Player Target = getNearestPlayer(player,10); if(Target == null) { diff --git a/src/main/java/CoswayUtil/IlluminationWand.java b/src/main/java/CoswayUtil/IlluminationWand.java new file mode 100644 index 0000000..496487f --- /dev/null +++ b/src/main/java/CoswayUtil/IlluminationWand.java @@ -0,0 +1,121 @@ +package CoswayUtil; + +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.block.data.type.Light; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.*; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.util.RayTraceResult; + +import java.util.HashMap; +import java.util.UUID; + +public class IlluminationWand implements Listener { + + private final CoswayUtil plugin; + private final HashMap cooldowns = new HashMap<>(); + private final long COOLDOWN_TIME = 1000; // 1 second in milliseconds + + // Constructor to accept the main plugin instance + public IlluminationWand(CoswayUtil plugin) { + this.plugin = plugin; + plugin.getServer().getPluginManager().registerEvents(this, plugin); + } + + public static ItemStack getIlluminationWand() { + ItemStack wand = new ItemStack(Material.CARROT_ON_A_STICK); + ItemMeta meta = wand.getItemMeta(); + if (meta != null) { + meta.setDisplayName(ChatColor.YELLOW + "Illumination Wand"); + meta.setLore(java.util.Arrays.asList(ChatColor.GOLD + "Right-click to place Light Blocks!", ChatColor.GRAY + "Reach: 20 blocks")); + meta.setUnbreakable(true); + wand.setItemMeta(meta); + } + return wand; + } + + @EventHandler + public void onPlayerUseWand(PlayerInteractEvent event) { + Player player = event.getPlayer(); + ItemStack item = player.getInventory().getItemInMainHand(); + + if (item.getType() != Material.CARROT_ON_A_STICK || !item.hasItemMeta() || + !ChatColor.stripColor(item.getItemMeta().getDisplayName()).equals("Illumination Wand")) { + return; + } + + if (player.getGameMode() != GameMode.CREATIVE) { + if (cooldowns.containsKey(player.getUniqueId())) { + long lastUse = cooldowns.get(player.getUniqueId()); + if (System.currentTimeMillis() - lastUse < COOLDOWN_TIME) { + player.sendMessage(ChatColor.RED + "The wand is on cooldown!"); + return; + } + } + cooldowns.put(player.getUniqueId(), System.currentTimeMillis()); + } + + RayTraceResult result = player.getWorld().rayTraceBlocks( + player.getEyeLocation(), player.getEyeLocation().getDirection(), 20, FluidCollisionMode.NEVER + ); + + if (result == null || result.getHitBlock() == null) { + player.sendMessage(ChatColor.RED + "You must aim at a block within range!"); + return; + } + + Block targetBlock = player.getTargetBlockExact(20, FluidCollisionMode.NEVER); // Get the block the player is looking at (within 20 blocks) + +// Ensure a valid block is being targeted + if (targetBlock == null || targetBlock.getType() == Material.AIR) { + player.sendMessage(ChatColor.RED + "You must look at a solid block to place light!"); + return; + } + +// Get the correct face where the block should be placed + BlockFace hitFace = event.getBlockFace(); + if (hitFace == null) { + player.sendMessage(ChatColor.RED + "Couldn't determine block face!"); + return; + } + + // Get the exact block where the light should be placed + Block placeLocation = targetBlock.getRelative(hitFace); + Location safeSpot = placeLocation.getLocation(); + +// Ensure we are not replacing a solid block + if (!placeLocation.getType().isAir() && placeLocation.getType() != Material.WATER) { + + Block checkUp = placeLocation.getRelative(BlockFace.UP); + Block checkDown = placeLocation.getRelative(BlockFace.DOWN); + + if (!checkUp.getType().isAir() && checkUp.getType() != Material.WATER) { + if (!checkDown.getType().isAir() && checkDown.getType() != Material.WATER) { + player.sendMessage(ChatColor.RED + "You cannot place a light inside a block!"); + return; + } else { + safeSpot = checkDown.getLocation(); + } + } else { + safeSpot = checkUp.getLocation(); + } + } + + // Place the light block at the correct location + safeSpot.getBlock().setType(Material.LIGHT); + Light lightBlock = (Light) safeSpot.getBlock().getBlockData(); + lightBlock.setLevel(15); // Set light level to max + safeSpot.getBlock().setBlockData(lightBlock); + + // Particle effect at the placed location + player.getWorld().spawnParticle(Particle.END_ROD, safeSpot.add(0.5, 0.5, 0.5), 10, 0.2, 0.2, 0.2, 0); + player.getWorld().playSound(safeSpot, Sound.BLOCK_END_PORTAL_FRAME_FILL, 1.0f, 1.5f); + + } +} diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 9c6f297..7458b3d 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -126,6 +126,12 @@ shop: quantity: 1 display_name: "Rapid Fire Bow" available: true + illumination_wand: + material: KNOWLEDGE_BOOK + price: 9000000 + quantity: 1 + display_name: "Illumination Wand" + available: true poor: "you're too poor for that, get gooder..." inventory_full: "you got too much clutter, cant fit your purchase into that mess..." pagination: