Merge branch 'Dual_1.9' of https://github.com/Mineplex-LLC/Minecraft-PC into Dual_1.9
Conflicts: Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java
This commit is contained in:
commit
6d0ca4f813
@ -39,7 +39,7 @@ public class PlayerCache
|
||||
catch (Exception exception)
|
||||
{
|
||||
System.out.println("Error adding player info in PlayerCache : " + exception.getMessage());
|
||||
// exception.printStackTrace();
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@ -47,9 +47,8 @@ public class PlayerCache
|
||||
{
|
||||
try
|
||||
{
|
||||
System.out.println("Getting PlayerCache for " + uuid.toString());
|
||||
PlayerInfo playerInfo = _repository.getElement(uuid.toString());
|
||||
System.out.println("Got playerINfo: " + playerInfo);
|
||||
System.out.println("Got playerInfo: " + playerInfo);
|
||||
if (playerInfo != null)
|
||||
{
|
||||
System.out.println("account id: " + playerInfo.getAccountId());
|
||||
|
@ -171,6 +171,7 @@ public class UtilBlock
|
||||
blockPassSet.add((byte) Material.STAINED_GLASS_PANE.getId());
|
||||
blockPassSet.add((byte) Material.IRON_TRAPDOOR.getId());
|
||||
blockPassSet.add((byte) Material.DAYLIGHT_DETECTOR_INVERTED.getId());
|
||||
blockPassSet.add((byte) Material.BARRIER.getId());
|
||||
|
||||
blockPassSet.add((byte) Material.BIRCH_FENCE_GATE.getId());
|
||||
blockPassSet.add((byte) Material.JUNGLE_FENCE_GATE.getId());
|
||||
|
@ -1,9 +1,9 @@
|
||||
package mineplex.core.common.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -14,7 +14,7 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.event.CraftEventFactory;
|
||||
@ -24,6 +24,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryView;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.util.BlockIterator;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.minecraft.server.v1_8_R3.EntityPlayer;
|
||||
@ -760,4 +761,32 @@ public class UtilPlayer
|
||||
looking.multiply(distance);
|
||||
return player.getEyeLocation().clone().add(looking);
|
||||
}
|
||||
|
||||
public static Block getTarget(LivingEntity entity, HashSet<Byte> ignore, int maxDistance)
|
||||
{
|
||||
Iterator<Block> itr = new BlockIterator(entity, maxDistance);
|
||||
|
||||
while (itr.hasNext())
|
||||
{
|
||||
Block block = itr.next();
|
||||
int id = block.getTypeId();
|
||||
|
||||
if (ignore == null)
|
||||
{
|
||||
if (id != 0)
|
||||
{
|
||||
return block;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!ignore.contains((byte)id))
|
||||
{
|
||||
return block;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,9 @@ import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class UtilTextTop
|
||||
@ -38,7 +41,7 @@ public class UtilTextTop
|
||||
// Logic
|
||||
public static final int EntityDragonId = 777777;
|
||||
public static final int EntityWitherId = 777778;
|
||||
public static final UUID BossUUID = UUID.randomUUID();
|
||||
public static final UUID BossUUID = UUID.fromString("178f5cde-2fb0-3e73-8296-967ec7e46748");
|
||||
private static HashMap<String, BukkitRunnable> _lastUpdated = new HashMap<String, BukkitRunnable>();
|
||||
|
||||
// Display
|
||||
@ -151,6 +154,15 @@ public class UtilTextTop
|
||||
UtilPlayer.sendPacket(player, destroyWitherPacket);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent event)
|
||||
{
|
||||
if (UtilPlayer.is1_9(event.getPlayer()))
|
||||
{
|
||||
deleteOld(event.getPlayer());
|
||||
}
|
||||
}
|
||||
|
||||
public static PacketPlayOutSpawnEntityLiving getDragonPacket(String text, double healthPercent, Location loc)
|
||||
{
|
||||
PacketPlayOutSpawnEntityLiving mobPacket = new PacketPlayOutSpawnEntityLiving();
|
||||
|
@ -4,7 +4,7 @@ import net.minecraft.server.v1_8_R3.EntityBat;
|
||||
|
||||
import org.bukkit.entity.*;
|
||||
|
||||
public class DisguiseBat extends DisguiseAnimal
|
||||
public class DisguiseBat extends DisguiseCreature
|
||||
{
|
||||
public DisguiseBat(org.bukkit.entity.Entity entity)
|
||||
{
|
||||
|
@ -296,7 +296,7 @@ public class Hologram
|
||||
packet.uuid = UUID.randomUUID();
|
||||
|
||||
// Setup datawatcher for armor stand
|
||||
watcher.a(0, (byte) 32, EntityArmorStand.META_ENTITYDATA, (byte) 0);
|
||||
watcher.a(0, (byte) 32, EntityArmorStand.META_ENTITYDATA, (byte) 32);
|
||||
watcher.a(2, lineOfText, EntityArmorStand.META_CUSTOMNAME, lineOfText);
|
||||
watcher.a(3, (byte) 1, EntityArmorStand.META_CUSTOMNAME_VISIBLE, true);
|
||||
|
||||
|
@ -172,7 +172,7 @@ public class Recharge extends MiniPlugin
|
||||
//Recharging
|
||||
if (Get(player).containsKey(ability))
|
||||
{
|
||||
if (inform)
|
||||
if (inform && !Get(player).get(ability).DisplayForce && !Get(player).get(ability).AttachItem)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Recharge", "You cannot use " + F.skill(abilityFull) + " for " +
|
||||
F.time(UtilTime.convertString((Get(player).get(ability).GetRemaining()), 1, TimeUnit.FIT)) + "."));
|
||||
@ -217,7 +217,7 @@ public class Recharge extends MiniPlugin
|
||||
}
|
||||
else
|
||||
{
|
||||
if (inform)
|
||||
if (inform && !Get(player).get(ability).DisplayForce && !Get(player).get(ability).AttachItem)
|
||||
UtilPlayer.message(player, F.main("Recharge", "You cannot use " + F.skill(ability) + " for " +
|
||||
F.time(UtilTime.convertString((Get(player).get(ability).GetRemaining()), 1, TimeUnit.FIT)) + "."));
|
||||
|
||||
|
@ -40,6 +40,7 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
|
||||
@Override
|
||||
protected void buildPage()
|
||||
{
|
||||
/*
|
||||
addButton(2, new ItemBuilder(Material.RED_ROSE).setTitle(C.cYellowB + "Valentines Vendetta " + C.cGray + "Save Valentines!").addLore(new String[]
|
||||
{
|
||||
(_extraValue ? C.cAquaB : C.cWhiteB) + "LIMITED TIME GAME",
|
||||
@ -50,8 +51,9 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
|
||||
C.Reset + "",
|
||||
C.Reset + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("VV") + C.Reset + " other players!",
|
||||
}).setHideInfo(true).build(), new SelectVVButton(this));
|
||||
*/
|
||||
|
||||
addButton(4, new ItemBuilder(Material.QUARTZ_BLOCK).setTitle(C.cYellowB + "Speed Builders " + C.cGray + "Competitive Building").addLore(new String[]
|
||||
addButton(2, new ItemBuilder(Material.QUARTZ_BLOCK).setTitle(C.cYellowB + "Speed Builders " + C.cGray + "Competitive Building").addLore(new String[]
|
||||
{
|
||||
(_extraValue ? C.cAquaB : C.cWhiteB) + "NEW GAME",
|
||||
C.Reset + "",
|
||||
@ -62,6 +64,28 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
|
||||
C.Reset + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("SB") + C.Reset + " other players!",
|
||||
}).setHideInfo(true).build(), new SelectSBButton(this));
|
||||
|
||||
addButton(4, new ItemBuilder(Material.BOOK_AND_QUILL).setTitle(C.cYellowB + "Draw My Thing " + C.cGray + "Pictionary").addLore(new String[]
|
||||
{
|
||||
(_extraValue ? C.cAquaB : C.cWhiteB) + "NEW UPDATE",
|
||||
C.Reset + "",
|
||||
C.Reset + "Players take turns at drawing a random",
|
||||
C.Reset + "word. Whoever guesses it within the time",
|
||||
C.Reset + "limit gets some points!",
|
||||
C.Reset + "",
|
||||
C.Reset + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("DMT") + C.Reset + " other players!",
|
||||
}).setHideInfo(true).build(), new SelectDMTButton(this));
|
||||
|
||||
addButton(6, new ItemBuilder(Material.TNT).setTitle(C.cYellowB + "Dragon Escape " + C.cGray + "Fast Paced Parkour").addLore(new String[]
|
||||
{
|
||||
(_extraValue ? C.cAquaB : C.cWhiteB) + "FEATURED ARCADE GAME",
|
||||
C.Reset + "",
|
||||
C.Reset + "Douglas the Dragon is angry",
|
||||
C.Reset + "You better RUNNNNN!",
|
||||
C.Reset + "Last player alive wins",
|
||||
C.Reset + "",
|
||||
C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("DE") + C.Reset + " other players!"
|
||||
}).setHideInfo(true).build(), new SelectFEATButton(this, "Dragon Escape"));
|
||||
|
||||
/*
|
||||
addButton(6, new ItemBuilder(Material.IRON_SWORD).setTitle(C.cYellowB + "Gladiators" + C.cGray + " Bracketted Deathmatch").addLore(new String[]
|
||||
{
|
||||
@ -88,6 +112,7 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
|
||||
}).setHideInfo(true).build(), new SelectFEATButton(this, "Micro Battle"));
|
||||
*/
|
||||
|
||||
/*
|
||||
addButton(6, new ItemBuilder(Material.TNT).setTitle(C.cYellowB + "Bomb Lobbers " + C.cGray + "TNT Mayhem").addLore(new String[]
|
||||
{
|
||||
(_extraValue ? C.cAquaB : C.cWhiteB) + "FEATURED ARCADE GAME",
|
||||
@ -97,6 +122,7 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
|
||||
C.Reset + "",
|
||||
C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("BL") + C.Reset + " other players!"
|
||||
}).setHideInfo(true).build(), new SelectFEATButton(this, "Bomb Lobbers"));
|
||||
*/
|
||||
|
||||
addButton(9, new ItemBuilder(Material.IRON_PICKAXE).setTitle(C.cYellowB + "The Bridges " + C.cGray + "4 Team Survival").addLore(new String[]
|
||||
{
|
||||
@ -201,7 +227,7 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
|
||||
C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("BH") + C.Reset + " other players!",
|
||||
}).setHideInfo(true).build(), new SelectBHButton(this));
|
||||
|
||||
addButton(27, new ItemBuilder(Material.TNT).setTitle(C.cYellowB + "MineStrike " + C.cGray + "Team Survival").addLore(new String[]
|
||||
addButton(28, new ItemBuilder(Material.TNT).setTitle(C.cYellowB + "MineStrike " + C.cGray + "Team Survival").addLore(new String[]
|
||||
{
|
||||
C.Reset + "",
|
||||
C.Reset + "One team must defend two bomb sites from",
|
||||
@ -211,21 +237,11 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
|
||||
C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("MS") + C.Reset + " other players!",
|
||||
}).setHideInfo(true).build(), new SelectMSButton(this));
|
||||
|
||||
addButton(29, new ItemBuilder(Material.BOOK_AND_QUILL).setTitle(C.cYellowB + "Draw My Thing " + C.cGray + "Pictionary").addLore(new String[]
|
||||
{
|
||||
C.Reset + "",
|
||||
C.Reset + "Players take turns at drawing a random",
|
||||
C.Reset + "word. Whoever guesses it within the time",
|
||||
C.Reset + "limit gets some points!",
|
||||
C.Reset + "",
|
||||
C.Reset + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("DMT") + C.Reset + " other players!",
|
||||
}).setHideInfo(true).build(), new SelectDMTButton(this));
|
||||
addButton(30, _superSmashCycle.get(_ssmIndex), new SelectSSMButton(this));
|
||||
|
||||
addButton(31, _superSmashCycle.get(_ssmIndex), new SelectSSMButton(this));
|
||||
addButton(32, _minigameCycle.get(_minigameIndex), new SelectMINButton(this));
|
||||
|
||||
addButton(33, _minigameCycle.get(_minigameIndex), new SelectMINButton(this));
|
||||
|
||||
addButton(35, new ItemBuilder(Material.WOOD).setTitle(C.cYellowB + "Master Builders " + C.cGray + "Creative Build").setLore(new String[]
|
||||
addButton(34, new ItemBuilder(Material.WOOD).setTitle(C.cYellowB + "Master Builders " + C.cGray + "Creative Build").setLore(new String[]
|
||||
{
|
||||
C.Reset + "",
|
||||
C.Reset + "Players are given a Build Theme and ",
|
||||
|
@ -22,26 +22,7 @@ import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
import mineplex.mapparser.command.AdminCommand;
|
||||
import mineplex.mapparser.command.AuthorCommand;
|
||||
import mineplex.mapparser.command.BaseCommand;
|
||||
import mineplex.mapparser.command.CopyCommand;
|
||||
import mineplex.mapparser.command.CopySchematicsCommand;
|
||||
import mineplex.mapparser.command.CreateCommand;
|
||||
import mineplex.mapparser.command.DeleteCommand;
|
||||
import mineplex.mapparser.command.GameTypeCommand;
|
||||
import mineplex.mapparser.command.HubCommand;
|
||||
import mineplex.mapparser.command.ListCommand;
|
||||
import mineplex.mapparser.command.MapCommand;
|
||||
import mineplex.mapparser.command.NameCommand;
|
||||
import mineplex.mapparser.command.ParseCommand200;
|
||||
import mineplex.mapparser.command.ParseCommand400;
|
||||
import mineplex.mapparser.command.ParseCommand600;
|
||||
import mineplex.mapparser.command.RenameCommand;
|
||||
import mineplex.mapparser.command.SaveCommand;
|
||||
import mineplex.mapparser.command.SetSpawnCommand;
|
||||
import mineplex.mapparser.command.SpawnCommand;
|
||||
import mineplex.mapparser.command.WorldsCommand;
|
||||
import mineplex.mapparser.command.*;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -120,6 +101,9 @@ public class MapParser extends JavaPlugin implements Listener
|
||||
_commands.add(new CopyCommand(this));
|
||||
_commands.add(new SpawnCommand(this));
|
||||
_commands.add(new SetSpawnCommand(this));
|
||||
_commands.add(new ItemNameCommand(this));
|
||||
_commands.add(new AddLoreCommand(this));
|
||||
_commands.add(new ClearLoreCommand(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -0,0 +1,58 @@
|
||||
package mineplex.mapparser.command;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.mapparser.MapParser;
|
||||
|
||||
public class AddLoreCommand extends BaseCommand
|
||||
{
|
||||
public AddLoreCommand(MapParser plugin)
|
||||
{
|
||||
super(plugin, "addlore", "al");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(Player player, String alias, String[] args)
|
||||
{
|
||||
if (args == null || args.length < 1)
|
||||
{
|
||||
message(player, "Invalid Usage: " + F.elem("/" + alias + " <text>"));
|
||||
return true;
|
||||
}
|
||||
|
||||
ItemStack is = player.getItemInHand();
|
||||
|
||||
if (is == null || is.getType() == Material.AIR)
|
||||
{
|
||||
message(player, "You must be holding an item in your hand.");
|
||||
return true;
|
||||
}
|
||||
|
||||
ItemMeta im = is.getItemMeta();
|
||||
|
||||
String line = "";
|
||||
for (int i = 0; i < args.length; i++)
|
||||
{
|
||||
line += args[i] + " ";
|
||||
}
|
||||
line = line.replaceAll("&", "§").trim();
|
||||
|
||||
List<String> lore = (im.getLore() != null ? new ArrayList<>(im.getLore()) : new ArrayList<>());
|
||||
lore.add(line);
|
||||
im.setLore(lore);
|
||||
is.setItemMeta(im);
|
||||
|
||||
player.setItemInHand(is);
|
||||
player.updateInventory();
|
||||
message(player, "Added lore: " + line);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package mineplex.mapparser.command;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import mineplex.mapparser.MapParser;
|
||||
|
||||
public class ClearLoreCommand extends BaseCommand
|
||||
{
|
||||
public ClearLoreCommand(MapParser plugin)
|
||||
{
|
||||
super(plugin, "clearlore", "cl");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(Player player, String alias, String[] args)
|
||||
{
|
||||
ItemStack is = player.getItemInHand();
|
||||
|
||||
if (is == null || is.getType() == Material.AIR)
|
||||
{
|
||||
message(player, "You must be holding an item in your hand.");
|
||||
return true;
|
||||
}
|
||||
|
||||
ItemMeta im = is.getItemMeta();
|
||||
im.setLore(new ArrayList<>());
|
||||
is.setItemMeta(im);
|
||||
|
||||
player.setItemInHand(is);
|
||||
player.updateInventory();
|
||||
message(player, "Cleared lore on item!");
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package mineplex.mapparser.command;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.mapparser.MapParser;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
public class ItemNameCommand extends BaseCommand
|
||||
{
|
||||
public ItemNameCommand(MapParser plugin)
|
||||
{
|
||||
super(plugin, "itemname", "in");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(Player player, String alias, String[] args)
|
||||
{
|
||||
if (args == null || args.length < 1)
|
||||
{
|
||||
message(player, "Invalid Usage: " + F.elem("/" + alias + " <name>"));
|
||||
return true;
|
||||
}
|
||||
|
||||
ItemStack is = player.getItemInHand();
|
||||
|
||||
if (is == null || is.getType() == Material.AIR)
|
||||
{
|
||||
message(player, "You must be holding an item in your hand.");
|
||||
return true;
|
||||
}
|
||||
|
||||
ItemMeta im = is.getItemMeta();
|
||||
|
||||
String name = "";
|
||||
for (int i = 0; i < args.length; i++)
|
||||
{
|
||||
name += args[i] + " ";
|
||||
}
|
||||
name = name.replaceAll("&", "§").trim();
|
||||
|
||||
im.setDisplayName(name);
|
||||
is.setItemMeta(im);
|
||||
|
||||
player.setItemInHand(is);
|
||||
player.updateInventory();
|
||||
message(player, "Set name: " + name);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -89,7 +89,7 @@ public enum GameType
|
||||
DragonRiders(DragonRiders.class, GameDisplay.DragonRiders),
|
||||
Dragons(Dragons.class, GameDisplay.Dragons),
|
||||
DragonsTeams(DragonsTeams.class, GameDisplay.DragonsTeams),
|
||||
Draw(Draw.class, GameDisplay.Draw),
|
||||
Draw(Draw.class, GameDisplay.Draw, "http://chivebox.com/mineplex/ResDrawMyThing.zip", true),
|
||||
ElytraRings(ElytraRings.class, GameDisplay.ElytraRings),
|
||||
Evolution(Evolution.class, GameDisplay.Evolution),
|
||||
Gravity(Gravity.class, GameDisplay.Gravity),
|
||||
|
@ -0,0 +1,25 @@
|
||||
package nautilus.game.arcade.game.games.draw;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
public class BlockInfo
|
||||
{
|
||||
private Material _type;
|
||||
private byte _data;
|
||||
|
||||
public BlockInfo(Material type, byte data)
|
||||
{
|
||||
_type = type;
|
||||
_data = data;
|
||||
}
|
||||
|
||||
public Material getType()
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
|
||||
public byte getData()
|
||||
{
|
||||
return _data;
|
||||
}
|
||||
}
|
@ -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;
|
||||
@ -88,22 +91,23 @@ public class Draw extends SoloGame
|
||||
private String[] _holidayWords;
|
||||
private boolean _useHolidayWords = false;
|
||||
private HashSet<String> _usedWords = new HashSet<String>();
|
||||
|
||||
|
||||
public Draw(ArcadeManager manager)
|
||||
{
|
||||
super(manager, GameType.Draw,
|
||||
|
||||
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",
|
||||
});
|
||||
|
||||
@ -111,11 +115,73 @@ public class Draw extends SoloGame
|
||||
this.Damage = false;
|
||||
this.HungerSet = 20;
|
||||
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
|
||||
@ -281,21 +384,20 @@ public class Draw extends SoloGame
|
||||
drawer.setAllowFlight(true);
|
||||
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"));
|
||||
|
||||
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.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"));
|
||||
|
||||
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().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"));
|
||||
|
||||
Announce(C.cGold + C.Bold + "Round " + (_roundCount+1) + ": " + C.cYellow + C.Bold + drawer.getName() + " is drawing!");
|
||||
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!");
|
||||
}
|
||||
}
|
||||
|
||||
@ -477,7 +579,66 @@ public class Draw extends SoloGame
|
||||
for (Tool tool : _tools)
|
||||
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)
|
||||
{
|
||||
@ -491,23 +652,24 @@ public class Draw extends SoloGame
|
||||
{
|
||||
if (!UtilGear.isMat(player.getItemInHand(), Material.WOOD_SWORD) && !UtilGear.isMat(player.getItemInHand(), Material.IRON_SWORD))
|
||||
continue;
|
||||
|
||||
|
||||
if (!player.isBlocking())
|
||||
{
|
||||
_brushPrevious = null;
|
||||
continue;
|
||||
}
|
||||
|
||||
Block block = player.getTargetBlock((HashSet<Byte>) null, 200);
|
||||
if (block == null || !_canvas.contains(block))
|
||||
|
||||
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
|
||||
if (UtilGear.isMat(player.getItemInHand(), Material.IRON_SWORD))
|
||||
{
|
||||
@ -515,25 +677,27 @@ public class Draw extends SoloGame
|
||||
{
|
||||
if (!_canvas.contains(other))
|
||||
continue;
|
||||
|
||||
|
||||
block.setType(_brushMaterial);
|
||||
other.setData(_brushColor);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Join Dots
|
||||
if (_brushPrevious != null)
|
||||
{
|
||||
{
|
||||
while (UtilMath.offset(_brushPrevious, block.getLocation().add(0.5, 0.5, 0.5)) > 0.5)
|
||||
{
|
||||
{
|
||||
_brushPrevious.add(UtilAlg.getTrajectory(_brushPrevious, block.getLocation().add(0.5, 0.5, 0.5)).multiply(0.5));
|
||||
|
||||
Block fixBlock = _brushPrevious.getBlock();
|
||||
|
||||
|
||||
if (!_canvas.contains(fixBlock))
|
||||
continue;
|
||||
|
||||
|
||||
fixBlock.setType(_brushMaterial);
|
||||
fixBlock.setData(_brushColor);
|
||||
|
||||
|
||||
//Thick Brush
|
||||
if (UtilGear.isMat(player.getItemInHand(), Material.IRON_SWORD))
|
||||
{
|
||||
@ -541,18 +705,19 @@ public class Draw extends SoloGame
|
||||
{
|
||||
if (!_canvas.contains(other))
|
||||
continue;
|
||||
|
||||
|
||||
other.setType(_brushMaterial);
|
||||
other.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);
|
||||
}
|
||||
}
|
||||
@ -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();
|
||||
|
||||
if (!UtilGear.isMat(player.getItemInHand(), Material.BUCKET))
|
||||
Player p = e.getPlayer();
|
||||
|
||||
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;
|
||||
|
@ -0,0 +1,38 @@
|
||||
package nautilus.game.arcade.game.games.draw.kits;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
/**
|
||||
* Created by William (WilliamTiger).
|
||||
* 23/12/15
|
||||
*/
|
||||
public class KitArtist extends Kit
|
||||
{
|
||||
public KitArtist(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Artist", KitAvailability.Free,
|
||||
new String[]
|
||||
{
|
||||
"The world is but a canvas to your imagination."
|
||||
},
|
||||
new Perk[]
|
||||
{
|
||||
|
||||
},
|
||||
EntityType.ZOMBIE, new ItemStack(Material.IRON_SWORD));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -1,13 +1,17 @@
|
||||
package nautilus.game.arcade.game.games.draw.tools;
|
||||
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import nautilus.game.arcade.game.games.draw.BlockInfo;
|
||||
import nautilus.game.arcade.game.games.draw.Draw;
|
||||
|
||||
import org.bukkit.Material;
|
||||
@ -25,8 +29,8 @@ public abstract class Tool
|
||||
|
||||
protected Material _material;
|
||||
|
||||
protected HashMap<Block, Byte> _past = new HashMap<Block, Byte>();
|
||||
protected HashMap<Block, Byte> _new = new HashMap<Block, Byte>();
|
||||
protected HashMap<Block, BlockInfo> _past = new HashMap<Block, BlockInfo>();
|
||||
protected HashMap<Block, BlockInfo> _new = new HashMap<Block, BlockInfo>();
|
||||
|
||||
public Tool(Draw host, Material mat)
|
||||
{
|
||||
@ -36,9 +40,13 @@ public abstract class Tool
|
||||
|
||||
public void start(PlayerInteractEvent event)
|
||||
{
|
||||
if (_start != null)
|
||||
return;
|
||||
|
||||
if (!UtilEvent.isAction(event, ActionType.R))
|
||||
return;
|
||||
Block block = event.getPlayer().getTargetBlock((HashSet<Byte>) null, 60);
|
||||
|
||||
Block block = UtilPlayer.getTarget(event.getPlayer(), UtilBlock.blockPassSet, 400);
|
||||
|
||||
if (block == null)
|
||||
return;
|
||||
@ -68,10 +76,10 @@ public abstract class Tool
|
||||
return;
|
||||
}
|
||||
|
||||
_new = new HashMap<Block, Byte>();
|
||||
_new = new HashMap<Block, BlockInfo>();
|
||||
|
||||
//Calculate New
|
||||
Block end = _drawer.getTargetBlock((HashSet<Byte>) null, 64);
|
||||
Block end = UtilPlayer.getTarget(_drawer, UtilBlock.blockPassSet, 400);
|
||||
if (end != null && Host.getCanvas().contains(end))
|
||||
{
|
||||
customDraw(end);
|
||||
@ -81,7 +89,10 @@ public abstract class Tool
|
||||
for (Block block : _past.keySet())
|
||||
{
|
||||
if (!_new.containsKey(block))
|
||||
block.setData(_past.get(block));
|
||||
{
|
||||
block.setType(_past.get(block).getType());
|
||||
block.setData(_past.get(block).getData());
|
||||
}
|
||||
}
|
||||
|
||||
_past = _new;
|
||||
|
@ -3,6 +3,7 @@ package nautilus.game.arcade.game.games.draw.tools;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import nautilus.game.arcade.game.games.draw.BlockInfo;
|
||||
import nautilus.game.arcade.game.games.draw.Draw;
|
||||
|
||||
import org.bukkit.Location;
|
||||
@ -48,10 +49,15 @@ public class ToolCircle extends Tool
|
||||
return;
|
||||
|
||||
byte color = block.getData();
|
||||
Material type = block.getType();
|
||||
if (_past.containsKey(block))
|
||||
color = _past.get(block);
|
||||
{
|
||||
type = _past.get(block).getType();
|
||||
color = _past.get(block).getData();
|
||||
}
|
||||
|
||||
_new.put(block, color);
|
||||
_new.put(block, new BlockInfo(type, color));
|
||||
block.setType(Host.getBrushMaterial());
|
||||
block.setData(Host.getColor());
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.draw.tools;
|
||||
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import nautilus.game.arcade.game.games.draw.BlockInfo;
|
||||
import nautilus.game.arcade.game.games.draw.Draw;
|
||||
|
||||
import org.bukkit.Location;
|
||||
@ -32,10 +33,15 @@ public class ToolLine extends Tool
|
||||
continue;
|
||||
|
||||
byte color = lineBlock.getData();
|
||||
Material type = lineBlock.getType();
|
||||
if (_past.containsKey(lineBlock))
|
||||
color = _past.get(lineBlock);
|
||||
{
|
||||
type = _past.get(lineBlock).getType();
|
||||
color = _past.get(lineBlock).getData();
|
||||
}
|
||||
|
||||
_new.put(lineBlock, color);
|
||||
_new.put(lineBlock, new BlockInfo(type, color));
|
||||
lineBlock.setType(Host.getBrushMaterial());
|
||||
lineBlock.setData(Host.getColor());
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package nautilus.game.arcade.game.games.draw.tools;
|
||||
|
||||
import nautilus.game.arcade.game.games.draw.BlockInfo;
|
||||
import nautilus.game.arcade.game.games.draw.Draw;
|
||||
|
||||
import org.bukkit.Location;
|
||||
@ -71,12 +72,17 @@ public class ToolSquare extends Tool
|
||||
|
||||
if (!Host.getCanvas().contains(block))
|
||||
return;
|
||||
|
||||
|
||||
Material type = block.getType();
|
||||
byte color = block.getData();
|
||||
if (_past.containsKey(block))
|
||||
color = _past.get(block);
|
||||
{
|
||||
type = _past.get(block).getType();
|
||||
color = _past.get(block).getData();
|
||||
}
|
||||
|
||||
_new.put(block, color);
|
||||
_new.put(block, new BlockInfo(type, color));
|
||||
block.setType(Host.getBrushMaterial());
|
||||
block.setData(Host.getColor());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user