Merged in FabioZumbi12/herobrine-for-bukkit-or-spigot (pull request #4)
Fixes and improvement!
This commit is contained in:
commit
0b399bec88
@ -5,11 +5,8 @@ import java.util.logging.Logger;
|
||||
import net.theprogrammersworld.herobrine.HerobrineAI;
|
||||
import net.theprogrammersworld.herobrine.AI.AICore;
|
||||
import net.theprogrammersworld.herobrine.AI.Core;
|
||||
import net.theprogrammersworld.herobrine.nms.NPC.entity.HumanNPC;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -431,7 +428,7 @@ public class CmdExecutor implements CommandExecutor {
|
||||
args[1]));
|
||||
String pname = args[1];
|
||||
Player target = Bukkit.getPlayer(pname);
|
||||
P_Core.herobrineNPC.lookAtPoint(target.getLocation());
|
||||
HerobrineAI.herobrineNPC.lookAtPoint(target.getLocation());
|
||||
player.sendMessage(ChatColor.RED
|
||||
+ "[Herobrine] Herobrine is now haunting "
|
||||
+ args[1] + ".");
|
||||
@ -850,13 +847,13 @@ public class CmdExecutor implements CommandExecutor {
|
||||
log.info("[Herobrine] Herobrine configuration file reloaded.");
|
||||
} else if (args[0].equalsIgnoreCase("position")) {
|
||||
// TODO: Position
|
||||
double x = P_Core.herobrineNPC.getNMSEntity().locX;
|
||||
double y = P_Core.herobrineNPC.getNMSEntity().locY;
|
||||
double z = P_Core.herobrineNPC.getNMSEntity().locZ;
|
||||
net.minecraft.server.v1_8_R3.World world = P_Core.herobrineNPC.getNMSEntity().getWorld();
|
||||
double x = HerobrineAI.herobrineNPC.getNMSEntity().locX;
|
||||
double y = HerobrineAI.herobrineNPC.getNMSEntity().locY;
|
||||
double z = HerobrineAI.herobrineNPC.getNMSEntity().locZ;
|
||||
net.minecraft.server.v1_8_R3.World world = HerobrineAI.herobrineNPC.getNMSEntity().getWorld();
|
||||
sender.sendMessage(red + "Herobrine's location world: " + red
|
||||
+ world + red + " x: " + red + x + red + " y: " + red
|
||||
+ y + red + " z: " + red + y);
|
||||
+ y + red + " z: " + red + z);
|
||||
|
||||
} else if (args[0].equalsIgnoreCase("help")) {
|
||||
log.info("[Herobrine] Command List");
|
||||
|
@ -38,6 +38,8 @@ public class EntityListener implements Listener {
|
||||
private ArrayList<String> getLore;
|
||||
|
||||
public EntityListener(){
|
||||
equalsLore = new ArrayList<String>();
|
||||
equalsLoreS = new ArrayList<String>();
|
||||
equalsLore.add("Herobrine´s artifact");
|
||||
equalsLore.add("Bow of Teleporting");
|
||||
equalsLoreS.add("Herobrine´s artifact");
|
||||
@ -196,7 +198,7 @@ public class EntityListener implements Listener {
|
||||
{
|
||||
this.itemInHand = player.getItemInHand();
|
||||
this.getLore = ItemName.getLore(this.itemInHand);
|
||||
if ((this.getLore.containsAll(this.equalsLoreS)) && (HerobrineAI.getPluginCore().getConfigDB().UseArtifactSword) && (new Random().nextBoolean())) {
|
||||
if ((this.equalsLoreS != null) && (this.getLore.containsAll(this.equalsLoreS)) && (HerobrineAI.getPluginCore().getConfigDB().UseArtifactSword) && (new Random().nextBoolean())) {
|
||||
player.getLocation().getWorld().strikeLightning(event.getEntity().getLocation());
|
||||
}
|
||||
}
|
||||
|
@ -181,9 +181,27 @@ public class PlayerListener implements Listener {
|
||||
HerobrineAI.getPluginCore().getAICore().cancelTarget(Core.CoreType.RANDOM_POSITION);
|
||||
HerobrineAI.herobrineNPC.moveTo(new Location(Bukkit.getServer().getWorlds().get(0), 0.0D, -20.0D, 0.0D));
|
||||
}
|
||||
} else {
|
||||
if (HerobrineAI.getPluginCore().getConfigDB().useWorlds.contains(event.getTo().getWorld().getName()) || HerobrineAI.getPluginCore().getConfigDB().HerobrineWorldName.equalsIgnoreCase(event.getTo().getWorld().getName())){
|
||||
addHerobrine(event.getPlayer());
|
||||
} else {
|
||||
delHerobrine(event.getPlayer());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addHerobrine(Player player){
|
||||
EntityPlayer p = ((CraftPlayer) player).getHandle();
|
||||
p.playerConnection.sendPacket(new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, HerobrineAI.herobrineNPC.getNMSEntity()));
|
||||
}
|
||||
|
||||
private void delHerobrine(Player player){
|
||||
EntityPlayer p = ((CraftPlayer) player).getHandle();
|
||||
p.playerConnection.sendPacket(new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, HerobrineAI.herobrineNPC.getNMSEntity()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerCommand(final PlayerCommandPreprocessEvent event) {
|
||||
if (event.getPlayer().getWorld() == Bukkit.getServer().getWorld(HerobrineAI.getPluginCore().getConfigDB().HerobrineWorldName) && !event.getPlayer().hasPermission("hb-ai.cmdblockbypass")) {
|
||||
@ -213,8 +231,14 @@ public class PlayerListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onJoin(PlayerJoinEvent event) {
|
||||
if (HerobrineAI.getPluginCore().getConfigDB().useWorlds.contains(event.getPlayer().getWorld().getName()) ||
|
||||
HerobrineAI.getPluginCore().getConfigDB().HerobrineWorldName.equalsIgnoreCase(event.getPlayer().getWorld().getName())){
|
||||
addHerobrine(event.getPlayer());
|
||||
}
|
||||
/*
|
||||
EntityPlayer player = ((CraftPlayer) event.getPlayer()).getHandle();
|
||||
player.playerConnection.sendPacket(new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, HerobrineAI.herobrineNPC.getNMSEntity()));
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
@ -15,6 +15,7 @@ public class NetworkHandler extends PlayerConnection {
|
||||
public void a(final double d0, final double d1, final double d2, final float f, final float f1) {
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public void sendPacket(final Packet packet) {
|
||||
}
|
||||
|
@ -9,8 +9,9 @@ import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class NetworkUtils {
|
||||
|
||||
|
||||
public static void sendPacketNearby(final Location location, final Packet packet) {
|
||||
sendPacketNearby(location, packet, 64.0);
|
||||
}
|
||||
|
Reference in New Issue
Block a user