Skip to content

Commit

Permalink
Merge pull request #11 from Tweetzy/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
kiranhart committed Nov 17, 2022
2 parents 0b60cc3 + 2ad03ae commit d7ecb1c
Show file tree
Hide file tree
Showing 28 changed files with 191 additions and 242 deletions.
5 changes: 5 additions & 0 deletions README.md
@@ -0,0 +1,5 @@
![](https://i.imgur.com/0lsV9oR.jpg)
![](https://static.tweetzy.ca/plugins/skulls/about.png)

![](https://static.tweetzy.ca/plugins/skulls/featurebar1.png)
![](https://static.tweetzy.ca/plugins/skulls/featurebar2.png)
23 changes: 14 additions & 9 deletions pom.xml
Expand Up @@ -7,20 +7,25 @@
<artifactId>skulls</artifactId>

<name>Skulls</name>
<version>3.5.0</version>
<version>3.6.0</version>
<packaging>jar</packaging>

<properties>
<author>Kiran Hart</author>
<jarName>Skulls</jarName>
<main.class>${project.groupId}.${project.artifactId}.${project.name}</main.class>
<java.version>1.8</java.version>
<feather.version>3.4.0</feather.version>
<feather.path>ca.tweetzy</feather.path>
<flight.version>3.6.0</flight.version>
<flight.path>ca.tweetzy</flight.path>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<repositories>
<repository>
<id>repsy</id>
<name>Tweetzy Maven Repo On Repsy</name>
<url>https://repo.repsy.io/mvn/kiran/tweetzy</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
Expand All @@ -40,9 +45,9 @@
</repositories>
<dependencies>
<dependency>
<groupId>${feather.path}</groupId>
<artifactId>feather</artifactId>
<version>${feather.version}</version>
<groupId>${flight.path}</groupId>
<artifactId>flight</artifactId>
<version>${flight.version}</version>
</dependency>
<dependency>
<groupId>com.sk89q.worldguard</groupId>
Expand Down Expand Up @@ -101,7 +106,7 @@
<createDependencyReducedPom>false</createDependencyReducedPom>
<artifactSet>
<includes>
<include>${feather.path}:feather*</include>
<include>${flight.path}:flight*</include>
</includes>
</artifactSet>
<filters>
Expand All @@ -117,8 +122,8 @@
</filters>
<relocations>
<relocation>
<pattern>ca.tweetzy.feather</pattern>
<shadedPattern>${project.groupId}.${project.artifactId}.core</shadedPattern>
<pattern>ca.tweetzy.flight</pattern>
<shadedPattern>${project.groupId}.${project.artifactId}.flight</shadedPattern>
</relocation>
</relocations>
</configuration>
Expand Down
28 changes: 12 additions & 16 deletions src/main/java/ca/tweetzy/skulls/Skulls.java
Expand Up @@ -18,16 +18,14 @@

package ca.tweetzy.skulls;

import ca.tweetzy.feather.FeatherCore;
import ca.tweetzy.feather.FeatherPlugin;
import ca.tweetzy.feather.command.CommandManager;
import ca.tweetzy.feather.comp.enums.CompMaterial;
import ca.tweetzy.feather.database.DataMigrationManager;
import ca.tweetzy.feather.database.DatabaseConnector;
import ca.tweetzy.feather.database.SQLiteConnector;
import ca.tweetzy.feather.files.file.YamlFile;
import ca.tweetzy.feather.gui.GuiManager;
import ca.tweetzy.feather.utils.Common;
import ca.tweetzy.flight.FlightPlugin;
import ca.tweetzy.flight.command.CommandManager;
import ca.tweetzy.flight.config.tweetzy.TweetzyYamlConfig;
import ca.tweetzy.flight.database.DataMigrationManager;
import ca.tweetzy.flight.database.DatabaseConnector;
import ca.tweetzy.flight.database.SQLiteConnector;
import ca.tweetzy.flight.gui.GuiManager;
import ca.tweetzy.flight.utils.Common;
import ca.tweetzy.skulls.api.SkullsAPI;
import ca.tweetzy.skulls.commands.*;
import ca.tweetzy.skulls.database.DataManager;
Expand All @@ -50,9 +48,9 @@
*
* @author Kiran Hart
*/
public final class Skulls extends FeatherPlugin {
public final class Skulls extends FlightPlugin {

private final YamlFile coreConfig = new YamlFile(getDataFolder() + "/config.yml");
private final TweetzyYamlConfig coreConfig = new TweetzyYamlConfig(this, "config.yml");

private final GuiManager guiManager = new GuiManager(this);
private final CommandManager commandManager = new CommandManager(this);
Expand All @@ -69,8 +67,6 @@ public final class Skulls extends FeatherPlugin {

@Override
protected void onFlight() {
FeatherCore.registerPlugin(this, 5, CompMaterial.ZOMBIE_HEAD.name());

// settings and locale setup
Settings.setup();
Locale.setup();
Expand Down Expand Up @@ -107,11 +103,11 @@ protected void onFlight() {
}

public static Skulls getInstance() {
return (Skulls) FeatherPlugin.getInstance();
return (Skulls) FlightPlugin.getInstance();
}


public static YamlFile getCoreConfig() {
public static TweetzyYamlConfig getCoreConfig() {
return getInstance().coreConfig;
}

Expand Down
8 changes: 4 additions & 4 deletions src/main/java/ca/tweetzy/skulls/commands/GiveCommand.java
Expand Up @@ -18,10 +18,10 @@

package ca.tweetzy.skulls.commands;

import ca.tweetzy.feather.command.AllowedExecutor;
import ca.tweetzy.feather.command.Command;
import ca.tweetzy.feather.command.ReturnType;
import ca.tweetzy.feather.utils.Common;
import ca.tweetzy.flight.command.AllowedExecutor;
import ca.tweetzy.flight.command.Command;
import ca.tweetzy.flight.command.ReturnType;
import ca.tweetzy.flight.utils.Common;
import ca.tweetzy.skulls.model.NumberHelper;
import ca.tweetzy.skulls.Skulls;
import ca.tweetzy.skulls.api.interfaces.Skull;
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/ca/tweetzy/skulls/commands/InspectCommand.java
Expand Up @@ -18,13 +18,13 @@

package ca.tweetzy.skulls.commands;

import ca.tweetzy.feather.command.AllowedExecutor;
import ca.tweetzy.feather.command.Command;
import ca.tweetzy.feather.command.ReturnType;
import ca.tweetzy.feather.comp.NBTEditor;
import ca.tweetzy.feather.comp.enums.CompMaterial;
import ca.tweetzy.feather.utils.Common;
import ca.tweetzy.feather.utils.PlayerUtil;
import ca.tweetzy.flight.command.AllowedExecutor;
import ca.tweetzy.flight.command.Command;
import ca.tweetzy.flight.command.ReturnType;
import ca.tweetzy.flight.comp.NBTEditor;
import ca.tweetzy.flight.comp.enums.CompMaterial;
import ca.tweetzy.flight.utils.Common;
import ca.tweetzy.flight.utils.PlayerUtil;
import ca.tweetzy.skulls.Skulls;
import ca.tweetzy.skulls.api.interfaces.PlacedSkull;
import ca.tweetzy.skulls.api.interfaces.Skull;
Expand Down
13 changes: 7 additions & 6 deletions src/main/java/ca/tweetzy/skulls/commands/PlayerHeadCommand.java
Expand Up @@ -18,11 +18,12 @@

package ca.tweetzy.skulls.commands;

import ca.tweetzy.feather.command.AllowedExecutor;
import ca.tweetzy.feather.command.Command;
import ca.tweetzy.feather.command.ReturnType;
import ca.tweetzy.feather.utils.Common;
import ca.tweetzy.feather.utils.QuickItem;
import ca.tweetzy.flight.command.AllowedExecutor;
import ca.tweetzy.flight.command.Command;
import ca.tweetzy.flight.command.ReturnType;
import ca.tweetzy.flight.utils.Common;
import ca.tweetzy.flight.utils.QuickItem;
import ca.tweetzy.skulls.Skulls;
import ca.tweetzy.skulls.model.NumberHelper;
import ca.tweetzy.skulls.settings.Settings;
import ca.tweetzy.skulls.settings.Translation;
Expand Down Expand Up @@ -52,7 +53,7 @@ protected ReturnType execute(CommandSender sender, String... args) {
return ReturnType.INVALID_SYNTAX;
}

Common.runAsync(() -> {
Bukkit.getServer().getScheduler().runTaskAsynchronously(Skulls.getInstance(), () -> {
if (args.length == 0) {
final Player executor = (Player) sender;
executor.getInventory().addItem(QuickItem.of(executor).name(Settings.PLAYER_HEAD_NAME.getString().replace("%player_name%", executor.getName())).make());
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/ca/tweetzy/skulls/commands/SearchCommand.java
Expand Up @@ -18,9 +18,9 @@

package ca.tweetzy.skulls.commands;

import ca.tweetzy.feather.command.AllowedExecutor;
import ca.tweetzy.feather.command.Command;
import ca.tweetzy.feather.command.ReturnType;
import ca.tweetzy.flight.command.AllowedExecutor;
import ca.tweetzy.flight.command.Command;
import ca.tweetzy.flight.command.ReturnType;
import ca.tweetzy.skulls.Skulls;
import ca.tweetzy.skulls.api.enums.ViewMode;
import ca.tweetzy.skulls.api.interfaces.SkullUser;
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/ca/tweetzy/skulls/commands/SkullsCommand.java
Expand Up @@ -18,9 +18,9 @@

package ca.tweetzy.skulls.commands;

import ca.tweetzy.feather.command.AllowedExecutor;
import ca.tweetzy.feather.command.Command;
import ca.tweetzy.feather.command.ReturnType;
import ca.tweetzy.flight.command.AllowedExecutor;
import ca.tweetzy.flight.command.Command;
import ca.tweetzy.flight.command.ReturnType;
import ca.tweetzy.skulls.Skulls;
import ca.tweetzy.skulls.guis.MainGUI;
import ca.tweetzy.skulls.settings.Settings;
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/ca/tweetzy/skulls/database/DataManager.java
Expand Up @@ -18,12 +18,12 @@

package ca.tweetzy.skulls.database;

import ca.tweetzy.feather.database.Callback;
import ca.tweetzy.feather.database.DataManagerAbstract;
import ca.tweetzy.feather.database.DatabaseConnector;
import ca.tweetzy.feather.database.UpdateCallback;
import ca.tweetzy.feather.utils.Common;
import ca.tweetzy.skulls.model.Serialize;
import ca.tweetzy.flight.database.Callback;
import ca.tweetzy.flight.database.DataManagerAbstract;
import ca.tweetzy.flight.database.DatabaseConnector;
import ca.tweetzy.flight.database.UpdateCallback;
import ca.tweetzy.flight.utils.Common;
import ca.tweetzy.flight.utils.SerializeUtil;
import ca.tweetzy.skulls.Skulls;
import ca.tweetzy.skulls.api.enums.BaseCategory;
import ca.tweetzy.skulls.api.interfaces.*;
Expand Down Expand Up @@ -121,7 +121,7 @@ public void insertPlacedSkull(@NonNull final PlacedSkull placedSkull, Callback<P
fetch.setString(1, placedSkull.getId().toString());
statement.setString(1, placedSkull.getId().toString());
statement.setInt(2, placedSkull.getSkullId());
statement.setString(3, Serialize.serializeLocation(placedSkull.getLocation()));
statement.setString(3, SerializeUtil.serializeLocation(placedSkull.getLocation()));
statement.executeUpdate();

if (callback != null) {
Expand Down Expand Up @@ -389,7 +389,7 @@ public PlacedSkull extractPlacedSkull(@NonNull final ResultSet resultSet) throws
return new PlacedSkullLocation(
UUID.fromString(resultSet.getString("id")),
resultSet.getInt("skull_id"),
Serialize.deserializeLocation(resultSet.getString("location"))
SerializeUtil.deserializeLocation(resultSet.getString("location"))
);
}

Expand Down
Expand Up @@ -19,7 +19,7 @@
package ca.tweetzy.skulls.database.migrations;


import ca.tweetzy.feather.database.DataMigration;
import ca.tweetzy.flight.database.DataMigration;

import java.sql.Connection;
import java.sql.SQLException;
Expand Down
Expand Up @@ -19,7 +19,7 @@
package ca.tweetzy.skulls.database.migrations;


import ca.tweetzy.feather.database.DataMigration;
import ca.tweetzy.flight.database.DataMigration;

import java.sql.Connection;
import java.sql.SQLException;
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/ca/tweetzy/skulls/guis/CategorySelectorGUI.java
Expand Up @@ -18,10 +18,10 @@

package ca.tweetzy.skulls.guis;

import ca.tweetzy.feather.comp.enums.CompMaterial;
import ca.tweetzy.feather.gui.events.GuiClickEvent;
import ca.tweetzy.feather.gui.template.PagedGUI;
import ca.tweetzy.feather.utils.QuickItem;
import ca.tweetzy.flight.comp.enums.CompMaterial;
import ca.tweetzy.flight.gui.events.GuiClickEvent;
import ca.tweetzy.flight.gui.template.PagedGUI;
import ca.tweetzy.flight.utils.QuickItem;
import ca.tweetzy.skulls.Skulls;
import ca.tweetzy.skulls.api.interfaces.Category;
import ca.tweetzy.skulls.settings.Translation;
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/ca/tweetzy/skulls/guis/CustomCategoryListGUI.java
Expand Up @@ -18,13 +18,13 @@

package ca.tweetzy.skulls.guis;

import ca.tweetzy.feather.comp.enums.CompMaterial;
import ca.tweetzy.feather.gui.Gui;
import ca.tweetzy.feather.gui.events.GuiClickEvent;
import ca.tweetzy.feather.gui.template.PagedGUI;
import ca.tweetzy.feather.utils.Common;
import ca.tweetzy.feather.utils.QuickItem;
import ca.tweetzy.feather.utils.input.TitleInput;
import ca.tweetzy.flight.comp.enums.CompMaterial;
import ca.tweetzy.flight.gui.Gui;
import ca.tweetzy.flight.gui.events.GuiClickEvent;
import ca.tweetzy.flight.gui.template.PagedGUI;
import ca.tweetzy.flight.utils.Common;
import ca.tweetzy.flight.utils.QuickItem;
import ca.tweetzy.flight.utils.input.TitleInput;
import ca.tweetzy.skulls.Skulls;
import ca.tweetzy.skulls.api.enums.ViewMode;
import ca.tweetzy.skulls.api.interfaces.Category;
Expand Down Expand Up @@ -67,7 +67,7 @@ protected void drawAdditional() {
setButton(5, 4, QuickItem.of(CompMaterial.SLIME_BALL)
.name(Translation.GUI_CUSTOM_CATEGORY_LIST_ITEMS_NEW_NAME.getString())
.lore(Translation.GUI_CUSTOM_CATEGORY_LIST_ITEMS_NEW_LORE.getList())
.make(), click -> new TitleInput(click.player, Translation.INPUT_CATEGORY_CREATE_TITLE.getString(), Translation.INPUT_CATEGORY_CREATE_SUBTITLE.getString()) {
.make(), click -> new TitleInput(Skulls.getInstance(),click.player, Translation.INPUT_CATEGORY_CREATE_TITLE.getString(), Translation.INPUT_CATEGORY_CREATE_SUBTITLE.getString()) {

@Override
public void onExit(Player player) {
Expand Down
15 changes: 8 additions & 7 deletions src/main/java/ca/tweetzy/skulls/guis/HistoryViewGUI.java
Expand Up @@ -18,16 +18,17 @@

package ca.tweetzy.skulls.guis;

import ca.tweetzy.feather.comp.enums.CompMaterial;
import ca.tweetzy.feather.gui.Gui;
import ca.tweetzy.feather.gui.events.GuiClickEvent;
import ca.tweetzy.feather.gui.template.PagedGUI;
import ca.tweetzy.feather.utils.Common;
import ca.tweetzy.feather.utils.QuickItem;
import ca.tweetzy.flight.comp.enums.CompMaterial;
import ca.tweetzy.flight.gui.Gui;
import ca.tweetzy.flight.gui.events.GuiClickEvent;
import ca.tweetzy.flight.gui.template.PagedGUI;
import ca.tweetzy.flight.utils.Common;
import ca.tweetzy.flight.utils.QuickItem;
import ca.tweetzy.skulls.Skulls;
import ca.tweetzy.skulls.api.enums.BaseCategory;
import ca.tweetzy.skulls.api.interfaces.History;
import ca.tweetzy.skulls.settings.Translation;
import org.bukkit.Bukkit;
import org.bukkit.inventory.ItemStack;

import java.text.SimpleDateFormat;
Expand Down Expand Up @@ -90,7 +91,7 @@ protected void onClick(History history, GuiClickEvent clickEvent) {
final boolean downloaded = Skulls.getSkullManager().getIdList().contains(history.getSkulls().get(0));
if (downloaded) return;

Common.runAsync(() -> {
Bukkit.getServer().getScheduler().runTaskAsynchronously(Skulls.getInstance(), () -> {
Skulls.getSkullManager().downloadHistorySkulls(history, finished -> clickEvent.manager.showGUI(clickEvent.player, new HistoryViewGUI(new MainGUI(clickEvent.player))));
});
}
Expand Down
18 changes: 9 additions & 9 deletions src/main/java/ca/tweetzy/skulls/guis/MainGUI.java
Expand Up @@ -18,16 +18,16 @@

package ca.tweetzy.skulls.guis;

import ca.tweetzy.feather.comp.enums.CompMaterial;
import ca.tweetzy.feather.gui.template.BaseGUI;
import ca.tweetzy.feather.utils.ChatUtil;
import ca.tweetzy.feather.utils.Common;
import ca.tweetzy.feather.utils.QuickItem;
import ca.tweetzy.feather.utils.input.TitleInput;
import ca.tweetzy.skulls.model.SkullItem;
import ca.tweetzy.flight.comp.enums.CompMaterial;
import ca.tweetzy.flight.gui.template.BaseGUI;
import ca.tweetzy.flight.utils.ChatUtil;
import ca.tweetzy.flight.utils.Common;
import ca.tweetzy.flight.utils.QuickItem;
import ca.tweetzy.flight.utils.input.TitleInput;
import ca.tweetzy.skulls.Skulls;
import ca.tweetzy.skulls.api.enums.BaseCategory;
import ca.tweetzy.skulls.api.enums.ViewMode;
import ca.tweetzy.skulls.model.SkullItem;
import ca.tweetzy.skulls.settings.Translation;
import lombok.NonNull;
import org.bukkit.entity.Player;
Expand Down Expand Up @@ -59,7 +59,7 @@ protected void draw() {
.lore(Translation.GUI_MAIN_ITEMS_CATEGORY_LORE.getList("category_size", Skulls.getSkullManager().getSkullCount(baseCategory.getId())))
.make(), click -> {

if (!click.player.hasPermission("skulls.category." + baseCategory.getId().toLowerCase().replace(" ", "").replace("&",""))) {
if (!click.player.hasPermission("skulls.category." + baseCategory.getId().toLowerCase().replace(" ", "").replace("&", ""))) {
Common.tell(click.player, Translation.CATEGORY_PERMISSION.getKey());
return;
}
Expand All @@ -78,7 +78,7 @@ protected void draw() {
return;
}

new TitleInput(click.player, Translation.INPUT_SKULL_SEARCH_TITLE.getString(), Translation.INPUT_SKULL_SEARCH_SUBTITLE.getString()) {
new TitleInput(Skulls.getInstance(), click.player, Translation.INPUT_SKULL_SEARCH_TITLE.getString(), Translation.INPUT_SKULL_SEARCH_SUBTITLE.getString()) {

@Override
public boolean onResult(String string) {
Expand Down

0 comments on commit d7ecb1c

Please sign in to comment.