Install errors uploader

Former-commit-id: 2ff2bd7188e5ad396543f0b018ee5a1d3f3d73bd [formerly 01ea781323812dd1401408a5beca2d27ffa2544f]
Former-commit-id: fe21f080d6c12061b76cd9ea58e9efa1204d5919
This commit is contained in:
Ghost_chu committed 2019-06-02 21:42:30 +08:00
1 parent 78c83ba8a9
commit 6d18c16a4e
4 files changed
+42 -10

No files matched your search

@@ -76,6 +76,7 @@ public class QuickShop extends JavaPlugin {
/** The plugin OpenInv (null if not present) */
private Plugin openInvPlugin;
/** The shop limites. **/
private HashMap<String, Integer> limits = new HashMap<>();
/** Use SpoutPlugin to get item / block names */
private boolean useSpout = false;
@@ -85,20 +86,33 @@ public class QuickShop extends JavaPlugin {
private int displayItemCheckTicks;
private boolean noopDisable;
private boolean setupDBonEnableding = false;
/** Default database prefix, can overwrite by config **/
private String dbPrefix = "";
private Tab commandTabCompleter;
/** bStats, good helper for metrics. **/
private Metrics metrics;
/** Language manager, to select which language will loaded. **/
private Language language;
/** The BootError, if it not NULL, plugin will stop loading and show setted errors when use /qs **/
private BootError bootError;
private CustomInventoryListener customInventoryListener;
/** WIP **/
private Compatibility compatibilityTool = new Compatibility(this);
/** Queued shop manager **/
private QueuedShopManager queuedShopManager;
/** Rewrited shoploader, more faster. **/
private ShopLoader shopLoader;
/** Contains all SQL tasks **/
private DatabaseHelper databaseHelper;
/** Queued database manager **/
private DatabaseManager databaseManager;
/** A util to call to check some actions permission **/
private PermissionChecker permissionChecker;
private SentryErrorReporter sentryErrorReporter;
/** The server UniqueID, use to the ErrorReporter **/
private static UUID serverUniqueID;
/** The error reporter to help devs report errors to Sentry.io **/
private SentryErrorReporter sentryErrorReporter;
//private LWCPlugin lwcPlugin;
/**
@@ -647,11 +647,11 @@ public class ShopManager {
}
}
double tax = plugin.getConfig().getDouble("shop.cost");
double createCost = plugin.getConfig().getDouble("shop.cost");
// Tax refers to the cost to create a shop. Not actual
// tax, that would be silly
if (tax != 0 && plugin.getEcon().getBalance(p.getUniqueId()) < tax) {
p.sendMessage(MsgUtil.getMessage("you-cant-afford-a-new-shop", format(tax)));
if (createCost != 0 && plugin.getEcon().getBalance(p.getUniqueId()) < createCost) {
p.sendMessage(MsgUtil.getMessage("you-cant-afford-a-new-shop", format(createCost)));
return;
}
// Create the sample shop.
@@ -667,15 +667,15 @@ public class ShopManager {
// This must be called after the event has been called.
// Else, if the event is cancelled, they won't get their
// money back.
if (tax != 0) {
if (!plugin.getEcon().withdraw(p.getUniqueId(), tax)) {
p.sendMessage(MsgUtil.getMessage("you-cant-afford-a-new-shop", format(tax)));
if (createCost != 0) {
if (!plugin.getEcon().withdraw(p.getUniqueId(), createCost)) {
p.sendMessage(MsgUtil.getMessage("you-cant-afford-a-new-shop", format(createCost)));
shop.onUnload();
return;
}
try {
plugin.getEcon().deposit(
Bukkit.getOfflinePlayer(plugin.getConfig().getString("tax-account")).getUniqueId(), tax);
Bukkit.getOfflinePlayer(plugin.getConfig().getString("tax-account")).getUniqueId(), createCost);
} catch (Exception e2) {
e2.printStackTrace();
plugin.getLogger().log(Level.WARNING,
@@ -172,7 +172,8 @@ public class SentryErrorReporter {
if (Util.isDevMode()) {
return true;
}
return false;
sendError(record.getThrown(), record.getMessage());
return false; //Hide errors
}
}
@@ -125,6 +125,7 @@ public class Util {
}
public static boolean isShoppables(Material material) {
Util.debugLog("" + shoppables.contains(material));
return shoppables.contains(material);
}
@@ -177,18 +178,21 @@ public class Util {
return false;
}
if ((bs instanceof InventoryHolder == false) && b.getType() != Material.ENDER_CHEST) {
Util.debugLog("Not InventoryHolder");
return false;
}
if (b.getType() == Material.ENDER_CHEST) {
if (plugin.getOpenInvPlugin() == null) {
Util.debugLog("OpenInv not loaded.");
return false;
}
}
return (isShoppables(b.getType()) && isBlacklistWorld(b.getWorld()));
return ((isShoppables(b.getType()) && isBlacklistWorld(b.getWorld())));
}
public static boolean isBlacklistWorld(World world) {
Util.debugLog("" + worldBlacklist.contains(world.getName()));
return worldBlacklist.contains(world.getName());
}
@@ -441,6 +445,13 @@ public class Util {
}
}
/**
* Remapping the INT to ROMAIN
* 10=X 9=IX 5=V 4=IV 1=I
*
* @param value
* @return
*/
public static String toRomain(Integer value) {
return toRoman(value.intValue());
}
@@ -484,6 +495,7 @@ public class Util {
/**
* Compares two items to each other. Returns true if they match.
* Rewrite it to use more faster hashCode.
*
* @param stack1 The first item stack
* @param stack2 The second item stack
@@ -555,6 +567,11 @@ public class Util {
return true;
}
/**
* Sort the HashMap
* @param map
* @return Sorted HashMap
*/
public static Map sortHashMap(Map map) {
List<Map.Entry<String, String>> list = new ArrayList<Map.Entry<String, String>>(map.entrySet());
Collections.sort(list, new Comparator<Map.Entry<String, String>>() {