*Added donation message to the server console output when the plugin is enabled

*Added donation message when OPs log in to the server
*Added configuration option to disable donation message when OPs log in to the server
*Updated plugin.yml version number from 1.6.1 to 1.7.0
*Changed plugin internal version number from 18 to 19
This commit is contained in:
David Berdik 2017-06-11 21:51:18 -04:00
parent 613677d243
commit 51df08505f
4 changed files with 36 additions and 7 deletions

View File

@ -23,6 +23,7 @@ public class ConfigDB
private Logger log;
public YamlConfiguration config;
public YamlConfiguration npc;
public boolean ShowDonateMsgToOp = true;
public int ShowRate = 2;
public boolean HitPlayer = true;
public boolean SendMessages = true;
@ -202,6 +203,7 @@ public class ConfigDB
this.log.info("[Herobrine] Creating new Config ...");
this.config.set("config.ShowInterval", Integer.valueOf(144000));
this.config.set("config.ShowDonateMsgToOp", Boolean.valueOf(true));
this.config.set("config.ShowRate", Integer.valueOf(2));
this.config.set("config.HitPlayer", Boolean.valueOf(true));
this.config.set("config.SendMessages", Boolean.valueOf(true));
@ -557,6 +559,14 @@ public class ConfigDB
this.config.set("config.BuildPyramidOnChunkPercentage", Integer.valueOf(5));
this.config.set("config.BuildTempleOnChunkPercentage", Integer.valueOf(5));
}
if (!this.config.contains("config.ShowDonateMsgToOp"))
{
if (!hasUpdated)
this.log.info("[Herobrine] Configuration file updating to Herobrine v" + pluginVersionNumber);
hasUpdated = true;
this.config.set("config.ShowDonateMsgToOp", Boolean.valueOf(true));
}
if (hasUpdated)
{
try
@ -674,6 +684,7 @@ public class ConfigDB
this.UseSound = this.config.getBoolean("config.UseHauntSound");
this.ShowInTabList = this.config.getBoolean("config.ShowInTabList");
this.CheckForUpdates = this.config.getBoolean("config.CheckForUpdates");
this.ShowDonateMsgToOp = this.config.getBoolean("config.ShowDonateMsgToOp");
Herobrine.HerobrineMaxHP = this.HerobrineHP;
Herobrine.getPluginCore().getAICore().stopMAIN();
Herobrine.getPluginCore().getAICore().startMAIN();

View File

@ -92,6 +92,14 @@ public class Herobrine extends JavaPlugin implements Listener {
{
new Thread(new UpdateScanner()).start();
}
Bukkit.getServer().getConsoleSender().sendMessage(
ChatColor.GREEN + "Thank you for choosing the Herobrine plugin for " +
"your Minecraft server. If you would like to promote your Minecraft server, please " +
"donate to us at www.theprogrammersworld.net/donate.php and mention your server in " +
"your donation message as well as why you like Herobrine. In return, we will add " +
"your server and message to a randomly rotating server list on our plugin's " +
"promotional pages. Thank you, and enjoy the plugin.");
}
private void initHerobrine() {
@ -291,11 +299,21 @@ public class Herobrine extends JavaPlugin implements Listener {
"teleported to it. To fix this, we have teleported you to this server's default spawn point.");
}
// If the player that has just joined is an OP and a newer version of Herobrine is available,
// display a message to them stating so.
if(configdb.newVersionFound && joinedPlayer.isOp()) {
joinedPlayer.sendMessage(ChatColor.RED + "A new version of Herobrine is available. To " +
"get it, go to www.theprogrammersworld.net/Herobrine and click \"Download\".");
// Check if the player that has just joined is an OP. If they are, perform several additional checks.
if(joinedPlayer.isOp()) {
if(configdb.ShowDonateMsgToOp)
// If the server is configured to display the donation promotion to OPs, then display it.
joinedPlayer.sendMessage(ChatColor.GREEN + "Thank you for choosing the Herobrine plugin for " +
"your Minecraft server. If you would like to promote your Minecraft server, please " +
"donate to us at www.theprogrammersworld.net/donate.php and mention your server in " +
"your donation message as well as why you like Herobrine. In return, we will add " +
"your server and message to a randomly rotating server list on our plugin's " +
"promotional pages. Thank you, and enjoy the plugin.");
// If a newer version of Herobrine is available, display a message to the OP stating so.
if(configdb.newVersionFound)
joinedPlayer.sendMessage(ChatColor.RED + "A new version of Herobrine is available. To " +
"get it, go to www.theprogrammersworld.net/Herobrine and click \"Download\".");
}
}

View File

@ -15,7 +15,7 @@ public class UpdateScanner implements Runnable {
// Check for a newer version of the plugin, and put the thread to sleep for 24 hours
// before the check is performed again. If a newer version is found, begin reporting
// the discovery of a newer version once every hour.
final String pluginVersionCount = "18";
final String pluginVersionCount = "19";
ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
while(!Herobrine.getPluginCore().getConfigDB().newVersionFound) {

View File

@ -1,6 +1,6 @@
name: Herobrine
main: net.theprogrammersworld.herobrine.Herobrine
version: 1.6.1
version: 1.7.0
website: https://www.theprogrammersworld.net
commands:
herobrine: