updates
This commit is contained in:
parent
3a759dd0b6
commit
17bc43d08f
2
pom.xml
2
pom.xml
@ -5,7 +5,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.loganmagnan</groupId>
|
||||
<artifactId>PluginBase</artifactId>
|
||||
<artifactId>NaturalDisasters</artifactId>
|
||||
<version>1.0</version>
|
||||
|
||||
<properties>
|
||||
|
@ -1,201 +0,0 @@
|
||||
package aether;
|
||||
|
||||
import aether.event.BoardCreateEvent;
|
||||
import aether.scoreboard.Board;
|
||||
import aether.scoreboard.BoardAdapter;
|
||||
import aether.scoreboard.BoardEntry;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.scoreboard.DisplaySlot;
|
||||
import org.bukkit.scoreboard.Objective;
|
||||
import org.bukkit.scoreboard.Score;
|
||||
import org.bukkit.scoreboard.Scoreboard;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static aether.AetherOptions.defaultOptions;
|
||||
|
||||
public class Aether implements Listener {
|
||||
|
||||
@Getter BoardAdapter adapter;
|
||||
@Getter private JavaPlugin plugin;
|
||||
@Getter private AetherOptions options;
|
||||
|
||||
private Pattern HEX_PATTERN = Pattern.compile("&#([A-Fa-f0-9]{6})");
|
||||
|
||||
public Aether(JavaPlugin plugin, BoardAdapter adapter, AetherOptions options) {
|
||||
this.options = options;
|
||||
this.plugin = plugin;
|
||||
|
||||
Bukkit.getPluginManager().registerEvents(this, plugin);
|
||||
|
||||
setAdapter(adapter);
|
||||
run();
|
||||
}
|
||||
|
||||
public Aether(JavaPlugin plugin, BoardAdapter adapter) {
|
||||
this(plugin, adapter, defaultOptions());
|
||||
}
|
||||
|
||||
public Aether(JavaPlugin plugin) {
|
||||
this(plugin, null, defaultOptions());
|
||||
}
|
||||
|
||||
private void run() {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (adapter == null) return;
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
Board board = Board.getByPlayer(player);
|
||||
if (board != null) {
|
||||
List<String> scores = adapter.getScoreboard(player, board, board.getCooldowns());
|
||||
List<String> translatedScores = new ArrayList<>();
|
||||
if (scores == null) {
|
||||
if (!board.getEntries().isEmpty()) {
|
||||
for (BoardEntry boardEntry : board.getEntries()) {
|
||||
boardEntry.remove();
|
||||
}
|
||||
board.getEntries().clear();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
for (String line : scores) {
|
||||
translatedScores.add(ChatColor.translateAlternateColorCodes('&', line));
|
||||
}
|
||||
|
||||
if (!options.scoreDirectionDown()) {
|
||||
Collections.reverse(scores);
|
||||
}
|
||||
|
||||
Scoreboard scoreboard = board.getScoreboard();
|
||||
Objective objective = board.getObjective();
|
||||
|
||||
if (!(objective.getDisplayName().equals(adapter.getTitle(player)))) {
|
||||
objective.setDisplayName(ChatColor.translateAlternateColorCodes('&', adapter.getTitle(player)));
|
||||
}
|
||||
|
||||
outer:
|
||||
for (int i = 0; i < scores.size(); i++) {
|
||||
String text = scores.get(i);
|
||||
int position;
|
||||
if (options.scoreDirectionDown()) {
|
||||
position = 15 - i;
|
||||
} else {
|
||||
position = i + 1;
|
||||
}
|
||||
|
||||
Iterator<BoardEntry> iterator = new ArrayList<>(board.getEntries()).iterator();
|
||||
while (iterator.hasNext()) {
|
||||
BoardEntry boardEntry = iterator.next();
|
||||
Score score = objective.getScore(boardEntry.getKey());
|
||||
|
||||
if (score != null && boardEntry.getText().equals(ChatColor.translateAlternateColorCodes('&', text))) {
|
||||
if (score.getScore() == position) {
|
||||
continue outer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int positionToSearch = options.scoreDirectionDown() ? 15 - position : position - 1;
|
||||
|
||||
iterator = board.getEntries().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
BoardEntry boardEntry = iterator.next();
|
||||
int entryPosition = scoreboard.getObjective(DisplaySlot.SIDEBAR).getScore(boardEntry.getKey()).getScore();
|
||||
|
||||
if (!options.scoreDirectionDown()) {
|
||||
if (entryPosition > scores.size()) {
|
||||
iterator.remove();
|
||||
boardEntry.remove();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
BoardEntry entry = board.getByPosition(positionToSearch);
|
||||
|
||||
if (entry == null) {
|
||||
new BoardEntry(board, text).send(position);
|
||||
} else {
|
||||
entry.setText(text).setup().send(position);
|
||||
}
|
||||
|
||||
if (board.getEntries().size() > scores.size()) {
|
||||
iterator = board.getEntries().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
BoardEntry boardEntry = iterator.next();
|
||||
if ((!translatedScores.contains(boardEntry.getText())) || Collections.frequency(board.getBoardEntriesFormatted(), boardEntry.getText()) > 1) {
|
||||
iterator.remove();
|
||||
boardEntry.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
adapter.onScoreboardCreate(player, scoreboard);
|
||||
player.setScoreboard(scoreboard);
|
||||
}
|
||||
}
|
||||
}
|
||||
}.runTaskTimerAsynchronously(plugin, 20L, 2L);
|
||||
}
|
||||
|
||||
public void setAdapter(BoardAdapter adapter) {
|
||||
this.adapter = adapter;
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
Board board = Board.getByPlayer(player);
|
||||
if (board != null) {
|
||||
Board.getBoards().remove(board);
|
||||
}
|
||||
Bukkit.getPluginManager().callEvent(new BoardCreateEvent(new Board(player, this, options), player));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoinEvent(PlayerJoinEvent event) {
|
||||
if (Board.getByPlayer(event.getPlayer()) == null) {
|
||||
Bukkit.getPluginManager().callEvent(new BoardCreateEvent(new Board(event.getPlayer(), this, options), event.getPlayer()));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onPlayerQuitEvent(PlayerQuitEvent event) {
|
||||
Board board = Board.getByPlayer(event.getPlayer());
|
||||
if (board != null) {
|
||||
Board.getBoards().remove(board);
|
||||
}
|
||||
}
|
||||
|
||||
public String colorize(String message) {
|
||||
return ChatColor.translateAlternateColorCodes('&', message);
|
||||
}
|
||||
|
||||
public String translateHexColorCodes(String message) {
|
||||
char colorChar = '§';
|
||||
Matcher matcher = HEX_PATTERN.matcher(message);
|
||||
StringBuffer buffer = new StringBuffer(message.length() + 32);
|
||||
while (matcher.find()) {
|
||||
String group = matcher.group(1);
|
||||
matcher.appendReplacement(buffer, "§x§" + group
|
||||
.charAt(0) + '§' + group.charAt(1) + '§' + group
|
||||
.charAt(2) + '§' + group.charAt(3) + '§' + group
|
||||
.charAt(4) + '§' + group.charAt(5));
|
||||
}
|
||||
return matcher.appendTail(buffer).toString();
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
package aether;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Accessors(chain = true, fluent = true)
|
||||
public class AetherOptions {
|
||||
|
||||
private boolean hook;
|
||||
private boolean scoreDirectionDown;
|
||||
|
||||
static AetherOptions defaultOptions() {
|
||||
return new AetherOptions().hook(false).scoreDirectionDown(false);
|
||||
}
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
package aether.event;
|
||||
|
||||
import aether.scoreboard.Board;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class BoardCreateEvent extends Event {
|
||||
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
@Getter private final Board board;
|
||||
@Getter private final Player player;
|
||||
|
||||
public BoardCreateEvent(Board board, Player player) {
|
||||
this.board = board;
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return HANDLERS;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers() {
|
||||
return HANDLERS;
|
||||
}
|
||||
}
|
@ -1,129 +0,0 @@
|
||||
package aether.scoreboard;
|
||||
|
||||
import aether.Aether;
|
||||
import aether.AetherOptions;
|
||||
import aether.scoreboard.cooldown.BoardCooldown;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scoreboard.DisplaySlot;
|
||||
import org.bukkit.scoreboard.Objective;
|
||||
import org.bukkit.scoreboard.Scoreboard;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class Board {
|
||||
|
||||
@Getter private static Set<Board> boards = new HashSet<>();
|
||||
|
||||
private final Aether aether;
|
||||
private final AetherOptions options;
|
||||
|
||||
@Getter private Scoreboard scoreboard;
|
||||
@Getter private Player player;
|
||||
@Getter private Objective objective;
|
||||
@Getter private Set<String> keys;
|
||||
@Getter private List<BoardEntry> entries;
|
||||
|
||||
private Set<BoardCooldown> cooldowns;
|
||||
|
||||
public Board(Player player, Aether aether, AetherOptions options) {
|
||||
this.player = player;
|
||||
this.aether = aether;
|
||||
this.options = options;
|
||||
|
||||
this.keys = new HashSet<>();
|
||||
this.entries = new ArrayList<>();
|
||||
|
||||
this.cooldowns = new HashSet<>();
|
||||
|
||||
setup();
|
||||
}
|
||||
|
||||
public static Board getByPlayer(Player player) {
|
||||
for (Board board : boards) {
|
||||
if (board.getPlayer().getName().equals(player.getName())) {
|
||||
return board;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void setup() {
|
||||
if (options.hook() && !player.getScoreboard().equals(Bukkit.getScoreboardManager().getMainScoreboard())) {
|
||||
scoreboard = player.getScoreboard();
|
||||
} else {
|
||||
scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
|
||||
}
|
||||
|
||||
objective = scoreboard.registerNewObjective("glaedr_is_shit", "dummy");
|
||||
objective.setDisplaySlot(DisplaySlot.SIDEBAR);
|
||||
|
||||
if (aether.getAdapter() != null) {
|
||||
objective.setDisplayName(ChatColor.translateAlternateColorCodes('&', aether.getAdapter().getTitle(player)));
|
||||
} else {
|
||||
objective.setDisplayName("Default Title");
|
||||
}
|
||||
|
||||
boards.add(this);
|
||||
}
|
||||
|
||||
public String getNewKey(BoardEntry entry) {
|
||||
for (ChatColor color : ChatColor.values()) {
|
||||
String colorText = color + "" + ChatColor.WHITE;
|
||||
if (entry.getText().length() > 16) {
|
||||
String sub = entry.getText().substring(0, 16);
|
||||
colorText = colorText + ChatColor.getLastColors(sub);
|
||||
}
|
||||
|
||||
if (!keys.contains(colorText)) {
|
||||
keys.add(colorText);
|
||||
return colorText;
|
||||
}
|
||||
}
|
||||
|
||||
throw new IndexOutOfBoundsException("No more keys available!");
|
||||
}
|
||||
|
||||
public List<String> getBoardEntriesFormatted() {
|
||||
List<String> toReturn = new ArrayList<>();
|
||||
for (BoardEntry entry : new ArrayList<>(entries)) {
|
||||
toReturn.add(entry.getText());
|
||||
}
|
||||
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
public BoardEntry getByPosition(int position) {
|
||||
int i = 0;
|
||||
|
||||
for (BoardEntry board : entries) {
|
||||
if (i == position) {
|
||||
return board;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public BoardCooldown getCooldown(String id) {
|
||||
for (BoardCooldown cooldown : getCooldowns()) {
|
||||
if (cooldown.getId().equals(id)) {
|
||||
return cooldown;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Set<BoardCooldown> getCooldowns() {
|
||||
cooldowns.removeIf(cooldown -> System.currentTimeMillis() >= cooldown.getEnd());
|
||||
return cooldowns;
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
package aether.scoreboard;
|
||||
|
||||
import aether.scoreboard.cooldown.BoardCooldown;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scoreboard.Scoreboard;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public interface BoardAdapter {
|
||||
|
||||
String getTitle(Player player);
|
||||
|
||||
List<String> getScoreboard(Player player, Board board, Set<BoardCooldown> cooldowns);
|
||||
|
||||
void onScoreboardCreate(Player player, Scoreboard board);
|
||||
}
|
@ -1,90 +0,0 @@
|
||||
package aether.scoreboard;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.scoreboard.Objective;
|
||||
import org.bukkit.scoreboard.Score;
|
||||
import org.bukkit.scoreboard.Scoreboard;
|
||||
import org.bukkit.scoreboard.Team;
|
||||
|
||||
@Accessors(chain = true)
|
||||
public class BoardEntry {
|
||||
|
||||
@Getter private Board board;
|
||||
@Getter @Setter private String text;
|
||||
@Getter private String originalText;
|
||||
@Getter private String key;
|
||||
@Getter private Team team;
|
||||
|
||||
public BoardEntry(Board board, String text) {
|
||||
this.board = board;
|
||||
this.text = text;
|
||||
this.originalText = text;
|
||||
this.key = board.getNewKey(this);
|
||||
|
||||
setup();
|
||||
}
|
||||
|
||||
public BoardEntry setup() {
|
||||
Scoreboard scoreboard = board.getScoreboard();
|
||||
|
||||
text = ChatColor.translateAlternateColorCodes('&', text);
|
||||
|
||||
String teamName = key;
|
||||
|
||||
if (teamName.length() > 16) {
|
||||
teamName = teamName.substring(0, 16);
|
||||
}
|
||||
|
||||
if (scoreboard.getTeam(teamName) != null) {
|
||||
team = scoreboard.getTeam(teamName);
|
||||
} else {
|
||||
team = scoreboard.registerNewTeam(teamName);
|
||||
}
|
||||
|
||||
if (!(team.getEntries().contains(key))) {
|
||||
team.addEntry(key);
|
||||
}
|
||||
|
||||
if (!(board.getEntries().contains(this))) {
|
||||
board.getEntries().add(this);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public BoardEntry send(int position) {
|
||||
Objective objective = board.getObjective();
|
||||
|
||||
if (text.length() > 16) {
|
||||
boolean fix = text.toCharArray()[15] == ChatColor.COLOR_CHAR;
|
||||
|
||||
String prefix = fix ? text.substring(0, 15) : text.substring(0, 16);
|
||||
String suffix = fix ? text.substring(15) : ChatColor.getLastColors(prefix) + text.substring(16);
|
||||
|
||||
team.setPrefix(prefix);
|
||||
|
||||
if (suffix.length() > 16) {
|
||||
team.setSuffix(suffix.substring(0, 16));
|
||||
} else {
|
||||
team.setSuffix(suffix);
|
||||
}
|
||||
} else {
|
||||
team.setPrefix(text);
|
||||
team.setSuffix("");
|
||||
}
|
||||
|
||||
Score score = objective.getScore(key);
|
||||
score.setScore(position);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public void remove() {
|
||||
board.getKeys().remove(key);
|
||||
board.getScoreboard().resetScores(key);
|
||||
}
|
||||
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
package aether.scoreboard.cooldown;
|
||||
|
||||
import aether.scoreboard.Board;
|
||||
import lombok.Getter;
|
||||
import org.apache.commons.lang3.time.DurationFormatUtils;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
public class BoardCooldown {
|
||||
|
||||
private static final DecimalFormat SECONDS_FORMATTER = new DecimalFormat("#0.0");
|
||||
|
||||
@Getter private final Board board;
|
||||
@Getter private final String id;
|
||||
@Getter private final double duration;
|
||||
@Getter private final long end;
|
||||
|
||||
public BoardCooldown(Board board, String id, double duration) {
|
||||
this.board = board;
|
||||
this.id = id;
|
||||
this.duration = duration;
|
||||
this.end = (long) (System.currentTimeMillis() + (duration * 1000));
|
||||
|
||||
board.getCooldowns().add(this);
|
||||
}
|
||||
|
||||
public String getFormattedString(BoardFormat format) {
|
||||
if (format == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
if (format == BoardFormat.SECONDS) {
|
||||
return SECONDS_FORMATTER.format(((end - System.currentTimeMillis()) / 1000.0f));
|
||||
} else {
|
||||
return DurationFormatUtils.formatDuration(end - System.currentTimeMillis(), "mm:ss");
|
||||
}
|
||||
}
|
||||
|
||||
public void cancel() {
|
||||
board.getCooldowns().remove(this);
|
||||
}
|
||||
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
package aether.scoreboard.cooldown;
|
||||
|
||||
public enum BoardFormat {
|
||||
SECONDS, MINUTES, HOURS
|
||||
}
|
@ -1,12 +1,13 @@
|
||||
package com.loganmagnan.pluginbase;
|
||||
package com.loganmagnan.naturaldisasters;
|
||||
|
||||
import com.loganmagnan.pluginbase.menusystem.PlayerMenuUtil;
|
||||
import com.loganmagnan.pluginbase.utils.ClassRegistrationUtils;
|
||||
import com.loganmagnan.pluginbase.utils.ColorUtils;
|
||||
import com.loganmagnan.pluginbase.utils.Utils;
|
||||
import com.loganmagnan.pluginbase.utils.command.CommandFramework;
|
||||
import com.loganmagnan.pluginbase.utils.config.FileConfig;
|
||||
import com.loganmagnan.pluginbase.utils.config.file.Config;
|
||||
import com.loganmagnan.naturaldisasters.managers.naturaldisasters.NaturalDisasterManager;
|
||||
import com.loganmagnan.naturaldisasters.menusystem.PlayerMenuUtil;
|
||||
import com.loganmagnan.naturaldisasters.utils.ClassRegistrationUtils;
|
||||
import com.loganmagnan.naturaldisasters.utils.ColorUtils;
|
||||
import com.loganmagnan.naturaldisasters.utils.Utils;
|
||||
import com.loganmagnan.naturaldisasters.utils.command.CommandFramework;
|
||||
import com.loganmagnan.naturaldisasters.utils.config.FileConfig;
|
||||
import com.loganmagnan.naturaldisasters.utils.config.file.Config;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -15,16 +16,17 @@ import java.util.HashMap;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class PluginBase extends JavaPlugin {
|
||||
public class NaturalDisasters extends JavaPlugin {
|
||||
|
||||
// Main class instance
|
||||
@Getter private static PluginBase instance;
|
||||
@Getter private static NaturalDisasters instance;
|
||||
|
||||
// Configuration files
|
||||
private Config mainConfig;
|
||||
private FileConfig messagesConfig;
|
||||
|
||||
// Managers
|
||||
private NaturalDisasterManager naturalDisasterManager;
|
||||
|
||||
// Menu system
|
||||
private HashMap<Player, PlayerMenuUtil> playerMenuUtilMap = new HashMap<>();
|
||||
@ -45,7 +47,7 @@ public class PluginBase extends JavaPlugin {
|
||||
|
||||
// Say the plugin's name
|
||||
this.getServer().getConsoleSender().sendMessage(Utils.chatBar);
|
||||
this.getServer().getConsoleSender().sendMessage(ColorUtils.getMessageType("&dPluginBase &7- &av" + this.getDescription().getVersion()));
|
||||
this.getServer().getConsoleSender().sendMessage(ColorUtils.getMessageType("&dNaturalDisasters &7- &av" + this.getDescription().getVersion()));
|
||||
this.getServer().getConsoleSender().sendMessage(ColorUtils.getMessageType("&7Made by &eLoganM Development"));
|
||||
this.getServer().getConsoleSender().sendMessage(Utils.chatBar);
|
||||
|
||||
@ -65,17 +67,17 @@ public class PluginBase extends JavaPlugin {
|
||||
|
||||
// Load commands function
|
||||
private void loadCommands() {
|
||||
ClassRegistrationUtils.loadCommands("com.loganmagnan.pluginbase.commands");
|
||||
ClassRegistrationUtils.loadCommands("com.loganmagnan.naturaldisasters.commands");
|
||||
}
|
||||
|
||||
// Load managers function
|
||||
private void loadManagers() {
|
||||
|
||||
this.naturalDisasterManager = new NaturalDisasterManager();
|
||||
}
|
||||
|
||||
// Load listeners function
|
||||
private void loadListeners() {
|
||||
ClassRegistrationUtils.loadListeners("com.loganmagnan.pluginbase.listeners");
|
||||
ClassRegistrationUtils.loadListeners("com.loganmagnan.naturaldisasters.listeners");
|
||||
}
|
||||
|
||||
// Load runnables function
|
@ -1,4 +1,4 @@
|
||||
package com.loganmagnan.pluginbase.chatcolor;
|
||||
package com.loganmagnan.naturaldisasters.chatcolor;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
@ -1,4 +1,4 @@
|
||||
package com.loganmagnan.pluginbase.chatcolor;
|
||||
package com.loganmagnan.naturaldisasters.chatcolor;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
@ -0,0 +1,25 @@
|
||||
package com.loganmagnan.naturaldisasters.commands;
|
||||
|
||||
import com.loganmagnan.naturaldisasters.NaturalDisasters;
|
||||
import com.loganmagnan.naturaldisasters.utils.ColorUtils;
|
||||
import com.loganmagnan.naturaldisasters.utils.command.BaseCommand;
|
||||
import com.loganmagnan.naturaldisasters.utils.command.Command;
|
||||
import com.loganmagnan.naturaldisasters.utils.command.CommandArguments;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class ExampleCommand extends BaseCommand {
|
||||
|
||||
private NaturalDisasters main = NaturalDisasters.getInstance();
|
||||
|
||||
@Command(name = "example", permission = "permission.example")
|
||||
@Override
|
||||
public void executeAs(CommandArguments command) {
|
||||
Player player = command.getPlayer();
|
||||
|
||||
String[] args = command.getArgs();
|
||||
|
||||
if (args.length == 0) {
|
||||
player.sendMessage(ColorUtils.getMessageType("&aThis is an example command."));
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
package com.loganmagnan.pluginbase.listeners;
|
||||
package com.loganmagnan.naturaldisasters.listeners;
|
||||
|
||||
import com.loganmagnan.pluginbase.PluginBase;
|
||||
import com.loganmagnan.pluginbase.menusystem.Menu;
|
||||
import com.loganmagnan.naturaldisasters.NaturalDisasters;
|
||||
import com.loganmagnan.naturaldisasters.menusystem.Menu;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
@ -9,7 +9,7 @@ import org.bukkit.inventory.InventoryHolder;
|
||||
|
||||
public class MenuListener implements Listener {
|
||||
|
||||
private PluginBase main = PluginBase.getInstance();
|
||||
private NaturalDisasters main = NaturalDisasters.getInstance();
|
||||
|
||||
@EventHandler
|
||||
public void onMenuClick(InventoryClickEvent event) {
|
@ -0,0 +1,21 @@
|
||||
package com.loganmagnan.naturaldisasters.managers.naturaldisasters;
|
||||
|
||||
import com.loganmagnan.naturaldisasters.NaturalDisasters;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class NaturalDisasterManager {
|
||||
|
||||
private NaturalDisasters main = NaturalDisasters.getInstance();
|
||||
|
||||
private Map<NaturalDisasterType, Boolean> naturalDisasters = new HashMap<NaturalDisasterType, Boolean>();
|
||||
|
||||
public NaturalDisasterManager() {
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,92 @@
|
||||
package com.loganmagnan.naturaldisasters.managers.naturaldisasters;
|
||||
|
||||
public enum NaturalDisasterType {
|
||||
|
||||
AVALANCHE,
|
||||
ASHFALL,
|
||||
ARIDIFICATION,
|
||||
BLIZZARD,
|
||||
BUSHFIRE,
|
||||
BARREN_LAND_EXPANSION,
|
||||
CYCLONE,
|
||||
COLD_WAVE,
|
||||
COASTAL_EROSION,
|
||||
CROP_FAILURE,
|
||||
DROUGHT,
|
||||
DUST_STORM,
|
||||
DEBRIS_FLOW,
|
||||
DAM_FAILURE,
|
||||
EARTHQUAKE,
|
||||
EPIDEMIC,
|
||||
EROSION,
|
||||
EXTREME_HEAT,
|
||||
FLOOD,
|
||||
FAMINE,
|
||||
FIRESTORM,
|
||||
FLASH_FLOOD,
|
||||
FREEZING_RAIN,
|
||||
GROUND_COLLAPSE,
|
||||
GLACIER_COLLAPSE,
|
||||
GEYSER_ERUPTION,
|
||||
HURRICANE,
|
||||
HEAT_WAVE,
|
||||
HAILSTORM,
|
||||
HABOOB,
|
||||
ICE_STORM,
|
||||
INLAND_FLOODING,
|
||||
INSECT_INFESTATION,
|
||||
JUNGLE_FIRE,
|
||||
JET_STREAM_SHIFT,
|
||||
KARST_COLLAPSE,
|
||||
KRAKATOA_TYPE_ERUPTION,
|
||||
LANDSLIDE,
|
||||
LIGHTNING_STORM,
|
||||
LAVA_FLOW,
|
||||
LIMNIC_ERUPTION,
|
||||
MUDSLIDE,
|
||||
MONSOON_FLOODING,
|
||||
METEOR_STRIKE,
|
||||
MEGA_TSUNAMI,
|
||||
NUCLEAR_DISASTER,
|
||||
NIGHT_FROST,
|
||||
OCEAN_SWELL,
|
||||
OIL_SPILL,
|
||||
OUTBURST_FLOOD,
|
||||
PANDEMIC,
|
||||
PLAGUE,
|
||||
PERMAFROST_MELTING,
|
||||
QUICKSAND_FORMATION,
|
||||
QUAKE_INDUCED_TSUNAMI,
|
||||
QUASAR_ERUPTION,
|
||||
ROCKFALL,
|
||||
RIVERBANK_EROSION,
|
||||
ROGUE_WAVE,
|
||||
RADIATION_RELEASE,
|
||||
STORM_SURGE,
|
||||
SNOW_STORM,
|
||||
SANDSTORM,
|
||||
SINKHOLE,
|
||||
SEVERE_THUNDERSTORM,
|
||||
SOLAR_FLARE,
|
||||
TORNADO,
|
||||
TSUNAMI,
|
||||
TYPHOON,
|
||||
TUNDRA_THAWING,
|
||||
UNDERWATER_ERUPTION,
|
||||
UNSEASONAL_WEATHER_EXTREMES,
|
||||
URBAN_FLOODING,
|
||||
VOLCANIC_ERUPTION,
|
||||
VALLEY_FLOODING,
|
||||
VOLCANIC_MUDFLOW,
|
||||
WILDFIRE,
|
||||
WATERSPOUT,
|
||||
WINDSTORM,
|
||||
WINTER_STORM,
|
||||
X_CATEGORY_CYCLONES,
|
||||
X_FACTOR_DROUGHT,
|
||||
YELLOW_DUST_STORM,
|
||||
YEDOMA_THAWING,
|
||||
ZUD,
|
||||
ZONE_COLLAPSE,
|
||||
ZEPHYR_WINDS;
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
package com.loganmagnan.pluginbase.menusystem;
|
||||
package com.loganmagnan.naturaldisasters.menusystem;
|
||||
|
||||
import com.loganmagnan.pluginbase.utils.ColorUtils;
|
||||
import com.loganmagnan.pluginbase.utils.ItemBuilder;
|
||||
import com.loganmagnan.naturaldisasters.utils.ColorUtils;
|
||||
import com.loganmagnan.naturaldisasters.utils.ItemBuilder;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
@ -1,6 +1,6 @@
|
||||
package com.loganmagnan.pluginbase.menusystem;
|
||||
package com.loganmagnan.naturaldisasters.menusystem;
|
||||
|
||||
import com.loganmagnan.pluginbase.utils.ItemBuilder;
|
||||
import com.loganmagnan.naturaldisasters.utils.ItemBuilder;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
@ -1,6 +1,6 @@
|
||||
package com.loganmagnan.pluginbase.menusystem;
|
||||
package com.loganmagnan.naturaldisasters.menusystem;
|
||||
|
||||
import com.loganmagnan.pluginbase.utils.ColorUtils;
|
||||
import com.loganmagnan.naturaldisasters.utils.ColorUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
@ -1,4 +1,4 @@
|
||||
package com.loganmagnan.pluginbase.menusystem;
|
||||
package com.loganmagnan.naturaldisasters.menusystem;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.loganmagnan.pluginbase.utils;
|
||||
package com.loganmagnan.naturaldisasters.utils;
|
||||
|
||||
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
import lombok.experimental.UtilityClass;
|
@ -1,4 +1,4 @@
|
||||
package com.loganmagnan.pluginbase.utils;
|
||||
package com.loganmagnan.naturaldisasters.utils;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
@ -1,4 +1,4 @@
|
||||
package com.loganmagnan.pluginbase.utils;
|
||||
package com.loganmagnan.naturaldisasters.utils;
|
||||
|
||||
public class Cache<T> {
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.loganmagnan.pluginbase.utils;
|
||||
package com.loganmagnan.naturaldisasters.utils;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
@ -1,7 +1,7 @@
|
||||
package com.loganmagnan.pluginbase.utils;
|
||||
package com.loganmagnan.naturaldisasters.utils;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.loganmagnan.pluginbase.PluginBase;
|
||||
import com.loganmagnan.naturaldisasters.NaturalDisasters;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -19,7 +19,7 @@ public class ClassRegistrationUtils {
|
||||
for (Class<?> clazz : getClassesInPackage(packageName)) {
|
||||
if (isListener(clazz)) {
|
||||
try {
|
||||
PluginBase.getInstance().getServer().getPluginManager().registerEvents((Listener) clazz.newInstance(), PluginBase.getInstance());
|
||||
NaturalDisasters.getInstance().getServer().getPluginManager().registerEvents((Listener) clazz.newInstance(), NaturalDisasters.getInstance());
|
||||
} catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
@ -50,7 +50,7 @@ public class ClassRegistrationUtils {
|
||||
public static Collection<Class<?>> getClassesInPackage(String packageName) {
|
||||
JarFile jarFile;
|
||||
Collection<Class<?>> classes = new ArrayList<>();
|
||||
CodeSource codeSource = PluginBase.getInstance().getClass().getProtectionDomain().getCodeSource();
|
||||
CodeSource codeSource = NaturalDisasters.getInstance().getClass().getProtectionDomain().getCodeSource();
|
||||
URL resource = codeSource.getLocation();
|
||||
|
||||
String relPath = packageName.replace('.', '/');
|
@ -1,4 +1,4 @@
|
||||
package com.loganmagnan.pluginbase.utils;
|
||||
package com.loganmagnan.naturaldisasters.utils;
|
||||
|
||||
import lombok.NoArgsConstructor;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
@ -1,6 +1,6 @@
|
||||
package com.loganmagnan.pluginbase.utils;
|
||||
package com.loganmagnan.naturaldisasters.utils;
|
||||
|
||||
import com.loganmagnan.pluginbase.chatcolor.ColorSet;
|
||||
import com.loganmagnan.naturaldisasters.chatcolor.ColorSet;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.md_5.bungee.api.ChatColor;
|
@ -1,4 +1,4 @@
|
||||
package com.loganmagnan.pluginbase.utils;
|
||||
package com.loganmagnan.naturaldisasters.utils;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
@ -1,4 +1,4 @@
|
||||
package com.loganmagnan.pluginbase.utils;
|
||||
package com.loganmagnan.naturaldisasters.utils;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.loganmagnan.pluginbase.utils;
|
||||
package com.loganmagnan.naturaldisasters.utils;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
@ -1,4 +1,4 @@
|
||||
package com.loganmagnan.pluginbase.utils;
|
||||
package com.loganmagnan.naturaldisasters.utils;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Color;
|
||||
@ -10,7 +10,6 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
import org.bukkit.material.MaterialData;
|
||||
import org.bukkit.util.io.BukkitObjectInputStream;
|
||||
import org.bukkit.util.io.BukkitObjectOutputStream;
|
||||
import org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder;
|
@ -1,4 +1,4 @@
|
||||
package com.loganmagnan.pluginbase.utils;
|
||||
package com.loganmagnan.naturaldisasters.utils;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
@ -1,4 +1,4 @@
|
||||
package com.loganmagnan.pluginbase.utils;
|
||||
package com.loganmagnan.naturaldisasters.utils;
|
||||
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.loganmagnan.pluginbase.utils;
|
||||
package com.loganmagnan.naturaldisasters.utils;
|
||||
|
||||
public class KeyUtils {
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.loganmagnan.pluginbase.utils;
|
||||
package com.loganmagnan.naturaldisasters.utils;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
@ -1,4 +1,4 @@
|
||||
package com.loganmagnan.pluginbase.utils;
|
||||
package com.loganmagnan.naturaldisasters.utils;
|
||||
|
||||
import java.util.Random;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.loganmagnan.pluginbase.utils;
|
||||
package com.loganmagnan.naturaldisasters.utils;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
@ -1,4 +1,4 @@
|
||||
package com.loganmagnan.pluginbase.utils;
|
||||
package com.loganmagnan.naturaldisasters.utils;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
@ -1,4 +1,4 @@
|
||||
package com.loganmagnan.pluginbase.utils;
|
||||
package com.loganmagnan.naturaldisasters.utils;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
@ -1,4 +1,4 @@
|
||||
package com.loganmagnan.pluginbase.utils;
|
||||
package com.loganmagnan.naturaldisasters.utils;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
@ -1,4 +1,4 @@
|
||||
package com.loganmagnan.pluginbase.utils;
|
||||
package com.loganmagnan.naturaldisasters.utils;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.entity.Player;
|
@ -1,4 +1,4 @@
|
||||
package com.loganmagnan.pluginbase.utils;
|
||||
package com.loganmagnan.naturaldisasters.utils;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
@ -1,4 +1,4 @@
|
||||
package com.loganmagnan.pluginbase.utils;
|
||||
package com.loganmagnan.naturaldisasters.utils;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
@ -1,4 +1,4 @@
|
||||
package com.loganmagnan.pluginbase.utils;
|
||||
package com.loganmagnan.naturaldisasters.utils;
|
||||
|
||||
public enum TeamAction {
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.loganmagnan.pluginbase.utils;
|
||||
package com.loganmagnan.naturaldisasters.utils;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.text.DecimalFormat;
|
@ -1,4 +1,4 @@
|
||||
package com.loganmagnan.pluginbase.utils;
|
||||
package com.loganmagnan.naturaldisasters.utils;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
@ -1,4 +1,4 @@
|
||||
package com.loganmagnan.pluginbase.utils;
|
||||
package com.loganmagnan.naturaldisasters.utils;
|
||||
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.loganmagnan.pluginbase.utils;
|
||||
package com.loganmagnan.naturaldisasters.utils;
|
||||
|
||||
public interface TtlHandler<E> {
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.loganmagnan.pluginbase.utils;
|
||||
package com.loganmagnan.naturaldisasters.utils;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.loganmagnan.pluginbase.utils;
|
||||
package com.loganmagnan.naturaldisasters.utils;
|
||||
|
||||
import com.loganmagnan.pluginbase.PluginBase;
|
||||
import com.loganmagnan.naturaldisasters.NaturalDisasters;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
@ -11,7 +11,7 @@ import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class Utils {
|
||||
|
||||
private PluginBase main = PluginBase.getInstance();
|
||||
private NaturalDisasters main = NaturalDisasters.getInstance();
|
||||
|
||||
public static String scoreboardBar = org.bukkit.ChatColor.GRAY.toString() + org.bukkit.ChatColor.STRIKETHROUGH + "----------------------";
|
||||
public static String chatBar = org.bukkit.ChatColor.GRAY.toString() + org.bukkit.ChatColor.STRIKETHROUGH + "--------------------------------------------";
|
@ -1,4 +1,4 @@
|
||||
package com.loganmagnan.pluginbase.utils;
|
||||
package com.loganmagnan.naturaldisasters.utils;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
@ -1,4 +1,4 @@
|
||||
package com.loganmagnan.pluginbase.utils;
|
||||
package com.loganmagnan.naturaldisasters.utils;
|
||||
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.Block;
|
@ -0,0 +1,12 @@
|
||||
package com.loganmagnan.naturaldisasters.utils.command;
|
||||
|
||||
import com.loganmagnan.naturaldisasters.NaturalDisasters;
|
||||
|
||||
public abstract class BaseCommand {
|
||||
|
||||
public BaseCommand() {
|
||||
NaturalDisasters.getInstance().getCommandFramework().registerCommands(this, null);
|
||||
}
|
||||
|
||||
public abstract void executeAs(CommandArguments command);
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.loganmagnan.pluginbase.utils.command;
|
||||
package com.loganmagnan.naturaldisasters.utils.command;
|
||||
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.bukkit.command.Command;
|
@ -1,4 +1,4 @@
|
||||
package com.loganmagnan.pluginbase.utils.command;
|
||||
package com.loganmagnan.naturaldisasters.utils.command;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
@ -1,4 +1,4 @@
|
||||
package com.loganmagnan.pluginbase.utils.command;
|
||||
package com.loganmagnan.naturaldisasters.utils.command;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
@ -1,4 +1,4 @@
|
||||
package com.loganmagnan.pluginbase.utils.command;
|
||||
package com.loganmagnan.naturaldisasters.utils.command;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.bukkit.command.CommandSender;
|
@ -1,7 +1,7 @@
|
||||
package com.loganmagnan.pluginbase.utils.command;
|
||||
package com.loganmagnan.naturaldisasters.utils.command;
|
||||
|
||||
import com.loganmagnan.pluginbase.PluginBase;
|
||||
import com.loganmagnan.pluginbase.utils.ColorUtils;
|
||||
import com.loganmagnan.naturaldisasters.NaturalDisasters;
|
||||
import com.loganmagnan.naturaldisasters.utils.ColorUtils;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandMap;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -20,11 +20,11 @@ import java.util.Map.Entry;
|
||||
|
||||
public class CommandFramework implements CommandExecutor {
|
||||
|
||||
private PluginBase plugin;
|
||||
private NaturalDisasters plugin;
|
||||
private Map<String, Entry<Method, Object>> commandMap = new HashMap<>();
|
||||
private CommandMap map;
|
||||
|
||||
public CommandFramework(PluginBase plugin) {
|
||||
public CommandFramework(NaturalDisasters plugin) {
|
||||
this.plugin = plugin;
|
||||
|
||||
if (plugin.getServer().getPluginManager() instanceof SimplePluginManager) {
|
@ -1,4 +1,4 @@
|
||||
package com.loganmagnan.pluginbase.utils.command;
|
||||
package com.loganmagnan.naturaldisasters.utils.command;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
@ -1,4 +1,4 @@
|
||||
package com.loganmagnan.pluginbase.utils.config;
|
||||
package com.loganmagnan.naturaldisasters.utils.config;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
@ -1,7 +1,7 @@
|
||||
package com.loganmagnan.pluginbase.utils.config;
|
||||
package com.loganmagnan.naturaldisasters.utils.config;
|
||||
|
||||
import com.loganmagnan.pluginbase.PluginBase;
|
||||
import com.loganmagnan.pluginbase.utils.ConfigUpdater;
|
||||
import com.loganmagnan.naturaldisasters.NaturalDisasters;
|
||||
import com.loganmagnan.naturaldisasters.utils.ConfigUpdater;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
@ -41,7 +41,7 @@ public class FileConfig {
|
||||
|
||||
try {
|
||||
if (update) {
|
||||
ConfigUpdater.update(PluginBase.getInstance(), fileName, this.file);
|
||||
ConfigUpdater.update(NaturalDisasters.getInstance(), fileName, this.file);
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
exception.printStackTrace();
|
@ -1,7 +1,7 @@
|
||||
package com.loganmagnan.pluginbase.utils.config.file;
|
||||
package com.loganmagnan.naturaldisasters.utils.config.file;
|
||||
|
||||
import com.loganmagnan.pluginbase.PluginBase;
|
||||
import com.loganmagnan.pluginbase.utils.ConfigUpdater;
|
||||
import com.loganmagnan.naturaldisasters.NaturalDisasters;
|
||||
import com.loganmagnan.naturaldisasters.utils.ConfigUpdater;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
@ -31,7 +31,7 @@ public class Config {
|
||||
|
||||
try {
|
||||
if (update) {
|
||||
ConfigUpdater.update(PluginBase.getInstance(), name + ".yml", this.configFile);
|
||||
ConfigUpdater.update(NaturalDisasters.getInstance(), name + ".yml", this.configFile);
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
exception.printStackTrace();
|
@ -1,7 +1,7 @@
|
||||
package com.loganmagnan.pluginbase.utils.config.file;
|
||||
package com.loganmagnan.naturaldisasters.utils.config.file;
|
||||
|
||||
import com.loganmagnan.pluginbase.PluginBase;
|
||||
import com.loganmagnan.pluginbase.utils.ConfigUpdater;
|
||||
import com.loganmagnan.naturaldisasters.NaturalDisasters;
|
||||
import com.loganmagnan.naturaldisasters.utils.ConfigUpdater;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
@ -27,7 +27,7 @@ public class ConfigFile {
|
||||
plugin.saveResource(name + ".yml", false);
|
||||
|
||||
try {
|
||||
ConfigUpdater.update(PluginBase.getInstance(), name + ".yml", this.file);
|
||||
ConfigUpdater.update(NaturalDisasters.getInstance(), name + ".yml", this.file);
|
||||
} catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.loganmagnan.pluginbase.utils.cuboid;
|
||||
package com.loganmagnan.naturaldisasters.utils.cuboid;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import org.bukkit.*;
|
@ -1,4 +1,4 @@
|
||||
package com.loganmagnan.pluginbase.utils.cuboid;
|
||||
package com.loganmagnan.naturaldisasters.utils.cuboid;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
@ -1,4 +1,4 @@
|
||||
package com.loganmagnan.pluginbase.utils.cuboid;
|
||||
package com.loganmagnan.naturaldisasters.utils.cuboid;
|
||||
|
||||
public enum CuboidDirection {
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.loganmagnan.pluginbase.utils.cuboid;
|
||||
package com.loganmagnan.naturaldisasters.utils.cuboid;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
@ -1,27 +0,0 @@
|
||||
package com.loganmagnan.pluginbase.commands;
|
||||
|
||||
import com.loganmagnan.pluginbase.PluginBase;
|
||||
import com.loganmagnan.pluginbase.utils.ColorUtils;
|
||||
import com.loganmagnan.pluginbase.utils.CustomLocation;
|
||||
import com.loganmagnan.pluginbase.utils.command.BaseCommand;
|
||||
import com.loganmagnan.pluginbase.utils.command.Command;
|
||||
import com.loganmagnan.pluginbase.utils.command.CommandArguments;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class ExampleCommand extends BaseCommand {
|
||||
|
||||
private PluginBase main = PluginBase.getInstance();
|
||||
|
||||
@Command(name = "example", permission = "permission.example")
|
||||
@Override
|
||||
public void executeAs(CommandArguments command) {
|
||||
Player player = command.getPlayer();
|
||||
|
||||
String[] args = command.getArgs();
|
||||
|
||||
if (args.length == 0) {
|
||||
player.sendMessage(ColorUtils.getMessageType("&aThis is an example command."));
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
package com.loganmagnan.pluginbase.utils.command;
|
||||
|
||||
import com.loganmagnan.pluginbase.PluginBase;
|
||||
|
||||
public abstract class BaseCommand {
|
||||
|
||||
public BaseCommand() {
|
||||
PluginBase.getInstance().getCommandFramework().registerCommands(this, null);
|
||||
}
|
||||
|
||||
public abstract void executeAs(CommandArguments command);
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
name: PluginBase
|
||||
name: NaturalDisasters
|
||||
author: Trixkz
|
||||
version: 1.0
|
||||
api-version: 1.13
|
||||
main: com.loganmagnan.pluginbase.PluginBase
|
||||
main: com.loganmagnan.naturaldisasters.NaturalDisasters
|
Loading…
Reference in New Issue
Block a user