fix shake for WITHER-SKELETON. avoid to use getSkeltonType()

This commit is contained in:
kanesada2 2017-01-13 14:10:55 +09:00
parent a2bcce9ab1
commit 2e7f56eeb5
4 changed files with 204 additions and 96 deletions

View File

@ -14,7 +14,6 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.PotionMeta; import org.bukkit.inventory.meta.PotionMeta;
import org.bukkit.material.Dye; import org.bukkit.material.Dye;
import org.bukkit.potion.Potion;
import org.bukkit.potion.PotionData; import org.bukkit.potion.PotionData;
import org.bukkit.potion.PotionType; import org.bukkit.potion.PotionType;
@ -46,31 +45,32 @@ public class TreasureConfig extends ConfigLoader {
public List<HylianTreasure> hylianFromFlowers = new ArrayList<HylianTreasure>(); public List<HylianTreasure> hylianFromFlowers = new ArrayList<HylianTreasure>();
public List<HylianTreasure> hylianFromPots = new ArrayList<HylianTreasure>(); public List<HylianTreasure> hylianFromPots = new ArrayList<HylianTreasure>();
public List<ShakeTreasure> shakeFromBlaze = new ArrayList<ShakeTreasure>(); public List<ShakeTreasure> shakeFromBlaze = new ArrayList<ShakeTreasure>();
public List<ShakeTreasure> shakeFromCaveSpider = new ArrayList<ShakeTreasure>(); public List<ShakeTreasure> shakeFromCaveSpider = new ArrayList<ShakeTreasure>();
public List<ShakeTreasure> shakeFromSpider = new ArrayList<ShakeTreasure>(); public List<ShakeTreasure> shakeFromSpider = new ArrayList<ShakeTreasure>();
public List<ShakeTreasure> shakeFromChicken = new ArrayList<ShakeTreasure>(); public List<ShakeTreasure> shakeFromChicken = new ArrayList<ShakeTreasure>();
public List<ShakeTreasure> shakeFromCow = new ArrayList<ShakeTreasure>(); public List<ShakeTreasure> shakeFromCow = new ArrayList<ShakeTreasure>();
public List<ShakeTreasure> shakeFromCreeper = new ArrayList<ShakeTreasure>(); public List<ShakeTreasure> shakeFromCreeper = new ArrayList<ShakeTreasure>();
public List<ShakeTreasure> shakeFromEnderman = new ArrayList<ShakeTreasure>(); public List<ShakeTreasure> shakeFromEnderman = new ArrayList<ShakeTreasure>();
public List<ShakeTreasure> shakeFromGhast = new ArrayList<ShakeTreasure>(); public List<ShakeTreasure> shakeFromGhast = new ArrayList<ShakeTreasure>();
public List<ShakeTreasure> shakeFromHorse = new ArrayList<ShakeTreasure>(); public List<ShakeTreasure> shakeFromHorse = new ArrayList<ShakeTreasure>();
public List<ShakeTreasure> shakeFromIronGolem = new ArrayList<ShakeTreasure>(); public List<ShakeTreasure> shakeFromIronGolem = new ArrayList<ShakeTreasure>();
public List<ShakeTreasure> shakeFromMagmaCube = new ArrayList<ShakeTreasure>(); public List<ShakeTreasure> shakeFromMagmaCube = new ArrayList<ShakeTreasure>();
public List<ShakeTreasure> shakeFromMushroomCow = new ArrayList<ShakeTreasure>(); public List<ShakeTreasure> shakeFromMushroomCow = new ArrayList<ShakeTreasure>();
public List<ShakeTreasure> shakeFromPig = new ArrayList<ShakeTreasure>(); public List<ShakeTreasure> shakeFromPig = new ArrayList<ShakeTreasure>();
public List<ShakeTreasure> shakeFromPigZombie = new ArrayList<ShakeTreasure>(); public List<ShakeTreasure> shakeFromPigZombie = new ArrayList<ShakeTreasure>();
public List<ShakeTreasure> shakeFromPlayer = new ArrayList<ShakeTreasure>(); public List<ShakeTreasure> shakeFromPlayer = new ArrayList<ShakeTreasure>();
public List<ShakeTreasure> shakeFromSheep = new ArrayList<ShakeTreasure>(); public List<ShakeTreasure> shakeFromSheep = new ArrayList<ShakeTreasure>();
public List<ShakeTreasure> shakeFromSkeleton = new ArrayList<ShakeTreasure>(); public List<ShakeTreasure> shakeFromSkeleton = new ArrayList<ShakeTreasure>();
public List<ShakeTreasure> shakeFromSlime = new ArrayList<ShakeTreasure>(); public List<ShakeTreasure> shakeFromSlime = new ArrayList<ShakeTreasure>();
public List<ShakeTreasure> shakeFromSnowman = new ArrayList<ShakeTreasure>(); public List<ShakeTreasure> shakeFromSnowman = new ArrayList<ShakeTreasure>();
public List<ShakeTreasure> shakeFromSquid = new ArrayList<ShakeTreasure>(); public List<ShakeTreasure> shakeFromSquid = new ArrayList<ShakeTreasure>();
public List<ShakeTreasure> shakeFromWitch = new ArrayList<ShakeTreasure>(); public List<ShakeTreasure> shakeFromWitch = new ArrayList<ShakeTreasure>();
public List<ShakeTreasure> shakeFromZombie = new ArrayList<ShakeTreasure>(); public List<ShakeTreasure> shakeFromWitherSkeleton = new ArrayList<ShakeTreasure>();
public List<ShakeTreasure> shakeFromRabbit = new ArrayList<ShakeTreasure>(); public List<ShakeTreasure> shakeFromZombie = new ArrayList<ShakeTreasure>();
public List<ShakeTreasure> shakeFromElderGuardian = new ArrayList<ShakeTreasure>(); public List<ShakeTreasure> shakeFromRabbit = new ArrayList<ShakeTreasure>();
public List<ShakeTreasure> shakeFromGuardian = new ArrayList<ShakeTreasure>(); public List<ShakeTreasure> shakeFromElderGuardian = new ArrayList<ShakeTreasure>();
public List<ShakeTreasure> shakeFromGuardian = new ArrayList<ShakeTreasure>();
public HashMap<Rarity, List<FishingTreasure>> fishingRewards = new HashMap<Rarity, List<FishingTreasure>>(); public HashMap<Rarity, List<FishingTreasure>> fishingRewards = new HashMap<Rarity, List<FishingTreasure>>();
public HashMap<Rarity, List<EnchantmentTreasure>> fishingEnchantments = new HashMap<Rarity, List<EnchantmentTreasure>>(); public HashMap<Rarity, List<EnchantmentTreasure>> fishingEnchantments = new HashMap<Rarity, List<EnchantmentTreasure>>();
@ -133,19 +133,19 @@ public class TreasureConfig extends ConfigLoader {
return; return;
} }
loadTreaures("Fishing"); loadTreasures("Fishing");
loadTreaures("Excavation"); loadTreasures("Excavation");
loadTreaures("Hylian_Luck"); loadTreasures("Hylian_Luck");
loadEnchantments(); loadEnchantments();
for (EntityType entity : EntityType.values()) { for (EntityType entity : EntityType.values()) {
if (entity.isAlive()) { if (entity.isAlive()) {
loadTreaures("Shake." + entity.toString()); loadTreasures("Shake." + entity.toString());
} }
} }
} }
private void loadTreaures(String type) { private void loadTreasures(String type) {
boolean isFishing = type.equals("Fishing"); boolean isFishing = type.equals("Fishing");
boolean isShake = type.contains("Shake"); boolean isShake = type.contains("Shake");
boolean isExcavation = type.equals("Excavation"); boolean isExcavation = type.equals("Excavation");
@ -178,7 +178,9 @@ public class TreasureConfig extends ConfigLoader {
if (materialName.contains("INK_SACK")) { if (materialName.contains("INK_SACK")) {
material = Material.INK_SACK; material = Material.INK_SACK;
} else if (materialName.contains("INVENTORY")) { } else if(materialName.contains("COAL")){
material = Material.COAL;
} else if (materialName.contains("INVENTORY")) {
// Use magic material BED_BLOCK to know that we're grabbing something from the inventory and not a normal treasure // Use magic material BED_BLOCK to know that we're grabbing something from the inventory and not a normal treasure
shakeFromPlayer.add(new ShakeTreasure(new ItemStack(Material.BED_BLOCK, 1, (byte) 0), 1, getInventoryStealDropChance(), getInventoryStealDropLevel())); shakeFromPlayer.add(new ShakeTreasure(new ItemStack(Material.BED_BLOCK, 1, (byte) 0), 1, getInventoryStealDropChance(), getInventoryStealDropLevel()));
continue; continue;
@ -365,6 +367,8 @@ public class TreasureConfig extends ConfigLoader {
shakeFromSquid.add(shakeTreasure); shakeFromSquid.add(shakeTreasure);
} else if (type.equals("Shake.WITCH")) { } else if (type.equals("Shake.WITCH")) {
shakeFromWitch.add(shakeTreasure); shakeFromWitch.add(shakeTreasure);
} else if (type.equals("Shake.WITHER_SKELETON")) {
shakeFromWitherSkeleton.add(shakeTreasure);
} else if (type.equals("Shake.ZOMBIE")) { } else if (type.equals("Shake.ZOMBIE")) {
shakeFromZombie.add(shakeTreasure); shakeFromZombie.add(shakeTreasure);
} else if (type.equals("Shake.RABBIT")) { } else if (type.equals("Shake.RABBIT")) {

View File

@ -1,6 +1,5 @@
package com.gmail.nossr50.skills.fishing; package com.gmail.nossr50.skills.fishing;
import java.util.EnumSet;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -131,6 +130,8 @@ public final class Fishing {
case WITCH: case WITCH:
return TreasureConfig.getInstance().shakeFromWitch; return TreasureConfig.getInstance().shakeFromWitch;
case WITHER_SKELETON:
return TreasureConfig.getInstance().shakeFromWitherSkeleton;
case ZOMBIE: case ZOMBIE:
return TreasureConfig.getInstance().shakeFromZombie; return TreasureConfig.getInstance().shakeFromZombie;

View File

@ -10,7 +10,6 @@ import java.util.Map;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.WeatherType; import org.bukkit.WeatherType;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
@ -23,8 +22,6 @@ import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Sheep; import org.bukkit.entity.Sheep;
import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Skeleton.SkeletonType;
import org.bukkit.entity.TNTPrimed; import org.bukkit.entity.TNTPrimed;
import org.bukkit.entity.ThrownPotion; import org.bukkit.entity.ThrownPotion;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
@ -448,26 +445,13 @@ public class FishingManager extends SkillManager {
sheep.setSheared(true); sheep.setSheared(true);
} }
break; break;
case WITHER_SKELETON:
case SKELETON: if(drop.getType() == Material.SKULL_ITEM){
if (((Skeleton) target).getSkeletonType() == SkeletonType.WITHER) { drop.setDurability((short) 1);
switch (drop.getType()) {
case SKULL_ITEM:
drop.setDurability((short) 1);
break;
case ARROW:
drop.setType(Material.COAL);
break;
default:
break;
}
} }
break; break;
default: default:
break; break;
} }
McMMOPlayerShakeEvent shakeEvent = new McMMOPlayerShakeEvent(getPlayer(), drop); McMMOPlayerShakeEvent shakeEvent = new McMMOPlayerShakeEvent(getPlayer(), drop);

199
src/main/resources/treasures.yml Normal file → Executable file
View File

@ -453,12 +453,14 @@ Excavation:
Drop_Chance: 10.0 Drop_Chance: 10.0
Drop_Level: 75 Drop_Level: 75
Drops_From: [Gravel] Drops_From: [Gravel]
BONE: #<2016/07/16 changed Start>
Amount: 1 # BONE:
XP: 30 # Amount: 1
Drop_Chance: 10.0 # XP: 30
Drop_Level: 175 # Drop_Chance: 10.0
Drops_From: [Gravel] # Drop_Level: 175
# Drops_From: [Gravel]
#<2016/07/16 changed End>
APPLE: APPLE:
Amount: 1 Amount: 1
XP: 100 XP: 100
@ -483,24 +485,26 @@ Excavation:
Drop_Chance: 0.5 Drop_Chance: 0.5
Drop_Level: 850 Drop_Level: 850
Drops_From: [Gravel] Drops_From: [Gravel]
RED_MUSHROOM: #<2016/07/16 changed Start>
Amount: 1 # RED_MUSHROOM:
XP: 80 # Amount: 1
Drop_Chance: 0.5 # XP: 80
Drop_Level: 500 # Drop_Chance: 0.5
Drops_From: [Dirt, Podzol, Grass, Mycelium] # Drop_Level: 500
BROWN_MUSHROOM: # Drops_From: [Dirt, Podzol, Grass, Mycelium]
Amount: 1 # BROWN_MUSHROOM:
XP: 80 # Amount: 1
Drop_Chance: 0.5 # XP: 80
Drop_Level: 500 # Drop_Chance: 0.5
Drops_From: [Dirt, Podzol, Grass, Mycelium] # Drop_Level: 500
EGG: # Drops_From: [Dirt, Podzol, Grass, Mycelium]
Amount: 1 # EGG:
XP: 100 # Amount: 1
Drop_Chance: 1.0 # XP: 100
Drop_Level: 250 # Drop_Chance: 1.0
Drops_From: [Grass] # Drop_Level: 250
# Drops_From: [Grass]
#<2016/07/16 changed End>
SOUL_SAND: SOUL_SAND:
Amount: 1 Amount: 1
XP: 80 XP: 80
@ -519,54 +523,152 @@ Excavation:
Drop_Chance: 5.0 Drop_Chance: 5.0
Drop_Level: 750 Drop_Level: 750
Drops_From: [Clay] Drops_From: [Clay]
STRING: #<2016/07/16 changed Start>
Amount: 1 # STRING:
XP: 200 # Amount: 1
Drop_Chance: 5.0 # XP: 200
Drop_Level: 250 # Drop_Chance: 5.0
Drops_From: [Clay] # Drop_Level: 250
# Drops_From: [Clay]
#<2016/07/16 changed End>
GLOWSTONE_DUST: GLOWSTONE_DUST:
Amount: 1 Amount: 1
XP: 80 XP: 80
Drop_Chance: 5.0 Drop_Chance: 5.0
Drop_Level: 25 Drop_Level: 25
Drops_From: [Dirt, Podzol, Grass, Sand, Red_Sand, Mycelium] Drops_From: [Dirt, Podzol, Grass, Sand, Red_Sand, Mycelium]
#<2016/07/16 changed Start>
# GOLD_RECORD:
# Amount: 1
# XP: 3000
# Drop_Chance: 0.05
# Drop_Level: 250
# Drops_From: [Dirt, Podzol, Grass, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand]
# GREEN_RECORD:
# Amount: 1
# XP: 3000:
# Drop_Chance: 0.05
# Drop_Level: 250
# Drops_From: [Dirt, Podzol, Grass, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand]
GOLD_RECORD: GOLD_RECORD:
Amount: 1 Amount: 1
XP: 3000 XP: 3000
Drop_Chance: 0.05 Drop_Chance: 0.0001
Drop_Level: 250 Drop_Level: 250
Drops_From: [Dirt, Podzol, Grass, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand] Drops_From: [Dirt, Podzol, Grass, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand]
GREEN_RECORD: GREEN_RECORD:
Amount: 1 Amount: 1
XP: 3000 XP: 3000
Drop_Chance: 0.05 Drop_Chance: 0.0001
Drop_Level: 250 Drop_Level: 250
Drops_From: [Dirt, Podzol, Grass, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand] Drops_From: [Dirt, Podzol, Grass, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand]
RECORD_3:
Amount: 1
XP: 3000
Drop_Chance: 0.0001
Drop_Level: 250
Drops_From: [Dirt, Podzol, Grass, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand]
RECORD_4:
Amount: 1
XP: 3000
Drop_Chance: 0.0001
Drop_Level: 250
Drops_From: [Dirt, Podzol, Grass, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand]
RECORD_5:
Amount: 1
XP: 3000
Drop_Chance: 0.0001
Drop_Level: 250
Drops_From: [Dirt, Podzol, Grass, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand]
RECORD_6:
Amount: 1
XP: 3000
Drop_Chance: 0.0001
Drop_Level: 250
Drops_From: [Dirt, Podzol, Grass, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand]
RECORD_7:
Amount: 1
XP: 3000
Drop_Chance: 0.0001
Drop_Level: 250
Drops_From: [Dirt, Podzol, Grass, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand]
RECORD_8:
Amount: 1
XP: 3000
Drop_Chance: 0.0001
Drop_Level: 250
Drops_From: [Dirt, Podzol, Grass, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand]
RECORD_9:
Amount: 1
XP: 3000
Drop_Chance: 0.0001
Drop_Level: 250
Drops_From: [Dirt, Podzol, Grass, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand]
RECORD_10:
Amount: 1
XP: 3000
Drop_Chance: 0.0001
Drop_Level: 250
Drops_From: [Dirt, Podzol, Grass, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand]
RECORD_11:
Amount: 1
XP: 3000
Drop_Chance: 0.0001
Drop_Level: 250
Drops_From: [Dirt, Podzol, Grass, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand]
RECORD_12:
Amount: 1
XP: 3000
Drop_Chance: 0.0001
Drop_Level: 250
Drops_From: [Dirt, Podzol, Grass, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand]
#<2016/07/16 changed End>
DIAMOND: DIAMOND:
Amount: 1 Amount: 1
XP: 1000 XP: 1000
Drop_Chance: 0.13 Drop_Chance: 0.13
Drop_Level: 350 Drop_Level: 350
Drops_From: [Dirt, Podzol, Grass, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand] Drops_From: [Dirt, Podzol, Grass, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand]
INK_SACK_BROWN: #<2016/07/16 changed Start>
Amount: 1 # INK_SACK_BROWN:
XP: 100 # Amount: 1
Drop_Chance: 1.33 # XP: 100
Drop_Level: 350 # Drop_Chance: 1.33
Drops_From: [Dirt, Podzol, Grass, Mycelium] # Drop_Level: 350
# Drops_From: [Dirt, Podzol, Grass, Mycelium]
# QUARTZ:
# Amount: 1
# XP: 100
# Drop_Chance: 0.5
# Drop_Level: 850
# Drops_From: [Dirt, Podzol, Sand, Red_Sand, Gravel, Mycelium, Soul_Sand]
QUARTZ: QUARTZ:
Amount: 1 Amount: 1
XP: 100 XP: 100
Drop_Chance: 0.5 Drop_Chance: 5.0
Drop_Level: 850 Drop_Level: 350
Drops_From: [Dirt, Podzol, Sand, Red_Sand, Gravel, Mycelium, Soul_Sand] Drops_From: [Dirt, Podzol, Sand, Red_Sand, Gravel, Mycelium, Soul_Sand]
#<2016/07/16 changed End>
NAME_TAG: NAME_TAG:
Amount: 1 Amount: 1
XP: 3000 XP: 3000
Drop_Chance: 0.05 Drop_Chance: 0.05
Drop_Level: 250 Drop_Level: 250
Drops_From: [Dirt, Podzol, Grass, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand] Drops_From: [Dirt, Podzol, Grass, Sand, Red_Sand, Gravel, Clay, Mycelium, Soul_Sand]
#<2016/07/16 changed Start>
CLAY_BALL:
Amount: 1
XP: 80
Drop_Chance: 5.0
Drop_Level: 25
Drops_From: [Dirt, Podzol, Grass, Sand, Red_Sand, Mycelium]
GOLDEN_APPLE:
Amount: 1
XP: 9800
Drop_Chance: 0.5
Drop_Level: 500
Drops_From: [Dirt, Podzol, Grass, Sand, Red_Sand, Mycelium]
#<2016/07/16 changed End>
# #
# Settings for Hylian Luck # Settings for Hylian Luck
### ###
@ -919,6 +1021,23 @@ Shake:
XP: 0 XP: 0
Drop_Chance: 15.0 Drop_Chance: 15.0
Drop_Level: 0 Drop_Level: 0
WITHER_SKELETON:
SKULL_ITEM:
Data: 0
Amount: 1
XP: 0
Drop_Chance: 2.0
Drop_Level: 0
BONE:
Amount: 1
XP: 0
Drop_Chance: 49.0
Drop_Level: 0
COAL:
Amount: 2
XP: 0
Drop_Chance: 49.0
Drop_Level: 0
ZOMBIE: ZOMBIE:
SKULL_ITEM: SKULL_ITEM:
Data: 2 Data: 2