Update to APIv4. I hope this no borke git.
This commit is contained in:
@@ -7,45 +7,53 @@ import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.server.ServerListPingEvent;
|
||||
|
||||
import com.nemez.cmdmgr.Command;
|
||||
import com.nemez.cmdmgr.Command.AsyncType;
|
||||
import com.redstoner.annotations.AutoRegisterListener;
|
||||
import com.redstoner.annotations.Commands;
|
||||
import com.redstoner.annotations.Version;
|
||||
import com.redstoner.misc.Utils;
|
||||
import com.redstoner.misc.CommandHolderType;
|
||||
import com.redstoner.modules.Module;
|
||||
|
||||
@Commands(CommandHolderType.String)
|
||||
@AutoRegisterListener
|
||||
@Version(major = 2, minor = 0, revision = 4, compatible = 2)
|
||||
@Version(major = 4, minor = 0, revision = 0, compatible = 4)
|
||||
public class Motd implements Module, Listener
|
||||
{
|
||||
private String default_motd, motd;
|
||||
|
||||
@Command(hook = "setmotd")
|
||||
@Command(hook = "setmotd", async = AsyncType.ALWAYS)
|
||||
public boolean setMotd(CommandSender sender, String motd)
|
||||
{
|
||||
if (motd.equals("--reset"))
|
||||
this.motd = default_motd;
|
||||
else
|
||||
this.motd = motd;
|
||||
Utils.sendMessage(sender, null, "The new motd is:\n" + this.motd, '&');
|
||||
getLogger().message(sender, "The new motd is:\n" + this.motd);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Command(hook = "getmotd")
|
||||
@Command(hook = "getmotd", async = AsyncType.ALWAYS)
|
||||
public boolean getMotd(CommandSender sender)
|
||||
{
|
||||
Utils.sendMessage(sender, null, motd == null ? default_motd : motd, '&');
|
||||
getLogger().message(sender, motd == null ? default_motd : motd);
|
||||
return true;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onServerPing(ServerListPingEvent event)
|
||||
{
|
||||
event.setMotd(motd == null ? default_motd : motd);
|
||||
event.setMotd(motd);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onEnable()
|
||||
{
|
||||
default_motd = Bukkit.getMotd();
|
||||
if (default_motd == null)
|
||||
{
|
||||
default_motd = "§6Sample text\n§4FIX YOUR SERVER!";
|
||||
}
|
||||
motd = default_motd;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user