Add halloween hats
This commit is contained in:
parent
bce439d0cf
commit
71e49854db
@ -12,23 +12,29 @@ import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.task.TaskManager;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.hub.HubManager;
|
||||
import mineplex.hub.HubType;
|
||||
import mineplex.hub.modules.trickortreat.Trick;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Instrument;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Note;
|
||||
import org.bukkit.Note.Tone;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class TrickOrTreatManager extends MiniPlugin
|
||||
@ -246,4 +252,43 @@ public class TrickOrTreatManager extends MiniPlugin
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void pumpkinHat(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
return;
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
if (player.getInventory().getHelmet() == null || player.getInventory().getHelmet().getType() == Material.AIR)
|
||||
{
|
||||
double rand = Math.random();
|
||||
|
||||
Material mat;
|
||||
byte data = 0;
|
||||
if (rand <= 0.25)
|
||||
{
|
||||
mat = Material.JACK_O_LANTERN;
|
||||
}
|
||||
else if (rand <= 0.5)
|
||||
{
|
||||
mat = Material.SKULL_ITEM;
|
||||
data = 0; // Skeleton
|
||||
}
|
||||
else if (rand <= 0.75)
|
||||
{
|
||||
mat = Material.SKULL_ITEM;
|
||||
data = 2; // Zombie
|
||||
}
|
||||
else
|
||||
{
|
||||
mat = Material.SKULL_ITEM;
|
||||
data = 4; // Creeper
|
||||
}
|
||||
|
||||
player.getInventory().setHelmet(new ItemStack(mat, 1, (short) 0, data));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user