-
-
Save chyyran/5c0225e61702d12755135ecd885da63a 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
#LegacyZombies config | |
#if this is true, feathers will drop with flesh | |
#if false, feathers will drop by themselves only. | |
dropFleshAndFeathers: false | |
#Percent Chance in Decimal of Feather Drops | |
chanceOfFeatherDrop: 0.50 |
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
package net.mystia.LegacyZombies; | |
import java.io.File; | |
import org.bukkit.Bukkit; | |
import org.bukkit.Material; | |
import org.bukkit.entity.EntityType; | |
import org.bukkit.event.EventHandler; | |
import org.bukkit.event.Listener; | |
import org.bukkit.event.entity.EntityDeathEvent; | |
import org.bukkit.inventory.ItemStack; | |
import org.bukkit.plugin.java.JavaPlugin; | |
public class LegacyZombiesMain extends JavaPlugin implements Listener | |
{ | |
public void onEnable() | |
{ | |
File config = new File(this.getDataFolder(), "config.yml"); | |
if (!config.exists()) | |
{ | |
this.saveDefaultConfig(); | |
} | |
getLogger().info("Loading LegacyZombies"); | |
Bukkit.getServer().getPluginManager().registerEvents(this, this); | |
} | |
@EventHandler | |
public void onZombieDeath(EntityDeathEvent event) | |
{ | |
if (event.getEntityType() == EntityType.ZOMBIE) | |
{ | |
Double FeatherDropChance = this.getConfig().getDouble("chanceOfFeatherDrop"); | |
Boolean DropBothItems = this.getConfig().getBoolean("dropFleshAndFeathers"); | |
if (Math.random() < FeatherDropChance) | |
{ | |
ItemStack feather = new ItemStack(Material.FEATHER, 1); | |
if (DropBothItems == false){ | |
event.getDrops().clear(); | |
} | |
event.getDrops().add(feather); | |
} | |
} | |
} | |
public void onDisable() | |
{ | |
getLogger().info("LegacyZombies has been disabled"); | |
} | |
} |
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
name: LegacyZombies | |
main: net.mystia.LegacyZombies.LegacyZombiesMain | |
version: 0.1 | |
description: Makes Zombies drop feathers | |
author: ron975 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment