use of org.bukkit.potion.PotionEffect in project GameCore by Warvale.
the class Bosses method BossWizard.
private void BossWizard(Location bossLocation) {
Skeleton Wizard = (Skeleton) bossLocation.getWorld().spawnEntity(bossLocation, EntityType.SKELETON);
Wizard.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 200, 100));
Wizard.setCustomName(ChatColor.translateAlternateColorCodes('&', "&eWizard"));
Wizard.setCustomNameVisible(true);
Wizard.setCanPickupItems(true);
ItemStack chestplate = new ItemStack(Material.IRON_CHESTPLATE);
chestplate.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2);
Wizard.getEquipment().setChestplate(chestplate);
Wizard.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(30);
Wizard.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, 1000000, 1, false, false, Color.RED));
}
use of org.bukkit.potion.PotionEffect in project GameCore by Warvale.
the class Bosses method BossGrometator.
/* Thanks CommandFox for all of the names below. */
private void BossGrometator(Location bossLocation) {
IronGolem Grometator = (IronGolem) bossLocation.getWorld().spawnEntity(bossLocation, EntityType.IRON_GOLEM);
Grometator.setCustomName(ChatColor.translateAlternateColorCodes('&', "&eGrometator"));
Grometator.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, 1000000, 1, false, false, Color.RED));
Grometator.setPlayerCreated(false);
Grometator.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(0.5);
}
use of org.bukkit.potion.PotionEffect in project GameCore by Warvale.
the class Bosses method BossCruitionator.
private void BossCruitionator(Location bossLocation) {
Spider Cruitionator = (Spider) bossLocation.getWorld().spawnEntity(bossLocation, EntityType.SPIDER);
Cruitionator.setCustomNameVisible(true);
Cruitionator.setCustomName(ChatColor.translateAlternateColorCodes('&', "&eCruitionator"));
Cruitionator.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(20);
Cruitionator.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(0.5);
Cruitionator.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, 1000000, 1, false, false, Color.RED));
Cruitionator.getEquipment().setItemInMainHand(new ItemStack(Material.WOOD_SWORD));
Cruitionator.getEquipment().setItemInOffHandDropChance(0);
}
use of org.bukkit.potion.PotionEffect in project GameCore by Warvale.
the class AbilityManager method Medic.
private void Medic(Player p) {
List<Entity> entities = p.getNearbyEntities(10, 10, 10);
for (Entity e : entities) {
if (!(e instanceof Player))
return;
Player nbp = (Player) e;
if (Main.getTeams().getSpectatorTeam().getEntries().contains(nbp.getName()))
return;
Set<String> BlueTeam = Main.getTeams().getBlueTeam().getEntries();
Set<String> RedTeam = Main.getTeams().getRedTeam().getEntries();
Set<String> teammates = ((BlueTeam.contains(p.getName())) ? BlueTeam : RedTeam);
if (!teammates.contains(nbp.getName()))
return;
nbp.addPotionEffect(new PotionEffect(PotionEffectType.HEAL, 100, 7));
}
}
use of org.bukkit.potion.PotionEffect in project Minigames by AddstarMC.
the class PlayerData method quitMinigame.
public void quitMinigame(MinigamePlayer player, boolean forced) {
Minigame minigame = player.getMinigame();
boolean isWinner = false;
if (GameOverModule.getMinigameModule(minigame).getWinners().contains(player))
isWinner = true;
QuitMinigameEvent event = new QuitMinigameEvent(player, minigame, forced, isWinner);
Bukkit.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
if (!minigame.isSpectator(player)) {
if (player.getEndTime() == 0)
player.setEndTime(System.currentTimeMillis());
if (isWinner)
GameOverModule.getMinigameModule(minigame).getWinners().remove(player);
else
GameOverModule.getMinigameModule(minigame).getLosers().remove(player);
if (!isWinner) {
if (!minigame.canSaveCheckpoint() && minigame.isEnabled()) {
StoredGameStats saveData = new StoredGameStats(minigame, player);
saveData.addStat(MinigameStats.Attempts, 1);
for (DynamicMinigameStat stat : MinigameStats.getDynamicStats()) {
if (stat.doesApply(minigame, player, false)) {
saveData.addStat(stat, stat.getValue(minigame, player, false));
}
}
saveData.applySettings(minigame.getStatSettings(saveData));
plugin.queueStatSave(saveData, false);
}
}
//Call Types quit.
mdata.minigameType(minigame.getType()).quitMinigame(player, minigame, forced);
//Call Mechanic quit.
minigame.getMechanic().quitMinigame(minigame, player, forced);
//Prepare player for quit
if (player.getPlayer().getVehicle() != null) {
Vehicle vehicle = (Vehicle) player.getPlayer().getVehicle();
vehicle.eject();
}
player.getPlayer().closeInventory();
if (player.getLoadout() != null) {
player.getLoadout().removeLoadout(player);
}
player.removeMinigame();
minigame.removePlayer(player);
for (PotionEffect potion : player.getPlayer().getActivePotionEffects()) {
player.getPlayer().removePotionEffect(potion.getType());
}
player.getPlayer().setFallDistance(0);
player.getPlayer().setNoDamageTicks(60);
final MinigamePlayer fplayer = player;
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
@Override
public void run() {
fplayer.getPlayer().setFireTicks(0);
}
});
player.resetAllStats();
if (!player.isDead()) {
player.restorePlayerData();
if (!isWinner)
player.teleport(minigame.getQuitPosition());
else
player.teleport(minigame.getEndPosition());
} else {
if (!isWinner)
player.setQuitPos(minigame.getQuitPosition());
else
player.setQuitPos(minigame.getEndPosition());
player.setRequiredQuit(true);
}
//Reward Player
if (isWinner) {
player.claimTempRewardItems();
}
player.claimRewards();
//Reset Minigame
if (minigame.getPlayers().size() == 0) {
if (minigame.getMinigameTimer() != null) {
minigame.getMinigameTimer().stopTimer();
minigame.setMinigameTimer(null);
}
if (minigame.getFloorDegenerator() != null) {
minigame.getFloorDegenerator().stopDegenerator();
}
minigame.setState(MinigameState.IDLE);
if (minigame.getBlockRecorder().hasData()) {
minigame.getBlockRecorder().restoreBlocks();
minigame.getBlockRecorder().restoreEntities();
minigame.getBlockRecorder().setCreatedRegenBlocks(false);
}
if (minigame.getMpTimer() != null) {
minigame.getMpTimer().pauseTimer();
minigame.getMpTimer().removeTimer();
minigame.setMpTimer(null);
}
if (minigame.getMpBets() != null) {
minigame.setMpBets(null);
}
mdata.clearClaimedScore(minigame);
WeatherTimeModule.getMinigameModule(minigame).stopTimeLoop();
GameOverModule.getMinigameModule(minigame).stopEndGameTimer();
for (Team team : TeamsModule.getMinigameModule(minigame).getTeams()) {
team.setScore(0);
}
}
minigame.getScoreboardManager().resetScores(player.getName());
for (MinigamePlayer pl : minigame.getSpectators()) {
player.getPlayer().showPlayer(pl.getPlayer());
}
if (minigame.getPlayers().size() == 0 && !minigame.isRegenerating()) {
HandlerList.unregisterAll(minigame.getBlockRecorder());
}
//Send out messages
if (!forced) {
mdata.sendMinigameMessage(minigame, MinigameUtils.formStr("player.quit.plyMsg", player.getName(), minigame.getName(true)), "error", player);
}
plugin.getLogger().info(player.getName() + " quit " + minigame);
player.updateInventory();
} else {
if (player.getPlayer().getVehicle() != null) {
Vehicle vehicle = (Vehicle) player.getPlayer().getVehicle();
vehicle.eject();
}
player.getPlayer().setFallDistance(0);
player.getPlayer().setNoDamageTicks(60);
final Player fplayer = player.getPlayer();
for (PotionEffect potion : player.getPlayer().getActivePotionEffects()) {
player.getPlayer().removePotionEffect(potion.getType());
}
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
@Override
public void run() {
fplayer.setFireTicks(0);
}
});
player.getPlayer().closeInventory();
if (!player.isDead()) {
player.restorePlayerData();
}
player.teleport(minigame.getQuitPosition());
player.removeMinigame();
minigame.removeSpectator(player);
for (MinigamePlayer pl : minigame.getPlayers()) {
pl.getPlayer().showPlayer(player.getPlayer());
}
player.sendMessage(MinigameUtils.formStr("player.spectate.quit.plyMsg", minigame.getName(true)), "error");
mdata.sendMinigameMessage(minigame, MinigameUtils.formStr("player.spectate.quit.minigameMsg", player.getName(), minigame.getName(true)), "error", player);
}
if (player.getPlayer().getGameMode() != GameMode.CREATIVE)
player.setCanFly(false);
if (!forced) {
minigame.getScoreboardData().reload();
}
}
}
Aggregations