Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixes and updates

  • Loading branch information...
commit f30d6737975d5f7fab68c7c0a8b1db55b0272665 1 parent f28b28f
@Butkicker12 authored
View
44 src/com/thebkkingdom/Shotgun/PlayerListener.java
@@ -6,13 +6,15 @@
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.entity.Arrow;
-import org.bukkit.entity.EntityType;
+import org.bukkit.entity.Explosive;
+import org.bukkit.entity.Fireball;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
+import org.bukkit.util.Vector;
public class PlayerListener implements Listener {
@@ -25,24 +27,31 @@ public void playerInteract(PlayerInteractEvent event) {
if (event.getAction() == Action.LEFT_CLICK_AIR) {
if (player.getItemInHand().getType() == Material.BOOK) {
- //Shotgun - Added permission node in YML registers defaultl to Op
- if (player.hasPermission("shotgun.shotgun")){
+ // 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);
+ // run task twice
+ for (int i = 0; i < 2; i++) {
+ world.createExplosion(playerLocation, -1);
+ }
+ // Runs the task 5 times
+ for (int i = 0; i < 5; i++) {
+ player.launchProjectile(Arrow.class);
}
+
+ // Checks if player has exactly five arrows. Needs fixing.
if (player.getInventory().contains(
new ItemStack(Material.ARROW, 5))) {
player.getInventory().removeItem(
new ItemStack(Material.ARROW, 5));
+
+ //fire arrow now
} else {
player.sendMessage(ChatColor.BLUE
+ "[Shotgun] You need at least 5 arrows to use the shotgun!");
@@ -58,7 +67,24 @@ public void playerInteract(PlayerInteractEvent event) {
if (event.getAction() == Action.RIGHT_CLICK_AIR) {
if (player.getItemInHand().getType() == Material.BOOK) {
- world.spawnCreature(playerLocation, EntityType.FIREBALL);
+ //world.spawnCreature(playerLocation, EntityType.FIREBALL);
+
+ /*
+ Fireball fb = this.b.getEntity().launchProjectile(
+ Fireball.class);
+ fb.setYield(200);
+ fb.setBounce(false);
+ fb.setDirection(p
+ .getPlayer()
+ .getVelocity()
+ .add(p.getPlayer()
+ .getLocation()
+ .toVector()
+ .subtract(
+ this.b.getEntity().getLocation()
+ .toVector()).normalize()
+ .multiply(Integer.MAX_VALUE)));
+ */
}
}
}
View
12 src/com/thebkkingdom/Shotgun/Shotgun.java
@@ -25,6 +25,9 @@ private void registerEvents() {
getServer().getPluginManager().registerEvents(new PlayerListener(),
this);
+
+ getServer().getPluginManager().registerEvents(new EntityListener(),
+ this);
}
public boolean onCommand(CommandSender sender, Command command,
@@ -35,8 +38,9 @@ public boolean onCommand(CommandSender sender, Command command,
Location targetLocation = target.getLocation();
if (command.getName().equalsIgnoreCase("airstrike")) {
- if(!(args.length==0)){
- sender.sendMessage(ChatColor.RED + "Did you mean /Airstrike");
+ if (!(args.length == 0)) {
+ sender.sendMessage(ChatColor.BLUE
+ + "[Shotgun] Did you mean /Airstrike");
}
if (player.hasPermission("shotgun.airstrike")) {
target.getWorld().strikeLightning(targetLocation);
@@ -44,11 +48,11 @@ public boolean onCommand(CommandSender sender, Command command,
sender.sendMessage(ChatColor.BLUE
+ "[Shotgun] Airstrike called at your crosshairs");
} else {
- sender.sendMessage(ChatColor.RED + "You do not have permission!");
+ 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.