Abuse spectator mode for SilentContainer (#64, #68)

Potentially causes issues with Cauldron and similar mods that use different mapping names.
This commit is contained in:
Jikoo 2017-07-04 13:22:03 -04:00
parent 784935a975
commit 9db18613a1
55 changed files with 312 additions and 385 deletions

View file

@ -5,7 +5,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinvplugin</artifactId>
<version>3.2.2-SNAPSHOT</version>
<version>3.3.0-SNAPSHOT</version>
</parent>
<artifactId>openinvplugincore</artifactId>
@ -22,12 +22,12 @@
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvcommon</artifactId>
<version>3.2.2-SNAPSHOT</version>
<version>3.3.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvpluginv1_10_r1</artifactId>
<version>3.2.2-SNAPSHOT</version>
<version>3.3.0-SNAPSHOT</version>
</dependency>
</dependencies>

View file

@ -41,6 +41,7 @@ import com.lishid.openinv.internal.IInventoryAccess;
import com.lishid.openinv.internal.ISpecialEnderChest;
import com.lishid.openinv.internal.ISpecialPlayerInventory;
import com.lishid.openinv.listeners.InventoryClickListener;
import com.lishid.openinv.listeners.InventoryCloseListener;
import com.lishid.openinv.listeners.InventoryDragListener;
import com.lishid.openinv.listeners.PlayerListener;
import com.lishid.openinv.listeners.PluginListener;
@ -504,6 +505,7 @@ public class OpenInv extends JavaPlugin implements IOpenInv {
pm.registerEvents(new PlayerListener(this), this);
pm.registerEvents(new PluginListener(this), this);
pm.registerEvents(new InventoryClickListener(this), this);
pm.registerEvents(new InventoryCloseListener(this), this);
// Bukkit will handle missing events for us, attempt to register InventoryDragEvent without a version check
pm.registerEvents(new InventoryDragListener(this), this);

View file

@ -0,0 +1,36 @@
package com.lishid.openinv.listeners;
import com.lishid.openinv.IOpenInv;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryCloseEvent;
/**
*
*
* @author Jikoo
*/
public class InventoryCloseListener implements Listener {
private final IOpenInv plugin;
public InventoryCloseListener(final IOpenInv plugin) {
this.plugin = plugin;
}
@EventHandler
public void onInventoryClose(final InventoryCloseEvent event) {
if (!(event.getPlayer() instanceof Player)) {
return;
}
Player player = (Player) event.getPlayer();
if (this.plugin.getPlayerSilentChestStatus(player)) {
this.plugin.getAnySilentContainer().deactivateContainer(player);
}
}
}

View file

@ -5,7 +5,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinvplugin</artifactId>
<version>3.2.2-SNAPSHOT</version>
<version>3.3.0-SNAPSHOT</version>
</parent>
<artifactId>openinvpluginv1_10_r1</artifactId>
@ -21,7 +21,7 @@
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvcommon</artifactId>
<version>3.2.2-SNAPSHOT</version>
<version>3.3.0-SNAPSHOT</version>
</dependency>
</dependencies>

View file

@ -5,7 +5,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinvparent</artifactId>
<version>3.2.2-SNAPSHOT</version>
<version>3.3.0-SNAPSHOT</version>
</parent>
<artifactId>openinvplugin</artifactId>