Code cleanup
This commit is contained in:
parent
c1d6286bc1
commit
3e6fa271e9
BIN
lib/Factions.jar
Normal file
BIN
lib/Factions.jar
Normal file
Binary file not shown.
Binary file not shown.
@ -1,6 +1,6 @@
|
|||||||
name: HerobrineAI
|
name: HerobrineAI
|
||||||
main: org.jakub1221.herobrineai.HerobrineAI
|
main: org.jakub1221.herobrineai.HerobrineAI
|
||||||
version: 3.1.0
|
version: 3.2.2
|
||||||
commands:
|
commands:
|
||||||
hb-ai:
|
hb-ai:
|
||||||
description: Main command.
|
description: Main command.
|
||||||
|
91
pom.xml
Normal file
91
pom.xml
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>org.jakub1221.herobrineai</groupId>
|
||||||
|
<artifactId>HerobrineAI</artifactId>
|
||||||
|
<version>3.5.0</version>
|
||||||
|
<name>HerobrineAI</name>
|
||||||
|
<url>http://dev.bukkit.org/projects/herobrine-ai</url>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<bukkitVersion>1.11-R0.1-SNAPSHOT</bukkitVersion>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<scm>
|
||||||
|
<url>https://github.com/jakub1221/HerobrineAI</url>
|
||||||
|
<connection>scm:git:git://github.com:jakub1221/HerobrineAI.git</connection>
|
||||||
|
<developerConnection>scm:git:git@github.com:jakub1221/HerobrineAI.git</developerConnection>
|
||||||
|
</scm>
|
||||||
|
|
||||||
|
<issueManagement>
|
||||||
|
<system>GitHub</system>
|
||||||
|
<url>https://github.com/jakub1221/HerobrineAI/issues</url>
|
||||||
|
</issueManagement>
|
||||||
|
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>spigot-repo</id>
|
||||||
|
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.bukkit</groupId>
|
||||||
|
<artifactId>bukkit</artifactId>
|
||||||
|
<version>${bukkitVersion}</version>
|
||||||
|
<type>jar</type>
|
||||||
|
</dependency>
|
||||||
|
<!-- Test Dependency -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>4.12</version>
|
||||||
|
<type>jar</type>
|
||||||
|
<scope>test</scope>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<defaultGoal>clean install</defaultGoal>
|
||||||
|
<sourceDirectory>src/</sourceDirectory>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>${project.basedir}</directory>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
<includes>
|
||||||
|
<include>plugin.yml</include>
|
||||||
|
</includes>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>2.0.2</version>
|
||||||
|
<configuration>
|
||||||
|
<source>1.6</source>
|
||||||
|
<target>1.6</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
|
<version>2.3</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>shade</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
<description>
|
||||||
|
HerobrineAI is Minecraft server plugin for bukkit/spigot that brings Herobrine to life.
|
||||||
|
</description>
|
||||||
|
</project>
|
@ -12,6 +12,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.jakub1221.herobrineai.HerobrineAI;
|
import org.jakub1221.herobrineai.HerobrineAI;
|
||||||
|
import org.jakub1221.herobrineai.Utils;
|
||||||
import org.jakub1221.herobrineai.AI.Core.CoreType;
|
import org.jakub1221.herobrineai.AI.Core.CoreType;
|
||||||
import org.jakub1221.herobrineai.AI.cores.Attack;
|
import org.jakub1221.herobrineai.AI.cores.Attack;
|
||||||
import org.jakub1221.herobrineai.AI.cores.Book;
|
import org.jakub1221.herobrineai.AI.cores.Book;
|
||||||
@ -47,6 +48,7 @@ public class AICore {
|
|||||||
public static boolean isDiscCalled = false;
|
public static boolean isDiscCalled = false;
|
||||||
public static boolean isTotemCalled = false;
|
public static boolean isTotemCalled = false;
|
||||||
public static int _ticks = 0;
|
public static int _ticks = 0;
|
||||||
|
private ResetLimits resetLimits = null;
|
||||||
private boolean BuildINT = false;
|
private boolean BuildINT = false;
|
||||||
private boolean MainINT = false;
|
private boolean MainINT = false;
|
||||||
private boolean RandomPositionINT = false;
|
private boolean RandomPositionINT = false;
|
||||||
@ -71,8 +73,6 @@ public class AICore {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public AICore() {
|
public AICore() {
|
||||||
|
|
||||||
/* Cores init */
|
/* Cores init */
|
||||||
@ -95,24 +95,50 @@ public class AICore {
|
|||||||
AllCores.add(new Burn());
|
AllCores.add(new Burn());
|
||||||
AllCores.add(new Curse());
|
AllCores.add(new Curse());
|
||||||
|
|
||||||
|
resetLimits = new ResetLimits();
|
||||||
|
|
||||||
plugin = HerobrineAI.getPluginCore();
|
plugin = HerobrineAI.getPluginCore();
|
||||||
log.info("[HerobrineAI] Debug mode enabled!");
|
log.info("[HerobrineAI] Debug mode enabled!");
|
||||||
FindPlayer();
|
FindPlayer();
|
||||||
StartIntervals();
|
StartIntervals();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Graveyard getGraveyard(){return ((Graveyard)getCore(CoreType.GRAVEYARD));}
|
public Graveyard getGraveyard() {
|
||||||
public RandomPosition getRandomPosition(){return ((RandomPosition)getCore(CoreType.RANDOM_POSITION));}
|
return ((Graveyard) getCore(CoreType.GRAVEYARD));
|
||||||
public void setCoreTypeNow(CoreType c){CoreNow=c;}
|
}
|
||||||
public CoreType getCoreTypeNow(){return CoreNow;}
|
|
||||||
|
public RandomPosition getRandomPosition() {
|
||||||
|
return ((RandomPosition) getCore(CoreType.RANDOM_POSITION));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCoreTypeNow(CoreType c) {
|
||||||
|
CoreNow = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CoreType getCoreTypeNow() {
|
||||||
|
return CoreNow;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResetLimits getResetLimits() {
|
||||||
|
return resetLimits;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void disableAll() {
|
||||||
|
|
||||||
|
resetLimits.disable();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public static String getStringWalkingMode() {
|
public static String getStringWalkingMode() {
|
||||||
|
|
||||||
String result = "";
|
String result = "";
|
||||||
|
|
||||||
if (HerobrineAI.getPluginCore().getAICore().getCoreTypeNow() == CoreType.RANDOM_POSITION){result="Yes";}else{result="No";}
|
if (HerobrineAI.getPluginCore().getAICore().getCoreTypeNow() == CoreType.RANDOM_POSITION) {
|
||||||
|
result = "Yes";
|
||||||
|
} else {
|
||||||
|
result = "No";
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
@ -125,7 +151,7 @@ public CoreType getCoreTypeNow(){return CoreNow;}
|
|||||||
} else if (chance < 50) {
|
} else if (chance < 50) {
|
||||||
setHauntTarget(player);
|
setHauntTarget(player);
|
||||||
} else {
|
} else {
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().UseNPC_Demon){
|
if (HerobrineAI.getPluginCore().getConfigDB().UseNPC_Demon && !HerobrineAI.isNPCDisabled) {
|
||||||
HerobrineAI.getPluginCore().getEntityManager().spawnCustomSkeleton(player.getLocation(), MobType.DEMON);
|
HerobrineAI.getPluginCore().getEntityManager().spawnCustomSkeleton(player.getLocation(), MobType.DEMON);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -141,28 +167,29 @@ public CoreType getCoreTypeNow(){return CoreNow;}
|
|||||||
|
|
||||||
if (att_chance - (HerobrineAI.getPluginCore().getConfigDB().ShowRate * 4) < 55) {
|
if (att_chance - (HerobrineAI.getPluginCore().getConfigDB().ShowRate * 4) < 55) {
|
||||||
|
|
||||||
if (Bukkit.getServer().getOnlinePlayers().length>0){
|
if (Bukkit.getServer().getOnlinePlayers().size() > 0) {
|
||||||
|
|
||||||
log.info("[HerobrineAI] Finding target...");
|
log.info("[HerobrineAI] Finding target...");
|
||||||
Player [] AllOnPlayers = Bukkit.getServer().getOnlinePlayers();
|
Player targetPlayer = Utils.getRandomPlayer();
|
||||||
int player_rolled= new Random().nextInt(Bukkit.getServer().getOnlinePlayers().length-1);
|
|
||||||
|
|
||||||
if (AllOnPlayers[player_rolled].getEntityId()!=HerobrineAI.HerobrineEntityID){
|
if (targetPlayer.getEntityId() != HerobrineAI.HerobrineEntityID) {
|
||||||
|
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().useWorlds.contains(AllOnPlayers[player_rolled].getLocation().getWorld().getName()) && HerobrineAI.getPluginCore().canAttackPlayerNoMSG(AllOnPlayers[player_rolled])){
|
if (HerobrineAI.getPluginCore().getConfigDB().useWorlds
|
||||||
|
.contains(targetPlayer.getLocation().getWorld().getName())
|
||||||
|
&& HerobrineAI.getPluginCore().canAttackPlayerNoMSG(targetPlayer)) {
|
||||||
|
|
||||||
CancelTarget(CoreType.ANY);
|
CancelTarget(CoreType.ANY);
|
||||||
PlayerTarget=AllOnPlayers[player_rolled];
|
|
||||||
isTarget = true;
|
isTarget = true;
|
||||||
log.info("[HerobrineAI] Target founded, starting AI now! ("+PlayerTarget.getName()+")");
|
log.info("[HerobrineAI] Target founded, starting AI now! (" + targetPlayer.getName()+ ")");
|
||||||
setCoreTypeNow(CoreType.START);
|
setCoreTypeNow(CoreType.START);
|
||||||
StartAI();
|
StartAI();
|
||||||
|
|
||||||
}else{ log.info("[HerobrineAI] Target is in the safe world! ("+AllOnPlayers[player_rolled].getLocation().getWorld().getName()+")");FindPlayer();}
|
} else {
|
||||||
|
log.info("[HerobrineAI] Target is in the safe world! ("+ targetPlayer.getLocation().getWorld().getName() + ")");
|
||||||
|
FindPlayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,9 +207,11 @@ public CoreType getCoreTypeNow(){return CoreNow;}
|
|||||||
Stop_RM();
|
Stop_RM();
|
||||||
Stop_RS();
|
Stop_RS();
|
||||||
Stop_CG();
|
Stop_CG();
|
||||||
Location nowloc = new Location((World) Bukkit.getServer().getWorlds().get(0),(float) 0,(float) -20,(float) 0);
|
Location nowloc = new Location((World) Bukkit.getServer().getWorlds().get(0), 0, -20.f, 0);
|
||||||
nowloc.setYaw((float) 1);
|
|
||||||
nowloc.setPitch((float) 1);
|
nowloc.setYaw(1.f);
|
||||||
|
nowloc.setPitch(1.f);
|
||||||
|
|
||||||
HerobrineAI.HerobrineNPC.moveTo(nowloc);
|
HerobrineAI.HerobrineNPC.moveTo(nowloc);
|
||||||
CoreNow = CoreType.ANY;
|
CoreNow = CoreType.ANY;
|
||||||
HerobrineAI.getPluginCore().getPathManager().setPath(null);
|
HerobrineAI.getPluginCore().getPathManager().setPath(null);
|
||||||
@ -196,14 +225,16 @@ public CoreType getCoreTypeNow(){return CoreNow;}
|
|||||||
((Haunt) getCore(CoreType.HAUNT)).StopHandler();
|
((Haunt) getCore(CoreType.HAUNT)).StopHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_ticks = 0;
|
_ticks = 0;
|
||||||
isTarget = false;
|
isTarget = false;
|
||||||
HerobrineAI.HerobrineHP = HerobrineAI.HerobrineMaxHP;
|
HerobrineAI.HerobrineHP = HerobrineAI.HerobrineMaxHP;
|
||||||
|
|
||||||
log.info("[HerobrineAI] Target cancelled.");
|
log.info("[HerobrineAI] Target cancelled.");
|
||||||
Location nowloc = new Location((World) Bukkit.getServer().getWorlds().get(0),(float) 0,(float) -20,(float) 0);
|
Location nowloc = new Location((World) Bukkit.getServer().getWorlds().get(0), 0, -20.f, 0);
|
||||||
nowloc.setYaw((float) 1);
|
|
||||||
nowloc.setPitch((float) 1);
|
nowloc.setYaw(1.f);
|
||||||
|
nowloc.setPitch(1.f);
|
||||||
|
|
||||||
HerobrineAI.HerobrineNPC.moveTo(nowloc);
|
HerobrineAI.HerobrineNPC.moveTo(nowloc);
|
||||||
CoreNow = CoreType.ANY;
|
CoreNow = CoreType.ANY;
|
||||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(AICore.plugin, new Runnable() {
|
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(AICore.plugin, new Runnable() {
|
||||||
@ -234,8 +265,12 @@ public CoreType getCoreTypeNow(){return CoreNow;}
|
|||||||
} else {
|
} else {
|
||||||
getCore(CoreType.HAUNT).RunCore(data);
|
getCore(CoreType.HAUNT).RunCore(data);
|
||||||
}
|
}
|
||||||
}else{CancelTarget(CoreType.START);}
|
} else {
|
||||||
}else{CancelTarget(CoreType.START);}
|
CancelTarget(CoreType.START);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
CancelTarget(CoreType.START);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public CoreResult setAttackTarget(Player player) {
|
public CoreResult setAttackTarget(Player player) {
|
||||||
@ -248,11 +283,6 @@ public CoreType getCoreTypeNow(){return CoreNow;}
|
|||||||
return getCore(CoreType.HAUNT).RunCore(data);
|
return getCore(CoreType.HAUNT).RunCore(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void GraveyardTeleport(final Player player) {
|
public void GraveyardTeleport(final Player player) {
|
||||||
|
|
||||||
if (player.isOnline()) {
|
if (player.isOnline()) {
|
||||||
@ -265,15 +295,10 @@ public CoreType getCoreTypeNow(){return CoreNow;}
|
|||||||
}
|
}
|
||||||
}, 1 * 10L);
|
}, 1 * 10L);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void PlayerCallTotem(Player player) {
|
public void PlayerCallTotem(Player player) {
|
||||||
final String playername = player.getName();
|
final String playername = player.getName();
|
||||||
final Location loc = (Location) player.getLocation();
|
final Location loc = (Location) player.getLocation();
|
||||||
@ -293,7 +318,8 @@ if (CoreNow==CoreType.ANY){
|
|||||||
((RandomPosition) getCore(CoreType.RANDOM_POSITION)).setRandomTicks(0);
|
((RandomPosition) getCore(CoreType.RANDOM_POSITION)).setRandomTicks(0);
|
||||||
int count = HerobrineAI.getPluginCore().getConfigDB().useWorlds.size();
|
int count = HerobrineAI.getPluginCore().getConfigDB().useWorlds.size();
|
||||||
int chance = new Random().nextInt(count);
|
int chance = new Random().nextInt(count);
|
||||||
Object[] data = {Bukkit.getServer().getWorld(HerobrineAI.getPluginCore().getConfigDB().useWorlds.get(chance))};
|
Object[] data = {
|
||||||
|
Bukkit.getServer().getWorld(HerobrineAI.getPluginCore().getConfigDB().useWorlds.get(chance)) };
|
||||||
getCore(CoreType.RANDOM_POSITION).RunCore(data);
|
getCore(CoreType.RANDOM_POSITION).RunCore(data);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -305,6 +331,7 @@ if (CoreNow==CoreType.ANY){
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RandomMoveInterval() {
|
private void RandomMoveInterval() {
|
||||||
((RandomPosition) getCore(CoreType.RANDOM_POSITION)).RandomMove();
|
((RandomPosition) getCore(CoreType.RANDOM_POSITION)).RandomMove();
|
||||||
|
|
||||||
@ -316,30 +343,30 @@ if (CoreNow==CoreType.ANY){
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PyramidInterval() {
|
private void PyramidInterval() {
|
||||||
|
|
||||||
if (new Random().nextBoolean()) {
|
if (new Random().nextBoolean()) {
|
||||||
if (Bukkit.getServer().getOnlinePlayers().length>0){
|
if (Bukkit.getServer().getOnlinePlayers().size() > 0) {
|
||||||
log.info("[HerobrineAI] Finding pyramid target...");
|
log.info("[HerobrineAI] Finding pyramid target...");
|
||||||
Player [] AllOnPlayers = Bukkit.getServer().getOnlinePlayers();
|
|
||||||
|
|
||||||
int player_rolled= new Random().nextInt(Bukkit.getServer().getOnlinePlayers().length-1);
|
Player player = Utils.getRandomPlayer();
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().useWorlds.contains(AllOnPlayers[player_rolled].getLocation().getWorld().getName())){
|
if (HerobrineAI.getPluginCore().getConfigDB().useWorlds.contains(player.getLocation().getWorld().getName())) {
|
||||||
|
|
||||||
int chance2 = new Random().nextInt(100);
|
int chance2 = new Random().nextInt(100);
|
||||||
if (chance2 < 30) {
|
if (chance2 < 30) {
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().BuildPyramids == true) {
|
if (HerobrineAI.getPluginCore().getConfigDB().BuildPyramids == true) {
|
||||||
Object[] data = {AllOnPlayers[player_rolled]};
|
Object[] data = { player };
|
||||||
getCore(CoreType.PYRAMID).RunCore(data);
|
getCore(CoreType.PYRAMID).RunCore(data);
|
||||||
}
|
}
|
||||||
} else if (chance2 < 70) {
|
} else if (chance2 < 70) {
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().BuryPlayers) {
|
if (HerobrineAI.getPluginCore().getConfigDB().BuryPlayers) {
|
||||||
Object[] data = {AllOnPlayers[player_rolled]};
|
Object[] data = { player };
|
||||||
getCore(CoreType.BURY_PLAYER).RunCore(data);
|
getCore(CoreType.BURY_PLAYER).RunCore(data);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().UseHeads) {
|
if (HerobrineAI.getPluginCore().getConfigDB().UseHeads) {
|
||||||
Object[] data = {AllOnPlayers[player_rolled].getName()};
|
Object[] data = { player.getName() };
|
||||||
getCore(CoreType.HEADS).RunCore(data);
|
getCore(CoreType.HEADS).RunCore(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -350,17 +377,17 @@ if (CoreNow==CoreType.ANY){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void TempleInterval() {
|
private void TempleInterval() {
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().BuildTemples == true) {
|
if (HerobrineAI.getPluginCore().getConfigDB().BuildTemples == true) {
|
||||||
if (new Random().nextBoolean()) {
|
if (new Random().nextBoolean()) {
|
||||||
if (Bukkit.getServer().getOnlinePlayers().length>0){
|
if (Bukkit.getServer().getOnlinePlayers().size() > 0) {
|
||||||
log.info("[HerobrineAI] Finding temple target...");
|
log.info("[HerobrineAI] Finding temple target...");
|
||||||
Player [] AllOnPlayers = Bukkit.getServer().getOnlinePlayers();
|
|
||||||
int player_rolled= new Random().nextInt(Bukkit.getServer().getOnlinePlayers().length-1);
|
Player player = Utils.getRandomPlayer();
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().useWorlds.contains(AllOnPlayers[player_rolled].getLocation().getWorld().getName())){
|
|
||||||
|
if (HerobrineAI.getPluginCore().getConfigDB().useWorlds.contains(player.getLocation().getWorld().getName())) {
|
||||||
if (new Random().nextBoolean()) {
|
if (new Random().nextBoolean()) {
|
||||||
Object[] data = {AllOnPlayers[player_rolled]};
|
Object[] data = { player };
|
||||||
getCore(CoreType.TEMPLE).RunCore(data);
|
getCore(CoreType.TEMPLE).RunCore(data);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -369,20 +396,20 @@ private void TempleInterval(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BuildCave() {
|
private void BuildCave() {
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().BuildStuff == true) {
|
if (HerobrineAI.getPluginCore().getConfigDB().BuildStuff == true) {
|
||||||
if (new Random().nextBoolean()) {
|
if (new Random().nextBoolean()) {
|
||||||
if (Bukkit.getServer().getOnlinePlayers().length>0){
|
if (Bukkit.getServer().getOnlinePlayers().size() > 0) {
|
||||||
Player [] AllOnPlayers = Bukkit.getServer().getOnlinePlayers();
|
|
||||||
int player_rolled= new Random().nextInt(Bukkit.getServer().getOnlinePlayers().length-1);
|
Player player = Utils.getRandomPlayer();
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().useWorlds.contains(AllOnPlayers[player_rolled].getLocation().getWorld().getName())){
|
|
||||||
|
if (HerobrineAI.getPluginCore().getConfigDB().useWorlds
|
||||||
|
.contains(player.getLocation().getWorld().getName())) {
|
||||||
|
|
||||||
if (new Random().nextBoolean()) {
|
if (new Random().nextBoolean()) {
|
||||||
Object[] data = {AllOnPlayers[player_rolled].getLocation()};
|
Object[] data = { player.getLocation() };
|
||||||
getCore(CoreType.BUILD_STUFF).RunCore(data);
|
getCore(CoreType.BUILD_STUFF).RunCore(data);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -392,7 +419,6 @@ private void BuildCave(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void callByDisc(Player player) {
|
public void callByDisc(Player player) {
|
||||||
isDiscCalled = false;
|
isDiscCalled = false;
|
||||||
if (player.isOnline()) {
|
if (player.isOnline()) {
|
||||||
@ -404,14 +430,15 @@ private void BuildCave(){
|
|||||||
public void RandomCoreINT() {
|
public void RandomCoreINT() {
|
||||||
|
|
||||||
if (new Random().nextBoolean()) {
|
if (new Random().nextBoolean()) {
|
||||||
if (Bukkit.getServer().getOnlinePlayers().length>0){
|
if (Bukkit.getServer().getOnlinePlayers().size() > 0) {
|
||||||
Player [] AllOnPlayers = Bukkit.getServer().getOnlinePlayers();
|
|
||||||
int player_rolled= new Random().nextInt(Bukkit.getServer().getOnlinePlayers().length-1);
|
|
||||||
|
|
||||||
if (AllOnPlayers[player_rolled].getEntityId()!=HerobrineAI.HerobrineEntityID){
|
Player player = Utils.getRandomPlayer();
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().useWorlds.contains(AllOnPlayers[player_rolled].getLocation().getWorld().getName())){
|
|
||||||
Object[] data = {AllOnPlayers[player_rolled]};
|
|
||||||
|
|
||||||
|
if (player.getEntityId() != HerobrineAI.HerobrineEntityID) {
|
||||||
|
if (HerobrineAI.getPluginCore().getConfigDB().useWorlds
|
||||||
|
.contains(player.getLocation().getWorld().getName())) {
|
||||||
|
Object[] data = { player };
|
||||||
|
if (HerobrineAI.getPluginCore().canAttackPlayerNoMSG(player)) {
|
||||||
if (new Random().nextInt(100) < 30) {
|
if (new Random().nextInt(100) < 30) {
|
||||||
|
|
||||||
getCore(CoreType.RANDOM_SOUND).RunCore(data);
|
getCore(CoreType.RANDOM_SOUND).RunCore(data);
|
||||||
@ -432,50 +459,19 @@ private void BuildCave(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void DisappearEffect() {
|
public void DisappearEffect() {
|
||||||
|
|
||||||
Location ploc = (Location) PlayerTarget.getLocation();
|
Location ploc = (Location) PlayerTarget.getLocation();
|
||||||
|
|
||||||
Location hbloc1 = (Location) HerobrineAI.HerobrineNPC.getBukkitEntity().getLocation();
|
for(int i=0; i < 5; i++){
|
||||||
hbloc1.setY(hbloc1.getY()+1);
|
for(float j=0; j < 2; j+= 0.5f){
|
||||||
Location hbloc2 = (Location) HerobrineAI.HerobrineNPC.getBukkitEntity().getLocation();
|
Location hbloc = (Location) HerobrineAI.HerobrineNPC.getBukkitEntity().getLocation();
|
||||||
hbloc2.setY(hbloc2.getY()+0);
|
hbloc.setY(hbloc.getY() + j);
|
||||||
Location hbloc3 = (Location) HerobrineAI.HerobrineNPC.getBukkitEntity().getLocation();
|
hbloc.getWorld().playEffect(hbloc, Effect.SMOKE, 80);
|
||||||
hbloc3.setY(hbloc3.getY()+0.5);
|
}
|
||||||
Location hbloc4 = (Location) HerobrineAI.HerobrineNPC.getBukkitEntity().getLocation();
|
}
|
||||||
hbloc4.setY(hbloc4.getY()+1.5);
|
|
||||||
|
|
||||||
|
|
||||||
ploc.getWorld().playEffect(hbloc1, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc2, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc3, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc4, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc1, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc2, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc3, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc4, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc1, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc2, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc3, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc4, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc1, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc2, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc3, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc4, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc1, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc2, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc3, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc4, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc1, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc2, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc3, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc4, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc1, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc2, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc3, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc4, Effect.SMOKE, 80);
|
|
||||||
|
|
||||||
ploc.setY(-20);
|
ploc.setY(-20);
|
||||||
HerobrineAI.HerobrineNPC.moveTo(ploc);
|
HerobrineAI.HerobrineNPC.moveTo(ploc);
|
||||||
@ -505,6 +501,7 @@ private void BuildCave(){
|
|||||||
}, 1 * 5L);
|
}, 1 * 5L);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Start_RP() {
|
public void Start_RP() {
|
||||||
RandomPositionINT = true;
|
RandomPositionINT = true;
|
||||||
RP_INT = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(AICore.plugin, new Runnable() {
|
RP_INT = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(AICore.plugin, new Runnable() {
|
||||||
@ -513,14 +510,17 @@ private void BuildCave(){
|
|||||||
}
|
}
|
||||||
}, 1 * 300L, 1 * 300L);
|
}, 1 * 300L, 1 * 300L);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Start_BD() {
|
public void Start_BD() {
|
||||||
BuildINT = true;
|
BuildINT = true;
|
||||||
BD_INT = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(AICore.plugin, new Runnable() {
|
BD_INT = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(AICore.plugin, new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
BuildInterval();
|
BuildInterval();
|
||||||
}
|
}
|
||||||
}, 1 * 1L * HerobrineAI.getPluginCore().getConfigDB().BuildInterval, 1 * 1L * HerobrineAI.getPluginCore().getConfigDB().BuildInterval);
|
}, 1 * 1L * HerobrineAI.getPluginCore().getConfigDB().BuildInterval,
|
||||||
|
1 * 1L * HerobrineAI.getPluginCore().getConfigDB().BuildInterval);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Start_MAIN() {
|
public void Start_MAIN() {
|
||||||
MainINT = true;
|
MainINT = true;
|
||||||
MAIN_INT = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(AICore.plugin, new Runnable() {
|
MAIN_INT = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(AICore.plugin, new Runnable() {
|
||||||
@ -528,8 +528,12 @@ private void BuildCave(){
|
|||||||
FindPlayer();
|
FindPlayer();
|
||||||
|
|
||||||
}
|
}
|
||||||
},(6/HerobrineAI.getPluginCore().getConfigDB().ShowRate) * (HerobrineAI.getPluginCore().getConfigDB().ShowInterval * 1L),(6/HerobrineAI.getPluginCore().getConfigDB().ShowRate) * (HerobrineAI.getPluginCore().getConfigDB().ShowInterval * 1L));
|
}, (6 / HerobrineAI.getPluginCore().getConfigDB().ShowRate)
|
||||||
|
* (HerobrineAI.getPluginCore().getConfigDB().ShowInterval * 1L),
|
||||||
|
(6 / HerobrineAI.getPluginCore().getConfigDB().ShowRate)
|
||||||
|
* (HerobrineAI.getPluginCore().getConfigDB().ShowInterval * 1L));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Start_RM() {
|
public void Start_RM() {
|
||||||
RandomMoveINT = true;
|
RandomMoveINT = true;
|
||||||
|
|
||||||
@ -540,6 +544,7 @@ private void BuildCave(){
|
|||||||
}, 1 * 50L, 1 * 50L);
|
}, 1 * 50L, 1 * 50L);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Start_RS() {
|
public void Start_RS() {
|
||||||
RandomSeeINT = true;
|
RandomSeeINT = true;
|
||||||
RS_INT = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(AICore.plugin, new Runnable() {
|
RS_INT = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(AICore.plugin, new Runnable() {
|
||||||
@ -555,7 +560,8 @@ private void BuildCave(){
|
|||||||
public void run() {
|
public void run() {
|
||||||
RandomCoreINT();
|
RandomCoreINT();
|
||||||
}
|
}
|
||||||
}, (long)(HerobrineAI.getPluginCore().getConfigDB().ShowInterval/1.5),(long)(HerobrineAI.getPluginCore().getConfigDB().ShowInterval/1.5));
|
}, (long) (HerobrineAI.getPluginCore().getConfigDB().ShowInterval / 1.5),
|
||||||
|
(long) (HerobrineAI.getPluginCore().getConfigDB().ShowInterval / 1.5));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Start_CG() {
|
public void Start_CG() {
|
||||||
@ -573,36 +579,42 @@ private void BuildCave(){
|
|||||||
Bukkit.getServer().getScheduler().cancelTask(RP_INT);
|
Bukkit.getServer().getScheduler().cancelTask(RP_INT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Stop_BD() {
|
public void Stop_BD() {
|
||||||
if (BuildINT) {
|
if (BuildINT) {
|
||||||
BuildINT = false;
|
BuildINT = false;
|
||||||
Bukkit.getServer().getScheduler().cancelTask(BD_INT);
|
Bukkit.getServer().getScheduler().cancelTask(BD_INT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Stop_RS() {
|
public void Stop_RS() {
|
||||||
if (RandomSeeINT) {
|
if (RandomSeeINT) {
|
||||||
RandomSeeINT = false;
|
RandomSeeINT = false;
|
||||||
Bukkit.getServer().getScheduler().cancelTask(RS_INT);
|
Bukkit.getServer().getScheduler().cancelTask(RS_INT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Stop_RM() {
|
public void Stop_RM() {
|
||||||
if (RandomMoveINT) {
|
if (RandomMoveINT) {
|
||||||
RandomMoveINT = false;
|
RandomMoveINT = false;
|
||||||
Bukkit.getServer().getScheduler().cancelTask(RM_INT);
|
Bukkit.getServer().getScheduler().cancelTask(RM_INT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Stop_RC() {
|
public void Stop_RC() {
|
||||||
if (RandomCoreINT) {
|
if (RandomCoreINT) {
|
||||||
RandomCoreINT = false;
|
RandomCoreINT = false;
|
||||||
Bukkit.getServer().getScheduler().cancelTask(RC_INT);
|
Bukkit.getServer().getScheduler().cancelTask(RC_INT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Stop_CG() {
|
public void Stop_CG() {
|
||||||
if (CheckGravityINT) {
|
if (CheckGravityINT) {
|
||||||
CheckGravityINT = false;
|
CheckGravityINT = false;
|
||||||
Bukkit.getServer().getScheduler().cancelTask(CG_INT);
|
Bukkit.getServer().getScheduler().cancelTask(CG_INT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Stop_MAIN() {
|
public void Stop_MAIN() {
|
||||||
if (MainINT) {
|
if (MainINT) {
|
||||||
MainINT = false;
|
MainINT = false;
|
||||||
@ -616,7 +628,7 @@ private void BuildCave(){
|
|||||||
ArrayList<String> lore = new ArrayList<String>();
|
ArrayList<String> lore = new ArrayList<String>();
|
||||||
lore.add("AncientSword");
|
lore.add("AncientSword");
|
||||||
lore.add("Very old and mysterious sword.");
|
lore.add("Very old and mysterious sword.");
|
||||||
lore.add("This will protect you aganist Herobrine.");
|
lore.add("It protects you aganist Herobrine.");
|
||||||
item = ItemName.setNameAndLore(item, name, lore);
|
item = ItemName.setNameAndLore(item, name, lore);
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
@ -625,7 +637,7 @@ private void BuildCave(){
|
|||||||
ArrayList<String> lore = new ArrayList<String>();
|
ArrayList<String> lore = new ArrayList<String>();
|
||||||
lore.add("AncientSword");
|
lore.add("AncientSword");
|
||||||
lore.add("Very old and mysterious sword.");
|
lore.add("Very old and mysterious sword.");
|
||||||
lore.add("This will protect you aganist Herobrine.");
|
lore.add("It protects you aganist Herobrine.");
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
if (item.getItemMeta() != null) {
|
if (item.getItemMeta() != null) {
|
||||||
if (item.getItemMeta().getLore() != null) {
|
if (item.getItemMeta().getLore() != null) {
|
||||||
|
@ -7,10 +7,12 @@ public abstract class Core {
|
|||||||
private final AppearType Appear;
|
private final AppearType Appear;
|
||||||
private final CoreType coreType;
|
private final CoreType coreType;
|
||||||
private CoreResult nowData = null;
|
private CoreResult nowData = null;
|
||||||
|
protected HerobrineAI PluginCore = null;
|
||||||
|
|
||||||
public Core(CoreType cp,AppearType ap){
|
public Core(CoreType cp,AppearType ap, HerobrineAI hb){
|
||||||
this.coreType=cp;
|
this.coreType=cp;
|
||||||
this.Appear=ap;
|
this.Appear=ap;
|
||||||
|
this.PluginCore = hb;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AppearType getAppear(){
|
public AppearType getAppear(){
|
||||||
@ -21,7 +23,7 @@ public abstract class Core {
|
|||||||
return coreType;
|
return coreType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract CoreResult CallCore(Object[] data);
|
protected abstract CoreResult CallCore(Object[] data);
|
||||||
|
|
||||||
public CoreResult RunCore(Object[] data){
|
public CoreResult RunCore(Object[] data){
|
||||||
|
|
||||||
@ -53,7 +55,8 @@ public abstract class Core {
|
|||||||
RANDOM_SOUND,
|
RANDOM_SOUND,
|
||||||
RANDOM_EXPLOSION,
|
RANDOM_EXPLOSION,
|
||||||
BURN,
|
BURN,
|
||||||
CURSE;
|
CURSE,
|
||||||
|
STARE;
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum AppearType{
|
public enum AppearType{
|
||||||
|
@ -9,9 +9,11 @@ public class CoreResult {
|
|||||||
this.bo = b;
|
this.bo = b;
|
||||||
this.text = t;
|
this.text = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getResult() {
|
public boolean getResult() {
|
||||||
return this.bo;
|
return this.bo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getResultString() {
|
public String getResultString() {
|
||||||
return this.text;
|
return this.text;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,6 @@ public class Message {
|
|||||||
|
|
||||||
player.sendMessage("<Herobrine> " + HerobrineAI.getPluginCore().getConfigDB().useMessages.get(randmsg));
|
player.sendMessage("<Herobrine> " + HerobrineAI.getPluginCore().getConfigDB().useMessages.get(randmsg));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
72
src/org/jakub1221/herobrineai/AI/ResetLimits.java
Normal file
72
src/org/jakub1221/herobrineai/AI/ResetLimits.java
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
package org.jakub1221.herobrineai.AI;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.jakub1221.herobrineai.HerobrineAI;
|
||||||
|
|
||||||
|
public class ResetLimits {
|
||||||
|
|
||||||
|
private int taskID = 0;
|
||||||
|
private int books = 0;
|
||||||
|
private int signs = 0;
|
||||||
|
private int heads = 0;
|
||||||
|
public int maxBooks = 1;
|
||||||
|
public int maxSigns = 1;
|
||||||
|
public int maxHeads = 1;
|
||||||
|
|
||||||
|
public ResetLimits() {
|
||||||
|
|
||||||
|
taskID = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(HerobrineAI.getPluginCore(),
|
||||||
|
new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
resetAll();
|
||||||
|
}
|
||||||
|
}, 1 * 72000L, 1 * 72000L);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void disable() {
|
||||||
|
Bukkit.getServer().getScheduler().cancelTask(taskID);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isBook() {
|
||||||
|
|
||||||
|
if (books < maxBooks) {
|
||||||
|
books++;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSign() {
|
||||||
|
|
||||||
|
if (signs < maxSigns) {
|
||||||
|
signs++;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isHead() {
|
||||||
|
|
||||||
|
if (heads < maxHeads) {
|
||||||
|
heads++;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resetAll() {
|
||||||
|
books = 0;
|
||||||
|
signs = 0;
|
||||||
|
heads = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateFromConfig() {
|
||||||
|
maxBooks = HerobrineAI.getPluginCore().getConfigDB().maxBooks;
|
||||||
|
maxSigns = HerobrineAI.getPluginCore().getConfigDB().maxSigns;
|
||||||
|
maxHeads = HerobrineAI.getPluginCore().getConfigDB().maxHeads;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -11,6 +11,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
import org.jakub1221.herobrineai.HerobrineAI;
|
import org.jakub1221.herobrineai.HerobrineAI;
|
||||||
|
import org.jakub1221.herobrineai.Utils;
|
||||||
import org.jakub1221.herobrineai.AI.AICore;
|
import org.jakub1221.herobrineai.AI.AICore;
|
||||||
import org.jakub1221.herobrineai.AI.Core;
|
import org.jakub1221.herobrineai.AI.Core;
|
||||||
import org.jakub1221.herobrineai.AI.CoreResult;
|
import org.jakub1221.herobrineai.AI.CoreResult;
|
||||||
@ -24,7 +25,7 @@ public class Attack extends Core{
|
|||||||
private boolean isHandler = false;
|
private boolean isHandler = false;
|
||||||
|
|
||||||
public Attack() {
|
public Attack() {
|
||||||
super(CoreType.ATTACK,AppearType.APPEAR);
|
super(CoreType.ATTACK, AppearType.APPEAR, HerobrineAI.getPluginCore());
|
||||||
}
|
}
|
||||||
|
|
||||||
public CoreResult CallCore(Object[] data) {
|
public CoreResult CallCore(Object[] data) {
|
||||||
@ -32,8 +33,11 @@ public class Attack extends Core{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public CoreResult setAttackTarget(Player player) {
|
public CoreResult setAttackTarget(Player player) {
|
||||||
if (!HerobrineAI.getPluginCore().getAICore().checkAncientSword(player.getInventory())){
|
if (!PluginCore.getAICore().checkAncientSword(player.getInventory())) {
|
||||||
if (HerobrineAI.getPluginCore().getSupport().checkAttack(player.getLocation())){
|
if (PluginCore.getSupport().checkAttack(player.getLocation())) {
|
||||||
|
if (!PluginCore.canAttackPlayerNoMSG(player)) {
|
||||||
|
return new CoreResult(false, "This player is protected.");
|
||||||
|
}
|
||||||
|
|
||||||
HerobrineAI.HerobrineHP = HerobrineAI.HerobrineMaxHP;
|
HerobrineAI.HerobrineHP = HerobrineAI.HerobrineMaxHP;
|
||||||
ticksToEnd = 0;
|
ticksToEnd = 0;
|
||||||
@ -42,8 +46,8 @@ public class Attack extends Core{
|
|||||||
AICore.log.info("[HerobrineAI] Teleporting to target. (" + AICore.PlayerTarget.getName() + ")");
|
AICore.log.info("[HerobrineAI] Teleporting to target. (" + AICore.PlayerTarget.getName() + ")");
|
||||||
Location ploc = (Location) AICore.PlayerTarget.getLocation();
|
Location ploc = (Location) AICore.PlayerTarget.getLocation();
|
||||||
Object[] data = { ploc };
|
Object[] data = { ploc };
|
||||||
HerobrineAI.getPluginCore().getAICore().getCore(CoreType.DESTROY_TORCHES).RunCore(data);
|
PluginCore.getAICore().getCore(CoreType.DESTROY_TORCHES).RunCore(data);
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().UsePotionEffects){
|
if (PluginCore.getConfigDB().UsePotionEffects) {
|
||||||
AICore.PlayerTarget.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 1000, 1));
|
AICore.PlayerTarget.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 1000, 1));
|
||||||
AICore.PlayerTarget.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 1000, 1));
|
AICore.PlayerTarget.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 1000, 1));
|
||||||
AICore.PlayerTarget.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 1000, 1));
|
AICore.PlayerTarget.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 1000, 1));
|
||||||
@ -85,33 +89,36 @@ public class Attack extends Core{
|
|||||||
|
|
||||||
private void Handler() {
|
private void Handler() {
|
||||||
KeepLooking();
|
KeepLooking();
|
||||||
if (ticksToEnd==1 || ticksToEnd==16 || ticksToEnd==32 || ticksToEnd==48 || ticksToEnd==64 || ticksToEnd==80 || ticksToEnd==96 || ticksToEnd==112 || ticksToEnd==128 || ticksToEnd==144){
|
if (ticksToEnd == 1 || ticksToEnd % 16 == 0)
|
||||||
FollowHideRepeat();
|
FollowHideRepeat();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void KeepLooking() {
|
public void KeepLooking() {
|
||||||
if (AICore.PlayerTarget.isOnline() && AICore.isTarget && HerobrineAI.getPluginCore().getAICore().getCoreTypeNow()==CoreType.ATTACK){
|
if (AICore.PlayerTarget.isOnline() && AICore.isTarget
|
||||||
|
&& PluginCore.getAICore().getCoreTypeNow() == CoreType.ATTACK) {
|
||||||
if (AICore.PlayerTarget.isDead() == false) {
|
if (AICore.PlayerTarget.isDead() == false) {
|
||||||
if (ticksToEnd==160){HerobrineAI.getPluginCore().getAICore().CancelTarget(CoreType.ATTACK);}else{
|
if (ticksToEnd == 160) {
|
||||||
|
PluginCore.getAICore().CancelTarget(CoreType.ATTACK);
|
||||||
|
} else {
|
||||||
ticksToEnd++;
|
ticksToEnd++;
|
||||||
|
|
||||||
Location ploc = (Location) AICore.PlayerTarget.getLocation();
|
Location ploc = (Location) AICore.PlayerTarget.getLocation();
|
||||||
ploc.setY(ploc.getY() + 1.5);
|
ploc.setY(ploc.getY() + 1.5);
|
||||||
HerobrineAI.HerobrineNPC.lookAtPoint(ploc);
|
HerobrineAI.HerobrineNPC.lookAtPoint(ploc);
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().Lighting==true){
|
if (PluginCore.getConfigDB().Lighting == true) {
|
||||||
int lchance= new Random().nextInt(100);
|
int lchance = Utils.getRandomGen().nextInt(100);
|
||||||
|
|
||||||
if (lchance > 75) {
|
if (lchance > 75) {
|
||||||
Location newloc = (Location) ploc;
|
Location newloc = (Location) ploc;
|
||||||
int randx= new Random().nextInt(50);
|
int randx = Utils.getRandomGen().nextInt(50);
|
||||||
int randz= new Random().nextInt(50);
|
int randz = Utils.getRandomGen().nextInt(50);
|
||||||
if (new Random().nextBoolean()){
|
if (Utils.getRandomGen().nextBoolean()) {
|
||||||
newloc.setX(newloc.getX() + randx);
|
newloc.setX(newloc.getX() + randx);
|
||||||
} else {
|
} else {
|
||||||
newloc.setX(newloc.getX() - randx);
|
newloc.setX(newloc.getX() - randx);
|
||||||
}
|
}
|
||||||
if (new Random().nextBoolean()){
|
if (Utils.getRandomGen().nextBoolean()) {
|
||||||
newloc.setZ(newloc.getZ() + randz);
|
newloc.setZ(newloc.getZ() + randz);
|
||||||
} else {
|
} else {
|
||||||
newloc.setZ(newloc.getZ() - randz);
|
newloc.setZ(newloc.getZ() - randz);
|
||||||
@ -121,108 +128,90 @@ public class Attack extends Core{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}else{HerobrineAI.getPluginCore().getAICore().CancelTarget(CoreType.ATTACK);}
|
} else {
|
||||||
}else{HerobrineAI.getPluginCore().getAICore().CancelTarget(CoreType.ATTACK);}
|
PluginCore.getAICore().CancelTarget(CoreType.ATTACK);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
PluginCore.getAICore().CancelTarget(CoreType.ATTACK);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Follow() {
|
public void Follow() {
|
||||||
if (AICore.PlayerTarget.isOnline() && AICore.isTarget && HerobrineAI.getPluginCore().getAICore().getCoreTypeNow()==CoreType.ATTACK){
|
if (AICore.PlayerTarget.isOnline()
|
||||||
|
&& AICore.isTarget
|
||||||
|
&& PluginCore.getAICore().getCoreTypeNow() == CoreType.ATTACK) {
|
||||||
|
|
||||||
if (AICore.PlayerTarget.isDead() == false) {
|
if (AICore.PlayerTarget.isDead() == false) {
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().useWorlds.contains(AICore.PlayerTarget.getWorld().getName()) && HerobrineAI.getPluginCore().getSupport().checkAttack(AICore.PlayerTarget.getLocation())){
|
|
||||||
|
if (PluginCore.getConfigDB().useWorlds.contains(AICore.PlayerTarget.getWorld().getName())
|
||||||
|
&& PluginCore.getSupport().checkAttack(AICore.PlayerTarget.getLocation())) {
|
||||||
|
|
||||||
HerobrineAI.HerobrineNPC.moveTo(Position.getTeleportPosition(AICore.PlayerTarget.getLocation()));
|
HerobrineAI.HerobrineNPC.moveTo(Position.getTeleportPosition(AICore.PlayerTarget.getLocation()));
|
||||||
Location ploc = (Location) AICore.PlayerTarget.getLocation();
|
Location ploc = (Location) AICore.PlayerTarget.getLocation();
|
||||||
ploc.setY(ploc.getY() + 1.5);
|
ploc.setY(ploc.getY() + 1.5);
|
||||||
HerobrineAI.HerobrineNPC.lookAtPoint(ploc);
|
HerobrineAI.HerobrineNPC.lookAtPoint(ploc);
|
||||||
AICore.PlayerTarget.playSound(AICore.PlayerTarget.getLocation(),Sound.BREATH,(float) 0.75,(float) 0.75);
|
AICore.PlayerTarget.playSound(AICore.PlayerTarget.getLocation(), Sound.ENTITY_PLAYER_BREATH, 0.75f, 0.75f);
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().HitPlayer==true){
|
if (PluginCore.getConfigDB().HitPlayer == true) {
|
||||||
int hitchance= new Random().nextInt(100);
|
int hitchance = Utils.getRandomGen().nextInt(100);
|
||||||
if (hitchance < 55) {
|
if (hitchance < 55) {
|
||||||
AICore.PlayerTarget.playSound(AICore.PlayerTarget.getLocation(), Sound.HURT,(float) 0.75,(float) 0.75);
|
AICore.PlayerTarget.playSound(AICore.PlayerTarget.getLocation(), Sound.ENTITY_PLAYER_HURT, 0.75f, 0.75f);
|
||||||
if (AICore.PlayerTarget.getHealth()>=4){
|
|
||||||
AICore.PlayerTarget.setHealth(AICore.PlayerTarget.getHealth()-4);
|
|
||||||
}else{AICore.PlayerTarget.setHealth(0);}
|
|
||||||
|
|
||||||
|
AICore.PlayerTarget.damage(4);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{HerobrineAI.getPluginCore().getAICore().CancelTarget(CoreType.ATTACK);}
|
} else {
|
||||||
}else{HerobrineAI.getPluginCore().getAICore().CancelTarget(CoreType.ATTACK);}
|
PluginCore.getAICore().CancelTarget(CoreType.ATTACK);
|
||||||
}else{HerobrineAI.getPluginCore().getAICore().CancelTarget(CoreType.ATTACK);}
|
}
|
||||||
|
} else {
|
||||||
|
PluginCore.getAICore().CancelTarget(CoreType.ATTACK);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
PluginCore.getAICore().CancelTarget(CoreType.ATTACK);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Hide() {
|
public void Hide() {
|
||||||
if (AICore.PlayerTarget.isOnline() && AICore.isTarget && HerobrineAI.getPluginCore().getAICore().getCoreTypeNow()==CoreType.ATTACK){
|
if (AICore.PlayerTarget.isOnline() && AICore.isTarget
|
||||||
|
&& PluginCore.getAICore().getCoreTypeNow() == CoreType.ATTACK) {
|
||||||
if (AICore.PlayerTarget.isDead() == false) {
|
if (AICore.PlayerTarget.isDead() == false) {
|
||||||
|
|
||||||
Location ploc = (Location) AICore.PlayerTarget.getLocation();
|
Location ploc = (Location) AICore.PlayerTarget.getLocation();
|
||||||
|
|
||||||
ploc.setY(-20);
|
ploc.setY(-20);
|
||||||
|
|
||||||
Location hbloc1 = (Location) HerobrineAI.HerobrineNPC.getBukkitEntity().getLocation();
|
for(int i=0; i < 5; i++){
|
||||||
hbloc1.setY(hbloc1.getY()+1);
|
for(float j=0; j < 2; j+= 0.5f){
|
||||||
Location hbloc2 = (Location) HerobrineAI.HerobrineNPC.getBukkitEntity().getLocation();
|
Location hbloc = (Location) HerobrineAI.HerobrineNPC.getBukkitEntity().getLocation();
|
||||||
hbloc2.setY(hbloc2.getY()+0);
|
hbloc.setY(hbloc.getY() + j);
|
||||||
Location hbloc3 = (Location) HerobrineAI.HerobrineNPC.getBukkitEntity().getLocation();
|
hbloc.getWorld().playEffect(hbloc, Effect.SMOKE, 80);
|
||||||
hbloc3.setY(hbloc3.getY()+0.5);
|
}
|
||||||
Location hbloc4 = (Location) HerobrineAI.HerobrineNPC.getBukkitEntity().getLocation();
|
|
||||||
hbloc4.setY(hbloc4.getY()+1.5);
|
|
||||||
|
|
||||||
|
|
||||||
ploc.getWorld().playEffect(hbloc1, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc2, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc3, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc4, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc1, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc2, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc3, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc4, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc1, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc2, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc3, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc4, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc1, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc2, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc3, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc4, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc1, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc2, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc3, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc4, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc1, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc2, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc3, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc4, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc1, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc2, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc3, Effect.SMOKE, 80);
|
|
||||||
ploc.getWorld().playEffect(hbloc4, Effect.SMOKE, 80);
|
|
||||||
|
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().SpawnBats){
|
|
||||||
int cc = new Random().nextInt(3);
|
|
||||||
if (cc==0){
|
|
||||||
ploc.getWorld().spawnEntity(hbloc1, EntityType.BAT);
|
|
||||||
ploc.getWorld().spawnEntity(hbloc1, EntityType.BAT);
|
|
||||||
}else if (cc==1){
|
|
||||||
ploc.getWorld().spawnEntity(hbloc1, EntityType.BAT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (PluginCore.getConfigDB().SpawnBats) {
|
||||||
|
Location hbloc = (Location) HerobrineAI.HerobrineNPC.getBukkitEntity().getLocation();
|
||||||
|
ploc.getWorld().spawnEntity(hbloc, EntityType.BAT);
|
||||||
|
ploc.getWorld().spawnEntity(hbloc, EntityType.BAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
HerobrineAI.HerobrineNPC.moveTo(ploc);
|
HerobrineAI.HerobrineNPC.moveTo(ploc);
|
||||||
|
|
||||||
}else{HerobrineAI.getPluginCore().getAICore().CancelTarget(CoreType.ATTACK);}
|
} else {
|
||||||
}else{HerobrineAI.getPluginCore().getAICore().CancelTarget(CoreType.ATTACK);}
|
PluginCore.getAICore().CancelTarget(CoreType.ATTACK);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
PluginCore.getAICore().CancelTarget(CoreType.ATTACK);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void FollowHideRepeat() {
|
public void FollowHideRepeat() {
|
||||||
if (AICore.PlayerTarget.isOnline() && AICore.isTarget && HerobrineAI.getPluginCore().getAICore().getCoreTypeNow()==CoreType.ATTACK){
|
if (AICore.PlayerTarget.isOnline() && AICore.isTarget
|
||||||
|
&& PluginCore.getAICore().getCoreTypeNow() == CoreType.ATTACK) {
|
||||||
if (AICore.PlayerTarget.isDead() == false) {
|
if (AICore.PlayerTarget.isDead() == false) {
|
||||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(AICore.plugin, new Runnable() {
|
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(AICore.plugin, new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -234,7 +223,11 @@ public class Attack extends Core{
|
|||||||
Follow();
|
Follow();
|
||||||
}
|
}
|
||||||
}, 1 * 45L);
|
}, 1 * 45L);
|
||||||
}else{HerobrineAI.getPluginCore().getAICore().CancelTarget(CoreType.ATTACK);}
|
} else {
|
||||||
}else{HerobrineAI.getPluginCore().getAICore().CancelTarget(CoreType.ATTACK);}
|
PluginCore.getAICore().CancelTarget(CoreType.ATTACK);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
PluginCore.getAICore().CancelTarget(CoreType.ATTACK);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,26 +9,32 @@ import org.bukkit.inventory.Inventory;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.BookMeta;
|
import org.bukkit.inventory.meta.BookMeta;
|
||||||
import org.jakub1221.herobrineai.HerobrineAI;
|
import org.jakub1221.herobrineai.HerobrineAI;
|
||||||
|
import org.jakub1221.herobrineai.Utils;
|
||||||
import org.jakub1221.herobrineai.AI.Core;
|
import org.jakub1221.herobrineai.AI.Core;
|
||||||
import org.jakub1221.herobrineai.AI.CoreResult;
|
import org.jakub1221.herobrineai.AI.CoreResult;
|
||||||
|
|
||||||
public class Book extends Core {
|
public class Book extends Core {
|
||||||
|
|
||||||
public Book() {
|
public Book() {
|
||||||
super(CoreType.BOOK,AppearType.NORMAL);
|
super(CoreType.BOOK, AppearType.NORMAL, HerobrineAI.getPluginCore());
|
||||||
}
|
}
|
||||||
|
|
||||||
public CoreResult CallCore(Object[] data) {
|
public CoreResult CallCore(Object[] data) {
|
||||||
Player player = (Player) data[0];
|
Player player = (Player) data[0];
|
||||||
|
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().useWorlds.contains(player.getLocation().getWorld().getName())) {
|
if (HerobrineAI.getPluginCore().getConfigDB().useWorlds.contains(player.getLocation().getWorld().getName())) {
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().WriteBooks==true && HerobrineAI.getPluginCore().getSupport().checkBooks(player.getLocation())){
|
|
||||||
int chance=new Random().nextInt(100);
|
if (HerobrineAI.getPluginCore().getConfigDB().WriteBooks == true
|
||||||
|
&& HerobrineAI.getPluginCore().getSupport().checkBooks(player.getLocation())) {
|
||||||
|
|
||||||
|
int chance = Utils.getRandomGen().nextInt(100);
|
||||||
if (chance > (100 - HerobrineAI.getPluginCore().getConfigDB().BookChance)) {
|
if (chance > (100 - HerobrineAI.getPluginCore().getConfigDB().BookChance)) {
|
||||||
Inventory chest = (Inventory) data[1];
|
Inventory chest = (Inventory) data[1];
|
||||||
if (chest.firstEmpty() != -1) {
|
if (chest.firstEmpty() != -1) {
|
||||||
|
if (HerobrineAI.getPluginCore().getAICore().getResetLimits().isBook()) {
|
||||||
chest.setItem(chest.firstEmpty(), newBook());
|
chest.setItem(chest.firstEmpty(), newBook());
|
||||||
return new CoreResult(true, "Book created!");
|
return new CoreResult(true, "Book created!");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return new CoreResult(false, "Book create failed!");
|
return new CoreResult(false, "Book create failed!");
|
||||||
}
|
}
|
||||||
@ -41,22 +47,21 @@ public class Book extends Core{
|
|||||||
}
|
}
|
||||||
return new CoreResult(false, "Book create failed!");
|
return new CoreResult(false, "Book create failed!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack newBook() {
|
public ItemStack newBook() {
|
||||||
|
|
||||||
int count = HerobrineAI.getPluginCore().getConfigDB().useBookMessages.size();
|
int count = HerobrineAI.getPluginCore().getConfigDB().useBookMessages.size();
|
||||||
|
|
||||||
int chance=new Random().nextInt(count);
|
int chance = Utils.getRandomGen().nextInt(count);
|
||||||
|
|
||||||
ItemStack book = new ItemStack(Material.WRITTEN_BOOK);
|
ItemStack book = new ItemStack(Material.WRITTEN_BOOK);
|
||||||
BookMeta meta = (BookMeta) book.getItemMeta();
|
BookMeta meta = (BookMeta) book.getItemMeta();
|
||||||
|
|
||||||
|
|
||||||
ArrayList<String> list = new ArrayList<String>();
|
ArrayList<String> list = new ArrayList<String>();
|
||||||
|
|
||||||
meta.setTitle("");
|
meta.setTitle("");
|
||||||
meta.setAuthor("");
|
meta.setAuthor("");
|
||||||
|
|
||||||
|
|
||||||
list.add(0, (String) HerobrineAI.getPluginCore().getConfigDB().useBookMessages.get(chance));
|
list.add(0, (String) HerobrineAI.getPluginCore().getConfigDB().useBookMessages.get(chance));
|
||||||
|
|
||||||
meta.setPages(list);
|
meta.setPages(list);
|
||||||
|
@ -7,14 +7,15 @@ import org.bukkit.Location;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.jakub1221.herobrineai.HerobrineAI;
|
import org.jakub1221.herobrineai.HerobrineAI;
|
||||||
|
import org.jakub1221.herobrineai.Utils;
|
||||||
import org.jakub1221.herobrineai.AI.*;
|
import org.jakub1221.herobrineai.AI.*;
|
||||||
|
|
||||||
|
|
||||||
public class BuildStuff extends Core {
|
public class BuildStuff extends Core {
|
||||||
|
|
||||||
public BuildStuff() {
|
public BuildStuff() {
|
||||||
super(CoreType.BUILD_STUFF,AppearType.NORMAL);
|
super(CoreType.BUILD_STUFF, AppearType.NORMAL, HerobrineAI.getPluginCore());
|
||||||
}
|
}
|
||||||
|
|
||||||
public CoreResult CallCore(Object[] data) {
|
public CoreResult CallCore(Object[] data) {
|
||||||
if (data.length == 2) {
|
if (data.length == 2) {
|
||||||
return BuildCave((Location) data[0], true);
|
return BuildCave((Location) data[0], true);
|
||||||
@ -28,7 +29,7 @@ public class BuildStuff extends Core{
|
|||||||
if (HerobrineAI.getPluginCore().getSupport().checkBuild(loc)) {
|
if (HerobrineAI.getPluginCore().getSupport().checkBuild(loc)) {
|
||||||
if (loc.getBlockY() < 60) {
|
if (loc.getBlockY() < 60) {
|
||||||
|
|
||||||
int chance=new Random().nextInt(100);
|
int chance = Utils.getRandomGen().nextInt(100);
|
||||||
if (chance > (100 - HerobrineAI.getPluginCore().getConfigDB().CaveChance)) {
|
if (chance > (100 - HerobrineAI.getPluginCore().getConfigDB().CaveChance)) {
|
||||||
AICore.log.info("Creating cave...");
|
AICore.log.info("Creating cave...");
|
||||||
|
|
||||||
@ -49,23 +50,19 @@ public class BuildStuff extends Core{
|
|||||||
return new CoreResult(false, "Player is in secure location.");
|
return new CoreResult(false, "Player is in secure location.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public CoreResult BuildCave(Location loc, boolean cmd) {
|
public CoreResult BuildCave(Location loc, boolean cmd) {
|
||||||
|
|
||||||
|
|
||||||
if (HerobrineAI.getPluginCore().getSupport().checkBuild(loc)) {
|
if (HerobrineAI.getPluginCore().getSupport().checkBuild(loc)) {
|
||||||
if (loc.getBlockY() < 60) {
|
if (loc.getBlockY() < 60) {
|
||||||
|
|
||||||
|
|
||||||
AICore.log.info("Creating cave...");
|
AICore.log.info("Creating cave...");
|
||||||
|
|
||||||
GenerateCave(loc);
|
GenerateCave(loc);
|
||||||
|
|
||||||
return new CoreResult(false, "Cave created!");
|
return new CoreResult(false, "Cave created!");
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return new CoreResult(false, "Location must be under 60 of Y.");
|
return new CoreResult(false, "Location must be under 60 of Y.");
|
||||||
}
|
}
|
||||||
@ -80,8 +77,11 @@ public class BuildStuff extends Core{
|
|||||||
if (HerobrineAI.getPluginCore().getSupport().checkBuild(loc)) {
|
if (HerobrineAI.getPluginCore().getSupport().checkBuild(loc)) {
|
||||||
|
|
||||||
ArrayList<Location> redstoneTorchList = new ArrayList<Location>();
|
ArrayList<Location> redstoneTorchList = new ArrayList<Location>();
|
||||||
boolean goByX=new Random().nextBoolean();
|
|
||||||
boolean goNegative=new Random().nextBoolean();
|
Random rand = Utils.getRandomGen();
|
||||||
|
|
||||||
|
boolean goByX = rand.nextBoolean();
|
||||||
|
boolean goNegative = rand.nextBoolean();
|
||||||
|
|
||||||
int baseX = loc.getBlockX();
|
int baseX = loc.getBlockX();
|
||||||
int baseZ = loc.getBlockZ();
|
int baseZ = loc.getBlockZ();
|
||||||
@ -90,14 +90,17 @@ public class BuildStuff extends Core{
|
|||||||
int finalX = 0;
|
int finalX = 0;
|
||||||
int finalZ = 0;
|
int finalZ = 0;
|
||||||
|
|
||||||
int maxL=new Random().nextInt(10)+4;
|
int maxL = rand.nextInt(10) + 4;
|
||||||
int iR=new Random().nextInt(3)+4;
|
int iR = rand.nextInt(3) + 4;
|
||||||
int iNow = 0;
|
int iNow = 0;
|
||||||
|
|
||||||
while (iNow != iR) {
|
while (iNow != iR) {
|
||||||
|
|
||||||
iNow++;
|
iNow++;
|
||||||
goByX=new Random().nextBoolean();
|
goByX = rand.nextBoolean();
|
||||||
goNegative=new Random().nextBoolean();
|
goNegative = rand.nextBoolean();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
for (i = 0; i <= maxL; i++) {
|
for (i = 0; i <= maxL; i++) {
|
||||||
finalX = 0;
|
finalX = 0;
|
||||||
finalZ = 0;
|
finalZ = 0;
|
||||||
@ -120,7 +123,8 @@ public class BuildStuff extends Core{
|
|||||||
|
|
||||||
loc.getWorld().getBlockAt(baseX, baseY, baseZ).breakNaturally(null);
|
loc.getWorld().getBlockAt(baseX, baseY, baseZ).breakNaturally(null);
|
||||||
loc.getWorld().getBlockAt(baseX, baseY + 1, baseZ).breakNaturally(null);
|
loc.getWorld().getBlockAt(baseX, baseY + 1, baseZ).breakNaturally(null);
|
||||||
if (new Random().nextBoolean()){
|
|
||||||
|
if (rand.nextBoolean()) {
|
||||||
redstoneTorchList.add(new Location(loc.getWorld(), baseX, baseY + 1, baseZ));
|
redstoneTorchList.add(new Location(loc.getWorld(), baseX, baseY + 1, baseZ));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -136,12 +140,11 @@ public class BuildStuff extends Core{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void PlaceRedstoneTorch(World world, int x, int y, int z) {
|
public void PlaceRedstoneTorch(World world, int x, int y, int z) {
|
||||||
Random randgen = new Random();
|
Random randgen = Utils.getRandomGen();
|
||||||
int chance = randgen.nextInt(100);
|
int chance = randgen.nextInt(100);
|
||||||
if (chance > 70) {
|
if (chance > 70) {
|
||||||
world.getBlockAt(x, y, z).setType(Material.REDSTONE_TORCH_ON);
|
world.getBlockAt(x, y, z).setType(Material.REDSTONE_TORCH_ON);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
package org.jakub1221.herobrineai.AI.cores;
|
package org.jakub1221.herobrineai.AI.cores;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.jakub1221.herobrineai.HerobrineAI;
|
||||||
import org.jakub1221.herobrineai.AI.Core;
|
import org.jakub1221.herobrineai.AI.Core;
|
||||||
import org.jakub1221.herobrineai.AI.CoreResult;
|
import org.jakub1221.herobrineai.AI.CoreResult;
|
||||||
|
|
||||||
public class Burn extends Core {
|
public class Burn extends Core {
|
||||||
|
|
||||||
public Burn() {
|
public Burn() {
|
||||||
super(CoreType.BURN, AppearType.NORMAL);
|
super(CoreType.BURN, AppearType.NORMAL, HerobrineAI.getPluginCore());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -16,7 +16,7 @@ public class BuryPlayer extends Core{
|
|||||||
public Block savedBlock2 = null;
|
public Block savedBlock2 = null;
|
||||||
|
|
||||||
public BuryPlayer() {
|
public BuryPlayer() {
|
||||||
super(CoreType.BURY_PLAYER,AppearType.NORMAL);
|
super(CoreType.BURY_PLAYER, AppearType.NORMAL, HerobrineAI.getPluginCore());
|
||||||
}
|
}
|
||||||
|
|
||||||
public CoreResult CallCore(Object[] data) {
|
public CoreResult CallCore(Object[] data) {
|
||||||
@ -25,35 +25,41 @@ public class BuryPlayer extends Core{
|
|||||||
|
|
||||||
public CoreResult FindPlace(Player player){
|
public CoreResult FindPlace(Player player){
|
||||||
if(HerobrineAI.getPluginCore().getSupport().checkBuild(player.getLocation())){
|
if(HerobrineAI.getPluginCore().getSupport().checkBuild(player.getLocation())){
|
||||||
|
|
||||||
|
|
||||||
Location loc = (Location) player.getLocation();
|
Location loc = (Location) player.getLocation();
|
||||||
|
|
||||||
if (HerobrineAI.StandBlocks.contains(loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY()-1, loc.getBlockZ()).getType())){
|
int[][] blocks = {
|
||||||
if (HerobrineAI.StandBlocks.contains(loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY()-2, loc.getBlockZ()).getType())){
|
{-1, 0},
|
||||||
if (HerobrineAI.StandBlocks.contains(loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY()-1, loc.getBlockZ()-1).getType())){
|
{-2, 0},
|
||||||
if (HerobrineAI.StandBlocks.contains(loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY()-2, loc.getBlockZ()-1).getType())){
|
{-1,-1},
|
||||||
if (HerobrineAI.StandBlocks.contains(loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY()-3, loc.getBlockZ()).getType())){
|
{-2,-1},
|
||||||
if (HerobrineAI.StandBlocks.contains(loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY()-3, loc.getBlockZ()-1).getType())){
|
{-3, 0},
|
||||||
if (HerobrineAI.StandBlocks.contains(loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY()-1, loc.getBlockZ()-1).getType())){
|
{-3,-1},
|
||||||
if (HerobrineAI.StandBlocks.contains(loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY()-2, loc.getBlockZ()-1).getType())){
|
{-1,-1},
|
||||||
if (HerobrineAI.StandBlocks.contains(loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY()-1, loc.getBlockZ()-2).getType())){
|
{-2,-1},
|
||||||
if (HerobrineAI.NonStandBlocks.contains(loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()-2).getType())){
|
{-1,-2},
|
||||||
|
{ 0,-2},
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
for (int i = 0; i < blocks.length; i++){
|
||||||
|
|
||||||
|
Material mat = loc.getWorld().getBlockAt(
|
||||||
|
loc.getBlockX(),
|
||||||
|
loc.getBlockY() + blocks[i][0],
|
||||||
|
loc.getBlockZ() + blocks[i][1]
|
||||||
|
).getType();
|
||||||
|
|
||||||
|
if(!HerobrineAI.StandBlocks.contains(mat))
|
||||||
|
return new CoreResult(false,"Cannot find suitable location!");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Bury(loc.getWorld(),loc.getBlockX(),loc.getBlockY(),loc.getBlockZ(),player);
|
Bury(loc.getWorld(),loc.getBlockX(),loc.getBlockY(),loc.getBlockZ(),player);
|
||||||
return new CoreResult(true,"Player buried!");
|
return new CoreResult(true,"Player buried!");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return new CoreResult(false,"Cannot find a good location!");
|
return new CoreResult(false,"Cannot find suitable location!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Bury(World world, int X, int Y, int Z, Player player) {
|
public void Bury(World world, int X, int Y, int Z, Player player) {
|
||||||
|
@ -12,7 +12,7 @@ import org.jakub1221.herobrineai.AI.CoreResult;
|
|||||||
public class Curse extends Core {
|
public class Curse extends Core {
|
||||||
|
|
||||||
public Curse() {
|
public Curse() {
|
||||||
super(CoreType.CURSE, AppearType.NORMAL);
|
super(CoreType.CURSE, AppearType.NORMAL, HerobrineAI.getPluginCore());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -26,21 +26,19 @@ public class Curse extends Core {
|
|||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 50, 1));
|
player.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 50, 1));
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, 1000, 1));
|
player.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, 1000, 1));
|
||||||
|
|
||||||
int i = 0;
|
for (int i=0; i< 3 ; i++) {
|
||||||
while(i!=3){
|
|
||||||
i++;
|
|
||||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(HerobrineAI.getPluginCore(), new Runnable() {
|
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(HerobrineAI.getPluginCore(), new Runnable() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
player.getLocation().getWorld().strikeLightning(new Location(player.getLocation().getWorld(),player.getLocation().getX(),player.getLocation().getY()+1,player.getLocation().getZ()));
|
player.getLocation().getWorld().strikeLightning(new Location(player.getLocation().getWorld(),
|
||||||
|
player.getLocation().getX(), player.getLocation().getY() + 1, player.getLocation().getZ()));
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 50, 1));
|
player.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 50, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
}, i * 150L);
|
}, i * 150L);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return new CoreResult(true, "Player cursed!");
|
return new CoreResult(true, "Player cursed!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ import org.jakub1221.herobrineai.AI.CoreResult;
|
|||||||
public class DestroyTorches extends Core {
|
public class DestroyTorches extends Core {
|
||||||
|
|
||||||
public DestroyTorches() {
|
public DestroyTorches() {
|
||||||
super(CoreType.DESTROY_TORCHES,AppearType.NORMAL);
|
super(CoreType.DESTROY_TORCHES, AppearType.NORMAL, HerobrineAI.getPluginCore());
|
||||||
}
|
}
|
||||||
|
|
||||||
public CoreResult CallCore(Object[] data) {
|
public CoreResult CallCore(Object[] data) {
|
||||||
@ -21,7 +21,6 @@ public class DestroyTorches extends Core{
|
|||||||
public CoreResult destroyTorches(Location loc) {
|
public CoreResult destroyTorches(Location loc) {
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().DestroyTorches == true) {
|
if (HerobrineAI.getPluginCore().getConfigDB().DestroyTorches == true) {
|
||||||
|
|
||||||
|
|
||||||
int x = loc.getBlockX();
|
int x = loc.getBlockX();
|
||||||
int y = loc.getBlockY();
|
int y = loc.getBlockY();
|
||||||
int z = loc.getBlockZ();
|
int z = loc.getBlockZ();
|
||||||
@ -31,9 +30,12 @@ public class DestroyTorches extends Core{
|
|||||||
int ii = -(HerobrineAI.getPluginCore().getConfigDB().DestroyTorchesRadius); // X
|
int ii = -(HerobrineAI.getPluginCore().getConfigDB().DestroyTorchesRadius); // X
|
||||||
int iii = -(HerobrineAI.getPluginCore().getConfigDB().DestroyTorchesRadius); // Z
|
int iii = -(HerobrineAI.getPluginCore().getConfigDB().DestroyTorchesRadius); // Z
|
||||||
|
|
||||||
for(i=-(HerobrineAI.getPluginCore().getConfigDB().DestroyTorchesRadius);i<=HerobrineAI.getPluginCore().getConfigDB().DestroyTorchesRadius;i++){
|
for (i = -(HerobrineAI.getPluginCore().getConfigDB().DestroyTorchesRadius); i <= HerobrineAI.getPluginCore()
|
||||||
for(ii=-(HerobrineAI.getPluginCore().getConfigDB().DestroyTorchesRadius);ii<=HerobrineAI.getPluginCore().getConfigDB().DestroyTorchesRadius;ii++){
|
.getConfigDB().DestroyTorchesRadius; i++) {
|
||||||
for(iii=-(HerobrineAI.getPluginCore().getConfigDB().DestroyTorchesRadius);iii<=HerobrineAI.getPluginCore().getConfigDB().DestroyTorchesRadius;iii++){
|
for (ii = -(HerobrineAI.getPluginCore().getConfigDB().DestroyTorchesRadius); ii <= HerobrineAI
|
||||||
|
.getPluginCore().getConfigDB().DestroyTorchesRadius; ii++) {
|
||||||
|
for (iii = -(HerobrineAI.getPluginCore().getConfigDB().DestroyTorchesRadius); iii <= HerobrineAI
|
||||||
|
.getPluginCore().getConfigDB().DestroyTorchesRadius; iii++) {
|
||||||
if (world.getBlockAt(x + ii, y + i, z + iii).getType() == Material.TORCH) {
|
if (world.getBlockAt(x + ii, y + i, z + iii).getType() == Material.TORCH) {
|
||||||
world.getBlockAt(x + ii, y + i, z + iii).breakNaturally();
|
world.getBlockAt(x + ii, y + i, z + iii).breakNaturally();
|
||||||
return new CoreResult(true, "Torches destroyed!");
|
return new CoreResult(true, "Torches destroyed!");
|
||||||
@ -46,5 +48,4 @@ public class DestroyTorches extends Core{
|
|||||||
return new CoreResult(false, "Cannot destroy torches.");
|
return new CoreResult(false, "Cannot destroy torches.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,13 +9,13 @@ import org.bukkit.World;
|
|||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.jakub1221.herobrineai.HerobrineAI;
|
import org.jakub1221.herobrineai.HerobrineAI;
|
||||||
|
import org.jakub1221.herobrineai.Utils;
|
||||||
import org.jakub1221.herobrineai.AI.AICore;
|
import org.jakub1221.herobrineai.AI.AICore;
|
||||||
import org.jakub1221.herobrineai.AI.Core;
|
import org.jakub1221.herobrineai.AI.Core;
|
||||||
import org.jakub1221.herobrineai.AI.CoreResult;
|
import org.jakub1221.herobrineai.AI.CoreResult;
|
||||||
|
|
||||||
public class Graveyard extends Core {
|
public class Graveyard extends Core {
|
||||||
|
|
||||||
|
|
||||||
private List<LivingEntity> LivingEntities;
|
private List<LivingEntity> LivingEntities;
|
||||||
private int ticks = 0;
|
private int ticks = 0;
|
||||||
private double savedX = 0;
|
private double savedX = 0;
|
||||||
@ -25,21 +25,22 @@ public class Graveyard extends Core{
|
|||||||
private Player savedPlayer = null;
|
private Player savedPlayer = null;
|
||||||
|
|
||||||
public Graveyard() {
|
public Graveyard() {
|
||||||
super(CoreType.GRAVEYARD,AppearType.APPEAR);
|
super(CoreType.GRAVEYARD, AppearType.APPEAR, HerobrineAI.getPluginCore());
|
||||||
}
|
}
|
||||||
|
|
||||||
public CoreResult CallCore(Object[] data) {
|
public CoreResult CallCore(Object[] data) {
|
||||||
return Teleport((Player) data[0]);
|
return Teleport((Player) data[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public CoreResult Teleport(Player player) {
|
public CoreResult Teleport(Player player) {
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().UseGraveyardWorld == true) {
|
if (HerobrineAI.getPluginCore().getConfigDB().UseGraveyardWorld == true) {
|
||||||
if (!HerobrineAI.getPluginCore().getAICore().checkAncientSword(player.getInventory())) {
|
if (!HerobrineAI.getPluginCore().getAICore().checkAncientSword(player.getInventory())) {
|
||||||
LivingEntities = Bukkit.getServer().getWorld("world_herobrineai_graveyard").getLivingEntities();
|
LivingEntities = Bukkit.getServer().getWorld("world_herobrineai_graveyard").getLivingEntities();
|
||||||
for (int i = 0; i <= LivingEntities.size() - 1; i++) {
|
for (int i = 0; i <= LivingEntities.size() - 1; i++) {
|
||||||
|
|
||||||
if (LivingEntities.get(i) instanceof Player || LivingEntities.get(i).getEntityId() == HerobrineAI.HerobrineEntityID){}else{
|
if (LivingEntities.get(i) instanceof Player
|
||||||
|
|| LivingEntities.get(i).getEntityId() == HerobrineAI.HerobrineEntityID) {
|
||||||
|
} else {
|
||||||
|
|
||||||
LivingEntities.get(i).remove();
|
LivingEntities.get(i).remove();
|
||||||
|
|
||||||
@ -59,22 +60,28 @@ public class Graveyard extends Core{
|
|||||||
loc.setX(-2.49);
|
loc.setX(-2.49);
|
||||||
loc.setY(4);
|
loc.setY(4);
|
||||||
loc.setZ(10.69);
|
loc.setZ(10.69);
|
||||||
loc.setYaw((float)-179.85);
|
loc.setYaw(-179.85f);
|
||||||
loc.setPitch((float) 0.44999);
|
loc.setPitch(0.44999f);
|
||||||
player.teleport(loc);
|
player.teleport(loc);
|
||||||
|
|
||||||
Start();
|
Start();
|
||||||
|
|
||||||
HerobrineAI.getPluginCore().getAICore().isTarget = true;
|
HerobrineAI.getPluginCore().getAICore().isTarget = true;
|
||||||
Bukkit.getServer().getWorld("world_herobrineai_graveyard").setStorm(false);
|
Bukkit.getServer().getWorld("world_herobrineai_graveyard").setStorm(false);
|
||||||
|
|
||||||
return new CoreResult(true, "Player successfully teleported!");
|
return new CoreResult(true, "Player successfully teleported!");
|
||||||
}else{return new CoreResult(false,"Player has Ancient Sword.");}
|
} else {
|
||||||
|
return new CoreResult(false, "Player has Ancient Sword.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return new CoreResult(false, "Graveyard world is not allowed!");
|
return new CoreResult(false, "Graveyard world is not allowed!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Start() {
|
public void Start() {
|
||||||
|
|
||||||
|
|
||||||
ticks = 0;
|
ticks = 0;
|
||||||
HerobrineAI.HerobrineNPC.moveTo(new Location(Bukkit.getServer().getWorld("world_herobrineai_graveyard"),-2.49,4,-4.12));
|
HerobrineAI.HerobrineNPC
|
||||||
|
.moveTo(new Location(Bukkit.getServer().getWorld("world_herobrineai_graveyard"), -2.49, 4, -4.12));
|
||||||
HandlerInterval();
|
HandlerInterval();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -93,7 +100,9 @@ public class Graveyard extends Core{
|
|||||||
LivingEntities = Bukkit.getServer().getWorld("world_herobrineai_graveyard").getLivingEntities();
|
LivingEntities = Bukkit.getServer().getWorld("world_herobrineai_graveyard").getLivingEntities();
|
||||||
for (int i = 0; i <= LivingEntities.size() - 1; i++) {
|
for (int i = 0; i <= LivingEntities.size() - 1; i++) {
|
||||||
|
|
||||||
if (LivingEntities.get(i) instanceof Player || LivingEntities.get(i).getEntityId() == HerobrineAI.HerobrineEntityID){}else{
|
if (LivingEntities.get(i) instanceof Player
|
||||||
|
|| LivingEntities.get(i).getEntityId() == HerobrineAI.HerobrineEntityID) {
|
||||||
|
} else {
|
||||||
|
|
||||||
LivingEntities.get(i).remove();
|
LivingEntities.get(i).remove();
|
||||||
|
|
||||||
@ -101,10 +110,15 @@ public class Graveyard extends Core{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (savedPlayer.isDead()==true || savedPlayer.isOnline()==false || savedPlayer.getLocation().getWorld()!=Bukkit.getServer().getWorld("world_herobrineai_graveyard") || this.ticks==90 || HerobrineAI.getPluginCore().getAICore().isTarget==false){
|
if (savedPlayer.isDead() == true
|
||||||
|
|| savedPlayer.isOnline() == false
|
||||||
|
|| savedPlayer.getLocation().getWorld() != Bukkit.getServer().getWorld("world_herobrineai_graveyard")
|
||||||
|
|| this.ticks == 90 || HerobrineAI.getPluginCore().getAICore().isTarget == false) {
|
||||||
|
|
||||||
if (HerobrineAI.getPluginCore().getAICore().PlayerTarget == savedPlayer) {
|
if (HerobrineAI.getPluginCore().getAICore().PlayerTarget == savedPlayer) {
|
||||||
HerobrineAI.getPluginCore().getAICore().CancelTarget(CoreType.GRAVEYARD);
|
HerobrineAI.getPluginCore().getAICore().CancelTarget(CoreType.GRAVEYARD);
|
||||||
}
|
}
|
||||||
|
|
||||||
savedPlayer.teleport(new Location(savedWorld, savedX, savedY, savedZ));
|
savedPlayer.teleport(new Location(savedWorld, savedX, savedY, savedZ));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -112,20 +126,27 @@ public class Graveyard extends Core{
|
|||||||
ploc.setY(ploc.getY() + 1.5);
|
ploc.setY(ploc.getY() + 1.5);
|
||||||
HerobrineAI.HerobrineNPC.lookAtPoint(ploc);
|
HerobrineAI.HerobrineNPC.lookAtPoint(ploc);
|
||||||
if (ticks == 1) {
|
if (ticks == 1) {
|
||||||
HerobrineAI.HerobrineNPC.moveTo(new Location(Bukkit.getServer().getWorld("world_herobrineai_graveyard"),-2.49,4,-4.12));
|
HerobrineAI.HerobrineNPC.moveTo(
|
||||||
}
|
new Location(Bukkit.getServer().getWorld("world_herobrineai_graveyard"), -2.49, 4, -4.12));
|
||||||
else if (ticks==40){
|
} else if (ticks == 40) {
|
||||||
HerobrineAI.HerobrineNPC.moveTo(new Location(Bukkit.getServer().getWorld("world_herobrineai_graveyard"),-2.49,4,-0.5));
|
HerobrineAI.HerobrineNPC.moveTo(
|
||||||
|
new Location(Bukkit.getServer().getWorld("world_herobrineai_graveyard"), -2.49, 4, -0.5));
|
||||||
} else if (ticks == 60) {
|
} else if (ticks == 60) {
|
||||||
HerobrineAI.HerobrineNPC.moveTo(new Location(Bukkit.getServer().getWorld("world_herobrineai_graveyard"),-2.49,4,5.1));
|
HerobrineAI.HerobrineNPC.moveTo(
|
||||||
|
new Location(Bukkit.getServer().getWorld("world_herobrineai_graveyard"), -2.49, 4, 5.1));
|
||||||
|
|
||||||
} else if (ticks == 84) {
|
} else if (ticks == 84) {
|
||||||
HerobrineAI.HerobrineNPC.moveTo(new Location(Bukkit.getServer().getWorld("world_herobrineai_graveyard"),-2.49,4,7.5));
|
HerobrineAI.HerobrineNPC.moveTo(
|
||||||
|
new Location(Bukkit.getServer().getWorld("world_herobrineai_graveyard"), -2.49, 4, 7.5));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (new Random().nextInt(4)==1){
|
Random randomGen = Utils.getRandomGen();
|
||||||
Location newloc = new Location(Bukkit.getServer().getWorld("world_herobrineai_graveyard"),(double)new Random().nextInt(400),(double)new Random().nextInt(20)+20,(double)new Random().nextInt(400));
|
|
||||||
|
if (randomGen.nextInt(4) == 1) {
|
||||||
|
Location newloc = new Location(Bukkit.getServer().getWorld("world_herobrineai_graveyard"),
|
||||||
|
(double) randomGen.nextInt(400), (double) Utils.getRandomGen().nextInt(20) + 20,
|
||||||
|
(double) randomGen.nextInt(400));
|
||||||
Bukkit.getServer().getWorld("world_herobrineai_graveyard").strikeLightning(newloc);
|
Bukkit.getServer().getWorld("world_herobrineai_graveyard").strikeLightning(newloc);
|
||||||
}
|
}
|
||||||
ticks++;
|
ticks++;
|
||||||
|
@ -1,31 +1,39 @@
|
|||||||
package org.jakub1221.herobrineai.AI.cores;
|
package org.jakub1221.herobrineai.AI.cores;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.CreatureType;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Wolf;
|
import org.bukkit.entity.Wolf;
|
||||||
import org.jakub1221.herobrineai.HerobrineAI;
|
import org.jakub1221.herobrineai.HerobrineAI;
|
||||||
|
import org.jakub1221.herobrineai.Utils;
|
||||||
import org.jakub1221.herobrineai.AI.AICore;
|
import org.jakub1221.herobrineai.AI.AICore;
|
||||||
import org.jakub1221.herobrineai.AI.Core;
|
import org.jakub1221.herobrineai.AI.Core;
|
||||||
import org.jakub1221.herobrineai.AI.CoreResult;
|
import org.jakub1221.herobrineai.AI.CoreResult;
|
||||||
|
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
public class Haunt extends Core {
|
public class Haunt extends Core {
|
||||||
|
|
||||||
private int _ticks = 0;
|
private int _ticks = 0;
|
||||||
private int ticksToEnd = 0;
|
|
||||||
private int spawnedWolves = 0;
|
private int spawnedWolves = 0;
|
||||||
private int spawnedBats = 0;
|
private int spawnedBats = 0;
|
||||||
private int KL_INT = 0;
|
private int KL_INT = 0;
|
||||||
private int PS_INT = 0;
|
private int PS_INT = 0;
|
||||||
private boolean isHandler = false;
|
private boolean isHandler = false;
|
||||||
|
private boolean isFirst = true;
|
||||||
|
|
||||||
public Haunt() {
|
public Haunt() {
|
||||||
super(CoreType.HAUNT,AppearType.APPEAR);
|
super(CoreType.HAUNT, AppearType.APPEAR, HerobrineAI.getPluginCore());
|
||||||
}
|
}
|
||||||
|
|
||||||
public CoreResult CallCore(Object[] data) {
|
public CoreResult CallCore(Object[] data) {
|
||||||
@ -33,12 +41,14 @@ public class Haunt extends Core{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public CoreResult setHauntTarget(Player player) {
|
public CoreResult setHauntTarget(Player player) {
|
||||||
if (HerobrineAI.getPluginCore().getSupport().checkHaunt(player.getLocation())){
|
if (PluginCore.getSupport().checkHaunt(player.getLocation())) {
|
||||||
|
if (!PluginCore.canAttackPlayerNoMSG(player)) {
|
||||||
|
return new CoreResult(false, "This player is protected.");
|
||||||
|
}
|
||||||
spawnedWolves = 0;
|
spawnedWolves = 0;
|
||||||
spawnedBats = 0;
|
spawnedBats = 0;
|
||||||
_ticks = 0;
|
_ticks = 0;
|
||||||
ticksToEnd=0;
|
isFirst = true;
|
||||||
AICore.isTarget = true;
|
AICore.isTarget = true;
|
||||||
AICore.PlayerTarget = player;
|
AICore.PlayerTarget = player;
|
||||||
AICore.log.info("[HerobrineAI] Hauntig player!");
|
AICore.log.info("[HerobrineAI] Hauntig player!");
|
||||||
@ -75,42 +85,45 @@ public class Haunt extends Core{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void PlaySounds() {
|
public void PlaySounds() {
|
||||||
if (AICore.PlayerTarget.isOnline() && AICore.isTarget && HerobrineAI.getPluginCore().getAICore().getCoreTypeNow()==CoreType.HAUNT){
|
if (AICore.PlayerTarget.isOnline() && AICore.isTarget
|
||||||
|
&& PluginCore.getAICore().getCoreTypeNow() == CoreType.HAUNT) {
|
||||||
if (AICore.PlayerTarget.isDead() == false) {
|
if (AICore.PlayerTarget.isDead() == false) {
|
||||||
if (ticksToEnd==35){HerobrineAI.getPluginCore().getAICore().CancelTarget(CoreType.HAUNT);}else{
|
if (_ticks > 290) {
|
||||||
ticksToEnd++;
|
PluginCore.getAICore().CancelTarget(CoreType.HAUNT);
|
||||||
|
} else {
|
||||||
|
|
||||||
Object[] data = { AICore.PlayerTarget };
|
Object[] data = { AICore.PlayerTarget };
|
||||||
HerobrineAI.getPluginCore().getAICore().getCore(CoreType.SOUNDF).RunCore(data);
|
PluginCore.getAICore().getCore(CoreType.SOUNDF).RunCore(data);
|
||||||
|
|
||||||
Location ploc = (Location) AICore.PlayerTarget.getLocation();
|
Location ploc = (Location) AICore.PlayerTarget.getLocation();
|
||||||
|
|
||||||
Random randxgen = new Random();
|
Random randxgen = Utils.getRandomGen();
|
||||||
int randx = randxgen.nextInt(100);
|
int randx = randxgen.nextInt(100);
|
||||||
if (randx<70){}
|
if (randx < 70) {
|
||||||
else if (randx<80 && spawnedBats<=3){
|
} else if (randx < 80 && spawnedBats < 2) {
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().SpawnBats){
|
if (PluginCore.getConfigDB().SpawnBats) {
|
||||||
ploc.getWorld().spawnEntity(ploc, EntityType.BAT);
|
ploc.getWorld().spawnEntity(ploc, EntityType.BAT);
|
||||||
spawnedBats++;
|
spawnedBats++;
|
||||||
}
|
}
|
||||||
}else if (randx<90 && spawnedWolves<=2){
|
} else if (randx < 90 && spawnedWolves < 1) {
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().SpawnWolves){
|
if (PluginCore.getConfigDB().SpawnWolves) {
|
||||||
Wolf wolf = (Wolf) ploc.getWorld().spawnCreature(ploc, CreatureType.WOLF);
|
Wolf wolf = (Wolf) ploc.getWorld().spawnEntity(ploc, EntityType.WOLF);
|
||||||
wolf.setAdult();
|
wolf.setAdult();
|
||||||
wolf.setAngry(true);
|
wolf.setAngry(true);
|
||||||
spawnedWolves++;
|
spawnedWolves++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().Lighting==true){
|
if (PluginCore.getConfigDB().Lighting == true) {
|
||||||
|
|
||||||
int lchance= new Random().nextInt(100);
|
int lchance = randxgen.nextInt(100);
|
||||||
|
|
||||||
if (lchance > 75) {
|
if (lchance > 75) {
|
||||||
Location newloc = (Location) ploc;
|
Location newloc = (Location) ploc;
|
||||||
|
|
||||||
int randz= new Random().nextInt(50);
|
int randz = randxgen.nextInt(50);
|
||||||
int randxp= new Random().nextInt(1);
|
int randxp = randxgen.nextInt(1);
|
||||||
int randzp= new Random().nextInt(1);
|
int randzp = randxgen.nextInt(1);
|
||||||
|
|
||||||
if (randxp == 1) {
|
if (randxp == 1) {
|
||||||
newloc.setX(newloc.getX() + randx);
|
newloc.setX(newloc.getX() + randx);
|
||||||
@ -128,40 +141,51 @@ public class Haunt extends Core{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isFirst) {
|
||||||
if (ticksToEnd==1){
|
|
||||||
Object[] data2 = { AICore.PlayerTarget.getLocation() };
|
Object[] data2 = { AICore.PlayerTarget.getLocation() };
|
||||||
HerobrineAI.getPluginCore().getAICore().getCore(CoreType.BUILD_STUFF).RunCore(data2);}
|
PluginCore.getAICore().getCore(CoreType.BUILD_STUFF).RunCore(data2);
|
||||||
|
}
|
||||||
|
isFirst = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
PluginCore.getAICore().CancelTarget(CoreType.HAUNT);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
PluginCore.getAICore().CancelTarget(CoreType.HAUNT);
|
||||||
}
|
}
|
||||||
}else{HerobrineAI.getPluginCore().getAICore().CancelTarget(CoreType.HAUNT);}
|
|
||||||
}else{HerobrineAI.getPluginCore().getAICore().CancelTarget(CoreType.HAUNT);}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void KeepLookingHaunt() {
|
public void KeepLookingHaunt() {
|
||||||
if (AICore.PlayerTarget.isOnline() && AICore.isTarget && HerobrineAI.getPluginCore().getAICore().getCoreTypeNow()==CoreType.HAUNT){
|
if (AICore.PlayerTarget.isOnline() && AICore.isTarget
|
||||||
|
&& PluginCore.getAICore().getCoreTypeNow() == CoreType.HAUNT) {
|
||||||
if (AICore.PlayerTarget.isDead() == false) {
|
if (AICore.PlayerTarget.isDead() == false) {
|
||||||
|
|
||||||
Location loc = (Location) HerobrineAI.HerobrineNPC.getBukkitEntity().getLocation();
|
Location loc = (Location) HerobrineAI.HerobrineNPC.getBukkitEntity().getLocation();
|
||||||
|
|
||||||
Player [] AllOnPlayers = Bukkit.getServer().getOnlinePlayers();
|
if (Bukkit.getServer().getOnlinePlayers().size() > 0) {
|
||||||
if (Bukkit.getServer().getOnlinePlayers().length>0){
|
|
||||||
int i = 0;
|
|
||||||
for (i=0;i<=Bukkit.getServer().getOnlinePlayers().length-1;i++){
|
|
||||||
if (AllOnPlayers[i].getEntityId()!=HerobrineAI.HerobrineEntityID){
|
|
||||||
Location ploc = (Location) AllOnPlayers[i].getLocation();
|
|
||||||
|
|
||||||
if (ploc.getWorld() == loc.getWorld() && ploc.getX()+5>loc.getX() && ploc.getX()-5<loc.getX() && ploc.getZ()+5>loc.getZ() && ploc.getZ()-5<loc.getZ() && ploc.getY()+5>loc.getY() && ploc.getY()-5<loc.getY()){
|
|
||||||
HerobrineAI.getPluginCore().getAICore().DisappearEffect();
|
|
||||||
|
|
||||||
|
|
||||||
|
Player player = Utils.getRandomPlayer();
|
||||||
|
|
||||||
|
if(player == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Location ploc = (Location) player.getLocation();
|
||||||
|
|
||||||
|
if (ploc.getWorld() == loc.getWorld()
|
||||||
|
&& ploc.getX() + 5 > loc.getX()
|
||||||
|
&& ploc.getX() - 5 < loc.getX()
|
||||||
|
&& ploc.getZ() + 5 > loc.getZ()
|
||||||
|
&& ploc.getZ() - 5 < loc.getZ()
|
||||||
|
&& ploc.getY() + 5 > loc.getY()
|
||||||
|
&& ploc.getY() - 5 < loc.getY()) {
|
||||||
|
|
||||||
|
PluginCore.getAICore().DisappearEffect();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HerobrineAI.HerobrineHP = HerobrineAI.HerobrineMaxHP;
|
HerobrineAI.HerobrineHP = HerobrineAI.HerobrineMaxHP;
|
||||||
@ -171,34 +195,47 @@ public class Haunt extends Core{
|
|||||||
|
|
||||||
_ticks++;
|
_ticks++;
|
||||||
|
|
||||||
if (_ticks==0){HauntTP();}else if (_ticks==20){HerobrineAI.getPluginCore().getAICore().DisappearEffect();}else if (_ticks==30){HauntTP();}else if (_ticks==50){HerobrineAI.getPluginCore().getAICore().DisappearEffect();}else if (_ticks==60){HauntTP();}
|
AICore _aicore = PluginCore.getAICore();
|
||||||
else if (_ticks==80){HerobrineAI.getPluginCore().getAICore().DisappearEffect();}else if (_ticks==90){HauntTP();}else if (_ticks==115){HerobrineAI.getPluginCore().getAICore().DisappearEffect();}else if (_ticks==120){HauntTP();}else if (_ticks==140){HerobrineAI.getPluginCore().getAICore().DisappearEffect();}
|
|
||||||
else if (_ticks==145){HauntTP();}else if (_ticks==170){HerobrineAI.getPluginCore().getAICore().DisappearEffect();}else if (_ticks==175){HauntTP();}else if (_ticks==190){HerobrineAI.getPluginCore().getAICore().DisappearEffect();}
|
if(_ticks % 30 == 0)
|
||||||
|
HauntTP();
|
||||||
|
else if(_ticks % 20 == 0)
|
||||||
|
_aicore.DisappearEffect();
|
||||||
|
|
||||||
|
|
||||||
}else{HerobrineAI.getPluginCore().getAICore().CancelTarget(CoreType.HAUNT);}
|
} else {
|
||||||
}else{HerobrineAI.getPluginCore().getAICore().CancelTarget(CoreType.HAUNT);}
|
PluginCore.getAICore().CancelTarget(CoreType.HAUNT);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
PluginCore.getAICore().CancelTarget(CoreType.HAUNT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HauntTP() {
|
public void HauntTP() {
|
||||||
if (AICore.PlayerTarget.isOnline() && AICore.isTarget && HerobrineAI.getPluginCore().getAICore().getCoreTypeNow()==CoreType.HAUNT){
|
if (AICore.PlayerTarget.isOnline() && AICore.isTarget
|
||||||
|
&& PluginCore.getAICore().getCoreTypeNow() == CoreType.HAUNT) {
|
||||||
if (AICore.PlayerTarget.isDead() == false) {
|
if (AICore.PlayerTarget.isDead() == false) {
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().useWorlds.contains(AICore.PlayerTarget.getWorld().getName())){
|
if (PluginCore.getConfigDB().useWorlds
|
||||||
|
.contains(AICore.PlayerTarget.getWorld().getName())) {
|
||||||
|
|
||||||
FindPlace(AICore.PlayerTarget);
|
FindAndTeleport(AICore.PlayerTarget);
|
||||||
Location ploc = (Location) AICore.PlayerTarget.getLocation();
|
Location ploc = (Location) AICore.PlayerTarget.getLocation();
|
||||||
ploc.setY(ploc.getY() + 1.5);
|
ploc.setY(ploc.getY() + 1.5);
|
||||||
HerobrineAI.HerobrineNPC.lookAtPoint(ploc);
|
HerobrineAI.HerobrineNPC.lookAtPoint(ploc);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
PluginCore.getAICore().CancelTarget(CoreType.HAUNT);
|
||||||
}else{HerobrineAI.getPluginCore().getAICore().CancelTarget(CoreType.HAUNT);}
|
}
|
||||||
}else{HerobrineAI.getPluginCore().getAICore().CancelTarget(CoreType.HAUNT);}
|
} else {
|
||||||
}else{HerobrineAI.getPluginCore().getAICore().CancelTarget(CoreType.HAUNT);}
|
PluginCore.getAICore().CancelTarget(CoreType.HAUNT);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
PluginCore.getAICore().CancelTarget(CoreType.HAUNT);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean FindPlace(Player player){
|
public boolean FindAndTeleport(Player player) {
|
||||||
|
|
||||||
Location loc = (Location) player.getLocation();
|
Location loc = (Location) player.getLocation();
|
||||||
|
|
||||||
@ -206,19 +243,42 @@ public boolean FindPlace(Player player){
|
|||||||
int z = 0;
|
int z = 0;
|
||||||
int y = 0;
|
int y = 0;
|
||||||
|
|
||||||
int xMax=new Random().nextInt(10)-7;
|
Random randGen = Utils.getRandomGen();
|
||||||
int zMax=new Random().nextInt(10)-7;
|
|
||||||
|
|
||||||
|
int xMax = randGen.nextInt(10) + 10;
|
||||||
|
int zMax = randGen.nextInt(10) + 10;
|
||||||
|
int randY = randGen.nextInt(5) + 5;
|
||||||
|
xMax = randGen.nextBoolean() ? -xMax : xMax;
|
||||||
|
zMax = randGen.nextBoolean() ? -zMax : zMax;
|
||||||
|
|
||||||
|
for (y = -randY; y <= randY; y++) {
|
||||||
|
|
||||||
for(y=-5;y<=5;y++){
|
for (x = -xMax; xMax > 0 ? x <= xMax : x >= xMax; x += xMax > 0 ? 1 : -1) {
|
||||||
for(x=xMax;x<=10;x++){
|
for (z = -zMax; zMax > 0 ? z <= zMax : z >= zMax; z += zMax > 0 ? 1 : -1) {
|
||||||
for(z=zMax;z<=10;z++){
|
if (!(x >= -4 && x <= 4 && z >= -4 && z <= 4)) {
|
||||||
|
|
||||||
if (HerobrineAI.StandBlocks.contains(loc.getWorld().getBlockAt(x+loc.getBlockX(), y+loc.getBlockY()-1, z+loc.getBlockZ()).getType())){
|
Material blockBottom = loc.getWorld().getBlockAt(
|
||||||
if (HerobrineAI.AllowedBlocks.contains(loc.getWorld().getBlockAt(x+loc.getBlockX(), y+loc.getBlockY(), z+loc.getBlockZ()).getType())){
|
x + loc.getBlockX(),
|
||||||
if (HerobrineAI.AllowedBlocks.contains(loc.getWorld().getBlockAt(x+loc.getBlockX(), y+loc.getBlockY()+1, z+loc.getBlockZ()).getType())){
|
y + loc.getBlockY() - 1,
|
||||||
|
z + loc.getBlockZ()).getType();
|
||||||
|
Material blockMiddle = loc.getWorld().getBlockAt(
|
||||||
|
x + loc.getBlockX(),
|
||||||
|
y + loc.getBlockY(),
|
||||||
|
z + loc.getBlockZ()).getType();
|
||||||
|
|
||||||
|
Material blockTop = loc.getWorld().getBlockAt(
|
||||||
|
x + loc.getBlockX(),
|
||||||
|
y + loc.getBlockY() + 1,
|
||||||
|
z + loc.getBlockZ()).getType();
|
||||||
|
|
||||||
|
List<Material> mats = new ArrayList<Material>();
|
||||||
|
mats.add(blockBottom);
|
||||||
|
mats.add(blockMiddle);
|
||||||
|
mats.add(blockTop);
|
||||||
|
|
||||||
|
if (HerobrineAI.StandBlocks.containsAll(mats)){
|
||||||
Teleport(loc.getWorld(), x + loc.getBlockX(), y + loc.getBlockY(), z + loc.getBlockZ());
|
Teleport(loc.getWorld(), x + loc.getBlockX(), y + loc.getBlockY(), z + loc.getBlockZ());
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -227,12 +287,6 @@ public boolean FindPlace(Player player){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -249,6 +303,3 @@ public boolean FindPlace(Player player){
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.jakub1221.herobrineai.HerobrineAI;
|
import org.jakub1221.herobrineai.HerobrineAI;
|
||||||
|
import org.jakub1221.herobrineai.Utils;
|
||||||
import org.jakub1221.herobrineai.AI.AICore;
|
import org.jakub1221.herobrineai.AI.AICore;
|
||||||
import org.jakub1221.herobrineai.AI.Core;
|
import org.jakub1221.herobrineai.AI.Core;
|
||||||
import org.jakub1221.herobrineai.AI.CoreResult;
|
import org.jakub1221.herobrineai.AI.CoreResult;
|
||||||
@ -21,15 +22,15 @@ public class Heads extends Core{
|
|||||||
private List<Block> headList = new ArrayList<Block>();
|
private List<Block> headList = new ArrayList<Block>();
|
||||||
|
|
||||||
public Heads() {
|
public Heads() {
|
||||||
super(CoreType.HEADS,AppearType.NORMAL);
|
super(CoreType.HEADS, AppearType.NORMAL, HerobrineAI.getPluginCore());
|
||||||
}
|
}
|
||||||
|
|
||||||
public CoreResult CallCore(Object[] data) {
|
public CoreResult CallCore(Object[] data) {
|
||||||
if (isCalled == false) {
|
if (isCalled == false) {
|
||||||
if (Bukkit.getPlayer((String) data[0]).isOnline()) {
|
if (Bukkit.getPlayer((String) data[0]).isOnline()) {
|
||||||
Player player = (Player) Bukkit.getServer().getPlayer((String) data[0]);
|
Player player = (Player) Bukkit.getServer().getPlayer((String) data[0]);
|
||||||
if(HerobrineAI.getPluginCore().getSupport().checkBuild(player.getLocation())){
|
if (PluginCore.getSupport().checkBuild(player.getLocation())) {
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().UseHeads){
|
if (PluginCore.getConfigDB().UseHeads) {
|
||||||
|
|
||||||
Location loc = player.getLocation();
|
Location loc = player.getLocation();
|
||||||
int px = loc.getBlockX();
|
int px = loc.getBlockX();
|
||||||
@ -37,9 +38,12 @@ public class Heads extends Core{
|
|||||||
int y = 0;
|
int y = 0;
|
||||||
int x = -7;
|
int x = -7;
|
||||||
int z = -7;
|
int z = -7;
|
||||||
|
|
||||||
|
Random randomGen = Utils.getRandomGen();
|
||||||
|
|
||||||
for (x = -7; x <= 7; x++) {
|
for (x = -7; x <= 7; x++) {
|
||||||
for (z = -7; z <= 7; z++) {
|
for (z = -7; z <= 7; z++) {
|
||||||
if(new Random().nextInt(7) == new Random().nextInt(7)){
|
if (randomGen.nextInt(7) == randomGen.nextInt(7)) {
|
||||||
|
|
||||||
if (HerobrineAI.NonStandBlocks.contains(loc.getWorld().getHighestBlockAt(px + x, pz + z).getType())) {
|
if (HerobrineAI.NonStandBlocks.contains(loc.getWorld().getHighestBlockAt(px + x, pz + z).getType())) {
|
||||||
y = loc.getWorld().getHighestBlockYAt(px + x, pz + z);
|
y = loc.getWorld().getHighestBlockYAt(px + x, pz + z);
|
||||||
@ -65,9 +69,15 @@ public class Heads extends Core{
|
|||||||
|
|
||||||
return new CoreResult(true, "Spawned some heads near " + player.getName() + "!");
|
return new CoreResult(true, "Spawned some heads near " + player.getName() + "!");
|
||||||
|
|
||||||
}else{return new CoreResult(false,"Heads are disabled!");}
|
} else {
|
||||||
}else{return new CoreResult(false,"Player is in secure area!");}
|
return new CoreResult(false, "Heads are disabled!");
|
||||||
}else{return new CoreResult(false,"Player is offline.");}
|
}
|
||||||
|
} else {
|
||||||
|
return new CoreResult(false, "Player is in secure area!");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return new CoreResult(false, "Player is offline.");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return new CoreResult(false, "There are already heads! Wait until they disappear.");
|
return new CoreResult(false, "There are already heads! Wait until they disappear.");
|
||||||
}
|
}
|
||||||
@ -80,6 +90,7 @@ public class Heads extends Core{
|
|||||||
headList.clear();
|
headList.clear();
|
||||||
isCalled = false;
|
isCalled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Block> getHeadList() {
|
public ArrayList<Block> getHeadList() {
|
||||||
return (ArrayList<Block>) headList;
|
return (ArrayList<Block>) headList;
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.jakub1221.herobrineai.HerobrineAI;
|
import org.jakub1221.herobrineai.HerobrineAI;
|
||||||
|
import org.jakub1221.herobrineai.Utils;
|
||||||
import org.jakub1221.herobrineai.AI.AICore;
|
import org.jakub1221.herobrineai.AI.AICore;
|
||||||
import org.jakub1221.herobrineai.AI.Core;
|
import org.jakub1221.herobrineai.AI.Core;
|
||||||
import org.jakub1221.herobrineai.AI.CoreResult;
|
import org.jakub1221.herobrineai.AI.CoreResult;
|
||||||
@ -15,7 +16,7 @@ import org.jakub1221.herobrineai.AI.CoreResult;
|
|||||||
public class Pyramid extends Core {
|
public class Pyramid extends Core {
|
||||||
|
|
||||||
public Pyramid() {
|
public Pyramid() {
|
||||||
super(CoreType.PYRAMID,AppearType.NORMAL);
|
super(CoreType.PYRAMID, AppearType.NORMAL, HerobrineAI.getPluginCore());
|
||||||
}
|
}
|
||||||
|
|
||||||
public CoreResult CallCore(Object[] data) {
|
public CoreResult CallCore(Object[] data) {
|
||||||
@ -27,7 +28,7 @@ public class Pyramid extends Core{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public CoreResult FindPlace(Chunk chunk) {
|
public CoreResult FindPlace(Chunk chunk) {
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().BuildPyramids){
|
if (PluginCore.getConfigDB().BuildPyramids) {
|
||||||
|
|
||||||
Location loc = chunk.getBlock(2, 0, 2).getLocation();
|
Location loc = chunk.getBlock(2, 0, 2).getLocation();
|
||||||
loc = loc.getWorld().getHighestBlockAt(loc).getLocation();
|
loc = loc.getWorld().getHighestBlockAt(loc).getLocation();
|
||||||
@ -44,19 +45,38 @@ public class Pyramid extends Core{
|
|||||||
|
|
||||||
canBuild = true;
|
canBuild = true;
|
||||||
|
|
||||||
|
|
||||||
for (i4 = -1; i4 <= 3; i4++) {// Y
|
for (i4 = -1; i4 <= 3; i4++) {// Y
|
||||||
for (i5 = -2; i5 <= 2; i5++) {// X
|
for (i5 = -2; i5 <= 2; i5++) {// X
|
||||||
for (i6 = -2; i6 <= 2; i6++) {// Z
|
for (i6 = -2; i6 <= 2; i6++) {// Z
|
||||||
|
|
||||||
if (loc.getBlockX()==i2+i5+loc.getBlockX() && loc.getBlockY()==i1+i4+loc.getBlockY() && loc.getBlockZ()==i3+i6+loc.getBlockZ()){canBuild=false;}
|
if (loc.getBlockX() == i2 + i5 + loc.getBlockX()
|
||||||
|
&& loc.getBlockY() == i1 + i4 + loc.getBlockY()
|
||||||
|
&& loc.getBlockZ() == i3 + i6 + loc.getBlockZ()) {
|
||||||
|
canBuild = false;
|
||||||
|
}
|
||||||
if (i4 == -1) {
|
if (i4 == -1) {
|
||||||
if (canBuild == true) {
|
if (canBuild == true) {
|
||||||
if (HerobrineAI.StandBlocks.contains(loc.getWorld().getBlockAt(i2+i5+loc.getBlockX(), i1+i4+loc.getBlockY(), i3+i6+loc.getBlockZ()).getType())){canBuild=true;}else{canBuild=false;}
|
if (HerobrineAI.StandBlocks
|
||||||
|
.contains(loc
|
||||||
|
.getWorld().getBlockAt(i2 + i5 + loc.getBlockX(),
|
||||||
|
i1 + i4 + loc.getBlockY(), i3 + i6 + loc.getBlockZ())
|
||||||
|
.getType())) {
|
||||||
|
canBuild = true;
|
||||||
|
} else {
|
||||||
|
canBuild = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (canBuild == true) {
|
if (canBuild == true) {
|
||||||
if (HerobrineAI.NonStandBlocks.contains(loc.getWorld().getBlockAt(i2+i5+loc.getBlockX(), i1+i4+loc.getBlockY(), i3+i6+loc.getBlockZ()).getType())){canBuild=true;}else{canBuild=false;}
|
if (HerobrineAI.NonStandBlocks
|
||||||
|
.contains(loc
|
||||||
|
.getWorld().getBlockAt(i2 + i5 + loc.getBlockX(),
|
||||||
|
i1 + i4 + loc.getBlockY(), i3 + i6 + loc.getBlockZ())
|
||||||
|
.getType())) {
|
||||||
|
canBuild = true;
|
||||||
|
} else {
|
||||||
|
canBuild = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -69,14 +89,8 @@ public class Pyramid extends Core{
|
|||||||
BuildPyramid(loc.getWorld(), i2 + loc.getBlockX(), i1 + loc.getBlockY(), i3 + loc.getBlockZ());
|
BuildPyramid(loc.getWorld(), i2 + loc.getBlockX(), i1 + loc.getBlockY(), i3 + loc.getBlockZ());
|
||||||
return new CoreResult(true, "Creating a pyramid!");
|
return new CoreResult(true, "Creating a pyramid!");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new CoreResult(false, "Cannot create a pyramid!");
|
return new CoreResult(false, "Cannot create a pyramid!");
|
||||||
@ -84,8 +98,7 @@ public class Pyramid extends Core{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public CoreResult FindPlace(Player player) {
|
public CoreResult FindPlace(Player player) {
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().BuildPyramids){
|
if (PluginCore.getConfigDB().BuildPyramids) {
|
||||||
|
|
||||||
|
|
||||||
Location loc = (Location) player.getLocation();
|
Location loc = (Location) player.getLocation();
|
||||||
|
|
||||||
@ -97,27 +110,44 @@ if (HerobrineAI.getPluginCore().getConfigDB().BuildPyramids){
|
|||||||
int i5 = 0;
|
int i5 = 0;
|
||||||
int i6 = 0;
|
int i6 = 0;
|
||||||
|
|
||||||
int xMax=new Random().nextInt(15)-10;
|
int xMax = Utils.getRandomGen().nextInt(15) - 10;
|
||||||
int zMax=new Random().nextInt(15)-10;
|
int zMax = Utils.getRandomGen().nextInt(15) - 10;
|
||||||
|
|
||||||
for (i1 = -5; i1 <= 5; i1++) {// Y
|
for (i1 = -5; i1 <= 5; i1++) {// Y
|
||||||
for (i2 = xMax; i2 <= 15; i2++) {// X
|
for (i2 = xMax; i2 <= 15; i2++) {// X
|
||||||
for (i3 = zMax; i3 <= 15; i3++) {// Z
|
for (i3 = zMax; i3 <= 15; i3++) {// Z
|
||||||
canBuild = true;
|
canBuild = true;
|
||||||
|
|
||||||
|
|
||||||
for (i4 = -1; i4 <= 3; i4++) {// Y
|
for (i4 = -1; i4 <= 3; i4++) {// Y
|
||||||
for (i5 = -2; i5 <= 2; i5++) {// X
|
for (i5 = -2; i5 <= 2; i5++) {// X
|
||||||
for (i6 = -2; i6 <= 2; i6++) {// Z
|
for (i6 = -2; i6 <= 2; i6++) {// Z
|
||||||
|
|
||||||
if (player.getLocation().getBlockX()==i2+i5+loc.getBlockX() && player.getLocation().getBlockY()==i1+i4+loc.getBlockY() && player.getLocation().getBlockZ()==i3+i6+loc.getBlockZ()){canBuild=false;}
|
if (player.getLocation().getBlockX() == i2 + i5 + loc.getBlockX()
|
||||||
|
&& player.getLocation().getBlockY() == i1 + i4 + loc.getBlockY()
|
||||||
|
&& player.getLocation().getBlockZ() == i3 + i6 + loc.getBlockZ()) {
|
||||||
|
canBuild = false;
|
||||||
|
}
|
||||||
if (i4 == -1) {
|
if (i4 == -1) {
|
||||||
if (canBuild == true) {
|
if (canBuild == true) {
|
||||||
if (HerobrineAI.StandBlocks.contains(loc.getWorld().getBlockAt(i2+i5+loc.getBlockX(), i1+i4+loc.getBlockY(), i3+i6+loc.getBlockZ()).getType())){canBuild=true;}else{canBuild=false;}
|
if (HerobrineAI.StandBlocks.contains(loc
|
||||||
|
.getWorld().getBlockAt(i2 + i5 + loc.getBlockX(),
|
||||||
|
i1 + i4 + loc.getBlockY(), i3 + i6 + loc.getBlockZ())
|
||||||
|
.getType())) {
|
||||||
|
canBuild = true;
|
||||||
|
} else {
|
||||||
|
canBuild = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (canBuild == true) {
|
if (canBuild == true) {
|
||||||
if (HerobrineAI.NonStandBlocks.contains(loc.getWorld().getBlockAt(i2+i5+loc.getBlockX(), i1+i4+loc.getBlockY(), i3+i6+loc.getBlockZ()).getType())){canBuild=true;}else{canBuild=false;}
|
if (HerobrineAI.NonStandBlocks.contains(loc
|
||||||
|
.getWorld().getBlockAt(i2 + i5 + loc.getBlockX(),
|
||||||
|
i1 + i4 + loc.getBlockY(), i3 + i6 + loc.getBlockZ())
|
||||||
|
.getType())) {
|
||||||
|
canBuild = true;
|
||||||
|
} else {
|
||||||
|
canBuild = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -127,7 +157,13 @@ if (HerobrineAI.getPluginCore().getConfigDB().BuildPyramids){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (canBuild == true) {
|
if (canBuild == true) {
|
||||||
BuildPyramid(loc.getWorld(),i2+loc.getBlockX(),i1+loc.getBlockY(),i3+loc.getBlockZ());
|
BuildPyramid(
|
||||||
|
loc.getWorld(),
|
||||||
|
i2 + loc.getBlockX(),
|
||||||
|
i1 + loc.getBlockY(),
|
||||||
|
i3 + loc.getBlockZ()
|
||||||
|
);
|
||||||
|
|
||||||
return new CoreResult(true, "Creating a pyramid!");
|
return new CoreResult(true, "Creating a pyramid!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -136,7 +172,6 @@ if (HerobrineAI.getPluginCore().getConfigDB().BuildPyramids){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return new CoreResult(false, "Cannot create a pyramid!");
|
return new CoreResult(false, "Cannot create a pyramid!");
|
||||||
|
|
||||||
@ -150,6 +185,8 @@ return new CoreResult(false,"Cannot create a pyramid!");
|
|||||||
|
|
||||||
Material mainMat = (Material) Material.SANDSTONE;
|
Material mainMat = (Material) Material.SANDSTONE;
|
||||||
|
|
||||||
|
|
||||||
|
// TODO CHANGE THIS
|
||||||
// Level 1
|
// Level 1
|
||||||
world.getBlockAt(X, Y, Z).setType(mainMat);
|
world.getBlockAt(X, Y, Z).setType(mainMat);
|
||||||
world.getBlockAt(X - 2, Y, Z).setType(mainMat);
|
world.getBlockAt(X - 2, Y, Z).setType(mainMat);
|
||||||
|
@ -5,26 +5,27 @@ import java.util.Random;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.jakub1221.herobrineai.HerobrineAI;
|
import org.jakub1221.herobrineai.HerobrineAI;
|
||||||
|
import org.jakub1221.herobrineai.Utils;
|
||||||
import org.jakub1221.herobrineai.AI.Core;
|
import org.jakub1221.herobrineai.AI.Core;
|
||||||
import org.jakub1221.herobrineai.AI.CoreResult;
|
import org.jakub1221.herobrineai.AI.CoreResult;
|
||||||
|
|
||||||
public class RandomExplosion extends Core {
|
public class RandomExplosion extends Core {
|
||||||
|
|
||||||
public RandomExplosion() {
|
public RandomExplosion() {
|
||||||
super(CoreType.RANDOM_EXPLOSION,AppearType.NORMAL);
|
super(CoreType.RANDOM_EXPLOSION, AppearType.NORMAL, HerobrineAI.getPluginCore());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CoreResult CallCore(Object[] data) {
|
public CoreResult CallCore(Object[] data) {
|
||||||
|
|
||||||
Player player = (Player) data[0];
|
Player player = (Player) data[0];
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().Explosions){
|
if (PluginCore.getConfigDB().Explosions) {
|
||||||
if (HerobrineAI.getPluginCore().getSupport().checkBuild(player.getLocation())){
|
if (PluginCore.getSupport().checkBuild(player.getLocation())) {
|
||||||
|
|
||||||
Location loc = player.getLocation();
|
Location loc = player.getLocation();
|
||||||
int x=loc.getBlockX()+(new Random().nextInt(16)-8);
|
int x = loc.getBlockX() + (Utils.getRandomGen().nextInt(16) - 8);
|
||||||
int y = loc.getBlockY();
|
int y = loc.getBlockY();
|
||||||
int z=loc.getBlockZ()+(new Random().nextInt(16)-8);
|
int z = loc.getBlockZ() + (Utils.getRandomGen().nextInt(16) - 8);
|
||||||
loc.getWorld().createExplosion(new Location(loc.getWorld(), x, y, z), 1.0f);
|
loc.getWorld().createExplosion(new Location(loc.getWorld(), x, y, z), 1.0f);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package org.jakub1221.herobrineai.AI.cores;
|
package org.jakub1221.herobrineai.AI.cores;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -9,6 +10,7 @@ import org.bukkit.World;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.jakub1221.herobrineai.ConfigDB;
|
import org.jakub1221.herobrineai.ConfigDB;
|
||||||
import org.jakub1221.herobrineai.HerobrineAI;
|
import org.jakub1221.herobrineai.HerobrineAI;
|
||||||
|
import org.jakub1221.herobrineai.Utils;
|
||||||
import org.jakub1221.herobrineai.AI.AICore;
|
import org.jakub1221.herobrineai.AI.AICore;
|
||||||
import org.jakub1221.herobrineai.AI.Core;
|
import org.jakub1221.herobrineai.AI.Core;
|
||||||
import org.jakub1221.herobrineai.AI.CoreResult;
|
import org.jakub1221.herobrineai.AI.CoreResult;
|
||||||
@ -21,23 +23,34 @@ public class RandomPosition extends Core{
|
|||||||
private boolean RandomMoveIsPlayer = false;
|
private boolean RandomMoveIsPlayer = false;
|
||||||
|
|
||||||
public RandomPosition() {
|
public RandomPosition() {
|
||||||
super(CoreType.RANDOM_POSITION,AppearType.APPEAR);
|
super(CoreType.RANDOM_POSITION, AppearType.APPEAR, HerobrineAI.getPluginCore());
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRandomTicks(){return this.randomTicks;}
|
public int getRandomTicks() {
|
||||||
public int getRandomMoveTicks(){return this.randomMoveTicks;}
|
return this.randomTicks;
|
||||||
public void setRandomTicks(int i){this.randomTicks=i;};
|
}
|
||||||
public void setRandomMoveTicks(int i){this.randomMoveTicks=i;};
|
|
||||||
|
public int getRandomMoveTicks() {
|
||||||
|
return this.randomMoveTicks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRandomTicks(int i) {
|
||||||
|
this.randomTicks = i;
|
||||||
|
};
|
||||||
|
|
||||||
|
public void setRandomMoveTicks(int i) {
|
||||||
|
this.randomMoveTicks = i;
|
||||||
|
};
|
||||||
|
|
||||||
public CoreResult CallCore(Object[] data) {
|
public CoreResult CallCore(Object[] data) {
|
||||||
return setRandomPosition((World) data[0]);
|
return setRandomPosition((World) data[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CoreResult setRandomPosition(World world) {
|
public CoreResult setRandomPosition(World world) {
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().UseWalkingMode){
|
if (PluginCore.getConfigDB().UseWalkingMode) {
|
||||||
if (randomTicks != 3) {
|
if (randomTicks != 3) {
|
||||||
randomTicks++;
|
randomTicks++;
|
||||||
if (HerobrineAI.getPluginCore().getAICore().getCoreTypeNow() != CoreType.RANDOM_POSITION && AICore.isTarget==false){
|
if (PluginCore.getAICore().getCoreTypeNow() != CoreType.RANDOM_POSITION && AICore.isTarget == false) {
|
||||||
Location newloc = (Location) getRandomLocation(world);
|
Location newloc = (Location) getRandomLocation(world);
|
||||||
if (newloc != null) {
|
if (newloc != null) {
|
||||||
|
|
||||||
@ -47,12 +60,15 @@ public class RandomPosition extends Core{
|
|||||||
HerobrineAI.HerobrineNPC.lookAtPoint(newloc);
|
HerobrineAI.HerobrineNPC.lookAtPoint(newloc);
|
||||||
randomTicks = 0;
|
randomTicks = 0;
|
||||||
AICore.log.info("[HerobrineAI] Herobrine is now in RandomLocation mode.");
|
AICore.log.info("[HerobrineAI] Herobrine is now in RandomLocation mode.");
|
||||||
HerobrineAI.getPluginCore().getAICore().Start_RM();
|
PluginCore.getAICore().Start_RM();
|
||||||
HerobrineAI.getPluginCore().getAICore().Start_RS();
|
PluginCore.getAICore().Start_RS();
|
||||||
HerobrineAI.getPluginCore().getAICore().Start_CG();
|
PluginCore.getAICore().Start_CG();
|
||||||
RandomMoveIsPlayer = false;
|
RandomMoveIsPlayer = false;
|
||||||
return new CoreResult(true, "Herobrine is now in WalkingMode.");
|
return new CoreResult(true, "Herobrine is now in WalkingMode.");
|
||||||
}else{AICore.log.info("[HerobrineAI] RandomPosition Failed!");return setRandomPosition(world);}
|
} else {
|
||||||
|
AICore.log.info("[HerobrineAI] RandomPosition Failed!");
|
||||||
|
return setRandomPosition(world);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return new CoreResult(false, "WalkingMode - Find location failed!");
|
return new CoreResult(false, "WalkingMode - Find location failed!");
|
||||||
@ -66,33 +82,37 @@ public class RandomPosition extends Core{
|
|||||||
public Location getRandomLocation(World world) {
|
public Location getRandomLocation(World world) {
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (i=0;i<=300;i++){
|
for (i = 0; i <= 100; i++) {
|
||||||
|
|
||||||
int r_nxtX=HerobrineAI.getPluginCore().getConfigDB().WalkingModeXRadius;
|
int r_nxtX = PluginCore.getConfigDB().WalkingModeXRadius;
|
||||||
int nxtX = r_nxtX;
|
int nxtX = r_nxtX;
|
||||||
if (nxtX < 0) {
|
if (nxtX < 0) {
|
||||||
nxtX = -nxtX;
|
nxtX = -nxtX;
|
||||||
}
|
}
|
||||||
int r_nxtZ=HerobrineAI.getPluginCore().getConfigDB().WalkingModeZRadius;
|
int r_nxtZ = PluginCore.getConfigDB().WalkingModeZRadius;
|
||||||
int nxtZ = r_nxtZ;
|
int nxtZ = r_nxtZ;
|
||||||
if (nxtZ < 0) {
|
if (nxtZ < 0) {
|
||||||
nxtZ = -nxtZ;
|
nxtZ = -nxtZ;
|
||||||
}
|
}
|
||||||
int randx= new Random().nextInt(nxtX);
|
int randx = Utils.getRandomGen().nextInt(nxtX);
|
||||||
|
|
||||||
int randy = 0;
|
int randy = 0;
|
||||||
|
|
||||||
int randz= new Random().nextInt(nxtZ);
|
int randz = Utils.getRandomGen().nextInt(nxtZ);
|
||||||
|
|
||||||
int randxp= new Random().nextInt(1);
|
int randxp = Utils.getRandomGen().nextInt(1);
|
||||||
|
|
||||||
int randzp= new Random().nextInt(1);
|
int randzp = Utils.getRandomGen().nextInt(1);
|
||||||
|
|
||||||
if (randxp==0 && randx!=0){randx=-(randx);}
|
if (randxp == 0 && randx != 0) {
|
||||||
if (randzp==0 && randz!=0){randz=-(randz);}
|
randx = -(randx);
|
||||||
|
}
|
||||||
|
if (randzp == 0 && randz != 0) {
|
||||||
|
randz = -(randz);
|
||||||
|
}
|
||||||
|
|
||||||
randx=randx+HerobrineAI.getPluginCore().getConfigDB().WalkingModeFromXRadius;
|
randx = randx + PluginCore.getConfigDB().WalkingModeFromXRadius;
|
||||||
randz=randz+HerobrineAI.getPluginCore().getConfigDB().WalkingModeFromZRadius;
|
randz = randz + PluginCore.getConfigDB().WalkingModeFromZRadius;
|
||||||
|
|
||||||
if (world != null) {
|
if (world != null) {
|
||||||
randy = world.getHighestBlockYAt(randx, randz);
|
randy = world.getHighestBlockYAt(randx, randz);
|
||||||
@ -100,25 +120,27 @@ public class RandomPosition extends Core{
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (world.getBlockAt(randx, randy, randz).getType() == Material.AIR && world.getBlockAt(randx, randy+1, randz).getType() == Material.AIR){
|
if (world.getBlockAt(randx, randy, randz).getType() == Material.AIR
|
||||||
if (world.getBlockAt(randx, randy-1, randz).getType() != Material.AIR &&
|
&& world.getBlockAt(randx, randy + 1, randz).getType() == Material.AIR) {
|
||||||
world.getBlockAt(randx, randy-1, randz).getType() != Material.WATER &&
|
if (world.getBlockAt(randx, randy - 1, randz).getType() != Material.AIR
|
||||||
world.getBlockAt(randx, randy-1, randz).getType() != Material.LAVA &&
|
&& world.getBlockAt(randx, randy - 1, randz).getType() != Material.WATER
|
||||||
world.getBlockAt(randx, randy-1, randz).getType() != Material.GRASS &&
|
&& world.getBlockAt(randx, randy - 1, randz).getType() != Material.LAVA
|
||||||
world.getBlockAt(randx, randy-1, randz).getType() != Material.SNOW &&
|
&& world.getBlockAt(randx, randy - 1, randz).getType() != Material.GRASS
|
||||||
world.getBlockAt(randx, randy-1, randz).getType() != Material.LEAVES &&
|
&& world.getBlockAt(randx, randy - 1, randz).getType() != Material.SNOW
|
||||||
world.getBlockAt(randx, randy-1, randz).getType() != Material.WHEAT &&
|
&& world.getBlockAt(randx, randy - 1, randz).getType() != Material.LEAVES
|
||||||
world.getBlockAt(randx, randy-1, randz).getType() != Material.TORCH &&
|
&& world.getBlockAt(randx, randy - 1, randz).getType() != Material.WHEAT
|
||||||
world.getBlockAt(randx, randy-1, randz).getType() != Material.REDSTONE_TORCH_OFF &&
|
&& world.getBlockAt(randx, randy - 1, randz).getType() != Material.TORCH
|
||||||
world.getBlockAt(randx, randy-1, randz).getType() != Material.REDSTONE_TORCH_ON &&
|
&& world.getBlockAt(randx, randy - 1, randz).getType() != Material.REDSTONE_TORCH_OFF
|
||||||
world.getBlockAt(randx, randy-1, randz).getType() != Material.REDSTONE &&
|
&& world.getBlockAt(randx, randy - 1, randz).getType() != Material.REDSTONE_TORCH_ON
|
||||||
world.getBlockAt(randx, randy-1, randz).getType() != Material.STATIONARY_WATER &&
|
&& world.getBlockAt(randx, randy - 1, randz).getType() != Material.REDSTONE
|
||||||
world.getBlockAt(randx, randy-1, randz).getType() != Material.STATIONARY_LAVA){
|
&& world.getBlockAt(randx, randy - 1, randz).getType() != Material.STATIONARY_WATER
|
||||||
|
&& world.getBlockAt(randx, randy - 1, randz).getType() != Material.STATIONARY_LAVA) {
|
||||||
|
|
||||||
AICore.log.info("[HerobrineAI] RandomLocation "+world.getBlockAt(randx, randy-1, randz).getType().toString()+" is X:"+randx+" Y:"+randy+" Z:"+randz);
|
AICore.log.info("[HerobrineAI] RandomLocation "
|
||||||
|
+ world.getBlockAt(randx, randy - 1, randz).getType().toString() + " is X:" + randx + " Y:"
|
||||||
|
+ randy + " Z:" + randz);
|
||||||
return new Location(world, (float) randx + 0.5, (float) randy, (float) randz);
|
return new Location(world, (float) randx + 0.5, (float) randy, (float) randz);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -128,13 +150,15 @@ public class RandomPosition extends Core{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void RandomMove() {
|
public void RandomMove() {
|
||||||
if (HerobrineAI.getPluginCore().getAICore().getCoreTypeNow()==CoreType.RANDOM_POSITION && AICore.isTarget==false && RandomMoveIsPlayer==false){
|
if (PluginCore.getAICore().getCoreTypeNow() == CoreType.RANDOM_POSITION && AICore.isTarget == false
|
||||||
|
&& RandomMoveIsPlayer == false) {
|
||||||
HerobrineAI.HerobrineHP = HerobrineAI.HerobrineMaxHP;
|
HerobrineAI.HerobrineHP = HerobrineAI.HerobrineMaxHP;
|
||||||
|
|
||||||
if (new Random().nextInt(4)==1){
|
if (Utils.getRandomGen().nextInt(5) == 3) {
|
||||||
Location loc = HerobrineAI.HerobrineNPC.getBukkitEntity().getLocation();
|
Location loc = HerobrineAI.HerobrineNPC.getBukkitEntity().getLocation();
|
||||||
Path path = new Path((float)loc.getX()+new Random().nextInt(12)-6,(float)loc.getZ()+new Random().nextInt(12)-6);
|
Path path = new Path((float) loc.getX() + Utils.getRandomGen().nextInt(30) - 15,
|
||||||
HerobrineAI.getPluginCore().getPathManager().setPath(path);
|
(float) loc.getZ() + Utils.getRandomGen().nextInt(30) - 15);
|
||||||
|
PluginCore.getPathManager().setPath(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -143,13 +167,17 @@ public class RandomPosition extends Core{
|
|||||||
|
|
||||||
public void CheckGravity() {
|
public void CheckGravity() {
|
||||||
|
|
||||||
if (HerobrineAI.getPluginCore().getAICore().getCoreTypeNow()==CoreType.RANDOM_POSITION && AICore.isTarget==false){
|
if (PluginCore.getAICore().getCoreTypeNow() == CoreType.RANDOM_POSITION && AICore.isTarget == false) {
|
||||||
|
|
||||||
Location hbloc = (Location) HerobrineAI.HerobrineNPC.getBukkitEntity().getLocation();
|
Location hbloc = (Location) HerobrineAI.HerobrineNPC.getBukkitEntity().getLocation();
|
||||||
World w = (World) hbloc.getWorld();
|
World w = (World) hbloc.getWorld();
|
||||||
ConfigDB config = HerobrineAI.getPluginCore().getConfigDB();
|
ConfigDB config = PluginCore.getConfigDB();
|
||||||
if (hbloc.getBlockX()<config.WalkingModeXRadius+config.WalkingModeFromXRadius && hbloc.getBlockX()>(-config.WalkingModeXRadius)+config.WalkingModeFromXRadius && hbloc.getBlockZ()<config.WalkingModeZRadius+config.WalkingModeFromZRadius && hbloc.getBlockZ()>(-config.WalkingModeZRadius)+config.WalkingModeFromZRadius){
|
if (hbloc.getBlockX() < config.WalkingModeXRadius + config.WalkingModeFromXRadius
|
||||||
if (HerobrineAI.NonStandBlocks.contains(w.getBlockAt(hbloc.getBlockX(), hbloc.getBlockY()-1, hbloc.getBlockZ()).getType())){
|
&& hbloc.getBlockX() > (-config.WalkingModeXRadius) + config.WalkingModeFromXRadius
|
||||||
|
&& hbloc.getBlockZ() < config.WalkingModeZRadius + config.WalkingModeFromZRadius
|
||||||
|
&& hbloc.getBlockZ() > (-config.WalkingModeZRadius) + config.WalkingModeFromZRadius) {
|
||||||
|
if (HerobrineAI.NonStandBlocks.contains(
|
||||||
|
w.getBlockAt(hbloc.getBlockX(), hbloc.getBlockY() - 1, hbloc.getBlockZ()).getType())) {
|
||||||
|
|
||||||
hbloc.setY(hbloc.getY() - 1);
|
hbloc.setY(hbloc.getY() - 1);
|
||||||
|
|
||||||
@ -157,7 +185,7 @@ public class RandomPosition extends Core{
|
|||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
HerobrineAI.getPluginCore().getAICore().CancelTarget(CoreType.RANDOM_POSITION);
|
PluginCore.getAICore().CancelTarget(CoreType.RANDOM_POSITION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -165,24 +193,38 @@ public class RandomPosition extends Core{
|
|||||||
public void CheckPlayerPosition() {
|
public void CheckPlayerPosition() {
|
||||||
boolean isThere = false;
|
boolean isThere = false;
|
||||||
Location loc = (Location) HerobrineAI.HerobrineNPC.getBukkitEntity().getLocation();
|
Location loc = (Location) HerobrineAI.HerobrineNPC.getBukkitEntity().getLocation();
|
||||||
Player [] AllOnPlayers = Bukkit.getServer().getOnlinePlayers();
|
Collection<? extends Player> onlinePlayers = Bukkit.getServer().getOnlinePlayers();
|
||||||
if (Bukkit.getServer().getOnlinePlayers().length>0){
|
|
||||||
int i = 0;
|
if (Bukkit.getServer().getOnlinePlayers().size() > 0) {
|
||||||
for (i=0;i<=Bukkit.getServer().getOnlinePlayers().length-1;i++){
|
|
||||||
if (HerobrineAI.HerobrineEntityID!=AllOnPlayers[i].getEntityId()){
|
for (Player player : onlinePlayers) {
|
||||||
Location ploc = (Location) AllOnPlayers[i].getLocation();
|
|
||||||
if (ploc.getWorld() == loc.getWorld() && ploc.getX()+7>loc.getX() && ploc.getX()-7<loc.getX() && ploc.getZ()+7>loc.getZ() && ploc.getZ()-7<loc.getZ() && ploc.getY()+7>loc.getY() && ploc.getY()-7<loc.getY()){
|
if (HerobrineAI.HerobrineEntityID != player.getEntityId()) {
|
||||||
|
Location ploc = (Location) player.getLocation();
|
||||||
|
|
||||||
|
if (ploc.getWorld() == loc.getWorld() && ploc.getX() + 7 > loc.getX()
|
||||||
|
&& ploc.getX() - 7 < loc.getX() && ploc.getZ() + 7 > loc.getZ()
|
||||||
|
&& ploc.getZ() - 7 < loc.getZ() && ploc.getY() + 7 > loc.getY()
|
||||||
|
&& ploc.getY() - 7 < loc.getY()) {
|
||||||
|
|
||||||
loc.setY(-20);
|
loc.setY(-20);
|
||||||
HerobrineAI.HerobrineNPC.moveTo(loc);
|
HerobrineAI.HerobrineNPC.moveTo(loc);
|
||||||
HerobrineAI.getPluginCore().getAICore().CancelTarget(CoreType.RANDOM_POSITION);
|
PluginCore.getAICore().CancelTarget(CoreType.RANDOM_POSITION);
|
||||||
RandomMoveIsPlayer = false;
|
RandomMoveIsPlayer = false;
|
||||||
HerobrineAI.getPluginCore().getAICore().setAttackTarget(AllOnPlayers[i]);
|
PluginCore.getAICore().setAttackTarget(player);
|
||||||
|
break;
|
||||||
} else {
|
} else {
|
||||||
if (ploc.getWorld() == loc.getWorld() && ploc.getX()+15>loc.getX() && ploc.getX()-15<loc.getX() && ploc.getZ()+15>loc.getZ() && ploc.getZ()-15<loc.getZ() && ploc.getY()+15>loc.getY() && ploc.getY()-15<loc.getY()){
|
|
||||||
|
if (ploc.getWorld() == loc.getWorld() && ploc.getX() + 15 > loc.getX()
|
||||||
|
&& ploc.getX() - 15 < loc.getX() && ploc.getZ() + 15 > loc.getZ()
|
||||||
|
&& ploc.getZ() - 15 < loc.getZ() && ploc.getY() + 15 > loc.getY()
|
||||||
|
&& ploc.getY() - 15 < loc.getY()) {
|
||||||
|
|
||||||
ploc.setY(ploc.getY() + 1.5);
|
ploc.setY(ploc.getY() + 1.5);
|
||||||
HerobrineAI.HerobrineNPC.lookAtPoint(ploc);
|
HerobrineAI.HerobrineNPC.lookAtPoint(ploc);
|
||||||
HerobrineAI.getPluginCore().getPathManager().setPath(null);
|
PluginCore.getPathManager().setPath(null);
|
||||||
isThere = true;
|
isThere = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import org.jakub1221.herobrineai.AI.CoreResult;
|
|||||||
public class RandomSound extends Core {
|
public class RandomSound extends Core {
|
||||||
|
|
||||||
public RandomSound() {
|
public RandomSound() {
|
||||||
super(CoreType.RANDOM_SOUND, AppearType.NORMAL);
|
super(CoreType.RANDOM_SOUND, AppearType.NORMAL, HerobrineAI.getPluginCore());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -7,6 +7,7 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
import org.jakub1221.herobrineai.HerobrineAI;
|
import org.jakub1221.herobrineai.HerobrineAI;
|
||||||
|
import org.jakub1221.herobrineai.Utils;
|
||||||
import org.jakub1221.herobrineai.AI.ConsoleLogger;
|
import org.jakub1221.herobrineai.AI.ConsoleLogger;
|
||||||
import org.jakub1221.herobrineai.AI.Core;
|
import org.jakub1221.herobrineai.AI.Core;
|
||||||
import org.jakub1221.herobrineai.AI.CoreResult;
|
import org.jakub1221.herobrineai.AI.CoreResult;
|
||||||
@ -15,7 +16,7 @@ import org.jakub1221.herobrineai.misc.BlockChanger;
|
|||||||
public class Signs extends Core {
|
public class Signs extends Core {
|
||||||
|
|
||||||
public Signs() {
|
public Signs() {
|
||||||
super(CoreType.SIGNS,AppearType.NORMAL);
|
super(CoreType.SIGNS, AppearType.NORMAL, HerobrineAI.getPluginCore());
|
||||||
}
|
}
|
||||||
|
|
||||||
public CoreResult CallCore(Object[] data) {
|
public CoreResult CallCore(Object[] data) {
|
||||||
@ -28,21 +29,30 @@ public class Signs extends Core{
|
|||||||
boolean status = false;
|
boolean status = false;
|
||||||
log.info("Generating sign location...");
|
log.info("Generating sign location...");
|
||||||
|
|
||||||
|
if (loc.getWorld().getBlockAt(loc.getBlockX() + 2, loc.getBlockY(), loc.getBlockZ()).getType() == Material.AIR
|
||||||
|
&& loc.getWorld().getBlockAt(loc.getBlockX() + 2, loc.getBlockY() - 1, loc.getBlockZ())
|
||||||
if (loc.getWorld().getBlockAt(loc.getBlockX()+2, loc.getBlockY(), loc.getBlockZ()).getType() == Material.AIR && loc.getWorld().getBlockAt(loc.getBlockX()+2, loc.getBlockY()-1, loc.getBlockZ()).getType()!= Material.AIR){
|
.getType() != Material.AIR) {
|
||||||
loc.setX(loc.getBlockX() + 2);
|
loc.setX(loc.getBlockX() + 2);
|
||||||
createSign(loc, ploc);
|
createSign(loc, ploc);
|
||||||
status = true;
|
status = true;
|
||||||
}else if (loc.getWorld().getBlockAt(loc.getBlockX()-2, loc.getBlockY(), loc.getBlockZ()).getType() == Material.AIR && loc.getWorld().getBlockAt(loc.getBlockX()-2, loc.getBlockY()-1, loc.getBlockZ()).getType()!= Material.AIR){
|
} else if (loc.getWorld().getBlockAt(loc.getBlockX() - 2, loc.getBlockY(), loc.getBlockZ())
|
||||||
|
.getType() == Material.AIR
|
||||||
|
&& loc.getWorld().getBlockAt(loc.getBlockX() - 2, loc.getBlockY() - 1, loc.getBlockZ())
|
||||||
|
.getType() != Material.AIR) {
|
||||||
loc.setX(loc.getBlockX() - 2);
|
loc.setX(loc.getBlockX() - 2);
|
||||||
createSign(loc, ploc);
|
createSign(loc, ploc);
|
||||||
status = true;
|
status = true;
|
||||||
}else if (loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()+2).getType() == Material.AIR && loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY()-1, loc.getBlockZ()+2).getType()!= Material.AIR){
|
} else if (loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ() + 2)
|
||||||
|
.getType() == Material.AIR
|
||||||
|
&& loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY() - 1, loc.getBlockZ() + 2)
|
||||||
|
.getType() != Material.AIR) {
|
||||||
loc.setZ(loc.getBlockZ() + 2);
|
loc.setZ(loc.getBlockZ() + 2);
|
||||||
createSign(loc, ploc);
|
createSign(loc, ploc);
|
||||||
status = true;
|
status = true;
|
||||||
}else if (loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()-2).getType() == Material.AIR && loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY()-1, loc.getBlockZ()-2).getType()!= Material.AIR){
|
} else if (loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ() - 2)
|
||||||
|
.getType() == Material.AIR
|
||||||
|
&& loc.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY() - 1, loc.getBlockZ() - 2)
|
||||||
|
.getType() != Material.AIR) {
|
||||||
loc.setZ(loc.getBlockZ() - 2);
|
loc.setZ(loc.getBlockZ() - 2);
|
||||||
createSign(loc, ploc);
|
createSign(loc, ploc);
|
||||||
status = true;
|
status = true;
|
||||||
@ -55,19 +65,19 @@ public class Signs extends Core{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void createSign(Location loc, Location ploc) {
|
public void createSign(Location loc, Location ploc) {
|
||||||
|
|
||||||
Random randcgen = new Random();
|
Random randcgen = Utils.getRandomGen();
|
||||||
int chance = randcgen.nextInt(100);
|
int chance = randcgen.nextInt(100);
|
||||||
if (chance > (100 - HerobrineAI.getPluginCore().getConfigDB().SignChance)) {
|
if (chance > (100 - HerobrineAI.getPluginCore().getConfigDB().SignChance)) {
|
||||||
Random randgen = new Random();
|
Random randgen = Utils.getRandomGen();
|
||||||
int count = HerobrineAI.getPluginCore().getConfigDB().useSignMessages.size();
|
int count = HerobrineAI.getPluginCore().getConfigDB().useSignMessages.size();
|
||||||
int randmsg = randgen.nextInt(count);
|
int randmsg = randgen.nextInt(count);
|
||||||
|
|
||||||
Block signblock = loc.add(0, 0D, 0).getBlock();
|
Block signblock = loc.add(0, 0D, 0).getBlock();
|
||||||
Block undersignblock = signblock.getLocation().subtract(0D, 1D, 0D).getBlock();
|
Block undersignblock = signblock.getLocation().subtract(0D, 1D, 0D).getBlock();
|
||||||
if (HerobrineAI.NonStandBlocks.contains(signblock.getType()) && !HerobrineAI.NonStandBlocks.contains(undersignblock.getType())){
|
if (HerobrineAI.NonStandBlocks.contains(signblock.getType())
|
||||||
|
&& !HerobrineAI.NonStandBlocks.contains(undersignblock.getType())) {
|
||||||
signblock.setType(Material.SIGN_POST);
|
signblock.setType(Material.SIGN_POST);
|
||||||
Sign sign = (Sign) signblock.getState();
|
Sign sign = (Sign) signblock.getState();
|
||||||
sign.setLine(1, HerobrineAI.getPluginCore().getConfigDB().useSignMessages.get(randmsg));
|
sign.setLine(1, HerobrineAI.getPluginCore().getConfigDB().useSignMessages.get(randmsg));
|
||||||
|
@ -4,13 +4,15 @@ import java.util.Random;
|
|||||||
|
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.jakub1221.herobrineai.HerobrineAI;
|
||||||
|
import org.jakub1221.herobrineai.Utils;
|
||||||
import org.jakub1221.herobrineai.AI.Core;
|
import org.jakub1221.herobrineai.AI.Core;
|
||||||
import org.jakub1221.herobrineai.AI.CoreResult;
|
import org.jakub1221.herobrineai.AI.CoreResult;
|
||||||
|
|
||||||
public class SoundF extends Core{
|
public class SoundF extends Core{
|
||||||
|
|
||||||
public SoundF(){
|
public SoundF(){
|
||||||
super(CoreType.SOUNDF,AppearType.NORMAL);
|
super(CoreType.SOUNDF,AppearType.NORMAL, HerobrineAI.getPluginCore());
|
||||||
}
|
}
|
||||||
|
|
||||||
public CoreResult CallCore(Object[] data){
|
public CoreResult CallCore(Object[] data){
|
||||||
@ -19,32 +21,19 @@ public class SoundF extends Core{
|
|||||||
|
|
||||||
public CoreResult playRandom(Player player){
|
public CoreResult playRandom(Player player){
|
||||||
|
|
||||||
Sound[] sounds = new Sound[15];
|
Sound[] sounds = {
|
||||||
sounds[0]=Sound.STEP_STONE;
|
Sound.ENTITY_GHAST_SCREAM,
|
||||||
sounds[1]=Sound.STEP_WOOD;
|
Sound.ENTITY_WITHER_DEATH,
|
||||||
sounds[2]=Sound.STEP_GRASS;
|
Sound.ENTITY_WITHER_HURT,
|
||||||
sounds[3]=Sound.STEP_SAND;
|
Sound.ENTITY_BAT_HURT,
|
||||||
sounds[4]=Sound.STEP_GRAVEL;
|
Sound.ENTITY_PLAYER_BREATH,
|
||||||
sounds[5]=Sound.BREATH;
|
Sound.ENTITY_PLAYER_HURT,
|
||||||
sounds[6]=Sound.BREATH;
|
Sound.BLOCK_IRON_DOOR_OPEN,
|
||||||
sounds[7]=Sound.BREATH;
|
Sound.BLOCK_IRON_DOOR_CLOSE
|
||||||
sounds[8]=Sound.BREATH;
|
};
|
||||||
sounds[9]=Sound.DOOR_OPEN;
|
|
||||||
sounds[10]=Sound.DOOR_CLOSE;
|
|
||||||
sounds[11]=Sound.GHAST_SCREAM;
|
|
||||||
sounds[12]=Sound.GHAST_SCREAM2;
|
|
||||||
sounds[13]=Sound.WITHER_DEATH;
|
|
||||||
sounds[14]=Sound.WITHER_HURT;
|
|
||||||
|
|
||||||
int chance=new Random().nextInt(14);
|
|
||||||
int randx=new Random().nextInt(3);
|
|
||||||
int randz=new Random().nextInt(3);
|
|
||||||
int randxp=new Random().nextInt(1);
|
|
||||||
int randzp=new Random().nextInt(1);
|
|
||||||
if (randxp==0 && randx!=0){randx=(-(randx));}
|
|
||||||
if (randzp==0 && randz!=0){randz=(-(randz));}
|
|
||||||
|
|
||||||
player.playSound(player.getLocation(),sounds[chance],(float) 0.75,(float) 0.75);
|
player.playSound(player.getLocation(),sounds[Utils.getRandomGen().nextInt(sounds.length)],(float) 0.75,(float) 0.75);
|
||||||
|
|
||||||
return new CoreResult(true,"SoundF is starting!");
|
return new CoreResult(true,"SoundF is starting!");
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ import org.bukkit.enchantments.Enchantment;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.jakub1221.herobrineai.HerobrineAI;
|
import org.jakub1221.herobrineai.HerobrineAI;
|
||||||
|
import org.jakub1221.herobrineai.Utils;
|
||||||
import org.jakub1221.herobrineai.AI.Core;
|
import org.jakub1221.herobrineai.AI.Core;
|
||||||
import org.jakub1221.herobrineai.AI.CoreResult;
|
import org.jakub1221.herobrineai.AI.CoreResult;
|
||||||
import org.jakub1221.herobrineai.entity.MobType;
|
import org.jakub1221.herobrineai.entity.MobType;
|
||||||
@ -21,7 +22,7 @@ import org.jakub1221.herobrineai.misc.StructureLoader;
|
|||||||
public class Temple extends Core {
|
public class Temple extends Core {
|
||||||
|
|
||||||
public Temple() {
|
public Temple() {
|
||||||
super(CoreType.TEMPLE,AppearType.NORMAL);
|
super(CoreType.TEMPLE, AppearType.NORMAL, HerobrineAI.getPluginCore());
|
||||||
}
|
}
|
||||||
|
|
||||||
public CoreResult CallCore(Object[] data) {
|
public CoreResult CallCore(Object[] data) {
|
||||||
@ -49,19 +50,36 @@ public class Temple extends Core{
|
|||||||
for (i3 = -20; i3 <= 20; i3++) {// Z
|
for (i3 = -20; i3 <= 20; i3++) {// Z
|
||||||
canBuild = true;
|
canBuild = true;
|
||||||
|
|
||||||
|
|
||||||
for (i4 = -1; i4 <= 12; i4++) {// Y
|
for (i4 = -1; i4 <= 12; i4++) {// Y
|
||||||
for (i5 = 0; i5 <= 11; i5++) {// X
|
for (i5 = 0; i5 <= 11; i5++) {// X
|
||||||
for (i6 = 0; i6 <= 10; i6++) {// Z
|
for (i6 = 0; i6 <= 10; i6++) {// Z
|
||||||
|
|
||||||
if (player.getLocation().getBlockX()==i2+i5+loc.getBlockX() && player.getLocation().getBlockY()==i1+i4+loc.getBlockY() && player.getLocation().getBlockZ()==i3+i6+loc.getBlockZ()){canBuild=false;}
|
if (player.getLocation().getBlockX() == i2 + i5 + loc.getBlockX()
|
||||||
|
&& player.getLocation().getBlockY() == i1 + i4 + loc.getBlockY()
|
||||||
|
&& player.getLocation().getBlockZ() == i3 + i6 + loc.getBlockZ()) {
|
||||||
|
canBuild = false;
|
||||||
|
}
|
||||||
if (i4 == -1) {
|
if (i4 == -1) {
|
||||||
if (canBuild == true) {
|
if (canBuild == true) {
|
||||||
if (HerobrineAI.StandBlocks.contains(loc.getWorld().getBlockAt(i2+i5+loc.getBlockX(), i1+i4+loc.getBlockY(), i3+i6+loc.getBlockZ()).getType())){canBuild=true;}else{canBuild=false;}
|
if (HerobrineAI.StandBlocks.contains(loc
|
||||||
|
.getWorld().getBlockAt(i2 + i5 + loc.getBlockX(),
|
||||||
|
i1 + i4 + loc.getBlockY(), i3 + i6 + loc.getBlockZ())
|
||||||
|
.getType())) {
|
||||||
|
canBuild = true;
|
||||||
|
} else {
|
||||||
|
canBuild = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (canBuild == true) {
|
if (canBuild == true) {
|
||||||
if (HerobrineAI.NonStandBlocks.contains(loc.getWorld().getBlockAt(i2+i5+loc.getBlockX(), i1+i4+loc.getBlockY(), i3+i6+loc.getBlockZ()).getType())){canBuild=true;}else{canBuild=false;}
|
if (HerobrineAI.NonStandBlocks.contains(loc
|
||||||
|
.getWorld().getBlockAt(i2 + i5 + loc.getBlockX(),
|
||||||
|
i1 + i4 + loc.getBlockY(), i3 + i6 + loc.getBlockZ())
|
||||||
|
.getType())) {
|
||||||
|
canBuild = true;
|
||||||
|
} else {
|
||||||
|
canBuild = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -80,7 +98,6 @@ public class Temple extends Core{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return new CoreResult(false, "Cannot find a good place for Temple.");
|
return new CoreResult(false, "Cannot find a good place for Temple.");
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -105,24 +122,41 @@ public class Temple extends Core{
|
|||||||
i5 = 0;
|
i5 = 0;
|
||||||
i6 = 0;
|
i6 = 0;
|
||||||
|
|
||||||
|
|
||||||
for (i1 = -5; i1 <= 5; i1++) {// Y
|
for (i1 = -5; i1 <= 5; i1++) {// Y
|
||||||
|
|
||||||
canBuild = true;
|
canBuild = true;
|
||||||
|
|
||||||
|
|
||||||
for (i4 = -1; i4 <= 12; i4++) {// Y
|
for (i4 = -1; i4 <= 12; i4++) {// Y
|
||||||
for (i5 = 0; i5 <= 11; i5++) {// X
|
for (i5 = 0; i5 <= 11; i5++) {// X
|
||||||
for (i6 = 0; i6 <= 10; i6++) {// Z
|
for (i6 = 0; i6 <= 10; i6++) {// Z
|
||||||
|
|
||||||
if (loc.getBlockX()==i2+i5+loc.getBlockX() && loc.getBlockY()==i1+i4+loc.getBlockY() && loc.getBlockZ()==i3+i6+loc.getBlockZ()){canBuild=false;}
|
if (loc.getBlockX() == i2 + i5 + loc.getBlockX() && loc.getBlockY() == i1 + i4 + loc.getBlockY()
|
||||||
|
&& loc.getBlockZ() == i3 + i6 + loc.getBlockZ()) {
|
||||||
|
canBuild = false;
|
||||||
|
}
|
||||||
if (i4 == -1) {
|
if (i4 == -1) {
|
||||||
if (canBuild == true) {
|
if (canBuild == true) {
|
||||||
if (HerobrineAI.StandBlocks.contains(loc.getWorld().getBlockAt(i2+i5+loc.getBlockX(), i1+i4+loc.getBlockY(), i3+i6+loc.getBlockZ()).getType())){canBuild=true;}else{canBuild=false;}
|
if (HerobrineAI.StandBlocks
|
||||||
|
.contains(loc
|
||||||
|
.getWorld().getBlockAt(i2 + i5 + loc.getBlockX(),
|
||||||
|
i1 + i4 + loc.getBlockY(), i3 + i6 + loc.getBlockZ())
|
||||||
|
.getType())) {
|
||||||
|
canBuild = true;
|
||||||
|
} else {
|
||||||
|
canBuild = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (canBuild == true) {
|
if (canBuild == true) {
|
||||||
if (HerobrineAI.NonStandBlocks.contains(loc.getWorld().getBlockAt(i2+i5+loc.getBlockX(), i1+i4+loc.getBlockY(), i3+i6+loc.getBlockZ()).getType())){canBuild=true;}else{canBuild=false;}
|
if (HerobrineAI.NonStandBlocks
|
||||||
|
.contains(loc
|
||||||
|
.getWorld().getBlockAt(i2 + i5 + loc.getBlockX(),
|
||||||
|
i1 + i4 + loc.getBlockY(), i3 + i6 + loc.getBlockZ())
|
||||||
|
.getType())) {
|
||||||
|
canBuild = true;
|
||||||
|
} else {
|
||||||
|
canBuild = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -136,12 +170,8 @@ public class Temple extends Core{
|
|||||||
return new CoreResult(true, "Creating temple!");
|
return new CoreResult(true, "Creating temple!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return new CoreResult(false, "Cannot find a good place for Temple.");
|
return new CoreResult(false, "Cannot find a good place for Temple.");
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -158,13 +188,18 @@ public class Temple extends Core{
|
|||||||
|
|
||||||
// Main blocks
|
// Main blocks
|
||||||
|
|
||||||
new StructureLoader(HerobrineAI.getPluginCore().data_temple).Build(loc.getWorld(), MainX, MainY, MainZ);
|
new StructureLoader(HerobrineAI.getPluginCore().getInputStreamData("/res/temple.yml")).Build(loc.getWorld(),
|
||||||
|
MainX, MainY, MainZ);
|
||||||
loc.getWorld().getBlockAt(MainX + 6, MainY + 0, MainZ + 2).setType(Material.CHEST);
|
loc.getWorld().getBlockAt(MainX + 6, MainY + 0, MainZ + 2).setType(Material.CHEST);
|
||||||
// Mob spawn
|
// Mob spawn
|
||||||
|
if (!HerobrineAI.isNPCDisabled) {
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().UseNPC_Guardian) {
|
if (HerobrineAI.getPluginCore().getConfigDB().UseNPC_Guardian) {
|
||||||
Location mobloc = new Location(loc.getWorld(), MainX + 6, MainY + 0, MainZ + 4);
|
Location mobloc = new Location(loc.getWorld(), MainX + 6, MainY + 0, MainZ + 4);
|
||||||
for (int i=1;i<=HerobrineAI.getPluginCore().getConfigDB().npc.getInt("npc.Guardian.SpawnCount");i++){
|
for (int i = 1; i <= HerobrineAI.getPluginCore().getConfigDB().npc
|
||||||
HerobrineAI.getPluginCore().getEntityManager().spawnCustomZombie(mobloc, MobType.ARTIFACT_GUARDIAN);
|
.getInt("npc.Guardian.SpawnCount"); i++) {
|
||||||
|
HerobrineAI.getPluginCore().getEntityManager().spawnCustomZombie(mobloc,
|
||||||
|
MobType.ARTIFACT_GUARDIAN);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Chest
|
// Chest
|
||||||
@ -174,8 +209,10 @@ public class Temple extends Core{
|
|||||||
Random generator = new Random();
|
Random generator = new Random();
|
||||||
int chance = generator.nextInt(HerobrineAI.getPluginCore().getConfigDB().UseCustomItemsList.size());
|
int chance = generator.nextInt(HerobrineAI.getPluginCore().getConfigDB().UseCustomItemsList.size());
|
||||||
if (HerobrineAI.getPluginCore().getSupport().isCustomItems()) {
|
if (HerobrineAI.getPluginCore().getSupport().isCustomItems()) {
|
||||||
if (HerobrineAI.getPluginCore().getSupport().getCustomItems().checkItem(HerobrineAI.getPluginCore().getConfigDB().UseCustomItemsList.get(chance))){
|
if (HerobrineAI.getPluginCore().getSupport().getCustomItems()
|
||||||
ciItem=HerobrineAI.getPluginCore().getSupport().getCustomItems().getItem(HerobrineAI.getPluginCore().getConfigDB().UseCustomItemsList.get(chance));
|
.checkItem(HerobrineAI.getPluginCore().getConfigDB().UseCustomItemsList.get(chance))) {
|
||||||
|
ciItem = HerobrineAI.getPluginCore().getSupport().getCustomItems()
|
||||||
|
.getItem(HerobrineAI.getPluginCore().getConfigDB().UseCustomItemsList.get(chance));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -185,28 +222,35 @@ public class Temple extends Core{
|
|||||||
chest.getBlockInventory().setItem(chest.getInventory().firstEmpty(), ciItem);
|
chest.getBlockInventory().setItem(chest.getInventory().firstEmpty(), ciItem);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Random generator = new Random();
|
|
||||||
|
Random generator = Utils.getRandomGen();
|
||||||
int chance = generator.nextInt(15);
|
int chance = generator.nextInt(15);
|
||||||
ItemStack item = null;
|
ItemStack item = null;
|
||||||
ArrayList<String> newLore = new ArrayList<String>();
|
ArrayList<String> newLore = new ArrayList<String>();
|
||||||
|
|
||||||
if (chance < 4 && HerobrineAI.getPluginCore().getConfigDB().UseArtifactBow) {
|
if (chance < 4 && HerobrineAI.getPluginCore().getConfigDB().UseArtifactBow) {
|
||||||
|
|
||||||
item = new ItemStack(Material.BOW);
|
item = new ItemStack(Material.BOW);
|
||||||
newLore.add("Herobrine´s artifact");
|
newLore.add("Herobrine<EFBFBD>s artifact");
|
||||||
newLore.add("Bow of Teleporting");
|
newLore.add("Bow of Teleporting");
|
||||||
item = ItemName.setNameAndLore(item, "Bow of Teleporting", newLore);
|
item = ItemName.setNameAndLore(item, "Bow of Teleporting", newLore);
|
||||||
item.addEnchantment(Enchantment.ARROW_FIRE, 1);
|
item.addEnchantment(Enchantment.ARROW_FIRE, 1);
|
||||||
item.addEnchantment(Enchantment.ARROW_KNOCKBACK, 1);
|
item.addEnchantment(Enchantment.ARROW_KNOCKBACK, 1);
|
||||||
|
|
||||||
} else if (chance < 8 && HerobrineAI.getPluginCore().getConfigDB().UseArtifactSword) {
|
} else if (chance < 8 && HerobrineAI.getPluginCore().getConfigDB().UseArtifactSword) {
|
||||||
|
|
||||||
item = new ItemStack(Material.DIAMOND_SWORD);
|
item = new ItemStack(Material.DIAMOND_SWORD);
|
||||||
newLore.add("Herobrine´s artifact");
|
newLore.add("Herobrine<EFBFBD>s artifact");
|
||||||
newLore.add("Sword of Lighting");
|
newLore.add("Sword of Lighting");
|
||||||
item = ItemName.setNameAndLore(item, "Sword of Lighting", newLore);
|
item = ItemName.setNameAndLore(item, "Sword of Lighting", newLore);
|
||||||
item.addEnchantment(Enchantment.KNOCKBACK, 2);
|
item.addEnchantment(Enchantment.KNOCKBACK, 2);
|
||||||
item.addEnchantment(Enchantment.DAMAGE_ALL, 2);
|
item.addEnchantment(Enchantment.DAMAGE_ALL, 2);
|
||||||
item.addEnchantment(Enchantment.DURABILITY, 3);
|
item.addEnchantment(Enchantment.DURABILITY, 3);
|
||||||
|
|
||||||
} else if (chance < 12 && HerobrineAI.getPluginCore().getConfigDB().UseArtifactApple) {
|
} else if (chance < 12 && HerobrineAI.getPluginCore().getConfigDB().UseArtifactApple) {
|
||||||
|
|
||||||
item = new ItemStack(Material.GOLDEN_APPLE);
|
item = new ItemStack(Material.GOLDEN_APPLE);
|
||||||
newLore.add("Herobrine´s artifact");
|
newLore.add("Herobrine<EFBFBD>s artifact");
|
||||||
newLore.add("Apple of Death");
|
newLore.add("Apple of Death");
|
||||||
item = ItemName.setNameAndLore(item, "Apple of Death", newLore);
|
item = ItemName.setNameAndLore(item, "Apple of Death", newLore);
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package org.jakub1221.herobrineai.AI.cores;
|
package org.jakub1221.herobrineai.AI.cores;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -14,7 +16,7 @@ import org.jakub1221.herobrineai.AI.Message;
|
|||||||
public class Totem extends Core {
|
public class Totem extends Core {
|
||||||
|
|
||||||
public Totem() {
|
public Totem() {
|
||||||
super(CoreType.TOTEM,AppearType.APPEAR);
|
super(CoreType.TOTEM, AppearType.APPEAR, HerobrineAI.getPluginCore());
|
||||||
}
|
}
|
||||||
|
|
||||||
public CoreResult CallCore(Object[] data) {
|
public CoreResult CallCore(Object[] data) {
|
||||||
@ -25,125 +27,91 @@ public class Totem extends Core{
|
|||||||
|
|
||||||
AICore.isTotemCalled = false;
|
AICore.isTotemCalled = false;
|
||||||
loc.getWorld().strikeLightning(loc);
|
loc.getWorld().strikeLightning(loc);
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().TotemExplodes==true){
|
|
||||||
|
if (PluginCore.getConfigDB().TotemExplodes == true) {
|
||||||
loc.getWorld().createExplosion(loc, 5);
|
loc.getWorld().createExplosion(loc, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Bukkit.getServer().getPlayer(caller) != null) {
|
if (Bukkit.getServer().getPlayer(caller) != null) {
|
||||||
|
|
||||||
if (Bukkit.getServer().getPlayer(caller).isOnline()) {
|
if (Bukkit.getServer().getPlayer(caller).isOnline()) {
|
||||||
HerobrineAI.getPluginCore().getAICore().setCoreTypeNow(CoreType.TOTEM);
|
PluginCore.getAICore().setCoreTypeNow(CoreType.TOTEM);
|
||||||
HerobrineAI.getPluginCore().getAICore().setAttackTarget(Bukkit.getServer().getPlayer(caller));
|
PluginCore.getAICore().setAttackTarget(Bukkit.getServer().getPlayer(caller));
|
||||||
Player player = (Player) Bukkit.getServer().getPlayer(caller);
|
Player player = (Player) Bukkit.getServer().getPlayer(caller);
|
||||||
|
|
||||||
Player [] AllOnPlayers = Bukkit.getServer().getOnlinePlayers();
|
Collection<? extends Player> onlinePlayers = Bukkit.getServer().getOnlinePlayers();
|
||||||
if (Bukkit.getServer().getOnlinePlayers().length>0){
|
|
||||||
int i = 0;
|
|
||||||
for (i=0;i<=Bukkit.getServer().getOnlinePlayers().length-1;i++){
|
|
||||||
Location ploc = (Location) AllOnPlayers[i].getLocation();
|
|
||||||
if (AllOnPlayers[i].getName() != player.getName() && ploc.getX()+10>loc.getX() && ploc.getX()-10<loc.getX() && ploc.getZ()+10>loc.getZ() && ploc.getZ()-10<loc.getZ()){
|
|
||||||
|
|
||||||
Message.SendMessage(AllOnPlayers[i]);
|
if (Bukkit.getServer().getOnlinePlayers().size() > 0) {
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().UsePotionEffects){
|
for(Player onlinePlayer : onlinePlayers) {
|
||||||
AllOnPlayers[i].addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 1000, 1));
|
Location ploc = (Location) onlinePlayer.getLocation();
|
||||||
AllOnPlayers[i].addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 1000, 1));
|
if (onlinePlayer.getName() != player.getName() && ploc.getX() + 10 > loc.getX()
|
||||||
AllOnPlayers[i].addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 1000, 1));
|
&& ploc.getX() - 10 < loc.getX() && ploc.getZ() + 10 > loc.getZ()
|
||||||
|
&& ploc.getZ() - 10 < loc.getZ()) {
|
||||||
|
|
||||||
|
Message.SendMessage(onlinePlayer);
|
||||||
|
if (PluginCore.getConfigDB().UsePotionEffects) {
|
||||||
|
onlinePlayer.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 1000, 1));
|
||||||
|
onlinePlayer.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 1000, 1));
|
||||||
|
onlinePlayer.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 1000, 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
boolean hasTarget=false;
|
|
||||||
Player target = null;
|
Player target = null;
|
||||||
|
|
||||||
Player [] AllOnPlayers = Bukkit.getServer().getOnlinePlayers();
|
Collection<? extends Player> onlinePlayers = Bukkit.getServer().getOnlinePlayers();
|
||||||
if (Bukkit.getServer().getOnlinePlayers().length>0){
|
|
||||||
int i = 0;
|
|
||||||
for (i=0;i<=Bukkit.getServer().getOnlinePlayers().length-1;i++){
|
|
||||||
if (hasTarget==false){
|
|
||||||
Location ploc = (Location) AllOnPlayers[i].getLocation();
|
|
||||||
if (ploc.getX()+10>loc.getX() && ploc.getX()-10<loc.getX() && ploc.getZ()+10>loc.getZ() && ploc.getZ()-10<loc.getZ()){
|
|
||||||
|
|
||||||
hasTarget=true;
|
if (Bukkit.getServer().getOnlinePlayers().size() > 0) {
|
||||||
target=AllOnPlayers[i];
|
for(Player onlinePlayer : onlinePlayers) {
|
||||||
|
|
||||||
|
Location ploc = (Location) onlinePlayer.getLocation();
|
||||||
|
|
||||||
|
if (ploc.getX() + 10 > loc.getX() && ploc.getX() - 10 < loc.getX()
|
||||||
|
&& ploc.getZ() + 10 > loc.getZ() && ploc.getZ() - 10 < loc.getZ()) {
|
||||||
|
|
||||||
|
target = onlinePlayer;
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (hasTarget==true){
|
|
||||||
|
|
||||||
HerobrineAI.getPluginCore().getAICore().CancelTarget(CoreType.TOTEM);
|
}
|
||||||
HerobrineAI.getPluginCore().getAICore().setAttackTarget(target);
|
|
||||||
|
if (target != null) {
|
||||||
|
|
||||||
|
PluginCore.getAICore().CancelTarget(CoreType.TOTEM);
|
||||||
|
PluginCore.getAICore().setAttackTarget(target);
|
||||||
Player player = (Player) target;
|
Player player = (Player) target;
|
||||||
if (Bukkit.getServer().getOnlinePlayers().length>0){
|
if (Bukkit.getServer().getOnlinePlayers().size() > 0) {
|
||||||
int i = 0;
|
for(Player onlinePlayer : onlinePlayers) {
|
||||||
for (i=0;i<=Bukkit.getServer().getOnlinePlayers().length-1;i++){
|
|
||||||
Location ploc = (Location) AllOnPlayers[i].getLocation();
|
|
||||||
if (AllOnPlayers[i].getName() != player.getName() && ploc.getX()+20>loc.getX() && ploc.getX()-20<loc.getX() && ploc.getZ()+20>loc.getZ() && ploc.getZ()-20<loc.getZ()){
|
|
||||||
|
|
||||||
Message.SendMessage(AllOnPlayers[i]);
|
Location ploc = (Location) onlinePlayer.getLocation();
|
||||||
AllOnPlayers[i].addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 1000, 1));
|
if (onlinePlayer.getName() != player.getName()
|
||||||
AllOnPlayers[i].addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 1000, 1));
|
&& ploc.getX() + 20 > loc.getX()
|
||||||
AllOnPlayers[i].addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 1000, 1));
|
&& ploc.getX() - 20 < loc.getX()
|
||||||
|
&& ploc.getZ() + 20 > loc.getZ()
|
||||||
|
&& ploc.getZ() - 20 < loc.getZ()
|
||||||
|
) {
|
||||||
|
|
||||||
|
Message.SendMessage(onlinePlayer);
|
||||||
|
onlinePlayer.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 1000, 1));
|
||||||
|
onlinePlayer.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 1000, 1));
|
||||||
|
onlinePlayer.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 1000, 1));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}else{
|
|
||||||
boolean hasTarget=false;
|
|
||||||
Player target = null;
|
|
||||||
|
|
||||||
Player [] AllOnPlayers = Bukkit.getServer().getOnlinePlayers();
|
|
||||||
if (Bukkit.getServer().getOnlinePlayers().length>0){
|
|
||||||
int i = 0;
|
|
||||||
for (i=0;i<=Bukkit.getServer().getOnlinePlayers().length-1;i++){
|
|
||||||
if (hasTarget==false){
|
|
||||||
Location ploc = (Location) AllOnPlayers[i].getLocation();
|
|
||||||
if (ploc.getX()+20>loc.getX() && ploc.getX()-20<loc.getX() && ploc.getZ()+20>loc.getZ() && ploc.getZ()-20<loc.getZ()){
|
|
||||||
|
|
||||||
hasTarget=true;
|
|
||||||
target=AllOnPlayers[i];
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
if (hasTarget==true){
|
|
||||||
|
|
||||||
HerobrineAI.getPluginCore().getAICore().CancelTarget(CoreType.TOTEM);
|
|
||||||
HerobrineAI.getPluginCore().getAICore().setAttackTarget(target);
|
|
||||||
Player player = (Player) target;
|
|
||||||
if (Bukkit.getServer().getOnlinePlayers().length>0){
|
|
||||||
int i = 0;
|
|
||||||
for (i=0;i<=Bukkit.getServer().getOnlinePlayers().length-1;i++){
|
|
||||||
if (AllOnPlayers[i].getEntityId()!=HerobrineAI.HerobrineEntityID){
|
|
||||||
Location ploc = (Location) AllOnPlayers[i].getLocation();
|
|
||||||
if (AllOnPlayers[i].getName() != player.getName() && ploc.getX()+20>loc.getX() && ploc.getX()-20<loc.getX() && ploc.getZ()+20>loc.getZ() && ploc.getZ()-20<loc.getZ()){
|
|
||||||
|
|
||||||
Message.SendMessage(AllOnPlayers[i]);
|
|
||||||
AllOnPlayers[i].addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 1000, 1));
|
|
||||||
AllOnPlayers[i].addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 1000, 1));
|
|
||||||
AllOnPlayers[i].addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 1000, 1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new CoreResult(false, "Totem called!");
|
return new CoreResult(false, "Totem called!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,11 +5,8 @@ import org.bukkit.Location;
|
|||||||
import org.jakub1221.herobrineai.HerobrineAI;
|
import org.jakub1221.herobrineai.HerobrineAI;
|
||||||
import org.jakub1221.herobrineai.misc.StructureLoader;
|
import org.jakub1221.herobrineai.misc.StructureLoader;
|
||||||
|
|
||||||
|
|
||||||
public class GraveyardWorld {
|
public class GraveyardWorld {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static void Create() {
|
public static void Create() {
|
||||||
|
|
||||||
Location loc = new Location(Bukkit.getServer().getWorld("world_herobrineai_graveyard"), 0, 3, 0);
|
Location loc = new Location(Bukkit.getServer().getWorld("world_herobrineai_graveyard"), 0, 3, 0);
|
||||||
@ -20,14 +17,14 @@ public class GraveyardWorld{
|
|||||||
loc.getWorld().getBlockAt(x, 3, z).setTypeId(110);
|
loc.getWorld().getBlockAt(x, 3, z).setTypeId(110);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int MainX = -10;
|
int MainX = -10;
|
||||||
int MainY = 3;
|
int MainY = 3;
|
||||||
int MainZ = -10;
|
int MainZ = -10;
|
||||||
|
|
||||||
new StructureLoader(HerobrineAI.getPluginCore().data_graveyard_world).Build(loc.getWorld(), MainX, MainY, MainZ);
|
StructureLoader structLoader = new StructureLoader(HerobrineAI.getPluginCore().getInputStreamData("/res/graveyard_world.yml"));
|
||||||
|
structLoader.Build(loc.getWorld(), MainX, MainY, MainZ);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,131 +1,29 @@
|
|||||||
package org.jakub1221.herobrineai.AI.extensions;
|
package org.jakub1221.herobrineai.AI.extensions;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.jakub1221.herobrineai.HerobrineAI;
|
import org.bukkit.Material;
|
||||||
|
|
||||||
|
|
||||||
public class Position {
|
public class Position {
|
||||||
|
|
||||||
public static Location getTeleportPosition(Location ploc) {
|
public static Location getTeleportPosition(Location ploc) {
|
||||||
|
|
||||||
Location newloc = (Location) ploc;
|
for(int y = -2; y < 2; y++)
|
||||||
|
{
|
||||||
|
for(int x = -2; x < 2; x++)
|
||||||
|
{
|
||||||
|
for(int z = -2; z < 2; z++)
|
||||||
|
{
|
||||||
|
Material bottomBlock = ploc.clone().add(new Location(ploc.getWorld(), x, y - 1 ,z)).getBlock().getType();
|
||||||
|
Material middleBlock = ploc.clone().add(new Location(ploc.getWorld(), x, y ,z)).getBlock().getType();
|
||||||
|
Material topBlock = ploc.clone().add(new Location(ploc.getWorld(), x, y + 1 ,z)).getBlock().getType();
|
||||||
|
|
||||||
int chance= new Random().nextInt(3);
|
if (bottomBlock.isSolid() && !middleBlock.isSolid() && !topBlock.isSolid())
|
||||||
|
return ploc.clone().add(new Location(ploc.getWorld(), x, y - 1 ,z));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (chance==0){
|
return ploc;
|
||||||
|
|
||||||
if (HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX()-2, ploc.getBlockY(), ploc.getBlockZ()).getType()) && HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX()-2, ploc.getBlockY()+1, ploc.getBlockZ()).getType())){
|
|
||||||
newloc.setX(newloc.getX()-2);
|
|
||||||
}else if (HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX()+2, ploc.getBlockY(), ploc.getBlockZ()).getType()) && HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX()+2, ploc.getBlockY()+1, ploc.getBlockZ()).getType())){
|
|
||||||
newloc.setX(newloc.getX()+2);
|
|
||||||
}else if (HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ()-2).getType()) && HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY()+1, ploc.getBlockZ()-2).getType())){
|
|
||||||
newloc.setZ(newloc.getZ()-2);
|
|
||||||
}else if (HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ()+2).getType()) && HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY()+1, ploc.getBlockZ()+2).getType())){
|
|
||||||
newloc.setZ(newloc.getZ()+2);
|
|
||||||
}else{
|
|
||||||
|
|
||||||
if (HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX()-2, ploc.getBlockY(), ploc.getBlockZ()).getType()) && HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX()-2, ploc.getBlockY()+1, ploc.getBlockZ()).getType())){
|
|
||||||
newloc.setX(newloc.getX()-2);
|
|
||||||
}else if (HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX()+2, ploc.getBlockY(), ploc.getBlockZ()).getType()) && HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX()+2, ploc.getBlockY()+1, ploc.getBlockZ()).getType())){
|
|
||||||
newloc.setX(newloc.getX()+2);
|
|
||||||
}else if (HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ()-2).getType()) && HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY()+1, ploc.getBlockZ()-2).getType())){
|
|
||||||
newloc.setZ(newloc.getZ()-2);
|
|
||||||
}else if (HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ()+2).getType()) && HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY()+1, ploc.getBlockZ()+2).getType())){
|
|
||||||
newloc.setZ(newloc.getZ()+2);
|
|
||||||
}else{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}else if(chance==1){
|
|
||||||
|
|
||||||
if (HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX()+2, ploc.getBlockY(), ploc.getBlockZ()).getType()) && HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX()+2, ploc.getBlockY()+1, ploc.getBlockZ()).getType())){
|
|
||||||
newloc.setX(newloc.getX()+2);
|
|
||||||
}else if (HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX()-2, ploc.getBlockY(), ploc.getBlockZ()).getType()) && HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX()-2, ploc.getBlockY()+1, ploc.getBlockZ()).getType())){
|
|
||||||
newloc.setX(newloc.getX()-2);
|
|
||||||
}else if (HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ()-2).getType()) && HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY()+1, ploc.getBlockZ()-2).getType())){
|
|
||||||
newloc.setZ(newloc.getZ()-2);
|
|
||||||
}else if (HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ()+2).getType()) && HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY()+1, ploc.getBlockZ()+2).getType())){
|
|
||||||
newloc.setZ(newloc.getZ()+2);
|
|
||||||
}else{
|
|
||||||
|
|
||||||
if (HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX()+2, ploc.getBlockY(), ploc.getBlockZ()).getType()) && HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX()+2, ploc.getBlockY()+1, ploc.getBlockZ()).getType())){
|
|
||||||
newloc.setX(newloc.getX()+2);
|
|
||||||
}else if (HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX()-2, ploc.getBlockY(), ploc.getBlockZ()).getType()) && HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX()-2, ploc.getBlockY()+1, ploc.getBlockZ()).getType())){
|
|
||||||
newloc.setX(newloc.getX()-2);
|
|
||||||
}else if (HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ()-2).getType()) && HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY()+1, ploc.getBlockZ()-2).getType())){
|
|
||||||
newloc.setZ(newloc.getZ()-2);
|
|
||||||
}else if (HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ()+2).getType()) && HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY()+1, ploc.getBlockZ()+2).getType())){
|
|
||||||
newloc.setZ(newloc.getZ()+2);
|
|
||||||
}else{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}else if(chance==2){
|
|
||||||
|
|
||||||
if (HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ()-2).getType()) && HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY()+1, ploc.getBlockZ()-2).getType())){
|
|
||||||
newloc.setZ(newloc.getZ()-2);
|
|
||||||
}
|
|
||||||
else if (HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX()+2, ploc.getBlockY(), ploc.getBlockZ()).getType()) && HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX()+2, ploc.getBlockY()+1, ploc.getBlockZ()).getType())){
|
|
||||||
newloc.setX(newloc.getX()+2);
|
|
||||||
}else if (HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX()-2, ploc.getBlockY(), ploc.getBlockZ()).getType()) && HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX()-2, ploc.getBlockY()+1, ploc.getBlockZ()).getType())){
|
|
||||||
newloc.setX(newloc.getX()-2);
|
|
||||||
}else if (HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ()+2).getType()) && HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY()+1, ploc.getBlockZ()+2).getType())){
|
|
||||||
newloc.setZ(newloc.getZ()+2);
|
|
||||||
}else{
|
|
||||||
|
|
||||||
if (HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ()-2).getType()) && HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY()+1, ploc.getBlockZ()-2).getType())){
|
|
||||||
newloc.setZ(newloc.getZ()-2);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX()+2, ploc.getBlockY(), ploc.getBlockZ()).getType()) && HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX()+2, ploc.getBlockY()+1, ploc.getBlockZ()).getType())){
|
|
||||||
newloc.setX(newloc.getX()+2);
|
|
||||||
}else if (HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX()-2, ploc.getBlockY(), ploc.getBlockZ()).getType()) && HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX()-2, ploc.getBlockY()+1, ploc.getBlockZ()).getType())){
|
|
||||||
newloc.setX(newloc.getX()-2);
|
|
||||||
}else if (HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ()+2).getType()) && HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY()+1, ploc.getBlockZ()+2).getType())){
|
|
||||||
newloc.setZ(newloc.getZ()+2);
|
|
||||||
}else{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} if (chance==3){
|
|
||||||
|
|
||||||
if (HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ()+2).getType()) && HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY()+1, ploc.getBlockZ()+2).getType())){
|
|
||||||
newloc.setZ(newloc.getZ()+2);
|
|
||||||
}
|
|
||||||
else if (HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX()-2, ploc.getBlockY(), ploc.getBlockZ()).getType()) && HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX()-2, ploc.getBlockY()+1, ploc.getBlockZ()).getType())){
|
|
||||||
newloc.setX(newloc.getX()-2);
|
|
||||||
}else if (HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX()+2, ploc.getBlockY(), ploc.getBlockZ()).getType()) && HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX()+2, ploc.getBlockY()+1, ploc.getBlockZ()).getType())){
|
|
||||||
newloc.setX(newloc.getX()+2);
|
|
||||||
}else if (HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ()-2).getType()) && HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY()+1, ploc.getBlockZ()-2).getType())){
|
|
||||||
newloc.setZ(newloc.getZ()-2);
|
|
||||||
}else if (HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ()+2).getType()) && HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY()+1, ploc.getBlockZ()+2).getType())){
|
|
||||||
newloc.setZ(newloc.getZ()+2);
|
|
||||||
}else{
|
|
||||||
|
|
||||||
if (HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ()+2).getType()) && HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY()+1, ploc.getBlockZ()+2).getType())){
|
|
||||||
newloc.setZ(newloc.getZ()+2);
|
|
||||||
}
|
|
||||||
else if (HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX()-2, ploc.getBlockY(), ploc.getBlockZ()).getType()) && HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX()-2, ploc.getBlockY()+1, ploc.getBlockZ()).getType())){
|
|
||||||
newloc.setX(newloc.getX()-2);
|
|
||||||
}else if (HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX()+2, ploc.getBlockY(), ploc.getBlockZ()).getType()) && HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX()+2, ploc.getBlockY()+1, ploc.getBlockZ()).getType())){
|
|
||||||
newloc.setX(newloc.getX()+2);
|
|
||||||
}else if (HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY(), ploc.getBlockZ()-2).getType()) && HerobrineAI.AllowedBlocks.contains(ploc.getWorld().getBlockAt(ploc.getBlockX(), ploc.getBlockY()+1, ploc.getBlockZ()-2).getType())){
|
|
||||||
newloc.setZ(newloc.getZ()-2);
|
|
||||||
}else{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return newloc;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ import java.util.List;
|
|||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.World;
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.jakub1221.herobrineai.misc.CustomID;
|
import org.jakub1221.herobrineai.misc.CustomID;
|
||||||
@ -23,7 +24,7 @@ public class ConfigDB {
|
|||||||
public boolean Lighting=true;
|
public boolean Lighting=true;
|
||||||
public boolean DestroyTorches=true;
|
public boolean DestroyTorches=true;
|
||||||
public int DestroyTorchesRadius=5;
|
public int DestroyTorchesRadius=5;
|
||||||
public int ShowInterval=30000;
|
public int ShowInterval=144000;
|
||||||
public boolean TotemExplodes=true;
|
public boolean TotemExplodes=true;
|
||||||
public boolean OnlyWalkingMode=false;
|
public boolean OnlyWalkingMode=false;
|
||||||
public boolean BuildStuff=true;
|
public boolean BuildStuff=true;
|
||||||
@ -62,7 +63,7 @@ public class ConfigDB {
|
|||||||
public boolean SecuredArea_Signs = true;
|
public boolean SecuredArea_Signs = true;
|
||||||
public boolean SecuredArea_Books = true;
|
public boolean SecuredArea_Books = true;
|
||||||
public int HerobrineHP = 150;
|
public int HerobrineHP = 150;
|
||||||
public int BuildInterval = 45000;
|
public int BuildInterval = 72000;
|
||||||
public boolean UseHeads = true;
|
public boolean UseHeads = true;
|
||||||
public boolean UseCustomItems = false;
|
public boolean UseCustomItems = false;
|
||||||
public boolean UseAncientSword = true;
|
public boolean UseAncientSword = true;
|
||||||
@ -74,6 +75,12 @@ public class ConfigDB {
|
|||||||
public boolean Explosions=true;
|
public boolean Explosions=true;
|
||||||
public boolean Burn=true;
|
public boolean Burn=true;
|
||||||
public boolean Curse=true;
|
public boolean Curse=true;
|
||||||
|
public int maxBooks=1;
|
||||||
|
public int maxSigns=1;
|
||||||
|
public int maxHeads=1;
|
||||||
|
public boolean UseIgnorePermission=true;
|
||||||
|
|
||||||
|
private boolean isStartupDone=false;
|
||||||
|
|
||||||
public ConfigDB(Logger l){
|
public ConfigDB(Logger l){
|
||||||
this.log=l;
|
this.log=l;
|
||||||
@ -125,18 +132,21 @@ public class ConfigDB {
|
|||||||
if (!npc.contains("npc.Guardian")){
|
if (!npc.contains("npc.Guardian")){
|
||||||
npc.set("npc.Guardian.SpawnCount", 1);
|
npc.set("npc.Guardian.SpawnCount", 1);
|
||||||
npc.set("npc.Guardian.HP", 40);
|
npc.set("npc.Guardian.HP", 40);
|
||||||
|
npc.set("npc.Guardian.Speed", 0.3);
|
||||||
npc.set("npc.Guardian.Drops.283.Chance", 40);
|
npc.set("npc.Guardian.Drops.283.Chance", 40);
|
||||||
npc.set("npc.Guardian.Drops.283.Count", 1);
|
npc.set("npc.Guardian.Drops.283.Count", 1);
|
||||||
npc.set("npc.Guardian.Drops.286.Chance", 30);
|
npc.set("npc.Guardian.Drops.286.Chance", 30);
|
||||||
npc.set("npc.Guardian.Drops.286.Count", 1);
|
npc.set("npc.Guardian.Drops.286.Count", 1);
|
||||||
npc.set("npc.Warrior.SpawnChance", 10);
|
npc.set("npc.Warrior.SpawnChance", 4);
|
||||||
npc.set("npc.Warrior.HP", 40);
|
npc.set("npc.Warrior.HP", 40);
|
||||||
|
npc.set("npc.Warrior.Speed", 0.3);
|
||||||
npc.set("npc.Warrior.Drops.307.Chance", 25);
|
npc.set("npc.Warrior.Drops.307.Chance", 25);
|
||||||
npc.set("npc.Warrior.Drops.307.Count", 1);
|
npc.set("npc.Warrior.Drops.307.Count", 1);
|
||||||
npc.set("npc.Warrior.Drops.306.Chance", 20);
|
npc.set("npc.Warrior.Drops.306.Chance", 20);
|
||||||
npc.set("npc.Warrior.Drops.306.Count", 1);
|
npc.set("npc.Warrior.Drops.306.Count", 1);
|
||||||
npc.set("npc.Demon.SpawnChance", 10);
|
npc.set("npc.Demon.SpawnChance", 4);
|
||||||
npc.set("npc.Demon.HP", 40);
|
npc.set("npc.Demon.HP", 40);
|
||||||
|
npc.set("npc.Demon.Speed", 0.3);
|
||||||
npc.set("npc.Demon.Drops.322.Chance", 40);
|
npc.set("npc.Demon.Drops.322.Chance", 40);
|
||||||
npc.set("npc.Demon.Drops.322.Count", 1);
|
npc.set("npc.Demon.Drops.322.Count", 1);
|
||||||
npc.set("npc.Demon.Drops.397.Chance", 20);
|
npc.set("npc.Demon.Drops.397.Chance", 20);
|
||||||
@ -167,7 +177,7 @@ public class ConfigDB {
|
|||||||
UseCustomItemsList.add("ItemExample");
|
UseCustomItemsList.add("ItemExample");
|
||||||
|
|
||||||
log.info("[HerobrineAI] Creating new Config ...");
|
log.info("[HerobrineAI] Creating new Config ...");
|
||||||
config.set("config.ShowInterval", 30000);
|
config.set("config.ShowInterval", 144000);
|
||||||
config.set("config.ShowRate", 2);
|
config.set("config.ShowRate", 2);
|
||||||
config.set("config.HitPlayer", true);
|
config.set("config.HitPlayer", true);
|
||||||
config.set("config.SendMessages", true);
|
config.set("config.SendMessages", true);
|
||||||
@ -202,12 +212,12 @@ public class ConfigDB {
|
|||||||
config.set("config.WalkingModeRadius.Z", 1000);
|
config.set("config.WalkingModeRadius.Z", 1000);
|
||||||
config.set("config.WalkingModeRadius.FromX", 0);
|
config.set("config.WalkingModeRadius.FromX", 0);
|
||||||
config.set("config.WalkingModeRadius.FromZ", 0);
|
config.set("config.WalkingModeRadius.FromZ", 0);
|
||||||
config.set("config.BuildInterval", 45000);
|
config.set("config.BuildInterval", 72000);
|
||||||
config.set("config.BuildTemples", true);
|
config.set("config.BuildTemples", true);
|
||||||
config.set("config.UseArtifacts.Bow", true);
|
config.set("config.UseArtifacts.Bow", true);
|
||||||
config.set("config.UseArtifacts.Sword", true);
|
config.set("config.UseArtifacts.Sword", true);
|
||||||
config.set("config.UseArtifacts.Apple", true);
|
config.set("config.UseArtifacts.Apple", true);
|
||||||
config.set("config.HerobrineHP", 200);
|
config.set("config.HerobrineHP", 300);
|
||||||
config.set("config.AttackCreative", true);
|
config.set("config.AttackCreative", true);
|
||||||
config.set("config.AttackOP", true);
|
config.set("config.AttackOP", true);
|
||||||
config.set("config.SecuredArea.Build", true);
|
config.set("config.SecuredArea.Build", true);
|
||||||
@ -226,6 +236,10 @@ public class ConfigDB {
|
|||||||
config.set("config.Explosions", true);
|
config.set("config.Explosions", true);
|
||||||
config.set("config.Burn", true);
|
config.set("config.Burn", true);
|
||||||
config.set("config.Curse", true);
|
config.set("config.Curse", true);
|
||||||
|
config.set("config.Limit.Books", 1);
|
||||||
|
config.set("config.Limit.Signs", 1);
|
||||||
|
config.set("config.Limit.Heads", 1);
|
||||||
|
config.set("config.UseIgnorePermission", true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
config.save(configF);
|
config.save(configF);
|
||||||
@ -453,10 +467,41 @@ public class ConfigDB {
|
|||||||
config.set("config.Curse", true);
|
config.set("config.Curse", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!npc.contains("npc.Warrior.Speed")){
|
||||||
|
if (hasUpdated==false){
|
||||||
|
log.info("[HerobrineAI] Updating old config...");
|
||||||
|
}
|
||||||
|
hasUpdated=true;
|
||||||
|
|
||||||
|
npc.set("npc.Warrior.Speed", 0.3);
|
||||||
|
npc.set("npc.Guardian.Speed", 0.3);
|
||||||
|
npc.set("npc.Demon.Speed", 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!config.contains("config.Limit.Books")){
|
||||||
|
if (hasUpdated==false){
|
||||||
|
log.info("[HerobrineAI] Updating old config...");
|
||||||
|
}
|
||||||
|
hasUpdated=true;
|
||||||
|
|
||||||
|
config.set("config.Limit.Books", 1);
|
||||||
|
config.set("config.Limit.Signs", 1);
|
||||||
|
config.set("config.Limit.Heads", 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!config.contains("config.UseIgnorePermission")){
|
||||||
|
if (hasUpdated==false){
|
||||||
|
log.info("[HerobrineAI] Updating old config...");
|
||||||
|
}
|
||||||
|
hasUpdated=true;
|
||||||
|
|
||||||
|
config.set("config.UseIgnorePermission", true);
|
||||||
|
}
|
||||||
|
|
||||||
if (hasUpdated==true){
|
if (hasUpdated==true){
|
||||||
try {
|
try {
|
||||||
config.save(configF);
|
config.save(configF);
|
||||||
|
npc.save(npcF);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -545,6 +590,10 @@ public class ConfigDB {
|
|||||||
Explosions=config.getBoolean("config.Explosions");
|
Explosions=config.getBoolean("config.Explosions");
|
||||||
Burn=config.getBoolean("config.Burn");
|
Burn=config.getBoolean("config.Burn");
|
||||||
Curse=config.getBoolean("config.Curse");
|
Curse=config.getBoolean("config.Curse");
|
||||||
|
maxBooks=config.getInt("config.Limit.Books");
|
||||||
|
maxSigns=config.getInt("config.Limit.Signs");
|
||||||
|
maxHeads=config.getInt("config.Limit.Heads");
|
||||||
|
UseIgnorePermission=config.getBoolean("config.UseIgnorePermission");
|
||||||
|
|
||||||
HerobrineAI.HerobrineMaxHP=HerobrineHP;
|
HerobrineAI.HerobrineMaxHP=HerobrineHP;
|
||||||
HerobrineAI.getPluginCore().getAICore().Stop_MAIN();
|
HerobrineAI.getPluginCore().getAICore().Stop_MAIN();
|
||||||
@ -554,17 +603,68 @@ public class ConfigDB {
|
|||||||
HerobrineAI.getPluginCore().getAICore().Stop_RC();
|
HerobrineAI.getPluginCore().getAICore().Stop_RC();
|
||||||
HerobrineAI.getPluginCore().getAICore().Start_RC();
|
HerobrineAI.getPluginCore().getAICore().Start_RC();
|
||||||
HerobrineAI.AvailableWorld=false;
|
HerobrineAI.AvailableWorld=false;
|
||||||
|
HerobrineAI.getPluginCore().getAICore().getResetLimits().updateFromConfig();
|
||||||
|
|
||||||
if (HerobrineAI.HerobrineNPC!=null){
|
if (HerobrineAI.HerobrineNPC!=null){
|
||||||
HerobrineAI.HerobrineNPC.setItemInHand(ItemInHand.getItemStack());
|
HerobrineAI.HerobrineNPC.setItemInHand(ItemInHand.getItemStack());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0;i<=useWorlds.size()-1;i++){
|
|
||||||
|
|
||||||
|
|
||||||
|
if (isStartupDone){
|
||||||
|
|
||||||
|
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(HerobrineAI.getPluginCore(), new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
for (int i = 0;i<=useWorlds.size()-1;i++){
|
||||||
if (Bukkit.getServer().getWorlds().contains(Bukkit.getServer().getWorld(useWorlds.get(i)))){HerobrineAI.AvailableWorld=true;}
|
if (Bukkit.getServer().getWorlds().contains(Bukkit.getServer().getWorld(useWorlds.get(i)))){HerobrineAI.AvailableWorld=true;}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (HerobrineAI.AvailableWorld==false){
|
||||||
|
log.warning("**********************************************************");
|
||||||
|
log.warning("[HerobrineAI] There are no available worlds for Herobrine!");
|
||||||
|
log.warning("**********************************************************");
|
||||||
|
}else{
|
||||||
|
log.info("**********************************************************");
|
||||||
|
log.info("[HerobrineAI] No problems detected.");
|
||||||
|
log.info("**********************************************************");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},1L);
|
||||||
|
|
||||||
|
}
|
||||||
|
isStartupDone=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addAllWorlds(){
|
||||||
|
|
||||||
|
ArrayList<String> allWorlds = new ArrayList<String>();
|
||||||
|
List<World> worlds_ = Bukkit.getWorlds();
|
||||||
|
for(int i=0;i<=worlds_.size()-1;i++){
|
||||||
|
if(!worlds_.get(i).getName().equalsIgnoreCase("world_herobrineai_graveyard")){
|
||||||
|
allWorlds.add(worlds_.get(i).getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
config.load(configF);
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (InvalidConfigurationException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
config.set("config.Worlds", allWorlds);
|
||||||
|
|
||||||
|
try {
|
||||||
|
config.save(configF);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
Reload();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,10 +6,12 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Random;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Color;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -18,8 +20,9 @@ import org.bukkit.WorldCreator;
|
|||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.metadata.FixedMetadataValue;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
import org.jakub1221.herobrineai.NPC.AI.Path;
|
||||||
import org.jakub1221.herobrineai.NPC.AI.PathManager;
|
import org.jakub1221.herobrineai.NPC.AI.PathManager;
|
||||||
import org.jakub1221.herobrineai.NPC.Entity.HumanNPC;
|
import org.jakub1221.herobrineai.NPC.Entity.HumanNPC;
|
||||||
import org.jakub1221.herobrineai.NPC.NPCCore;
|
import org.jakub1221.herobrineai.NPC.NPCCore;
|
||||||
@ -36,8 +39,6 @@ import org.jakub1221.herobrineai.listeners.InventoryListener;
|
|||||||
import org.jakub1221.herobrineai.listeners.PlayerListener;
|
import org.jakub1221.herobrineai.listeners.PlayerListener;
|
||||||
import org.jakub1221.herobrineai.listeners.WorldListener;
|
import org.jakub1221.herobrineai.listeners.WorldListener;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class HerobrineAI extends JavaPlugin implements Listener {
|
public class HerobrineAI extends JavaPlugin implements Listener {
|
||||||
|
|
||||||
private static HerobrineAI pluginCore;
|
private static HerobrineAI pluginCore;
|
||||||
@ -46,14 +47,16 @@ public class HerobrineAI extends JavaPlugin implements Listener{
|
|||||||
private Support support;
|
private Support support;
|
||||||
private EntityManager entMng;
|
private EntityManager entMng;
|
||||||
private PathManager pathMng;
|
private PathManager pathMng;
|
||||||
public static final int build=3127;
|
public static final int build = 3219;
|
||||||
public static final String versionStr="3.1.0";
|
public static final String versionStr = "3.2.2";
|
||||||
public java.io.InputStream data_temple=HerobrineAI.class.getResourceAsStream("/res/temple.yml");
|
public static boolean isNPCDisabled = false;
|
||||||
public java.io.InputStream data_graveyard_world=HerobrineAI.class.getResourceAsStream("/res/graveyard_world.yml");
|
private static int pathUpdateINT = 0;
|
||||||
|
|
||||||
|
public static String bukkit_ver_string = "1.6.4 R0.1";
|
||||||
public static int HerobrineHP = 200;
|
public static int HerobrineHP = 200;
|
||||||
public static int HerobrineMaxHP = 200;
|
public static int HerobrineMaxHP = 200;
|
||||||
public static final boolean isDebugging = false;
|
public static final boolean isDebugging = false;
|
||||||
|
public static boolean isInitDone = false;
|
||||||
|
|
||||||
public static NPCCore NPCman;
|
public static NPCCore NPCman;
|
||||||
public static HumanNPC HerobrineNPC;
|
public static HumanNPC HerobrineNPC;
|
||||||
@ -70,10 +73,21 @@ public class HerobrineAI extends JavaPlugin implements Listener{
|
|||||||
|
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
|
|
||||||
NPCman = new NPCCore(this);
|
boolean errorCheck = true;
|
||||||
HerobrineAI.pluginCore = this;
|
|
||||||
this.configdb = new ConfigDB(log);
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
Class.forName("net.minecraft.server.v1_6_R3.Entity");
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
errorCheck = false;
|
||||||
|
isInitDone = false;
|
||||||
|
}
|
||||||
|
if (errorCheck) {
|
||||||
|
isInitDone = true;
|
||||||
|
HerobrineAI.pluginCore = this;
|
||||||
|
|
||||||
|
NPCman = new NPCCore(this);
|
||||||
|
|
||||||
|
this.configdb = new ConfigDB(log);
|
||||||
|
|
||||||
getServer().getPluginManager().registerEvents(new EntityListener(), this);
|
getServer().getPluginManager().registerEvents(new EntityListener(), this);
|
||||||
getServer().getPluginManager().registerEvents(new BlockListener(), this);
|
getServer().getPluginManager().registerEvents(new BlockListener(), this);
|
||||||
@ -109,7 +123,8 @@ public class HerobrineAI extends JavaPlugin implements Listener{
|
|||||||
|
|
||||||
// Spawn Herobrine
|
// Spawn Herobrine
|
||||||
|
|
||||||
Location nowloc = new Location((World) Bukkit.getServer().getWorlds().get(0),(float) 0,(float) -20,(float) 0);
|
Location nowloc = new Location((World) Bukkit.getServer().getWorlds().get(0), (float) 0, (float) -20,
|
||||||
|
(float) 0);
|
||||||
nowloc.setYaw((float) 1);
|
nowloc.setYaw((float) 1);
|
||||||
nowloc.setPitch((float) 1);
|
nowloc.setPitch((float) 1);
|
||||||
HerobrineSpawn(nowloc);
|
HerobrineSpawn(nowloc);
|
||||||
@ -173,22 +188,36 @@ public class HerobrineAI extends JavaPlugin implements Listener{
|
|||||||
AllowedBlocks.add(Material.getMaterial(77));
|
AllowedBlocks.add(Material.getMaterial(77));
|
||||||
AllowedBlocks.add(Material.LADDER);
|
AllowedBlocks.add(Material.LADDER);
|
||||||
|
|
||||||
for (int i = 0;i<=configdb.useWorlds.size()-1;i++){
|
/*
|
||||||
if (Bukkit.getServer().getWorlds().contains(Bukkit.getServer().getWorld(configdb.useWorlds.get(i)))){AvailableWorld=true;}
|
* Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this,
|
||||||
}
|
* new Runnable() { public void run() {
|
||||||
if (AvailableWorld==false){
|
*
|
||||||
log.info("**********************************************************");
|
* for (int i = 0;i<=configdb.useWorlds.size()-1;i++){ if
|
||||||
log.info("[HerobrineAI] There are no available worlds for Herobrine!");
|
* (Bukkit.getServer().getWorlds().contains(Bukkit.getServer().
|
||||||
log.info("**********************************************************");
|
* getWorld(configdb.useWorlds.get(i)))){AvailableWorld=true;} } if
|
||||||
}
|
* (AvailableWorld==false){ log.warning(
|
||||||
|
* "**********************************************************");
|
||||||
|
* log.
|
||||||
|
* warning("[HerobrineAI] There are no available worlds for Herobrine!"
|
||||||
|
* ); log.warning(
|
||||||
|
* "**********************************************************");
|
||||||
|
* }else{ log.info(
|
||||||
|
* "**********************************************************");
|
||||||
|
* log.info("[HerobrineAI] No problems detected."); log.info(
|
||||||
|
* "**********************************************************"); }
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* } }, 1 * 1L);
|
||||||
|
*/
|
||||||
|
|
||||||
|
pathUpdateINT = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
|
||||||
|
|
||||||
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(AICore.plugin, new Runnable() {
|
|
||||||
public void run() {
|
public void run() {
|
||||||
|
if (new Random().nextInt(4) == 2 && HerobrineAI.getPluginCore().getAICore().getCoreTypeNow()
|
||||||
|
.equals(CoreType.RANDOM_POSITION)) {
|
||||||
|
pathMng.setPath(new Path(new Random().nextInt(15) - 7f, new Random().nextInt(15) - 7f));
|
||||||
}
|
}
|
||||||
}, 1 * 35L, 1 * 35L);
|
}
|
||||||
|
}, 1 * 200L, 1 * 200L);
|
||||||
|
|
||||||
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
|
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -196,7 +225,6 @@ public class HerobrineAI extends JavaPlugin implements Listener{
|
|||||||
}
|
}
|
||||||
}, 1 * 5L, 1 * 5L);
|
}, 1 * 5L, 1 * 5L);
|
||||||
|
|
||||||
|
|
||||||
// Command Executors
|
// Command Executors
|
||||||
this.getCommand("hb").setExecutor((CommandExecutor) new CmdExecutor(this));
|
this.getCommand("hb").setExecutor((CommandExecutor) new CmdExecutor(this));
|
||||||
this.getCommand("hb-ai").setExecutor((CommandExecutor) new CmdExecutor(this));
|
this.getCommand("hb-ai").setExecutor((CommandExecutor) new CmdExecutor(this));
|
||||||
@ -204,8 +232,19 @@ public class HerobrineAI extends JavaPlugin implements Listener{
|
|||||||
// Support initialize
|
// Support initialize
|
||||||
this.support = new Support();
|
this.support = new Support();
|
||||||
|
|
||||||
|
Class[] argst = new Class[3];
|
||||||
|
argst[0] = Class.class;
|
||||||
|
argst[1] = String.class;
|
||||||
|
argst[2] = int.class;
|
||||||
|
try {
|
||||||
|
Method ab = net.minecraft.server.v1_11_R1.EntityTypes.class.getDeclaredMethod("a", argst);
|
||||||
|
} catch (NoSuchMethodException e1) {
|
||||||
|
isNPCDisabled = true;
|
||||||
|
} catch (SecurityException e1) {
|
||||||
|
isNPCDisabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
//Register mobs
|
if (!isNPCDisabled) {
|
||||||
try {
|
try {
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
Class[] args = new Class[3];
|
Class[] args = new Class[3];
|
||||||
@ -213,7 +252,7 @@ public class HerobrineAI extends JavaPlugin implements Listener{
|
|||||||
args[1] = String.class;
|
args[1] = String.class;
|
||||||
args[2] = int.class;
|
args[2] = int.class;
|
||||||
|
|
||||||
Method a = net.minecraft.server.v1_5_R2.EntityTypes.class.getDeclaredMethod("a", args);
|
Method a = net.minecraft.server.v1_11_R1.EntityTypes.class.getDeclaredMethod("a", args);
|
||||||
a.setAccessible(true);
|
a.setAccessible(true);
|
||||||
|
|
||||||
a.invoke(a, CustomZombie.class, "Zombie", 54);
|
a.invoke(a, CustomZombie.class, "Zombie", 54);
|
||||||
@ -222,19 +261,39 @@ public class HerobrineAI extends JavaPlugin implements Listener{
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
this.setEnabled(false);
|
this.setEnabled(false);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
log.warning("[HerobrineAI] Custom NPCs have been disabled. (Incompatibility error!)");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.warning("[HerobrineAI] ******************ERROR******************");
|
||||||
|
log.warning("[HerobrineAI] This version is only compatible with bukkit version " + bukkit_ver_string);
|
||||||
|
log.warning("[HerobrineAI] *****************************************");
|
||||||
|
this.setEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onDisable() {
|
||||||
|
|
||||||
|
if (isInitDone) {
|
||||||
|
this.entMng.killAllMobs();
|
||||||
|
Bukkit.getServer().getScheduler().cancelTask(pathUpdateINT);
|
||||||
|
NPCman.DisableTask();
|
||||||
|
aicore.CancelTarget(CoreType.ANY);
|
||||||
|
aicore.Stop_BD();
|
||||||
|
aicore.Stop_CG();
|
||||||
|
aicore.Stop_MAIN();
|
||||||
|
aicore.Stop_RC();
|
||||||
|
aicore.Stop_RM();
|
||||||
|
aicore.Stop_RP();
|
||||||
|
aicore.Stop_RS();
|
||||||
|
aicore.disableAll();
|
||||||
|
log.info("[HerobrineAI] Plugin disabled!");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public java.io.InputStream getInputStreamData(String src) {
|
||||||
public void onDisable(){
|
return HerobrineAI.class.getResourceAsStream(src);
|
||||||
this.entMng.killAllMobs();
|
|
||||||
NPCman.DisableTask();
|
|
||||||
aicore.CancelTarget(CoreType.ANY);
|
|
||||||
log.info("[HerobrineAI] Plugin disabled!");
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public AICore getAICore() {
|
public AICore getAICore() {
|
||||||
@ -255,9 +314,11 @@ public class HerobrineAI extends JavaPlugin implements Listener{
|
|||||||
|
|
||||||
public void HerobrineSpawn(Location loc) {
|
public void HerobrineSpawn(Location loc) {
|
||||||
HerobrineNPC = (HumanNPC) NPCman.spawnHumanNPC(ChatColor.WHITE + "Herobrine", loc);
|
HerobrineNPC = (HumanNPC) NPCman.spawnHumanNPC(ChatColor.WHITE + "Herobrine", loc);
|
||||||
|
HerobrineNPC.getBukkitEntity().setMetadata("NPC", new FixedMetadataValue(this, true));
|
||||||
HerobrineEntityID = HerobrineNPC.getBukkitEntity().getEntityId();
|
HerobrineEntityID = HerobrineNPC.getBukkitEntity().getEntityId();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HerobrineRemove() {
|
public void HerobrineRemove() {
|
||||||
|
|
||||||
HerobrineEntityID = 0;
|
HerobrineEntityID = 0;
|
||||||
@ -265,80 +326,123 @@ public class HerobrineAI extends JavaPlugin implements Listener{
|
|||||||
NPCman.removeAll();
|
NPCman.removeAll();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConfigDB getConfigDB() {
|
public ConfigDB getConfigDB() {
|
||||||
return this.configdb;
|
return this.configdb;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getVersionStr() {
|
public String getVersionStr() {
|
||||||
return versionStr;
|
return versionStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Support getSupport() {
|
public Support getSupport() {
|
||||||
return this.support;
|
return this.support;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PathManager getPathManager() {
|
public PathManager getPathManager() {
|
||||||
return this.pathMng;
|
return this.pathMng;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canAttackPlayer(Player player, Player sender) {
|
public boolean canAttackPlayer(Player player, Player sender) {
|
||||||
|
|
||||||
|
boolean opCheck = true;
|
||||||
|
boolean creativeCheck = true;
|
||||||
|
boolean ignoreCheck = true;
|
||||||
|
|
||||||
|
if (!configdb.AttackOP) {
|
||||||
if (player.isOp()) {
|
if (player.isOp()) {
|
||||||
if (configdb.AttackOP){
|
opCheck = false;
|
||||||
if (player.getGameMode()==GameMode.CREATIVE){
|
|
||||||
if (configdb.AttackCreative){
|
|
||||||
return true;
|
|
||||||
}else{sender.sendMessage(ChatColor.RED+"[HerobrineAI] Player is in Creative mode.");return false;}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (!configdb.AttackCreative) {
|
||||||
|
if (player.getGameMode() == GameMode.CREATIVE) {
|
||||||
|
creativeCheck = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
;
|
||||||
|
if (configdb.UseIgnorePermission && player.hasPermission("hb-ai.ignore")) {
|
||||||
|
ignoreCheck = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opCheck && creativeCheck && ignoreCheck) {
|
||||||
return true;
|
return true;
|
||||||
}else{sender.sendMessage(ChatColor.RED+"[HerobrineAI] Player is OP.");return false;}
|
} else {
|
||||||
}else if (player.hasPermission("hb-ai.ignore")){
|
if (!opCheck) {
|
||||||
|
sender.sendMessage(ChatColor.RED + "[HerobrineAI] Player is OP.");
|
||||||
|
} else if (!creativeCheck) {
|
||||||
|
sender.sendMessage(ChatColor.RED + "[HerobrineAI] Player is in Creative mode.");
|
||||||
|
} else if (!ignoreCheck) {
|
||||||
sender.sendMessage(ChatColor.RED + "[HerobrineAI] Player has ignore permission.");
|
sender.sendMessage(ChatColor.RED + "[HerobrineAI] Player has ignore permission.");
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}else if (player.getGameMode()==GameMode.CREATIVE){
|
}
|
||||||
if (configdb.AttackCreative){
|
|
||||||
return true;
|
|
||||||
}else{sender.sendMessage(ChatColor.RED+"[HerobrineAI] Player is in Creative mode.");return false;}
|
|
||||||
}else{return true;}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canAttackPlayerConsole(Player player) {
|
public boolean canAttackPlayerConsole(Player player) {
|
||||||
|
|
||||||
|
boolean opCheck = true;
|
||||||
|
boolean creativeCheck = true;
|
||||||
|
boolean ignoreCheck = true;
|
||||||
|
|
||||||
|
if (!configdb.AttackOP) {
|
||||||
if (player.isOp()) {
|
if (player.isOp()) {
|
||||||
if (configdb.AttackOP){
|
opCheck = false;
|
||||||
if (player.getGameMode()==GameMode.CREATIVE){
|
|
||||||
if (configdb.AttackCreative){
|
|
||||||
return true;
|
|
||||||
}else{log.info("[HerobrineAI] Player is in Creative mode.");return false;}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (!configdb.AttackCreative) {
|
||||||
|
if (player.getGameMode() == GameMode.CREATIVE) {
|
||||||
|
creativeCheck = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
;
|
||||||
|
if (configdb.UseIgnorePermission && player.hasPermission("hb-ai.ignore")) {
|
||||||
|
ignoreCheck = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opCheck && creativeCheck && ignoreCheck) {
|
||||||
return true;
|
return true;
|
||||||
}else{log.info("[HerobrineAI] Player is OP.");return false;}
|
} else {
|
||||||
}else if (player.hasPermission("hb-ai.ignore")){
|
if (!opCheck) {
|
||||||
|
log.info("[HerobrineAI] Player is OP.");
|
||||||
|
} else if (!creativeCheck) {
|
||||||
|
log.info("[HerobrineAI] Player is in Creative mode.");
|
||||||
|
} else if (!ignoreCheck) {
|
||||||
log.info("[HerobrineAI] Player has ignore permission.");
|
log.info("[HerobrineAI] Player has ignore permission.");
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}else if (player.getGameMode()==GameMode.CREATIVE){
|
}
|
||||||
if (configdb.AttackCreative){
|
|
||||||
return true;
|
|
||||||
}else{log.info("[HerobrineAI] Player is in Creative mode.");return false;}
|
|
||||||
}else{return true;}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canAttackPlayerNoMSG(Player player) {
|
public boolean canAttackPlayerNoMSG(Player player) {
|
||||||
if (player.isOp()){
|
boolean opCheck = true;
|
||||||
if (configdb.AttackOP){
|
boolean creativeCheck = true;
|
||||||
if (player.getGameMode()==GameMode.CREATIVE){
|
boolean ignoreCheck = true;
|
||||||
if (configdb.AttackCreative){
|
|
||||||
return true;
|
|
||||||
}else{return false;}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}else{return false;}
|
|
||||||
}else if (player.hasPermission("hb-ai.ignore")){
|
|
||||||
return false;
|
|
||||||
}else if (player.getGameMode()==GameMode.CREATIVE){
|
|
||||||
if (configdb.AttackCreative){
|
|
||||||
return true;
|
|
||||||
}else{return false;}
|
|
||||||
}else{return true;}
|
|
||||||
|
|
||||||
|
if (!configdb.AttackOP) {
|
||||||
|
if (player.isOp()) {
|
||||||
|
opCheck = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (!configdb.AttackCreative) {
|
||||||
|
if (player.getGameMode() == GameMode.CREATIVE) {
|
||||||
|
creativeCheck = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
;
|
||||||
|
if (configdb.UseIgnorePermission && player.hasPermission("hb-ai.ignore")) {
|
||||||
|
ignoreCheck = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opCheck && creativeCheck && ignoreCheck) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String getAvailableWorldString() {
|
public String getAvailableWorldString() {
|
||||||
if (AvailableWorld) {
|
if (AvailableWorld) {
|
||||||
return "Yes";
|
return "Yes";
|
||||||
@ -348,4 +452,3 @@ public class HerobrineAI extends JavaPlugin implements Listener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -360,7 +360,7 @@ public class Metrics {
|
|||||||
data.append(encode("guid")).append('=').append(encode(guid));
|
data.append(encode("guid")).append('=').append(encode(guid));
|
||||||
encodeDataPair(data, "version", description.getVersion());
|
encodeDataPair(data, "version", description.getVersion());
|
||||||
encodeDataPair(data, "server", Bukkit.getVersion());
|
encodeDataPair(data, "server", Bukkit.getVersion());
|
||||||
encodeDataPair(data, "players", Integer.toString(Bukkit.getServer().getOnlinePlayers().length));
|
encodeDataPair(data, "players", Integer.toString(Bukkit.getServer().getOnlinePlayers().size()));
|
||||||
encodeDataPair(data, "revision", String.valueOf(REVISION));
|
encodeDataPair(data, "revision", String.valueOf(REVISION));
|
||||||
|
|
||||||
// If we're pinging, append it
|
// If we're pinging, append it
|
||||||
|
@ -97,9 +97,12 @@ public class Path {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if (new Random().nextInt(4)==0){
|
if (new Random().nextInt(7)==3){
|
||||||
|
|
||||||
HerobrineAI.HerobrineNPC.setYaw(new Random().nextInt(360));
|
int yaw=new Random().nextInt(360);
|
||||||
|
|
||||||
|
HerobrineAI.HerobrineNPC.setYaw(yaw);
|
||||||
|
HerobrineAI.HerobrineNPC.setYawA(yaw);
|
||||||
HerobrineAI.HerobrineNPC.setPitch(0);
|
HerobrineAI.HerobrineNPC.setPitch(0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package org.jakub1221.herobrineai.NPC.AI;
|
package org.jakub1221.herobrineai.NPC.AI;
|
||||||
|
|
||||||
|
import org.jakub1221.herobrineai.HerobrineAI;
|
||||||
|
import org.jakub1221.herobrineai.AI.Core.CoreType;
|
||||||
|
|
||||||
public class PathManager {
|
public class PathManager {
|
||||||
|
|
||||||
Path pathNow = null;
|
Path pathNow = null;
|
||||||
@ -9,7 +12,7 @@ public class PathManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void update() {
|
public void update() {
|
||||||
if (pathNow!=null){
|
if (pathNow != null && HerobrineAI.getPluginCore().getAICore().getCoreTypeNow().equals(CoreType.RANDOM_POSITION)) {
|
||||||
pathNow.update();
|
pathNow.update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package org.jakub1221.herobrineai.NPC.Entity;
|
package org.jakub1221.herobrineai.NPC.Entity;
|
||||||
|
|
||||||
import net.minecraft.server.v1_5_R2.Entity;
|
import net.minecraft.server.v1_11_R1.Entity;
|
||||||
import net.minecraft.server.v1_5_R2.EntityHuman;
|
import net.minecraft.server.v1_11_R1.EntityHuman;
|
||||||
import net.minecraft.server.v1_5_R2.EntityPlayer;
|
import net.minecraft.server.v1_11_R1.EntityPlayer;
|
||||||
import net.minecraft.server.v1_5_R2.EnumGamemode;
|
import net.minecraft.server.v1_11_R1.EnumGamemode;
|
||||||
import net.minecraft.server.v1_5_R2.PlayerInteractManager;
|
import net.minecraft.server.v1_11_R1.PlayerInteractManager;
|
||||||
|
|
||||||
import org.bukkit.craftbukkit.v1_5_R2.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_11_R1.entity.CraftEntity;
|
||||||
import org.jakub1221.herobrineai.NPC.NPCCore;
|
import org.jakub1221.herobrineai.NPC.NPCCore;
|
||||||
import org.jakub1221.herobrineai.NPC.NMS.BWorld;
|
import org.jakub1221.herobrineai.NPC.NMS.BWorld;
|
||||||
import org.jakub1221.herobrineai.NPC.Network.NetworkHandler;
|
import org.jakub1221.herobrineai.NPC.Network.NetworkHandler;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package org.jakub1221.herobrineai.NPC.Entity;
|
package org.jakub1221.herobrineai.NPC.Entity;
|
||||||
|
|
||||||
import net.minecraft.server.v1_5_R2.EntityPlayer;
|
import net.minecraft.server.v1_11_R1.EntityPlayer;
|
||||||
import net.minecraft.server.v1_5_R2.Packet18ArmAnimation;
|
import net.minecraft.server.v1_11_R1.Packet18ArmAnimation;
|
||||||
import net.minecraft.server.v1_5_R2.WorldServer;
|
import net.minecraft.server.v1_11_R1.WorldServer;
|
||||||
import net.minecraft.server.v1_5_R2.Entity;
|
import net.minecraft.server.v1_11_R1.Entity;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
@ -43,7 +43,7 @@ public class HumanNPC {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return ((HumanEntity) getEntity()).name;
|
return ((HumanEntity) getEntity()).getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPitch(float pitch){
|
public void setPitch(float pitch){
|
||||||
@ -96,11 +96,15 @@ public class HumanNPC {
|
|||||||
|
|
||||||
((EntityPlayer) getEntity()).yaw = (float) (newYaw - 90);
|
((EntityPlayer) getEntity()).yaw = (float) (newYaw - 90);
|
||||||
((EntityPlayer) getEntity()).pitch = (float) newPitch;
|
((EntityPlayer) getEntity()).pitch = (float) newPitch;
|
||||||
((EntityPlayer) getEntity()).aA = (float) (newYaw - 90);
|
((EntityPlayer) getEntity()).aP = (float) (newYaw - 90);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setYawA(float yaw){
|
||||||
|
((EntityPlayer) getEntity()).aP=yaw;
|
||||||
|
}
|
||||||
|
|
||||||
public org.bukkit.entity.Entity getBukkitEntity() {
|
public org.bukkit.entity.Entity getBukkitEntity() {
|
||||||
return entity.getBukkitEntity();
|
return entity.getBukkitEntity();
|
||||||
}
|
}
|
||||||
|
@ -5,13 +5,13 @@ import java.util.List;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import net.minecraft.server.v1_5_R2.DedicatedServer;
|
import net.minecraft.server.v1_6_R3.DedicatedServer;
|
||||||
import net.minecraft.server.v1_5_R2.MinecraftServer;
|
import net.minecraft.server.v1_6_R3.MinecraftServer;
|
||||||
import net.minecraft.server.v1_5_R2.WorldServer;
|
import net.minecraft.server.v1_6_R3.WorldServer;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.craftbukkit.v1_5_R2.CraftServer;
|
import org.bukkit.craftbukkit.v1_6_R3.CraftServer;
|
||||||
|
|
||||||
public class BServer {
|
public class BServer {
|
||||||
private static BServer ins;
|
private static BServer ins;
|
||||||
|
@ -6,17 +6,17 @@ import java.util.concurrent.Callable;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import net.minecraft.server.v1_5_R2.AxisAlignedBB;
|
import net.minecraft.server.v1_11_R1.AxisAlignedBB;
|
||||||
import net.minecraft.server.v1_5_R2.Entity;
|
import net.minecraft.server.v1_11_R1.Entity;
|
||||||
import net.minecraft.server.v1_5_R2.EntityPlayer;
|
import net.minecraft.server.v1_11_R1.EntityPlayer;
|
||||||
import net.minecraft.server.v1_5_R2.PlayerChunkMap;
|
import net.minecraft.server.v1_11_R1.PlayerChunkMap;
|
||||||
import net.minecraft.server.v1_5_R2.WorldProvider;
|
import net.minecraft.server.v1_11_R1.WorldProvider;
|
||||||
import net.minecraft.server.v1_5_R2.WorldServer;
|
import net.minecraft.server.v1_11_R1.WorldServer;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.craftbukkit.v1_5_R2.CraftWorld;
|
import org.bukkit.craftbukkit.v1_11_R1.CraftWorld;
|
||||||
import org.bukkit.craftbukkit.v1_5_R2.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
@ -6,8 +6,8 @@ import java.util.HashMap;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import net.minecraft.server.v1_5_R2.Entity;
|
import net.minecraft.server.v1_11_R1.Entity;
|
||||||
import net.minecraft.server.v1_5_R2.PlayerInteractManager;
|
import net.minecraft.server.v1_11_R1.PlayerInteractManager;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -44,7 +44,6 @@ public class NPCCore {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
taskid = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
|
taskid = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -92,13 +91,15 @@ public class NPCCore {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onChunkLoad(ChunkLoadEvent event) throws EventException {
|
public void onChunkLoad(ChunkLoadEvent event) throws EventException {
|
||||||
for (HumanNPC humannpc : npcs) {
|
for (HumanNPC humannpc : npcs) {
|
||||||
if (humannpc != null && event.getChunk() == humannpc.getBukkitEntity().getLocation().getBlock().getChunk()) {
|
if (humannpc != null
|
||||||
|
&& event.getChunk() == humannpc.getBukkitEntity().getLocation().getBlock().getChunk()) {
|
||||||
|
|
||||||
if (isInLoaded == false) {
|
if (isInLoaded == false) {
|
||||||
BWorld world = getBWorld(event.getWorld());
|
BWorld world = getBWorld(event.getWorld());
|
||||||
|
|
||||||
isInLoaded = true;
|
isInLoaded = true;
|
||||||
}}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -106,7 +107,8 @@ public class NPCCore {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onChunkUnload(ChunkUnloadEvent event) {
|
public void onChunkUnload(ChunkUnloadEvent event) {
|
||||||
for (HumanNPC humannpc : npcs) {
|
for (HumanNPC humannpc : npcs) {
|
||||||
if (humannpc != null && event.getChunk() == humannpc.getBukkitEntity().getLocation().getBlock().getChunk()) {
|
if (humannpc != null
|
||||||
|
&& event.getChunk() == humannpc.getBukkitEntity().getLocation().getBlock().getChunk()) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -130,8 +132,6 @@ public class NPCCore {
|
|||||||
return humannpc;
|
return humannpc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public HumanNPC getHumanNPC(int id) {
|
public HumanNPC getHumanNPC(int id) {
|
||||||
|
|
||||||
for (HumanNPC n : npcs) {
|
for (HumanNPC n : npcs) {
|
||||||
|
@ -2,9 +2,9 @@ package org.jakub1221.herobrineai.NPC.Network;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import net.minecraft.server.v1_5_R2.Connection;
|
import net.minecraft.server.v1_11_R1.Connection;
|
||||||
import net.minecraft.server.v1_5_R2.NetworkManager;
|
import net.minecraft.server.v1_11_R1.NetworkManager;
|
||||||
import net.minecraft.server.v1_5_R2.Packet;
|
import net.minecraft.server.v1_11_R1.Packet;
|
||||||
|
|
||||||
public class NetworkCore extends NetworkManager{
|
public class NetworkCore extends NetworkManager{
|
||||||
|
|
||||||
|
@ -1,26 +1,26 @@
|
|||||||
package org.jakub1221.herobrineai.NPC.Network;
|
package org.jakub1221.herobrineai.NPC.Network;
|
||||||
|
|
||||||
import net.minecraft.server.v1_5_R2.EntityPlayer;
|
import net.minecraft.server.v1_11_R1.EntityPlayer;
|
||||||
import net.minecraft.server.v1_5_R2.Packet;
|
import net.minecraft.server.v1_11_R1.Packet;
|
||||||
import net.minecraft.server.v1_5_R2.Packet101CloseWindow;
|
import net.minecraft.server.v1_11_R1.Packet101CloseWindow;
|
||||||
import net.minecraft.server.v1_5_R2.Packet102WindowClick;
|
import net.minecraft.server.v1_11_R1.Packet102WindowClick;
|
||||||
import net.minecraft.server.v1_5_R2.Packet106Transaction;
|
import net.minecraft.server.v1_11_R1.Packet106Transaction;
|
||||||
import net.minecraft.server.v1_5_R2.Packet10Flying;
|
import net.minecraft.server.v1_11_R1.Packet10Flying;
|
||||||
import net.minecraft.server.v1_5_R2.Packet130UpdateSign;
|
import net.minecraft.server.v1_11_R1.Packet130UpdateSign;
|
||||||
import net.minecraft.server.v1_5_R2.Packet14BlockDig;
|
import net.minecraft.server.v1_11_R1.Packet14BlockDig;
|
||||||
import net.minecraft.server.v1_5_R2.Packet15Place;
|
import net.minecraft.server.v1_11_R1.Packet15Place;
|
||||||
import net.minecraft.server.v1_5_R2.Packet16BlockItemSwitch;
|
import net.minecraft.server.v1_11_R1.Packet16BlockItemSwitch;
|
||||||
import net.minecraft.server.v1_5_R2.Packet18ArmAnimation;
|
import net.minecraft.server.v1_11_R1.Packet18ArmAnimation;
|
||||||
import net.minecraft.server.v1_5_R2.Packet19EntityAction;
|
import net.minecraft.server.v1_11_R1.Packet19EntityAction;
|
||||||
import net.minecraft.server.v1_5_R2.Packet255KickDisconnect;
|
import net.minecraft.server.v1_11_R1.Packet255KickDisconnect;
|
||||||
import net.minecraft.server.v1_5_R2.Packet3Chat;
|
import net.minecraft.server.v1_11_R1.Packet3Chat;
|
||||||
import net.minecraft.server.v1_5_R2.Packet7UseEntity;
|
import net.minecraft.server.v1_11_R1.Packet7UseEntity;
|
||||||
import net.minecraft.server.v1_5_R2.Packet9Respawn;
|
import net.minecraft.server.v1_11_R1.Packet9Respawn;
|
||||||
import net.minecraft.server.v1_5_R2.PlayerConnection;
|
import net.minecraft.server.v1_11_R1.PlayerConnection;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_5_R2.CraftServer;
|
import org.bukkit.craftbukkit.v1_11_R1.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_5_R2.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer;
|
||||||
import org.jakub1221.herobrineai.NPC.NPCCore;
|
import org.jakub1221.herobrineai.NPC.NPCCore;
|
||||||
|
|
||||||
public class NetworkHandler extends PlayerConnection {
|
public class NetworkHandler extends PlayerConnection {
|
||||||
@ -34,10 +34,6 @@ public class NetworkHandler extends PlayerConnection {
|
|||||||
return new CraftPlayer((CraftServer) Bukkit.getServer(), player);
|
return new CraftPlayer((CraftServer) Bukkit.getServer(), player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void d() {
|
|
||||||
};
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void a(Packet10Flying packet10flying) {
|
public void a(Packet10Flying packet10flying) {
|
||||||
};
|
};
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package org.jakub1221.herobrineai.NPC.Network;
|
package org.jakub1221.herobrineai.NPC.Network;
|
||||||
|
|
||||||
import net.minecraft.server.v1_5_R2.Packet;
|
import net.minecraft.server.v1_11_R1.Packet;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.craftbukkit.v1_5_R2.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package org.jakub1221.herobrineai;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.jakub1221.herobrineai.support._CustomItems;
|
import org.jakub1221.herobrineai.support._CustomItems;
|
||||||
|
import org.jakub1221.herobrineai.support._Factions;
|
||||||
import org.jakub1221.herobrineai.support._GriefPrevention;
|
import org.jakub1221.herobrineai.support._GriefPrevention;
|
||||||
import org.jakub1221.herobrineai.support._PreciousStones;
|
import org.jakub1221.herobrineai.support._PreciousStones;
|
||||||
import org.jakub1221.herobrineai.support._Residence;
|
import org.jakub1221.herobrineai.support._Residence;
|
||||||
@ -17,12 +18,14 @@ public class Support {
|
|||||||
private boolean B_CustomItems=false;
|
private boolean B_CustomItems=false;
|
||||||
private boolean B_WorldGuard=false;
|
private boolean B_WorldGuard=false;
|
||||||
private boolean B_PreciousStones=false;
|
private boolean B_PreciousStones=false;
|
||||||
|
private boolean B_Factions=false;
|
||||||
private _Residence ResidenceCore=null;
|
private _Residence ResidenceCore=null;
|
||||||
private _GriefPrevention GriefPreventionCore=null;
|
private _GriefPrevention GriefPreventionCore=null;
|
||||||
private _Towny TownyCore=null;
|
private _Towny TownyCore=null;
|
||||||
private _CustomItems CustomItems=null;
|
private _CustomItems CustomItems=null;
|
||||||
private _WorldGuard WorldGuard=null;
|
private _WorldGuard WorldGuard=null;
|
||||||
private _PreciousStones PreciousStones=null;
|
private _PreciousStones PreciousStones=null;
|
||||||
|
private _Factions Factions=null;
|
||||||
|
|
||||||
public Support(){
|
public Support(){
|
||||||
ResidenceCore=new _Residence();
|
ResidenceCore=new _Residence();
|
||||||
@ -31,11 +34,12 @@ public class Support {
|
|||||||
CustomItems=new _CustomItems();
|
CustomItems=new _CustomItems();
|
||||||
WorldGuard=new _WorldGuard();
|
WorldGuard=new _WorldGuard();
|
||||||
PreciousStones=new _PreciousStones();
|
PreciousStones=new _PreciousStones();
|
||||||
|
Factions=new _Factions();
|
||||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(HerobrineAI.getPluginCore(), new Runnable() {
|
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(HerobrineAI.getPluginCore(), new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
CheckForPlugins();
|
CheckForPlugins();
|
||||||
}
|
}
|
||||||
}, 1 * 10L);
|
}, 1 * 2L);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPreciousStones(){
|
public boolean isPreciousStones(){
|
||||||
@ -53,6 +57,9 @@ public class Support {
|
|||||||
public boolean isTowny(){
|
public boolean isTowny(){
|
||||||
return B_Towny;
|
return B_Towny;
|
||||||
}
|
}
|
||||||
|
public boolean isFactions(){
|
||||||
|
return B_Factions;
|
||||||
|
}
|
||||||
public void CheckForPlugins(){
|
public void CheckForPlugins(){
|
||||||
if (ResidenceCore.Check()){
|
if (ResidenceCore.Check()){
|
||||||
B_Residence=true;
|
B_Residence=true;
|
||||||
@ -79,6 +86,10 @@ public class Support {
|
|||||||
B_PreciousStones=true;
|
B_PreciousStones=true;
|
||||||
HerobrineAI.log.info("[HerobrineAI] PreciousStones plugin detected!");
|
HerobrineAI.log.info("[HerobrineAI] PreciousStones plugin detected!");
|
||||||
}
|
}
|
||||||
|
if (Factions.Check()){
|
||||||
|
B_Factions=true;
|
||||||
|
HerobrineAI.log.info("[HerobrineAI] Factions plugin detected!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public boolean isSecuredArea(Location loc){
|
public boolean isSecuredArea(Location loc){
|
||||||
if (B_Residence){
|
if (B_Residence){
|
||||||
@ -101,6 +112,10 @@ public class Support {
|
|||||||
if (PreciousStones.isSecuredArea(loc)){
|
if (PreciousStones.isSecuredArea(loc)){
|
||||||
return true;
|
return true;
|
||||||
}else{return false;}
|
}else{return false;}
|
||||||
|
}else if (B_Factions){
|
||||||
|
if (Factions.isSecuredArea(loc)){
|
||||||
|
return true;
|
||||||
|
}else{return false;}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
40
src/org/jakub1221/herobrineai/Utils.java
Normal file
40
src/org/jakub1221/herobrineai/Utils.java
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package org.jakub1221.herobrineai;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class Utils {
|
||||||
|
|
||||||
|
private static Random randomGen = new Random();
|
||||||
|
|
||||||
|
public static Random getRandomGen(){
|
||||||
|
return randomGen;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Player getRandomPlayer() {
|
||||||
|
Collection<? extends Player> playersOnline = Bukkit.getServer().getOnlinePlayers();
|
||||||
|
|
||||||
|
if(playersOnline.size() == 1 && ((Player)playersOnline.toArray()[0]).getEntityId() == HerobrineAI.getPluginCore().HerobrineEntityID)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
int player_rolled = new Random().nextInt(playersOnline.size());
|
||||||
|
|
||||||
|
Player p = (Player) playersOnline.toArray()[player_rolled];
|
||||||
|
|
||||||
|
if (p.getEntityId() == HerobrineAI.getPluginCore().HerobrineEntityID)
|
||||||
|
return getRandomPlayer();
|
||||||
|
|
||||||
|
return p;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getRandomPlayerNum() {
|
||||||
|
Collection<? extends Player> playersOnline = Bukkit.getServer().getOnlinePlayers();
|
||||||
|
|
||||||
|
return new Random().nextInt(playersOnline.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
@ -1,18 +1,18 @@
|
|||||||
package org.jakub1221.herobrineai.entity;
|
package org.jakub1221.herobrineai.entity;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Skeleton;
|
import org.bukkit.entity.Skeleton;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.Color;
|
import org.bukkit.Color;
|
||||||
import org.jakub1221.herobrineai.HerobrineAI;
|
import org.jakub1221.herobrineai.HerobrineAI;
|
||||||
|
import org.jakub1221.herobrineai.Utils;
|
||||||
import org.jakub1221.herobrineai.misc.ItemName;
|
import org.jakub1221.herobrineai.misc.ItemName;
|
||||||
|
|
||||||
import net.minecraft.server.v1_5_R2.World;
|
import net.minecraft.server.v1_11_R1.GenericAttributes;
|
||||||
|
import net.minecraft.server.v1_11_R1.World;
|
||||||
|
|
||||||
public class CustomSkeleton extends net.minecraft.server.v1_5_R2.EntitySkeleton implements CustomEntity{
|
public class CustomSkeleton extends net.minecraft.server.v1_11_R1.EntitySkeleton implements CustomEntity {
|
||||||
|
|
||||||
private MobType mobType = null;
|
private MobType mobType = null;
|
||||||
|
|
||||||
@ -26,15 +26,18 @@ public class CustomSkeleton extends net.minecraft.server.v1_5_R2.EntitySkeleton
|
|||||||
|
|
||||||
public void spawnDemon(Location loc) {
|
public void spawnDemon(Location loc) {
|
||||||
|
|
||||||
this.health=HerobrineAI.getPluginCore().getConfigDB().npc.getInt("npc.Demon.HP");
|
this.getAttributeInstance(GenericAttributes.c).setValue(HerobrineAI.getPluginCore().getConfigDB().npc.getDouble("npc.Demon.Speed"));
|
||||||
|
this.getAttributeInstance(GenericAttributes.maxHealth).setValue(HerobrineAI.getPluginCore().getConfigDB().npc.getInt("npc.Demon.HP"));
|
||||||
|
this.setHealth(HerobrineAI.getPluginCore().getConfigDB().npc.getInt("npc.Demon.HP"));
|
||||||
this.setCustomName("Demon");
|
this.setCustomName("Demon");
|
||||||
this.maxHealth=HerobrineAI.getPluginCore().getConfigDB().npc.getInt("npc.Demon.HP");
|
|
||||||
|
|
||||||
((Skeleton)this.getBukkitEntity()).getEquipment().setItemInHand(new ItemStack(Material.GOLDEN_APPLE,1));
|
Skeleton entityCast = (Skeleton) this.getBukkitEntity();
|
||||||
((Skeleton)this.getBukkitEntity()).getEquipment().setHelmet(ItemName.colorLeatherArmor(new ItemStack(Material.LEATHER_HELMET,1), Color.RED));
|
|
||||||
((Skeleton)this.getBukkitEntity()).getEquipment().setChestplate(ItemName.colorLeatherArmor(new ItemStack(Material.LEATHER_CHESTPLATE,1), Color.RED));
|
entityCast.getEquipment().setItemInHand(new ItemStack(Material.GOLDEN_APPLE, 1));
|
||||||
((Skeleton)this.getBukkitEntity()).getEquipment().setLeggings(ItemName.colorLeatherArmor(new ItemStack(Material.LEATHER_LEGGINGS,1), Color.RED));
|
entityCast.getEquipment().setHelmet(ItemName.colorLeatherArmor(new ItemStack(Material.LEATHER_HELMET, 1), Color.RED));
|
||||||
((Skeleton)this.getBukkitEntity()).getEquipment().setBoots(ItemName.colorLeatherArmor(new ItemStack(Material.LEATHER_BOOTS,1), Color.RED));
|
entityCast.getEquipment().setChestplate(ItemName.colorLeatherArmor(new ItemStack(Material.LEATHER_CHESTPLATE, 1), Color.RED));
|
||||||
|
entityCast.getEquipment().setLeggings(ItemName.colorLeatherArmor(new ItemStack(Material.LEATHER_LEGGINGS, 1), Color.RED));
|
||||||
|
entityCast.getEquipment().setBoots(ItemName.colorLeatherArmor(new ItemStack(Material.LEATHER_BOOTS, 1), Color.RED));
|
||||||
this.getBukkitEntity().teleport(loc);
|
this.getBukkitEntity().teleport(loc);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -47,13 +50,19 @@ public class CustomSkeleton extends net.minecraft.server.v1_5_R2.EntitySkeleton
|
|||||||
public void Kill() {
|
public void Kill() {
|
||||||
for (int i = 1; i <= 2500; i++) {
|
for (int i = 1; i <= 2500; i++) {
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().npc.contains("npc.Demon.Drops." + Integer.toString(i)) == true) {
|
if (HerobrineAI.getPluginCore().getConfigDB().npc.contains("npc.Demon.Drops." + Integer.toString(i)) == true) {
|
||||||
int chance=new Random().nextInt(100);
|
int chance = Utils.getRandomGen().nextInt(100);
|
||||||
if (chance<=HerobrineAI.getPluginCore().getConfigDB().npc.getInt("npc.Demon.Drops."+Integer.toString(i)+".Chance")){
|
|
||||||
this.getBukkitEntity().getLocation().getWorld().dropItemNaturally(this.getBukkitEntity().getLocation(), new ItemStack(Material.getMaterial(i),HerobrineAI.getPluginCore().getConfigDB().npc.getInt("npc.Demon.Drops."+Integer.toString(i)+".Count")));
|
int requiredRoll = HerobrineAI.getPluginCore().getConfigDB().npc.getInt("npc.Demon.Drops." + Integer.toString(i) + ".Chance");
|
||||||
|
|
||||||
|
if (chance <= requiredRoll) {
|
||||||
|
|
||||||
|
ItemStack its = new ItemStack(Material.getMaterial(i), HerobrineAI.getPluginCore().getConfigDB().npc.getInt("npc.Demon.Drops." + Integer.toString(i) + ".Count"));
|
||||||
|
|
||||||
|
this.getBukkitEntity().getLocation().getWorld().dropItemNaturally(this.getBukkitEntity().getLocation(),its);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.health=0;
|
this.setHealth(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -4,12 +4,16 @@ import java.util.Random;
|
|||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Skeleton;
|
||||||
|
import org.bukkit.entity.Zombie;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.jakub1221.herobrineai.HerobrineAI;
|
import org.jakub1221.herobrineai.HerobrineAI;
|
||||||
|
import org.jakub1221.herobrineai.Utils;
|
||||||
|
|
||||||
import net.minecraft.server.v1_5_R2.ItemStack;
|
import net.minecraft.server.v1_11_R1.GenericAttributes;
|
||||||
import net.minecraft.server.v1_5_R2.World;
|
import net.minecraft.server.v1_11_R1.World;
|
||||||
|
|
||||||
public class CustomZombie extends net.minecraft.server.v1_5_R2.EntityZombie implements CustomEntity{
|
public class CustomZombie extends net.minecraft.server.v1_11_R1.EntityZombie implements CustomEntity {
|
||||||
|
|
||||||
private MobType mobType = null;
|
private MobType mobType = null;
|
||||||
|
|
||||||
@ -25,30 +29,40 @@ public class CustomZombie extends net.minecraft.server.v1_5_R2.EntityZombie impl
|
|||||||
|
|
||||||
private void spawnArtifactGuardian(Location loc) {
|
private void spawnArtifactGuardian(Location loc) {
|
||||||
|
|
||||||
this.health=HerobrineAI.getPluginCore().getConfigDB().npc.getInt("npc.Guardian.HP");
|
this.getAttributeInstance(GenericAttributes.c).setValue(HerobrineAI.getPluginCore().getConfigDB().npc.getDouble("npc.Guardian.Speed"));
|
||||||
|
this.getAttributeInstance(GenericAttributes.maxHealth).setValue(HerobrineAI.getPluginCore().getConfigDB().npc.getInt("npc.Guardian.HP"));
|
||||||
|
this.setHealth(HerobrineAI.getPluginCore().getConfigDB().npc.getInt("npc.Guardian.HP"));
|
||||||
|
|
||||||
this.setCustomName("Artifact Guardian");
|
this.setCustomName("Artifact Guardian");
|
||||||
this.maxHealth=HerobrineAI.getPluginCore().getConfigDB().npc.getInt("npc.Guardian.HP");
|
|
||||||
this.setEquipment(0, new ItemStack(net.minecraft.server.v1_5_R2.Item.GOLD_SWORD));
|
Zombie entityCast = (Zombie) this.getBukkitEntity();
|
||||||
this.setEquipment(1, new ItemStack(net.minecraft.server.v1_5_R2.Item.GOLD_BOOTS));
|
|
||||||
this.setEquipment(2, new ItemStack(net.minecraft.server.v1_5_R2.Item.GOLD_LEGGINGS));
|
entityCast.getEquipment().setItemInMainHand(new ItemStack(Material.GOLD_SWORD, 1));
|
||||||
this.setEquipment(3, new ItemStack(net.minecraft.server.v1_5_R2.Item.GOLD_CHESTPLATE));
|
entityCast.getEquipment().setHelmet(new ItemStack(Material.GOLD_HELMET, 1));
|
||||||
this.setEquipment(4, new ItemStack(net.minecraft.server.v1_5_R2.Item.GOLD_HELMET));
|
entityCast.getEquipment().setChestplate(new ItemStack(Material.GOLD_CHESTPLATE, 1));
|
||||||
|
entityCast.getEquipment().setLeggings(new ItemStack(Material.GOLD_LEGGINGS, 1));
|
||||||
|
entityCast.getEquipment().setBoots(new ItemStack(Material.GOLD_BOOTS, 1));
|
||||||
|
|
||||||
this.getBukkitEntity().teleport(loc);
|
this.getBukkitEntity().teleport(loc);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void spawnHerobrineWarrior(Location loc) {
|
private void spawnHerobrineWarrior(Location loc) {
|
||||||
|
|
||||||
this.health=HerobrineAI.getPluginCore().getConfigDB().npc.getInt("npc.Warrior.HP");
|
this.getAttributeInstance(GenericAttributes.c).setValue(HerobrineAI.getPluginCore().getConfigDB().npc.getDouble("npc.Warrior.Speed"));
|
||||||
this.setCustomName("Herobrine´s Warrior");
|
this.getAttributeInstance(GenericAttributes.maxHealth).setValue(HerobrineAI.getPluginCore().getConfigDB().npc.getInt("npc.Warrior.HP"));
|
||||||
this.maxHealth=HerobrineAI.getPluginCore().getConfigDB().npc.getInt("npc.Warrior.HP");
|
this.setHealth(HerobrineAI.getPluginCore().getConfigDB().npc.getInt("npc.Warrior.HP"));
|
||||||
this.setEquipment(0, new ItemStack(net.minecraft.server.v1_5_R2.Item.IRON_SWORD));
|
|
||||||
this.setEquipment(1, new ItemStack(net.minecraft.server.v1_5_R2.Item.IRON_BOOTS));
|
this.setCustomName("Herobrine Warrior");
|
||||||
this.setEquipment(2, new ItemStack(net.minecraft.server.v1_5_R2.Item.IRON_LEGGINGS));
|
|
||||||
this.setEquipment(3, new ItemStack(net.minecraft.server.v1_5_R2.Item.IRON_CHESTPLATE));
|
Zombie entityCast = (Zombie) this.getBukkitEntity();
|
||||||
this.setEquipment(4, new ItemStack(net.minecraft.server.v1_5_R2.Item.IRON_HELMET));
|
|
||||||
|
entityCast.getEquipment().setItemInMainHand(new ItemStack(Material.IRON_SWORD, 1));
|
||||||
|
entityCast.getEquipment().setHelmet(new ItemStack(Material.IRON_HELMET, 1));
|
||||||
|
entityCast.getEquipment().setChestplate(new ItemStack(Material.IRON_CHESTPLATE, 1));
|
||||||
|
entityCast.getEquipment().setLeggings(new ItemStack(Material.IRON_LEGGINGS, 1));
|
||||||
|
entityCast.getEquipment().setBoots(new ItemStack(Material.IRON_BOOTS, 1));
|
||||||
|
|
||||||
this.getBukkitEntity().teleport(loc);
|
this.getBukkitEntity().teleport(loc);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -61,18 +75,28 @@ public class CustomZombie extends net.minecraft.server.v1_5_R2.EntityZombie impl
|
|||||||
public void Kill() {
|
public void Kill() {
|
||||||
|
|
||||||
String mobS = "";
|
String mobS = "";
|
||||||
if (this.mobType==MobType.ARTIFACT_GUARDIAN){mobS="Guardian";}else{mobS="Warrior";}
|
if (this.mobType == MobType.ARTIFACT_GUARDIAN) {
|
||||||
|
mobS = "Guardian";
|
||||||
|
} else {
|
||||||
|
mobS = "Warrior";
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 1; i <= 2500; i++) {
|
for (int i = 1; i <= 2500; i++) {
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().npc.contains("npc." + mobS + ".Drops." + Integer.toString(i)) == true) {
|
if (HerobrineAI.getPluginCore().getConfigDB().npc.contains("npc." + mobS + ".Drops." + Integer.toString(i)) == true) {
|
||||||
int chance=new Random().nextInt(100);
|
int chance = Utils.getRandomGen().nextInt(100);
|
||||||
if (chance<=HerobrineAI.getPluginCore().getConfigDB().npc.getInt("npc."+mobS+".Drops."+Integer.toString(i)+".Chance")){
|
|
||||||
this.getBukkitEntity().getLocation().getWorld().dropItemNaturally(this.getBukkitEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.getMaterial(i),HerobrineAI.getPluginCore().getConfigDB().npc.getInt("npc."+mobS+".Drops."+Integer.toString(i)+".Count")));
|
int requiredRoll = HerobrineAI.getPluginCore().getConfigDB().npc.getInt("npc." + mobS + ".Drops." + Integer.toString(i) + ".Chance");
|
||||||
|
|
||||||
|
if (chance <= requiredRoll) {
|
||||||
|
|
||||||
|
ItemStack its = new ItemStack(Material.getMaterial(i), HerobrineAI.getPluginCore().getConfigDB().npc.getInt("npc." + mobS + ".Drops." + Integer.toString(i) + ".Count"));
|
||||||
|
|
||||||
|
this.getBukkitEntity().getLocation().getWorld().dropItemNaturally(this.getBukkitEntity().getLocation(),its);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.health=0;
|
this.setHealth(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -5,7 +5,6 @@ import java.util.Map;
|
|||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.jakub1221.herobrineai.HerobrineAI;
|
|
||||||
|
|
||||||
public class EntityManager {
|
public class EntityManager {
|
||||||
|
|
||||||
@ -14,7 +13,7 @@ public class EntityManager {
|
|||||||
public void spawnCustomZombie(Location loc,MobType mbt){
|
public void spawnCustomZombie(Location loc,MobType mbt){
|
||||||
|
|
||||||
World world = loc.getWorld();
|
World world = loc.getWorld();
|
||||||
net.minecraft.server.v1_5_R2.World mcWorld = ((org.bukkit.craftbukkit.v1_5_R2.CraftWorld) world).getHandle();
|
net.minecraft.server.v1_11_R1.World mcWorld = ((org.bukkit.craftbukkit.v1_11_R1.CraftWorld) world).getHandle();
|
||||||
CustomZombie zmb = new CustomZombie(mcWorld,loc,mbt);
|
CustomZombie zmb = new CustomZombie(mcWorld,loc,mbt);
|
||||||
mcWorld.addEntity(zmb);
|
mcWorld.addEntity(zmb);
|
||||||
mobList.put(new Integer(zmb.getBukkitEntity().getEntityId()),zmb);
|
mobList.put(new Integer(zmb.getBukkitEntity().getEntityId()),zmb);
|
||||||
@ -24,7 +23,7 @@ public class EntityManager {
|
|||||||
public void spawnCustomSkeleton(Location loc,MobType mbt){
|
public void spawnCustomSkeleton(Location loc,MobType mbt){
|
||||||
|
|
||||||
World world = loc.getWorld();
|
World world = loc.getWorld();
|
||||||
net.minecraft.server.v1_5_R2.World mcWorld = ((org.bukkit.craftbukkit.v1_5_R2.CraftWorld) world).getHandle();
|
net.minecraft.server.v1_11_R1.World mcWorld = ((org.bukkit.craftbukkit.v1_11_R1.CraftWorld) world).getHandle();
|
||||||
CustomSkeleton zmb = new CustomSkeleton(mcWorld,loc,mbt);
|
CustomSkeleton zmb = new CustomSkeleton(mcWorld,loc,mbt);
|
||||||
mcWorld.addEntity(zmb);
|
mcWorld.addEntity(zmb);
|
||||||
mobList.put(new Integer(zmb.getBukkitEntity().getEntityId()),zmb);
|
mobList.put(new Integer(zmb.getBukkitEntity().getEntityId()),zmb);
|
||||||
|
@ -12,6 +12,7 @@ import org.bukkit.event.Listener;
|
|||||||
import org.bukkit.event.block.BlockIgniteEvent;
|
import org.bukkit.event.block.BlockIgniteEvent;
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
import org.jakub1221.herobrineai.AI.*;
|
import org.jakub1221.herobrineai.AI.*;
|
||||||
import org.jakub1221.herobrineai.AI.Core.CoreType;
|
import org.jakub1221.herobrineai.AI.Core.CoreType;
|
||||||
import org.jakub1221.herobrineai.AI.cores.Heads;
|
import org.jakub1221.herobrineai.AI.cores.Heads;
|
||||||
@ -32,39 +33,41 @@ public class BlockListener implements Listener{
|
|||||||
Block block = (Block) blockloc.getWorld().getBlockAt(blockloc);
|
Block block = (Block) blockloc.getWorld().getBlockAt(blockloc);
|
||||||
if (block.getType() == Material.NETHERRACK) {
|
if (block.getType() == Material.NETHERRACK) {
|
||||||
|
|
||||||
if (block.getWorld().getBlockAt(blockloc.getBlockX(), blockloc.getBlockY()-1, blockloc.getBlockZ()).getType() == Material.NETHERRACK){
|
Object[][] checkList = {
|
||||||
if (block.getWorld().getBlockAt(blockloc.getBlockX()-1, blockloc.getBlockY()-1, blockloc.getBlockZ()).getType() == Material.GOLD_BLOCK){
|
{ new Vector(0, -1, 0), Material.NETHERRACK },
|
||||||
if (block.getWorld().getBlockAt(blockloc.getBlockX()-1, blockloc.getBlockY()-1, blockloc.getBlockZ()-1).getType() == Material.GOLD_BLOCK){
|
{ new Vector(-1, -1, 0), Material.GOLD_BLOCK },
|
||||||
if (block.getWorld().getBlockAt(blockloc.getBlockX()-1, blockloc.getBlockY()-1, blockloc.getBlockZ()+1).getType() == Material.GOLD_BLOCK){
|
{ new Vector(-1, -1, -1), Material.GOLD_BLOCK },
|
||||||
if (block.getWorld().getBlockAt(blockloc.getBlockX()+1, blockloc.getBlockY()-1, blockloc.getBlockZ()).getType() == Material.GOLD_BLOCK){
|
{ new Vector(-1, -1, 1), Material.GOLD_BLOCK },
|
||||||
if (block.getWorld().getBlockAt(blockloc.getBlockX()+1, blockloc.getBlockY()-1, blockloc.getBlockZ()-1).getType() == Material.GOLD_BLOCK){
|
{ new Vector(1, -1, 0), Material.GOLD_BLOCK },
|
||||||
if (block.getWorld().getBlockAt(blockloc.getBlockX()+1, blockloc.getBlockY()-1, blockloc.getBlockZ()+1).getType() == Material.GOLD_BLOCK){
|
{ new Vector(1, -1, -1), Material.GOLD_BLOCK },
|
||||||
if (block.getWorld().getBlockAt(blockloc.getBlockX(), blockloc.getBlockY()-1, blockloc.getBlockZ()-1).getType() == Material.GOLD_BLOCK){
|
{ new Vector(1, -1, 1), Material.GOLD_BLOCK },
|
||||||
if (block.getWorld().getBlockAt(blockloc.getBlockX(), blockloc.getBlockY()-1, blockloc.getBlockZ()+1).getType() == Material.GOLD_BLOCK){
|
{ new Vector(0, -1, -1), Material.GOLD_BLOCK },
|
||||||
if (block.getWorld().getBlockAt(blockloc.getBlockX(), blockloc.getBlockY(), blockloc.getBlockZ()+1).getType() == Material.REDSTONE_TORCH_ON){
|
{ new Vector(0, -1, +1), Material.GOLD_BLOCK },
|
||||||
if (block.getWorld().getBlockAt(blockloc.getBlockX(), blockloc.getBlockY(), blockloc.getBlockZ()-1).getType() == Material.REDSTONE_TORCH_ON){
|
{ new Vector(0, 0, 1), Material.REDSTONE_TORCH_ON },
|
||||||
if (block.getWorld().getBlockAt(blockloc.getBlockX()+1, blockloc.getBlockY(), blockloc.getBlockZ()).getType() == Material.REDSTONE_TORCH_ON){
|
{ new Vector(0, 0, -1), Material.REDSTONE_TORCH_ON },
|
||||||
if (block.getWorld().getBlockAt(blockloc.getBlockX()-1, blockloc.getBlockY(), blockloc.getBlockZ()).getType() == Material.REDSTONE_TORCH_ON){
|
{ new Vector(1, 0, 0), Material.REDSTONE_TORCH_ON },
|
||||||
|
{ new Vector(-1, 0, 0), Material.REDSTONE_TORCH_ON }
|
||||||
|
};
|
||||||
|
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().UseTotem==true && AICore.isTotemCalled==false){
|
boolean checkListCorrect = true;
|
||||||
|
|
||||||
|
for (int i = 0; i < checkList.length; i++) {
|
||||||
|
|
||||||
|
Vector v = (Vector) checkList[i][0];
|
||||||
|
|
||||||
|
Block checkBlock = block.getWorld().getBlockAt(blockloc.getBlockX() + v.getBlockX(),
|
||||||
|
blockloc.getBlockY() + v.getBlockY(), blockloc.getBlockZ() + v.getBlockZ());
|
||||||
|
|
||||||
|
if (checkBlock.getType() != (Material) checkList[i][1]) {
|
||||||
|
checkListCorrect = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (checkListCorrect && HerobrineAI.getPluginCore().getConfigDB().UseTotem && !AICore.isTotemCalled) {
|
||||||
HerobrineAI.getPluginCore().getAICore().PlayerCallTotem(event.getPlayer());
|
HerobrineAI.getPluginCore().getAICore().PlayerCallTotem(event.getPlayer());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -73,6 +76,7 @@ public class BlockListener implements Listener{
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -89,8 +93,8 @@ public class BlockListener implements Listener{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onBlockPlace(BlockPlaceEvent event) {
|
public void onBlockPlace(BlockPlaceEvent event) {
|
||||||
if (event.getBlock().getWorld() == Bukkit.getServer().getWorld("world_herobrineai_graveyard")) {
|
if (event.getBlock().getWorld() == Bukkit.getServer().getWorld("world_herobrineai_graveyard")) {
|
||||||
@ -98,6 +102,5 @@ public class BlockListener implements Listener{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,8 @@ import org.bukkit.Location;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Arrow;
|
import org.bukkit.entity.Arrow;
|
||||||
|
|
||||||
import org.bukkit.entity.CreatureType;
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Projectile;
|
import org.bukkit.entity.Projectile;
|
||||||
@ -25,6 +25,7 @@ import org.bukkit.event.entity.EntityDeathEvent;
|
|||||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.jakub1221.herobrineai.HerobrineAI;
|
import org.jakub1221.herobrineai.HerobrineAI;
|
||||||
|
import org.jakub1221.herobrineai.Utils;
|
||||||
import org.jakub1221.herobrineai.AI.*;
|
import org.jakub1221.herobrineai.AI.*;
|
||||||
import org.jakub1221.herobrineai.AI.Core.CoreType;
|
import org.jakub1221.herobrineai.AI.Core.CoreType;
|
||||||
import org.jakub1221.herobrineai.entity.MobType;
|
import org.jakub1221.herobrineai.entity.MobType;
|
||||||
@ -39,22 +40,26 @@ public class EntityListener implements Listener{
|
|||||||
private ArrayList<String> getLore = new ArrayList<String>();
|
private ArrayList<String> getLore = new ArrayList<String>();
|
||||||
|
|
||||||
public EntityListener() {
|
public EntityListener() {
|
||||||
equalsLore.add("Herobrine´s artifact");
|
equalsLore.add("Herobrine artifact");
|
||||||
equalsLore.add("Bow of Teleporting");
|
equalsLore.add("Bow of Teleporting");
|
||||||
equalsLoreS.add("Herobrine´s artifact");
|
equalsLoreS.add("Herobrine artifact");
|
||||||
equalsLoreS.add("Sword of Lighting");
|
equalsLoreS.add("Sword of Lighting");
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onCreatureSpawn(CreatureSpawnEvent event) {
|
public void onCreatureSpawn(CreatureSpawnEvent event) {
|
||||||
Entity entity = event.getEntity();
|
if (!HerobrineAI.isNPCDisabled) {
|
||||||
CreatureType creatureType = event.getCreatureType();
|
if (HerobrineAI.getPluginCore().getConfigDB().useWorlds.contains(event.getEntity().getLocation().getWorld().getName())) {
|
||||||
if (event.isCancelled()) return;
|
|
||||||
|
|
||||||
if (creatureType == CreatureType.ZOMBIE){
|
Entity entity = event.getEntity();
|
||||||
|
EntityType creatureType = event.getEntityType();
|
||||||
|
|
||||||
|
if (event.isCancelled())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (creatureType == EntityType.ZOMBIE) {
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().UseNPC_Warrior) {
|
if (HerobrineAI.getPluginCore().getConfigDB().UseNPC_Warrior) {
|
||||||
if (new Random().nextInt(100)<HerobrineAI.getPluginCore().getConfigDB().npc.getInt("npc.Warrior.SpawnChance")){
|
if (Utils.getRandomGen().nextInt(100) < HerobrineAI.getPluginCore().getConfigDB().npc.getInt("npc.Warrior.SpawnChance")) {
|
||||||
|
|
||||||
if (HerobrineAI.getPluginCore().getEntityManager().isCustomMob(entity.getEntityId()) == false) {
|
if (HerobrineAI.getPluginCore().getEntityManager().isCustomMob(entity.getEntityId()) == false) {
|
||||||
LivingEntity ent = (LivingEntity) entity;
|
LivingEntity ent = (LivingEntity) entity;
|
||||||
@ -66,9 +71,9 @@ public class EntityListener implements Listener{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else if (creatureType == CreatureType.SKELETON){
|
} else if (creatureType == EntityType.SKELETON) {
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().UseNPC_Demon) {
|
if (HerobrineAI.getPluginCore().getConfigDB().UseNPC_Demon) {
|
||||||
if (new Random().nextInt(100)<HerobrineAI.getPluginCore().getConfigDB().npc.getInt("npc.Demon.SpawnChance")){
|
if (Utils.getRandomGen().nextInt(100) < HerobrineAI.getPluginCore().getConfigDB().npc.getInt("npc.Demon.SpawnChance")) {
|
||||||
|
|
||||||
if (HerobrineAI.getPluginCore().getEntityManager().isCustomMob(entity.getEntityId()) == false) {
|
if (HerobrineAI.getPluginCore().getEntityManager().isCustomMob(entity.getEntityId()) == false) {
|
||||||
LivingEntity ent = (LivingEntity) entity;
|
LivingEntity ent = (LivingEntity) entity;
|
||||||
@ -82,6 +87,8 @@ public class EntityListener implements Listener{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onEntityDeathEvent(EntityDeathEvent event) {
|
public void onEntityDeathEvent(EntityDeathEvent event) {
|
||||||
@ -102,16 +109,22 @@ public class EntityListener implements Listener{
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onProjectileHit(ProjectileHitEvent event) {
|
public void onProjectileHit(ProjectileHitEvent event) {
|
||||||
if (event.getEntity() instanceof Arrow) {
|
if (event.getEntity() instanceof Arrow) {
|
||||||
|
|
||||||
Arrow arrow = (Arrow) event.getEntity();
|
Arrow arrow = (Arrow) event.getEntity();
|
||||||
if (arrow.getShooter() instanceof Player) {
|
if (arrow.getShooter() instanceof Player) {
|
||||||
|
|
||||||
Player player = (Player) arrow.getShooter();
|
Player player = (Player) arrow.getShooter();
|
||||||
if (player.getItemInHand() != null) {
|
if (player.getItemInHand() != null) {
|
||||||
|
|
||||||
itemInHand = player.getItemInHand();
|
itemInHand = player.getItemInHand();
|
||||||
if (itemInHand.getType() != null) {
|
if (itemInHand.getType() != null) {
|
||||||
|
|
||||||
if (itemInHand.getType() == Material.BOW) {
|
if (itemInHand.getType() == Material.BOW) {
|
||||||
getLore = ItemName.getLore(itemInHand);
|
getLore = ItemName.getLore(itemInHand);
|
||||||
if (getLore != null) {
|
if (getLore != null) {
|
||||||
|
|
||||||
if (getLore.containsAll(equalsLore)) {
|
if (getLore.containsAll(equalsLore)) {
|
||||||
|
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().UseArtifactBow) {
|
if (HerobrineAI.getPluginCore().getConfigDB().UseArtifactBow) {
|
||||||
|
|
||||||
player.teleport(arrow.getLocation());
|
player.teleport(arrow.getLocation());
|
||||||
@ -119,7 +132,6 @@ public class EntityListener implements Listener{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -137,35 +149,30 @@ public class EntityListener implements Listener{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("static-access")
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onEntityDamage(EntityDamageEvent event) {
|
public void onEntityDamage(EntityDamageEvent event) {
|
||||||
if (event.getEntity().getEntityId() == HerobrineAI.HerobrineEntityID) {
|
if (event.getEntity().getEntityId() == HerobrineAI.HerobrineEntityID) {
|
||||||
if (event instanceof EntityDamageByEntityEvent) {
|
if (event instanceof EntityDamageByEntityEvent) {
|
||||||
|
|
||||||
EntityDamageByEntityEvent dEvent = (EntityDamageByEntityEvent) event;
|
EntityDamageByEntityEvent dEvent = (EntityDamageByEntityEvent) event;
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().Killable==true && HerobrineAI.getPluginCore().getAICore().getCoreTypeNow()!=CoreType.GRAVEYARD){
|
if (HerobrineAI.getPluginCore().getConfigDB().Killable == true
|
||||||
|
&& HerobrineAI.getPluginCore().getAICore().getCoreTypeNow() != CoreType.GRAVEYARD) {
|
||||||
|
|
||||||
if (dEvent.getDamager() instanceof Player) {
|
if (dEvent.getDamager() instanceof Player) {
|
||||||
if (event.getDamage() >= HerobrineAI.HerobrineHP) {
|
if (event.getDamage() >= HerobrineAI.HerobrineHP) {
|
||||||
|
|
||||||
|
HerobrineDropItems();
|
||||||
int i=1;
|
|
||||||
for(i=1;i<=2500;i++){
|
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().config.contains("config.Drops."+Integer.toString(i))==true){
|
|
||||||
Random randgen = new Random();
|
|
||||||
int chance=randgen.nextInt(100);
|
|
||||||
if (chance<=HerobrineAI.getPluginCore().getConfigDB().config.getInt("config.Drops."+Integer.toString(i)+".chance")){
|
|
||||||
HerobrineAI.HerobrineNPC.getBukkitEntity().getLocation().getWorld().dropItemNaturally(HerobrineAI.HerobrineNPC.getBukkitEntity().getLocation(), new ItemStack(Material.getMaterial(i),HerobrineAI.getPluginCore().getConfigDB().config.getInt("config.Drops."+Integer.toString(i)+".count")));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
HerobrineAI.getPluginCore().getAICore().CancelTarget(CoreType.ANY);
|
HerobrineAI.getPluginCore().getAICore().CancelTarget(CoreType.ANY);
|
||||||
HerobrineAI.HerobrineHP = HerobrineAI.HerobrineMaxHP;
|
HerobrineAI.HerobrineHP = HerobrineAI.HerobrineMaxHP;
|
||||||
Player player = (Player) dEvent.getDamager();
|
Player player = (Player) dEvent.getDamager();
|
||||||
player.sendMessage("<Herobrine> " + HerobrineAI.getPluginCore().getConfigDB().DeathMessage);
|
player.sendMessage("<Herobrine> " + HerobrineAI.getPluginCore().getConfigDB().DeathMessage);
|
||||||
|
|
||||||
}else{HerobrineAI.HerobrineHP-=event.getDamage();HerobrineAI.HerobrineNPC.HurtAnimation();AICore.log.info("HIT: "+event.getDamage());}
|
} else {
|
||||||
|
HerobrineAI.HerobrineHP -= event.getDamage();
|
||||||
|
HerobrineAI.HerobrineNPC.HurtAnimation();
|
||||||
|
AICore.log.info("HIT: " + event.getDamage());
|
||||||
|
}
|
||||||
} else if (dEvent.getDamager() instanceof Projectile) {
|
} else if (dEvent.getDamager() instanceof Projectile) {
|
||||||
|
|
||||||
Arrow arrow = (Arrow) dEvent.getDamager();
|
Arrow arrow = (Arrow) dEvent.getDamager();
|
||||||
@ -177,33 +184,28 @@ public class EntityListener implements Listener{
|
|||||||
|
|
||||||
if (event.getDamage() >= HerobrineAI.HerobrineHP) {
|
if (event.getDamage() >= HerobrineAI.HerobrineHP) {
|
||||||
|
|
||||||
|
HerobrineDropItems();
|
||||||
int i=1;
|
|
||||||
for(i=1;i<=2500;i++){
|
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().config.contains("config.Drops."+Integer.toString(i))==true){
|
|
||||||
Random randgen = new Random();
|
|
||||||
int chance=randgen.nextInt(100);
|
|
||||||
if (chance<=HerobrineAI.getPluginCore().getConfigDB().config.getInt("config.Drops."+Integer.toString(i)+".chance")){
|
|
||||||
HerobrineAI.HerobrineNPC.getBukkitEntity().getLocation().getWorld().dropItemNaturally(HerobrineAI.HerobrineNPC.getBukkitEntity().getLocation(), new ItemStack(Material.getMaterial(i),HerobrineAI.getPluginCore().getConfigDB().config.getInt("config.Drops."+Integer.toString(i)+".count")));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
HerobrineAI.getPluginCore().getAICore().CancelTarget(CoreType.ANY);
|
HerobrineAI.getPluginCore().getAICore().CancelTarget(CoreType.ANY);
|
||||||
HerobrineAI.HerobrineHP = HerobrineAI.HerobrineMaxHP;
|
HerobrineAI.HerobrineHP = HerobrineAI.HerobrineMaxHP;
|
||||||
Player player = (Player) arrow.getShooter();
|
Player player = (Player) arrow.getShooter();
|
||||||
player.sendMessage("<Herobrine> " + HerobrineAI.getPluginCore().getConfigDB().DeathMessage);
|
player.sendMessage("<Herobrine> " + HerobrineAI.getPluginCore().getConfigDB().DeathMessage);
|
||||||
|
|
||||||
}else{HerobrineAI.HerobrineHP-=event.getDamage();HerobrineAI.HerobrineNPC.HurtAnimation();AICore.log.info("HIT: "+event.getDamage());}
|
} else {
|
||||||
|
HerobrineAI.HerobrineHP -= event.getDamage();
|
||||||
|
HerobrineAI.HerobrineNPC.HurtAnimation();
|
||||||
|
AICore.log.info("HIT: " + event.getDamage());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}else{if (HerobrineAI.getPluginCore().getAICore().getCoreTypeNow() == CoreType.RANDOM_POSITION){
|
} else {
|
||||||
|
if (HerobrineAI.getPluginCore().getAICore().getCoreTypeNow() == CoreType.RANDOM_POSITION) {
|
||||||
Location newloc = (Location) HerobrineAI.HerobrineNPC.getBukkitEntity().getLocation();
|
Location newloc = (Location) HerobrineAI.HerobrineNPC.getBukkitEntity().getLocation();
|
||||||
newloc.setY(-20);
|
newloc.setY(-20);
|
||||||
HerobrineAI.HerobrineNPC.moveTo(newloc);
|
HerobrineAI.HerobrineNPC.moveTo(newloc);
|
||||||
HerobrineAI.getPluginCore().getAICore().CancelTarget(CoreType.ANY);
|
HerobrineAI.getPluginCore().getAICore().CancelTarget(CoreType.ANY);
|
||||||
}}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (HerobrineAI.getPluginCore().getAICore().getCoreTypeNow() == CoreType.RANDOM_POSITION) {
|
if (HerobrineAI.getPluginCore().getAICore().getCoreTypeNow() == CoreType.RANDOM_POSITION) {
|
||||||
Location newloc = (Location) HerobrineAI.HerobrineNPC.getBukkitEntity().getLocation();
|
Location newloc = (Location) HerobrineAI.HerobrineNPC.getBukkitEntity().getLocation();
|
||||||
@ -216,12 +218,10 @@ public class EntityListener implements Listener{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
event.setDamage(0);
|
event.setDamage(0);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (event instanceof EntityDamageByEntityEvent) {
|
if (event instanceof EntityDamageByEntityEvent) {
|
||||||
EntityDamageByEntityEvent dEvent = (EntityDamageByEntityEvent) event;
|
EntityDamageByEntityEvent dEvent = (EntityDamageByEntityEvent) event;
|
||||||
@ -234,7 +234,7 @@ public class EntityListener implements Listener{
|
|||||||
getLore = ItemName.getLore(itemInHand);
|
getLore = ItemName.getLore(itemInHand);
|
||||||
if (getLore.containsAll(equalsLoreS)) {
|
if (getLore.containsAll(equalsLoreS)) {
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().UseArtifactSword) {
|
if (HerobrineAI.getPluginCore().getConfigDB().UseArtifactSword) {
|
||||||
if (new Random().nextBoolean()){
|
if (Utils.getRandomGen().nextBoolean()) {
|
||||||
player.getLocation().getWorld().strikeLightning(event.getEntity().getLocation());
|
player.getLocation().getWorld().strikeLightning(event.getEntity().getLocation());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -244,7 +244,7 @@ public class EntityListener implements Listener{
|
|||||||
}
|
}
|
||||||
} else if (dEvent.getDamager() instanceof Zombie) {
|
} else if (dEvent.getDamager() instanceof Zombie) {
|
||||||
Zombie zmb = (Zombie) dEvent.getDamager();
|
Zombie zmb = (Zombie) dEvent.getDamager();
|
||||||
if (zmb.getCustomName()=="Artifact Guardian" || zmb.getCustomName()=="Herobrine´s Warrior"){
|
if (zmb.getCustomName() == "Artifact Guardian" || zmb.getCustomName() == "Herobrine<EFBFBD>s Warrior") {
|
||||||
|
|
||||||
dEvent.setDamage(dEvent.getDamage() * 3);
|
dEvent.setDamage(dEvent.getDamage() * 3);
|
||||||
}
|
}
|
||||||
@ -287,4 +287,28 @@ public class EntityListener implements Listener{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void HerobrineDropItems(){
|
||||||
|
for (int i = 1; i <= 2500; i++) {
|
||||||
|
if (HerobrineAI.getPluginCore().getConfigDB().config.contains("config.Drops." + Integer.toString(i)) == true) {
|
||||||
|
|
||||||
|
Random randgen = Utils.getRandomGen();
|
||||||
|
|
||||||
|
int chance = randgen.nextInt(100);
|
||||||
|
|
||||||
|
int requiredRoll = HerobrineAI.getPluginCore().getConfigDB().config.getInt("config.Drops." + Integer.toString(i) + ".chance");
|
||||||
|
|
||||||
|
if (chance <= requiredRoll) {
|
||||||
|
|
||||||
|
int itsAmount = HerobrineAI.getPluginCore().getConfigDB().config.getInt("config.Drops." + Integer.toString(i)+ ".count");
|
||||||
|
|
||||||
|
ItemStack its = new ItemStack(Material.getMaterial(i), itsAmount);
|
||||||
|
|
||||||
|
HerobrineAI.HerobrineNPC.getBukkitEntity().getLocation().getWorld().dropItemNaturally(
|
||||||
|
HerobrineAI.HerobrineNPC.getBukkitEntity().getLocation(),
|
||||||
|
its);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,9 +25,13 @@ public class InventoryListener implements Listener{
|
|||||||
HerobrineAI.getPluginCore().getAICore().getCore(CoreType.BOOK).RunCore(data);
|
HerobrineAI.getPluginCore().getAICore().getCore(CoreType.BOOK).RunCore(data);
|
||||||
|
|
||||||
if (new Random().nextInt(100) > 97) {
|
if (new Random().nextInt(100) > 97) {
|
||||||
|
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().UseHeads) {
|
if (HerobrineAI.getPluginCore().getConfigDB().UseHeads) {
|
||||||
if (event.getInventory().firstEmpty() != -1) {
|
if (event.getInventory().firstEmpty() != -1) {
|
||||||
event.getInventory().setItem(event.getInventory().firstEmpty(),ItemName.CreateSkull(event.getPlayer().getName()));
|
if (HerobrineAI.getPluginCore().getAICore().getResetLimits().isHead()) {
|
||||||
|
event.getInventory().setItem(event.getInventory().firstEmpty(),
|
||||||
|
ItemName.CreateSkull(event.getPlayer().getName()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -37,18 +41,23 @@ public class InventoryListener implements Listener{
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onInventoryOpen(InventoryOpenEvent event) {
|
public void onInventoryOpen(InventoryOpenEvent event) {
|
||||||
|
|
||||||
|
if (event.getInventory().getType() == InventoryType.CHEST
|
||||||
|
|| event.getInventory().getType() == InventoryType.FURNACE
|
||||||
|
|| event.getInventory().getType() == InventoryType.WORKBENCH) {
|
||||||
|
|
||||||
if (event.getInventory().getType() == InventoryType.CHEST || event.getInventory().getType() == InventoryType.FURNACE || event.getInventory().getType() == InventoryType.WORKBENCH){
|
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().useWorlds.contains(event.getPlayer().getLocation().getWorld().getName())) {
|
if (HerobrineAI.getPluginCore().getConfigDB().useWorlds.contains(event.getPlayer().getLocation().getWorld().getName())) {
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().PlaceSigns==true && HerobrineAI.getPluginCore().getSupport().checkSigns(event.getPlayer().getLocation())){
|
|
||||||
|
if (HerobrineAI.getPluginCore().getConfigDB().PlaceSigns == true
|
||||||
|
&& HerobrineAI.getPluginCore().getSupport().checkSigns(event.getPlayer().getLocation())) {
|
||||||
|
|
||||||
|
if (HerobrineAI.getPluginCore().getAICore().getResetLimits().isSign()) {
|
||||||
Object[] data = { event.getPlayer().getLocation(), event.getPlayer().getLocation() };
|
Object[] data = { event.getPlayer().getLocation(), event.getPlayer().getLocation() };
|
||||||
HerobrineAI.getPluginCore().getAICore().getCore(CoreType.SIGNS).RunCore(data);
|
HerobrineAI.getPluginCore().getAICore().getCore(CoreType.SIGNS).RunCore(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package org.jakub1221.herobrineai.listeners;
|
package org.jakub1221.herobrineai.listeners;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -9,7 +8,7 @@ import org.bukkit.Location;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Jukebox;
|
import org.bukkit.block.Jukebox;
|
||||||
import org.bukkit.craftbukkit.v1_5_R2.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@ -25,16 +24,15 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
|||||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.jakub1221.herobrineai.HerobrineAI;
|
import org.jakub1221.herobrineai.HerobrineAI;
|
||||||
|
import org.jakub1221.herobrineai.Utils;
|
||||||
import org.jakub1221.herobrineai.AI.AICore;
|
import org.jakub1221.herobrineai.AI.AICore;
|
||||||
import org.jakub1221.herobrineai.AI.Core.CoreType;
|
import org.jakub1221.herobrineai.AI.Core.CoreType;
|
||||||
import org.jakub1221.herobrineai.misc.ItemName;
|
import org.jakub1221.herobrineai.misc.ItemName;
|
||||||
|
|
||||||
public class PlayerListener implements Listener {
|
public class PlayerListener implements Listener {
|
||||||
|
|
||||||
private ItemStack itemInHand=null;
|
|
||||||
private ArrayList<String> equalsLoreS = new ArrayList<String>();
|
private ArrayList<String> equalsLoreS = new ArrayList<String>();
|
||||||
private ArrayList<String> equalsLoreA = new ArrayList<String>();
|
private ArrayList<String> equalsLoreA = new ArrayList<String>();
|
||||||
private ArrayList<String> getLore = new ArrayList<String>();
|
|
||||||
private ArrayList<LivingEntity> LivingEntities = new ArrayList<LivingEntity>();
|
private ArrayList<LivingEntity> LivingEntities = new ArrayList<LivingEntity>();
|
||||||
private Location le_loc = null;
|
private Location le_loc = null;
|
||||||
private Location p_loc = null;
|
private Location p_loc = null;
|
||||||
@ -42,56 +40,82 @@ public class PlayerListener implements Listener{
|
|||||||
private boolean canUse = false;
|
private boolean canUse = false;
|
||||||
|
|
||||||
public PlayerListener() {
|
public PlayerListener() {
|
||||||
equalsLoreS.add("Herobrine´s artifact");
|
equalsLoreS.add("Herobrine artifact");
|
||||||
equalsLoreS.add("Sword of Lighting");
|
equalsLoreS.add("Sword of Lighting");
|
||||||
equalsLoreA.add("Herobrine´s artifact");
|
equalsLoreA.add("Herobrine artifact");
|
||||||
equalsLoreA.add("Apple of Death");
|
equalsLoreA.add("Apple of Death");
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||||
|
|
||||||
if (event.getAction() == Action.LEFT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
if (event.getAction() == Action.LEFT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||||
if (event.getClickedBlock() != null && event.getPlayer().getItemInHand() != null) {
|
if (event.getClickedBlock() != null && event.getPlayer().getItemInHand() != null) {
|
||||||
|
|
||||||
ItemStack itemInHand = event.getPlayer().getItemInHand();
|
ItemStack itemInHand = event.getPlayer().getItemInHand();
|
||||||
if (event.getPlayer().getItemInHand().getType() != null) {
|
if (event.getPlayer().getItemInHand().getType() != null) {
|
||||||
if (itemInHand.getType() == Material.DIAMOND_SWORD || itemInHand.getType() == Material.GOLDEN_APPLE){
|
|
||||||
|
if (itemInHand.getType() == Material.DIAMOND_SWORD
|
||||||
|
|| itemInHand.getType() == Material.GOLDEN_APPLE) {
|
||||||
|
|
||||||
if (ItemName.getLore(itemInHand) != null) {
|
if (ItemName.getLore(itemInHand) != null) {
|
||||||
if (ItemName.getLore(itemInHand).containsAll(equalsLoreS) && HerobrineAI.getPluginCore().getConfigDB().UseArtifactSword){
|
|
||||||
if (new Random().nextBoolean()){
|
if (ItemName.getLore(itemInHand).containsAll(equalsLoreS)
|
||||||
event.getPlayer().getLocation().getWorld().strikeLightning(event.getClickedBlock().getLocation());
|
&& HerobrineAI.getPluginCore().getConfigDB().UseArtifactSword) {
|
||||||
|
|
||||||
|
if (Utils.getRandomGen().nextBoolean()) {
|
||||||
|
event.getPlayer().getLocation().getWorld()
|
||||||
|
.strikeLightning(event.getClickedBlock().getLocation());
|
||||||
}
|
}
|
||||||
}else if (ItemName.getLore(itemInHand).containsAll(equalsLoreA) && HerobrineAI.getPluginCore().getConfigDB().UseArtifactApple){
|
|
||||||
|
} else if (ItemName.getLore(itemInHand).containsAll(equalsLoreA)
|
||||||
|
&& HerobrineAI.getPluginCore().getConfigDB().UseArtifactApple) {
|
||||||
|
|
||||||
timestamp = System.currentTimeMillis() / 1000;
|
timestamp = System.currentTimeMillis() / 1000;
|
||||||
canUse = false;
|
canUse = false;
|
||||||
|
|
||||||
if (HerobrineAI.getPluginCore().PlayerApple.containsKey(event.getPlayer())) {
|
if (HerobrineAI.getPluginCore().PlayerApple.containsKey(event.getPlayer())) {
|
||||||
if (HerobrineAI.getPluginCore().PlayerApple.get(event.getPlayer()) < timestamp) {
|
if (HerobrineAI.getPluginCore().PlayerApple.get(event.getPlayer()) < timestamp) {
|
||||||
HerobrineAI.getPluginCore().PlayerApple.remove(event.getPlayer());
|
HerobrineAI.getPluginCore().PlayerApple.remove(event.getPlayer());
|
||||||
canUse = true;
|
canUse = true;
|
||||||
}else{canUse=false;}
|
} else {
|
||||||
}else{canUse=true;}
|
canUse = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
canUse = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (canUse == true) {
|
if (canUse == true) {
|
||||||
|
|
||||||
event.getPlayer().getWorld().createExplosion(event.getPlayer().getLocation(), 0F);
|
event.getPlayer().getWorld().createExplosion(event.getPlayer().getLocation(), 0F);
|
||||||
LivingEntities = (ArrayList<LivingEntity>) event.getPlayer().getLocation().getWorld().getLivingEntities();
|
LivingEntities = (ArrayList<LivingEntity>) event.getPlayer().getLocation()
|
||||||
|
.getWorld().getLivingEntities();
|
||||||
HerobrineAI.getPluginCore().PlayerApple.put(event.getPlayer(), timestamp + 60);
|
HerobrineAI.getPluginCore().PlayerApple.put(event.getPlayer(), timestamp + 60);
|
||||||
|
|
||||||
for (int i = 0; i <= LivingEntities.size() - 1; i++) {
|
for (int i = 0; i <= LivingEntities.size() - 1; i++) {
|
||||||
|
|
||||||
if (LivingEntities.get(i) instanceof Player || LivingEntities.get(i).getEntityId() == HerobrineAI.HerobrineEntityID){}else{
|
if (LivingEntities.get(i) instanceof Player || LivingEntities.get(i)
|
||||||
|
.getEntityId() == HerobrineAI.HerobrineEntityID) {
|
||||||
|
} else {
|
||||||
le_loc = LivingEntities.get(i).getLocation();
|
le_loc = LivingEntities.get(i).getLocation();
|
||||||
p_loc = event.getPlayer().getLocation();
|
p_loc = event.getPlayer().getLocation();
|
||||||
if (le_loc.getBlockX() < p_loc.getBlockX()+20 && le_loc.getBlockX() > p_loc.getBlockX()-20){
|
|
||||||
if (le_loc.getBlockY() < p_loc.getBlockY()+10 && le_loc.getBlockY() > p_loc.getBlockY()-10){
|
if (le_loc.getBlockX() < p_loc.getBlockX() + 20
|
||||||
if (le_loc.getBlockZ() < p_loc.getBlockZ()+20 && le_loc.getBlockZ() > p_loc.getBlockZ()-20){
|
&& le_loc.getBlockX() > p_loc.getBlockX() - 20) {
|
||||||
|
|
||||||
|
if (le_loc.getBlockY() < p_loc.getBlockY() + 10
|
||||||
|
&& le_loc.getBlockY() > p_loc.getBlockY() - 10) {
|
||||||
|
|
||||||
|
if (le_loc.getBlockZ() < p_loc.getBlockZ() + 20
|
||||||
|
&& le_loc.getBlockZ() > p_loc.getBlockZ() - 20) {
|
||||||
|
|
||||||
event.getPlayer().getWorld().createExplosion(LivingEntities.get(i).getLocation(), 0F);
|
event.getPlayer().getWorld().createExplosion(LivingEntities.get(i).getLocation(), 0F);
|
||||||
LivingEntities.get(i).damage(10000);
|
LivingEntities.get(i).damage(10000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
event.getPlayer().sendMessage(ChatColor.RED + "Apple of Death is recharging!");
|
event.getPlayer().sendMessage(ChatColor.RED + "Apple of Death is recharging!");
|
||||||
}
|
}
|
||||||
@ -102,21 +126,27 @@ public class PlayerListener implements Listener{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (event.getClickedBlock() != null) {
|
if (event.getClickedBlock() != null) {
|
||||||
if (event.getPlayer().getItemInHand() != null) {
|
if (event.getPlayer().getItemInHand() != null) {
|
||||||
if (event.getClickedBlock().getType() == Material.JUKEBOX) {
|
if (event.getClickedBlock().getType() == Material.JUKEBOX) {
|
||||||
|
|
||||||
ItemStack item = event.getPlayer().getItemInHand();
|
ItemStack item = event.getPlayer().getItemInHand();
|
||||||
Jukebox block = (Jukebox) event.getClickedBlock().getState();
|
Jukebox block = (Jukebox) event.getClickedBlock().getState();
|
||||||
|
|
||||||
if (!block.isPlaying()) {
|
if (!block.isPlaying()) {
|
||||||
if (item.getType() == Material.getMaterial(2266)) {
|
if (item.getType() == Material.getMaterial(2266)) {
|
||||||
|
|
||||||
HerobrineAI.getPluginCore().getAICore();
|
HerobrineAI.getPluginCore().getAICore();
|
||||||
|
|
||||||
if (!AICore.isDiscCalled) {
|
if (!AICore.isDiscCalled) {
|
||||||
|
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
HerobrineAI.getPluginCore().getAICore();
|
HerobrineAI.getPluginCore().getAICore();
|
||||||
AICore.isDiscCalled = true;
|
AICore.isDiscCalled = true;
|
||||||
HerobrineAI.getPluginCore().getAICore().CancelTarget(CoreType.ANY);
|
HerobrineAI.getPluginCore().getAICore().CancelTarget(CoreType.ANY);
|
||||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(AICore.plugin, new Runnable() {
|
|
||||||
|
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(AICore.plugin,
|
||||||
|
new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
HerobrineAI.getPluginCore().getAICore().callByDisc(player);
|
HerobrineAI.getPluginCore().getAICore().callByDisc(player);
|
||||||
}
|
}
|
||||||
@ -132,7 +162,7 @@ public class PlayerListener implements Listener{
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerEnterBed(PlayerBedEnterEvent event) {
|
public void onPlayerEnterBed(PlayerBedEnterEvent event) {
|
||||||
if (new Random().nextInt(100)>75){
|
if (Utils.getRandomGen().nextInt(100) > 75) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
((CraftPlayer) player).getHandle().a(true, false, false);
|
((CraftPlayer) player).getHandle().a(true, false, false);
|
||||||
HerobrineAI.getPluginCore().getAICore().playerBedEnter(player);
|
HerobrineAI.getPluginCore().getAICore().playerBedEnter(player);
|
||||||
@ -140,12 +170,19 @@ public class PlayerListener implements Listener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
|
|
||||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||||
if (event.getPlayer().getEntityId() != HerobrineAI.HerobrineEntityID) {
|
if (event.getPlayer().getEntityId() != HerobrineAI.HerobrineEntityID) {
|
||||||
if (HerobrineAI.getPluginCore().getAICore().PlayerTarget==event.getPlayer() && HerobrineAI.getPluginCore().getAICore().getCoreTypeNow() == CoreType.GRAVEYARD && event.getPlayer().getLocation().getWorld()==Bukkit.getServer().getWorld("world_herobrineai_graveyard") && HerobrineAI.getPluginCore().getAICore().isTarget){
|
|
||||||
if (new Random().nextBoolean()){
|
|
||||||
event.getPlayer().teleport( HerobrineAI.getPluginCore().getAICore().getGraveyard().getSavedLocation());
|
|
||||||
|
|
||||||
|
if (HerobrineAI.getPluginCore().getAICore().PlayerTarget == event.getPlayer()
|
||||||
|
&& HerobrineAI.getPluginCore().getAICore().getCoreTypeNow() == CoreType.GRAVEYARD
|
||||||
|
&& event.getPlayer().getLocation().getWorld() == Bukkit.getServer()
|
||||||
|
.getWorld("world_herobrineai_graveyard")
|
||||||
|
&& HerobrineAI.getPluginCore().getAICore().isTarget) {
|
||||||
|
|
||||||
|
if (Utils.getRandomGen().nextBoolean()) {
|
||||||
|
event.getPlayer()
|
||||||
|
.teleport(HerobrineAI.getPluginCore().getAICore().getGraveyard().getSavedLocation());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -161,6 +198,7 @@ public class PlayerListener implements Listener{
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onPlayerTeleport(PlayerTeleportEvent event) {
|
public void onPlayerTeleport(PlayerTeleportEvent event) {
|
||||||
|
|
||||||
if (event.getPlayer().getEntityId() == HerobrineAI.HerobrineEntityID) {
|
if (event.getPlayer().getEntityId() == HerobrineAI.HerobrineEntityID) {
|
||||||
if (event.getFrom().getWorld() != event.getTo().getWorld()) {
|
if (event.getFrom().getWorld() != event.getTo().getWorld()) {
|
||||||
HerobrineAI.getPluginCore().HerobrineRemove();
|
HerobrineAI.getPluginCore().HerobrineRemove();
|
||||||
@ -170,15 +208,17 @@ public class PlayerListener implements Listener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (HerobrineAI.getPluginCore().getAICore().getCoreTypeNow() == CoreType.RANDOM_POSITION) {
|
if (HerobrineAI.getPluginCore().getAICore().getCoreTypeNow() == CoreType.RANDOM_POSITION) {
|
||||||
if (HerobrineAI.HerobrineNPC.getEntity().getBukkitEntity().getLocation().getBlockX() > HerobrineAI.getPluginCore().getConfigDB().WalkingModeXRadius){
|
|
||||||
if (HerobrineAI.HerobrineNPC.getEntity().getBukkitEntity().getLocation().getBlockX() < (-HerobrineAI.getPluginCore().getConfigDB().WalkingModeXRadius)){
|
Location herobrineLocation = HerobrineAI.HerobrineNPC.getEntity().getBukkitEntity().getLocation();
|
||||||
if (HerobrineAI.HerobrineNPC.getEntity().getBukkitEntity().getLocation().getBlockZ() > HerobrineAI.getPluginCore().getConfigDB().WalkingModeZRadius){
|
|
||||||
if (HerobrineAI.HerobrineNPC.getEntity().getBukkitEntity().getLocation().getBlockZ() < (-HerobrineAI.getPluginCore().getConfigDB().WalkingModeZRadius)){
|
if (herobrineLocation.getBlockX() > HerobrineAI.getPluginCore().getConfigDB().WalkingModeXRadius
|
||||||
|
&& herobrineLocation.getBlockX() < -HerobrineAI.getPluginCore().getConfigDB().WalkingModeXRadius
|
||||||
|
&& herobrineLocation.getBlockZ() > HerobrineAI.getPluginCore().getConfigDB().WalkingModeZRadius
|
||||||
|
&& herobrineLocation.getBlockZ() < -HerobrineAI.getPluginCore().getConfigDB().WalkingModeZRadius) {
|
||||||
|
|
||||||
HerobrineAI.getPluginCore().getAICore().CancelTarget(CoreType.RANDOM_POSITION);
|
HerobrineAI.getPluginCore().getAICore().CancelTarget(CoreType.RANDOM_POSITION);
|
||||||
HerobrineAI.HerobrineNPC.moveTo(new Location(Bukkit.getServer().getWorlds().get(0), 0, -20, 0));
|
HerobrineAI.HerobrineNPC.moveTo(new Location(Bukkit.getServer().getWorlds().get(0), 0, -20, 0));
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -191,9 +231,9 @@ public class PlayerListener implements Listener{
|
|||||||
|
|
||||||
HerobrineAI.getPluginCore().HerobrineRemove();
|
HerobrineAI.getPluginCore().HerobrineRemove();
|
||||||
|
|
||||||
Location nowloc = new Location((World) Bukkit.getServer().getWorlds().get(0),(float) 0,(float) -20,(float) 0);
|
Location nowloc = new Location((World) Bukkit.getServer().getWorlds().get(0), 0, -20.f, 0);
|
||||||
nowloc.setYaw((float) 1);
|
nowloc.setYaw(1.f);
|
||||||
nowloc.setPitch((float) 1);
|
nowloc.setPitch(1.f);
|
||||||
HerobrineAI.getPluginCore().HerobrineSpawn(nowloc);
|
HerobrineAI.getPluginCore().HerobrineSpawn(nowloc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -203,13 +243,11 @@ public class PlayerListener implements Listener{
|
|||||||
if (event.getPlayer().getEntityId() != HerobrineAI.HerobrineEntityID) {
|
if (event.getPlayer().getEntityId() != HerobrineAI.HerobrineEntityID) {
|
||||||
if (event.getPlayer().getWorld() == Bukkit.getServer().getWorld("world_herobrineai_graveyard")) {
|
if (event.getPlayer().getWorld() == Bukkit.getServer().getWorld("world_herobrineai_graveyard")) {
|
||||||
Player player = (Player) event.getPlayer();
|
Player player = (Player) event.getPlayer();
|
||||||
player.teleport(new Location(Bukkit.getServer().getWorld("world_herobrineai_graveyard"),-2.49,4,10.69,(float)-179.85,(float) 0.44999));
|
player.teleport(new Location(Bukkit.getServer().getWorld("world_herobrineai_graveyard"), -2.49f, 4.f,
|
||||||
|
10.69f, -179.85f, 0.44999f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ public class WorldListener implements Listener{
|
|||||||
|
|
||||||
if (HerobrineAI.getPluginCore().getConfigDB().BuildPyramids==true){
|
if (HerobrineAI.getPluginCore().getConfigDB().BuildPyramids==true){
|
||||||
|
|
||||||
if (new Random().nextInt(15)==1){
|
if (new Random().nextInt(30)==4){
|
||||||
Object[] data = {event.getChunk()};
|
Object[] data = {event.getChunk()};
|
||||||
HerobrineAI.getPluginCore().getAICore().getCore(CoreType.PYRAMID).RunCore(data);
|
HerobrineAI.getPluginCore().getAICore().getCore(CoreType.PYRAMID).RunCore(data);
|
||||||
}
|
}
|
||||||
|
@ -11,32 +11,67 @@ import org.bukkit.block.Skull;
|
|||||||
|
|
||||||
public class BlockChanger {
|
public class BlockChanger {
|
||||||
|
|
||||||
public static BlockFace getPlayerBlockFace(Location loc)
|
public static BlockFace getPlayerBlockFace(Location loc) {
|
||||||
{
|
|
||||||
|
|
||||||
BlockFace dir = null;
|
BlockFace dir = null;
|
||||||
float y = loc.getYaw();
|
float y = loc.getYaw();
|
||||||
if( y < 0 ){y += 360;}
|
if (y < 0) {
|
||||||
|
y += 360;
|
||||||
|
}
|
||||||
y %= 360;
|
y %= 360;
|
||||||
int i = (int) ((y + 8) / 22.5);
|
int i = (int) ((y + 8) / 22.5);
|
||||||
switch (i) {
|
switch (i) {
|
||||||
case 0: dir = BlockFace.WEST; break;
|
case 0:
|
||||||
case 1: dir = BlockFace.WEST_NORTH_WEST; break;
|
dir = BlockFace.WEST;
|
||||||
case 2: dir = BlockFace.NORTH_WEST; break;
|
break;
|
||||||
case 3: dir = BlockFace.NORTH_NORTH_WEST; break;
|
case 1:
|
||||||
case 4: dir = BlockFace.NORTH; break;
|
dir = BlockFace.WEST_NORTH_WEST;
|
||||||
case 5: dir = BlockFace.NORTH_NORTH_EAST; break;
|
break;
|
||||||
case 6: dir = BlockFace.NORTH_EAST; break;
|
case 2:
|
||||||
case 7: dir = BlockFace.EAST_NORTH_EAST; break;
|
dir = BlockFace.NORTH_WEST;
|
||||||
case 8: dir = BlockFace.EAST; break;
|
break;
|
||||||
case 9: dir = BlockFace.EAST_SOUTH_EAST; break;
|
case 3:
|
||||||
case 10: dir = BlockFace.SOUTH_EAST; break;
|
dir = BlockFace.NORTH_NORTH_WEST;
|
||||||
case 11: dir = BlockFace.SOUTH_SOUTH_EAST; break;
|
break;
|
||||||
case 12: dir = BlockFace.SOUTH; break;
|
case 4:
|
||||||
case 13: dir = BlockFace.SOUTH_SOUTH_WEST; break;
|
dir = BlockFace.NORTH;
|
||||||
case 14: dir = BlockFace.SOUTH_WEST; break;
|
break;
|
||||||
case 15: dir = BlockFace.WEST_SOUTH_WEST; break;
|
case 5:
|
||||||
default: dir = BlockFace.WEST; break;
|
dir = BlockFace.NORTH_NORTH_EAST;
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
dir = BlockFace.NORTH_EAST;
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
dir = BlockFace.EAST_NORTH_EAST;
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
dir = BlockFace.EAST;
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
dir = BlockFace.EAST_SOUTH_EAST;
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
dir = BlockFace.SOUTH_EAST;
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
|
dir = BlockFace.SOUTH_SOUTH_EAST;
|
||||||
|
break;
|
||||||
|
case 12:
|
||||||
|
dir = BlockFace.SOUTH;
|
||||||
|
break;
|
||||||
|
case 13:
|
||||||
|
dir = BlockFace.SOUTH_SOUTH_WEST;
|
||||||
|
break;
|
||||||
|
case 14:
|
||||||
|
dir = BlockFace.SOUTH_WEST;
|
||||||
|
break;
|
||||||
|
case 15:
|
||||||
|
dir = BlockFace.WEST_SOUTH_WEST;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
dir = BlockFace.WEST;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return dir;
|
return dir;
|
||||||
@ -54,14 +89,18 @@ public class BlockChanger {
|
|||||||
|
|
||||||
BlockFace bface = BlockFace.EAST;
|
BlockFace bface = BlockFace.EAST;
|
||||||
|
|
||||||
if (chance==0){bface=BlockFace.WEST;}
|
if (chance == 0) {
|
||||||
else if (chance==1){bface=BlockFace.EAST;}
|
bface = BlockFace.WEST;
|
||||||
else if (chance==2){bface=BlockFace.SOUTH;}
|
} else if (chance == 1) {
|
||||||
else if (chance==3){bface=BlockFace.NORTH;}
|
bface = BlockFace.EAST;
|
||||||
|
} else if (chance == 2) {
|
||||||
|
bface = BlockFace.SOUTH;
|
||||||
|
} else if (chance == 3) {
|
||||||
|
bface = BlockFace.NORTH;
|
||||||
|
}
|
||||||
|
|
||||||
skull.setRawData((byte) bface.ordinal());
|
skull.setRawData((byte) bface.ordinal());
|
||||||
skull.update(true);
|
skull.update(true);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package org.jakub1221.herobrineai.misc;
|
package org.jakub1221.herobrineai.misc;
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -25,18 +24,21 @@ public class ItemName {
|
|||||||
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack setName(ItemStack item, String name) {
|
public static ItemStack setName(ItemStack item, String name) {
|
||||||
meta = item.getItemMeta();
|
meta = item.getItemMeta();
|
||||||
meta.setDisplayName(name);
|
meta.setDisplayName(name);
|
||||||
item.setItemMeta(meta);
|
item.setItemMeta(meta);
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack setLore(ItemStack item, ArrayList<String> lore) {
|
public static ItemStack setLore(ItemStack item, ArrayList<String> lore) {
|
||||||
meta = item.getItemMeta();
|
meta = item.getItemMeta();
|
||||||
meta.setLore(lore);
|
meta.setLore(lore);
|
||||||
item.setItemMeta(meta);
|
item.setItemMeta(meta);
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack setNameAndLore(ItemStack item, String name, ArrayList<String> lore) {
|
public static ItemStack setNameAndLore(ItemStack item, String name, ArrayList<String> lore) {
|
||||||
meta = item.getItemMeta();
|
meta = item.getItemMeta();
|
||||||
meta.setDisplayName(name);
|
meta.setDisplayName(name);
|
||||||
@ -44,12 +46,15 @@ public class ItemName {
|
|||||||
item.setItemMeta(meta);
|
item.setItemMeta(meta);
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayList<String> getLore(ItemStack item) {
|
public static ArrayList<String> getLore(ItemStack item) {
|
||||||
return (ArrayList<String>) item.getItemMeta().getLore();
|
return (ArrayList<String>) item.getItemMeta().getLore();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getName(ItemStack item) {
|
public static String getName(ItemStack item) {
|
||||||
return item.getItemMeta().getDisplayName();
|
return item.getItemMeta().getDisplayName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack CreateSkull(String data) {
|
public static ItemStack CreateSkull(String data) {
|
||||||
ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (short) SkullType.PLAYER.ordinal());
|
ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (short) SkullType.PLAYER.ordinal());
|
||||||
SkullMeta skullmeta = (SkullMeta) skull.getItemMeta();
|
SkullMeta skullmeta = (SkullMeta) skull.getItemMeta();
|
||||||
|
@ -32,16 +32,23 @@ public class StructureLoader {
|
|||||||
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
inp.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Build(World world, int MainX, int MainY, int MainZ) {
|
public void Build(World world, int MainX, int MainY, int MainZ) {
|
||||||
|
|
||||||
length = file.getInt("DATA.LENGTH") - 1;
|
length = file.getInt("DATA.LENGTH") - 1;
|
||||||
for (current = 0; current <= length; current++) {
|
for (current = 0; current <= length; current++) {
|
||||||
world.getBlockAt(MainX+file.getInt("DATA."+current+".X"), MainY+file.getInt("DATA."+current+".Y"), MainZ+file.getInt("DATA."+current+".Z")).setTypeIdAndData(+file.getInt("DATA."+current+".ID"),(byte) +file.getInt("DATA."+current+".DATA"),false);
|
world.getBlockAt(MainX + file.getInt("DATA." + current + ".X"),
|
||||||
|
MainY + file.getInt("DATA." + current + ".Y"), MainZ + file.getInt("DATA." + current + ".Z"))
|
||||||
|
.setTypeIdAndData(+file.getInt("DATA." + current + ".ID"),(byte) +file.getInt("DATA." + current + ".DATA"), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
17
src/org/jakub1221/herobrineai/support/_Factions.java
Normal file
17
src/org/jakub1221/herobrineai/support/_Factions.java
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
package org.jakub1221.herobrineai.support;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.entity.BoardColls;
|
||||||
|
import com.massivecraft.mcore.ps.PS;
|
||||||
|
|
||||||
|
public class _Factions {
|
||||||
|
|
||||||
|
public boolean Check(){
|
||||||
|
return (Bukkit.getServer().getPluginManager().getPlugin("Factions")!=null);
|
||||||
|
}
|
||||||
|
public boolean isSecuredArea(Location loc){
|
||||||
|
return !BoardColls.get().getFactionAt(PS.valueOf(loc)).getComparisonName().equalsIgnoreCase("Wilderness");
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user