mirror of
https://github.com/EarthMC/QuickShop-Reremake.git
synced 2026-11-24 17:39:52 -05:00
Fixed log system
Former-commit-id: d34104a22910f3fb05f25acac764be3cbbdfa449 [formerly 52a71e3c1ed499a4bf0e433057357e6c1ee32050] Former-commit-id: 708691e4517733a815194eb4eac88a4a34186cbf
This commit is contained in:
1 parent
474ff1ca2f
commit
05f483f721
7 files changed
+33
-9
No files matched your search
@@ -22,7 +22,8 @@ public class ChatListener implements Listener {
|
||||
return;
|
||||
}
|
||||
if (!plugin.getShopManager().getActions().containsKey(e.getPlayer().getUniqueId())) {
|
||||
plugin.log(plugin.getShopManager().getActions().toString());
|
||||
plugin.log(e.getPlayer().getName() + "(" + e.getPlayer().getUniqueId().toString() + ") was " + plugin.getShopManager()
|
||||
.getActions().get(e.getPlayer().getUniqueId()).getAction().name() + " the shop.");
|
||||
return;
|
||||
}
|
||||
plugin.getShopManager().handleChat(e.getPlayer(), e.getMessage());
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.maxgamer.quickshop.Listeners;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
||||
import lombok.*;
|
||||
import org.bukkit.Chunk;
|
||||
@@ -26,10 +27,18 @@ public class ChunkListener implements Listener {
|
||||
HashMap<Location, Shop> inChunk = plugin.getShopManager().getShops(c);
|
||||
if (inChunk == null || inChunk.isEmpty())
|
||||
return;
|
||||
HashMap<Location, Shop> inChunkClone = new HashMap<>();
|
||||
Iterator<Location> locationIterator = inChunk.keySet().iterator();
|
||||
/** Clone HashMap to fix ConcurrentModificationException **/
|
||||
while (locationIterator.hasNext()) {
|
||||
Location key = locationIterator.next();
|
||||
inChunkClone.put(key, inChunk.get(key));
|
||||
}
|
||||
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (Shop shop : inChunk.values()) {
|
||||
for (Shop shop : inChunkClone.values()) {
|
||||
shop.onLoad();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -754,6 +754,11 @@ public class QuickShop extends JavaPlugin {
|
||||
this.priceChangeRequiresFee = this.getConfig().getBoolean("shop.price-change-requires-fee");
|
||||
this.displayItemCheckTicks = this.getConfig().getInt("shop.display-items-check-ticks");
|
||||
language = new Language(this); //Init locale
|
||||
if (this.getConfig().getBoolean("log-actions")) {
|
||||
logWatcher = new LogWatcher(this, new File(getDataFolder(), "qs.log"));
|
||||
} else {
|
||||
logWatcher = null;
|
||||
}
|
||||
MsgUtil.loadCfgMessages();
|
||||
}
|
||||
|
||||
|
||||
@@ -610,7 +610,7 @@ public class ShopManager {
|
||||
p.sendMessage(MsgUtil.getMessage("chest-was-removed"));
|
||||
return;
|
||||
}
|
||||
if (info.getLocation().getWorld().getBlockAt(info.getLocation()).getType() == Material.ENDER_CHEST) {
|
||||
if (info.getLocation().getBlock().getType() == Material.ENDER_CHEST) {
|
||||
if (!p.hasPermission("quickshop.create.enderchest"))
|
||||
return;
|
||||
}
|
||||
@@ -623,8 +623,7 @@ public class ShopManager {
|
||||
return;
|
||||
}
|
||||
Material signType = info.getSignBlock().getType();
|
||||
if (signType != Material.AIR && signType != Material.CAVE_AIR
|
||||
&& signType != Material.VOID_AIR && signType != Material.WATER) {
|
||||
if (Util.isAir(signType) && signType != Material.WATER) {
|
||||
p.sendMessage(MsgUtil.getMessage("failed-to-put-sign"));
|
||||
return;
|
||||
}
|
||||
@@ -720,8 +719,8 @@ public class ShopManager {
|
||||
p.sendMessage(MsgUtil.getMessage("buying-more-than-selling"));
|
||||
}
|
||||
}
|
||||
}
|
||||
/* They didn't enter a number. */ catch (NumberFormatException ex) {
|
||||
} catch (NumberFormatException ex) {
|
||||
//No number input
|
||||
p.sendMessage(MsgUtil.getMessage("shop-creation-cancelled"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,7 +187,6 @@ public class ItemMatcher {
|
||||
if (meta1.hasEnchants()) {
|
||||
Map<Enchantment, Integer> enchMap1 = meta1.getEnchants();
|
||||
Map<Enchantment, Integer> enchMap2 = meta2.getEnchants();
|
||||
|
||||
if (!Util.mapDuoMatches(enchMap1, enchMap2))
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -830,9 +830,12 @@ public class MsgUtil {
|
||||
*/
|
||||
public static void sendExploitAlert(@NotNull Object objectDo, @NotNull String action, @NotNull Location location) {
|
||||
Util.sendMessageToOps(ChatColor.RED + "[QuickShop][ExploitAlert] A displayItem exploit was found!");
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("[ExploitAlert] A displayItem exploit was found!");
|
||||
if (objectDo instanceof Player) {
|
||||
Player player = (Player) objectDo;
|
||||
Util.sendMessageToOps(ChatColor.RED + "Exploiter: " + "Player=" + player.getName());
|
||||
builder.append(" #Player=").append(player.getName());
|
||||
}
|
||||
if (objectDo instanceof Inventory) {
|
||||
Inventory inventory = (Inventory) objectDo;
|
||||
@@ -844,22 +847,28 @@ public class MsgUtil {
|
||||
if (tamer != null) {
|
||||
Util.sendMessageToOps(ChatColor.RED + "Exploiter: " + "LivingEntity=" + livingEntity.getType()
|
||||
.name() + "; Tamer=" + Bukkit.getOfflinePlayer(tamer.getUniqueId()));
|
||||
builder.append(" #LivingEntity=").append(livingEntity.getType().name()).append(", Tamer=").append(Bukkit
|
||||
.getOfflinePlayer(tamer.getUniqueId()));
|
||||
} else {
|
||||
Util.sendMessageToOps(ChatColor.RED + "Exploiter: " + "LivingEntity=" + livingEntity.getType()
|
||||
.name());
|
||||
}
|
||||
}
|
||||
Util.sendMessageToOps(ChatColor.RED + "Exploiter: " + "LivingEntity=" + livingEntity.getType().name());
|
||||
builder.append(" #LivingEntity=").append(livingEntity.getType().name());
|
||||
}
|
||||
if (inventory.getHolder() instanceof Block) {
|
||||
Block block = (Block) inventory;
|
||||
Util.sendMessageToOps(ChatColor.RED + "Exploiter: " + "Block=" + block.getType().name());
|
||||
builder.append(" #Block=").append(block.getType().name());
|
||||
}
|
||||
Util.sendMessageToOps(ChatColor.RED + "Exploiter: Unknown Inventory");
|
||||
}
|
||||
Util.sendMessageToOps(ChatColor.RED + "Action: " + action);
|
||||
builder.append(" #Action=").append(action);
|
||||
Util.sendMessageToOps(ChatColor.RED + "Location: " + "World=" + location.getWorld().getName() + " X=" + location
|
||||
.getBlockX() + " Y=" + location.getBlockY() + " Z=" + location.getBlockZ());
|
||||
builder.append(" #Location=").append(location.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -522,7 +522,9 @@ public class Util {
|
||||
* @param material mat
|
||||
* @return is or not a wall_sign
|
||||
*/
|
||||
public static boolean isWallSign(@NotNull Material material) {
|
||||
public static boolean isWallSign(@Nullable Material material) {
|
||||
if (material == null)
|
||||
return false;
|
||||
try {
|
||||
return Tag.WALL_SIGNS.isTagged(material);
|
||||
} catch (NoSuchFieldError e) {
|
||||
|
||||
Reference in new issue
Block a user