mirror of
https://github.com/EarthMC/QuickShop-Reremake.git
synced 2026-11-24 17:39:52 -05:00
Fully Support i18n,Cleanup code,Fix a display item small bug
Former-commit-id: 891a925778c615ef6a499253e3394f63a52d12d1
This commit is contained in:
1 parent
110988094b
commit
5c274fcba2
12 files changed
+947
-66
No files matched your search
@@ -1,7 +1,6 @@
|
||||
package org.maxgamer.quickshop.Command;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.logging.Level;
|
||||
@@ -258,7 +257,7 @@ public class QS implements CommandExecutor {
|
||||
if (inChunk == null)
|
||||
continue;
|
||||
for (Shop shop : inChunk.values()) {
|
||||
if (shop.getDataName().toLowerCase().contains(lookFor) && shop.getLocation().distanceSquared(loc) < minDistanceSquared) {
|
||||
if (MsgUtil.getItemi18n(shop.getDataName()).toLowerCase().contains(lookFor) && shop.getLocation().distanceSquared(loc) < minDistanceSquared) {
|
||||
closest = shop;
|
||||
minDistanceSquared = shop.getLocation().distanceSquared(loc);
|
||||
}
|
||||
|
||||
@@ -6,9 +6,13 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.maxgamer.quickshop.QuickShop;
|
||||
|
||||
public class Database {
|
||||
private DatabaseCore core;
|
||||
private QuickShop plugin;
|
||||
|
||||
/**
|
||||
* Creates a new database and validates its connection.
|
||||
@@ -159,7 +163,7 @@ public class Database {
|
||||
for (String table : tables) {
|
||||
if (table.toLowerCase().startsWith("sqlite_autoindex_"))
|
||||
continue;
|
||||
System.out.println("Copying " + table);
|
||||
plugin.getLogger().log(Level.WARNING, "Copying " + table);
|
||||
// Wipe the old records
|
||||
db.getConnection().prepareStatement("DELETE FROM " + table).execute();
|
||||
// Fetch all the data from the existing database
|
||||
@@ -185,7 +189,7 @@ public class Database {
|
||||
ps.addBatch();
|
||||
if (n % 100 == 0) {
|
||||
ps.executeBatch();
|
||||
System.out.println(n + " records copied...");
|
||||
plugin.getLogger().log(Level.WARNING, n + " records copied...");
|
||||
}
|
||||
}
|
||||
ps.executeBatch();
|
||||
|
||||
@@ -6,7 +6,6 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
@@ -29,8 +28,6 @@ import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.potion.PotionType;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
import org.maxgamer.quickshop.Command.QS;
|
||||
@@ -54,7 +51,7 @@ import org.maxgamer.quickshop.Shop.ContainerShop;
|
||||
import org.maxgamer.quickshop.Shop.Shop;
|
||||
import org.maxgamer.quickshop.Shop.ShopManager;
|
||||
import org.maxgamer.quickshop.Shop.ShopType;
|
||||
import org.maxgamer.quickshop.Util.CustomItemName;
|
||||
import org.maxgamer.quickshop.Util.CustomItemNameAAA;
|
||||
//import org.maxgamer.quickshop.Util.CustomPotionsName;
|
||||
import org.maxgamer.quickshop.Util.MsgUtil;
|
||||
//import org.maxgamer.quickshop.Util.NMS;
|
||||
@@ -113,9 +110,9 @@ public class QuickShop extends JavaPlugin {
|
||||
public boolean useSpout = false;
|
||||
// private Metrics metrics;
|
||||
/** Whether debug info should be shown in the console */
|
||||
public static boolean debug = false;
|
||||
public static boolean debug = true;
|
||||
|
||||
private Map<Material,List<CustomItemName>> customItemsName = new HashMap<Material,List<CustomItemName>>();
|
||||
private Map<Material,List<CustomItemNameAAA>> customItemsName = new HashMap<Material,List<CustomItemNameAAA>>();
|
||||
|
||||
private int displayItemCheckTicks;
|
||||
|
||||
@@ -270,11 +267,11 @@ public class QuickShop extends JavaPlugin {
|
||||
getLogger().info("Loading shops from database...");
|
||||
/*int res = Converter.convert();
|
||||
if (res < 0) {
|
||||
System.out.println("Could not convert shops. Exitting.");
|
||||
plugin.getLogger().log(Level.WARNING, "Could not convert shops. Exitting.");
|
||||
return;
|
||||
}
|
||||
if (res > 0) {
|
||||
System.out.println("Conversion success. Continuing...");
|
||||
plugin.getLogger().log(Level.WARNING, "Conversion success. Continuing...");
|
||||
}*/
|
||||
con = database.getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT * FROM shops");
|
||||
@@ -525,16 +522,16 @@ public class QuickShop extends JavaPlugin {
|
||||
return this.shopManager;
|
||||
}
|
||||
|
||||
public Map<Material, List<CustomItemName>> getCustomItemsNameMap() {
|
||||
public Map<Material, List<CustomItemNameAAA>> getCustomItemsNameMap() {
|
||||
return customItemsName;
|
||||
}
|
||||
|
||||
public CustomItemName getCustomItemNames(ItemStack is) {
|
||||
List<CustomItemName> list = customItemsName.get(is.getType());
|
||||
public CustomItemNameAAA getCustomItemNames(ItemStack is) {
|
||||
List<CustomItemNameAAA> list = customItemsName.get(is.getType());
|
||||
if (list==null) {
|
||||
return null;
|
||||
}
|
||||
for (CustomItemName cin : list) {
|
||||
for (CustomItemNameAAA cin : list) {
|
||||
if (cin.matches(is)) {
|
||||
return cin;
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ public class ContainerShop implements Shop {
|
||||
plugin.getDB().execute(q, this.getOwner().toString(), Util.serialize(this.getItem()), unlimited, shopType.toID(), this.getPrice(), x, y, z, world);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("Could not update shop in database! Changes will revert after a reboot!");
|
||||
plugin.getLogger().log(Level.WARNING, "Could not update shop in database! Changes will revert after a reboot!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package org.maxgamer.quickshop.Shop;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
@@ -19,6 +21,7 @@ public class DisplayItem {
|
||||
private Shop shop;
|
||||
private ItemStack iStack;
|
||||
private Item item;
|
||||
private QuickShop plugin;
|
||||
|
||||
// private Location displayLoc;
|
||||
/**
|
||||
@@ -45,14 +48,14 @@ public class DisplayItem {
|
||||
this.item = shop.getLocation().getWorld().dropItem(dispLoc, this.iStack);
|
||||
this.item.setVelocity(new Vector(0, 0.1, 0));
|
||||
if (QuickShop.debug) {
|
||||
System.out.println("Spawned item. Safeguarding.");
|
||||
plugin.getLogger().log(Level.WARNING, "Spawned item. Safeguarding.");
|
||||
}
|
||||
try {
|
||||
this.safeGuard(this.item);
|
||||
//NMS.safeGuard
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("QuickShop version mismatch! This version of QuickShop is incompatible with this version of bukkit! Try update?");
|
||||
plugin.getLogger().log(Level.WARNING, "QuickShop version mismatch! This version of QuickShop is incompatible with this version of bukkit! Try update?");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +101,7 @@ public class DisplayItem {
|
||||
e.remove();
|
||||
removed = true;
|
||||
if (QuickShop.debug) {
|
||||
System.out.println("Removed rogue item: " + near.getType());
|
||||
plugin.getLogger().log(Level.WARNING, "Removed rogue item: " + near.getType());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,8 +29,6 @@ import org.maxgamer.quickshop.Util.MsgUtil;
|
||||
import org.maxgamer.quickshop.Util.Permissions;
|
||||
import org.maxgamer.quickshop.Util.Util;
|
||||
|
||||
import net.minecraft.server.v1_13_R1.WorldGenDecoratorHeight32;
|
||||
|
||||
public class ShopManager {
|
||||
private QuickShop plugin;
|
||||
private HashMap<UUID, Info> actions = new HashMap<UUID, Info>();
|
||||
@@ -64,7 +62,7 @@ public class ShopManager {
|
||||
addShop(loc.getWorld().getName(), shop);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("Could not create shop! Changes will revert after a reboot!");
|
||||
plugin.getLogger().log(Level.WARNING, "Could not create shop! Changes will revert after a reboot!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,7 +112,7 @@ public class ShopManager {
|
||||
// long start = System.nanoTime();
|
||||
HashMap<Location, Shop> shops = getShops(c.getWorld().getName(), c.getX(), c.getZ());
|
||||
// long end = System.nanoTime();
|
||||
// System.out.println("Chunk lookup in " + ((end - start)/1000000.0) +
|
||||
// plugin.getLogger().log(Level.WARNING, "Chunk lookup in " + ((end - start)/1000000.0) +
|
||||
// "ms.");
|
||||
return shops;
|
||||
}
|
||||
@@ -458,7 +456,7 @@ public class ShopManager {
|
||||
if (shop.isSelling()) {
|
||||
int stock = shop.getRemainingStock();
|
||||
if (stock < amount) {
|
||||
p.sendMessage(MsgUtil.getMessage("shop-stock-too-low", "" + shop.getRemainingStock(), shop.getDataName()));
|
||||
p.sendMessage(MsgUtil.getMessage("shop-stock-too-low", String.valueOf(shop.getRemainingStock()),MsgUtil.getItemi18n(shop.getDataName())));
|
||||
return;
|
||||
}
|
||||
if (amount == 0) {
|
||||
|
||||
+4
-4
@@ -2,11 +2,11 @@ package org.maxgamer.quickshop.Util;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class CustomItemName {
|
||||
public class CustomItemNameAAA {
|
||||
private ItemStack itemStack;
|
||||
private String signName, fullName;
|
||||
|
||||
public CustomItemName(ItemStack itemStack, String signName, String fullName) {
|
||||
public CustomItemNameAAA(ItemStack itemStack, String signName, String fullName) {
|
||||
this.itemStack = itemStack;
|
||||
this.signName = signName;
|
||||
this.fullName = fullName;
|
||||
@@ -43,10 +43,10 @@ public class CustomItemName {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (!(obj instanceof CustomItemName)) {
|
||||
if (!(obj instanceof CustomItemNameAAA)) {
|
||||
return false;
|
||||
}
|
||||
CustomItemName other = (CustomItemName) obj;
|
||||
CustomItemNameAAA other = (CustomItemNameAAA) obj;
|
||||
if (fullName == null) {
|
||||
if (other.fullName != null) {
|
||||
return false;
|
||||
@@ -1,21 +1,21 @@
|
||||
package org.maxgamer.quickshop.Util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.logging.Level;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.apache.commons.io.output.ThresholdingOutputStream;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -24,11 +24,10 @@ import org.bukkit.inventory.meta.EnchantmentStorageMeta;
|
||||
import org.maxgamer.quickshop.QuickShop;
|
||||
import org.maxgamer.quickshop.Shop.Shop;
|
||||
|
||||
import net.minecraft.server.v1_13_R1.StatusChallengeUtils;
|
||||
|
||||
public class MsgUtil {
|
||||
private static QuickShop plugin;
|
||||
private static YamlConfiguration messages;
|
||||
private static YamlConfiguration itemi18n;
|
||||
private static HashMap<UUID, LinkedList<String>> player_messages = new HashMap<UUID, LinkedList<String>>();
|
||||
static {
|
||||
plugin = QuickShop.instance;
|
||||
@@ -73,30 +72,47 @@ public class MsgUtil {
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("Could not load transaction messages from database. Skipping.");
|
||||
plugin.getLogger().log(Level.WARNING, "Could not load transaction messages from database. Skipping.");
|
||||
}
|
||||
}
|
||||
public static void loadItemi18n() {
|
||||
plugin.getLogger().info("Starting loading Itemname i18n...");
|
||||
FileConfiguration config = plugin.getConfig();
|
||||
plugin.getLogger().info("Starting loading itemname i18n...");
|
||||
File itemi18nFile = new File(plugin.getDataFolder(), "itemi18n.yml");
|
||||
if (!itemi18nFile.exists()) {
|
||||
plugin.getLogger().info("Creating itemi18n.yml");
|
||||
plugin.saveResource("itemi18n.yml", true);
|
||||
}
|
||||
// Store it
|
||||
itemi18n = YamlConfiguration.loadConfiguration(itemi18nFile);
|
||||
itemi18n.options().copyDefaults(true);
|
||||
YamlConfiguration itemi18nYAML = YamlConfiguration.loadConfiguration(new InputStreamReader(plugin.getResource("itemi18n.yml")));
|
||||
itemi18n.setDefaults(itemi18nYAML);
|
||||
Util.parseColours(messages);
|
||||
Material[] itemsi18n = Material.values();
|
||||
for (Material material : itemsi18n) {
|
||||
String itemname = config.getString("itemi18n."+material.name());
|
||||
String itemname = itemi18n.getString("itemi18n."+material.name());
|
||||
if(itemname==null || itemname.equals("")) {
|
||||
plugin.getLogger().info("Found new items/blocks,add it in config...");
|
||||
config.set("itemi18n."+material.name(), material.name());
|
||||
plugin.getLogger().info("Found new items/blocks ["+material.name()+"] ,add it in config...");
|
||||
itemi18n.set("itemi18n."+material.name(), material.name());
|
||||
}
|
||||
}
|
||||
plugin.saveConfig();
|
||||
try {
|
||||
itemi18n.save(itemi18nFile);
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
plugin.getLogger().log(Level.WARNING, "Could not load/save transaction itemname from itemi18n.yml. Skipping.");
|
||||
}
|
||||
plugin.getLogger().info("Complete to load Itemname i18n.");
|
||||
}
|
||||
public static String getItemi18n(String ItemBukkitName) {
|
||||
String Itemname_i18n = plugin.getConfig().getString("itemi18n."+ItemBukkitName);
|
||||
ItemBukkitName = ItemBukkitName.trim().replaceAll(" ", "_").toUpperCase(Locale.ROOT);
|
||||
String Itemname_i18n = itemi18n.getString("itemi18n."+ItemBukkitName).trim();
|
||||
if(ItemBukkitName==null) {
|
||||
return "";
|
||||
}
|
||||
if(Itemname_i18n==null || Itemname_i18n.equals("")) {
|
||||
return Material.matchMaterial("ItemBukkitName").name();
|
||||
if(Itemname_i18n==null) {
|
||||
return Material.matchMaterial(ItemBukkitName).name();
|
||||
}else {
|
||||
return Itemname_i18n;
|
||||
}
|
||||
@@ -131,7 +147,7 @@ public class MsgUtil {
|
||||
* on space.
|
||||
*/
|
||||
public static void clean() {
|
||||
System.out.println("Cleaning purchase messages from database that are over a week old...");
|
||||
plugin.getLogger().log(Level.WARNING, "Cleaning purchase messages from database that are over a week old...");
|
||||
// 604800,000 msec = 1 week.
|
||||
long weekAgo = System.currentTimeMillis() - 604800000;
|
||||
plugin.getDB().execute("DELETE FROM messages WHERE time < ?", weekAgo);
|
||||
@@ -168,7 +184,7 @@ public class MsgUtil {
|
||||
p.sendMessage(ChatColor.DARK_PURPLE + "+---------------------------------------------------+");
|
||||
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.getMessage("menu.shop-information"));
|
||||
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.getMessage("menu.owner", shop.ownerName()));
|
||||
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.getMessage("menu.item", MsgUtil.getItemi18n(shop.getDataName().replaceAll(" ", "_"))));
|
||||
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.getMessage("menu.item", MsgUtil.getItemi18n(shop.getDataName())));
|
||||
// if (NMS.isPotion(items.getType())) {
|
||||
// String effects = CustomPotionsName.getEffects(items);
|
||||
// if (!effects.isEmpty()) {
|
||||
@@ -183,7 +199,7 @@ public class MsgUtil {
|
||||
} else {
|
||||
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.getMessage("menu.space", "" + shop.getRemainingSpace()));
|
||||
}
|
||||
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.getMessage("menu.price-per", MsgUtil.getItemi18n(shop.getDataName().replaceAll(" ", "_")), Util.format(shop.getPrice())));
|
||||
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.getMessage("menu.price-per", MsgUtil.getItemi18n(shop.getDataName()),Util.format(shop.getPrice())));
|
||||
if (shop.isBuying()) {
|
||||
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.getMessage("menu.this-shop-is-buying"));
|
||||
} else {
|
||||
@@ -219,7 +235,7 @@ public class MsgUtil {
|
||||
public static void sendPurchaseSuccess(Player p, Shop shop, int amount) {
|
||||
p.sendMessage(ChatColor.DARK_PURPLE + "+---------------------------------------------------+");
|
||||
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.getMessage("menu.successful-purchase"));
|
||||
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.getMessage("menu.item-name-and-price", "" + amount, shop.getDataName(), Util.format((amount * shop.getPrice()))));
|
||||
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.getMessage("menu.item-name-and-price", "" + amount, MsgUtil.getItemi18n(shop.getDataName()), Util.format((amount * shop.getPrice()))));
|
||||
Map<Enchantment, Integer> enchs = shop.getItem().getItemMeta().getEnchants();
|
||||
if (enchs != null && !enchs.isEmpty()) {
|
||||
p.sendMessage(ChatColor.DARK_PURPLE + "+--------------------" + MsgUtil.getMessage("menu.enchants") + "-----------------------+");
|
||||
@@ -257,7 +273,7 @@ public class MsgUtil {
|
||||
public static void sendSellSuccess(Player p, Shop shop, int amount) {
|
||||
p.sendMessage(ChatColor.DARK_PURPLE + "+---------------------------------------------------+");
|
||||
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.getMessage("menu.successfully-sold"));
|
||||
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.getMessage("menu.item-name-and-price", "" + amount, shop.getDataName(), Util.format((amount * shop.getPrice()))));
|
||||
p.sendMessage(ChatColor.DARK_PURPLE + "| " + MsgUtil.getMessage("menu.item-name-and-price", "" + amount, MsgUtil.getItemi18n(shop.getDataName()), Util.format((amount * shop.getPrice()))));
|
||||
if (plugin.getConfig().getBoolean("show-tax")) {
|
||||
double tax = plugin.getConfig().getDouble("tax");
|
||||
double total = amount * shop.getPrice();
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
// nmsDependencies.add(new NMSDependent("v1_13") {
|
||||
// @Override
|
||||
// public void safeGuard(Item item) {
|
||||
// if(QuickShop.debug)System.out.println("safeGuard");
|
||||
// if(QuickShop.debug)plugin.getLogger().log(Level.WARNING, "safeGuard");
|
||||
// ItemStack iStack = item.getItemStack();
|
||||
// net.minecraft.server.v1_13_R1.ItemStack nmsItemStack = org.bukkit.craftbukkit.v1_13_R1.inventory.CraftItemStack.asNMSCopy(iStack);
|
||||
// nmsItemStack.setCount(0);
|
||||
@@ -49,7 +49,7 @@
|
||||
// @Override
|
||||
// public byte[] getNBTBytes(org.bukkit.inventory.ItemStack iStack) {
|
||||
// try{
|
||||
// if(QuickShop.debug)System.out.println("getNBTBytes");
|
||||
// if(QuickShop.debug)plugin.getLogger().log(Level.WARNING, "getNBTBytes");
|
||||
// net.minecraft.server.v1_13_R1.ItemStack is = org.bukkit.craftbukkit.v1_13_R1.inventory.CraftItemStack.asNMSCopy(iStack);
|
||||
// net.minecraft.server.v1_13_R1.NBTTagCompound itemCompound = new net.minecraft.server.v1_13_R1.NBTTagCompound();
|
||||
// itemCompound = is.save(itemCompound);
|
||||
@@ -71,7 +71,7 @@
|
||||
// ItemStack is = null;
|
||||
// is.setData(null);
|
||||
// try{
|
||||
// if(QuickShop.debug)System.out.println("getItemStack");
|
||||
// if(QuickShop.debug)plugin.getLogger().log(Level.WARNING, "getItemStack");
|
||||
// DataInputStream datainputstream = new DataInputStream(new BufferedInputStream(new GZIPInputStream(new ByteArrayInputStream(bytes))));
|
||||
// net.minecraft.server.v1_13_R1.NBTTagCompound nbttagcompound;
|
||||
// try {
|
||||
@@ -131,18 +131,18 @@
|
||||
// }
|
||||
//
|
||||
// public static void safeGuard(Item item) throws ClassNotFoundException {
|
||||
// if(QuickShop.debug)System.out.println("Renaming");
|
||||
// if(QuickShop.debug)plugin.getLogger().log(Level.WARNING, "Renaming");
|
||||
// rename(item.getItemStack());
|
||||
// //if(QuickShop.debug)System.out.println("Protecting");
|
||||
// //if(QuickShop.debug)plugin.getLogger().log(Level.WARNING, "Protecting");
|
||||
// //protect(item);
|
||||
// if(QuickShop.debug)System.out.println("Seting pickup delay");
|
||||
// if(QuickShop.debug)plugin.getLogger().log(Level.WARNING, "Seting pickup delay");
|
||||
// item.setPickupDelay(2147483647);
|
||||
// }
|
||||
//
|
||||
// public static void init() {
|
||||
// String packageName = Bukkit.getServer().getClass().getPackage().getName();
|
||||
// packageName = packageName.substring(packageName.lastIndexOf(".") + 1);
|
||||
// //System.out.println("Package: " + packageName);
|
||||
// //plugin.getLogger().log(Level.WARNING, "Package: " + packageName);
|
||||
// for (NMSDependent dep : nmsDependencies) {
|
||||
// if ((packageName.startsWith(dep.getVersion())) || ((dep.getVersion().isEmpty()) && ((packageName.equals("bukkit")) || (packageName.equals("craftbukkit"))))) {
|
||||
// nms = dep;
|
||||
@@ -200,9 +200,9 @@
|
||||
// countField.set(itemStack, Integer.valueOf(0));
|
||||
// } catch (NoSuchFieldException e) {
|
||||
// e.printStackTrace();
|
||||
// System.out.println("[QuickShop] Could not protect item from pickup properly! Dupes are now possible.");
|
||||
// plugin.getLogger().log(Level.WARNING, "[QuickShop] Could not protect item from pickup properly! Dupes are now possible.");
|
||||
// } catch (Exception e) {
|
||||
// System.out.println("Other error");
|
||||
// plugin.getLogger().log(Level.WARNING, "Other error");
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }*/
|
||||
|
||||
@@ -28,8 +28,6 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.EnchantmentStorageMeta;
|
||||
import org.bukkit.material.MaterialData;
|
||||
import org.bukkit.material.Sign;
|
||||
import org.bukkit.potion.Potion;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.maxgamer.quickshop.QuickShop;
|
||||
import org.maxgamer.quickshop.Shop.Shop;
|
||||
|
||||
@@ -315,7 +313,7 @@ public class Util {
|
||||
// return CustomPotionsName.getFullName(itemStack);
|
||||
// }
|
||||
|
||||
CustomItemName customItemName = QuickShop.instance.getCustomItemNames(itemStack);
|
||||
CustomItemNameAAA customItemName = QuickShop.instance.getCustomItemNames(itemStack);
|
||||
if (customItemName!=null) {
|
||||
return customItemName.getFullName();
|
||||
}
|
||||
@@ -573,9 +571,9 @@ public class Util {
|
||||
* @return true if the given location is loaded or not.
|
||||
*/
|
||||
public static boolean isLoaded(Location loc) {
|
||||
// System.out.println("Checking isLoaded(Location loc)");
|
||||
// plugin.getLogger().log(Level.WARNING, "Checking isLoaded(Location loc)");
|
||||
if (loc.getWorld() == null) {
|
||||
// System.out.println("Is not loaded. (No world)");
|
||||
// plugin.getLogger().log(Level.WARNING, "Is not loaded. (No world)");
|
||||
return false;
|
||||
}
|
||||
// Calculate the chunks coordinates. These are 1,2,3 for each chunk, NOT
|
||||
@@ -583,10 +581,10 @@ public class Util {
|
||||
int x = (int) Math.floor((loc.getBlockX()) / 16.0);
|
||||
int z = (int) Math.floor((loc.getBlockZ()) / 16.0);
|
||||
if (loc.getWorld().isChunkLoaded(x, z)) {
|
||||
// System.out.println("Chunk is loaded " + x + ", " + z);
|
||||
// plugin.getLogger().log(Level.WARNING, "Chunk is loaded " + x + ", " + z);
|
||||
return true;
|
||||
} else {
|
||||
// System.out.println("Chunk is NOT loaded " + x + ", " + z);
|
||||
// plugin.getLogger().log(Level.WARNING, "Chunk is NOT loaded " + x + ", " + z);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user