*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){
|
private void removeHero(Player p){
|
||||||
//make hero invisible
|
// Remove Herobrine from the tab list unless he is configured to always be listed.
|
||||||
EntityPlayer pcon = ((CraftPlayer) p).getHandle();
|
if(!HerobrineAI.getPluginCore().getConfigDB().ShowInTabList) {
|
||||||
pcon.playerConnection.sendPacket(new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, HerobrineAI.herobrineNPC.getNMSEntity()));
|
EntityPlayer pcon = ((CraftPlayer) p).getHandle();
|
||||||
|
pcon.playerConnection.sendPacket(new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, HerobrineAI.herobrineNPC.getNMSEntity()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showHero(Player p){
|
public static void showHero(Player p){
|
||||||
//make hero visible
|
// Show Herobrine in the tab list.
|
||||||
EntityPlayer pcon = ((CraftPlayer) p).getHandle();
|
EntityPlayer pcon = ((CraftPlayer) p).getHandle();
|
||||||
pcon.playerConnection.sendPacket(new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, HerobrineAI.herobrineNPC.getNMSEntity()));
|
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 HerobrineWorldName = "world_herobrine_graveyard";
|
||||||
public String HerobrineUUID = "f84c6a79-0a4e-45e0-879b-cd49ebd4c4e2";
|
public String HerobrineUUID = "f84c6a79-0a4e-45e0-879b-cd49ebd4c4e2";
|
||||||
public boolean UseSound = true;
|
public boolean UseSound = true;
|
||||||
|
public boolean ShowInTabList = false;
|
||||||
private boolean isStartupDone = false;
|
private boolean isStartupDone = false;
|
||||||
|
|
||||||
public ConfigDB(Logger l)
|
public ConfigDB(Logger l)
|
||||||
@ -263,6 +264,7 @@ public class ConfigDB
|
|||||||
this.config.set("config.HerobrineWorldName", "world_herobrine_graveyard");
|
this.config.set("config.HerobrineWorldName", "world_herobrine_graveyard");
|
||||||
this.config.set("config.HerobrineUUID", "f84c6a79-0a4e-45e0-879b-cd49ebd4c4e2");
|
this.config.set("config.HerobrineUUID", "f84c6a79-0a4e-45e0-879b-cd49ebd4c4e2");
|
||||||
this.config.set("config.UseHauntSound", Boolean.valueOf(true));
|
this.config.set("config.UseHauntSound", Boolean.valueOf(true));
|
||||||
|
this.config.set("config.ShowInTabList", Boolean.valueOf(false));
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
this.config.save(this.configF);
|
this.config.save(this.configF);
|
||||||
@ -523,6 +525,15 @@ public class ConfigDB
|
|||||||
|
|
||||||
this.config.set("config.UseHauntSound", Boolean.valueOf(true));
|
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)
|
if (hasUpdated)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -627,6 +638,7 @@ public class ConfigDB
|
|||||||
this.HerobrineWorldName = this.config.getString("config.HerobrineWorldName");
|
this.HerobrineWorldName = this.config.getString("config.HerobrineWorldName");
|
||||||
this.HerobrineUUID = this.config.getString("config.HerobrineUUID");
|
this.HerobrineUUID = this.config.getString("config.HerobrineUUID");
|
||||||
this.UseSound = this.config.getBoolean("config.UseHauntSound");
|
this.UseSound = this.config.getBoolean("config.UseHauntSound");
|
||||||
|
this.ShowInTabList = this.config.getBoolean("config.ShowInTabList");
|
||||||
HerobrineAI.HerobrineMaxHP = this.HerobrineHP;
|
HerobrineAI.HerobrineMaxHP = this.HerobrineHP;
|
||||||
HerobrineAI.getPluginCore().getAICore().stopMAIN();
|
HerobrineAI.getPluginCore().getAICore().stopMAIN();
|
||||||
HerobrineAI.getPluginCore().getAICore().startMAIN();
|
HerobrineAI.getPluginCore().getAICore().startMAIN();
|
||||||
|
@ -60,7 +60,7 @@ public class HerobrineAI extends JavaPlugin implements Listener {
|
|||||||
|
|
||||||
public Location hbSpawnData = null;
|
public Location hbSpawnData = null;
|
||||||
public boolean removeHBNextTick = false;
|
public boolean removeHBNextTick = false;
|
||||||
public String pluginVersionCount = "6";
|
public String pluginVersionCount = "7";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
|
@ -23,6 +23,7 @@ import org.bukkit.event.entity.PlayerDeathEvent;
|
|||||||
import org.bukkit.event.player.PlayerBedEnterEvent;
|
import org.bukkit.event.player.PlayerBedEnterEvent;
|
||||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerKickEvent;
|
import org.bukkit.event.player.PlayerKickEvent;
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
@ -186,6 +187,15 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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
|
@EventHandler
|
||||||
public void onPlayerDeathEvent(final PlayerDeathEvent event) {
|
public void onPlayerDeathEvent(final PlayerDeathEvent event) {
|
||||||
if (event.getEntity().getEntityId() == HerobrineAI.herobrineEntityID) {
|
if (event.getEntity().getEntityId() == HerobrineAI.herobrineEntityID) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
name: Herobrine
|
name: Herobrine
|
||||||
main: net.theprogrammersworld.herobrine.HerobrineAI
|
main: net.theprogrammersworld.herobrine.HerobrineAI
|
||||||
version: 1.2.2
|
version: 1.2.3
|
||||||
commands:
|
commands:
|
||||||
herobrine:
|
herobrine:
|
||||||
description: Main command.
|
description: Main command.
|
||||||
|
Reference in New Issue
Block a user