Skip to content

Commit

Permalink
hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
7isenko committed Jul 23, 2020
1 parent ae59371 commit c3f4fad
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 25 deletions.
2 changes: 2 additions & 0 deletions src/main/java/io/github/_7isenko/vampcraft/PotionHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public static ArrayList<PotionEffect> getGoodVampirePotions() {
effects.add(getPotion(PotionEffectType.INCREASE_DAMAGE, 0));
effects.add(getPotion(PotionEffectType.DAMAGE_RESISTANCE, 0));
effects.add(getPotion(PotionEffectType.FAST_DIGGING, 0));
effects.add(getPotion(PotionEffectType.INVISIBILITY, 0));
effects.add(getPotion(PotionEffectType.JUMP, 2));
return effects;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.github._7isenko.vampcraft;

import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.Sound;
Expand All @@ -25,25 +24,28 @@ public void onAttack(EntityDamageByEntityEvent event) {

if (event.getDamager() instanceof LivingEntity && event.getEntity() instanceof Player && Vampcraft.vampires.contains(event.getEntity())) {
EntityEquipment equipment = ((LivingEntity) event.getDamager()).getEquipment();
if (equipment != null && equipment.getItemInMainHand().getType().name().contains("GOLDEN")) {
Random r = new Random();
Player vampire = (Player) event.getEntity();
if (r.nextDouble() > 0.6D) vampire.addPotionEffect(PotionHelper.getPotion(PotionEffectType.SLOW, 0));
if (r.nextDouble() > 0.7D)
vampire.addPotionEffect(PotionHelper.getPotion(PotionEffectType.BLINDNESS, 0));
if (r.nextDouble() > 0.9D) {
event.setDamage(event.getDamage() * 2);
vampire.getWorld().playSound(vampire.getLocation(), Sound.ENTITY_PLAYER_ATTACK_CRIT, 1, 4);
vampire.getWorld().spawnParticle(Particle.SPIT, vampire.getLocation(), 30, 0.5, 2, 0.5);
}
if (r.nextDouble() > 0.90D) {
for (PotionEffect goodPotionEffect : Vampcraft.goodPotionEffects) {
vampire.removePotionEffect(goodPotionEffect.getType());
}
vampire.getWorld().playSound(vampire.getLocation(), Sound.ITEM_TOTEM_USE, 0.3f, 4);
vampire.getWorld().spawnParticle(Particle.ENCHANTMENT_TABLE, vampire.getLocation(), 60, 0.5, 2, 0.5);
Vampcraft.runnable.addToOffList(vampire);
if (equipment == null || !equipment.getItemInMainHand().getType().name().contains("GOLD")) {
event.setCancelled(true);
return;
}

Random r = new Random();
Player vampire = (Player) event.getEntity();
if (r.nextDouble() > 0.6D) vampire.addPotionEffect(PotionHelper.getPotion(PotionEffectType.SLOW, 0));
if (r.nextDouble() > 0.7D)
vampire.addPotionEffect(PotionHelper.getPotion(PotionEffectType.BLINDNESS, 0));
if (r.nextDouble() > 0.9D) {
event.setDamage(event.getDamage() * 2);
vampire.getWorld().playSound(vampire.getLocation(), Sound.ENTITY_PLAYER_ATTACK_CRIT, 1, 4);
vampire.getWorld().spawnParticle(Particle.SPIT, vampire.getLocation(), 30, 0.5, 2, 0.5);
}
if (r.nextDouble() > 0.9D) {
for (PotionEffect goodPotionEffect : Vampcraft.goodPotionEffects) {
vampire.removePotionEffect(goodPotionEffect.getType());
}
vampire.getWorld().playSound(vampire.getLocation(), Sound.ITEM_TOTEM_USE, 0.3f, 4);
vampire.getWorld().spawnParticle(Particle.ENCHANTMENT_TABLE, vampire.getLocation(), 60, 0.5, 2, 0.5);
Vampcraft.runnable.addToOffList(vampire);
}
}

Expand Down Expand Up @@ -80,7 +82,7 @@ private int getGoldenLevel(LivingEntity entity) {
EntityEquipment equipment = entity.getEquipment();
if (equipment == null) return lvl;
for (ItemStack armor : equipment.getArmorContents()) {
if (armor != null && armor.getType().name().contains("GOLDEN"))
if (armor != null && armor.getType().name().contains("GOLD"))
lvl++;
}
return lvl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.inventivetalent.glow.GlowAPI;

public class VampireCommandExecutor implements CommandExecutor {

Expand All @@ -14,6 +15,7 @@ public boolean onCommand(CommandSender commandSender, Command command, String s,
if (Vampcraft.vampires.contains(player)) {
Vampcraft.vampires.remove(player);
player.sendMessage("Now you are a human");
player.getNearbyEntities(80, 60, 80).forEach(entity -> GlowAPI.setGlowing(entity, false, player));
} else {
Vampcraft.vampires.add(player);
player.sendMessage("You become a vampire");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package io.github._7isenko.vampcraft;

import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.material.MaterialData;

public class VampireDeathListener implements Listener {
@EventHandler(ignoreCancelled = true)
Expand All @@ -18,7 +20,7 @@ public void onDeath(PlayerDeathEvent event) {
event.getDrops().clear();
}
player.getWorld().spawnEntity(player.getLocation(), EntityType.BAT);
player.getWorld().spawnParticle(Particle.REDSTONE, player.getLocation(), 100, 1, 1, 1, null);
player.getWorld().spawnParticle(Particle.BLOCK_CRACK, player.getLocation(), 30, 0.5, 2, 0.5, new MaterialData(Material.REDSTONE_BLOCK));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,8 @@ public void run() {
player.addPotionEffect(effect, true);
return;
}
// check caving during day
if (location.getY() > 60 || (location.getY() > 50 && world.getHighestBlockAt(location).getType() == Material.WATER))
return;
}

if (offList.contains(player)) {
offList.remove(player);
return;
Expand All @@ -60,7 +58,6 @@ public void run() {
for (PotionEffect effect : Vampcraft.goodPotionEffects)
player.addPotionEffect(effect, true);

player.addPotionEffect(PotionHelper.getPotion(PotionEffectType.INVISIBILITY, 0), true);
for (int i = 0; i < (period + 20); i++) {
new BukkitRunnable() {
@Override
Expand Down

0 comments on commit c3f4fad

Please sign in to comment.