Added #1 fully
This commit is contained in:
parent
5379d2cc1a
commit
c3fbbdfcaf
2 changed files with 24 additions and 4 deletions
|
@ -6,6 +6,7 @@ import java.nio.charset.StandardCharsets;
|
|||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
|
@ -28,7 +29,7 @@ import sx.blah.discord.handle.obj.IChannel;
|
|||
public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
|
||||
private static final String SubredditURL = "https://www.reddit.com/r/ChromaGamers";
|
||||
private static boolean stop = false;
|
||||
private static IDiscordClient dc;
|
||||
public static IDiscordClient dc;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
|
@ -50,9 +51,9 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
|
|||
}
|
||||
}
|
||||
|
||||
private IChannel botchannel;
|
||||
private IChannel annchannel;
|
||||
private IChannel genchannel;
|
||||
public static IChannel botchannel;
|
||||
public static IChannel annchannel;
|
||||
public static IChannel genchannel;
|
||||
|
||||
@Override
|
||||
public void handle(ReadyEvent event) {
|
||||
|
|
19
src/main/java/buttondevteam/discordplugin/MCListener.java
Normal file
19
src/main/java/buttondevteam/discordplugin/MCListener.java
Normal file
|
@ -0,0 +1,19 @@
|
|||
package buttondevteam.discordplugin;
|
||||
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.server.ServerCommandEvent;
|
||||
|
||||
public class MCListener implements Listener {
|
||||
public void onServerCommandPreprocess(ServerCommandEvent e) {
|
||||
if (!DiscordPlugin.dc.isReady())
|
||||
return;
|
||||
try {
|
||||
if (e.getCommand().equalsIgnoreCase("stop"))
|
||||
DiscordPlugin.botchannel.sendMessage("Minecraft server shutting down!");
|
||||
else if (e.getCommand().equalsIgnoreCase("restart"))
|
||||
DiscordPlugin.botchannel.sendMessage("Minecraft server restarting");
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue