Clean up unused imports
This commit is contained in:
parent
57be263412
commit
6190c43eb1
|
|
@ -8,7 +8,6 @@ import com.alttd.playershops.shop.PlayerShop;
|
|||
import com.alttd.playershops.utils.ShopUtil;
|
||||
import com.alttd.playershops.utils.Util;
|
||||
import com.destroystokyo.paper.ParticleBuilder;
|
||||
import net.kyori.adventure.chat.ChatType;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
||||
|
|
|
|||
|
|
@ -1,31 +1,17 @@
|
|||
package com.alttd.playershops.commands.subcommands;
|
||||
|
||||
import com.alttd.playershops.PlayerShops;
|
||||
import com.alttd.playershops.commands.PlayerShopCommand;
|
||||
import com.alttd.playershops.commands.PlayerShopCommands;
|
||||
import com.alttd.playershops.commands.Subcommand;
|
||||
import com.alttd.playershops.shop.PlayerShop;
|
||||
import com.alttd.playershops.utils.ShopUtil;
|
||||
import com.alttd.playershops.utils.Util;
|
||||
import com.destroystokyo.paper.ParticleBuilder;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@DefaultQualifier(NonNull.class)
|
||||
public class TransferShopsCommand implements Subcommand {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package com.alttd.playershops.gui;
|
||||
|
||||
import com.alttd.playershops.config.GuiIconConfig;
|
||||
import com.alttd.playershops.config.ShopTypeConfig;
|
||||
import com.alttd.playershops.utils.Util;
|
||||
import lombok.Getter;
|
||||
import net.kyori.adventure.text.Component;
|
||||
|
|
|
|||
|
|
@ -4,8 +4,6 @@ import com.alttd.playershops.PlayerShops;
|
|||
import com.alttd.playershops.config.MessageConfig;
|
||||
import com.alttd.playershops.utils.ShopUtil;
|
||||
import com.alttd.playershops.utils.Util;
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
|
|
|||
|
|
@ -5,10 +5,7 @@ import com.alttd.playershops.shop.PlayerShop;
|
|||
import com.alttd.playershops.shop.ShopTransaction;
|
||||
import com.alttd.playershops.utils.ShopUtil;
|
||||
import com.alttd.playershops.utils.Util;
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.List;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ package com.alttd.playershops.gui;
|
|||
|
||||
import com.alttd.playershops.PlayerShops;
|
||||
import com.alttd.playershops.config.MessageConfig;
|
||||
import com.alttd.playershops.config.ShopTypeConfig;
|
||||
import com.alttd.playershops.conversation.ConversationManager;
|
||||
import com.alttd.playershops.conversation.ConversationType;
|
||||
import com.alttd.playershops.shop.PlayerShop;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ package com.alttd.playershops.listener;
|
|||
|
||||
import com.alttd.playershops.PlayerShops;
|
||||
import com.alttd.playershops.gui.AbstractGui;
|
||||
import com.alttd.playershops.gui.ShopManagementGui;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ import org.bukkit.block.Chest;
|
|||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.Directional;
|
||||
import org.bukkit.block.data.Rotatable;
|
||||
import org.bukkit.block.data.type.WallSign;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ public class ShopListener extends EventListener {
|
|||
}
|
||||
|
||||
// currently goes to breaking player, but this should go to owning player at one point
|
||||
EconomyUtils.addFunds(player, shop.getBalance());
|
||||
EconomyUtils.addFunds(player, shop.getBalance()); // FIXME -- funds have to go to the shop owner, not the breaking player
|
||||
|
||||
shopHandler.removeShop(shop);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,117 +0,0 @@
|
|||
package com.alttd.playershops.storage.database;
|
||||
|
||||
import com.alttd.playershops.PlayerShops;
|
||||
import com.alttd.playershops.config.DatabaseConfig;
|
||||
import com.alttd.playershops.utils.Logger;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class Database {
|
||||
//
|
||||
// private static Database instance = null;
|
||||
// private Connection connection = null;
|
||||
//
|
||||
// private Database() {}
|
||||
//
|
||||
// public static Database getDatabase(){
|
||||
// if (instance == null)
|
||||
// {
|
||||
// instance = new Database();
|
||||
// instance.init();
|
||||
// }
|
||||
// return (instance);
|
||||
// }
|
||||
//
|
||||
// protected void init() {
|
||||
// try {
|
||||
// openConnection();
|
||||
// } catch (SQLException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
//
|
||||
// //Run all create table functions
|
||||
// for (Method method : Database.class.getDeclaredMethods()) {
|
||||
// if (Modifier.isPrivate(method.getModifiers())) {
|
||||
// if (method.getParameterTypes().length == 0 && method.getReturnType() == Void.TYPE) {
|
||||
// try {
|
||||
// method.setAccessible(true);
|
||||
// method.invoke(instance);
|
||||
// } catch (InvocationTargetException ex) {
|
||||
// throw new RuntimeException(ex.getCause());
|
||||
// } catch (Exception ex) {
|
||||
// Logger.severe("Error invoking " + method + ".");
|
||||
// ex.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Opens the connection if it's not already open.
|
||||
// * @throws SQLException If it can't create the connection.
|
||||
// */
|
||||
// private void openConnection() throws SQLException {
|
||||
// if (connection != null && !connection.isClosed()) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// synchronized (this) {
|
||||
// if (connection != null && !connection.isClosed()) {
|
||||
// return;
|
||||
// }
|
||||
// try {
|
||||
// Class.forName("com.mysql.cj.jdbc.Driver");
|
||||
// } catch (ClassNotFoundException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
//
|
||||
// connection = DriverManager.getConnection(
|
||||
// "jdbc:mysql://" + DatabaseConfig.IP + ":" + DatabaseConfig.PORT + "/" + DatabaseConfig.DATABASE_NAME +
|
||||
// "?autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true",
|
||||
// DatabaseConfig.USERNAME, DatabaseConfig.PASSWORD);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public Connection getConnection() {
|
||||
// try {
|
||||
// openConnection();
|
||||
// } catch (SQLException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// return connection;
|
||||
// }
|
||||
//
|
||||
// private static void createShopTable() {
|
||||
// try {
|
||||
// String sql = "CREATE TABLE IF NOT EXISTS shops(" +
|
||||
// "id INT NOT NULL AUTO_INCREMENT, " +
|
||||
// "owner_name VARCHAR(16) NOT NULL, " +
|
||||
// "owner_uuid VARCHAR(36) NOT NULL, " +
|
||||
// "shop_type VARCHAR(36) NOT NULL, " +
|
||||
// "server VARCHAR(16) NOT NULL, " +
|
||||
// "container_location VARCHAR(256), " +
|
||||
// "sign_location VARCHAR(256), " +
|
||||
// "price DOUBLE NOT NULL, " +
|
||||
// "amount INT NOT NULL, " +
|
||||
// "balance DOUBLE NOT NULL, " +
|
||||
// "item_one TEXT, " +
|
||||
// "last_transaction BIGINT, " +
|
||||
// "PRIMARY KEY (id)" +
|
||||
// ")";
|
||||
// getDatabase().getConnection().prepareStatement(sql).executeUpdate();
|
||||
// } catch (SQLException e) {
|
||||
// e.printStackTrace();
|
||||
// Logger.severe("Error while trying to create shop table");
|
||||
// Logger.severe("Shutting down PlayerShops");
|
||||
// Bukkit.getPluginManager().disablePlugin(PlayerShops.getInstance());
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
package com.alttd.playershops.storage.database;
|
||||
|
||||
import com.alttd.playershops.PlayerShops;
|
||||
import com.alttd.playershops.config.DatabaseConfig;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,6 @@
|
|||
package com.alttd.playershops.storage.database;
|
||||
|
||||
import com.alttd.playershops.PlayerShops;
|
||||
import com.alttd.playershops.config.DatabaseConfig;
|
||||
import com.alttd.playershops.storage.database.DatabaseConnection;
|
||||
import com.alttd.playershops.storage.database.DatabaseQuery;
|
||||
import com.alttd.playershops.storage.database.DatabaseQueue;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
|
|
|||
|
|
@ -1,149 +0,0 @@
|
|||
package com.alttd.playershops.storage.database;
|
||||
|
||||
import com.alttd.playershops.shop.PlayerShop;
|
||||
import com.alttd.playershops.shop.ShopType;
|
||||
import com.alttd.playershops.utils.AMath;
|
||||
import com.alttd.playershops.utils.Logger;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class ShopQueries {
|
||||
//
|
||||
// public static boolean saveShop(PlayerShop shop) {
|
||||
// String sql = "INSERT INTO shops " +
|
||||
// "(id, owner_name, owner_uuid, shop_type, server, container_location, sign_location, " +
|
||||
// "price, amount, balance, item_one, item_two, last_transaction)" +
|
||||
// "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" +
|
||||
// "ON DUPLICATE KEY UPDATE owner_name = ?, owner_uuid = ?, shop_type = ?, server = ?, " +
|
||||
// "container_location = ?, sign_location = ?, price = ?, amount = ?, balance = ?, " +
|
||||
// "item_one = ?, last_transaction = ?";
|
||||
// try {
|
||||
// PreparedStatement statement = Database.getDatabase().getConnection().prepareStatement(sql);
|
||||
//
|
||||
// statement.setInt(1, shop.getId());
|
||||
// statement.setString(2, shop.getOwnerName());
|
||||
// statement.setString(3, shop.getOwnerUUID().toString());
|
||||
// statement.setString(4, shop.getServer());
|
||||
// statement.setString(5, shop.getType().toString());
|
||||
// statement.setString(6, locationToString(shop.getShopLocation()));
|
||||
// statement.setString(7, locationToString(shop.getSignLocation()));
|
||||
// statement.setDouble(8, shop.getPrice());
|
||||
// statement.setInt(9, shop.getAmount());
|
||||
// statement.setDouble(10, shop.getBalance());
|
||||
// statement.setBytes(11, shop.getItemStack().serializeAsBytes());
|
||||
// statement.setLong(12, shop.getLastTransaction());
|
||||
// //repeat everything except id for update
|
||||
// statement.setString(13, shop.getOwnerName());
|
||||
// statement.setString(14, shop.getOwnerUUID().toString());
|
||||
// statement.setString(15, shop.getServer());
|
||||
// statement.setString(16, shop.getType().toString());
|
||||
// statement.setString(17, locationToString(shop.getShopLocation()));
|
||||
// statement.setString(18, locationToString(shop.getSignLocation()));
|
||||
// statement.setDouble(19, shop.getPrice());
|
||||
// statement.setInt(20, shop.getAmount());
|
||||
// statement.setDouble(21, shop.getBalance());
|
||||
// statement.setBytes(22, shop.getItemStack().serializeAsBytes());
|
||||
// statement.setLong(23, shop.getLastTransaction());
|
||||
//
|
||||
// return statement.executeUpdate() == 1;
|
||||
// } catch (SQLException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// public static PlayerShop loadShop(int id) {
|
||||
// String sql = "SELECT * FROM shops WHERE id = ?";
|
||||
// try {
|
||||
// PreparedStatement statement = Database.getDatabase().getConnection().prepareStatement(sql);
|
||||
//
|
||||
// statement.setInt(1, id);
|
||||
// ResultSet resultSet = statement.executeQuery();
|
||||
// if (resultSet.next())
|
||||
// return shopFromResultSet(resultSet);
|
||||
// } catch (SQLException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// public static List<PlayerShop> loadShops() {
|
||||
// String sql = "SELECT * FROM shops";
|
||||
// ArrayList<PlayerShop> shops = new ArrayList<>();
|
||||
// try {
|
||||
// PreparedStatement statement = Database.getDatabase().getConnection().prepareStatement(sql);
|
||||
//
|
||||
// ResultSet resultSet = statement.executeQuery();
|
||||
// while (resultSet.next()) {
|
||||
// PlayerShop shop = shopFromResultSet(resultSet);
|
||||
// if (shop == null) {
|
||||
// Logger.warn("Tried to load a shop but failed [" + resultSet + "]");
|
||||
// continue;
|
||||
// }
|
||||
// shops.add(shop);
|
||||
// }
|
||||
// } catch (SQLException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// return shops;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Loads a shop from a result set, does not iterate
|
||||
// * @param resultSet Result set to load from
|
||||
// * @return A shop
|
||||
// * @throws SQLException if data is missing or formatted incorrectly
|
||||
// */
|
||||
// private static PlayerShop shopFromResultSet(ResultSet resultSet) throws SQLException {
|
||||
// int id = resultSet.getInt("id");
|
||||
// String ownerName = resultSet.getString("owner_name");
|
||||
// UUID ownerUuid = UUID.fromString(resultSet.getString("owner_uuid"));
|
||||
// ShopType shopType = ShopType.valueOf(resultSet.getString("shop_type"));
|
||||
// String server = resultSet.getString("server");
|
||||
// Location containerLocation = stringToLocation(resultSet.getString("container_location"));
|
||||
// Location signLocation = stringToLocation(resultSet.getString("sign_location"));
|
||||
// double price = resultSet.getDouble("price");
|
||||
// int amount = resultSet.getInt("amount");
|
||||
// double balance = resultSet.getDouble("balance");
|
||||
// ItemStack itemOne = ItemStack.deserializeBytes(resultSet.getBytes("item_one"));
|
||||
//// ItemStack itemTwo = ItemStack.deserializeBytes(resultSet.getBytes("item_two"));
|
||||
// long lastTransaction = resultSet.getLong("last_transaction");
|
||||
//
|
||||
// if (containerLocation == null || signLocation == null)
|
||||
// return null;
|
||||
//
|
||||
// return PlayerShop.create(id, ownerName, ownerUuid, shopType, server, containerLocation, signLocation,
|
||||
// price, amount, balance, itemOne, lastTransaction);
|
||||
// }
|
||||
//
|
||||
// private static String locationToString(Location location) {
|
||||
// return location.getWorld() + ":" +
|
||||
// AMath.round(location.getX(), 1) + ":" +
|
||||
// AMath.round(location.getY(), 1) + ":" +
|
||||
// AMath.round(location.getZ(), 1);
|
||||
// }
|
||||
//
|
||||
// private static Location stringToLocation(String string) {
|
||||
// String[] split = string.split(":");
|
||||
// if (split.length != 4) {
|
||||
// Logger.warn("Unable to load location [" + string + "] due to invalid format");
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// try {
|
||||
// return new Location(Bukkit.getWorld(split[0]),
|
||||
// Double.parseDouble(split[1]), Double.parseDouble(split[2]), Double.parseDouble(split[3]));
|
||||
// } catch (NumberFormatException e) {
|
||||
// Logger.warn("Unable to load location [" + string + "] due to invalid format");
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
package com.alttd.playershops.utils;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
package com.alttd.playershops.utils;
|
||||
|
||||
import com.alttd.playershops.gui.GuiIcon;
|
||||
import com.alttd.playershops.shop.PlayerShop;
|
||||
import com.alttd.playershops.shop.ShopTransaction;
|
||||
import lombok.extern.java.Log;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
|
|
@ -13,7 +11,6 @@ import org.bukkit.*;
|
|||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.ShulkerBox;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Axolotl;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user