Kapito? Rabbito! #26
@ -46,7 +46,7 @@ public class PlayerConnectionListener implements Listener {
|
||||
player.teleport(new Location(Bukkit.getWorlds().get(0), Config.SpawnX, Config.SpawnY, Config.SpawnZ, Config.Yaw, Config.Pitch));
|
||||
player.getInventory().clear();
|
||||
LobbyInventory.givePlayerLobbyItems(player);
|
||||
player.getInventory().setHelmet(RabbitListener.EGG_HEAD);
|
||||
player.getInventory().setHelmet(RabbitListener.getEggHead());
|
||||
player.setGameMode(GameMode.ADVENTURE);
|
||||
player.setHealth(20);
|
||||
player.setFoodLevel(20);
|
||||
|
@ -12,29 +12,37 @@ import org.bukkit.entity.Rabbit;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.FireworkMeta;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.HashSet;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
|
||||
public class RabbitListener implements Listener {
|
||||
|
||||
public static final ItemStack EGG_HEAD;
|
||||
private static final HashSet<String> EGGS = new HashSet<>();
|
||||
|
||||
static {
|
||||
EGG_HEAD = getCustomTextureHead(new ItemStack(Material.PLAYER_HEAD),
|
||||
"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMjkxYzQyYjE3MWZlZDZiZWE2ZmRmNGQ4NzJkNThiZDMzZDdjZTA5ZWVlZGRhMzZlNTQxNTFmODg5MDY2YmU0ZSJ9fX0=");
|
||||
EGGS.add("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6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I0ODY5Nzk5ZWZkM2UzZTI2N2ZlYjQ1ZjEyYzk0YWJhMTJiYWQzMTk1NmNmMmU0MmYwMzVkN2U5YjRjIn19fQ==");
|
||||
EGGS.add("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZjIxMDkwNzlkZGUxNWFkYWU1NTljNDdhYTZkZTRiZGFkYjE4NmE0YjMwZGE1YWNiZWU3NDE1YTk3ODhmN2UifX19");
|
||||
EGGS.add("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOWViZjc4ZTFjMWIwMWRlY2ZiNmIzZGY1MjU4MTY4YzNhYTg3NDg3MWJlNGJjNGRiMjU1ODRlZDU5MGE1NTdiMiJ9fX0=");
|
||||
EGGS.add("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZGEzZGRjZTJjNTU2ZjIyZmRhMzE3OTc4MzlmZmQxZDA0MjhhZmUxMmE0NWMwNzM1NTk1MWY0NDRjNzc0YWQifX19");
|
||||
}
|
||||
|
||||
public RabbitListener() {
|
||||
Bukkit.getPluginManager().registerEvents(this, LobbySystem.getInstance());
|
||||
World world = Bukkit.getWorlds().get(0);
|
||||
spreadRabbits(50, world);
|
||||
spreadRabbits(125, world);
|
||||
Bukkit.getScheduler().runTaskTimer(LobbySystem.getInstance(), () -> {
|
||||
Rabbit rabbit = world.getEntitiesByClass(Rabbit.class).iterator().next();
|
||||
world.spawn(rabbit.getLocation(), Firework.class, firework -> {
|
||||
@ -79,7 +87,12 @@ public class RabbitListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
public static ItemStack getCustomTextureHead(ItemStack head, String value) {
|
||||
public static ItemStack getEggHead() {
|
||||
return getCustomTextureHead(new ItemStack(Material.PLAYER_HEAD),
|
||||
EGGS.iterator().next());
|
||||
}
|
||||
|
||||
private static ItemStack getCustomTextureHead(ItemStack head, String value) {
|
||||
SkullMeta meta = (SkullMeta) head.getItemMeta();
|
||||
meta.setDisplayName("§eEierkopf");
|
||||
GameProfile profile = new GameProfile(UUID.randomUUID(), "");
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren