mirror of
https://github.com/EarthMC/QuickShop-Reremake.git
synced 2026-11-26 10:29:48 -05:00
Mark the @Nullable and @NotNull
Former-commit-id: 84d7c45ff1ba805904ddb9f0569f4e4b87302ab4 [formerly 7e9facba3d86f967565f6b1d28debedd182b4c79] Former-commit-id: ae19d03b5959d59fdd6c95e2fe0d8a85ccae932b
This commit is contained in:
1 parent
e0a82063b3
commit
cc7940978b
39 files changed
+253
-210
No files matched your search
@@ -2,6 +2,7 @@ package org.maxgamer.quickshop;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
/**
|
||||
* BootError class contains print errors on /qs command when plugin failed launched.
|
||||
@@ -10,7 +11,7 @@ public class BootError {
|
||||
|
||||
private String[] errors;
|
||||
|
||||
BootError(String... errors) {
|
||||
BootError(@NotNull String... errors) {
|
||||
this.errors = errors;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.BlockIterator;
|
||||
import org.jetbrains.annotations.*;
|
||||
import org.maxgamer.quickshop.QuickShop;
|
||||
import org.maxgamer.quickshop.Shop.*;
|
||||
import org.maxgamer.quickshop.Util.MsgUtil;
|
||||
@@ -30,7 +31,7 @@ import org.maxgamer.quickshop.Util.Util;
|
||||
public class QS implements CommandExecutor {
|
||||
private QuickShop plugin;
|
||||
|
||||
public QS(QuickShop plugin) {
|
||||
public QS(@NotNull QuickShop plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ import org.maxgamer.quickshop.Util.MsgUtil;
|
||||
public class Tab implements TabCompleter {
|
||||
private QuickShop plugin;
|
||||
|
||||
public Tab(QuickShop plugin) {
|
||||
public Tab(@NotNull QuickShop plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.jetbrains.annotations.*;
|
||||
import org.maxgamer.quickshop.Util.Util;
|
||||
|
||||
|
||||
@@ -22,7 +23,7 @@ public class BufferStatement {
|
||||
* @param values The values to replace ? with in
|
||||
* query. These are in order.
|
||||
*/
|
||||
public BufferStatement(String query, Object... values) {
|
||||
public BufferStatement(@NotNull String query, @NotNull Object... values) {
|
||||
this.query = query;
|
||||
Util.debugLog(query);
|
||||
this.values = values;
|
||||
@@ -44,7 +45,7 @@ public class BufferStatement {
|
||||
*
|
||||
* @throws SQLException Throw exception when failed execute somethins on SQL
|
||||
*/
|
||||
public PreparedStatement prepareStatement(Connection con) throws SQLException {
|
||||
public PreparedStatement prepareStatement(@NotNull Connection con) throws SQLException {
|
||||
PreparedStatement ps;
|
||||
Util.debugLog(query);
|
||||
ps = con.prepareStatement(query);
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.jetbrains.annotations.*;
|
||||
import org.maxgamer.quickshop.QuickShop;
|
||||
import org.maxgamer.quickshop.Util.Util;
|
||||
|
||||
@@ -24,7 +25,7 @@ public class Database {
|
||||
* @param core The core for the database, either MySQL or SQLite.
|
||||
* @throws ConnectionException If the connection was invalid
|
||||
*/
|
||||
public Database(DatabaseCore core) throws ConnectionException {
|
||||
public Database(@NotNull DatabaseCore core) throws ConnectionException {
|
||||
try {
|
||||
try {
|
||||
if (!core.getConnection().isValid(10)) {
|
||||
@@ -64,7 +65,7 @@ public class Database {
|
||||
* @param query The query
|
||||
* @param objs The string values for each ? in the given query.
|
||||
*/
|
||||
public void execute(String query, Object... objs) {
|
||||
public void execute(@NotNull String query, @NotNull Object... objs) {
|
||||
Util.debugLog(query);
|
||||
BufferStatement bs = new BufferStatement(query, objs);
|
||||
core.queue(bs);
|
||||
@@ -77,7 +78,7 @@ public class Database {
|
||||
* @return True if the table is found
|
||||
* @throws SQLException Throw exception when failed execute somethins on SQL
|
||||
*/
|
||||
public boolean hasTable(String table) throws SQLException {
|
||||
public boolean hasTable(@NotNull String table) throws SQLException {
|
||||
ResultSet rs = getConnection().getMetaData().getTables(null, null, "%", null);
|
||||
while (rs.next()) {
|
||||
if (table.equalsIgnoreCase(rs.getString("TABLE_NAME"))) {
|
||||
@@ -104,7 +105,7 @@ public class Database {
|
||||
* @return True if the given table has the given column
|
||||
* @throws SQLException If the database isn't connected
|
||||
*/
|
||||
public boolean hasColumn(String table, String column) throws SQLException {
|
||||
public boolean hasColumn(@NotNull String table, @NotNull String column) throws SQLException {
|
||||
if (!hasTable(table))
|
||||
return false;
|
||||
String query = "SELECT * FROM " + table + " LIMIT 0,1";
|
||||
@@ -145,7 +146,7 @@ public class Database {
|
||||
* @param db The database to copy data to
|
||||
* @throws SQLException if an error occurs.
|
||||
*/
|
||||
public void copyTo(Database db) throws SQLException {
|
||||
public void copyTo(@NotNull Database db) throws SQLException {
|
||||
ResultSet rs = getConnection().getMetaData().getTables(null, null, "%", null);
|
||||
List<String> tables = new LinkedList<String>();
|
||||
while (rs.next()) {
|
||||
|
||||
@@ -9,6 +9,7 @@ import java.util.UUID;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.*;
|
||||
import org.maxgamer.quickshop.QuickShop;
|
||||
import org.maxgamer.quickshop.Util.Util;
|
||||
|
||||
@@ -37,7 +38,7 @@ public class DatabaseHelper {
|
||||
* Verifies that all required columns exist.
|
||||
* @param db The database you want to check
|
||||
*/
|
||||
private void checkColumns(Database db) {
|
||||
private void checkColumns(@NotNull Database db) {
|
||||
PreparedStatement ps = null;
|
||||
try {
|
||||
// V3.4.2
|
||||
@@ -63,7 +64,7 @@ public class DatabaseHelper {
|
||||
* @param db The database you want create at.
|
||||
* @throws SQLException If the connection is invalid.
|
||||
*/
|
||||
public void createShopsTable(Database db) throws SQLException {
|
||||
public void createShopsTable(@NotNull Database db) throws SQLException {
|
||||
Statement st = db.getConnection().createStatement();
|
||||
String createTable = null;
|
||||
createTable = "CREATE TABLE " + QuickShop.instance
|
||||
@@ -78,7 +79,7 @@ public class DatabaseHelper {
|
||||
* @return Create failed or successed.
|
||||
* @throws SQLException If the connection is invalid
|
||||
*/
|
||||
public boolean createMessagesTable(Database db) throws SQLException {
|
||||
public boolean createMessagesTable(@NotNull Database db) throws SQLException {
|
||||
Statement st = db.getConnection().createStatement();
|
||||
String createTable = null;
|
||||
createTable = "CREATE TABLE " + QuickShop.instance.getDbPrefix()
|
||||
@@ -98,7 +99,7 @@ public class DatabaseHelper {
|
||||
return st.executeQuery(selectAllShops);
|
||||
}
|
||||
|
||||
public boolean removeShop(Database db, int x, int y, int z, String worldName) throws SQLException {
|
||||
public boolean removeShop(@NotNull Database db, int x, int y, int z, @NotNull String worldName) throws SQLException {
|
||||
// db.getConnection().createStatement()
|
||||
// .executeUpdate("DELETE FROM " + QuickShop.instance.getDbPrefix() + "shops WHERE x = " + x + " AND y = " + y
|
||||
// + " AND z = " + z + " AND world = \"" + worldName + "\""
|
||||
@@ -116,7 +117,7 @@ public class DatabaseHelper {
|
||||
return ps.execute();
|
||||
}
|
||||
|
||||
public void updateOwner2UUID(Database db, String ownerUUID, int x, int y, int z, String worldName)
|
||||
public void updateOwner2UUID(@NotNull Database db, @NotNull String ownerUUID, int x, int y, int z, @NotNull String worldName)
|
||||
throws SQLException {
|
||||
//QuickShop.instance.getDB().getConnection().createStatement()
|
||||
// .executeUpdate("UPDATE " + QuickShop.instance.getDbPrefix() + "shops SET owner = \"" + ownerUUID.toString()
|
||||
@@ -134,7 +135,7 @@ public class DatabaseHelper {
|
||||
plugin.getDatabaseManager().add(ps);
|
||||
}
|
||||
|
||||
public void updateShop(Database db, String owner, ItemStack item, int unlimited, int shopType,
|
||||
public void updateShop(@NotNull Database db, @NotNull String owner, @NotNull ItemStack item, int unlimited, int shopType,
|
||||
double price, int x, int y, int z, String world) {
|
||||
try {
|
||||
String sqlString = "UPDATE " + QuickShop.instance
|
||||
@@ -157,7 +158,7 @@ public class DatabaseHelper {
|
||||
|
||||
}
|
||||
|
||||
public void createShop(Database db, String owner, double price, ItemStack item, int unlimited, int shopType, String world, int x, int y, int z) {
|
||||
public void createShop(@NotNull Database db, @NotNull String owner, double price, @NotNull ItemStack item, int unlimited, int shopType, @NotNull String world, int x, int y, int z) {
|
||||
try {
|
||||
String sqlString = "INSERT INTO " + QuickShop.instance
|
||||
.getDbPrefix() + "shops (owner, price, itemConfig, x, y, z, world, unlimited, type) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
@@ -178,7 +179,7 @@ public class DatabaseHelper {
|
||||
}
|
||||
}
|
||||
|
||||
public void sendMessage(Database db, UUID player, String message, long time) {
|
||||
public void sendMessage(@NotNull Database db, @NotNull UUID player, @NotNull String message, long time) {
|
||||
try {
|
||||
String sqlString = "INSERT INTO " + QuickShop.instance
|
||||
.getDbPrefix() + "messages (owner, message, time) VALUES (?, ?, ?)";
|
||||
@@ -193,7 +194,7 @@ public class DatabaseHelper {
|
||||
}
|
||||
}
|
||||
|
||||
public void cleanMessage(Database db, long weekAgo) {
|
||||
public void cleanMessage(@NotNull Database db, long weekAgo) {
|
||||
try {
|
||||
//QuickShop.instance.getDB().execute("DELETE FROM " + QuickShop.instance
|
||||
// .getDbPrefix() + "messages WHERE time < ?", weekAgo);
|
||||
@@ -207,7 +208,7 @@ public class DatabaseHelper {
|
||||
}
|
||||
}
|
||||
|
||||
public void cleanMessageForPlayer(Database db, UUID player) {
|
||||
public void cleanMessageForPlayer(@NotNull Database db, @NotNull UUID player) {
|
||||
try {
|
||||
String sqlString = "DELETE FROM " + QuickShop.instance.getDbPrefix() + "messages WHERE owner = ?";
|
||||
PreparedStatement ps = db.getConnection().prepareStatement(sqlString);
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.concurrent.LinkedBlockingQueue;
|
||||
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
import org.jetbrains.annotations.*;
|
||||
import org.maxgamer.quickshop.QuickShop;
|
||||
import org.maxgamer.quickshop.Util.Util;
|
||||
|
||||
@@ -28,7 +29,7 @@ public class DatabaseManager {
|
||||
* @param plugin plugin main class
|
||||
* @param db database
|
||||
*/
|
||||
public DatabaseManager(QuickShop plugin, Database db) {
|
||||
public DatabaseManager(@NotNull QuickShop plugin, @NotNull Database db) {
|
||||
this.plugin = plugin;
|
||||
this.database = db;
|
||||
this.useQueue = plugin.getConfig().getBoolean("database.queue");
|
||||
@@ -82,7 +83,7 @@ public class DatabaseManager {
|
||||
* Add preparedStatement to queue waiting flush to database,
|
||||
* @param ps The ps you want add in queue.
|
||||
*/
|
||||
public void add(PreparedStatement ps) {
|
||||
public void add(@NotNull PreparedStatement ps) {
|
||||
if (useQueue) {
|
||||
sqlQueue.offer(ps);
|
||||
} else {
|
||||
|
||||
@@ -7,6 +7,8 @@ import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
public class MySQLCore implements DatabaseCore {
|
||||
private String url;
|
||||
/** The connection properties... user, pass, autoReconnect.. */
|
||||
@@ -14,7 +16,7 @@ public class MySQLCore implements DatabaseCore {
|
||||
private static final int MAX_CONNECTIONS = 8;
|
||||
private static ArrayList<Connection> pool = new ArrayList<Connection>();
|
||||
|
||||
public MySQLCore(String host, String user, String pass, String database, String port, boolean useSSL) {
|
||||
public MySQLCore(@NotNull String host, @NotNull String user, @NotNull String pass, @NotNull String database, @NotNull String port, boolean useSSL) {
|
||||
info = new Properties();
|
||||
info.setProperty("autoReconnect", "true");
|
||||
info.setProperty("user", user);
|
||||
@@ -54,7 +56,7 @@ public class MySQLCore implements DatabaseCore {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void queue(BufferStatement bs) {
|
||||
public void queue(@NotNull BufferStatement bs) {
|
||||
try {
|
||||
Connection con = this.getConnection();
|
||||
while (con == null) {
|
||||
|
||||
@@ -8,13 +8,15 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
public class SQLiteCore implements DatabaseCore {
|
||||
private Connection connection;
|
||||
private File dbFile;
|
||||
private volatile Thread watcher;
|
||||
private volatile LinkedList<BufferStatement> queue = new LinkedList<BufferStatement>();
|
||||
private final LinkedList<BufferStatement> queue = new LinkedList<BufferStatement>();
|
||||
|
||||
public SQLiteCore(File dbFile) {
|
||||
public SQLiteCore(@NotNull File dbFile) {
|
||||
this.dbFile = dbFile;
|
||||
}
|
||||
|
||||
@@ -61,7 +63,7 @@ public class SQLiteCore implements DatabaseCore {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void queue(BufferStatement bs) {
|
||||
public void queue(@NotNull BufferStatement bs) {
|
||||
synchronized (queue) {
|
||||
queue.add(bs);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.maxgamer.quickshop.Economy;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.jetbrains.annotations.*;
|
||||
import org.maxgamer.quickshop.Util.Util;
|
||||
|
||||
public class Economy implements EconomyCore {
|
||||
@@ -38,22 +39,22 @@ public class Economy implements EconomyCore {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deposit(UUID name, double amount) {
|
||||
public boolean deposit(@NotNull UUID name, double amount) {
|
||||
return core.deposit(name, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean withdraw(UUID name, double amount) {
|
||||
public boolean withdraw(@NotNull UUID name, double amount) {
|
||||
return core.withdraw(name, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean transfer(UUID from, UUID to, double amount) {
|
||||
public boolean transfer(@NotNull UUID from, UUID to, double amount) {
|
||||
return core.transfer(from, to, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBalance(UUID name) {
|
||||
public double getBalance(@NotNull UUID name) {
|
||||
return core.getBalance(name);
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import net.milkbowl.vault.economy.Economy;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
import org.jetbrains.annotations.*;
|
||||
import org.maxgamer.quickshop.QuickShop;
|
||||
import org.maxgamer.quickshop.Util.Util;
|
||||
|
||||
@@ -37,21 +38,21 @@ public class Economy_Vault implements EconomyCore {
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public boolean deposit(String name, double amount) {
|
||||
public boolean deposit(@NotNull String name, double amount) {
|
||||
Util.sendDeprecatedMethodWarn();
|
||||
boolean result = this.vault.depositPlayer(name, amount).transactionSuccess();
|
||||
return result;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public boolean withdraw(String name, double amount) {
|
||||
public boolean withdraw(@NotNull String name, double amount) {
|
||||
Util.sendDeprecatedMethodWarn();
|
||||
boolean result = this.vault.withdrawPlayer(name, amount).transactionSuccess();
|
||||
return result;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public boolean transfer(String from, String to, double amount) {
|
||||
public boolean transfer(@NotNull String from, @NotNull String to, double amount) {
|
||||
Util.sendDeprecatedMethodWarn();
|
||||
if (this.vault.getBalance(from) >= amount) {
|
||||
if (this.vault.withdrawPlayer(from, amount).transactionSuccess()) {
|
||||
@@ -67,7 +68,7 @@ public class Economy_Vault implements EconomyCore {
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public double getBalance(String name) {
|
||||
public double getBalance(@NotNull String name) {
|
||||
Util.sendDeprecatedMethodWarn();
|
||||
return this.vault.getBalance(name);
|
||||
}
|
||||
@@ -94,21 +95,21 @@ public class Economy_Vault implements EconomyCore {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deposit(UUID name, double amount) {
|
||||
public boolean deposit(@NotNull UUID name, double amount) {
|
||||
OfflinePlayer p = Bukkit.getOfflinePlayer(name);
|
||||
boolean result = this.vault.depositPlayer(p, amount).transactionSuccess();
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean withdraw(UUID name, double amount) {
|
||||
public boolean withdraw(@NotNull UUID name, double amount) {
|
||||
OfflinePlayer p = Bukkit.getOfflinePlayer(name);
|
||||
boolean result = this.vault.withdrawPlayer(p, amount).transactionSuccess();
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean transfer(UUID from, UUID to, double amount) {
|
||||
public boolean transfer(@NotNull UUID from, @NotNull UUID to, double amount) {
|
||||
OfflinePlayer pFrom = Bukkit.getOfflinePlayer(from);
|
||||
OfflinePlayer pTo = Bukkit.getOfflinePlayer(to);
|
||||
if (this.vault.getBalance(pFrom) >= amount) {
|
||||
@@ -125,7 +126,7 @@ public class Economy_Vault implements EconomyCore {
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBalance(UUID name) {
|
||||
public double getBalance(@NotNull UUID name) {
|
||||
OfflinePlayer p = Bukkit.getOfflinePlayer(name);
|
||||
return this.vault.getBalance(p);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.jetbrains.annotations.*;
|
||||
import org.maxgamer.quickshop.Util.Util;
|
||||
|
||||
public class Language {
|
||||
@@ -42,7 +42,7 @@ public class Language {
|
||||
* @param type The file type for you want get. e.g. messages
|
||||
* @return The target file's InputStream.
|
||||
*/
|
||||
public InputStream getFile(String language, String type) {
|
||||
public InputStream getFile(@Nullable String language, @Nullable String type) {
|
||||
if ((language == null)) {
|
||||
language = "en";
|
||||
Util.debugLog("Use default language cause language is null.");
|
||||
@@ -67,8 +67,8 @@ public class Language {
|
||||
* @param type Target type
|
||||
* @param fileName The filename you want write to the plugin datafolder.
|
||||
*/
|
||||
public void saveFile(String language, String type, String fileName) {
|
||||
File targetFile = new File(Bukkit.getPluginManager().getPlugin(plugin.getName()).getDataFolder()
|
||||
public void saveFile(@NotNull String language, @NotNull String type, @NotNull String fileName) {
|
||||
File targetFile = new File(plugin.getDataFolder()
|
||||
.toPath() + "/" + fileName);
|
||||
if (!targetFile.exists()) {
|
||||
try {
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
import org.jetbrains.annotations.*;
|
||||
import org.maxgamer.quickshop.Command.QS;
|
||||
import org.maxgamer.quickshop.Command.Tab;
|
||||
import org.maxgamer.quickshop.Database.*;
|
||||
@@ -119,7 +120,7 @@ public class QuickShop extends JavaPlugin {
|
||||
* @param p The player you want get limit.
|
||||
* @return int Player's shop limit
|
||||
*/
|
||||
public int getShopLimit(Player p) {
|
||||
public int getShopLimit(@NotNull Player p) {
|
||||
int max = getConfig().getInt("limits.default");
|
||||
for (Entry<String, Integer> entry : limits.entrySet()) {
|
||||
if (entry.getValue() > max && p.hasPermission(entry.getKey()))
|
||||
@@ -822,7 +823,7 @@ public class QuickShop extends JavaPlugin {
|
||||
*
|
||||
* @param s The string to log. It will be prefixed with the date and time.
|
||||
*/
|
||||
public void log(String s) {
|
||||
public void log(@NotNull String s) {
|
||||
if (this.logWatcher == null)
|
||||
return;
|
||||
Date date = Calendar.getInstance().getTime();
|
||||
|
||||
@@ -10,6 +10,7 @@ import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.EulerAngle;
|
||||
import org.jetbrains.annotations.*;
|
||||
import org.maxgamer.quickshop.QuickShop;
|
||||
import org.maxgamer.quickshop.Util.Util;
|
||||
|
||||
@@ -20,7 +21,7 @@ public class ArmorStandDisplayItem implements DisplayItem {
|
||||
private ArmorStand armorStand;
|
||||
private Shop shop;
|
||||
|
||||
public ArmorStandDisplayItem(Shop shop) {
|
||||
public ArmorStandDisplayItem(@NotNull Shop shop) {
|
||||
this.shop = shop;
|
||||
this.originalItemStack = shop.getItem().clone();
|
||||
}
|
||||
@@ -73,7 +74,7 @@ public class ArmorStandDisplayItem implements DisplayItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void safeGuard(Entity entity) {
|
||||
public void safeGuard(@NotNull Entity entity) {
|
||||
if (entity == null) {
|
||||
Util.debugLog("Failed to safeGuard the NULL, somethings given a wrong args.");
|
||||
}
|
||||
@@ -139,7 +140,7 @@ public class ArmorStandDisplayItem implements DisplayItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkIsShopEntity(Entity entity) {
|
||||
public boolean checkIsShopEntity(@NotNull Entity entity) {
|
||||
if (!(entity instanceof ArmorStand))
|
||||
return false;
|
||||
return DisplayItem.checkIsGuardItemStack(((ArmorStand) entity).getItemInHand());
|
||||
|
||||
@@ -21,6 +21,7 @@ import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.Damageable;
|
||||
import org.jetbrains.annotations.*;
|
||||
import org.maxgamer.quickshop.QuickShop;
|
||||
import org.maxgamer.quickshop.Util.MsgUtil;
|
||||
import org.maxgamer.quickshop.Util.Util;
|
||||
@@ -50,7 +51,7 @@ public class ContainerShop implements Shop {
|
||||
return new ContainerShop(this);
|
||||
}
|
||||
|
||||
private ContainerShop(ContainerShop s) {
|
||||
private ContainerShop(@NotNull ContainerShop s) {
|
||||
this.displayItem = s.displayItem;
|
||||
this.shopType = s.shopType;
|
||||
this.item = s.item;
|
||||
@@ -72,7 +73,7 @@ public class ContainerShop implements Shop {
|
||||
* @param type The shop type
|
||||
* @param unlimited The unlimited
|
||||
*/
|
||||
public ContainerShop(Location loc, double price, ItemStack item, ShopModerator moderator, boolean unlimited, ShopType type) {
|
||||
public ContainerShop(@NotNull Location loc, double price, @NotNull ItemStack item, @NotNull ShopModerator moderator, boolean unlimited, @NotNull ShopType type) {
|
||||
this.loc = loc;
|
||||
this.price = price;
|
||||
this.moderator = moderator;
|
||||
@@ -129,7 +130,7 @@ public class ContainerShop implements Shop {
|
||||
* @param item The ItemStack
|
||||
* @return True if the ItemStack is the same (Excludes amounts)
|
||||
*/
|
||||
public boolean matches(ItemStack item) {
|
||||
public boolean matches(@Nullable ItemStack item) {
|
||||
return plugin.getItemMatcher().matches(this.item, item);
|
||||
}
|
||||
|
||||
@@ -275,14 +276,14 @@ public class ContainerShop implements Shop {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addStaff(UUID player) {
|
||||
public boolean addStaff(@NotNull UUID player) {
|
||||
boolean result = this.moderator.addStaff(player);
|
||||
update();
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean delStaff(UUID player) {
|
||||
public boolean delStaff(@NotNull UUID player) {
|
||||
boolean result = this.moderator.delStaff(player);
|
||||
update();
|
||||
return result;
|
||||
@@ -315,7 +316,7 @@ public class ContainerShop implements Shop {
|
||||
* else
|
||||
* @param amount The amount to remove from the shop.
|
||||
*/
|
||||
public void remove(ItemStack item, int amount) {
|
||||
public void remove(@NotNull ItemStack item, @NotNull int amount) {
|
||||
if (this.unlimited)
|
||||
return;
|
||||
Inventory inv = this.getInventory();
|
||||
@@ -336,7 +337,7 @@ public class ContainerShop implements Shop {
|
||||
* else
|
||||
* @param amount The amount to add to the shop.
|
||||
*/
|
||||
public void add(ItemStack item, int amount) {
|
||||
public void add(@NotNull ItemStack item, @NotNull int amount) {
|
||||
if (this.unlimited)
|
||||
return;
|
||||
Inventory inv = this.getInventory();
|
||||
@@ -357,7 +358,7 @@ public class ContainerShop implements Shop {
|
||||
* @param p The player to sell to
|
||||
* @param amount The amount to sell
|
||||
*/
|
||||
public void sell(Player p, int amount) {
|
||||
public void sell(@NotNull Player p, @NotNull int amount) {
|
||||
if (amount < 0)
|
||||
this.buy(p, -amount);
|
||||
// Items to drop on floor
|
||||
@@ -409,7 +410,7 @@ public class ContainerShop implements Shop {
|
||||
* @param p The player to buy from
|
||||
* @param amount The amount to buy
|
||||
*/
|
||||
public void buy(Player p, int amount) {
|
||||
public void buy(@NotNull Player p, @NotNull int amount) {
|
||||
if (amount < 0)
|
||||
this.sell(p, -amount);
|
||||
if (this.isUnlimited()) {
|
||||
@@ -465,7 +466,7 @@ public class ContainerShop implements Shop {
|
||||
*
|
||||
* @param owner the new owner
|
||||
*/
|
||||
public void setOwner(UUID owner) {
|
||||
public void setOwner(@NotNull UUID owner) {
|
||||
this.moderator.setOwner(owner);
|
||||
this.setSignText();
|
||||
update();
|
||||
@@ -507,7 +508,7 @@ public class ContainerShop implements Shop {
|
||||
*
|
||||
* @param shopType The new type (ShopType.BUYING or ShopType.SELLING)
|
||||
*/
|
||||
public void setShopType(ShopType shopType) {
|
||||
public void setShopType(@NotNull ShopType shopType) {
|
||||
this.shopType = shopType;
|
||||
this.setSignText();
|
||||
update();
|
||||
@@ -547,7 +548,7 @@ public class ContainerShop implements Shop {
|
||||
*
|
||||
* @param lines The array of lines to change. Index is line number.
|
||||
*/
|
||||
public void setSignText(String[] lines) {
|
||||
public void setSignText(@NotNull String[] lines) {
|
||||
for (Sign sign : this.getSigns()) {
|
||||
if (sign.getLines().equals(lines)) {
|
||||
Util.debugLog("Skipped new sign text setup: Same content");
|
||||
@@ -609,7 +610,7 @@ public class ContainerShop implements Shop {
|
||||
return signs;
|
||||
}
|
||||
|
||||
public boolean isAttached(Block b) {
|
||||
public boolean isAttached(@NotNull Block b) {
|
||||
return this.getLocation().getBlock().equals(Util.getAttached(b));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package org.maxgamer.quickshop.Shop;
|
||||
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
public enum DisplayType {
|
||||
UNKNOWN(-1), REALITEM(0), ARMORSTAND(1), VIRTUALITEM(2);
|
||||
private int id;
|
||||
@@ -17,7 +19,7 @@ public enum DisplayType {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int toID(DisplayType displayType) {
|
||||
public static int toID(@NotNull DisplayType displayType) {
|
||||
return displayType.id;
|
||||
}
|
||||
|
||||
@@ -25,7 +27,7 @@ public enum DisplayType {
|
||||
return id;
|
||||
}
|
||||
|
||||
public static DisplayType typeIs(DisplayItem displayItem) {
|
||||
public static DisplayType typeIs(@Nullable DisplayItem displayItem) {
|
||||
if (displayItem instanceof RealDisplayItem)
|
||||
return REALITEM;
|
||||
if (displayItem instanceof ArmorStandDisplayItem)
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.maxgamer.quickshop.Shop;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
/**
|
||||
* A class contains shop's infomations
|
||||
@@ -14,23 +15,23 @@ public class Info {
|
||||
private Block last;
|
||||
private Shop shop;
|
||||
|
||||
public Info(Location loc, ShopAction action, ItemStack item, Block last) {
|
||||
public Info(@NotNull Location loc, @NotNull ShopAction action, @NotNull ItemStack item, @NotNull Block last) {
|
||||
this.loc = loc;
|
||||
this.action = action;
|
||||
this.last = last;
|
||||
if (item != null)
|
||||
this.item = item.clone();
|
||||
// if (item != null)
|
||||
this.item = item.clone();
|
||||
}
|
||||
|
||||
public Info(Location loc, ShopAction action, ItemStack item, Block last, Shop shop) {
|
||||
public Info(@NotNull Location loc, @NotNull ShopAction action, @NotNull ItemStack item, @NotNull Block last, @NotNull Shop shop) {
|
||||
this.loc = loc;
|
||||
this.action = action;
|
||||
this.last = last;
|
||||
if (item != null)
|
||||
// if (item != null)
|
||||
this.item = item.clone();
|
||||
if (shop != null) {
|
||||
// if (shop != null) {
|
||||
this.shop = shop.clone();
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -39,7 +40,7 @@ public class Info {
|
||||
* @param shop, The need checked with this shop.
|
||||
* @return hasChanged
|
||||
*/
|
||||
public boolean hasChanged(Shop shop) {
|
||||
public boolean hasChanged(@NotNull Shop shop) {
|
||||
if (this.shop.isUnlimited() != shop.isUnlimited())
|
||||
return true;
|
||||
if (this.shop.getShopType() != shop.getShopType())
|
||||
|
||||
@@ -10,6 +10,7 @@ import org.bukkit.event.Listener;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.jetbrains.annotations.*;
|
||||
import org.maxgamer.quickshop.Util.MsgUtil;
|
||||
|
||||
/**
|
||||
@@ -27,7 +28,7 @@ public class InventoryPreview implements Listener {
|
||||
* @param itemStack The item you want create.
|
||||
* @param player Target player.
|
||||
*/
|
||||
public InventoryPreview(ItemStack itemStack, Player player) {
|
||||
public InventoryPreview(@NotNull ItemStack itemStack, @NotNull Player player) {
|
||||
this.itemStack = itemStack.clone();
|
||||
this.player = player;
|
||||
if (this.itemStack.getItemMeta().hasLore()) {
|
||||
@@ -74,7 +75,7 @@ public class InventoryPreview implements Listener {
|
||||
inventory = null; // Destory
|
||||
}
|
||||
|
||||
public static boolean isPreviewItem(ItemStack stack) {
|
||||
public static boolean isPreviewItem(@Nullable ItemStack stack) {
|
||||
if (stack == null)
|
||||
return false;
|
||||
if (!stack.hasItemMeta() || !stack.getItemMeta().hasLore())
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.maxgamer.quickshop.Shop;
|
||||
|
||||
import lombok.*;
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@@ -18,7 +19,7 @@ public class QueueShopObject {
|
||||
* @param shop The shop
|
||||
* @param action The action you want to do for the shop.
|
||||
*/
|
||||
public QueueShopObject(Shop shop, QueueAction... action) {
|
||||
public QueueShopObject(@NotNull Shop shop, @NotNull QueueAction... action) {
|
||||
this.shop = shop;
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.concurrent.LinkedBlockingQueue;
|
||||
import lombok.*;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
import org.jetbrains.annotations.*;
|
||||
import org.maxgamer.quickshop.QuickShop;
|
||||
import org.maxgamer.quickshop.Util.Util;
|
||||
|
||||
@@ -27,7 +28,7 @@ public class QueuedShopManager {
|
||||
*
|
||||
* @param quickshop plugin main class
|
||||
*/
|
||||
public QueuedShopManager(QuickShop quickshop) {
|
||||
public QueuedShopManager(@NotNull QuickShop quickshop) {
|
||||
this.plugin = quickshop;
|
||||
this.useQueue = plugin.getConfig().getBoolean("queue.enable");
|
||||
if (!useQueue)
|
||||
@@ -75,9 +76,9 @@ public class QueuedShopManager {
|
||||
* Run a queuedShopObject.
|
||||
* @param queueShopObject queueShopObject
|
||||
*/
|
||||
private void doTask(QueueShopObject queueShopObject) {
|
||||
if (queueShopObject == null) //No more queue need to do
|
||||
return; //Jump out, go next tick
|
||||
private void doTask(@NotNull QueueShopObject queueShopObject) {
|
||||
// if (queueShopObject == null) //No more queue need to do
|
||||
// return; //Jump out, go next tick
|
||||
QueueAction[] actions = queueShopObject.getAction();
|
||||
for (QueueAction action : actions) { //Run actions.
|
||||
Util.debugLog("Execute action " + action.name() + " for shop at " + queueShopObject.getShop().getLocation()
|
||||
@@ -118,7 +119,7 @@ public class QueuedShopManager {
|
||||
*
|
||||
* @param queueShopObjects target object you want add
|
||||
*/
|
||||
public void add(QueueShopObject... queueShopObjects) {
|
||||
public void add(@NotNull QueueShopObject... queueShopObjects) {
|
||||
for (QueueShopObject queueShopObject : queueShopObjects) {
|
||||
if (useQueue) {
|
||||
this.shopQueue.offer(queueShopObject);
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
import org.jetbrains.annotations.*;
|
||||
import org.maxgamer.quickshop.QuickShop;
|
||||
import org.maxgamer.quickshop.Util.Util;
|
||||
|
||||
@@ -23,7 +24,7 @@ public class RealDisplayItem implements DisplayItem {
|
||||
*
|
||||
* @param shop The shop (See Shop)
|
||||
*/
|
||||
public RealDisplayItem(Shop shop) {
|
||||
public RealDisplayItem(@NotNull Shop shop) {
|
||||
this.shop = shop;
|
||||
this.originalItemStack = shop.getItem().clone();
|
||||
|
||||
@@ -66,7 +67,7 @@ public class RealDisplayItem implements DisplayItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void safeGuard(Entity entity) {
|
||||
public void safeGuard(@NotNull Entity entity) {
|
||||
if (entity == null) {
|
||||
Util.debugLog("Failed to safeGuard the NULL, somethings given a wrong args.");
|
||||
}
|
||||
@@ -128,7 +129,7 @@ public class RealDisplayItem implements DisplayItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkIsShopEntity(Entity entity) {
|
||||
public boolean checkIsShopEntity(@NotNull Entity entity) {
|
||||
if (!(entity instanceof Item))
|
||||
return false;
|
||||
return DisplayItem.checkIsGuardItemStack(((Item) entity).getItemStack());
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.maxgamer.quickshop.Shop;
|
||||
|
||||
import lombok.*;
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
@Getter
|
||||
public class ShopChunk {
|
||||
@@ -9,7 +10,7 @@ public class ShopChunk {
|
||||
private int z;
|
||||
private int hash = 0;
|
||||
|
||||
public ShopChunk(String world, int x, int z) {
|
||||
public ShopChunk(@NotNull String world, int x, int z) {
|
||||
this.world = world;
|
||||
this.x = x;
|
||||
this.z = z;
|
||||
@@ -19,7 +20,7 @@ public class ShopChunk {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
public boolean equals(@NotNull Object obj) {
|
||||
if (obj.getClass() != this.getClass()) {
|
||||
return false;
|
||||
} else {
|
||||
|
||||
@@ -32,7 +32,7 @@ public class ShopLoader {
|
||||
*
|
||||
* @param plugin Plugin main class
|
||||
*/
|
||||
public ShopLoader(QuickShop plugin) {
|
||||
public ShopLoader(@NotNull QuickShop plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@@ -260,7 +260,7 @@ public class ShopLoader {
|
||||
Util.debugLog("Loaded shop used time " + singleShopLoadTime + "ms");
|
||||
}
|
||||
|
||||
private boolean shopNullCheck(Shop shop) {
|
||||
private boolean shopNullCheck(@Nullable Shop shop) {
|
||||
if (shop == null) {
|
||||
Util.debugLog("Shop Object is null");
|
||||
return true;
|
||||
@@ -288,7 +288,7 @@ public class ShopLoader {
|
||||
return false;
|
||||
}
|
||||
|
||||
private void exceptionHandler(Exception ex, Location shopLocation) {
|
||||
private void exceptionHandler(@NotNull Exception ex, @Nullable Location shopLocation) {
|
||||
errors++;
|
||||
Logger logger = plugin.getLogger();
|
||||
logger.warning("##########FAILED TO LOAD SHOP##########");
|
||||
@@ -391,7 +391,7 @@ public class ShopLoader {
|
||||
}
|
||||
}
|
||||
|
||||
private ItemStack deserializeItem(String itemConfig) {
|
||||
private ItemStack deserializeItem(@NotNull String itemConfig) {
|
||||
try {
|
||||
return Util.deserialize(itemConfig);
|
||||
} catch (InvalidConfigurationException e) {
|
||||
@@ -402,7 +402,7 @@ public class ShopLoader {
|
||||
}
|
||||
}
|
||||
|
||||
private ShopModerator deserializeModerator(String moderatorJson) {
|
||||
private ShopModerator deserializeModerator(@NotNull String moderatorJson) {
|
||||
// try {
|
||||
// UUID.fromString(moderators);
|
||||
// if (!isBackuped) {
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.RegisteredListener;
|
||||
import org.jetbrains.annotations.*;
|
||||
import org.maxgamer.quickshop.QuickShop;
|
||||
import org.maxgamer.quickshop.Util.MsgUtil;
|
||||
import org.maxgamer.quickshop.Util.Util;
|
||||
@@ -29,7 +30,7 @@ public class ShopManager {
|
||||
private HashMap<String, HashMap<ShopChunk, HashMap<Location, Shop>>> shops = new HashMap<String, HashMap<ShopChunk, HashMap<Location, Shop>>>();
|
||||
final private static ItemStack AIR = new ItemStack(Material.AIR);
|
||||
|
||||
public ShopManager(QuickShop plugin) {
|
||||
public ShopManager(@NotNull QuickShop plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@@ -47,7 +48,7 @@ public class ShopManager {
|
||||
* @param shop The shop object
|
||||
* @param info The info object
|
||||
*/
|
||||
public void createShop(Shop shop, Info info) {
|
||||
public void createShop(@NotNull Shop shop, @NotNull Info info) {
|
||||
ShopCreateEvent ssShopCreateEvent = new ShopCreateEvent(shop, Bukkit.getPlayer(shop.getOwner()));
|
||||
Bukkit.getPluginManager().callEvent(ssShopCreateEvent);
|
||||
if (ssShopCreateEvent.isCancelled()) {
|
||||
@@ -122,7 +123,7 @@ public class ShopManager {
|
||||
* @param world The world the shop is in
|
||||
* @param shop The shop to load
|
||||
*/
|
||||
public void loadShop(String world, Shop shop) {
|
||||
public void loadShop(@NotNull String world, @NotNull Shop shop) {
|
||||
this.addShop(world, shop);
|
||||
}
|
||||
|
||||
@@ -142,7 +143,7 @@ public class ShopManager {
|
||||
* shops from
|
||||
* @return a hashmap of Chunk - Shop
|
||||
*/
|
||||
public HashMap<ShopChunk, HashMap<Location, Shop>> getShops(String world) {
|
||||
public HashMap<ShopChunk, HashMap<Location, Shop>> getShops(@NotNull String world) {
|
||||
return this.shops.get(world);
|
||||
}
|
||||
|
||||
@@ -153,7 +154,7 @@ public class ShopManager {
|
||||
* coordinates and world are used.
|
||||
* @return Shops
|
||||
*/
|
||||
public HashMap<Location, Shop> getShops(Chunk c) {
|
||||
public HashMap<Location, Shop> getShops(@NotNull Chunk c) {
|
||||
// long start = System.nanoTime();
|
||||
HashMap<Location, Shop> shops = getShops(c.getWorld().getName(), c.getX(), c.getZ());
|
||||
// long end = System.nanoTime();
|
||||
@@ -177,7 +178,7 @@ public class ShopManager {
|
||||
* @param loc The location to get the shop from
|
||||
* @return The shop at that location
|
||||
*/
|
||||
public Shop getShop(Location loc) {
|
||||
public Shop getShop(@NotNull Location loc) {
|
||||
HashMap<Location, Shop> inChunk = getShops(loc.getChunk());
|
||||
if (inChunk == null) {
|
||||
return null;
|
||||
@@ -193,7 +194,7 @@ public class ShopManager {
|
||||
* @param world The name of the world
|
||||
* @param shop The shop to add
|
||||
*/
|
||||
private void addShop(String world, Shop shop) {
|
||||
private void addShop(@NotNull String world, @NotNull Shop shop) {
|
||||
|
||||
ShopLoadEvent shopLoadEvent = new ShopLoadEvent(shop);
|
||||
Bukkit.getPluginManager().callEvent(shopLoadEvent);
|
||||
@@ -231,7 +232,7 @@ public class ShopManager {
|
||||
*
|
||||
* @param shop The shop to remove
|
||||
*/
|
||||
public void removeShop(Shop shop) {
|
||||
public void removeShop(@NotNull Shop shop) {
|
||||
ShopUnloadEvent shopUnloadEvent = new ShopUnloadEvent(shop);
|
||||
Bukkit.getPluginManager().callEvent(shopUnloadEvent);
|
||||
Location loc = shop.getLocation();
|
||||
@@ -274,7 +275,7 @@ public class ShopManager {
|
||||
* @param bf The blockface to check
|
||||
* @return True if they're allowed to place a shop there.
|
||||
*/
|
||||
public boolean canBuildShop(Player p, Block b, BlockFace bf) {
|
||||
public boolean canBuildShop(@NotNull Player p, @NotNull Block b, @NotNull BlockFace bf) {
|
||||
RegisteredListener openInvRegisteredListener = null; // added for compatibility reasons with OpenInv - see https://github.com/KaiKikuchi/QuickShop/issues/139
|
||||
// try {
|
||||
// if (plugin.openInvPlugin != null) {
|
||||
@@ -336,7 +337,7 @@ public class ShopManager {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void handleChat(final Player p, String msg) {
|
||||
public void handleChat(@NotNull Player p, @NotNull String msg) {
|
||||
final String message = ChatColor.stripColor(msg);
|
||||
// Use from the main thread, because Bukkit hates life
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||
@@ -370,7 +371,7 @@ public class ShopManager {
|
||||
});
|
||||
}
|
||||
|
||||
private void actionTrade(Player p, HashMap<UUID, Info> actions, Info info, String message) {
|
||||
private void actionTrade(@NotNull Player p, @NotNull HashMap<UUID, Info> actions, @NotNull Info info, @NotNull String message) {
|
||||
int amount = 0;
|
||||
try {
|
||||
amount = Integer.parseInt(message);
|
||||
@@ -401,7 +402,7 @@ public class ShopManager {
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void actionBuy(Player p, HashMap<UUID, Info> actions2, Info info, String message, Shop shop, int amount) {
|
||||
private void actionBuy(@NotNull Player p, @NotNull HashMap<UUID, Info> actions2, @NotNull Info info, @NotNull String message, @NotNull Shop shop, @NotNull int amount) {
|
||||
int space = shop.getRemainingSpace();
|
||||
if (space == -1)
|
||||
space = 10000;
|
||||
@@ -478,7 +479,7 @@ public class ShopManager {
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void actionSell(Player p, HashMap<UUID, Info> actions2, Info info, String message, Shop shop2, int amount) {
|
||||
private void actionSell(@NotNull Player p, @NotNull HashMap<UUID, Info> actions2, @NotNull Info info, @NotNull String message, @NotNull Shop shop2, @NotNull int amount) {
|
||||
Shop shop = plugin.getShopManager().getShop(info.getLocation());
|
||||
// It's not valid anymore
|
||||
if (shop == null || !Util.canBeShop(info.getLocation().getBlock())) {
|
||||
@@ -574,7 +575,7 @@ public class ShopManager {
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void actionCreate(Player p, HashMap<UUID, Info> actions2, Info info, String message) {
|
||||
private void actionCreate(@NotNull Player p, @NotNull HashMap<UUID, Info> actions2, @NotNull Info info, @NotNull String message) {
|
||||
Util.debugLog("actionCreate");
|
||||
try {
|
||||
// Checking the shop can be created
|
||||
@@ -743,7 +744,7 @@ public class ShopManager {
|
||||
* @param d price
|
||||
* @return formated price
|
||||
*/
|
||||
public String format(double d) {
|
||||
public String format(@NotNull double d) {
|
||||
return plugin.getEcon().format(d);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
/**
|
||||
* Contains shop's moderators infomations, owner, staffs etc.
|
||||
@@ -12,7 +13,7 @@ public class ShopModerator {
|
||||
private UUID owner;
|
||||
private ArrayList<UUID> staffs;
|
||||
|
||||
private ShopModerator(ShopModerator shopModerator) {
|
||||
private ShopModerator(@NotNull ShopModerator shopModerator) {
|
||||
this.owner = shopModerator.owner;
|
||||
this.staffs = shopModerator.staffs;
|
||||
}
|
||||
@@ -22,7 +23,7 @@ public class ShopModerator {
|
||||
*
|
||||
* @param owner The owner
|
||||
*/
|
||||
public ShopModerator(UUID owner) {
|
||||
public ShopModerator(@NotNull UUID owner) {
|
||||
this.owner = owner;
|
||||
this.staffs = new ArrayList<UUID>();
|
||||
}
|
||||
@@ -32,7 +33,7 @@ public class ShopModerator {
|
||||
* @param owner The owner
|
||||
* @param staffs The staffs
|
||||
*/
|
||||
public ShopModerator(UUID owner, ArrayList<UUID> staffs) {
|
||||
public ShopModerator(@NotNull UUID owner, @NotNull ArrayList<UUID> staffs) {
|
||||
this.owner = owner;
|
||||
this.staffs = new ArrayList<UUID>();
|
||||
}
|
||||
@@ -53,7 +54,7 @@ public class ShopModerator {
|
||||
* Set moderators owner (Shop Owner)
|
||||
* @param player Owner's UUID
|
||||
*/
|
||||
public void setOwner(UUID player) {
|
||||
public void setOwner(@NotNull UUID player) {
|
||||
this.owner = player;
|
||||
}
|
||||
|
||||
@@ -61,7 +62,7 @@ public class ShopModerator {
|
||||
* Set moderators staffs
|
||||
* @param players staffs list
|
||||
*/
|
||||
public void setStaffs(ArrayList<UUID> players) {
|
||||
public void setStaffs(@NotNull ArrayList<UUID> players) {
|
||||
this.staffs = players;
|
||||
}
|
||||
|
||||
@@ -70,7 +71,7 @@ public class ShopModerator {
|
||||
* @param player New staff
|
||||
* @return Success
|
||||
*/
|
||||
public boolean addStaff(UUID player) {
|
||||
public boolean addStaff(@NotNull UUID player) {
|
||||
if (staffs.contains(player))
|
||||
return false;
|
||||
staffs.add(player);
|
||||
@@ -82,7 +83,7 @@ public class ShopModerator {
|
||||
* @param player Staff
|
||||
* @return Success
|
||||
*/
|
||||
public boolean delStaff(UUID player) {
|
||||
public boolean delStaff(@NotNull UUID player) {
|
||||
if (!staffs.contains(player))
|
||||
return false;
|
||||
staffs.remove(player);
|
||||
@@ -109,7 +110,7 @@ public class ShopModerator {
|
||||
* @param player Player
|
||||
* @return yes or no
|
||||
*/
|
||||
public boolean isOwner(UUID player) {
|
||||
public boolean isOwner(@NotNull UUID player) {
|
||||
return player.equals(owner);
|
||||
}
|
||||
|
||||
@@ -118,7 +119,7 @@ public class ShopModerator {
|
||||
* @param player Player
|
||||
* @return yes or no
|
||||
*/
|
||||
public boolean isStaff(UUID player) {
|
||||
public boolean isStaff(@NotNull UUID player) {
|
||||
return staffs.contains(player);
|
||||
}
|
||||
|
||||
@@ -127,7 +128,7 @@ public class ShopModerator {
|
||||
* @param player Player
|
||||
* @return yes or no, return true when it is staff or owner
|
||||
*/
|
||||
public boolean isModerator(UUID player) {
|
||||
public boolean isModerator(@NotNull UUID player) {
|
||||
if (isOwner(player))
|
||||
return true;
|
||||
if (isStaff(player))
|
||||
@@ -135,12 +136,12 @@ public class ShopModerator {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static String serialize(ShopModerator shopModerator) {
|
||||
public static String serialize(@NotNull ShopModerator shopModerator) {
|
||||
Gson gson = new Gson();
|
||||
return gson.toJson(shopModerator); //Use Gson serialize this class
|
||||
}
|
||||
|
||||
public static ShopModerator deserialize(String serilized) {
|
||||
public static ShopModerator deserialize(@NotNull String serilized) {
|
||||
//Use Gson deserialize data
|
||||
Gson gson = new Gson();
|
||||
return gson.fromJson(serilized, ShopModerator.class);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package org.maxgamer.quickshop.Shop;
|
||||
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
public enum ShopType {
|
||||
SELLING(0), BUYING(1);
|
||||
private int id;
|
||||
@@ -17,7 +19,7 @@ public enum ShopType {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int toID(ShopType shopType) {
|
||||
public static int toID(@NotNull ShopType shopType) {
|
||||
return shopType.id;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import net.md_5.bungee.api.chat.HoverEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
@@ -25,11 +26,11 @@ public class ChatSheetPrinter {
|
||||
p.sendMessage(chatColor + MsgUtil.getMessage("tableformat.full_line"));
|
||||
}
|
||||
|
||||
public void printLine(String text) {
|
||||
public void printLine(@NotNull String text) {
|
||||
p.sendMessage(chatColor + MsgUtil.getMessage("tableformat.left_begin") + " " + text);
|
||||
}
|
||||
|
||||
public void printCenterLine(String text) {
|
||||
public void printCenterLine(@NotNull String text) {
|
||||
p.sendMessage(chatColor + MsgUtil.getMessage("tableformat.left_half_line") + text + MsgUtil
|
||||
.getMessage("tableformat.right_half_line"));
|
||||
}
|
||||
@@ -38,7 +39,7 @@ public class ChatSheetPrinter {
|
||||
p.sendMessage(chatColor + MsgUtil.getMessage("tableformat.full_line"));
|
||||
}
|
||||
|
||||
public void printExecuteableCmdLine(String text, String hoverText, String executeCmd) {
|
||||
public void printExecuteableCmdLine(@NotNull String text, @NotNull String hoverText, @NotNull String executeCmd) {
|
||||
TextComponent message = new TextComponent(chatColor + MsgUtil.getMessage("tableformat.left_begin") + text);
|
||||
message.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, executeCmd));
|
||||
message.setHoverEvent(
|
||||
@@ -46,7 +47,7 @@ public class ChatSheetPrinter {
|
||||
p.spigot().sendMessage(message);
|
||||
}
|
||||
|
||||
public void printSuggestableCmdLine(String text, String hoverText, String suggestCmd) {
|
||||
public void printSuggestableCmdLine(@NotNull String text, @NotNull String hoverText, @NotNull String suggestCmd) {
|
||||
TextComponent message = new TextComponent(chatColor + MsgUtil.getMessage("tableformat.left_begin") + text);
|
||||
message.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, suggestCmd));
|
||||
message.setHoverEvent(
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.maxgamer.quickshop.Util;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.plugin.RegisteredListener;
|
||||
import org.jetbrains.annotations.*;
|
||||
import org.maxgamer.quickshop.QuickShop;
|
||||
|
||||
/**
|
||||
@@ -12,7 +13,7 @@ public class Compatibility {
|
||||
private QuickShop plugin;
|
||||
final private ArrayList<String> knownIncompatiablePlugin = new ArrayList<>();
|
||||
|
||||
public Compatibility(QuickShop plugin) {
|
||||
public Compatibility(@NotNull QuickShop plugin) {
|
||||
this.plugin = plugin;
|
||||
knownIncompatiablePlugin.add("OpenInv");
|
||||
knownIncompatiablePlugin.add("LWC");
|
||||
@@ -27,7 +28,7 @@ public class Compatibility {
|
||||
*
|
||||
* @param status true=turn on closed listeners, false=turn off all turned on listeners.
|
||||
*/
|
||||
public void toggleInteractListeners(boolean status) {
|
||||
public void toggleInteractListeners(@NotNull boolean status) {
|
||||
// if (status) {
|
||||
// disabledListeners.clear();
|
||||
// for (RegisteredListener listener : PlayerInteractEvent.getHandlerList().getRegisteredListeners()) {
|
||||
|
||||
@@ -9,6 +9,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.Damageable;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
import org.jetbrains.annotations.*;
|
||||
import org.maxgamer.quickshop.QuickShop;
|
||||
|
||||
/**
|
||||
@@ -27,11 +28,7 @@ public class ItemMatcher {
|
||||
* @param stack2 The second item stack
|
||||
* @return true if the itemstacks match. (Material, durability, enchants, name)
|
||||
*/
|
||||
public boolean matches(ItemStack stack1, ItemStack stack2) {
|
||||
|
||||
if (plugin.getConfig().getBoolean("shop.strict-matches-check"))
|
||||
if (stack1.equals(stack2))
|
||||
return false;
|
||||
public boolean matches(@Nullable ItemStack stack1, @Nullable ItemStack stack2) {
|
||||
|
||||
if (stack1 == stack2)
|
||||
return true; // Referring to the same thing, or both are null.
|
||||
@@ -39,6 +36,10 @@ public class ItemMatcher {
|
||||
if (stack1 == null || stack2 == null)
|
||||
return false; // One of them is null (Can't be both, see above)
|
||||
|
||||
if (plugin.getConfig().getBoolean("shop.strict-matches-check"))
|
||||
if (stack1.equals(stack2))
|
||||
return false;
|
||||
|
||||
if (stack1.hashCode() == stack2.hashCode())
|
||||
return true;
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.lang.reflect.Method;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.*;
|
||||
import org.maxgamer.quickshop.QuickShop;
|
||||
|
||||
public abstract class ItemNMS {
|
||||
@@ -39,7 +40,7 @@ public abstract class ItemNMS {
|
||||
* @return The json for ItemStack.
|
||||
* @throws Throwable throws
|
||||
*/
|
||||
public static String saveJsonfromNMS(ItemStack bStack) throws Throwable {
|
||||
public static String saveJsonfromNMS(@NotNull ItemStack bStack) throws Throwable {
|
||||
if (bStack.getType() == Material.AIR)
|
||||
return null;
|
||||
Object mcStack = craftItemStack_asNMSCopyMethod.invoke(null, bStack);
|
||||
|
||||
@@ -23,6 +23,7 @@ import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.EnchantmentStorageMeta;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.jetbrains.annotations.*;
|
||||
import org.maxgamer.quickshop.QuickShop;
|
||||
import org.maxgamer.quickshop.Shop.Shop;
|
||||
|
||||
@@ -41,7 +42,7 @@ public class MsgUtil {
|
||||
return messagei18n;
|
||||
}
|
||||
|
||||
public static void loadCfgMessages(String... reload) {
|
||||
public static void loadCfgMessages(@NotNull String... reload) {
|
||||
messageFile = new File(plugin.getDataFolder(), "messages.yml");
|
||||
if (!messageFile.exists()) {
|
||||
plugin.getLogger().info("Creating messages.yml");
|
||||
@@ -94,7 +95,7 @@ public class MsgUtil {
|
||||
|
||||
}
|
||||
|
||||
public static void updateMessages(int selectedVersion) throws IOException {
|
||||
public static void updateMessages(@NotNull int selectedVersion) throws IOException {
|
||||
if (selectedVersion == 1) {
|
||||
messagei18n.set("shop-not-exist", "&cThere had no shop.");
|
||||
messagei18n.set("controlpanel.infomation", "&aShop Control Panel:");
|
||||
@@ -267,7 +268,7 @@ public class MsgUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public static void sendControlPanelInfo(CommandSender sender, Shop shop) {
|
||||
public static void sendControlPanelInfo(@NotNull CommandSender sender, @NotNull Shop shop) {
|
||||
if (!sender.hasPermission("quickshop.use")) {
|
||||
return;
|
||||
}
|
||||
@@ -383,7 +384,7 @@ public class MsgUtil {
|
||||
* @param bool The boolean value
|
||||
* @return The result of translate.
|
||||
*/
|
||||
public static String bool2String(boolean bool) {
|
||||
public static String bool2String(@NotNull boolean bool) {
|
||||
if (bool) {
|
||||
return MsgUtil.getMessage("booleanformat.success");
|
||||
} else {
|
||||
@@ -452,7 +453,7 @@ public class MsgUtil {
|
||||
* @param ItemBukkitName ItemBukkitName(e.g. Material.STONE.name())
|
||||
* @return String Item's i18n name.
|
||||
*/
|
||||
public static String getItemi18n(String ItemBukkitName) {
|
||||
public static String getItemi18n(@NotNull String ItemBukkitName) {
|
||||
if (ItemBukkitName == null) {
|
||||
return "";
|
||||
}
|
||||
@@ -519,7 +520,7 @@ public class MsgUtil {
|
||||
* @param key The Enchantment.
|
||||
* @return Enchantment's i18n name.
|
||||
*/
|
||||
public static String getEnchi18n(Enchantment key) {
|
||||
public static String getEnchi18n(@NotNull Enchantment key) {
|
||||
if (key == null) {
|
||||
return "ERROR";
|
||||
}
|
||||
@@ -580,7 +581,7 @@ public class MsgUtil {
|
||||
* @param potion potionType
|
||||
* @return Potion's i18n name.
|
||||
*/
|
||||
public static String getPotioni18n(PotionEffectType potion) {
|
||||
public static String getPotioni18n(@NotNull PotionEffectType potion) {
|
||||
if (potion == null) {
|
||||
return "ERROR";
|
||||
}
|
||||
@@ -606,7 +607,7 @@ public class MsgUtil {
|
||||
* them in the database.
|
||||
* @param isUnlimited The shop is or unlimited
|
||||
*/
|
||||
public static void send(UUID player, String message, boolean isUnlimited) { //TODO Converted to UUID
|
||||
public static void send(@NotNull UUID player, @NotNull String message, @NotNull boolean isUnlimited) {
|
||||
if (plugin.getConfig().getBoolean("shop.ignore-unlimited-shop-messages") && isUnlimited)
|
||||
return; //Ignore unlimited shops messages.
|
||||
OfflinePlayer p = Bukkit.getOfflinePlayer(player);
|
||||
@@ -640,7 +641,7 @@ public class MsgUtil {
|
||||
* @param p The player to message
|
||||
* @return True if success, False if the player is offline or null
|
||||
*/
|
||||
public static boolean flush(OfflinePlayer p) { //TODO Changed to UUID
|
||||
public static boolean flush(@NotNull OfflinePlayer p) { //TODO Changed to UUID
|
||||
if (p != null && p.isOnline()) {
|
||||
UUID pName = p.getUniqueId();
|
||||
LinkedList<String> msgs = player_messages.get(pName);
|
||||
@@ -664,7 +665,7 @@ public class MsgUtil {
|
||||
* @param p Target player
|
||||
* @param shop The shop
|
||||
*/
|
||||
public static void sendShopInfo(Player p, Shop shop) {
|
||||
public static void sendShopInfo(@NotNull Player p, @NotNull Shop shop) {
|
||||
// Potentially faster with an array?
|
||||
ItemStack items = shop.getItem();
|
||||
ChatSheetPrinter chatSheetPrinter = new ChatSheetPrinter(p);
|
||||
@@ -728,7 +729,7 @@ public class MsgUtil {
|
||||
* @param shop Target shop
|
||||
* @param amount Trading item amounts.
|
||||
*/
|
||||
public static void sendPurchaseSuccess(Player p, Shop shop, int amount) {
|
||||
public static void sendPurchaseSuccess(@NotNull Player p, @NotNull Shop shop, @NotNull int amount) {
|
||||
ChatSheetPrinter chatSheetPrinter = new ChatSheetPrinter(p);
|
||||
chatSheetPrinter.printHeader();
|
||||
chatSheetPrinter.printLine(MsgUtil.getMessage("menu.successful-purchase"));
|
||||
@@ -770,7 +771,7 @@ public class MsgUtil {
|
||||
* @param shop Target shop
|
||||
* @param amount Trading item amounts.
|
||||
*/
|
||||
public static void sendSellSuccess(Player p, Shop shop, int amount) {
|
||||
public static void sendSellSuccess(@NotNull Player p, @NotNull Shop shop, @NotNull int amount) {
|
||||
ChatSheetPrinter chatSheetPrinter = new ChatSheetPrinter(p);
|
||||
chatSheetPrinter.printHeader();
|
||||
chatSheetPrinter.printLine(MsgUtil.getMessage("menu.successfully-sold"));
|
||||
@@ -814,7 +815,7 @@ public class MsgUtil {
|
||||
* @param iStack stack
|
||||
* @return itemDisplayName
|
||||
*/
|
||||
public static String getDisplayName(ItemStack iStack) {
|
||||
public static String getDisplayName(@NotNull ItemStack iStack) {
|
||||
ItemStack is = iStack.clone();
|
||||
|
||||
if (is.hasItemMeta() && is.getItemMeta().hasDisplayName()) {
|
||||
@@ -832,7 +833,7 @@ public class MsgUtil {
|
||||
* @param args args
|
||||
* @return message
|
||||
*/
|
||||
public static String getMessage(String loc, String... args) {
|
||||
public static String getMessage(@NotNull String loc, @NotNull String... args) {
|
||||
String raw = messagei18n.getString(loc);
|
||||
if (raw == null) {
|
||||
return "Invalid message: " + loc + " Did you modify the i18n file?";
|
||||
@@ -847,7 +848,7 @@ public class MsgUtil {
|
||||
* @param args args
|
||||
* @return filled text
|
||||
*/
|
||||
public static String fillArgs(String raw, String... args) {
|
||||
public static String fillArgs(@NotNull String raw, @NotNull String... args) {
|
||||
if (raw == null) {
|
||||
return "Invalid message: " + "raw";
|
||||
}
|
||||
@@ -870,7 +871,7 @@ public class MsgUtil {
|
||||
* @param action What action trigger the exploit alert.
|
||||
* @param location Event/Shop location.
|
||||
*/
|
||||
public static void sendExploitAlert(Object objectDo, String action, Location location) {
|
||||
public static void sendExploitAlert(@NotNull Object objectDo, @NotNull String action, @NotNull Location location) {
|
||||
Util.sendMessageToOps(ChatColor.RED + "[QuickShop][ExploitAlert] A displayItem exploit was found!");
|
||||
if (objectDo instanceof Player) {
|
||||
Player player = (Player) objectDo;
|
||||
|
||||
@@ -11,6 +11,7 @@ import java.net.URLEncoder;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.jetbrains.annotations.*;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.maxgamer.quickshop.QuickShop;
|
||||
|
||||
@@ -20,7 +21,7 @@ import org.maxgamer.quickshop.QuickShop;
|
||||
public class Paste {
|
||||
private QuickShop plugin;
|
||||
|
||||
public Paste(QuickShop plugin) {
|
||||
public Paste(@NotNull QuickShop plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@@ -104,7 +105,7 @@ public class Paste {
|
||||
* @return Target paste URL.
|
||||
* @throws Exception the throws
|
||||
*/
|
||||
public String pasteTheText(String text) throws Exception {
|
||||
public String pasteTheText(@NotNull String text) throws Exception {
|
||||
URL url = new URL("https://paste.ubuntu.com");
|
||||
URLConnection conn = url.openConnection();
|
||||
conn.setRequestProperty("accept", "*/*");
|
||||
@@ -126,10 +127,8 @@ public class Paste {
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
|
||||
Util.debugLog("Request Completed: " + conn.getURL().toString());
|
||||
String link = conn.getURL().toString();
|
||||
if (in != null)
|
||||
in.close();
|
||||
if (out != null)
|
||||
out.close();
|
||||
in.close();
|
||||
out.close();
|
||||
return link;
|
||||
}
|
||||
}
|
||||
@@ -9,13 +9,14 @@ import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.jetbrains.annotations.*;
|
||||
import org.maxgamer.quickshop.QuickShop;
|
||||
|
||||
public class PermissionChecker {
|
||||
private QuickShop plugin;
|
||||
private boolean usePermissionChecker;
|
||||
|
||||
public PermissionChecker(QuickShop plugin) {
|
||||
public PermissionChecker(@NotNull QuickShop plugin) {
|
||||
this.plugin = plugin;
|
||||
usePermissionChecker = this.plugin.getConfig().getBoolean("shop.protection-checking");
|
||||
}
|
||||
@@ -28,7 +29,7 @@ public class PermissionChecker {
|
||||
* @param place Place block (false = break block)
|
||||
* @return Success
|
||||
*/
|
||||
public boolean canBuild(Player player, Location location, boolean place) {
|
||||
public boolean canBuild(@NotNull Player player, @NotNull Location location, boolean place) {
|
||||
return canBuild(player, location.getBlock(), place);
|
||||
}
|
||||
|
||||
@@ -39,7 +40,7 @@ public class PermissionChecker {
|
||||
* @param place Place block (false = break block)
|
||||
* @return Success
|
||||
*/
|
||||
public boolean canBuild(Player player, Block block, boolean place) {
|
||||
public boolean canBuild(@NotNull Player player, @NotNull Block block, boolean place) {
|
||||
if (!usePermissionChecker)
|
||||
return true;
|
||||
BlockEvent beMainHand;
|
||||
|
||||
@@ -15,6 +15,7 @@ import io.sentry.event.BreadcrumbBuilder;
|
||||
import io.sentry.event.UserBuilder;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.jetbrains.annotations.*;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.maxgamer.quickshop.QuickShop;
|
||||
|
||||
@@ -29,7 +30,7 @@ public class SentryErrorReporter {
|
||||
private final ArrayList<String> reported = new ArrayList<>();
|
||||
private QuickShop plugin;
|
||||
|
||||
public SentryErrorReporter(QuickShop plugin) {
|
||||
public SentryErrorReporter(@NotNull QuickShop plugin) {
|
||||
this.plugin = plugin;
|
||||
JSONObject serverData = plugin.getMetrics().getServerData();
|
||||
//sentryClient = Sentry.init(dsn);
|
||||
@@ -84,7 +85,7 @@ public class SentryErrorReporter {
|
||||
* @param context BreadCrumb
|
||||
* @return Event Uniqud ID
|
||||
*/
|
||||
public UUID sendError(Throwable throwable, String... context) {
|
||||
public UUID sendError(@NotNull Throwable throwable, @NotNull String... context) {
|
||||
Util.debugLog("Preparing for reporting errors...");
|
||||
if (!enabled) {
|
||||
Util.debugLog("Errors not sended, cause ErrorReport not enabled.");
|
||||
@@ -131,7 +132,7 @@ public class SentryErrorReporter {
|
||||
* @param throwable Throws
|
||||
* @return Cause or not
|
||||
*/
|
||||
private boolean checkWasCauseByQS(Throwable throwable) {
|
||||
private boolean checkWasCauseByQS(@NotNull Throwable throwable) {
|
||||
StackTraceElement[] stackTraces = throwable.getStackTrace();
|
||||
Optional<StackTraceElement> element;
|
||||
element = Arrays.stream(throwable.getStackTrace())
|
||||
@@ -157,7 +158,7 @@ public class SentryErrorReporter {
|
||||
* @param throwable Throws
|
||||
* @return dupecated
|
||||
*/
|
||||
private boolean canReport(Throwable throwable) {
|
||||
private boolean canReport(@NotNull Throwable throwable) {
|
||||
if (!enabled) {
|
||||
return false;
|
||||
}
|
||||
@@ -179,7 +180,7 @@ public class SentryErrorReporter {
|
||||
* @return true if the log record should be published.
|
||||
*/
|
||||
@Override
|
||||
public boolean isLoggable(LogRecord record) {
|
||||
public boolean isLoggable(@NotNull LogRecord record) {
|
||||
if (!enabled) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.bukkit.inventory.meta.Damageable;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.jetbrains.annotations.*;
|
||||
import org.maxgamer.quickshop.Database.MySQLCore;
|
||||
import org.maxgamer.quickshop.QuickShop;
|
||||
import org.maxgamer.quickshop.Shop.DisplayItem;
|
||||
@@ -118,12 +119,12 @@ public class Util {
|
||||
* @param material mat
|
||||
* @return min, max
|
||||
*/
|
||||
public static Entry<Double, Double> getPriceRestriction(Material material) {
|
||||
public static Entry<Double, Double> getPriceRestriction(@NotNull Material material) {
|
||||
return restrictedPrices.get(material);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static boolean isTransparent(Material m) {
|
||||
public static boolean isTransparent(@NotNull Material m) {
|
||||
return m.isTransparent();
|
||||
}
|
||||
|
||||
@@ -132,7 +133,7 @@ public class Util {
|
||||
* @param material Mat
|
||||
* @return Can or not
|
||||
*/
|
||||
public static boolean isShoppables(Material material) {
|
||||
public static boolean isShoppables(@NotNull Material material) {
|
||||
return shoppables.contains(material);
|
||||
}
|
||||
|
||||
@@ -141,7 +142,7 @@ public class Util {
|
||||
*
|
||||
* @param config yaml config
|
||||
*/
|
||||
public static void parseColours(YamlConfiguration config) {
|
||||
public static void parseColours(@NotNull YamlConfiguration config) {
|
||||
Set<String> keys = config.getKeys(true);
|
||||
for (String key : keys) {
|
||||
String filtered = config.getString(key);
|
||||
@@ -159,7 +160,7 @@ public class Util {
|
||||
* @param text the text
|
||||
* @return parsed text
|
||||
*/
|
||||
public static String parseColours(String text) {
|
||||
public static String parseColours(@NotNull String text) {
|
||||
text = ChatColor.translateAlternateColorCodes('&', text);
|
||||
return text;
|
||||
}
|
||||
@@ -170,7 +171,7 @@ public class Util {
|
||||
* @param b The block to check, Possibly a chest, dispenser, etc.
|
||||
* @return True if it can be made into a shop, otherwise false.
|
||||
*/
|
||||
public static boolean canBeShop(Block b) {
|
||||
public static boolean canBeShop(@NotNull Block b) {
|
||||
BlockState bs = b.getState();
|
||||
if ((!(bs instanceof InventoryHolder)) && b.getType() != Material.ENDER_CHEST) {
|
||||
return false;
|
||||
@@ -188,7 +189,7 @@ public class Util {
|
||||
|
||||
}
|
||||
|
||||
public static boolean isBlacklistWorld(World world) {
|
||||
public static boolean isBlacklistWorld(@NotNull World world) {
|
||||
return worldBlacklist.contains(world.getName());
|
||||
}
|
||||
|
||||
@@ -198,7 +199,7 @@ public class Util {
|
||||
* @param item The ItemStack of tools to check
|
||||
* @return The percentage 'health' the tool has. (Opposite of total damage)
|
||||
*/
|
||||
public static String getToolPercentage(ItemStack item) {
|
||||
public static String getToolPercentage(@NotNull ItemStack item) {
|
||||
if (!(item instanceof Damageable))
|
||||
return "Error: NaN";
|
||||
double dura = ((Damageable) item.getItemMeta()).getDamage();
|
||||
@@ -216,7 +217,7 @@ public class Util {
|
||||
* @deprecated
|
||||
*/
|
||||
@Deprecated
|
||||
public static Block getSecondHalf_old(Block b) {
|
||||
public static Block getSecondHalf_old(@NotNull Block b) {
|
||||
if (b.getType() != Material.CHEST && b.getType() != Material.TRAPPED_CHEST)
|
||||
return null;
|
||||
Block[] blocks = new Block[4];
|
||||
@@ -239,7 +240,7 @@ public class Util {
|
||||
* @param b The chest to check.
|
||||
* @return the block which is also a chest and connected to b.
|
||||
*/
|
||||
public static Block getSecondHalf(Block b) {
|
||||
public static Block getSecondHalf(@NotNull Block b) {
|
||||
if ((b.getType() != Material.CHEST) && (b.getType() != Material.TRAPPED_CHEST)) {
|
||||
return null;
|
||||
}
|
||||
@@ -271,7 +272,7 @@ public class Util {
|
||||
* @param b2 block 2
|
||||
* @return Equals or not.
|
||||
*/
|
||||
private static boolean equalsBlockStateLocation(Location b1, Location b2) {
|
||||
private static boolean equalsBlockStateLocation(@NotNull Location b1, @NotNull Location b2) {
|
||||
return (b1.getBlockX() == b2.getBlockX()) && (b1.getBlockY() == b2.getBlockY()) && (b1.getBlockZ() == b2
|
||||
.getBlockZ()) && (b1.getWorld().getName().equals(b2.getWorld().getName()));
|
||||
}
|
||||
@@ -283,7 +284,7 @@ public class Util {
|
||||
* @param loc2 location 2
|
||||
* @return Equals or not.
|
||||
*/
|
||||
public static boolean location3DEqual(Location loc1, Location loc2) {
|
||||
public static boolean location3DEqual(@NotNull Location loc1, @NotNull Location loc2) {
|
||||
if (loc1.equals(loc2))
|
||||
return true;
|
||||
if (!loc1.getWorld().getName().equals(loc2.getWorld().getName()))
|
||||
@@ -304,7 +305,7 @@ public class Util {
|
||||
* @param p The player performing the action.
|
||||
* @return true if a nearby shop was found, false otherwise.
|
||||
*/
|
||||
public static boolean isOtherShopWithinHopperReach(Block b, Player p) {
|
||||
public static boolean isOtherShopWithinHopperReach(@NotNull Block b, @NotNull Player p) {
|
||||
// Check 5 relative positions that can be affected by a hopper: behind, in front of, to the right,
|
||||
// to the left and underneath.
|
||||
Block[] blocks = new Block[5];
|
||||
@@ -333,7 +334,7 @@ public class Util {
|
||||
* @param iStack target ItemStack
|
||||
* @return String serialized itemStack
|
||||
*/
|
||||
public static String serialize(ItemStack iStack) {
|
||||
public static String serialize(@NotNull ItemStack iStack) {
|
||||
YamlConfiguration cfg = new YamlConfiguration();
|
||||
cfg.set("item", iStack);
|
||||
return cfg.saveToString();
|
||||
@@ -346,7 +347,7 @@ public class Util {
|
||||
* @return ItemStack iStack
|
||||
* @throws InvalidConfigurationException when failed deserialize config
|
||||
*/
|
||||
public static ItemStack deserialize(String config) throws InvalidConfigurationException {
|
||||
public static ItemStack deserialize(@NotNull String config) throws InvalidConfigurationException {
|
||||
YamlConfiguration cfg = new YamlConfiguration();
|
||||
cfg.loadFromString(config);
|
||||
cfg.getString("item");
|
||||
@@ -360,7 +361,7 @@ public class Util {
|
||||
* @param itemStack The itemstack to fetch the name of
|
||||
* @return The human readable item name.
|
||||
*/
|
||||
public static String getName(ItemStack itemStack) {
|
||||
public static String getName(@NotNull ItemStack itemStack) {
|
||||
// if (NMS.isPotion(itemStack.getType())) {
|
||||
// return CustomPotionsName.getFullName(itemStack);
|
||||
// }
|
||||
@@ -374,7 +375,7 @@ public class Util {
|
||||
* @param ugly The string such as IRON_INGOT
|
||||
* @return A nicer version, such as Iron Ingot
|
||||
*/
|
||||
public static String prettifyText(String ugly) {
|
||||
public static String prettifyText(@NotNull String ugly) {
|
||||
String[] nameParts = ugly.split("_");
|
||||
if (nameParts.length == 1) {
|
||||
return firstUppercase(ugly);
|
||||
@@ -395,7 +396,7 @@ public class Util {
|
||||
* @return String ItemOnSignName
|
||||
*/
|
||||
// Let's make very long names shorter for our sign
|
||||
public static String getNameForSign(ItemStack itemStack) {
|
||||
public static String getNameForSign(@NotNull ItemStack itemStack) {
|
||||
// if (NMS.isPotion(itemStack.getType())) {
|
||||
// return CustomPotionsName.getSignName(itemStack);
|
||||
// }
|
||||
@@ -435,7 +436,7 @@ public class Util {
|
||||
* @param string text
|
||||
* @return Processed text.
|
||||
*/
|
||||
public static String firstUppercase(String string) {
|
||||
public static String firstUppercase(@NotNull String string) {
|
||||
if (string.length() > 1) {
|
||||
return Character.toUpperCase(string.charAt(0)) + string.substring(1).toLowerCase();
|
||||
} else {
|
||||
@@ -450,7 +451,7 @@ public class Util {
|
||||
* @param value the num you want to convert to
|
||||
* @return the Romain num
|
||||
*/
|
||||
public static String toRomain(Integer value) {
|
||||
public static String toRomain(@NotNull Integer value) {
|
||||
return toRoman(value.intValue());
|
||||
}
|
||||
|
||||
@@ -482,7 +483,7 @@ public class Util {
|
||||
* @return Returns true if the item is a tool (Has durability) or false if
|
||||
* it doesn't.
|
||||
*/
|
||||
public static boolean isTool(Material mat) {
|
||||
public static boolean isTool(@NotNull Material mat) {
|
||||
return !(mat.getMaxDurability() == 0);
|
||||
}
|
||||
|
||||
@@ -534,7 +535,7 @@ public class Util {
|
||||
* @param m The material to check if it is blacklisted
|
||||
* @return true if the material is black listed. False if not.
|
||||
*/
|
||||
public static boolean isBlacklisted(Material m) {
|
||||
public static boolean isBlacklisted(@NotNull Material m) {
|
||||
return blacklist.contains(m);
|
||||
}
|
||||
|
||||
@@ -544,7 +545,7 @@ public class Util {
|
||||
* @param b The block which is attached
|
||||
* @return The block the sign is attached to
|
||||
*/
|
||||
public static Block getAttached(Block b) {
|
||||
public static Block getAttached(@NotNull Block b) {
|
||||
try {
|
||||
if (b.getBlockData() instanceof Directional) {
|
||||
Directional directional = (Directional) b.getBlockData();
|
||||
@@ -567,7 +568,7 @@ public class Util {
|
||||
* @param item The ItemStack to search for
|
||||
* @return The number of items that match in this inventory.
|
||||
*/
|
||||
public static int countItems(Inventory inv, ItemStack item) {
|
||||
public static int countItems(@Nullable Inventory inv, @NotNull ItemStack item) {
|
||||
if (inv == null)
|
||||
return 0;
|
||||
int items = 0;
|
||||
@@ -589,7 +590,7 @@ public class Util {
|
||||
* match for 'stackability' to occur.
|
||||
* @return The number of items that can be given to the inventory safely.
|
||||
*/
|
||||
public static int countSpace(Inventory inv, ItemStack item) {
|
||||
public static int countSpace(@Nullable Inventory inv, @NotNull ItemStack item) {
|
||||
if (inv == null)
|
||||
return 0;
|
||||
int space = 0;
|
||||
@@ -611,7 +612,7 @@ public class Util {
|
||||
* @param material mat
|
||||
* @return is or not a wall_sign
|
||||
*/
|
||||
public static boolean isWallSign(Material material) {
|
||||
public static boolean isWallSign(@NotNull Material material) {
|
||||
try {
|
||||
if (Tag.WALL_SIGNS.isTagged(material))
|
||||
return true;
|
||||
@@ -630,7 +631,7 @@ public class Util {
|
||||
* @param loc The location
|
||||
* @return true if the given location is loaded or not.
|
||||
*/
|
||||
public static boolean isLoaded(Location loc) {
|
||||
public static boolean isLoaded(@NotNull Location loc) {
|
||||
// plugin.getLogger().log(Level.WARNING, "Checking isLoaded(Location loc)");
|
||||
if (loc.getWorld() == null) {
|
||||
// plugin.getLogger().log(Level.WARNING, "Is not loaded. (No world)");
|
||||
@@ -667,7 +668,7 @@ public class Util {
|
||||
* @param qualifiedName class qualifiedName
|
||||
* @return boolean Available
|
||||
*/
|
||||
public static boolean isClassAvailable(String qualifiedName) {
|
||||
public static boolean isClassAvailable(@NotNull String qualifiedName) {
|
||||
try {
|
||||
Class.forName(qualifiedName);
|
||||
return true;
|
||||
@@ -681,7 +682,7 @@ public class Util {
|
||||
*
|
||||
* @param message The message you want send
|
||||
*/
|
||||
public static void sendMessageToOps(String message) {
|
||||
public static void sendMessageToOps(@NotNull String message) {
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
if (player.isOp() || player.hasPermission("quickshop.alert")) {
|
||||
player.sendMessage(message);
|
||||
@@ -699,7 +700,7 @@ public class Util {
|
||||
* @param player Target player
|
||||
* @param normalText The text you will see
|
||||
*/
|
||||
public static void sendItemholochat(Shop shop, ItemStack itemStack, Player player, String normalText) {
|
||||
public static void sendItemholochat(@NotNull Shop shop, @NotNull ItemStack itemStack, @NotNull Player player, @NotNull String normalText) {
|
||||
try {
|
||||
String json = ItemNMS.saveJsonfromNMS(itemStack);
|
||||
if (json == null)
|
||||
@@ -728,7 +729,7 @@ public class Util {
|
||||
* @param normalText The text you will see
|
||||
*/
|
||||
// Without NMS
|
||||
private static void sendItemholochatAsNormaly(ItemStack itemStack, Player player, String normalText) {
|
||||
private static void sendItemholochatAsNormaly(@NotNull ItemStack itemStack, @NotNull Player player, @NotNull String normalText) {
|
||||
try {
|
||||
String Itemname = null;
|
||||
List<String> Itemlore = new ArrayList<>();
|
||||
@@ -807,7 +808,7 @@ public class Util {
|
||||
* @param level level
|
||||
* @return formated level
|
||||
*/
|
||||
private static String formatEnchLevel(Integer level) {
|
||||
private static String formatEnchLevel(@NotNull Integer level) {
|
||||
switch (level) {
|
||||
case 1:
|
||||
return "I";
|
||||
@@ -829,7 +830,7 @@ public class Util {
|
||||
* @param iStack itemstack
|
||||
* @return potion data, readable
|
||||
*/
|
||||
public static String getPotiondata(ItemStack iStack) {
|
||||
public static String getPotiondata(@NotNull ItemStack iStack) {
|
||||
if ((iStack.getType() != Material.POTION) && (iStack.getType() != Material.LINGERING_POTION) && (iStack
|
||||
.getType() != Material.SPLASH_POTION)) {
|
||||
return null;
|
||||
@@ -893,7 +894,7 @@ public class Util {
|
||||
* Call this to check items in inventory and remove it.
|
||||
* @param inv inv
|
||||
*/
|
||||
public static void inventoryCheck(Inventory inv) {
|
||||
public static void inventoryCheck(@Nullable Inventory inv) {
|
||||
if (inv == null)
|
||||
return;
|
||||
try {
|
||||
@@ -933,7 +934,7 @@ public class Util {
|
||||
|
||||
}
|
||||
|
||||
private static Class<?> getNMSClass(String className) {
|
||||
private static Class<?> getNMSClass(@Nullable String className) {
|
||||
if (className == null)
|
||||
className = "MinecraftServer";
|
||||
String name = Bukkit.getServer().getClass().getPackage().getName();
|
||||
@@ -945,7 +946,7 @@ public class Util {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isAir(Material mat) {
|
||||
public static boolean isAir(@NotNull Material mat) {
|
||||
if (mat == Material.AIR)
|
||||
return true;
|
||||
try {
|
||||
@@ -964,7 +965,7 @@ public class Util {
|
||||
*
|
||||
* @param logs logs
|
||||
*/
|
||||
public static void debugLog(String... logs) {
|
||||
public static void debugLog(@NotNull String... logs) {
|
||||
if (!devMode)
|
||||
return;
|
||||
String className = Thread.currentThread().getStackTrace()[2].getClassName();
|
||||
@@ -975,7 +976,7 @@ public class Util {
|
||||
}
|
||||
}
|
||||
|
||||
public static void permformanceLog(String className, String methodName, long tookedTime) {
|
||||
public static void permformanceLog(@NotNull String className, @NotNull String methodName, long tookedTime) {
|
||||
if (!devMode)
|
||||
return;
|
||||
plugin.getLogger().info("[PERFORMANCE] [" + className + "] [" + methodName + "] Used time " + tookedTime + "ns.");
|
||||
@@ -999,7 +1000,7 @@ public class Util {
|
||||
* @param uuid timer's uuid
|
||||
* @return long time
|
||||
*/
|
||||
public static long getTimer(UUID uuid) {
|
||||
public static long getTimer(@NotNull UUID uuid) {
|
||||
return System.currentTimeMillis() - timerMap.get(uuid);
|
||||
}
|
||||
|
||||
@@ -1009,7 +1010,7 @@ public class Util {
|
||||
* @param uuid time's uuid
|
||||
* @return long time
|
||||
*/
|
||||
public static long endTimer(UUID uuid) {
|
||||
public static long endTimer(@NotNull UUID uuid) {
|
||||
long time = System.currentTimeMillis() - timerMap.get(uuid);
|
||||
timerMap.remove(uuid);
|
||||
return time;
|
||||
@@ -1021,7 +1022,7 @@ public class Util {
|
||||
* @param worldName Target world.
|
||||
* @return The shops.
|
||||
*/
|
||||
public static int getShopsInWorld(String worldName) {
|
||||
public static int getShopsInWorld(@NotNull String worldName) {
|
||||
int cost = 0;
|
||||
Iterator<Shop> iterator = plugin.getShopManager().getShopIterator();
|
||||
while (iterator.hasNext()) {
|
||||
@@ -1039,7 +1040,7 @@ public class Util {
|
||||
* @param fileName Target file.
|
||||
* @return Target file's content.
|
||||
*/
|
||||
public static String readToString(String fileName) {
|
||||
public static String readToString(@NotNull String fileName) {
|
||||
String encoding = "UTF-8";
|
||||
File file = new File(fileName);
|
||||
Long filelength = file.length();
|
||||
@@ -1090,7 +1091,7 @@ public class Util {
|
||||
* @param filePath Target file
|
||||
* @return Byte array
|
||||
*/
|
||||
public static byte[] inputStream2ByteArray(String filePath) {
|
||||
public static byte[] inputStream2ByteArray(@NotNull String filePath) {
|
||||
try {
|
||||
InputStream in = new FileInputStream(filePath);
|
||||
byte[] data = toByteArray(in);
|
||||
@@ -1108,7 +1109,7 @@ public class Util {
|
||||
* @param inputStream Target stream
|
||||
* @return Byte array
|
||||
*/
|
||||
public static byte[] inputStream2ByteArray(InputStream inputStream) {
|
||||
public static byte[] inputStream2ByteArray(@NotNull InputStream inputStream) {
|
||||
try {
|
||||
byte[] data = toByteArray(inputStream);
|
||||
inputStream.close();
|
||||
@@ -1119,8 +1120,7 @@ public class Util {
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static byte[] toByteArray(InputStream in) throws IOException {
|
||||
private static byte[] toByteArray(@NotNull InputStream in) throws IOException {
|
||||
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
byte[] buffer = new byte[1024 * 4];
|
||||
@@ -1158,7 +1158,7 @@ public class Util {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isUUID(String string) {
|
||||
public static boolean isUUID(@NotNull String string) {
|
||||
if (string.length() != 36 && string.length() != 32)
|
||||
return false;
|
||||
Util.debugLog("Run extra uuid checking for " + string + ". Length: " + string.length());
|
||||
@@ -1170,7 +1170,7 @@ public class Util {
|
||||
}
|
||||
}
|
||||
|
||||
public static void shoppablesCheck(Shop shop) {
|
||||
public static void shoppablesCheck(@NotNull Shop shop) {
|
||||
if (!Util.canBeShop(shop.getLocation().getBlock())) {
|
||||
Util.debugLog("This shopblock can't be shop, deleteing...");
|
||||
shop.onUnload();
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.util.Map.Entry;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.jetbrains.annotations.*;
|
||||
import org.maxgamer.quickshop.QuickShop;
|
||||
import org.maxgamer.quickshop.Shop.QueueAction;
|
||||
import org.maxgamer.quickshop.Shop.QueueShopObject;
|
||||
@@ -21,7 +22,7 @@ import org.maxgamer.quickshop.Shop.ShopChunk;
|
||||
public class ItemWatcher implements Runnable {
|
||||
private QuickShop plugin;
|
||||
|
||||
public ItemWatcher(QuickShop plugin) {
|
||||
public ItemWatcher(@NotNull QuickShop plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.Queue;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
import org.jetbrains.annotations.*;
|
||||
import org.maxgamer.quickshop.QuickShop;
|
||||
|
||||
public class LogWatcher implements Runnable {
|
||||
@@ -44,7 +45,7 @@ public class LogWatcher implements Runnable {
|
||||
}.runTask(QuickShop.instance);
|
||||
}
|
||||
|
||||
public void add(String s) {
|
||||
public void add(@NotNull String s) {
|
||||
new BukkitRunnable() {
|
||||
public void run() {
|
||||
logs.add(s);
|
||||
|
||||
@@ -12,6 +12,7 @@ import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
import org.jetbrains.annotations.*;
|
||||
import org.maxgamer.quickshop.QuickShop;
|
||||
import org.maxgamer.quickshop.Util.MsgUtil;
|
||||
import org.maxgamer.quickshop.Util.UpdateInfomation;
|
||||
@@ -110,7 +111,7 @@ public class UpdateWatcher implements Listener {
|
||||
}.runTaskLater(QuickShop.instance, 80);
|
||||
}
|
||||
|
||||
public static String fixVer(String originalVer) {
|
||||
public static String fixVer(@NotNull String originalVer) {
|
||||
originalVer = originalVer.replaceAll("Reremake", "");
|
||||
originalVer = originalVer.trim();
|
||||
return originalVer;
|
||||
|
||||
Reference in new issue
Block a user