Add sound effects when a hardened item is breaking.

This commit is contained in:
sigonasr2 2016-07-15 01:40:44 -05:00
parent cc52679a55
commit 431eb48b22
3 changed files with 12 additions and 1 deletions

Binary file not shown.

View File

@ -7,6 +7,7 @@ import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.DyeColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.Sign;
import org.bukkit.command.CommandSender;
@ -85,6 +86,7 @@ public class GenericFunctions {
if (p!=null && break_count==0) {
p.sendMessage(ChatColor.GOLD+"WARNING!"+ChatColor.GREEN+ " Your "+ChatColor.YELLOW+GenericFunctions.UserFriendlyMaterialName(item)+ChatColor.WHITE+" is going to break soon! You should let it recharge by waiting 24 hours!");
}
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_BREAK, 1.0f, 1.0f);
return breakObscureHardenedItem(item);
} else {
lore.set(i, ChatColor.GRAY+"Breaks Remaining: "+ChatColor.YELLOW+(break_count-1));
@ -101,10 +103,12 @@ public class GenericFunctions {
if (p!=null && break_count==0) {
p.sendMessage(ChatColor.GOLD+"WARNING!"+ChatColor.GREEN+ " Your "+ChatColor.YELLOW+GenericFunctions.UserFriendlyMaterialName(item)+ChatColor.WHITE+" is going to break soon!");
}
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_BREAK, 1.0f, 1.0f);
return item;
//By setting the amount to 1, you refresh the item in the player's inventory.
} else {
//This item is technically destroyed.
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_BREAK, 1.0f, 1.0f);
return new ItemStack(Material.AIR);
}
}

View File

@ -2578,6 +2578,11 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
}
},15);
}
} else {
if (ev.getItemDrop().getItemStack().getType().toString().contains("SWORD") &&
ev.getPlayer().isSneaking()) {
ev.setCancelled(true);
}
}
}
@ -4306,6 +4311,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
GenericFunctions.breakHardenedItem(item,p);
} else
{
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_BREAK, 1.0f, 1.0f);
p.sendMessage(ChatColor.DARK_RED+"Your "+ChatColor.YELLOW+GenericFunctions.UserFriendlyMaterialName(item)+ChatColor.DARK_RED+" has broken!");
}
@ -4636,7 +4642,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
ev.setCancelled(true);
} else
if (armor.getType().toString().contains("SHIELD") &&
p.getInventory().getExtraContents()[0]==null) {
p.getInventory().getExtraContents()[0]==null &&
!GenericFunctions.isStriker(p)) {
p.getInventory().setExtraContents(new ItemStack[]{armor});
p.sendMessage(ChatColor.DARK_AQUA+"Automatically equipped "+ChatColor.YELLOW+(ev.getItem().getItemStack().getItemMeta().hasDisplayName()?ev.getItem().getItemStack().getItemMeta().getDisplayName():GenericFunctions.UserFriendlyMaterialName(ev.getItem().getItemStack())));
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_PICKUP, 1.0f, 1.0f);