mirror of
https://github.com/TotalFreedomMC/OpenInv.git
synced 2024-12-23 00:15:08 +00:00
Potentially causes issues with Cauldron and similar mods that use different mapping names.
This commit is contained in:
parent
784935a975
commit
9db18613a1
55 changed files with 312 additions and 385 deletions
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvparent</artifactId>
|
<artifactId>openinvparent</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>openinvapi</artifactId>
|
<artifactId>openinvapi</artifactId>
|
||||||
|
|
|
@ -6,12 +6,23 @@ import org.bukkit.entity.Player;
|
||||||
public interface IAnySilentContainer {
|
public interface IAnySilentContainer {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the given block is a container which can be unblocked or silenced.
|
* Opens the container at the given coordinates for the Player. If you do not want blocked
|
||||||
|
* containers to open, be sure to check {@link #isAnyContainerNeeded(Player, Block)}
|
||||||
|
* first.
|
||||||
*
|
*
|
||||||
* @param block the BlockState
|
* @param player the Player opening the container
|
||||||
* @return true if the Block is a supported container
|
* @param silentchest whether the container's noise is to be silenced
|
||||||
|
* @param block the Block
|
||||||
|
* @return true if the container can be opened
|
||||||
*/
|
*/
|
||||||
public boolean isAnySilentContainer(Block block);
|
public boolean activateContainer(Player player, boolean silentchest, Block block);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Closes the Player's currently open container silently, if necessary.
|
||||||
|
*
|
||||||
|
* @param player the Player closing a container
|
||||||
|
*/
|
||||||
|
public void deactivateContainer(Player player);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the container at the given coordinates is blocked.
|
* Checks if the container at the given coordinates is blocked.
|
||||||
|
@ -23,15 +34,11 @@ public interface IAnySilentContainer {
|
||||||
public boolean isAnyContainerNeeded(Player player, Block block);
|
public boolean isAnyContainerNeeded(Player player, Block block);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens the container at the given coordinates for the Player. If you do not want blocked
|
* Checks if the given block is a container which can be unblocked or silenced.
|
||||||
* containers to open, be sure to check {@link #isAnyContainerNeeded(Player, Block)}
|
|
||||||
* first.
|
|
||||||
*
|
*
|
||||||
* @param player
|
* @param block the BlockState
|
||||||
* @param silentchest whether the container's noise is to be silenced
|
* @return true if the Block is a supported container
|
||||||
* @param block the Block
|
|
||||||
* @return true if the container can be opened
|
|
||||||
*/
|
*/
|
||||||
public boolean activateContainer(Player player, boolean silentchest, Block block);
|
public boolean isAnySilentContainer(Block block);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvparent</artifactId>
|
<artifactId>openinvparent</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>openinvassembly</artifactId>
|
<artifactId>openinvassembly</artifactId>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvparent</artifactId>
|
<artifactId>openinvparent</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>openinvcommon</artifactId>
|
<artifactId>openinvcommon</artifactId>
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvapi</artifactId>
|
<artifactId>openinvapi</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvinternal</artifactId>
|
<artifactId>openinvinternal</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>openinvadapter1_4_5</artifactId>
|
<artifactId>openinvadapter1_4_5</artifactId>
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvcommon</artifactId>
|
<artifactId>openinvcommon</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -165,4 +165,7 @@ public class AnySilentContainer implements IAnySilentContainer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deactivateContainer(final Player bukkitPlayer) {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvinternal</artifactId>
|
<artifactId>openinvinternal</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>openinvadapter1_4_6</artifactId>
|
<artifactId>openinvadapter1_4_6</artifactId>
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvcommon</artifactId>
|
<artifactId>openinvcommon</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -165,4 +165,7 @@ public class AnySilentContainer implements IAnySilentContainer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deactivateContainer(final Player bukkitPlayer) {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvparent</artifactId>
|
<artifactId>openinvparent</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>openinvinternal</artifactId>
|
<artifactId>openinvinternal</artifactId>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvinternal</artifactId>
|
<artifactId>openinvinternal</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>openinvadapter1_10_R1</artifactId>
|
<artifactId>openinvadapter1_10_R1</artifactId>
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvcommon</artifactId>
|
<artifactId>openinvcommon</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -211,4 +211,7 @@ public class AnySilentContainer implements IAnySilentContainer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deactivateContainer(final Player bukkitPlayer) {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvinternal</artifactId>
|
<artifactId>openinvinternal</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>openinvadapter1_11_R1</artifactId>
|
<artifactId>openinvadapter1_11_R1</artifactId>
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvcommon</artifactId>
|
<artifactId>openinvcommon</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -16,14 +16,14 @@
|
||||||
|
|
||||||
package com.lishid.openinv.internal.v1_11_R1;
|
package com.lishid.openinv.internal.v1_11_R1;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
import com.lishid.openinv.internal.IAnySilentContainer;
|
import com.lishid.openinv.internal.IAnySilentContainer;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.inventory.InventoryView;
|
||||||
|
|
||||||
import net.minecraft.server.v1_11_R1.AxisAlignedBB;
|
import net.minecraft.server.v1_11_R1.AxisAlignedBB;
|
||||||
import net.minecraft.server.v1_11_R1.Block;
|
import net.minecraft.server.v1_11_R1.Block;
|
||||||
|
@ -31,7 +31,6 @@ import net.minecraft.server.v1_11_R1.BlockChest;
|
||||||
import net.minecraft.server.v1_11_R1.BlockEnderChest;
|
import net.minecraft.server.v1_11_R1.BlockEnderChest;
|
||||||
import net.minecraft.server.v1_11_R1.BlockPosition;
|
import net.minecraft.server.v1_11_R1.BlockPosition;
|
||||||
import net.minecraft.server.v1_11_R1.BlockShulkerBox;
|
import net.minecraft.server.v1_11_R1.BlockShulkerBox;
|
||||||
import net.minecraft.server.v1_11_R1.Container;
|
|
||||||
import net.minecraft.server.v1_11_R1.Entity;
|
import net.minecraft.server.v1_11_R1.Entity;
|
||||||
import net.minecraft.server.v1_11_R1.EntityOcelot;
|
import net.minecraft.server.v1_11_R1.EntityOcelot;
|
||||||
import net.minecraft.server.v1_11_R1.EntityPlayer;
|
import net.minecraft.server.v1_11_R1.EntityPlayer;
|
||||||
|
@ -40,18 +39,29 @@ import net.minecraft.server.v1_11_R1.IBlockData;
|
||||||
import net.minecraft.server.v1_11_R1.ITileInventory;
|
import net.minecraft.server.v1_11_R1.ITileInventory;
|
||||||
import net.minecraft.server.v1_11_R1.InventoryEnderChest;
|
import net.minecraft.server.v1_11_R1.InventoryEnderChest;
|
||||||
import net.minecraft.server.v1_11_R1.InventoryLargeChest;
|
import net.minecraft.server.v1_11_R1.InventoryLargeChest;
|
||||||
import net.minecraft.server.v1_11_R1.PacketPlayOutOpenWindow;
|
|
||||||
import net.minecraft.server.v1_11_R1.StatisticList;
|
import net.minecraft.server.v1_11_R1.StatisticList;
|
||||||
import net.minecraft.server.v1_11_R1.TileEntity;
|
import net.minecraft.server.v1_11_R1.TileEntity;
|
||||||
import net.minecraft.server.v1_11_R1.TileEntityChest;
|
import net.minecraft.server.v1_11_R1.TileEntityChest;
|
||||||
import net.minecraft.server.v1_11_R1.TileEntityEnderChest;
|
import net.minecraft.server.v1_11_R1.TileEntityEnderChest;
|
||||||
import net.minecraft.server.v1_11_R1.TileEntityShulkerBox;
|
import net.minecraft.server.v1_11_R1.TileEntityShulkerBox;
|
||||||
import net.minecraft.server.v1_11_R1.World;
|
import net.minecraft.server.v1_11_R1.World;
|
||||||
|
import net.minecraft.server.v1_11_R1.EnumGamemode;
|
||||||
import org.bukkit.craftbukkit.v1_11_R1.event.CraftEventFactory;
|
import net.minecraft.server.v1_11_R1.PlayerInteractManager;
|
||||||
|
|
||||||
public class AnySilentContainer implements IAnySilentContainer {
|
public class AnySilentContainer implements IAnySilentContainer {
|
||||||
|
|
||||||
|
private Field playerInteractManagerGamemode;
|
||||||
|
|
||||||
|
public AnySilentContainer() {
|
||||||
|
try {
|
||||||
|
this.playerInteractManagerGamemode = PlayerInteractManager.class.getDeclaredField("gamemode");
|
||||||
|
this.playerInteractManagerGamemode.setAccessible(true);
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.err.println("[OpenInv] Unable to directly write player gamemode! SilentChest will fail.");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAnySilentContainer(org.bukkit.block.Block block) {
|
public boolean isAnySilentContainer(org.bukkit.block.Block block) {
|
||||||
if (block.getType() == Material.ENDER_CHEST) {
|
if (block.getType() == Material.ENDER_CHEST) {
|
||||||
|
@ -186,7 +196,6 @@ public class AnySilentContainer implements IAnySilentContainer {
|
||||||
|
|
||||||
ITileInventory tileInventory = (ITileInventory) tile;
|
ITileInventory tileInventory = (ITileInventory) tile;
|
||||||
Block block = world.getType(blockPosition).getBlock();
|
Block block = world.getType(blockPosition).getBlock();
|
||||||
Container container = null;
|
|
||||||
|
|
||||||
if (block instanceof BlockChest) {
|
if (block instanceof BlockChest) {
|
||||||
for (EnumDirection localEnumDirection : EnumDirection.EnumDirectionLimit.HORIZONTAL) {
|
for (EnumDirection localEnumDirection : EnumDirection.EnumDirectionLimit.HORIZONTAL) {
|
||||||
|
@ -218,68 +227,68 @@ public class AnySilentContainer implements IAnySilentContainer {
|
||||||
} else if (blockChest.g == BlockChest.Type.TRAP) {
|
} else if (blockChest.g == BlockChest.Type.TRAP) {
|
||||||
player.b(StatisticList.getStatistic("stat.trappedChestTriggered"));
|
player.b(StatisticList.getStatistic("stat.trappedChestTriggered"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (silentchest) {
|
|
||||||
container = new SilentContainerChest(player.inventory, tileInventory, player);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (block instanceof BlockShulkerBox) {
|
if (block instanceof BlockShulkerBox) {
|
||||||
player.b(StatisticList.getStatistic("stat.shulkerBoxOpened"));
|
player.b(StatisticList.getStatistic("stat.shulkerBoxOpened"));
|
||||||
|
|
||||||
if (silentchest && tileInventory instanceof TileEntityShulkerBox) {
|
|
||||||
// Set value to current + 1. Ensures consistency later when resetting.
|
|
||||||
SilentContainerShulkerBox.setOpenValue((TileEntityShulkerBox) tileInventory,
|
|
||||||
SilentContainerShulkerBox.getOpenValue((TileEntityShulkerBox) tileInventory) + 1);
|
|
||||||
|
|
||||||
container = new SilentContainerShulkerBox(player.inventory, tileInventory, player);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// AnyChest only - SilentChest not active or container unsupported
|
// AnyChest only - SilentChest not active, container unsupported, or unnecessary.
|
||||||
if (!silentchest || container == null) {
|
if (!silentchest || player.playerInteractManager.getGameMode() == EnumGamemode.SPECTATOR) {
|
||||||
player.openContainer(tileInventory);
|
player.openContainer(tileInventory);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// SilentChest
|
// SilentChest requires access to setting players' gamemode directly.
|
||||||
|
if (this.playerInteractManagerGamemode == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
EnumGamemode gamemode = player.playerInteractManager.getGameMode();
|
||||||
|
this.forceGameMode(player, EnumGamemode.SPECTATOR);
|
||||||
|
player.openContainer(tileInventory);
|
||||||
|
this.forceGameMode(player, gamemode);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deactivateContainer(final Player bukkitPlayer) {
|
||||||
|
if (this.playerInteractManagerGamemode == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
InventoryView view = bukkitPlayer.getOpenInventory();
|
||||||
|
switch (view.getType()) {
|
||||||
|
case CHEST:
|
||||||
|
case ENDER_CHEST:
|
||||||
|
case SHULKER_BOX:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
EntityPlayer player = PlayerDataManager.getHandle(bukkitPlayer);
|
||||||
|
|
||||||
|
EnumGamemode gamemode = player.playerInteractManager.getGameMode();
|
||||||
|
this.forceGameMode(player, EnumGamemode.SPECTATOR);
|
||||||
|
player.activeContainer.b(player);
|
||||||
|
player.activeContainer = player.defaultContainer;
|
||||||
|
this.forceGameMode(player, gamemode);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void forceGameMode(final EntityPlayer player, final EnumGamemode gameMode) {
|
||||||
|
if (this.playerInteractManagerGamemode == null) {
|
||||||
|
// No need to warn repeatedly, error on startup and lack of function should be enough.
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
// Call InventoryOpenEvent
|
if (!this.playerInteractManagerGamemode.isAccessible()) {
|
||||||
container = CraftEventFactory.callInventoryOpenEvent(player, container, false);
|
// Just in case, ensure accessible.
|
||||||
if (container == null) {
|
this.playerInteractManagerGamemode.setAccessible(true);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
this.playerInteractManagerGamemode.set(player.playerInteractManager, gameMode);
|
||||||
// Open window
|
|
||||||
int windowId = player.nextContainerCounter();
|
|
||||||
player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(windowId, tileInventory.getContainerName(), tileInventory.getScoreboardDisplayName(), tileInventory.getSize()));
|
|
||||||
player.activeContainer = container;
|
|
||||||
player.activeContainer.windowId = windowId;
|
|
||||||
player.activeContainer.addSlotListener(player);
|
|
||||||
|
|
||||||
// Special handling for shulker boxes - reset value for viewers to what it was initially.
|
|
||||||
if (tile instanceof TileEntityShulkerBox) {
|
|
||||||
new BukkitRunnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
// TODO hacky
|
|
||||||
Object tile = world.getTileEntity(blockPosition);
|
|
||||||
if (!(tile instanceof TileEntityShulkerBox)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
TileEntityShulkerBox box = (TileEntityShulkerBox) tile;
|
|
||||||
// Reset back - we added 1, and calling TileEntityShulkerBox#startOpen adds 1 more.
|
|
||||||
SilentContainerShulkerBox.setOpenValue(box,
|
|
||||||
SilentContainerShulkerBox.getOpenValue((TileEntityShulkerBox) tile) - 2);
|
|
||||||
}
|
|
||||||
}.runTaskLater(Bukkit.getPluginManager().getPlugin("OpenInv"), 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
p.sendMessage(ChatColor.RED + "Error while sending silent container.");
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,46 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2011-2014 lishid. All rights reserved.
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, version 3.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.lishid.openinv.internal.v1_11_R1;
|
|
||||||
|
|
||||||
import net.minecraft.server.v1_11_R1.ContainerChest;
|
|
||||||
import net.minecraft.server.v1_11_R1.EntityHuman;
|
|
||||||
import net.minecraft.server.v1_11_R1.IInventory;
|
|
||||||
import net.minecraft.server.v1_11_R1.ItemStack;
|
|
||||||
import net.minecraft.server.v1_11_R1.PlayerInventory;
|
|
||||||
|
|
||||||
public class SilentContainerChest extends ContainerChest {
|
|
||||||
|
|
||||||
public SilentContainerChest(PlayerInventory playerInventory, IInventory iInventory,
|
|
||||||
EntityHuman entityHuman) {
|
|
||||||
super(playerInventory, iInventory, entityHuman);
|
|
||||||
// Send close signal
|
|
||||||
iInventory.closeContainer(entityHuman);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void b(EntityHuman entityHuman) {
|
|
||||||
// Don't send close signal twice, might screw up
|
|
||||||
PlayerInventory playerinventory = entityHuman.inventory;
|
|
||||||
|
|
||||||
if (playerinventory.getCarried() != ItemStack.a) {
|
|
||||||
ItemStack carried = playerinventory.getCarried();
|
|
||||||
playerinventory.setCarried(ItemStack.a);
|
|
||||||
entityHuman.drop(carried, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,56 +0,0 @@
|
||||||
package com.lishid.openinv.internal.v1_11_R1;
|
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
|
|
||||||
import net.minecraft.server.v1_11_R1.ContainerShulkerBox;
|
|
||||||
import net.minecraft.server.v1_11_R1.EntityHuman;
|
|
||||||
import net.minecraft.server.v1_11_R1.IInventory;
|
|
||||||
import net.minecraft.server.v1_11_R1.ItemStack;
|
|
||||||
import net.minecraft.server.v1_11_R1.PlayerInventory;
|
|
||||||
import net.minecraft.server.v1_11_R1.TileEntityShulkerBox;
|
|
||||||
|
|
||||||
public class SilentContainerShulkerBox extends ContainerShulkerBox {
|
|
||||||
|
|
||||||
private static Field fieldShulkerActionData;
|
|
||||||
|
|
||||||
public SilentContainerShulkerBox(PlayerInventory playerInventory, IInventory iInventory,
|
|
||||||
EntityHuman entityHuman) {
|
|
||||||
super(playerInventory, iInventory, entityHuman);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void b(EntityHuman entityHuman) {
|
|
||||||
PlayerInventory playerinventory = entityHuman.inventory;
|
|
||||||
|
|
||||||
if (!playerinventory.getCarried().isEmpty()) {
|
|
||||||
entityHuman.drop(playerinventory.getCarried(), false);
|
|
||||||
playerinventory.setCarried(ItemStack.a);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Field exposeOpenStatus() throws NoSuchFieldException, SecurityException {
|
|
||||||
if (fieldShulkerActionData == null) {
|
|
||||||
fieldShulkerActionData = TileEntityShulkerBox.class.getDeclaredField("h");
|
|
||||||
fieldShulkerActionData.setAccessible(true);
|
|
||||||
}
|
|
||||||
return fieldShulkerActionData;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setOpenValue(TileEntityShulkerBox tileShulkerBox, Object value) {
|
|
||||||
try {
|
|
||||||
exposeOpenStatus().set(tileShulkerBox, value);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Integer getOpenValue(TileEntityShulkerBox tileShulkerBox) {
|
|
||||||
try {
|
|
||||||
return (Integer) exposeOpenStatus().get(tileShulkerBox);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvinternal</artifactId>
|
<artifactId>openinvinternal</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>openinvadapter1_12_R1</artifactId>
|
<artifactId>openinvadapter1_12_R1</artifactId>
|
||||||
|
@ -21,8 +21,21 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvcommon</artifactId>
|
<artifactId>openinvcommon</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.6.1</version>
|
||||||
|
<configuration>
|
||||||
|
<source>1.8</source>
|
||||||
|
<target>1.8</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -10,15 +10,15 @@
|
||||||
|
|
||||||
package com.lishid.openinv.internal.v1_12_R1;
|
package com.lishid.openinv.internal.v1_12_R1;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
import com.lishid.openinv.internal.IAnySilentContainer;
|
import com.lishid.openinv.internal.IAnySilentContainer;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Statistic;
|
import org.bukkit.Statistic;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.inventory.InventoryView;
|
||||||
|
|
||||||
import net.minecraft.server.v1_12_R1.AxisAlignedBB;
|
import net.minecraft.server.v1_12_R1.AxisAlignedBB;
|
||||||
import net.minecraft.server.v1_12_R1.Block;
|
import net.minecraft.server.v1_12_R1.Block;
|
||||||
|
@ -26,26 +26,36 @@ import net.minecraft.server.v1_12_R1.BlockChest;
|
||||||
import net.minecraft.server.v1_12_R1.BlockEnderChest;
|
import net.minecraft.server.v1_12_R1.BlockEnderChest;
|
||||||
import net.minecraft.server.v1_12_R1.BlockPosition;
|
import net.minecraft.server.v1_12_R1.BlockPosition;
|
||||||
import net.minecraft.server.v1_12_R1.BlockShulkerBox;
|
import net.minecraft.server.v1_12_R1.BlockShulkerBox;
|
||||||
import net.minecraft.server.v1_12_R1.Container;
|
|
||||||
import net.minecraft.server.v1_12_R1.Entity;
|
import net.minecraft.server.v1_12_R1.Entity;
|
||||||
import net.minecraft.server.v1_12_R1.EntityOcelot;
|
import net.minecraft.server.v1_12_R1.EntityOcelot;
|
||||||
import net.minecraft.server.v1_12_R1.EntityPlayer;
|
import net.minecraft.server.v1_12_R1.EntityPlayer;
|
||||||
import net.minecraft.server.v1_12_R1.EnumDirection;
|
import net.minecraft.server.v1_12_R1.EnumDirection;
|
||||||
|
import net.minecraft.server.v1_12_R1.EnumGamemode;
|
||||||
import net.minecraft.server.v1_12_R1.IBlockData;
|
import net.minecraft.server.v1_12_R1.IBlockData;
|
||||||
import net.minecraft.server.v1_12_R1.ITileInventory;
|
import net.minecraft.server.v1_12_R1.ITileInventory;
|
||||||
import net.minecraft.server.v1_12_R1.InventoryEnderChest;
|
import net.minecraft.server.v1_12_R1.InventoryEnderChest;
|
||||||
import net.minecraft.server.v1_12_R1.InventoryLargeChest;
|
import net.minecraft.server.v1_12_R1.InventoryLargeChest;
|
||||||
import net.minecraft.server.v1_12_R1.PacketPlayOutOpenWindow;
|
import net.minecraft.server.v1_12_R1.PlayerInteractManager;
|
||||||
import net.minecraft.server.v1_12_R1.TileEntity;
|
import net.minecraft.server.v1_12_R1.TileEntity;
|
||||||
import net.minecraft.server.v1_12_R1.TileEntityChest;
|
import net.minecraft.server.v1_12_R1.TileEntityChest;
|
||||||
import net.minecraft.server.v1_12_R1.TileEntityEnderChest;
|
import net.minecraft.server.v1_12_R1.TileEntityEnderChest;
|
||||||
import net.minecraft.server.v1_12_R1.TileEntityShulkerBox;
|
import net.minecraft.server.v1_12_R1.TileEntityShulkerBox;
|
||||||
import net.minecraft.server.v1_12_R1.World;
|
import net.minecraft.server.v1_12_R1.World;
|
||||||
|
|
||||||
import org.bukkit.craftbukkit.v1_12_R1.event.CraftEventFactory;
|
|
||||||
|
|
||||||
public class AnySilentContainer implements IAnySilentContainer {
|
public class AnySilentContainer implements IAnySilentContainer {
|
||||||
|
|
||||||
|
private Field playerInteractManagerGamemode;
|
||||||
|
|
||||||
|
public AnySilentContainer() {
|
||||||
|
try {
|
||||||
|
this.playerInteractManagerGamemode = PlayerInteractManager.class.getDeclaredField("gamemode");
|
||||||
|
this.playerInteractManagerGamemode.setAccessible(true);
|
||||||
|
} catch (NoSuchFieldException | SecurityException e) {
|
||||||
|
System.err.println("[OpenInv] Unable to directly write player gamemode! SilentChest will fail.");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean activateContainer(final Player bukkitPlayer, final boolean silentchest,
|
public boolean activateContainer(final Player bukkitPlayer, final boolean silentchest,
|
||||||
final org.bukkit.block.Block bukkitBlock) {
|
final org.bukkit.block.Block bukkitBlock) {
|
||||||
|
@ -82,7 +92,6 @@ public class AnySilentContainer implements IAnySilentContainer {
|
||||||
|
|
||||||
ITileInventory tileInventory = (ITileInventory) tile;
|
ITileInventory tileInventory = (ITileInventory) tile;
|
||||||
Block block = world.getType(blockPosition).getBlock();
|
Block block = world.getType(blockPosition).getBlock();
|
||||||
Container container = null;
|
|
||||||
|
|
||||||
if (block instanceof BlockChest) {
|
if (block instanceof BlockChest) {
|
||||||
for (EnumDirection localEnumDirection : EnumDirection.EnumDirectionLimit.HORIZONTAL) {
|
for (EnumDirection localEnumDirection : EnumDirection.EnumDirectionLimit.HORIZONTAL) {
|
||||||
|
@ -115,73 +124,69 @@ public class AnySilentContainer implements IAnySilentContainer {
|
||||||
} else if (blockChest.g == BlockChest.Type.TRAP) {
|
} else if (blockChest.g == BlockChest.Type.TRAP) {
|
||||||
bukkitPlayer.incrementStatistic(Statistic.TRAPPED_CHEST_TRIGGERED);
|
bukkitPlayer.incrementStatistic(Statistic.TRAPPED_CHEST_TRIGGERED);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (silentchest) {
|
|
||||||
container = new SilentContainerChest(player.inventory, tileInventory, player);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (block instanceof BlockShulkerBox) {
|
if (block instanceof BlockShulkerBox) {
|
||||||
bukkitPlayer.incrementStatistic(Statistic.SHULKER_BOX_OPENED);
|
bukkitPlayer.incrementStatistic(Statistic.SHULKER_BOX_OPENED);
|
||||||
|
|
||||||
if (silentchest && tileInventory instanceof TileEntityShulkerBox) {
|
|
||||||
// Set value to current + 1. Ensures consistency later when resetting.
|
|
||||||
SilentContainerShulkerBox.setOpenValue((TileEntityShulkerBox) tileInventory,
|
|
||||||
SilentContainerShulkerBox.getOpenValue((TileEntityShulkerBox) tileInventory)
|
|
||||||
+ 1);
|
|
||||||
|
|
||||||
container = new SilentContainerShulkerBox(player.inventory, tileInventory, player);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// AnyChest only - SilentChest not active or container unsupported
|
// AnyChest only - SilentChest not active, container unsupported, or unnecessary.
|
||||||
if (!silentchest || container == null) {
|
if (!silentchest || player.playerInteractManager.getGameMode() == EnumGamemode.SPECTATOR) {
|
||||||
player.openContainer(tileInventory);
|
player.openContainer(tileInventory);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// SilentChest
|
// SilentChest requires access to setting players' gamemode directly.
|
||||||
try {
|
if (this.playerInteractManagerGamemode == null) {
|
||||||
// Call InventoryOpenEvent
|
|
||||||
container = CraftEventFactory.callInventoryOpenEvent(player, container, false);
|
|
||||||
if (container == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Open window
|
|
||||||
int windowId = player.nextContainerCounter();
|
|
||||||
player.playerConnection.sendPacket(
|
|
||||||
new PacketPlayOutOpenWindow(windowId, tileInventory.getContainerName(),
|
|
||||||
tileInventory.getScoreboardDisplayName(), tileInventory.getSize()));
|
|
||||||
player.activeContainer = container;
|
|
||||||
player.activeContainer.windowId = windowId;
|
|
||||||
player.activeContainer.addSlotListener(player);
|
|
||||||
|
|
||||||
// Special handling for shulker boxes - reset value for viewers to what it was initially.
|
|
||||||
if (tile instanceof TileEntityShulkerBox) {
|
|
||||||
new BukkitRunnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
// TODO hacky
|
|
||||||
Object tile = world.getTileEntity(blockPosition);
|
|
||||||
if (!(tile instanceof TileEntityShulkerBox)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
TileEntityShulkerBox box = (TileEntityShulkerBox) tile;
|
|
||||||
// Reset back - we added 1, and calling TileEntityShulkerBox#startOpen adds 1 more.
|
|
||||||
SilentContainerShulkerBox.setOpenValue(box,
|
|
||||||
SilentContainerShulkerBox.getOpenValue((TileEntityShulkerBox) tile)
|
|
||||||
- 2);
|
|
||||||
}
|
|
||||||
}.runTaskLater(Bukkit.getPluginManager().getPlugin("OpenInv"), 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
bukkitPlayer.sendMessage(ChatColor.RED + "Error while sending silent container.");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EnumGamemode gamemode = player.playerInteractManager.getGameMode();
|
||||||
|
this.forceGameMode(player, EnumGamemode.SPECTATOR);
|
||||||
|
player.openContainer(tileInventory);
|
||||||
|
this.forceGameMode(player, gamemode);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deactivateContainer(final Player bukkitPlayer) {
|
||||||
|
if (this.playerInteractManagerGamemode == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
InventoryView view = bukkitPlayer.getOpenInventory();
|
||||||
|
switch (view.getType()) {
|
||||||
|
case CHEST:
|
||||||
|
case ENDER_CHEST:
|
||||||
|
case SHULKER_BOX:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
EntityPlayer player = PlayerDataManager.getHandle(bukkitPlayer);
|
||||||
|
|
||||||
|
EnumGamemode gamemode = player.playerInteractManager.getGameMode();
|
||||||
|
this.forceGameMode(player, EnumGamemode.SPECTATOR);
|
||||||
|
player.activeContainer.b(player);
|
||||||
|
player.activeContainer = player.defaultContainer;
|
||||||
|
this.forceGameMode(player, gamemode);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void forceGameMode(final EntityPlayer player, final EnumGamemode gameMode) {
|
||||||
|
if (this.playerInteractManagerGamemode == null) {
|
||||||
|
// No need to warn repeatedly, error on startup and lack of function should be enough.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if (!this.playerInteractManagerGamemode.isAccessible()) {
|
||||||
|
// Just in case, ensure accessible.
|
||||||
|
this.playerInteractManagerGamemode.setAccessible(true);
|
||||||
|
}
|
||||||
|
this.playerInteractManagerGamemode.set(player.playerInteractManager, gameMode);
|
||||||
|
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasOcelotOnTop(final World world, final BlockPosition blockPosition) {
|
private boolean hasOcelotOnTop(final World world, final BlockPosition blockPosition) {
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2011-2014 lishid. All rights reserved. This program is free software: you can
|
|
||||||
* redistribute it and/or modify it under the terms of the GNU General Public License as published
|
|
||||||
* by the Free Software Foundation, version 3. This program is distributed in the hope that it will
|
|
||||||
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should
|
|
||||||
* have received a copy of the GNU General Public License along with this program. If not, see
|
|
||||||
* <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.lishid.openinv.internal.v1_12_R1;
|
|
||||||
|
|
||||||
import net.minecraft.server.v1_12_R1.ContainerChest;
|
|
||||||
import net.minecraft.server.v1_12_R1.EntityHuman;
|
|
||||||
import net.minecraft.server.v1_12_R1.IInventory;
|
|
||||||
import net.minecraft.server.v1_12_R1.ItemStack;
|
|
||||||
import net.minecraft.server.v1_12_R1.PlayerInventory;
|
|
||||||
|
|
||||||
public class SilentContainerChest extends ContainerChest {
|
|
||||||
|
|
||||||
public SilentContainerChest(final PlayerInventory playerInventory, final IInventory iInventory,
|
|
||||||
final EntityHuman entityHuman) {
|
|
||||||
super(playerInventory, iInventory, entityHuman);
|
|
||||||
// Send close signal
|
|
||||||
iInventory.closeContainer(entityHuman);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void b(final EntityHuman entityHuman) {
|
|
||||||
// Don't send close signal twice, might screw up
|
|
||||||
PlayerInventory playerinventory = entityHuman.inventory;
|
|
||||||
|
|
||||||
if (playerinventory.getCarried() != ItemStack.a) {
|
|
||||||
ItemStack carried = playerinventory.getCarried();
|
|
||||||
playerinventory.setCarried(ItemStack.a);
|
|
||||||
entityHuman.drop(carried, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,57 +0,0 @@
|
||||||
package com.lishid.openinv.internal.v1_12_R1;
|
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
|
|
||||||
import net.minecraft.server.v1_12_R1.ContainerShulkerBox;
|
|
||||||
import net.minecraft.server.v1_12_R1.EntityHuman;
|
|
||||||
import net.minecraft.server.v1_12_R1.IInventory;
|
|
||||||
import net.minecraft.server.v1_12_R1.ItemStack;
|
|
||||||
import net.minecraft.server.v1_12_R1.PlayerInventory;
|
|
||||||
import net.minecraft.server.v1_12_R1.TileEntityShulkerBox;
|
|
||||||
|
|
||||||
public class SilentContainerShulkerBox extends ContainerShulkerBox {
|
|
||||||
|
|
||||||
private static Field fieldShulkerActionData;
|
|
||||||
|
|
||||||
private static Field exposeOpenStatus() throws NoSuchFieldException, SecurityException {
|
|
||||||
if (SilentContainerShulkerBox.fieldShulkerActionData == null) {
|
|
||||||
SilentContainerShulkerBox.fieldShulkerActionData = TileEntityShulkerBox.class
|
|
||||||
.getDeclaredField("h");
|
|
||||||
SilentContainerShulkerBox.fieldShulkerActionData.setAccessible(true);
|
|
||||||
}
|
|
||||||
return SilentContainerShulkerBox.fieldShulkerActionData;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Integer getOpenValue(final TileEntityShulkerBox tileShulkerBox) {
|
|
||||||
try {
|
|
||||||
return (Integer) SilentContainerShulkerBox.exposeOpenStatus().get(tileShulkerBox);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setOpenValue(final TileEntityShulkerBox tileShulkerBox, final Object value) {
|
|
||||||
try {
|
|
||||||
SilentContainerShulkerBox.exposeOpenStatus().set(tileShulkerBox, value);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public SilentContainerShulkerBox(final PlayerInventory playerInventory,
|
|
||||||
final IInventory iInventory, final EntityHuman entityHuman) {
|
|
||||||
super(playerInventory, iInventory, entityHuman);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void b(final EntityHuman entityHuman) {
|
|
||||||
PlayerInventory playerinventory = entityHuman.inventory;
|
|
||||||
|
|
||||||
if (!playerinventory.getCarried().isEmpty()) {
|
|
||||||
entityHuman.drop(playerinventory.getCarried(), false);
|
|
||||||
playerinventory.setCarried(ItemStack.a);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvinternal</artifactId>
|
<artifactId>openinvinternal</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>openinvadapter1_4_R1</artifactId>
|
<artifactId>openinvadapter1_4_R1</artifactId>
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvcommon</artifactId>
|
<artifactId>openinvcommon</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -165,4 +165,7 @@ public class AnySilentContainer implements IAnySilentContainer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deactivateContainer(final Player bukkitPlayer) {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvinternal</artifactId>
|
<artifactId>openinvinternal</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>openinvadapter1_5_R2</artifactId>
|
<artifactId>openinvadapter1_5_R2</artifactId>
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvcommon</artifactId>
|
<artifactId>openinvcommon</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -165,4 +165,7 @@ public class AnySilentContainer implements IAnySilentContainer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deactivateContainer(final Player bukkitPlayer) {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvinternal</artifactId>
|
<artifactId>openinvinternal</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>openinvadapter1_5_R3</artifactId>
|
<artifactId>openinvadapter1_5_R3</artifactId>
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvcommon</artifactId>
|
<artifactId>openinvcommon</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -165,4 +165,7 @@ public class AnySilentContainer implements IAnySilentContainer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deactivateContainer(final Player bukkitPlayer) {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvinternal</artifactId>
|
<artifactId>openinvinternal</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>openinvadapter1_6_R1</artifactId>
|
<artifactId>openinvadapter1_6_R1</artifactId>
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvcommon</artifactId>
|
<artifactId>openinvcommon</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -165,4 +165,7 @@ public class AnySilentContainer implements IAnySilentContainer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deactivateContainer(final Player bukkitPlayer) {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvinternal</artifactId>
|
<artifactId>openinvinternal</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>openinvadapter1_6_R2</artifactId>
|
<artifactId>openinvadapter1_6_R2</artifactId>
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvcommon</artifactId>
|
<artifactId>openinvcommon</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -165,4 +165,7 @@ public class AnySilentContainer implements IAnySilentContainer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deactivateContainer(final Player bukkitPlayer) {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvinternal</artifactId>
|
<artifactId>openinvinternal</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>openinvadapter1_6_R3</artifactId>
|
<artifactId>openinvadapter1_6_R3</artifactId>
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvcommon</artifactId>
|
<artifactId>openinvcommon</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -165,4 +165,7 @@ public class AnySilentContainer implements IAnySilentContainer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deactivateContainer(final Player bukkitPlayer) {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvinternal</artifactId>
|
<artifactId>openinvinternal</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>openinvadapter1_7_R1</artifactId>
|
<artifactId>openinvadapter1_7_R1</artifactId>
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvcommon</artifactId>
|
<artifactId>openinvcommon</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -166,4 +166,7 @@ public class AnySilentContainer implements IAnySilentContainer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deactivateContainer(final Player bukkitPlayer) {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvinternal</artifactId>
|
<artifactId>openinvinternal</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>openinvadapter1_7_R2</artifactId>
|
<artifactId>openinvadapter1_7_R2</artifactId>
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvcommon</artifactId>
|
<artifactId>openinvcommon</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -166,4 +166,7 @@ public class AnySilentContainer implements IAnySilentContainer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deactivateContainer(final Player bukkitPlayer) {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvinternal</artifactId>
|
<artifactId>openinvinternal</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>openinvadapter1_7_R3</artifactId>
|
<artifactId>openinvadapter1_7_R3</artifactId>
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvcommon</artifactId>
|
<artifactId>openinvcommon</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -166,4 +166,7 @@ public class AnySilentContainer implements IAnySilentContainer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deactivateContainer(final Player bukkitPlayer) {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvinternal</artifactId>
|
<artifactId>openinvinternal</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>openinvadapter1_7_R4</artifactId>
|
<artifactId>openinvadapter1_7_R4</artifactId>
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvcommon</artifactId>
|
<artifactId>openinvcommon</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -166,4 +166,7 @@ public class AnySilentContainer implements IAnySilentContainer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deactivateContainer(final Player bukkitPlayer) {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvinternal</artifactId>
|
<artifactId>openinvinternal</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>openinvadapter1_8_R1</artifactId>
|
<artifactId>openinvadapter1_8_R1</artifactId>
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvcommon</artifactId>
|
<artifactId>openinvcommon</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -210,4 +210,7 @@ public class AnySilentContainer implements IAnySilentContainer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deactivateContainer(final Player bukkitPlayer) {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvinternal</artifactId>
|
<artifactId>openinvinternal</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>openinvadapter1_8_R2</artifactId>
|
<artifactId>openinvadapter1_8_R2</artifactId>
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvcommon</artifactId>
|
<artifactId>openinvcommon</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -211,4 +211,7 @@ public class AnySilentContainer implements IAnySilentContainer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deactivateContainer(final Player bukkitPlayer) {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvinternal</artifactId>
|
<artifactId>openinvinternal</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>openinvadapter1_8_R3</artifactId>
|
<artifactId>openinvadapter1_8_R3</artifactId>
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvcommon</artifactId>
|
<artifactId>openinvcommon</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -211,4 +211,7 @@ public class AnySilentContainer implements IAnySilentContainer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deactivateContainer(final Player bukkitPlayer) {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvinternal</artifactId>
|
<artifactId>openinvinternal</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>openinvadapter1_9_R1</artifactId>
|
<artifactId>openinvadapter1_9_R1</artifactId>
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvcommon</artifactId>
|
<artifactId>openinvcommon</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -211,4 +211,7 @@ public class AnySilentContainer implements IAnySilentContainer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deactivateContainer(final Player bukkitPlayer) {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvinternal</artifactId>
|
<artifactId>openinvinternal</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>openinvadapter1_9_R2</artifactId>
|
<artifactId>openinvadapter1_9_R2</artifactId>
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvcommon</artifactId>
|
<artifactId>openinvcommon</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -211,4 +211,7 @@ public class AnySilentContainer implements IAnySilentContainer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deactivateContainer(final Player bukkitPlayer) {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvplugin</artifactId>
|
<artifactId>openinvplugin</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>openinvplugincore</artifactId>
|
<artifactId>openinvplugincore</artifactId>
|
||||||
|
@ -22,12 +22,12 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvcommon</artifactId>
|
<artifactId>openinvcommon</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvpluginv1_10_r1</artifactId>
|
<artifactId>openinvpluginv1_10_r1</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ import com.lishid.openinv.internal.IInventoryAccess;
|
||||||
import com.lishid.openinv.internal.ISpecialEnderChest;
|
import com.lishid.openinv.internal.ISpecialEnderChest;
|
||||||
import com.lishid.openinv.internal.ISpecialPlayerInventory;
|
import com.lishid.openinv.internal.ISpecialPlayerInventory;
|
||||||
import com.lishid.openinv.listeners.InventoryClickListener;
|
import com.lishid.openinv.listeners.InventoryClickListener;
|
||||||
|
import com.lishid.openinv.listeners.InventoryCloseListener;
|
||||||
import com.lishid.openinv.listeners.InventoryDragListener;
|
import com.lishid.openinv.listeners.InventoryDragListener;
|
||||||
import com.lishid.openinv.listeners.PlayerListener;
|
import com.lishid.openinv.listeners.PlayerListener;
|
||||||
import com.lishid.openinv.listeners.PluginListener;
|
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 PlayerListener(this), this);
|
||||||
pm.registerEvents(new PluginListener(this), this);
|
pm.registerEvents(new PluginListener(this), this);
|
||||||
pm.registerEvents(new InventoryClickListener(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
|
// Bukkit will handle missing events for us, attempt to register InventoryDragEvent without a version check
|
||||||
pm.registerEvents(new InventoryDragListener(this), this);
|
pm.registerEvents(new InventoryDragListener(this), this);
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvplugin</artifactId>
|
<artifactId>openinvplugin</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>openinvpluginv1_10_r1</artifactId>
|
<artifactId>openinvpluginv1_10_r1</artifactId>
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvcommon</artifactId>
|
<artifactId>openinvcommon</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.lishid</groupId>
|
<groupId>com.lishid</groupId>
|
||||||
<artifactId>openinvparent</artifactId>
|
<artifactId>openinvparent</artifactId>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>openinvplugin</artifactId>
|
<artifactId>openinvplugin</artifactId>
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -6,7 +6,7 @@
|
||||||
<artifactId>openinvparent</artifactId>
|
<artifactId>openinvparent</artifactId>
|
||||||
<name>OpenInvParent</name>
|
<name>OpenInvParent</name>
|
||||||
<url>http://dev.bukkit.org/bukkit-plugins/openinv/</url>
|
<url>http://dev.bukkit.org/bukkit-plugins/openinv/</url>
|
||||||
<version>3.2.2-SNAPSHOT</version>
|
<version>3.3.0-SNAPSHOT</version>
|
||||||
|
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue