Added shortbow and edited path for jar file to output
This commit is contained in:
parent
e46bc98564
commit
7dd18898f2
6 changed files with 117 additions and 30 deletions
10
pom.xml
10
pom.xml
|
@ -19,6 +19,7 @@
|
||||||
<url>https://github.com/night0721/nullvalkyrie</url>
|
<url>https://github.com/night0721/nullvalkyrie</url>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
<finalName>${project.name}-${project.version}</finalName>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
@ -45,6 +46,14 @@
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
|
<version>2.4</version>
|
||||||
|
<configuration>
|
||||||
|
<outputDirectory>D:\Server\plugins</outputDirectory>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
<resources>
|
<resources>
|
||||||
<resource>
|
<resource>
|
||||||
|
@ -53,7 +62,6 @@
|
||||||
</resource>
|
</resource>
|
||||||
</resources>
|
</resources>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>spigotmc-repo</id>
|
<id>spigotmc-repo</id>
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,7 @@
|
||||||
package com.night.nullvalkyrie.Items;
|
package com.night.nullvalkyrie.Items;
|
||||||
|
|
||||||
|
|
||||||
|
import com.night.nullvalkyrie.Enchantments.EnchantmentHandler;
|
||||||
import com.night.nullvalkyrie.Main;
|
import com.night.nullvalkyrie.Main;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
@ -18,8 +20,11 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import static com.night.nullvalkyrie.Enchantments.EnchantmentHandler.ThunderBolt;
|
||||||
|
|
||||||
public class CustomItemManager {
|
public class CustomItemManager {
|
||||||
private static Main main;
|
private static Main main;
|
||||||
public CustomItemManager(Main main) {
|
public CustomItemManager(Main main) {
|
||||||
|
@ -30,9 +35,16 @@ public class CustomItemManager {
|
||||||
|
|
||||||
}
|
}
|
||||||
public static ItemStack WidowSword;
|
public static ItemStack WidowSword;
|
||||||
|
public static ItemStack Terminator;
|
||||||
|
public static ItemStack ExplosiveBow;
|
||||||
|
public static ItemStack Grenade;
|
||||||
|
public static ItemStack SnowGun;
|
||||||
public static void register() {
|
public static void register() {
|
||||||
createItemDataDirectory("ItemData");
|
createItemDataDirectory("ItemData");
|
||||||
setWidowSword();
|
setWidowSword();
|
||||||
|
setTerminator();
|
||||||
|
setGrenade();
|
||||||
|
setSnowGun();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static YamlConfiguration loadConfig(String path) {
|
public static YamlConfiguration loadConfig(String path) {
|
||||||
|
@ -77,7 +89,6 @@ public class CustomItemManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private static void setWidowSword() {
|
private static void setWidowSword() {
|
||||||
|
|
||||||
YamlConfiguration config = loadConfig("ItemData\\WidowSword.yml");
|
YamlConfiguration config = loadConfig("ItemData\\WidowSword.yml");
|
||||||
config.set("zombie", 100);
|
config.set("zombie", 100);
|
||||||
config.set("skeleton", 100);
|
config.set("skeleton", 100);
|
||||||
|
@ -118,4 +129,42 @@ public class CustomItemManager {
|
||||||
wither_sword_recipe.setIngredient('B', Material.STICK);
|
wither_sword_recipe.setIngredient('B', Material.STICK);
|
||||||
Bukkit.addRecipe(wither_sword_recipe);
|
Bukkit.addRecipe(wither_sword_recipe);
|
||||||
}
|
}
|
||||||
|
private static void setTerminator() {
|
||||||
|
ItemStack terminator = new ItemStack(Material.BOW);
|
||||||
|
terminator.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 20);
|
||||||
|
terminator.addUnsafeEnchantment(Enchantment.LOOT_BONUS_MOBS, 10);
|
||||||
|
terminator.addUnsafeEnchantment(ThunderBolt,5);
|
||||||
|
ItemMeta terminatorMeta = terminator.getItemMeta();
|
||||||
|
terminatorMeta.setDisplayName(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "Terminator");
|
||||||
|
terminatorMeta.setUnbreakable(true);
|
||||||
|
ArrayList<String> lore = new ArrayList<>();
|
||||||
|
lore.add("");
|
||||||
|
lore.add(ChatColor.GOLD + "Item Ability: Triple Shot");
|
||||||
|
lore.add(ChatColor.GRAY + "Shoot three arrow at one time");
|
||||||
|
lore.add("");
|
||||||
|
lore.add(net.md_5.bungee.api.ChatColor.of("#ff23ff").toString() + ChatColor.BOLD + "MYTHIC");
|
||||||
|
terminatorMeta.setLore(lore);
|
||||||
|
terminator.setItemMeta(terminatorMeta);
|
||||||
|
Terminator = terminator;
|
||||||
|
}
|
||||||
|
private static void setGrenade() {
|
||||||
|
ItemStack egg = new ItemStack(Material.EGG);
|
||||||
|
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"));
|
||||||
|
egg.setItemMeta(eggdata);
|
||||||
|
Grenade = egg;
|
||||||
|
}
|
||||||
|
private static void setSnowGun() {
|
||||||
|
ItemStack hoe = new ItemStack(Material.DIAMOND_HOE);
|
||||||
|
hoe.addUnsafeEnchantment(EnchantmentHandler.ThunderBolt, 5);
|
||||||
|
hoe.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 20);
|
||||||
|
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!"));
|
||||||
|
hoe.setItemMeta(hoedata);
|
||||||
|
SnowGun = hoe;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.night.nullvalkyrie;
|
||||||
import com.night.nullvalkyrie.Chests.MenuListener;
|
import com.night.nullvalkyrie.Chests.MenuListener;
|
||||||
import com.night.nullvalkyrie.Enchantments.EnchantmentHandler;
|
import com.night.nullvalkyrie.Enchantments.EnchantmentHandler;
|
||||||
import com.night.nullvalkyrie.Events.onEntityDamageByEntity;
|
import com.night.nullvalkyrie.Events.onEntityDamageByEntity;
|
||||||
|
import com.night.nullvalkyrie.Events.onEntityShoot;
|
||||||
import com.night.nullvalkyrie.Items.CustomItemManager;
|
import com.night.nullvalkyrie.Items.CustomItemManager;
|
||||||
import com.night.nullvalkyrie.Rank.*;
|
import com.night.nullvalkyrie.Rank.*;
|
||||||
import com.night.nullvalkyrie.Util.Util;
|
import com.night.nullvalkyrie.Util.Util;
|
||||||
|
@ -54,12 +55,13 @@ public final class Main extends JavaPlugin implements Listener {
|
||||||
Bukkit.getPluginManager().registerEvents(new MenuListener(), this);
|
Bukkit.getPluginManager().registerEvents(new MenuListener(), this);
|
||||||
Bukkit.getPluginManager().registerEvents(new ScoreboardListener(this), this);
|
Bukkit.getPluginManager().registerEvents(new ScoreboardListener(this), this);
|
||||||
Bukkit.getPluginManager().registerEvents(new onEntityDamageByEntity(), this);
|
Bukkit.getPluginManager().registerEvents(new onEntityDamageByEntity(), this);
|
||||||
|
Bukkit.getPluginManager().registerEvents(new onEntityShoot(), this);
|
||||||
nameTagManager = new NameTagManager(this);
|
nameTagManager = new NameTagManager(this);
|
||||||
rankManager = new RankManager(this);
|
rankManager = new RankManager(this);
|
||||||
sideBarManager = new SideBarManager(this);
|
sideBarManager = new SideBarManager(this);
|
||||||
belowNameManager = new BelowNameManager();
|
belowNameManager = new BelowNameManager();
|
||||||
customItemManager = new CustomItemManager(this);
|
customItemManager = new CustomItemManager(this);
|
||||||
customItemManager.register();
|
CustomItemManager.register();
|
||||||
|
|
||||||
EnchantmentHandler.register();
|
EnchantmentHandler.register();
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ import org.bukkit.entity.Player;
|
||||||
import org.bukkit.util.StringUtil;
|
import org.bukkit.util.StringUtil;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class MessageCommand extends Command {
|
public class MessageCommand extends Command {
|
||||||
|
|
|
@ -1,15 +1,8 @@
|
||||||
package com.night.nullvalkyrie.commands;
|
package com.night.nullvalkyrie.commands;
|
||||||
|
|
||||||
import com.night.nullvalkyrie.Enchantments.EnchantmentHandler;
|
|
||||||
import com.night.nullvalkyrie.Items.CustomItemManager;
|
import com.night.nullvalkyrie.Items.CustomItemManager;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
|
||||||
import org.bukkit.util.StringUtil;
|
import org.bukkit.util.StringUtil;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -31,36 +24,25 @@ public class WeaponCommand extends Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCommand(CommandSender sender, String[] args) {
|
public void onCommand(CommandSender sender, String[] args) {
|
||||||
String name = String.join(" ", args);
|
List<String> ar = new ArrayList<>();
|
||||||
|
ar.addAll(Arrays.asList(args));
|
||||||
|
String name = String.join(" ", ar.remove(0));
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
if(name.equalsIgnoreCase("Snow Gun")) {
|
if(name.equalsIgnoreCase("Snow Gun")) {
|
||||||
ItemStack hoe = new ItemStack(Material.DIAMOND_HOE);
|
player.getInventory().addItem(CustomItemManager.SnowGun);
|
||||||
hoe.addUnsafeEnchantment(EnchantmentHandler.ThunderBolt, 5);
|
|
||||||
hoe.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 20);
|
|
||||||
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!"));
|
|
||||||
hoe.setItemMeta(hoedata);
|
|
||||||
|
|
||||||
player.getInventory().addItem(hoe);
|
|
||||||
} else if(name.equalsIgnoreCase("Grenade")) {
|
} else if(name.equalsIgnoreCase("Grenade")) {
|
||||||
ItemStack egg = new ItemStack(Material.EGG);
|
player.getInventory().addItem(CustomItemManager.Grenade);
|
||||||
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"));
|
|
||||||
egg.setItemMeta(eggdata);
|
|
||||||
player.getInventory().addItem(egg);
|
|
||||||
} else if(name.equalsIgnoreCase("Widow Sword")) {
|
} else if(name.equalsIgnoreCase("Widow Sword")) {
|
||||||
player.getInventory().addItem(CustomItemManager.WidowSword);
|
player.getInventory().addItem(CustomItemManager.WidowSword);
|
||||||
|
} else if(name.equalsIgnoreCase("Terminator")) {
|
||||||
|
player.getInventory().addItem(CustomItemManager.Terminator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> onTabComplete(CommandSender sender, String[] args) {
|
public List<String> onTabComplete(CommandSender sender, String[] args) {
|
||||||
if(args.length == 1) {
|
if(args.length == 1) {
|
||||||
return StringUtil.copyPartialMatches(args[0], Arrays.asList("Snow Gun", "Grenade", "Widow Sword"), new ArrayList<>());
|
return StringUtil.copyPartialMatches(args[0], Arrays.asList("Snow Gun", "Grenade", "Widow Sword", "Terminator"), new ArrayList<>());
|
||||||
}
|
}
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue