diff --git a/.gradle/8.8/executionHistory/executionHistory.bin b/.gradle/8.8/executionHistory/executionHistory.bin index b275e8f..17e5eb4 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 f435fab..dba6df9 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 9e3cc46..5ec422d 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 3af5ea0..ee12374 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 b3569d7..d820e25 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 8ee6c8c..ce5ba2b 100644 Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/build/classes/java/main/CoswayUtil/CoswayUtil$AnchorShield$1.class b/build/classes/java/main/CoswayUtil/CoswayUtil$AnchorShield$1.class index ec9fa9c..a202e0c 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 d949101..b4a0d6f 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 17bb56f..da9992e 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 b4687aa..bf4adec 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 dc3c8f6..06c4ff2 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 6c589f4..926a79e 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.8-BETA.jar b/build/libs/CoswayUtil-1.8-BETA.jar index c923ce1..73444d4 100644 Binary files a/build/libs/CoswayUtil-1.8-BETA.jar and b/build/libs/CoswayUtil-1.8-BETA.jar differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$1.class.uniqueId0 b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$1.class.uniqueId0 index a53539d..742c7c6 100644 Binary files a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$1.class.uniqueId0 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.uniqueId6 b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$1.class.uniqueId6 index 31dcfbc..ec9fa9c 100644 Binary files a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$1.class.uniqueId6 and b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$1.class.uniqueId6 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 index 2768f51..d949101 100644 Binary files a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$2.class.uniqueId2 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.uniqueId4 b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$3.class.uniqueId4 index d1caeba..17bb56f 100644 Binary files a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$3.class.uniqueId4 and b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$3.class.uniqueId4 differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$4.class.uniqueId3 b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$4.class.uniqueId3 index 4537d3c..b4687aa 100644 Binary files a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$4.class.uniqueId3 and b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield$4.class.uniqueId3 differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield.class.uniqueId5 b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield.class.uniqueId5 index bf1b599..dc3c8f6 100644 Binary files a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield.class.uniqueId5 and b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil$AnchorShield.class.uniqueId5 differ diff --git a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil.class.uniqueId1 b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil.class.uniqueId1 index 22842c2..6c589f4 100644 Binary files a/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil.class.uniqueId1 and b/build/tmp/compileJava/compileTransaction/stash-dir/CoswayUtil.class.uniqueId1 differ diff --git a/build/tmp/compileJava/previous-compilation-data.bin b/build/tmp/compileJava/previous-compilation-data.bin index 50a3c99..c325e48 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/CoswayUtil.java b/src/main/java/CoswayUtil/CoswayUtil.java index d624088..590b045 100644 --- a/src/main/java/CoswayUtil/CoswayUtil.java +++ b/src/main/java/CoswayUtil/CoswayUtil.java @@ -57,7 +57,8 @@ public final class CoswayUtil extends JavaPlugin implements Listener { } } }.runTaskTimer(this, 0, 2); // Runs every 10 ticks (0.5 seconds) - + // Register Gravity Gauntlet + new GravityGauntlet(this); } @Override diff --git a/src/main/java/CoswayUtil/GravityGauntlet.java b/src/main/java/CoswayUtil/GravityGauntlet.java new file mode 100644 index 0000000..c4e165e --- /dev/null +++ b/src/main/java/CoswayUtil/GravityGauntlet.java @@ -0,0 +1,101 @@ +package CoswayUtil; +import org.bukkit.*; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +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.scheduler.BukkitRunnable; +import org.bukkit.util.Vector; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +public class GravityGauntlet implements Listener { + private final CoswayUtil plugin; // Reference to the main plugin + private final Map cooldowns = new HashMap<>(); + private static final long COOLDOWN_TIME = 5 * 1000; // 5 seconds in milliseconds + + public GravityGauntlet(CoswayUtil plugin) { + this.plugin = plugin; + Bukkit.getPluginManager().registerEvents(this, plugin); + } + + @EventHandler + public void onRightClick(PlayerInteractEvent event) { + Player player = event.getPlayer(); + ItemStack item = player.getInventory().getItemInMainHand(); + + // Check if the player is holding the Gravity Gauntlet + if (item.getType() == Material.NETHERITE_HOE && item.hasItemMeta()) { + ItemMeta meta = item.getItemMeta(); + if (meta != null && meta.hasDisplayName() && meta.getDisplayName().equals(ChatColor.LIGHT_PURPLE + "Gravity Gauntlet")) { + event.setCancelled(true); + + // Cooldown check + if (cooldowns.containsKey(player.getUniqueId())) { + long timeLeft = (cooldowns.get(player.getUniqueId()) + COOLDOWN_TIME) - System.currentTimeMillis(); + if (timeLeft > 0) { + player.sendMessage(ColorKey("&cThe Gravity Gauntlet is on cooldown for " + (timeLeft / 1000) + "s!")); + return; + } + } + cooldowns.put(player.getUniqueId(), System.currentTimeMillis()); + + // Shift-click = Throw away, Normal click = Pull in + if (player.isSneaking()) { + throwEntitiesAway(player); + } else { + pullEntitiesTowards(player); + } + } + } + } + public String ColorKey(String t) { + char searchChar = '&'; // Character to search for + char replacementChar = 'ยง'; // Character to replace with + StringBuilder sb = new StringBuilder(t); + // Search for the character in the StringBuilder + int index = sb.indexOf(String.valueOf(searchChar)); + + // Replace the character if found + for (int j = 0; j < sb.length(); j++) { + if (sb.charAt(j) == searchChar) { + sb.setCharAt(j, replacementChar); + } + } + return sb.toString(); + } + private void pullEntitiesTowards(Player player) { + Location playerLoc = player.getLocation(); + double radius = 10.0; + + for (Entity entity : player.getNearbyEntities(radius, radius, radius)) { + if (entity instanceof LivingEntity && entity != player) { + Vector direction = playerLoc.toVector().subtract(entity.getLocation().toVector()).normalize().multiply(1.5); + entity.setVelocity(direction); + player.getWorld().playSound(playerLoc, Sound.ENTITY_ENDERMAN_TELEPORT, 1, 1); + player.getWorld().spawnParticle(Particle.PORTAL, entity.getLocation(), 30); + } + } + } + + private void throwEntitiesAway(Player player) { + Location playerLoc = player.getLocation(); + double radius = 10.0; + + for (Entity entity : player.getNearbyEntities(radius, radius, radius)) { + if (entity instanceof LivingEntity && entity != player) { + Vector direction = entity.getLocation().toVector().subtract(playerLoc.toVector()).normalize().multiply(2.5); + direction.setY(direction.getY() + 1.0); // Give it an upward boost + entity.setVelocity(direction); + player.getWorld().playSound(playerLoc, Sound.ENTITY_ENDER_DRAGON_FLAP, 1, 1); + player.getWorld().spawnParticle(Particle.EXPLOSION, entity.getLocation(), 20); + } + } + } +} \ No newline at end of file