public void FindPlayer() {
   if (!HerobrineAI.getPluginCore().getConfigDB().OnlyWalkingMode && !AICore.isTarget) {
     final int att_chance = new Random().nextInt(100);
     AICore.log.info("[HerobrineAI] Generating find chance...");
     if (((att_chance - (HerobrineAI.getPluginCore().getConfigDB().ShowRate * 4)) < 55)
         && (Bukkit.getServer().getOnlinePlayers().length > 0)) {
       AICore.log.info("[HerobrineAI] Finding target...");
       final Player[] AllOnPlayers = Bukkit.getServer().getOnlinePlayers();
       final int player_rolled = Util.getRandomPlayerNum();
       if (AllOnPlayers[player_rolled].getEntityId() != HerobrineAI.HerobrineEntityID) {
         if (HerobrineAI.getPluginCore()
                 .getConfigDB()
                 .useWorlds
                 .contains(AllOnPlayers[player_rolled].getLocation().getWorld().getName())
             && HerobrineAI.getPluginCore().canAttackPlayerNoMSG(AllOnPlayers[player_rolled])) {
           CancelTarget(Core.CoreType.ANY);
           AICore.PlayerTarget = AllOnPlayers[player_rolled];
           AICore.isTarget = true;
           AICore.log.info(
               "[HerobrineAI] Target founded, starting AI now! ("
                   + AICore.PlayerTarget.getName()
                   + ")");
           setCoreTypeNow(Core.CoreType.START);
           StartAI();
         } else {
           AICore.log.info(
               "[HerobrineAI] Target is in the safe world! ("
                   + AllOnPlayers[player_rolled].getLocation().getWorld().getName()
                   + ")");
           FindPlayer();
         }
       }
     }
   }
 }
 public void RandomCoreINT() {
   if (new Random().nextBoolean() && (Bukkit.getServer().getOnlinePlayers().length > 0)) {
     final Player[] AllOnPlayers = Bukkit.getServer().getOnlinePlayers();
     final int player_rolled = Util.getRandomPlayerNum();
     if ((AllOnPlayers[player_rolled].getEntityId() != HerobrineAI.HerobrineEntityID)
         && HerobrineAI.getPluginCore()
             .getConfigDB()
             .useWorlds
             .contains(AllOnPlayers[player_rolled].getLocation().getWorld().getName())) {
       final Object[] data = {AllOnPlayers[player_rolled]};
       if (HerobrineAI.getPluginCore().canAttackPlayerNoMSG(AllOnPlayers[player_rolled])) {
         if (new Random().nextInt(100) < 30) {
           getCore(Core.CoreType.RANDOM_SOUND).RunCore(data);
         } else if (new Random().nextInt(100) < 60) {
           if (HerobrineAI.getPluginCore().getConfigDB().Burn) {
             getCore(Core.CoreType.BURN).RunCore(data);
           }
         } else if (new Random().nextInt(100) < 80) {
           if (HerobrineAI.getPluginCore().getConfigDB().Curse) {
             getCore(Core.CoreType.CURSE).RunCore(data);
           }
         } else {
           getCore(Core.CoreType.RANDOM_EXPLOSION).RunCore(data);
         }
       }
     }
   }
 }
 private void PyramidInterval() {
   if (new Random().nextBoolean() && (Bukkit.getServer().getOnlinePlayers().length > 0)) {
     AICore.log.info("[HerobrineAI] Finding pyramid target...");
     final Player[] AllOnPlayers = Bukkit.getServer().getOnlinePlayers();
     final int player_rolled = Util.getRandomPlayerNum();
     if (HerobrineAI.getPluginCore()
         .getConfigDB()
         .useWorlds
         .contains(AllOnPlayers[player_rolled].getLocation().getWorld().getName())) {
       final int chance2 = new Random().nextInt(100);
       if (chance2 < 30) {
         if (HerobrineAI.getPluginCore().getConfigDB().BuildPyramids) {
           final Object[] data = {AllOnPlayers[player_rolled]};
           getCore(Core.CoreType.PYRAMID).RunCore(data);
         }
       } else if (chance2 < 70) {
         if (HerobrineAI.getPluginCore().getConfigDB().BuryPlayers) {
           final Object[] data = {AllOnPlayers[player_rolled]};
           getCore(Core.CoreType.BURY_PLAYER).RunCore(data);
         }
       } else if (HerobrineAI.getPluginCore().getConfigDB().UseHeads) {
         final Object[] data = {AllOnPlayers[player_rolled].getName()};
         getCore(Core.CoreType.HEADS).RunCore(data);
       }
     }
   }
 }
 private void RandomPositionInterval() {
   if (CoreNow == Core.CoreType.ANY) {
     ((RandomPosition) getCore(Core.CoreType.RANDOM_POSITION)).setRandomTicks(0);
     final int count = HerobrineAI.getPluginCore().getConfigDB().useWorlds.size();
     final int chance = new Random().nextInt(count);
     final Object[] data = {
       Bukkit.getServer().getWorld(HerobrineAI.getPluginCore().getConfigDB().useWorlds.get(chance))
     };
     getCore(Core.CoreType.RANDOM_POSITION).RunCore(data);
   }
 }
 public void playerBedEnter(final Player player) {
   final int chance = new Random().nextInt(100);
   if (chance < 25) {
     GraveyardTeleport(player);
   } else if (chance < 50) {
     setHauntTarget(player);
   } else if (HerobrineAI.getPluginCore().getConfigDB().UseNPC_Demon
       && !HerobrineAI.isNPCDisabled) {
     HerobrineAI.getPluginCore()
         .getEntityManager()
         .spawnCustomSkeleton(player.getLocation(), MobType.DEMON);
   }
 }
 public void Start_RC() {
   RandomCoreINT = true;
   RC_INT =
       Bukkit.getServer()
           .getScheduler()
           .scheduleSyncRepeatingTask(
               AICore.plugin,
               new Runnable() {
                 @Override
                 public void run() {
                   AICore.this.RandomCoreINT();
                 }
               },
               HerobrineAI.getPluginCore().getConfigDB().ShowInterval / 2L,
               HerobrineAI.getPluginCore().getConfigDB().ShowInterval / 2L);
 }
 public void Start_BD() {
   BuildINT = true;
   BD_INT =
       Bukkit.getServer()
           .getScheduler()
           .scheduleSyncRepeatingTask(
               AICore.plugin,
               new Runnable() {
                 @Override
                 public void run() {
                   AICore.this.BuildInterval();
                 }
               },
               1L * HerobrineAI.getPluginCore().getConfigDB().BuildInterval,
               1L * HerobrineAI.getPluginCore().getConfigDB().BuildInterval);
 }
 private void BuildCave() {
   if (HerobrineAI.getPluginCore().getConfigDB().BuildStuff
       && new Random().nextBoolean()
       && (Bukkit.getServer().getOnlinePlayers().length > 0)) {
     final Player[] AllOnPlayers = Bukkit.getServer().getOnlinePlayers();
     final int player_rolled = Util.getRandomPlayerNum();
     if (HerobrineAI.getPluginCore()
             .getConfigDB()
             .useWorlds
             .contains(AllOnPlayers[player_rolled].getLocation().getWorld().getName())
         && new Random().nextBoolean()) {
       final Object[] data = {AllOnPlayers[player_rolled].getLocation()};
       getCore(Core.CoreType.BUILD_STUFF).RunCore(data);
     }
   }
 }
 public void CancelTarget(final Core.CoreType coreType) {
   if ((coreType == CoreNow) || (coreType == Core.CoreType.ANY)) {
     if (CoreNow == Core.CoreType.RANDOM_POSITION) {
       Stop_RM();
       Stop_RS();
       Stop_CG();
       final Location nowloc =
           new Location(Bukkit.getServer().getWorlds().get(0), 0.0, -20.0, 0.0);
       nowloc.setYaw(1.0f);
       nowloc.setPitch(1.0f);
       HerobrineAI.HerobrineNPC.moveTo(nowloc);
       CoreNow = Core.CoreType.ANY;
       HerobrineAI.getPluginCore().getPathManager().setPath(null);
     }
     if (AICore.isTarget) {
       if (CoreNow == Core.CoreType.ATTACK) {
         ((Attack) getCore(Core.CoreType.ATTACK)).StopHandler();
       }
       if (CoreNow == Core.CoreType.HAUNT) {
         ((Haunt) getCore(Core.CoreType.HAUNT)).StopHandler();
       }
       AICore._ticks = 0;
       AICore.isTarget = false;
       HerobrineAI.HerobrineHP = HerobrineAI.HerobrineMaxHP;
       AICore.log.info("[HerobrineAI] Target cancelled.");
       final Location nowloc =
           new Location(Bukkit.getServer().getWorlds().get(0), 0.0, -20.0, 0.0);
       nowloc.setYaw(1.0f);
       nowloc.setPitch(1.0f);
       HerobrineAI.HerobrineNPC.moveTo(nowloc);
       CoreNow = Core.CoreType.ANY;
       Bukkit.getServer()
           .getScheduler()
           .scheduleSyncDelayedTask(
               AICore.plugin,
               new Runnable() {
                 @Override
                 public void run() {
                   AICore.this.FindPlayer();
                 }
               },
               (6 / HerobrineAI.getPluginCore().getConfigDB().ShowRate)
                   * (HerobrineAI.getPluginCore().getConfigDB().ShowInterval * 1L));
     }
   }
 }
Exemple #10
0
 public void Start_MAIN() {
   MainINT = true;
   MAIN_INT =
       Bukkit.getServer()
           .getScheduler()
           .scheduleSyncRepeatingTask(
               AICore.plugin,
               new Runnable() {
                 @Override
                 public void run() {
                   AICore.this.FindPlayer();
                 }
               },
               (6 / HerobrineAI.getPluginCore().getConfigDB().ShowRate)
                   * (HerobrineAI.getPluginCore().getConfigDB().ShowInterval * 1L),
               (6 / HerobrineAI.getPluginCore().getConfigDB().ShowRate)
                   * (HerobrineAI.getPluginCore().getConfigDB().ShowInterval * 1L));
 }
Exemple #11
0
 public static String getStringWalkingMode() {
   String result = "";
   if (HerobrineAI.getPluginCore().getAICore().getCoreTypeNow() == Core.CoreType.RANDOM_POSITION) {
     result = "Yes";
   } else {
     result = "No";
   }
   return result;
 }
Exemple #12
0
 public AICore() {
   super();
   AllCores = new ArrayList<Core>();
   CoreNow = Core.CoreType.ANY;
   resetLimits = null;
   BuildINT = false;
   MainINT = false;
   RandomPositionINT = false;
   RandomMoveINT = false;
   RandomSeeINT = false;
   CheckGravityINT = false;
   RandomCoreINT = false;
   RP_INT = 0;
   RM_INT = 0;
   RS_INT = 0;
   CG_INT = 0;
   MAIN_INT = 0;
   BD_INT = 0;
   RC_INT = 0;
   AllCores.add(new Attack());
   AllCores.add(new Book());
   AllCores.add(new BuildStuff());
   AllCores.add(new BuryPlayer());
   AllCores.add(new DestroyTorches());
   AllCores.add(new Graveyard());
   AllCores.add(new Haunt());
   AllCores.add(new Pyramid());
   AllCores.add(new RandomPosition());
   AllCores.add(new Signs());
   AllCores.add(new SoundF());
   AllCores.add(new Totem());
   AllCores.add(new Heads());
   AllCores.add(new RandomSound());
   AllCores.add(new RandomExplosion());
   AllCores.add(new Burn());
   AllCores.add(new Curse());
   resetLimits = new ResetLimits();
   AICore.plugin = HerobrineAI.getPluginCore();
   AICore.log.info("[HerobrineAI] Debug mode enabled!");
   FindPlayer();
   StartIntervals();
 }
Exemple #13
0
 public void StartAI() {
   if (AICore.PlayerTarget.isOnline() && AICore.isTarget) {
     if (!AICore.PlayerTarget.isDead()) {
       final Object[] data = {AICore.PlayerTarget};
       final int chance = new Random().nextInt(100);
       if (chance <= 10) {
         if (HerobrineAI.getPluginCore().getConfigDB().UseGraveyardWorld) {
           AICore.log.info("[HerobrineAI] Teleporting target to Graveyard world.");
           getCore(Core.CoreType.GRAVEYARD).RunCore(data);
         }
       } else if (chance <= 25) {
         getCore(Core.CoreType.ATTACK).RunCore(data);
       } else {
         getCore(Core.CoreType.HAUNT).RunCore(data);
       }
     } else {
       CancelTarget(Core.CoreType.START);
     }
   } else {
     CancelTarget(Core.CoreType.START);
   }
 }