From 88f6d74d7e222c7b2cae52f61b2c27894999f161 Mon Sep 17 00:00:00 2001 From: Jacob S Date: Sun, 18 Jul 2021 00:14:52 -0700 Subject: [PATCH] Fixed /fly error & it actually works how intended to work & added right click to wear pumpkin & fixed Raygun error cause bitch. --- .../ParadisuPlugin/commands/snwcommands.java | 7 +++ .../ParadisuPlugin/events/snwevents.java | 58 +++++++------------ src/main/resources/plugin.yml | 2 +- 3 files changed, 28 insertions(+), 39 deletions(-) diff --git a/src/main/java/me/jakedadream/ParadisuPlugin/commands/snwcommands.java b/src/main/java/me/jakedadream/ParadisuPlugin/commands/snwcommands.java index bb0d250..e248324 100644 --- a/src/main/java/me/jakedadream/ParadisuPlugin/commands/snwcommands.java +++ b/src/main/java/me/jakedadream/ParadisuPlugin/commands/snwcommands.java @@ -454,10 +454,13 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String if (player.hasPermission("snw.fly")) { if (args.length < 1) { if (player.isFlying()) { + player.setAllowFlight(false); player.setFlying(false); + player.sendMessage("§3[§dParadisu §bツ§3] §fYou are no longer flying"); } else if (!player.isFlying()) { + player.setAllowFlight(true); player.setFlying(true); player.sendMessage("§3[§dParadisu §bツ§3] §fYou are now flying"); @@ -473,12 +476,16 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String Player target = Bukkit.getServer().getPlayer(flytarget); if (target.isFlying()) { + player.setAllowFlight(false); target.setFlying(false); + player.sendMessage("§3[§dParadisu §bツ§3] §3" + flytarget + " §fis no longer flying!"); target.sendMessage("§3[§dParadisu §bツ§3] §fYou are no longer flying"); } else if (!player.isFlying()) { + player.setAllowFlight(true); target.setFlying(true); + player.sendMessage("§3[§dParadisu §bツ§3] §3" + flytarget + " §fis now flying!"); target.sendMessage("§3[§dParadisu §bツ§3] §fYou are now flying"); diff --git a/src/main/java/me/jakedadream/ParadisuPlugin/events/snwevents.java b/src/main/java/me/jakedadream/ParadisuPlugin/events/snwevents.java index df36fbd..c975eea 100644 --- a/src/main/java/me/jakedadream/ParadisuPlugin/events/snwevents.java +++ b/src/main/java/me/jakedadream/ParadisuPlugin/events/snwevents.java @@ -63,39 +63,16 @@ public void onPlayerInteractAtEntity(PlayerInteractAtEntityEvent intEvent) { public static void WearHatEvent(PlayerInteractEvent wearhat) { Player player = wearhat.getPlayer(); - if (player.getInventory().getItemInMainHand().getType() == Material.AIR) - return; - switch (((Damageable) player.getEquipment().getItemInMainHand().getItemMeta()).getDamage()) { - case 16: - case 24: - case 25: - case 26: - case 27: - case 28: - case 29: - case 41: - case 53: - case 60: - case 64: - case 65: - case 66: - case 76: - case 77: - case 78: - if (wearhat.getAction() == Action.RIGHT_CLICK_AIR) { - - if (wearhat.getItem() != null) { - ItemStack[] armor = player.getInventory().getArmorContents(); - ItemStack swap = armor[3]; - armor[3] = player.getEquipment().getItemInMainHand(); - player.getInventory().setArmorContents(armor); - player.getInventory().setItemInMainHand(swap); - - - break; - - } - } + if (player.getInventory().getItemInMainHand().getType() == Material.AIR) return; + if (wearhat.getAction() == Action.RIGHT_CLICK_AIR) { + + if (wearhat.getItem() != null && wearhat.getItem().getType() == Material.CARVED_PUMPKIN) { + ItemStack[] armor = player.getInventory().getArmorContents(); + ItemStack swap = armor[3]; + armor[3] = player.getEquipment().getItemInMainHand(); + player.getInventory().setArmorContents(armor); + player.getInventory().setItemInMainHand(swap); + } } } @@ -282,13 +259,17 @@ public void PlayerPunchBlock(PlayerInteractEvent pie) { @EventHandler public void dslauncher(final PlayerInteractEvent e) { - if (e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.LEFT_CLICK_AIR) { - + if (e.getAction() != null) { Player p = e.getPlayer(); - if (e.getItem().getType() == Material.DIAMOND_AXE) { - if (e.getItem().getItemMeta().hasCustomModelData()) { + if (e.getAction() == Action.RIGHT_CLICK_BLOCK) + return; + + if (e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.LEFT_CLICK_AIR) { + + if (e.getItem().getType() == Material.DIAMOND_AXE) { if (e.getItem().getItemMeta().getCustomModelData() == 146) { + ItemStack item = new ItemStack(Material.DEAD_TUBE_CORAL_BLOCK, 1); Snowball s = e.getPlayer().launchProjectile(Snowball.class); s.setItem(item); @@ -297,7 +278,7 @@ public void dslauncher(final PlayerInteractEvent e) { p.getWorld().playSound(p.getLocation(), Sound.ENTITY_PIGLIN_JEALOUS, 1F, 1F); } } - } else {return;} + } } } @@ -314,6 +295,7 @@ public void EatFoodEvent(PlayerItemConsumeEvent e) { p.sendMessage("§3[§dParadisu §bツ§3] §fYou consumed a drink/food item and were given speed for§3 " + seconds/60 + "§f minutes."); } } + /* @EventHandler public void (PlayerInteractEvent e) { diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index f2465a6..82f4837 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: ParadisuPlugin -version: 2.0.2 +version: 2.1.0 authors: [JakeDaDream, RealInstantRamen, andyinnie, _Kastle] main: me.jakedadream.ParadisuPlugin.paradisumain api-version: 1.16