Skip to content

Commit

Permalink
maybe make ghast try to target nearest player
Browse files Browse the repository at this point in the history
  • Loading branch information
msudol committed Dec 30, 2019
1 parent a22843d commit 7194807
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/com/pwn9/PwnRaid/RaidListener.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package com.pwn9.PwnRaid;

import java.util.List;

import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Raid;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.entity.Creeper;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Ghast;
import org.bukkit.entity.Player;
Expand Down Expand Up @@ -156,14 +159,23 @@ public void spawnGhast(World w, Location loc)
ghast.setCustomName("Raid-A-Ghast");
ghast.setCustomNameVisible(true);

List<Entity> near = ghast.getNearbyEntities(50.0D, 50.0D, 50.0D);
for(Entity entity : near) {
if(entity instanceof Player) {
Player nearPlayer = (Player) entity;
ghast.setTarget(nearPlayer);
return;
}
}

return;
}

// spawn primed tnt
public void spawnTnt(World w, Location loc)
{
Location newLoc = this.getRandomLocNearby(w, loc, 80);
newLoc.setY(newLoc.getY() + 30.00);
newLoc.setY(newLoc.getY() + 30.0D);
// spawn tnt for kicks
w.spawnEntity(newLoc, EntityType.PRIMED_TNT);
return;
Expand Down Expand Up @@ -199,7 +211,7 @@ else if (wave == 4)
this.spawnGhast(w, loc);
this.spawnWitherJockey(w, loc);
}
else if (wave > 5 && wave < 8)
else if (wave > 4 && wave < 9)
{
this.spawnSuperCreeper(w, loc);
this.spawnSuperCreeper(w, loc);
Expand All @@ -224,7 +236,7 @@ else if (wave > 8)
}

// artillery
if (wave == 3 || wave == 6 || wave == 9 || wave > 9)
if (wave == 3 || wave == 6 || wave > 8)
{
String msg = "PwnRaid: Raid Captain ~ Enough messing around... call in artillery!!!";
plugin.getServer().broadcastMessage(ChatColor.RED + msg);
Expand Down

0 comments on commit 7194807

Please sign in to comment.