Compare commits

..

9 Commits
3.0.1 ... 3.0.4

Author SHA1 Message Date
Jikoo
f05110c9b8 Fix getOnlinePlayers call to support all versions
Moved IPlayerDataManager from api module to common module - it is not part of the API as there is no supported way to obtain an instance of it.
2016-12-22 09:55:51 -05:00
Jikoo
a41f89b011 Release any players held by a disabling plugin 2016-12-16 15:13:04 -05:00
Jikoo
d24827ffcb Allow plugins to indicate to OpenInv that a Player is in use
This allows API users to prevent issues caused by multiple different copies of the Player being loaded, such as #49. Multiple instances of the same player could be obtained by calling IOpenInv#loadPlayer, waiting for OpenInv to remove it from the cache, then calling the method again.
2016-12-14 19:49:18 -05:00
Jikoo
802ce28103 Fix issue caused by module cleanup while backporting awarding achievement 2016-12-05 19:02:43 -05:00
Jikoo
f31356b227 Fix permissions mistakes in readme 2016-12-05 19:01:21 -05:00
Jikoo
7942466863 Maven cleanliness and API progress
The project was very messy and due to older Bukkit packaging conventions, 1_4_5 and 1_4_6 were sorted away from the rest of the versioned code. All of the versioned internals are now submodules of the internal module.
Rather than use the hackish existing method of abusing the shade plugin to combine "dependencies" for a dummy assembly project, we're actually using the assembly plugin.
Profiles are still split up between the parent pom and the internal module pom, but they're much more clean.

The API is now its own module and can be compiled and released as a separate file for developers. Soon, Bukkit ticket 20, you'll be closed.
2016-11-30 21:26:56 -05:00
Jikoo
db2cade4e2 Don't convert names in config to UUIDs on the main thread
This is pretty messy, but I can't think of a better way to avoid saving about 5 times in a row. Then again, I did just wake up, so my brain may not be on point yet.
2016-11-27 17:30:39 -05:00
Jikoo
718b4bb5dd Added /searchenchant, fixed a couple little mistakes
Mistakes being breaking UUID-based lookups and /anychest's toggle.
MY BAD, SORRY.
2016-11-27 06:38:24 -05:00
Jikoo
6aa25dd2dc Don't use reflection to increment container counter
Fixes #53 (pretty please with a cherry on top)
2016-11-27 06:13:17 -05:00
168 changed files with 1228 additions and 716 deletions

View File

@@ -10,7 +10,7 @@ OpenInv is a [Bukkit plugin](https://dev.bukkit.org/bukkit-plugins/openinv/) whi
- **OpenEnder**: Open anyone's inventory, even if they're offline.
- Read-only mode! No edits allowed! Don't grant `OpenInv.editender`
- Cross-world support! Don't grant `OpenInv.crossworld`
- No self-opening! Don't grant `OpenInv.openself`
- No opening others! Don't grant `OpenInv.openenderall`
- **SilentChest**: Open containers without displaying an animation or making sound.
- **AnyChest**: Open containers, even if blocked by ocelots or blocks.
@@ -80,7 +80,7 @@ OpenInv is a [Bukkit plugin](https://dev.bukkit.org/bukkit-plugins/openinv/) whi
<td>Required to use /openender.</td>
</tr>
<tr>
<td>OpenInv.editinv</td>
<td>OpenInv.editender</td>
<td>Required to make changes to open ender chests.</td>
</tr>
<tr>
@@ -117,9 +117,9 @@ OpenInv is a [Bukkit plugin](https://dev.bukkit.org/bukkit-plugins/openinv/) whi
To compile, the relevant Craftbukkit/Spigot jars must be installed in your local repository using the install plugin.
Ex: `mvn install:install-file -Dpackaging=jar -Dfile=spigot-1.11-R0.1-SNAPSHOT.jar -DgroupId=org.spigotmc -DartifactId=spigot -Dversion=1.11-R0.1-SNAPSHOT`
Compiling OpenInv for a specific version is very easy - just compile the correct module.
To compile for a specific version or set of versions, you'll need to use a profile. Provided profiles are `latest`, `modern` (versions 1.8+), and `all`. Select an existing profile using the `-P` argument (ex: `mvn clean package -am -P all`) or make your own. For more information, check out the [official guide](http://maven.apache.org/guides/introduction/introduction-to-profiles.html).
Compiling for a set of versions is slightly more complex. You'll need to use a profile for the versions you want to compile. Provided profiles are latest, modern (versions 1.8+), and all. For more information, check out the [official guide](http://maven.apache.org/guides/introduction/introduction-to-profiles.html).
The final file is target/OpenInv.jar
## License
```

23
api/pom.xml Normal file
View File

@@ -0,0 +1,23 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinvparent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>openinvapi</artifactId>
<name>OpenInvAPI</name>
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.4.5-R1.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,187 @@
package com.lishid.openinv;
import com.lishid.openinv.internal.IAnySilentContainer;
import com.lishid.openinv.internal.IInventoryAccess;
import com.lishid.openinv.internal.ISpecialEnderChest;
import com.lishid.openinv.internal.ISpecialPlayerInventory;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
/**
* Interface defining behavior for the OpenInv plugin.
*
* @author Jikoo
*/
public interface IOpenInv {
/**
* Checks if the server version is supported by OpenInv.
*
* @return true if the server version is supported
*/
public boolean isSupportedVersion();
/**
* Gets the active IInventoryAccess implementation. May return null if the server version is
* unsupported.
*
* @return the IInventoryAccess
*/
public IInventoryAccess getInventoryAccess();
/**
* Gets the active ISilentContainer implementation. May return null if the server version is
* unsupported.
*
* @return the ISilentContainer
*/
public IAnySilentContainer getAnySilentContainer();
/**
* Gets an ISpecialPlayerInventory for the given Player.
*
* @param player the Player
* @param online true if the Player is currently online
* @return the ISpecialPlayerInventory
*/
public ISpecialPlayerInventory getInventory(Player player, boolean online);
/**
* Gets an ISpecialEnderChest for the given Player.
*
* @param player the Player
* @param online true if the Player is currently online
* @return the ISpecialEnderChest
*/
public ISpecialEnderChest getEnderChest(Player player, boolean online);
/**
* Forcibly unload a cached Player's data.
*
* @param player the OfflinePlayer to unload
*/
public void unload(OfflinePlayer player);
/**
* Check the configuration value for whether or not OpenInv saves player data when unloading
* players. This is exclusively for users who do not allow editing of inventories, only viewing,
* and wish to prevent any possibility of bugs such as lishid#40. If true, OpenInv will not ever
* save any edits made to players.
*
* @return false unless configured otherwise
*/
public boolean disableSaving();
/**
* Check the configuration value for whether or not OpenInv displays a notification to the user
* when a container is activated with SilentChest.
*
* @return true unless configured otherwise
*/
public boolean notifySilentChest();
/**
* Check the configuration value for whether or not OpenInv displays a notification to the user
* when a container is activated with AnyChest.
*
* @return true unless configured otherwise
*/
public boolean notifyAnyChest();
/**
* Gets a player's SilentChest setting.
*
* @param player the OfflinePlayer
* @return true if SilentChest is enabled
*/
public boolean getPlayerSilentChestStatus(OfflinePlayer player);
/**
* Sets a player's SilentChest setting.
*
* @param player the OfflinePlayer
* @param status the status
*/
public void setPlayerSilentChestStatus(OfflinePlayer player, boolean status);
/**
* Gets the provided player's AnyChest setting.
*
* @param player the OfflinePlayer
* @return true if AnyChest is enabled
*/
public boolean getPlayerAnyChestStatus(OfflinePlayer player);
/**
* Sets a player's AnyChest setting.
*
* @param player the OfflinePlayer
* @param status the status
*/
public void setPlayerAnyChestStatus(OfflinePlayer player, boolean status);
/**
* Gets a unique identifier by which the OfflinePlayer can be referenced. Using the value
* returned to look up a Player will generally be much faster for later implementations.
*
* @param offline the OfflinePlayer
* @return the identifier
*/
public String getPlayerID(OfflinePlayer offline);
/**
* Get an OfflinePlayer by name.
* <p>
* Note: This method is potentially very heavily blocking. It should not ever be called on the
* main thread, and if it is, a stack trace will be displayed alerting server owners to the
* call.
*
* @param name the name of the Player
* @return the OfflinePlayer with the closest matching name or null if no players have ever logged in
*/
public OfflinePlayer matchPlayer(String name);
/**
* Load a Player from an OfflinePlayer. May return null under some circumstances.
*
* @param offline the OfflinePlayer to load a Player for
* @return the Player
*/
public Player loadPlayer(final OfflinePlayer offline);
/**
* Mark a Player as in use by a Plugin to prevent it from being removed from the cache. Used to
* prevent issues with multiple copies of the same Player being loaded such as lishid#49.
* Changes made to loaded copies overwrite changes to the others when saved, leading to
* duplication bugs and more.
* <p>
* When finished with the Player object, be sure to call {@link #releasePlayer(Player, Plugin)}
* to prevent the cache from keeping it stored until the plugin is disabled.
* <p>
* When using a Player object from OpenInv, you must handle the Player coming online, replacing
* your Player reference with the Player from the PlayerJoinEvent. In addition, you must change
* any values in the Player to reflect any unsaved alterations to the existing Player which do
* not affect the inventory or ender chest contents.
* <p>
* OpenInv only saves player data when unloading a Player from the cache, and then only if
* {@link #disableSaving()} returns false. If you are making changes that OpenInv does not cause
* to persist when a Player logs in as noted above, it is suggested that you manually call
* {@link Player#saveData()} when releasing your reference to ensure your changes persist.
*
* @param player the Player
* @param plugin the Plugin holding the reference to the Player
*/
public void retainPlayer(Player player, Plugin plugin);
/**
* Mark a Player as no longer in use by a Plugin to allow OpenInv to remove it from the cache
* when eligible.
*
* @param player the Player
* @param plugin the Plugin no longer holding a reference to the Player
*/
public void releasePlayer(Player player, Plugin plugin);
}

View File

@@ -4,205 +4,39 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinv</artifactId>
<artifactId>openinvparent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>openinvassembly</artifactId>
<name>OpenInvAssembly</name>
<profiles>
<profile>
<id>latest</id>
<dependencies>
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvadapter1_11_R1</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>modern</id>
<dependencies>
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvadapter1_8_R1</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvadapter1_8_R2</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvadapter1_8_R3</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvadapter1_9_R1</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvadapter1_9_R2</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvadapter1_10_R1</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvadapter1_11_R1</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>all</id>
<dependencies>
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvadapter1_4_5</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvadapter1_4_6</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvadapter1_4_R1</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvadapter1_5_R2</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvadapter1_5_R3</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvadapter1_6_R1</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvadapter1_6_R2</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvadapter1_6_R3</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvadapter1_7_R1</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvadapter1_7_R2</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvadapter1_7_R3</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvadapter1_7_R4</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvadapter1_8_R1</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvadapter1_8_R2</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvadapter1_8_R3</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvadapter1_9_R1</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvadapter1_9_R2</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvadapter1_10_R1</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvadapter1_11_R1</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
</profiles>
<build>
<directory>../target</directory>
<finalName>OpenInv</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<configuration>
<!--
~ This keeps the final file clean, but may cause issues for people not familiar with the setup.
~ If you're having trouble with the final product missing files, remove or tweak this configuration.
-->
<minimizeJar>true</minimizeJar>
<filters>
<filter>
<artifact>com.lishid:*</artifact>
<includes>
<include>com/lishid/openinv/**/*</include>
<include>plugin.yml</include>
</includes>
</filter>
</filters>
</configuration>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>reactor-uberjar</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
<goal>single</goal>
</goals>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/assembly/reactor-uberjar.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
</project>

View File

@@ -0,0 +1,28 @@
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
<id>reactor-uberjar</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<moduleSets>
<moduleSet>
<useAllReactorProjects>true</useAllReactorProjects>
<binaries>
<outputDirectory>/</outputDirectory>
<unpack>true</unpack>
<!-- unpackOptions must be present or build breaks. -->
<unpackOptions/>
</binaries>
</moduleSet>
</moduleSets>
</assembly>

29
common/pom.xml Normal file
View File

@@ -0,0 +1,29 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinvparent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>openinvcommon</artifactId>
<name>OpenInvCommon</name>
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.4.5-R1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvapi</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

View File

@@ -16,6 +16,8 @@
package com.lishid.openinv.internal;
import java.util.Collection;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
@@ -47,4 +49,11 @@ public interface IPlayerDataManager {
*/
public OfflinePlayer getPlayerByID(String identifier);
/**
* Gets a Collection of all Players currently online.
*
* @return the Collection of Players
*/
public Collection<? extends Player> getOnlinePlayers();
}

View File

@@ -14,11 +14,17 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.lishid.openinv.internal;
package com.lishid.openinv.util;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import com.lishid.openinv.internal.IAnySilentContainer;
import com.lishid.openinv.internal.IInventoryAccess;
import com.lishid.openinv.internal.IPlayerDataManager;
import com.lishid.openinv.internal.ISpecialEnderChest;
import com.lishid.openinv.internal.ISpecialPlayerInventory;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;

View File

@@ -1,4 +1,4 @@
package com.lishid.openinv;
package com.lishid.openinv.util;
import org.bukkit.permissions.Permissible;

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinv</artifactId>
<artifactId>openinvinternal</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
@@ -14,7 +14,7 @@
<dependencies>
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvplugin</artifactId>
<artifactId>openinvcommon</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>

View File

@@ -16,8 +16,6 @@
package com.lishid.openinv.internal.v1_4_5;
import java.lang.reflect.Field;
import com.lishid.openinv.internal.IAnySilentContainer;
import org.bukkit.ChatColor;
@@ -142,15 +140,7 @@ public class AnySilentContainer implements IAnySilentContainer {
returnValue = true;
} else {
try {
int windowId = 0;
try {
Field windowID = player.getClass().getDeclaredField("containerCounter");
windowID.setAccessible(true);
windowId = windowID.getInt(player);
windowId = windowId % 100 + 1;
windowID.setInt(player, windowId);
} catch (NoSuchFieldException e) {}
int windowId = player.nextContainerCounter();
player.netServerHandler.sendPacket(new Packet100OpenWindow(windowId, 0, ((IInventory) tile).getName(), ((IInventory) tile).getSize()));
player.activeContainer = new SilentContainerChest(player.inventory, ((IInventory) tile));
player.activeContainer.windowId = windowId;

View File

@@ -19,7 +19,7 @@ package com.lishid.openinv.internal.v1_4_5;
import com.lishid.openinv.internal.IInventoryAccess;
import com.lishid.openinv.internal.ISpecialEnderChest;
import com.lishid.openinv.internal.ISpecialPlayerInventory;
import com.lishid.openinv.internal.InternalAccessor;
import com.lishid.openinv.util.InternalAccessor;
import org.bukkit.inventory.Inventory;

View File

@@ -16,6 +16,9 @@
package com.lishid.openinv.internal.v1_4_5;
import java.util.Arrays;
import java.util.Collection;
import com.lishid.openinv.internal.IPlayerDataManager;
import org.bukkit.Bukkit;
@@ -69,4 +72,9 @@ public class PlayerDataManager implements IPlayerDataManager {
return player;
}
@Override
public Collection<? extends Player> getOnlinePlayers() {
return Arrays.asList(Bukkit.getOnlinePlayers());
}
}

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinv</artifactId>
<artifactId>openinvinternal</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
@@ -14,7 +14,7 @@
<dependencies>
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvplugin</artifactId>
<artifactId>openinvcommon</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>

View File

@@ -16,8 +16,6 @@
package com.lishid.openinv.internal.v1_4_6;
import java.lang.reflect.Field;
import com.lishid.openinv.internal.IAnySilentContainer;
import org.bukkit.ChatColor;
@@ -142,15 +140,7 @@ public class AnySilentContainer implements IAnySilentContainer {
returnValue = true;
} else {
try {
int windowId = 0;
try {
Field windowID = player.getClass().getDeclaredField("containerCounter");
windowID.setAccessible(true);
windowId = windowID.getInt(player);
windowId = windowId % 100 + 1;
windowID.setInt(player, windowId);
} catch (NoSuchFieldException e) {}
int windowId = player.nextContainerCounter();
player.playerConnection.sendPacket(new Packet100OpenWindow(windowId, 0, ((IInventory) tile).getName(), ((IInventory) tile).getSize()));
player.activeContainer = new SilentContainerChest(player.inventory, ((IInventory) tile));
player.activeContainer.windowId = windowId;

View File

@@ -19,7 +19,7 @@ package com.lishid.openinv.internal.v1_4_6;
import com.lishid.openinv.internal.IInventoryAccess;
import com.lishid.openinv.internal.ISpecialEnderChest;
import com.lishid.openinv.internal.ISpecialPlayerInventory;
import com.lishid.openinv.internal.InternalAccessor;
import com.lishid.openinv.util.InternalAccessor;
import org.bukkit.inventory.Inventory;

View File

@@ -16,6 +16,9 @@
package com.lishid.openinv.internal.v1_4_6;
import java.util.Arrays;
import java.util.Collection;
import com.lishid.openinv.internal.IPlayerDataManager;
import org.bukkit.Bukkit;
@@ -69,4 +72,9 @@ public class PlayerDataManager implements IPlayerDataManager {
return player;
}
@Override
public Collection<? extends Player> getOnlinePlayers() {
return Arrays.asList(Bukkit.getOnlinePlayers());
}
}

View File

@@ -4,20 +4,65 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinv</artifactId>
<artifactId>openinvparent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>openinvinternal</artifactId>
<name>OpenInvInternal</name>
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.4.5-R1.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<packaging>pom</packaging>
<profiles>
<profile>
<id>latest</id>
<modules>
<module>v1_11_R1</module>
</modules>
</profile>
<profile>
<id>modern</id>
<modules>
<module>v1_8_R1</module>
<module>v1_8_R2</module>
<module>v1_8_R3</module>
<module>v1_9_R1</module>
<module>v1_9_R2</module>
<module>v1_10_R1</module>
<module>v1_11_R1</module>
</modules>
</profile>
<profile>
<id>all</id>
<modules>
<module>1_4_5</module>
<module>1_4_6</module>
<module>v1_4_R1</module>
<!-- 1_5_R1 was never released -->
<module>v1_5_R2</module>
<module>v1_5_R3</module>
<!-- 1_6_R1 also had no tagged releases, remove? -->
<module>v1_6_R1</module>
<module>v1_6_R2</module>
<module>v1_6_R3</module>
<!-- TODO: Recompile CB for 1_7_R1 through 1_7_R4, currently using whatever jars worked -->
<module>v1_7_R1</module>
<module>v1_7_R2</module>
<module>v1_7_R3</module>
<module>v1_7_R4</module>
<module>v1_8_R1</module>
<module>v1_8_R2</module>
<module>v1_8_R3</module>
<module>v1_9_R1</module>
<module>v1_9_R2</module>
<module>v1_10_R1</module>
<module>v1_11_R1</module>
</modules>
</profile>
</profiles>
</project>

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinv</artifactId>
<artifactId>openinvinternal</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
@@ -14,7 +14,7 @@
<dependencies>
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvplugin</artifactId>
<artifactId>openinvcommon</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>

View File

@@ -29,6 +29,7 @@ import net.minecraft.server.v1_10_R1.BlockChest;
import net.minecraft.server.v1_10_R1.BlockChest.Type;
import net.minecraft.server.v1_10_R1.BlockEnderChest;
import net.minecraft.server.v1_10_R1.BlockPosition;
import net.minecraft.server.v1_10_R1.Container;
import net.minecraft.server.v1_10_R1.Entity;
import net.minecraft.server.v1_10_R1.EntityOcelot;
import net.minecraft.server.v1_10_R1.EntityPlayer;
@@ -145,6 +146,7 @@ public class AnySilentContainer implements IAnySilentContainer {
}
Block block = world.getType(blockPosition).getBlock();
Container container = null;
if (block instanceof BlockChest) {
for (EnumDirection localEnumDirection : EnumDirection.EnumDirectionLimit.HORIZONTAL) {
@@ -171,26 +173,27 @@ public class AnySilentContainer implements IAnySilentContainer {
}
if (silentchest) {
tile = new SilentContainerChest(player.inventory, ((IInventory) tile), player);
container = new SilentContainerChest(player.inventory, ((IInventory) tile), player);
}
if (((BlockChest) block).g == Type.BASIC)
if (((BlockChest) block).g == Type.BASIC) {
player.b(StatisticList.ac);
else if (((BlockChest) block).g == Type.TRAP) {
} else if (((BlockChest) block).g == Type.TRAP) {
player.b(StatisticList.W);
}
}
boolean returnValue = false;
if (!silentchest) {
player.openContainer((IInventory) tile);
final IInventory iInventory = (IInventory) tile;
if (!silentchest || container == null) {
player.openContainer(iInventory);
returnValue = true;
} else {
try {
SilentContainerChest silentContainerChest = new SilentContainerChest(player.inventory, ((IInventory) tile), player);
int windowId = player.nextContainerCounter();
player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(windowId, "minecraft:chest", ((IInventory) tile).getScoreboardDisplayName(), ((IInventory) tile).getSize()));
player.activeContainer = silentContainerChest;
player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(windowId, iInventory.getName(), iInventory.getScoreboardDisplayName(), iInventory.getSize()));
player.activeContainer = container;
player.activeContainer.windowId = windowId;
player.activeContainer.addSlotListener(player);
returnValue = true;

View File

@@ -19,7 +19,7 @@ package com.lishid.openinv.internal.v1_10_R1;
import com.lishid.openinv.internal.IInventoryAccess;
import com.lishid.openinv.internal.ISpecialEnderChest;
import com.lishid.openinv.internal.ISpecialPlayerInventory;
import com.lishid.openinv.internal.InternalAccessor;
import com.lishid.openinv.util.InternalAccessor;
import org.bukkit.inventory.Inventory;

View File

@@ -16,6 +16,7 @@
package com.lishid.openinv.internal.v1_10_R1;
import java.util.Collection;
import java.util.UUID;
import com.lishid.openinv.internal.IPlayerDataManager;
@@ -79,4 +80,9 @@ public class PlayerDataManager implements IPlayerDataManager {
}
}
@Override
public Collection<? extends Player> getOnlinePlayers() {
return Bukkit.getOnlinePlayers();
}
}

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinv</artifactId>
<artifactId>openinvinternal</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
@@ -14,7 +14,7 @@
<dependencies>
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvplugin</artifactId>
<artifactId>openinvcommon</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>

View File

@@ -211,9 +211,9 @@ public class AnySilentContainer implements IAnySilentContainer {
break;
}
if (blockChest.g == Type.BASIC)
if (blockChest.g == Type.BASIC) {
player.b(StatisticList.ac);
else if (blockChest.g == Type.TRAP) {
} else if (blockChest.g == Type.TRAP) {
player.b(StatisticList.W);
}

View File

@@ -19,7 +19,7 @@ package com.lishid.openinv.internal.v1_11_R1;
import com.lishid.openinv.internal.IInventoryAccess;
import com.lishid.openinv.internal.ISpecialEnderChest;
import com.lishid.openinv.internal.ISpecialPlayerInventory;
import com.lishid.openinv.internal.InternalAccessor;
import com.lishid.openinv.util.InternalAccessor;
import org.bukkit.inventory.Inventory;

View File

@@ -16,6 +16,7 @@
package com.lishid.openinv.internal.v1_11_R1;
import java.util.Collection;
import java.util.UUID;
import com.lishid.openinv.internal.IPlayerDataManager;
@@ -79,4 +80,9 @@ public class PlayerDataManager implements IPlayerDataManager {
}
}
@Override
public Collection<? extends Player> getOnlinePlayers() {
return Bukkit.getOnlinePlayers();
}
}

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinv</artifactId>
<artifactId>openinvinternal</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
@@ -14,7 +14,7 @@
<dependencies>
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvplugin</artifactId>
<artifactId>openinvcommon</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>

View File

@@ -16,8 +16,6 @@
package com.lishid.openinv.internal.v1_4_R1;
import java.lang.reflect.Field;
import com.lishid.openinv.internal.IAnySilentContainer;
import org.bukkit.ChatColor;
@@ -142,15 +140,7 @@ public class AnySilentContainer implements IAnySilentContainer {
returnValue = true;
} else {
try {
int windowId = 0;
try {
Field windowID = player.getClass().getDeclaredField("containerCounter");
windowID.setAccessible(true);
windowId = windowID.getInt(player);
windowId = windowId % 100 + 1;
windowID.setInt(player, windowId);
} catch (NoSuchFieldException e) {}
int windowId = player.nextContainerCounter();
player.playerConnection.sendPacket(new Packet100OpenWindow(windowId, 0, ((IInventory) tile).getName(), ((IInventory) tile).getSize()));
player.activeContainer = new SilentContainerChest(player.inventory, ((IInventory) tile));
player.activeContainer.windowId = windowId;

View File

@@ -19,7 +19,7 @@ package com.lishid.openinv.internal.v1_4_R1;
import com.lishid.openinv.internal.IInventoryAccess;
import com.lishid.openinv.internal.ISpecialEnderChest;
import com.lishid.openinv.internal.ISpecialPlayerInventory;
import com.lishid.openinv.internal.InternalAccessor;
import com.lishid.openinv.util.InternalAccessor;
import org.bukkit.inventory.Inventory;

View File

@@ -16,6 +16,9 @@
package com.lishid.openinv.internal.v1_4_R1;
import java.util.Arrays;
import java.util.Collection;
import com.lishid.openinv.internal.IPlayerDataManager;
import org.bukkit.Bukkit;
@@ -70,4 +73,9 @@ public class PlayerDataManager implements IPlayerDataManager {
return player;
}
@Override
public Collection<? extends Player> getOnlinePlayers() {
return Arrays.asList(Bukkit.getOnlinePlayers());
}
}

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinv</artifactId>
<artifactId>openinvinternal</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
@@ -14,7 +14,7 @@
<dependencies>
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvplugin</artifactId>
<artifactId>openinvcommon</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>

View File

@@ -16,8 +16,6 @@
package com.lishid.openinv.internal.v1_5_R2;
import java.lang.reflect.Field;
import com.lishid.openinv.internal.IAnySilentContainer;
import org.bukkit.ChatColor;
@@ -142,15 +140,7 @@ public class AnySilentContainer implements IAnySilentContainer {
returnValue = true;
} else {
try {
int windowId = 0;
try {
Field windowID = player.getClass().getDeclaredField("containerCounter");
windowID.setAccessible(true);
windowId = windowID.getInt(player);
windowId = windowId % 100 + 1;
windowID.setInt(player, windowId);
} catch (NoSuchFieldException e) {}
int windowId = player.nextContainerCounter();
player.playerConnection.sendPacket(new Packet100OpenWindow(windowId, 0, ((IInventory) tile).getName(), ((IInventory) tile).getSize(), true));
player.activeContainer = new SilentContainerChest(player.inventory, ((IInventory) tile));
player.activeContainer.windowId = windowId;

View File

@@ -19,7 +19,7 @@ package com.lishid.openinv.internal.v1_5_R2;
import com.lishid.openinv.internal.IInventoryAccess;
import com.lishid.openinv.internal.ISpecialEnderChest;
import com.lishid.openinv.internal.ISpecialPlayerInventory;
import com.lishid.openinv.internal.InternalAccessor;
import com.lishid.openinv.util.InternalAccessor;
import org.bukkit.inventory.Inventory;

View File

@@ -16,6 +16,9 @@
package com.lishid.openinv.internal.v1_5_R2;
import java.util.Arrays;
import java.util.Collection;
import com.lishid.openinv.internal.IPlayerDataManager;
import org.bukkit.Bukkit;
@@ -69,4 +72,9 @@ public class PlayerDataManager implements IPlayerDataManager {
return player;
}
@Override
public Collection<? extends Player> getOnlinePlayers() {
return Arrays.asList(Bukkit.getOnlinePlayers());
}
}

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinv</artifactId>
<artifactId>openinvinternal</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
@@ -14,7 +14,7 @@
<dependencies>
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvplugin</artifactId>
<artifactId>openinvcommon</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>

View File

@@ -16,8 +16,6 @@
package com.lishid.openinv.internal.v1_5_R3;
import java.lang.reflect.Field;
import com.lishid.openinv.internal.IAnySilentContainer;
import org.bukkit.ChatColor;
@@ -142,15 +140,7 @@ public class AnySilentContainer implements IAnySilentContainer {
returnValue = true;
} else {
try {
int windowId = 0;
try {
Field windowID = player.getClass().getDeclaredField("containerCounter");
windowID.setAccessible(true);
windowId = windowID.getInt(player);
windowId = windowId % 100 + 1;
windowID.setInt(player, windowId);
} catch (NoSuchFieldException e) {}
int windowId = player.nextContainerCounter();
player.playerConnection.sendPacket(new Packet100OpenWindow(windowId, 0, ((IInventory) tile).getName(), ((IInventory) tile).getSize(), true));
player.activeContainer = new SilentContainerChest(player.inventory, ((IInventory) tile));
player.activeContainer.windowId = windowId;

View File

@@ -19,7 +19,7 @@ package com.lishid.openinv.internal.v1_5_R3;
import com.lishid.openinv.internal.IInventoryAccess;
import com.lishid.openinv.internal.ISpecialEnderChest;
import com.lishid.openinv.internal.ISpecialPlayerInventory;
import com.lishid.openinv.internal.InternalAccessor;
import com.lishid.openinv.util.InternalAccessor;
import org.bukkit.inventory.Inventory;

View File

@@ -16,6 +16,9 @@
package com.lishid.openinv.internal.v1_5_R3;
import java.util.Arrays;
import java.util.Collection;
import com.lishid.openinv.internal.IPlayerDataManager;
import org.bukkit.Bukkit;
@@ -69,4 +72,9 @@ public class PlayerDataManager implements IPlayerDataManager {
return player;
}
@Override
public Collection<? extends Player> getOnlinePlayers() {
return Arrays.asList(Bukkit.getOnlinePlayers());
}
}

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinv</artifactId>
<artifactId>openinvinternal</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
@@ -14,7 +14,7 @@
<dependencies>
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvplugin</artifactId>
<artifactId>openinvcommon</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>

View File

@@ -16,8 +16,6 @@
package com.lishid.openinv.internal.v1_6_R1;
import java.lang.reflect.Field;
import com.lishid.openinv.internal.IAnySilentContainer;
import org.bukkit.ChatColor;
@@ -142,15 +140,7 @@ public class AnySilentContainer implements IAnySilentContainer {
returnValue = true;
} else {
try {
int windowId = 0;
try {
Field windowID = player.getClass().getDeclaredField("containerCounter");
windowID.setAccessible(true);
windowId = windowID.getInt(player);
windowId = windowId % 100 + 1;
windowID.setInt(player, windowId);
} catch (NoSuchFieldException e) {}
int windowId = player.nextContainerCounter();
player.playerConnection.sendPacket(new Packet100OpenWindow(windowId, 0, ((IInventory) tile).getName(), ((IInventory) tile).getSize(), true));
player.activeContainer = new SilentContainerChest(player.inventory, ((IInventory) tile));
player.activeContainer.windowId = windowId;

View File

@@ -19,7 +19,7 @@ package com.lishid.openinv.internal.v1_6_R1;
import com.lishid.openinv.internal.IInventoryAccess;
import com.lishid.openinv.internal.ISpecialEnderChest;
import com.lishid.openinv.internal.ISpecialPlayerInventory;
import com.lishid.openinv.internal.InternalAccessor;
import com.lishid.openinv.util.InternalAccessor;
import org.bukkit.inventory.Inventory;

View File

@@ -16,6 +16,9 @@
package com.lishid.openinv.internal.v1_6_R1;
import java.util.Arrays;
import java.util.Collection;
import com.lishid.openinv.internal.IPlayerDataManager;
import org.bukkit.Bukkit;
@@ -69,4 +72,9 @@ public class PlayerDataManager implements IPlayerDataManager {
return player;
}
@Override
public Collection<? extends Player> getOnlinePlayers() {
return Arrays.asList(Bukkit.getOnlinePlayers());
}
}

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinv</artifactId>
<artifactId>openinvinternal</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
@@ -14,7 +14,7 @@
<dependencies>
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvplugin</artifactId>
<artifactId>openinvcommon</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>

View File

@@ -16,8 +16,6 @@
package com.lishid.openinv.internal.v1_6_R2;
import java.lang.reflect.Field;
import com.lishid.openinv.internal.IAnySilentContainer;
import org.bukkit.ChatColor;
@@ -142,15 +140,7 @@ public class AnySilentContainer implements IAnySilentContainer {
returnValue = true;
} else {
try {
int windowId = 0;
try {
Field windowID = player.getClass().getDeclaredField("containerCounter");
windowID.setAccessible(true);
windowId = windowID.getInt(player);
windowId = windowId % 100 + 1;
windowID.setInt(player, windowId);
} catch (NoSuchFieldException e) {}
int windowId = player.nextContainerCounter();
player.playerConnection.sendPacket(new Packet100OpenWindow(windowId, 0, ((IInventory) tile).getName(), ((IInventory) tile).getSize(), true));
player.activeContainer = new SilentContainerChest(player.inventory, ((IInventory) tile));
player.activeContainer.windowId = windowId;

View File

@@ -19,7 +19,7 @@ package com.lishid.openinv.internal.v1_6_R2;
import com.lishid.openinv.internal.IInventoryAccess;
import com.lishid.openinv.internal.ISpecialEnderChest;
import com.lishid.openinv.internal.ISpecialPlayerInventory;
import com.lishid.openinv.internal.InternalAccessor;
import com.lishid.openinv.util.InternalAccessor;
import org.bukkit.inventory.Inventory;

View File

@@ -16,6 +16,9 @@
package com.lishid.openinv.internal.v1_6_R2;
import java.util.Arrays;
import java.util.Collection;
import com.lishid.openinv.internal.IPlayerDataManager;
import org.bukkit.Bukkit;
@@ -69,4 +72,9 @@ public class PlayerDataManager implements IPlayerDataManager {
return player;
}
@Override
public Collection<? extends Player> getOnlinePlayers() {
return Arrays.asList(Bukkit.getOnlinePlayers());
}
}

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinv</artifactId>
<artifactId>openinvinternal</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
@@ -14,7 +14,7 @@
<dependencies>
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvplugin</artifactId>
<artifactId>openinvcommon</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>

View File

@@ -16,8 +16,6 @@
package com.lishid.openinv.internal.v1_6_R3;
import java.lang.reflect.Field;
import com.lishid.openinv.internal.IAnySilentContainer;
import org.bukkit.ChatColor;
@@ -142,15 +140,7 @@ public class AnySilentContainer implements IAnySilentContainer {
returnValue = true;
} else {
try {
int windowId = 0;
try {
Field windowID = player.getClass().getDeclaredField("containerCounter");
windowID.setAccessible(true);
windowId = windowID.getInt(player);
windowId = windowId % 100 + 1;
windowID.setInt(player, windowId);
} catch (NoSuchFieldException e) {}
int windowId = player.nextContainerCounter();
player.playerConnection.sendPacket(new Packet100OpenWindow(windowId, 0, ((IInventory) tile).getName(), ((IInventory) tile).getSize(), true));
player.activeContainer = new SilentContainerChest(player.inventory, ((IInventory) tile));
player.activeContainer.windowId = windowId;

View File

@@ -19,7 +19,7 @@ package com.lishid.openinv.internal.v1_6_R3;
import com.lishid.openinv.internal.IInventoryAccess;
import com.lishid.openinv.internal.ISpecialEnderChest;
import com.lishid.openinv.internal.ISpecialPlayerInventory;
import com.lishid.openinv.internal.InternalAccessor;
import com.lishid.openinv.util.InternalAccessor;
import org.bukkit.inventory.Inventory;

View File

@@ -16,6 +16,9 @@
package com.lishid.openinv.internal.v1_6_R3;
import java.util.Arrays;
import java.util.Collection;
import com.lishid.openinv.internal.IPlayerDataManager;
import org.bukkit.Bukkit;
@@ -69,4 +72,9 @@ public class PlayerDataManager implements IPlayerDataManager {
return player;
}
@Override
public Collection<? extends Player> getOnlinePlayers() {
return Arrays.asList(Bukkit.getOnlinePlayers());
}
}

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinv</artifactId>
<artifactId>openinvinternal</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
@@ -14,7 +14,7 @@
<dependencies>
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvplugin</artifactId>
<artifactId>openinvcommon</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>

View File

@@ -16,8 +16,6 @@
package com.lishid.openinv.internal.v1_7_R1;
import java.lang.reflect.Field;
import com.lishid.openinv.internal.IAnySilentContainer;
import org.bukkit.ChatColor;
@@ -143,15 +141,7 @@ public class AnySilentContainer implements IAnySilentContainer {
returnValue = true;
} else {
try {
int windowId = 0;
try {
Field windowID = player.getClass().getDeclaredField("containerCounter");
windowID.setAccessible(true);
windowId = windowID.getInt(player);
windowId = windowId % 100 + 1;
windowID.setInt(player, windowId);
} catch (NoSuchFieldException e) {}
int windowId = player.nextContainerCounter();
player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(windowId, 0, ((IInventory) tile).getInventoryName(), ((IInventory) tile).getSize(), true));
player.activeContainer = new SilentContainerChest(player.inventory, ((IInventory) tile));
player.activeContainer.windowId = windowId;

View File

@@ -19,7 +19,7 @@ package com.lishid.openinv.internal.v1_7_R1;
import com.lishid.openinv.internal.IInventoryAccess;
import com.lishid.openinv.internal.ISpecialEnderChest;
import com.lishid.openinv.internal.ISpecialPlayerInventory;
import com.lishid.openinv.internal.InternalAccessor;
import com.lishid.openinv.util.InternalAccessor;
import org.bukkit.inventory.Inventory;

View File

@@ -16,6 +16,9 @@
package com.lishid.openinv.internal.v1_7_R1;
import java.util.Arrays;
import java.util.Collection;
import com.lishid.openinv.internal.IPlayerDataManager;
import org.bukkit.Bukkit;
@@ -70,4 +73,9 @@ public class PlayerDataManager implements IPlayerDataManager {
return player;
}
@Override
public Collection<? extends Player> getOnlinePlayers() {
return Arrays.asList(Bukkit.getOnlinePlayers());
}
}

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>com.lishid</groupId>
<artifactId>openinv</artifactId>
<artifactId>openinvinternal</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
@@ -14,7 +14,7 @@
<dependencies>
<dependency>
<groupId>com.lishid</groupId>
<artifactId>openinvplugin</artifactId>
<artifactId>openinvcommon</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>

View File

@@ -16,8 +16,6 @@
package com.lishid.openinv.internal.v1_7_R2;
import java.lang.reflect.Field;
import com.lishid.openinv.internal.IAnySilentContainer;
import org.bukkit.ChatColor;
@@ -143,15 +141,7 @@ public class AnySilentContainer implements IAnySilentContainer {
returnValue = true;
} else {
try {
int windowId = 0;
try {
Field windowID = player.getClass().getDeclaredField("containerCounter");
windowID.setAccessible(true);
windowId = windowID.getInt(player);
windowId = windowId % 100 + 1;
windowID.setInt(player, windowId);
} catch (NoSuchFieldException e) {}
int windowId = player.nextContainerCounter();
player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(windowId, 0, ((IInventory) tile).getInventoryName(), ((IInventory) tile).getSize(), true));
player.activeContainer = new SilentContainerChest(player.inventory, ((IInventory) tile));
player.activeContainer.windowId = windowId;

View File

@@ -19,7 +19,7 @@ package com.lishid.openinv.internal.v1_7_R2;
import com.lishid.openinv.internal.IInventoryAccess;
import com.lishid.openinv.internal.ISpecialEnderChest;
import com.lishid.openinv.internal.ISpecialPlayerInventory;
import com.lishid.openinv.internal.InternalAccessor;
import com.lishid.openinv.util.InternalAccessor;
import org.bukkit.inventory.Inventory;

View File

@@ -16,6 +16,9 @@
package com.lishid.openinv.internal.v1_7_R2;
import java.util.Arrays;
import java.util.Collection;
import com.lishid.openinv.internal.IPlayerDataManager;
import org.bukkit.Bukkit;
@@ -71,4 +74,9 @@ public class PlayerDataManager implements IPlayerDataManager {
return player;
}
@Override
public Collection<? extends Player> getOnlinePlayers() {
return Arrays.asList(Bukkit.getOnlinePlayers());
}
}

Some files were not shown because too many files have changed in this diff Show More