|
4 | 4 | import java.util.Map; |
5 | 5 |
|
6 | 6 | import org.bukkit.ChatColor; |
| 7 | +import org.bukkit.Sound; |
7 | 8 | import org.bukkit.entity.Entity; |
8 | 9 | import org.bukkit.entity.FallingBlock; |
9 | 10 | import org.bukkit.entity.LivingEntity; |
|
47 | 48 | import com.projectkorra.projectkorra.util.ActionBar; |
48 | 49 | import com.projectkorra.projectkorra.util.ClickType; |
49 | 50 |
|
| 51 | +import me.simplicitee.project.addons.ability.air.Deafen; |
50 | 52 | import me.simplicitee.project.addons.ability.air.GaleGust; |
| 53 | +import me.simplicitee.project.addons.ability.air.SonicWave; |
| 54 | +import me.simplicitee.project.addons.ability.air.VocalMimicry; |
51 | 55 | import me.simplicitee.project.addons.ability.air.Zephyr; |
52 | 56 | import me.simplicitee.project.addons.ability.avatar.EnergyBeam; |
53 | 57 | import me.simplicitee.project.addons.ability.avatar.EnergyBeam.EnergyColor; |
@@ -176,6 +180,8 @@ public void onLeftClick(final PlayerInteractEvent event) { |
176 | 180 | if (CoreAbility.hasAbility(player, Bulwark.class)) { |
177 | 181 | CoreAbility.getAbility(player, Bulwark.class).clickFunction(); |
178 | 182 | } |
| 183 | + } else if (canBend(player, "SonicWave")) { |
| 184 | + new SonicWave(player); |
179 | 185 | } |
180 | 186 | } |
181 | 187 |
|
@@ -247,6 +253,10 @@ public void onSneak(PlayerToggleSneakEvent event) { |
247 | 253 | new CombustBeam(player); |
248 | 254 | } else if (canBend(player, "Bulwark")) { |
249 | 255 | new Bulwark(player); |
| 256 | + } else if (canBend(player, "VocalMimicry")) { |
| 257 | + new VocalMimicry(player); |
| 258 | + } else if (canBend(player, "Deafen")) { |
| 259 | + new Deafen(player); |
250 | 260 | } |
251 | 261 | } |
252 | 262 |
|
@@ -430,28 +440,57 @@ public void onChat(AsyncPlayerChatEvent event) { |
430 | 440 |
|
431 | 441 | Player player = event.getPlayer(); |
432 | 442 | String[] args = event.getMessage().split(" "); |
433 | | - if (args.length != 2) { |
434 | | - return; |
435 | | - } |
436 | 443 |
|
437 | 444 | if (args[0].equalsIgnoreCase("@energycolor")) { |
438 | | - if (player.hasPermission("bending.ability.energybeam")) { |
| 445 | + if (!player.hasPermission("bending.ability.energybeam")) { |
| 446 | + player.sendMessage(ProjectAddons.instance.prefix() + ChatColor.RED + " You do not have permission to change color"); |
| 447 | + } else if (args.length != 2) { |
| 448 | + player.sendMessage(ProjectAddons.instance.prefix() + ChatColor.RED + " Invalid format, try `@energycolor <color>`"); |
| 449 | + } else { |
439 | 450 | EnergyColor color = EnergyColor.valueOf(args[1].toUpperCase()); |
| 451 | + |
440 | 452 | if (color != null) { |
441 | 453 | EnergyBeam.colors.put(player.getUniqueId(), color); |
442 | | - player.sendMessage(ChatColor.GREEN + "Successfully set EnergyBeam color to " + args[1].toLowerCase()); |
| 454 | + player.sendMessage(ProjectAddons.instance.prefix() + ChatColor.GREEN + " Successfully set EnergyBeam color to " + args[1].toLowerCase()); |
443 | 455 | } else { |
444 | | - player.sendMessage(ChatColor.RED + "Unknown color! Try red, blue, yellow, green, purple, orange, indigo, brown, white, or black!"); |
| 456 | + player.sendMessage(ProjectAddons.instance.prefix() + ChatColor.RED + " Unknown color! Try red, blue, yellow, green, purple, orange, indigo, brown, white, or black!"); |
| 457 | + } |
| 458 | + } |
| 459 | + event.setCancelled(true); |
| 460 | + } else if (args[0].equalsIgnoreCase("@vocalsound")) { |
| 461 | + if (!player.hasPermission("bending.ability.VocalMimicry")) { |
| 462 | + player.sendMessage(ProjectAddons.instance.prefix() + ChatColor.RED + " You do not have permission to change vocal noise"); |
| 463 | + } else if (args.length != 2) { |
| 464 | + player.sendMessage(ProjectAddons.instance.prefix() + ChatColor.RED + " Invalid format, try `@vocalsound <sound>`"); |
| 465 | + } else { |
| 466 | + Sound sound = Sound.valueOf(args[1].toUpperCase()); |
| 467 | + |
| 468 | + if (sound != null) { |
| 469 | + if (plugin.getConfig().getStringList("Abilities.Air.VocalMimicry.SoundBlacklist").contains(sound.toString())) { |
| 470 | + player.sendMessage(ProjectAddons.instance.prefix() + ChatColor.RED + " Cannot use that sound!"); |
| 471 | + } else { |
| 472 | + VocalMimicry.selectSound(player, sound); |
| 473 | + player.sendMessage(ProjectAddons.instance.prefix() + ChatColor.GREEN + " Successfully set vocal sound to " + args[1].toLowerCase()); |
| 474 | + } |
| 475 | + } else { |
| 476 | + player.sendMessage(ProjectAddons.instance.prefix() + ChatColor.RED + " Unknown sound!"); |
445 | 477 | } |
446 | | - event.setCancelled(true); |
447 | 478 | } |
| 479 | + event.setCancelled(true); |
448 | 480 | } |
449 | 481 | } |
450 | 482 |
|
451 | 483 | @EventHandler |
452 | 484 | public void onReload(BendingReloadEvent event) { |
453 | 485 | ProjectAddons.instance.config().reload(); |
454 | 486 | event.getSender().sendMessage(ProjectAddons.instance.prefix() + " Config reloaded"); |
| 487 | + |
| 488 | + new BukkitRunnable() { |
| 489 | + @Override |
| 490 | + public void run() { |
| 491 | + CoreAbility.registerPluginAbilities(plugin, "me.simplicitee.project.addons.ability"); |
| 492 | + } |
| 493 | + }.runTaskLater(plugin, 1); |
455 | 494 | } |
456 | 495 |
|
457 | 496 | @EventHandler |
@@ -630,10 +669,16 @@ private boolean canBend(Player player, String ability, boolean canbend) { |
630 | 669 |
|
631 | 670 | if (abil == null) { |
632 | 671 | return false; |
| 672 | + } else if (bPlayer.getBoundAbility() == null) { |
| 673 | + return false; |
633 | 674 | } else if (!bPlayer.getBoundAbilityName().equals(ability)) { |
634 | 675 | return false; |
635 | 676 | } else if (canbend && !bPlayer.canBend(abil)) { |
636 | 677 | return false; |
| 678 | + } else if (GeneralMethods.isRegionProtectedFromBuild(player, ability, player.getLocation())) { |
| 679 | + return false; |
| 680 | + } else if (GeneralMethods.isRegionProtectedFromBuild(player, ability, player.getEyeLocation())) { |
| 681 | + return false; |
637 | 682 | } |
638 | 683 |
|
639 | 684 | return true; |
|
0 commit comments