Merge remote-tracking branch 'origin/master' into mrsomeone12_SmallFixes
This commit is contained in:
commit
6120c8246b
@ -23,7 +23,7 @@
|
|||||||
</profile>
|
</profile>
|
||||||
<profile default="false" name="Annotation profile for bungee" enabled="true">
|
<profile default="false" name="Annotation profile for bungee" enabled="true">
|
||||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
<sourceTestOutputDir name="target\generated-test-sources\test-annotations" />
|
||||||
<outputRelativeToContentRoot value="true" />
|
<outputRelativeToContentRoot value="true" />
|
||||||
<processorPath useClasspath="true" />
|
<processorPath useClasspath="true" />
|
||||||
</profile>
|
</profile>
|
||||||
|
@ -116,4 +116,12 @@ public enum Rank
|
|||||||
{
|
{
|
||||||
return _donor;
|
return _donor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getRawTag()
|
||||||
|
{
|
||||||
|
if (Name.equalsIgnoreCase("ALL"))
|
||||||
|
return "";
|
||||||
|
|
||||||
|
return Name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -505,12 +505,12 @@ public class UtilItem
|
|||||||
|
|
||||||
public static boolean isSword(Material material)
|
public static boolean isSword(Material material)
|
||||||
{
|
{
|
||||||
return material == null ? false : (_materials.get(material).contains(ItemCategory.SWORD));
|
return material == null ? false : (contains(material, ItemCategory.SWORD));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isEdible(Material material)
|
public static boolean isEdible(Material material)
|
||||||
{
|
{
|
||||||
return material == null ? false : (_materials.get(material).contains(ItemCategory.EDIBLE));
|
return material == null ? false : (contains(material, ItemCategory.EDIBLE));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isEdible(ItemStack stack)
|
public static boolean isEdible(ItemStack stack)
|
||||||
@ -520,7 +520,7 @@ public class UtilItem
|
|||||||
|
|
||||||
public static boolean isPotable(Material material)
|
public static boolean isPotable(Material material)
|
||||||
{
|
{
|
||||||
return material == null ? false : (_materials.get(material).contains(ItemCategory.POTABLE));
|
return material == null ? false : (contains(material, ItemCategory.POTABLE));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isPotable(ItemStack stack)
|
public static boolean isPotable(ItemStack stack)
|
||||||
@ -530,7 +530,7 @@ public class UtilItem
|
|||||||
|
|
||||||
public static boolean isAxe(Material material)
|
public static boolean isAxe(Material material)
|
||||||
{
|
{
|
||||||
return material == null ? false : (_materials.get(material).contains(ItemCategory.AXE));
|
return material == null ? false : (contains(material, ItemCategory.AXE));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isAxe(ItemStack stack)
|
public static boolean isAxe(ItemStack stack)
|
||||||
@ -540,7 +540,7 @@ public class UtilItem
|
|||||||
|
|
||||||
public static boolean isWeapon(Material material)
|
public static boolean isWeapon(Material material)
|
||||||
{
|
{
|
||||||
return material == null ? false : (_materials.get(material).contains(ItemCategory.WEAPON));
|
return material == null ? false : (contains(material, ItemCategory.WEAPON));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isWeapon(ItemStack stack)
|
public static boolean isWeapon(ItemStack stack)
|
||||||
@ -550,7 +550,7 @@ public class UtilItem
|
|||||||
|
|
||||||
public static boolean isHelmet(Material material)
|
public static boolean isHelmet(Material material)
|
||||||
{
|
{
|
||||||
return material == null ? false : (_materials.get(material).contains(ItemCategory.ARMOR_HELMET));
|
return material == null ? false : (contains(material, ItemCategory.ARMOR_HELMET));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isHelmet(ItemStack stack)
|
public static boolean isHelmet(ItemStack stack)
|
||||||
@ -560,7 +560,7 @@ public class UtilItem
|
|||||||
|
|
||||||
public static boolean isChestplate(Material material)
|
public static boolean isChestplate(Material material)
|
||||||
{
|
{
|
||||||
return material == null ? false : (_materials.get(material).contains(ItemCategory.ARMOR_CHESTPLATE));
|
return material == null ? false : (contains(material, ItemCategory.ARMOR_CHESTPLATE));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isChestplate(ItemStack stack)
|
public static boolean isChestplate(ItemStack stack)
|
||||||
@ -570,7 +570,7 @@ public class UtilItem
|
|||||||
|
|
||||||
public static boolean isLeggings(Material material)
|
public static boolean isLeggings(Material material)
|
||||||
{
|
{
|
||||||
return material == null ? false : (_materials.get(material).contains(ItemCategory.ARMOR_LEGGINGS));
|
return material == null ? false : (contains(material, ItemCategory.ARMOR_LEGGINGS));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isLeggings(ItemStack stack)
|
public static boolean isLeggings(ItemStack stack)
|
||||||
@ -580,7 +580,7 @@ public class UtilItem
|
|||||||
|
|
||||||
public static boolean isBoots(Material material)
|
public static boolean isBoots(Material material)
|
||||||
{
|
{
|
||||||
return material == null ? false : (_materials.get(material).contains(ItemCategory.ARMOR_BOOTS));
|
return material == null ? false : (contains(material, ItemCategory.ARMOR_BOOTS));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isBoots(ItemStack stack)
|
public static boolean isBoots(ItemStack stack)
|
||||||
@ -590,7 +590,7 @@ public class UtilItem
|
|||||||
|
|
||||||
public static boolean isBlock(Material material)
|
public static boolean isBlock(Material material)
|
||||||
{
|
{
|
||||||
return material == null ? false : (_materials.get(material).contains(ItemCategory.BLOCK));
|
return material == null ? false : (contains(material, ItemCategory.BLOCK));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isBlock(ItemStack stack)
|
public static boolean isBlock(ItemStack stack)
|
||||||
@ -600,7 +600,7 @@ public class UtilItem
|
|||||||
|
|
||||||
public static boolean isLiquid(Material material)
|
public static boolean isLiquid(Material material)
|
||||||
{
|
{
|
||||||
return material == null ? false : (_materials.get(material).contains(ItemCategory.LIQUID));
|
return material == null ? false : (contains(material, ItemCategory.LIQUID));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isLiquid(ItemStack stack)
|
public static boolean isLiquid(ItemStack stack)
|
||||||
@ -620,7 +620,7 @@ public class UtilItem
|
|||||||
|
|
||||||
public static boolean isTranslucent(Material material)
|
public static boolean isTranslucent(Material material)
|
||||||
{
|
{
|
||||||
return material == null ? false : (_materials.get(material).contains(ItemCategory.TRANSLUCENT));
|
return material == null ? false : (contains(material, ItemCategory.TRANSLUCENT));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isTranslucent(ItemStack stack)
|
public static boolean isTranslucent(ItemStack stack)
|
||||||
@ -630,7 +630,7 @@ public class UtilItem
|
|||||||
|
|
||||||
public static boolean isOre(Material material)
|
public static boolean isOre(Material material)
|
||||||
{
|
{
|
||||||
return material == null ? false : (_materials.get(material).contains(ItemCategory.ORE));
|
return material == null ? false : (contains(material, ItemCategory.ORE));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isOre(ItemStack stack)
|
public static boolean isOre(ItemStack stack)
|
||||||
@ -640,7 +640,7 @@ public class UtilItem
|
|||||||
|
|
||||||
public static boolean isCompactBlock(Material material)
|
public static boolean isCompactBlock(Material material)
|
||||||
{
|
{
|
||||||
return material == null ? false : (_materials.get(material).contains(ItemCategory.COMPACT_BLOCK));
|
return material == null ? false : (contains(material, ItemCategory.COMPACT_BLOCK));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isCompactBlock(ItemStack stack)
|
public static boolean isCompactBlock(ItemStack stack)
|
||||||
@ -650,7 +650,7 @@ public class UtilItem
|
|||||||
|
|
||||||
public static boolean isGlassProduct(Material material)
|
public static boolean isGlassProduct(Material material)
|
||||||
{
|
{
|
||||||
return material == null ? false : (_materials.get(material).contains(ItemCategory.GLASS));
|
return material == null ? false : (contains(material, ItemCategory.GLASS));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isGlassProduct(ItemStack stack)
|
public static boolean isGlassProduct(ItemStack stack)
|
||||||
@ -660,7 +660,7 @@ public class UtilItem
|
|||||||
|
|
||||||
public static boolean doesModifyMovement(Material material)
|
public static boolean doesModifyMovement(Material material)
|
||||||
{
|
{
|
||||||
return material == null ? false : (_materials.get(material).contains(ItemCategory.MOVEMENT_MODIFYING));
|
return material == null ? false : (contains(material, ItemCategory.MOVEMENT_MODIFYING));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean doesModifyMovement(ItemStack stack)
|
public static boolean doesModifyMovement(ItemStack stack)
|
||||||
@ -670,7 +670,7 @@ public class UtilItem
|
|||||||
|
|
||||||
public static boolean doesEmitLight(Material material)
|
public static boolean doesEmitLight(Material material)
|
||||||
{
|
{
|
||||||
return material == null ? false : (_materials.get(material).contains(ItemCategory.LIGHT_EMITTING));
|
return material == null ? false : (contains(material, ItemCategory.LIGHT_EMITTING));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean doesEmitLight(ItemStack stack)
|
public static boolean doesEmitLight(ItemStack stack)
|
||||||
@ -680,7 +680,7 @@ public class UtilItem
|
|||||||
|
|
||||||
public static boolean isRedstoneComponent(Material material)
|
public static boolean isRedstoneComponent(Material material)
|
||||||
{
|
{
|
||||||
return material == null ? false : (_materials.get(material).contains(ItemCategory.REDSTONE));
|
return material == null ? false : (contains(material, ItemCategory.REDSTONE));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isRedstoneComponent(ItemStack stack)
|
public static boolean isRedstoneComponent(ItemStack stack)
|
||||||
@ -690,7 +690,7 @@ public class UtilItem
|
|||||||
|
|
||||||
public static boolean doesHaveGUI(Material material)
|
public static boolean doesHaveGUI(Material material)
|
||||||
{
|
{
|
||||||
return material == null ? false : (_materials.get(material).contains(ItemCategory.GUI));
|
return material == null ? false : (contains(material, ItemCategory.GUI));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean doesHaveGUI(ItemStack stack)
|
public static boolean doesHaveGUI(ItemStack stack)
|
||||||
@ -700,7 +700,7 @@ public class UtilItem
|
|||||||
|
|
||||||
public static boolean isClimbable(Material material)
|
public static boolean isClimbable(Material material)
|
||||||
{
|
{
|
||||||
return material == null ? false : (_materials.get(material).contains(ItemCategory.CLIMBABLE));
|
return material == null ? false : (contains(material, ItemCategory.CLIMBABLE));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isClimbable(ItemStack stack)
|
public static boolean isClimbable(ItemStack stack)
|
||||||
@ -710,7 +710,7 @@ public class UtilItem
|
|||||||
|
|
||||||
public static boolean isLeatherProduct(Material material)
|
public static boolean isLeatherProduct(Material material)
|
||||||
{
|
{
|
||||||
return material == null ? false : (_materials.get(material).contains(ItemCategory.LEATHER));
|
return material == null ? false : (contains(material, ItemCategory.LEATHER));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isLeatherProduct(ItemStack stack)
|
public static boolean isLeatherProduct(ItemStack stack)
|
||||||
@ -720,7 +720,7 @@ public class UtilItem
|
|||||||
|
|
||||||
public static boolean isGoldProduct(Material material)
|
public static boolean isGoldProduct(Material material)
|
||||||
{
|
{
|
||||||
return material == null ? false : (_materials.get(material).contains(ItemCategory.GOLD));
|
return material == null ? false : (contains(material, ItemCategory.GOLD));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isGoldProduct(ItemStack stack)
|
public static boolean isGoldProduct(ItemStack stack)
|
||||||
@ -730,7 +730,7 @@ public class UtilItem
|
|||||||
|
|
||||||
public static boolean isIronProduct(Material material)
|
public static boolean isIronProduct(Material material)
|
||||||
{
|
{
|
||||||
return material == null ? false : (_materials.get(material).contains(ItemCategory.IRON));
|
return material == null ? false : (contains(material, ItemCategory.IRON));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isIronProduct(ItemStack stack)
|
public static boolean isIronProduct(ItemStack stack)
|
||||||
@ -740,7 +740,7 @@ public class UtilItem
|
|||||||
|
|
||||||
public static boolean isDiamondProduct(Material material)
|
public static boolean isDiamondProduct(Material material)
|
||||||
{
|
{
|
||||||
return material == null ? false : (_materials.get(material).contains(ItemCategory.DIAMOND));
|
return material == null ? false : (contains(material, ItemCategory.DIAMOND));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isDiamondProduct(ItemStack stack)
|
public static boolean isDiamondProduct(ItemStack stack)
|
||||||
@ -750,7 +750,7 @@ public class UtilItem
|
|||||||
|
|
||||||
public static boolean isStoneProduct(Material material)
|
public static boolean isStoneProduct(Material material)
|
||||||
{
|
{
|
||||||
return material == null ? false : (_materials.get(material).contains(ItemCategory.STONE));
|
return material == null ? false : (contains(material, ItemCategory.STONE));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isStoneProduct(ItemStack stack)
|
public static boolean isStoneProduct(ItemStack stack)
|
||||||
@ -760,7 +760,7 @@ public class UtilItem
|
|||||||
|
|
||||||
public static boolean isWoodProduct(Material material)
|
public static boolean isWoodProduct(Material material)
|
||||||
{
|
{
|
||||||
return material == null ? false : (_materials.get(material).contains(ItemCategory.WOOD));
|
return material == null ? false : (contains(material, ItemCategory.WOOD));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isWoodProduct(ItemStack stack)
|
public static boolean isWoodProduct(ItemStack stack)
|
||||||
@ -770,7 +770,7 @@ public class UtilItem
|
|||||||
|
|
||||||
public static boolean isChainmailProduct(Material material)
|
public static boolean isChainmailProduct(Material material)
|
||||||
{
|
{
|
||||||
return material == null ? false : (_materials.get(material).contains(ItemCategory.CHAINMAIL));
|
return material == null ? false : (contains(material, ItemCategory.CHAINMAIL));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isChainmailProduct(ItemStack stack)
|
public static boolean isChainmailProduct(ItemStack stack)
|
||||||
@ -780,7 +780,7 @@ public class UtilItem
|
|||||||
|
|
||||||
public static boolean isThrowable(Material material)
|
public static boolean isThrowable(Material material)
|
||||||
{
|
{
|
||||||
return material == null ? false : (_materials.get(material).contains(ItemCategory.THROWABLE));
|
return material == null ? false : (contains(material, ItemCategory.THROWABLE));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isThrowable(ItemStack stack)
|
public static boolean isThrowable(ItemStack stack)
|
||||||
@ -790,7 +790,7 @@ public class UtilItem
|
|||||||
|
|
||||||
public static boolean isVehicle(Material material)
|
public static boolean isVehicle(Material material)
|
||||||
{
|
{
|
||||||
return material == null ? false : (_materials.get(material).contains(ItemCategory.VEHICLE));
|
return material == null ? false : (contains(material, ItemCategory.VEHICLE));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isVehicle(ItemStack stack)
|
public static boolean isVehicle(ItemStack stack)
|
||||||
@ -800,7 +800,7 @@ public class UtilItem
|
|||||||
|
|
||||||
public static boolean isItem(Material material)
|
public static boolean isItem(Material material)
|
||||||
{
|
{
|
||||||
return material == null ? false : (_materials.get(material).contains(ItemCategory.ITEM));
|
return material == null ? false : (contains(material, ItemCategory.ITEM));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isItem(ItemStack stack)
|
public static boolean isItem(ItemStack stack)
|
||||||
@ -820,7 +820,7 @@ public class UtilItem
|
|||||||
|
|
||||||
public static boolean isLeaf(Material material)
|
public static boolean isLeaf(Material material)
|
||||||
{
|
{
|
||||||
return material == null ? false : (_materials.get(material).contains(ItemCategory.LEAVES));
|
return material == null ? false : (contains(material, ItemCategory.LEAVES));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isLeaf(ItemStack stack)
|
public static boolean isLeaf(ItemStack stack)
|
||||||
@ -830,7 +830,7 @@ public class UtilItem
|
|||||||
|
|
||||||
public static boolean isTool(Material material)
|
public static boolean isTool(Material material)
|
||||||
{
|
{
|
||||||
return material == null ? false : (_materials.get(material).contains(ItemCategory.TOOL));
|
return material == null ? false : (contains(material, ItemCategory.TOOL));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isTool(ItemStack stack)
|
public static boolean isTool(ItemStack stack)
|
||||||
@ -840,7 +840,7 @@ public class UtilItem
|
|||||||
|
|
||||||
public static boolean isAffectedByPhysics(Material material)
|
public static boolean isAffectedByPhysics(Material material)
|
||||||
{
|
{
|
||||||
return material == null ? false : (_materials.get(material).contains(ItemCategory.PHYSICS));
|
return material == null ? false : (contains(material, ItemCategory.PHYSICS));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isAffectedByPhysics(ItemStack stack)
|
public static boolean isAffectedByPhysics(ItemStack stack)
|
||||||
@ -850,7 +850,7 @@ public class UtilItem
|
|||||||
|
|
||||||
public static boolean isFromNether(Material material)
|
public static boolean isFromNether(Material material)
|
||||||
{
|
{
|
||||||
return material == null ? false : (_materials.get(material).contains(ItemCategory.NETHER));
|
return material == null ? false : (contains(material, ItemCategory.NETHER));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isFromNether(ItemStack stack)
|
public static boolean isFromNether(ItemStack stack)
|
||||||
@ -870,7 +870,7 @@ public class UtilItem
|
|||||||
|
|
||||||
public static boolean isMusicDisc(Material material)
|
public static boolean isMusicDisc(Material material)
|
||||||
{
|
{
|
||||||
return material == null ? false : (_materials.get(material).contains(ItemCategory.MUSIC_DISC));
|
return material == null ? false : (contains(material, ItemCategory.MUSIC_DISC));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isMusicDisc(ItemStack stack)
|
public static boolean isMusicDisc(ItemStack stack)
|
||||||
@ -880,7 +880,7 @@ public class UtilItem
|
|||||||
|
|
||||||
public static boolean isSpade(Material material)
|
public static boolean isSpade(Material material)
|
||||||
{
|
{
|
||||||
return material == null ? false : (_materials.get(material).contains(ItemCategory.SHOVEL));
|
return material == null ? false : (contains(material, ItemCategory.SHOVEL));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isSpade(ItemStack stack)
|
public static boolean isSpade(ItemStack stack)
|
||||||
@ -890,7 +890,7 @@ public class UtilItem
|
|||||||
|
|
||||||
public static boolean isPickaxe(Material material)
|
public static boolean isPickaxe(Material material)
|
||||||
{
|
{
|
||||||
return material == null ? false : (_materials.get(material).contains(ItemCategory.PICKAXE));
|
return material == null ? false : (contains(material, ItemCategory.PICKAXE));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isPickaxe(ItemStack stack)
|
public static boolean isPickaxe(ItemStack stack)
|
||||||
@ -900,7 +900,7 @@ public class UtilItem
|
|||||||
|
|
||||||
public static boolean isHoe(Material material)
|
public static boolean isHoe(Material material)
|
||||||
{
|
{
|
||||||
return material == null ? false : (_materials.get(material).contains(ItemCategory.HOE));
|
return material == null ? false : (contains(material, ItemCategory.HOE));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isHoe(ItemStack stack)
|
public static boolean isHoe(ItemStack stack)
|
||||||
@ -920,7 +920,7 @@ public class UtilItem
|
|||||||
|
|
||||||
public static boolean isArmor(Material material)
|
public static boolean isArmor(Material material)
|
||||||
{
|
{
|
||||||
return material == null ? false : (_materials.get(material).contains(ItemCategory.ARMOR));
|
return material == null ? false : (contains(material, ItemCategory.ARMOR));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isArmor(ItemStack stack)
|
public static boolean isArmor(ItemStack stack)
|
||||||
@ -928,6 +928,12 @@ public class UtilItem
|
|||||||
return isArmor(stack == null ? null : stack.getType());
|
return isArmor(stack == null ? null : stack.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean contains(Material material, ItemCategory category)
|
||||||
|
{
|
||||||
|
EnumSet<ItemCategory> set = _materials.get(material);
|
||||||
|
return set == null ? false : set.contains(category);
|
||||||
|
}
|
||||||
|
|
||||||
public static List<Material> listIn(ItemCategory... attr)
|
public static List<Material> listIn(ItemCategory... attr)
|
||||||
{
|
{
|
||||||
List<ItemCategory> attributes = new ArrayList<>(attr.length);
|
List<ItemCategory> attributes = new ArrayList<>(attr.length);
|
||||||
|
@ -106,4 +106,8 @@ public class UtilText {
|
|||||||
return x <= 0 ? true : x > 1;
|
return x <= 0 ? true : x > 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String trim(int maxLength, String s) {
|
||||||
|
return s.length() <= maxLength ? s : s.substring(0, maxLength);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ public class ItemTNT extends ItemGadget
|
|||||||
double mult = players.get(player);
|
double mult = players.get(player);
|
||||||
|
|
||||||
//Knockback
|
//Knockback
|
||||||
UtilAction.velocity(player, UtilAlg.getTrajectory(event.getLocation(), player.getLocation()), 3 * mult, false, 0, 0.5 + 2 * mult, 10, true);
|
UtilAction.velocity(player, UtilAlg.getTrajectory(event.getLocation(), player.getLocation()), 2 * mult, false, 0, 0.5 + 1 * mult, 10, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Simulating explosion to prevent water from being evaporated.
|
// Simulating explosion to prevent water from being evaporated.
|
||||||
|
@ -2,6 +2,7 @@ package mineplex.core.gadget.gadgets;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -137,8 +138,8 @@ public class MorphTitan extends MorphGadget
|
|||||||
{
|
{
|
||||||
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, stand.getLocation(), 3f, 3f, 3f, 0, 32, ViewDist.MAX, UtilServer.getPlayers());
|
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, stand.getLocation(), 3f, 3f, 3f, 0, 32, ViewDist.MAX, UtilServer.getPlayers());
|
||||||
|
|
||||||
HashMap<LivingEntity, Double> players = UtilEnt.getInRadius(stand.getLocation(), 12);
|
HashMap<Player, Double> players = UtilPlayer.getInRadius(stand.getLocation(), 12d);
|
||||||
for (Entity ent : players.keySet())
|
for (Player ent : players.keySet())
|
||||||
{
|
{
|
||||||
if (ent instanceof Player)
|
if (ent instanceof Player)
|
||||||
if (Manager.collideEvent(this, (Player)ent))
|
if (Manager.collideEvent(this, (Player)ent))
|
||||||
@ -147,11 +148,13 @@ public class MorphTitan extends MorphGadget
|
|||||||
double mult = players.get(ent);
|
double mult = players.get(ent);
|
||||||
|
|
||||||
//Knockback
|
//Knockback
|
||||||
UtilAction.velocity(ent, UtilAlg.getTrajectory(stand.getLocation(), ent.getLocation()), 4 * mult, false, 0, 1 + 3 * mult, 10, true);
|
UtilAction.velocity(ent, UtilAlg.getTrajectory(stand.getLocation(), ent.getLocation()), 3 * mult, false, 0, 1 + 2 * mult, 10, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Sound
|
//Sound
|
||||||
stand.getWorld().playSound(stand.getLocation(), Sound.ZOMBIE_REMEDY, 6f, 0.75f);
|
stand.getWorld().playSound(stand.getLocation(), Sound.ZOMBIE_REMEDY, 6f, 0.75f);
|
||||||
|
|
||||||
|
stand.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Disguise
|
//Disguise
|
||||||
@ -215,4 +218,25 @@ public class MorphTitan extends MorphGadget
|
|||||||
Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName());
|
Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void clean(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (event.getType() != UpdateType.SLOW)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Iterator<Player> playerIter = _targets.keySet().iterator();
|
||||||
|
|
||||||
|
while (playerIter.hasNext())
|
||||||
|
{
|
||||||
|
Player player = playerIter.next();
|
||||||
|
|
||||||
|
if (!player.isOnline())
|
||||||
|
{
|
||||||
|
Entity ent = _targets.get(player);
|
||||||
|
ent.remove();
|
||||||
|
playerIter.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ public class ParticleLegend extends ParticleGadget
|
|||||||
" ",
|
" ",
|
||||||
C.cGreen + "Unlocked with Legend Rank",
|
C.cGreen + "Unlocked with Legend Rank",
|
||||||
},
|
},
|
||||||
-2,
|
-3,
|
||||||
Material.ENDER_PORTAL_FRAME, (byte)0);
|
Material.ENDER_PORTAL_FRAME, (byte)0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,12 +37,12 @@ public class ParticleTitan extends ParticleGadget
|
|||||||
super(manager, "Flame of the Titans", new String[]
|
super(manager, "Flame of the Titans", new String[]
|
||||||
{
|
{
|
||||||
C.cWhite + "These flames are said to be the",
|
C.cWhite + "These flames are said to be the",
|
||||||
C.cWhite + "souls of an lost civilisation of",
|
C.cWhite + "souls of a lost civilisation of",
|
||||||
C.cWhite + "Titans, forgotten by time.",
|
C.cWhite + "Titans, forgotten by time.",
|
||||||
" ",
|
" ",
|
||||||
C.cRed + "Unlocked with Titan Rank",
|
C.cRed + "Unlocked with Titan Rank",
|
||||||
},
|
},
|
||||||
-2,
|
-3,
|
||||||
Material.FIREBALL, (byte)0);
|
Material.FIREBALL, (byte)0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ public class ConfirmationPage<PluginType extends MiniPlugin, ShopType extends Sh
|
|||||||
buildSquareAt(_okSquareSlotStart, new ShopItem(Material.EMERALD_BLOCK, (byte) 0, ChatColor.GREEN + "OK", null, 1, false, true), okClicked);
|
buildSquareAt(_okSquareSlotStart, new ShopItem(Material.EMERALD_BLOCK, (byte) 0, ChatColor.GREEN + "OK", null, 1, false, true), okClicked);
|
||||||
buildSquareAt(_okSquareSlotStart + 6, new ShopItem(Material.REDSTONE_BLOCK, (byte) 0, ChatColor.RED + "CANCEL", null, 1, false, true), cancelClicked);
|
buildSquareAt(_okSquareSlotStart + 6, new ShopItem(Material.REDSTONE_BLOCK, (byte) 0, ChatColor.RED + "CANCEL", null, 1, false, true), cancelClicked);
|
||||||
|
|
||||||
this.getInventory().setItem(4, new ShopItem(getCurrencyType().GetDisplayMaterial(), (byte)0, getCurrencyType().toString(), new String[] { C.cGray + _salesItem.GetCost(getCurrencyType()) + " " + getCurrencyType().toString() + " will be deducted from your account balance." }, 1, false, true).getHandle());
|
this.getInventory().setItem(4, new ShopItem(getCurrencyType().GetDisplayMaterial(), (byte)0, getCurrencyType().toString(), new String[] { C.cGray + _salesItem.GetCost(getCurrencyType()) + " " + getCurrencyType().toString() + " will be", "deducted from your account balance." }, 1, false, true).getHandle());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void okClicked(Player player)
|
protected void okClicked(Player player)
|
||||||
@ -146,6 +146,7 @@ public class ConfirmationPage<PluginType extends MiniPlugin, ShopType extends Sh
|
|||||||
if (data)
|
if (data)
|
||||||
{
|
{
|
||||||
showResultsPage(TransactionResponse.Success);
|
showResultsPage(TransactionResponse.Success);
|
||||||
|
getPlayer().playSound(getPlayer().getLocation(), Sound.LEVEL_UP, 2f, 1.5f);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -18,6 +18,8 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
|
|
||||||
public class TaskManager extends MiniDbClientPlugin<TaskClient>
|
public class TaskManager extends MiniDbClientPlugin<TaskClient>
|
||||||
{
|
{
|
||||||
|
public static TaskManager Instance;
|
||||||
|
|
||||||
private static Object _taskLock = new Object();
|
private static Object _taskLock = new Object();
|
||||||
private TaskRepository _repository;
|
private TaskRepository _repository;
|
||||||
|
|
||||||
@ -27,6 +29,8 @@ public class TaskManager extends MiniDbClientPlugin<TaskClient>
|
|||||||
{
|
{
|
||||||
super("Task Manager", plugin, clientManager);
|
super("Task Manager", plugin, clientManager);
|
||||||
|
|
||||||
|
Instance = this;
|
||||||
|
|
||||||
_repository = new TaskRepository(plugin);
|
_repository = new TaskRepository(plugin);
|
||||||
updateTasks();
|
updateTasks();
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
import mineplex.core.MiniPlugin;
|
import mineplex.core.MiniPlugin;
|
||||||
import mineplex.core.account.CoreClient;
|
import mineplex.core.account.CoreClient;
|
||||||
import mineplex.core.account.CoreClientManager;
|
import mineplex.core.account.CoreClientManager;
|
||||||
|
import mineplex.core.common.CurrencyType;
|
||||||
import mineplex.core.common.Rank;
|
import mineplex.core.common.Rank;
|
||||||
import mineplex.core.common.util.Callback;
|
import mineplex.core.common.util.Callback;
|
||||||
import mineplex.core.common.util.NautHashMap;
|
import mineplex.core.common.util.NautHashMap;
|
||||||
@ -236,7 +237,7 @@ public class Enjin extends MiniPlugin implements CommandExecutor
|
|||||||
_purchaseManager.addAccountPurchaseToQueue(client.getAccountId(), packageName, amount, data == TransactionResponse.Success);
|
_purchaseManager.addAccountPurchaseToQueue(client.getAccountId(), packageName, amount, data == TransactionResponse.Success);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, name, client.getAccountId(), amount == 1 ? packageName : packageName + " " + amount, false, 0, false);
|
}, name, client.getAccountId(), amount == 1 ? packageName : packageName + " " + amount, CurrencyType.Gems, 0, false);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ import mineplex.core.common.util.C;
|
|||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
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.tutorials.types.ClanTips.TipType;
|
import mineplex.game.clans.clans.ClanTips.TipType;
|
||||||
|
|
||||||
public class ClanEnergyTracker extends MiniPlugin
|
public class ClanEnergyTracker extends MiniPlugin
|
||||||
{
|
{
|
||||||
|
@ -670,7 +670,7 @@ public class ClanInfo
|
|||||||
public int getEnergyMax()
|
public int getEnergyMax()
|
||||||
{
|
{
|
||||||
// 10080 = 7 days of minutes
|
// 10080 = 7 days of minutes
|
||||||
return Math.max(4320, getEnergyCostPerMinute() * 60 * 24 * 3);
|
return Math.max(10080, getEnergyCostPerMinute() * 60 * 24 * 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getEnergyCostPerMinute()
|
public int getEnergyCostPerMinute()
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package mineplex.game.clans.tutorials.types;
|
package mineplex.game.clans.clans;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
@ -12,8 +12,9 @@ import mineplex.core.common.util.C;
|
|||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.UtilBlock;
|
import mineplex.core.common.util.UtilBlock;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.core.preferences.PreferencesManager;
|
import mineplex.core.preferences.PreferencesManager;
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
import mineplex.game.clans.clans.event.ClanTipEvent;
|
||||||
import mineplex.game.clans.clans.event.PlayerClaimTerritoryEvent;
|
import mineplex.game.clans.clans.event.PlayerClaimTerritoryEvent;
|
||||||
import mineplex.game.clans.clans.event.PlayerEnterTerritoryEvent;
|
import mineplex.game.clans.clans.event.PlayerEnterTerritoryEvent;
|
||||||
import mineplex.game.clans.clans.event.PlayerUnClaimTerritoryEvent;
|
import mineplex.game.clans.clans.event.PlayerUnClaimTerritoryEvent;
|
||||||
@ -117,6 +118,15 @@ public class ClanTips extends MiniPlugin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ClanTipEvent event = new ClanTipEvent(tip, player);
|
||||||
|
|
||||||
|
UtilServer.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
|
if (event.isCancelled())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
UtilPlayer.message(player, " ");
|
UtilPlayer.message(player, " ");
|
||||||
UtilPlayer.message(player, tip._messages);
|
UtilPlayer.message(player, tip._messages);
|
||||||
|
|
@ -64,6 +64,7 @@ import mineplex.core.task.TaskManager;
|
|||||||
import mineplex.core.teleport.Teleport;
|
import mineplex.core.teleport.Teleport;
|
||||||
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.ClanTips.TipType;
|
||||||
import mineplex.game.clans.clans.ClansUtility.ClanRelation;
|
import mineplex.game.clans.clans.ClansUtility.ClanRelation;
|
||||||
import mineplex.game.clans.clans.commands.ClanManagementCommand;
|
import mineplex.game.clans.clans.commands.ClanManagementCommand;
|
||||||
import mineplex.game.clans.clans.commands.ClansAllyChatCommand;
|
import mineplex.game.clans.clans.commands.ClansAllyChatCommand;
|
||||||
@ -103,8 +104,6 @@ import mineplex.game.clans.gameplay.safelog.npc.NPCManager;
|
|||||||
import mineplex.game.clans.items.GearManager;
|
import mineplex.game.clans.items.GearManager;
|
||||||
import mineplex.game.clans.spawn.Spawn;
|
import mineplex.game.clans.spawn.Spawn;
|
||||||
import mineplex.game.clans.tutorials.TutorialManager;
|
import mineplex.game.clans.tutorials.TutorialManager;
|
||||||
import mineplex.game.clans.tutorials.types.ClanTips;
|
|
||||||
import mineplex.game.clans.tutorials.types.ClanTips.TipType;
|
|
||||||
import mineplex.minecraft.game.classcombat.Class.ClassManager;
|
import mineplex.minecraft.game.classcombat.Class.ClassManager;
|
||||||
import mineplex.minecraft.game.classcombat.Class.ClientClass;
|
import mineplex.minecraft.game.classcombat.Class.ClientClass;
|
||||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass;
|
import mineplex.minecraft.game.classcombat.Class.IPvpClass;
|
||||||
@ -1002,7 +1001,8 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
|||||||
public void updateBedStatus(UpdateEvent event)
|
public void updateBedStatus(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (event.getType() != UpdateType.TWOSEC)
|
if (event.getType() != UpdateType.TWOSEC)
|
||||||
{
|
return;
|
||||||
|
|
||||||
for (String name : getClanNameSet())
|
for (String name : getClanNameSet())
|
||||||
{
|
{
|
||||||
ClanInfo clan = _clanUtility.getClanByClanName(name);
|
ClanInfo clan = _clanUtility.getClanByClanName(name);
|
||||||
@ -1031,7 +1031,6 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void handleClansDeath(PlayerDeathEvent event)
|
public void handleClansDeath(PlayerDeathEvent event)
|
||||||
|
@ -674,6 +674,9 @@ public class ClansUtility
|
|||||||
if (!data)
|
if (!data)
|
||||||
{
|
{
|
||||||
UtilPlayer.message(caller, F.main("Clans", "There was an error processing your request. Try again later"));
|
UtilPlayer.message(caller, F.main("Clans", "There was an error processing your request. Try again later"));
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
UtilPlayer.message(caller, F.main("Clans", "You disbanded your Clan."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -724,11 +727,11 @@ public class ClansUtility
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clan.getClaims() >= clan.getClaimsMax())
|
// if (clan.getClaims() >= clan.getClaimsMax())
|
||||||
{
|
// {
|
||||||
UtilPlayer.message(caller, F.main("Clans", "Your Clan cannot claim more Territory."));
|
// UtilPlayer.message(caller, F.main("Clans", "Your Clan cannot claim more Territory."));
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
|
|
||||||
// Adjacent
|
// Adjacent
|
||||||
boolean selfAdj = false;
|
boolean selfAdj = false;
|
||||||
@ -736,7 +739,13 @@ public class ClansUtility
|
|||||||
{
|
{
|
||||||
for (int z = -1; z <= 1; z++)
|
for (int z = -1; z <= 1; z++)
|
||||||
{
|
{
|
||||||
if (x == 0 && z == 0) continue;
|
if ((x == 1 && z == 1)
|
||||||
|
|| (x == -1 && z == 1)
|
||||||
|
|| (x == -1 && z == -1)
|
||||||
|
|| (x == 1 && z == -1)
|
||||||
|
|| (x == 0 && z == 0)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
String other = UtilWorld.chunkToStr(caller.getWorld().getChunkAt(caller.getLocation().getChunk().getX() + x, caller.getLocation().getChunk().getZ() + z));
|
String other = UtilWorld.chunkToStr(caller.getWorld().getChunkAt(caller.getLocation().getChunk().getX() + x, caller.getLocation().getChunk().getZ() + z));
|
||||||
|
|
||||||
@ -837,10 +846,10 @@ public class ClansUtility
|
|||||||
int boxed = 0;
|
int boxed = 0;
|
||||||
|
|
||||||
// This is bad. I know. But the other way doesn't seem to work.
|
// This is bad. I know. But the other way doesn't seem to work.
|
||||||
String down = UtilWorld.chunkToStr(chunk.getWorld().getChunkAt(chunk.getX() + 1, chunk.getZ() + 1));
|
String down = UtilWorld.chunkToStr(chunk.getWorld().getChunkAt(chunk.getX() + 0, chunk.getZ() + 1));
|
||||||
String up = UtilWorld.chunkToStr(chunk.getWorld().getChunkAt(chunk.getX(), chunk.getZ() -1 ));
|
String up = UtilWorld.chunkToStr(chunk.getWorld().getChunkAt(chunk.getX(), chunk.getZ() - 1));
|
||||||
String right = UtilWorld.chunkToStr(chunk.getWorld().getChunkAt(chunk.getX() + 1, chunk.getZ()));
|
String right = UtilWorld.chunkToStr(chunk.getWorld().getChunkAt(chunk.getX() + 1, chunk.getZ()));
|
||||||
String left = UtilWorld.chunkToStr(chunk.getWorld().getChunkAt(chunk.getX() - 1, chunk.getZ() + 0));
|
String left = UtilWorld.chunkToStr(chunk.getWorld().getChunkAt(chunk.getX() - 1, chunk.getZ()));
|
||||||
|
|
||||||
ClanInfo downClan = getOwner(down);
|
ClanInfo downClan = getOwner(down);
|
||||||
ClanInfo upClan = getOwner(up);
|
ClanInfo upClan = getOwner(up);
|
||||||
|
@ -16,18 +16,16 @@ 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.UtilTime.TimeUnit;
|
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||||
import mineplex.core.recharge.Recharge;
|
|
||||||
import mineplex.core.common.util.UtilWorld;
|
import mineplex.core.common.util.UtilWorld;
|
||||||
import mineplex.game.clans.Clans;
|
import mineplex.core.recharge.Recharge;
|
||||||
import mineplex.game.clans.clans.ClanInfo;
|
import mineplex.game.clans.clans.ClanInfo;
|
||||||
import mineplex.game.clans.clans.ClanRole;
|
import mineplex.game.clans.clans.ClanRole;
|
||||||
|
import mineplex.game.clans.clans.ClanTips.TipType;
|
||||||
import mineplex.game.clans.clans.ClansBlacklist;
|
import mineplex.game.clans.clans.ClansBlacklist;
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
import mineplex.game.clans.clans.ClansUtility;
|
|
||||||
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.TutorialManager;
|
import mineplex.game.clans.tutorials.TutorialManager;
|
||||||
import mineplex.game.clans.tutorials.types.ClanTips.TipType;
|
|
||||||
import net.minecraft.server.v1_8_R3.EnumDirection;
|
import net.minecraft.server.v1_8_R3.EnumDirection;
|
||||||
|
|
||||||
public class ClansCommand extends CommandBase<ClansManager>
|
public class ClansCommand extends CommandBase<ClansManager>
|
||||||
@ -275,6 +273,10 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
// Hopefully shouldn't happen!
|
// Hopefully shouldn't happen!
|
||||||
UtilPlayer.message(caller, F.main("Clans", "There was an error creating the clan. Please try again"));
|
UtilPlayer.message(caller, F.main("Clans", "There was an error creating the clan. Please try again"));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UtilPlayer.message(caller, F.main("Clans", "You created Clan " + C.cYellow + data.getName() + C.cGray + "."));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -777,6 +779,15 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
{
|
{
|
||||||
ClanInfo clan = Plugin.getClanUtility().getClanByPlayer(caller);
|
ClanInfo clan = Plugin.getClanUtility().getClanByPlayer(caller);
|
||||||
|
|
||||||
|
// Event
|
||||||
|
ClansCommandExecutedEvent event = new ClansCommandExecutedEvent(caller, "homeset");
|
||||||
|
UtilServer.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
|
if (event.isCancelled())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (clan == null)
|
if (clan == null)
|
||||||
{
|
{
|
||||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||||
@ -833,7 +844,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void infoClan(Player caller, String search)
|
public void infoClan(Player caller, String search)
|
||||||
{
|
{System.out.println(search);
|
||||||
if (search == null)
|
if (search == null)
|
||||||
{
|
{
|
||||||
UtilPlayer.message(caller, F.main("Clans", "You did not input a search parameter."));
|
UtilPlayer.message(caller, F.main("Clans", "You did not input a search parameter."));
|
||||||
@ -854,6 +865,36 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
_manager.getClanShop().openClanWho(caller, clan);
|
_manager.getClanShop().openClanWho(caller, clan);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void forceJoinClan(Player caller, String search)
|
||||||
|
{
|
||||||
|
if (_manager.getClientManager().hasRank(caller, Rank.ADMIN))
|
||||||
|
{
|
||||||
|
UtilPlayer.message(caller, F.main("Clans", "No no no, this command is not for you ;-)"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (search == null)
|
||||||
|
{
|
||||||
|
UtilPlayer.message(caller, F.main("Clans", "You did not input a search parameter."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ClansCommandExecutedEvent event = new ClansCommandExecutedEvent(caller, "info", search);
|
||||||
|
UtilServer.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
|
if (event.isCancelled())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ClanInfo clan = Plugin.getClanUtility().searchClanPlayer(caller, search, true);
|
||||||
|
if (clan == null) return;
|
||||||
|
|
||||||
|
_manager.getClanUtility().join(caller, clan);
|
||||||
|
_manager.getClanDataAccess().role(clan, caller.getUniqueId(), ClanRole.LEADER);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void infoTerritory(Player caller, String[] args)
|
public void infoTerritory(Player caller, String[] args)
|
||||||
{
|
{
|
||||||
ClanInfo clan;
|
ClanInfo clan;
|
||||||
|
@ -0,0 +1,40 @@
|
|||||||
|
package mineplex.game.clans.clans.commands;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import mineplex.core.command.CommandBase;
|
||||||
|
import mineplex.core.common.Rank;
|
||||||
|
import mineplex.core.task.TaskManager;
|
||||||
|
import mineplex.game.clans.tutorials.Tutorial;
|
||||||
|
import mineplex.game.clans.tutorials.TutorialManager;
|
||||||
|
import mineplex.game.clans.tutorials.gettingstarted.TutorialGettingStarted;
|
||||||
|
|
||||||
|
public class RestartTutCommand extends CommandBase<TutorialManager>
|
||||||
|
{
|
||||||
|
public RestartTutCommand(TutorialManager plugin)
|
||||||
|
{
|
||||||
|
super(plugin, Rank.ALL, "rst", "rstut");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void Execute(Player caller, String[] args)
|
||||||
|
{
|
||||||
|
String ignoreString = String.format(Tutorial.TUTORIAL_REWARD_TASK, "GettingStartedTutorial");
|
||||||
|
Integer ignoreInt = TaskManager.Instance.getTaskId(ignoreString);
|
||||||
|
|
||||||
|
Iterator<Integer> it = TaskManager.Instance.Get(caller).TasksCompleted.iterator();
|
||||||
|
while (it.hasNext())
|
||||||
|
{
|
||||||
|
Integer i = it.next();
|
||||||
|
if (i != null && (ignoreInt == null || i.intValue() != ignoreInt.intValue()))
|
||||||
|
{
|
||||||
|
it.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TutorialManager.Instance.cancelTutorial(caller);
|
||||||
|
TutorialManager.Instance.startTutorial(TutorialGettingStarted.class, caller);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,55 @@
|
|||||||
|
package mineplex.game.clans.clans.event;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
|
import mineplex.game.clans.clans.ClanTips.TipType;
|
||||||
|
|
||||||
|
public class ClanTipEvent extends Event
|
||||||
|
{
|
||||||
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
|
||||||
|
private Player _player;
|
||||||
|
private TipType _tip;
|
||||||
|
|
||||||
|
private boolean _cancelled;
|
||||||
|
|
||||||
|
public ClanTipEvent(TipType tip, Player player)
|
||||||
|
{
|
||||||
|
_player = player;
|
||||||
|
|
||||||
|
_tip = tip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Player getPlayer()
|
||||||
|
{
|
||||||
|
return _player;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TipType getTip()
|
||||||
|
{
|
||||||
|
return _tip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCancelled(boolean cancelled)
|
||||||
|
{
|
||||||
|
_cancelled = cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCancelled()
|
||||||
|
{
|
||||||
|
return _cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HandlerList getHandlers()
|
||||||
|
{
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList()
|
||||||
|
{
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
package mineplex.game.clans.clans.event;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
|
import mineplex.core.shop.ShopBase;
|
||||||
|
|
||||||
|
public class EnergyPageBuildEvent extends Event
|
||||||
|
{
|
||||||
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
|
||||||
|
private boolean _free;
|
||||||
|
private boolean _cancelled;
|
||||||
|
|
||||||
|
private Player _player;
|
||||||
|
|
||||||
|
public EnergyPageBuildEvent(Player player)
|
||||||
|
{
|
||||||
|
_player = player;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Player getPlayer()
|
||||||
|
{
|
||||||
|
return _player;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean free()
|
||||||
|
{
|
||||||
|
return _free;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFree(boolean free)
|
||||||
|
{
|
||||||
|
_free = free;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCancelled()
|
||||||
|
{
|
||||||
|
return _cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCancelled(boolean cancelled)
|
||||||
|
{
|
||||||
|
_cancelled = cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HandlerList getHandlers()
|
||||||
|
{
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList()
|
||||||
|
{
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
}
|
@ -55,6 +55,7 @@ import mineplex.core.common.util.UtilTime;
|
|||||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||||
import mineplex.core.itemstack.ItemBuilder;
|
import mineplex.core.itemstack.ItemBuilder;
|
||||||
import mineplex.core.portal.ServerTransferEvent;
|
import mineplex.core.portal.ServerTransferEvent;
|
||||||
|
import mineplex.core.timing.TimingManager;
|
||||||
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.ClansManager;
|
||||||
@ -69,7 +70,7 @@ import net.minecraft.server.v1_8_R3.PersistentCollection;
|
|||||||
|
|
||||||
public class ItemMapManager extends MiniPlugin
|
public class ItemMapManager extends MiniPlugin
|
||||||
{
|
{
|
||||||
private int _blocksScan = 16 * 12;
|
private int _blocksScan = 16 * 3;
|
||||||
private ClansUtility _clansUtility;
|
private ClansUtility _clansUtility;
|
||||||
private Comparator<Entry<Integer, Integer>> _comparator;
|
private Comparator<Entry<Integer, Integer>> _comparator;
|
||||||
private int _halfMapSize = 1536 / 2;
|
private int _halfMapSize = 1536 / 2;
|
||||||
@ -702,9 +703,7 @@ public class ItemMapManager extends MiniPlugin
|
|||||||
public void renderMap(UpdateEvent event)
|
public void renderMap(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (event.getType() != UpdateType.FAST)
|
if (event.getType() != UpdateType.FAST)
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if (_scanList.isEmpty())
|
if (_scanList.isEmpty())
|
||||||
{
|
{
|
||||||
@ -741,13 +740,16 @@ public class ItemMapManager extends MiniPlugin
|
|||||||
|
|
||||||
boolean outsideMap = startingZ < -_halfMapSize;
|
boolean outsideMap = startingZ < -_halfMapSize;
|
||||||
|
|
||||||
|
TimingManager.start("renderMap.scanWorldMap");
|
||||||
scanWorldMap(startingX, startingZ, !outsideMap);
|
scanWorldMap(startingX, startingZ, !outsideMap);
|
||||||
|
TimingManager.stop("renderMap.scanWorldMap");
|
||||||
|
|
||||||
if (outsideMap)
|
if (outsideMap)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TimingManager.start("renderMap.scale loop");
|
||||||
for (int scale = 1; scale < _scale.size(); scale++)
|
for (int scale = 1; scale < _scale.size(); scale++)
|
||||||
{
|
{
|
||||||
if (scale == 3 && _loadWorld)
|
if (scale == 3 && _loadWorld)
|
||||||
@ -760,8 +762,11 @@ public class ItemMapManager extends MiniPlugin
|
|||||||
|
|
||||||
colorWorldHeight(scale, startingX, startingZ);
|
colorWorldHeight(scale, startingX, startingZ);
|
||||||
}
|
}
|
||||||
|
TimingManager.stop("renderMap.scale loop");
|
||||||
|
|
||||||
|
TimingManager.start("renderMap.colorWorldHeight 0");
|
||||||
colorWorldHeight(0, startingX, startingZ);
|
colorWorldHeight(0, startingX, startingZ);
|
||||||
|
TimingManager.stop("renderMap.colorWorldHeight 0");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void scanWorldMap(int startingX, int startingZ, boolean setColors)
|
public void scanWorldMap(int startingX, int startingZ, boolean setColors)
|
||||||
|
@ -14,7 +14,7 @@ public class ObserverCommand extends CommandBase<ObserverManager>
|
|||||||
{
|
{
|
||||||
public ObserverCommand(ObserverManager plugin)
|
public ObserverCommand(ObserverManager plugin)
|
||||||
{
|
{
|
||||||
super(plugin, Rank.ALL, "observer", "o");
|
super(plugin, Rank.HELPER, "observer", "o");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package mineplex.game.clans.clans.scoreboard;
|
package mineplex.game.clans.clans.scoreboard;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scoreboard.DisplaySlot;
|
import org.bukkit.scoreboard.DisplaySlot;
|
||||||
import org.bukkit.scoreboard.Objective;
|
import org.bukkit.scoreboard.Objective;
|
||||||
@ -10,6 +12,7 @@ import org.bukkit.scoreboard.Team;
|
|||||||
import net.minecraft.server.v1_8_R3.ScoreboardTeam;
|
import net.minecraft.server.v1_8_R3.ScoreboardTeam;
|
||||||
|
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.UtilText;
|
||||||
import mineplex.core.scoreboard.PlayerScoreboard;
|
import mineplex.core.scoreboard.PlayerScoreboard;
|
||||||
import mineplex.core.scoreboard.ScoreboardManager;
|
import mineplex.core.scoreboard.ScoreboardManager;
|
||||||
import mineplex.game.clans.clans.ClanInfo;
|
import mineplex.game.clans.clans.ClanInfo;
|
||||||
@ -73,6 +76,33 @@ public class ClansPlayerScoreboard extends PlayerScoreboard
|
|||||||
|
|
||||||
public void add(Scoreboard scoreboard, Player otherPlayer, ClanInfo clanInfo, ClanRelation relation, int ownScore)
|
public void add(Scoreboard scoreboard, Player otherPlayer, ClanInfo clanInfo, ClanRelation relation, int ownScore)
|
||||||
{
|
{
|
||||||
|
if (otherPlayer.getGameMode().equals(GameMode.CREATIVE))
|
||||||
|
{
|
||||||
|
String teamName = UtilText.trim(16, _clansManager.getClientManager().Get(otherPlayer).GetRank().getRawTag() + "CREATIVE");
|
||||||
|
Team team = scoreboard.getTeam(teamName);
|
||||||
|
if (team == null)
|
||||||
|
{
|
||||||
|
team = scoreboard.registerNewTeam(teamName);
|
||||||
|
team.setPrefix(UtilText.trim(16, _clansManager.getClientManager().Get(otherPlayer).GetRank().getTag(true, true) + ChatColor.RESET + " "));
|
||||||
|
team.setSuffix(C.cRed + " STAFF MODE");
|
||||||
|
}
|
||||||
|
|
||||||
|
Objective domObjective;
|
||||||
|
if ((domObjective = scoreboard.getObjective(DisplaySlot.BELOW_NAME)) == null)
|
||||||
|
{
|
||||||
|
domObjective = scoreboard.registerNewObjective("war", "dummy");
|
||||||
|
domObjective.setDisplayName("War Points");
|
||||||
|
domObjective.setDisplaySlot(DisplaySlot.BELOW_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (clanInfo != null)
|
||||||
|
domObjective.getScore(otherPlayer.getName()).setScore(ownScore);
|
||||||
|
|
||||||
|
team.addPlayer(otherPlayer);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
String teamName = getTeamName(clanInfo, relation, ownScore);
|
String teamName = getTeamName(clanInfo, relation, ownScore);
|
||||||
Team team = scoreboard.getTeam(teamName);
|
Team team = scoreboard.getTeam(teamName);
|
||||||
if (team == null)
|
if (team == null)
|
||||||
|
@ -19,7 +19,7 @@ import mineplex.game.clans.spawn.Spawn;
|
|||||||
|
|
||||||
public class StuckManager extends MiniClientPlugin<StuckClient>
|
public class StuckManager extends MiniClientPlugin<StuckClient>
|
||||||
{
|
{
|
||||||
public static final long UNSTICK_WAIT_TIME = UtilTime.convert(1, TimeUnit.MINUTES, TimeUnit.MILLISECONDS);
|
public static final long UNSTICK_WAIT_TIME = UtilTime.convert(35, TimeUnit.SECONDS, TimeUnit.MILLISECONDS);
|
||||||
|
|
||||||
public StuckManager(ClansManager clans)
|
public StuckManager(ClansManager clans)
|
||||||
{
|
{
|
||||||
|
@ -27,13 +27,13 @@ import mineplex.core.updater.event.UpdateEvent;
|
|||||||
import mineplex.game.clans.clans.ClanInfo;
|
import mineplex.game.clans.clans.ClanInfo;
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
import mineplex.game.clans.clans.ClansUtility;
|
import mineplex.game.clans.clans.ClansUtility;
|
||||||
|
import mineplex.game.clans.clans.ClanTips.TipType;
|
||||||
import mineplex.game.clans.clans.event.ClanDisbandedEvent;
|
import mineplex.game.clans.clans.event.ClanDisbandedEvent;
|
||||||
import mineplex.game.clans.clans.event.ClansPlayerDeathEvent;
|
import mineplex.game.clans.clans.event.ClansPlayerDeathEvent;
|
||||||
import mineplex.game.clans.clans.war.command.WarPointsCommand;
|
import mineplex.game.clans.clans.war.command.WarPointsCommand;
|
||||||
import mineplex.game.clans.clans.war.event.WarInvasionEndEvent;
|
import mineplex.game.clans.clans.war.event.WarInvasionEndEvent;
|
||||||
import mineplex.game.clans.clans.war.event.WarInvasionStartEvent;
|
import mineplex.game.clans.clans.war.event.WarInvasionStartEvent;
|
||||||
import mineplex.game.clans.core.war.ClanWarData;
|
import mineplex.game.clans.core.war.ClanWarData;
|
||||||
import mineplex.game.clans.tutorials.types.ClanTips.TipType;
|
|
||||||
|
|
||||||
public class WarManager extends MiniPlugin implements ScoreboardElement
|
public class WarManager extends MiniPlugin implements ScoreboardElement
|
||||||
{
|
{
|
||||||
|
@ -20,8 +20,8 @@ import mineplex.core.common.util.UtilServer;
|
|||||||
import mineplex.core.common.util.UtilTextMiddle;
|
import mineplex.core.common.util.UtilTextMiddle;
|
||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
|
import mineplex.game.clans.clans.ClanTips.TipType;
|
||||||
import mineplex.game.clans.gameplay.safelog.npc.NPCManager;
|
import mineplex.game.clans.gameplay.safelog.npc.NPCManager;
|
||||||
import mineplex.game.clans.tutorials.types.ClanTips.TipType;
|
|
||||||
|
|
||||||
public class SafeLog extends MiniPlugin
|
public class SafeLog extends MiniPlugin
|
||||||
{
|
{
|
||||||
|
@ -4,6 +4,7 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import mineplex.core.account.CoreClientManager;
|
import mineplex.core.account.CoreClientManager;
|
||||||
|
import mineplex.core.common.util.UtilItem;
|
||||||
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.shop.ShopBase;
|
import mineplex.core.shop.ShopBase;
|
||||||
@ -79,7 +80,7 @@ public abstract class ClansShopPage<T extends ShopBase<ClansManager>> extends Sh
|
|||||||
if (!event.isCancelled())
|
if (!event.isCancelled())
|
||||||
{
|
{
|
||||||
PvpItem item = new PvpItem(material, data, 1, displayName, buyPrice, sellPrice, 64);
|
PvpItem item = new PvpItem(material, data, 1, displayName, buyPrice, sellPrice, 64);
|
||||||
addButton(slot, item, new ShopItemButton<ClansShopPage<?>>(this, buyPrice, sellPrice, material, data, amount));
|
addButton(slot, item, new ShopItemButton<ClansShopPage<?>>(this, buyPrice, sellPrice, material, data, amount, displayName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,6 +89,7 @@ public abstract class ClansShopPage<T extends ShopBase<ClansManager>> extends Sh
|
|||||||
addShopItem(index, item, (byte) 0, displayName, 1);
|
addShopItem(index, item, (byte) 0, displayName, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void addShopItem(int index, ClansShopItem item)
|
public void addShopItem(int index, ClansShopItem item)
|
||||||
{
|
{
|
||||||
addShopItem(index, item, (byte) 0);
|
addShopItem(index, item, (byte) 0);
|
||||||
|
@ -3,6 +3,7 @@ package mineplex.game.clans.shop;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.UtilItem;
|
||||||
import mineplex.core.shop.item.ShopItem;
|
import mineplex.core.shop.item.ShopItem;
|
||||||
|
|
||||||
public class PvpItem extends ShopItem
|
public class PvpItem extends ShopItem
|
||||||
@ -25,7 +26,18 @@ public class PvpItem extends ShopItem
|
|||||||
|
|
||||||
public PvpItem(Material type, byte data, int displayAmount, String name, int buyPrice, int sellPrice, int bulkCount)
|
public PvpItem(Material type, byte data, int displayAmount, String name, int buyPrice, int sellPrice, int bulkCount)
|
||||||
{
|
{
|
||||||
super(type, data, name, new String[] { C.cWhite + " ", LEFT_CLICK_BUY, C.cWhite + "Costs " + C.cGreen + buyPrice + "g", C.cWhite + " ", C.cYellow + "Shift Left-Click" + C.cWhite + " to Buy " + C.cGreen + bulkCount, C.cWhite + "Costs " + C.cGreen + (buyPrice * bulkCount) + "g", C.cWhite + " ", RIGHT_CLICK_SELL, C.cWhite + "Earns " + C.cGreen + sellPrice + "g", C.cWhite + " ", C.cYellow + "Shift Right-Click" + C.cWhite + " to Sell " + C.cGreen + "All", }, 0, false, false);
|
super(type, data, name, new String[] {
|
||||||
|
C.cWhite + " ",
|
||||||
|
LEFT_CLICK_BUY,
|
||||||
|
C.cWhite + "Costs " + C.cGreen + (buyPrice == 0 ? "Free" : buyPrice + "g"),
|
||||||
|
C.cWhite + " ",
|
||||||
|
UtilItem.isArmor(type) || UtilItem.isTool(type) ? "" : C.cYellow + "Shift Left-Click" + C.cWhite + " to Buy " + C.cGreen + bulkCount,
|
||||||
|
UtilItem.isArmor(type) || UtilItem.isTool(type) ? "" : C.cWhite + "Costs " + C.cGreen + (buyPrice * bulkCount) + "g", C.cWhite + " ",
|
||||||
|
RIGHT_CLICK_SELL,
|
||||||
|
C.cWhite + "Earns " + C.cGreen + (sellPrice == 0 ? "Free" : sellPrice + ""),
|
||||||
|
C.cWhite + " ",
|
||||||
|
C.cYellow + "Shift Right-Click" + C.cWhite + " to Sell " + C.cGreen + "All",
|
||||||
|
}, 0, false, false);
|
||||||
|
|
||||||
_price = buyPrice;
|
_price = buyPrice;
|
||||||
_sellPrice = sellPrice;
|
_sellPrice = sellPrice;
|
||||||
|
@ -1,14 +1,18 @@
|
|||||||
package mineplex.game.clans.shop;
|
package mineplex.game.clans.shop;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftInventory;
|
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftInventory;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.inventory.ClickType;
|
import org.bukkit.event.inventory.ClickType;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.Callback;
|
import mineplex.core.common.util.Callback;
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.InventoryUtil;
|
import mineplex.core.common.util.InventoryUtil;
|
||||||
|
import mineplex.core.common.util.UtilItem;
|
||||||
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.shop.item.IButton;
|
import mineplex.core.shop.item.IButton;
|
||||||
@ -24,17 +28,30 @@ public class ShopItemButton<T extends ShopPageBase<?, ?>> implements IButton
|
|||||||
private ItemStack _item;
|
private ItemStack _item;
|
||||||
private T _page;
|
private T _page;
|
||||||
|
|
||||||
public ShopItemButton(T page, int buyPrice, int sellPrice, Material material, byte data, int amount)
|
public ShopItemButton(T page, int buyPrice, int sellPrice, Material material, byte data, int amount, String displayName)
|
||||||
{
|
{
|
||||||
_page = page;
|
_page = page;
|
||||||
_sellPrice = sellPrice;
|
_sellPrice = sellPrice;
|
||||||
_buyPrice = buyPrice;
|
_buyPrice = buyPrice;
|
||||||
_item = new ItemStack(material, amount, data);
|
_item = new ItemStack(material, amount, data);
|
||||||
|
|
||||||
|
if (displayName != null)
|
||||||
|
{
|
||||||
|
ItemMeta meta = _item.getItemMeta();
|
||||||
|
if (meta == null)
|
||||||
|
{
|
||||||
|
meta = Bukkit.getItemFactory().getItemMeta(material);
|
||||||
|
}
|
||||||
|
|
||||||
|
meta.setDisplayName(C.Reset + displayName);
|
||||||
|
|
||||||
|
_item.setItemMeta(meta);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ShopItemButton(T page, int buyPrice, int sellPrice, Material material)
|
public ShopItemButton(T page, int buyPrice, int sellPrice, Material material)
|
||||||
{
|
{
|
||||||
this(page, buyPrice, sellPrice, material, (byte) 0, 1);
|
this(page, buyPrice, sellPrice, material, (byte) 0, 1, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -78,7 +95,7 @@ public class ShopItemButton<T extends ShopPageBase<?, ?>> implements IButton
|
|||||||
}
|
}
|
||||||
else if (clickType == ClickType.SHIFT_LEFT || clickType == ClickType.LEFT)
|
else if (clickType == ClickType.SHIFT_LEFT || clickType == ClickType.LEFT)
|
||||||
{
|
{
|
||||||
final int amount = shiftClick ? 64 : 1;
|
final int amount = !(UtilItem.isArmor(_item.getType()) || UtilItem.isTool(_item.getType())) && shiftClick ? 64 : 1;
|
||||||
final int cost = amount * _buyPrice;
|
final int cost = amount * _buyPrice;
|
||||||
int goldCount = GoldManager.getInstance().getGold(player);
|
int goldCount = GoldManager.getInstance().getGold(player);
|
||||||
|
|
||||||
|
@ -8,12 +8,15 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import mineplex.core.account.CoreClientManager;
|
import mineplex.core.account.CoreClientManager;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
import mineplex.core.donation.DonationManager;
|
import mineplex.core.donation.DonationManager;
|
||||||
import mineplex.core.shop.item.ShopItem;
|
import mineplex.core.shop.item.ShopItem;
|
||||||
import mineplex.core.shop.page.ShopPageBase;
|
import mineplex.core.shop.page.ShopPageBase;
|
||||||
import mineplex.game.clans.clans.ClanEnergyManager;
|
import mineplex.game.clans.clans.ClanEnergyManager;
|
||||||
import mineplex.game.clans.clans.ClanInfo;
|
import mineplex.game.clans.clans.ClanInfo;
|
||||||
|
import mineplex.game.clans.clans.event.ClansShopAddButtonEvent;
|
||||||
|
import mineplex.game.clans.clans.event.EnergyPageBuildEvent;
|
||||||
|
|
||||||
public class EnergyPage extends ShopPageBase<ClanEnergyManager, EnergyShop>
|
public class EnergyPage extends ShopPageBase<ClanEnergyManager, EnergyShop>
|
||||||
{
|
{
|
||||||
@ -44,9 +47,13 @@ public class EnergyPage extends ShopPageBase<ClanEnergyManager, EnergyShop>
|
|||||||
int oneDayEnergy = oneHourEnergy * 24;
|
int oneDayEnergy = oneHourEnergy * 24;
|
||||||
int maxEnergy = clanInfo.getEnergyPurchasable();
|
int maxEnergy = clanInfo.getEnergyPurchasable();
|
||||||
|
|
||||||
addButton(clanInfo, 11, oneHourEnergy, Material.REDSTONE, (byte) 0, " ", ChatColor.RESET + "1 Hour of Energy", " ", ChatColor.RESET + "Costs " + C.cGreen + getPlugin().convertEnergyToGold(oneHourEnergy) + "g");
|
EnergyPageBuildEvent event = new EnergyPageBuildEvent(getPlayer());
|
||||||
addButton(clanInfo, 13, oneDayEnergy, Material.REDSTONE_BLOCK, (byte) 0, " ", ChatColor.RESET + "1 Day of Energy", " ", ChatColor.RESET + "Costs " + C.cGreen + getPlugin().convertEnergyToGold(oneDayEnergy) + "g");
|
|
||||||
addButton(clanInfo, 15, maxEnergy, Material.FURNACE, (byte) 0, " ", ChatColor.RESET + "Maxed Out Energy", " ", ChatColor.RESET + "Costs " + C.cGreen + getPlugin().convertEnergyToGold(maxEnergy) + "g");
|
UtilServer.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
|
addButton(clanInfo, 11, oneHourEnergy, Material.REDSTONE, (byte) 0, event.free(), " ", ChatColor.RESET + "Purchase 1 Hour of Energy for your Clan", " ", ChatColor.RESET + (event.free() ? "FREE! (Tutorial)" : "Costs " + C.cGreen + getPlugin().convertEnergyToGold(oneHourEnergy) + "g"));
|
||||||
|
addButton(clanInfo, 13, oneDayEnergy, Material.REDSTONE_BLOCK, (byte) 0, event.free(), " ", ChatColor.RESET + "Purchase 1 Day of Energy for your Clan", " ", ChatColor.RESET + (event.free() ? "FREE! (Tutorial)" : "Costs " + C.cGreen + getPlugin().convertEnergyToGold(oneDayEnergy) + "g"));
|
||||||
|
addButton(clanInfo, 15, maxEnergy, Material.FURNACE, (byte) 0, event.free(), " ", ChatColor.RESET + "Max Out your Clan's Energy", " ", ChatColor.RESET + (event.free() ? "FREE! (Tutorial)" : "Costs " + C.cGreen + getPlugin().convertEnergyToGold(maxEnergy) + "g"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addInfo(ClanInfo clanInfo, int slot)
|
private void addInfo(ClanInfo clanInfo, int slot)
|
||||||
@ -63,7 +70,7 @@ public class EnergyPage extends ShopPageBase<ClanEnergyManager, EnergyShop>
|
|||||||
setItem(slot, shopItem);
|
setItem(slot, shopItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addButton(ClanInfo clanInfo, int slot, int energyAmount, Material material, byte data, String... lore)
|
private void addButton(ClanInfo clanInfo, int slot, int energyAmount, Material material, byte data, boolean free, String... lore)
|
||||||
{
|
{
|
||||||
boolean locked = energyAmount > clanInfo.getEnergyPurchasable() || energyAmount == 0;
|
boolean locked = energyAmount > clanInfo.getEnergyPurchasable() || energyAmount == 0;
|
||||||
String itemName = "Purchase " + energyAmount + " Energy";
|
String itemName = "Purchase " + energyAmount + " Energy";
|
||||||
@ -73,7 +80,7 @@ public class EnergyPage extends ShopPageBase<ClanEnergyManager, EnergyShop>
|
|||||||
if (locked)
|
if (locked)
|
||||||
setItem(slot, shopItem);
|
setItem(slot, shopItem);
|
||||||
else
|
else
|
||||||
addButton(slot, shopItem, new EnergyShopButton(getPlugin(), this, energyAmount, clanInfo));
|
addButton(slot, shopItem, new EnergyShopButton(getPlugin(), this, energyAmount, clanInfo, free ? 0 : getPlugin().convertEnergyToGold(energyAmount)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildNoClan()
|
private void buildNoClan()
|
||||||
|
@ -24,13 +24,15 @@ public class EnergyShopButton implements IButton
|
|||||||
private EnergyPage _page;
|
private EnergyPage _page;
|
||||||
private int _energyToPurchase;
|
private int _energyToPurchase;
|
||||||
private ClanInfo _clanInfo;
|
private ClanInfo _clanInfo;
|
||||||
|
private int _cost;
|
||||||
|
|
||||||
public EnergyShopButton(ClanEnergyManager energyManager, EnergyPage page, int energyToPurchase, ClanInfo clanInfo)
|
public EnergyShopButton(ClanEnergyManager energyManager, EnergyPage page, int energyToPurchase, ClanInfo clanInfo, int cost)
|
||||||
{
|
{
|
||||||
_energyManager = energyManager;
|
_energyManager = energyManager;
|
||||||
_clanInfo = clanInfo;
|
_clanInfo = clanInfo;
|
||||||
_energyToPurchase = energyToPurchase;
|
_energyToPurchase = energyToPurchase;
|
||||||
_page = page;
|
_page = page;
|
||||||
|
_cost = cost;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -56,7 +58,7 @@ public class EnergyShopButton implements IButton
|
|||||||
// Notify
|
// Notify
|
||||||
_energyManager.getClansManager().messageClan(_clanInfo, F.main("Energy", F.name(player.getName()) + " purchased " + F.elem(_energyToPurchase + " Energy") + " for the clan"));
|
_energyManager.getClansManager().messageClan(_clanInfo, F.main("Energy", F.name(player.getName()) + " purchased " + F.elem(_energyToPurchase + " Energy") + " for the clan"));
|
||||||
}
|
}
|
||||||
}, _page, new EnergyPackage(_energyToPurchase + " Energy", _energyManager.convertEnergyToGold(_energyToPurchase)), CurrencyType.Gold, player));
|
}, _page, new EnergyPackage(_energyToPurchase + " Energy", _cost), CurrencyType.Gold, player));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,46 @@
|
|||||||
|
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() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,7 +1,8 @@
|
|||||||
package mineplex.game.clans.tutorials;
|
package mineplex.game.clans.tutorials;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.Iterator;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -14,6 +15,7 @@ import org.bukkit.event.EventPriority;
|
|||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
|
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||||
@ -27,7 +29,6 @@ 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.UtilText;
|
|
||||||
import mineplex.core.donation.DonationManager;
|
import mineplex.core.donation.DonationManager;
|
||||||
import mineplex.core.scoreboard.ScoreboardManager;
|
import mineplex.core.scoreboard.ScoreboardManager;
|
||||||
import mineplex.core.scoreboard.elements.ScoreboardElement;
|
import mineplex.core.scoreboard.elements.ScoreboardElement;
|
||||||
@ -35,6 +36,7 @@ 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.ClansManager;
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
|
import mineplex.game.clans.clans.event.ClanTipEvent;
|
||||||
import mineplex.game.clans.economy.GoldManager;
|
import mineplex.game.clans.economy.GoldManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -46,9 +48,10 @@ import mineplex.game.clans.economy.GoldManager;
|
|||||||
*/
|
*/
|
||||||
public abstract class Tutorial implements ScoreboardElement, Listener
|
public abstract class Tutorial implements ScoreboardElement, Listener
|
||||||
{
|
{
|
||||||
public static String TASK_COMPLETE_TASK = "Tutorial%sDoneTask%s";
|
public static String TASK_COMPLETE_TASK = "tttatatta%sTask%s";
|
||||||
public static String TUTORIAL_COMPLETE_TASK = "Tutorial%sFinito";
|
public static String TUTORIAL_COMPLETE_TASK = "tatatatatat%sDone"; //do not change
|
||||||
public static String SKIPPED_TASK = "Tutorial%sSkipito";
|
public static String TUTORIAL_REWARD_TASK = "tatatatatat%sRewardGiven"; //do not change
|
||||||
|
public static String SKIPPED_TASK = "tatatatata%sSkip";
|
||||||
|
|
||||||
protected final TutorialManager _manager;
|
protected final TutorialManager _manager;
|
||||||
protected final GoldManager _goldManager;
|
protected final GoldManager _goldManager;
|
||||||
@ -56,17 +59,17 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
|||||||
protected final TaskManager _taskManager;
|
protected final TaskManager _taskManager;
|
||||||
protected final DonationManager _donationManager;
|
protected final DonationManager _donationManager;
|
||||||
|
|
||||||
private final Map<Integer, TutorialTask> _tasks;
|
protected final LinkedHashMap<Integer, TutorialTask<?>> _tasks;
|
||||||
private final Map<String, TutorialTask> _nameToTask;
|
protected final LinkedHashMap<String, TutorialTask<?>> _nameToTask;
|
||||||
protected final Map<String, TutorialClient> _inTutorial;
|
protected final LinkedHashMap<String, TutorialClient> _inTutorial;
|
||||||
|
|
||||||
protected boolean _doScoreboard;
|
protected boolean _doScoreboard;
|
||||||
protected boolean _ghostMode;
|
protected boolean _ghostMode;
|
||||||
|
|
||||||
protected boolean _startOnJoin;
|
protected boolean _startOnJoin;
|
||||||
|
|
||||||
protected String _uniqueId;
|
protected String _technicalName;
|
||||||
protected String _friendlyName;
|
protected String _displayName;
|
||||||
|
|
||||||
protected int _goldReward = -1;
|
protected int _goldReward = -1;
|
||||||
protected int _gemReward = -1;
|
protected int _gemReward = -1;
|
||||||
@ -79,9 +82,9 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
|||||||
_donationManager = donationManager;
|
_donationManager = donationManager;
|
||||||
_taskManager = taskManager;
|
_taskManager = taskManager;
|
||||||
_manager = manager;
|
_manager = manager;
|
||||||
_tasks = new HashMap<>();
|
_tasks = new LinkedHashMap<>();
|
||||||
_inTutorial = new HashMap<>();
|
_inTutorial = new LinkedHashMap<>();
|
||||||
_nameToTask = new HashMap<>();
|
_nameToTask = new LinkedHashMap<>();
|
||||||
|
|
||||||
_manager.getPluginManager().registerEvents(this, _manager.getPlugin());
|
_manager.getPluginManager().registerEvents(this, _manager.getPlugin());
|
||||||
}
|
}
|
||||||
@ -91,78 +94,72 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
|||||||
{
|
{
|
||||||
final List<String> lines = new ArrayList<>();
|
final List<String> lines = new ArrayList<>();
|
||||||
|
|
||||||
if (!isInTutorial(player) || !_doScoreboard)
|
if (!isInTutorial(player))
|
||||||
|
{
|
||||||
|
return lines;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_doScoreboard)
|
||||||
|
{
|
||||||
|
return lines;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (get(player).CurrentTask == null)
|
||||||
{
|
{
|
||||||
return lines;
|
return lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
out.clear();
|
out.clear();
|
||||||
|
|
||||||
final TutorialClient ptutorial = _inTutorial.get(player.getName());
|
final TutorialClient client = _inTutorial.get(player.getName());
|
||||||
|
|
||||||
lines.add(C.cAqua + _friendlyName + " Tutorial");
|
lines.add(C.cAqua + "Tutorial");
|
||||||
|
|
||||||
for (final TutorialTask task : _tasks.values())
|
for (final TutorialTask<?> task : _tasks.values())
|
||||||
{
|
{
|
||||||
if (get(player).getCurrentTask() == task.getID())
|
if (get(player).CurrentTask.equals(task))
|
||||||
{
|
{
|
||||||
lines.add(C.cDAqua + task.getID() + ". " + task.getFriendlyName());
|
lines.add(C.cDAqua + task.getID() + ". " + task.getDisplayName());
|
||||||
}
|
}
|
||||||
else if (ptutorial.hasFinishedTask(task))
|
else if (client.CurrentTask.getID() > task.getID())
|
||||||
{
|
{
|
||||||
lines.add(C.cGreen + task.getID() + ". " + task.getFriendlyName());
|
lines.add(C.cGreen + task.getID() + ". " + task.getDisplayName());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lines.add(C.cRed + task.getID() + ". " + task.getFriendlyName());
|
lines.add(C.cRed + task.getID() + ". " + task.getDisplayName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lines.add(C.cYellow + "To skip, type: /skiptutorial");
|
lines.add(C.cYellow + "To skip, type: /skiptutorial");
|
||||||
// lines.add(C.cYellow + "To get info, type: /taskinfo");
|
|
||||||
|
|
||||||
return lines;
|
return lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addTask(final int id, final String name, final String description)
|
protected void addTask(TutorialTask<?> task)
|
||||||
{
|
{
|
||||||
addTask(id, name, description, null);
|
_tasks.put(_tasks.size() + 1, task);
|
||||||
|
_nameToTask.put(task.getTechnicalName(), task);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addTask(final int id, final String name, final String description, final String finishMessage)
|
protected boolean hasFinishedTask(Player player, TutorialTask<?> task)
|
||||||
{
|
{
|
||||||
_tasks.put(id, new TutorialTask(id, name, description, finishMessage));
|
return get(player).CurrentTask.getID() < task.getID();
|
||||||
_nameToTask.put(name, _tasks.get(id));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean hasFinishedTask(Player player, String taskName)
|
protected void finishTask(final Player player, final TutorialTask<?> task)
|
||||||
{
|
{
|
||||||
return hasFinishedTask(player, _nameToTask.get(taskName).getID());
|
get(player).LastDescriptionSentTime = 0;
|
||||||
}
|
get(player).CurrentTask.visibleFinish(player);
|
||||||
|
get(player).CurrentTask = task.equals(_tasks.get(_tasks.size())) ? null : _tasks.get(task.getID() + 1);
|
||||||
|
|
||||||
protected boolean hasFinishedTask(Player player, int taskID)
|
if (!_taskManager.hasCompletedTask(player, String.format(TASK_COMPLETE_TASK, _technicalName, task.getTechnicalName())))
|
||||||
{
|
|
||||||
return get(player).hasFinishedTask(_tasks.get(taskID));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void finishTask(final Player player, final int taskID)
|
|
||||||
{
|
|
||||||
final TutorialTask task = _tasks.get(taskID);
|
|
||||||
|
|
||||||
String taskName = task.getFriendlyName();
|
|
||||||
onFinishTask(player, taskName);
|
|
||||||
|
|
||||||
_inTutorial.get(player.getName()).setTaskFinished(taskID);
|
|
||||||
|
|
||||||
if (!_taskManager.hasCompletedTask(player, String.format(TASK_COMPLETE_TASK, _uniqueId, task.getUniqueId())))
|
|
||||||
{
|
{
|
||||||
_taskManager.completedTask(new Callback<Boolean>()
|
_taskManager.completedTask(new Callback<Boolean>()
|
||||||
{
|
{
|
||||||
public void run(final Boolean completed)
|
public void run(final Boolean completed)
|
||||||
{
|
{
|
||||||
UtilPlayer.message(player, F.main("Tutorials", "You have completed Task " + F.elem(taskID + ": " + task.getFriendlyName()) + ". " + (_tasks.size() - taskID) + " task" + (UtilText.plural(_tasks.size() - taskID) ? "s" : "") + " to go!"));
|
if (task.equals(_tasks.get(_tasks.size())))
|
||||||
|
|
||||||
if (taskID == _tasks.size())
|
|
||||||
{
|
{
|
||||||
finishFor(player);
|
finishFor(player);
|
||||||
}
|
}
|
||||||
@ -172,30 +169,20 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
|||||||
{
|
{
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
_tasks.get(taskID + 1).sendDescriptionTo(player);
|
get(player).CurrentTask.deploy(player);
|
||||||
}
|
}
|
||||||
}, 40L);
|
}, 10L);
|
||||||
}
|
}
|
||||||
|
|
||||||
player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1.5f);
|
player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1.5f);
|
||||||
}
|
}
|
||||||
}, player, String.format(TASK_COMPLETE_TASK, _uniqueId, task.getUniqueId()));
|
}, player, String.format(TASK_COMPLETE_TASK, _technicalName, task.getTechnicalName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void finishTask(final Player player, final String taskName)
|
public TutorialTask<?> getTask(final String technicalName)
|
||||||
{
|
{
|
||||||
finishTask(player, _nameToTask.get(taskName).getID());
|
return _nameToTask.get(technicalName);
|
||||||
}
|
|
||||||
|
|
||||||
public TutorialTask getTask(final int taskID)
|
|
||||||
{
|
|
||||||
return _tasks.get(taskID);
|
|
||||||
}
|
|
||||||
|
|
||||||
public TutorialTask getTask(final String name)
|
|
||||||
{
|
|
||||||
return _nameToTask.get(name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||||
@ -239,13 +226,14 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
|||||||
_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);
|
UtilFirework.launchFirework(player.getLocation(), Type.BALL_LARGE, Color.LIME, false, false, new Vector(0, 0, 0), 1);
|
||||||
UtilPlayer.message(player, F.main("Tutorials", "You have completed the " + F.elem(_friendlyName + " Tutorial") + "."));
|
|
||||||
onFinished(player);
|
onFinished(player);
|
||||||
if (!_taskManager.hasCompletedTask(player, String.format(TUTORIAL_COMPLETE_TASK, _uniqueId)))
|
|
||||||
|
if (!_taskManager.hasCompletedTask(player, String.format(TUTORIAL_REWARD_TASK, _technicalName)))
|
||||||
{
|
{
|
||||||
_taskManager.completedTask(new Callback<Boolean>()
|
_taskManager.completedTask(new Callback<Boolean>()
|
||||||
{
|
{
|
||||||
public void run(final Boolean completed)
|
@Override
|
||||||
|
public void run(Boolean data)
|
||||||
{
|
{
|
||||||
if (_goldReward != -1)
|
if (_goldReward != -1)
|
||||||
{
|
{
|
||||||
@ -272,7 +260,17 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
|||||||
}
|
}
|
||||||
}, "Clans", player.getName(), _clansManager.getClientManager().getAccountId(player), _coinReward);
|
}, "Clans", player.getName(), _clansManager.getClientManager().getAccountId(player), _coinReward);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}, player, String.format(TUTORIAL_REWARD_TASK, _technicalName));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_taskManager.hasCompletedTask(player, String.format(TUTORIAL_COMPLETE_TASK, _technicalName)))
|
||||||
|
{
|
||||||
|
_taskManager.completedTask(new Callback<Boolean>()
|
||||||
|
{
|
||||||
|
public void run(final Boolean completed)
|
||||||
|
{
|
||||||
if (_ghostMode)
|
if (_ghostMode)
|
||||||
{
|
{
|
||||||
for (Player other : UtilServer.getPlayers())
|
for (Player other : UtilServer.getPlayers())
|
||||||
@ -294,7 +292,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
|||||||
}, i * 10);
|
}, i * 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, player, String.format(TUTORIAL_COMPLETE_TASK, _uniqueId));
|
}, player, String.format(TUTORIAL_COMPLETE_TASK, _technicalName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -303,11 +301,6 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implementation left to sub classes.
|
|
||||||
protected void onFinishTask(final Player player, String task)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// Implementation left to sub classes.
|
// Implementation left to sub classes.
|
||||||
protected void onBegin(final Player player)
|
protected void onBegin(final Player player)
|
||||||
{
|
{
|
||||||
@ -320,7 +313,10 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
|||||||
_manager._playerTutorials.put(player.getName(), this);
|
_manager._playerTutorials.put(player.getName(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
_inTutorial.put(player.getName(), TutorialClient.create(player, _taskManager, this));
|
_inTutorial.put(player.getName(), new TutorialClient(player, this));
|
||||||
|
|
||||||
|
get(player).CurrentTask.deploy(player);
|
||||||
|
|
||||||
player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1.5f);
|
player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1.5f);
|
||||||
|
|
||||||
if (_ghostMode)
|
if (_ghostMode)
|
||||||
@ -335,8 +331,6 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
|||||||
onBegin(player);
|
onBegin(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
//_playerTutorials.remove(player.getName());
|
|
||||||
|
|
||||||
public void cancelFor(final Player player)
|
public void cancelFor(final Player player)
|
||||||
{
|
{
|
||||||
_inTutorial.remove(player.getName());
|
_inTutorial.remove(player.getName());
|
||||||
@ -345,7 +339,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
|||||||
{
|
{
|
||||||
for (Player other : UtilServer.getPlayers())
|
for (Player other : UtilServer.getPlayers())
|
||||||
{
|
{
|
||||||
other.showPlayer(player);
|
if (!isInTutorial(other)) other.showPlayer(player);
|
||||||
player.showPlayer(other);
|
player.showPlayer(other);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -361,19 +355,19 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
|||||||
return _inTutorial.containsKey(player);
|
return _inTutorial.containsKey(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<Integer, TutorialTask> getTasks()
|
public Map<Integer, TutorialTask<?>> getTasks()
|
||||||
{
|
{
|
||||||
return _tasks;
|
return _tasks;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasCompleted(final Player player)
|
public boolean hasCompleted(final Player player)
|
||||||
{
|
{
|
||||||
return _taskManager.hasCompletedTask(player, String.format(TUTORIAL_COMPLETE_TASK, _uniqueId));
|
return _taskManager.hasCompletedTask(player, String.format(TUTORIAL_COMPLETE_TASK, _technicalName));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasSkipped(final Player player)
|
public boolean hasSkipped(final Player player)
|
||||||
{
|
{
|
||||||
return _taskManager.hasCompletedTask(player, String.format(SKIPPED_TASK, _uniqueId));
|
return _taskManager.hasCompletedTask(player, String.format(SKIPPED_TASK, _technicalName));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void skip(final Player player)
|
public void skip(final Player player)
|
||||||
@ -396,12 +390,15 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
|||||||
new JsonMessage(
|
new JsonMessage(
|
||||||
F.main(
|
F.main(
|
||||||
"Tutorial",
|
"Tutorial",
|
||||||
"Click here to confirm you want to skip the tutorial!"
|
"Click "
|
||||||
))
|
))
|
||||||
|
.extra("here")
|
||||||
|
.color("aqua")
|
||||||
.click(ClickEvent.RUN_COMMAND, "/yesiconfirmiwanttoskip")
|
.click(ClickEvent.RUN_COMMAND, "/yesiconfirmiwanttoskip")
|
||||||
|
.extra(" here to confirm you want to skip the tutorial!")
|
||||||
|
.color("gray")
|
||||||
|
|
||||||
.sendToPlayer(player);
|
.sendToPlayer(player);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doSkip(final Player player)
|
public void doSkip(final Player player)
|
||||||
@ -412,12 +409,12 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
|||||||
{
|
{
|
||||||
cancelFor(player);
|
cancelFor(player);
|
||||||
}
|
}
|
||||||
}, player, String.format(SKIPPED_TASK, _uniqueId));
|
}, player, String.format(SKIPPED_TASK, _technicalName));
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUniqueId()
|
public String getTechnicalName()
|
||||||
{
|
{
|
||||||
return _uniqueId;
|
return _technicalName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TutorialClient get(final Player player)
|
public TutorialClient get(final Player player)
|
||||||
@ -425,10 +422,19 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
|||||||
return _inTutorial.get(player.getName());
|
return _inTutorial.get(player.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onClanTip(ClanTipEvent event)
|
||||||
|
{
|
||||||
|
if (isInTutorial(event.getPlayer()))
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void taskInfo(final UpdateEvent evt)
|
public void taskInfo(final UpdateEvent evt)
|
||||||
{
|
{
|
||||||
if (evt.getType() != UpdateType.SEC_30)
|
if (evt.getType() != UpdateType.SEC)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -437,11 +443,32 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
|||||||
{
|
{
|
||||||
if (isInTutorial(player))
|
if (isInTutorial(player))
|
||||||
{
|
{
|
||||||
getTask(get(player).getCurrentTask()).sendDescriptionTo(player);
|
get(player).CurrentTask.trySendDescription(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void chat(final AsyncPlayerChatEvent evt)
|
||||||
|
{
|
||||||
|
if (!isInTutorial(evt.getPlayer()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Iterator<Player> iterator = evt.getRecipients().iterator();
|
||||||
|
|
||||||
|
while (iterator.hasNext())
|
||||||
|
{
|
||||||
|
if (isInTutorial(iterator.next()))
|
||||||
|
{
|
||||||
|
iterator.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
evt.setCancelled(true);
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerJoin(final PlayerJoinEvent evt)
|
public void onPlayerJoin(final PlayerJoinEvent evt)
|
||||||
{
|
{
|
||||||
@ -460,4 +487,11 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void cleanup(Player player)
|
||||||
|
{
|
||||||
|
if (get(player) != null && get(player).CurrentTask != null)
|
||||||
|
get(player).CurrentTask.cleanup(player);
|
||||||
|
|
||||||
|
_inTutorial.remove(player.getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,70 +2,31 @@ package mineplex.game.clans.tutorials;
|
|||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import mineplex.core.common.util.UtilServer;
|
|
||||||
import mineplex.core.task.TaskManager;
|
import mineplex.core.task.TaskManager;
|
||||||
|
|
||||||
public class TutorialClient
|
public class TutorialClient
|
||||||
{
|
{
|
||||||
private final Tutorial _tutorial;
|
public Player Player;
|
||||||
private final Player _player;
|
public TutorialTask<?> CurrentTask;
|
||||||
|
public long LastDescriptionSentTime = System.currentTimeMillis() - 3000;
|
||||||
|
|
||||||
private int _currentTask = 1;
|
public TutorialClient(Player player, Tutorial tutorial)
|
||||||
|
{
|
||||||
|
Player = player;
|
||||||
|
|
||||||
public TutorialClient(final Player player, final Tutorial tutorial)
|
CurrentTask = tutorial._tasks.get(1);
|
||||||
{
|
|
||||||
_player = player;
|
|
||||||
_tutorial = tutorial;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static TutorialClient create(final Player player, final TaskManager taskManager, final Tutorial tutorial)
|
for (TutorialTask<?> task : tutorial._tasks.values())
|
||||||
{
|
{
|
||||||
final TutorialClient user = new TutorialClient(player, tutorial);
|
if (TaskManager.Instance.hasCompletedTask(player, String.format(
|
||||||
|
Tutorial.TASK_COMPLETE_TASK,
|
||||||
for (final int i : tutorial.getTasks().keySet())
|
task.getTutorial().getTechnicalName(), task.getTechnicalName())))
|
||||||
{
|
{
|
||||||
if (taskManager.hasCompletedTask(player, String.format(Tutorial.TASK_COMPLETE_TASK, tutorial.getUniqueId(), tutorial.getTask(i).getUniqueId())))
|
if (CurrentTask.getID() <= task.getID())
|
||||||
{
|
{
|
||||||
user._currentTask = i;
|
CurrentTask = task.getTutorial().getTasks().get(Math.min(task.getTutorial().getTasks().size(), task.getID() + 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(tutorial._manager.getPlugin(), new Runnable()
|
|
||||||
{
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
tutorial.getTask(user._currentTask).sendDescriptionTo(player);
|
|
||||||
}
|
}
|
||||||
}, 40);
|
|
||||||
|
|
||||||
return user;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCurrentTask()
|
|
||||||
{
|
|
||||||
return _currentTask;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Tutorial getTutorial()
|
|
||||||
{
|
|
||||||
return _tutorial;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Player getPlayer()
|
|
||||||
{
|
|
||||||
return _player;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTaskFinished(final int taskID)
|
|
||||||
{
|
|
||||||
_currentTask = taskID + 1;
|
|
||||||
|
|
||||||
_tutorial.getTask(taskID).onFinish(_player);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasFinishedTask(final TutorialTask task)
|
|
||||||
{
|
|
||||||
return task != null && task.getID() < _currentTask;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
package mineplex.game.clans.tutorials;
|
package mineplex.game.clans.tutorials;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
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.player.PlayerQuitEvent;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import mineplex.core.MiniPlugin;
|
import mineplex.core.MiniPlugin;
|
||||||
@ -16,14 +14,12 @@ import mineplex.core.common.util.UtilPlayer;
|
|||||||
import mineplex.core.donation.DonationManager;
|
import mineplex.core.donation.DonationManager;
|
||||||
import mineplex.core.preferences.PreferencesManager;
|
import mineplex.core.preferences.PreferencesManager;
|
||||||
import mineplex.core.task.TaskManager;
|
import mineplex.core.task.TaskManager;
|
||||||
import mineplex.core.updater.UpdateType;
|
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
|
import mineplex.game.clans.clans.commands.RestartTutCommand;
|
||||||
import mineplex.game.clans.economy.GoldManager;
|
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.commands.TaskInfoCommand;
|
import mineplex.game.clans.tutorials.gettingstarted.TutorialGettingStarted;
|
||||||
import mineplex.game.clans.tutorials.types.TutorialGettingStarted;
|
|
||||||
|
|
||||||
public class TutorialManager extends MiniPlugin
|
public class TutorialManager extends MiniPlugin
|
||||||
{
|
{
|
||||||
@ -49,7 +45,7 @@ public class TutorialManager extends MiniPlugin
|
|||||||
{
|
{
|
||||||
addCommand(new SkipTutorialCommand(this));
|
addCommand(new SkipTutorialCommand(this));
|
||||||
addCommand(new DoSkipTutorialCommand(this));
|
addCommand(new DoSkipTutorialCommand(this));
|
||||||
addCommand(new TaskInfoCommand(this));
|
addCommand(new RestartTutCommand(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean startTutorial(final Class<? extends Tutorial> tutorial, final Player player)
|
public boolean startTutorial(final Class<? extends Tutorial> tutorial, final Player player)
|
||||||
@ -81,9 +77,9 @@ public class TutorialManager extends MiniPlugin
|
|||||||
{
|
{
|
||||||
getTutorial(player).cancelFor(player);
|
getTutorial(player).cancelFor(player);
|
||||||
|
|
||||||
_playerTutorials.remove(player.getName());
|
|
||||||
|
|
||||||
UtilPlayer.message(player, F.main("Tutorials", "You have cancelled the " + F.elem(getTutorial(player)._friendlyName + " Tutorial") + "."));
|
UtilPlayer.message(player, F.main("Tutorials", "You have cancelled the " + F.elem(getTutorial(player)._displayName + " Tutorial") + "."));
|
||||||
|
_playerTutorials.remove(player.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,32 +95,18 @@ 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)._friendlyName + " Tutorial") + "."));
|
UtilPlayer.message(player, F.main("Tutorials", "You have skipped the " + F.elem(getTutorial(player)._displayName + " Tutorial") + "."));
|
||||||
getTutorial(player).doSkip(player);
|
getTutorial(player).doSkip(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void cleanup(UpdateEvent event)
|
public void quit(PlayerQuitEvent event)
|
||||||
{
|
|
||||||
if (!event.getType().equals(UpdateType.SLOW))
|
|
||||||
{
|
{
|
||||||
|
if (!isInTutorial(event.getPlayer()))
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
List<String> del = new ArrayList<>();
|
getTutorial(event.getPlayer()).cleanup(event.getPlayer());
|
||||||
for (String name : _playerTutorials.keySet())
|
|
||||||
{
|
|
||||||
if (Bukkit.getPlayer(name) == null)
|
|
||||||
{
|
|
||||||
del.add(name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (String name : del)
|
|
||||||
{
|
|
||||||
_playerTutorials.remove(name);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Tutorial getTutorial(final Player player)
|
public Tutorial getTutorial(final Player player)
|
||||||
|
@ -1,39 +1,121 @@
|
|||||||
package mineplex.game.clans.tutorials;
|
package mineplex.game.clans.tutorials;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.common.util.UtilText;
|
import mineplex.core.common.util.UtilServer;
|
||||||
|
import mineplex.core.updater.UpdateType;
|
||||||
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
|
||||||
public class TutorialTask
|
public class TutorialTask<T extends Tutorial> implements Listener
|
||||||
{
|
{
|
||||||
private final String _name;
|
private T _tutorial;
|
||||||
private final String _description;
|
|
||||||
private final String _finishMessage;
|
|
||||||
private final int _id;
|
|
||||||
|
|
||||||
public TutorialTask(final int id, final String name, final String description, String finishMessage)
|
protected long _autoCompleteTime = -1;
|
||||||
|
|
||||||
|
protected String _displayName;
|
||||||
|
protected String _technicalName;
|
||||||
|
|
||||||
|
protected String _description;
|
||||||
|
protected String _finishMessage;
|
||||||
|
|
||||||
|
protected long _descriptionWaitTime = 30000;
|
||||||
|
|
||||||
|
private List<String> _playersFinished = new ArrayList<>();
|
||||||
|
|
||||||
|
private Map<String, DeployedTask> _deployedInstances = new HashMap<>();
|
||||||
|
private List<DeployedTask> _toCull = new ArrayList<>();
|
||||||
|
|
||||||
|
private int _id;
|
||||||
|
|
||||||
|
public TutorialTask(T tutorial, int id)
|
||||||
{
|
{
|
||||||
|
_tutorial = tutorial;
|
||||||
_id = id;
|
_id = id;
|
||||||
_name = name;
|
|
||||||
_description = description;
|
UtilServer.getServer().getPluginManager().registerEvents(this, _tutorial._manager.getPlugin());
|
||||||
_finishMessage = finishMessage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getID()
|
protected DeployedTask deploy(final Player player)
|
||||||
{
|
{
|
||||||
return _id;
|
DeployedTask task = customDeploy(player);
|
||||||
|
|
||||||
|
_deployedInstances.put(player.getName(), task);
|
||||||
|
|
||||||
|
UtilServer.getServer().getPluginManager().registerEvents(task, _tutorial._manager.getPlugin());
|
||||||
|
|
||||||
|
trySendDescription(player);
|
||||||
|
|
||||||
|
if (_autoCompleteTime != -1)
|
||||||
|
{
|
||||||
|
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(_tutorial._manager.getPlugin(), new Runnable(){
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
if (_deployedInstances.containsKey(player.getName()))
|
||||||
|
{
|
||||||
|
finishFor(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, _autoCompleteTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFinishMessage()
|
task.postDeploy();
|
||||||
{
|
|
||||||
return _finishMessage;
|
return task;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFriendlyName()
|
public void trySendDescription(Player player)
|
||||||
{
|
{
|
||||||
return _name;
|
if (!_tutorial.isInTutorial(player))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
TutorialClient client = _tutorial.get(player);
|
||||||
|
|
||||||
|
if (System.currentTimeMillis() - client.LastDescriptionSentTime > client.CurrentTask.getDescriptionWaitTime())
|
||||||
|
{
|
||||||
|
UtilPlayer.message(player, " ");
|
||||||
|
UtilPlayer.message(player, " ");
|
||||||
|
UtilPlayer.message(player, " ");
|
||||||
|
UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||||
|
UtilPlayer.message(player, " ");
|
||||||
|
UtilPlayer.message(player, C.cYellowB + "Part " + _id + ": " + _displayName);
|
||||||
|
UtilPlayer.message(player, C.cWhite + _description.replace("{", C.cAqua).replace("}", C.cWhite));
|
||||||
|
UtilPlayer.message(player, " ");
|
||||||
|
UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||||
|
client.LastDescriptionSentTime = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected DeployedTask customDeploy(final Player player)
|
||||||
|
{
|
||||||
|
return new DeployedTask(player, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public final void startFor(Player player)
|
||||||
|
{
|
||||||
|
deploy(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public final boolean hasFinished(final Player player)
|
||||||
|
{
|
||||||
|
return _playersFinished.contains(player.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDisplayName()
|
||||||
|
{
|
||||||
|
return _displayName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription()
|
public String getDescription()
|
||||||
@ -41,26 +123,79 @@ public class TutorialTask
|
|||||||
return _description;
|
return _description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUniqueId()
|
public String getFinishMessage()
|
||||||
{
|
{
|
||||||
return _name.replace(" ", "");
|
return _finishMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendDescriptionTo(final Player player)
|
public String getTechnicalName()
|
||||||
{
|
{
|
||||||
UtilPlayer.message(player, C.cGreen + "==== Pt." + _id + ": " + _name + " ====");
|
return _technicalName;
|
||||||
UtilPlayer.message(player, C.cYellow + _description.replace("{", C.cAqua).replace("}", C.cYellow));
|
|
||||||
UtilPlayer.message(player, C.cGreen + UtilText.repeat("=", _name.length() + ("=== Pt." + _id + ": ===").length()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onFinish(final Player player)
|
public int getID()
|
||||||
{
|
{
|
||||||
|
return _id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void finishFor(Player player)
|
||||||
|
{
|
||||||
|
_tutorial.finishTask(player, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void visibleFinish(Player player)
|
||||||
|
{
|
||||||
|
_deployedInstances.get(player.getName()).kill();
|
||||||
|
_toCull.add(_deployedInstances.get(player.getName()));
|
||||||
|
_deployedInstances.remove(player.getName());
|
||||||
|
|
||||||
if (_finishMessage != null)
|
if (_finishMessage != null)
|
||||||
{
|
{
|
||||||
UtilPlayer.message(player, C.cGreen + "==================");
|
UtilPlayer.message(player, " ");
|
||||||
UtilPlayer.message(player, C.cYellow + _finishMessage.replace("{", C.cAqua).replace("}", C.cYellow));
|
UtilPlayer.message(player, " ");
|
||||||
UtilPlayer.message(player, C.cGreen + "==================");
|
UtilPlayer.message(player, " ");
|
||||||
|
UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||||
|
UtilPlayer.message(player, " ");
|
||||||
|
UtilPlayer.message(player, C.cWhite + _finishMessage.replace("{", C.cAqua).replace("}", C.cWhite));
|
||||||
|
UtilPlayer.message(player, " ");
|
||||||
|
UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void update(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (event.getType() != UpdateType.SEC)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Iterator<DeployedTask> iterator = _toCull.iterator();
|
||||||
|
|
||||||
|
while(iterator.hasNext())
|
||||||
|
{
|
||||||
|
DeployedTask task = iterator.next();
|
||||||
|
|
||||||
|
task.kill();
|
||||||
|
HandlerList.unregisterAll(task);
|
||||||
|
iterator.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void cleanup(Player player)
|
||||||
|
{
|
||||||
|
_deployedInstances.get(player.getName()).kill();
|
||||||
|
_toCull.add(_deployedInstances.get(player.getName()));
|
||||||
|
_playersFinished.remove(player.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getDescriptionWaitTime()
|
||||||
|
{
|
||||||
|
return _descriptionWaitTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public T getTutorial()
|
||||||
|
{
|
||||||
|
return _tutorial;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
package mineplex.game.clans.tutorials.commands;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import mineplex.core.command.CommandBase;
|
|
||||||
import mineplex.core.common.Rank;
|
|
||||||
import mineplex.core.common.util.F;
|
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
|
||||||
import mineplex.game.clans.tutorials.TutorialManager;
|
|
||||||
|
|
||||||
public class TaskInfoCommand extends CommandBase<TutorialManager>
|
|
||||||
{
|
|
||||||
public TaskInfoCommand(final TutorialManager plugin)
|
|
||||||
{
|
|
||||||
super(plugin, Rank.ALL, "taskinfo", "ti");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void Execute(final Player caller, final String[] args)
|
|
||||||
{
|
|
||||||
if (Plugin.isInTutorial(caller))
|
|
||||||
{
|
|
||||||
Plugin.getTutorial(caller).getTask(Plugin.getTutorial(caller).get(caller).getCurrentTask()).sendDescriptionTo(caller);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
UtilPlayer.message(caller, F.main("Tutorials", "You are not currently in a tutorial."));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -0,0 +1,62 @@
|
|||||||
|
package mineplex.game.clans.tutorials.gettingstarted;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
|
||||||
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
|
import mineplex.game.clans.clans.event.ClansCommandExecutedEvent;
|
||||||
|
import mineplex.game.clans.tutorials.DeployedTask;
|
||||||
|
import mineplex.game.clans.tutorials.TutorialTask;
|
||||||
|
|
||||||
|
public class TaskClaim extends TutorialTask<TutorialGettingStarted>
|
||||||
|
{
|
||||||
|
public TaskClaim(TutorialGettingStarted tutorial, int id)
|
||||||
|
{
|
||||||
|
super(tutorial, id);
|
||||||
|
|
||||||
|
_displayName = "Claim some Territory";
|
||||||
|
_technicalName = "ClaimTerr";
|
||||||
|
|
||||||
|
_description = "Clans can claim 16x16 areas of Territory! "
|
||||||
|
+ "Once claimed, only your Clan can break/place blocks here. "
|
||||||
|
+ "This is the perfect place to build a base and stash your items! "
|
||||||
|
+ "You can only claim in the Wilderness, and not next to other Clans Territory. "
|
||||||
|
+ "Claim some Territory now, by typing {/c claim}!";
|
||||||
|
}
|
||||||
|
|
||||||
|
@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)
|
||||||
|
public void onClansCommand(ClansCommandExecutedEvent event)
|
||||||
|
{
|
||||||
|
if (!_player.equals(event.getPlayer()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ClansManager.getInstance().isInClan(event.getPlayer()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.getCommand().equals("claim"))
|
||||||
|
{
|
||||||
|
_task.finishFor(_player);
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
package mineplex.game.clans.tutorials.gettingstarted;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
|
||||||
|
import mineplex.game.clans.clans.event.ClanCreatedEvent;
|
||||||
|
import mineplex.game.clans.tutorials.DeployedTask;
|
||||||
|
import mineplex.game.clans.tutorials.TutorialTask;
|
||||||
|
|
||||||
|
public class TaskCreateClan extends TutorialTask<TutorialGettingStarted>
|
||||||
|
{
|
||||||
|
public TaskCreateClan(TutorialGettingStarted tutorial, int id)
|
||||||
|
{
|
||||||
|
super(tutorial, id);
|
||||||
|
|
||||||
|
_displayName = "Create a Clan";
|
||||||
|
_technicalName = "ClanCreation";
|
||||||
|
|
||||||
|
_description = "Before beginning, use the {/c create <ClanName>} command to start up your own Clan! ";
|
||||||
|
}
|
||||||
|
|
||||||
|
@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 onClanCreated(ClanCreatedEvent event)
|
||||||
|
{
|
||||||
|
if (!_player.equals(event.getFounder()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_task.finishFor(_player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,69 @@
|
|||||||
|
package mineplex.game.clans.tutorials.gettingstarted;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
|
||||||
|
import mineplex.core.updater.UpdateType;
|
||||||
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
|
import mineplex.game.clans.spawn.Spawn;
|
||||||
|
import mineplex.game.clans.tutorials.DeployedTask;
|
||||||
|
import mineplex.game.clans.tutorials.TutorialTask;
|
||||||
|
import mineplex.minecraft.game.classcombat.Class.ClientClass;
|
||||||
|
|
||||||
|
public class TaskCustomizeClass extends TutorialTask<TutorialGettingStarted>
|
||||||
|
{
|
||||||
|
public TaskCustomizeClass(TutorialGettingStarted tutorial, int id)
|
||||||
|
{
|
||||||
|
super(tutorial, id);
|
||||||
|
|
||||||
|
_displayName = "Customize Class";
|
||||||
|
_technicalName = "CustomizeKlass";
|
||||||
|
|
||||||
|
_description = "Now that you have equipped a class, use this enchantment table to customize your class builds. "
|
||||||
|
+ "Click on the enchantment table, and click the edit build button.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
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)
|
||||||
|
public void onUpdate(final UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (!event.getType().equals(UpdateType.SEC))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (checkForDeath())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final ClientClass clientclass = ClansManager.getInstance().getClassManager().Get(_player);
|
||||||
|
|
||||||
|
if (clientclass != null && clientclass.GetSavingCustomBuild() != null)
|
||||||
|
{
|
||||||
|
_task.finishFor(_player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
package mineplex.game.clans.tutorials.gettingstarted;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
|
||||||
|
import mineplex.game.clans.clans.event.ClanDisbandedEvent;
|
||||||
|
import mineplex.game.clans.tutorials.DeployedTask;
|
||||||
|
import mineplex.game.clans.tutorials.TutorialTask;
|
||||||
|
|
||||||
|
public class TaskDisbandClan extends TutorialTask<TutorialGettingStarted>
|
||||||
|
{
|
||||||
|
public TaskDisbandClan(TutorialGettingStarted tutorial, int id)
|
||||||
|
{
|
||||||
|
super(tutorial, id);
|
||||||
|
|
||||||
|
_displayName = "Disband your Clan";
|
||||||
|
_technicalName = "DisbandClan";
|
||||||
|
|
||||||
|
_description = "Finally, let's disband your Clan to end the Tutorial. "
|
||||||
|
+ "Simply type {/c disband} to do this. "
|
||||||
|
+ "This will delete your Clan, and you'll be able to create or join a new one!";
|
||||||
|
}
|
||||||
|
|
||||||
|
@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
|
||||||
|
public void sell(ClanDisbandedEvent event)
|
||||||
|
{
|
||||||
|
if (!_player.equals(event.getDisbander()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_task.finishFor(_player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,116 @@
|
|||||||
|
package mineplex.game.clans.tutorials.gettingstarted;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.Callback;
|
||||||
|
import mineplex.core.common.util.UtilItem;
|
||||||
|
import mineplex.core.task.TaskManager;
|
||||||
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
|
import mineplex.game.clans.clans.event.ClansPlayerBuyItemEvent;
|
||||||
|
import mineplex.game.clans.clans.event.ClansShopAddButtonEvent;
|
||||||
|
import mineplex.game.clans.spawn.Spawn;
|
||||||
|
import mineplex.game.clans.tutorials.DeployedTask;
|
||||||
|
import mineplex.game.clans.tutorials.TutorialTask;
|
||||||
|
import mineplex.minecraft.game.classcombat.Class.event.ClassEquipEvent;
|
||||||
|
|
||||||
|
public class TaskEquipClass extends TutorialTask<TutorialGettingStarted>
|
||||||
|
{
|
||||||
|
public TaskEquipClass(TutorialGettingStarted tutorial, int id)
|
||||||
|
{
|
||||||
|
super(tutorial, id);
|
||||||
|
|
||||||
|
_displayName = "Equip a Class";
|
||||||
|
_technicalName = "AuszustattenKlasse";
|
||||||
|
|
||||||
|
_description = "Use the PvP Gear shop, and right-click the Villager. "
|
||||||
|
+ "Purchase Iron Armor from the PvP Shop. "
|
||||||
|
+ "Then put on your armor to equip a Champion’s Class.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
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
|
||||||
|
public void onClassEquipped(ClassEquipEvent event)
|
||||||
|
{
|
||||||
|
if (!ClansManager.getInstance().getClassManager().Get(_player).equals(event.getPlayer()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_task.finishFor(_player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void button(ClansShopAddButtonEvent event)
|
||||||
|
{
|
||||||
|
if (!_player.equals(event.getPlayer()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(UtilItem.isArmor(event.getMaterial()) && UtilItem.isIronProduct(event.getMaterial())))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!TaskManager.Instance.hasCompletedTask(event.getPlayer(), "tuttoooooe" + event.getMaterial().name()) && !_bought.contains(event.getMaterial()))
|
||||||
|
{
|
||||||
|
event.setBuyPrice(0);
|
||||||
|
event.setSellPrice(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void buy(final ClansPlayerBuyItemEvent event)
|
||||||
|
{
|
||||||
|
if (!_player.equals(event.getPlayer()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(UtilItem.isArmor(event.getItem().getType()) && UtilItem.isIronProduct(event.getItem().getType())))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.getCost() == 0 && _bought.contains(event.getItem().getType()))
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
TaskManager.Instance.completedTask(new Callback<Boolean>() {
|
||||||
|
@Override
|
||||||
|
public void run(Boolean data)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}, event.getPlayer(), "tuttoooooe" + event.getItem().getType().name());
|
||||||
|
_bought.add(event.getItem().getType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,87 @@
|
|||||||
|
package mineplex.game.clans.tutorials.gettingstarted;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
|
||||||
|
import mineplex.core.updater.UpdateType;
|
||||||
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
|
import mineplex.game.clans.clans.event.EnergyPageBuildEvent;
|
||||||
|
import mineplex.game.clans.spawn.Spawn;
|
||||||
|
import mineplex.game.clans.tutorials.DeployedTask;
|
||||||
|
import mineplex.game.clans.tutorials.TutorialTask;
|
||||||
|
|
||||||
|
public class TaskExploreShops extends TutorialTask<TutorialGettingStarted>
|
||||||
|
{
|
||||||
|
public TaskExploreShops(TutorialGettingStarted tutorial, int id)
|
||||||
|
{
|
||||||
|
super(tutorial, id);
|
||||||
|
|
||||||
|
_displayName = "Welcome to the Shops";
|
||||||
|
_technicalName = "WillkommenZumGeschaft";
|
||||||
|
|
||||||
|
_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. "
|
||||||
|
+ "Go to the Energy Shop and buy {Max Energy}. (FREE)";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
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(), 17, 66.5, -330, -180f, 0f));
|
||||||
|
|
||||||
|
ClansManager.getInstance().getClan(_player).adjustEnergy(-(ClansManager.getInstance().getClan(_player).getEnergyCostPerMinute() * 60));
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onItemPut(EnergyPageBuildEvent event)
|
||||||
|
{
|
||||||
|
if (!_player.equals(event.getPlayer()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ClansManager.getInstance().isInClan(_player))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ClansManager.getInstance().getClan(_player).getEnergyPurchasable() == 0)
|
||||||
|
{
|
||||||
|
_task.finishFor(_player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
event.setFree(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onUpdate(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (event.getType() != UpdateType.TWOSEC)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ClansManager.getInstance().getClan(_player).getEnergy() == ClansManager.getInstance().getClan(_player).getEnergyMax())
|
||||||
|
{
|
||||||
|
_task.finishFor(_player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,55 @@
|
|||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,69 @@
|
|||||||
|
package mineplex.game.clans.tutorials.gettingstarted;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
|
||||||
|
import mineplex.core.updater.UpdateType;
|
||||||
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
|
import mineplex.game.clans.clans.event.PlayerEnterTerritoryEvent;
|
||||||
|
import mineplex.game.clans.tutorials.DeployedTask;
|
||||||
|
import mineplex.game.clans.tutorials.TutorialTask;
|
||||||
|
|
||||||
|
public class TaskLeaveSpawn extends TutorialTask<TutorialGettingStarted>
|
||||||
|
{
|
||||||
|
public TaskLeaveSpawn(TutorialGettingStarted tutorial, int id)
|
||||||
|
{
|
||||||
|
super(tutorial, id);
|
||||||
|
|
||||||
|
_displayName = "Leave Spawn Islands";
|
||||||
|
_technicalName = "LeaveSpawn";
|
||||||
|
|
||||||
|
_description = "Now you can leave the Spawn Island. "
|
||||||
|
+ "Don't worry, you won't get hurt from the fall! "
|
||||||
|
+ "Once you end the tutorial, PvP will be enabled down there, so be careful!";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
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()
|
||||||
|
{
|
||||||
|
if (_player.getLocation().getY() < 100)
|
||||||
|
{
|
||||||
|
_task.finishFor(_player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void update(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (event.getType() != UpdateType.SEC)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (checkForDeath())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_player.getLocation().getY() < 100){
|
||||||
|
_task.finishFor(_player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,71 @@
|
|||||||
|
package mineplex.game.clans.tutorials.gettingstarted;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
|
import mineplex.game.clans.clans.event.ClansPlayerSellItemEvent;
|
||||||
|
import mineplex.game.clans.spawn.Spawn;
|
||||||
|
import mineplex.game.clans.tutorials.DeployedTask;
|
||||||
|
import mineplex.game.clans.tutorials.TutorialTask;
|
||||||
|
|
||||||
|
public class TaskMakingMoney extends TutorialTask<TutorialGettingStarted>
|
||||||
|
{
|
||||||
|
public TaskMakingMoney(TutorialGettingStarted tutorial, int id)
|
||||||
|
{
|
||||||
|
super(tutorial, id);
|
||||||
|
|
||||||
|
_displayName = "Making Money (Farming)";
|
||||||
|
_technicalName = "ImAFarmer";
|
||||||
|
|
||||||
|
_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.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DeployedTask customDeploy(Player player)
|
||||||
|
{
|
||||||
|
return new Deployed(player, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
class Deployed extends DeployedTask
|
||||||
|
{
|
||||||
|
private int _carrotsSold;
|
||||||
|
|
||||||
|
public Deployed(Player player, TutorialTask<?> task)
|
||||||
|
{
|
||||||
|
super(player, task);
|
||||||
|
player.getInventory().addItem(new ItemStack(Material.CARROT_ITEM, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void postDeploy()
|
||||||
|
{
|
||||||
|
_player.teleport(new Location(Spawn.getSpawnWorld(), 25.536, 66, -316.844, -100f, 0f));
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void button(ClansPlayerSellItemEvent event)
|
||||||
|
{
|
||||||
|
if (!_player.equals(event.getPlayer()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ClansManager.getInstance().isInClan(_player))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!event.getItem().getType().equals(Material.CARROT_ITEM))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_task.finishFor(_player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,60 @@
|
|||||||
|
package mineplex.game.clans.tutorials.gettingstarted;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
|
||||||
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
|
import mineplex.game.clans.clans.event.ClansCommandExecutedEvent;
|
||||||
|
import mineplex.game.clans.tutorials.DeployedTask;
|
||||||
|
import mineplex.game.clans.tutorials.TutorialTask;
|
||||||
|
|
||||||
|
public class TaskSetHome extends TutorialTask<TutorialGettingStarted>
|
||||||
|
{
|
||||||
|
public TaskSetHome(TutorialGettingStarted tutorial, int id)
|
||||||
|
{
|
||||||
|
super(tutorial, id);
|
||||||
|
|
||||||
|
_displayName = "Set Clan Home";
|
||||||
|
_technicalName = "SetClanHome";
|
||||||
|
|
||||||
|
_description = "You are now ready to set a Clan Home. "
|
||||||
|
+ "To do this, use the {/c sethome} command.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@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)
|
||||||
|
public void onSetHome(ClansCommandExecutedEvent event)
|
||||||
|
{
|
||||||
|
if (!_player.equals(event.getPlayer()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ClansManager.getInstance().isInClan(event.getPlayer()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!event.getCommand().equals("homeset"))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_task.finishFor(_player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,129 @@
|
|||||||
|
package mineplex.game.clans.tutorials.gettingstarted;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||||
|
import org.bukkit.event.inventory.InventoryType;
|
||||||
|
import org.bukkit.inventory.CraftingInventory;
|
||||||
|
import org.bukkit.inventory.PlayerInventory;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.Callback;
|
||||||
|
import mineplex.core.task.TaskManager;
|
||||||
|
import mineplex.core.updater.UpdateType;
|
||||||
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
import mineplex.game.clans.clans.event.ClansPlayerBuyItemEvent;
|
||||||
|
import mineplex.game.clans.clans.event.ClansShopAddButtonEvent;
|
||||||
|
import mineplex.game.clans.spawn.Spawn;
|
||||||
|
import mineplex.game.clans.tutorials.DeployedTask;
|
||||||
|
import mineplex.game.clans.tutorials.TutorialTask;
|
||||||
|
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
|
||||||
|
|
||||||
|
public class TaskUseAbility extends TutorialTask<TutorialGettingStarted>
|
||||||
|
{
|
||||||
|
public TaskUseAbility(TutorialGettingStarted tutorial, int id)
|
||||||
|
{
|
||||||
|
super(tutorial, id);
|
||||||
|
|
||||||
|
_displayName = "Use a Class Ability";
|
||||||
|
_technicalName = "KlassAbilityUsage";
|
||||||
|
|
||||||
|
_description = "Now that you have equipped a class, you can start using abilities. "
|
||||||
|
+ "Purchase an Iron Axe from the PvP Shop. "
|
||||||
|
+ "Right-Click with your Iron Axe to use your Axe Ability!";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DeployedTask customDeploy(Player player)
|
||||||
|
{
|
||||||
|
return new Deployed(player, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
class Deployed extends DeployedTask
|
||||||
|
{
|
||||||
|
private List<Material> _bought = new ArrayList<>();
|
||||||
|
private boolean _teleported = false;
|
||||||
|
|
||||||
|
public Deployed(Player player, TutorialTask<?> task)
|
||||||
|
{
|
||||||
|
super(player, task);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void teleportPlayer(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (event.getType() != UpdateType.SEC) return;
|
||||||
|
|
||||||
|
if (!_teleported && _player != null && _player.isOnline() && _player.getOpenInventory().getType() == InventoryType.CRAFTING)
|
||||||
|
{
|
||||||
|
_player.teleport(new Location(Spawn.getSpawnWorld(), 19, 66, -305.844, -100f, 0f));
|
||||||
|
_teleported = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onAbilityUesd(SkillTriggerEvent event)
|
||||||
|
{
|
||||||
|
if (_player == null || !_player.equals(event.GetPlayer()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_task.finishFor(_player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void button(ClansShopAddButtonEvent event)
|
||||||
|
{
|
||||||
|
if (!_player.equals(event.getPlayer()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println(event.getDisplayName());
|
||||||
|
|
||||||
|
if (!event.getMaterial().equals(Material.IRON_AXE))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!TaskManager.Instance.hasCompletedTask(event.getPlayer(), "tuttoooooe" + event.getMaterial().name()) && !_bought.contains(event.getMaterial()))
|
||||||
|
{
|
||||||
|
event.setBuyPrice(0);
|
||||||
|
event.setSellPrice(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void buy(final ClansPlayerBuyItemEvent event)
|
||||||
|
{
|
||||||
|
if (!_player.equals(event.getPlayer()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!event.getItem().getType().equals(Material.IRON_AXE))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.getCost() == 0 && _bought.contains(event.getItem().getType()))
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
TaskManager.Instance.completedTask(new Callback<Boolean>() {
|
||||||
|
@Override
|
||||||
|
public void run(Boolean data)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}, event.getPlayer(), "tuttoooooe" + event.getItem().getType().name());
|
||||||
|
_bought.add(event.getItem().getType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,53 @@
|
|||||||
|
package mineplex.game.clans.tutorials.gettingstarted;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
|
||||||
|
import mineplex.game.clans.clans.event.ClansCommandExecutedEvent;
|
||||||
|
import mineplex.game.clans.tutorials.DeployedTask;
|
||||||
|
import mineplex.game.clans.tutorials.TutorialTask;
|
||||||
|
|
||||||
|
public class TaskViewClanDetails extends TutorialTask<TutorialGettingStarted>
|
||||||
|
{
|
||||||
|
public TaskViewClanDetails(TutorialGettingStarted tutorial, int id)
|
||||||
|
{
|
||||||
|
super(tutorial, id);
|
||||||
|
|
||||||
|
_displayName = "Viewing Clan Details";
|
||||||
|
_technicalName = "CommandClanX";
|
||||||
|
|
||||||
|
_description = "Now you can view information about your clan. "
|
||||||
|
+ "To do this type {/c [clan name]}! "
|
||||||
|
+ "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)
|
||||||
|
public void onClansCommand(ClansCommandExecutedEvent event)
|
||||||
|
{
|
||||||
|
if (!_player.equals(event.getPlayer()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.getCommand().equals("info"))
|
||||||
|
{
|
||||||
|
_task.finishFor(_player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package mineplex.game.clans.tutorials.gettingstarted;
|
||||||
|
|
||||||
|
import mineplex.game.clans.tutorials.TutorialTask;
|
||||||
|
|
||||||
|
public class TaskWelcome extends TutorialTask<TutorialGettingStarted>
|
||||||
|
{
|
||||||
|
public TaskWelcome(TutorialGettingStarted tutorial, int id)
|
||||||
|
{
|
||||||
|
super(tutorial, id);
|
||||||
|
|
||||||
|
_autoCompleteTime = 20 * 10;
|
||||||
|
|
||||||
|
_displayName = "Welcome";
|
||||||
|
_technicalName = "Welcome";
|
||||||
|
|
||||||
|
_description = "Welcome to Clans! "
|
||||||
|
+ "In this game mode, you are able to create a Clan, invite your friends to the Clan, build a base, claim it to protect, and fight others with your new powerful Clan!"
|
||||||
|
+ "You can also join a friend's Clan if they invite you to it!"
|
||||||
|
+ "When you finish the tutorial, you will be awarded {30,000 Gold}";
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,106 @@
|
|||||||
|
package mineplex.game.clans.tutorials.gettingstarted;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
|
import mineplex.core.donation.DonationManager;
|
||||||
|
import mineplex.core.task.TaskManager;
|
||||||
|
import mineplex.core.updater.UpdateType;
|
||||||
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
|
import mineplex.game.clans.economy.GoldManager;
|
||||||
|
import mineplex.game.clans.spawn.Spawn;
|
||||||
|
import mineplex.game.clans.tutorials.Tutorial;
|
||||||
|
import mineplex.game.clans.tutorials.TutorialManager;
|
||||||
|
|
||||||
|
public class TutorialGettingStarted extends Tutorial
|
||||||
|
{
|
||||||
|
public TutorialGettingStarted(final TutorialManager manager, final ClansManager clansManager, final DonationManager donationManager, final GoldManager goldManager, final TaskManager taskManager)
|
||||||
|
{
|
||||||
|
super(goldManager, taskManager, clansManager, donationManager, manager);
|
||||||
|
|
||||||
|
// addTask(new TaskWelcome(this, 1));
|
||||||
|
|
||||||
|
int id = 0;
|
||||||
|
addTask(new TaskCreateClan(this, ++id));
|
||||||
|
addTask(new TaskViewClanDetails(this, ++id));
|
||||||
|
addTask(new TaskLeaveSpawn(this, ++id));
|
||||||
|
addTask(new TaskGoToWilderness(this, ++id));
|
||||||
|
addTask(new TaskClaim(this, ++id));
|
||||||
|
addTask(new TaskSetHome(this, ++id));
|
||||||
|
addTask(new TaskExploreShops(this, ++id));
|
||||||
|
addTask(new TaskEquipClass(this, ++id));
|
||||||
|
addTask(new TaskCustomizeClass(this, ++id));
|
||||||
|
addTask(new TaskUseAbility(this, ++id));
|
||||||
|
addTask(new TaskMakingMoney(this, ++id));
|
||||||
|
addTask(new TaskDisbandClan(this, ++id));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_doScoreboard = true;
|
||||||
|
_ghostMode = true;
|
||||||
|
_startOnJoin = true;
|
||||||
|
_goldReward = 30000;
|
||||||
|
|
||||||
|
_technicalName = "GettingStartedTutorial";
|
||||||
|
_displayName = "Getting Started";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFinished(final Player player)
|
||||||
|
{
|
||||||
|
UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||||
|
UtilPlayer.message(player, C.cYellowB + "CONGRATULATIONS");
|
||||||
|
UtilPlayer.message(player, " ");
|
||||||
|
UtilPlayer.message(player, C.cWhite + "You have completed the Clans basic tutorial and have been awarded " + C.cAqua + "30,000 Gold");
|
||||||
|
UtilPlayer.message(player, C.cWhite + "You can now begin your adventure, but do take a moment to read the signs around spawn for more information!");
|
||||||
|
UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||||
|
|
||||||
|
player.resetPlayerTime();
|
||||||
|
player.teleport(Spawn.getEastSpawn());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBegin(final Player player)
|
||||||
|
{
|
||||||
|
UtilPlayer.message(player, " ");
|
||||||
|
UtilPlayer.message(player, " ");
|
||||||
|
UtilPlayer.message(player, " ");
|
||||||
|
UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||||
|
UtilPlayer.message(player, " ");
|
||||||
|
UtilPlayer.message(player, C.cYellowB + "Getting Started");
|
||||||
|
UtilPlayer.message(player, C.cWhite + "Welcome to Clans! "
|
||||||
|
+ "In this game mode you are able to create a clan, invite your friends to play with you, build a base, and wage war against others! "
|
||||||
|
+ "When you finish the tutorial, you will be awarded " + C.cAqua + "30,000 Gold");
|
||||||
|
UtilPlayer.message(player, " ");
|
||||||
|
UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
|
public void onUpdate(final UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (!event.getType().equals(UpdateType.SEC))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Player player : UtilServer.getPlayers())
|
||||||
|
{
|
||||||
|
if (isInTutorial(player))
|
||||||
|
{
|
||||||
|
for (Player other : UtilServer.getPlayers())
|
||||||
|
{
|
||||||
|
other.hidePlayer(player.getPlayer());
|
||||||
|
player.hidePlayer(other);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,404 +0,0 @@
|
|||||||
package mineplex.game.clans.tutorials.types;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.EventPriority;
|
|
||||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import mineplex.core.common.util.Callback;
|
|
||||||
import mineplex.core.common.util.F;
|
|
||||||
import mineplex.core.common.util.UtilItem;
|
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
|
||||||
import mineplex.core.common.util.UtilServer;
|
|
||||||
import mineplex.core.common.util.UtilItem.ItemCategory;
|
|
||||||
import mineplex.core.donation.DonationManager;
|
|
||||||
import mineplex.core.task.TaskManager;
|
|
||||||
import mineplex.core.updater.UpdateType;
|
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
|
||||||
import mineplex.game.clans.clans.ClanRole;
|
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
|
||||||
import mineplex.game.clans.clans.event.ClanCreatedEvent;
|
|
||||||
import mineplex.game.clans.clans.event.ClanDisbandedEvent;
|
|
||||||
import mineplex.game.clans.clans.event.ClanJoinEvent;
|
|
||||||
import mineplex.game.clans.clans.event.ClanSetHomeEvent;
|
|
||||||
import mineplex.game.clans.clans.event.ClansCommandExecutedEvent;
|
|
||||||
import mineplex.game.clans.clans.event.ClansPlayerBuyItemEvent;
|
|
||||||
import mineplex.game.clans.clans.event.ClansPlayerSellItemEvent;
|
|
||||||
import mineplex.game.clans.clans.event.ClansShopAddButtonEvent;
|
|
||||||
import mineplex.game.clans.clans.event.PlayerEnterTerritoryEvent;
|
|
||||||
import mineplex.game.clans.economy.GoldManager;
|
|
||||||
import mineplex.game.clans.spawn.Spawn;
|
|
||||||
import mineplex.game.clans.tutorials.Tutorial;
|
|
||||||
import mineplex.game.clans.tutorials.TutorialClient;
|
|
||||||
import mineplex.game.clans.tutorials.TutorialManager;
|
|
||||||
import mineplex.minecraft.game.classcombat.Class.ClientClass;
|
|
||||||
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
|
|
||||||
|
|
||||||
public class TutorialGettingStarted extends Tutorial
|
|
||||||
{
|
|
||||||
public TutorialGettingStarted(final TutorialManager manager, final ClansManager clansManager, final DonationManager donationManager, final GoldManager goldManager, final TaskManager taskManager)
|
|
||||||
{
|
|
||||||
super(goldManager, taskManager, clansManager, donationManager, manager);
|
|
||||||
|
|
||||||
addTask(1, "Welcome",
|
|
||||||
"Welcome to Clans! "
|
|
||||||
+ "In this game mode, you are able to create a Clan, invite your friends to the Clan, build a base, claim it to protect, and fight others with your new powerful Clan!"
|
|
||||||
+ "You can also join a friend's Clan if they invite you to it!"
|
|
||||||
+ "When you finish the tutorial, you will be awarded {30,000 Gold}");
|
|
||||||
|
|
||||||
addTask(2, "Create a clan",
|
|
||||||
"Before beginning, use the {/c create <ClanName>} command to start up your own Clan!"
|
|
||||||
+ "Alternatively, you can join a friend's Clan, if they have invited you, instead of making your own.");
|
|
||||||
|
|
||||||
addTask(3, "Viewing Clan Details",
|
|
||||||
"Now you can view information about your Clan. "
|
|
||||||
+ "To do this type {/c [Clan Name]}! "
|
|
||||||
+ "You can also use any Clans name to get some information about them as well.");
|
|
||||||
|
|
||||||
addTask(4, "Leave Spawn Islands",
|
|
||||||
"Now you can leave the Spawn Island. "
|
|
||||||
+ "Don't worry, you won't get hurt from the fall! "
|
|
||||||
+ "Once you end the tutorial, PvP will be enabled down there, so be careful!");
|
|
||||||
|
|
||||||
addTask(5, "Go To The Wilderness",
|
|
||||||
"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 by Left and Right Clicking!");
|
|
||||||
|
|
||||||
addTask(6, "Claim some Territory",
|
|
||||||
"Clans can claim 16x16 areas of Territory! "
|
|
||||||
+ "Once claimed, only your Clan can break/place blocks here. "
|
|
||||||
+ "This is the perfect place to build a base and stash your items!"
|
|
||||||
+ "You can only claim in the Wilderness, and not next to other Clans Territory. "
|
|
||||||
+ "Claim some Territory now, by typing {/c claim}! ",
|
|
||||||
|
|
||||||
"Good job! We won't actually claim this Territory yet!");
|
|
||||||
|
|
||||||
addTask(7, "Set Clan Home",
|
|
||||||
"You are now ready to set a Clan Home."
|
|
||||||
+ "To do this, use the {/c sethome} command.");
|
|
||||||
|
|
||||||
addTask(8, "Explore the Shops",
|
|
||||||
"You can buy all sorts of things at the Shops! "
|
|
||||||
+ "You can also sell things to the Villagers for Gold! "
|
|
||||||
+ "Look at your Map and take notice of where the Shops is. "
|
|
||||||
+ "You can also transfer {1,000 Gems} into {32,000 Clans Gold} each day.");
|
|
||||||
|
|
||||||
addTask(9, "Equip a Class",
|
|
||||||
"Find the PvP Gear shop, and Right-Click the Villager. "
|
|
||||||
+ "Purchase Iron Armor from the PvP Shop. (FREE) "
|
|
||||||
+ "Then put on your Armor to equip a Champions Class. ");
|
|
||||||
|
|
||||||
addTask(10, "Use a Class Ability",
|
|
||||||
"Now that you have Equipped a Class, you can start using Abilities. "
|
|
||||||
+ "Purchase a Sword from the PvP Shop. (FREE) "
|
|
||||||
+ "Right-Click with your Sword to use your Sword Ability!");
|
|
||||||
|
|
||||||
addTask(11, "Class Customization",
|
|
||||||
"To customize your Class, Right-Click an Enchantment Table! "
|
|
||||||
+ "There should be one nearby in the Shops!"
|
|
||||||
+ "Find it, and try customizing your Class! ");
|
|
||||||
|
|
||||||
addTask(12, "Making Money (Farming)",
|
|
||||||
"We have given you a few Carrots, as a starter for your Farming career. "
|
|
||||||
+ "Go to the Organic Produce Villager in one of the Shops, and sell the Carrots for {Gold}.");
|
|
||||||
|
|
||||||
addTask(13, "Disband your Clan",
|
|
||||||
"Finally, let's disband your Clan to end the Tutorial. "
|
|
||||||
+ "Simply type {/c disband} to do this. "
|
|
||||||
+ "This will delete your Clan, and you'll be able to create or join a new one!");
|
|
||||||
|
|
||||||
_doScoreboard = true;
|
|
||||||
_ghostMode = true;
|
|
||||||
_startOnJoin = true;
|
|
||||||
_goldReward = 30000;
|
|
||||||
|
|
||||||
_uniqueId = "GettingStartedTutorial";
|
|
||||||
_friendlyName = "Getting Started";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFinished(final Player player)
|
|
||||||
{
|
|
||||||
UtilPlayer.message(player, F.main("Tutorials", "You are now ready to play, welcome to the game."));
|
|
||||||
player.resetPlayerTime();
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void button(ClansShopAddButtonEvent event)
|
|
||||||
{
|
|
||||||
if (get(event.getPlayer()).hasFinishedTask(getTask("Explore the Shops")) && !get(event.getPlayer()).hasFinishedTask(getTask("Equip a Class")))
|
|
||||||
{
|
|
||||||
if (!(UtilItem.isArmor(event.getMaterial()) && UtilItem.isIronProduct(event.getMaterial())))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!_taskManager.hasCompletedTask(event.getPlayer(), "GettingStartedBought" + event.getMaterial().name()))
|
|
||||||
{
|
|
||||||
event.setBuyPrice(0);
|
|
||||||
event.setSellPrice(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void swordbutton(ClansShopAddButtonEvent event)
|
|
||||||
{
|
|
||||||
if (get(event.getPlayer()).hasFinishedTask(getTask("Equip A Class")) && !get(event.getPlayer()).hasFinishedTask(getTask("Use a Class Ability")))
|
|
||||||
{
|
|
||||||
if (!(UtilItem.isSword(event.getMaterial())))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!_taskManager.hasCompletedTask(event.getPlayer(), "GettingStartedBoughtSword"))
|
|
||||||
{
|
|
||||||
event.setBuyPrice(0);
|
|
||||||
event.setSellPrice(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void buy(final ClansPlayerBuyItemEvent event)
|
|
||||||
{
|
|
||||||
if (get(event.getPlayer()).hasFinishedTask(getTask("Explore the Shops")) && !get(event.getPlayer()).hasFinishedTask(getTask("Equip a Class")))
|
|
||||||
{
|
|
||||||
if (!(UtilItem.isArmor(event.getItem().getType()) && UtilItem.isIronProduct(event.getItem().getType())))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_taskManager.completedTask(new Callback<Boolean>(){
|
|
||||||
@Override
|
|
||||||
public void run(Boolean data)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}, event.getPlayer(), "GettingStartedBought" + event.getItem().getType().name());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void buysword(final ClansPlayerBuyItemEvent event)
|
|
||||||
{
|
|
||||||
if (get(event.getPlayer()).hasFinishedTask(getTask("Equip A Class")) && !get(event.getPlayer()).hasFinishedTask(getTask("Use a Class Ability")))
|
|
||||||
{
|
|
||||||
if (UtilItem.isSword(event.getItem().getType()))
|
|
||||||
{
|
|
||||||
_taskManager.completedTask(new Callback<Boolean>() {
|
|
||||||
@Override
|
|
||||||
public void run(Boolean data)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}, event.getPlayer(), "GettingStartedBoughtSword");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void sell(ClansPlayerSellItemEvent event)
|
|
||||||
{
|
|
||||||
if (get(event.getPlayer()).hasFinishedTask(getTask("Class Customization")) && !get(event.getPlayer()).hasFinishedTask(getTask("Making Money (Farming)")))
|
|
||||||
{
|
|
||||||
finishTask(event.getPlayer(), "Making Money (Farming)");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBegin(final Player player)
|
|
||||||
{
|
|
||||||
UtilPlayer.message(player, F.main("Tutorials", "Welcome to the " + F.elem("Getting Started Tutorial!")));
|
|
||||||
|
|
||||||
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(_clansManager.getPlugin(), new Runnable() {
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
finishTask(player, "Welcome");
|
|
||||||
|
|
||||||
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(_clansManager.getPlugin(), new Runnable() {
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
if (_clansManager.isInClan(player) && _clansManager.getClan(player).getClansPlayerFromName(player.getName()).getRole().has(ClanRole.ADMIN))
|
|
||||||
{
|
|
||||||
finishTask(player, "Create a clan");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, 20L);
|
|
||||||
}
|
|
||||||
}, 80L);
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
|
||||||
public void onClanCreated(ClanCreatedEvent event)
|
|
||||||
{
|
|
||||||
if (event.getFounder() == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isInTutorial(event.getFounder()) && get(event.getFounder()).hasFinishedTask(getTask("Welcome")) && !get(event.getFounder()).hasFinishedTask(getTask("Create a clan")))
|
|
||||||
{
|
|
||||||
finishTask(event.getFounder(), "Create a clan");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
|
||||||
public void onClanJoined(ClanJoinEvent event)
|
|
||||||
{
|
|
||||||
if (event.getPlayer() == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isInTutorial(event.getPlayer()) && get(event.getPlayer()).hasFinishedTask(getTask("Welcome")) && !get(event.getPlayer()).hasFinishedTask(getTask("Create a clan")))
|
|
||||||
{
|
|
||||||
finishTask(event.getPlayer(), "Create a clan");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
|
||||||
public void handlePlayerChat(AsyncPlayerChatEvent event)
|
|
||||||
{
|
|
||||||
for (TutorialClient player : _inTutorial.values())
|
|
||||||
{
|
|
||||||
if (event.getPlayer().equals(player.getPlayer()))
|
|
||||||
{
|
|
||||||
event.setCancelled(true);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
event.getRecipients().remove(player.getPlayer());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
|
||||||
public void onClansCommand(ClansCommandExecutedEvent event)
|
|
||||||
{
|
|
||||||
if (event.getCommand().equals("info"))
|
|
||||||
{
|
|
||||||
if (isInTutorial(event.getPlayer()) && get(event.getPlayer()).hasFinishedTask(getTask("Create a clan")) && !get(event.getPlayer()).hasFinishedTask(getTask("Viewing Clan Details")))
|
|
||||||
{
|
|
||||||
finishTask(event.getPlayer(), "Viewing Clan Details");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (event.getCommand().equals("claim"))
|
|
||||||
{
|
|
||||||
if (isInTutorial(event.getPlayer()) && get(event.getPlayer()).hasFinishedTask(getTask("Go To The Wilderness")) && !get(event.getPlayer()).hasFinishedTask(getTask("Claiming Territory")))
|
|
||||||
{
|
|
||||||
finishTask(event.getPlayer(), "Claim some Territory");
|
|
||||||
event.getPlayer().teleport(Spawn.getNorthTown());
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
|
||||||
public void onSethome(ClanSetHomeEvent event)
|
|
||||||
{
|
|
||||||
if (isInTutorial(event.getPlayer()) && get(event.getPlayer()).hasFinishedTask(getTask("Claim some Territory")) && !get(event.getPlayer()).hasFinishedTask(getTask("Set Clan Home")))
|
|
||||||
{
|
|
||||||
finishTask(event.getPlayer(), "Set Clan Home");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
|
||||||
public void onTerritory(final PlayerEnterTerritoryEvent event)
|
|
||||||
{
|
|
||||||
final Player player = event.getPlayer();
|
|
||||||
final String newTerritory = event.getNewTerritory();
|
|
||||||
|
|
||||||
if (isInTutorial(player) && newTerritory.contains("Spawn") && get(player).hasFinishedTask(getTask("Viewing Clan Details")) && !get(player).hasFinishedTask(getTask("Leave Spawn Islands")))
|
|
||||||
{
|
|
||||||
finishTask(player, "Leave Spawn Islands");
|
|
||||||
}
|
|
||||||
else if (isInTutorial(player) && newTerritory.contains("Wilderness") && get(player).hasFinishedTask(getTask("Leave Spawn Islands")) && !get(player).hasFinishedTask(getTask("Go To The Wilderness")))
|
|
||||||
{
|
|
||||||
finishTask(player, "Go To The Wilderness");
|
|
||||||
}
|
|
||||||
else if (isInTutorial(player) && newTerritory.contains("Shops") && get(player).hasFinishedTask(getTask("Claim some Territory")) && !get(player).hasFinishedTask(getTask("Explore the Shops")))
|
|
||||||
{
|
|
||||||
finishTask(player, "Explore the Shops");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
|
||||||
public void onSkillTriggered(final SkillTriggerEvent event)
|
|
||||||
{
|
|
||||||
final Player player = event.GetPlayer();
|
|
||||||
|
|
||||||
if (isInTutorial(player) && get(player).hasFinishedTask(getTask("Equip a Class")) && !get(player).hasFinishedTask(getTask("Use a Class Ability")))
|
|
||||||
{
|
|
||||||
finishTask(player, "Use a Class Ability");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
|
||||||
public void onUpdated(final UpdateEvent event)
|
|
||||||
{
|
|
||||||
for (Player player : UtilServer.getPlayers())
|
|
||||||
{
|
|
||||||
if (!isInTutorial(player))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
ClientClass client = _clansManager.getClassManager().Get(player);
|
|
||||||
|
|
||||||
if (client == null)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (client.GetGameClass() == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isInTutorial(player) && get(player).hasFinishedTask(getTask("Explore the Shops")) && !get(player).hasFinishedTask(getTask("Equip a Class")))
|
|
||||||
{
|
|
||||||
finishTask(player, "Use a Class Ability");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
|
||||||
public void onUpdate(final UpdateEvent event)
|
|
||||||
{
|
|
||||||
if (!event.getType().equals(UpdateType.SEC))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (final TutorialClient client : _inTutorial.values())
|
|
||||||
{
|
|
||||||
if (isInTutorial(client.getPlayer()))
|
|
||||||
{
|
|
||||||
client.getPlayer().setPlayerTime(6000, false);
|
|
||||||
|
|
||||||
if (get(client.getPlayer()).hasFinishedTask(getTask("Equip a Class")) && !get(client.getPlayer()).hasFinishedTask(getTask("Class Customization")))
|
|
||||||
{
|
|
||||||
final ClientClass clientclass = _clansManager.getClassManager().Get(client.getPlayer());
|
|
||||||
|
|
||||||
if (clientclass != null && clientclass.GetSavingCustomBuild() != null)
|
|
||||||
{
|
|
||||||
finishTask(client.getPlayer(), "Class Customization");
|
|
||||||
client.getPlayer().getInventory().addItem(new ItemStack(Material.CARROT_ITEM, 5));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
|
||||||
public void onDeletedClan(final ClanDisbandedEvent event)
|
|
||||||
{
|
|
||||||
if (isInTutorial(event.getDisbander()) && get(event.getDisbander()).hasFinishedTask(getTask("Making Money (Farming)")) && !get(event.getDisbander()).hasFinishedTask(getTask("Disband your Clan")))
|
|
||||||
{
|
|
||||||
finishTask(event.getDisbander(), "Disband your Clan");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -3,9 +3,12 @@ package mineplex.game.clans.world;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.Item;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
@ -38,8 +41,24 @@ public class WorldManager extends MiniPlugin
|
|||||||
for (Entity ent : world.getEntities())
|
for (Entity ent : world.getEntities())
|
||||||
{
|
{
|
||||||
if (ent.getCustomName() == null)
|
if (ent.getCustomName() == null)
|
||||||
|
{
|
||||||
|
boolean cull = true;
|
||||||
|
|
||||||
|
for (Player player : world.getPlayers())
|
||||||
|
{
|
||||||
|
if (player.getLocation().distance(ent.getLocation()) <= 64)
|
||||||
|
{
|
||||||
|
cull = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cull)
|
||||||
|
{
|
||||||
_ents.get(ent.getType()).add(ent);
|
_ents.get(ent.getType()).add(ent);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (EntityType type : _ents.keySet())
|
for (EntityType type : _ents.keySet())
|
||||||
{
|
{
|
||||||
|
@ -17,9 +17,11 @@ import mineplex.core.common.util.C;
|
|||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.NautHashMap;
|
import mineplex.core.common.util.NautHashMap;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.core.donation.Donor;
|
import mineplex.core.donation.Donor;
|
||||||
import mineplex.core.itemstack.ItemStackFactory;
|
import mineplex.core.itemstack.ItemStackFactory;
|
||||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
||||||
|
import mineplex.minecraft.game.classcombat.Class.event.ClassEquipEvent;
|
||||||
import mineplex.minecraft.game.classcombat.Class.repository.token.ClientClassToken;
|
import mineplex.minecraft.game.classcombat.Class.repository.token.ClientClassToken;
|
||||||
import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken;
|
import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken;
|
||||||
import mineplex.minecraft.game.classcombat.Class.repository.token.SlotToken;
|
import mineplex.minecraft.game.classcombat.Class.repository.token.SlotToken;
|
||||||
@ -344,6 +346,15 @@ public class ClientClass
|
|||||||
|
|
||||||
ResetToDefaults(!skillsOnly, !skillsOnly);
|
ResetToDefaults(!skillsOnly, !skillsOnly);
|
||||||
|
|
||||||
|
// Event
|
||||||
|
ClassEquipEvent event = new ClassEquipEvent(this, customBuild);
|
||||||
|
UtilServer.getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
|
if (event.isCancelled())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (notify)
|
if (notify)
|
||||||
{
|
{
|
||||||
ListSkills(_client.GetPlayer());
|
ListSkills(_client.GetPlayer());
|
||||||
|
@ -5,8 +5,10 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
|
|
||||||
import mineplex.core.common.util.Callback;
|
import mineplex.core.common.util.Callback;
|
||||||
import mineplex.core.common.util.UtilGear;
|
import mineplex.core.common.util.UtilGear;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.core.gadget.types.GadgetType;
|
import mineplex.core.gadget.types.GadgetType;
|
||||||
import mineplex.core.itemstack.ItemStackFactory;
|
import mineplex.core.itemstack.ItemStackFactory;
|
||||||
|
import mineplex.minecraft.game.classcombat.Class.event.ClassEquipEvent;
|
||||||
import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken;
|
import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken;
|
||||||
import mineplex.minecraft.game.classcombat.Skill.ISkill;
|
import mineplex.minecraft.game.classcombat.Skill.ISkill;
|
||||||
|
|
||||||
|
@ -0,0 +1,57 @@
|
|||||||
|
package mineplex.minecraft.game.classcombat.Class.event;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
|
import mineplex.minecraft.game.classcombat.Class.ClientClass;
|
||||||
|
import mineplex.minecraft.game.classcombat.Class.PvpClass;
|
||||||
|
import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken;
|
||||||
|
|
||||||
|
public class ClassEquipEvent extends Event
|
||||||
|
{
|
||||||
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
|
||||||
|
private ClientClass _client;
|
||||||
|
|
||||||
|
private CustomBuildToken _build;
|
||||||
|
|
||||||
|
private boolean _cancelled;
|
||||||
|
|
||||||
|
public ClassEquipEvent(ClientClass client, CustomBuildToken build)
|
||||||
|
{
|
||||||
|
_client = client;
|
||||||
|
_build = build;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClientClass getPlayer()
|
||||||
|
{
|
||||||
|
return _client;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CustomBuildToken getBuild()
|
||||||
|
{
|
||||||
|
return _build;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCancelled(boolean cancelled)
|
||||||
|
{
|
||||||
|
_cancelled = cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCancelled()
|
||||||
|
{
|
||||||
|
return _cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HandlerList getHandlers()
|
||||||
|
{
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList()
|
||||||
|
{
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -172,6 +172,7 @@ public class BlockToss extends SkillCharge implements IThrown
|
|||||||
|
|
||||||
//Block to Item
|
//Block to Item
|
||||||
FallingBlock block = player.getWorld().spawnFallingBlock(player.getEyeLocation(), event.getClickedBlock().getType(), event.getClickedBlock().getData());
|
FallingBlock block = player.getWorld().spawnFallingBlock(player.getEyeLocation(), event.getClickedBlock().getType(), event.getClickedBlock().getData());
|
||||||
|
block.setDropItem(false);
|
||||||
|
|
||||||
//Action
|
//Action
|
||||||
player.eject();
|
player.eject();
|
||||||
@ -280,6 +281,7 @@ public class BlockToss extends SkillCharge implements IThrown
|
|||||||
FallingBlock thrown = (FallingBlock) data.GetThrown();
|
FallingBlock thrown = (FallingBlock) data.GetThrown();
|
||||||
|
|
||||||
FallingBlock newThrown = data.GetThrown().getWorld().spawnFallingBlock(data.GetThrown().getLocation(), thrown.getMaterial(), thrown.getBlockData());
|
FallingBlock newThrown = data.GetThrown().getWorld().spawnFallingBlock(data.GetThrown().getLocation(), thrown.getMaterial(), thrown.getBlockData());
|
||||||
|
newThrown.setDropItem(false);
|
||||||
|
|
||||||
//Remove Old
|
//Remove Old
|
||||||
_falling.remove(thrown);
|
_falling.remove(thrown);
|
||||||
|
@ -374,7 +374,7 @@ public class ConditionEffect implements Listener
|
|||||||
for (LivingEntity ent : Manager.GetActiveConditions().keySet())
|
for (LivingEntity ent : Manager.GetActiveConditions().keySet())
|
||||||
{
|
{
|
||||||
Condition condition = Manager.GetActiveCondition(ent, ConditionType.POISON_SHOCK);
|
Condition condition = Manager.GetActiveCondition(ent, ConditionType.POISON_SHOCK);
|
||||||
if (condition == null)
|
if (condition == null || condition.GetSource() == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Manager.getDamagerManager().NewDamageEvent(ent, condition.GetSource(), null,
|
Manager.getDamagerManager().NewDamageEvent(ent, condition.GetSource(), null,
|
||||||
|
Loading…
Reference in New Issue
Block a user