diff --git a/pom.xml b/pom.xml index a4ce163..ebbf779 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 com.loganmagnan - PluginBase + UnlimitedItems 1.0 diff --git a/src/main/java/aether/Aether.java b/src/main/java/aether/Aether.java deleted file mode 100644 index c432e94..0000000 --- a/src/main/java/aether/Aether.java +++ /dev/null @@ -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 scores = adapter.getScoreboard(player, board, board.getCooldowns()); - List 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 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(); - } -} diff --git a/src/main/java/aether/AetherOptions.java b/src/main/java/aether/AetherOptions.java deleted file mode 100644 index 526c513..0000000 --- a/src/main/java/aether/AetherOptions.java +++ /dev/null @@ -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); - } -} diff --git a/src/main/java/aether/event/BoardCreateEvent.java b/src/main/java/aether/event/BoardCreateEvent.java deleted file mode 100644 index 0cc018e..0000000 --- a/src/main/java/aether/event/BoardCreateEvent.java +++ /dev/null @@ -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; - } -} diff --git a/src/main/java/aether/scoreboard/Board.java b/src/main/java/aether/scoreboard/Board.java deleted file mode 100644 index 2bdc888..0000000 --- a/src/main/java/aether/scoreboard/Board.java +++ /dev/null @@ -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 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 keys; - @Getter private List entries; - - private Set 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 getBoardEntriesFormatted() { - List 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 getCooldowns() { - cooldowns.removeIf(cooldown -> System.currentTimeMillis() >= cooldown.getEnd()); - return cooldowns; - } -} diff --git a/src/main/java/aether/scoreboard/BoardAdapter.java b/src/main/java/aether/scoreboard/BoardAdapter.java deleted file mode 100644 index 2b1b1b8..0000000 --- a/src/main/java/aether/scoreboard/BoardAdapter.java +++ /dev/null @@ -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 getScoreboard(Player player, Board board, Set cooldowns); - - void onScoreboardCreate(Player player, Scoreboard board); -} diff --git a/src/main/java/aether/scoreboard/BoardEntry.java b/src/main/java/aether/scoreboard/BoardEntry.java deleted file mode 100644 index 903832e..0000000 --- a/src/main/java/aether/scoreboard/BoardEntry.java +++ /dev/null @@ -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); - } - -} diff --git a/src/main/java/aether/scoreboard/cooldown/BoardCooldown.java b/src/main/java/aether/scoreboard/cooldown/BoardCooldown.java deleted file mode 100644 index cfb9482..0000000 --- a/src/main/java/aether/scoreboard/cooldown/BoardCooldown.java +++ /dev/null @@ -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); - } - -} \ No newline at end of file diff --git a/src/main/java/aether/scoreboard/cooldown/BoardFormat.java b/src/main/java/aether/scoreboard/cooldown/BoardFormat.java deleted file mode 100644 index 24f34cf..0000000 --- a/src/main/java/aether/scoreboard/cooldown/BoardFormat.java +++ /dev/null @@ -1,5 +0,0 @@ -package aether.scoreboard.cooldown; - -public enum BoardFormat { - SECONDS, MINUTES, HOURS -} diff --git a/src/main/java/com/loganmagnan/pluginbase/commands/ExampleCommand.java b/src/main/java/com/loganmagnan/pluginbase/commands/ExampleCommand.java deleted file mode 100644 index 46f93d2..0000000 --- a/src/main/java/com/loganmagnan/pluginbase/commands/ExampleCommand.java +++ /dev/null @@ -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.")); - } - } -} \ No newline at end of file diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/command/BaseCommand.java b/src/main/java/com/loganmagnan/pluginbase/utils/command/BaseCommand.java deleted file mode 100644 index 7225050..0000000 --- a/src/main/java/com/loganmagnan/pluginbase/utils/command/BaseCommand.java +++ /dev/null @@ -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); -} diff --git a/src/main/java/com/loganmagnan/pluginbase/PluginBase.java b/src/main/java/com/loganmagnan/unlimiteditems/UnlimitedItems.java similarity index 66% rename from src/main/java/com/loganmagnan/pluginbase/PluginBase.java rename to src/main/java/com/loganmagnan/unlimiteditems/UnlimitedItems.java index 49075ff..eb92220 100644 --- a/src/main/java/com/loganmagnan/pluginbase/PluginBase.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/UnlimitedItems.java @@ -1,12 +1,13 @@ -package com.loganmagnan.pluginbase; +package com.loganmagnan.unlimiteditems; -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.unlimiteditems.managers.PlayerDataManager; +import com.loganmagnan.unlimiteditems.menusystem.PlayerMenuUtil; +import com.loganmagnan.unlimiteditems.utils.ClassRegistrationUtils; +import com.loganmagnan.unlimiteditems.utils.ColorUtils; +import com.loganmagnan.unlimiteditems.utils.Utils; +import com.loganmagnan.unlimiteditems.utils.command.CommandFramework; +import com.loganmagnan.unlimiteditems.utils.config.FileConfig; +import com.loganmagnan.unlimiteditems.utils.config.file.Config; import lombok.Getter; import lombok.Setter; import org.bukkit.entity.Player; @@ -15,16 +16,18 @@ import java.util.HashMap; @Getter @Setter -public class PluginBase extends JavaPlugin { +public class UnlimitedItems extends JavaPlugin { // Main class instance - @Getter private static PluginBase instance; + @Getter private static UnlimitedItems instance; // Configuration files private Config mainConfig; private FileConfig messagesConfig; + private FileConfig menusConfig; // Managers + private PlayerDataManager playerDataManager; // Menu system private HashMap playerMenuUtilMap = new HashMap<>(); @@ -42,10 +45,11 @@ public class PluginBase extends JavaPlugin { this.saveDefaultConfig(); this.mainConfig = new Config("config", this, true); this.messagesConfig = new FileConfig(this, "messages.yml", true); + this.menusConfig = new FileConfig(this, "menus.yml", true); // 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("&dUnlimitedItems &7- &av" + this.getDescription().getVersion())); this.getServer().getConsoleSender().sendMessage(ColorUtils.getMessageType("&7Made by &eLoganM Development")); this.getServer().getConsoleSender().sendMessage(Utils.chatBar); @@ -65,17 +69,17 @@ public class PluginBase extends JavaPlugin { // Load commands function private void loadCommands() { - ClassRegistrationUtils.loadCommands("com.loganmagnan.pluginbase.commands"); + ClassRegistrationUtils.loadCommands("com.loganmagnan.unlimiteditems.commands"); } // Load managers function private void loadManagers() { - + this.playerDataManager = new PlayerDataManager(); } // Load listeners function private void loadListeners() { - ClassRegistrationUtils.loadListeners("com.loganmagnan.pluginbase.listeners"); + ClassRegistrationUtils.loadListeners("com.loganmagnan.unlimiteditems.listeners"); } // Load runnables function diff --git a/src/main/java/com/loganmagnan/pluginbase/chatcolor/ColorSet.java b/src/main/java/com/loganmagnan/unlimiteditems/chatcolor/ColorSet.java similarity index 85% rename from src/main/java/com/loganmagnan/pluginbase/chatcolor/ColorSet.java rename to src/main/java/com/loganmagnan/unlimiteditems/chatcolor/ColorSet.java index 8c8da2d..b84339c 100644 --- a/src/main/java/com/loganmagnan/pluginbase/chatcolor/ColorSet.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/chatcolor/ColorSet.java @@ -1,4 +1,4 @@ -package com.loganmagnan.pluginbase.chatcolor; +package com.loganmagnan.unlimiteditems.chatcolor; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/src/main/java/com/loganmagnan/pluginbase/chatcolor/GradientColor.java b/src/main/java/com/loganmagnan/unlimiteditems/chatcolor/GradientColor.java similarity index 87% rename from src/main/java/com/loganmagnan/pluginbase/chatcolor/GradientColor.java rename to src/main/java/com/loganmagnan/unlimiteditems/chatcolor/GradientColor.java index 1d6133f..a7e95ef 100644 --- a/src/main/java/com/loganmagnan/pluginbase/chatcolor/GradientColor.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/chatcolor/GradientColor.java @@ -1,4 +1,4 @@ -package com.loganmagnan.pluginbase.chatcolor; +package com.loganmagnan.unlimiteditems.chatcolor; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/src/main/java/com/loganmagnan/unlimiteditems/commands/SettingsCommand.java b/src/main/java/com/loganmagnan/unlimiteditems/commands/SettingsCommand.java new file mode 100644 index 0000000..3af0e67 --- /dev/null +++ b/src/main/java/com/loganmagnan/unlimiteditems/commands/SettingsCommand.java @@ -0,0 +1,25 @@ +package com.loganmagnan.unlimiteditems.commands; + +import com.loganmagnan.unlimiteditems.UnlimitedItems; +import com.loganmagnan.unlimiteditems.menusystem.menu.SettingsSelectorMenu; +import com.loganmagnan.unlimiteditems.utils.command.BaseCommand; +import com.loganmagnan.unlimiteditems.utils.command.Command; +import com.loganmagnan.unlimiteditems.utils.command.CommandArguments; +import org.bukkit.entity.Player; + +public class SettingsCommand extends BaseCommand { + + private UnlimitedItems main = UnlimitedItems.getInstance(); + + @Command(name = "settings", permission = "unlimiteditems.command.settings", aliases = {"settingsmenu"}) + @Override + public void executeAs(CommandArguments command) { + Player player = command.getPlayer(); + + String[] args = command.getArgs(); + + if (args.length == 0) { + new SettingsSelectorMenu(this.main.getPlayerMenuUtil(player)).open(player); + } + } +} diff --git a/src/main/java/com/loganmagnan/unlimiteditems/listeners/EntityPickupItemListener.java b/src/main/java/com/loganmagnan/unlimiteditems/listeners/EntityPickupItemListener.java new file mode 100644 index 0000000..857f94e --- /dev/null +++ b/src/main/java/com/loganmagnan/unlimiteditems/listeners/EntityPickupItemListener.java @@ -0,0 +1,89 @@ +package com.loganmagnan.unlimiteditems.listeners; + +import com.loganmagnan.unlimiteditems.UnlimitedItems; +import com.loganmagnan.unlimiteditems.playerdata.PlayerData; +import com.loganmagnan.unlimiteditems.playerdata.PlayerSettings; +import org.bukkit.Material; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityPickupItemEvent; +import org.bukkit.inventory.ItemStack; + +public class EntityPickupItemListener implements Listener { + + private UnlimitedItems main = UnlimitedItems.getInstance(); + + @EventHandler + public void onEntityPickupItem(EntityPickupItemEvent event) { + Entity entity = event.getEntity(); + + if (!(entity instanceof Player)) { + return; + } + + Player player = (Player) entity; + + PlayerData playerData = this.main.getPlayerDataManager().getPlayerData(player.getUniqueId()); + + PlayerSettings playerSettings = playerData.getPlayerSettings(); + + if (!playerSettings.isUnlimitedItems()) { + return; + } + + ItemStack itemStackOne = event.getItem().getItemStack(); + + event.setCancelled(true); + event.getItem().remove(); + + if (player.getInventory().contains(itemStackOne.getType())) { + int amount = this.getMaterialAmount(player, itemStackOne.getType()); + + ItemStack itemStackTwo = new ItemStack(itemStackOne.getType(), itemStackOne.getAmount() + amount); + + this.removeMaterial(player, itemStackOne.getType(), amount); + + player.getInventory().addItem(itemStackTwo); + } else { + player.getInventory().addItem(itemStackOne); + } + } + + public int getMaterialAmount(Player player, Material material) { + int amount = 0; + + for (ItemStack item : player.getInventory().getContents()) { + if (item != null && item.getType() == material) { + amount += item.getAmount(); + } + } + + return amount; + } + + public void removeMaterial(Player player, Material material, int amount) { + ItemStack[] contents = player.getInventory().getContents(); + + for (int i = 0; i < contents.length; i++) { + ItemStack item = contents[i]; + + if (item != null && item.getType() == material && amount > 0) { + int itemAmount = item.getAmount(); + + if (itemAmount <= amount) { + amount -= itemAmount; + player.getInventory().setItem(i, null); + + } else { + item.setAmount(itemAmount - amount); + + amount = 0; + } + } + } + + player.updateInventory(); + } +} \ No newline at end of file diff --git a/src/main/java/com/loganmagnan/pluginbase/listeners/MenuListener.java b/src/main/java/com/loganmagnan/unlimiteditems/listeners/MenuListener.java similarity index 74% rename from src/main/java/com/loganmagnan/pluginbase/listeners/MenuListener.java rename to src/main/java/com/loganmagnan/unlimiteditems/listeners/MenuListener.java index 02b1232..e9dcfce 100644 --- a/src/main/java/com/loganmagnan/pluginbase/listeners/MenuListener.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/listeners/MenuListener.java @@ -1,7 +1,7 @@ -package com.loganmagnan.pluginbase.listeners; +package com.loganmagnan.unlimiteditems.listeners; -import com.loganmagnan.pluginbase.PluginBase; -import com.loganmagnan.pluginbase.menusystem.Menu; +import com.loganmagnan.unlimiteditems.UnlimitedItems; +import com.loganmagnan.unlimiteditems.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 UnlimitedItems main = UnlimitedItems.getInstance(); @EventHandler public void onMenuClick(InventoryClickEvent event) { diff --git a/src/main/java/com/loganmagnan/unlimiteditems/listeners/PlayerDataListener.java b/src/main/java/com/loganmagnan/unlimiteditems/listeners/PlayerDataListener.java new file mode 100644 index 0000000..2544276 --- /dev/null +++ b/src/main/java/com/loganmagnan/unlimiteditems/listeners/PlayerDataListener.java @@ -0,0 +1,82 @@ +package com.loganmagnan.unlimiteditems.listeners; + +import com.loganmagnan.unlimiteditems.UnlimitedItems; +import com.loganmagnan.unlimiteditems.playerdata.PlayerData; +import org.bukkit.Bukkit; +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.*; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; + +public class PlayerDataListener implements Listener { + + private UnlimitedItems main = UnlimitedItems.getInstance(); + + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) + public void onAsyncPlayerPreLogin(AsyncPlayerPreLoginEvent event) { + Player player = Bukkit.getPlayer(event.getUniqueId()); + + if (player != null) { + if (player.isOnline()) { + event.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER); + event.setKickMessage("§cYou tried to login too quickly after disconnecting.\n§cTry again in a few seconds."); + + this.main.getServer().getScheduler().runTask(this.main, () -> player.kickPlayer("§cDuplicate Login")); + + return; + } + + PlayerData playerData = this.main.getPlayerDataManager().getPlayerData(player.getUniqueId()); + } + } + + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + public void onPlayerLogin(PlayerLoginEvent event) { + PlayerData playerData = this.main.getPlayerDataManager().getOrCreate(event.getPlayer().getUniqueId()); + + if (playerData == null) { + event.setResult(PlayerLoginEvent.Result.KICK_OTHER); + event.setKickMessage("§cAn error has occurred while loading your profile. Please reconnect."); + + return; + } + + if (!playerData.isLoaded()) { + event.setResult(PlayerLoginEvent.Result.KICK_OTHER); + event.setKickMessage("§cAn error has occurred while loading your profile. Please reconnect."); + } + } + + @EventHandler + public void onPlayerQuit(PlayerQuitEvent event) { + Player player = event.getPlayer(); + + PlayerData playerData = this.main.getPlayerDataManager().getPlayerData(player.getUniqueId()); + + this.handleLeave(player); + this.handleDataSave(playerData); + } + + @EventHandler + public void onPlayerKick(PlayerKickEvent event) { + Player player = event.getPlayer(); + + PlayerData playerData = this.main.getPlayerDataManager().getPlayerData(player.getUniqueId()); + + this.handleLeave(player); + this.handleDataSave(playerData); + } + + private void handleLeave(Player player) { + + } + + private void handleDataSave(PlayerData playerData) { + if (playerData != null) { + this.main.getPlayerDataManager().deletePlayer(playerData.getUniqueId()); + } + } +} diff --git a/src/main/java/com/loganmagnan/unlimiteditems/managers/PlayerDataManager.java b/src/main/java/com/loganmagnan/unlimiteditems/managers/PlayerDataManager.java new file mode 100644 index 0000000..41725b1 --- /dev/null +++ b/src/main/java/com/loganmagnan/unlimiteditems/managers/PlayerDataManager.java @@ -0,0 +1,46 @@ +package com.loganmagnan.unlimiteditems.managers; + +import com.loganmagnan.unlimiteditems.UnlimitedItems; +import com.loganmagnan.unlimiteditems.playerdata.PlayerData; +import lombok.Getter; +import org.bukkit.entity.Player; +import org.bukkit.scheduler.BukkitRunnable; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +public class PlayerDataManager { + + private UnlimitedItems main = UnlimitedItems.getInstance(); + + @Getter private final Map players = new HashMap<>(); + + public PlayerData getOrCreate(UUID uniqueId) { + return this.players.computeIfAbsent(uniqueId, PlayerData::new); + } + + public PlayerData getPlayerData(UUID uniqueId) { + return this.players.getOrDefault(uniqueId, new PlayerData(uniqueId)); + } + + public Collection getAllPlayers() { + return this.players.values(); + } + + public void loadPlayerData(PlayerData playerData) { + playerData.setLoaded(true); + } + + public void savePlayerData(PlayerData playerData) { + + } + + public void deletePlayer(UUID uniqueId) { + this.main.getServer().getScheduler().runTaskAsynchronously(this.main, () -> { + this.savePlayerData(this.players.get(uniqueId)); + this.players.remove(uniqueId); + }); + } +} diff --git a/src/main/java/com/loganmagnan/pluginbase/menusystem/ItemStackButton.java b/src/main/java/com/loganmagnan/unlimiteditems/menusystem/ItemStackButton.java similarity index 60% rename from src/main/java/com/loganmagnan/pluginbase/menusystem/ItemStackButton.java rename to src/main/java/com/loganmagnan/unlimiteditems/menusystem/ItemStackButton.java index f92313f..6ccd55a 100644 --- a/src/main/java/com/loganmagnan/pluginbase/menusystem/ItemStackButton.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/menusystem/ItemStackButton.java @@ -1,7 +1,7 @@ -package com.loganmagnan.pluginbase.menusystem; +package com.loganmagnan.unlimiteditems.menusystem; -import com.loganmagnan.pluginbase.utils.ColorUtils; -import com.loganmagnan.pluginbase.utils.ItemBuilder; +import com.loganmagnan.unlimiteditems.utils.ColorUtils; +import com.loganmagnan.unlimiteditems.utils.ItemBuilder; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.RequiredArgsConstructor; @@ -10,6 +10,7 @@ import org.bukkit.Material; import org.bukkit.inventory.ItemStack; import java.util.Arrays; +import java.util.List; @Getter @Setter @@ -18,12 +19,12 @@ import java.util.Arrays; public class ItemStackButton { private String name; - private String[] lore; + private List lore; private Material material; private int data; private int amount; public ItemStack makeItemStack() { - return new ItemBuilder(this.material).name(ColorUtils.getMessageType(this.name)).lore(ColorUtils.getMessageType(Arrays.asList(this.lore))).durability(this.data).amount(this.amount).build(); + return new ItemBuilder(this.material).name(ColorUtils.getMessageType(this.name)).lore(ColorUtils.getMessageType(this.lore)).durability(this.data).amount(this.amount).build(); } } diff --git a/src/main/java/com/loganmagnan/pluginbase/menusystem/Menu.java b/src/main/java/com/loganmagnan/unlimiteditems/menusystem/Menu.java similarity index 94% rename from src/main/java/com/loganmagnan/pluginbase/menusystem/Menu.java rename to src/main/java/com/loganmagnan/unlimiteditems/menusystem/Menu.java index 952cdba..e4cd6ad 100644 --- a/src/main/java/com/loganmagnan/pluginbase/menusystem/Menu.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/menusystem/Menu.java @@ -1,6 +1,6 @@ -package com.loganmagnan.pluginbase.menusystem; +package com.loganmagnan.unlimiteditems.menusystem; -import com.loganmagnan.pluginbase.utils.ItemBuilder; +import com.loganmagnan.unlimiteditems.utils.ItemBuilder; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.Player; diff --git a/src/main/java/com/loganmagnan/pluginbase/menusystem/PaginatedMenu.java b/src/main/java/com/loganmagnan/unlimiteditems/menusystem/PaginatedMenu.java similarity index 93% rename from src/main/java/com/loganmagnan/pluginbase/menusystem/PaginatedMenu.java rename to src/main/java/com/loganmagnan/unlimiteditems/menusystem/PaginatedMenu.java index 9bcc2dc..9c93f08 100644 --- a/src/main/java/com/loganmagnan/pluginbase/menusystem/PaginatedMenu.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/menusystem/PaginatedMenu.java @@ -1,6 +1,6 @@ -package com.loganmagnan.pluginbase.menusystem; +package com.loganmagnan.unlimiteditems.menusystem; -import com.loganmagnan.pluginbase.utils.ColorUtils; +import com.loganmagnan.unlimiteditems.utils.ColorUtils; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; diff --git a/src/main/java/com/loganmagnan/pluginbase/menusystem/PlayerMenuUtil.java b/src/main/java/com/loganmagnan/unlimiteditems/menusystem/PlayerMenuUtil.java similarity index 85% rename from src/main/java/com/loganmagnan/pluginbase/menusystem/PlayerMenuUtil.java rename to src/main/java/com/loganmagnan/unlimiteditems/menusystem/PlayerMenuUtil.java index 9137a38..dd91abb 100644 --- a/src/main/java/com/loganmagnan/pluginbase/menusystem/PlayerMenuUtil.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/menusystem/PlayerMenuUtil.java @@ -1,4 +1,4 @@ -package com.loganmagnan.pluginbase.menusystem; +package com.loganmagnan.unlimiteditems.menusystem; import org.bukkit.entity.Player; diff --git a/src/main/java/com/loganmagnan/unlimiteditems/menusystem/menu/SettingsSelectorMenu.java b/src/main/java/com/loganmagnan/unlimiteditems/menusystem/menu/SettingsSelectorMenu.java new file mode 100644 index 0000000..526602f --- /dev/null +++ b/src/main/java/com/loganmagnan/unlimiteditems/menusystem/menu/SettingsSelectorMenu.java @@ -0,0 +1,79 @@ +package com.loganmagnan.unlimiteditems.menusystem.menu; + +import com.loganmagnan.unlimiteditems.UnlimitedItems; +import com.loganmagnan.unlimiteditems.menusystem.ItemStackButton; +import com.loganmagnan.unlimiteditems.menusystem.Menu; +import com.loganmagnan.unlimiteditems.menusystem.PlayerMenuUtil; +import com.loganmagnan.unlimiteditems.playerdata.PlayerData; +import com.loganmagnan.unlimiteditems.playerdata.PlayerSettings; +import com.loganmagnan.unlimiteditems.utils.ColorUtils; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.inventory.ItemStack; + +import java.util.ArrayList; +import java.util.List; + +public class SettingsSelectorMenu extends Menu { + + private UnlimitedItems main = UnlimitedItems.getInstance(); + + public SettingsSelectorMenu(PlayerMenuUtil playerMenuUtil) { + super(playerMenuUtil); + } + + @Override + public String getMenuName() { + return ColorUtils.getMessageType(this.main.getMenusConfig().getConfig().getString("MENUS.SETTINGS.TITLE")); + } + + @Override + public int getSlots() { + return this.main.getMenusConfig().getConfig().getInt("MENUS.SETTINGS.SIZE"); + } + + @Override + public void handleMenu(InventoryClickEvent event) { + Player player = (Player) event.getWhoClicked(); + + PlayerData playerData = this.main.getPlayerDataManager().getPlayerData(player.getUniqueId()); + + PlayerSettings playerSettings = playerData.getPlayerSettings(); + + if (event.getView().getTitle().equalsIgnoreCase(ColorUtils.getMessageType(this.main.getMenusConfig().getConfig().getString("MENUS.SETTINGS.TITLE")))) { + switch (event.getCurrentItem().getType()) { + case NETHER_STAR: + playerSettings.setUnlimitedItems(!playerSettings.isUnlimitedItems()); + + break; + } + + new SettingsSelectorMenu(this.playerMenuUtil).open(player); + } + } + + @Override + public void setMenuItems(Player player) { + PlayerData playerData = this.main.getPlayerDataManager().getPlayerData(player.getUniqueId()); + + PlayerSettings playerSettings = playerData.getPlayerSettings(); + + this.setFillerGlass(); + + List unlimitedItemsLore = new ArrayList(this.main.getMenusConfig().getConfig().getStringList("MENUS.SETTINGS.SETTINGS.UNLIMITED-ITEMS.LORE")); + unlimitedItemsLore.add((playerSettings.isUnlimitedItems() ? this.main.getMenusConfig().getConfig().getString("MENUS.SETTINGS.ENABLED") : this.main.getMenusConfig().getConfig().getString("MENUS.SETTINGS.UNSELECTED")) + " Unlimited items enabled"); + unlimitedItemsLore.add((!playerSettings.isUnlimitedItems() ? this.main.getMenusConfig().getConfig().getString("MENUS.SETTINGS.DISABLED") : this.main.getMenusConfig().getConfig().getString("MENUS.SETTINGS.UNSELECTED")) + " Unlimited items disabled"); + + ItemStackButton unlimitedItemsItemStackButton = new ItemStackButton( + this.main.getMenusConfig().getConfig().getString("MENUS.SETTINGS.SETTINGS.UNLIMITED-ITEMS.NAME"), + unlimitedItemsLore, + Material.getMaterial(this.main.getMenusConfig().getConfig().getString("MENUS.SETTINGS.SETTINGS.UNLIMITED-ITEMS.MATERIAL")), + 0, + 1); + + ItemStack unlimitedItemsItemStack = unlimitedItemsItemStackButton.makeItemStack(); + + this.inventory.setItem(this.main.getMenusConfig().getConfig().getInt("MENUS.SETTINGS.SETTINGS.UNLIMITED-ITEMS.SLOT"), unlimitedItemsItemStack); + } +} diff --git a/src/main/java/com/loganmagnan/unlimiteditems/playerdata/PlayerData.java b/src/main/java/com/loganmagnan/unlimiteditems/playerdata/PlayerData.java new file mode 100644 index 0000000..f58776c --- /dev/null +++ b/src/main/java/com/loganmagnan/unlimiteditems/playerdata/PlayerData.java @@ -0,0 +1,41 @@ +package com.loganmagnan.unlimiteditems.playerdata; + +import com.loganmagnan.unlimiteditems.UnlimitedItems; +import com.loganmagnan.unlimiteditems.managers.PlayerDataManager; +import com.loganmagnan.unlimiteditems.playerdata.currentgame.PlayerCurrentGameData; +import lombok.Getter; +import lombok.Setter; +import org.bukkit.Effect; +import org.bukkit.block.Block; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +@Getter +@Setter +public class PlayerData { + + private PlayerDataManager playerDataManager = UnlimitedItems.getInstance().getPlayerDataManager(); + private PlayerState playerState = PlayerState.SPAWN; + + private PlayerSettings playerSettings = new PlayerSettings(); + private PlayerCurrentGameData currentGameData = new PlayerCurrentGameData(); + + private final UUID uniqueId; + private boolean loaded; + + private List blocks = new ArrayList(); + + private Effect effect; + + public PlayerData(UUID uniqueId) { + this.uniqueId = uniqueId; + this.loaded = false; + this.playerDataManager.loadPlayerData(this); + } + + public boolean isInSpawn() { + return this.playerState == PlayerState.SPAWN; + } +} diff --git a/src/main/java/com/loganmagnan/unlimiteditems/playerdata/PlayerSettings.java b/src/main/java/com/loganmagnan/unlimiteditems/playerdata/PlayerSettings.java new file mode 100644 index 0000000..1e117cf --- /dev/null +++ b/src/main/java/com/loganmagnan/unlimiteditems/playerdata/PlayerSettings.java @@ -0,0 +1,11 @@ +package com.loganmagnan.unlimiteditems.playerdata; + +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class PlayerSettings { + + private boolean unlimitedItems = false; +} diff --git a/src/main/java/com/loganmagnan/unlimiteditems/playerdata/PlayerState.java b/src/main/java/com/loganmagnan/unlimiteditems/playerdata/PlayerState.java new file mode 100644 index 0000000..85144b6 --- /dev/null +++ b/src/main/java/com/loganmagnan/unlimiteditems/playerdata/PlayerState.java @@ -0,0 +1,6 @@ +package com.loganmagnan.unlimiteditems.playerdata; + +public enum PlayerState { + + SPAWN; +} diff --git a/src/main/java/com/loganmagnan/unlimiteditems/playerdata/currentgame/PlayerCurrentGameData.java b/src/main/java/com/loganmagnan/unlimiteditems/playerdata/currentgame/PlayerCurrentGameData.java new file mode 100644 index 0000000..68bba0f --- /dev/null +++ b/src/main/java/com/loganmagnan/unlimiteditems/playerdata/currentgame/PlayerCurrentGameData.java @@ -0,0 +1,10 @@ +package com.loganmagnan.unlimiteditems.playerdata.currentgame; + +import com.loganmagnan.unlimiteditems.UnlimitedItems; +import lombok.Data; + +@Data +public class PlayerCurrentGameData { + + private UnlimitedItems main = UnlimitedItems.getInstance(); +} diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/AsyncScheduler.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/AsyncScheduler.java similarity index 95% rename from src/main/java/com/loganmagnan/pluginbase/utils/AsyncScheduler.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/AsyncScheduler.java index 70aed45..0069c65 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/AsyncScheduler.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/AsyncScheduler.java @@ -1,4 +1,4 @@ -package com.loganmagnan.pluginbase.utils; +package com.loganmagnan.unlimiteditems.utils; import com.google.common.util.concurrent.ThreadFactoryBuilder; import lombok.experimental.UtilityClass; diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/BlockUtils.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/BlockUtils.java similarity index 96% rename from src/main/java/com/loganmagnan/pluginbase/utils/BlockUtils.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/BlockUtils.java index 1cfafbf..abf222c 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/BlockUtils.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/BlockUtils.java @@ -1,4 +1,4 @@ -package com.loganmagnan.pluginbase.utils; +package com.loganmagnan.unlimiteditems.utils; import org.bukkit.Material; import org.bukkit.block.Block; diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/Cache.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/Cache.java similarity index 94% rename from src/main/java/com/loganmagnan/pluginbase/utils/Cache.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/Cache.java index 97d5fb7..4663057 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/Cache.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/Cache.java @@ -1,4 +1,4 @@ -package com.loganmagnan.pluginbase.utils; +package com.loganmagnan.unlimiteditems.utils; public class Cache { diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/CachedInventory.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/CachedInventory.java similarity index 99% rename from src/main/java/com/loganmagnan/pluginbase/utils/CachedInventory.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/CachedInventory.java index b9b8be4..dafc087 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/CachedInventory.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/CachedInventory.java @@ -1,4 +1,4 @@ -package com.loganmagnan.pluginbase.utils; +package com.loganmagnan.unlimiteditems.utils; import com.google.gson.JsonArray; import com.google.gson.JsonObject; diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/ClassRegistrationUtils.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/ClassRegistrationUtils.java similarity index 88% rename from src/main/java/com/loganmagnan/pluginbase/utils/ClassRegistrationUtils.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/ClassRegistrationUtils.java index ed0ebf9..4be87df 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/ClassRegistrationUtils.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/ClassRegistrationUtils.java @@ -1,7 +1,7 @@ -package com.loganmagnan.pluginbase.utils; +package com.loganmagnan.unlimiteditems.utils; import com.google.common.collect.ImmutableSet; -import com.loganmagnan.pluginbase.PluginBase; +import com.loganmagnan.unlimiteditems.UnlimitedItems; 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()); + UnlimitedItems.getInstance().getServer().getPluginManager().registerEvents((Listener) clazz.newInstance(), UnlimitedItems.getInstance()); } catch (Exception exception) { exception.printStackTrace(); } @@ -50,7 +50,7 @@ public class ClassRegistrationUtils { public static Collection> getClassesInPackage(String packageName) { JarFile jarFile; Collection> classes = new ArrayList<>(); - CodeSource codeSource = PluginBase.getInstance().getClass().getProtectionDomain().getCodeSource(); + CodeSource codeSource = UnlimitedItems.getInstance().getClass().getProtectionDomain().getCodeSource(); URL resource = codeSource.getLocation(); String relPath = packageName.replace('.', '/'); diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/Clickable.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/Clickable.java similarity index 97% rename from src/main/java/com/loganmagnan/pluginbase/utils/Clickable.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/Clickable.java index f2cc33c..6bf4e1a 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/Clickable.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/Clickable.java @@ -1,4 +1,4 @@ -package com.loganmagnan.pluginbase.utils; +package com.loganmagnan.unlimiteditems.utils; import lombok.NoArgsConstructor; import net.md_5.bungee.api.chat.ClickEvent; diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/ColorUtils.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/ColorUtils.java similarity index 98% rename from src/main/java/com/loganmagnan/pluginbase/utils/ColorUtils.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/ColorUtils.java index aa1b190..5992485 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/ColorUtils.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/ColorUtils.java @@ -1,6 +1,6 @@ -package com.loganmagnan.pluginbase.utils; +package com.loganmagnan.unlimiteditems.utils; -import com.loganmagnan.pluginbase.chatcolor.ColorSet; +import com.loganmagnan.unlimiteditems.chatcolor.ColorSet; import lombok.Getter; import lombok.Setter; import net.md_5.bungee.api.ChatColor; diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/ConfigUpdater.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/ConfigUpdater.java similarity index 99% rename from src/main/java/com/loganmagnan/pluginbase/utils/ConfigUpdater.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/ConfigUpdater.java index 3cad316..f4113ae 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/ConfigUpdater.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/ConfigUpdater.java @@ -1,4 +1,4 @@ -package com.loganmagnan.pluginbase.utils; +package com.loganmagnan.unlimiteditems.utils; import com.google.common.base.Preconditions; import org.bukkit.configuration.ConfigurationSection; diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/Cuboid.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/Cuboid.java similarity index 96% rename from src/main/java/com/loganmagnan/pluginbase/utils/Cuboid.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/Cuboid.java index d4e08c1..161fa1a 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/Cuboid.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/Cuboid.java @@ -1,4 +1,4 @@ -package com.loganmagnan.pluginbase.utils; +package com.loganmagnan.unlimiteditems.utils; import org.bukkit.Location; diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/CustomLocation.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/CustomLocation.java similarity index 98% rename from src/main/java/com/loganmagnan/pluginbase/utils/CustomLocation.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/CustomLocation.java index dc68ca2..f2f0194 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/CustomLocation.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/CustomLocation.java @@ -1,4 +1,4 @@ -package com.loganmagnan.pluginbase.utils; +package com.loganmagnan.unlimiteditems.utils; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/ItemBuilder.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/ItemBuilder.java similarity index 98% rename from src/main/java/com/loganmagnan/pluginbase/utils/ItemBuilder.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/ItemBuilder.java index 25113c9..8ea90ba 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/ItemBuilder.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/ItemBuilder.java @@ -1,4 +1,4 @@ -package com.loganmagnan.pluginbase.utils; +package com.loganmagnan.unlimiteditems.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; diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/ItemUtil.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/ItemUtil.java similarity index 98% rename from src/main/java/com/loganmagnan/pluginbase/utils/ItemUtil.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/ItemUtil.java index cee868b..45a818d 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/ItemUtil.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/ItemUtil.java @@ -1,4 +1,4 @@ -package com.loganmagnan.pluginbase.utils; +package com.loganmagnan.unlimiteditems.utils; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/KeyBuilder.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/KeyBuilder.java similarity index 98% rename from src/main/java/com/loganmagnan/pluginbase/utils/KeyBuilder.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/KeyBuilder.java index f8482a8..571f884 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/KeyBuilder.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/KeyBuilder.java @@ -1,4 +1,4 @@ -package com.loganmagnan.pluginbase.utils; +package com.loganmagnan.unlimiteditems.utils; import org.bukkit.configuration.file.FileConfiguration; diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/KeyUtils.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/KeyUtils.java similarity index 93% rename from src/main/java/com/loganmagnan/pluginbase/utils/KeyUtils.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/KeyUtils.java index 17f617e..ee29bb7 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/KeyUtils.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/KeyUtils.java @@ -1,4 +1,4 @@ -package com.loganmagnan.pluginbase.utils; +package com.loganmagnan.unlimiteditems.utils; public class KeyUtils { diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/LocationUtils.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/LocationUtils.java similarity index 94% rename from src/main/java/com/loganmagnan/pluginbase/utils/LocationUtils.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/LocationUtils.java index 4121ed0..778cc33 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/LocationUtils.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/LocationUtils.java @@ -1,4 +1,4 @@ -package com.loganmagnan.pluginbase.utils; +package com.loganmagnan.unlimiteditems.utils; import org.bukkit.Location; import org.bukkit.block.Block; diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/MathUtil.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/MathUtil.java similarity index 96% rename from src/main/java/com/loganmagnan/pluginbase/utils/MathUtil.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/MathUtil.java index c1c4836..da03caf 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/MathUtil.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/MathUtil.java @@ -1,4 +1,4 @@ - package com.loganmagnan.pluginbase.utils; + package com.loganmagnan.unlimiteditems.utils; import java.util.Random; diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/NBTEditor.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/NBTEditor.java similarity index 99% rename from src/main/java/com/loganmagnan/pluginbase/utils/NBTEditor.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/NBTEditor.java index b05f7af..ebe2dbd 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/NBTEditor.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/NBTEditor.java @@ -1,4 +1,4 @@ -package com.loganmagnan.pluginbase.utils; +package com.loganmagnan.unlimiteditems.utils; import org.bukkit.Bukkit; import org.bukkit.Location; diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/Pair.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/Pair.java similarity index 84% rename from src/main/java/com/loganmagnan/pluginbase/utils/Pair.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/Pair.java index 87a3a3a..e96902e 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/Pair.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/Pair.java @@ -1,4 +1,4 @@ -package com.loganmagnan.pluginbase.utils; +package com.loganmagnan.unlimiteditems.utils; import lombok.Getter; import lombok.Setter; diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/ParameterType.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/ParameterType.java similarity index 86% rename from src/main/java/com/loganmagnan/pluginbase/utils/ParameterType.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/ParameterType.java index 0f580df..1fc6533 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/ParameterType.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/ParameterType.java @@ -1,4 +1,4 @@ -package com.loganmagnan.pluginbase.utils; +package com.loganmagnan.unlimiteditems.utils; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/PlayerHeadUtils.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/PlayerHeadUtils.java similarity index 96% rename from src/main/java/com/loganmagnan/pluginbase/utils/PlayerHeadUtils.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/PlayerHeadUtils.java index ef8da7b..cc7260f 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/PlayerHeadUtils.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/PlayerHeadUtils.java @@ -1,4 +1,4 @@ -package com.loganmagnan.pluginbase.utils; +package com.loganmagnan.unlimiteditems.utils; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/PlayerUtil.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/PlayerUtil.java similarity index 96% rename from src/main/java/com/loganmagnan/pluginbase/utils/PlayerUtil.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/PlayerUtil.java index 708fb17..f1ea618 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/PlayerUtil.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/PlayerUtil.java @@ -1,4 +1,4 @@ -package com.loganmagnan.pluginbase.utils; +package com.loganmagnan.unlimiteditems.utils; import org.bukkit.GameMode; import org.bukkit.entity.Player; diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/SpigotUtils.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/SpigotUtils.java similarity index 97% rename from src/main/java/com/loganmagnan/pluginbase/utils/SpigotUtils.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/SpigotUtils.java index cec8408..89d9d4f 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/SpigotUtils.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/SpigotUtils.java @@ -1,4 +1,4 @@ -package com.loganmagnan.pluginbase.utils; +package com.loganmagnan.unlimiteditems.utils; import org.bukkit.ChatColor; import org.bukkit.entity.Player; diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/StringUtils.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/StringUtils.java similarity index 99% rename from src/main/java/com/loganmagnan/pluginbase/utils/StringUtils.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/StringUtils.java index dadae28..eb2a930 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/StringUtils.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/StringUtils.java @@ -1,4 +1,4 @@ -package com.loganmagnan.pluginbase.utils; +package com.loganmagnan.unlimiteditems.utils; import org.bukkit.Bukkit; import org.bukkit.ChatColor; diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/TeamAction.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/TeamAction.java similarity index 58% rename from src/main/java/com/loganmagnan/pluginbase/utils/TeamAction.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/TeamAction.java index 3b5c536..33fd86f 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/TeamAction.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/TeamAction.java @@ -1,4 +1,4 @@ -package com.loganmagnan.pluginbase.utils; +package com.loganmagnan.unlimiteditems.utils; public enum TeamAction { diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/TimeUtil.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/TimeUtil.java similarity index 99% rename from src/main/java/com/loganmagnan/pluginbase/utils/TimeUtil.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/TimeUtil.java index 1e182b2..2ff7d73 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/TimeUtil.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/TimeUtil.java @@ -1,4 +1,4 @@ -package com.loganmagnan.pluginbase.utils; +package com.loganmagnan.unlimiteditems.utils; import java.sql.Timestamp; import java.text.DecimalFormat; diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/TimeUtils.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/TimeUtils.java similarity index 98% rename from src/main/java/com/loganmagnan/pluginbase/utils/TimeUtils.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/TimeUtils.java index 38613c2..4425e1b 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/TimeUtils.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/TimeUtils.java @@ -1,4 +1,4 @@ -package com.loganmagnan.pluginbase.utils; +package com.loganmagnan.unlimiteditems.utils; import java.text.SimpleDateFormat; import java.util.Date; diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/TimerRunnable.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/TimerRunnable.java similarity index 94% rename from src/main/java/com/loganmagnan/pluginbase/utils/TimerRunnable.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/TimerRunnable.java index e6c8c4e..f882f85 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/TimerRunnable.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/TimerRunnable.java @@ -1,4 +1,4 @@ -package com.loganmagnan.pluginbase.utils; +package com.loganmagnan.unlimiteditems.utils; import java.util.concurrent.ScheduledFuture; diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/TtlHandler.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/TtlHandler.java similarity index 68% rename from src/main/java/com/loganmagnan/pluginbase/utils/TtlHandler.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/TtlHandler.java index 1f1f3e8..0b7934f 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/TtlHandler.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/TtlHandler.java @@ -1,4 +1,4 @@ -package com.loganmagnan.pluginbase.utils; +package com.loganmagnan.unlimiteditems.utils; public interface TtlHandler { diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/TtlHashMap.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/TtlHashMap.java similarity index 98% rename from src/main/java/com/loganmagnan/pluginbase/utils/TtlHashMap.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/TtlHashMap.java index 162c9d5..d008b53 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/TtlHashMap.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/TtlHashMap.java @@ -1,4 +1,4 @@ -package com.loganmagnan.pluginbase.utils; +package com.loganmagnan.unlimiteditems.utils; import org.bukkit.Bukkit; diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/Utils.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/Utils.java similarity index 96% rename from src/main/java/com/loganmagnan/pluginbase/utils/Utils.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/Utils.java index dbc8d5a..bfce5e6 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/Utils.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/Utils.java @@ -1,6 +1,6 @@ -package com.loganmagnan.pluginbase.utils; +package com.loganmagnan.unlimiteditems.utils; -import com.loganmagnan.pluginbase.PluginBase; +import com.loganmagnan.unlimiteditems.UnlimitedItems; 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 UnlimitedItems main = UnlimitedItems.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 + "--------------------------------------------"; diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/Vector3.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/Vector3.java similarity index 96% rename from src/main/java/com/loganmagnan/pluginbase/utils/Vector3.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/Vector3.java index d466b11..3536b16 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/Vector3.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/Vector3.java @@ -1,4 +1,4 @@ -package com.loganmagnan.pluginbase.utils; +package com.loganmagnan.unlimiteditems.utils; import org.bukkit.Location; import org.bukkit.World; diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/WorldUtils.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/WorldUtils.java similarity index 99% rename from src/main/java/com/loganmagnan/pluginbase/utils/WorldUtils.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/WorldUtils.java index 61c558e..b3094cc 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/WorldUtils.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/WorldUtils.java @@ -1,4 +1,4 @@ - package com.loganmagnan.pluginbase.utils; + package com.loganmagnan.unlimiteditems.utils; import org.bukkit.*; import org.bukkit.block.Block; diff --git a/src/main/java/com/loganmagnan/unlimiteditems/utils/command/BaseCommand.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/command/BaseCommand.java new file mode 100644 index 0000000..39e7e9a --- /dev/null +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/command/BaseCommand.java @@ -0,0 +1,12 @@ +package com.loganmagnan.unlimiteditems.utils.command; + +import com.loganmagnan.unlimiteditems.UnlimitedItems; + +public abstract class BaseCommand { + + public BaseCommand() { + UnlimitedItems.getInstance().getCommandFramework().registerCommands(this, null); + } + + public abstract void executeAs(CommandArguments command); +} diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/command/BukkitCommand.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/command/BukkitCommand.java similarity index 98% rename from src/main/java/com/loganmagnan/pluginbase/utils/command/BukkitCommand.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/command/BukkitCommand.java index 95830b7..fe88f95 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/command/BukkitCommand.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/command/BukkitCommand.java @@ -1,4 +1,4 @@ -package com.loganmagnan.pluginbase.utils.command; +package com.loganmagnan.unlimiteditems.utils.command; import org.apache.commons.lang3.Validate; import org.bukkit.command.Command; diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/command/BukkitCompleter.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/command/BukkitCompleter.java similarity index 96% rename from src/main/java/com/loganmagnan/pluginbase/utils/command/BukkitCompleter.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/command/BukkitCompleter.java index a8823e5..4b6ea0b 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/command/BukkitCompleter.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/command/BukkitCompleter.java @@ -1,4 +1,4 @@ -package com.loganmagnan.pluginbase.utils.command; +package com.loganmagnan.unlimiteditems.utils.command; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/command/Command.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/command/Command.java similarity index 90% rename from src/main/java/com/loganmagnan/pluginbase/utils/command/Command.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/command/Command.java index d1e5388..faae758 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/command/Command.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/command/Command.java @@ -1,4 +1,4 @@ -package com.loganmagnan.pluginbase.utils.command; +package com.loganmagnan.unlimiteditems.utils.command; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/command/CommandArguments.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/command/CommandArguments.java similarity index 96% rename from src/main/java/com/loganmagnan/pluginbase/utils/command/CommandArguments.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/command/CommandArguments.java index 46cfeb7..1ebc80b 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/command/CommandArguments.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/command/CommandArguments.java @@ -1,4 +1,4 @@ -package com.loganmagnan.pluginbase.utils.command; +package com.loganmagnan.unlimiteditems.utils.command; import lombok.Getter; import org.bukkit.command.CommandSender; diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/command/CommandFramework.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/command/CommandFramework.java similarity index 96% rename from src/main/java/com/loganmagnan/pluginbase/utils/command/CommandFramework.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/command/CommandFramework.java index 4ce216b..0d298e9 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/command/CommandFramework.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/command/CommandFramework.java @@ -1,7 +1,7 @@ -package com.loganmagnan.pluginbase.utils.command; +package com.loganmagnan.unlimiteditems.utils.command; -import com.loganmagnan.pluginbase.PluginBase; -import com.loganmagnan.pluginbase.utils.ColorUtils; +import com.loganmagnan.unlimiteditems.UnlimitedItems; +import com.loganmagnan.unlimiteditems.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 UnlimitedItems plugin; private Map> commandMap = new HashMap<>(); private CommandMap map; - public CommandFramework(PluginBase plugin) { + public CommandFramework(UnlimitedItems plugin) { this.plugin = plugin; if (plugin.getServer().getPluginManager() instanceof SimplePluginManager) { diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/command/Completer.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/command/Completer.java similarity index 85% rename from src/main/java/com/loganmagnan/pluginbase/utils/command/Completer.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/command/Completer.java index 4350b13..298d1e7 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/command/Completer.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/command/Completer.java @@ -1,4 +1,4 @@ -package com.loganmagnan.pluginbase.utils.command; +package com.loganmagnan.unlimiteditems.utils.command; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/config/ConfigCursor.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/config/ConfigCursor.java similarity index 97% rename from src/main/java/com/loganmagnan/pluginbase/utils/config/ConfigCursor.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/config/ConfigCursor.java index 8b7277a..cd8a606 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/config/ConfigCursor.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/config/ConfigCursor.java @@ -1,4 +1,4 @@ -package com.loganmagnan.pluginbase.utils.config; +package com.loganmagnan.unlimiteditems.utils.config; import org.bukkit.Bukkit; import org.bukkit.World; diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/config/FileConfig.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/config/FileConfig.java similarity index 85% rename from src/main/java/com/loganmagnan/pluginbase/utils/config/FileConfig.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/config/FileConfig.java index aaac4da..11ac5d3 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/config/FileConfig.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/config/FileConfig.java @@ -1,7 +1,7 @@ -package com.loganmagnan.pluginbase.utils.config; +package com.loganmagnan.unlimiteditems.utils.config; -import com.loganmagnan.pluginbase.PluginBase; -import com.loganmagnan.pluginbase.utils.ConfigUpdater; +import com.loganmagnan.unlimiteditems.UnlimitedItems; +import com.loganmagnan.unlimiteditems.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(UnlimitedItems.getInstance(), fileName, this.file); } } catch (Exception exception) { exception.printStackTrace(); diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/config/file/Config.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/config/file/Config.java similarity index 79% rename from src/main/java/com/loganmagnan/pluginbase/utils/config/file/Config.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/config/file/Config.java index afa6a19..1ffd6e5 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/config/file/Config.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/config/file/Config.java @@ -1,7 +1,7 @@ -package com.loganmagnan.pluginbase.utils.config.file; +package com.loganmagnan.unlimiteditems.utils.config.file; -import com.loganmagnan.pluginbase.PluginBase; -import com.loganmagnan.pluginbase.utils.ConfigUpdater; +import com.loganmagnan.unlimiteditems.UnlimitedItems; +import com.loganmagnan.unlimiteditems.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(UnlimitedItems.getInstance(), name + ".yml", this.configFile); } } catch (Exception exception) { exception.printStackTrace(); diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/config/file/ConfigFile.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/config/file/ConfigFile.java similarity index 92% rename from src/main/java/com/loganmagnan/pluginbase/utils/config/file/ConfigFile.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/config/file/ConfigFile.java index 5adbf74..231935b 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/config/file/ConfigFile.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/config/file/ConfigFile.java @@ -1,7 +1,7 @@ -package com.loganmagnan.pluginbase.utils.config.file; +package com.loganmagnan.unlimiteditems.utils.config.file; -import com.loganmagnan.pluginbase.PluginBase; -import com.loganmagnan.pluginbase.utils.ConfigUpdater; +import com.loganmagnan.unlimiteditems.UnlimitedItems; +import com.loganmagnan.unlimiteditems.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(UnlimitedItems.getInstance(), name + ".yml", this.file); } catch (Exception exception) { exception.printStackTrace(); } diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/cuboid/Cuboid.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/cuboid/Cuboid.java similarity index 99% rename from src/main/java/com/loganmagnan/pluginbase/utils/cuboid/Cuboid.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/cuboid/Cuboid.java index d5fe1b9..14d949a 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/cuboid/Cuboid.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/cuboid/Cuboid.java @@ -1,4 +1,4 @@ -package com.loganmagnan.pluginbase.utils.cuboid; +package com.loganmagnan.unlimiteditems.utils.cuboid; import com.google.common.base.Preconditions; import org.bukkit.*; diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/cuboid/CuboidBlockIterator.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/cuboid/CuboidBlockIterator.java similarity index 97% rename from src/main/java/com/loganmagnan/pluginbase/utils/cuboid/CuboidBlockIterator.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/cuboid/CuboidBlockIterator.java index 665be5d..06aaf89 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/cuboid/CuboidBlockIterator.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/cuboid/CuboidBlockIterator.java @@ -1,4 +1,4 @@ -package com.loganmagnan.pluginbase.utils.cuboid; +package com.loganmagnan.unlimiteditems.utils.cuboid; import org.bukkit.World; import org.bukkit.block.Block; diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/cuboid/CuboidDirection.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/cuboid/CuboidDirection.java similarity index 94% rename from src/main/java/com/loganmagnan/pluginbase/utils/cuboid/CuboidDirection.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/cuboid/CuboidDirection.java index 0298b22..bb7c89b 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/cuboid/CuboidDirection.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/cuboid/CuboidDirection.java @@ -1,4 +1,4 @@ -package com.loganmagnan.pluginbase.utils.cuboid; +package com.loganmagnan.unlimiteditems.utils.cuboid; public enum CuboidDirection { diff --git a/src/main/java/com/loganmagnan/pluginbase/utils/cuboid/CuboidLocationIterator.java b/src/main/java/com/loganmagnan/unlimiteditems/utils/cuboid/CuboidLocationIterator.java similarity index 97% rename from src/main/java/com/loganmagnan/pluginbase/utils/cuboid/CuboidLocationIterator.java rename to src/main/java/com/loganmagnan/unlimiteditems/utils/cuboid/CuboidLocationIterator.java index aa3cd18..f125e5c 100644 --- a/src/main/java/com/loganmagnan/pluginbase/utils/cuboid/CuboidLocationIterator.java +++ b/src/main/java/com/loganmagnan/unlimiteditems/utils/cuboid/CuboidLocationIterator.java @@ -1,4 +1,4 @@ -package com.loganmagnan.pluginbase.utils.cuboid; +package com.loganmagnan.unlimiteditems.utils.cuboid; import org.bukkit.Location; import org.bukkit.World; diff --git a/src/main/resources/menus.yml b/src/main/resources/menus.yml new file mode 100644 index 0000000..3058324 --- /dev/null +++ b/src/main/resources/menus.yml @@ -0,0 +1,16 @@ +MENUS: + SETTINGS: + TITLE: "&bSettings Selector" + SIZE: 27 + ENABLED: "&a►" + DISABLED: "&c►" + UNSELECTED: "&7►" + SETTINGS: + UNLIMITED-ITEMS: + NAME: "&bUnlimited Items" + LORE: + - "&7If enabled, then you'll be" + - "&7able to have a stack size of 99." + - "" + MATERIAL: "NETHER_STAR" # Don't change this value + SLOT: 13 \ No newline at end of file diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index d712f52..426dd0e 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ -name: PluginBase +name: UnlimitedItems author: Trixkz version: 1.0 api-version: 1.13 -main: com.loganmagnan.pluginbase.PluginBase \ No newline at end of file +main: com.loganmagnan.unlimiteditems.UnlimitedItems \ No newline at end of file