tutorial revamp 2.0
This commit is contained in:
parent
e1be0b1dbd
commit
9ff9724fc8
@ -239,3 +239,4 @@ public class MorphTitan extends MorphGadget
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
@ -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
|
||||||
{
|
{
|
||||||
|
@ -12,7 +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.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;
|
||||||
@ -116,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);
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
@ -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(0, TimeUnit.MINUTES, TimeUnit.MILLISECONDS);
|
||||||
|
|
||||||
public StuckManager(ClansManager clans)
|
public StuckManager(ClansManager clans)
|
||||||
{
|
{
|
||||||
|
@ -80,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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,12 +29,12 @@ public class PvpItem extends ShopItem
|
|||||||
super(type, data, name, new String[] {
|
super(type, data, name, new String[] {
|
||||||
C.cWhite + " ",
|
C.cWhite + " ",
|
||||||
LEFT_CLICK_BUY,
|
LEFT_CLICK_BUY,
|
||||||
C.cWhite + "Costs " + C.cGreen + buyPrice + "g",
|
C.cWhite + "Costs " + C.cGreen + (buyPrice == 0 ? "Free" : buyPrice + "g"),
|
||||||
C.cWhite + " ",
|
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.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 + " ",
|
UtilItem.isArmor(type) || UtilItem.isTool(type) ? "" : C.cWhite + "Costs " + C.cGreen + (buyPrice * bulkCount) + "g", C.cWhite + " ",
|
||||||
RIGHT_CLICK_SELL,
|
RIGHT_CLICK_SELL,
|
||||||
C.cWhite + "Earns " + C.cGreen + sellPrice + "g",
|
C.cWhite + "Earns " + C.cGreen + (sellPrice == 0 ? "Free" : sellPrice + ""),
|
||||||
C.cWhite + " ",
|
C.cWhite + " ",
|
||||||
C.cYellow + "Shift Right-Click" + C.cWhite + " to Sell " + C.cGreen + "All",
|
C.cYellow + "Shift Right-Click" + C.cWhite + " to Sell " + C.cGreen + "All",
|
||||||
}, 0, false, false);
|
}, 0, false, false);
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
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;
|
||||||
@ -25,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
|
||||||
|
@ -16,6 +16,7 @@ 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.ClansShopAddButtonEvent;
|
||||||
|
import mineplex.game.clans.clans.event.EnergyPageBuildEvent;
|
||||||
|
|
||||||
public class EnergyPage extends ShopPageBase<ClanEnergyManager, EnergyShop>
|
public class EnergyPage extends ShopPageBase<ClanEnergyManager, EnergyShop>
|
||||||
{
|
{
|
||||||
@ -46,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)
|
||||||
@ -65,31 +70,17 @@ 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";
|
||||||
|
|
||||||
ClansShopAddButtonEvent event = new ClansShopAddButtonEvent(getPlayer(), getShop(), slot, material, getPlugin().convertEnergyToGold(energyAmount), 01, data, itemName, energyAmount);
|
|
||||||
UtilServer.getServer().getPluginManager().callEvent(event);
|
|
||||||
|
|
||||||
if (event.isCancelled())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
itemName = event.getDisplayName();
|
|
||||||
int buyPrice = event.getBuyPrice();
|
|
||||||
slot = event.getSlot();
|
|
||||||
material = event.getMaterial();
|
|
||||||
data = event.getData();
|
|
||||||
|
|
||||||
ShopItem shopItem = new ShopItem(material, itemName, lore, 1, locked, false);
|
ShopItem shopItem = new ShopItem(material, itemName, lore, 1, locked, false);
|
||||||
|
|
||||||
if (locked)
|
if (locked)
|
||||||
setItem(slot, shopItem);
|
setItem(slot, shopItem);
|
||||||
else
|
else
|
||||||
addButton(slot, shopItem, new EnergyShopButton(getPlugin(), this, energyAmount, clanInfo, buyPrice));
|
addButton(slot, shopItem, new EnergyShopButton(getPlugin(), this, energyAmount, clanInfo, free ? 0 : getPlugin().convertEnergyToGold(energyAmount)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildNoClan()
|
private void buildNoClan()
|
||||||
|
@ -23,6 +23,11 @@ public class DeployedTask implements Listener
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean checkForDeath()
|
||||||
|
{
|
||||||
|
return _dead || _player == null;
|
||||||
|
}
|
||||||
|
|
||||||
public void finish()
|
public void finish()
|
||||||
{
|
{
|
||||||
onFinish();
|
onFinish();
|
||||||
@ -36,7 +41,6 @@ public class DeployedTask implements Listener
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onFinish() {
|
public void onFinish() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
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.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -15,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;
|
||||||
@ -28,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;
|
||||||
@ -36,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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -47,9 +48,9 @@ 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 = "tutori%sTask%s";
|
public static String TASK_COMPLETE_TASK = "tutorialboughtought%sTask%s";
|
||||||
public static String TUTORIAL_COMPLETE_TASK = "tutori%sDone";
|
public static String TUTORIAL_COMPLETE_TASK = "tutorialboughtought%sDone"; //do not change
|
||||||
public static String SKIPPED_TASK = "tutori%sSkip";
|
public static String SKIPPED_TASK = "tutorialboughtought%sSkip";
|
||||||
|
|
||||||
protected final TutorialManager _manager;
|
protected final TutorialManager _manager;
|
||||||
protected final GoldManager _goldManager;
|
protected final GoldManager _goldManager;
|
||||||
@ -111,7 +112,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
|||||||
|
|
||||||
final TutorialClient client = _inTutorial.get(player.getName());
|
final TutorialClient client = _inTutorial.get(player.getName());
|
||||||
|
|
||||||
lines.add(C.cAqua + _displayName + " Tutorial");
|
lines.add(C.cAqua + "Tutorial");
|
||||||
|
|
||||||
for (final TutorialTask<?> task : _tasks.values())
|
for (final TutorialTask<?> task : _tasks.values())
|
||||||
{
|
{
|
||||||
@ -172,7 +173,6 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
|||||||
}, 10L);
|
}, 10L);
|
||||||
}
|
}
|
||||||
|
|
||||||
UtilPlayer.message(player, F.main("Tutorials", "You have completed Task " + F.elem(task.getID() + ": " + task.getDisplayName()) + ". " + (_tasks.size() - task.getID()) + " task" + (UtilText.plural(_tasks.size() - task.getID()) ? "s" : "") + " to go!"));
|
|
||||||
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, _technicalName, task.getTechnicalName()));
|
}, player, String.format(TASK_COMPLETE_TASK, _technicalName, task.getTechnicalName()));
|
||||||
@ -327,7 +327,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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -378,9 +378,13 @@ 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 "
|
||||||
))
|
))
|
||||||
.click(ClickEvent.RUN_COMMAND, "/yesiconfirmiwanttoskip")
|
.extra("here")
|
||||||
|
.color("aqua")
|
||||||
|
.click(ClickEvent.RUN_COMMAND, "/yesiconfirmiwanttoskip")
|
||||||
|
.extra(" here to confirm you want to skip the tutorial!")
|
||||||
|
.color("gray")
|
||||||
|
|
||||||
.sendToPlayer(player);
|
.sendToPlayer(player);
|
||||||
}
|
}
|
||||||
@ -406,6 +410,15 @@ 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)
|
||||||
{
|
{
|
||||||
@ -422,6 +435,27 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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)
|
||||||
@ -443,7 +477,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
|||||||
|
|
||||||
public void cleanup(Player player)
|
public void cleanup(Player player)
|
||||||
{
|
{
|
||||||
get(player).CurrentTask.cleanup(player);
|
if (get(player).CurrentTask != null) get(player).CurrentTask.cleanup(player);
|
||||||
_inTutorial.remove(player.getName());
|
_inTutorial.remove(player.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ public class TutorialClient
|
|||||||
{
|
{
|
||||||
public Player Player;
|
public Player Player;
|
||||||
public TutorialTask<?> CurrentTask;
|
public TutorialTask<?> CurrentTask;
|
||||||
public long LastDescriptionSentTime = 0;
|
public long LastDescriptionSentTime = System.currentTimeMillis() - 3000;
|
||||||
|
|
||||||
public TutorialClient(Player player, Tutorial tutorial)
|
public TutorialClient(Player player, Tutorial tutorial)
|
||||||
{
|
{
|
||||||
|
@ -2,17 +2,20 @@ package mineplex.game.clans.tutorials;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
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.HandlerList;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.common.util.UtilServer;
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.core.common.util.UtilText;
|
import mineplex.core.updater.UpdateType;
|
||||||
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
|
||||||
public class TutorialTask<T extends Tutorial> implements Listener
|
public class TutorialTask<T extends Tutorial> implements Listener
|
||||||
{
|
{
|
||||||
@ -31,6 +34,7 @@ public class TutorialTask<T extends Tutorial> implements Listener
|
|||||||
private List<String> _playersFinished = new ArrayList<>();
|
private List<String> _playersFinished = new ArrayList<>();
|
||||||
|
|
||||||
private Map<String, DeployedTask> _deployedInstances = new HashMap<>();
|
private Map<String, DeployedTask> _deployedInstances = new HashMap<>();
|
||||||
|
private List<DeployedTask> _toCull = new ArrayList<>();
|
||||||
|
|
||||||
private int _id;
|
private int _id;
|
||||||
|
|
||||||
@ -81,9 +85,15 @@ public class TutorialTask<T extends Tutorial> implements Listener
|
|||||||
|
|
||||||
if (System.currentTimeMillis() - client.LastDescriptionSentTime > client.CurrentTask.getDescriptionWaitTime())
|
if (System.currentTimeMillis() - client.LastDescriptionSentTime > client.CurrentTask.getDescriptionWaitTime())
|
||||||
{
|
{
|
||||||
UtilPlayer.message(player, C.cGreen + "==== Pt." + client.CurrentTask.getID() + ": " + client.CurrentTask.getDisplayName() + " ====");
|
UtilPlayer.message(player, " ");
|
||||||
UtilPlayer.message(player, C.cYellow + client.CurrentTask.getDescription().replace("{", C.cAqua).replace("}", C.cYellow));
|
UtilPlayer.message(player, " ");
|
||||||
UtilPlayer.message(player, C.cGreen + UtilText.repeat("=", client.CurrentTask.getDisplayName().length() + ("=== Pt." + client.CurrentTask.getID() + ": ===").length()));
|
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();
|
client.LastDescriptionSentTime = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -136,20 +146,46 @@ public class TutorialTask<T extends Tutorial> implements Listener
|
|||||||
public void visibleFinish(Player player)
|
public void visibleFinish(Player player)
|
||||||
{
|
{
|
||||||
_deployedInstances.get(player.getName()).kill();
|
_deployedInstances.get(player.getName()).kill();
|
||||||
HandlerList.unregisterAll(_deployedInstances.get(player.getName()));
|
_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)
|
public void cleanup(Player player)
|
||||||
{
|
{
|
||||||
_deployedInstances.get(player.getName()).kill();
|
_deployedInstances.get(player.getName()).kill();
|
||||||
_deployedInstances.remove(player.getName());
|
_toCull.add(_deployedInstances.get(player.getName()));
|
||||||
_playersFinished.remove(player.getName());
|
_playersFinished.remove(player.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,8 +23,6 @@ public class TaskClaim extends TutorialTask<TutorialGettingStarted>
|
|||||||
+ "This is the perfect place to build a base and stash your items! "
|
+ "This is the perfect place to build a base and stash your items! "
|
||||||
+ "You can only claim in the Wilderness, and not next to other Clans Territory. "
|
+ "You can only claim in the Wilderness, and not next to other Clans Territory. "
|
||||||
+ "Claim some Territory now, by typing {/c claim}!";
|
+ "Claim some Territory now, by typing {/c claim}!";
|
||||||
|
|
||||||
_finishMessage = "Good job! We won't actually claim this Territory yet!";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package mineplex.game.clans.tutorials.gettingstarted;
|
package mineplex.game.clans.tutorials.gettingstarted;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@ -7,6 +8,7 @@ import org.bukkit.event.EventPriority;
|
|||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
|
import mineplex.game.clans.spawn.Spawn;
|
||||||
import mineplex.game.clans.tutorials.DeployedTask;
|
import mineplex.game.clans.tutorials.DeployedTask;
|
||||||
import mineplex.game.clans.tutorials.TutorialTask;
|
import mineplex.game.clans.tutorials.TutorialTask;
|
||||||
import mineplex.minecraft.game.classcombat.Class.ClientClass;
|
import mineplex.minecraft.game.classcombat.Class.ClientClass;
|
||||||
@ -20,9 +22,8 @@ public class TaskCustomizeClass extends TutorialTask<TutorialGettingStarted>
|
|||||||
_displayName = "Customize Class";
|
_displayName = "Customize Class";
|
||||||
_technicalName = "CustomizeKlass";
|
_technicalName = "CustomizeKlass";
|
||||||
|
|
||||||
_description = "Now that you have Equipped a Class, you can start using Abilities. "
|
_description = "Now that you have Equipped a Class, use this enchantment table to customize your Class Builds. "
|
||||||
+ "Purchase an Iron Axe from the PvP Shop. (FREE) "
|
+ "Click on the enchantment table, and click the Edit Build button.";
|
||||||
+ "Right-Click with your Iron Axe to use your Axe Ability!";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -38,6 +39,12 @@ public class TaskCustomizeClass extends TutorialTask<TutorialGettingStarted>
|
|||||||
super(player, task);
|
super(player, task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void postDeploy()
|
||||||
|
{
|
||||||
|
_player.teleport(new Location(Spawn.getSpawnWorld(), 6, 66, -300, -180f, 0f));
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onUpdate(final UpdateEvent event)
|
public void onUpdate(final UpdateEvent event)
|
||||||
{
|
{
|
||||||
@ -46,6 +53,11 @@ public class TaskCustomizeClass extends TutorialTask<TutorialGettingStarted>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (checkForDeath())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final ClientClass clientclass = ClansManager.getInstance().getClassManager().Get(_player);
|
final ClientClass clientclass = ClansManager.getInstance().getClassManager().Get(_player);
|
||||||
|
|
||||||
if (clientclass != null && clientclass.GetSavingCustomBuild() != null)
|
if (clientclass != null && clientclass.GetSavingCustomBuild() != null)
|
||||||
|
@ -3,6 +3,7 @@ package mineplex.game.clans.tutorials.gettingstarted;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -13,6 +14,7 @@ import mineplex.core.task.TaskManager;
|
|||||||
import mineplex.game.clans.clans.ClansManager;
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
import mineplex.game.clans.clans.event.ClansPlayerBuyItemEvent;
|
import mineplex.game.clans.clans.event.ClansPlayerBuyItemEvent;
|
||||||
import mineplex.game.clans.clans.event.ClansShopAddButtonEvent;
|
import mineplex.game.clans.clans.event.ClansShopAddButtonEvent;
|
||||||
|
import mineplex.game.clans.spawn.Spawn;
|
||||||
import mineplex.game.clans.tutorials.DeployedTask;
|
import mineplex.game.clans.tutorials.DeployedTask;
|
||||||
import mineplex.game.clans.tutorials.TutorialTask;
|
import mineplex.game.clans.tutorials.TutorialTask;
|
||||||
import mineplex.minecraft.game.classcombat.Class.event.ClassEquipEvent;
|
import mineplex.minecraft.game.classcombat.Class.event.ClassEquipEvent;
|
||||||
@ -26,8 +28,8 @@ public class TaskEquipClass extends TutorialTask<TutorialGettingStarted>
|
|||||||
_displayName = "Equip a Class";
|
_displayName = "Equip a Class";
|
||||||
_technicalName = "AuszustattenKlasse";
|
_technicalName = "AuszustattenKlasse";
|
||||||
|
|
||||||
_description = "Find 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. (FREE) "
|
+ "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.";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,11 +48,15 @@ public class TaskEquipClass extends TutorialTask<TutorialGettingStarted>
|
|||||||
super(player, task);
|
super(player, task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void postDeploy()
|
||||||
|
{
|
||||||
|
_player.teleport(new Location(Spawn.getSpawnWorld(), 19.536, 66, -305.844, -100f, 0f));
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onClassEquipped(ClassEquipEvent event)
|
public void onClassEquipped(ClassEquipEvent event)
|
||||||
{
|
{
|
||||||
System.out.println(event.getPlayer());
|
|
||||||
System.out.println(ClansManager.getInstance().getClassManager().Get(_player));
|
|
||||||
if (!ClansManager.getInstance().getClassManager().Get(_player).equals(event.getPlayer()))
|
if (!ClansManager.getInstance().getClassManager().Get(_player).equals(event.getPlayer()))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -62,7 +68,7 @@ public class TaskEquipClass extends TutorialTask<TutorialGettingStarted>
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void button(ClansShopAddButtonEvent event)
|
public void button(ClansShopAddButtonEvent event)
|
||||||
{
|
{
|
||||||
if (_player.equals(event.getPlayer()))
|
if (!_player.equals(event.getPlayer()))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -72,7 +78,7 @@ public class TaskEquipClass extends TutorialTask<TutorialGettingStarted>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!TaskManager.Instance.hasCompletedTask(event.getPlayer(), "iboughtthis" + event.getMaterial().name()) && !_bought.contains(event.getMaterial()))
|
if (!TaskManager.Instance.hasCompletedTask(event.getPlayer(), "tutorialboughtought" + event.getMaterial().name()) && !_bought.contains(event.getMaterial()))
|
||||||
{
|
{
|
||||||
event.setBuyPrice(0);
|
event.setBuyPrice(0);
|
||||||
event.setSellPrice(0);
|
event.setSellPrice(0);
|
||||||
@ -103,7 +109,7 @@ public class TaskEquipClass extends TutorialTask<TutorialGettingStarted>
|
|||||||
public void run(Boolean data)
|
public void run(Boolean data)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}, event.getPlayer(), "iboughtthis" + event.getItem().getType().name());
|
}, event.getPlayer(), "tutorialboughtought" + event.getItem().getType().name());
|
||||||
_bought.add(event.getItem().getType());
|
_bought.add(event.getItem().getType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
package mineplex.game.clans.tutorials.gettingstarted;
|
package mineplex.game.clans.tutorials.gettingstarted;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
|
||||||
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.ClansShopAddButtonEvent;
|
import mineplex.game.clans.clans.event.EnergyPageBuildEvent;
|
||||||
import mineplex.game.clans.shop.energy.EnergyShop;
|
|
||||||
import mineplex.game.clans.spawn.Spawn;
|
import mineplex.game.clans.spawn.Spawn;
|
||||||
import mineplex.game.clans.tutorials.DeployedTask;
|
import mineplex.game.clans.tutorials.DeployedTask;
|
||||||
import mineplex.game.clans.tutorials.TutorialTask;
|
import mineplex.game.clans.tutorials.TutorialTask;
|
||||||
@ -22,8 +22,8 @@ public class TaskExploreShops extends TutorialTask<TutorialGettingStarted>
|
|||||||
_technicalName = "WillkommenZumGeschaft";
|
_technicalName = "WillkommenZumGeschaft";
|
||||||
|
|
||||||
_description = "Welcome to the Shops! Here you can buy all kinds of things that you may require during your adventure. "
|
_description = "Welcome to the Shops! Here you can buy all kinds of things that you may require during your adventure. "
|
||||||
+ "You can also sell certain items to the Villagers to make a bit of extra Gold."
|
+ "You can also sell certain items to the Villagers to make a bit of extra Gold. "
|
||||||
+ "Go to the Energy Shop and buy {7 Days} of Energy. (FREE)";
|
+ "Go to the Energy Shop and buy {Max Energy}. (FREE)";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -42,13 +42,13 @@ public class TaskExploreShops extends TutorialTask<TutorialGettingStarted>
|
|||||||
@Override
|
@Override
|
||||||
public void postDeploy()
|
public void postDeploy()
|
||||||
{
|
{
|
||||||
_player.teleport(Spawn.getNorthTownCenter());
|
_player.teleport(new Location(Spawn.getSpawnWorld(), 17, 66.5, -330, -180f, 0f));
|
||||||
|
|
||||||
ClansManager.getInstance().getClan(_player).adjustEnergy(-(ClansManager.getInstance().getClan(_player).getEnergyCostPerMinute() * 60));
|
ClansManager.getInstance().getClan(_player).adjustEnergy(-(ClansManager.getInstance().getClan(_player).getEnergyCostPerMinute() * 60));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onItemPut(ClansShopAddButtonEvent event)
|
public void onItemPut(EnergyPageBuildEvent event)
|
||||||
{
|
{
|
||||||
if (!_player.equals(event.getPlayer()))
|
if (!_player.equals(event.getPlayer()))
|
||||||
{
|
{
|
||||||
@ -62,13 +62,11 @@ public class TaskExploreShops extends TutorialTask<TutorialGettingStarted>
|
|||||||
|
|
||||||
if (ClansManager.getInstance().getClan(_player).getEnergyPurchasable() == 0)
|
if (ClansManager.getInstance().getClan(_player).getEnergyPurchasable() == 0)
|
||||||
{
|
{
|
||||||
|
_task.finishFor(_player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.getShop().getClass().equals(EnergyShop.class) && event.getDisplayName().contains("Energy"))
|
event.setFree(true);
|
||||||
{
|
|
||||||
event.setBuyPrice(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -37,17 +37,6 @@ public class TaskGoToWilderness extends TutorialTask<TutorialGettingStarted>
|
|||||||
super(player, task);
|
super(player, task);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void postDeploy()
|
|
||||||
{
|
|
||||||
if ((
|
|
||||||
ClansManager.getInstance().getClanUtility().getClaim(_player.getLocation()) == null
|
|
||||||
)
|
|
||||||
){
|
|
||||||
_task.finishFor(_player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onTerritory(final PlayerEnterTerritoryEvent event)
|
public void onTerritory(final PlayerEnterTerritoryEvent event)
|
||||||
{
|
{
|
||||||
|
@ -4,6 +4,8 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
|
|
||||||
|
import mineplex.core.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.event.PlayerEnterTerritoryEvent;
|
import mineplex.game.clans.clans.event.PlayerEnterTerritoryEvent;
|
||||||
import mineplex.game.clans.tutorials.DeployedTask;
|
import mineplex.game.clans.tutorials.DeployedTask;
|
||||||
@ -39,26 +41,26 @@ public class TaskLeaveSpawn extends TutorialTask<TutorialGettingStarted>
|
|||||||
@Override
|
@Override
|
||||||
public void postDeploy()
|
public void postDeploy()
|
||||||
{
|
{
|
||||||
if (ClansManager.getInstance().getClanUtility().getClaim(_player.getLocation()) == null
|
if (_player.getLocation().getY() < 100)
|
||||||
|| (
|
{
|
||||||
ClansManager.getInstance().getClanUtility().getClaim(_player.getLocation()) != null
|
|
||||||
&& !ClansManager.getInstance().getClanUtility().getClaim(_player.getLocation()).Owner.equals("Spawn")
|
|
||||||
)
|
|
||||||
){
|
|
||||||
_task.finishFor(_player);
|
_task.finishFor(_player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler
|
||||||
public void onTerritory(final PlayerEnterTerritoryEvent event)
|
public void update(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (!_player.equals(event.getPlayer()))
|
if (event.getType() != UpdateType.SEC)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.getNewTerritory().contains("Spawn"))
|
if (checkForDeath())
|
||||||
{
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_player.getLocation().getY() < 100){
|
||||||
_task.finishFor(_player);
|
_task.finishFor(_player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package mineplex.game.clans.tutorials.gettingstarted;
|
package mineplex.game.clans.tutorials.gettingstarted;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -7,6 +8,7 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
import mineplex.game.clans.clans.event.ClansPlayerSellItemEvent;
|
import mineplex.game.clans.clans.event.ClansPlayerSellItemEvent;
|
||||||
|
import mineplex.game.clans.spawn.Spawn;
|
||||||
import mineplex.game.clans.tutorials.DeployedTask;
|
import mineplex.game.clans.tutorials.DeployedTask;
|
||||||
import mineplex.game.clans.tutorials.TutorialTask;
|
import mineplex.game.clans.tutorials.TutorialTask;
|
||||||
|
|
||||||
@ -19,8 +21,8 @@ public class TaskMakingMoney extends TutorialTask<TutorialGettingStarted>
|
|||||||
_displayName = "Making Money (Farming)";
|
_displayName = "Making Money (Farming)";
|
||||||
_technicalName = "ImAFarmer";
|
_technicalName = "ImAFarmer";
|
||||||
|
|
||||||
_description = "We have given you a few Carrots, as a starter for your Farming career. "
|
_description = "We have given you a carrot to sell in the Organic Produce Shop. "
|
||||||
+ "Go to the Organic Produce Villager in one of the Shops, and sell the Carrots for Gold.";
|
+ "Click on the Villager, and {Right-Click} the carrot to sell your carrots in exchange for Gold.";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -31,10 +33,18 @@ public class TaskMakingMoney extends TutorialTask<TutorialGettingStarted>
|
|||||||
|
|
||||||
class Deployed extends DeployedTask
|
class Deployed extends DeployedTask
|
||||||
{
|
{
|
||||||
|
private int _carrotsSold;
|
||||||
|
|
||||||
public Deployed(Player player, TutorialTask<?> task)
|
public Deployed(Player player, TutorialTask<?> task)
|
||||||
{
|
{
|
||||||
super(player, task);
|
super(player, task);
|
||||||
player.getInventory().addItem(new ItemStack(Material.CARROT_ITEM, 5));
|
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
|
@EventHandler
|
||||||
|
@ -25,7 +25,7 @@ public class TaskUseAbility extends TutorialTask<TutorialGettingStarted>
|
|||||||
_technicalName = "KlassAbilityUsage";
|
_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. (FREE) "
|
+ "Purchase an Iron Axe from the PvP Shop. "
|
||||||
+ "Right-Click with your Iron Axe to use your Axe Ability!";
|
+ "Right-Click with your Iron Axe to use your Axe Ability!";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,13 +62,15 @@ public class TaskUseAbility extends TutorialTask<TutorialGettingStarted>
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
System.out.println(event.getDisplayName());
|
||||||
|
|
||||||
if (!event.getMaterial().equals(Material.IRON_AXE))
|
if (!event.getMaterial().equals(Material.IRON_AXE))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!TaskManager.Instance.hasCompletedTask(event.getPlayer(), "iboughtthis" + event.getMaterial().name()) && !_bought.contains(event.getMaterial()))
|
if (!TaskManager.Instance.hasCompletedTask(event.getPlayer(), "tutorialboughtought" + event.getMaterial().name()) && !_bought.contains(event.getMaterial()))
|
||||||
{
|
{
|
||||||
event.setBuyPrice(0);
|
event.setBuyPrice(0);
|
||||||
event.setSellPrice(0);
|
event.setSellPrice(0);
|
||||||
@ -99,7 +101,7 @@ public class TaskUseAbility extends TutorialTask<TutorialGettingStarted>
|
|||||||
public void run(Boolean data)
|
public void run(Boolean data)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}, event.getPlayer(), "iboughtthis" + event.getItem().getType().name());
|
}, event.getPlayer(), "tutorialboughtought" + event.getItem().getType().name());
|
||||||
_bought.add(event.getItem().getType());
|
_bought.add(event.getItem().getType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.common.util.UtilServer;
|
import mineplex.core.common.util.UtilServer;
|
||||||
@ -22,19 +23,23 @@ public class TutorialGettingStarted extends Tutorial
|
|||||||
{
|
{
|
||||||
super(goldManager, taskManager, clansManager, donationManager, manager);
|
super(goldManager, taskManager, clansManager, donationManager, manager);
|
||||||
|
|
||||||
addTask(new TaskWelcome(this, 1));
|
// addTask(new TaskWelcome(this, 1));
|
||||||
addTask(new TaskCreateClan(this, 2));
|
|
||||||
addTask(new TaskViewClanDetails(this, 3));
|
int id = 0;
|
||||||
addTask(new TaskLeaveSpawn(this, 4));
|
addTask(new TaskCreateClan(this, ++id));
|
||||||
addTask(new TaskGoToWilderness(this, 5));
|
addTask(new TaskViewClanDetails(this, ++id));
|
||||||
addTask(new TaskClaim(this, 6));
|
addTask(new TaskLeaveSpawn(this, ++id));
|
||||||
addTask(new TaskSetHome(this, 7));
|
addTask(new TaskGoToWilderness(this, ++id));
|
||||||
addTask(new TaskExploreShops(this, 8));
|
addTask(new TaskClaim(this, ++id));
|
||||||
addTask(new TaskEquipClass(this, 9));
|
addTask(new TaskSetHome(this, ++id));
|
||||||
addTask(new TaskUseAbility(this, 10));
|
addTask(new TaskExploreShops(this, ++id));
|
||||||
addTask(new TaskCustomizeClass(this, 11));
|
addTask(new TaskEquipClass(this, ++id));
|
||||||
addTask(new TaskMakingMoney(this, 12));
|
addTask(new TaskUseAbility(this, ++id));
|
||||||
addTask(new TaskDisbandClan(this, 13));
|
addTask(new TaskCustomizeClass(this, ++id));
|
||||||
|
addTask(new TaskMakingMoney(this, ++id));
|
||||||
|
addTask(new TaskDisbandClan(this, ++id));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_doScoreboard = true;
|
_doScoreboard = true;
|
||||||
_ghostMode = true;
|
_ghostMode = true;
|
||||||
@ -52,6 +57,24 @@ public class TutorialGettingStarted extends Tutorial
|
|||||||
player.resetPlayerTime();
|
player.resetPlayerTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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 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 " + C.cAqua + "30,000 Gold");
|
||||||
|
UtilPlayer.message(player, " ");
|
||||||
|
UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onUpdate(final UpdateEvent event)
|
public void onUpdate(final UpdateEvent event)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user