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.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.SkullType;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.block.Banner;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.block.BlockState;
|
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.CraftWorld;
|
||||||
|
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.BannerMeta;
|
||||||
|
import org.bukkit.inventory.meta.SkullMeta;
|
||||||
import org.bukkit.material.Bed;
|
import org.bukkit.material.Bed;
|
||||||
|
|
||||||
import net.minecraft.server.v1_8_R3.BlockPosition;
|
import net.minecraft.server.v1_8_R3.BlockPosition;
|
||||||
import net.minecraft.server.v1_8_R3.Blocks;
|
import net.minecraft.server.v1_8_R3.Blocks;
|
||||||
import net.minecraft.server.v1_8_R3.EnumDirection;
|
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.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;
|
import net.minecraft.server.v1_8_R3.WorldServer;
|
||||||
|
|
||||||
public class UtilBlock
|
public class UtilBlock
|
||||||
@ -844,9 +861,11 @@ public class UtilBlock
|
|||||||
return blocks;
|
return blocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack blockToInventoryItemStack(Block block)
|
public static ArrayList<ItemStack> blockToInventoryItemStacks(Block block)
|
||||||
{
|
{
|
||||||
ItemStack itemStack = new ItemStack(block.getType(), 1, block.getData());
|
ItemStack itemStack = new ItemStack(block.getType(), 1, block.getData());
|
||||||
|
ArrayList<ItemStack> itemStacks = new ArrayList<ItemStack>();
|
||||||
|
itemStacks.add(itemStack);
|
||||||
|
|
||||||
switch (block.getType())
|
switch (block.getType())
|
||||||
{
|
{
|
||||||
@ -877,6 +896,17 @@ public class UtilBlock
|
|||||||
break;
|
break;
|
||||||
case DISPENSER:
|
case DISPENSER:
|
||||||
itemStack.setDurability((short) 0);
|
itemStack.setDurability((short) 0);
|
||||||
|
|
||||||
|
Dispenser dispenser = (Dispenser) block.getState();
|
||||||
|
|
||||||
|
for (ItemStack is : dispenser.getInventory().getContents())
|
||||||
|
{
|
||||||
|
if (is == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
itemStacks.add(is);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case BED_BLOCK:
|
case BED_BLOCK:
|
||||||
itemStack.setType(Material.BED);
|
itemStack.setType(Material.BED);
|
||||||
@ -921,6 +951,17 @@ public class UtilBlock
|
|||||||
break;
|
break;
|
||||||
case CHEST:
|
case CHEST:
|
||||||
itemStack.setDurability((short) 0);
|
itemStack.setDurability((short) 0);
|
||||||
|
|
||||||
|
Chest chest = (Chest) block.getState();
|
||||||
|
|
||||||
|
for (ItemStack is : chest.getBlockInventory().getContents())
|
||||||
|
{
|
||||||
|
if (is == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
itemStacks.add(is);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case REDSTONE_WIRE:
|
case REDSTONE_WIRE:
|
||||||
itemStack.setType(Material.REDSTONE);
|
itemStack.setType(Material.REDSTONE);
|
||||||
@ -936,10 +977,32 @@ public class UtilBlock
|
|||||||
break;
|
break;
|
||||||
case FURNACE:
|
case FURNACE:
|
||||||
itemStack.setDurability((short) 0);
|
itemStack.setDurability((short) 0);
|
||||||
|
|
||||||
|
Furnace furnace = (Furnace) block.getState();
|
||||||
|
|
||||||
|
for (ItemStack is : furnace.getInventory().getContents())
|
||||||
|
{
|
||||||
|
if (is == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
itemStacks.add(is);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case BURNING_FURNACE:
|
case BURNING_FURNACE:
|
||||||
itemStack.setType(Material.FURNACE);
|
itemStack.setType(Material.FURNACE);
|
||||||
itemStack.setDurability((short) 0);
|
itemStack.setDurability((short) 0);
|
||||||
|
|
||||||
|
Furnace burningFurnace = (Furnace) block.getState();
|
||||||
|
|
||||||
|
for (ItemStack is : burningFurnace.getInventory().getContents())
|
||||||
|
{
|
||||||
|
if (is == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
itemStacks.add(is);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case SIGN_POST:
|
case SIGN_POST:
|
||||||
itemStack.setType(Material.SIGN);
|
itemStack.setType(Material.SIGN);
|
||||||
@ -1001,6 +1064,12 @@ public class UtilBlock
|
|||||||
break;
|
break;
|
||||||
case JUKEBOX:
|
case JUKEBOX:
|
||||||
itemStack.setDurability((short) 0);
|
itemStack.setDurability((short) 0);
|
||||||
|
|
||||||
|
Jukebox jukebox = (Jukebox) block.getState();
|
||||||
|
|
||||||
|
if (jukebox.getPlaying() != Material.AIR)
|
||||||
|
itemStacks.add(new ItemStack(jukebox.getPlaying()));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case PORTAL:
|
case PORTAL:
|
||||||
itemStack.setType(Material.AIR);
|
itemStack.setType(Material.AIR);
|
||||||
@ -1057,10 +1126,25 @@ public class UtilBlock
|
|||||||
case BREWING_STAND:
|
case BREWING_STAND:
|
||||||
itemStack.setType(Material.BREWING_STAND_ITEM);
|
itemStack.setType(Material.BREWING_STAND_ITEM);
|
||||||
itemStack.setDurability((short) 0);
|
itemStack.setDurability((short) 0);
|
||||||
|
|
||||||
|
BrewingStand brewingStand = (BrewingStand) block.getState();
|
||||||
|
|
||||||
|
for (ItemStack is : brewingStand.getInventory().getContents())
|
||||||
|
{
|
||||||
|
if (is == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
itemStacks.add(is);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case CAULDRON:
|
case CAULDRON:
|
||||||
itemStack.setType(Material.CAULDRON_ITEM);
|
itemStack.setType(Material.CAULDRON_ITEM);
|
||||||
itemStack.setDurability((short) 0);
|
itemStack.setDurability((short) 0);
|
||||||
|
|
||||||
|
if (block.getData() != 0)
|
||||||
|
itemStacks.add(new ItemStack(Material.WATER_BUCKET));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case ENDER_PORTAL:
|
case ENDER_PORTAL:
|
||||||
itemStack.setType(Material.AIR);
|
itemStack.setType(Material.AIR);
|
||||||
@ -1068,6 +1152,10 @@ public class UtilBlock
|
|||||||
break;
|
break;
|
||||||
case ENDER_PORTAL_FRAME:
|
case ENDER_PORTAL_FRAME:
|
||||||
itemStack.setDurability((short) 0);
|
itemStack.setDurability((short) 0);
|
||||||
|
|
||||||
|
if ((block.getData() & 0x4) != 0)
|
||||||
|
itemStacks.add(new ItemStack(Material.EYE_OF_ENDER));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case REDSTONE_LAMP_ON:
|
case REDSTONE_LAMP_ON:
|
||||||
itemStack.setType(Material.REDSTONE_LAMP_OFF);
|
itemStack.setType(Material.REDSTONE_LAMP_OFF);
|
||||||
@ -1111,6 +1199,27 @@ public class UtilBlock
|
|||||||
case FLOWER_POT:
|
case FLOWER_POT:
|
||||||
itemStack.setType(Material.FLOWER_POT_ITEM);
|
itemStack.setType(Material.FLOWER_POT_ITEM);
|
||||||
itemStack.setDurability((short) 0);
|
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;
|
break;
|
||||||
case CARROT:
|
case CARROT:
|
||||||
itemStack.setType(Material.CARROT_ITEM);
|
itemStack.setType(Material.CARROT_ITEM);
|
||||||
@ -1125,9 +1234,31 @@ public class UtilBlock
|
|||||||
break;
|
break;
|
||||||
case SKULL:
|
case SKULL:
|
||||||
itemStack.setType(Material.SKULL_ITEM);
|
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;
|
break;
|
||||||
case TRAPPED_CHEST:
|
case TRAPPED_CHEST:
|
||||||
itemStack.setDurability((short) 0);
|
itemStack.setDurability((short) 0);
|
||||||
|
|
||||||
|
Chest trappedChest = (Chest) block.getState();
|
||||||
|
|
||||||
|
for (ItemStack is : trappedChest.getBlockInventory().getContents())
|
||||||
|
{
|
||||||
|
if (is == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
itemStacks.add(is);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case GOLD_PLATE:
|
case GOLD_PLATE:
|
||||||
itemStack.setDurability((short) 0);
|
itemStack.setDurability((short) 0);
|
||||||
@ -1148,6 +1279,17 @@ public class UtilBlock
|
|||||||
break;
|
break;
|
||||||
case HOPPER:
|
case HOPPER:
|
||||||
itemStack.setDurability((short) 0);
|
itemStack.setDurability((short) 0);
|
||||||
|
|
||||||
|
Hopper hopper = (Hopper) block.getState();
|
||||||
|
|
||||||
|
for (ItemStack is : hopper.getInventory().getContents())
|
||||||
|
{
|
||||||
|
if (is == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
itemStacks.add(is);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case QUARTZ_STAIRS:
|
case QUARTZ_STAIRS:
|
||||||
itemStack.setDurability((short) 0);
|
itemStack.setDurability((short) 0);
|
||||||
@ -1157,6 +1299,17 @@ public class UtilBlock
|
|||||||
break;
|
break;
|
||||||
case DROPPER:
|
case DROPPER:
|
||||||
itemStack.setDurability((short) 0);
|
itemStack.setDurability((short) 0);
|
||||||
|
|
||||||
|
Dropper dropper = (Dropper) block.getState();
|
||||||
|
|
||||||
|
for (ItemStack is : dropper.getInventory().getContents())
|
||||||
|
{
|
||||||
|
if (is == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
itemStacks.add(is);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case LEAVES_2:
|
case LEAVES_2:
|
||||||
itemStack.setDurability((short) (itemStack.getDurability() % 4));
|
itemStack.setDurability((short) (itemStack.getDurability() % 4));
|
||||||
@ -1178,11 +1331,27 @@ public class UtilBlock
|
|||||||
break;
|
break;
|
||||||
case STANDING_BANNER:
|
case STANDING_BANNER:
|
||||||
itemStack.setType(Material.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;
|
break;
|
||||||
case WALL_BANNER:
|
case WALL_BANNER:
|
||||||
itemStack.setType(Material.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;
|
break;
|
||||||
case DAYLIGHT_DETECTOR_INVERTED:
|
case DAYLIGHT_DETECTOR_INVERTED:
|
||||||
itemStack.setType(Material.DAYLIGHT_DETECTOR);
|
itemStack.setType(Material.DAYLIGHT_DETECTOR);
|
||||||
@ -1235,6 +1404,6 @@ public class UtilBlock
|
|||||||
break;
|
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.CraftCreature;
|
||||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
||||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity;
|
||||||
|
import org.bukkit.entity.ArmorStand;
|
||||||
import org.bukkit.entity.Creature;
|
import org.bukkit.entity.Creature;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
@ -804,6 +805,20 @@ public class UtilEnt
|
|||||||
return null;
|
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)
|
public static boolean inWater(LivingEntity ent)
|
||||||
{
|
{
|
||||||
return ent.getLocation().getBlock().getTypeId() == 8 || ent.getLocation().getBlock().getTypeId() == 9;
|
return ent.getLocation().getBlock().getTypeId() == 8 || ent.getLocation().getBlock().getTypeId() == 9;
|
||||||
|
@ -25,8 +25,8 @@ public class UtilItem
|
|||||||
|
|
||||||
_materials.put(Material.AIR, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.BOUNDLESS));
|
_materials.put(Material.AIR, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.BOUNDLESS));
|
||||||
_materials.put(Material.STONE, EnumSet.of(ItemCategory.BLOCK));
|
_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.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.COBBLESTONE, EnumSet.of(ItemCategory.BLOCK, ItemCategory.STONE));
|
||||||
_materials.put(Material.WOOD, EnumSet.of(ItemCategory.BLOCK, ItemCategory.WOOD));
|
_materials.put(Material.WOOD, EnumSet.of(ItemCategory.BLOCK, ItemCategory.WOOD));
|
||||||
_materials.put(Material.SAPLING, EnumSet.of(ItemCategory.BLOCK));
|
_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.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.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
|
// 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_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_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));
|
_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)
|
if (slot == 26)
|
||||||
slot = 28;
|
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)
|
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));
|
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;
|
package mineplex.core.mount;
|
||||||
|
|
||||||
import mineplex.core.common.util.UtilAlg;
|
import java.util.ArrayList;
|
||||||
import mineplex.core.common.util.UtilEnt;
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -13,12 +13,14 @@ import org.bukkit.entity.Entity;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.util.Vector;
|
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;
|
DragonMount Host;
|
||||||
|
|
||||||
public EnderDragon Dragon;
|
public EnderDragon Dragon;
|
||||||
public Player Rider;
|
|
||||||
|
|
||||||
public Entity TargetEntity = null;
|
public Entity TargetEntity = null;
|
||||||
|
|
||||||
@ -31,10 +33,9 @@ public class DragonData
|
|||||||
|
|
||||||
public DragonData(DragonMount dragonMount, Player rider)
|
public DragonData(DragonMount dragonMount, Player rider)
|
||||||
{
|
{
|
||||||
|
super(rider);
|
||||||
Host = dragonMount;
|
Host = dragonMount;
|
||||||
|
|
||||||
Rider = rider;
|
|
||||||
|
|
||||||
Velocity = rider.getLocation().getDirection().setY(0).normalize();
|
Velocity = rider.getLocation().getDirection().setY(0).normalize();
|
||||||
Pitch = UtilAlg.GetPitch(rider.getLocation().getDirection());
|
Pitch = UtilAlg.GetPitch(rider.getLocation().getDirection());
|
||||||
|
|
||||||
@ -51,25 +52,34 @@ public class DragonData
|
|||||||
Chicken = rider.getWorld().spawn(rider.getLocation(), Chicken.class);
|
Chicken = rider.getWorld().spawn(rider.getLocation(), Chicken.class);
|
||||||
Dragon.setPassenger(Chicken);
|
Dragon.setPassenger(Chicken);
|
||||||
|
|
||||||
Chicken.setPassenger(Rider);
|
Chicken.setPassenger(getOwner());
|
||||||
|
|
||||||
Bukkit.getServer().getScheduler().runTaskLater(Host.Manager.getPlugin(), new Runnable()
|
Bukkit.getServer().getScheduler().runTaskLater(Host.Manager.getPlugin(), new Runnable()
|
||||||
{
|
{
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
Chicken.setPassenger(Rider);
|
Chicken.setPassenger(getOwner());
|
||||||
}
|
}
|
||||||
}, 10L);
|
}, 10L);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Move()
|
public void Move()
|
||||||
{
|
{
|
||||||
Rider.eject();
|
getOwner().eject();
|
||||||
((CraftEnderDragon)Dragon).getHandle().setTargetBlock(GetTarget().getBlockX(), GetTarget().getBlockY(), GetTarget().getBlockZ());
|
((CraftEnderDragon)Dragon).getHandle().setTargetBlock(GetTarget().getBlockX(), GetTarget().getBlockY(), GetTarget().getBlockZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Location GetTarget()
|
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.F;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.disguise.disguises.DisguiseChicken;
|
|
||||||
|
|
||||||
public class DragonMount extends Mount<DragonData>
|
public class DragonMount extends Mount<DragonData>
|
||||||
{
|
{
|
||||||
|
@ -22,7 +22,7 @@ import org.bukkit.entity.Horse.Style;
|
|||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class HorseMount extends Mount<Horse>
|
public class HorseMount extends Mount<SingleEntityMountData<Horse>>
|
||||||
{
|
{
|
||||||
protected Color _color;
|
protected Color _color;
|
||||||
protected Style _style;
|
protected Style _style;
|
||||||
@ -53,7 +53,7 @@ public class HorseMount extends Mount<Horse>
|
|||||||
while (activeIterator.hasNext())
|
while (activeIterator.hasNext())
|
||||||
{
|
{
|
||||||
Player player = activeIterator.next();
|
Player player = activeIterator.next();
|
||||||
Horse horse = _active.get(player);
|
Horse horse = _active.get(player).getEntity();
|
||||||
|
|
||||||
//Invalid (dead)
|
//Invalid (dead)
|
||||||
if (!horse.isValid())
|
if (!horse.isValid())
|
||||||
@ -113,15 +113,16 @@ public class HorseMount extends Mount<Horse>
|
|||||||
UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + "."));
|
UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + "."));
|
||||||
|
|
||||||
//Store
|
//Store
|
||||||
_active.put(player, horse);
|
SingleEntityMountData<Horse> mount = new SingleEntityMountData<Horse>(player, horse);
|
||||||
|
_active.put(player, mount);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Disable(Player player)
|
public void Disable(Player player)
|
||||||
{
|
{
|
||||||
Horse horse = _active.remove(player);
|
SingleEntityMountData<Horse> mount = _active.remove(player);
|
||||||
if (horse != null)
|
if (mount != null)
|
||||||
{
|
{
|
||||||
horse.remove();
|
mount.remove();
|
||||||
|
|
||||||
//Inform
|
//Inform
|
||||||
UtilPlayer.message(player, F.main("Mount", "You despawned " + F.elem(GetName()) + "."));
|
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.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
@ -18,7 +19,7 @@ import mineplex.core.common.util.UtilServer;
|
|||||||
import mineplex.core.mount.event.MountActivateEvent;
|
import mineplex.core.mount.event.MountActivateEvent;
|
||||||
import mineplex.core.shop.item.SalesPackageBase;
|
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 HashSet<Player> _owners = new HashSet<Player>();
|
||||||
protected HashMap<Player, T> _active = new HashMap<Player, T>();
|
protected HashMap<Player, T> _active = new HashMap<Player, T>();
|
||||||
@ -51,8 +52,8 @@ public abstract class Mount<T> extends SalesPackageBase implements Listener
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Manager.setActive(player, this);
|
|
||||||
EnableCustom(player);
|
EnableCustom(player);
|
||||||
|
Manager.setActive(player, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract void EnableCustom(Player player);
|
public abstract void EnableCustom(Player player);
|
||||||
@ -97,4 +98,13 @@ public abstract class Mount<T> extends SalesPackageBase implements Listener
|
|||||||
{
|
{
|
||||||
return _owners.contains(player);
|
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.ArrayList;
|
||||||
import java.util.List;
|
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.MiniPlugin;
|
||||||
import mineplex.core.account.CoreClientManager;
|
import mineplex.core.account.CoreClientManager;
|
||||||
import mineplex.core.blockrestore.BlockRestore;
|
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.MountUndead;
|
||||||
import mineplex.core.mount.types.MountZombie;
|
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
|
public class MountManager extends MiniPlugin
|
||||||
{
|
{
|
||||||
private CoreClientManager _clientManager;
|
private CoreClientManager _clientManager;
|
||||||
@ -84,32 +84,30 @@ public class MountManager extends MiniPlugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void HorseInteract(PlayerInteractEntityEvent event)
|
public void mountInteract(PlayerInteractAtEntityEvent event)
|
||||||
{
|
{
|
||||||
if (!(event.getRightClicked() instanceof Horse))
|
MountData mount = getMountData(event.getRightClicked());
|
||||||
return;
|
|
||||||
|
|
||||||
boolean found = false;
|
if(mount == null) return;
|
||||||
for (Mount mount : _playerActiveMountMap.values())
|
|
||||||
{
|
|
||||||
if (mount.GetActive().containsValue(event.getRightClicked()))
|
|
||||||
{
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!found)
|
if(mount.ownsMount(event.getPlayer())) return;
|
||||||
return;
|
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
|
||||||
Horse horse = (Horse)event.getRightClicked();
|
|
||||||
|
|
||||||
if (horse.getOwner() == null || !horse.getOwner().equals(player))
|
|
||||||
{
|
|
||||||
UtilPlayer.message(player, F.main("Mount", "This is not your Mount!"));
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void mountInteract(PlayerInteractEntityEvent event)
|
||||||
|
{
|
||||||
|
MountData mount = getMountData(event.getRightClicked());
|
||||||
|
|
||||||
|
if(mount == null) return;
|
||||||
|
|
||||||
|
if(mount.ownsMount(event.getPlayer())) return;
|
||||||
|
|
||||||
|
UtilPlayer.message(event.getPlayer(), F.main("Mount", "This is not your Mount!"));
|
||||||
|
event.setCancelled(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -179,15 +177,27 @@ public class MountManager extends MiniPlugin
|
|||||||
return _disguiseManager;
|
return _disguiseManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMount(Entity ent)
|
public MountData getMountData(Entity ent)
|
||||||
{
|
{
|
||||||
for (Mount<?> mount : _playerActiveMountMap.values())
|
for (Mount<?> mount : _playerActiveMountMap.values())
|
||||||
{
|
{
|
||||||
if (mount.GetActive().values().contains(ent))
|
MountData data = mount.getMountData(ent);
|
||||||
|
if(data != null) return data;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Mount<?> getMount(Entity ent)
|
||||||
{
|
{
|
||||||
return true;
|
for (Mount<?> mount : _playerActiveMountMap.values())
|
||||||
}
|
{
|
||||||
}
|
if(mount.getMountData(ent) != null) return mount;
|
||||||
return false;
|
}
|
||||||
|
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;
|
package mineplex.core.mount.types;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
@ -18,23 +19,12 @@ import mineplex.core.common.util.UtilMath;
|
|||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.mount.Mount;
|
import mineplex.core.mount.Mount;
|
||||||
import mineplex.core.mount.MountManager;
|
import mineplex.core.mount.MountManager;
|
||||||
|
import mineplex.core.mount.SingleEntityMountData;
|
||||||
import mineplex.core.recharge.Recharge;
|
import mineplex.core.recharge.Recharge;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
|
||||||
|
public class MountCart extends Mount<SingleEntityMountData<Minecart>>
|
||||||
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 MountCart(MountManager manager)
|
public MountCart(MountManager manager)
|
||||||
{
|
{
|
||||||
@ -56,7 +46,7 @@ public class MountCart extends Mount<Minecart>
|
|||||||
//Remove other mounts
|
//Remove other mounts
|
||||||
Manager.DeregisterAll(player);
|
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
|
//Inform
|
||||||
UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + "."));
|
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)
|
public void Disable(Player player)
|
||||||
{
|
{
|
||||||
Minecart mount = _active.remove(player);
|
SingleEntityMountData<Minecart> mount = _active.remove(player);
|
||||||
if (mount != null)
|
if (mount != null)
|
||||||
{
|
{
|
||||||
mount.remove();
|
mount.remove();
|
||||||
@ -85,14 +75,11 @@ public class MountCart extends Mount<Minecart>
|
|||||||
if (event.getRightClicked() == null)
|
if (event.getRightClicked() == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!GetActive().containsKey(event.getPlayer()))
|
SingleEntityMountData<Minecart> mount = GetActive().get(event.getPlayer());
|
||||||
return;
|
|
||||||
|
|
||||||
if (!GetActive().get(event.getPlayer()).equals(event.getRightClicked()))
|
if(mount == null) return;
|
||||||
{
|
|
||||||
UtilPlayer.message(event.getPlayer(), F.main("Mount", "This is not your Mount!"));
|
if(!mount.ownsMount(event.getPlayer())) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
event.getPlayer().leaveVehicle();
|
event.getPlayer().leaveVehicle();
|
||||||
event.getPlayer().eject();
|
event.getPlayer().eject();
|
||||||
@ -117,8 +104,10 @@ public class MountCart extends Mount<Minecart>
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
//Bounce
|
//Bounce
|
||||||
for (Minecart cart : GetActive().values())
|
for (SingleEntityMountData<Minecart> cartData : GetActive().values())
|
||||||
{
|
{
|
||||||
|
Minecart cart = cartData.getEntity();
|
||||||
|
|
||||||
if (cart.getPassenger() == null)
|
if (cart.getPassenger() == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -137,8 +126,10 @@ public class MountCart extends Mount<Minecart>
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Collide
|
//Collide
|
||||||
for (Minecart cart : GetActive().values())
|
for (SingleEntityMountData<Minecart> cartData : GetActive().values())
|
||||||
{
|
{
|
||||||
|
Minecart cart = cartData.getEntity();
|
||||||
|
|
||||||
if (cart.getPassenger() == null)
|
if (cart.getPassenger() == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -150,8 +141,9 @@ public class MountCart extends Mount<Minecart>
|
|||||||
if (!Recharge.Instance.usable(player, GetName() + " Collide"))
|
if (!Recharge.Instance.usable(player, GetName() + " Collide"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (Minecart other : GetActive().values())
|
for (SingleEntityMountData<Minecart> otherData : GetActive().values())
|
||||||
{
|
{
|
||||||
|
Minecart other = otherData.getEntity();
|
||||||
if (other.equals(cart))
|
if (other.equals(cart))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -9,11 +9,11 @@ import org.bukkit.event.EventHandler;
|
|||||||
|
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.UtilParticle;
|
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.ParticleType;
|
||||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||||
import mineplex.core.mount.HorseMount;
|
import mineplex.core.mount.HorseMount;
|
||||||
import mineplex.core.mount.MountManager;
|
import mineplex.core.mount.MountManager;
|
||||||
|
import mineplex.core.mount.SingleEntityMountData;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
|
||||||
@ -38,10 +38,12 @@ public class MountFrost extends HorseMount
|
|||||||
public void Trail(UpdateEvent event)
|
public void Trail(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (event.getType() == UpdateType.TICK)
|
if (event.getType() == UpdateType.TICK)
|
||||||
for (Horse horse : GetActive().values())
|
for (SingleEntityMountData<Horse> horseData : GetActive().values())
|
||||||
UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, horse.getLocation().add(0, 1, 0),
|
{
|
||||||
0.25f, 0.25f, 0.25f, 0.1f, 4,
|
Horse horse = horseData.getEntity();
|
||||||
ViewDist.NORMAL, UtilServer.getPlayers());
|
UtilParticle.PlayParticleToAll(ParticleType.SNOW_SHOVEL, horse.getLocation().add(0, 1, 0),
|
||||||
|
0.25f, 0.25f, 0.25f, 0.1f, 4, ViewDist.NORMAL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @EventHandler
|
// @EventHandler
|
||||||
|
@ -5,19 +5,19 @@ import org.bukkit.DyeColor;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Horse;
|
import org.bukkit.entity.Horse;
|
||||||
import org.bukkit.entity.Horse.Color;
|
import org.bukkit.entity.Horse.Color;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.entity.Horse.Style;
|
import org.bukkit.entity.Horse.Style;
|
||||||
import org.bukkit.entity.Horse.Variant;
|
import org.bukkit.entity.Horse.Variant;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.disguise.disguises.DisguiseBase;
|
import mineplex.core.disguise.disguises.DisguiseBase;
|
||||||
import mineplex.core.disguise.disguises.DisguisePig;
|
|
||||||
import mineplex.core.disguise.disguises.DisguiseSheep;
|
import mineplex.core.disguise.disguises.DisguiseSheep;
|
||||||
import mineplex.core.mount.HorseMount;
|
import mineplex.core.mount.HorseMount;
|
||||||
import mineplex.core.mount.MountManager;
|
import mineplex.core.mount.MountManager;
|
||||||
|
import mineplex.core.mount.SingleEntityMountData;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
|
||||||
@ -45,6 +45,7 @@ public class MountSheep extends HorseMount
|
|||||||
Manager.DeregisterAll(player);
|
Manager.DeregisterAll(player);
|
||||||
|
|
||||||
Horse horse = player.getWorld().spawn(player.getLocation(), Horse.class);
|
Horse horse = player.getWorld().spawn(player.getLocation(), Horse.class);
|
||||||
|
SingleEntityMountData<Horse> mount = new SingleEntityMountData<Horse>(player, horse);
|
||||||
|
|
||||||
horse.setOwner(player);
|
horse.setOwner(player);
|
||||||
horse.setMaxDomestication(1);
|
horse.setMaxDomestication(1);
|
||||||
@ -59,7 +60,7 @@ public class MountSheep extends HorseMount
|
|||||||
UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + "."));
|
UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + "."));
|
||||||
|
|
||||||
//Store
|
//Store
|
||||||
_active.put(player, horse);
|
_active.put(player, mount);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -68,8 +69,10 @@ public class MountSheep extends HorseMount
|
|||||||
if (event.getType() != UpdateType.TICK)
|
if (event.getType() != UpdateType.TICK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (Horse horse : GetActive().values())
|
for (SingleEntityMountData<Horse> horseData : GetActive().values())
|
||||||
{
|
{
|
||||||
|
Horse horse = horseData.getEntity();
|
||||||
|
|
||||||
DisguiseBase base = Manager.getDisguiseManager().getDisguise(horse);
|
DisguiseBase base = Manager.getDisguiseManager().getDisguise(horse);
|
||||||
if (base == null || !(base instanceof DisguiseSheep))
|
if (base == null || !(base instanceof DisguiseSheep))
|
||||||
continue;
|
continue;
|
||||||
|
@ -9,6 +9,7 @@ import org.bukkit.entity.Slime;
|
|||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.entity.EntityTargetEvent;
|
import org.bukkit.event.entity.EntityTargetEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.UtilAction;
|
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.common.util.UtilPlayer;
|
||||||
import mineplex.core.mount.Mount;
|
import mineplex.core.mount.Mount;
|
||||||
import mineplex.core.mount.MountManager;
|
import mineplex.core.mount.MountManager;
|
||||||
|
import mineplex.core.mount.SingleEntityMountData;
|
||||||
import mineplex.core.recharge.Recharge;
|
import mineplex.core.recharge.Recharge;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
|
||||||
public class MountSlime extends Mount<Slime>
|
public class MountSlime extends Mount<SingleEntityMountData<Slime>>
|
||||||
{
|
{
|
||||||
public MountSlime(MountManager manager)
|
public MountSlime(MountManager manager)
|
||||||
{
|
{
|
||||||
@ -44,10 +46,10 @@ public class MountSlime extends Mount<Slime>
|
|||||||
//Remove other mounts
|
//Remove other mounts
|
||||||
Manager.DeregisterAll(player);
|
Manager.DeregisterAll(player);
|
||||||
|
|
||||||
Slime mount = player.getWorld().spawn(player.getLocation(), Slime.class);
|
SingleEntityMountData<Slime> mount = new SingleEntityMountData<Slime>(player, player.getWorld().spawn(player.getLocation(), Slime.class));
|
||||||
mount.setSize(2);
|
mount.getEntity().setSize(2);
|
||||||
|
|
||||||
mount.setCustomName(player.getName() + "'s " + GetName());
|
mount.getEntity().setCustomName(player.getName() + "'s " + GetName());
|
||||||
|
|
||||||
//Inform
|
//Inform
|
||||||
UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + "."));
|
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)
|
public void Disable(Player player)
|
||||||
{
|
{
|
||||||
Slime mount = _active.remove(player);
|
SingleEntityMountData<Slime> mount = _active.remove(player);
|
||||||
if (mount != null)
|
if (mount != null)
|
||||||
{
|
{
|
||||||
mount.remove();
|
mount.remove();
|
||||||
@ -79,11 +81,8 @@ public class MountSlime extends Mount<Slime>
|
|||||||
if (!GetActive().containsKey(event.getPlayer()))
|
if (!GetActive().containsKey(event.getPlayer()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!GetActive().get(event.getPlayer()).equals(event.getRightClicked()))
|
if(!GetActive().get(event.getPlayer()).ownsMount(event.getPlayer()))
|
||||||
{
|
|
||||||
UtilPlayer.message(event.getPlayer(), F.main("Mount", "This is not your Mount!"));
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
event.getPlayer().leaveVehicle();
|
event.getPlayer().leaveVehicle();
|
||||||
event.getPlayer().eject();
|
event.getPlayer().eject();
|
||||||
@ -108,10 +107,15 @@ public class MountSlime extends Mount<Slime>
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
//Bounce
|
//Bounce
|
||||||
for (Slime slime : GetActive().values())
|
for (SingleEntityMountData<Slime> slimeData : GetActive().values())
|
||||||
{
|
{
|
||||||
|
Slime slime = slimeData.getEntity();
|
||||||
|
|
||||||
if (slime.getPassenger() == null)
|
if (slime.getPassenger() == null)
|
||||||
|
{
|
||||||
|
UtilEnt.setFakeHead(slime, false);
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!UtilEnt.isGrounded(slime))
|
if (!UtilEnt.isGrounded(slime))
|
||||||
continue;
|
continue;
|
||||||
@ -124,14 +128,19 @@ public class MountSlime extends Mount<Slime>
|
|||||||
if (!Recharge.Instance.use(player, GetName(), 200, false, false))
|
if (!Recharge.Instance.use(player, GetName(), 200, false, false))
|
||||||
continue;
|
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);
|
slime.getWorld().playSound(slime.getLocation(), Sound.SLIME_WALK, 1f, 0.75f);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Collide
|
//Collide
|
||||||
for (Slime slime : GetActive().values())
|
for (SingleEntityMountData<Slime> slimeData : GetActive().values())
|
||||||
{
|
{
|
||||||
|
Slime slime = slimeData.getEntity();
|
||||||
if (slime.getPassenger() == null)
|
if (slime.getPassenger() == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -143,8 +152,10 @@ public class MountSlime extends Mount<Slime>
|
|||||||
if (!Recharge.Instance.usable(player, GetName() + " Collide"))
|
if (!Recharge.Instance.usable(player, GetName() + " Collide"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (Slime other : GetActive().values())
|
for (SingleEntityMountData<Slime> otherSlime : GetActive().values())
|
||||||
{
|
{
|
||||||
|
Slime other = otherSlime.getEntity();
|
||||||
|
|
||||||
if (other.equals(slime))
|
if (other.equals(slime))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -4,21 +4,6 @@ import java.lang.reflect.Field;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Map.Entry;
|
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.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
@ -32,6 +17,22 @@ import org.bukkit.event.EventHandler;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.util.Vector;
|
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
|
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()) + "."));
|
UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + "."));
|
||||||
|
|
||||||
//Store
|
//Store
|
||||||
_active.put(player, horse);
|
SingleEntityMountData<Horse> mount = new SingleEntityMountData<Horse>(player, horse);
|
||||||
|
_active.put(player, mount);
|
||||||
|
|
||||||
DisguiseSpider spider = new DisguiseSpider(horse);
|
DisguiseSpider spider = new DisguiseSpider(horse);
|
||||||
spider.setName(player.getName() + "'s Spider Mount");
|
spider.setName(player.getName() + "'s Spider Mount");
|
||||||
@ -105,7 +107,7 @@ public class MountSpider extends HorseMount
|
|||||||
ArrayList<Horse> used = new ArrayList<Horse>();
|
ArrayList<Horse> used = new ArrayList<Horse>();
|
||||||
for (Player player : GetActive().keySet())
|
for (Player player : GetActive().keySet())
|
||||||
{
|
{
|
||||||
Horse horse = GetActive().get(player);
|
Horse horse = GetActive().get(player).getEntity();
|
||||||
|
|
||||||
used.add(horse);
|
used.add(horse);
|
||||||
|
|
||||||
@ -126,21 +128,24 @@ public class MountSpider extends HorseMount
|
|||||||
if (event.getType() != UpdateType.TICK)
|
if (event.getType() != UpdateType.TICK)
|
||||||
return;
|
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;
|
continue;
|
||||||
|
|
||||||
//If player is looking up
|
//If player is looking up
|
||||||
if (horse.getKey().getEyeLocation().getPitch() > -45)
|
if (player.getEyeLocation().getPitch() > -45)
|
||||||
continue;
|
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())
|
if (UtilBlock.airFoliage(block) || block.isLiquid())
|
||||||
continue;
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -191,7 +196,7 @@ public class MountSpider extends HorseMount
|
|||||||
|
|
||||||
for (Player player : GetActive().keySet())
|
for (Player player : GetActive().keySet())
|
||||||
{
|
{
|
||||||
final Horse horse = GetActive().get(player);
|
final Horse horse = GetActive().get(player).getEntity();
|
||||||
|
|
||||||
if (horse.getPassenger() != player)
|
if (horse.getPassenger() != player)
|
||||||
continue;
|
continue;
|
||||||
|
@ -1,27 +1,19 @@
|
|||||||
package mineplex.core.mount.types;
|
package mineplex.core.mount.types;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.ArmorStand;
|
import org.bukkit.entity.EntityType;
|
||||||
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.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.entity.EntityTargetEvent;
|
import org.bukkit.event.entity.EntityTargetEvent;
|
||||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
|
||||||
import mineplex.core.common.Rank;
|
import mineplex.core.common.Rank;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.mount.HorseMount;
|
|
||||||
import mineplex.core.mount.Mount;
|
import mineplex.core.mount.Mount;
|
||||||
import mineplex.core.mount.MountManager;
|
import mineplex.core.mount.MountManager;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
@ -85,11 +77,20 @@ public class MountTitan extends Mount<MountTitanData>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void interactMount(PlayerInteractEntityEvent event)
|
public void interactMount(PlayerInteractAtEntityEvent event)
|
||||||
{
|
{
|
||||||
if (event.getRightClicked() == null)
|
if (event.getRightClicked() == null)
|
||||||
return;
|
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()))
|
if (!GetActive().containsKey(event.getPlayer()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -123,7 +124,7 @@ public class MountTitan extends Mount<MountTitanData>
|
|||||||
{
|
{
|
||||||
for (MountTitanData data : _active.values())
|
for (MountTitanData data : _active.values())
|
||||||
{
|
{
|
||||||
if (data.ownsEntity(event.getEntity()))
|
if (data.isPartOfMount(event.getEntity()))
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,11 +3,7 @@
|
|||||||
package mineplex.core.mount.types;
|
package mineplex.core.mount.types;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
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 org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -20,9 +16,13 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import org.bukkit.util.EulerAngle;
|
import org.bukkit.util.EulerAngle;
|
||||||
import org.bukkit.util.Vector;
|
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;
|
private Slime _head;
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ public class MountTitanData
|
|||||||
|
|
||||||
public MountTitanData(Player player, String name)
|
public MountTitanData(Player player, String name)
|
||||||
{
|
{
|
||||||
_owner = player.getName();
|
super(player);
|
||||||
|
|
||||||
Location loc = player.getLocation();
|
Location loc = player.getLocation();
|
||||||
loc.setPitch(0);
|
loc.setPitch(0);
|
||||||
@ -72,7 +72,11 @@ public class MountTitanData
|
|||||||
{
|
{
|
||||||
//Head
|
//Head
|
||||||
if (_head.getPassenger() != null)
|
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);
|
Location infront = _head.getLocation().add(0, -1.5, 0);
|
||||||
|
|
||||||
@ -134,13 +138,12 @@ public class MountTitanData
|
|||||||
stand.remove();
|
stand.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean ownsMount(Player player)
|
@Override
|
||||||
|
public List<Entity> getEntityParts()
|
||||||
{
|
{
|
||||||
return _owner.equals(player.getName());
|
List<Entity> entities = new ArrayList<Entity>();
|
||||||
}
|
entities.addAll(_nodes);
|
||||||
|
entities.add(_head);
|
||||||
public boolean ownsEntity(Entity ent)
|
return entities;
|
||||||
{
|
|
||||||
return (_head.equals(ent) || _nodes.contains(ent));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,5 @@
|
|||||||
package mineplex.core.mount.types;
|
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.Material;
|
||||||
import org.bukkit.entity.Horse;
|
import org.bukkit.entity.Horse;
|
||||||
import org.bukkit.entity.Horse.Color;
|
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.entity.Horse.Variant;
|
||||||
import org.bukkit.event.EventHandler;
|
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 class MountUndead extends HorseMount
|
||||||
{
|
{
|
||||||
public MountUndead(MountManager manager)
|
public MountUndead(MountManager manager)
|
||||||
@ -37,16 +37,20 @@ public class MountUndead extends HorseMount
|
|||||||
public void Trail(UpdateEvent event)
|
public void Trail(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (event.getType() == UpdateType.TICK)
|
if (event.getType() == UpdateType.TICK)
|
||||||
for (Horse horse : GetActive().values())
|
for (SingleEntityMountData<Horse> horseData : GetActive().values())
|
||||||
UtilParticle.PlayParticle(ParticleType.FLAME, horse.getLocation().add(0, 1, 0),
|
{
|
||||||
0.25f, 0.25f, 0.25f, 0, 2,
|
Horse horse = horseData.getEntity();
|
||||||
ViewDist.NORMAL, UtilServer.getPlayers());
|
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)
|
if (event.getType() == UpdateType.FAST)
|
||||||
for (Horse horse : GetActive().values())
|
for (SingleEntityMountData<Horse> horseData : GetActive().values())
|
||||||
UtilParticle.PlayParticle(ParticleType.LAVA, horse.getLocation().add(0, 1, 0),
|
{
|
||||||
0.25f, 0.25f, 0.25f, 0, 1,
|
Horse horse = horseData.getEntity();
|
||||||
ViewDist.NORMAL, UtilServer.getPlayers());
|
UtilParticle.PlayParticleToAll(ParticleType.LAVA, horse.getLocation().add(0, 1, 0),
|
||||||
|
0.25f, 0.25f, 0.25f, 0, 1, ViewDist.NORMAL);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void Piston(BlockPistonExtendEvent event)
|
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
|
@EventHandler
|
||||||
public void Quit(PlayerQuitEvent event)
|
public void Quit(PlayerQuitEvent event)
|
||||||
{
|
{
|
||||||
|
@ -227,7 +227,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
|||||||
|
|
||||||
TaskManager taskManager = new TaskManager(plugin, _clientManager, webServerAddress);
|
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);
|
ClanTips = new ClanTips(plugin, this, preferencesManager);
|
||||||
|
|
||||||
@ -402,6 +402,11 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
|||||||
return _disguiseManager;
|
return _disguiseManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TutorialManager getTutorials()
|
||||||
|
{
|
||||||
|
return _tutorialManager;
|
||||||
|
}
|
||||||
|
|
||||||
public NpcManager getNPCManager()
|
public NpcManager getNPCManager()
|
||||||
{
|
{
|
||||||
return _npcManager;
|
return _npcManager;
|
||||||
|
@ -19,9 +19,9 @@ import mineplex.core.common.util.UtilPlayer;
|
|||||||
import mineplex.core.common.util.UtilServer;
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
import mineplex.core.common.util.UtilWorld;
|
import mineplex.core.common.util.UtilWorld;
|
||||||
import mineplex.core.recharge.Recharge;
|
|
||||||
import mineplex.game.clans.clans.event.ClanDisbandedEvent;
|
import mineplex.game.clans.clans.event.ClanDisbandedEvent;
|
||||||
import mineplex.game.clans.clans.event.PlayerClaimTerritoryEvent;
|
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.clans.event.PlayerUnClaimTerritoryEvent;
|
||||||
import mineplex.game.clans.core.repository.ClanTerritory;
|
import mineplex.game.clans.core.repository.ClanTerritory;
|
||||||
|
|
||||||
@ -157,10 +157,10 @@ public class ClansUtility
|
|||||||
|
|
||||||
if (inform)
|
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);
|
Clans.getTutorials().sendTutorialMsg(caller, F.desc("Matches via Clan", clanMatchString));
|
||||||
UtilPlayer.message(caller, F.desc("Matches via Player", playerMatchString), false);;
|
Clans.getTutorials().sendTutorialMsg(caller, F.desc("Matches via Player", playerMatchString));
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@ -183,7 +183,7 @@ public class ClansUtility
|
|||||||
if (!inform) return null;
|
if (!inform) return null;
|
||||||
|
|
||||||
// Inform
|
// 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)
|
if (matchList.size() > 0)
|
||||||
{
|
{
|
||||||
@ -191,7 +191,7 @@ public class ClansUtility
|
|||||||
for (ClanInfo cur : matchList)
|
for (ClanInfo cur : matchList)
|
||||||
matchString += cur.getName() + " ";
|
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;
|
return null;
|
||||||
@ -554,31 +554,31 @@ public class ClansUtility
|
|||||||
{
|
{
|
||||||
if (Clans.getClanMemberUuidMap().containsKey(caller.getUniqueId()))
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Clans.Get(caller).canJoin())
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clanInfo == null)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!clanInfo.isInvited(caller.getName()))
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clanInfo.getSize() >= clanInfo.getMaxSize())
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -591,12 +591,12 @@ public class ClansUtility
|
|||||||
if (data)
|
if (data)
|
||||||
{
|
{
|
||||||
// Inform
|
// 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());
|
clanInfo.inform(F.name(caller.getName()) + " has joined your Clan.", caller.getName());
|
||||||
}
|
}
|
||||||
else
|
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)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clan.getMembers().get(caller.getUniqueId()).getRole() == ClanRole.LEADER && clan.getMembers().size() > 1)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -629,7 +629,7 @@ public class ClansUtility
|
|||||||
public void run(Boolean data)
|
public void run(Boolean data)
|
||||||
{
|
{
|
||||||
// Inform
|
// 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);
|
clan.inform(F.name(caller.getName()) + " has left your Clan.", null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -646,13 +646,13 @@ public class ClansUtility
|
|||||||
|
|
||||||
if (clan == null)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getRole(caller) != ClanRole.LEADER)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -665,6 +665,8 @@ public class ClansUtility
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Clans.messageClan(clan, C.cYellow + caller.getName() + C.cGray + " has disbanded the Clan.");
|
||||||
|
|
||||||
// Task
|
// Task
|
||||||
Clans.getClanDataAccess().delete(clan, new Callback<Boolean>()
|
Clans.getClanDataAccess().delete(clan, new Callback<Boolean>()
|
||||||
{
|
{
|
||||||
@ -673,10 +675,11 @@ public class ClansUtility
|
|||||||
{
|
{
|
||||||
if (!data)
|
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
|
}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);
|
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)
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN)
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ClansManager.isClaimable(caller.getLocation()))
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (clan.getEnergy() == 0)
|
// 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;
|
// return false;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@ -722,14 +735,14 @@ public class ClansUtility
|
|||||||
}
|
}
|
||||||
else
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (clan.getClaims() >= clan.getClaimsMax())
|
// 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;
|
// 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))
|
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."));
|
Clans.getTutorials().sendTutorialMsg(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", "This means a Territory has all sides claimed."));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -766,7 +779,7 @@ public class ClansUtility
|
|||||||
}
|
}
|
||||||
else if (rel(clan, adjClan) != ClanRelation.SELF)
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -775,21 +788,21 @@ public class ClansUtility
|
|||||||
// Boxed
|
// Boxed
|
||||||
if (checkBox(caller.getLocation().getChunk(), 4))
|
if (checkBox(caller.getLocation().getChunk(), 4))
|
||||||
{
|
{
|
||||||
UtilPlayer.message(caller, F.main("Clans", "You cannot claim this Territory, it causes a box."));
|
Clans.getTutorials().sendTutorialMsg(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", "This means a Territory has all sides claimed."));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isNearAdminClaim(caller.getLocation()))
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not Next to Self
|
// Not Next to Self
|
||||||
if (!selfAdj && !clan.getClaimSet().isEmpty())
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -798,7 +811,7 @@ public class ClansUtility
|
|||||||
{
|
{
|
||||||
if (!UtilTime.elapsed(Clans.getUnclaimMap().get(chunk), Clans.getReclaimTime()))
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
@ -813,7 +826,7 @@ public class ClansUtility
|
|||||||
{
|
{
|
||||||
if (UtilMath.offset(cur, caller) < 16) if (playerEnemy(caller, cur))
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -835,7 +848,7 @@ public class ClansUtility
|
|||||||
Clans.getClanDataAccess().claim(clan.getName(), chunk, caller.getName(), false);
|
Clans.getClanDataAccess().claim(clan.getName(), chunk, caller.getName(), false);
|
||||||
|
|
||||||
// Inform
|
// 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());
|
clan.inform(F.name(caller.getName()) + " claimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + ".", caller.getName());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -872,7 +885,7 @@ public class ClansUtility
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Change Inform
|
// 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
|
// Inform
|
||||||
UtilServer.broadcast(F.main("Clans", F.elem(clientClan.getName()) + " unclaimed from " + F.elem(ownerClan.getName()) + " at " + F.elem(UtilWorld.locToStrClean(caller.getLocation())) + "."));
|
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)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -900,13 +913,13 @@ public class ClansUtility
|
|||||||
|
|
||||||
if (target.equals(caller.getName()))
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.getRole().ordinal() <= target.getRole().ordinal())
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -941,7 +954,7 @@ public class ClansUtility
|
|||||||
|
|
||||||
if (clan == null)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -952,19 +965,19 @@ public class ClansUtility
|
|||||||
|
|
||||||
if (target.equals(caller.getName()))
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.getRole().ordinal() <= target.getRole().ordinal())
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target.getRole() == ClanRole.RECRUIT)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -991,7 +1004,7 @@ public class ClansUtility
|
|||||||
|
|
||||||
if (clan == null)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1002,20 +1015,20 @@ public class ClansUtility
|
|||||||
|
|
||||||
if (self.getRole() != ClanRole.LEADER && self.getRole() != ClanRole.ADMIN)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clansPlayer.getRole() == ClanRole.LEADER)
|
if (clansPlayer.getRole() == ClanRole.LEADER)
|
||||||
{
|
{
|
||||||
UtilPlayer.message(caller, F.main("Clans", "Clan leaders cannot be kicked."));
|
Clans.getTutorials().sendTutorialMsg(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", "To disband a clan, use /c disband"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((clansPlayer.getRole() == ClanRole.LEADER && self.getRole() == ClanRole.ADMIN) || (clansPlayer.getRole() == ClanRole.ADMIN && self.getRole() == ClanRole.ADMIN))
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1027,8 +1040,8 @@ public class ClansUtility
|
|||||||
public void run(Boolean data)
|
public void run(Boolean data)
|
||||||
{
|
{
|
||||||
// Inform
|
// Inform
|
||||||
if (player != null) UtilPlayer.message(player, F.main("Clans", F.name(caller.getName()) + " kicked you from " + F.elem("Clan " + clan.getName()) + "."));
|
if (player != null) Clans.getTutorials().sendTutorialMsg(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."));
|
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());
|
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)
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1059,14 +1072,14 @@ public class ClansUtility
|
|||||||
// Role
|
// Role
|
||||||
if (clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN)
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not Claimed
|
// Not Claimed
|
||||||
if (ownerClan == null || !ownerClan.equals(clan))
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1084,7 +1097,7 @@ public class ClansUtility
|
|||||||
Clans.getClanDataAccess().unclaim(chunk, caller.getName(), true);
|
Clans.getClanDataAccess().unclaim(chunk, caller.getName(), true);
|
||||||
|
|
||||||
// Inform
|
// 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());
|
clan.inform(F.name(caller.getName()) + " unclaimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + ".", caller.getName());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -1096,13 +1109,13 @@ public class ClansUtility
|
|||||||
|
|
||||||
if (clan == null)
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER)
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1120,7 +1133,7 @@ public class ClansUtility
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Inform
|
// 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());
|
clan.inform(F.name(caller.getName()) + " unclaimed all your Clans Territory.", caller.getName());
|
||||||
|
|
||||||
return true;
|
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)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target.getName().equals(caller.getName()))
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inform
|
// Inform
|
||||||
clan.inform(F.name(caller.getName()) + " invited " + F.name(target.getName()) + " to join your Clan.", caller.getName());
|
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."));
|
Clans.getTutorials().sendTutorialMsg(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()) + "."));
|
Clans.getTutorials().sendTutorialMsg(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(target, F.main("Clans", "Type " + F.elem("/c join " + clan.getName()) + " to accept!"));
|
||||||
|
|
||||||
// Task
|
// Task
|
||||||
Clans.getClanDataAccess().invite(clan, target.getName(), caller.getName());
|
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.ClansManager;
|
||||||
import mineplex.game.clans.clans.ClientClan;
|
import mineplex.game.clans.clans.ClientClan;
|
||||||
import mineplex.game.clans.clans.event.ClansCommandExecutedEvent;
|
import mineplex.game.clans.clans.event.ClansCommandExecutedEvent;
|
||||||
|
import mineplex.game.clans.tutorials.Tutorial;
|
||||||
import mineplex.game.clans.tutorials.TutorialManager;
|
import mineplex.game.clans.tutorials.TutorialManager;
|
||||||
import net.minecraft.server.v1_8_R3.EnumDirection;
|
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("+"))
|
else if (args[0].equalsIgnoreCase("promote") || args[0].equalsIgnoreCase("+"))
|
||||||
promote(caller, args);
|
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("-"))
|
else if (args[0].equalsIgnoreCase("demote") || args[0].equalsIgnoreCase("-"))
|
||||||
demote(caller, args);
|
demote(caller, args);
|
||||||
|
|
||||||
@ -121,12 +123,41 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
infoClan(caller, args[0]);
|
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)
|
public void commandChat(Player caller, String[] args)
|
||||||
{
|
{
|
||||||
if (args.length == 0)
|
if (args.length == 0)
|
||||||
{
|
{
|
||||||
Plugin.Get(caller).setClanChat(!Plugin.Get(caller).isClanChat());
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,7 +166,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
{
|
{
|
||||||
ClanInfo clan = Plugin.getClanUtility().getClanByPlayer(caller);
|
ClanInfo clan = Plugin.getClanUtility().getClanByPlayer(caller);
|
||||||
if (clan == null)
|
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
|
else
|
||||||
Plugin.chatClan(clan, caller, F.combine(args, 0, null, false));
|
Plugin.chatClan(clan, caller, F.combine(args, 0, null, false));
|
||||||
}
|
}
|
||||||
@ -146,7 +177,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
if (args.length == 0)
|
if (args.length == 0)
|
||||||
{
|
{
|
||||||
Plugin.Get(caller).setAllyChat(!Plugin.Get(caller).isAllyChat());
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,7 +186,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
{
|
{
|
||||||
ClanInfo clan = Plugin.getClanUtility().getClanByPlayer(caller);
|
ClanInfo clan = Plugin.getClanUtility().getClanByPlayer(caller);
|
||||||
if (clan == null)
|
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
|
else
|
||||||
Plugin.chatAlly(clan, caller, F.combine(args, 0, null, false));
|
Plugin.chatAlly(clan, caller, F.combine(args, 0, null, false));
|
||||||
}
|
}
|
||||||
@ -171,30 +202,30 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
UtilPlayer.message(caller, F.main("Clans", "Commands List;"));
|
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Commands List;"));
|
||||||
UtilPlayer.message(caller, F.help("/c create <clan>", "Create new Clan", Rank.ALL));
|
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c create <clan>", "Create new Clan", Rank.ALL));
|
||||||
UtilPlayer.message(caller, F.help("/c join <clan>", "Join a Clan", Rank.ALL));
|
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c join <clan>", "Join a Clan", Rank.ALL));
|
||||||
UtilPlayer.message(caller, F.help("/c leave <clan>", "Leave your Clan", Rank.ALL));
|
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c leave <clan>", "Leave your Clan", Rank.ALL));
|
||||||
UtilPlayer.message(caller, F.help("/c map <toggle>", "View Clan Map", Rank.ALL));
|
_manager.getTutorials().sendTutorialMsg(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.help("/cc (Message)", "Clan Chat (Toggle)", Rank.ALL));
|
||||||
|
|
||||||
UtilPlayer.message(caller, F.help("/c promote <player>", "Promote Player in Clan", Rank.MODERATOR));
|
_manager.getTutorials().sendTutorialMsg(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 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));
|
_manager.getTutorials().sendTutorialMsg(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));
|
_manager.getTutorials().sendTutorialMsg(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));
|
_manager.getTutorials().sendTutorialMsg(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));
|
_manager.getTutorials().sendTutorialMsg(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));
|
_manager.getTutorials().sendTutorialMsg(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));
|
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c trust <clan>", "Give Trust to Clan", Rank.ADMIN));
|
||||||
UtilPlayer.message(caller, F.help("/c claim", "Claim Territory", Rank.ADMIN));
|
_manager.getTutorials().sendTutorialMsg(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 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)
|
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()))
|
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;
|
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 +
|
* F.main("Clans", "You cannot join a Clan for " + C.mTime +
|
||||||
* UtilTime.convertString(System.currentTimeMillis() -
|
* UtilTime.convertString(System.currentTimeMillis() -
|
||||||
* client.getDelay(), 1, TimeUnit.FIT) + C.mBody + ".")); return; }
|
* client.getDelay(), 1, TimeUnit.FIT) + C.mBody + ".")); return; }
|
||||||
@ -218,37 +249,37 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
|
|
||||||
if (args.length < 2)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!UtilInput.valid(args[1]))
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args[1].length() < Plugin.getNameMin())
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args[1].length() > Plugin.getNameMax())
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Plugin.getChat().getFilteredMessage(caller, args[1]).contains("*"))
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ClansBlacklist.isValidClanName(args[1]))
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,7 +290,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
{
|
{
|
||||||
if (clanExists)
|
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
|
else
|
||||||
{
|
{
|
||||||
@ -271,11 +302,11 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
if (data == null)
|
if (data == null)
|
||||||
{
|
{
|
||||||
// Hopefully shouldn't happen!
|
// 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
|
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)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.length < 2)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -315,25 +346,25 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
{
|
{
|
||||||
if (Plugin.getClanMemberUuidMap().containsKey(caller.getUniqueId()))
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Plugin.Get(caller).canJoin())
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.length < 2)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!UtilInput.valid(args[1]))
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -342,13 +373,13 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
|
|
||||||
if (!clan.isInvited(caller.getName()))
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clan.getSize() >= clan.getMaxSize())
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -361,12 +392,12 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
if (data)
|
if (data)
|
||||||
{
|
{
|
||||||
// Inform
|
// 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());
|
clan.inform(F.name(caller.getName()) + " has joined your Clan.", caller.getName());
|
||||||
}
|
}
|
||||||
else
|
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)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clan.getMembers().get(caller.getUniqueId()).getRole() == ClanRole.LEADER && clan.getMembers().size() > 1)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -399,7 +430,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
public void run(Boolean data)
|
public void run(Boolean data)
|
||||||
{
|
{
|
||||||
// Inform
|
// 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);
|
clan.inform(F.name(caller.getName()) + " has left your Clan.", null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -416,13 +447,13 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
|
|
||||||
if (clan == null)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.length < 2)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -437,13 +468,13 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
|
|
||||||
if (clan == null)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.length < 2)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -458,13 +489,13 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
|
|
||||||
if (clan == null)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.length < 2)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -479,19 +510,19 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
|
|
||||||
if (cA == null)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cA.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && cA.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.length < 2)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -501,31 +532,31 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
|
|
||||||
if (cA.isSelf(cB.getName()))
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cA.isAlly(cB.getName()))
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cA.getAllies() >= cA.getAlliesMax())
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cB.getAllies() >= cB.getAlliesMax())
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Recharge.Instance.usable(caller, "AllyReq" + cB.getName()))
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -535,7 +566,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
Plugin.getClanDataAccess().ally(cA, cB, caller.getName());
|
Plugin.getClanDataAccess().ally(cA, cB, caller.getName());
|
||||||
|
|
||||||
// Inform
|
// 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());
|
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);
|
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());
|
Plugin.getClanDataAccess().requestAlly(cA, cB, caller.getName());
|
||||||
|
|
||||||
// Inform
|
// 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());
|
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);
|
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)
|
// 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;
|
// return;
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// if (cA.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && cA.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN)
|
// 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;
|
// return;
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// if (args.length < 2)
|
// 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;
|
// return;
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
@ -581,7 +612,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
//
|
//
|
||||||
// if (!cA.isAlly(cB.getName()))
|
// 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;
|
// return;
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
@ -589,14 +620,14 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
// if (Plugin.getClanDataAccess().trust(cA, cB, caller.getName()))
|
// if (Plugin.getClanDataAccess().trust(cA, cB, caller.getName()))
|
||||||
// {
|
// {
|
||||||
// // Inform
|
// // 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());
|
// 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);
|
// cB.inform(F.elem("Clan " + cA.getName()) + " has given trust to you.", null);
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
// // Inform
|
// // 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());
|
// 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);
|
// 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)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cA.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && cA.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.length < 2)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -630,11 +661,11 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
|
|
||||||
if (cB.isSelf(cA.getName()))
|
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()))
|
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()))
|
else if (cB.isAlly(cA.getName()))
|
||||||
{
|
{
|
||||||
@ -642,7 +673,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
Plugin.getClanDataAccess().neutral(cA, cB, caller.getName(), true);
|
Plugin.getClanDataAccess().neutral(cA, cB, caller.getName(), true);
|
||||||
|
|
||||||
// Inform
|
// 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());
|
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);
|
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
|
// 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
|
// Inform
|
||||||
UtilServer.broadcast(F.main("Clans", F.elem(clientClan.getName()) + " unclaimed from " + F.elem(ownerClan.getName()) + " at " + F.elem(UtilWorld.locToStrClean(caller.getLocation())) + "."));
|
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)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clan.getHome() == null)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!clan.getClaimSet().contains(UtilWorld.chunkToStr(clan.getHome().getChunk())))
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Plugin.getClanUtility().isSafe(caller.getLocation()))
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Plugin.getClanUtility().isSpecial(caller.getLocation(), "Spawn"))
|
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;
|
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))
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -760,7 +791,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
* (Player cur : clan.GetHome().getWorld().getPlayers()) if
|
* (Player cur : clan.GetHome().getWorld().getPlayers()) if
|
||||||
* (client.Clan().GetRelation(cur.getName()) == ClanRelation.NEUTRAL) if
|
* (client.Clan().GetRelation(cur.getName()) == ClanRelation.NEUTRAL) if
|
||||||
* (clan.GetClaimSet().contains(UtilWorld.chunkToStr(cur.getLocation().
|
* (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;
|
* "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));
|
Plugin.getTeleport().TP(caller, clan.getHome().add(0, 1, 0));
|
||||||
|
|
||||||
// Inform
|
// 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)
|
public void homeSet(Player caller)
|
||||||
@ -790,31 +821,31 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
|
|
||||||
if (clan == null)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Plugin.getClanUtility().getOwner(caller.getLocation()) == null)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Plugin.getClanUtility().getOwner(caller.getLocation()).isSelf(clan.getName()))
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(caller.getLocation().add(0, 1, 0).getBlock().getType().equals(Material.AIR) && caller.getLocation().add(0, 2, 0).getBlock().getType().equals(Material.AIR)))
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -823,7 +854,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
|
|
||||||
if (!bedPlaced)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -839,7 +870,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
Plugin.ClanTips.displayTip(TipType.SETHOME, caller);
|
Plugin.ClanTips.displayTip(TipType.SETHOME, caller);
|
||||||
|
|
||||||
// Inform
|
// 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());
|
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);
|
{System.out.println(search);
|
||||||
if (search == null)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -869,13 +900,13 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
{
|
{
|
||||||
if (_manager.getClientManager().hasRank(caller, Rank.ADMIN))
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (search == null)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -904,7 +935,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
|
|
||||||
if (clan == null)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -914,6 +945,6 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
|
|
||||||
if (clan == null) return;
|
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)
|
public RegionsCommand(ClansManager plugin)
|
||||||
{
|
{
|
||||||
super(plugin, Rank.ADMIN, new Rank[]{Rank.JNR_DEV},"region-reset");
|
super(plugin, Rank.ADMIN,"region-reset");
|
||||||
|
|
||||||
_manager = plugin;
|
_manager = plugin;
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import org.bukkit.entity.Player;
|
|||||||
import mineplex.core.command.CommandBase;
|
import mineplex.core.command.CommandBase;
|
||||||
import mineplex.core.common.Rank;
|
import mineplex.core.common.Rank;
|
||||||
import mineplex.core.task.TaskManager;
|
import mineplex.core.task.TaskManager;
|
||||||
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
import mineplex.game.clans.tutorials.Tutorial;
|
import mineplex.game.clans.tutorials.Tutorial;
|
||||||
import mineplex.game.clans.tutorials.TutorialManager;
|
import mineplex.game.clans.tutorials.TutorialManager;
|
||||||
import mineplex.game.clans.tutorials.gettingstarted.TutorialGettingStarted;
|
import mineplex.game.clans.tutorials.gettingstarted.TutorialGettingStarted;
|
||||||
@ -15,11 +16,14 @@ public class RestartTutCommand extends CommandBase<TutorialManager>
|
|||||||
{
|
{
|
||||||
public RestartTutCommand(TutorialManager plugin)
|
public RestartTutCommand(TutorialManager plugin)
|
||||||
{
|
{
|
||||||
super(plugin, Rank.ALL, "rst", "rstut");
|
super(plugin, Rank.ALL, "rst", "rstut", "reset");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void Execute(Player caller, String[] args)
|
public void Execute(Player caller, String[] args)
|
||||||
|
{
|
||||||
|
if (ClansManager.getInstance().getClanUtility().getClaim(caller.getLocation()) != null
|
||||||
|
&& ClansManager.getInstance().getClanUtility().getClaim(caller.getLocation()).isSafe(caller.getLocation()))
|
||||||
{
|
{
|
||||||
String ignoreString = String.format(Tutorial.TUTORIAL_REWARD_TASK, "GettingStartedTutorial");
|
String ignoreString = String.format(Tutorial.TUTORIAL_REWARD_TASK, "GettingStartedTutorial");
|
||||||
Integer ignoreInt = TaskManager.Instance.getTaskId(ignoreString);
|
Integer ignoreInt = TaskManager.Instance.getTaskId(ignoreString);
|
||||||
@ -37,4 +41,9 @@ public class RestartTutCommand extends CommandBase<TutorialManager>
|
|||||||
TutorialManager.Instance.cancelTutorial(caller);
|
TutorialManager.Instance.cancelTutorial(caller);
|
||||||
TutorialManager.Instance.startTutorial(TutorialGettingStarted.class, caller);
|
TutorialManager.Instance.startTutorial(TutorialGettingStarted.class, caller);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TutorialManager.Instance.sendTutorialMsg(caller, "You must be in a safezone to restart the tutorial.");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -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)
|
public List<String> getLines(ScoreboardManager manager, Player player, List<String> out)
|
||||||
{
|
{
|
||||||
List<String> output = new ArrayList<String>();
|
List<String> output = new ArrayList<String>();
|
||||||
output.add(C.cYellow + "Players Online: " + UtilServer.getPlayers().length + "/100");
|
|
||||||
output.add("");
|
output.add("");
|
||||||
|
output.add(C.cYellow + "Players Online " + UtilServer.getPlayers().length + "/100");
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ import mineplex.minecraft.game.core.boss.WorldEvent;
|
|||||||
public enum WorldEventType
|
public enum WorldEventType
|
||||||
{
|
{
|
||||||
// SLIME_KING("Slime King", SlimeBoss.class, 30),
|
// 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);// ,
|
UNDEAD_CAMP("Undead Camp", UndeadCamp.class, 30);// ,
|
||||||
// Golem("Iron Wizard", GolemBoss.class, 30);
|
// Golem("Iron Wizard", GolemBoss.class, 30);
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ public class HillData
|
|||||||
|
|
||||||
public boolean isOnHill(Location location, Location eventLocation)
|
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)
|
public Location getHillCenter(Location eventLocation)
|
||||||
|
@ -117,7 +117,7 @@ public class KingHill extends WorldEvent
|
|||||||
if (_hill.isOnHill(player.getLocation(), getCenterLocation()))
|
if (_hill.isOnHill(player.getLocation(), getCenterLocation()))
|
||||||
{
|
{
|
||||||
ClanInfo playerClan = _clansManager.getClan(player);
|
ClanInfo playerClan = _clansManager.getClan(player);
|
||||||
if (playerClan != null)
|
if (playerClan != null && !playerClan.equals(lastClan))
|
||||||
{
|
{
|
||||||
clanCount++;
|
clanCount++;
|
||||||
lastClan = playerClan;
|
lastClan = playerClan;
|
||||||
|
@ -55,6 +55,7 @@ import mineplex.core.common.util.UtilInv;
|
|||||||
import mineplex.core.common.util.UtilItem;
|
import mineplex.core.common.util.UtilItem;
|
||||||
import mineplex.core.common.util.UtilMath;
|
import mineplex.core.common.util.UtilMath;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
import mineplex.core.itemstack.ItemStackFactory;
|
import mineplex.core.itemstack.ItemStackFactory;
|
||||||
import mineplex.core.recharge.Recharge;
|
import mineplex.core.recharge.Recharge;
|
||||||
@ -433,7 +434,7 @@ public class Gameplay extends MiniPlugin
|
|||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void replantTree(BlockBreakEvent event)
|
public void replantTree(BlockBreakEvent event)
|
||||||
{
|
{
|
||||||
Block block = event.getBlock();
|
final Block block = event.getBlock();
|
||||||
|
|
||||||
if (!UtilItem.isLog(block.getType()))
|
if (!UtilItem.isLog(block.getType()))
|
||||||
{
|
{
|
||||||
@ -455,22 +456,15 @@ public class Gameplay extends MiniPlugin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Location saplingArea = null;
|
final byte data = block.getData();
|
||||||
|
|
||||||
for (Block otherBlock : UtilBlock.getInRadius(event.getBlock().getLocation(), 4.5).keySet())
|
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable() {
|
||||||
|
public void run()
|
||||||
{
|
{
|
||||||
if (!otherBlock.equals(UtilBlock.getHighest(otherBlock.getLocation().getWorld(), otherBlock.getX(), otherBlock.getZ())))
|
block.setType(Material.SAPLING);
|
||||||
{
|
block.setData(data);
|
||||||
saplingArea = otherBlock.getLocation();
|
|
||||||
if (Math.random() > .75)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}, 20 * 5);
|
||||||
}
|
|
||||||
|
|
||||||
saplingArea.add(0, 1, 0).getBlock().setType(Material.SAPLING);
|
|
||||||
saplingArea.getBlock().setData(block.getData());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -12,7 +12,7 @@ public class GearCommand extends CommandBase<GearManager>
|
|||||||
|
|
||||||
public GearCommand(GearManager plugin)
|
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;
|
_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.UtilFirework;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.common.util.UtilServer;
|
import mineplex.core.common.util.UtilServer;
|
||||||
|
import mineplex.core.common.util.UtilTextMiddle;
|
||||||
import mineplex.core.donation.DonationManager;
|
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.ScoreboardManager;
|
||||||
import mineplex.core.scoreboard.elements.ScoreboardElement;
|
import mineplex.core.scoreboard.elements.ScoreboardElement;
|
||||||
import mineplex.core.task.TaskManager;
|
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.ClansManager;
|
||||||
import mineplex.game.clans.clans.event.ClanTipEvent;
|
import mineplex.game.clans.clans.event.ClanTipEvent;
|
||||||
import mineplex.game.clans.economy.GoldManager;
|
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 TUTORIAL_REWARD_TASK = "tatatatatat%sRewardGiven"; //do not change
|
||||||
public static String SKIPPED_TASK = "tatatatata%sSkip";
|
public static String SKIPPED_TASK = "tatatatata%sSkip";
|
||||||
|
|
||||||
|
public static String AllowedMessage = C.cGold + "TutorialAllowedMessage" + C.Reset;
|
||||||
|
|
||||||
protected final TutorialManager _manager;
|
protected final TutorialManager _manager;
|
||||||
protected final GoldManager _goldManager;
|
protected final GoldManager _goldManager;
|
||||||
protected final ClansManager _clansManager;
|
protected final ClansManager _clansManager;
|
||||||
@ -75,7 +82,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
|||||||
protected int _gemReward = -1;
|
protected int _gemReward = -1;
|
||||||
protected int _coinReward = -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;
|
_clansManager = clansManager;
|
||||||
_goldManager = goldManager;
|
_goldManager = goldManager;
|
||||||
@ -144,13 +151,31 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
|||||||
|
|
||||||
protected boolean hasFinishedTask(Player player, TutorialTask<?> task)
|
protected boolean hasFinishedTask(Player player, TutorialTask<?> task)
|
||||||
{
|
{
|
||||||
|
if (get(player).QueuedFinish)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return get(player).CurrentTask.getID() < task.getID();
|
return get(player).CurrentTask.getID() < task.getID();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void finishTask(final Player player, final TutorialTask<?> task)
|
protected void finishTask(final Player player, final TutorialTask<?> task)
|
||||||
{
|
{
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
get(player).LastDescriptionSentTime = 0;
|
get(player).LastDescriptionSentTime = 0;
|
||||||
get(player).CurrentTask.visibleFinish(player);
|
get(player).CurrentTask.visibleFinish(player);
|
||||||
|
|
||||||
|
// 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()
|
||||||
|
{
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
// Cycle to next task, or null if last task.
|
||||||
get(player).CurrentTask = task.equals(_tasks.get(_tasks.size())) ? null : _tasks.get(task.getID() + 1);
|
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 (!_taskManager.hasCompletedTask(player, String.format(TASK_COMPLETE_TASK, _technicalName, task.getTechnicalName())))
|
||||||
@ -159,19 +184,21 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
|||||||
{
|
{
|
||||||
public void run(final Boolean completed)
|
public void run(final Boolean completed)
|
||||||
{
|
{
|
||||||
|
// If last task, end tutorial.
|
||||||
if (task.equals(_tasks.get(_tasks.size())))
|
if (task.equals(_tasks.get(_tasks.size())))
|
||||||
{
|
{
|
||||||
finishFor(player);
|
finishFor(player);
|
||||||
}
|
}
|
||||||
else
|
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()
|
_manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(_manager.getPlugin(), new Runnable()
|
||||||
{
|
{
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
get(player).CurrentTask.deploy(player);
|
get(player).CurrentTask.startFor(player);
|
||||||
}
|
}
|
||||||
}, 10L);
|
}, 30L);
|
||||||
}
|
}
|
||||||
|
|
||||||
player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1.5f);
|
player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1.5f);
|
||||||
@ -179,6 +206,8 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
|||||||
}, 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)
|
public TutorialTask<?> getTask(final String technicalName)
|
||||||
{
|
{
|
||||||
@ -223,11 +252,24 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
|||||||
|
|
||||||
private void finishFor(final Player player)
|
private void finishFor(final Player player)
|
||||||
{
|
{
|
||||||
|
if (player.getOpenInventory() != null)
|
||||||
|
{
|
||||||
|
_inTutorial.get(player.getName()).QueuedFinish = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
_inTutorial.remove(player.getName());
|
_inTutorial.remove(player.getName());
|
||||||
|
|
||||||
UtilFirework.launchFirework(player.getLocation(), Type.BALL_LARGE, Color.LIME, false, false, new Vector(0, 0, 0), 1);
|
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()
|
||||||
|
{
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
// Custom Finish Method (usually messages)
|
||||||
onFinished(player);
|
onFinished(player);
|
||||||
|
|
||||||
|
// Do Reward
|
||||||
if (!_taskManager.hasCompletedTask(player, String.format(TUTORIAL_REWARD_TASK, _technicalName)))
|
if (!_taskManager.hasCompletedTask(player, String.format(TUTORIAL_REWARD_TASK, _technicalName)))
|
||||||
{
|
{
|
||||||
_taskManager.completedTask(new Callback<Boolean>()
|
_taskManager.completedTask(new Callback<Boolean>()
|
||||||
@ -238,7 +280,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
|||||||
if (_goldReward != -1)
|
if (_goldReward != -1)
|
||||||
{
|
{
|
||||||
_goldManager.addGold(player, _goldReward);
|
_goldManager.addGold(player, _goldReward);
|
||||||
UtilPlayer.message(player, F.main("Tutorials", "You have been awarded " + F.elem(_goldReward + " Gold") + "."));
|
_manager.sendTutorialMsg(player, F.main("Tutorials", "You have been awarded " + F.elem(_goldReward + " Gold") + "."));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_gemReward != -1)
|
if (_gemReward != -1)
|
||||||
@ -246,7 +288,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
|||||||
_donationManager.RewardGems(new Callback<Boolean>() {
|
_donationManager.RewardGems(new Callback<Boolean>() {
|
||||||
public void run(Boolean data)
|
public void run(Boolean data)
|
||||||
{
|
{
|
||||||
UtilPlayer.message(player, F.main("Tutorials", "You have been awarded " + F.elem(_goldReward + " Gems") + "."));
|
_manager.sendTutorialMsg(player, F.main("Tutorials", "You have been awarded " + F.elem(_goldReward + " Gems") + "."));
|
||||||
}
|
}
|
||||||
}, "Clans", player.getName(), player.getUniqueId(), _gemReward);
|
}, "Clans", player.getName(), player.getUniqueId(), _gemReward);
|
||||||
}
|
}
|
||||||
@ -256,17 +298,19 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
|||||||
_donationManager.RewardCoins(new Callback<Boolean>() {
|
_donationManager.RewardCoins(new Callback<Boolean>() {
|
||||||
public void run(Boolean data)
|
public void run(Boolean data)
|
||||||
{
|
{
|
||||||
UtilPlayer.message(player, F.main("Tutorials", "You have been awarded " + F.elem(_coinReward + " Coins") + "."));
|
_manager.sendTutorialMsg(player, F.main("Tutorials", "You have been awarded " + F.elem(_coinReward + " Coins") + "."));
|
||||||
}
|
}
|
||||||
}, "Clans", player.getName(), _clansManager.getClientManager().getAccountId(player), _coinReward);
|
}, "Clans", player.getName(), _clansManager.getClientManager().getAccountId(player), _coinReward);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, player, String.format(TUTORIAL_REWARD_TASK, _technicalName));
|
}, player, String.format(TUTORIAL_REWARD_TASK, _technicalName));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_taskManager.hasCompletedTask(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>()
|
_taskManager.completedTask(new Callback<Boolean>()
|
||||||
{
|
{
|
||||||
public void run(final Boolean completed)
|
public void run(final Boolean completed)
|
||||||
@ -294,6 +338,9 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
|||||||
}
|
}
|
||||||
}, player, String.format(TUTORIAL_COMPLETE_TASK, _technicalName));
|
}, player, String.format(TUTORIAL_COMPLETE_TASK, _technicalName));
|
||||||
}
|
}
|
||||||
|
}, 20 * 2);
|
||||||
|
}
|
||||||
|
}, 20 * 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implementation left to sub classes.
|
// Implementation left to sub classes.
|
||||||
@ -315,7 +362,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
|||||||
|
|
||||||
_inTutorial.put(player.getName(), new TutorialClient(player, this));
|
_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);
|
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)
|
public void skip(final Player player)
|
||||||
{
|
{
|
||||||
new JsonMessage(
|
new JsonMessage(
|
||||||
|
AllowedMessage
|
||||||
|
)
|
||||||
|
.extra(
|
||||||
F.main(
|
F.main(
|
||||||
"Tutorial",
|
"Tutorial",
|
||||||
"Are you sure you want to skip the tutorial? We "
|
"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 (isInTutorial(player))
|
||||||
{
|
{
|
||||||
|
if (get(player).QueuedFinish)
|
||||||
|
{
|
||||||
|
if (player.getOpenInventory() == null)
|
||||||
|
{
|
||||||
|
get(player).QueuedFinish = false;
|
||||||
|
finishFor(player);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
get(player).CurrentTask.trySendDescription(player);
|
get(player).CurrentTask.trySendDescription(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,8 @@ public class TutorialClient
|
|||||||
public Player Player;
|
public Player Player;
|
||||||
public TutorialTask<?> CurrentTask;
|
public TutorialTask<?> CurrentTask;
|
||||||
public long LastDescriptionSentTime = System.currentTimeMillis() - 3000;
|
public long LastDescriptionSentTime = System.currentTimeMillis() - 3000;
|
||||||
|
public boolean InClanOnStart;
|
||||||
|
public boolean QueuedFinish;
|
||||||
|
|
||||||
public TutorialClient(Player player, Tutorial tutorial)
|
public TutorialClient(Player player, Tutorial tutorial)
|
||||||
{
|
{
|
||||||
@ -16,11 +18,15 @@ public class TutorialClient
|
|||||||
|
|
||||||
CurrentTask = tutorial._tasks.get(1);
|
CurrentTask = tutorial._tasks.get(1);
|
||||||
|
|
||||||
|
InClanOnStart = tutorial._clansManager.isInClan(player);
|
||||||
|
|
||||||
for (TutorialTask<?> task : tutorial._tasks.values())
|
for (TutorialTask<?> task : tutorial._tasks.values())
|
||||||
{
|
{
|
||||||
if (TaskManager.Instance.hasCompletedTask(player, String.format(
|
if (TaskManager.Instance.hasCompletedTask(player, String.format(
|
||||||
Tutorial.TASK_COMPLETE_TASK,
|
Tutorial.TASK_COMPLETE_TASK,
|
||||||
task.getTutorial().getTechnicalName(), task.getTechnicalName())))
|
task.getTutorial().getTechnicalName(),
|
||||||
|
task.getTechnicalName()
|
||||||
|
)))
|
||||||
{
|
{
|
||||||
if (CurrentTask.getID() <= task.getID())
|
if (CurrentTask.getID() <= task.getID())
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package mineplex.game.clans.tutorials;
|
package mineplex.game.clans.tutorials;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.LinkedList;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -12,6 +13,9 @@ import mineplex.core.MiniPlugin;
|
|||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.donation.DonationManager;
|
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.preferences.PreferencesManager;
|
||||||
import mineplex.core.task.TaskManager;
|
import mineplex.core.task.TaskManager;
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
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.DoSkipTutorialCommand;
|
||||||
import mineplex.game.clans.tutorials.commands.SkipTutorialCommand;
|
import mineplex.game.clans.tutorials.commands.SkipTutorialCommand;
|
||||||
import mineplex.game.clans.tutorials.gettingstarted.TutorialGettingStarted;
|
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
|
public class TutorialManager extends MiniPlugin
|
||||||
{
|
{
|
||||||
@ -30,7 +36,7 @@ public class TutorialManager extends MiniPlugin
|
|||||||
|
|
||||||
private final TaskManager _taskManager;
|
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);
|
super("Tutorials", plugin);
|
||||||
|
|
||||||
@ -38,7 +44,37 @@ public class TutorialManager extends MiniPlugin
|
|||||||
|
|
||||||
_taskManager = taskManager;
|
_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()
|
public void addCommands()
|
||||||
@ -58,7 +94,6 @@ public class TutorialManager extends MiniPlugin
|
|||||||
if (_tutorials.containsKey(tutorial))
|
if (_tutorials.containsKey(tutorial))
|
||||||
{
|
{
|
||||||
_tutorials.get(tutorial).startFor(player);
|
_tutorials.get(tutorial).startFor(player);
|
||||||
_playerTutorials.put(player.getName(), _tutorials.get(tutorial));
|
|
||||||
|
|
||||||
return isInTutorial(player);
|
return isInTutorial(player);
|
||||||
}
|
}
|
||||||
@ -78,7 +113,7 @@ public class TutorialManager extends MiniPlugin
|
|||||||
getTutorial(player).cancelFor(player);
|
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());
|
_playerTutorials.remove(player.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -95,7 +130,7 @@ public class TutorialManager extends MiniPlugin
|
|||||||
{
|
{
|
||||||
if (isInTutorial(player))
|
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);
|
getTutorial(player).doSkip(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -109,6 +144,19 @@ public class TutorialManager extends MiniPlugin
|
|||||||
getTutorial(event.getPlayer()).cleanup(event.getPlayer());
|
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)
|
public Tutorial getTutorial(final Player player)
|
||||||
{
|
{
|
||||||
return _playerTutorials.get(player.getName());
|
return _playerTutorials.get(player.getName());
|
||||||
|
@ -1,25 +1,18 @@
|
|||||||
package mineplex.game.clans.tutorials;
|
package mineplex.game.clans.tutorials;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import org.bukkit.Location;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.HandlerList;
|
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
|
||||||
import mineplex.core.common.util.C;
|
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.common.util.UtilServer;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.common.util.UtilTextMiddle;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
|
|
||||||
public class TutorialTask<T extends Tutorial> implements Listener
|
public class TutorialTask<T extends Tutorial> implements Listener
|
||||||
{
|
{
|
||||||
private T _tutorial;
|
protected T _tutorial;
|
||||||
|
|
||||||
protected long _autoCompleteTime = -1;
|
protected long _autoCompleteTime = -1;
|
||||||
|
|
||||||
@ -29,13 +22,17 @@ public class TutorialTask<T extends Tutorial> implements Listener
|
|||||||
protected String _description;
|
protected String _description;
|
||||||
protected String _finishMessage;
|
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;
|
protected long _descriptionWaitTime = 30000;
|
||||||
|
|
||||||
private List<String> _playersFinished = new ArrayList<>();
|
protected NautArrayList<String> _playersFinished = new NautArrayList<>();
|
||||||
|
protected NautArrayList<String> _inTask = new NautArrayList<>();
|
||||||
private Map<String, DeployedTask> _deployedInstances = new HashMap<>();
|
|
||||||
private List<DeployedTask> _toCull = new ArrayList<>();
|
|
||||||
|
|
||||||
|
private long _lastTaskTp;
|
||||||
private int _id;
|
private int _id;
|
||||||
|
|
||||||
public TutorialTask(T tutorial, 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());
|
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);
|
protected void customEndFor(final Player player)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
UtilServer.getServer().getPluginManager().registerEvents(task, _tutorial._manager.getPlugin());
|
protected final void startFor(final Player player)
|
||||||
|
{
|
||||||
|
_inTask.add(player.getName());
|
||||||
|
|
||||||
trySendDescription(player);
|
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)
|
if (_autoCompleteTime != -1)
|
||||||
{
|
{
|
||||||
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(_tutorial._manager.getPlugin(), new Runnable(){
|
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(_tutorial._manager.getPlugin(), new Runnable(){
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
if (_deployedInstances.containsKey(player.getName()))
|
if (isDoing(player))
|
||||||
{
|
{
|
||||||
finishFor(player);
|
finishFor(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, _autoCompleteTime);
|
}, _autoCompleteTime);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
task.postDeploy();
|
public boolean isDoing(Player player)
|
||||||
|
{
|
||||||
return task;
|
return _inTask != null && player != null && _inTask.contains(player.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void trySendDescription(Player player)
|
public void trySendDescription(Player player)
|
||||||
@ -83,34 +106,38 @@ public class TutorialTask<T extends Tutorial> implements Listener
|
|||||||
|
|
||||||
TutorialClient client = _tutorial.get(player);
|
TutorialClient client = _tutorial.get(player);
|
||||||
|
|
||||||
|
if (client.QueuedFinish)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (System.currentTimeMillis() - client.LastDescriptionSentTime > client.CurrentTask.getDescriptionWaitTime())
|
if (System.currentTimeMillis() - client.LastDescriptionSentTime > client.CurrentTask.getDescriptionWaitTime())
|
||||||
{
|
{
|
||||||
UtilPlayer.message(player, " ");
|
_tutorial._manager.sendTutorialMsg(player, " ");
|
||||||
UtilPlayer.message(player, " ");
|
_tutorial._manager.sendTutorialMsg(player, " ");
|
||||||
UtilPlayer.message(player, " ");
|
_tutorial._manager.sendTutorialMsg(player, " ");
|
||||||
UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
_tutorial._manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||||
UtilPlayer.message(player, " ");
|
_tutorial._manager.sendTutorialMsg(player, " ");
|
||||||
UtilPlayer.message(player, C.cYellowB + "Part " + _id + ": " + _displayName);
|
_tutorial._manager.sendTutorialMsg(player, C.cYellowB + "Part " + _id + ": " + _displayName);
|
||||||
UtilPlayer.message(player, C.cWhite + _description.replace("{", C.cAqua).replace("}", C.cWhite));
|
_tutorial._manager.sendTutorialMsg(player, C.cWhite + " " + _description.replace("{", C.cAqua).replace("}", C.cWhite));
|
||||||
UtilPlayer.message(player, " ");
|
_tutorial._manager.sendTutorialMsg(player, " ");
|
||||||
UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
_tutorial._manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||||
|
|
||||||
|
UtilTextMiddle.display("", getDisplayName());
|
||||||
|
|
||||||
client.LastDescriptionSentTime = System.currentTimeMillis();
|
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)
|
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()
|
public String getDisplayName()
|
||||||
@ -133,6 +160,16 @@ public class TutorialTask<T extends Tutorial> implements Listener
|
|||||||
return _technicalName;
|
return _technicalName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TutorialManager getManager()
|
||||||
|
{
|
||||||
|
return _tutorial._manager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClansManager getClans()
|
||||||
|
{
|
||||||
|
return _tutorial._clansManager;
|
||||||
|
}
|
||||||
|
|
||||||
public int getID()
|
public int getID()
|
||||||
{
|
{
|
||||||
return _id;
|
return _id;
|
||||||
@ -140,52 +177,30 @@ public class TutorialTask<T extends Tutorial> implements Listener
|
|||||||
|
|
||||||
public void finishFor(Player player)
|
public void finishFor(Player player)
|
||||||
{
|
{
|
||||||
|
customEndFor(player);
|
||||||
_tutorial.finishTask(player, this);
|
_tutorial.finishTask(player, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void visibleFinish(Player player)
|
public void visibleFinish(Player player)
|
||||||
{
|
{
|
||||||
_deployedInstances.get(player.getName()).kill();
|
_inTask.remove(player.getName());
|
||||||
_toCull.add(_deployedInstances.get(player.getName()));
|
|
||||||
_deployedInstances.remove(player.getName());
|
|
||||||
|
|
||||||
if (_finishMessage != null)
|
if (_finishMessage != null)
|
||||||
{
|
{
|
||||||
UtilPlayer.message(player, " ");
|
_tutorial._manager.sendTutorialMsg(player, " ");
|
||||||
UtilPlayer.message(player, " ");
|
_tutorial._manager.sendTutorialMsg(player, " ");
|
||||||
UtilPlayer.message(player, " ");
|
_tutorial._manager.sendTutorialMsg(player, " ");
|
||||||
UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
_tutorial._manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||||
UtilPlayer.message(player, " ");
|
_tutorial._manager.sendTutorialMsg(player, " ");
|
||||||
UtilPlayer.message(player, C.cWhite + _finishMessage.replace("{", C.cAqua).replace("}", C.cWhite));
|
_tutorial._manager.sendTutorialMsg(player, C.cWhite + _finishMessage.replace("{", C.cAqua).replace("}", C.cWhite));
|
||||||
UtilPlayer.message(player, " ");
|
_tutorial._manager.sendTutorialMsg(player, " ");
|
||||||
UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
_tutorial._manager.sendTutorialMsg(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();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cleanup(Player player)
|
public void cleanup(Player player)
|
||||||
{
|
{
|
||||||
_deployedInstances.get(player.getName()).kill();
|
_inTask.remove(player.getName());
|
||||||
_toCull.add(_deployedInstances.get(player.getName()));
|
|
||||||
_playersFinished.remove(player.getName());
|
_playersFinished.remove(player.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ public class SkipTutorialCommand extends CommandBase<TutorialManager>
|
|||||||
}
|
}
|
||||||
else
|
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;
|
package mineplex.game.clans.tutorials.gettingstarted;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
|
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
import mineplex.game.clans.clans.event.ClansCommandExecutedEvent;
|
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;
|
import mineplex.game.clans.tutorials.TutorialTask;
|
||||||
|
|
||||||
public class TaskClaim extends TutorialTask<TutorialGettingStarted>
|
public class TaskClaim extends TutorialTask<TutorialGettingStarted>
|
||||||
@ -21,42 +20,24 @@ public class TaskClaim extends TutorialTask<TutorialGettingStarted>
|
|||||||
_description = "Clans can claim 16x16 areas of Territory! "
|
_description = "Clans can claim 16x16 areas of Territory! "
|
||||||
+ "Once claimed, only your Clan can break/place blocks here. "
|
+ "Once claimed, only your Clan can break/place blocks here. "
|
||||||
+ "This is the perfect place to build a base and stash your items! "
|
+ "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. "
|
+ "You can only claim in the Wilderness, and not next to other Clan's Territory. "
|
||||||
+ "Claim some Territory now, by typing {/c claim}!";
|
+ "To claim some territory, go into the Clans GUI by typing {/c} and {Left-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, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onClansCommand(ClansCommandExecutedEvent event)
|
public void onClansCommand(PlayerPreClaimTerritoryEvent event)
|
||||||
{
|
{
|
||||||
if (!_player.equals(event.getPlayer()))
|
if (!isDoing(event.getClaimer()))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ClansManager.getInstance().isInClan(event.getPlayer()))
|
if (!ClansManager.getInstance().isInClan(event.getClaimer()))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.getCommand().equals("claim"))
|
finishFor(event.getClaimer());
|
||||||
{
|
|
||||||
_task.finishFor(_player);
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
@ -4,8 +4,8 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.game.clans.clans.event.ClanCreatedEvent;
|
import mineplex.game.clans.clans.event.ClanCreatedEvent;
|
||||||
import mineplex.game.clans.tutorials.DeployedTask;
|
|
||||||
import mineplex.game.clans.tutorials.TutorialTask;
|
import mineplex.game.clans.tutorials.TutorialTask;
|
||||||
|
|
||||||
public class TaskCreateClan extends TutorialTask<TutorialGettingStarted>
|
public class TaskCreateClan extends TutorialTask<TutorialGettingStarted>
|
||||||
@ -17,32 +17,36 @@ public class TaskCreateClan extends TutorialTask<TutorialGettingStarted>
|
|||||||
_displayName = "Create a Clan";
|
_displayName = "Create a Clan";
|
||||||
_technicalName = "ClanCreation";
|
_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
|
@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
|
|
||||||
{
|
|
||||||
public Deployed(Player player, TutorialTask<?> task)
|
|
||||||
{
|
|
||||||
super(player, task);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onClanCreated(ClanCreatedEvent event)
|
public void onClanCreated(ClanCreatedEvent event)
|
||||||
{
|
{
|
||||||
if (!_player.equals(event.getFounder()))
|
if (!isDoing(event.getFounder()))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_task.finishFor(_player);
|
finishFor(event.getFounder());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package mineplex.game.clans.tutorials.gettingstarted;
|
package mineplex.game.clans.tutorials.gettingstarted;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -9,7 +12,6 @@ import mineplex.core.updater.UpdateType;
|
|||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
import mineplex.game.clans.spawn.Spawn;
|
import mineplex.game.clans.spawn.Spawn;
|
||||||
import mineplex.game.clans.tutorials.DeployedTask;
|
|
||||||
import mineplex.game.clans.tutorials.TutorialTask;
|
import mineplex.game.clans.tutorials.TutorialTask;
|
||||||
import mineplex.minecraft.game.classcombat.Class.ClientClass;
|
import mineplex.minecraft.game.classcombat.Class.ClientClass;
|
||||||
|
|
||||||
@ -23,26 +25,10 @@ public class TaskCustomizeClass extends TutorialTask<TutorialGettingStarted>
|
|||||||
_technicalName = "CustomizeKlass";
|
_technicalName = "CustomizeKlass";
|
||||||
|
|
||||||
_description = "Now that you have equipped a class, use this enchantment table to customize your class builds. "
|
_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!";
|
||||||
|
|
||||||
@Override
|
_taskPos = new Location(Spawn.getSpawnWorld(), 6, 66, -300, -180f, 0f);
|
||||||
public DeployedTask customDeploy(Player player)
|
|
||||||
{
|
|
||||||
return new Deployed(player, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
class Deployed extends DeployedTask
|
|
||||||
{
|
|
||||||
public Deployed(Player player, TutorialTask<?> task)
|
|
||||||
{
|
|
||||||
super(player, task);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void postDeploy()
|
|
||||||
{
|
|
||||||
_player.teleport(new Location(Spawn.getSpawnWorld(), 6, 66, -300, -180f, 0f));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
@ -53,16 +39,15 @@ public class TaskCustomizeClass extends TutorialTask<TutorialGettingStarted>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (checkForDeath())
|
Iterator<String> iterator = _inTask.iterator();
|
||||||
|
while (iterator.hasNext())
|
||||||
{
|
{
|
||||||
return;
|
Player player = Bukkit.getPlayer(iterator.next());
|
||||||
}
|
final ClientClass clientclass = ClansManager.getInstance().getClassManager().Get(player);
|
||||||
|
|
||||||
final ClientClass clientclass = ClansManager.getInstance().getClassManager().Get(_player);
|
if (clientclass != null && clientclass.GetSavingCustomBuild() != null && clientclass.GetSavingCustomBuild().AxeSkill != null)
|
||||||
|
|
||||||
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.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.game.clans.clans.event.ClanDisbandedEvent;
|
import mineplex.game.clans.clans.event.ClanDisbandedEvent;
|
||||||
import mineplex.game.clans.tutorials.DeployedTask;
|
|
||||||
import mineplex.game.clans.tutorials.TutorialTask;
|
import mineplex.game.clans.tutorials.TutorialTask;
|
||||||
|
|
||||||
public class TaskDisbandClan extends TutorialTask<TutorialGettingStarted>
|
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. "
|
_description = "Finally, let's disband your Clan to end the Tutorial. "
|
||||||
+ "Simply type {/c disband} to do this. "
|
+ "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
|
@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
|
|
||||||
{
|
|
||||||
public Deployed(Player player, TutorialTask<?> task)
|
|
||||||
{
|
|
||||||
super(player, task);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void sell(ClanDisbandedEvent event)
|
public void sell(ClanDisbandedEvent event)
|
||||||
{
|
{
|
||||||
if (!_player.equals(event.getDisbander()))
|
if (!isDoing(event.getDisbander()))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_task.finishFor(_player);
|
finishFor(event.getDisbander());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,18 @@
|
|||||||
package mineplex.game.clans.tutorials.gettingstarted;
|
package mineplex.game.clans.tutorials.gettingstarted;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
|
||||||
import mineplex.core.common.util.Callback;
|
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.common.util.UtilItem;
|
||||||
import mineplex.core.task.TaskManager;
|
import mineplex.core.task.TaskManager;
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
|
||||||
import mineplex.game.clans.clans.event.ClansPlayerBuyItemEvent;
|
import mineplex.game.clans.clans.event.ClansPlayerBuyItemEvent;
|
||||||
import mineplex.game.clans.clans.event.ClansShopAddButtonEvent;
|
import mineplex.game.clans.clans.event.ClansShopAddButtonEvent;
|
||||||
import mineplex.game.clans.spawn.Spawn;
|
import mineplex.game.clans.spawn.Spawn;
|
||||||
import mineplex.game.clans.tutorials.DeployedTask;
|
|
||||||
import mineplex.game.clans.tutorials.TutorialTask;
|
import mineplex.game.clans.tutorials.TutorialTask;
|
||||||
import mineplex.minecraft.game.classcombat.Class.event.ClassEquipEvent;
|
import mineplex.minecraft.game.classcombat.Class.event.ClassEquipEvent;
|
||||||
|
|
||||||
@ -30,45 +27,41 @@ public class TaskEquipClass extends TutorialTask<TutorialGettingStarted>
|
|||||||
|
|
||||||
_description = "Use the PvP Gear shop, and right-click the Villager. "
|
_description = "Use the PvP Gear shop, and right-click the Villager. "
|
||||||
+ "Purchase Iron Armor from the PvP Shop. "
|
+ "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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private NautHashMap<String, NautArrayList<Material>> _bought = new NautHashMap<>();
|
||||||
public DeployedTask customDeploy(Player player)
|
|
||||||
{
|
|
||||||
return new Deployed(player, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
class Deployed extends DeployedTask
|
|
||||||
{
|
|
||||||
private List<Material> _bought = new ArrayList<>();
|
|
||||||
|
|
||||||
public Deployed(Player player, TutorialTask<?> task)
|
|
||||||
{
|
|
||||||
super(player, task);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void postDeploy()
|
|
||||||
{
|
|
||||||
_player.teleport(new Location(Spawn.getSpawnWorld(), 19, 66, -305.844, -100f, 0f));
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onClassEquipped(ClassEquipEvent event)
|
public void onClassEquipped(ClassEquipEvent event)
|
||||||
{
|
{
|
||||||
if (!ClansManager.getInstance().getClassManager().Get(_player).equals(event.getPlayer()))
|
if (!isDoing(event.getUser()))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_task.finishFor(_player);
|
finishFor(event.getUser());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void customEndFor(Player player)
|
||||||
|
{
|
||||||
|
_bought.get(player.getName()).clear();
|
||||||
|
_bought.remove(player.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void customStartFor(Player player)
|
||||||
|
{
|
||||||
|
_bought.put(player.getName(), new NautArrayList<Material>());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void button(ClansShopAddButtonEvent event)
|
public void button(ClansShopAddButtonEvent event)
|
||||||
{
|
{
|
||||||
if (!_player.equals(event.getPlayer()))
|
if (!isDoing(event.getPlayer()))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -78,7 +71,7 @@ public class TaskEquipClass extends TutorialTask<TutorialGettingStarted>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!TaskManager.Instance.hasCompletedTask(event.getPlayer(), "tuttoooooe" + event.getMaterial().name()) && !_bought.contains(event.getMaterial()))
|
if (!TaskManager.Instance.hasCompletedTask(event.getPlayer(), "tuttoooooe" + event.getMaterial().name()) && !_bought.get(event.getPlayer().getName()).contains(event.getMaterial()))
|
||||||
{
|
{
|
||||||
event.setBuyPrice(0);
|
event.setBuyPrice(0);
|
||||||
event.setSellPrice(0);
|
event.setSellPrice(0);
|
||||||
@ -88,7 +81,7 @@ public class TaskEquipClass extends TutorialTask<TutorialGettingStarted>
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void buy(final ClansPlayerBuyItemEvent event)
|
public void buy(final ClansPlayerBuyItemEvent event)
|
||||||
{
|
{
|
||||||
if (!_player.equals(event.getPlayer()))
|
if (!isDoing(event.getPlayer()))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -98,7 +91,7 @@ public class TaskEquipClass extends TutorialTask<TutorialGettingStarted>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.getCost() == 0 && _bought.contains(event.getItem().getType()))
|
if (event.getCost() == 0 && _bought.get(event.getPlayer().getName()).contains(event.getItem().getType()))
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
@ -110,7 +103,7 @@ public class TaskEquipClass extends TutorialTask<TutorialGettingStarted>
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
}, event.getPlayer(), "tuttoooooe" + event.getItem().getType().name());
|
}, event.getPlayer(), "tuttoooooe" + event.getItem().getType().name());
|
||||||
_bought.add(event.getItem().getType());
|
|
||||||
}
|
_bought.get(event.getPlayer().getName()).add(event.getItem().getType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package mineplex.game.clans.tutorials.gettingstarted;
|
package mineplex.game.clans.tutorials.gettingstarted;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
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.ClansManager;
|
||||||
import mineplex.game.clans.clans.event.EnergyPageBuildEvent;
|
import mineplex.game.clans.clans.event.EnergyPageBuildEvent;
|
||||||
import mineplex.game.clans.spawn.Spawn;
|
import mineplex.game.clans.spawn.Spawn;
|
||||||
import mineplex.game.clans.tutorials.DeployedTask;
|
|
||||||
import mineplex.game.clans.tutorials.TutorialTask;
|
import mineplex.game.clans.tutorials.TutorialTask;
|
||||||
|
|
||||||
public class TaskExploreShops extends TutorialTask<TutorialGettingStarted>
|
public class TaskExploreShops extends TutorialTask<TutorialGettingStarted>
|
||||||
@ -23,46 +25,38 @@ 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. "
|
_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. "
|
+ "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)";
|
+ "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
|
@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));
|
||||||
}
|
|
||||||
|
|
||||||
class Deployed extends DeployedTask
|
ClansManager.getInstance().getClan(player).adjustEnergy(-(ClansManager.getInstance().getClan(player).getEnergyCostPerMinute() * 60));
|
||||||
{
|
|
||||||
public Deployed(Player player, TutorialTask<?> task)
|
|
||||||
{
|
|
||||||
super(player, task);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void postDeploy()
|
|
||||||
{
|
|
||||||
_player.teleport(new Location(Spawn.getSpawnWorld(), 17, 66.5, -330, -180f, 0f));
|
|
||||||
|
|
||||||
ClansManager.getInstance().getClan(_player).adjustEnergy(-(ClansManager.getInstance().getClan(_player).getEnergyCostPerMinute() * 60));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onItemPut(EnergyPageBuildEvent event)
|
public void onItemPut(EnergyPageBuildEvent event)
|
||||||
{
|
{
|
||||||
if (!_player.equals(event.getPlayer()))
|
if (!isDoing(event.getPlayer()))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ClansManager.getInstance().isInClan(_player))
|
if (!ClansManager.getInstance().isInClan(event.getPlayer()))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ClansManager.getInstance().getClan(_player).getEnergyPurchasable() == 0)
|
if (ClansManager.getInstance().getClan(event.getPlayer()).getEnergyPurchasable() == 0)
|
||||||
{
|
{
|
||||||
_task.finishFor(_player);
|
finishFor(event.getPlayer());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,11 +71,14 @@ public class TaskExploreShops extends TutorialTask<TutorialGettingStarted>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ClansManager.getInstance().getClan(_player).getEnergy() == ClansManager.getInstance().getClan(_player).getEnergyMax())
|
Iterator<String> iterator = _inTask.iterator();
|
||||||
|
while (iterator.hasNext())
|
||||||
{
|
{
|
||||||
_task.finishFor(_player);
|
Player player = Bukkit.getPlayer(iterator.next());
|
||||||
|
if (ClansManager.getInstance().getClan(player).getEnergy() == ClansManager.getInstance().getClan(player).getEnergyMax())
|
||||||
|
{
|
||||||
|
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;
|
package mineplex.game.clans.tutorials.gettingstarted;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
|
||||||
|
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
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;
|
import mineplex.game.clans.tutorials.TutorialTask;
|
||||||
|
|
||||||
public class TaskLeaveSpawn extends TutorialTask<TutorialGettingStarted>
|
public class TaskLeaveSpawn extends TutorialTask<TutorialGettingStarted>
|
||||||
@ -22,28 +21,16 @@ public class TaskLeaveSpawn extends TutorialTask<TutorialGettingStarted>
|
|||||||
|
|
||||||
_description = "Now you can leave the Spawn Island. "
|
_description = "Now you can leave the Spawn Island. "
|
||||||
+ "Don't worry, you won't get hurt from the fall! "
|
+ "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
|
@Override
|
||||||
public DeployedTask customDeploy(Player player)
|
public void customStartFor(Player player)
|
||||||
{
|
{
|
||||||
return new Deployed(player, this);
|
if (player.getLocation().getY() < 100)
|
||||||
}
|
|
||||||
|
|
||||||
class Deployed extends DeployedTask
|
|
||||||
{
|
{
|
||||||
public Deployed(Player player, TutorialTask<?> task)
|
finishFor(player);
|
||||||
{
|
|
||||||
super(player, task);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void postDeploy()
|
|
||||||
{
|
|
||||||
if (_player.getLocation().getY() < 100)
|
|
||||||
{
|
|
||||||
_task.finishFor(_player);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,15 +42,15 @@ public class TaskLeaveSpawn extends TutorialTask<TutorialGettingStarted>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (checkForDeath())
|
Iterator<String> iterator = _inTask.iterator();
|
||||||
|
while (iterator.hasNext())
|
||||||
{
|
{
|
||||||
return;
|
Player player = Bukkit.getPlayer(iterator.next());
|
||||||
}
|
|
||||||
|
|
||||||
if (_player.getLocation().getY() < 100){
|
if (player.getLocation().getY() < 100 && getClans().getClanUtility().getClaim(player.getLocation()) == null)
|
||||||
_task.finishFor(_player);
|
{
|
||||||
|
finishFor(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,12 +4,12 @@ import org.bukkit.Location;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.player.PlayerItemConsumeEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
import mineplex.game.clans.clans.event.ClansPlayerSellItemEvent;
|
import mineplex.game.clans.clans.event.ClansPlayerSellItemEvent;
|
||||||
import mineplex.game.clans.spawn.Spawn;
|
import mineplex.game.clans.spawn.Spawn;
|
||||||
import mineplex.game.clans.tutorials.DeployedTask;
|
|
||||||
import mineplex.game.clans.tutorials.TutorialTask;
|
import mineplex.game.clans.tutorials.TutorialTask;
|
||||||
|
|
||||||
public class TaskMakingMoney extends TutorialTask<TutorialGettingStarted>
|
public class TaskMakingMoney extends TutorialTask<TutorialGettingStarted>
|
||||||
@ -23,39 +23,45 @@ public class TaskMakingMoney extends TutorialTask<TutorialGettingStarted>
|
|||||||
|
|
||||||
_description = "We have given you a carrot to sell in the Organic Produce Shop. "
|
_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.";
|
+ "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
|
@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;
|
if (!isDoing(event.getPlayer()))
|
||||||
|
|
||||||
public Deployed(Player player, TutorialTask<?> task)
|
|
||||||
{
|
{
|
||||||
super(player, task);
|
return;
|
||||||
player.getInventory().addItem(new ItemStack(Material.CARROT_ITEM, 1));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
if (!event.getItem().getType().equals(Material.CARROT))
|
||||||
public void postDeploy()
|
|
||||||
{
|
{
|
||||||
_player.teleport(new Location(Spawn.getSpawnWorld(), 25.536, 66, -316.844, -100f, 0f));
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void button(ClansPlayerSellItemEvent event)
|
public void button(ClansPlayerSellItemEvent event)
|
||||||
{
|
{
|
||||||
if (!_player.equals(event.getPlayer()))
|
if (!isDoing(event.getPlayer()))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ClansManager.getInstance().isInClan(_player))
|
if (!ClansManager.getInstance().isInClan(event.getPlayer()))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -65,7 +71,6 @@ public class TaskMakingMoney extends TutorialTask<TutorialGettingStarted>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_task.finishFor(_player);
|
finishFor(event.getPlayer());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
package mineplex.game.clans.tutorials.gettingstarted;
|
package mineplex.game.clans.tutorials.gettingstarted;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
|
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
import mineplex.game.clans.clans.event.ClansCommandExecutedEvent;
|
import mineplex.game.clans.clans.event.ClansCommandExecutedEvent;
|
||||||
import mineplex.game.clans.tutorials.DeployedTask;
|
|
||||||
import mineplex.game.clans.tutorials.TutorialTask;
|
import mineplex.game.clans.tutorials.TutorialTask;
|
||||||
|
|
||||||
public class TaskSetHome extends TutorialTask<TutorialGettingStarted>
|
public class TaskSetHome extends TutorialTask<TutorialGettingStarted>
|
||||||
@ -19,26 +17,14 @@ public class TaskSetHome extends TutorialTask<TutorialGettingStarted>
|
|||||||
_technicalName = "SetClanHome";
|
_technicalName = "SetClanHome";
|
||||||
|
|
||||||
_description = "You are now ready to set a Clan Home. "
|
_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)
|
|
||||||
{
|
|
||||||
return new Deployed(player, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
class Deployed extends DeployedTask
|
|
||||||
{
|
|
||||||
public Deployed(Player player, TutorialTask<?> task)
|
|
||||||
{
|
|
||||||
super(player, task);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onSetHome(ClansCommandExecutedEvent event)
|
public void onSetHome(ClansCommandExecutedEvent event)
|
||||||
{
|
{
|
||||||
if (!_player.equals(event.getPlayer()))
|
if (!isDoing(event.getPlayer()))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -53,8 +39,6 @@ public class TaskSetHome extends TutorialTask<TutorialGettingStarted>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_task.finishFor(_player);
|
finishFor(event.getPlayer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
package mineplex.game.clans.tutorials.gettingstarted;
|
package mineplex.game.clans.tutorials.gettingstarted;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -13,13 +15,14 @@ import org.bukkit.inventory.CraftingInventory;
|
|||||||
import org.bukkit.inventory.PlayerInventory;
|
import org.bukkit.inventory.PlayerInventory;
|
||||||
|
|
||||||
import mineplex.core.common.util.Callback;
|
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.task.TaskManager;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import mineplex.game.clans.clans.event.ClansPlayerBuyItemEvent;
|
import mineplex.game.clans.clans.event.ClansPlayerBuyItemEvent;
|
||||||
import mineplex.game.clans.clans.event.ClansShopAddButtonEvent;
|
import mineplex.game.clans.clans.event.ClansShopAddButtonEvent;
|
||||||
import mineplex.game.clans.spawn.Spawn;
|
import mineplex.game.clans.spawn.Spawn;
|
||||||
import mineplex.game.clans.tutorials.DeployedTask;
|
|
||||||
import mineplex.game.clans.tutorials.TutorialTask;
|
import mineplex.game.clans.tutorials.TutorialTask;
|
||||||
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
|
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
|
||||||
|
|
||||||
@ -35,22 +38,26 @@ public class TaskUseAbility extends TutorialTask<TutorialGettingStarted>
|
|||||||
_description = "Now that you have equipped a class, you can start using abilities. "
|
_description = "Now that you have equipped a class, you can start using abilities. "
|
||||||
+ "Purchase an Iron Axe from the PvP Shop. "
|
+ "Purchase an Iron Axe from the PvP Shop. "
|
||||||
+ "Right-Click with your Iron Axe to use your Axe Ability!";
|
+ "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
|
@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
|
|
||||||
{
|
|
||||||
private List<Material> _bought = new ArrayList<>();
|
|
||||||
private boolean _teleported = false;
|
|
||||||
|
|
||||||
public Deployed(Player player, TutorialTask<?> task)
|
|
||||||
{
|
|
||||||
super(player, task);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -58,40 +65,45 @@ public class TaskUseAbility extends TutorialTask<TutorialGettingStarted>
|
|||||||
{
|
{
|
||||||
if (event.getType() != UpdateType.SEC) return;
|
if (event.getType() != UpdateType.SEC) return;
|
||||||
|
|
||||||
if (!_teleported && _player != null && _player.isOnline() && _player.getOpenInventory().getType() == InventoryType.CRAFTING)
|
Iterator<String> iterator = _inTask.iterator();
|
||||||
|
while (iterator.hasNext())
|
||||||
|
{
|
||||||
|
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));
|
_player.teleport(new Location(Spawn.getSpawnWorld(), 19, 66, -305.844, -100f, 0f));
|
||||||
_teleported = true;
|
_teleported.put(_player.getName(), true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onAbilityUesd(SkillTriggerEvent event)
|
public void onAbilityUesd(SkillTriggerEvent event)
|
||||||
{
|
{
|
||||||
if (_player == null || !_player.equals(event.GetPlayer()))
|
if (!isDoing(event.GetPlayer()))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_task.finishFor(_player);
|
finishFor(event.GetPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void button(ClansShopAddButtonEvent event)
|
public void button(ClansShopAddButtonEvent event)
|
||||||
{
|
{
|
||||||
if (!_player.equals(event.getPlayer()))
|
if (!isDoing(event.getPlayer()))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println(event.getDisplayName());
|
|
||||||
|
|
||||||
if (!event.getMaterial().equals(Material.IRON_AXE))
|
if (!event.getMaterial().equals(Material.IRON_AXE))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!TaskManager.Instance.hasCompletedTask(event.getPlayer(), "tuttoooooe" + event.getMaterial().name()) && !_bought.contains(event.getMaterial()))
|
if (!TaskManager.Instance.hasCompletedTask(event.getPlayer(), "tuttoooooe" + event.getMaterial().name())
|
||||||
|
&& !_bought.get(event.getPlayer().getName()).contains(event.getMaterial()))
|
||||||
{
|
{
|
||||||
event.setBuyPrice(0);
|
event.setBuyPrice(0);
|
||||||
event.setSellPrice(0);
|
event.setSellPrice(0);
|
||||||
@ -101,7 +113,7 @@ public class TaskUseAbility extends TutorialTask<TutorialGettingStarted>
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void buy(final ClansPlayerBuyItemEvent event)
|
public void buy(final ClansPlayerBuyItemEvent event)
|
||||||
{
|
{
|
||||||
if (!_player.equals(event.getPlayer()))
|
if (!isDoing(event.getPlayer()))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -111,7 +123,7 @@ public class TaskUseAbility extends TutorialTask<TutorialGettingStarted>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.getCost() == 0 && _bought.contains(event.getItem().getType()))
|
if (event.getCost() == 0 && _bought.get(event.getPlayer().getName()).contains(event.getItem().getType()))
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
@ -123,7 +135,6 @@ public class TaskUseAbility extends TutorialTask<TutorialGettingStarted>
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
}, event.getPlayer(), "tuttoooooe" + event.getItem().getType().name());
|
}, event.getPlayer(), "tuttoooooe" + event.getItem().getType().name());
|
||||||
_bought.add(event.getItem().getType());
|
_bought.get(event.getPlayer().getName()).add(event.getItem().getType());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
package mineplex.game.clans.tutorials.gettingstarted;
|
package mineplex.game.clans.tutorials.gettingstarted;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
|
|
||||||
import mineplex.game.clans.clans.event.ClansCommandExecutedEvent;
|
import mineplex.game.clans.clans.event.ClansCommandExecutedEvent;
|
||||||
import mineplex.game.clans.tutorials.DeployedTask;
|
|
||||||
import mineplex.game.clans.tutorials.TutorialTask;
|
import mineplex.game.clans.tutorials.TutorialTask;
|
||||||
|
|
||||||
public class TaskViewClanDetails extends TutorialTask<TutorialGettingStarted>
|
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.";
|
+ "You can also use any clan's name to get some information about them as well.";
|
||||||
}
|
}
|
||||||
|
|
||||||
@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, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onClansCommand(ClansCommandExecutedEvent event)
|
public void onClansCommand(ClansCommandExecutedEvent event)
|
||||||
{
|
{
|
||||||
if (!_player.equals(event.getPlayer()))
|
if (!isDoing(event.getPlayer()))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
System.out.println(event.getCommand());
|
||||||
|
|
||||||
if (event.getCommand().equals("info"))
|
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 org.bukkit.event.EventPriority;
|
||||||
|
|
||||||
import mineplex.core.common.util.C;
|
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.common.util.UtilServer;
|
||||||
import mineplex.core.donation.DonationManager;
|
import mineplex.core.donation.DonationManager;
|
||||||
|
import mineplex.core.packethandler.PacketHandler;
|
||||||
import mineplex.core.task.TaskManager;
|
import mineplex.core.task.TaskManager;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
@ -20,9 +19,9 @@ import mineplex.game.clans.tutorials.TutorialManager;
|
|||||||
|
|
||||||
public class TutorialGettingStarted extends Tutorial
|
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));
|
// addTask(new TaskWelcome(this, 1));
|
||||||
|
|
||||||
@ -30,7 +29,6 @@ public class TutorialGettingStarted extends Tutorial
|
|||||||
addTask(new TaskCreateClan(this, ++id));
|
addTask(new TaskCreateClan(this, ++id));
|
||||||
addTask(new TaskViewClanDetails(this, ++id));
|
addTask(new TaskViewClanDetails(this, ++id));
|
||||||
addTask(new TaskLeaveSpawn(this, ++id));
|
addTask(new TaskLeaveSpawn(this, ++id));
|
||||||
addTask(new TaskGoToWilderness(this, ++id));
|
|
||||||
addTask(new TaskClaim(this, ++id));
|
addTask(new TaskClaim(this, ++id));
|
||||||
addTask(new TaskSetHome(this, ++id));
|
addTask(new TaskSetHome(this, ++id));
|
||||||
addTask(new TaskExploreShops(this, ++id));
|
addTask(new TaskExploreShops(this, ++id));
|
||||||
@ -40,8 +38,6 @@ public class TutorialGettingStarted extends Tutorial
|
|||||||
addTask(new TaskMakingMoney(this, ++id));
|
addTask(new TaskMakingMoney(this, ++id));
|
||||||
addTask(new TaskDisbandClan(this, ++id));
|
addTask(new TaskDisbandClan(this, ++id));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_doScoreboard = true;
|
_doScoreboard = true;
|
||||||
_ghostMode = true;
|
_ghostMode = true;
|
||||||
_startOnJoin = true;
|
_startOnJoin = true;
|
||||||
@ -54,12 +50,12 @@ public class TutorialGettingStarted extends Tutorial
|
|||||||
@Override
|
@Override
|
||||||
public void onFinished(final Player player)
|
public void onFinished(final Player player)
|
||||||
{
|
{
|
||||||
UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
_manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||||
UtilPlayer.message(player, C.cYellowB + "CONGRATULATIONS");
|
_manager.sendTutorialMsg(player, C.cYellowB + "CONGRATULATIONS");
|
||||||
UtilPlayer.message(player, " ");
|
_manager.sendTutorialMsg(player, " ");
|
||||||
UtilPlayer.message(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 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!");
|
_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!");
|
||||||
UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
_manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||||
|
|
||||||
player.resetPlayerTime();
|
player.resetPlayerTime();
|
||||||
player.teleport(Spawn.getEastSpawn());
|
player.teleport(Spawn.getEastSpawn());
|
||||||
@ -68,17 +64,17 @@ public class TutorialGettingStarted extends Tutorial
|
|||||||
@Override
|
@Override
|
||||||
public void onBegin(final Player player)
|
public void onBegin(final Player player)
|
||||||
{
|
{
|
||||||
UtilPlayer.message(player, " ");
|
_manager.sendTutorialMsg(player, " ");
|
||||||
UtilPlayer.message(player, " ");
|
_manager.sendTutorialMsg(player, " ");
|
||||||
UtilPlayer.message(player, " ");
|
_manager.sendTutorialMsg(player, " ");
|
||||||
UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
_manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||||
UtilPlayer.message(player, " ");
|
_manager.sendTutorialMsg(player, " ");
|
||||||
UtilPlayer.message(player, C.cYellowB + "Getting Started");
|
_manager.sendTutorialMsg(player, C.cYellowB + "Getting Started");
|
||||||
UtilPlayer.message(player, C.cWhite + "Welcome to Clans! "
|
_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! "
|
+ "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");
|
+ "When you finish the tutorial, you will be awarded " + C.cAqua + "30,000 Gold");
|
||||||
UtilPlayer.message(player, " ");
|
_manager.sendTutorialMsg(player, " ");
|
||||||
UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
_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.Player;
|
||||||
import org.bukkit.entity.Wither;
|
import org.bukkit.entity.Wither;
|
||||||
import org.bukkit.event.EventHandler;
|
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.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.util.Vector;
|
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.UtilAlg;
|
||||||
import mineplex.core.common.util.UtilEnt;
|
import mineplex.core.common.util.UtilEnt;
|
||||||
import mineplex.core.common.util.UtilEvent;
|
import mineplex.core.common.util.UtilEvent;
|
||||||
|
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||||
import mineplex.core.common.util.UtilGear;
|
import mineplex.core.common.util.UtilGear;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
|
||||||
import mineplex.core.event.StackerEvent;
|
import mineplex.core.event.StackerEvent;
|
||||||
import mineplex.core.gadget.gadgets.MorphBlock;
|
import mineplex.core.gadget.gadgets.MorphBlock;
|
||||||
import mineplex.core.gadget.types.GadgetType;
|
import mineplex.core.gadget.types.GadgetType;
|
||||||
@ -54,7 +54,7 @@ public class StackerManager extends MiniPlugin implements IThrown
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void GrabEntity(PlayerInteractEntityEvent event)
|
public void GrabEntity(PlayerInteractAtEntityEvent event)
|
||||||
{
|
{
|
||||||
if (event.isCancelled())
|
if (event.isCancelled())
|
||||||
return;
|
return;
|
||||||
@ -63,6 +63,9 @@ public class StackerManager extends MiniPlugin implements IThrown
|
|||||||
if (stackee == null)
|
if (stackee == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if(Manager.GetMount().isMount(stackee))
|
||||||
|
return;
|
||||||
|
|
||||||
if (!(stackee instanceof LivingEntity))
|
if (!(stackee instanceof LivingEntity))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -347,7 +347,7 @@ public class ClientClass
|
|||||||
ResetToDefaults(!skillsOnly, !skillsOnly);
|
ResetToDefaults(!skillsOnly, !skillsOnly);
|
||||||
|
|
||||||
// Event
|
// Event
|
||||||
ClassEquipEvent event = new ClassEquipEvent(this, customBuild);
|
ClassEquipEvent event = new ClassEquipEvent(this, customBuild, _client.GetPlayer());
|
||||||
UtilServer.getServer().getPluginManager().callEvent(event);
|
UtilServer.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled())
|
if (event.isCancelled())
|
||||||
|
@ -5,7 +5,6 @@ import org.bukkit.event.Event;
|
|||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
import mineplex.minecraft.game.classcombat.Class.ClientClass;
|
import mineplex.minecraft.game.classcombat.Class.ClientClass;
|
||||||
import mineplex.minecraft.game.classcombat.Class.PvpClass;
|
|
||||||
import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken;
|
import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken;
|
||||||
|
|
||||||
public class ClassEquipEvent extends Event
|
public class ClassEquipEvent extends Event
|
||||||
@ -13,15 +12,16 @@ public class ClassEquipEvent extends Event
|
|||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
|
||||||
private ClientClass _client;
|
private ClientClass _client;
|
||||||
|
private Player _user;
|
||||||
private CustomBuildToken _build;
|
private CustomBuildToken _build;
|
||||||
|
|
||||||
private boolean _cancelled;
|
private boolean _cancelled;
|
||||||
|
|
||||||
public ClassEquipEvent(ClientClass client, CustomBuildToken build)
|
public ClassEquipEvent(ClientClass client, CustomBuildToken build, Player user)
|
||||||
{
|
{
|
||||||
_client = client;
|
_client = client;
|
||||||
_build = build;
|
_build = build;
|
||||||
|
_user = user;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClientClass getPlayer()
|
public ClientClass getPlayer()
|
||||||
@ -34,6 +34,11 @@ public class ClassEquipEvent extends Event
|
|||||||
return _build;
|
return _build;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Player getUser()
|
||||||
|
{
|
||||||
|
return _user;
|
||||||
|
}
|
||||||
|
|
||||||
public void setCancelled(boolean cancelled)
|
public void setCancelled(boolean cancelled)
|
||||||
{
|
{
|
||||||
_cancelled = cancelled;
|
_cancelled = cancelled;
|
||||||
|
@ -302,6 +302,8 @@ public abstract class Game implements Listener
|
|||||||
public boolean DeadBodiesDeath = true;
|
public boolean DeadBodiesDeath = true;
|
||||||
public int DeadBodiesExpire = -1;
|
public int DeadBodiesExpire = -1;
|
||||||
|
|
||||||
|
public boolean FixSpawnFacing = true;
|
||||||
|
|
||||||
private IPacketHandler _useEntityPacketHandler;
|
private IPacketHandler _useEntityPacketHandler;
|
||||||
private int _deadBodyCount;
|
private int _deadBodyCount;
|
||||||
private NautHashMap<String, Entity> _deadBodies = new NautHashMap<String, Entity>();
|
private NautHashMap<String, Entity> _deadBodies = new NautHashMap<String, Entity>();
|
||||||
|
@ -112,6 +112,8 @@ public class GameTeam
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Location fixFacing(Location loc)
|
private Location fixFacing(Location loc)
|
||||||
|
{
|
||||||
|
if (Host.FixSpawnFacing)
|
||||||
{
|
{
|
||||||
float yaw = UtilAlg.GetYaw(UtilAlg.getTrajectory2d(loc, Host.GetSpectatorLocation()));
|
float yaw = UtilAlg.GetYaw(UtilAlg.getTrajectory2d(loc, Host.GetSpectatorLocation()));
|
||||||
|
|
||||||
@ -119,6 +121,7 @@ public class GameTeam
|
|||||||
|
|
||||||
loc = loc.clone();
|
loc = loc.clone();
|
||||||
loc.setYaw(yaw);
|
loc.setYaw(yaw);
|
||||||
|
}
|
||||||
|
|
||||||
return loc;
|
return loc;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user