mirror of
https://github.com/SimplexDevelopment/SimplexCore.git
synced 2024-12-22 16:47:37 +00:00
Some tweaks
This commit is contained in:
parent
6c18f25820
commit
952bbd72d5
@ -1,6 +1,7 @@
|
|||||||
package io.github.paldiu.simplexcore;
|
package io.github.paldiu.simplexcore;
|
||||||
|
|
||||||
import io.github.paldiu.simplexcore.command.defaults.Command_info;
|
import io.github.paldiu.simplexcore.command.defaults.Command_info;
|
||||||
|
import io.github.paldiu.simplexcore.future.Announcer;
|
||||||
import io.github.paldiu.simplexcore.listener.ServerPluginListener;
|
import io.github.paldiu.simplexcore.listener.ServerPluginListener;
|
||||||
import io.github.paldiu.simplexcore.listener.SimplexListener;
|
import io.github.paldiu.simplexcore.listener.SimplexListener;
|
||||||
import io.github.paldiu.simplexcore.plugin.SimplexAddon;
|
import io.github.paldiu.simplexcore.plugin.SimplexAddon;
|
||||||
@ -21,6 +22,7 @@ public final class SimplexCore extends SimplexAddon<SimplexCore> {
|
|||||||
Constants.getRegistry().register(this);
|
Constants.getRegistry().register(this);
|
||||||
Constants.getCommandLoader().classpath(Command_info.class).load();
|
Constants.getCommandLoader().classpath(Command_info.class).load();
|
||||||
SimplexListener.register(new ServerPluginListener(), this);
|
SimplexListener.register(new ServerPluginListener(), this);
|
||||||
|
new Announcer();
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
suspended = true;
|
suspended = true;
|
||||||
// TODO: Write an output to a file with why it suspended.
|
// TODO: Write an output to a file with why it suspended.
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package io.github.paldiu.simplexcore.chat;
|
package io.github.paldiu.simplexcore.chat;
|
||||||
|
|
||||||
import io.github.paldiu.simplexcore.utils.Bean;
|
import io.github.paldiu.simplexcore.utils.Bean;
|
||||||
import net.md_5.bungee.api.ChatColor;
|
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@CommandInfo(name = "defaultcommand", usage = "/<command>", description = "Default plugin command.")
|
@CommandInfo(name = "default", usage = "/<command>", description = "Default plugin command.")
|
||||||
public final class DefaultCommand extends SimplexCommand {
|
public final class DefaultCommand extends SimplexCommand {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||||
|
@ -0,0 +1,29 @@
|
|||||||
|
package io.github.paldiu.simplexcore.future;
|
||||||
|
|
||||||
|
import io.github.paldiu.simplexcore.chat.Messages;
|
||||||
|
import io.github.paldiu.simplexcore.utils.Constants;
|
||||||
|
import org.apache.commons.lang.math.RandomUtils;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class Announcer extends SimplexTask {
|
||||||
|
|
||||||
|
public Announcer() {
|
||||||
|
super(20L);
|
||||||
|
register(this, Constants.getPlugin(), true, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> stringList = new ArrayList<>(){{
|
||||||
|
add("Join our discord!" + Messages.DISCORD.getMessage());
|
||||||
|
add("Thank you for using SimplexCore!");
|
||||||
|
add("https://github.com/Paldiu/SimplexCore");
|
||||||
|
}};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void accept(BukkitTask bukkitTask) {
|
||||||
|
Bukkit.getServer().broadcastMessage(stringList.get(RandomUtils.nextInt(stringList.size())));
|
||||||
|
}
|
||||||
|
}
|
@ -17,6 +17,11 @@ public abstract class SimplexTask implements Consumer<BukkitTask> {
|
|||||||
INTERVAL = interval;
|
INTERVAL = interval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected SimplexTask(long interval) {
|
||||||
|
DELAY = 0L;
|
||||||
|
INTERVAL = interval;
|
||||||
|
}
|
||||||
|
|
||||||
protected SimplexTask() {
|
protected SimplexTask() {
|
||||||
DELAY = Constants.getTimeValues().SECOND() * 30; // 30 seconds until the task triggers for the first time.
|
DELAY = Constants.getTimeValues().SECOND() * 30; // 30 seconds until the task triggers for the first time.
|
||||||
INTERVAL = Constants.getTimeValues().MINUTE() * 5; // Task will run at 5 minute intervals once the first trigger has been called.
|
INTERVAL = Constants.getTimeValues().MINUTE() * 5; // Task will run at 5 minute intervals once the first trigger has been called.
|
||||||
|
Loading…
Reference in New Issue
Block a user