Give the players a wand when starting to create a jail or cell.

This commit is contained in:
graywolf336 2013-12-06 15:56:46 -06:00
parent 647a4f9d17
commit e07c657a40
4 changed files with 319 additions and 278 deletions

View File

@ -1,5 +1,11 @@
package com.graywolf336.jail;
import java.util.LinkedList;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.util.Vector;
public class Util {
@ -40,4 +46,17 @@ public class Util {
public static String getColorfulMessage(String message) {
return message.replaceAll("(?i)&([0-9abcdefklmnor])", "\u00A7$1");
}
public static ItemStack getWand() {
ItemStack wand = new ItemStack(Material.WOOD_SWORD);
ItemMeta meta = wand.getItemMeta();
meta.setDisplayName(ChatColor.AQUA + "Jail Wand");
LinkedList<String> lore = new LinkedList<String>();
lore.add(ChatColor.BLUE + "The wand for creating");
lore.add(ChatColor.BLUE + "a jail or cell.");
meta.setLore(lore);
wand.setItemMeta(meta);
return wand;
}
}

View File

@ -19,7 +19,7 @@ import com.graywolf336.jail.beans.SimpleLocation;
*
* @author graywolf336
* @since 3.0.0
* @version 1.0.0
* @version 1.0.1
*/
public class CellCreationSteps {
@ -28,6 +28,16 @@ public class CellCreationSteps {
player.sendMessage(ChatColor.AQUA + "---------- Jail Cell Creation ----------");
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 + "----------------------------------------");
if(player.getInventory().contains(Material.WOOD_SWORD)) {
int i = player.getInventory().first(Util.getWand());
if(i != -1) {
player.getInventory().setItem(i, player.getItemInHand());
player.setItemInHand(Util.getWand());
}
}else {
player.getInventory().addItem(Util.getWand());
}
}
/**

View File

@ -2,6 +2,7 @@ package com.graywolf336.jail.steps;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
@ -15,7 +16,7 @@ import com.graywolf336.jail.beans.Jail;
*
* @author graywolf336
* @since 3.0.0
* @version 1.1.0
* @version 1.1.1
*/
public class JailCreationSteps {
@ -24,6 +25,16 @@ public class JailCreationSteps {
player.sendMessage(ChatColor.AQUA + "----------Jail Zone Creation----------");
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 + "--------------------------------------");
if(player.getInventory().contains(Material.WOOD_SWORD)) {
int i = player.getInventory().first(Util.getWand());
if(i != -1) {
player.getInventory().setItem(i, player.getItemInHand());
player.setItemInHand(Util.getWand());
}
}else {
player.getInventory().addItem(Util.getWand());
}
}
/**

View File

@ -1,6 +1,7 @@
system:
configVersion: 3
debug: false
language: 'en'
updateNotifications: true
storage:
type: 'flatfile' #can be flatfile, sqlite, or mysql