Make it possible to shake heads from players

This commit is contained in:
TfT_02 2014-12-20 23:24:58 +01:00
parent 3422c5d3eb
commit d188224c06
4 changed files with 31 additions and 0 deletions

View File

@ -57,6 +57,7 @@ public class TreasureConfig extends ConfigLoader {
public List<ShakeTreasure> shakeFromMushroomCow = new ArrayList<ShakeTreasure>();
public List<ShakeTreasure> shakeFromPig = new ArrayList<ShakeTreasure>();
public List<ShakeTreasure> shakeFromPigZombie = new ArrayList<ShakeTreasure>();
public List<ShakeTreasure> shakeFromPlayer = new ArrayList<ShakeTreasure>();
public List<ShakeTreasure> shakeFromSheep = new ArrayList<ShakeTreasure>();
public List<ShakeTreasure> shakeFromSkeleton = new ArrayList<ShakeTreasure>();
public List<ShakeTreasure> shakeFromSlime = new ArrayList<ShakeTreasure>();
@ -353,6 +354,9 @@ public class TreasureConfig extends ConfigLoader {
else if (type.equals("Shake.PIG_ZOMBIE")) {
shakeFromPigZombie.add(shakeTreasure);
}
else if (type.equals("Shake.PLAYER")) {
shakeFromPlayer.add(shakeTreasure);
}
else if (type.equals("Shake.SHEEP")) {
shakeFromSheep.add(shakeTreasure);
}

View File

@ -110,6 +110,9 @@ public final class Fishing {
case PIG_ZOMBIE:
return TreasureConfig.getInstance().shakeFromPigZombie;
case PLAYER:
return TreasureConfig.getInstance().shakeFromPlayer;
case SHEEP:
return TreasureConfig.getInstance().shakeFromSheep;

View File

@ -28,6 +28,7 @@ import org.bukkit.entity.TNTPrimed;
import org.bukkit.entity.ThrownPotion;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta;
import org.bukkit.material.Wool;
import org.bukkit.potion.Potion;
import org.bukkit.potion.PotionType;
@ -393,6 +394,23 @@ public class FishingManager extends SkillManager {
// Extra processing depending on the mob and drop type
switch (target.getType()) {
case PLAYER:
Player targetPlayer = (Player) target;
switch (drop.getType()) {
case SKULL_ITEM:
drop.setDurability((short) 3);
SkullMeta skullMeta = (SkullMeta) drop.getItemMeta();
skullMeta.setOwner(targetPlayer.getName());
drop.setItemMeta(skullMeta);
break;
default:
break;
}
break;
case SHEEP:
Sheep sheep = (Sheep) target;

View File

@ -793,6 +793,12 @@ Shake:
XP: 0
Drop_Chance: 50.0
Drop_Level: 0
PLAYER:
SKULL_ITEM:
Amount: 1
XP: 0
Drop_Chance: 0.0
Drop_Level: 0
SHEEP:
WOOL:
Amount: 3