|
|
|
@ -10,6 +10,7 @@ import java.util.List;
|
|
|
|
|
|
|
|
|
|
import org.bukkit.Bukkit;
|
|
|
|
|
import org.bukkit.ChatColor;
|
|
|
|
|
import org.bukkit.GameMode;
|
|
|
|
|
import org.bukkit.Location;
|
|
|
|
|
import org.bukkit.Material;
|
|
|
|
|
import org.bukkit.Sound;
|
|
|
|
@ -18,6 +19,7 @@ import org.bukkit.block.BlockFace;
|
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
|
import org.bukkit.event.EventHandler;
|
|
|
|
|
import org.bukkit.event.EventPriority;
|
|
|
|
|
import org.bukkit.event.entity.EntityShootBowEvent;
|
|
|
|
|
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
|
|
|
|
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
|
|
|
|
import org.bukkit.event.player.PlayerInteractEvent;
|
|
|
|
@ -66,6 +68,7 @@ public class Draw extends SoloGame
|
|
|
|
|
|
|
|
|
|
//Brush
|
|
|
|
|
private byte _brushColor = 15;
|
|
|
|
|
private Material _brushMaterial = Material.WOOL;
|
|
|
|
|
private Location _brushPrevious = null;
|
|
|
|
|
|
|
|
|
|
private boolean _lockDrawer = true;
|
|
|
|
@ -95,15 +98,16 @@ public class Draw extends SoloGame
|
|
|
|
|
|
|
|
|
|
new Kit[]
|
|
|
|
|
{
|
|
|
|
|
new KitSlowAndSteady(manager),
|
|
|
|
|
new KitSelector(manager),
|
|
|
|
|
new KitTools(manager),
|
|
|
|
|
//new KitSlowAndSteady(manager),
|
|
|
|
|
//new KitSelector(manager),
|
|
|
|
|
// new KitTools(manager),
|
|
|
|
|
new KitArtist(manager)
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
new String[]
|
|
|
|
|
{
|
|
|
|
|
"Take turns to draw something",
|
|
|
|
|
"Right-Click with Swords to draw",
|
|
|
|
|
"Right-Click with items to draw",
|
|
|
|
|
"Hints are given at top of screen",
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -113,9 +117,71 @@ public class Draw extends SoloGame
|
|
|
|
|
this.WorldTimeSet = 8000;
|
|
|
|
|
|
|
|
|
|
_words = new String[]
|
|
|
|
|
{
|
|
|
|
|
"Bird", "Volcano", "Sloth", "Love", "Dance", "Hair", "Glasses", "Domino", "Dice", "Computer", "Top Hat", "Beard", "Wind", "Rain", "Minecraft", "Push", "Fighting", "Juggle", "Clown", "Miner", "Creeper", "Ghast", "Spider", "Punch", "Roll", "River", "Desert", "Cold", "Pregnant", "Photo", "Quick", "Mario", "Luigi", "Bridge", "Turtle", "Door Knob", "Mineplex", "Binoculars", "Telescope", "Planet", "Mountain Bike", "Moon", "Comet", "Flower", "Squirrel", "Horse Riding", "Chef", "Elephant", "Yoshi", "Shotgun", "Pistol", "James Bond", "Money", "Salt and Pepper", "Truck", "Helicopter", "Hot Air Balloon", "Sprout", "Yelling", "Muscles", "Skinny", "Zombie", "Lava", "Snake", "Motorbike", "Whale", "Boat", "Letterbox", "Window", "Lollipop", "Handcuffs", "Police", "Uppercut", "Windmill", "Eyepatch", "Campfire", "Rainbow", "Storm", "Pikachu", "Charmander", "Tornado", "Crying", "King", "Hobo", "Worm", "Snail", "XBox", "Playstation", "Nintendo", "Duck", "Pull", "Dinosaur", "Alligator", "Ankle", "Angel", "Acorn", "Bread", "Booty", "Bacon", "Crown", "Donut", "Drill", "Leash", "Magic", "Wizard", "Igloo", "Plant", "Screw", "Rifle", "Puppy", "Stool", "Stamp", "Letter", "Witch", "Zebra", "Wagon", "Compass", "Watch", "Clock", "Time", "Cyclops", "Coconut", "Hang", "Penguin", "Confused", "Bucket", "Lion", "Rubbish", "Spaceship", "Bowl", "Shark", "Pizza", "Pyramid", "Dress", "Pants", "Shorts", "Boots", "Boy", "Girl", "Math", "Sunglasses", "Frog", "Chair", "Cake", "Grapes", "Kiss", "Snorlax", "Earth", "Spaghetti", "Couch", "Family", "Milk", "Blood", "Pig", "Giraffe", "Mouse", "Couch", "Fat", "Chocolate", "Camel", "Cheese", "Beans", "Water", "Chicken", "Cannibal", "Zipper", "Book", "Swimming", "Horse", "Paper", "Toaster", "Television", "Hammer", "Piano", "Sleeping", "Yawn", "Sheep", "Night", "Chest", "Lamp", "Redstone", "Grass", "Plane", "Ocean", "Lake", "Melon", "Pumpkin", "Gift", "Fishing", "Pirate", "Lightning", "Stomach", "Belly Button", "Fishing Rod", "Iron Ore", "Diamonds", "Emeralds", "Nether Portal", "Ender Dragon", "Rabbit", "Harry Potter", "Torch", "Light", "Battery", "Zombie Pigman", "Telephone", "Tent", "Hand", "Traffic Lights", "Anvil", "Tail", "Umbrella", "Piston", "Skeleton", "Spikes", "Bridge", "Bomb", "Spoon", "Rainbow", "Staircase", "Poop", "Dragon", "Fire", "Apple", "Shoe", "Squid", "Cookie", "Tooth", "Camera", "Sock", "Monkey", "Unicorn", "Smile", "Pool", "Rabbit", "Cupcake", "Pancake", "Princess", "Castle", "Flag", "Planet", "Stars", "Camp Fire", "Rose", "Spray", "Pencil", "Ice Cream", "Toilet", "Moose", "Bear", "Beer", "Batman", "Eggs", "Teapot", "Golf Club", "Tennis Racket", "Shield", "Crab", "Pot of Gold", "Cactus", "Television", "Pumpkin Pie", "Chimney", "Stable", "Nether", "Wither", "Beach", "Stop Sign", "Chestplate", "Pokeball", "Christmas Tree", "Present", "Snowflake", "Laptop", "Superman", "Football", "Basketball", "Creeper", "Tetris", "Jump", "Ninja", "Baby", "Troll Face", "Grim Reaper", "Temple", "Explosion", "Vomit", "Ants", "Barn", "Burn", "Baggage", "Frisbee", "Iceberg", "Sleeping", "Dream", "Snorlax", "Balloons", "Elevator", "Alligator", "Bikini", "Butterfly", "Bumblebee", "Pizza", "Jellyfish", "Sideburns", "Speedboat", "Treehouse", "Water Gun", "Drink", "Hook", "Dance", "Fall", "Summer", "Autumn", "Spring", "Winter", "Night Time", "Galaxy", "Sunrise", "Sunset", "Picnic", "Snowflake", "Holding Hands", "America", "Laptop", "Anvil", "Bagel", "Bench", "Cigar", "Darts", "Muffin", "Queen", "Wheat", "Dolphin", "Scarf", "Swing", "Thumb", "Tomato", "Alcohol", "Armor", "Alien", "Beans", "Cheek", "Phone", "Keyboard", "Orange", "Calculator", "Paper", "Desk", "Disco", "Elbow", "Drool", "Giant", "Golem", "Grave", "Llama", "Moose", "Party", "Panda", "Plumber", "Salsa", "Salad", "Skunk", "Skull", "Stump", "Sugar", "Ruler", "Bookcase", "Hamster", "Soup", "Teapot", "Towel", "Waist", "Archer", "Anchor", "Bamboo", "Branch", "Booger", "Carrot", "Cereal", "Coffee", "Wolf", "Crayon", "Finger", "Forest", "Hotdog", "Burger", "Obsidian", "Pillow", "Swing", "YouTube", "Farm", "Rain", "Cloud", "Frozen", "Garbage", "Music", "Twitter", "Facebook", "Santa Hat", "Rope", "Neck", "Sponge", "Sushi", "Noodles", "Soup", "Tower", "Berry", "Capture", "Prison", "Robot", "Trash", "School", "Skype", "Snowman", "Crowd", "Bank", "Mudkip", "Joker", "Lizard", "Tiger", "Royal", "Erupt", "Wizard", "Stain", "Cinema", "Notebook", "Blanket", "Paint", "Guard", "Astronaut" , "Slime" , "Mansion" , "Radar" , "Thorn" , "Tears" , "Tiny" , "Candy" , "Pepsi" , "Flint" , "Draw My Thing" , "Rice" , "Shout" , "Prize" , "Skirt" , "Thief" , "Syrup" , "Kirby" , "Brush" , "Violin", "Car", "Sun", "Eye", "Bow", "Axe", "Face", "Mushroom", "Guitar", "Book",
|
|
|
|
|
};
|
|
|
|
|
{
|
|
|
|
|
"Bird", "Volcano", "Sloth", "Love", "Dance", "Hair", "Glasses", "Domino", "Dice", "Computer", "Top Hat",
|
|
|
|
|
"Beard", "Wind", "Rain", "Minecraft", "Push", "Fighting", "Juggle", "Clown", "Miner", "Creeper",
|
|
|
|
|
"Ghast", "Spider", "Punch", "Roll", "River", "Desert", "Cold", "Pregnant", "Photo", "Quick", "Mario",
|
|
|
|
|
"Luigi", "Bridge", "Turtle", "Door Knob", "Mineplex", "Binoculars", "Telescope", "Planet",
|
|
|
|
|
"Mountain Bike", "Moon", "Comet", "Flower", "Squirrel", "Horse Riding", "Chef", "Elephant", "Yoshi",
|
|
|
|
|
"Shotgun", "Pistol", "James Bond", "Money", "Salt and Pepper", "Truck", "Helicopter", "Hot Air Balloon",
|
|
|
|
|
"Sprout", "Yelling", "Muscles", "Skinny", "Zombie", "Lava", "Snake", "Motorbike", "Whale", "Boat",
|
|
|
|
|
"Letterbox", "Window", "Lollipop", "Handcuffs", "Police", "Uppercut", "Windmill", "Eyepatch", "Campfire",
|
|
|
|
|
"Rainbow", "Storm", "Pikachu", "Charmander", "Tornado", "Crying", "King", "Hobo", "Worm", "Snail",
|
|
|
|
|
"XBox", "Playstation", "Nintendo", "Duck", "Pull", "Dinosaur", "Alligator", "Ankle", "Angel", "Acorn",
|
|
|
|
|
"Bread", "Booty", "Bacon", "Crown", "Donut", "Drill", "Leash", "Magic", "Wizard", "Igloo", "Plant",
|
|
|
|
|
"Screw", "Rifle", "Puppy", "Stool", "Stamp", "Letter", "Witch", "Zebra", "Wagon", "Compass", "Watch",
|
|
|
|
|
"Clock", "Time", "Cyclops", "Coconut", "Hang", "Penguin", "Confused", "Bucket", "Lion", "Rubbish",
|
|
|
|
|
"Spaceship", "Bowl", "Shark", "Pizza", "Pyramid", "Dress", "Pants", "Shorts", "Boots", "Boy", "Girl",
|
|
|
|
|
"Math", "Sunglasses", "Frog", "Chair", "Cake", "Grapes", "Kiss", "Snorlax", "Earth", "Spaghetti",
|
|
|
|
|
"Couch", "Family", "Milk", "Blood", "Pig", "Giraffe", "Mouse", "Couch", "Fat", "Chocolate", "Camel",
|
|
|
|
|
"Cheese", "Beans", "Water", "Chicken", "Zipper", "Book", "Swimming", "Horse", "Paper", "Toaster",
|
|
|
|
|
"Television", "Hammer", "Piano", "Sleeping", "Yawn", "Sheep", "Night", "Chest", "Lamp", "Redstone",
|
|
|
|
|
"Grass", "Plane", "Ocean", "Lake", "Melon", "Pumpkin", "Gift", "Fishing", "Pirate",
|
|
|
|
|
"Lightning", "Stomach", "Belly Button", "Fishing Rod", "Iron Ore", "Diamonds", "Emeralds",
|
|
|
|
|
"Nether Portal", "Ender Dragon", "Rabbit", "Harry Potter", "Torch", "Light", "Battery", "Zombie Pigman",
|
|
|
|
|
"Telephone", "Tent", "Hand", "Traffic Lights", "Anvil", "Tail", "Umbrella", "Piston", "Skeleton",
|
|
|
|
|
"Spikes", "Bridge", "Bomb", "Spoon", "Rainbow", "Staircase", "Poop", "Dragon", "Fire", "Apple", "Shoe",
|
|
|
|
|
"Squid", "Cookie", "Tooth", "Camera", "Sock", "Monkey", "Unicorn", "Smile", "Pool", "Rabbit",
|
|
|
|
|
"Cupcake", "Pancake", "Princess", "Castle", "Flag", "Planet", "Stars", "Camp Fire", "Rose", "Spray",
|
|
|
|
|
"Pencil", "Ice Cream", "Toilet", "Moose", "Bear", "Beer", "Batman", "Eggs", "Teapot", "Golf Club",
|
|
|
|
|
"Tennis Racket", "Shield", "Crab", "Pot of Gold", "Cactus", "Television", "Pumpkin Pie", "Chimney",
|
|
|
|
|
"Stable", "Nether", "Wither", "Beach", "Stop Sign", "Chestplate", "Pokeball", "Christmas Tree",
|
|
|
|
|
"Present", "Snowflake", "Laptop", "Superman", "Football", "Basketball", "Creeper", "Tetris", "Jump",
|
|
|
|
|
"Ninja", "Baby", "Troll Face", "Grim Reaper", "Temple", "Explosion", "Vomit", "Ants", "Barn", "Burn",
|
|
|
|
|
"Baggage", "Frisbee", "Iceberg", "Sleeping", "Dream", "Snorlax", "Balloons", "Elevator", "Alligator",
|
|
|
|
|
"Bikini", "Butterfly", "Bumblebee", "Pizza", "Jellyfish", "Sideburns", "Speedboat", "Treehouse",
|
|
|
|
|
"Water Gun", "Drink", "Hook", "Dance", "Fall", "Summer", "Autumn", "Spring", "Winter", "Night Time",
|
|
|
|
|
"Galaxy", "Sunrise", "Sunset", "Picnic", "Snowflake", "Holding Hands", "America", "Laptop", "Anvil",
|
|
|
|
|
"Bagel", "Bench", "Cigar", "Darts", "Muffin", "Queen", "Wheat", "Dolphin", "Scarf", "Swing", "Thumb",
|
|
|
|
|
"Tomato", "Armor", "Alien", "Beans", "Cheek", "Phone", "Keyboard", "Orange", "Calculator",
|
|
|
|
|
"Paper", "Desk", "Disco", "Elbow", "Drool", "Giant", "Golem", "Grave", "Llama", "Moose", "Party",
|
|
|
|
|
"Panda", "Plumber", "Salsa", "Salad", "Skunk", "Skull", "Stump", "Sugar", "Ruler", "Bookcase",
|
|
|
|
|
"Hamster", "Soup", "Teapot", "Towel", "Waist", "Archer", "Anchor", "Bamboo", "Branch", "Booger",
|
|
|
|
|
"Carrot", "Cereal", "Coffee", "Wolf", "Crayon", "Finger", "Forest", "Hotdog", "Burger", "Obsidian",
|
|
|
|
|
"Pillow", "Swing", "YouTube", "Farm", "Rain", "Cloud", "Frozen", "Garbage", "Music", "Twitter",
|
|
|
|
|
"Facebook", "Santa Hat", "Rope", "Neck", "Sponge", "Sushi", "Noodles", "Soup", "Tower", "Berry",
|
|
|
|
|
"Capture", "Prison", "Robot", "Trash", "School", "Skype", "Snowman", "Crowd", "Bank", "Mudkip",
|
|
|
|
|
"Joker", "Lizard", "Tiger", "Royal", "Erupt", "Wizard", "Stain", "Cinema", "Notebook", "Blanket",
|
|
|
|
|
"Paint", "Guard", "Astronaut" , "Slime" , "Mansion" , "Radar" , "Thorn" , "Tears" , "Tiny" , "Candy" ,
|
|
|
|
|
"Pepsi" , "Flint" , "Draw My Thing" , "Rice" , "Shout" , "Prize" , "Skirt" , "Thief" , "Syrup" ,
|
|
|
|
|
"Kirby" , "Brush" , "Violin", "Car", "Sun", "Eye", "Bow", "Axe", "Face", "Mushroom", "Guitar",
|
|
|
|
|
"Pickle", "Banana", "Crab", "Sugar", "Soda", "Cookie", "Burger", "Fries", "Speaker",
|
|
|
|
|
"Pillow", "Rug", "Purse", "Monitor", "Bow", "Pen", "Cat", "Kitten", "Puppy", "Bed", "Button",
|
|
|
|
|
"Computer", "Key", "Spoon", "Lamp", "Bottle", "Card", "Newspaper", "Glasses", "Mountain", "Minecraft",
|
|
|
|
|
"Shirt", "Truck", "Car", "Phone", "Cork", "iPod", "Paper", "Bag", "USB", "CD", "Wallet", "Cow", "Pig",
|
|
|
|
|
"Sheep", "Tomato", "Painting", "Chair", "Keyboard", "Chocolate", "Duck", "Clock", "Balloon", "Remote",
|
|
|
|
|
"Bread", "Ring", "Necklace", "Hippo", "Flag", "Window", "Door", "Radio", "Television", "Boat",
|
|
|
|
|
"Fridge", "House", "Piano", "Guitar", "Trumpet", "Drums", "Speaker", "Helmet", "Tree", "Slippers",
|
|
|
|
|
"Table", "Doll", "Headphones", "Box", "Flower", "Book", "Carrot", "Egg", "Sun", "Hill", "Candle",
|
|
|
|
|
"Food", "Mouse", "Money", "Emerald", "Magnet", "Camera", "Movie", "Video Game", "Teddy", "Lake",
|
|
|
|
|
"Violin", "Cheese", "Burger", "Peasant", "King", "Queen", "Prince", "Princess", "Mother", "Father", "Taco",
|
|
|
|
|
"Racecar", "Car", "Truck", "Tree", "Elephant", "Lion", "Pig", "Cow", "Chicken", "Dog", "Cat", "Moon", "Stars",
|
|
|
|
|
"Sun", "Diamond", "Gold", "Redstone", "Skateboard", "Bike", "Swimming Pool", "Cookie", "Computer", "Laptop",
|
|
|
|
|
"Piano", "Guitar", "Trumpet", "Drums", "Flute", "Helicopter", "Plane", "Football", "Tennis", "Hockey",
|
|
|
|
|
"Water", "Ocean", "Microsoft", "Twitter", "Godzilla", "Building", "House", "Rainbow", "Barbie", "Girl", "Boy",
|
|
|
|
|
"Children", "Bomb", "Explosion", "Gun", "Tank", "Penguin", "Eagle", "America", "Kangaroo", "Sea", "Raspberry",
|
|
|
|
|
"Strawberry", "Jam", "Sandwich", "Owl", "Watermelon", "Australia", "Canada", "United States", "Diary"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
_holidayWords = new String[]
|
|
|
|
|
{
|
|
|
|
@ -150,13 +216,50 @@ public class Draw extends SoloGame
|
|
|
|
|
@Override
|
|
|
|
|
public void ParseData()
|
|
|
|
|
{
|
|
|
|
|
for (Location loc : WorldData.GetCustomLocs("159"))
|
|
|
|
|
_canvas.add(loc.getBlock());
|
|
|
|
|
int count = 0;
|
|
|
|
|
for (Block b : UtilBlock.getInBoundingBox(WorldData.GetDataLocs("PINK").get(0), WorldData.GetDataLocs("PINK").get(1), false))
|
|
|
|
|
{
|
|
|
|
|
if (b.getType() != Material.AIR)
|
|
|
|
|
{
|
|
|
|
|
_canvas.add(b);
|
|
|
|
|
count++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
System.out.println("===");
|
|
|
|
|
System.out.println("Draw loc: " + WorldData.GetDataLocs("RED").size());
|
|
|
|
|
System.out.println("Canvas Count: " + count);
|
|
|
|
|
System.out.println("===");
|
|
|
|
|
|
|
|
|
|
_drawerLocation = WorldData.GetDataLocs("RED").get(0);
|
|
|
|
|
_textLocation = WorldData.GetDataLocs("YELLOW").get(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
|
public void clearBoardStart(GameStateChangeEvent e)
|
|
|
|
|
{
|
|
|
|
|
if (e.GetState() != GameState.Live)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
Reset();
|
|
|
|
|
|
|
|
|
|
for (Player player : GetPlayers(true))
|
|
|
|
|
player.setGameMode(GameMode.ADVENTURE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
|
public void playerFallCloudy(PlayerMoveEvent e)
|
|
|
|
|
{
|
|
|
|
|
if (!GetPlayers(true).contains(e.getPlayer()))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (!WorldData.MapName.equalsIgnoreCase("Cloudy"))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (e.getTo().getBlockY() <= 130)
|
|
|
|
|
{
|
|
|
|
|
GetTeam(e.getPlayer()).SpawnTeleport(e.getPlayer());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -282,20 +385,19 @@ public class Draw extends SoloGame
|
|
|
|
|
drawer.setFlying(true);
|
|
|
|
|
drawer.setFlySpeed(0.4f);
|
|
|
|
|
|
|
|
|
|
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOD_SWORD, (byte)0, 1, "Thin Paint Brush"));
|
|
|
|
|
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, "Thick Paint Brush"));
|
|
|
|
|
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOD_SWORD, (byte) 0, 1, "Pencil"));
|
|
|
|
|
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte) 0, 1, "Paint Brush"));
|
|
|
|
|
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_SWORD, (byte) 0, 1, "Line Tool"));
|
|
|
|
|
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.GOLD_SWORD, (byte)0, 1, "Square Tool"));
|
|
|
|
|
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD, (byte)0, 1, "Circle Tool"));
|
|
|
|
|
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW, (byte)0, 1, "Spray Can"));
|
|
|
|
|
|
|
|
|
|
if (GetKit(drawer) instanceof KitTools)
|
|
|
|
|
{
|
|
|
|
|
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_SWORD, (byte)0, 1, "Line Tool"));
|
|
|
|
|
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.GOLD_SWORD, (byte)0, 1, "Square Tool"));
|
|
|
|
|
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD, (byte)0, 1, "Circle Tool"));
|
|
|
|
|
}
|
|
|
|
|
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_HOE, (byte)0, 1, "Paint Bucket"));
|
|
|
|
|
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.GOLD_HOE, (byte)0, 1, "Clear Canvas"));
|
|
|
|
|
|
|
|
|
|
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BUCKET, (byte)0, 1, "Paint Bucket"));
|
|
|
|
|
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.TNT, (byte)0, 1, "Clear Canvas"));
|
|
|
|
|
drawer.getInventory().setItem(10, ItemStackFactory.Instance.CreateStack(Material.ARROW, (byte)0, 1, "Paint"));
|
|
|
|
|
|
|
|
|
|
Announce(C.cGold + C.Bold + "Round " + (_roundCount+1) + ": " + C.cYellow + C.Bold + drawer.getName() + " is drawing!");
|
|
|
|
|
Announce(C.cGold + C.Bold + "Round " + (_roundCount + 1) + ": " + C.cYellow + C.Bold + drawer.getName() + " is drawing!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -478,6 +580,65 @@ public class Draw extends SoloGame
|
|
|
|
|
tool.update();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
|
public void sprayCan(UpdateEvent e)
|
|
|
|
|
{
|
|
|
|
|
if (e.getType() != UpdateType.TICK)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (!IsLive())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
for (Player p : _drawers.GetPlayers(true))
|
|
|
|
|
{
|
|
|
|
|
if (!UtilGear.isMat(p.getItemInHand(), Material.BOW))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (!UtilPlayer.isChargingBow(p))
|
|
|
|
|
{
|
|
|
|
|
_brushPrevious = null;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Block block = UtilPlayer.getTarget(p, UtilBlock.blockPassSet, 400);
|
|
|
|
|
if (block == null || !_canvas.contains(block))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
// Spray
|
|
|
|
|
block.setType(_brushMaterial);
|
|
|
|
|
block.setData(_brushColor);
|
|
|
|
|
|
|
|
|
|
for (Block surround : UtilBlock.getSurrounding(block, true))
|
|
|
|
|
{
|
|
|
|
|
if (!_canvas.contains(surround))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (Math.random() > 0.5)
|
|
|
|
|
{
|
|
|
|
|
surround.setType(_brushMaterial);
|
|
|
|
|
surround.setData(_brushColor);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (Player other : UtilServer.getPlayers())
|
|
|
|
|
other.playSound(other.getLocation(), Sound.FIZZ, 0.2f, 2f);
|
|
|
|
|
|
|
|
|
|
_lockDrawer = false;
|
|
|
|
|
|
|
|
|
|
_brushPrevious = block.getLocation().add(0.5, 0.5, 0.5);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
|
public void sprayCanArrowCancel(EntityShootBowEvent e)
|
|
|
|
|
{
|
|
|
|
|
if (e.getEntity() instanceof Player)
|
|
|
|
|
{
|
|
|
|
|
e.setCancelled(true);
|
|
|
|
|
((Player)e.getEntity()).updateInventory();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
|
public void Paint(UpdateEvent event)
|
|
|
|
|
{
|
|
|
|
@ -498,14 +659,15 @@ public class Draw extends SoloGame
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Block block = player.getTargetBlock((HashSet<Byte>) null, 200);
|
|
|
|
|
Block block = UtilPlayer.getTarget(player, UtilBlock.blockPassSet, 400);
|
|
|
|
|
if (block == null || !_canvas.contains(block))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (block.getData() == _brushColor)
|
|
|
|
|
if (block.getData() == _brushColor && block.getType() == _brushMaterial)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
//Color
|
|
|
|
|
block.setType(_brushMaterial);
|
|
|
|
|
block.setData(_brushColor);
|
|
|
|
|
|
|
|
|
|
//Thick Brush
|
|
|
|
@ -516,6 +678,7 @@ public class Draw extends SoloGame
|
|
|
|
|
if (!_canvas.contains(other))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
block.setType(_brushMaterial);
|
|
|
|
|
other.setData(_brushColor);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -532,6 +695,7 @@ public class Draw extends SoloGame
|
|
|
|
|
if (!_canvas.contains(fixBlock))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
fixBlock.setType(_brushMaterial);
|
|
|
|
|
fixBlock.setData(_brushColor);
|
|
|
|
|
|
|
|
|
|
//Thick Brush
|
|
|
|
@ -542,6 +706,7 @@ public class Draw extends SoloGame
|
|
|
|
|
if (!_canvas.contains(other))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
other.setType(_brushMaterial);
|
|
|
|
|
other.setData(_brushColor);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -565,7 +730,7 @@ public class Draw extends SoloGame
|
|
|
|
|
|
|
|
|
|
Player player = event.getPlayer();
|
|
|
|
|
|
|
|
|
|
if (!UtilGear.isMat(player.getItemInHand(), Material.TNT))
|
|
|
|
|
if (!UtilGear.isMat(player.getItemInHand(), Material.GOLD_HOE))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (!_drawers.HasPlayer(player))
|
|
|
|
@ -580,6 +745,7 @@ public class Draw extends SoloGame
|
|
|
|
|
|
|
|
|
|
//Restore
|
|
|
|
|
_brushColor = color;
|
|
|
|
|
_brushMaterial = Material.WOOL;
|
|
|
|
|
_lockDrawer = false;
|
|
|
|
|
|
|
|
|
|
for (Player other : UtilServer.getPlayers())
|
|
|
|
@ -587,48 +753,60 @@ public class Draw extends SoloGame
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
|
public void PaintBucket(PlayerInteractEvent event)
|
|
|
|
|
public void paintFill(PlayerInteractEvent e)
|
|
|
|
|
{
|
|
|
|
|
if (!IsLive())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
Player player = event.getPlayer();
|
|
|
|
|
Player p = e.getPlayer();
|
|
|
|
|
|
|
|
|
|
if (!UtilGear.isMat(player.getItemInHand(), Material.BUCKET))
|
|
|
|
|
if (!UtilGear.isMat(p.getItemInHand(), Material.IRON_HOE))
|
|
|
|
|
{
|
|
|
|
|
// Not the correct tool (iron hoe = paint fill).
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!_drawers.HasPlayer(p))
|
|
|
|
|
{
|
|
|
|
|
// Not drawing.
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Get the target block that the player clicks on.
|
|
|
|
|
Block target = UtilPlayer.getTarget(p, UtilBlock.blockPassSet, 400);
|
|
|
|
|
|
|
|
|
|
if (target == null || !_canvas.contains(target))
|
|
|
|
|
{
|
|
|
|
|
// Target block is non-existent or not in the canvas.
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Material material = target.getType();
|
|
|
|
|
byte data = target.getData();
|
|
|
|
|
|
|
|
|
|
if (data == _brushColor && material == _brushMaterial)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (!_drawers.HasPlayer(player))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
Block block = player.getTargetBlock((HashSet<Byte>) null, 200);
|
|
|
|
|
if (block == null || !_canvas.contains(block))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
//Fill
|
|
|
|
|
byte color = block.getData();
|
|
|
|
|
|
|
|
|
|
if (color == _brushColor)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
FillRecurse(block, color);
|
|
|
|
|
fillRecursive(target, material, data);
|
|
|
|
|
|
|
|
|
|
for (Player other : UtilServer.getPlayers())
|
|
|
|
|
other.playSound(other.getLocation(), Sound.SPLASH, 0.4f, 1.5f);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void FillRecurse(Block block, byte color)
|
|
|
|
|
private void fillRecursive(Block block, final Material fillMaterial, final byte fillData)
|
|
|
|
|
{
|
|
|
|
|
if (block.getData() != color)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (!_canvas.contains(block))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
block.setData(_brushColor);
|
|
|
|
|
|
|
|
|
|
for (Block other : UtilBlock.getSurrounding(block, false))
|
|
|
|
|
if (!_canvas.contains(block) || block.getType() != fillMaterial || block.getData() != fillData)
|
|
|
|
|
{
|
|
|
|
|
FillRecurse(other, color);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
block.setTypeIdAndData(_brushMaterial.getId(), _brushColor, false);
|
|
|
|
|
|
|
|
|
|
List<Block> around = UtilBlock.getSurrounding(block, false);
|
|
|
|
|
|
|
|
|
|
for (Block next : around)
|
|
|
|
|
{
|
|
|
|
|
fillRecursive(next, fillMaterial, fillData);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -643,11 +821,40 @@ public class Draw extends SoloGame
|
|
|
|
|
if (!_drawers.HasPlayer(player))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
Block block = player.getTargetBlock((HashSet<Byte>) null, 200);
|
|
|
|
|
if (block == null || block.getType() != Material.WOOL || _canvas.contains(block))
|
|
|
|
|
Block target = UtilPlayer.getTarget(player, UtilBlock.blockPassSet, 400);
|
|
|
|
|
|
|
|
|
|
if (target == null)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
Location loc = target.getLocation();
|
|
|
|
|
|
|
|
|
|
List<Block> possibleBlocks = UtilBlock.getInBoundingBox(WorldData.GetDataLocs("GREEN").get(0),
|
|
|
|
|
WorldData.GetDataLocs("GREEN").get(1));
|
|
|
|
|
|
|
|
|
|
Block block = player.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
|
|
|
|
|
|
|
|
|
|
if (block == null)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (Block other : possibleBlocks)
|
|
|
|
|
{
|
|
|
|
|
if (
|
|
|
|
|
other.getX() == block.getX()
|
|
|
|
|
&& other.getY() == block.getY()
|
|
|
|
|
&& other.getZ() == block.getZ()
|
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
block = other;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (block == null || !possibleBlocks.contains(block))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
_brushColor = block.getData();
|
|
|
|
|
_brushMaterial = block.getType();
|
|
|
|
|
|
|
|
|
|
player.playSound(player.getLocation(), Sound.ORB_PICKUP, 2f, 1f);
|
|
|
|
|
}
|
|
|
|
@ -656,11 +863,13 @@ public class Draw extends SoloGame
|
|
|
|
|
{
|
|
|
|
|
for (Block block : _canvas)
|
|
|
|
|
{
|
|
|
|
|
if (block.getTypeId() != 35 || block.getData() != 0)
|
|
|
|
|
block.setTypeIdAndData(35, (byte)0, false);
|
|
|
|
|
// if (block.getTypeId() != 35 || block.getData() != 0)
|
|
|
|
|
// block.setTypeIdAndData(35, (byte)0, false);
|
|
|
|
|
block.setTypeIdAndData(35, (byte) 0, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_brushColor = 15;
|
|
|
|
|
_brushMaterial = Material.WOOL;
|
|
|
|
|
|
|
|
|
|
if (_textBlocks != null)
|
|
|
|
|
{
|
|
|
|
@ -843,6 +1052,11 @@ public class Draw extends SoloGame
|
|
|
|
|
return _brushColor;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Material getBrushMaterial()
|
|
|
|
|
{
|
|
|
|
|
return _brushMaterial;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setLock(boolean b)
|
|
|
|
|
{
|
|
|
|
|
_lockDrawer = b;
|
|
|
|
|