Merge remote-tracking branch 'origin/master'

This commit is contained in:
Ghost_chu committed 2021-07-12 19:56:52 +08:00
commit 2d1899496f
9 files changed
+31 -27

No files matched your search

@@ -148,7 +148,6 @@ public class DatabaseManager {
* Internal method, runTasks in queue.
*/
private synchronized void runTask() { // synchronized for QUICKSHOP-WX
synchronized (sqlQueue) {
if (sqlQueue.isEmpty()) {
return;
}
@@ -199,7 +198,6 @@ public class DatabaseManager {
} finally {
dbconnection.release();
}
}
// try {
// this.database.getConnection().commit();
@@ -229,9 +227,7 @@ public class DatabaseManager {
*/
public void addDelayTask(DatabaseTask task) {
if (useQueue) {
synchronized (sqlQueue) {
sqlQueue.offer(task);
}
sqlQueue.offer(task);
} else {
runInstantTask(task);
}
@@ -24,7 +24,6 @@ import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.block.Sign;
import org.bukkit.block.data.type.WallSign;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@@ -114,7 +113,7 @@ public class LockListener extends ProtectionListenerBase {
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onSignPlace(BlockPlaceEvent event) {
Block placedBlock = event.getBlock();
if (!(placedBlock.getBlockData() instanceof WallSign)) {
if (!(placedBlock.getState() instanceof Sign)) {
return;
}
Block posShopBlock = Util.getAttached(placedBlock);
@@ -676,12 +676,6 @@ public class ContainerShop implements Shop {
public void setSignText(@NotNull String[] lines) {
Util.ensureThread(false);
List<Sign> signs = this.getSigns();
boolean signGlowing = plugin.getConfig().getBoolean("shop.sign-glowing");
DyeColor dyeColor = null;
try {
dyeColor = DyeColor.valueOf(plugin.getConfig().getString("shop.sign-dye-color"));
} catch (IllegalArgumentException ignored) {
}
for (Sign sign : signs) {
if (Arrays.equals(sign.getLines(), lines)) {
continue;
@@ -689,11 +683,15 @@ public class ContainerShop implements Shop {
for (int i = 0; i < lines.length; i++) {
sign.setLine(i, lines[i]);
}
if (plugin.getGameVersion().isSignTextDyeSupport() && dyeColor != null) {
sign.setColor(dyeColor);
if (plugin.getGameVersion().isSignTextDyeSupport()) {
DyeColor dyeColor = Util.getDyeColor();
if (dyeColor != null) {
sign.setColor(dyeColor);
}
}
if (signGlowing && plugin.getGameVersion().isSignGlowingSupport()) {
sign.setGlowingText(true);
if (plugin.getGameVersion().isSignGlowingSupport()) {
boolean isGlowing = plugin.getConfig().getBoolean("shop.sign-glowing");
sign.setGlowingText(isGlowing);
}
sign.update(true);
plugin.getServer().getPluginManager().callEvent(new ShopSignUpdateEvent(this, sign));
@@ -66,6 +66,7 @@ public class ShopManager {
private final QuickShop plugin;
@Getter
@Nullable
private final Trader cacheTaxAccount;
@Getter
private final Trader cacheUnlimitedShopAccount;
@@ -27,6 +27,7 @@ import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.events.PacketEvent;
import com.comphenix.protocol.injector.server.TemporaryPlayer;
import com.comphenix.protocol.reflect.StructureModifier;
import com.comphenix.protocol.utility.MinecraftVersion;
import com.comphenix.protocol.wrappers.WrappedChatComponent;
import com.comphenix.protocol.wrappers.WrappedDataWatcher;
import org.bukkit.Chunk;
@@ -462,7 +463,12 @@ public class VirtualDisplayItem extends DisplayItem {
fakeItemDestroyPacket.getIntegerArrays().write(0, new int[]{entityID});
} else {
//1.17+
if (protocolManager.getMinecraftVersion().getMinor() >= 1) {
MinecraftVersion minecraftVersion = protocolManager.getMinecraftVersion();
if (minecraftVersion.getMajor() == 1 && minecraftVersion.getMinor() == 17 && minecraftVersion.getBuild() == 0) {
//On 1.17, just need to write a int
//Entity to remove
fakeItemDestroyPacket.getIntegers().write(0, entityID);
} else {
//On 1.17.1 (may be 1.17.1+? it's enough, Mojang, stop the changes), we need add the int list
//Entity to remove
try {
@@ -470,10 +476,6 @@ public class VirtualDisplayItem extends DisplayItem {
} catch (NoSuchMethodError e) {
throw new RuntimeException("Unable to initialize packet, ProtocolLib update needed", e);
}
} else {
//On 1.17, just need to write a int
//Entity to remove
fakeItemDestroyPacket.getIntegers().write(0, entityID);
}
}
return fakeItemDestroyPacket;
@@ -84,6 +84,9 @@ public class Util {
private static List<String> worldBlacklist = new ArrayList<>(5);
@Getter
private static boolean disableDebugLogger = false;
@Getter
@Nullable
private static DyeColor dyeColor = null;
private static boolean currencySymbolOnRight;
private static String alternateCurrencySymbol;
private static boolean disableVaultFormat;
@@ -675,7 +678,10 @@ public class Util {
}
worldBlacklist = plugin.getConfig().getStringList("shop.blacklist-world");
disableDebugLogger = plugin.getConfig().getBoolean("debug.disable-debuglogger", false);
try {
dyeColor = DyeColor.valueOf(plugin.getConfig().getString("shop.sign-dye-color"));
} catch (Exception ignored) {
}
currencySymbolOnRight = plugin.getConfig().getBoolean("shop.currency-symbol-on-right", false);
alternateCurrencySymbol = plugin.getConfig().getString("shop.alternate-currency-symbol", "$");
disableVaultFormat = plugin.getConfig().getBoolean("shop.disable-vault-format", false);
@@ -26,6 +26,7 @@ import org.bukkit.scheduler.BukkitRunnable;
import org.jetbrains.annotations.NotNull;
import org.maxgamer.quickshop.QuickShop;
import org.maxgamer.quickshop.economy.EconomyTransaction;
import org.maxgamer.quickshop.economy.Trader;
import org.maxgamer.quickshop.shop.Shop;
import org.maxgamer.quickshop.util.MsgUtil;
import org.maxgamer.quickshop.util.Util;
@@ -67,13 +68,14 @@ public class OngoingFeeWatcher extends BukkitRunnable {
World world = location.getWorld();
//We must check balance manually to avoid shop missing hell when tax account broken
if (allowLoan || plugin.getEconomy().getBalance(shopOwner, Objects.requireNonNull(world), shop.getCurrency()) >= cost) {
Trader trader = plugin.getShopManager().getCacheTaxAccount();
Util.mainThreadRun(() -> {
EconomyTransaction transaction = EconomyTransaction.builder()
.allowLoan(allowLoan)
.currency(shop.getCurrency())
.core(plugin.getEconomy())
.world(world)
.to(plugin.getShopManager().getCacheTaxAccount().getUniqueId())
.to(trader == null ? null : trader.getUniqueId())
.from(shopOwner).build();
boolean success = transaction.failSafeCommit();
+1 -1
View File
@@ -34,7 +34,7 @@
"negative-amount": "&cNo puedes comerciar con valores negativos",
"not-a-number": "&cSolo puedes introducir un número, tu entrada era {0}.",
"exceeded-maximum": "&cEl valor excedió el valor máximo en Java.",
"not-a-integer": "&cYou must input a integer, your input was {0}.",
"not-a-integer": "&cSolo puedes introducir un número, tu entrada era {0}.",
"player-bought-from-your-store": "&c{0} ha comprado {1} {2} en tu tienda, y has pagado {3} en impuestos.",
"shop-out-of-stock": "&5Tu tienda en {0}, {1}, {2} se ha quedado sin {3}!",
"shop-has-no-space": "&cLa tienda sólo tiene espacio para {0} más {1}.",