mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-11-02 02:47:11 +00:00
Updated for latest SpoutAPI/Vanilla version.
This commit is contained in:
parent
30515a65f5
commit
50b7ef02c7
2
pom.xml
2
pom.xml
@ -93,7 +93,7 @@
|
||||
<dependency>
|
||||
<groupId>org.spout</groupId>
|
||||
<artifactId>vanilla</artifactId>
|
||||
<version>dev-SNAPSHOT</version>
|
||||
<version>1.2.5-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
@ -35,6 +35,7 @@ import org.spout.api.geo.discrete.Point;
|
||||
import org.spout.api.inventory.ItemStack;
|
||||
import org.spout.api.material.MaterialRegistry;
|
||||
import org.spout.api.player.Player;
|
||||
import org.spout.vanilla.controller.living.player.VanillaPlayer;
|
||||
|
||||
public class SpoutPlayer extends LocalPlayer {
|
||||
private Player player;
|
||||
@ -49,7 +50,8 @@ public class SpoutPlayer extends LocalPlayer {
|
||||
|
||||
@Override
|
||||
public int getItemInHand() {
|
||||
ItemStack itemStack = player.getEntity().getInventory().getCurrentItem();
|
||||
VanillaPlayer vanillaPlayer = (VanillaPlayer) player.getEntity().getController();
|
||||
ItemStack itemStack = vanillaPlayer.getInventory().getCurrentItem();
|
||||
return itemStack != null ? itemStack.getMaterial().getId() : 0;
|
||||
}
|
||||
|
||||
@ -77,7 +79,8 @@ public class SpoutPlayer extends LocalPlayer {
|
||||
|
||||
@Override
|
||||
public void giveItem(int type, int amt) {
|
||||
player.getEntity().getInventory().addItem(new ItemStack(MaterialRegistry.get((short) type), amt), false);
|
||||
VanillaPlayer vanillaPlayer = (VanillaPlayer) player.getEntity().getController();
|
||||
vanillaPlayer.getInventory().addItem(new ItemStack(MaterialRegistry.get((short) type), amt), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -34,6 +34,7 @@ import org.spout.api.inventory.ItemStack;
|
||||
import org.spout.api.material.Material;
|
||||
import org.spout.api.material.MaterialRegistry;
|
||||
import org.spout.api.player.Player;
|
||||
import org.spout.vanilla.controller.living.player.VanillaPlayer;
|
||||
|
||||
public class SpoutPlayerBlockBag extends BlockBag {
|
||||
/**
|
||||
@ -59,7 +60,8 @@ public class SpoutPlayerBlockBag extends BlockBag {
|
||||
*/
|
||||
private void loadInventory() {
|
||||
if (items == null) {
|
||||
items = player.getEntity().getInventory().getContents();
|
||||
VanillaPlayer vanillaPlayer = (VanillaPlayer) player.getEntity().getController();
|
||||
items = vanillaPlayer.getInventory().getContents();
|
||||
}
|
||||
}
|
||||
|
||||
@ -206,7 +208,8 @@ public class SpoutPlayerBlockBag extends BlockBag {
|
||||
@Override
|
||||
public void flushChanges() {
|
||||
if (items != null) {
|
||||
Inventory inv = player.getEntity().getInventory();
|
||||
VanillaPlayer vanillaPlayer = (VanillaPlayer) player.getEntity().getController();
|
||||
Inventory inv = vanillaPlayer.getInventory();
|
||||
for (int i = 0; i < items.length && i < inv.getSize(); ++i) {
|
||||
inv.setItem(i, items[i]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user