mirror of
https://e.coding.net/circlecloud/QuickShop.git
synced 2024-11-25 02:28:54 +00:00
Hook WowSuchListener...
Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
parent
5bab17a117
commit
3f781c473c
7
pom.xml
7
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.4.2</version>
|
<version>1.4.3</version>
|
||||||
<build>
|
<build>
|
||||||
<finalName>${project.name}</finalName>
|
<finalName>${project.name}</finalName>
|
||||||
<resources>
|
<resources>
|
||||||
@ -97,6 +97,11 @@
|
|||||||
<type>jar</type>
|
<type>jar</type>
|
||||||
<version>1.0</version>
|
<version>1.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.github.Cnly.WowSuchCleaner</groupId>
|
||||||
|
<artifactId>WowSuchCleaner</artifactId>
|
||||||
|
<version>1.6.1</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mcstats.bukkit</groupId>
|
<groupId>org.mcstats.bukkit</groupId>
|
||||||
<artifactId>metrics</artifactId>
|
<artifactId>metrics</artifactId>
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
package org.maxgamer.QuickShop.Listeners;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Item;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.maxgamer.QuickShop.Util.MarkUtil;
|
||||||
|
|
||||||
|
import io.github.Cnly.WowSuchCleaner.WowSuchCleaner.ItemPreCleanEvent;
|
||||||
|
|
||||||
|
public class WowSuchCleanerListener implements Listener {
|
||||||
|
@EventHandler
|
||||||
|
public void onWSCClear(final ItemPreCleanEvent e) {
|
||||||
|
final List<Item> clearList = new ArrayList<Item>();
|
||||||
|
final List<ItemStack> aucList = new ArrayList<ItemStack>();
|
||||||
|
for (final Item item : e.getItemsToClean()) {
|
||||||
|
if (MarkUtil.hasMark(item.getItemStack())) {
|
||||||
|
clearList.add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (final ItemStack itemStack : e.getItemsToAuction()) {
|
||||||
|
if (MarkUtil.hasMark(itemStack)) {
|
||||||
|
aucList.add(itemStack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
e.getItemsToClean().removeAll(clearList);
|
||||||
|
e.getItemsToAuction().removeAll(aucList);
|
||||||
|
}
|
||||||
|
}
|
@ -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.Plugin;
|
||||||
import org.bukkit.plugin.PluginManager;
|
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;
|
||||||
@ -41,6 +42,7 @@ 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.ProtectListener;
|
||||||
import org.maxgamer.QuickShop.Listeners.WorldListener;
|
import org.maxgamer.QuickShop.Listeners.WorldListener;
|
||||||
|
import org.maxgamer.QuickShop.Listeners.WowSuchCleanerListener;
|
||||||
import org.maxgamer.QuickShop.Shop.ContainerShop;
|
import org.maxgamer.QuickShop.Shop.ContainerShop;
|
||||||
import org.maxgamer.QuickShop.Shop.Shop;
|
import org.maxgamer.QuickShop.Shop.Shop;
|
||||||
import org.maxgamer.QuickShop.Shop.ShopManager;
|
import org.maxgamer.QuickShop.Shop.ShopManager;
|
||||||
@ -61,25 +63,16 @@ public class QuickShop extends JavaPlugin {
|
|||||||
public FileConfig config;
|
public FileConfig config;
|
||||||
// private HeroChatListener heroChatListener;
|
// private HeroChatListener heroChatListener;
|
||||||
// Listeners (These don't)
|
// Listeners (These don't)
|
||||||
private final BlockListener blockListener = new BlockListener(this);
|
|
||||||
// Listeners - We decide which one to use at runtime
|
|
||||||
private ChatListener chatListener;
|
|
||||||
private final ChunkListener chunkListener = new ChunkListener(this);
|
|
||||||
/** The Config Manager used to read config */
|
/** The Config Manager used to read config */
|
||||||
private ConfigManager configManager;
|
private ConfigManager configManager;
|
||||||
|
|
||||||
/** The database for storing all our data for persistence */
|
/** The database for storing all our data for persistence */
|
||||||
private Database database;
|
private Database database;
|
||||||
/** The economy we hook into for transactions */
|
/** The economy we hook into for transactions */
|
||||||
private Economy economy;
|
private Economy economy;
|
||||||
private BukkitTask itemWatcherTask;
|
private BukkitTask itemWatcherTask;
|
||||||
|
|
||||||
private LogWatcher logWatcher;
|
private LogWatcher logWatcher;
|
||||||
private final PlayerListener playerListener = new PlayerListener(this);
|
|
||||||
private final ProtectListener protectListener = new ProtectListener(this);
|
|
||||||
/** The Shop Manager used to store shops */
|
/** The Shop Manager used to store shops */
|
||||||
private ShopManager shopManager;
|
private ShopManager shopManager;
|
||||||
private final WorldListener worldListener = new WorldListener(this);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prints debug information if QuickShop is configured to do so.
|
* Prints debug information if QuickShop is configured to do so.
|
||||||
@ -312,19 +305,29 @@ public class QuickShop extends JavaPlugin {
|
|||||||
MsgUtil.clean();
|
MsgUtil.clean();
|
||||||
// Register events
|
// Register events
|
||||||
final PluginManager pm = this.getServer().getPluginManager();
|
final PluginManager pm = this.getServer().getPluginManager();
|
||||||
pm.registerEvents(blockListener, this);
|
final Plugin wsc = pm.getPlugin("WowSuchCleaner");
|
||||||
pm.registerEvents(playerListener, this);
|
if (wsc != null && wsc.isEnabled()) {
|
||||||
pm.registerEvents(worldListener, this);
|
getLogger().info("发现 WowSuchCleaner 插件 开启相关功能...");
|
||||||
pm.registerEvents(protectListener, this);
|
try {
|
||||||
|
Class.forName("io.github.Cnly.WowSuchCleaner.WowSuchCleaner.ItemPreCleanEvent");
|
||||||
|
pm.registerEvents(new WowSuchCleanerListener(), this);
|
||||||
|
} catch (final ClassNotFoundException e) {
|
||||||
|
getLogger().info("WowSuchCleaner 版本过低 可能造成悬浮物上架...");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pm.registerEvents(new BlockListener(this), this);
|
||||||
|
pm.registerEvents(new PlayerListener(this), this);
|
||||||
|
pm.registerEvents(new WorldListener(this), this);
|
||||||
|
pm.registerEvents(new ProtectListener(this), this);
|
||||||
|
pm.registerEvents(new ChatListener(this), this);
|
||||||
if (configManager.isDisplay()) {
|
if (configManager.isDisplay()) {
|
||||||
Bukkit.getServer().getPluginManager().registerEvents(chunkListener, this);
|
Bukkit.getServer().getPluginManager().registerEvents(new ChunkListener(this), this);
|
||||||
// Display item handler thread
|
// Display item handler thread
|
||||||
getLogger().info("开启商店检查以及悬浮物刷新线程...");
|
getLogger().info("开启商店检查以及悬浮物刷新线程...");
|
||||||
final ItemWatcher itemWatcher = new ItemWatcher(this);
|
final ItemWatcher itemWatcher = new ItemWatcher(this);
|
||||||
itemWatcherTask = Bukkit.getScheduler().runTaskTimer(this, itemWatcher, 20, 1800);
|
itemWatcherTask = Bukkit.getScheduler().runTaskTimer(this, itemWatcher, 20, 1800);
|
||||||
}
|
}
|
||||||
this.chatListener = new ChatListener(this);
|
|
||||||
Bukkit.getServer().getPluginManager().registerEvents(chatListener, this);
|
|
||||||
// Command handlers
|
// Command handlers
|
||||||
final QuickShopCommands commandExecutor = new QuickShopCommands(this);
|
final QuickShopCommands commandExecutor = new QuickShopCommands(this);
|
||||||
getCommand("qs").setExecutor(commandExecutor);
|
getCommand("qs").setExecutor(commandExecutor);
|
||||||
|
@ -9,6 +9,7 @@ authors:
|
|||||||
- 喵♂呜
|
- 喵♂呜
|
||||||
softdepend:
|
softdepend:
|
||||||
- Vault
|
- Vault
|
||||||
|
- WowSuchCleaner
|
||||||
website: ${jenkins.url}/job/${project.artifactId}/
|
website: ${jenkins.url}/job/${project.artifactId}/
|
||||||
commands:
|
commands:
|
||||||
qs:
|
qs:
|
||||||
|
Loading…
Reference in New Issue
Block a user