Last active
December 22, 2015 10:59
-
-
Save CeramicTitan/6462779 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable(){ | |
@Override | |
public void run() { | |
for(Player p : Bukkit.getOnlinePlayers()){//Gets all the online platers | |
if(p.getInventory().getArmorContents() != null){ | |
for(ItemStack armour : p.getInventory().getArmorContents()){ | |
armour.setDurability((short)0);//Keeping durability at a constant durability | |
} | |
} | |
if(p.getInventory().contains(Material.WOOD_SWORD) | |
|| p.getInventory().contains(Material.IRON_SWORD) | |
|| p.getInventory().contains(Material.GOLD_SWORD) | |
|| p.getInventory().contains(Material.DIAMOND_SWORD)){//Checking if the inventory contains swords | |
for(int x=1; x<=33;x++){ | |
if(p.getInventory().getItem(x) != null && p.getInventory().getItem(x).getType() == Material.WOOD_SWORD | |
|| p.getInventory().getItem(x).getType() == Material.IRON_SWORD | |
|| p.getInventory().getItem(x).getType() == Material.GOLD_SWORD | |
|| p.getInventory().getItem(x).getType() == Material.DIAMOND_SWORD){//Getting all the swords | |
p.getInventory().getItem(x).setDurability((short) 0);//Keeping durability at a constant durability | |
} | |
} | |
} | |
} | |
} | |
}, 0L, 20L); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment