Skip to content

Commit

Permalink
Update AnimateChest class
Browse files Browse the repository at this point in the history
Interesting new NMS class
  • Loading branch information
Morphan1 committed Nov 29, 2014
1 parent 375cdb4 commit 705e8f6
Showing 1 changed file with 8 additions and 7 deletions.
Expand Up @@ -2,7 +2,9 @@

import net.aufdemrand.denizen.BukkitScriptEntryData;
import net.aufdemrand.denizen.objects.*;
import net.minecraft.server.v1_8_R1.Block;
import net.minecraft.server.v1_8_R1.PacketPlayOutBlockAction;
import net.minecraft.server.v1_8_R1.BlockPosition;
import org.bukkit.Sound;

import net.aufdemrand.denizencore.exceptions.CommandExecutionException;
Expand Down Expand Up @@ -76,26 +78,25 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException {
+ sound.debug()
+ aH.debugObj("players", players.toString()));

BlockPosition blockPosition = new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ());
Block block = ((CraftWorld) location.getWorld()).getHandle().getType(blockPosition).getBlock();

switch (ChestAction.valueOf(action.asString().toUpperCase())) {
/*
case OPEN:
for (dPlayer player: players) {
if (sound.asBoolean()) player.getPlayerEntity().playSound(location, Sound.CHEST_OPEN, 1, 1);
((CraftPlayer)player.getPlayerEntity()).getHandle().playerConnection.sendPacket(
new PacketPlayOutBlockAction(location.getBlockX(), location.getBlockY(), location.getBlockZ(),
((CraftWorld) location.getWorld()).getHandle().getType(location.getBlockX(), location.getBlockY(), location.getBlockZ()), 1, 1));
new PacketPlayOutBlockAction(blockPosition, block, 1, 1));
}
break;

case CLOSE:
for (dPlayer player: players) {
if (sound.asBoolean()) player.getPlayerEntity().getWorld().playSound(location, Sound.CHEST_CLOSE, 1, 1);
((CraftPlayer)player.getPlayerEntity()).getHandle().playerConnection.sendPacket(
new PacketPlayOutBlockAction(location.getBlockX(), location.getBlockY(), location.getBlockZ(),
((CraftWorld)location.getWorld()).getHandle().getType(location.getBlockX(), location.getBlockY(), location.getBlockZ()), 1, 0));
new PacketPlayOutBlockAction(blockPosition, block, 1, 0));
}
break;*/
// TODO: 1.8 UPDATE
break;
}
}
}

0 comments on commit 705e8f6

Please sign in to comment.