+ added test for GiantItem
This commit is contained in:
parent
dfdea0762b
commit
d256ecf6e0
@ -1,9 +1,10 @@
|
||||
package eu.univento.lobby.listeners;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import eu.univento.core.api.*;
|
||||
import eu.univento.core.api.player.Rank;
|
||||
import eu.univento.commons.player.Rank;
|
||||
import eu.univento.core.api.Config;
|
||||
import eu.univento.core.api.Hologram;
|
||||
import eu.univento.core.api.player.CustomPlayer;
|
||||
import eu.univento.lobby.utils.Inventorys;
|
||||
import eu.univento.lobby.utils.PetManager;
|
||||
import eu.univento.lobby.utils.Scoreboards;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -17,12 +18,9 @@ import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
import eu.univento.core.api.player.CustomPlayer;
|
||||
import eu.univento.lobby.utils.Inventorys;
|
||||
import net.minecraft.server.v1_10_R1.EnumParticle;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* @author joethei
|
||||
@ -47,14 +45,13 @@ public class JoinQuit implements Listener {
|
||||
}
|
||||
|
||||
Inventorys invs = new Inventorys(p);
|
||||
p.playParticle(p.getEyeLocation(), EnumParticle.SPELL_MOB, 2.0F, 500);
|
||||
p.giveExp(p.getExperience());
|
||||
p.giveExp(p.getDatabasePlayer().getExperience());
|
||||
|
||||
Title.sendTitle(p, 10, 50, 10, p.getMessages().Lobby_JOIN_TITLE_1(), p.getMessages().Lobby_JOIN_TITLE_2());
|
||||
p.sendTitle(10, 50, 10, p.getMessages().Lobby_JOIN_TITLE_1(), p.getMessages().Lobby_JOIN_TITLE_2());
|
||||
invs.setMainInventory(false);
|
||||
|
||||
|
||||
if (!p.isAllowed(Rank.Supporter)) {
|
||||
if (!p.getDatabasePlayer().isAllowed(Rank.Supporter)) {
|
||||
for (CustomPlayer players : PlayerHider.getHidden()) {
|
||||
players.hidePlayer(p);
|
||||
}
|
||||
@ -65,13 +62,13 @@ public class JoinQuit implements Listener {
|
||||
}
|
||||
|
||||
String[] text = {"§e@univentoEU"};
|
||||
Hologram holo = new Hologram(text, p.getWorld().getSpawnLocation());
|
||||
Hologram holo = new Hologram(new ItemStack(Material.WOOD_AXE), text, p.getWorld().getSpawnLocation());
|
||||
holo.showPlayer(p);
|
||||
|
||||
BossBar bar = Bukkit.createBossBar("§cAchtung, frisch gestrichen", BarColor.GREEN, BarStyle.SEGMENTED_6, BarFlag.CREATE_FOG);
|
||||
bar.addPlayer(p);
|
||||
|
||||
Actionbar.send(p, p.getMessages().LobbyBoard_NEW() + " " + p.getMessages().LobbyBoard_NEWS());
|
||||
p.sendActionBar(p.getMessages().LobbyBoard_NEW() + " " + p.getMessages().LobbyBoard_NEWS());
|
||||
|
||||
Scoreboards.updateScoreboard(p);
|
||||
|
||||
|
@ -5,10 +5,16 @@ import eu.univento.core.api.player.CustomPlayer;
|
||||
import eu.univento.core.api.story.StoryMission;
|
||||
import eu.univento.lobby.Lobby;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Giant;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
/**
|
||||
* @author joethei
|
||||
@ -24,11 +30,30 @@ public class StartMissionEvents implements Listener{
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockBreak(BlockBreakEvent e) {
|
||||
public void onSneak(PlayerToggleSneakEvent e) {
|
||||
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
||||
if(p == mission.getPlayer()) {
|
||||
p.sendMessage("Hallo du da");
|
||||
EntityModifier.Builder modifier = new EntityModifier(p.getWorld().spawnEntity(p.getLocation(), EntityType.CREEPER)).modify();
|
||||
modifier.setNoAI(true).followPlayer(p, 1.0F);
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(Lobby.getInstance(), modifier::die, 10 * 20L);
|
||||
p.setItemInHand(new ItemStack(Material.DIAMOND_SWORD));
|
||||
EntityModifier.Builder crepper = new EntityModifier(p.getWorld().spawnEntity(p.getLocation(), EntityType.CREEPER)).modify();
|
||||
crepper.setNoAI(true).followPlayer(p, 1.0F);
|
||||
|
||||
Giant giant = p.getWorld().spawn(p.getLocation(), Giant.class);
|
||||
giant.getEquipment().setItemInMainHand(p.getItemInHand());
|
||||
giant.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 999));
|
||||
giant.setAI(false);
|
||||
giant.setGravity(false);
|
||||
|
||||
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(Lobby.getInstance(), () -> {
|
||||
crepper.die();
|
||||
giant.remove();
|
||||
}, 20 * 20L);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDamage(EntityDamageEvent e) {
|
||||
if(e.getEntity() instanceof Giant) e.setCancelled(true);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user