Skip to content

Commit

Permalink
Fixed /fly error & it actually works how intended to work & added rig…
Browse files Browse the repository at this point in the history
…ht click to wear pumpkin & fixed Raygun error cause bitch.
  • Loading branch information
Jacob S committed Jul 18, 2021
1 parent 84a1bd4 commit 88f6d74
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand All @@ -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");

Expand Down
58 changes: 20 additions & 38 deletions src/main/java/me/jakedadream/ParadisuPlugin/events/snwevents.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

Expand Down Expand Up @@ -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);
Expand All @@ -297,7 +278,7 @@ public void dslauncher(final PlayerInteractEvent e) {
p.getWorld().playSound(p.getLocation(), Sound.ENTITY_PIGLIN_JEALOUS, 1F, 1F);
}
}
} else {return;}
}
}
}

Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 88f6d74

Please sign in to comment.