Let's check for the wand and not just a wooden sword.

This commit is contained in:
graywolf336 2013-12-09 12:54:51 -06:00
parent 68cd8bc56a
commit 3643627b7d
2 changed files with 12 additions and 9 deletions

View File

@ -5,6 +5,7 @@ import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import com.graywolf336.jail.JailManager; import com.graywolf336.jail.JailManager;
@ -29,14 +30,15 @@ public class CellCreationSteps {
player.sendMessage(ChatColor.GREEN + "First, you must select a teleport point for the cell! Move to the teleport point and then click anywhere with your wooden sword to set it."); player.sendMessage(ChatColor.GREEN + "First, you must select a teleport point for the cell! Move to the teleport point and then click anywhere with your wooden sword to set it.");
player.sendMessage(ChatColor.AQUA + "----------------------------------------"); player.sendMessage(ChatColor.AQUA + "----------------------------------------");
if(player.getInventory().contains(Material.WOOD_SWORD)) { ItemStack wand = Util.getWand();
int i = player.getInventory().first(Util.getWand()); if(player.getInventory().contains(wand)) {
int i = player.getInventory().first(wand);
if(i != -1) { if(i != -1) {
player.getInventory().setItem(i, player.getItemInHand()); player.getInventory().setItem(i, player.getItemInHand());
player.setItemInHand(Util.getWand()); player.setItemInHand(wand);
} }
}else { }else {
player.getInventory().addItem(Util.getWand()); player.getInventory().addItem(wand);
} }
} }

View File

@ -2,8 +2,8 @@ package com.graywolf336.jail.steps;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import com.graywolf336.jail.JailManager; import com.graywolf336.jail.JailManager;
@ -26,14 +26,15 @@ public class JailCreationSteps {
player.sendMessage(ChatColor.GREEN + "First, you must select jail cuboid. Select the first point of the cuboid by right clicking on the block with your wooden sword. DO NOT FORGET TO MARK THE FLOOR AND CEILING TOO!"); player.sendMessage(ChatColor.GREEN + "First, you must select jail cuboid. Select the first point of the cuboid by right clicking on the block with your wooden sword. DO NOT FORGET TO MARK THE FLOOR AND CEILING TOO!");
player.sendMessage(ChatColor.AQUA + "--------------------------------------"); player.sendMessage(ChatColor.AQUA + "--------------------------------------");
if(player.getInventory().contains(Material.WOOD_SWORD)) { ItemStack wand = Util.getWand();
int i = player.getInventory().first(Util.getWand()); if(player.getInventory().contains(wand)) {
int i = player.getInventory().first(wand);
if(i != -1) { if(i != -1) {
player.getInventory().setItem(i, player.getItemInHand()); player.getInventory().setItem(i, player.getItemInHand());
player.setItemInHand(Util.getWand()); player.setItemInHand(wand);
} }
}else { }else {
player.getInventory().addItem(Util.getWand()); player.getInventory().addItem(wand);
} }
} }