Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed command, added permission in YML(& Command),Permission default …

…to Op, loop for shotgun

-emericask8ur ;)

Reverse <
  • Loading branch information...
commit 8df3c2691d3d2fff97bfe2b2b1317db9d22ca937 1 parent e573868
@fallensk8ur fallensk8ur authored
View
13 plugin.yml
@@ -1,3 +1,14 @@
name: Shotgun
version: 1.0
-main: com.thebkkingdom.Shotgun.Shotgun
+main: com.thebkkingdom.Shotgun.Shotgun
+commands:
+ Airstrike:
+ description: Help Menu
+ usage: /Airstrike
+permissions:
+ shotgun.airstrike:
+ description: Uses the airstrike command
+ default: op
+ shotgun.shotgun:
+ description: Uses the airstrike command
+ default: op
View
13 src/com/thebkkingdom/Shotgun/PlayerListener.java
@@ -25,18 +25,19 @@ public void playerInteract(PlayerInteractEvent event) {
if (event.getAction() == Action.LEFT_CLICK_AIR) {
if (player.getItemInHand().getType() == Material.BOOK) {
- if (player.hasPermission("shotgun.shotgun") || player.isOp()) {
+ //Shotgun - Added permission node in YML registers defaultl to Op
+ if (player.hasPermission("shotgun.shotgun")){
world.playEffect(playerLocation, Effect.BOW_FIRE, 50);
world.createExplosion(playerLocation, -1);
world.createExplosion(playerLocation, -1);
world.playEffect(playerLocation, Effect.SMOKE, 105);
+ // Runs the task 5 times
+ for (int i = 0; i < 6; i++) {
- player.launchProjectile(Arrow.class);
- player.launchProjectile(Arrow.class);
- player.launchProjectile(Arrow.class);
- player.launchProjectile(Arrow.class);
- player.launchProjectile(Arrow.class);
+ player.launchProjectile(Arrow.class);
+
+ }
if (player.getInventory().contains(
new ItemStack(Material.ARROW, 5))) {
View
8 src/com/thebkkingdom/Shotgun/Shotgun.java
@@ -34,13 +34,19 @@ public boolean onCommand(CommandSender sender, Command command,
Block target = player.getTargetBlock(null, 200);
Location targetLocation = target.getLocation();
- if (command.getName().equalsIgnoreCase("airstrike") && args.length == 1) {
+ if (command.getName().equalsIgnoreCase("airstrike")) {
+ if(!(args.length==0)){
+ sender.sendMessage(ChatColor.RED + "Did you mean /Airstrike");
+ }
if (player.hasPermission("shotgun.airstrike")) {
target.getWorld().strikeLightning(targetLocation);
target.getWorld().createExplosion(targetLocation, 5);
sender.sendMessage(ChatColor.BLUE
+ "[Shotgun] Airstrike called at your crosshairs");
+ } else {
+ sender.sendMessage(ChatColor.RED + "You do not have permission!");
}
+ return true;
}
return false;
Please sign in to comment.
Something went wrong with that request. Please try again.