Skip to content

Instantly share code, notes, and snippets.

@Lizardz
Last active December 10, 2018 14:23
Show Gist options
  • Save Lizardz/1c8b2e06b9a62acdc70b to your computer and use it in GitHub Desktop.
Save Lizardz/1c8b2e06b9a62acdc70b to your computer and use it in GitHub Desktop.
[Lizardz] Announcer Plugin 1.0
package me.Lizardz.dev;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.File;
/**
* Created by Alexander on 2/19/15.
*/
public class AnnouncerMain extends JavaPlugin {
FileConfiguration config;
File cfile;
public void onEnable() {
getLogger().info("Plugin enabled!");
config = getConfig();
config.options().copyDefaults(true);
saveConfig();
cfile = new File(getDataFolder(), "config.yml");
this.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
public void run() {
Bukkit.broadcastMessage(ChatColor.GOLD + toString() + ChatColor.BOLD + "> " + ChatColor.DARK_AQUA + config.getString("announcement-1"));
}
}, 0L, 600L);
this.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
public void run() {
Bukkit.broadcastMessage(ChatColor.GOLD + toString() + ChatColor.BOLD + "> " + ChatColor.DARK_AQUA + config.getString("announcement-2"));
}
}, 0L, 600L);
this.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
public void run() {
Bukkit.broadcastMessage(ChatColor.GOLD + toString() + ChatColor.BOLD + "> " + ChatColor.DARK_AQUA + config.getString("announcement-3"));
}
}, 0L, 600L);
this.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
public void run() {
Bukkit.broadcastMessage(ChatColor.GOLD + toString() + ChatColor.BOLD + "> " + ChatColor.DARK_AQUA + config.getString("announcement-4"));
}
}, 0L, 600L);
this.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
public void run() {
Bukkit.broadcastMessage(ChatColor.GOLD + toString() + ChatColor.BOLD + "> " + ChatColor.DARK_AQUA + config.getString("announcement-5"));
}
}, 0L, 600L);
/**
* 20L = 20 Ticks
* 20 Ticks = 1 second
* 300 Ticks = 30 seconds
* 600 Ticks = 1 minute
*/
return;
}
}
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
This is the announcer config.yml paste:
announcement-1: Register @ our website!
announcement-2: Donate for amazing perks!
announcement-3: Make sure to checkout all our gamemodes!
announcement-4: Execute the command "/vote" in any server to receive awesome rewards!
announcement-5: NEW gamemodes being added soon!
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment