*Added new option "ShowInTabList" to the configuration. This option allows the server administrator to set whether Herobrine will always show in the tab list or will only show to Herobrine's current target.
*Updated version number from 1.2.2 to 1.2.3. *Updated internal version number from six to seven.
This commit is contained in:
parent
7b8b8d90bc
commit
095e5c49f1
@ -216,13 +216,15 @@ public class AICore {
|
||||
}
|
||||
|
||||
private void removeHero(Player p){
|
||||
//make hero invisible
|
||||
EntityPlayer pcon = ((CraftPlayer) p).getHandle();
|
||||
pcon.playerConnection.sendPacket(new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, HerobrineAI.herobrineNPC.getNMSEntity()));
|
||||
// Remove Herobrine from the tab list unless he is configured to always be listed.
|
||||
if(!HerobrineAI.getPluginCore().getConfigDB().ShowInTabList) {
|
||||
EntityPlayer pcon = ((CraftPlayer) p).getHandle();
|
||||
pcon.playerConnection.sendPacket(new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, HerobrineAI.herobrineNPC.getNMSEntity()));
|
||||
}
|
||||
}
|
||||
|
||||
private void showHero(Player p){
|
||||
//make hero visible
|
||||
public static void showHero(Player p){
|
||||
// Show Herobrine in the tab list.
|
||||
EntityPlayer pcon = ((CraftPlayer) p).getHandle();
|
||||
pcon.playerConnection.sendPacket(new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, HerobrineAI.herobrineNPC.getNMSEntity()));
|
||||
}
|
||||
|
@ -88,6 +88,7 @@ public class ConfigDB
|
||||
public String HerobrineWorldName = "world_herobrine_graveyard";
|
||||
public String HerobrineUUID = "f84c6a79-0a4e-45e0-879b-cd49ebd4c4e2";
|
||||
public boolean UseSound = true;
|
||||
public boolean ShowInTabList = false;
|
||||
private boolean isStartupDone = false;
|
||||
|
||||
public ConfigDB(Logger l)
|
||||
@ -263,6 +264,7 @@ public class ConfigDB
|
||||
this.config.set("config.HerobrineWorldName", "world_herobrine_graveyard");
|
||||
this.config.set("config.HerobrineUUID", "f84c6a79-0a4e-45e0-879b-cd49ebd4c4e2");
|
||||
this.config.set("config.UseHauntSound", Boolean.valueOf(true));
|
||||
this.config.set("config.ShowInTabList", Boolean.valueOf(false));
|
||||
try
|
||||
{
|
||||
this.config.save(this.configF);
|
||||
@ -523,6 +525,15 @@ public class ConfigDB
|
||||
|
||||
this.config.set("config.UseHauntSound", Boolean.valueOf(true));
|
||||
}
|
||||
if (!this.config.contains("config.ShowInTabList"))
|
||||
{
|
||||
if (!hasUpdated) {
|
||||
this.log.info("[Herobrine] Updating old config...");
|
||||
}
|
||||
hasUpdated = true;
|
||||
|
||||
this.config.set("config.ShowInTabList", Boolean.valueOf(false));
|
||||
}
|
||||
if (hasUpdated)
|
||||
{
|
||||
try
|
||||
@ -627,6 +638,7 @@ public class ConfigDB
|
||||
this.HerobrineWorldName = this.config.getString("config.HerobrineWorldName");
|
||||
this.HerobrineUUID = this.config.getString("config.HerobrineUUID");
|
||||
this.UseSound = this.config.getBoolean("config.UseHauntSound");
|
||||
this.ShowInTabList = this.config.getBoolean("config.ShowInTabList");
|
||||
HerobrineAI.HerobrineMaxHP = this.HerobrineHP;
|
||||
HerobrineAI.getPluginCore().getAICore().stopMAIN();
|
||||
HerobrineAI.getPluginCore().getAICore().startMAIN();
|
||||
|
@ -60,7 +60,7 @@ public class HerobrineAI extends JavaPlugin implements Listener {
|
||||
|
||||
public Location hbSpawnData = null;
|
||||
public boolean removeHBNextTick = false;
|
||||
public String pluginVersionCount = "6";
|
||||
public String pluginVersionCount = "7";
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
|
@ -23,6 +23,7 @@ import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerBedEnterEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerKickEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
@ -185,6 +186,15 @@ public class PlayerListener implements Listener {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onJoin(PlayerJoinEvent event) {
|
||||
// If the plugin is configured to show Herobrine in the tab list, add him to the list
|
||||
// when the user logs on.
|
||||
if(HerobrineAI.getPluginCore().getConfigDB().ShowInTabList) {
|
||||
AICore.showHero(event.getPlayer());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerDeathEvent(final PlayerDeathEvent event) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
name: Herobrine
|
||||
main: net.theprogrammersworld.herobrine.HerobrineAI
|
||||
version: 1.2.2
|
||||
version: 1.2.3
|
||||
commands:
|
||||
herobrine:
|
||||
description: Main command.
|
||||
|
Reference in New Issue
Block a user