Ranger mode and Bow arrow shooting fixed, while still preventing them

from being hit by Strikers. Obey hidden flags with item description.
This commit is contained in:
sigonasr2 2016-08-14 20:30:17 -05:00
parent 22e1dc51bc
commit e779ccb420
3 changed files with 76 additions and 72 deletions

Binary file not shown.

View File

@ -26,6 +26,7 @@ import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BannerMeta;
import org.bukkit.inventory.meta.BlockStateMeta;
@ -125,6 +126,7 @@ public class WorldShop {
if (item.getType()==Material.ENCHANTED_BOOK) {
if (item.getItemMeta() instanceof EnchantmentStorageMeta) {
EnchantmentStorageMeta e = (EnchantmentStorageMeta)item.getItemMeta();
if (!e.getItemFlags().contains(ItemFlag.HIDE_ENCHANTS)) {
for (int i=0;i<Enchantment.values().length;i++) {
if (e.hasStoredEnchant((Enchantment.values()[i]))) {
message+="\n"+ChatColor.GRAY+getRealName(Enchantment.values()[i])+" "+toRomanNumeral(e.getStoredEnchantLevel(Enchantment.getByName(Enchantment.values()[i].getName()))); //This is an enchantment we have.
@ -132,6 +134,7 @@ public class WorldShop {
}
}
}
}
if (item.getType()==Material.WRITTEN_BOOK) {
if (item.getItemMeta() instanceof BookMeta) {
BookMeta book = (BookMeta)item.getItemMeta();
@ -143,6 +146,7 @@ public class WorldShop {
if (item.getType()==Material.POTION || item.getType()==Material.SPLASH_POTION || item.getType()==Material.LINGERING_POTION) {
if (item.getItemMeta() instanceof PotionMeta) {
PotionMeta pot = (PotionMeta)item.getItemMeta();
if (!pot.getItemFlags().contains(ItemFlag.HIDE_POTION_EFFECTS)) {
List<PotionEffect> effects = pot.getCustomEffects();
for (int i=0;i<effects.size();i++) {
@ -215,7 +219,7 @@ public class WorldShop {
}
}
}
}
}

View File

@ -5375,6 +5375,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
}
}
arr.setCustomName("HIT");
}
}
}
@ -5399,7 +5400,6 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
ev.getProjectile().getType()==EntityType.TIPPED_ARROW)) {
//Now we know this is a player who shot a regular old arrow.
final Player p = (Player)ev.getEntity();
ev.getProjectile().setCustomName("HIT");
//We need to give one back to them.
if (ev.getProjectile().getType()==EntityType.ARROW) {
//This was an arrow quiver. We need to verify that, check the player's inventory for one.