import org.bukkit.entity.Player; //导入方法依赖的package包/类
private void items(Player p){
WCCore.getInstance().debugLog("Task Items");
if(files.getUsers().contains("Users." + p.getName() + ".bypass")
&& files.getUsers().getBoolean("Users." + p.getName() + ".bypass")) return;
if (p.getInventory().getItemInMainHand() == null) {
return;
}
//Comprobación extra
//Palo
if (p.getInventory().getItemInMainHand().isSimilar(itemsClass.STICK.getItemStack())){
if(p.getMaxHealth() != 30){
p.setMaxHealth(30);
}
if(p.getWalkSpeed() > 0.2f){
p.setWalkSpeed(0.2f);
}
return;
}
//Picos
if (p.getInventory().getItemInMainHand().isSimilar(itemsClass.P1.getItemStack())){
if(p.getMaxHealth() != 35){
p.setMaxHealth(35);
}
if(p.getWalkSpeed() != 0.4f){
p.setWalkSpeed(0.4f);
}
return;
}
if (p.getInventory().getItemInMainHand().isSimilar(itemsClass.P2.getItemStack())){
if(p.getMaxHealth() != 35){
p.setMaxHealth(35);
}
if(p.getWalkSpeed() != 0.4f){
p.setWalkSpeed(0.4f);
}
return;
}
if (p.getInventory().getItemInMainHand().isSimilar(itemsClass.P3.getItemStack())){
if(p.getMaxHealth() != 35){
p.setMaxHealth(35);
}
if(p.getWalkSpeed() != 0.4f){
p.setWalkSpeed(0.4f);
}
return;
}
if(!(p.getInventory().getItemInMainHand().isSimilar(itemsClass.STICK.getItemStack())
|| p.getInventory().getItemInMainHand().isSimilar(itemsClass.P1.getItemStack())
|| p.getInventory().getItemInMainHand().isSimilar(itemsClass.P2.getItemStack())
|| p.getInventory().getItemInMainHand().isSimilar(itemsClass.P3.getItemStack()))){
if(p.getMaxHealth() > 20){
p.setMaxHealth(20);
}
if(p.getWalkSpeed() > 0.2f){
p.setWalkSpeed(0.2f);
}
}
}