Worked on replacing HerobrineAI branding as well as improving improving plugin output. Work will continue with doing this in the BuildStuff.java file.

This commit is contained in:
David Berdik 2015-02-06 22:29:49 -05:00
parent e9b4b7c2b9
commit 36240343f9
7 changed files with 35 additions and 35 deletions

View File

@ -65,7 +65,7 @@ public class AICore {
public AICore() { public AICore() {
AICore.plugin = HerobrineAI.getPluginCore(); AICore.plugin = HerobrineAI.getPluginCore();
resetLimits = new ResetLimits(); resetLimits = new ResetLimits();
AICore.log.info("[HerobrineAI] Debug mode enabled!"); AICore.log.info("[Herobrine] Herobrine is now running in debug mode.");
findPlayer(); findPlayer();
startIntervals(); startIntervals();
} }
@ -132,7 +132,7 @@ public class AICore {
AICore._ticks = 0; AICore._ticks = 0;
AICore.isTarget = false; AICore.isTarget = false;
HerobrineAI.HerobrineHP = HerobrineAI.HerobrineMaxHP; HerobrineAI.HerobrineHP = HerobrineAI.HerobrineMaxHP;
AICore.log.info("[HerobrineAI] Target cancelled."); AICore.log.info("[HerobrineAI] Cancelled teleporting of " + PlayerTarget.getDisplayName() + " to Herobrine's Graveyard.");
final Location nowloc = new Location(Bukkit.getServer().getWorlds().get(0), 0.0, -20.0, 0.0); final Location nowloc = new Location(Bukkit.getServer().getWorlds().get(0), 0.0, -20.0, 0.0);
nowloc.setYaw(1.0f); nowloc.setYaw(1.0f);
nowloc.setPitch(1.0f); nowloc.setPitch(1.0f);
@ -154,7 +154,7 @@ public class AICore {
final int chance = new Random().nextInt(100); final int chance = new Random().nextInt(100);
if (chance <= 5) { if (chance <= 5) {
if (HerobrineAI.getPluginCore().getConfigDB().useGraveyardWorld) { if (HerobrineAI.getPluginCore().getConfigDB().useGraveyardWorld) {
AICore.log.info("[HerobrineAI] Teleporting target to Graveyard world."); AICore.log.info("[Herobrine] Teleporting " + PlayerTarget.getDisplayName() + " to Herobrine's Graveyard.");
getCore(Core.CoreType.GRAVEYARD).runCore(data); getCore(Core.CoreType.GRAVEYARD).runCore(data);
} }
} else if (chance <= 20) { } else if (chance <= 20) {
@ -207,7 +207,7 @@ public class AICore {
private void pyramidInterval() { private void pyramidInterval() {
if (new Random().nextBoolean() && (Bukkit.getServer().getOnlinePlayers().size() > 0)) { if (new Random().nextBoolean() && (Bukkit.getServer().getOnlinePlayers().size() > 0)) {
AICore.log.info("[HerobrineAI] Finding pyramid target..."); AICore.log.info("[Herobrine] Finding pyramid target...");
final Player[] allOnPlayers = Bukkit.getServer().getOnlinePlayers().toArray(new Player[0]); final Player[] allOnPlayers = Bukkit.getServer().getOnlinePlayers().toArray(new Player[0]);
final int playerRolled = Util.getRandomPlayerNum(allOnPlayers); final int playerRolled = Util.getRandomPlayerNum(allOnPlayers);
if (HerobrineAI.getPluginCore().getConfigDB().useWorlds.contains(allOnPlayers[playerRolled].getLocation().getWorld().getName())) { if (HerobrineAI.getPluginCore().getConfigDB().useWorlds.contains(allOnPlayers[playerRolled].getLocation().getWorld().getName())) {

View File

@ -40,7 +40,7 @@ public class Attack extends Core {
ticksToEnd = 0; ticksToEnd = 0;
AICore.PlayerTarget = player; AICore.PlayerTarget = player;
AICore.isTarget = true; AICore.isTarget = true;
AICore.log.info("[HerobrineAI] Teleporting to target. (" + AICore.PlayerTarget.getName() + ")"); AICore.log.info("[Herobrine] Teleporting Herobrine to " + AICore.PlayerTarget.getName() + ".");
final Location ploc = AICore.PlayerTarget.getLocation(); final Location ploc = AICore.PlayerTarget.getLocation();
final Object[] data = { ploc }; final Object[] data = { ploc };
HerobrineAI.getPluginCore().getAICore().getCore(CoreType.DESTROY_TORCHES).runCore(data); HerobrineAI.getPluginCore().getAICore().getCore(CoreType.DESTROY_TORCHES).runCore(data);
@ -53,9 +53,9 @@ public class Attack extends Core {
HerobrineAI.herobrineNPC.moveTo(tploc); HerobrineAI.herobrineNPC.moveTo(tploc);
Message.sendMessage(AICore.PlayerTarget); Message.sendMessage(AICore.PlayerTarget);
StartHandler(); StartHandler();
return new CoreResult(true, "Herobrine attacks " + player.getName() + "!"); return new CoreResult(true, "Herobrine is currently attacking " + player.getName() + ".");
} }
return new CoreResult(false, "Player is in secure area."); return new CoreResult(false, AICore.PlayerTarget.getName() + " cannot be attacked because they are in a protected area.");
} }
public void StopHandler() { public void StopHandler() {

View File

@ -23,22 +23,22 @@ public class Book extends Core {
final Player player = (Player) data[0]; final 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 || !HerobrineAI.getPluginCore().getSupport().checkBooks(player.getLocation())) { if (!HerobrineAI.getPluginCore().getConfigDB().writeBooks || !HerobrineAI.getPluginCore().getSupport().checkBooks(player.getLocation())) {
return new CoreResult(false, "Player is not in allowed world!"); return new CoreResult(false, player.getDisplayName() + " is in a world that Herobrine cannot haunt.");
} }
final int chance = new Random().nextInt(100); final int chance = new Random().nextInt(100);
if (chance <= (100 - HerobrineAI.getPluginCore().getConfigDB().bookChance)) { if (chance <= (100 - HerobrineAI.getPluginCore().getConfigDB().bookChance)) {
return new CoreResult(false, "Books are not allowed!"); return new CoreResult(false, "Herobrine books are prohibited.");
} }
final Inventory chest = (Inventory) data[1]; final Inventory chest = (Inventory) data[1];
if (chest.firstEmpty() == -1) { if (chest.firstEmpty() == -1) {
return new CoreResult(false, "Book create failed!"); return new CoreResult(false, "Herobrine failed to create a book.");
} }
if (HerobrineAI.getPluginCore().getAICore().getResetLimits().isBook()) { 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, "Herobrine has created a book.");
} }
} }
return new CoreResult(false, "Book create failed!"); return new CoreResult(false, "Herobrine failed to create a book.");
} }
public ItemStack newBook() { public ItemStack newBook() {

View File

@ -66,8 +66,8 @@ public class ConfigDB {
public int maxHeads = 1; public int maxHeads = 1;
public boolean useIgnorePermission = true; public boolean useIgnorePermission = true;
public boolean useSound = true; public boolean useSound = true;
public File configF = new File("plugins/HerobrineAI/config.yml"); public File configF = new File("plugins/Herobrine/config.yml");
public File npcF = new File("plugins/HerobrineAI/npc.yml"); public File npcF = new File("plugins/Herobrine/npc.yml");
public void reload() { public void reload() {
try { try {
@ -143,7 +143,7 @@ public class ConfigDB {
final ArrayList<String> allWorlds = new ArrayList<String>(); final ArrayList<String> allWorlds = new ArrayList<String>();
final List<World> worlds_ = Bukkit.getWorlds(); final List<World> worlds_ = Bukkit.getWorlds();
for (int i = 0; i <= (worlds_.size() - 1); ++i) { for (int i = 0; i <= (worlds_.size() - 1); ++i) {
if (!worlds_.get(i).getName().equalsIgnoreCase("world_herobrineai_graveyard")) { if (!worlds_.get(i).getName().equalsIgnoreCase("world_herobrine_graveyard")) {
allWorlds.add(worlds_.get(i).getName()); allWorlds.add(worlds_.get(i).getName());
} }
} }

View File

@ -73,9 +73,9 @@ public class HerobrineAI extends JavaPlugin implements Listener {
} }
private void initHerobrine() { private void initHerobrine() {
if (configdb.useGraveyardWorld && (Bukkit.getServer().getWorld("world_herobrineai_graveyard") == null)) { if (configdb.useGraveyardWorld && (Bukkit.getServer().getWorld("world_herobrine_graveyard") == null)) {
HerobrineAI.log.info("[Herobrine] Creating Herobrine Graveyard world"); HerobrineAI.log.info("[Herobrine] Creating Herobrine Graveyard world");
final WorldCreator wc = new WorldCreator("world_herobrineai_graveyard"); final WorldCreator wc = new WorldCreator("world_herobrine_graveyard");
wc.generateStructures(false); wc.generateStructures(false);
final WorldType type = WorldType.FLAT; final WorldType type = WorldType.FLAT;
wc.type(type); wc.type(type);
@ -157,18 +157,18 @@ public class HerobrineAI extends JavaPlugin implements Listener {
if (!configdb.attackCreative && (player.getGameMode() == GameMode.CREATIVE)) { if (!configdb.attackCreative && (player.getGameMode() == GameMode.CREATIVE)) {
creativeCheck = false; creativeCheck = false;
} }
if (configdb.useIgnorePermission && player.hasPermission("hb-ai.ignore")) { if (configdb.useIgnorePermission && player.hasPermission("herobrine.ignore")) {
ignoreCheck = false; ignoreCheck = false;
} }
if (opCheck && creativeCheck && ignoreCheck) { if (opCheck && creativeCheck && ignoreCheck) {
return true; return true;
} }
if (!opCheck) { if (!opCheck) {
sender.sendMessage(ChatColor.RED + "[HerobrineAI] Player is OP."); sender.sendMessage(ChatColor.RED + "[Herobrine] " + player.getDisplayName() + " is an OP.");
} else if (!creativeCheck) { } else if (!creativeCheck) {
sender.sendMessage(ChatColor.RED + "[HerobrineAI] Player is in Creative mode."); sender.sendMessage(ChatColor.RED + "[Herobrine] " + player.getDisplayName() + " is in creative mode.");
} else if (!ignoreCheck) { } else if (!ignoreCheck) {
sender.sendMessage(ChatColor.RED + "[HerobrineAI] Player has ignore permission."); sender.sendMessage(ChatColor.RED + "[Herobrine] " + player.getDisplayName() + " has ignore permissions.");
} }
return false; return false;
} }
@ -183,18 +183,18 @@ public class HerobrineAI extends JavaPlugin implements Listener {
if (!configdb.attackCreative && (player.getGameMode() == GameMode.CREATIVE)) { if (!configdb.attackCreative && (player.getGameMode() == GameMode.CREATIVE)) {
creativeCheck = false; creativeCheck = false;
} }
if (configdb.useIgnorePermission && player.hasPermission("hb-ai.ignore")) { if (configdb.useIgnorePermission && player.hasPermission("herobrine.ignore")) {
ignoreCheck = false; ignoreCheck = false;
} }
if (opCheck && creativeCheck && ignoreCheck) { if (opCheck && creativeCheck && ignoreCheck) {
return true; return true;
} }
if (!opCheck) { if (!opCheck) {
HerobrineAI.log.info("[HerobrineAI] Player is OP."); HerobrineAI.log.info("[Herobrine] " + player.getDisplayName() + " is an OP.");
} else if (!creativeCheck) { } else if (!creativeCheck) {
HerobrineAI.log.info("[HerobrineAI] Player is in Creative mode."); HerobrineAI.log.info("[Herobrine] " + player.getDisplayName() + " is in creative mode.");
} else if (!ignoreCheck) { } else if (!ignoreCheck) {
HerobrineAI.log.info("[HerobrineAI] Player has ignore permission."); HerobrineAI.log.info("[Herobrine] " + player.getDisplayName() + " has ignore permissions.");
} }
return false; return false;
} }
@ -209,7 +209,7 @@ public class HerobrineAI extends JavaPlugin implements Listener {
if (!configdb.attackCreative && (player.getGameMode() == GameMode.CREATIVE)) { if (!configdb.attackCreative && (player.getGameMode() == GameMode.CREATIVE)) {
creativeCheck = false; creativeCheck = false;
} }
if (configdb.useIgnorePermission && player.hasPermission("hb-ai.ignore")) { if (configdb.useIgnorePermission && player.hasPermission("herobrine.ignore")) {
ignoreCheck = false; ignoreCheck = false;
} }
return opCheck && creativeCheck && ignoreCheck; return opCheck && creativeCheck && ignoreCheck;

View File

@ -65,27 +65,27 @@ public class Support {
public void CheckForPlugins() { public void CheckForPlugins() {
if (ResidenceCore.Check()) { if (ResidenceCore.Check()) {
B_Residence = true; B_Residence = true;
HerobrineAI.log.info("[HerobrineAI] Residence plugin detected!"); HerobrineAI.log.info("[Herobrine] Residence plugin detected on server.");
} }
if (GriefPreventionCore.Check()) { if (GriefPreventionCore.Check()) {
B_GriefPrevention = true; B_GriefPrevention = true;
HerobrineAI.log.info("[HerobrineAI] GriefPrevention plugin detected!"); HerobrineAI.log.info("[Herobrine] GriefPrevention plugin detected on server.");
} }
if (TownyCore.Check()) { if (TownyCore.Check()) {
B_Towny = true; B_Towny = true;
HerobrineAI.log.info("[HerobrineAI] Towny plugin detected!"); HerobrineAI.log.info("[Herobrine] Towny plugin detected on server.");
} }
if (WorldGuard.Check()) { if (WorldGuard.Check()) {
B_WorldGuard = true; B_WorldGuard = true;
HerobrineAI.log.info("[HerobrineAI] WorldGuard plugin detected!"); HerobrineAI.log.info("[Herobrine] WorldGuard plugin detected on server.");
} }
if (PreciousStones.Check()) { if (PreciousStones.Check()) {
B_PreciousStones = true; B_PreciousStones = true;
HerobrineAI.log.info("[HerobrineAI] PreciousStones plugin detected!"); HerobrineAI.log.info("[Herobrine] PreciousStones plugin detected on server.");
} }
if (Factions.Check()) { if (Factions.Check()) {
B_Factions = true; B_Factions = true;
HerobrineAI.log.info("[HerobrineAI] Factions plugin detected!"); HerobrineAI.log.info("[Herobrine] Factions plugin detected on server.");
} }
} }

View File

@ -1,7 +1,7 @@
name: HerobrineAI name: HerobrineAI
main: org.jakub1221.herobrineai.HerobrineAI main: org.jakub1221.herobrineai.HerobrineAI
version: 4.0 version: 1.0.0
commands: commands:
hb-ai: herobrine:
description: Main command. description: Main command.
usage: /hb-ai help usage: /herobrine help