mirror of
https://github.com/EarthMC/QuickShop-Reremake.git
synced 2026-11-24 09:39:40 -05:00
Fix #137
Former-commit-id: b6f1975ad0239b10bf00699075b198cd4cd4da71 [formerly 4462c8ab4ba548ba330e06c6979431361e0f7a21] Former-commit-id: 921a5910abd58f0e2692e15a5e28bb8e93f85d51
This commit is contained in:
1 parent
af58664924
commit
af410bcce9
1 file changed
+2
-19
@@ -31,23 +31,7 @@ import org.maxgamer.quickshop.Util.Util;
|
||||
public class PlayerListener implements Listener {
|
||||
private QuickShop plugin;
|
||||
|
||||
/*
|
||||
* Could be useful one day private LinkedList<String> getParents(Class<?>
|
||||
* clazz){ LinkedList<String> classes = new LinkedList<String>();
|
||||
*
|
||||
* while(clazz != null){ classes.add("Extends " + ChatColor.GREEN +
|
||||
* clazz.getCanonicalName()); for(Class<?> iface : clazz.getInterfaces()){
|
||||
* classes.add("Implements " + ChatColor.RED + iface.getCanonicalName());
|
||||
* classes.addAll(getParents(iface)); }
|
||||
*
|
||||
* clazz = clazz.getSuperclass(); } return classes; }
|
||||
*/
|
||||
|
||||
/*
|
||||
* Handles players left clicking a chest. Left click a NORMAL chest with item :
|
||||
* Send creation menu Left click a SHOP chest : Send purchase menu
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onClick(PlayerInteractEvent e) {
|
||||
if (e.getAction().equals(Action.LEFT_CLICK_BLOCK)) {
|
||||
Block b = e.getClickedBlock();
|
||||
@@ -157,6 +141,7 @@ public class PlayerListener implements Listener {
|
||||
plugin.getShopManager().getActions().put(p.getUniqueId(), info);
|
||||
p.sendMessage(
|
||||
MsgUtil.getMessage("how-much-to-trade-for", Util.getItemStackName(e.getItem())));
|
||||
e.setCancelled(true);
|
||||
}
|
||||
} else if (e.getAction().equals(Action.RIGHT_CLICK_BLOCK)
|
||||
&& Util.isWallSign(e.getClickedBlock().getType())) {
|
||||
@@ -186,8 +171,6 @@ public class PlayerListener implements Listener {
|
||||
* Waits for a player to move too far from a shop, then cancels the menu.
|
||||
*/
|
||||
public void onMove(PlayerMoveEvent e) {
|
||||
if (e.isCancelled())
|
||||
return;
|
||||
Info info = plugin.getShopManager().getActions().get(e.getPlayer().getUniqueId());
|
||||
if (info != null) {
|
||||
Player p = e.getPlayer();
|
||||
|
||||
Reference in new issue
Block a user