mirror of
https://e.coding.net/circlecloud/QuickShop.git
synced 2024-11-22 01:58:54 +00:00
fix some bug and Release Version 1.3...
Signed-off-by: j502647092 <jtb1@163.com>
This commit is contained in:
parent
ba8848eff4
commit
3bcee64220
2
pom.xml
2
pom.xml
@ -3,7 +3,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.maxgamer</groupId>
|
<groupId>org.maxgamer</groupId>
|
||||||
<artifactId>QuickShop</artifactId>
|
<artifactId>QuickShop</artifactId>
|
||||||
<version>1.2</version>
|
<version>1.3</version>
|
||||||
<build>
|
<build>
|
||||||
<finalName>${project.name}</finalName>
|
<finalName>${project.name}</finalName>
|
||||||
<resources>
|
<resources>
|
||||||
|
@ -37,7 +37,7 @@ public class ConfigManager {
|
|||||||
protected int findDistance = 30;
|
protected int findDistance = 30;
|
||||||
protected Material superItem = Material.GOLD_AXE;
|
protected Material superItem = Material.GOLD_AXE;
|
||||||
protected double feeForPriceChange = 0.0;
|
protected double feeForPriceChange = 0.0;
|
||||||
|
protected boolean preventhopper = false;
|
||||||
/** Use SpoutPlugin to get item / block names */
|
/** Use SpoutPlugin to get item / block names */
|
||||||
protected boolean useSpout = false;
|
protected boolean useSpout = false;
|
||||||
|
|
||||||
@ -65,6 +65,7 @@ public class ConfigManager {
|
|||||||
this.priceChangeRequiresFee = plugin.getConfig().getBoolean("shop.price-change-requires-fee");
|
this.priceChangeRequiresFee = plugin.getConfig().getBoolean("shop.price-change-requires-fee");
|
||||||
this.findDistance = plugin.getConfig().getInt("shop.find-distance");
|
this.findDistance = plugin.getConfig().getInt("shop.find-distance");
|
||||||
this.feeForPriceChange = plugin.getConfig().getDouble("shop.fee-for-price-change");
|
this.feeForPriceChange = plugin.getConfig().getDouble("shop.fee-for-price-change");
|
||||||
|
this.preventhopper = plugin.getConfig().getBoolean("preventhopper");
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getFeeForPriceChange() {
|
public double getFeeForPriceChange() {
|
||||||
@ -107,6 +108,10 @@ public class ConfigManager {
|
|||||||
return logAction;
|
return logAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isPreventHopper() {
|
||||||
|
return preventhopper;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isPriceChangeRequiresFee() {
|
public boolean isPriceChangeRequiresFee() {
|
||||||
return priceChangeRequiresFee;
|
return priceChangeRequiresFee;
|
||||||
}
|
}
|
||||||
|
@ -12,20 +12,17 @@ import org.bukkit.event.EventHandler;
|
|||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.event.block.Action;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||||
import org.bukkit.inventory.Inventory;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.util.BlockIterator;
|
import org.bukkit.util.BlockIterator;
|
||||||
import org.maxgamer.QuickShop.QuickShop;
|
import org.maxgamer.QuickShop.QuickShop;
|
||||||
import org.maxgamer.QuickShop.Shop.Info;
|
import org.maxgamer.QuickShop.Shop.Info;
|
||||||
import org.maxgamer.QuickShop.Shop.Shop;
|
import org.maxgamer.QuickShop.Shop.Shop;
|
||||||
import org.maxgamer.QuickShop.Shop.ShopAction;
|
import org.maxgamer.QuickShop.Shop.ShopAction;
|
||||||
import org.maxgamer.QuickShop.Util.MarkUtil;
|
|
||||||
import org.maxgamer.QuickShop.Util.MsgUtil;
|
import org.maxgamer.QuickShop.Util.MsgUtil;
|
||||||
import org.maxgamer.QuickShop.Util.Util;
|
import org.maxgamer.QuickShop.Util.Util;
|
||||||
|
|
||||||
@ -120,21 +117,6 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onItemClick(final InventoryClickEvent e) {
|
|
||||||
final Player p = (Player) e.getWhoClicked();
|
|
||||||
final ItemStack ci = e.getCurrentItem();
|
|
||||||
final Inventory inv = e.getInventory();
|
|
||||||
final int solt = e.getSlot();
|
|
||||||
try {
|
|
||||||
if (MarkUtil.hasMark(ci)) {
|
|
||||||
inv.setItem(solt, new ItemStack(Material.AIR));
|
|
||||||
Bukkit.broadcastMessage("§6[§b快捷商店§6] §4警告 " + p.getDisplayName() + " §c非法获取快捷商店悬浮物品 已清理...");
|
|
||||||
}
|
|
||||||
} catch (final Exception ex) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onJoin(final PlayerJoinEvent e) {
|
public void onJoin(final PlayerJoinEvent e) {
|
||||||
// Notify the player any messages they were sent
|
// Notify the player any messages they were sent
|
||||||
|
@ -1,28 +1,81 @@
|
|||||||
package org.maxgamer.QuickShop.Listeners;
|
package org.maxgamer.QuickShop.Listeners;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
import org.bukkit.event.inventory.InventoryMoveItemEvent;
|
import org.bukkit.event.inventory.InventoryMoveItemEvent;
|
||||||
|
import org.bukkit.event.inventory.InventoryPickupItemEvent;
|
||||||
|
import org.bukkit.event.player.PlayerItemHeldEvent;
|
||||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||||
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.maxgamer.QuickShop.QuickShop;
|
||||||
import org.maxgamer.QuickShop.Util.MarkUtil;
|
import org.maxgamer.QuickShop.Util.MarkUtil;
|
||||||
|
|
||||||
public class ProtectListener {
|
public class ProtectListener implements Listener {
|
||||||
|
|
||||||
|
private final QuickShop plugin;
|
||||||
|
|
||||||
|
public ProtectListener(final QuickShop plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onInvMove(final InventoryMoveItemEvent e) {
|
public void onInvMove(final InventoryMoveItemEvent e) {
|
||||||
final ItemStack ci = e.getItem();
|
final ItemStack ci = e.getItem();
|
||||||
if (MarkUtil.hasMark(ci)) {
|
if (MarkUtil.hasMark(ci)) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
|
final ItemStack[] items = e.getSource().getContents();
|
||||||
|
for (final ItemStack itemStack : items) {
|
||||||
|
if (MarkUtil.hasMark(itemStack)) {
|
||||||
|
itemStack.setType(Material.AIR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
e.getSource().setContents(items);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @EventHandler
|
@EventHandler
|
||||||
// public void onInvPickup(final InventoryPickupItemEvent e) {
|
public void onInvPickup(final InventoryPickupItemEvent e) {
|
||||||
// final ItemStack ci = e.getItem().getItemStack();
|
if (!plugin.getConfigManager().isPreventHopper()) {
|
||||||
// if (MarkUtil.hasMark(ci)) {
|
return;
|
||||||
// e.setCancelled(true);
|
}
|
||||||
// }
|
final ItemStack ci = e.getItem().getItemStack();
|
||||||
// }
|
if (MarkUtil.hasMark(ci)) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onItemClick(final InventoryClickEvent e) {
|
||||||
|
final Player p = (Player) e.getWhoClicked();
|
||||||
|
final ItemStack ci = e.getCurrentItem();
|
||||||
|
final Inventory inv = e.getInventory();
|
||||||
|
final int solt = e.getSlot();
|
||||||
|
try {
|
||||||
|
if (MarkUtil.hasMark(ci)) {
|
||||||
|
inv.setItem(solt, new ItemStack(Material.AIR));
|
||||||
|
Bukkit.broadcastMessage("§6[§b快捷商店§6] §4警告 " + p.getDisplayName() + " §c非法 §d§l获取 " + ci.getItemMeta().getDisplayName() + " §a已清理...");
|
||||||
|
}
|
||||||
|
} catch (final Exception ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerHandlerItem(final PlayerItemHeldEvent e) {
|
||||||
|
final Player p = e.getPlayer();
|
||||||
|
final ItemStack[] cis = p.getInventory().getArmorContents();
|
||||||
|
for (final ItemStack itemStack : cis) {
|
||||||
|
if (MarkUtil.hasMark(itemStack)) {
|
||||||
|
Bukkit.broadcastMessage("§6[§b快捷商店§6] §4警告 " + p.getDisplayName() + " §c非法 §e§l穿戴 " + itemStack.getItemMeta().getDisplayName() + " §a已清理...");
|
||||||
|
itemStack.setType(Material.AIR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
p.getInventory().setArmorContents(cis);
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerPickup(final PlayerPickupItemEvent e) {
|
public void onPlayerPickup(final PlayerPickupItemEvent e) {
|
||||||
@ -31,5 +84,4 @@ public class ProtectListener {
|
|||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ import org.bukkit.configuration.file.FileConfiguration;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.InventoryHolder;
|
import org.bukkit.inventory.InventoryHolder;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
import org.maxgamer.QuickShop.Command.QS;
|
import org.maxgamer.QuickShop.Command.QS;
|
||||||
@ -38,6 +39,7 @@ import org.maxgamer.QuickShop.Listeners.ChatListener;
|
|||||||
import org.maxgamer.QuickShop.Listeners.ChunkListener;
|
import org.maxgamer.QuickShop.Listeners.ChunkListener;
|
||||||
import org.maxgamer.QuickShop.Listeners.LockListener;
|
import org.maxgamer.QuickShop.Listeners.LockListener;
|
||||||
import org.maxgamer.QuickShop.Listeners.PlayerListener;
|
import org.maxgamer.QuickShop.Listeners.PlayerListener;
|
||||||
|
import org.maxgamer.QuickShop.Listeners.ProtectListener;
|
||||||
import org.maxgamer.QuickShop.Listeners.WorldListener;
|
import org.maxgamer.QuickShop.Listeners.WorldListener;
|
||||||
import org.maxgamer.QuickShop.Shop.ContainerShop;
|
import org.maxgamer.QuickShop.Shop.ContainerShop;
|
||||||
import org.maxgamer.QuickShop.Shop.Shop;
|
import org.maxgamer.QuickShop.Shop.Shop;
|
||||||
@ -72,6 +74,7 @@ public class QuickShop extends JavaPlugin {
|
|||||||
// Listeners (These don't)
|
// Listeners (These don't)
|
||||||
private final BlockListener blockListener = new BlockListener(this);
|
private final BlockListener blockListener = new BlockListener(this);
|
||||||
private final PlayerListener playerListener = new PlayerListener(this);
|
private final PlayerListener playerListener = new PlayerListener(this);
|
||||||
|
private final ProtectListener protectListener = new ProtectListener(this);
|
||||||
private final ChunkListener chunkListener = new ChunkListener(this);
|
private final ChunkListener chunkListener = new ChunkListener(this);
|
||||||
private final WorldListener worldListener = new WorldListener(this);
|
private final WorldListener worldListener = new WorldListener(this);
|
||||||
private BukkitTask itemWatcherTask;
|
private BukkitTask itemWatcherTask;
|
||||||
@ -316,9 +319,11 @@ public class QuickShop extends JavaPlugin {
|
|||||||
MsgUtil.loadTransactionMessages();
|
MsgUtil.loadTransactionMessages();
|
||||||
MsgUtil.clean();
|
MsgUtil.clean();
|
||||||
// Register events
|
// Register events
|
||||||
Bukkit.getServer().getPluginManager().registerEvents(blockListener, this);
|
final PluginManager pm = this.getServer().getPluginManager();
|
||||||
Bukkit.getServer().getPluginManager().registerEvents(playerListener, this);
|
pm.registerEvents(blockListener, this);
|
||||||
Bukkit.getServer().getPluginManager().registerEvents(worldListener, this);
|
pm.registerEvents(playerListener, this);
|
||||||
|
pm.registerEvents(worldListener, this);
|
||||||
|
pm.registerEvents(protectListener, this);
|
||||||
if (configManager.isDisplay()) {
|
if (configManager.isDisplay()) {
|
||||||
Bukkit.getServer().getPluginManager().registerEvents(chunkListener, this);
|
Bukkit.getServer().getPluginManager().registerEvents(chunkListener, this);
|
||||||
// Display item handler thread
|
// Display item handler thread
|
||||||
@ -334,6 +339,7 @@ public class QuickShop extends JavaPlugin {
|
|||||||
if (configManager.getFindDistance() > 100) {
|
if (configManager.getFindDistance() > 100) {
|
||||||
getLogger().warning("商店查找半径过大 可能导致服务器Lag! 推荐使用低于 100 的配置!");
|
getLogger().warning("商店查找半径过大 可能导致服务器Lag! 推荐使用低于 100 的配置!");
|
||||||
}
|
}
|
||||||
|
this.getLogger().info("载入完成! 版本: " + this.getDescription().getVersion() + " 重制 by 喵♂呜");
|
||||||
new VersionChecker(this);
|
new VersionChecker(this);
|
||||||
try {
|
try {
|
||||||
final Metrics metrics = new Metrics(this);
|
final Metrics metrics = new Metrics(this);
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
Version: 1.0
|
Version: 1.1
|
||||||
|
|
||||||
#超级工具(OP可以用该工具在创造模式打破所有商店)
|
#超级工具(OP可以用该工具在创造模式打破所有商店)
|
||||||
superitem: GOLD_AXE
|
superitem: GOLD_AXE
|
||||||
|
#阻止漏洞吸取商店物品(非特殊情况不要开启)
|
||||||
|
preventhopper: false
|
||||||
|
|
||||||
#Tax amount (decimal) - Eg, P1 buys $50 worth of stuff from P2. Therefore, P1 loses $50, P2 gains $(1-0.05)*50, and tax-account gains $(0.05)*50.
|
#Tax amount (decimal) - Eg, P1 buys $50 worth of stuff from P2. Therefore, P1 loses $50, P2 gains $(1-0.05)*50, and tax-account gains $(0.05)*50.
|
||||||
tax: 0.05
|
tax: 0.05
|
||||||
|
Loading…
Reference in New Issue
Block a user