Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex

This commit is contained in:
Jonathan Williams 2015-11-29 02:24:32 -06:00
commit 782026556e
10 changed files with 123 additions and 69 deletions

View File

@ -505,12 +505,12 @@ public class UtilItem
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)
{
return material == null ? false : (_materials.get(material).contains(ItemCategory.EDIBLE));
return material == null ? false : (contains(material, ItemCategory.EDIBLE));
}
public static boolean isEdible(ItemStack stack)
@ -520,7 +520,7 @@ public class UtilItem
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)
@ -530,7 +530,7 @@ public class UtilItem
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)
@ -540,7 +540,7 @@ public class UtilItem
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)
@ -550,7 +550,7 @@ public class UtilItem
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)
@ -560,7 +560,7 @@ public class UtilItem
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)
@ -570,7 +570,7 @@ public class UtilItem
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)
@ -580,7 +580,7 @@ public class UtilItem
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)
@ -590,7 +590,7 @@ public class UtilItem
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)
@ -600,7 +600,7 @@ public class UtilItem
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)
@ -620,7 +620,7 @@ public class UtilItem
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)
@ -630,7 +630,7 @@ public class UtilItem
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)
@ -640,7 +640,7 @@ public class UtilItem
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)
@ -650,7 +650,7 @@ public class UtilItem
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)
@ -660,7 +660,7 @@ public class UtilItem
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)
@ -670,7 +670,7 @@ public class UtilItem
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)
@ -680,7 +680,7 @@ public class UtilItem
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)
@ -690,7 +690,7 @@ public class UtilItem
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)
@ -700,7 +700,7 @@ public class UtilItem
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)
@ -710,7 +710,7 @@ public class UtilItem
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)
@ -720,7 +720,7 @@ public class UtilItem
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)
@ -730,7 +730,7 @@ public class UtilItem
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)
@ -740,7 +740,7 @@ public class UtilItem
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)
@ -750,7 +750,7 @@ public class UtilItem
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)
@ -760,7 +760,7 @@ public class UtilItem
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)
@ -770,7 +770,7 @@ public class UtilItem
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)
@ -780,7 +780,7 @@ public class UtilItem
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)
@ -790,7 +790,7 @@ public class UtilItem
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)
@ -800,7 +800,7 @@ public class UtilItem
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)
@ -820,7 +820,7 @@ public class UtilItem
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)
@ -830,7 +830,7 @@ public class UtilItem
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)
@ -840,7 +840,7 @@ public class UtilItem
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)
@ -850,7 +850,7 @@ public class UtilItem
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)
@ -870,7 +870,7 @@ public class UtilItem
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)
@ -880,7 +880,7 @@ public class UtilItem
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)
@ -890,7 +890,7 @@ public class UtilItem
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)
@ -900,7 +900,7 @@ public class UtilItem
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)
@ -920,7 +920,7 @@ public class UtilItem
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)
@ -928,6 +928,12 @@ public class UtilItem
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)
{
List<ItemCategory> attributes = new ArrayList<>(attr.length);

View File

@ -1,10 +1,13 @@
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;
@ -18,7 +21,19 @@ public class RestartTutCommand extends CommandBase<TutorialManager>
@Override
public void Execute(Player caller, String[] args)
{
TaskManager.Instance.Get(caller).TasksCompleted.clear();
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);
}

View File

@ -50,6 +50,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener
{
public static String TASK_COMPLETE_TASK = "tttatatta%sTask%s";
public static String TUTORIAL_COMPLETE_TASK = "tatatatatat%sDone"; //do not change
public static String TUTORIAL_REWARD_TASK = "tatatatatat%sRewardGiven"; //do not change
public static String SKIPPED_TASK = "tatatatata%sSkip";
protected final TutorialManager _manager;
@ -226,11 +227,13 @@ public abstract class Tutorial implements ScoreboardElement, Listener
UtilFirework.launchFirework(player.getLocation(), Type.BALL_LARGE, Color.LIME, false, false, new Vector(0, 0, 0), 1);
onFinished(player);
if (!_taskManager.hasCompletedTask(player, String.format(TUTORIAL_COMPLETE_TASK, _technicalName)))
if (!_taskManager.hasCompletedTask(player, String.format(TUTORIAL_REWARD_TASK, _technicalName)))
{
_taskManager.completedTask(new Callback<Boolean>()
{
public void run(final Boolean completed)
@Override
public void run(Boolean data)
{
if (_goldReward != -1)
{
@ -257,7 +260,17 @@ public abstract class Tutorial implements ScoreboardElement, Listener
}
}, "Clans", player.getName(), _clansManager.getClientManager().getAccountId(player), _coinReward);
}
}
}, player, String.format(TUTORIAL_REWARD_TASK, _technicalName));
}
if (!_taskManager.hasCompletedTask(player, String.format(TUTORIAL_COMPLETE_TASK, _technicalName)))
{
_taskManager.completedTask(new Callback<Boolean>()
{
public void run(final Boolean completed)
{
if (_ghostMode)
{
for (Player other : UtilServer.getPlayers())

View File

@ -22,8 +22,8 @@ public class TaskCustomizeClass extends TutorialTask<TutorialGettingStarted>
_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.";
_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

View File

@ -28,9 +28,9 @@ public class TaskEquipClass extends TutorialTask<TutorialGettingStarted>
_displayName = "Equip a Class";
_technicalName = "AuszustattenKlasse";
_description = "Use the PvP Gear shop, and Right-Click the Villager. "
_description = "Use the PvP Gear shop, and right-click the Villager. "
+ "Purchase Iron Armor from the PvP Shop. "
+ "Then put on your Armor to equip a Champions Class.";
+ "Then put on your armor to equip a Champions Class.";
}
@Override

View File

@ -21,7 +21,7 @@ public class TaskGoToWilderness extends TutorialTask<TutorialGettingStarted>
_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 by Left and Right Clicking!";
+ "You can zoom in/out on our map by left and right clicking!";
}
@Override

View File

@ -3,14 +3,22 @@ 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;
@ -24,7 +32,7 @@ public class TaskUseAbility extends TutorialTask<TutorialGettingStarted>
_displayName = "Use a Class Ability";
_technicalName = "KlassAbilityUsage";
_description = "Now that you have Equipped a Class, you can start using Abilities. "
_description = "Now that you have equipped a class, you can start using abilities. "
+ "Purchase an Iron Axe from the PvP Shop. "
+ "Right-Click with your Iron Axe to use your Axe Ability!";
}
@ -38,12 +46,25 @@ public class TaskUseAbility extends TutorialTask<TutorialGettingStarted>
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)
{

View File

@ -17,9 +17,9 @@ public class TaskViewClanDetails extends TutorialTask<TutorialGettingStarted>
_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 Clans name to get some information about them as well.";
_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

View File

@ -35,8 +35,8 @@ public class TutorialGettingStarted extends Tutorial
addTask(new TaskSetHome(this, ++id));
addTask(new TaskExploreShops(this, ++id));
addTask(new TaskEquipClass(this, ++id));
addTask(new TaskUseAbility(this, ++id));
addTask(new TaskCustomizeClass(this, ++id));
addTask(new TaskUseAbility(this, ++id));
addTask(new TaskMakingMoney(this, ++id));
addTask(new TaskDisbandClan(this, ++id));
@ -57,8 +57,8 @@ public class TutorialGettingStarted extends Tutorial
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 {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.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();
@ -75,8 +75,7 @@ public class TutorialGettingStarted extends Tutorial
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 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! "
+ "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 + "---------------------------------------------");

View File

@ -170,10 +170,9 @@ public class BlockToss extends SkillCharge implements IThrown
return;
}
event.getClickedBlock().setType(Material.AIR);
//Block to Item
FallingBlock block = player.getWorld().spawnFallingBlock(player.getEyeLocation(), event.getClickedBlock().getType(), event.getClickedBlock().getData());
block.setDropItem(false);
//Action
player.eject();
@ -282,6 +281,7 @@ public class BlockToss extends SkillCharge implements IThrown
FallingBlock thrown = (FallingBlock) data.GetThrown();
FallingBlock newThrown = data.GetThrown().getWorld().spawnFallingBlock(data.GetThrown().getLocation(), thrown.getMaterial(), thrown.getBlockData());
newThrown.setDropItem(false);
//Remove Old
_falling.remove(thrown);