more custom weapons
This commit is contained in:
parent
7dd18898f2
commit
dd75ae0ddf
6 changed files with 192 additions and 127 deletions
|
@ -0,0 +1,118 @@
|
|||
package com.night.nullvalkyrie.Events;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||
import org.bukkit.event.player.PlayerFishEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import static com.night.nullvalkyrie.Items.CustomItemManager.loadConfig;
|
||||
|
||||
public class CustomItemEvents implements Listener {
|
||||
@EventHandler
|
||||
public void onEntityDamageByEntity(EntityDamageByEntityEvent e) {
|
||||
if (e.getDamager().getType().equals(EntityType.SNOWBALL)) {
|
||||
Snowball sb = (Snowball) e.getDamager();
|
||||
Player pl = (Player) sb.getShooter();
|
||||
if (pl.getInventory().getItemInMainHand().getItemMeta() != null) {
|
||||
String name = pl.getInventory().getItemInMainHand().getItemMeta().getDisplayName();
|
||||
if (name.equalsIgnoreCase(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "SnowGun")) {
|
||||
e.setDamage(10000);
|
||||
} else if (name.equalsIgnoreCase("AA-12")) {
|
||||
e.setDamage(7);
|
||||
} else {
|
||||
e.setDamage(0);
|
||||
}
|
||||
}
|
||||
} else if (e.getDamager() instanceof Player) {
|
||||
Player player = (Player) e.getDamager();
|
||||
if (player.getInventory().getItemInMainHand().getItemMeta() != null) {
|
||||
String name = player.getInventory().getItemInMainHand().getItemMeta().getDisplayName();
|
||||
if(name.equalsIgnoreCase(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "Fabled Widow Sword")) {
|
||||
if (e.getEntity() instanceof Zombie) {
|
||||
int zombie = loadConfig("ItemData\\WidowSword.yml").getInt("zombie");
|
||||
e.setDamage(e.getDamage() * (1 + zombie / 100));
|
||||
} else if (e.getEntity() instanceof Skeleton) {
|
||||
int skeleton = loadConfig("ItemData\\WidowSword.yml").getInt("skeleton");
|
||||
e.setDamage(e.getDamage() * (1 + skeleton / 100));
|
||||
} else if (e.getEntity() instanceof Spider) {
|
||||
int spider = loadConfig("ItemData\\WidowSword.yml").getInt("spider");
|
||||
e.setDamage(e.getDamage() * (1 + spider / 100));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerFish(PlayerFishEvent e) {
|
||||
Player player = e.getPlayer();
|
||||
if (player.getInventory().getItemInMainHand().getItemMeta() != null) {
|
||||
String name = player.getInventory().getItemInMainHand().getItemMeta().getDisplayName();
|
||||
if (name.equalsIgnoreCase(ChatColor.WHITE + "Grappling Hook")) {
|
||||
if(e.getState().equals(PlayerFishEvent.State.REEL_IN)) {
|
||||
Location change = e.getHook().getLocation().subtract(player.getLocation());
|
||||
player.setVelocity(change.toVector().multiply(0.4));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent e) {
|
||||
Player player = e.getPlayer();
|
||||
if (player.getInventory().getItemInMainHand().getItemMeta() != null) {
|
||||
String name = player.getInventory().getItemInMainHand().getItemMeta().getDisplayName();
|
||||
if (e.getAction().equals(Action.RIGHT_CLICK_AIR) || e.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
|
||||
if (name.equalsIgnoreCase(ChatColor.DARK_PURPLE + "Aspect of The Void")) {
|
||||
Block block = player.getTargetBlock((Set<Material>) null, 12);
|
||||
Location l = block.getLocation();
|
||||
l.add(0, 1, 0);
|
||||
float yaw = player.getEyeLocation().getYaw();
|
||||
float pitch = player.getEyeLocation().getPitch();
|
||||
l.setYaw(yaw);
|
||||
l.setPitch(pitch);
|
||||
player.teleport(l);
|
||||
player.playSound(player.getLocation(), Sound.ENTITY_ENDERMAN_TELEPORT, 10, 10);
|
||||
} else if (name.equalsIgnoreCase(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "SnowGun")) {
|
||||
Snowball s = player.launchProjectile(Snowball.class, player.getLocation().getDirection());
|
||||
s.setVelocity(player.getLocation().getDirection().multiply(10));
|
||||
} else if (name.equalsIgnoreCase(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "Terminator")) {
|
||||
Arrow arrow = player.launchProjectile(Arrow.class, player.getEyeLocation().getDirection());
|
||||
arrow.setPickupStatus(Arrow.PickupStatus.DISALLOWED);
|
||||
arrow.setVelocity(arrow.getVelocity().multiply(5));
|
||||
Arrow a1 = player.launchProjectile(Arrow.class, player.getEyeLocation().getDirection());
|
||||
a1.setVelocity(arrow.getVelocity().rotateAroundY(Math.toRadians(5)).multiply(5));
|
||||
a1.setPickupStatus(Arrow.PickupStatus.DISALLOWED);
|
||||
Arrow a2 = player.launchProjectile(Arrow.class, player.getEyeLocation().getDirection());
|
||||
a2.setVelocity(arrow.getVelocity().rotateAroundY(Math.toRadians(-5)).multiply(5));
|
||||
a2.setPickupStatus(Arrow.PickupStatus.DISALLOWED);
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@EventHandler
|
||||
public void onEntityShoot(EntityShootBowEvent e) {
|
||||
if (e.getProjectile() instanceof Arrow) {
|
||||
if (e.getEntity() instanceof Player) {
|
||||
Player player = (Player) e.getEntity();
|
||||
if (player.getInventory().getItemInMainHand().getItemMeta() != null) {
|
||||
String name = player.getInventory().getItemInMainHand().getItemMeta().getDisplayName();
|
||||
if (name.equalsIgnoreCase(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "Terminator")) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
package com.night.nullvalkyrie.Events;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
|
||||
import static com.night.nullvalkyrie.Items.CustomItemManager.loadConfig;
|
||||
|
||||
public class onEntityDamageByEntity implements Listener {
|
||||
@EventHandler
|
||||
public void onEntityDamageByEntity(EntityDamageByEntityEvent e) {
|
||||
if (e.getDamager().getType() == EntityType.SNOWBALL) {
|
||||
Snowball sb = (Snowball) e.getDamager();
|
||||
Player pl = (Player) sb.getShooter();
|
||||
if(pl.getInventory().getItemInMainHand().getItemMeta() != null) {
|
||||
String name = pl.getInventory().getItemInMainHand().getItemMeta().getDisplayName();
|
||||
if (name.equalsIgnoreCase(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "SnowGun")) {
|
||||
e.setDamage(10000);
|
||||
} else if (name.equalsIgnoreCase("AA-12")) {
|
||||
e.setDamage(7);
|
||||
} else {
|
||||
e.setDamage(0);
|
||||
}
|
||||
}
|
||||
} else if(e.getDamager() instanceof Player) {
|
||||
Player player = (Player) e.getDamager();
|
||||
if(player.getInventory().getItemInMainHand().getItemMeta() != null && player.getInventory().getItemInMainHand().getItemMeta().getLore() != null && player.getInventory().getItemInMainHand().getItemMeta().getLore().contains(ChatColor.GOLD + "Item Ability: Damage Multiplier")) {
|
||||
if(e.getEntity() instanceof Zombie) {
|
||||
int zombie = loadConfig("ItemData\\WidowSword.yml").getInt("zombie");
|
||||
e.setDamage(e.getDamage() * (1 + zombie / 100));
|
||||
} else if(e.getEntity() instanceof Skeleton) {
|
||||
int skeleton = loadConfig("ItemData\\WidowSword.yml").getInt("skeleton");
|
||||
e.setDamage(e.getDamage() * (1 + skeleton / 100));
|
||||
} else if(e.getEntity() instanceof Spider) {
|
||||
int spider = loadConfig("ItemData\\WidowSword.yml").getInt("spider");
|
||||
e.setDamage(e.getDamage() * (1 + spider / 100));
|
||||
}
|
||||
player.sendMessage(String.valueOf(e.getDamage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
package com.night.nullvalkyrie.Events;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Arrow;
|
||||
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.entity.EntityShootBowEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
public class onEntityShoot implements Listener {
|
||||
@EventHandler
|
||||
public void onEntityShoot(EntityShootBowEvent e) {
|
||||
if(e.getProjectile() instanceof Arrow) {
|
||||
if(e.getEntity() instanceof Player) {
|
||||
if(e.getBow() != null && e.getBow().getItemMeta() != null && e.getBow().getItemMeta().getLore() != null && e.getBow().getItemMeta().getLore().contains(ChatColor.GOLD + "Item Ability: Triple Shot")) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@EventHandler
|
||||
public void onInteract(PlayerInteractEvent e) {
|
||||
Player player = e.getPlayer();
|
||||
if(e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||
if(e.hasItem()) {
|
||||
if(player.getInventory().getItemInMainHand().getItemMeta() != null) {
|
||||
String name = player.getInventory().getItemInMainHand().getItemMeta().getDisplayName();
|
||||
if (name.equalsIgnoreCase(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "Terminator")) {
|
||||
Arrow arrow = player.launchProjectile(Arrow.class, player.getEyeLocation().getDirection());
|
||||
arrow.setPickupStatus(Arrow.PickupStatus.DISALLOWED);
|
||||
arrow.setVelocity(arrow.getVelocity().multiply(5));
|
||||
Arrow a1 = player.launchProjectile(Arrow.class, player.getEyeLocation().getDirection());
|
||||
a1.setVelocity(arrow.getVelocity().rotateAroundY(Math.toRadians(5)).multiply(5));
|
||||
a1.setPickupStatus(Arrow.PickupStatus.DISALLOWED);
|
||||
Arrow a2 = player.launchProjectile(Arrow.class, player.getEyeLocation().getDirection());
|
||||
a2.setVelocity(arrow.getVelocity().rotateAroundY(Math.toRadians(-5)).multiply(5));
|
||||
a2.setPickupStatus(Arrow.PickupStatus.DISALLOWED);
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -36,15 +36,20 @@ public class CustomItemManager {
|
|||
}
|
||||
public static ItemStack WidowSword;
|
||||
public static ItemStack Terminator;
|
||||
public static ItemStack ExplosiveBow;
|
||||
public static ItemStack Grenade;
|
||||
public static ItemStack SnowGun;
|
||||
public static ItemStack ExplosiveBow;
|
||||
public static ItemStack AOTV;
|
||||
public static ItemStack GrapplingHook;
|
||||
public static void register() {
|
||||
createItemDataDirectory("ItemData");
|
||||
setWidowSword();
|
||||
setTerminator();
|
||||
setGrenade();
|
||||
setSnowGun();
|
||||
setExplosiveBow();
|
||||
setAOTV();
|
||||
setGrapplingHook();
|
||||
}
|
||||
|
||||
public static YamlConfiguration loadConfig(String path) {
|
||||
|
@ -120,7 +125,7 @@ public class CustomItemManager {
|
|||
wsMeta.setLore(lore);
|
||||
AttributeModifier dmg = new AttributeModifier(UUID.randomUUID(), "generic.attackDamage", 100, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlot.HAND);
|
||||
wsMeta.addAttributeModifier(Attribute.GENERIC_ATTACK_DAMAGE, dmg);
|
||||
wsMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
|
||||
wsMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_UNBREAKABLE, ItemFlag.HIDE_ENCHANTS);
|
||||
widow_sword.setItemMeta(wsMeta);
|
||||
WidowSword = widow_sword;
|
||||
ShapedRecipe wither_sword_recipe = new ShapedRecipe(new NamespacedKey(main, "widow_sword"), widow_sword);
|
||||
|
@ -144,6 +149,7 @@ public class CustomItemManager {
|
|||
lore.add("");
|
||||
lore.add(net.md_5.bungee.api.ChatColor.of("#ff23ff").toString() + ChatColor.BOLD + "MYTHIC");
|
||||
terminatorMeta.setLore(lore);
|
||||
terminatorMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_UNBREAKABLE, ItemFlag.HIDE_ENCHANTS);
|
||||
terminator.setItemMeta(terminatorMeta);
|
||||
Terminator = terminator;
|
||||
}
|
||||
|
@ -152,7 +158,13 @@ public class CustomItemManager {
|
|||
ItemMeta eggdata = egg.getItemMeta();
|
||||
eggdata.setDisplayName(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "Frag Grenade");
|
||||
eggdata.setUnbreakable(true);
|
||||
eggdata.setLore(Arrays.asList(ChatColor.GOLD + "Boom"));
|
||||
ArrayList<String> lore = new ArrayList<>();
|
||||
lore.add(ChatColor.GOLD + "Item Ability: Throw a TNT ");
|
||||
lore.add(ChatColor.GRAY + "Shoot TNT with 25x more power!");
|
||||
lore.add("");
|
||||
lore.add(net.md_5.bungee.api.ChatColor.of("#ff23ff").toString() + ChatColor.BOLD + "MYTHIC");
|
||||
eggdata.setLore(lore);
|
||||
eggdata.addItemFlags(ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_UNBREAKABLE, ItemFlag.HIDE_ENCHANTS);
|
||||
egg.setItemMeta(eggdata);
|
||||
Grenade = egg;
|
||||
}
|
||||
|
@ -163,8 +175,53 @@ public class CustomItemManager {
|
|||
ItemMeta hoedata = hoe.getItemMeta();
|
||||
hoedata.setDisplayName(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "SnowGun");
|
||||
hoedata.setUnbreakable(true);
|
||||
hoedata.setLore(Arrays.asList(ChatColor.GOLD + "Shoot Snowball!"));
|
||||
ArrayList<String> lore = new ArrayList<>();
|
||||
lore.add(ChatColor.GOLD + "Item Ability: Shoot Snowball");
|
||||
lore.add(ChatColor.GRAY + "Shoot snowball!");
|
||||
lore.add("");
|
||||
lore.add(net.md_5.bungee.api.ChatColor.of("#ff23ff").toString() + ChatColor.BOLD + "MYTHIC");
|
||||
hoedata.setLore(lore);
|
||||
hoedata.addItemFlags(ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_UNBREAKABLE, ItemFlag.HIDE_ENCHANTS);
|
||||
hoe.setItemMeta(hoedata);
|
||||
|
||||
SnowGun = hoe;
|
||||
}
|
||||
private static void setExplosiveBow() {
|
||||
|
||||
}
|
||||
private static void setAOTV() {
|
||||
ItemStack i = new ItemStack(Material.DIAMOND_SWORD, 1);
|
||||
ItemMeta im = i.getItemMeta();
|
||||
im.setDisplayName(ChatColor.DARK_PURPLE + "Aspect of The Void");
|
||||
ArrayList<String> lore = new ArrayList<>();
|
||||
lore.add(ChatColor.GRAY + "Damage: " + ChatColor.RED + "+100");
|
||||
lore.add("");
|
||||
lore.add(ChatColor.GOLD + "Item Ability: Instant Teleport");
|
||||
lore.add(ChatColor.GRAY + "Teleport 12 blocks ahead");
|
||||
lore.add("");
|
||||
lore.add(ChatColor.DARK_PURPLE.toString() + ChatColor.BOLD + "EPIC");
|
||||
im.setLore(lore);
|
||||
im.setUnbreakable(true);
|
||||
AttributeModifier dmg = new AttributeModifier(UUID.randomUUID(), "generic.attackDamage", 25, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlot.HAND);
|
||||
AttributeModifier speed = new AttributeModifier(UUID.randomUUID(), "generic.movementSpeed", 0.2, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlot.HAND);
|
||||
im.addAttributeModifier(Attribute.GENERIC_ATTACK_DAMAGE, dmg);
|
||||
im.addAttributeModifier(Attribute.GENERIC_MOVEMENT_SPEED, speed);
|
||||
im.addItemFlags(ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_UNBREAKABLE, ItemFlag.HIDE_ENCHANTS);
|
||||
i.setItemMeta(im);
|
||||
AOTV = i;
|
||||
}
|
||||
private static void setGrapplingHook() {
|
||||
ItemStack i = new ItemStack(Material.FISHING_ROD, 1);
|
||||
ItemMeta im = i.getItemMeta();
|
||||
im.setDisplayName(ChatColor.WHITE + "Grappling Hook");
|
||||
ArrayList<String> lore = new ArrayList<>();
|
||||
lore.add(ChatColor.GRAY + "I believe I can fly...");
|
||||
lore.add("");
|
||||
lore.add(ChatColor.WHITE.toString() + ChatColor.BOLD + "COMMON");
|
||||
im.setLore(lore);
|
||||
im.setUnbreakable(true);
|
||||
im.addItemFlags(ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_UNBREAKABLE, ItemFlag.HIDE_ENCHANTS);
|
||||
i.setItemMeta(im);
|
||||
GrapplingHook = i;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,8 +2,7 @@ package com.night.nullvalkyrie;
|
|||
|
||||
import com.night.nullvalkyrie.Chests.MenuListener;
|
||||
import com.night.nullvalkyrie.Enchantments.EnchantmentHandler;
|
||||
import com.night.nullvalkyrie.Events.onEntityDamageByEntity;
|
||||
import com.night.nullvalkyrie.Events.onEntityShoot;
|
||||
import com.night.nullvalkyrie.Events.CustomItemEvents;
|
||||
import com.night.nullvalkyrie.Items.CustomItemManager;
|
||||
import com.night.nullvalkyrie.Rank.*;
|
||||
import com.night.nullvalkyrie.Util.Util;
|
||||
|
@ -20,7 +19,6 @@ import org.bukkit.event.Listener;
|
|||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.server.ServerListPingEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
@ -33,7 +31,6 @@ public final class Main extends JavaPlugin implements Listener {
|
|||
private NameTagManager nameTagManager;
|
||||
private SideBarManager sideBarManager;
|
||||
private BelowNameManager belowNameManager;
|
||||
private CustomItemManager customItemManager;
|
||||
|
||||
public RankManager getRankManager() {
|
||||
return rankManager;
|
||||
|
@ -44,25 +41,18 @@ public final class Main extends JavaPlugin implements Listener {
|
|||
@Override
|
||||
public void onEnable() {
|
||||
new VanishCommand();new TestCommand();new AnvilCommand();new ArmorCommand();new MenuCommand();new RankCommand(this);
|
||||
new MessageCommand();new HologramCommand();new CraftCommand();new EnchantingCommand();new SpawnCommand();
|
||||
new WeaponCommand();
|
||||
bossbar = Bukkit.createBossBar(
|
||||
ChatColor.GOLD + "Kuudra",
|
||||
BarColor.RED,
|
||||
BarStyle.SEGMENTED_12
|
||||
);
|
||||
new MessageCommand();new HologramCommand();new CraftCommand();new EnchantingCommand();new SpawnCommand();new WeaponCommand();
|
||||
bossbar = Bukkit.createBossBar(ChatColor.GOLD + "Kuudra", BarColor.RED, BarStyle.SEGMENTED_12);
|
||||
Bukkit.getPluginManager().registerEvents(this, this);
|
||||
Bukkit.getPluginManager().registerEvents(new MenuListener(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new ScoreboardListener(this), this);
|
||||
Bukkit.getPluginManager().registerEvents(new onEntityDamageByEntity(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new onEntityShoot(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new CustomItemEvents(), this);
|
||||
nameTagManager = new NameTagManager(this);
|
||||
rankManager = new RankManager(this);
|
||||
sideBarManager = new SideBarManager(this);
|
||||
belowNameManager = new BelowNameManager();
|
||||
customItemManager = new CustomItemManager(this);
|
||||
new CustomItemManager(this);
|
||||
CustomItemManager.register();
|
||||
|
||||
EnchantmentHandler.register();
|
||||
}
|
||||
@EventHandler
|
||||
|
@ -78,19 +68,6 @@ public final class Main extends JavaPlugin implements Listener {
|
|||
}
|
||||
}
|
||||
}
|
||||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent e) {
|
||||
Player player = e.getPlayer();
|
||||
if(e.hasItem()) {
|
||||
if(player.getInventory().getItemInMainHand().getItemMeta() != null) {
|
||||
String name = player.getInventory().getItemInMainHand().getItemMeta().getDisplayName();
|
||||
if (name.equalsIgnoreCase(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "SnowGun")) {
|
||||
Snowball s = player.launchProjectile(Snowball.class, player.getLocation().getDirection());
|
||||
s.setVelocity(player.getLocation().getDirection().multiply(10));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onJoin(PlayerJoinEvent e) {
|
||||
|
|
|
@ -24,9 +24,7 @@ public class WeaponCommand extends Command {
|
|||
|
||||
@Override
|
||||
public void onCommand(CommandSender sender, String[] args) {
|
||||
List<String> ar = new ArrayList<>();
|
||||
ar.addAll(Arrays.asList(args));
|
||||
String name = String.join(" ", ar.remove(0));
|
||||
String name = String.join(" ", args);
|
||||
Player player = (Player) sender;
|
||||
if(name.equalsIgnoreCase("Snow Gun")) {
|
||||
player.getInventory().addItem(CustomItemManager.SnowGun);
|
||||
|
@ -36,13 +34,19 @@ public class WeaponCommand extends Command {
|
|||
player.getInventory().addItem(CustomItemManager.WidowSword);
|
||||
} else if(name.equalsIgnoreCase("Terminator")) {
|
||||
player.getInventory().addItem(CustomItemManager.Terminator);
|
||||
} else if(name.equalsIgnoreCase("Explosive Bow")) {
|
||||
player.getInventory().addItem(CustomItemManager.ExplosiveBow);
|
||||
} else if(name.equalsIgnoreCase("AOTV")) {
|
||||
player.getInventory().addItem(CustomItemManager.AOTV);
|
||||
} else if(name.equalsIgnoreCase("Grappling Hook")) {
|
||||
player.getInventory().addItem(CustomItemManager.GrapplingHook);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, String[] args) {
|
||||
if(args.length == 1) {
|
||||
return StringUtil.copyPartialMatches(args[0], Arrays.asList("Snow Gun", "Grenade", "Widow Sword", "Terminator"), new ArrayList<>());
|
||||
return StringUtil.copyPartialMatches(args[0], Arrays.asList("Snow Gun", "Grenade", "Widow Sword", "Terminator", "Explosive Bow", "AOTV", "Grappling Hook"), new ArrayList<>());
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue