Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex
This commit is contained in:
commit
e01d30b920
@ -0,0 +1,132 @@
|
||||
package mineplex.core.common.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
|
||||
public class NautArrayList<Elem>
|
||||
{
|
||||
private ArrayList<Elem> _wrappedArrayList = new ArrayList<Elem>();
|
||||
|
||||
public boolean add(Elem elem)
|
||||
{
|
||||
return _wrappedArrayList.add(elem);
|
||||
}
|
||||
|
||||
public void add(int index, Elem elem)
|
||||
{
|
||||
_wrappedArrayList.add(index, elem);
|
||||
}
|
||||
|
||||
public boolean addAll(Collection<? extends Elem> elements)
|
||||
{
|
||||
return _wrappedArrayList.addAll(elements);
|
||||
}
|
||||
|
||||
public boolean addAll(int index, Collection<? extends Elem> elements)
|
||||
{
|
||||
return _wrappedArrayList.addAll(index, elements);
|
||||
}
|
||||
|
||||
public void clear()
|
||||
{
|
||||
_wrappedArrayList.clear();
|
||||
}
|
||||
|
||||
public boolean contains(Elem elem)
|
||||
{
|
||||
return _wrappedArrayList.contains(elem);
|
||||
}
|
||||
|
||||
public boolean containsAll(Collection<? extends Elem> elements)
|
||||
{
|
||||
return _wrappedArrayList.containsAll(elements);
|
||||
}
|
||||
|
||||
public Elem get(int index)
|
||||
{
|
||||
return _wrappedArrayList.get(index);
|
||||
}
|
||||
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
return _wrappedArrayList.equals(o);
|
||||
}
|
||||
|
||||
public int hashCode()
|
||||
{
|
||||
return _wrappedArrayList.hashCode();
|
||||
}
|
||||
|
||||
public int indexOf(Elem elem)
|
||||
{
|
||||
return _wrappedArrayList.indexOf(elem);
|
||||
}
|
||||
|
||||
public boolean isEmpty()
|
||||
{
|
||||
return _wrappedArrayList.isEmpty();
|
||||
}
|
||||
|
||||
public Iterator<Elem> iterator()
|
||||
{
|
||||
return _wrappedArrayList.iterator();
|
||||
}
|
||||
|
||||
public int lastIndexOf(Elem elem)
|
||||
{
|
||||
return _wrappedArrayList.lastIndexOf(elem);
|
||||
}
|
||||
|
||||
public ListIterator<Elem> listIterator()
|
||||
{
|
||||
return _wrappedArrayList.listIterator();
|
||||
}
|
||||
|
||||
public ListIterator<Elem> listIterator(int index)
|
||||
{
|
||||
return _wrappedArrayList.listIterator(index);
|
||||
}
|
||||
|
||||
public Elem remove(int index)
|
||||
{
|
||||
return _wrappedArrayList.remove(index);
|
||||
}
|
||||
|
||||
public boolean remove(Elem element)
|
||||
{
|
||||
return _wrappedArrayList.remove(element);
|
||||
}
|
||||
|
||||
public boolean removeAll(Collection<? extends Elem> elements)
|
||||
{
|
||||
return _wrappedArrayList.removeAll(elements);
|
||||
}
|
||||
|
||||
public boolean retainAll(Collection<? extends Elem> elements)
|
||||
{
|
||||
return _wrappedArrayList.retainAll(elements);
|
||||
}
|
||||
|
||||
public Elem set(int index, Elem element)
|
||||
{
|
||||
return _wrappedArrayList.set(index, element);
|
||||
}
|
||||
|
||||
public int size()
|
||||
{
|
||||
return _wrappedArrayList.size();
|
||||
}
|
||||
|
||||
public List<Elem> subList(int begin, int end)
|
||||
{
|
||||
return _wrappedArrayList.subList(begin, end);
|
||||
}
|
||||
|
||||
public Object[] toArray()
|
||||
{
|
||||
return _wrappedArrayList.toArray();
|
||||
}
|
||||
}
|
@ -6,18 +6,35 @@ import java.util.HashSet;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.SkullType;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Banner;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.BrewingStand;
|
||||
import org.bukkit.block.Chest;
|
||||
import org.bukkit.block.Dispenser;
|
||||
import org.bukkit.block.Dropper;
|
||||
import org.bukkit.block.Furnace;
|
||||
import org.bukkit.block.Hopper;
|
||||
import org.bukkit.block.Jukebox;
|
||||
import org.bukkit.block.Skull;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.BannerMeta;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
import org.bukkit.material.Bed;
|
||||
|
||||
import net.minecraft.server.v1_8_R3.BlockPosition;
|
||||
import net.minecraft.server.v1_8_R3.Blocks;
|
||||
import net.minecraft.server.v1_8_R3.EnumDirection;
|
||||
import net.minecraft.server.v1_8_R3.Item;
|
||||
import net.minecraft.server.v1_8_R3.MathHelper;
|
||||
import net.minecraft.server.v1_8_R3.MinecraftKey;
|
||||
import net.minecraft.server.v1_8_R3.NBTTagCompound;
|
||||
import net.minecraft.server.v1_8_R3.TileEntityFlowerPot;
|
||||
import net.minecraft.server.v1_8_R3.WorldServer;
|
||||
|
||||
public class UtilBlock
|
||||
@ -844,9 +861,11 @@ public class UtilBlock
|
||||
return blocks;
|
||||
}
|
||||
|
||||
public static ItemStack blockToInventoryItemStack(Block block)
|
||||
public static ArrayList<ItemStack> blockToInventoryItemStacks(Block block)
|
||||
{
|
||||
ItemStack itemStack = new ItemStack(block.getType(), 1, block.getData());
|
||||
ArrayList<ItemStack> itemStacks = new ArrayList<ItemStack>();
|
||||
itemStacks.add(itemStack);
|
||||
|
||||
switch (block.getType())
|
||||
{
|
||||
@ -877,6 +896,17 @@ public class UtilBlock
|
||||
break;
|
||||
case DISPENSER:
|
||||
itemStack.setDurability((short) 0);
|
||||
|
||||
Dispenser dispenser = (Dispenser) block.getState();
|
||||
|
||||
for (ItemStack is : dispenser.getInventory().getContents())
|
||||
{
|
||||
if (is == null)
|
||||
continue;
|
||||
|
||||
itemStacks.add(is);
|
||||
}
|
||||
|
||||
break;
|
||||
case BED_BLOCK:
|
||||
itemStack.setType(Material.BED);
|
||||
@ -921,6 +951,17 @@ public class UtilBlock
|
||||
break;
|
||||
case CHEST:
|
||||
itemStack.setDurability((short) 0);
|
||||
|
||||
Chest chest = (Chest) block.getState();
|
||||
|
||||
for (ItemStack is : chest.getBlockInventory().getContents())
|
||||
{
|
||||
if (is == null)
|
||||
continue;
|
||||
|
||||
itemStacks.add(is);
|
||||
}
|
||||
|
||||
break;
|
||||
case REDSTONE_WIRE:
|
||||
itemStack.setType(Material.REDSTONE);
|
||||
@ -936,10 +977,32 @@ public class UtilBlock
|
||||
break;
|
||||
case FURNACE:
|
||||
itemStack.setDurability((short) 0);
|
||||
|
||||
Furnace furnace = (Furnace) block.getState();
|
||||
|
||||
for (ItemStack is : furnace.getInventory().getContents())
|
||||
{
|
||||
if (is == null)
|
||||
continue;
|
||||
|
||||
itemStacks.add(is);
|
||||
}
|
||||
|
||||
break;
|
||||
case BURNING_FURNACE:
|
||||
itemStack.setType(Material.FURNACE);
|
||||
itemStack.setDurability((short) 0);
|
||||
|
||||
Furnace burningFurnace = (Furnace) block.getState();
|
||||
|
||||
for (ItemStack is : burningFurnace.getInventory().getContents())
|
||||
{
|
||||
if (is == null)
|
||||
continue;
|
||||
|
||||
itemStacks.add(is);
|
||||
}
|
||||
|
||||
break;
|
||||
case SIGN_POST:
|
||||
itemStack.setType(Material.SIGN);
|
||||
@ -1001,6 +1064,12 @@ public class UtilBlock
|
||||
break;
|
||||
case JUKEBOX:
|
||||
itemStack.setDurability((short) 0);
|
||||
|
||||
Jukebox jukebox = (Jukebox) block.getState();
|
||||
|
||||
if (jukebox.getPlaying() != Material.AIR)
|
||||
itemStacks.add(new ItemStack(jukebox.getPlaying()));
|
||||
|
||||
break;
|
||||
case PORTAL:
|
||||
itemStack.setType(Material.AIR);
|
||||
@ -1057,10 +1126,25 @@ public class UtilBlock
|
||||
case BREWING_STAND:
|
||||
itemStack.setType(Material.BREWING_STAND_ITEM);
|
||||
itemStack.setDurability((short) 0);
|
||||
|
||||
BrewingStand brewingStand = (BrewingStand) block.getState();
|
||||
|
||||
for (ItemStack is : brewingStand.getInventory().getContents())
|
||||
{
|
||||
if (is == null)
|
||||
continue;
|
||||
|
||||
itemStacks.add(is);
|
||||
}
|
||||
|
||||
break;
|
||||
case CAULDRON:
|
||||
itemStack.setType(Material.CAULDRON_ITEM);
|
||||
itemStack.setDurability((short) 0);
|
||||
|
||||
if (block.getData() != 0)
|
||||
itemStacks.add(new ItemStack(Material.WATER_BUCKET));
|
||||
|
||||
break;
|
||||
case ENDER_PORTAL:
|
||||
itemStack.setType(Material.AIR);
|
||||
@ -1068,6 +1152,10 @@ public class UtilBlock
|
||||
break;
|
||||
case ENDER_PORTAL_FRAME:
|
||||
itemStack.setDurability((short) 0);
|
||||
|
||||
if ((block.getData() & 0x4) != 0)
|
||||
itemStacks.add(new ItemStack(Material.EYE_OF_ENDER));
|
||||
|
||||
break;
|
||||
case REDSTONE_LAMP_ON:
|
||||
itemStack.setType(Material.REDSTONE_LAMP_OFF);
|
||||
@ -1111,6 +1199,27 @@ public class UtilBlock
|
||||
case FLOWER_POT:
|
||||
itemStack.setType(Material.FLOWER_POT_ITEM);
|
||||
itemStack.setDurability((short) 0);
|
||||
|
||||
//The FlowerPot class is outdated and doesn't work so we do some NBT checking
|
||||
TileEntityFlowerPot tefp = (TileEntityFlowerPot) ((CraftWorld) block.getWorld()).getHandle().getTileEntity(new BlockPosition(block.getX(), block.getY(), block.getZ()));
|
||||
|
||||
NBTTagCompound c = new NBTTagCompound();
|
||||
tefp.b(c);
|
||||
|
||||
ItemStack blockInPot = new ItemStack(Material.AIR);
|
||||
|
||||
if (c.hasKey("Item"))
|
||||
{
|
||||
MinecraftKey mk = new MinecraftKey(c.getString("Item"));
|
||||
blockInPot = CraftItemStack.asNewCraftStack(Item.REGISTRY.get(mk));
|
||||
}
|
||||
|
||||
if (c.hasKey("Data"))
|
||||
blockInPot.setDurability(c.getShort("Data"));
|
||||
|
||||
if (blockInPot.getType() != Material.AIR)
|
||||
itemStacks.add(blockInPot);
|
||||
|
||||
break;
|
||||
case CARROT:
|
||||
itemStack.setType(Material.CARROT_ITEM);
|
||||
@ -1125,9 +1234,31 @@ public class UtilBlock
|
||||
break;
|
||||
case SKULL:
|
||||
itemStack.setType(Material.SKULL_ITEM);
|
||||
|
||||
Skull skull = (Skull) block.getState();
|
||||
itemStack.setDurability((short) skull.getSkullType().ordinal());
|
||||
|
||||
if (skull.getSkullType() == SkullType.PLAYER && skull.hasOwner())
|
||||
{
|
||||
SkullMeta skullMeta = (SkullMeta) itemStack.getItemMeta();
|
||||
skullMeta.setOwner(skull.getOwner());
|
||||
itemStack.setItemMeta(skullMeta);
|
||||
}
|
||||
|
||||
break;
|
||||
case TRAPPED_CHEST:
|
||||
itemStack.setDurability((short) 0);
|
||||
|
||||
Chest trappedChest = (Chest) block.getState();
|
||||
|
||||
for (ItemStack is : trappedChest.getBlockInventory().getContents())
|
||||
{
|
||||
if (is == null)
|
||||
continue;
|
||||
|
||||
itemStacks.add(is);
|
||||
}
|
||||
|
||||
break;
|
||||
case GOLD_PLATE:
|
||||
itemStack.setDurability((short) 0);
|
||||
@ -1148,6 +1279,17 @@ public class UtilBlock
|
||||
break;
|
||||
case HOPPER:
|
||||
itemStack.setDurability((short) 0);
|
||||
|
||||
Hopper hopper = (Hopper) block.getState();
|
||||
|
||||
for (ItemStack is : hopper.getInventory().getContents())
|
||||
{
|
||||
if (is == null)
|
||||
continue;
|
||||
|
||||
itemStacks.add(is);
|
||||
}
|
||||
|
||||
break;
|
||||
case QUARTZ_STAIRS:
|
||||
itemStack.setDurability((short) 0);
|
||||
@ -1157,6 +1299,17 @@ public class UtilBlock
|
||||
break;
|
||||
case DROPPER:
|
||||
itemStack.setDurability((short) 0);
|
||||
|
||||
Dropper dropper = (Dropper) block.getState();
|
||||
|
||||
for (ItemStack is : dropper.getInventory().getContents())
|
||||
{
|
||||
if (is == null)
|
||||
continue;
|
||||
|
||||
itemStacks.add(is);
|
||||
}
|
||||
|
||||
break;
|
||||
case LEAVES_2:
|
||||
itemStack.setDurability((short) (itemStack.getDurability() % 4));
|
||||
@ -1178,11 +1331,27 @@ public class UtilBlock
|
||||
break;
|
||||
case STANDING_BANNER:
|
||||
itemStack.setType(Material.BANNER);
|
||||
itemStack.setDurability((short) 0);
|
||||
|
||||
Banner banner = (Banner) block.getState();
|
||||
itemStack.setDurability(banner.getBaseColor().getDyeData());
|
||||
|
||||
BannerMeta bannerMeta = (BannerMeta) itemStack.getItemMeta();
|
||||
bannerMeta.setBaseColor(bannerMeta.getBaseColor());
|
||||
bannerMeta.setPatterns(banner.getPatterns());
|
||||
itemStack.setItemMeta(bannerMeta);
|
||||
|
||||
break;
|
||||
case WALL_BANNER:
|
||||
itemStack.setType(Material.BANNER);
|
||||
itemStack.setDurability((short) 0);
|
||||
|
||||
Banner wallBanner = (Banner) block.getState();
|
||||
itemStack.setDurability(wallBanner.getBaseColor().getDyeData());
|
||||
|
||||
BannerMeta wallBannerMeta = (BannerMeta) itemStack.getItemMeta();
|
||||
wallBannerMeta.setBaseColor(wallBannerMeta.getBaseColor());
|
||||
wallBannerMeta.setPatterns(wallBanner.getPatterns());
|
||||
itemStack.setItemMeta(wallBannerMeta);
|
||||
|
||||
break;
|
||||
case DAYLIGHT_DETECTOR_INVERTED:
|
||||
itemStack.setType(Material.DAYLIGHT_DETECTOR);
|
||||
@ -1235,6 +1404,6 @@ public class UtilBlock
|
||||
break;
|
||||
}
|
||||
|
||||
return itemStack;
|
||||
return itemStacks;
|
||||
}
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.Creature;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
@ -803,6 +804,20 @@ public class UtilEnt
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void setAI(LivingEntity entity, boolean ai)
|
||||
{
|
||||
if(entity instanceof ArmorStand)
|
||||
{
|
||||
((ArmorStand)entity).setGravity(ai);
|
||||
return;
|
||||
}
|
||||
CraftEntity e = (CraftEntity)entity;
|
||||
if(e.getHandle() instanceof EntityInsentient)
|
||||
{
|
||||
((EntityInsentient)e.getHandle()).k(!ai);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean inWater(LivingEntity ent)
|
||||
{
|
||||
|
@ -25,8 +25,8 @@ public class UtilItem
|
||||
|
||||
_materials.put(Material.AIR, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.BOUNDLESS));
|
||||
_materials.put(Material.STONE, EnumSet.of(ItemCategory.BLOCK));
|
||||
_materials.put(Material.DIRT, EnumSet.of(ItemCategory.BLOCK));
|
||||
_materials.put(Material.GRASS, EnumSet.of(ItemCategory.BLOCK));
|
||||
_materials.put(Material.DIRT, EnumSet.of(ItemCategory.BLOCK));
|
||||
_materials.put(Material.COBBLESTONE, EnumSet.of(ItemCategory.BLOCK, ItemCategory.STONE));
|
||||
_materials.put(Material.WOOD, EnumSet.of(ItemCategory.BLOCK, ItemCategory.WOOD));
|
||||
_materials.put(Material.SAPLING, EnumSet.of(ItemCategory.BLOCK));
|
||||
@ -196,8 +196,56 @@ public class UtilItem
|
||||
_materials.put(Material.PACKED_ICE, EnumSet.of(ItemCategory.BLOCK, ItemCategory.MOVEMENT_MODIFYING));
|
||||
_materials.put(Material.DOUBLE_PLANT, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.BOUNDLESS));
|
||||
|
||||
_materials.put(Material.SLIME_BLOCK, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT));
|
||||
_materials.put(Material.BARRIER, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT));
|
||||
_materials.put(Material.IRON_TRAPDOOR, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT));
|
||||
_materials.put(Material.PRISMARINE, EnumSet.of(ItemCategory.BLOCK));
|
||||
_materials.put(Material.SEA_LANTERN, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.LIGHT_EMITTING));
|
||||
_materials.put(Material.STANDING_BANNER, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT));
|
||||
_materials.put(Material.WALL_BANNER, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT));
|
||||
_materials.put(Material.DAYLIGHT_DETECTOR_INVERTED, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT));
|
||||
_materials.put(Material.RED_SANDSTONE, EnumSet.of(ItemCategory.BLOCK, ItemCategory.STONE));
|
||||
_materials.put(Material.RED_SANDSTONE_STAIRS, EnumSet.of(ItemCategory.BLOCK, ItemCategory.STONE, ItemCategory.TRANSLUCENT));
|
||||
_materials.put(Material.DOUBLE_STONE_SLAB2, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.STONE));
|
||||
_materials.put(Material.STONE_SLAB2, EnumSet.of(ItemCategory.BLOCK, ItemCategory.STONE, ItemCategory.TRANSLUCENT));
|
||||
_materials.put(Material.SPRUCE_FENCE_GATE, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.WOOD));
|
||||
_materials.put(Material.BIRCH_FENCE_GATE, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.WOOD));
|
||||
_materials.put(Material.JUNGLE_FENCE_GATE, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.WOOD));
|
||||
_materials.put(Material.DARK_OAK_FENCE_GATE, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.WOOD));
|
||||
_materials.put(Material.ACACIA_FENCE_GATE, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.WOOD));
|
||||
_materials.put(Material.SPRUCE_FENCE, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.WOOD));
|
||||
_materials.put(Material.BIRCH_FENCE, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.WOOD));
|
||||
_materials.put(Material.JUNGLE_FENCE, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.WOOD));
|
||||
_materials.put(Material.SPRUCE_DOOR, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.WOOD));
|
||||
_materials.put(Material.BIRCH_DOOR, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.WOOD));
|
||||
_materials.put(Material.JUNGLE_DOOR, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.WOOD));
|
||||
_materials.put(Material.ACACIA_DOOR, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.WOOD));
|
||||
_materials.put(Material.DARK_OAK_DOOR, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.WOOD));
|
||||
|
||||
|
||||
_materials.put(Material.DARK_OAK_FENCE, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.WOOD));
|
||||
_materials.put(Material.ACACIA_FENCE, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.WOOD));
|
||||
_materials.put(Material.DARK_OAK_DOOR_ITEM, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.WOOD));
|
||||
|
||||
// Items
|
||||
|
||||
_materials.put(Material.PRISMARINE_SHARD, EnumSet.of(ItemCategory.ITEM));
|
||||
_materials.put(Material.PRISMARINE_CRYSTALS, EnumSet.of(ItemCategory.ITEM));
|
||||
_materials.put(Material.RABBIT, EnumSet.of(ItemCategory.ITEM, ItemCategory.RAW_FOOD, ItemCategory.EDIBLE));
|
||||
_materials.put(Material.COOKED_RABBIT, EnumSet.of(ItemCategory.ITEM, ItemCategory.EDIBLE));
|
||||
_materials.put(Material.RABBIT_STEW, EnumSet.of(ItemCategory.ITEM, ItemCategory.EDIBLE));
|
||||
_materials.put(Material.RABBIT_FOOT, EnumSet.of(ItemCategory.ITEM));
|
||||
_materials.put(Material.RABBIT_HIDE, EnumSet.of(ItemCategory.ITEM));
|
||||
_materials.put(Material.ARMOR_STAND, EnumSet.of(ItemCategory.ITEM));
|
||||
_materials.put(Material.MUTTON, EnumSet.of(ItemCategory.ITEM, ItemCategory.RAW_FOOD, ItemCategory.EDIBLE));
|
||||
_materials.put(Material.COOKED_MUTTON, EnumSet.of(ItemCategory.ITEM, ItemCategory.EDIBLE));
|
||||
_materials.put(Material.BANNER, EnumSet.of(ItemCategory.ITEM));
|
||||
_materials.put(Material.SPRUCE_DOOR_ITEM, EnumSet.of(ItemCategory.ITEM, ItemCategory.WOOD));
|
||||
_materials.put(Material.BIRCH_DOOR_ITEM, EnumSet.of(ItemCategory.ITEM, ItemCategory.WOOD));
|
||||
_materials.put(Material.JUNGLE_DOOR_ITEM, EnumSet.of(ItemCategory.ITEM, ItemCategory.WOOD));
|
||||
_materials.put(Material.ACACIA_DOOR_ITEM, EnumSet.of(ItemCategory.ITEM, ItemCategory.WOOD));
|
||||
|
||||
|
||||
_materials.put(Material.IRON_SPADE, EnumSet.of(ItemCategory.ITEM, ItemCategory.IRON, ItemCategory.TOOL, ItemCategory.SHOVEL));
|
||||
_materials.put(Material.IRON_PICKAXE, EnumSet.of(ItemCategory.ITEM, ItemCategory.IRON, ItemCategory.TOOL, ItemCategory.PICKAXE));
|
||||
_materials.put(Material.IRON_AXE, EnumSet.of(ItemCategory.AXE, ItemCategory.ITEM, ItemCategory.IRON, ItemCategory.WEAPON, ItemCategory.TOOL));
|
||||
@ -1063,4 +1111,9 @@ public class UtilItem
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isIndexed(Material material)
|
||||
{
|
||||
return _materials.containsKey(material);
|
||||
}
|
||||
}
|
||||
|
@ -43,6 +43,14 @@ public class MountPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
if (slot == 26)
|
||||
slot = 28;
|
||||
}
|
||||
|
||||
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
|
||||
{
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void addMount(Mount<?> mount, int slot)
|
||||
@ -76,12 +84,5 @@ public class MountPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
setItem(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), (mount.GetCost(CurrencyType.Coins) < 0 ? "" : "Purchase ") + mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
|
||||
}
|
||||
|
||||
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
|
||||
{
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
package mineplex.core.mount;
|
||||
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
@ -13,12 +13,14 @@ import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class DragonData
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
|
||||
public class DragonData extends MountData
|
||||
{
|
||||
DragonMount Host;
|
||||
|
||||
public EnderDragon Dragon;
|
||||
public Player Rider;
|
||||
|
||||
public Entity TargetEntity = null;
|
||||
|
||||
@ -31,9 +33,8 @@ public class DragonData
|
||||
|
||||
public DragonData(DragonMount dragonMount, Player rider)
|
||||
{
|
||||
Host = dragonMount;
|
||||
|
||||
Rider = rider;
|
||||
super(rider);
|
||||
Host = dragonMount;
|
||||
|
||||
Velocity = rider.getLocation().getDirection().setY(0).normalize();
|
||||
Pitch = UtilAlg.GetPitch(rider.getLocation().getDirection());
|
||||
@ -51,25 +52,34 @@ public class DragonData
|
||||
Chicken = rider.getWorld().spawn(rider.getLocation(), Chicken.class);
|
||||
Dragon.setPassenger(Chicken);
|
||||
|
||||
Chicken.setPassenger(Rider);
|
||||
Chicken.setPassenger(getOwner());
|
||||
|
||||
Bukkit.getServer().getScheduler().runTaskLater(Host.Manager.getPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
Chicken.setPassenger(Rider);
|
||||
Chicken.setPassenger(getOwner());
|
||||
}
|
||||
}, 10L);
|
||||
}
|
||||
|
||||
public void Move()
|
||||
{
|
||||
Rider.eject();
|
||||
getOwner().eject();
|
||||
((CraftEnderDragon)Dragon).getHandle().setTargetBlock(GetTarget().getBlockX(), GetTarget().getBlockY(), GetTarget().getBlockZ());
|
||||
}
|
||||
|
||||
public Location GetTarget()
|
||||
{
|
||||
return Rider.getLocation().add(Rider.getLocation().getDirection().multiply(40));
|
||||
return getOwner().getLocation().add(getOwner().getLocation().getDirection().multiply(40));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Entity> getEntityParts()
|
||||
{
|
||||
List<Entity> list = new ArrayList<Entity>();
|
||||
list.add(Dragon);
|
||||
list.add(Chicken);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.disguise.disguises.DisguiseChicken;
|
||||
|
||||
public class DragonMount extends Mount<DragonData>
|
||||
{
|
||||
|
@ -22,7 +22,7 @@ import org.bukkit.entity.Horse.Style;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class HorseMount extends Mount<Horse>
|
||||
public class HorseMount extends Mount<SingleEntityMountData<Horse>>
|
||||
{
|
||||
protected Color _color;
|
||||
protected Style _style;
|
||||
@ -53,7 +53,7 @@ public class HorseMount extends Mount<Horse>
|
||||
while (activeIterator.hasNext())
|
||||
{
|
||||
Player player = activeIterator.next();
|
||||
Horse horse = _active.get(player);
|
||||
Horse horse = _active.get(player).getEntity();
|
||||
|
||||
//Invalid (dead)
|
||||
if (!horse.isValid())
|
||||
@ -113,15 +113,16 @@ public class HorseMount extends Mount<Horse>
|
||||
UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + "."));
|
||||
|
||||
//Store
|
||||
_active.put(player, horse);
|
||||
SingleEntityMountData<Horse> mount = new SingleEntityMountData<Horse>(player, horse);
|
||||
_active.put(player, mount);
|
||||
}
|
||||
|
||||
public void Disable(Player player)
|
||||
{
|
||||
Horse horse = _active.remove(player);
|
||||
if (horse != null)
|
||||
SingleEntityMountData<Horse> mount = _active.remove(player);
|
||||
if (mount != null)
|
||||
{
|
||||
horse.remove();
|
||||
mount.remove();
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main("Mount", "You despawned " + F.elem(GetName()) + "."));
|
||||
|
@ -5,6 +5,7 @@ import java.util.HashSet;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
@ -18,7 +19,7 @@ import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.mount.event.MountActivateEvent;
|
||||
import mineplex.core.shop.item.SalesPackageBase;
|
||||
|
||||
public abstract class Mount<T> extends SalesPackageBase implements Listener
|
||||
public abstract class Mount<T extends MountData> extends SalesPackageBase implements Listener
|
||||
{
|
||||
protected HashSet<Player> _owners = new HashSet<Player>();
|
||||
protected HashMap<Player, T> _active = new HashMap<Player, T>();
|
||||
@ -51,8 +52,8 @@ public abstract class Mount<T> extends SalesPackageBase implements Listener
|
||||
return;
|
||||
}
|
||||
|
||||
Manager.setActive(player, this);
|
||||
EnableCustom(player);
|
||||
Manager.setActive(player, this);
|
||||
}
|
||||
|
||||
public abstract void EnableCustom(Player player);
|
||||
@ -97,4 +98,13 @@ public abstract class Mount<T> extends SalesPackageBase implements Listener
|
||||
{
|
||||
return _owners.contains(player);
|
||||
}
|
||||
|
||||
public T getMountData(Entity ent)
|
||||
{
|
||||
for(T data : GetActive().values())
|
||||
{
|
||||
if(data.isPartOfMount(ent)) return data;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
43
Plugins/Mineplex.Core/src/mineplex/core/mount/MountData.java
Normal file
43
Plugins/Mineplex.Core/src/mineplex/core/mount/MountData.java
Normal file
@ -0,0 +1,43 @@
|
||||
package mineplex.core.mount;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public abstract class MountData
|
||||
{
|
||||
|
||||
protected Player _owner;
|
||||
|
||||
public MountData(Player player)
|
||||
{
|
||||
_owner = player;
|
||||
}
|
||||
|
||||
public boolean isPartOfMount(Entity ent)
|
||||
{
|
||||
return getEntityParts().contains(ent);
|
||||
}
|
||||
|
||||
public abstract List<Entity> getEntityParts();
|
||||
|
||||
public boolean ownsMount(Player p)
|
||||
{
|
||||
return _owner.equals(p);
|
||||
}
|
||||
|
||||
public Player getOwner()
|
||||
{
|
||||
return _owner;
|
||||
}
|
||||
|
||||
public void remove()
|
||||
{
|
||||
for(Entity e : getEntityParts())
|
||||
{
|
||||
e.remove();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -3,6 +3,17 @@ package mineplex.core.mount;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.ItemSpawnEvent;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.blockrestore.BlockRestore;
|
||||
@ -22,17 +33,6 @@ import mineplex.core.mount.types.MountTitan;
|
||||
import mineplex.core.mount.types.MountUndead;
|
||||
import mineplex.core.mount.types.MountZombie;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Horse;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.ItemSpawnEvent;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class MountManager extends MiniPlugin
|
||||
{
|
||||
private CoreClientManager _clientManager;
|
||||
@ -84,32 +84,30 @@ public class MountManager extends MiniPlugin
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void HorseInteract(PlayerInteractEntityEvent event)
|
||||
public void mountInteract(PlayerInteractAtEntityEvent event)
|
||||
{
|
||||
MountData mount = getMountData(event.getRightClicked());
|
||||
|
||||
if(mount == null) return;
|
||||
|
||||
if(mount.ownsMount(event.getPlayer())) return;
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void mountInteract(PlayerInteractEntityEvent event)
|
||||
{
|
||||
if (!(event.getRightClicked() instanceof Horse))
|
||||
return;
|
||||
MountData mount = getMountData(event.getRightClicked());
|
||||
|
||||
boolean found = false;
|
||||
for (Mount mount : _playerActiveMountMap.values())
|
||||
{
|
||||
if (mount.GetActive().containsValue(event.getRightClicked()))
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(mount == null) return;
|
||||
|
||||
if (!found)
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
Horse horse = (Horse)event.getRightClicked();
|
||||
if(mount.ownsMount(event.getPlayer())) return;
|
||||
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Mount", "This is not your Mount!"));
|
||||
event.setCancelled(true);
|
||||
|
||||
if (horse.getOwner() == null || !horse.getOwner().equals(player))
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Mount", "This is not your Mount!"));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -178,16 +176,28 @@ public class MountManager extends MiniPlugin
|
||||
{
|
||||
return _disguiseManager;
|
||||
}
|
||||
|
||||
public boolean isMount(Entity ent)
|
||||
|
||||
public MountData getMountData(Entity ent)
|
||||
{
|
||||
for (Mount<?> mount : _playerActiveMountMap.values())
|
||||
{
|
||||
if (mount.GetActive().values().contains(ent))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
MountData data = mount.getMountData(ent);
|
||||
if(data != null) return data;
|
||||
}
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
public Mount<?> getMount(Entity ent)
|
||||
{
|
||||
for (Mount<?> mount : _playerActiveMountMap.values())
|
||||
{
|
||||
if(mount.getMountData(ent) != null) return mount;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isMount(Entity ent)
|
||||
{
|
||||
return getMount(ent) != null;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,35 @@
|
||||
package mineplex.core.mount;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class SingleEntityMountData<T extends Entity> extends MountData
|
||||
{
|
||||
|
||||
protected T Entity;
|
||||
|
||||
public SingleEntityMountData(Player player, T ent)
|
||||
{
|
||||
super(player);
|
||||
Entity = ent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Entity> getEntityParts()
|
||||
{
|
||||
List<Entity> list = new ArrayList<Entity>();
|
||||
list.add(Entity);
|
||||
return list;
|
||||
}
|
||||
|
||||
public T getEntity()
|
||||
{
|
||||
return Entity;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package mineplex.core.mount.types;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
@ -18,23 +19,12 @@ import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.mount.Mount;
|
||||
import mineplex.core.mount.MountManager;
|
||||
import mineplex.core.mount.SingleEntityMountData;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftMinecart;
|
||||
import org.bukkit.entity.Minecart;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.vehicle.VehicleDamageEvent;
|
||||
|
||||
public class MountCart extends Mount<Minecart>
|
||||
public class MountCart extends Mount<SingleEntityMountData<Minecart>>
|
||||
{
|
||||
public MountCart(MountManager manager)
|
||||
{
|
||||
@ -56,7 +46,7 @@ public class MountCart extends Mount<Minecart>
|
||||
//Remove other mounts
|
||||
Manager.DeregisterAll(player);
|
||||
|
||||
Minecart mount = player.getWorld().spawn(player.getLocation().add(0, 2, 0), Minecart.class);
|
||||
SingleEntityMountData<Minecart> mount = new SingleEntityMountData<Minecart>(player, player.getWorld().spawn(player.getLocation().add(0, 2, 0), Minecart.class));
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + "."));
|
||||
@ -67,7 +57,7 @@ public class MountCart extends Mount<Minecart>
|
||||
|
||||
public void Disable(Player player)
|
||||
{
|
||||
Minecart mount = _active.remove(player);
|
||||
SingleEntityMountData<Minecart> mount = _active.remove(player);
|
||||
if (mount != null)
|
||||
{
|
||||
mount.remove();
|
||||
@ -85,14 +75,11 @@ public class MountCart extends Mount<Minecart>
|
||||
if (event.getRightClicked() == null)
|
||||
return;
|
||||
|
||||
if (!GetActive().containsKey(event.getPlayer()))
|
||||
return;
|
||||
SingleEntityMountData<Minecart> mount = GetActive().get(event.getPlayer());
|
||||
|
||||
if (!GetActive().get(event.getPlayer()).equals(event.getRightClicked()))
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Mount", "This is not your Mount!"));
|
||||
return;
|
||||
}
|
||||
if(mount == null) return;
|
||||
|
||||
if(!mount.ownsMount(event.getPlayer())) return;
|
||||
|
||||
event.getPlayer().leaveVehicle();
|
||||
event.getPlayer().eject();
|
||||
@ -117,8 +104,10 @@ public class MountCart extends Mount<Minecart>
|
||||
return;
|
||||
|
||||
//Bounce
|
||||
for (Minecart cart : GetActive().values())
|
||||
for (SingleEntityMountData<Minecart> cartData : GetActive().values())
|
||||
{
|
||||
Minecart cart = cartData.getEntity();
|
||||
|
||||
if (cart.getPassenger() == null)
|
||||
continue;
|
||||
|
||||
@ -137,8 +126,10 @@ public class MountCart extends Mount<Minecart>
|
||||
}
|
||||
|
||||
//Collide
|
||||
for (Minecart cart : GetActive().values())
|
||||
for (SingleEntityMountData<Minecart> cartData : GetActive().values())
|
||||
{
|
||||
Minecart cart = cartData.getEntity();
|
||||
|
||||
if (cart.getPassenger() == null)
|
||||
continue;
|
||||
|
||||
@ -150,8 +141,9 @@ public class MountCart extends Mount<Minecart>
|
||||
if (!Recharge.Instance.usable(player, GetName() + " Collide"))
|
||||
continue;
|
||||
|
||||
for (Minecart other : GetActive().values())
|
||||
for (SingleEntityMountData<Minecart> otherData : GetActive().values())
|
||||
{
|
||||
Minecart other = otherData.getEntity();
|
||||
if (other.equals(cart))
|
||||
continue;
|
||||
|
||||
|
@ -9,11 +9,11 @@ import org.bukkit.event.EventHandler;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.mount.HorseMount;
|
||||
import mineplex.core.mount.MountManager;
|
||||
import mineplex.core.mount.SingleEntityMountData;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
@ -38,10 +38,12 @@ public class MountFrost extends HorseMount
|
||||
public void Trail(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() == UpdateType.TICK)
|
||||
for (Horse horse : GetActive().values())
|
||||
UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, horse.getLocation().add(0, 1, 0),
|
||||
0.25f, 0.25f, 0.25f, 0.1f, 4,
|
||||
ViewDist.NORMAL, UtilServer.getPlayers());
|
||||
for (SingleEntityMountData<Horse> horseData : GetActive().values())
|
||||
{
|
||||
Horse horse = horseData.getEntity();
|
||||
UtilParticle.PlayParticleToAll(ParticleType.SNOW_SHOVEL, horse.getLocation().add(0, 1, 0),
|
||||
0.25f, 0.25f, 0.25f, 0.1f, 4, ViewDist.NORMAL);
|
||||
}
|
||||
}
|
||||
|
||||
// @EventHandler
|
||||
|
@ -5,19 +5,19 @@ import org.bukkit.DyeColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Horse;
|
||||
import org.bukkit.entity.Horse.Color;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Horse.Style;
|
||||
import org.bukkit.entity.Horse.Variant;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.disguise.disguises.DisguiseBase;
|
||||
import mineplex.core.disguise.disguises.DisguisePig;
|
||||
import mineplex.core.disguise.disguises.DisguiseSheep;
|
||||
import mineplex.core.mount.HorseMount;
|
||||
import mineplex.core.mount.MountManager;
|
||||
import mineplex.core.mount.SingleEntityMountData;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
@ -45,6 +45,7 @@ public class MountSheep extends HorseMount
|
||||
Manager.DeregisterAll(player);
|
||||
|
||||
Horse horse = player.getWorld().spawn(player.getLocation(), Horse.class);
|
||||
SingleEntityMountData<Horse> mount = new SingleEntityMountData<Horse>(player, horse);
|
||||
|
||||
horse.setOwner(player);
|
||||
horse.setMaxDomestication(1);
|
||||
@ -59,7 +60,7 @@ public class MountSheep extends HorseMount
|
||||
UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + "."));
|
||||
|
||||
//Store
|
||||
_active.put(player, horse);
|
||||
_active.put(player, mount);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -68,8 +69,10 @@ public class MountSheep extends HorseMount
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
for (Horse horse : GetActive().values())
|
||||
for (SingleEntityMountData<Horse> horseData : GetActive().values())
|
||||
{
|
||||
Horse horse = horseData.getEntity();
|
||||
|
||||
DisguiseBase base = Manager.getDisguiseManager().getDisguise(horse);
|
||||
if (base == null || !(base instanceof DisguiseSheep))
|
||||
continue;
|
||||
|
@ -9,6 +9,7 @@ import org.bukkit.entity.Slime;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
@ -18,11 +19,12 @@ import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.mount.Mount;
|
||||
import mineplex.core.mount.MountManager;
|
||||
import mineplex.core.mount.SingleEntityMountData;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
public class MountSlime extends Mount<Slime>
|
||||
public class MountSlime extends Mount<SingleEntityMountData<Slime>>
|
||||
{
|
||||
public MountSlime(MountManager manager)
|
||||
{
|
||||
@ -44,10 +46,10 @@ public class MountSlime extends Mount<Slime>
|
||||
//Remove other mounts
|
||||
Manager.DeregisterAll(player);
|
||||
|
||||
Slime mount = player.getWorld().spawn(player.getLocation(), Slime.class);
|
||||
mount.setSize(2);
|
||||
SingleEntityMountData<Slime> mount = new SingleEntityMountData<Slime>(player, player.getWorld().spawn(player.getLocation(), Slime.class));
|
||||
mount.getEntity().setSize(2);
|
||||
|
||||
mount.setCustomName(player.getName() + "'s " + GetName());
|
||||
mount.getEntity().setCustomName(player.getName() + "'s " + GetName());
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + "."));
|
||||
@ -58,7 +60,7 @@ public class MountSlime extends Mount<Slime>
|
||||
|
||||
public void Disable(Player player)
|
||||
{
|
||||
Slime mount = _active.remove(player);
|
||||
SingleEntityMountData<Slime> mount = _active.remove(player);
|
||||
if (mount != null)
|
||||
{
|
||||
mount.remove();
|
||||
@ -79,11 +81,8 @@ public class MountSlime extends Mount<Slime>
|
||||
if (!GetActive().containsKey(event.getPlayer()))
|
||||
return;
|
||||
|
||||
if (!GetActive().get(event.getPlayer()).equals(event.getRightClicked()))
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Mount", "This is not your Mount!"));
|
||||
if(!GetActive().get(event.getPlayer()).ownsMount(event.getPlayer()))
|
||||
return;
|
||||
}
|
||||
|
||||
event.getPlayer().leaveVehicle();
|
||||
event.getPlayer().eject();
|
||||
@ -108,10 +107,15 @@ public class MountSlime extends Mount<Slime>
|
||||
return;
|
||||
|
||||
//Bounce
|
||||
for (Slime slime : GetActive().values())
|
||||
for (SingleEntityMountData<Slime> slimeData : GetActive().values())
|
||||
{
|
||||
Slime slime = slimeData.getEntity();
|
||||
|
||||
if (slime.getPassenger() == null)
|
||||
{
|
||||
UtilEnt.setFakeHead(slime, false);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!UtilEnt.isGrounded(slime))
|
||||
continue;
|
||||
@ -124,14 +128,19 @@ public class MountSlime extends Mount<Slime>
|
||||
if (!Recharge.Instance.use(player, GetName(), 200, false, false))
|
||||
continue;
|
||||
|
||||
UtilAction.velocity(slime, slime.getPassenger().getLocation().getDirection(), 1, true, 0, 0.4, 1, true);
|
||||
Vector dir = slime.getPassenger().getLocation().getDirection();
|
||||
|
||||
UtilAction.velocity(slime, dir, 1, true, 0, 0.4, 1, true);
|
||||
|
||||
UtilEnt.CreatureForceLook(slime, 0, UtilAlg.GetYaw(dir));
|
||||
|
||||
slime.getWorld().playSound(slime.getLocation(), Sound.SLIME_WALK, 1f, 0.75f);
|
||||
}
|
||||
|
||||
//Collide
|
||||
for (Slime slime : GetActive().values())
|
||||
for (SingleEntityMountData<Slime> slimeData : GetActive().values())
|
||||
{
|
||||
Slime slime = slimeData.getEntity();
|
||||
if (slime.getPassenger() == null)
|
||||
continue;
|
||||
|
||||
@ -143,8 +152,10 @@ public class MountSlime extends Mount<Slime>
|
||||
if (!Recharge.Instance.usable(player, GetName() + " Collide"))
|
||||
continue;
|
||||
|
||||
for (Slime other : GetActive().values())
|
||||
for (SingleEntityMountData<Slime> otherSlime : GetActive().values())
|
||||
{
|
||||
Slime other = otherSlime.getEntity();
|
||||
|
||||
if (other.equals(slime))
|
||||
continue;
|
||||
|
||||
|
@ -4,21 +4,6 @@ import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.disguise.disguises.DisguiseSpider;
|
||||
import mineplex.core.mount.HorseMount;
|
||||
import mineplex.core.mount.MountManager;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import net.minecraft.server.v1_8_R3.EntityLiving;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
@ -32,6 +17,22 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.disguise.disguises.DisguiseSpider;
|
||||
import mineplex.core.mount.HorseMount;
|
||||
import mineplex.core.mount.MountManager;
|
||||
import mineplex.core.mount.SingleEntityMountData;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import net.minecraft.server.v1_8_R3.EntityLiving;
|
||||
|
||||
public class MountSpider extends HorseMount
|
||||
{
|
||||
/**
|
||||
@ -87,7 +88,8 @@ public class MountSpider extends HorseMount
|
||||
UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + "."));
|
||||
|
||||
//Store
|
||||
_active.put(player, horse);
|
||||
SingleEntityMountData<Horse> mount = new SingleEntityMountData<Horse>(player, horse);
|
||||
_active.put(player, mount);
|
||||
|
||||
DisguiseSpider spider = new DisguiseSpider(horse);
|
||||
spider.setName(player.getName() + "'s Spider Mount");
|
||||
@ -105,7 +107,7 @@ public class MountSpider extends HorseMount
|
||||
ArrayList<Horse> used = new ArrayList<Horse>();
|
||||
for (Player player : GetActive().keySet())
|
||||
{
|
||||
Horse horse = GetActive().get(player);
|
||||
Horse horse = GetActive().get(player).getEntity();
|
||||
|
||||
used.add(horse);
|
||||
|
||||
@ -126,21 +128,24 @@ public class MountSpider extends HorseMount
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
for (Entry<Player, Horse> horse : GetActive().entrySet())
|
||||
for (Entry<Player, SingleEntityMountData<Horse>> entry : GetActive().entrySet())
|
||||
{
|
||||
if (horse.getValue().getPassenger() != horse.getKey())
|
||||
Player player = entry.getKey();
|
||||
Horse horse = entry.getValue().getEntity();
|
||||
|
||||
if (horse.getPassenger() != player)
|
||||
continue;
|
||||
|
||||
//If player is looking up
|
||||
if (horse.getKey().getEyeLocation().getPitch() > -45)
|
||||
if (player.getEyeLocation().getPitch() > -45)
|
||||
continue;
|
||||
|
||||
for (Block block : UtilBlock.getSurrounding(horse.getValue().getLocation().getBlock(), true))
|
||||
for (Block block : UtilBlock.getSurrounding(horse.getLocation().getBlock(), true))
|
||||
{
|
||||
if (UtilBlock.airFoliage(block) || block.isLiquid())
|
||||
continue;
|
||||
|
||||
UtilAction.velocity(horse.getValue(), new Vector(horse.getValue().getVelocity().getX(), 0.2, horse.getValue().getVelocity().getZ()));
|
||||
UtilAction.velocity(horse, new Vector(horse.getVelocity().getX(), 0.2, horse.getVelocity().getZ()));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -191,7 +196,7 @@ public class MountSpider extends HorseMount
|
||||
|
||||
for (Player player : GetActive().keySet())
|
||||
{
|
||||
final Horse horse = GetActive().get(player);
|
||||
final Horse horse = GetActive().get(player).getEntity();
|
||||
|
||||
if (horse.getPassenger() != player)
|
||||
continue;
|
||||
|
@ -1,27 +1,19 @@
|
||||
package mineplex.core.mount.types;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.Slime;
|
||||
import org.bukkit.entity.Horse.Color;
|
||||
import org.bukkit.entity.Horse.Style;
|
||||
import org.bukkit.entity.Horse.Variant;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.mount.HorseMount;
|
||||
import mineplex.core.mount.Mount;
|
||||
import mineplex.core.mount.MountManager;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
@ -85,11 +77,20 @@ public class MountTitan extends Mount<MountTitanData>
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void interactMount(PlayerInteractEntityEvent event)
|
||||
public void interactMount(PlayerInteractAtEntityEvent event)
|
||||
{
|
||||
if (event.getRightClicked() == null)
|
||||
return;
|
||||
|
||||
for(MountTitanData mount : GetActive().values())
|
||||
{
|
||||
if(mount.isPartOfMount(event.getRightClicked()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
if(event.getRightClicked().getType() == EntityType.ARMOR_STAND) return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!GetActive().containsKey(event.getPlayer()))
|
||||
return;
|
||||
|
||||
@ -123,7 +124,7 @@ public class MountTitan extends Mount<MountTitanData>
|
||||
{
|
||||
for (MountTitanData data : _active.values())
|
||||
{
|
||||
if (data.ownsEntity(event.getEntity()))
|
||||
if (data.isPartOfMount(event.getEntity()))
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
@ -3,11 +3,7 @@
|
||||
package mineplex.core.mount.types;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -20,9 +16,13 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.EulerAngle;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class MountTitanData
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.mount.MountData;
|
||||
|
||||
public class MountTitanData extends MountData
|
||||
{
|
||||
private String _owner;
|
||||
|
||||
private Slime _head;
|
||||
|
||||
@ -30,7 +30,7 @@ public class MountTitanData
|
||||
|
||||
public MountTitanData(Player player, String name)
|
||||
{
|
||||
_owner = player.getName();
|
||||
super(player);
|
||||
|
||||
Location loc = player.getLocation();
|
||||
loc.setPitch(0);
|
||||
@ -72,7 +72,11 @@ public class MountTitanData
|
||||
{
|
||||
//Head
|
||||
if (_head.getPassenger() != null)
|
||||
_head.setVelocity(_head.getPassenger().getLocation().getDirection().multiply(0.8).add(new Vector(0,0.2,0)));
|
||||
{
|
||||
Vector dir = _head.getPassenger().getLocation().getDirection().multiply(0.8).add(new Vector(0,0.2,0));
|
||||
_head.setVelocity(dir);
|
||||
UtilEnt.CreatureLook(_head, dir);
|
||||
}
|
||||
|
||||
Location infront = _head.getLocation().add(0, -1.5, 0);
|
||||
|
||||
@ -133,14 +137,13 @@ public class MountTitanData
|
||||
for (ArmorStand stand : _nodes)
|
||||
stand.remove();
|
||||
}
|
||||
|
||||
public boolean ownsMount(Player player)
|
||||
{
|
||||
return _owner.equals(player.getName());
|
||||
}
|
||||
|
||||
public boolean ownsEntity(Entity ent)
|
||||
@Override
|
||||
public List<Entity> getEntityParts()
|
||||
{
|
||||
return (_head.equals(ent) || _nodes.contains(ent));
|
||||
List<Entity> entities = new ArrayList<Entity>();
|
||||
entities.addAll(_nodes);
|
||||
entities.add(_head);
|
||||
return entities;
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,5 @@
|
||||
package mineplex.core.mount.types;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.mount.HorseMount;
|
||||
import mineplex.core.mount.MountManager;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Horse;
|
||||
import org.bukkit.entity.Horse.Color;
|
||||
@ -17,6 +7,16 @@ import org.bukkit.entity.Horse.Style;
|
||||
import org.bukkit.entity.Horse.Variant;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.mount.HorseMount;
|
||||
import mineplex.core.mount.MountManager;
|
||||
import mineplex.core.mount.SingleEntityMountData;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
public class MountUndead extends HorseMount
|
||||
{
|
||||
public MountUndead(MountManager manager)
|
||||
@ -37,16 +37,20 @@ public class MountUndead extends HorseMount
|
||||
public void Trail(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() == UpdateType.TICK)
|
||||
for (Horse horse : GetActive().values())
|
||||
UtilParticle.PlayParticle(ParticleType.FLAME, horse.getLocation().add(0, 1, 0),
|
||||
0.25f, 0.25f, 0.25f, 0, 2,
|
||||
ViewDist.NORMAL, UtilServer.getPlayers());
|
||||
for (SingleEntityMountData<Horse> horseData : GetActive().values())
|
||||
{
|
||||
Horse horse = horseData.getEntity();
|
||||
UtilParticle.PlayParticleToAll(ParticleType.FLAME, horse.getLocation().add(0, 1, 0),
|
||||
0.25f, 0.25f, 0.25f, 0, 2,ViewDist.NORMAL);
|
||||
}
|
||||
|
||||
if (event.getType() == UpdateType.FAST)
|
||||
for (Horse horse : GetActive().values())
|
||||
UtilParticle.PlayParticle(ParticleType.LAVA, horse.getLocation().add(0, 1, 0),
|
||||
0.25f, 0.25f, 0.25f, 0, 1,
|
||||
ViewDist.NORMAL, UtilServer.getPlayers());
|
||||
for (SingleEntityMountData<Horse> horseData : GetActive().values())
|
||||
{
|
||||
Horse horse = horseData.getEntity();
|
||||
UtilParticle.PlayParticleToAll(ParticleType.LAVA, horse.getLocation().add(0, 1, 0),
|
||||
0.25f, 0.25f, 0.25f, 0, 1, ViewDist.NORMAL);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ public class PlayerScoreboard
|
||||
System.out.println("Scoreboard Error: Line Team Not Found!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//Set Line Prefix/Suffix
|
||||
team.setPrefix(newLine.substring(0, Math.min(newLine.length(), 16)));
|
||||
team.setSuffix(ChatColor.getLastColors(team.getPrefix()) + newLine.substring(team.getPrefix().length(), Math.min(newLine.length(), 32)));
|
||||
|
@ -459,6 +459,27 @@ public class ClansGame extends MiniPlugin
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void doorPlaced(BlockPlaceEvent event)
|
||||
{
|
||||
if (event.getBlockPlaced().getType().equals(Material.ACACIA_DOOR)
|
||||
|| event.getBlockPlaced().getType().equals(Material.WOODEN_DOOR)
|
||||
|| event.getBlockPlaced().getType().equals(Material.BIRCH_DOOR)
|
||||
|| event.getBlockPlaced().getType().equals(Material.DARK_OAK_DOOR)
|
||||
|| event.getBlockPlaced().getType().equals(Material.JUNGLE_DOOR)
|
||||
|| event.getBlockPlaced().getType().equals(Material.SPRUCE_DOOR)
|
||||
|| event.getBlockPlaced().getType().equals(Material.WOOD_DOOR)
|
||||
|| event.getBlockPlaced().getType().equals(Material.IRON_DOOR_BLOCK))
|
||||
{
|
||||
ClanTerritory claim = _clans.getClanUtility().getClaim(event.getBlockPlaced().getLocation());
|
||||
|
||||
if (claim != null && (claim.Owner.equals("Spawn") || claim.Owner.equals("Shops")))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void Piston(BlockPistonExtendEvent event)
|
||||
{
|
||||
@ -494,16 +515,6 @@ public class ClansGame extends MiniPlugin
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void TURTLEZ(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
if (event.getPlayer().getName().equals("SamitoD") && event.getMessage().equals("/gear"))
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), "UR SPECIAL!!!");
|
||||
_clans.getGearManager().openShop(event.getPlayer());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Quit(PlayerQuitEvent event)
|
||||
{
|
||||
|
@ -227,7 +227,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
|
||||
TaskManager taskManager = new TaskManager(plugin, _clientManager, webServerAddress);
|
||||
|
||||
_tutorialManager = new TutorialManager(plugin, _goldManager, taskManager, donationManager, preferencesManager, this);
|
||||
_tutorialManager = new TutorialManager(plugin, _goldManager, taskManager, donationManager, preferencesManager, this, packetHandler);
|
||||
|
||||
ClanTips = new ClanTips(plugin, this, preferencesManager);
|
||||
|
||||
@ -402,6 +402,11 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
return _disguiseManager;
|
||||
}
|
||||
|
||||
public TutorialManager getTutorials()
|
||||
{
|
||||
return _tutorialManager;
|
||||
}
|
||||
|
||||
public NpcManager getNPCManager()
|
||||
{
|
||||
return _npcManager;
|
||||
|
@ -19,9 +19,9 @@ 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.core.recharge.Recharge;
|
||||
import mineplex.game.clans.clans.event.ClanDisbandedEvent;
|
||||
import mineplex.game.clans.clans.event.PlayerClaimTerritoryEvent;
|
||||
import mineplex.game.clans.clans.event.PlayerPreClaimTerritoryEvent;
|
||||
import mineplex.game.clans.clans.event.PlayerUnClaimTerritoryEvent;
|
||||
import mineplex.game.clans.core.repository.ClanTerritory;
|
||||
|
||||
@ -157,10 +157,10 @@ public class ClansUtility
|
||||
|
||||
if (inform)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clan Search", "" + C.mCount + (clanMatchList.size() + playerMatchList.size()) + C.mBody + " matches for [" + C.mElem + name + C.mBody + "]."), false);
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clan Search", "" + C.mCount + (clanMatchList.size() + playerMatchList.size()) + C.mBody + " matches for [" + C.mElem + name + C.mBody + "]."));
|
||||
|
||||
UtilPlayer.message(caller, F.desc("Matches via Clan", clanMatchString), false);
|
||||
UtilPlayer.message(caller, F.desc("Matches via Player", playerMatchString), false);;
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.desc("Matches via Clan", clanMatchString));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.desc("Matches via Player", playerMatchString));
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -183,7 +183,7 @@ public class ClansUtility
|
||||
if (!inform) return null;
|
||||
|
||||
// Inform
|
||||
UtilPlayer.message(caller, F.main("Clan Search", "" + C.mCount + matchList.size() + C.mBody + " matches for [" + C.mElem + name + C.mBody + "]."), false);
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clan Search", "" + C.mCount + matchList.size() + C.mBody + " matches for [" + C.mElem + name + C.mBody + "]."));
|
||||
|
||||
if (matchList.size() > 0)
|
||||
{
|
||||
@ -191,7 +191,7 @@ public class ClansUtility
|
||||
for (ClanInfo cur : matchList)
|
||||
matchString += cur.getName() + " ";
|
||||
|
||||
UtilPlayer.message(caller, F.main("Clan Search", "" + C.mBody + " Matches [" + C.mElem + matchString + C.mBody + "]."), false);
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clan Search", "" + C.mBody + " Matches [" + C.mElem + matchString + C.mBody + "]."));
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -554,31 +554,31 @@ public class ClansUtility
|
||||
{
|
||||
if (Clans.getClanMemberUuidMap().containsKey(caller.getUniqueId()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are already in a Clan."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are already in a Clan."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Clans.Get(caller).canJoin())
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You cannot join a Clan for " + C.mTime + UtilTime.convertString(System.currentTimeMillis() - Clans.Get(caller).getDelay(), 1, UtilTime.TimeUnit.FIT) + C.mBody + "."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot join a Clan for " + C.mTime + UtilTime.convertString(System.currentTimeMillis() - Clans.Get(caller).getDelay(), 1, UtilTime.TimeUnit.FIT) + C.mBody + "."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (clanInfo == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Error: Clan does not exist"));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Error: Clan does not exist"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!clanInfo.isInvited(caller.getName()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not invited to " + F.elem("Clan " + clanInfo.getName()) + "."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not invited to " + F.elem("Clan " + clanInfo.getName()) + "."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (clanInfo.getSize() >= clanInfo.getMaxSize())
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "The clan " + F.elem("Clan " + clanInfo.getName()) + " is full and cannot be joined!"));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "The clan " + F.elem("Clan " + clanInfo.getName()) + " is full and cannot be joined!"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -591,12 +591,12 @@ public class ClansUtility
|
||||
if (data)
|
||||
{
|
||||
// Inform
|
||||
UtilPlayer.message(caller, F.main("Clans", "You joined " + F.elem("Clan " + clanInfo.getName()) + "."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You joined " + F.elem("Clan " + clanInfo.getName()) + "."));
|
||||
clanInfo.inform(F.name(caller.getName()) + " has joined your Clan.", caller.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "There was an error processing your request"));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "There was an error processing your request"));
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -609,13 +609,13 @@ public class ClansUtility
|
||||
|
||||
if (clan == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (clan.getMembers().get(caller.getUniqueId()).getRole() == ClanRole.LEADER && clan.getMembers().size() > 1)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You must pass on " + F.elem("Leadership") + " before leaving."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must pass on " + F.elem("Leadership") + " before leaving."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -629,7 +629,7 @@ public class ClansUtility
|
||||
public void run(Boolean data)
|
||||
{
|
||||
// Inform
|
||||
UtilPlayer.message(caller, F.main("Clans", "You left " + F.elem("Clan " + clan.getName()) + "."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You left " + F.elem("Clan " + clan.getName()) + "."));
|
||||
clan.inform(F.name(caller.getName()) + " has left your Clan.", null);
|
||||
}
|
||||
});
|
||||
@ -646,13 +646,13 @@ public class ClansUtility
|
||||
|
||||
if (clan == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (getRole(caller) != ClanRole.LEADER)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader can disband the Clan."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader can disband the Clan."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -665,6 +665,8 @@ public class ClansUtility
|
||||
return;
|
||||
}
|
||||
|
||||
Clans.messageClan(clan, C.cYellow + caller.getName() + C.cGray + " has disbanded the Clan.");
|
||||
|
||||
// Task
|
||||
Clans.getClanDataAccess().delete(clan, new Callback<Boolean>()
|
||||
{
|
||||
@ -673,10 +675,11 @@ public class ClansUtility
|
||||
{
|
||||
if (!data)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "There was an error processing your request. Try again later"));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "There was an error processing your request. Try again later"));
|
||||
|
||||
}else
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You disbanded your Clan."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You disbanded your Clan."));
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -686,27 +689,37 @@ public class ClansUtility
|
||||
{
|
||||
ClanInfo clan = getClanByPlayer(caller);
|
||||
|
||||
// Pre Event
|
||||
PlayerPreClaimTerritoryEvent preEvent = new PlayerPreClaimTerritoryEvent(caller, caller.getLocation().getChunk(), clan);
|
||||
|
||||
UtilServer.getServer().getPluginManager().callEvent(preEvent);
|
||||
|
||||
if (preEvent.isCancelled())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (clan == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can claim Territory."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can claim Territory."));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ClansManager.isClaimable(caller.getLocation()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You cannot claim territory at this location!"));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot claim territory at this location!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
// if (clan.getEnergy() == 0)
|
||||
// {
|
||||
// UtilPlayer.message(caller, F.main("Clans", "You must purchase energy at a shop before you can claim land."));
|
||||
// Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must purchase energy at a shop before you can claim land."));
|
||||
// return false;
|
||||
// }
|
||||
|
||||
@ -722,14 +735,14 @@ public class ClansUtility
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "This Territory is owned by " + mRel(Clans.getClanUtility().relPC(caller, ownerClan), ownerClan.getName(), true) + "."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This Territory is owned by " + mRel(Clans.getClanUtility().relPC(caller, ownerClan), ownerClan.getName(), true) + "."));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// if (clan.getClaims() >= clan.getClaimsMax())
|
||||
// {
|
||||
// UtilPlayer.message(caller, F.main("Clans", "Your Clan cannot claim more Territory."));
|
||||
// Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Your Clan cannot claim more Territory."));
|
||||
// return false;
|
||||
// }
|
||||
|
||||
@ -755,8 +768,8 @@ public class ClansUtility
|
||||
|
||||
if (checkBox(caller.getWorld().getChunkAt(caller.getLocation().getChunk().getX() + x, caller.getLocation().getChunk().getZ() + z), 3))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You cannot claim this Territory, it causes a box."));
|
||||
UtilPlayer.message(caller, F.main("Clans", "This means a Territory has all sides claimed."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot claim this Territory, it causes a box."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This means a Territory has all sides claimed."));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -766,7 +779,7 @@ public class ClansUtility
|
||||
}
|
||||
else if (rel(clan, adjClan) != ClanRelation.SELF)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You cannot claim Territory next to " + mRel(rel(ownerClan, adjClan), adjClan.getName(), true) + "."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot claim Territory next to " + mRel(rel(ownerClan, adjClan), adjClan.getName(), true) + "."));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -775,21 +788,21 @@ public class ClansUtility
|
||||
// Boxed
|
||||
if (checkBox(caller.getLocation().getChunk(), 4))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You cannot claim this Territory, it causes a box."));
|
||||
UtilPlayer.message(caller, F.main("Clans", "This means a Territory has all sides claimed."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot claim this Territory, it causes a box."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This means a Territory has all sides claimed."));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isNearAdminClaim(caller.getLocation()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You cannot claim so close to administrative territory!"));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot claim so close to administrative territory!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Not Next to Self
|
||||
if (!selfAdj && !clan.getClaimSet().isEmpty())
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You must claim next to your other Territory."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must claim next to your other Territory."));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -798,7 +811,7 @@ public class ClansUtility
|
||||
{
|
||||
if (!UtilTime.elapsed(Clans.getUnclaimMap().get(chunk), Clans.getReclaimTime()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "This Territory cannot be claimed for " + F.time(UtilTime.convertString(Clans.getReclaimTime() - (System.currentTimeMillis() - Clans.getUnclaimMap().get(chunk)), 1, UtilTime.TimeUnit.FIT)) + "."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This Territory cannot be claimed for " + F.time(UtilTime.convertString(Clans.getReclaimTime() - (System.currentTimeMillis() - Clans.getUnclaimMap().get(chunk)), 1, UtilTime.TimeUnit.FIT)) + "."));
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -813,7 +826,7 @@ public class ClansUtility
|
||||
{
|
||||
if (UtilMath.offset(cur, caller) < 16) if (playerEnemy(caller, cur))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You cannot claim while enemies are nearby."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot claim while enemies are nearby."));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -835,7 +848,7 @@ public class ClansUtility
|
||||
Clans.getClanDataAccess().claim(clan.getName(), chunk, caller.getName(), false);
|
||||
|
||||
// Inform
|
||||
UtilPlayer.message(caller, F.main("Clans", "You claimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + "."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You claimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + "."));
|
||||
clan.inform(F.name(caller.getName()) + " claimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + ".", caller.getName());
|
||||
|
||||
return true;
|
||||
@ -872,7 +885,7 @@ public class ClansUtility
|
||||
}
|
||||
|
||||
// Change Inform
|
||||
UtilPlayer.message(caller, F.main("Clans", "You can no longer 'steal' territory. " + "You simply unclaim it and it can not be reclaimed by anyone for 30 mintes." + "This was done to improve gameplay. Enjoy!"));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You can no longer 'steal' territory. " + "You simply unclaim it and it can not be reclaimed by anyone for 30 mintes." + "This was done to improve gameplay. Enjoy!"));
|
||||
|
||||
// Inform
|
||||
UtilServer.broadcast(F.main("Clans", F.elem(clientClan.getName()) + " unclaimed from " + F.elem(ownerClan.getName()) + " at " + F.elem(UtilWorld.locToStrClean(caller.getLocation())) + "."));
|
||||
@ -889,7 +902,7 @@ public class ClansUtility
|
||||
|
||||
if (clan == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -900,13 +913,13 @@ public class ClansUtility
|
||||
|
||||
if (target.equals(caller.getName()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You cannot promote yourself."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot promote yourself."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.getRole().ordinal() <= target.getRole().ordinal())
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You do not outrank " + F.name(other) + "."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You do not outrank " + F.name(other) + "."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -941,7 +954,7 @@ public class ClansUtility
|
||||
|
||||
if (clan == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -952,19 +965,19 @@ public class ClansUtility
|
||||
|
||||
if (target.equals(caller.getName()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You cannot demote yourself."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot demote yourself."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.getRole().ordinal() <= target.getRole().ordinal())
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You do not outrank " + F.name(other) + "."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You do not outrank " + F.name(other) + "."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.getRole() == ClanRole.RECRUIT)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You cannot demote " + F.name(other) + " any further."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot demote " + F.name(other) + " any further."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -991,7 +1004,7 @@ public class ClansUtility
|
||||
|
||||
if (clan == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1002,20 +1015,20 @@ public class ClansUtility
|
||||
|
||||
if (self.getRole() != ClanRole.LEADER && self.getRole() != ClanRole.ADMIN)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can kick members."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can kick members."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (clansPlayer.getRole() == ClanRole.LEADER)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Clan leaders cannot be kicked."));
|
||||
UtilPlayer.message(caller, F.main("Clans", "To disband a clan, use /c disband"));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan leaders cannot be kicked."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "To disband a clan, use /c disband"));
|
||||
return;
|
||||
}
|
||||
|
||||
if ((clansPlayer.getRole() == ClanRole.LEADER && self.getRole() == ClanRole.ADMIN) || (clansPlayer.getRole() == ClanRole.ADMIN && self.getRole() == ClanRole.ADMIN))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You do not outrank " + F.name(other) + "."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You do not outrank " + F.name(other) + "."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1027,8 +1040,8 @@ public class ClansUtility
|
||||
public void run(Boolean data)
|
||||
{
|
||||
// Inform
|
||||
if (player != null) UtilPlayer.message(player, F.main("Clans", F.name(caller.getName()) + " kicked you from " + F.elem("Clan " + clan.getName()) + "."));
|
||||
UtilPlayer.message(caller, F.main("Clans", "You kicked " + F.name(other) + " from your Clan."));
|
||||
if (player != null) Clans.getTutorials().sendTutorialMsg(player, F.main("Clans", F.name(caller.getName()) + " kicked you from " + F.elem("Clan " + clan.getName()) + "."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You kicked " + F.name(other) + " from your Clan."));
|
||||
clan.inform(F.main("Clans", F.name(caller.getName()) + " kicked " + F.name(other) + " from your Clan."), caller.getName());
|
||||
}
|
||||
};
|
||||
@ -1046,7 +1059,7 @@ public class ClansUtility
|
||||
|
||||
if (clan == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1059,14 +1072,14 @@ public class ClansUtility
|
||||
// Role
|
||||
if (clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can unclaim Territory."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can unclaim Territory."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Not Claimed
|
||||
if (ownerClan == null || !ownerClan.equals(clan))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "This Territory is not owned by you."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This Territory is not owned by you."));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1084,7 +1097,7 @@ public class ClansUtility
|
||||
Clans.getClanDataAccess().unclaim(chunk, caller.getName(), true);
|
||||
|
||||
// Inform
|
||||
UtilPlayer.message(caller, F.main("Clans", "You unclaimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + "."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You unclaimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + "."));
|
||||
clan.inform(F.name(caller.getName()) + " unclaimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + ".", caller.getName());
|
||||
|
||||
return true;
|
||||
@ -1096,13 +1109,13 @@ public class ClansUtility
|
||||
|
||||
if (clan == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader can unclaim all Territory."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader can unclaim all Territory."));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1120,7 +1133,7 @@ public class ClansUtility
|
||||
}
|
||||
|
||||
// Inform
|
||||
UtilPlayer.message(caller, F.main("Clans", "You unclaimed all your Clans Territory."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You unclaimed all your Clans Territory."));
|
||||
clan.inform(F.name(caller.getName()) + " unclaimed all your Clans Territory.", caller.getName());
|
||||
|
||||
return true;
|
||||
@ -1130,21 +1143,21 @@ public class ClansUtility
|
||||
{
|
||||
if (clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can send invites."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can send invites."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.getName().equals(caller.getName()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You cannot invite yourself."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot invite yourself."));
|
||||
return;
|
||||
}
|
||||
|
||||
// Inform
|
||||
clan.inform(F.name(caller.getName()) + " invited " + F.name(target.getName()) + " to join your Clan.", caller.getName());
|
||||
UtilPlayer.message(caller, F.main("Clans", "You invited " + F.name(target.getName()) + " to join your Clan."));
|
||||
UtilPlayer.message(target, F.main("Clans", F.name(caller.getName()) + " invited you to join " + F.elem("Clan " + clan.getName()) + "."));
|
||||
UtilPlayer.message(target, F.main("Clans", "Type " + F.elem("/c join " + clan.getName()) + " to accept!"));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You invited " + F.name(target.getName()) + " to join your Clan."));
|
||||
Clans.getTutorials().sendTutorialMsg(target, F.main("Clans", F.name(caller.getName()) + " invited you to join " + F.elem("Clan " + clan.getName()) + "."));
|
||||
Clans.getTutorials().sendTutorialMsg(target, F.main("Clans", "Type " + F.elem("/c join " + clan.getName()) + " to accept!"));
|
||||
|
||||
// Task
|
||||
Clans.getClanDataAccess().invite(clan, target.getName(), caller.getName());
|
||||
|
@ -25,6 +25,7 @@ import mineplex.game.clans.clans.ClansBlacklist;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.clans.ClientClan;
|
||||
import mineplex.game.clans.clans.event.ClansCommandExecutedEvent;
|
||||
import mineplex.game.clans.tutorials.Tutorial;
|
||||
import mineplex.game.clans.tutorials.TutorialManager;
|
||||
import net.minecraft.server.v1_8_R3.EnumDirection;
|
||||
|
||||
@ -65,7 +66,8 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
else if (args[0].equalsIgnoreCase("promote") || args[0].equalsIgnoreCase("+"))
|
||||
promote(caller, args);
|
||||
|
||||
else if (args[0].equalsIgnoreCase("forcejoin") || args[0].equalsIgnoreCase("fj"))
|
||||
forceJoin(caller, args);
|
||||
else if (args[0].equalsIgnoreCase("demote") || args[0].equalsIgnoreCase("-"))
|
||||
demote(caller, args);
|
||||
|
||||
@ -121,12 +123,41 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
infoClan(caller, args[0]);
|
||||
}
|
||||
|
||||
private void forceJoin(Player caller, String[] args)
|
||||
{
|
||||
if (!Plugin.getClientManager().hasRank(caller, Rank.ADMIN) && !caller.getName().equals("NewGarbo"))
|
||||
{
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This requires ADMIN+ permission."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.length > 1)
|
||||
{
|
||||
ClanInfo clan = Plugin.getClan(args[1]);
|
||||
|
||||
if (clan != null)
|
||||
{
|
||||
_manager.getClanUtility().join(caller, clan);
|
||||
_manager.getClanDataAccess().role(clan, caller.getUniqueId(), ClanRole.LEADER);
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You have successfully joined " + F.elem(clan.getName()) + " and are now Leader Role."));
|
||||
}
|
||||
else
|
||||
{
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan provided does not exist."));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "No clan provided."));
|
||||
}
|
||||
}
|
||||
|
||||
public void commandChat(Player caller, String[] args)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
Plugin.Get(caller).setClanChat(!Plugin.Get(caller).isClanChat());
|
||||
UtilPlayer.message(caller, F.main("Clans", "Clan Chat: " + F.oo(Plugin.Get(caller).isClanChat())));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan Chat: " + F.oo(Plugin.Get(caller).isClanChat())));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -135,7 +166,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
{
|
||||
ClanInfo clan = Plugin.getClanUtility().getClanByPlayer(caller);
|
||||
if (clan == null)
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
||||
else
|
||||
Plugin.chatClan(clan, caller, F.combine(args, 0, null, false));
|
||||
}
|
||||
@ -146,7 +177,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
if (args.length == 0)
|
||||
{
|
||||
Plugin.Get(caller).setAllyChat(!Plugin.Get(caller).isAllyChat());
|
||||
UtilPlayer.message(caller, F.main("Clans", "Ally Chat: " + F.oo(Plugin.Get(caller).isAllyChat())));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Ally Chat: " + F.oo(Plugin.Get(caller).isAllyChat())));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -155,7 +186,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
{
|
||||
ClanInfo clan = Plugin.getClanUtility().getClanByPlayer(caller);
|
||||
if (clan == null)
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
||||
else
|
||||
Plugin.chatAlly(clan, caller, F.combine(args, 0, null, false));
|
||||
}
|
||||
@ -171,30 +202,30 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
return;
|
||||
}
|
||||
|
||||
UtilPlayer.message(caller, F.main("Clans", "Commands List;"));
|
||||
UtilPlayer.message(caller, F.help("/c create <clan>", "Create new Clan", Rank.ALL));
|
||||
UtilPlayer.message(caller, F.help("/c join <clan>", "Join a Clan", Rank.ALL));
|
||||
UtilPlayer.message(caller, F.help("/c leave <clan>", "Leave your Clan", Rank.ALL));
|
||||
UtilPlayer.message(caller, F.help("/c map <toggle>", "View Clan Map", Rank.ALL));
|
||||
UtilPlayer.message(caller, F.help("/cc (Message)", "Clan Chat (Toggle)", Rank.ALL));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Commands List;"));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c create <clan>", "Create new Clan", Rank.ALL));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c join <clan>", "Join a Clan", Rank.ALL));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c leave <clan>", "Leave your Clan", Rank.ALL));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c map <toggle>", "View Clan Map", Rank.ALL));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.help("/cc (Message)", "Clan Chat (Toggle)", Rank.ALL));
|
||||
|
||||
UtilPlayer.message(caller, F.help("/c promote <player>", "Promote Player in Clan", Rank.MODERATOR));
|
||||
UtilPlayer.message(caller, F.help("/c demote <player>", "Demote Player in Clan", Rank.MODERATOR));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c promote <player>", "Promote Player in Clan", Rank.MODERATOR));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c demote <player>", "Demote Player in Clan", Rank.MODERATOR));
|
||||
|
||||
UtilPlayer.message(caller, F.help("/c home (set)", "Teleport to Clan Home", Rank.MODERATOR));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c home (set)", "Teleport to Clan Home", Rank.MODERATOR));
|
||||
|
||||
UtilPlayer.message(caller, F.help("/c invite <player>", "Invite Player to Clan", Rank.ADMIN));
|
||||
UtilPlayer.message(caller, F.help("/c kick <player>", "Kick Player from Clan", Rank.ADMIN));
|
||||
UtilPlayer.message(caller, F.help("/c neutral <clan>", "Request Neutrality with Clan", Rank.ADMIN));
|
||||
UtilPlayer.message(caller, F.help("/c enemy <clan>", "Declare ClanWar with Clan", Rank.ADMIN));
|
||||
UtilPlayer.message(caller, F.help("/c ally <clan>", "Send Alliance to Clan", Rank.ADMIN));
|
||||
UtilPlayer.message(caller, F.help("/c trust <clan>", "Give Trust to Clan", Rank.ADMIN));
|
||||
UtilPlayer.message(caller, F.help("/c claim", "Claim Territory", Rank.ADMIN));
|
||||
UtilPlayer.message(caller, F.help("/c unclaim (all)", "Unclaim Territory", Rank.ADMIN));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c invite <player>", "Invite Player to Clan", Rank.ADMIN));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c kick <player>", "Kick Player from Clan", Rank.ADMIN));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c neutral <clan>", "Request Neutrality with Clan", Rank.ADMIN));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c enemy <clan>", "Declare ClanWar with Clan", Rank.ADMIN));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c ally <clan>", "Send Alliance to Clan", Rank.ADMIN));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c trust <clan>", "Give Trust to Clan", Rank.ADMIN));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c claim", "Claim Territory", Rank.ADMIN));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c unclaim (all)", "Unclaim Territory", Rank.ADMIN));
|
||||
|
||||
UtilPlayer.message(caller, F.help("/c delete", "Delete your Clan", Rank.OWNER));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c delete", "Delete your Clan", Rank.OWNER));
|
||||
|
||||
UtilPlayer.message(caller, F.help("/c <clan>", "View Clan Information", Rank.ALL));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c <clan>", "View Clan Information", Rank.ALL));
|
||||
}
|
||||
|
||||
public void create(final Player caller, final String[] args)
|
||||
@ -205,12 +236,12 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
if (Plugin.getClanMemberUuidMap().containsKey(caller.getUniqueId()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are already in a Clan."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are already in a Clan."));
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO if (!client.canJoin()) { UtilPlayer.message(caller,
|
||||
* TODO if (!client.canJoin()) { _manager.getTutorials().sendTutorialMsg(caller,
|
||||
* F.main("Clans", "You cannot join a Clan for " + C.mTime +
|
||||
* UtilTime.convertString(System.currentTimeMillis() -
|
||||
* client.getDelay(), 1, TimeUnit.FIT) + C.mBody + ".")); return; }
|
||||
@ -218,37 +249,37 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
if (args.length < 2)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You did not input a Clan name."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a Clan name."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!UtilInput.valid(args[1]))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Invalid characters in Clan name."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Invalid characters in Clan name."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (args[1].length() < Plugin.getNameMin())
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Clan name too short. Minimum length is " + (Plugin.getNameMin()) + "."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan name too short. Minimum length is " + (Plugin.getNameMin()) + "."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (args[1].length() > Plugin.getNameMax())
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Clan name too long. Maximum length is " + (Plugin.getNameMax()) + "."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan name too long. Maximum length is " + (Plugin.getNameMax()) + "."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (Plugin.getChat().getFilteredMessage(caller, args[1]).contains("*"))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Clan name inappropriate. Please try a different name"));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan name inappropriate. Please try a different name"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ClansBlacklist.isValidClanName(args[1]))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Clan name is blacklisted! Please try a different name."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan name is blacklisted! Please try a different name."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -259,7 +290,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
{
|
||||
if (clanExists)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Clan name is already in use by another Clan."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan name is already in use by another Clan."));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -271,11 +302,11 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
if (data == null)
|
||||
{
|
||||
// Hopefully shouldn't happen!
|
||||
UtilPlayer.message(caller, F.main("Clans", "There was an error creating the clan. Please try again"));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "There was an error creating the clan. Please try again"));
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You created Clan " + C.cYellow + data.getName() + C.cGray + "."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You created Clan " + C.cYellow + data.getName() + C.cGray + "."));
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -295,13 +326,13 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
if (clan == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.length < 2)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You did not input an invitee."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input an invitee."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -315,25 +346,25 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
{
|
||||
if (Plugin.getClanMemberUuidMap().containsKey(caller.getUniqueId()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are already in a Clan."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are already in a Clan."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Plugin.Get(caller).canJoin())
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You cannot join a Clan for " + C.mTime + UtilTime.convertString(System.currentTimeMillis() - Plugin.Get(caller).getDelay(), 1, TimeUnit.FIT) + C.mBody + "."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot join a Clan for " + C.mTime + UtilTime.convertString(System.currentTimeMillis() - Plugin.Get(caller).getDelay(), 1, TimeUnit.FIT) + C.mBody + "."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.length < 2)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You did not input a Clan name."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a Clan name."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!UtilInput.valid(args[1]))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Invalid characters in Clan name."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Invalid characters in Clan name."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -342,13 +373,13 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
if (!clan.isInvited(caller.getName()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not invited to " + F.elem("Clan " + clan.getName()) + "."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not invited to " + F.elem("Clan " + clan.getName()) + "."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (clan.getSize() >= clan.getMaxSize())
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "The clan " + F.elem("Clan " + clan.getName()) + " is full and cannot be joined!"));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "The clan " + F.elem("Clan " + clan.getName()) + " is full and cannot be joined!"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -361,12 +392,12 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
if (data)
|
||||
{
|
||||
// Inform
|
||||
UtilPlayer.message(caller, F.main("Clans", "You joined " + F.elem("Clan " + clan.getName()) + "."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You joined " + F.elem("Clan " + clan.getName()) + "."));
|
||||
clan.inform(F.name(caller.getName()) + " has joined your Clan.", caller.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "There was an error processing your request"));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "There was an error processing your request"));
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -379,13 +410,13 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
if (clan == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (clan.getMembers().get(caller.getUniqueId()).getRole() == ClanRole.LEADER && clan.getMembers().size() > 1)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You must pass on " + F.elem("Leadership") + " before leaving."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must pass on " + F.elem("Leadership") + " before leaving."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -399,7 +430,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
public void run(Boolean data)
|
||||
{
|
||||
// Inform
|
||||
UtilPlayer.message(caller, F.main("Clans", "You left " + F.elem("Clan " + clan.getName()) + "."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You left " + F.elem("Clan " + clan.getName()) + "."));
|
||||
clan.inform(F.name(caller.getName()) + " has left your Clan.", null);
|
||||
}
|
||||
});
|
||||
@ -416,13 +447,13 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
if (clan == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.length < 2)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You did not input a Player to kick."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a Player to kick."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -437,13 +468,13 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
if (clan == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.length < 2)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You did not input player to promote."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input player to promote."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -458,13 +489,13 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
if (clan == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.length < 2)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You did not input player to demote."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input player to demote."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -479,19 +510,19 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
if (cA == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (cA.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && cA.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can manage Alliances."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can manage Alliances."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.length < 2)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You did not input a Clan to ally."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a Clan to ally."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -501,31 +532,31 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
if (cA.isSelf(cB.getName()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You cannot ally with yourself."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot ally with yourself."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (cA.isAlly(cB.getName()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are already allies with Clan" + F.elem(cB.getName())) + ".");
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are already allies with Clan" + F.elem(cB.getName())) + ".");
|
||||
return;
|
||||
}
|
||||
|
||||
if (cA.getAllies() >= cA.getAlliesMax())
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You cannot have any more allies."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot have any more allies."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (cB.getAllies() >= cB.getAlliesMax())
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Clan " + F.elem(cB.getName()) + " cannot have any more allies."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan " + F.elem(cB.getName()) + " cannot have any more allies."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Recharge.Instance.usable(caller, "AllyReq" + cB.getName()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Please do not spam alliance requests."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Please do not spam alliance requests."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -535,7 +566,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
Plugin.getClanDataAccess().ally(cA, cB, caller.getName());
|
||||
|
||||
// Inform
|
||||
UtilPlayer.message(caller, F.main("Clans", "You accepted alliance with Clan " + F.elem(cB.getName()) + "."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You accepted alliance with Clan " + F.elem(cB.getName()) + "."));
|
||||
cA.inform(F.name(caller.getName()) + " accepted alliance with Clan " + F.elem(cB.getName()) + ".", caller.getName());
|
||||
cB.inform("Clan " + F.elem(cA.getName()) + " has accepted alliance with you.", null);
|
||||
}
|
||||
@ -545,7 +576,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
Plugin.getClanDataAccess().requestAlly(cA, cB, caller.getName());
|
||||
|
||||
// Inform
|
||||
UtilPlayer.message(caller, F.main("Clans", "You requested alliance with Clan " + F.elem(cB.getName()) + "."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You requested alliance with Clan " + F.elem(cB.getName()) + "."));
|
||||
cA.inform(F.name(caller.getName()) + " has requested alliance with Clan " + F.elem(cB.getName()) + ".", caller.getName());
|
||||
cB.inform("Clan " + F.elem(cA.getName()) + " has requested alliance with you.", null);
|
||||
|
||||
@ -559,19 +590,19 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
//
|
||||
// if (cA == null)
|
||||
// {
|
||||
// UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
// _manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (cA.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && cA.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN)
|
||||
// {
|
||||
// UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can manage Trust."));
|
||||
// _manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can manage Trust."));
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (args.length < 2)
|
||||
// {
|
||||
// UtilPlayer.message(caller, F.main("Clans", "You did not input a Clan to enemy."));
|
||||
// _manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a Clan to enemy."));
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
@ -581,7 +612,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
//
|
||||
// if (!cA.isAlly(cB.getName()))
|
||||
// {
|
||||
// UtilPlayer.message(caller, F.main("Clans", "You must be allied to trust a clan!"));
|
||||
// _manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must be allied to trust a clan!"));
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
@ -589,14 +620,14 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
// if (Plugin.getClanDataAccess().trust(cA, cB, caller.getName()))
|
||||
// {
|
||||
// // Inform
|
||||
// UtilPlayer.message(caller, F.main("Clans", "You gave trust to " + F.elem("Clan " + cB.getName()) + "."));
|
||||
// _manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You gave trust to " + F.elem("Clan " + cB.getName()) + "."));
|
||||
// cA.inform(F.name(caller.getName()) + " has given trust to " + F.elem("Clan " + cB.getName()) + ".", caller.getName());
|
||||
// cB.inform(F.elem("Clan " + cA.getName()) + " has given trust to you.", null);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // Inform
|
||||
// UtilPlayer.message(caller, F.main("Clans", "You revoked trust to " + F.elem("Clan " + cB.getName()) + "."));
|
||||
// _manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You revoked trust to " + F.elem("Clan " + cB.getName()) + "."));
|
||||
// cA.inform(F.name(caller.getName()) + " has revoked trust to " + F.elem("Clan " + cB.getName()) + ".", caller.getName());
|
||||
// cB.inform(F.elem("Clan " + cA.getName()) + " has revoked trust to you.", null);
|
||||
// }
|
||||
@ -608,19 +639,19 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
if (cA == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (cA.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && cA.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can manage relationships."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can manage relationships."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.length < 2)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You did not input a Clan to set neutrality with."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a Clan to set neutrality with."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -630,11 +661,11 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
if (cB.isSelf(cA.getName()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You prefer to think of yourself positively..."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You prefer to think of yourself positively..."));
|
||||
}
|
||||
else if (cB.isNeutral(cA.getName()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are already neutral with " + F.elem("Clan " + cB.getName()) + "."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are already neutral with " + F.elem("Clan " + cB.getName()) + "."));
|
||||
}
|
||||
else if (cB.isAlly(cA.getName()))
|
||||
{
|
||||
@ -642,7 +673,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
Plugin.getClanDataAccess().neutral(cA, cB, caller.getName(), true);
|
||||
|
||||
// Inform
|
||||
UtilPlayer.message(caller, F.main("Clans", "You revoked alliance with " + F.elem("Clan " + cB.getName()) + "."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You revoked alliance with " + F.elem("Clan " + cB.getName()) + "."));
|
||||
cA.inform(F.name(caller.getName()) + " revoked alliance with " + F.elem("Clan " + cB.getName()) + ".", caller.getName());
|
||||
cB.inform(F.elem("Clan " + cA.getName()) + " has revoked alliance with you.", null);
|
||||
}
|
||||
@ -683,7 +714,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
}
|
||||
|
||||
// Change Inform
|
||||
UtilPlayer.message(caller, F.main("Clans", "You can no longer 'steal' territory. " + "You simply unclaim it and it can not be reclaimed by anyone for 30 mintes." + "This was done to improve gameplay. Enjoy!"));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You can no longer 'steal' territory. " + "You simply unclaim it and it can not be reclaimed by anyone for 30 mintes." + "This was done to improve gameplay. Enjoy!"));
|
||||
|
||||
// Inform
|
||||
UtilServer.broadcast(F.main("Clans", F.elem(clientClan.getName()) + " unclaimed from " + F.elem(ownerClan.getName()) + " at " + F.elem(UtilWorld.locToStrClean(caller.getLocation())) + "."));
|
||||
@ -719,31 +750,31 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
if (clan == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (clan.getHome() == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Your Clan has not set a Home"));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Your Clan has not set a Home"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!clan.getClaimSet().contains(UtilWorld.chunkToStr(clan.getHome().getChunk())))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Your Clan has lost its Home Territory."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Your Clan has lost its Home Territory."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Plugin.getClanUtility().isSafe(caller.getLocation()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You can only use Clan Home from Spawn."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You can only use Clan Home from Spawn."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Plugin.getClanUtility().isSpecial(caller.getLocation(), "Spawn"))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You can only use Clan Home from Spawn."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You can only use Clan Home from Spawn."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -751,7 +782,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
if (!(home.getBlock().getType().equals(Material.BED_BLOCK) && home.add(0, 1, 0).getBlock().getType().equals(Material.AIR)) && home.add(0, 2, 0).getBlock().getType().equals(Material.AIR))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Your Clan's bed has been destroyed, or is obstructed."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Your Clan's bed has been destroyed, or is obstructed."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -760,7 +791,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
* (Player cur : clan.GetHome().getWorld().getPlayers()) if
|
||||
* (client.Clan().GetRelation(cur.getName()) == ClanRelation.NEUTRAL) if
|
||||
* (clan.GetClaimSet().contains(UtilWorld.chunkToStr(cur.getLocation().
|
||||
* getChunk()))) { UtilPlayer.message(caller, F.main("Clans",
|
||||
* getChunk()))) { _manager.getTutorials().sendTutorialMsg(caller, F.main("Clans",
|
||||
* "You cannot use Clan Home with enemies in your Territory.")); return;
|
||||
* }
|
||||
*/
|
||||
@ -772,7 +803,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
Plugin.getTeleport().TP(caller, clan.getHome().add(0, 1, 0));
|
||||
|
||||
// Inform
|
||||
UtilPlayer.message(caller, F.main("Clans", "You teleported to your Clan Home " + UtilWorld.locToStrClean(caller.getLocation()) + "."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You teleported to your Clan Home " + UtilWorld.locToStrClean(caller.getLocation()) + "."));
|
||||
}
|
||||
|
||||
public void homeSet(Player caller)
|
||||
@ -790,31 +821,31 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
if (clan == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can manage Clan Home."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can manage Clan Home."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (Plugin.getClanUtility().getOwner(caller.getLocation()) == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You must set your Clan Home in your own Territory."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must set your Clan Home in your own Territory."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Plugin.getClanUtility().getOwner(caller.getLocation()).isSelf(clan.getName()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You must set your Clan Home in your own Territory."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must set your Clan Home in your own Territory."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(caller.getLocation().add(0, 1, 0).getBlock().getType().equals(Material.AIR) && caller.getLocation().add(0, 2, 0).getBlock().getType().equals(Material.AIR)))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "This is not a suitable place for a bed."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This is not a suitable place for a bed."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -823,7 +854,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
if (!bedPlaced)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "This is not a suitable place for a bed."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This is not a suitable place for a bed."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -839,7 +870,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
Plugin.ClanTips.displayTip(TipType.SETHOME, caller);
|
||||
|
||||
// Inform
|
||||
UtilPlayer.message(caller, F.main("Clans", "You set Clan Home to " + F.elem(UtilWorld.locToStrClean(caller.getLocation())) + "."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You set Clan Home to " + F.elem(UtilWorld.locToStrClean(caller.getLocation())) + "."));
|
||||
clan.inform(caller.getName() + " set Clan Home to " + F.elem(UtilWorld.locToStrClean(caller.getLocation())) + ".", caller.getName());
|
||||
}
|
||||
|
||||
@ -847,7 +878,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
{System.out.println(search);
|
||||
if (search == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You did not input a search parameter."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a search parameter."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -869,13 +900,13 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
{
|
||||
if (_manager.getClientManager().hasRank(caller, Rank.ADMIN))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "No no no, this command is not for you ;-)"));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "No no no, this command is not for you ;-)"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (search == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You did not input a search parameter."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a search parameter."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -904,7 +935,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
if (clan == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -914,6 +945,6 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
if (clan == null) return;
|
||||
|
||||
UtilPlayer.message(caller, clan.mTerritory());
|
||||
_manager.getTutorials().sendTutorialMsg(caller, clan.mTerritory());
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ public class RegionsCommand extends CommandBase<ClansManager>
|
||||
|
||||
public RegionsCommand(ClansManager plugin)
|
||||
{
|
||||
super(plugin, Rank.ADMIN, new Rank[]{Rank.JNR_DEV},"region-reset");
|
||||
super(plugin, Rank.ADMIN,"region-reset");
|
||||
|
||||
_manager = plugin;
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import org.bukkit.entity.Player;
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.task.TaskManager;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.tutorials.Tutorial;
|
||||
import mineplex.game.clans.tutorials.TutorialManager;
|
||||
import mineplex.game.clans.tutorials.gettingstarted.TutorialGettingStarted;
|
||||
@ -15,26 +16,34 @@ public class RestartTutCommand extends CommandBase<TutorialManager>
|
||||
{
|
||||
public RestartTutCommand(TutorialManager plugin)
|
||||
{
|
||||
super(plugin, Rank.ALL, "rst", "rstut");
|
||||
super(plugin, Rank.ALL, "rst", "rstut", "reset");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
String ignoreString = String.format(Tutorial.TUTORIAL_REWARD_TASK, "GettingStartedTutorial");
|
||||
Integer ignoreInt = TaskManager.Instance.getTaskId(ignoreString);
|
||||
|
||||
Iterator<Integer> it = TaskManager.Instance.Get(caller).TasksCompleted.iterator();
|
||||
while (it.hasNext())
|
||||
if (ClansManager.getInstance().getClanUtility().getClaim(caller.getLocation()) != null
|
||||
&& ClansManager.getInstance().getClanUtility().getClaim(caller.getLocation()).isSafe(caller.getLocation()))
|
||||
{
|
||||
Integer i = it.next();
|
||||
if (i != null && (ignoreInt == null || i.intValue() != ignoreInt.intValue()))
|
||||
String ignoreString = String.format(Tutorial.TUTORIAL_REWARD_TASK, "GettingStartedTutorial");
|
||||
Integer ignoreInt = TaskManager.Instance.getTaskId(ignoreString);
|
||||
|
||||
Iterator<Integer> it = TaskManager.Instance.Get(caller).TasksCompleted.iterator();
|
||||
while (it.hasNext())
|
||||
{
|
||||
it.remove();
|
||||
Integer i = it.next();
|
||||
if (i != null && (ignoreInt == null || i.intValue() != ignoreInt.intValue()))
|
||||
{
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
|
||||
TutorialManager.Instance.cancelTutorial(caller);
|
||||
TutorialManager.Instance.startTutorial(TutorialGettingStarted.class, caller);
|
||||
}
|
||||
else
|
||||
{
|
||||
TutorialManager.Instance.sendTutorialMsg(caller, "You must be in a safezone to restart the tutorial.");
|
||||
}
|
||||
|
||||
TutorialManager.Instance.cancelTutorial(caller);
|
||||
TutorialManager.Instance.startTutorial(TutorialGettingStarted.class, caller);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,63 @@
|
||||
package mineplex.game.clans.clans.event;
|
||||
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import mineplex.game.clans.clans.ClanInfo;
|
||||
|
||||
public class PlayerPreClaimTerritoryEvent extends Event
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private Player _claimer;
|
||||
private Chunk _claimedChunk;
|
||||
|
||||
private boolean _cancelled;
|
||||
|
||||
private ClanInfo _clan;
|
||||
|
||||
public PlayerPreClaimTerritoryEvent(Player claimer, Chunk claimedChunk, ClanInfo clan)
|
||||
{
|
||||
_claimer = claimer;
|
||||
_claimedChunk = claimedChunk;
|
||||
_clan = clan;
|
||||
}
|
||||
|
||||
public Player getClaimer()
|
||||
{
|
||||
return _claimer;
|
||||
}
|
||||
|
||||
public ClanInfo getClan()
|
||||
{
|
||||
return _clan;
|
||||
}
|
||||
|
||||
public Chunk getClaimedChunk()
|
||||
{
|
||||
return _claimedChunk;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancelled)
|
||||
{
|
||||
_cancelled = cancelled;
|
||||
}
|
||||
|
||||
public boolean isCancelled()
|
||||
{
|
||||
return _cancelled;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
}
|
@ -27,8 +27,9 @@ public class ScoreboardElementPlayerCount implements ScoreboardElement
|
||||
public List<String> getLines(ScoreboardManager manager, Player player, List<String> out)
|
||||
{
|
||||
List<String> output = new ArrayList<String>();
|
||||
output.add(C.cYellow + "Players Online: " + UtilServer.getPlayers().length + "/100");
|
||||
|
||||
output.add("");
|
||||
output.add(C.cYellow + "Players Online " + UtilServer.getPlayers().length + "/100");
|
||||
|
||||
return output;
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ import mineplex.minecraft.game.core.boss.WorldEvent;
|
||||
public enum WorldEventType
|
||||
{
|
||||
// SLIME_KING("Slime King", SlimeBoss.class, 30),
|
||||
KING_HILL("King of The Hill", KingHill.class, 30),
|
||||
// KING_HILL("King of The Hill", KingHill.class, 30),
|
||||
UNDEAD_CAMP("Undead Camp", UndeadCamp.class, 30);// ,
|
||||
// Golem("Iron Wizard", GolemBoss.class, 30);
|
||||
|
||||
|
@ -41,7 +41,7 @@ public class HillData
|
||||
|
||||
public boolean isOnHill(Location location, Location eventLocation)
|
||||
{
|
||||
return location.getWorld().equals(eventLocation.getWorld()) && UtilMath.offset(location, eventLocation) <= 36;
|
||||
return location.getWorld().equals(eventLocation.getWorld()) && UtilMath.offset(location, eventLocation.clone().add(0, 12, 0)) <= 7.5;
|
||||
}
|
||||
|
||||
public Location getHillCenter(Location eventLocation)
|
||||
|
@ -117,7 +117,7 @@ public class KingHill extends WorldEvent
|
||||
if (_hill.isOnHill(player.getLocation(), getCenterLocation()))
|
||||
{
|
||||
ClanInfo playerClan = _clansManager.getClan(player);
|
||||
if (playerClan != null)
|
||||
if (playerClan != null && !playerClan.equals(lastClan))
|
||||
{
|
||||
clanCount++;
|
||||
lastClan = playerClan;
|
||||
|
@ -55,6 +55,7 @@ import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilItem;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
@ -433,7 +434,7 @@ public class Gameplay extends MiniPlugin
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void replantTree(BlockBreakEvent event)
|
||||
{
|
||||
Block block = event.getBlock();
|
||||
final Block block = event.getBlock();
|
||||
|
||||
if (!UtilItem.isLog(block.getType()))
|
||||
{
|
||||
@ -455,22 +456,15 @@ public class Gameplay extends MiniPlugin
|
||||
return;
|
||||
}
|
||||
|
||||
Location saplingArea = null;
|
||||
final byte data = block.getData();
|
||||
|
||||
for (Block otherBlock : UtilBlock.getInRadius(event.getBlock().getLocation(), 4.5).keySet())
|
||||
{
|
||||
if (!otherBlock.equals(UtilBlock.getHighest(otherBlock.getLocation().getWorld(), otherBlock.getX(), otherBlock.getZ())))
|
||||
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable() {
|
||||
public void run()
|
||||
{
|
||||
saplingArea = otherBlock.getLocation();
|
||||
if (Math.random() > .75)
|
||||
{
|
||||
break;
|
||||
}
|
||||
block.setType(Material.SAPLING);
|
||||
block.setData(data);
|
||||
}
|
||||
}
|
||||
|
||||
saplingArea.add(0, 1, 0).getBlock().setType(Material.SAPLING);
|
||||
saplingArea.getBlock().setData(block.getData());
|
||||
}, 20 * 5);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -12,7 +12,7 @@ public class GearCommand extends CommandBase<GearManager>
|
||||
|
||||
public GearCommand(GearManager plugin)
|
||||
{
|
||||
super(plugin, Rank.ADMIN, new Rank[]{Rank.JNR_DEV}, "gear", "custom-gear");
|
||||
super(plugin, Rank.ADMIN, "gear", "custom-gear");
|
||||
_gearManager = plugin;
|
||||
}
|
||||
|
||||
|
@ -1,46 +0,0 @@
|
||||
package mineplex.game.clans.tutorials;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
public class DeployedTask implements Listener
|
||||
{
|
||||
protected Player _player;
|
||||
protected boolean _finished;
|
||||
|
||||
protected TutorialTask<?> _task;
|
||||
|
||||
protected boolean _dead;
|
||||
|
||||
public DeployedTask(Player player, TutorialTask<?> task)
|
||||
{
|
||||
_player = player;
|
||||
|
||||
_task = task;
|
||||
}
|
||||
|
||||
public void postDeploy()
|
||||
{
|
||||
}
|
||||
|
||||
public boolean checkForDeath()
|
||||
{
|
||||
return _dead || _player == null;
|
||||
}
|
||||
|
||||
public void finish()
|
||||
{
|
||||
onFinish();
|
||||
_task.finishFor(_player);
|
||||
}
|
||||
|
||||
public void kill()
|
||||
{
|
||||
_dead = true;
|
||||
_player = null;
|
||||
}
|
||||
|
||||
public void onFinish() {
|
||||
}
|
||||
|
||||
}
|
@ -29,7 +29,11 @@ import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.packethandler.IPacketHandler;
|
||||
import mineplex.core.packethandler.PacketHandler;
|
||||
import mineplex.core.packethandler.PacketInfo;
|
||||
import mineplex.core.scoreboard.ScoreboardManager;
|
||||
import mineplex.core.scoreboard.elements.ScoreboardElement;
|
||||
import mineplex.core.task.TaskManager;
|
||||
@ -38,6 +42,7 @@ import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.clans.event.ClanTipEvent;
|
||||
import mineplex.game.clans.economy.GoldManager;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutChat;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -53,6 +58,8 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
||||
public static String TUTORIAL_REWARD_TASK = "tatatatatat%sRewardGiven"; //do not change
|
||||
public static String SKIPPED_TASK = "tatatatata%sSkip";
|
||||
|
||||
public static String AllowedMessage = C.cGold + "TutorialAllowedMessage" + C.Reset;
|
||||
|
||||
protected final TutorialManager _manager;
|
||||
protected final GoldManager _goldManager;
|
||||
protected final ClansManager _clansManager;
|
||||
@ -75,7 +82,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
||||
protected int _gemReward = -1;
|
||||
protected int _coinReward = -1;
|
||||
|
||||
public Tutorial(final GoldManager goldManager, final TaskManager taskManager, final ClansManager clansManager, final DonationManager donationManager, final TutorialManager manager)
|
||||
public Tutorial(final GoldManager goldManager, final TaskManager taskManager, final ClansManager clansManager, final DonationManager donationManager, final TutorialManager manager, final PacketHandler packetHandler)
|
||||
{
|
||||
_clansManager = clansManager;
|
||||
_goldManager = goldManager;
|
||||
@ -144,40 +151,62 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
||||
|
||||
protected boolean hasFinishedTask(Player player, TutorialTask<?> task)
|
||||
{
|
||||
if (get(player).QueuedFinish)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return get(player).CurrentTask.getID() < task.getID();
|
||||
}
|
||||
|
||||
protected void finishTask(final Player player, final TutorialTask<?> task)
|
||||
{
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
get(player).LastDescriptionSentTime = 0;
|
||||
get(player).CurrentTask.visibleFinish(player);
|
||||
get(player).CurrentTask = task.equals(_tasks.get(_tasks.size())) ? null : _tasks.get(task.getID() + 1);
|
||||
|
||||
if (!_taskManager.hasCompletedTask(player, String.format(TASK_COMPLETE_TASK, _technicalName, task.getTechnicalName())))
|
||||
// 6 Seconds for player to read the finish message (sent by the line above)
|
||||
// (will be instant if get(player).CurrentTask.getFinishMessage() is null).
|
||||
_manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(_manager.getPlugin(), new Runnable()
|
||||
{
|
||||
_taskManager.completedTask(new Callback<Boolean>()
|
||||
public void run()
|
||||
{
|
||||
public void run(final Boolean completed)
|
||||
// Cycle to next task, or null if last task.
|
||||
get(player).CurrentTask = task.equals(_tasks.get(_tasks.size())) ? null : _tasks.get(task.getID() + 1);
|
||||
|
||||
if (!_taskManager.hasCompletedTask(player, String.format(TASK_COMPLETE_TASK, _technicalName, task.getTechnicalName())))
|
||||
{
|
||||
if (task.equals(_tasks.get(_tasks.size())))
|
||||
_taskManager.completedTask(new Callback<Boolean>()
|
||||
{
|
||||
finishFor(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
_manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(_manager.getPlugin(), new Runnable()
|
||||
public void run(final Boolean completed)
|
||||
{
|
||||
public void run()
|
||||
// If last task, end tutorial.
|
||||
if (task.equals(_tasks.get(_tasks.size())))
|
||||
{
|
||||
get(player).CurrentTask.deploy(player);
|
||||
finishFor(player);
|
||||
}
|
||||
}, 10L);
|
||||
}
|
||||
|
||||
player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1.5f);
|
||||
else
|
||||
{
|
||||
// Start next task in 1.5 Seconds (just to give a more smooth feel to the tutorial)
|
||||
_manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(_manager.getPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
get(player).CurrentTask.startFor(player);
|
||||
}
|
||||
}, 30L);
|
||||
}
|
||||
|
||||
player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1.5f);
|
||||
}
|
||||
}, player, String.format(TASK_COMPLETE_TASK, _technicalName, task.getTechnicalName()));
|
||||
}
|
||||
}, player, String.format(TASK_COMPLETE_TASK, _technicalName, task.getTechnicalName()));
|
||||
}
|
||||
}
|
||||
}, get(player).CurrentTask._finishMessage == null ? 1L : 6 * 20L);
|
||||
}
|
||||
|
||||
public TutorialTask<?> getTask(final String technicalName)
|
||||
@ -223,77 +252,95 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
||||
|
||||
private void finishFor(final Player player)
|
||||
{
|
||||
if (player.getOpenInventory() != null)
|
||||
{
|
||||
_inTutorial.get(player.getName()).QueuedFinish = true;
|
||||
return;
|
||||
}
|
||||
|
||||
_inTutorial.remove(player.getName());
|
||||
|
||||
UtilFirework.launchFirework(player.getLocation(), Type.BALL_LARGE, Color.LIME, false, false, new Vector(0, 0, 0), 1);
|
||||
onFinished(player);
|
||||
|
||||
if (!_taskManager.hasCompletedTask(player, String.format(TUTORIAL_REWARD_TASK, _technicalName)))
|
||||
UtilTextMiddle.display(C.cWhite + "Clans Tutorial", C.cGreen + "You have completed the Clans Tutorial!", 20, 20 * 3, 20);
|
||||
|
||||
_manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(_manager.getPlugin(), new Runnable()
|
||||
{
|
||||
_taskManager.completedTask(new Callback<Boolean>()
|
||||
public void run()
|
||||
{
|
||||
@Override
|
||||
public void run(Boolean data)
|
||||
// Custom Finish Method (usually messages)
|
||||
onFinished(player);
|
||||
|
||||
// Do Reward
|
||||
if (!_taskManager.hasCompletedTask(player, String.format(TUTORIAL_REWARD_TASK, _technicalName)))
|
||||
{
|
||||
if (_goldReward != -1)
|
||||
_taskManager.completedTask(new Callback<Boolean>()
|
||||
{
|
||||
_goldManager.addGold(player, _goldReward);
|
||||
UtilPlayer.message(player, F.main("Tutorials", "You have been awarded " + F.elem(_goldReward + " Gold") + "."));
|
||||
}
|
||||
|
||||
if (_gemReward != -1)
|
||||
{
|
||||
_donationManager.RewardGems(new Callback<Boolean>() {
|
||||
public void run(Boolean data)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Tutorials", "You have been awarded " + F.elem(_goldReward + " Gems") + "."));
|
||||
}
|
||||
}, "Clans", player.getName(), player.getUniqueId(), _gemReward);
|
||||
}
|
||||
|
||||
if (_coinReward != -1)
|
||||
{
|
||||
_donationManager.RewardCoins(new Callback<Boolean>() {
|
||||
public void run(Boolean data)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Tutorials", "You have been awarded " + F.elem(_coinReward + " Coins") + "."));
|
||||
}
|
||||
}, "Clans", player.getName(), _clansManager.getClientManager().getAccountId(player), _coinReward);
|
||||
}
|
||||
}
|
||||
}, player, String.format(TUTORIAL_REWARD_TASK, _technicalName));
|
||||
|
||||
}
|
||||
|
||||
if (!_taskManager.hasCompletedTask(player, String.format(TUTORIAL_COMPLETE_TASK, _technicalName)))
|
||||
{
|
||||
_taskManager.completedTask(new Callback<Boolean>()
|
||||
{
|
||||
public void run(final Boolean completed)
|
||||
{
|
||||
if (_ghostMode)
|
||||
{
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
@Override
|
||||
public void run(Boolean data)
|
||||
{
|
||||
other.showPlayer(player);
|
||||
player.showPlayer(other);
|
||||
if (_goldReward != -1)
|
||||
{
|
||||
_goldManager.addGold(player, _goldReward);
|
||||
_manager.sendTutorialMsg(player, F.main("Tutorials", "You have been awarded " + F.elem(_goldReward + " Gold") + "."));
|
||||
}
|
||||
|
||||
if (_gemReward != -1)
|
||||
{
|
||||
_donationManager.RewardGems(new Callback<Boolean>() {
|
||||
public void run(Boolean data)
|
||||
{
|
||||
_manager.sendTutorialMsg(player, F.main("Tutorials", "You have been awarded " + F.elem(_goldReward + " Gems") + "."));
|
||||
}
|
||||
}, "Clans", player.getName(), player.getUniqueId(), _gemReward);
|
||||
}
|
||||
|
||||
if (_coinReward != -1)
|
||||
{
|
||||
_donationManager.RewardCoins(new Callback<Boolean>() {
|
||||
public void run(Boolean data)
|
||||
{
|
||||
_manager.sendTutorialMsg(player, F.main("Tutorials", "You have been awarded " + F.elem(_coinReward + " Coins") + "."));
|
||||
}
|
||||
}, "Clans", player.getName(), _clansManager.getClientManager().getAccountId(player), _coinReward);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
final int index = i;
|
||||
_manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(_manager.getPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
UtilFirework.launchFirework(player.getLocation(), Type.BALL_LARGE, (index % 2 == 0) ? Color.RED : Color.LIME, false, false, new Vector(0, 0, 0), 0);
|
||||
}
|
||||
}, i * 10);
|
||||
}
|
||||
}, player, String.format(TUTORIAL_REWARD_TASK, _technicalName));
|
||||
}
|
||||
}, player, String.format(TUTORIAL_COMPLETE_TASK, _technicalName));
|
||||
}
|
||||
|
||||
_manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(_manager.getPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
// Sets the tutorial as complete in the TaskManager and effects.
|
||||
_taskManager.completedTask(new Callback<Boolean>()
|
||||
{
|
||||
public void run(final Boolean completed)
|
||||
{
|
||||
if (_ghostMode)
|
||||
{
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
{
|
||||
other.showPlayer(player);
|
||||
player.showPlayer(other);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
final int index = i;
|
||||
_manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(_manager.getPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
UtilFirework.launchFirework(player.getLocation(), Type.BALL_LARGE, (index % 2 == 0) ? Color.RED : Color.LIME, false, false, new Vector(0, 0, 0), 0);
|
||||
}
|
||||
}, i * 10);
|
||||
}
|
||||
}
|
||||
}, player, String.format(TUTORIAL_COMPLETE_TASK, _technicalName));
|
||||
}
|
||||
}, 20 * 2);
|
||||
}
|
||||
}, 20 * 4);
|
||||
}
|
||||
|
||||
// Implementation left to sub classes.
|
||||
@ -315,7 +362,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
||||
|
||||
_inTutorial.put(player.getName(), new TutorialClient(player, this));
|
||||
|
||||
get(player).CurrentTask.deploy(player);
|
||||
get(player).CurrentTask.startFor(player);
|
||||
|
||||
player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1.5f);
|
||||
|
||||
@ -373,6 +420,9 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
||||
public void skip(final Player player)
|
||||
{
|
||||
new JsonMessage(
|
||||
AllowedMessage
|
||||
)
|
||||
.extra(
|
||||
F.main(
|
||||
"Tutorial",
|
||||
"Are you sure you want to skip the tutorial? We "
|
||||
@ -443,6 +493,19 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
||||
{
|
||||
if (isInTutorial(player))
|
||||
{
|
||||
if (get(player).QueuedFinish)
|
||||
{
|
||||
if (player.getOpenInventory() == null)
|
||||
{
|
||||
get(player).QueuedFinish = false;
|
||||
finishFor(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
get(player).CurrentTask.trySendDescription(player);
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,8 @@ public class TutorialClient
|
||||
public Player Player;
|
||||
public TutorialTask<?> CurrentTask;
|
||||
public long LastDescriptionSentTime = System.currentTimeMillis() - 3000;
|
||||
public boolean InClanOnStart;
|
||||
public boolean QueuedFinish;
|
||||
|
||||
public TutorialClient(Player player, Tutorial tutorial)
|
||||
{
|
||||
@ -16,11 +18,15 @@ public class TutorialClient
|
||||
|
||||
CurrentTask = tutorial._tasks.get(1);
|
||||
|
||||
InClanOnStart = tutorial._clansManager.isInClan(player);
|
||||
|
||||
for (TutorialTask<?> task : tutorial._tasks.values())
|
||||
{
|
||||
if (TaskManager.Instance.hasCompletedTask(player, String.format(
|
||||
Tutorial.TASK_COMPLETE_TASK,
|
||||
task.getTutorial().getTechnicalName(), task.getTechnicalName())))
|
||||
task.getTutorial().getTechnicalName(),
|
||||
task.getTechnicalName()
|
||||
)))
|
||||
{
|
||||
if (CurrentTask.getID() <= task.getID())
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
package mineplex.game.clans.tutorials;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
@ -12,6 +13,9 @@ import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.packethandler.IPacketHandler;
|
||||
import mineplex.core.packethandler.PacketHandler;
|
||||
import mineplex.core.packethandler.PacketInfo;
|
||||
import mineplex.core.preferences.PreferencesManager;
|
||||
import mineplex.core.task.TaskManager;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
@ -20,6 +24,8 @@ import mineplex.game.clans.economy.GoldManager;
|
||||
import mineplex.game.clans.tutorials.commands.DoSkipTutorialCommand;
|
||||
import mineplex.game.clans.tutorials.commands.SkipTutorialCommand;
|
||||
import mineplex.game.clans.tutorials.gettingstarted.TutorialGettingStarted;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutChat;
|
||||
|
||||
public class TutorialManager extends MiniPlugin
|
||||
{
|
||||
@ -30,7 +36,7 @@ public class TutorialManager extends MiniPlugin
|
||||
|
||||
private final TaskManager _taskManager;
|
||||
|
||||
public TutorialManager(final JavaPlugin plugin, final GoldManager goldManager, final TaskManager taskManager, final DonationManager donationManager, final PreferencesManager preferencesManager, final ClansManager clansManager)
|
||||
public TutorialManager(final JavaPlugin plugin, final GoldManager goldManager, final TaskManager taskManager, final DonationManager donationManager, final PreferencesManager preferencesManager, final ClansManager clansManager, final PacketHandler packetHandler)
|
||||
{
|
||||
super("Tutorials", plugin);
|
||||
|
||||
@ -38,7 +44,37 @@ public class TutorialManager extends MiniPlugin
|
||||
|
||||
_taskManager = taskManager;
|
||||
|
||||
_tutorials.put(TutorialGettingStarted.class, new TutorialGettingStarted(this, clansManager, donationManager, goldManager,taskManager));
|
||||
_tutorials.put(TutorialGettingStarted.class, new TutorialGettingStarted(this, clansManager, donationManager, goldManager, taskManager, packetHandler));
|
||||
|
||||
packetHandler.addPacketHandler(new IPacketHandler() {
|
||||
public void handle(PacketInfo packet)
|
||||
{
|
||||
if (packet.getPacket() instanceof PacketPlayOutChat)
|
||||
{
|
||||
PacketPlayOutChat chat = (PacketPlayOutChat) packet.getPacket();
|
||||
|
||||
if (chat.b == 1)
|
||||
{
|
||||
if (chat.a.a().isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (chat.a.a().get(0).c().equals(ChatColor.stripColor(Tutorial.AllowedMessage)))
|
||||
{
|
||||
chat.a.a().remove(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isInTutorial(packet.getPlayer()))
|
||||
{
|
||||
packet.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}, PacketPlayOutChat.class);
|
||||
}
|
||||
|
||||
public void addCommands()
|
||||
@ -58,7 +94,6 @@ public class TutorialManager extends MiniPlugin
|
||||
if (_tutorials.containsKey(tutorial))
|
||||
{
|
||||
_tutorials.get(tutorial).startFor(player);
|
||||
_playerTutorials.put(player.getName(), _tutorials.get(tutorial));
|
||||
|
||||
return isInTutorial(player);
|
||||
}
|
||||
@ -78,7 +113,7 @@ public class TutorialManager extends MiniPlugin
|
||||
getTutorial(player).cancelFor(player);
|
||||
|
||||
|
||||
UtilPlayer.message(player, F.main("Tutorials", "You have cancelled the " + F.elem(getTutorial(player)._displayName + " Tutorial") + "."));
|
||||
sendTutorialMsg(player, F.main("Tutorials", "You have cancelled the " + F.elem(getTutorial(player)._displayName + " Tutorial") + "."));
|
||||
_playerTutorials.remove(player.getName());
|
||||
}
|
||||
}
|
||||
@ -95,7 +130,7 @@ public class TutorialManager extends MiniPlugin
|
||||
{
|
||||
if (isInTutorial(player))
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Tutorials", "You have skipped the " + F.elem(getTutorial(player)._displayName + " Tutorial") + "."));
|
||||
sendTutorialMsg(player, F.main("Tutorials", "You have skipped the " + F.elem(getTutorial(player)._displayName + " Tutorial") + "."));
|
||||
getTutorial(player).doSkip(player);
|
||||
}
|
||||
}
|
||||
@ -109,6 +144,19 @@ public class TutorialManager extends MiniPlugin
|
||||
getTutorial(event.getPlayer()).cleanup(event.getPlayer());
|
||||
}
|
||||
|
||||
public void sendTutorialMsg(Player player, String message)
|
||||
{
|
||||
player.sendMessage(Tutorial.AllowedMessage + message);
|
||||
}
|
||||
|
||||
public void sendTutorialMsg(Player player, LinkedList<String> messages)
|
||||
{
|
||||
for (String message : messages)
|
||||
{
|
||||
sendTutorialMsg(player, message);
|
||||
}
|
||||
}
|
||||
|
||||
public Tutorial getTutorial(final Player player)
|
||||
{
|
||||
return _playerTutorials.get(player.getName());
|
||||
|
@ -1,25 +1,18 @@
|
||||
package mineplex.game.clans.tutorials;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.NautArrayList;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
|
||||
public class TutorialTask<T extends Tutorial> implements Listener
|
||||
{
|
||||
private T _tutorial;
|
||||
protected T _tutorial;
|
||||
|
||||
protected long _autoCompleteTime = -1;
|
||||
|
||||
@ -29,13 +22,17 @@ public class TutorialTask<T extends Tutorial> implements Listener
|
||||
protected String _description;
|
||||
protected String _finishMessage;
|
||||
|
||||
protected Location _taskPos;
|
||||
|
||||
// How much time after the beginning the task/last teleport it should take to teleport back to _taskPos.
|
||||
protected int _taskTpDelay = 2 * 60 * 20;
|
||||
|
||||
protected long _descriptionWaitTime = 30000;
|
||||
|
||||
private List<String> _playersFinished = new ArrayList<>();
|
||||
|
||||
private Map<String, DeployedTask> _deployedInstances = new HashMap<>();
|
||||
private List<DeployedTask> _toCull = new ArrayList<>();
|
||||
protected NautArrayList<String> _playersFinished = new NautArrayList<>();
|
||||
protected NautArrayList<String> _inTask = new NautArrayList<>();
|
||||
|
||||
private long _lastTaskTp;
|
||||
private int _id;
|
||||
|
||||
public TutorialTask(T tutorial, int id)
|
||||
@ -46,32 +43,58 @@ public class TutorialTask<T extends Tutorial> implements Listener
|
||||
UtilServer.getServer().getPluginManager().registerEvents(this, _tutorial._manager.getPlugin());
|
||||
}
|
||||
|
||||
protected DeployedTask deploy(final Player player)
|
||||
protected void customStartFor(final Player player)
|
||||
{
|
||||
DeployedTask task = customDeploy(player);
|
||||
|
||||
_deployedInstances.put(player.getName(), task);
|
||||
|
||||
UtilServer.getServer().getPluginManager().registerEvents(task, _tutorial._manager.getPlugin());
|
||||
}
|
||||
|
||||
protected void customEndFor(final Player player)
|
||||
{
|
||||
}
|
||||
|
||||
protected final void startFor(final Player player)
|
||||
{
|
||||
_inTask.add(player.getName());
|
||||
|
||||
trySendDescription(player);
|
||||
|
||||
customStartFor(player);
|
||||
|
||||
if (_taskPos != null)
|
||||
{
|
||||
player.teleport(_taskPos);
|
||||
_lastTaskTp = System.currentTimeMillis();
|
||||
if (_taskTpDelay != -1)
|
||||
{
|
||||
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(_tutorial._manager.getPlugin(), new Runnable(){
|
||||
public void run()
|
||||
{
|
||||
if (isDoing(player))
|
||||
{
|
||||
player.teleport(_taskPos);
|
||||
_lastTaskTp = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
}, _taskTpDelay);
|
||||
}
|
||||
}
|
||||
|
||||
if (_autoCompleteTime != -1)
|
||||
{
|
||||
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(_tutorial._manager.getPlugin(), new Runnable(){
|
||||
public void run()
|
||||
{
|
||||
if (_deployedInstances.containsKey(player.getName()))
|
||||
if (isDoing(player))
|
||||
{
|
||||
finishFor(player);
|
||||
}
|
||||
}
|
||||
}, _autoCompleteTime);
|
||||
}
|
||||
|
||||
task.postDeploy();
|
||||
|
||||
return task;
|
||||
}
|
||||
|
||||
public boolean isDoing(Player player)
|
||||
{
|
||||
return _inTask != null && player != null && _inTask.contains(player.getName());
|
||||
}
|
||||
|
||||
public void trySendDescription(Player player)
|
||||
@ -83,34 +106,38 @@ public class TutorialTask<T extends Tutorial> implements Listener
|
||||
|
||||
TutorialClient client = _tutorial.get(player);
|
||||
|
||||
if (client.QueuedFinish)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (System.currentTimeMillis() - client.LastDescriptionSentTime > client.CurrentTask.getDescriptionWaitTime())
|
||||
{
|
||||
UtilPlayer.message(player, " ");
|
||||
UtilPlayer.message(player, " ");
|
||||
UtilPlayer.message(player, " ");
|
||||
UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||
UtilPlayer.message(player, " ");
|
||||
UtilPlayer.message(player, C.cYellowB + "Part " + _id + ": " + _displayName);
|
||||
UtilPlayer.message(player, C.cWhite + _description.replace("{", C.cAqua).replace("}", C.cWhite));
|
||||
UtilPlayer.message(player, " ");
|
||||
UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||
_tutorial._manager.sendTutorialMsg(player, " ");
|
||||
_tutorial._manager.sendTutorialMsg(player, " ");
|
||||
_tutorial._manager.sendTutorialMsg(player, " ");
|
||||
_tutorial._manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||
_tutorial._manager.sendTutorialMsg(player, " ");
|
||||
_tutorial._manager.sendTutorialMsg(player, C.cYellowB + "Part " + _id + ": " + _displayName);
|
||||
_tutorial._manager.sendTutorialMsg(player, C.cWhite + " " + _description.replace("{", C.cAqua).replace("}", C.cWhite));
|
||||
_tutorial._manager.sendTutorialMsg(player, " ");
|
||||
_tutorial._manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||
|
||||
UtilTextMiddle.display("", getDisplayName());
|
||||
|
||||
client.LastDescriptionSentTime = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
|
||||
protected DeployedTask customDeploy(final Player player)
|
||||
{
|
||||
return new DeployedTask(player, this);
|
||||
}
|
||||
|
||||
public final void startFor(Player player)
|
||||
{
|
||||
deploy(player);
|
||||
}
|
||||
|
||||
public final boolean hasFinished(final Player player)
|
||||
{
|
||||
return _playersFinished.contains(player.getName());
|
||||
if (_tutorial.get(player).QueuedFinish)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// CurrentTask will be null if player has finished tutorial
|
||||
return _tutorial.get(player).CurrentTask == null || _tutorial.get(player).CurrentTask.getID() < getID();
|
||||
}
|
||||
|
||||
public String getDisplayName()
|
||||
@ -133,6 +160,16 @@ public class TutorialTask<T extends Tutorial> implements Listener
|
||||
return _technicalName;
|
||||
}
|
||||
|
||||
public TutorialManager getManager()
|
||||
{
|
||||
return _tutorial._manager;
|
||||
}
|
||||
|
||||
public ClansManager getClans()
|
||||
{
|
||||
return _tutorial._clansManager;
|
||||
}
|
||||
|
||||
public int getID()
|
||||
{
|
||||
return _id;
|
||||
@ -140,52 +177,30 @@ public class TutorialTask<T extends Tutorial> implements Listener
|
||||
|
||||
public void finishFor(Player player)
|
||||
{
|
||||
customEndFor(player);
|
||||
_tutorial.finishTask(player, this);
|
||||
}
|
||||
|
||||
public void visibleFinish(Player player)
|
||||
{
|
||||
_deployedInstances.get(player.getName()).kill();
|
||||
_toCull.add(_deployedInstances.get(player.getName()));
|
||||
_deployedInstances.remove(player.getName());
|
||||
_inTask.remove(player.getName());
|
||||
|
||||
if (_finishMessage != null)
|
||||
{
|
||||
UtilPlayer.message(player, " ");
|
||||
UtilPlayer.message(player, " ");
|
||||
UtilPlayer.message(player, " ");
|
||||
UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||
UtilPlayer.message(player, " ");
|
||||
UtilPlayer.message(player, C.cWhite + _finishMessage.replace("{", C.cAqua).replace("}", C.cWhite));
|
||||
UtilPlayer.message(player, " ");
|
||||
UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void update(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Iterator<DeployedTask> iterator = _toCull.iterator();
|
||||
|
||||
while(iterator.hasNext())
|
||||
{
|
||||
DeployedTask task = iterator.next();
|
||||
|
||||
task.kill();
|
||||
HandlerList.unregisterAll(task);
|
||||
iterator.remove();
|
||||
_tutorial._manager.sendTutorialMsg(player, " ");
|
||||
_tutorial._manager.sendTutorialMsg(player, " ");
|
||||
_tutorial._manager.sendTutorialMsg(player, " ");
|
||||
_tutorial._manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||
_tutorial._manager.sendTutorialMsg(player, " ");
|
||||
_tutorial._manager.sendTutorialMsg(player, C.cWhite + _finishMessage.replace("{", C.cAqua).replace("}", C.cWhite));
|
||||
_tutorial._manager.sendTutorialMsg(player, " ");
|
||||
_tutorial._manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||
}
|
||||
}
|
||||
|
||||
public void cleanup(Player player)
|
||||
{
|
||||
_deployedInstances.get(player.getName()).kill();
|
||||
_toCull.add(_deployedInstances.get(player.getName()));
|
||||
_inTask.remove(player.getName());
|
||||
_playersFinished.remove(player.getName());
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ public class SkipTutorialCommand extends CommandBase<TutorialManager>
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Tutorials", "You are not currently in a tutorial."));
|
||||
Plugin.sendTutorialMsg(caller, F.main("Tutorials", "You are not currently in a tutorial."));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,11 @@
|
||||
package mineplex.game.clans.tutorials.gettingstarted;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.clans.event.ClansCommandExecutedEvent;
|
||||
import mineplex.game.clans.tutorials.DeployedTask;
|
||||
import mineplex.game.clans.clans.event.PlayerPreClaimTerritoryEvent;
|
||||
import mineplex.game.clans.tutorials.TutorialTask;
|
||||
|
||||
public class TaskClaim extends TutorialTask<TutorialGettingStarted>
|
||||
@ -21,42 +20,24 @@ public class TaskClaim extends TutorialTask<TutorialGettingStarted>
|
||||
_description = "Clans can claim 16x16 areas of Territory! "
|
||||
+ "Once claimed, only your Clan can break/place blocks here. "
|
||||
+ "This is the perfect place to build a base and stash your items! "
|
||||
+ "You can only claim in the Wilderness, and not next to other Clans Territory. "
|
||||
+ "Claim some Territory now, by typing {/c claim}!";
|
||||
+ "You can only claim in the Wilderness, and not next to other Clan's Territory. "
|
||||
+ "To claim some territory, go into the Clans GUI by typing {/c} and {Left-Clicking}";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeployedTask customDeploy(Player player)
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onClansCommand(PlayerPreClaimTerritoryEvent event)
|
||||
{
|
||||
return new Deployed(player, this);
|
||||
}
|
||||
|
||||
class Deployed extends DeployedTask
|
||||
{
|
||||
public Deployed(Player player, TutorialTask<?> task)
|
||||
if (!isDoing(event.getClaimer()))
|
||||
{
|
||||
super(player, task);
|
||||
return;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onClansCommand(ClansCommandExecutedEvent event)
|
||||
if (!ClansManager.getInstance().isInClan(event.getClaimer()))
|
||||
{
|
||||
if (!_player.equals(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ClansManager.getInstance().isInClan(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getCommand().equals("claim"))
|
||||
{
|
||||
_task.finishFor(_player);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
finishFor(event.getClaimer());
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4,8 +4,8 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.game.clans.clans.event.ClanCreatedEvent;
|
||||
import mineplex.game.clans.tutorials.DeployedTask;
|
||||
import mineplex.game.clans.tutorials.TutorialTask;
|
||||
|
||||
public class TaskCreateClan extends TutorialTask<TutorialGettingStarted>
|
||||
@ -17,32 +17,36 @@ public class TaskCreateClan extends TutorialTask<TutorialGettingStarted>
|
||||
_displayName = "Create a Clan";
|
||||
_technicalName = "ClanCreation";
|
||||
|
||||
_description = "Before beginning, use the {/c create <ClanName>} command to start up your own Clan! ";
|
||||
_description = "Before beginning, use the {/c create <ClanName>} command to start up your own Clan! "
|
||||
+ "If you are already in a Clan, don't worry, you will automatically skip this part.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeployedTask customDeploy(Player player)
|
||||
public void customStartFor(final Player player)
|
||||
{
|
||||
return new Deployed(player, this);
|
||||
if (_tutorial.get(player).InClanOnStart)
|
||||
{
|
||||
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(getManager().getPlugin(), new Runnable(){
|
||||
public void run()
|
||||
{
|
||||
if (isDoing(player))
|
||||
{
|
||||
finishFor(player);
|
||||
}
|
||||
}
|
||||
}, 6 * 20);
|
||||
}
|
||||
}
|
||||
|
||||
class Deployed extends DeployedTask
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onClanCreated(ClanCreatedEvent event)
|
||||
{
|
||||
public Deployed(Player player, TutorialTask<?> task)
|
||||
if (!isDoing(event.getFounder()))
|
||||
{
|
||||
super(player, task);
|
||||
return;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onClanCreated(ClanCreatedEvent event)
|
||||
{
|
||||
if (!_player.equals(event.getFounder()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_task.finishFor(_player);
|
||||
}
|
||||
finishFor(event.getFounder());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
package mineplex.game.clans.tutorials.gettingstarted;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -9,7 +12,6 @@ import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.spawn.Spawn;
|
||||
import mineplex.game.clans.tutorials.DeployedTask;
|
||||
import mineplex.game.clans.tutorials.TutorialTask;
|
||||
import mineplex.minecraft.game.classcombat.Class.ClientClass;
|
||||
|
||||
@ -23,46 +25,29 @@ public class TaskCustomizeClass extends TutorialTask<TutorialGettingStarted>
|
||||
_technicalName = "CustomizeKlass";
|
||||
|
||||
_description = "Now that you have equipped a class, use this enchantment table to customize your class builds. "
|
||||
+ "Click on the enchantment table, and click the edit build button.";
|
||||
+ "Click on the enchantment table, and click the edit build button. "
|
||||
+ "Make sure to select an axe ability to try out in the next task!";
|
||||
|
||||
_taskPos = new Location(Spawn.getSpawnWorld(), 6, 66, -300, -180f, 0f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeployedTask customDeploy(Player player)
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onUpdate(final UpdateEvent event)
|
||||
{
|
||||
return new Deployed(player, this);
|
||||
}
|
||||
|
||||
class Deployed extends DeployedTask
|
||||
{
|
||||
public Deployed(Player player, TutorialTask<?> task)
|
||||
if (!event.getType().equals(UpdateType.SEC))
|
||||
{
|
||||
super(player, task);
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postDeploy()
|
||||
Iterator<String> iterator = _inTask.iterator();
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
_player.teleport(new Location(Spawn.getSpawnWorld(), 6, 66, -300, -180f, 0f));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onUpdate(final UpdateEvent event)
|
||||
{
|
||||
if (!event.getType().equals(UpdateType.SEC))
|
||||
{
|
||||
return;
|
||||
}
|
||||
Player player = Bukkit.getPlayer(iterator.next());
|
||||
final ClientClass clientclass = ClansManager.getInstance().getClassManager().Get(player);
|
||||
|
||||
if (checkForDeath())
|
||||
if (clientclass != null && clientclass.GetSavingCustomBuild() != null && clientclass.GetSavingCustomBuild().AxeSkill != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final ClientClass clientclass = ClansManager.getInstance().getClassManager().Get(_player);
|
||||
|
||||
if (clientclass != null && clientclass.GetSavingCustomBuild() != null)
|
||||
{
|
||||
_task.finishFor(_player);
|
||||
finishFor(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,8 +3,8 @@ package mineplex.game.clans.tutorials.gettingstarted;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.game.clans.clans.event.ClanDisbandedEvent;
|
||||
import mineplex.game.clans.tutorials.DeployedTask;
|
||||
import mineplex.game.clans.tutorials.TutorialTask;
|
||||
|
||||
public class TaskDisbandClan extends TutorialTask<TutorialGettingStarted>
|
||||
@ -18,31 +18,35 @@ public class TaskDisbandClan extends TutorialTask<TutorialGettingStarted>
|
||||
|
||||
_description = "Finally, let's disband your Clan to end the Tutorial. "
|
||||
+ "Simply type {/c disband} to do this. "
|
||||
+ "This will delete your Clan, and you'll be able to create or join a new one!";
|
||||
+ "This will delete your Clan, and you'll be able to create or join a new one! "
|
||||
+ "If you were already in a Clan before you originally begun the Tutorial, you will automatically skip this part.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeployedTask customDeploy(Player player)
|
||||
public void customStartFor(final Player player)
|
||||
{
|
||||
return new Deployed(player, this);
|
||||
if (_tutorial.get(player).InClanOnStart)
|
||||
{
|
||||
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(getManager().getPlugin(), new Runnable(){
|
||||
public void run()
|
||||
{
|
||||
if (isDoing(player))
|
||||
{
|
||||
finishFor(player);
|
||||
}
|
||||
}
|
||||
}, 6 * 20);
|
||||
}
|
||||
}
|
||||
|
||||
class Deployed extends DeployedTask
|
||||
@EventHandler
|
||||
public void sell(ClanDisbandedEvent event)
|
||||
{
|
||||
public Deployed(Player player, TutorialTask<?> task)
|
||||
if (!isDoing(event.getDisbander()))
|
||||
{
|
||||
super(player, task);
|
||||
return;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void sell(ClanDisbandedEvent event)
|
||||
{
|
||||
if (!_player.equals(event.getDisbander()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_task.finishFor(_player);
|
||||
}
|
||||
finishFor(event.getDisbander());
|
||||
}
|
||||
}
|
||||
|
@ -1,21 +1,18 @@
|
||||
package mineplex.game.clans.tutorials.gettingstarted;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.NautArrayList;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilItem;
|
||||
import mineplex.core.task.TaskManager;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.clans.event.ClansPlayerBuyItemEvent;
|
||||
import mineplex.game.clans.clans.event.ClansShopAddButtonEvent;
|
||||
import mineplex.game.clans.spawn.Spawn;
|
||||
import mineplex.game.clans.tutorials.DeployedTask;
|
||||
import mineplex.game.clans.tutorials.TutorialTask;
|
||||
import mineplex.minecraft.game.classcombat.Class.event.ClassEquipEvent;
|
||||
|
||||
@ -30,87 +27,83 @@ public class TaskEquipClass extends TutorialTask<TutorialGettingStarted>
|
||||
|
||||
_description = "Use the PvP Gear shop, and right-click the Villager. "
|
||||
+ "Purchase Iron Armor from the PvP Shop. "
|
||||
+ "Then put on your armor to equip a Champion’s Class.";
|
||||
+ "Then put on your armor to equip the Knight Class.";
|
||||
|
||||
_taskPos = new Location(Spawn.getSpawnWorld(), 19, 66, -305.844, -100f, 0f);
|
||||
}
|
||||
|
||||
private NautHashMap<String, NautArrayList<Material>> _bought = new NautHashMap<>();
|
||||
|
||||
@EventHandler
|
||||
public void onClassEquipped(ClassEquipEvent event)
|
||||
{
|
||||
if (!isDoing(event.getUser()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
finishFor(event.getUser());
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeployedTask customDeploy(Player player)
|
||||
public void customEndFor(Player player)
|
||||
{
|
||||
return new Deployed(player, this);
|
||||
_bought.get(player.getName()).clear();
|
||||
_bought.remove(player.getName());
|
||||
}
|
||||
|
||||
class Deployed extends DeployedTask
|
||||
@Override
|
||||
public void customStartFor(Player player)
|
||||
{
|
||||
private List<Material> _bought = new ArrayList<>();
|
||||
|
||||
public Deployed(Player player, TutorialTask<?> task)
|
||||
_bought.put(player.getName(), new NautArrayList<Material>());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void button(ClansShopAddButtonEvent event)
|
||||
{
|
||||
if (!isDoing(event.getPlayer()))
|
||||
{
|
||||
super(player, task);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(UtilItem.isArmor(event.getMaterial()) && UtilItem.isIronProduct(event.getMaterial())))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postDeploy()
|
||||
if (!TaskManager.Instance.hasCompletedTask(event.getPlayer(), "tuttoooooe" + event.getMaterial().name()) && !_bought.get(event.getPlayer().getName()).contains(event.getMaterial()))
|
||||
{
|
||||
_player.teleport(new Location(Spawn.getSpawnWorld(), 19, 66, -305.844, -100f, 0f));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onClassEquipped(ClassEquipEvent event)
|
||||
{
|
||||
if (!ClansManager.getInstance().getClassManager().Get(_player).equals(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_task.finishFor(_player);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void button(ClansShopAddButtonEvent event)
|
||||
{
|
||||
if (!_player.equals(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(UtilItem.isArmor(event.getMaterial()) && UtilItem.isIronProduct(event.getMaterial())))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!TaskManager.Instance.hasCompletedTask(event.getPlayer(), "tuttoooooe" + event.getMaterial().name()) && !_bought.contains(event.getMaterial()))
|
||||
{
|
||||
event.setBuyPrice(0);
|
||||
event.setSellPrice(0);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void buy(final ClansPlayerBuyItemEvent event)
|
||||
{
|
||||
if (!_player.equals(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(UtilItem.isArmor(event.getItem().getType()) && UtilItem.isIronProduct(event.getItem().getType())))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getCost() == 0 && _bought.contains(event.getItem().getType()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
TaskManager.Instance.completedTask(new Callback<Boolean>() {
|
||||
@Override
|
||||
public void run(Boolean data)
|
||||
{
|
||||
}
|
||||
}, event.getPlayer(), "tuttoooooe" + event.getItem().getType().name());
|
||||
_bought.add(event.getItem().getType());
|
||||
event.setBuyPrice(0);
|
||||
event.setSellPrice(0);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void buy(final ClansPlayerBuyItemEvent event)
|
||||
{
|
||||
if (!isDoing(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(UtilItem.isArmor(event.getItem().getType()) && UtilItem.isIronProduct(event.getItem().getType())))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getCost() == 0 && _bought.get(event.getPlayer().getName()).contains(event.getItem().getType()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
TaskManager.Instance.completedTask(new Callback<Boolean>() {
|
||||
@Override
|
||||
public void run(Boolean data)
|
||||
{
|
||||
}
|
||||
}, event.getPlayer(), "tuttoooooe" + event.getItem().getType().name());
|
||||
|
||||
_bought.get(event.getPlayer().getName()).add(event.getItem().getType());
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
package mineplex.game.clans.tutorials.gettingstarted;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -9,7 +12,6 @@ import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.clans.event.EnergyPageBuildEvent;
|
||||
import mineplex.game.clans.spawn.Spawn;
|
||||
import mineplex.game.clans.tutorials.DeployedTask;
|
||||
import mineplex.game.clans.tutorials.TutorialTask;
|
||||
|
||||
public class TaskExploreShops extends TutorialTask<TutorialGettingStarted>
|
||||
@ -23,65 +25,60 @@ public class TaskExploreShops extends TutorialTask<TutorialGettingStarted>
|
||||
|
||||
_description = "Welcome to the Shops! Here you can buy all kinds of things that you may require during your adventure. "
|
||||
+ "You can also sell certain items to the Villagers to make a bit of extra Gold. "
|
||||
+ "Clan Energy is required to maintain the clan, without it, you will lose all claimed Territory! "
|
||||
+ "Go to the Energy Shop and buy {Max Energy}. (FREE)";
|
||||
|
||||
_finishMessage = "Great! "
|
||||
+ "Clans use energy to control Territory. "
|
||||
+ "More territory will cause your energy to drain faster, so make sure you remember to refill it regularly!";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeployedTask customDeploy(Player player)
|
||||
public void customStartFor(Player player)
|
||||
{
|
||||
return new Deployed(player, this);
|
||||
player.teleport(new Location(Spawn.getSpawnWorld(), 17, 66.5, -330, -180f, 0f));
|
||||
|
||||
ClansManager.getInstance().getClan(player).adjustEnergy(-(ClansManager.getInstance().getClan(player).getEnergyCostPerMinute() * 60));
|
||||
}
|
||||
|
||||
class Deployed extends DeployedTask
|
||||
@EventHandler
|
||||
public void onItemPut(EnergyPageBuildEvent event)
|
||||
{
|
||||
public Deployed(Player player, TutorialTask<?> task)
|
||||
if (!isDoing(event.getPlayer()))
|
||||
{
|
||||
super(player, task);
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postDeploy()
|
||||
if (!ClansManager.getInstance().isInClan(event.getPlayer()))
|
||||
{
|
||||
_player.teleport(new Location(Spawn.getSpawnWorld(), 17, 66.5, -330, -180f, 0f));
|
||||
|
||||
ClansManager.getInstance().getClan(_player).adjustEnergy(-(ClansManager.getInstance().getClan(_player).getEnergyCostPerMinute() * 60));
|
||||
return;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onItemPut(EnergyPageBuildEvent event)
|
||||
if (ClansManager.getInstance().getClan(event.getPlayer()).getEnergyPurchasable() == 0)
|
||||
{
|
||||
if (!_player.equals(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ClansManager.getInstance().isInClan(_player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (ClansManager.getInstance().getClan(_player).getEnergyPurchasable() == 0)
|
||||
{
|
||||
_task.finishFor(_player);
|
||||
return;
|
||||
}
|
||||
|
||||
event.setFree(true);
|
||||
finishFor(event.getPlayer());
|
||||
return;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onUpdate(UpdateEvent event)
|
||||
event.setFree(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TWOSEC)
|
||||
{
|
||||
if (event.getType() != UpdateType.TWOSEC)
|
||||
return;
|
||||
}
|
||||
|
||||
Iterator<String> iterator = _inTask.iterator();
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
Player player = Bukkit.getPlayer(iterator.next());
|
||||
if (ClansManager.getInstance().getClan(player).getEnergy() == ClansManager.getInstance().getClan(player).getEnergyMax())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (ClansManager.getInstance().getClan(_player).getEnergy() == ClansManager.getInstance().getClan(_player).getEnergyMax())
|
||||
{
|
||||
_task.finishFor(_player);
|
||||
finishFor(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,55 +0,0 @@
|
||||
package mineplex.game.clans.tutorials.gettingstarted;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.clans.event.PlayerEnterTerritoryEvent;
|
||||
import mineplex.game.clans.tutorials.DeployedTask;
|
||||
import mineplex.game.clans.tutorials.TutorialTask;
|
||||
|
||||
public class TaskGoToWilderness extends TutorialTask<TutorialGettingStarted>
|
||||
{
|
||||
public TaskGoToWilderness(TutorialGettingStarted tutorial, int id)
|
||||
{
|
||||
super(tutorial, id);
|
||||
|
||||
_displayName = "Go To The Wilderness";
|
||||
_technicalName = "GoToWildy";
|
||||
|
||||
_description = "Use your Map (Slot 9) to help find your way to the Wilderness. "
|
||||
+ "The Wilderness is anywhere that is not colored on the Map. "
|
||||
+ "If you don't have a map, you can get one at any time by typing {/map}. "
|
||||
+ "You can zoom in/out on our map by left and right clicking!";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeployedTask customDeploy(Player player)
|
||||
{
|
||||
return new Deployed(player, this);
|
||||
}
|
||||
|
||||
class Deployed extends DeployedTask
|
||||
{
|
||||
public Deployed(Player player, TutorialTask<?> task)
|
||||
{
|
||||
super(player, task);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onTerritory(final PlayerEnterTerritoryEvent event)
|
||||
{
|
||||
if (!_player.equals(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getNewTerritory().contains("Wilderness"))
|
||||
{
|
||||
_task.finishFor(_player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,14 +1,13 @@
|
||||
package mineplex.game.clans.tutorials.gettingstarted;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.clans.event.PlayerEnterTerritoryEvent;
|
||||
import mineplex.game.clans.tutorials.DeployedTask;
|
||||
import mineplex.game.clans.tutorials.TutorialTask;
|
||||
|
||||
public class TaskLeaveSpawn extends TutorialTask<TutorialGettingStarted>
|
||||
@ -22,48 +21,36 @@ public class TaskLeaveSpawn extends TutorialTask<TutorialGettingStarted>
|
||||
|
||||
_description = "Now you can leave the Spawn Island. "
|
||||
+ "Don't worry, you won't get hurt from the fall! "
|
||||
+ "Once you end the tutorial, PvP will be enabled down there, so be careful!";
|
||||
+ "Once you're down there, run out a couple of blocks to get to the Wilderness. "
|
||||
+ "When you finish the tutorial, you will be vulnerable to player attacks out there, so be careful!";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeployedTask customDeploy(Player player)
|
||||
public void customStartFor(Player player)
|
||||
{
|
||||
return new Deployed(player, this);
|
||||
}
|
||||
|
||||
class Deployed extends DeployedTask
|
||||
{
|
||||
public Deployed(Player player, TutorialTask<?> task)
|
||||
if (player.getLocation().getY() < 100)
|
||||
{
|
||||
super(player, task);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postDeploy()
|
||||
{
|
||||
if (_player.getLocation().getY() < 100)
|
||||
{
|
||||
_task.finishFor(_player);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void update(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (checkForDeath())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_player.getLocation().getY() < 100){
|
||||
_task.finishFor(_player);
|
||||
}
|
||||
finishFor(player);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void update(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Iterator<String> iterator = _inTask.iterator();
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
Player player = Bukkit.getPlayer(iterator.next());
|
||||
|
||||
if (player.getLocation().getY() < 100 && getClans().getClanUtility().getClaim(player.getLocation()) == null)
|
||||
{
|
||||
finishFor(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,12 +4,12 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerItemConsumeEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.clans.event.ClansPlayerSellItemEvent;
|
||||
import mineplex.game.clans.spawn.Spawn;
|
||||
import mineplex.game.clans.tutorials.DeployedTask;
|
||||
import mineplex.game.clans.tutorials.TutorialTask;
|
||||
|
||||
public class TaskMakingMoney extends TutorialTask<TutorialGettingStarted>
|
||||
@ -23,49 +23,54 @@ public class TaskMakingMoney extends TutorialTask<TutorialGettingStarted>
|
||||
|
||||
_description = "We have given you a carrot to sell in the Organic Produce Shop. "
|
||||
+ "Click on the Villager, and {Right-Click} the carrot to sell your carrots in exchange for Gold.";
|
||||
|
||||
_finishMessage = "Good job! "
|
||||
+ "Farming and selling foods like carrots and potatoes are great ways to make money. "
|
||||
+ "You can also sell blocks, ores, and many other items that a Shop may be interested in buying.";
|
||||
|
||||
_taskPos = new Location(Spawn.getSpawnWorld(), 25.536, 66, -316.844, -100f, 0f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeployedTask customDeploy(Player player)
|
||||
public void customStartFor(Player player)
|
||||
{
|
||||
return new Deployed(player, this);
|
||||
player.getInventory().addItem(new ItemStack(Material.CARROT, 1));
|
||||
}
|
||||
|
||||
class Deployed extends DeployedTask
|
||||
@EventHandler
|
||||
public void eat(PlayerItemConsumeEvent event)
|
||||
{
|
||||
private int _carrotsSold;
|
||||
|
||||
public Deployed(Player player, TutorialTask<?> task)
|
||||
if (!isDoing(event.getPlayer()))
|
||||
{
|
||||
super(player, task);
|
||||
player.getInventory().addItem(new ItemStack(Material.CARROT_ITEM, 1));
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postDeploy()
|
||||
if (!event.getItem().getType().equals(Material.CARROT))
|
||||
{
|
||||
_player.teleport(new Location(Spawn.getSpawnWorld(), 25.536, 66, -316.844, -100f, 0f));
|
||||
return;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void button(ClansPlayerSellItemEvent event)
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void button(ClansPlayerSellItemEvent event)
|
||||
{
|
||||
if (!isDoing(event.getPlayer()))
|
||||
{
|
||||
if (!_player.equals(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ClansManager.getInstance().isInClan(_player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!event.getItem().getType().equals(Material.CARROT_ITEM))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_task.finishFor(_player);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ClansManager.getInstance().isInClan(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!event.getItem().getType().equals(Material.CARROT_ITEM))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
finishFor(event.getPlayer());
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,10 @@
|
||||
package mineplex.game.clans.tutorials.gettingstarted;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.clans.event.ClansCommandExecutedEvent;
|
||||
import mineplex.game.clans.tutorials.DeployedTask;
|
||||
import mineplex.game.clans.tutorials.TutorialTask;
|
||||
|
||||
public class TaskSetHome extends TutorialTask<TutorialGettingStarted>
|
||||
@ -19,42 +17,28 @@ public class TaskSetHome extends TutorialTask<TutorialGettingStarted>
|
||||
_technicalName = "SetClanHome";
|
||||
|
||||
_description = "You are now ready to set a Clan Home. "
|
||||
+ "To do this, use the {/c sethome} command.";
|
||||
+ "To do this, use the {/c sethome} command. "
|
||||
+ "After you set a Clan Home, you or any of your Clan mates will be able to teleport back to the Clan Home by typing {/c home} whenever they are at Spawn.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeployedTask customDeploy(Player player)
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onSetHome(ClansCommandExecutedEvent event)
|
||||
{
|
||||
return new Deployed(player, this);
|
||||
}
|
||||
|
||||
class Deployed extends DeployedTask
|
||||
{
|
||||
public Deployed(Player player, TutorialTask<?> task)
|
||||
if (!isDoing(event.getPlayer()))
|
||||
{
|
||||
super(player, task);
|
||||
return;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onSetHome(ClansCommandExecutedEvent event)
|
||||
if (!ClansManager.getInstance().isInClan(event.getPlayer()))
|
||||
{
|
||||
if (!_player.equals(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ClansManager.getInstance().isInClan(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!event.getCommand().equals("homeset"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_task.finishFor(_player);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!event.getCommand().equals("homeset"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
finishFor(event.getPlayer());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,8 +1,10 @@
|
||||
package mineplex.game.clans.tutorials.gettingstarted;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -13,13 +15,14 @@ import org.bukkit.inventory.CraftingInventory;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.NautArrayList;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.task.TaskManager;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.game.clans.clans.event.ClansPlayerBuyItemEvent;
|
||||
import mineplex.game.clans.clans.event.ClansShopAddButtonEvent;
|
||||
import mineplex.game.clans.spawn.Spawn;
|
||||
import mineplex.game.clans.tutorials.DeployedTask;
|
||||
import mineplex.game.clans.tutorials.TutorialTask;
|
||||
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
|
||||
|
||||
@ -35,95 +38,103 @@ public class TaskUseAbility extends TutorialTask<TutorialGettingStarted>
|
||||
_description = "Now that you have equipped a class, you can start using abilities. "
|
||||
+ "Purchase an Iron Axe from the PvP Shop. "
|
||||
+ "Right-Click with your Iron Axe to use your Axe Ability!";
|
||||
|
||||
_taskPos = new Location(Spawn.getSpawnWorld(), 19, 66, -305.844, -100f, 0f);
|
||||
}
|
||||
|
||||
private NautHashMap<String, NautArrayList<Material>> _bought = new NautHashMap<>();
|
||||
private NautHashMap<String, Boolean> _teleported = new NautHashMap<>();
|
||||
|
||||
@Override
|
||||
public void customStartFor(Player player)
|
||||
{
|
||||
_bought.put(player.getName(), new NautArrayList<Material>());
|
||||
_teleported.put(player.getName(), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeployedTask customDeploy(Player player)
|
||||
public void customEndFor(Player player)
|
||||
{
|
||||
return new Deployed(player, this);
|
||||
_bought.get(player.getName()).clear();
|
||||
_bought.remove(player.getName());
|
||||
_teleported.remove(player.getName());
|
||||
}
|
||||
|
||||
class Deployed extends DeployedTask
|
||||
@EventHandler
|
||||
public void teleportPlayer(UpdateEvent event)
|
||||
{
|
||||
private List<Material> _bought = new ArrayList<>();
|
||||
private boolean _teleported = false;
|
||||
if (event.getType() != UpdateType.SEC) return;
|
||||
|
||||
public Deployed(Player player, TutorialTask<?> task)
|
||||
Iterator<String> iterator = _inTask.iterator();
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
super(player, task);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void teleportPlayer(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC) return;
|
||||
|
||||
if (!_teleported && _player != null && _player.isOnline() && _player.getOpenInventory().getType() == InventoryType.CRAFTING)
|
||||
Player _player = Bukkit.getPlayer(iterator.next());
|
||||
|
||||
if (!_teleported.get(_player.getName()) && _player != null && _player.isOnline() && _player.getOpenInventory().getType() == InventoryType.CRAFTING)
|
||||
{
|
||||
_player.teleport(new Location(Spawn.getSpawnWorld(), 19, 66, -305.844, -100f, 0f));
|
||||
_teleported = true;
|
||||
_teleported.put(_player.getName(), true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onAbilityUesd(SkillTriggerEvent event)
|
||||
{
|
||||
if (_player == null || !_player.equals(event.GetPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_task.finishFor(_player);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void button(ClansShopAddButtonEvent event)
|
||||
{
|
||||
if (!_player.equals(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
System.out.println(event.getDisplayName());
|
||||
|
||||
if (!event.getMaterial().equals(Material.IRON_AXE))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!TaskManager.Instance.hasCompletedTask(event.getPlayer(), "tuttoooooe" + event.getMaterial().name()) && !_bought.contains(event.getMaterial()))
|
||||
{
|
||||
event.setBuyPrice(0);
|
||||
event.setSellPrice(0);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void buy(final ClansPlayerBuyItemEvent event)
|
||||
{
|
||||
if (!_player.equals(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!event.getItem().getType().equals(Material.IRON_AXE))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getCost() == 0 && _bought.contains(event.getItem().getType()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
TaskManager.Instance.completedTask(new Callback<Boolean>() {
|
||||
@Override
|
||||
public void run(Boolean data)
|
||||
{
|
||||
}
|
||||
}, event.getPlayer(), "tuttoooooe" + event.getItem().getType().name());
|
||||
_bought.add(event.getItem().getType());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onAbilityUesd(SkillTriggerEvent event)
|
||||
{
|
||||
if (!isDoing(event.GetPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
finishFor(event.GetPlayer());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void button(ClansShopAddButtonEvent event)
|
||||
{
|
||||
if (!isDoing(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!event.getMaterial().equals(Material.IRON_AXE))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!TaskManager.Instance.hasCompletedTask(event.getPlayer(), "tuttoooooe" + event.getMaterial().name())
|
||||
&& !_bought.get(event.getPlayer().getName()).contains(event.getMaterial()))
|
||||
{
|
||||
event.setBuyPrice(0);
|
||||
event.setSellPrice(0);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void buy(final ClansPlayerBuyItemEvent event)
|
||||
{
|
||||
if (!isDoing(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!event.getItem().getType().equals(Material.IRON_AXE))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getCost() == 0 && _bought.get(event.getPlayer().getName()).contains(event.getItem().getType()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
TaskManager.Instance.completedTask(new Callback<Boolean>() {
|
||||
@Override
|
||||
public void run(Boolean data)
|
||||
{
|
||||
}
|
||||
}, event.getPlayer(), "tuttoooooe" + event.getItem().getType().name());
|
||||
_bought.get(event.getPlayer().getName()).add(event.getItem().getType());
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,9 @@
|
||||
package mineplex.game.clans.tutorials.gettingstarted;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
import mineplex.game.clans.clans.event.ClansCommandExecutedEvent;
|
||||
import mineplex.game.clans.tutorials.DeployedTask;
|
||||
import mineplex.game.clans.tutorials.TutorialTask;
|
||||
|
||||
public class TaskViewClanDetails extends TutorialTask<TutorialGettingStarted>
|
||||
@ -22,32 +20,19 @@ public class TaskViewClanDetails extends TutorialTask<TutorialGettingStarted>
|
||||
+ "You can also use any clan's name to get some information about them as well.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeployedTask customDeploy(Player player)
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onClansCommand(ClansCommandExecutedEvent event)
|
||||
{
|
||||
return new Deployed(player, this);
|
||||
}
|
||||
|
||||
class Deployed extends DeployedTask
|
||||
{
|
||||
public Deployed(Player player, TutorialTask<?> task)
|
||||
if (!isDoing(event.getPlayer()))
|
||||
{
|
||||
super(player, task);
|
||||
return;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onClansCommand(ClansCommandExecutedEvent event)
|
||||
System.out.println(event.getCommand());
|
||||
|
||||
if (event.getCommand().equals("info"))
|
||||
{
|
||||
if (!_player.equals(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getCommand().equals("info"))
|
||||
{
|
||||
_task.finishFor(_player);
|
||||
}
|
||||
finishFor(event.getPlayer());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -5,10 +5,9 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.packethandler.PacketHandler;
|
||||
import mineplex.core.task.TaskManager;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
@ -20,9 +19,9 @@ import mineplex.game.clans.tutorials.TutorialManager;
|
||||
|
||||
public class TutorialGettingStarted extends Tutorial
|
||||
{
|
||||
public TutorialGettingStarted(final TutorialManager manager, final ClansManager clansManager, final DonationManager donationManager, final GoldManager goldManager, final TaskManager taskManager)
|
||||
public TutorialGettingStarted(final TutorialManager manager, final ClansManager clansManager, final DonationManager donationManager, final GoldManager goldManager, final TaskManager taskManager, final PacketHandler packetHandler)
|
||||
{
|
||||
super(goldManager, taskManager, clansManager, donationManager, manager);
|
||||
super(goldManager, taskManager, clansManager, donationManager, manager, packetHandler);
|
||||
|
||||
// addTask(new TaskWelcome(this, 1));
|
||||
|
||||
@ -30,7 +29,6 @@ public class TutorialGettingStarted extends Tutorial
|
||||
addTask(new TaskCreateClan(this, ++id));
|
||||
addTask(new TaskViewClanDetails(this, ++id));
|
||||
addTask(new TaskLeaveSpawn(this, ++id));
|
||||
addTask(new TaskGoToWilderness(this, ++id));
|
||||
addTask(new TaskClaim(this, ++id));
|
||||
addTask(new TaskSetHome(this, ++id));
|
||||
addTask(new TaskExploreShops(this, ++id));
|
||||
@ -40,8 +38,6 @@ public class TutorialGettingStarted extends Tutorial
|
||||
addTask(new TaskMakingMoney(this, ++id));
|
||||
addTask(new TaskDisbandClan(this, ++id));
|
||||
|
||||
|
||||
|
||||
_doScoreboard = true;
|
||||
_ghostMode = true;
|
||||
_startOnJoin = true;
|
||||
@ -54,12 +50,12 @@ public class TutorialGettingStarted extends Tutorial
|
||||
@Override
|
||||
public void onFinished(final Player player)
|
||||
{
|
||||
UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||
UtilPlayer.message(player, C.cYellowB + "CONGRATULATIONS");
|
||||
UtilPlayer.message(player, " ");
|
||||
UtilPlayer.message(player, C.cWhite + "You have completed the Clans basic tutorial and have been awarded " + C.cAqua + "30,000 Gold");
|
||||
UtilPlayer.message(player, C.cWhite + "You can now begin your adventure, but do take a moment to read the signs around spawn for more information!");
|
||||
UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||
_manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||
_manager.sendTutorialMsg(player, C.cYellowB + "CONGRATULATIONS");
|
||||
_manager.sendTutorialMsg(player, " ");
|
||||
_manager.sendTutorialMsg(player, C.cWhite + "You have completed the Clans basic tutorial and have been awarded " + C.cAqua + "30,000 Gold");
|
||||
_manager.sendTutorialMsg(player, C.cWhite + "You can now begin your adventure, but do take a moment to read the signs around spawn for more information!");
|
||||
_manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||
|
||||
player.resetPlayerTime();
|
||||
player.teleport(Spawn.getEastSpawn());
|
||||
@ -68,17 +64,17 @@ public class TutorialGettingStarted extends Tutorial
|
||||
@Override
|
||||
public void onBegin(final Player player)
|
||||
{
|
||||
UtilPlayer.message(player, " ");
|
||||
UtilPlayer.message(player, " ");
|
||||
UtilPlayer.message(player, " ");
|
||||
UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||
UtilPlayer.message(player, " ");
|
||||
UtilPlayer.message(player, C.cYellowB + "Getting Started");
|
||||
UtilPlayer.message(player, C.cWhite + "Welcome to Clans! "
|
||||
_manager.sendTutorialMsg(player, " ");
|
||||
_manager.sendTutorialMsg(player, " ");
|
||||
_manager.sendTutorialMsg(player, " ");
|
||||
_manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||
_manager.sendTutorialMsg(player, " ");
|
||||
_manager.sendTutorialMsg(player, C.cYellowB + "Getting Started");
|
||||
_manager.sendTutorialMsg(player, C.cWhite + " Welcome to Clans! "
|
||||
+ "In this game mode you are able to create a clan, invite your friends to play with you, build a base, and wage war against others! "
|
||||
+ "When you finish the tutorial, you will be awarded " + C.cAqua + "30,000 Gold");
|
||||
UtilPlayer.message(player, " ");
|
||||
UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||
_manager.sendTutorialMsg(player, " ");
|
||||
_manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||
}
|
||||
|
||||
|
||||
|
@ -14,7 +14,7 @@ import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Wither;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -24,9 +24,9 @@ import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.event.StackerEvent;
|
||||
import mineplex.core.gadget.gadgets.MorphBlock;
|
||||
import mineplex.core.gadget.types.GadgetType;
|
||||
@ -54,7 +54,7 @@ public class StackerManager extends MiniPlugin implements IThrown
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void GrabEntity(PlayerInteractEntityEvent event)
|
||||
public void GrabEntity(PlayerInteractAtEntityEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
@ -62,7 +62,10 @@ public class StackerManager extends MiniPlugin implements IThrown
|
||||
Entity stackee = event.getRightClicked();
|
||||
if (stackee == null)
|
||||
return;
|
||||
|
||||
|
||||
if(Manager.GetMount().isMount(stackee))
|
||||
return;
|
||||
|
||||
if (!(stackee instanceof LivingEntity))
|
||||
return;
|
||||
|
||||
|
@ -347,7 +347,7 @@ public class ClientClass
|
||||
ResetToDefaults(!skillsOnly, !skillsOnly);
|
||||
|
||||
// Event
|
||||
ClassEquipEvent event = new ClassEquipEvent(this, customBuild);
|
||||
ClassEquipEvent event = new ClassEquipEvent(this, customBuild, _client.GetPlayer());
|
||||
UtilServer.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled())
|
||||
|
@ -5,7 +5,6 @@ import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import mineplex.minecraft.game.classcombat.Class.ClientClass;
|
||||
import mineplex.minecraft.game.classcombat.Class.PvpClass;
|
||||
import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken;
|
||||
|
||||
public class ClassEquipEvent extends Event
|
||||
@ -13,15 +12,16 @@ public class ClassEquipEvent extends Event
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private ClientClass _client;
|
||||
|
||||
private Player _user;
|
||||
private CustomBuildToken _build;
|
||||
|
||||
private boolean _cancelled;
|
||||
|
||||
public ClassEquipEvent(ClientClass client, CustomBuildToken build)
|
||||
public ClassEquipEvent(ClientClass client, CustomBuildToken build, Player user)
|
||||
{
|
||||
_client = client;
|
||||
_build = build;
|
||||
_user = user;
|
||||
}
|
||||
|
||||
public ClientClass getPlayer()
|
||||
@ -34,6 +34,11 @@ public class ClassEquipEvent extends Event
|
||||
return _build;
|
||||
}
|
||||
|
||||
public Player getUser()
|
||||
{
|
||||
return _user;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancelled)
|
||||
{
|
||||
_cancelled = cancelled;
|
||||
|
@ -302,6 +302,8 @@ public abstract class Game implements Listener
|
||||
public boolean DeadBodiesDeath = true;
|
||||
public int DeadBodiesExpire = -1;
|
||||
|
||||
public boolean FixSpawnFacing = true;
|
||||
|
||||
private IPacketHandler _useEntityPacketHandler;
|
||||
private int _deadBodyCount;
|
||||
private NautHashMap<String, Entity> _deadBodies = new NautHashMap<String, Entity>();
|
||||
|
@ -113,12 +113,15 @@ public class GameTeam
|
||||
|
||||
private Location fixFacing(Location loc)
|
||||
{
|
||||
float yaw = UtilAlg.GetYaw(UtilAlg.getTrajectory2d(loc, Host.GetSpectatorLocation()));
|
||||
|
||||
yaw = (int) (yaw / 90) * 90;
|
||||
|
||||
loc = loc.clone();
|
||||
loc.setYaw(yaw);
|
||||
if (Host.FixSpawnFacing)
|
||||
{
|
||||
float yaw = UtilAlg.GetYaw(UtilAlg.getTrajectory2d(loc, Host.GetSpectatorLocation()));
|
||||
|
||||
yaw = (int) (yaw / 90) * 90;
|
||||
|
||||
loc = loc.clone();
|
||||
loc.setYaw(yaw);
|
||||
}
|
||||
|
||||
return loc;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user