Merge pull request #86 in MIN/mineplex from clans-beta to master
* commit 'e9fd661311910c81c287ca146d5f22ccbe80dfcc': (22 commits) disabled koth fixed message on tick (might be cause of laggg) a few last touches forcejoin command for ADMIN+ and fixed auto tree replanting. made it so that you can only use /reset in safe zones modifications changes to tutorial fixed skiptutorial message not displaying bunch o' changes made skip tutorial messages be seen whilst in tutorial made entire clan know about disband fixed players from being able to eat their carrot in the making money task fixed some annoying bugs and fixed certain messages not showing in tutorial made certain messages visible in tutorial that are actually required to be seen Got rid of deployed tasks. using different system now. (untested) made it so players cannot see chat whilst in tutorial whoops.. this isn't php hehe made it so that no messages are shown when in tutorial fixed doors getting placed in spawn and shops removed some testing stuff ...
This commit is contained in:
commit
717508529c
@ -0,0 +1,132 @@
|
||||
package mineplex.core.common.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
|
||||
public class NautArrayList<Elem>
|
||||
{
|
||||
private ArrayList<Elem> _wrappedArrayList = new ArrayList<Elem>();
|
||||
|
||||
public boolean add(Elem elem)
|
||||
{
|
||||
return _wrappedArrayList.add(elem);
|
||||
}
|
||||
|
||||
public void add(int index, Elem elem)
|
||||
{
|
||||
_wrappedArrayList.add(index, elem);
|
||||
}
|
||||
|
||||
public boolean addAll(Collection<? extends Elem> elements)
|
||||
{
|
||||
return _wrappedArrayList.addAll(elements);
|
||||
}
|
||||
|
||||
public boolean addAll(int index, Collection<? extends Elem> elements)
|
||||
{
|
||||
return _wrappedArrayList.addAll(index, elements);
|
||||
}
|
||||
|
||||
public void clear()
|
||||
{
|
||||
_wrappedArrayList.clear();
|
||||
}
|
||||
|
||||
public boolean contains(Elem elem)
|
||||
{
|
||||
return _wrappedArrayList.contains(elem);
|
||||
}
|
||||
|
||||
public boolean containsAll(Collection<? extends Elem> elements)
|
||||
{
|
||||
return _wrappedArrayList.containsAll(elements);
|
||||
}
|
||||
|
||||
public Elem get(int index)
|
||||
{
|
||||
return _wrappedArrayList.get(index);
|
||||
}
|
||||
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
return _wrappedArrayList.equals(o);
|
||||
}
|
||||
|
||||
public int hashCode()
|
||||
{
|
||||
return _wrappedArrayList.hashCode();
|
||||
}
|
||||
|
||||
public int indexOf(Elem elem)
|
||||
{
|
||||
return _wrappedArrayList.indexOf(elem);
|
||||
}
|
||||
|
||||
public boolean isEmpty()
|
||||
{
|
||||
return _wrappedArrayList.isEmpty();
|
||||
}
|
||||
|
||||
public Iterator<Elem> iterator()
|
||||
{
|
||||
return _wrappedArrayList.iterator();
|
||||
}
|
||||
|
||||
public int lastIndexOf(Elem elem)
|
||||
{
|
||||
return _wrappedArrayList.lastIndexOf(elem);
|
||||
}
|
||||
|
||||
public ListIterator<Elem> listIterator()
|
||||
{
|
||||
return _wrappedArrayList.listIterator();
|
||||
}
|
||||
|
||||
public ListIterator<Elem> listIterator(int index)
|
||||
{
|
||||
return _wrappedArrayList.listIterator(index);
|
||||
}
|
||||
|
||||
public Elem remove(int index)
|
||||
{
|
||||
return _wrappedArrayList.remove(index);
|
||||
}
|
||||
|
||||
public boolean remove(Elem element)
|
||||
{
|
||||
return _wrappedArrayList.remove(element);
|
||||
}
|
||||
|
||||
public boolean removeAll(Collection<? extends Elem> elements)
|
||||
{
|
||||
return _wrappedArrayList.removeAll(elements);
|
||||
}
|
||||
|
||||
public boolean retainAll(Collection<? extends Elem> elements)
|
||||
{
|
||||
return _wrappedArrayList.retainAll(elements);
|
||||
}
|
||||
|
||||
public Elem set(int index, Elem element)
|
||||
{
|
||||
return _wrappedArrayList.set(index, element);
|
||||
}
|
||||
|
||||
public int size()
|
||||
{
|
||||
return _wrappedArrayList.size();
|
||||
}
|
||||
|
||||
public List<Elem> subList(int begin, int end)
|
||||
{
|
||||
return _wrappedArrayList.subList(begin, end);
|
||||
}
|
||||
|
||||
public Object[] toArray()
|
||||
{
|
||||
return _wrappedArrayList.toArray();
|
||||
}
|
||||
}
|
@ -25,8 +25,8 @@ public class UtilItem
|
||||
|
||||
_materials.put(Material.AIR, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.BOUNDLESS));
|
||||
_materials.put(Material.STONE, EnumSet.of(ItemCategory.BLOCK));
|
||||
_materials.put(Material.DIRT, EnumSet.of(ItemCategory.BLOCK));
|
||||
_materials.put(Material.GRASS, EnumSet.of(ItemCategory.BLOCK));
|
||||
_materials.put(Material.DIRT, EnumSet.of(ItemCategory.BLOCK));
|
||||
_materials.put(Material.COBBLESTONE, EnumSet.of(ItemCategory.BLOCK, ItemCategory.STONE));
|
||||
_materials.put(Material.WOOD, EnumSet.of(ItemCategory.BLOCK, ItemCategory.WOOD));
|
||||
_materials.put(Material.SAPLING, EnumSet.of(ItemCategory.BLOCK));
|
||||
@ -196,8 +196,56 @@ public class UtilItem
|
||||
_materials.put(Material.PACKED_ICE, EnumSet.of(ItemCategory.BLOCK, ItemCategory.MOVEMENT_MODIFYING));
|
||||
_materials.put(Material.DOUBLE_PLANT, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.BOUNDLESS));
|
||||
|
||||
_materials.put(Material.SLIME_BLOCK, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT));
|
||||
_materials.put(Material.BARRIER, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT));
|
||||
_materials.put(Material.IRON_TRAPDOOR, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT));
|
||||
_materials.put(Material.PRISMARINE, EnumSet.of(ItemCategory.BLOCK));
|
||||
_materials.put(Material.SEA_LANTERN, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.LIGHT_EMITTING));
|
||||
_materials.put(Material.STANDING_BANNER, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT));
|
||||
_materials.put(Material.WALL_BANNER, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT));
|
||||
_materials.put(Material.DAYLIGHT_DETECTOR_INVERTED, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT));
|
||||
_materials.put(Material.RED_SANDSTONE, EnumSet.of(ItemCategory.BLOCK, ItemCategory.STONE));
|
||||
_materials.put(Material.RED_SANDSTONE_STAIRS, EnumSet.of(ItemCategory.BLOCK, ItemCategory.STONE, ItemCategory.TRANSLUCENT));
|
||||
_materials.put(Material.DOUBLE_STONE_SLAB2, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.STONE));
|
||||
_materials.put(Material.STONE_SLAB2, EnumSet.of(ItemCategory.BLOCK, ItemCategory.STONE, ItemCategory.TRANSLUCENT));
|
||||
_materials.put(Material.SPRUCE_FENCE_GATE, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.WOOD));
|
||||
_materials.put(Material.BIRCH_FENCE_GATE, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.WOOD));
|
||||
_materials.put(Material.JUNGLE_FENCE_GATE, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.WOOD));
|
||||
_materials.put(Material.DARK_OAK_FENCE_GATE, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.WOOD));
|
||||
_materials.put(Material.ACACIA_FENCE_GATE, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.WOOD));
|
||||
_materials.put(Material.SPRUCE_FENCE, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.WOOD));
|
||||
_materials.put(Material.BIRCH_FENCE, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.WOOD));
|
||||
_materials.put(Material.JUNGLE_FENCE, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.WOOD));
|
||||
_materials.put(Material.SPRUCE_DOOR, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.WOOD));
|
||||
_materials.put(Material.BIRCH_DOOR, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.WOOD));
|
||||
_materials.put(Material.JUNGLE_DOOR, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.WOOD));
|
||||
_materials.put(Material.ACACIA_DOOR, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.WOOD));
|
||||
_materials.put(Material.DARK_OAK_DOOR, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.WOOD));
|
||||
|
||||
|
||||
_materials.put(Material.DARK_OAK_FENCE, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.WOOD));
|
||||
_materials.put(Material.ACACIA_FENCE, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.WOOD));
|
||||
_materials.put(Material.DARK_OAK_DOOR_ITEM, EnumSet.of(ItemCategory.BLOCK, ItemCategory.TRANSLUCENT, ItemCategory.WOOD));
|
||||
|
||||
// Items
|
||||
|
||||
_materials.put(Material.PRISMARINE_SHARD, EnumSet.of(ItemCategory.ITEM));
|
||||
_materials.put(Material.PRISMARINE_CRYSTALS, EnumSet.of(ItemCategory.ITEM));
|
||||
_materials.put(Material.RABBIT, EnumSet.of(ItemCategory.ITEM, ItemCategory.RAW_FOOD, ItemCategory.EDIBLE));
|
||||
_materials.put(Material.COOKED_RABBIT, EnumSet.of(ItemCategory.ITEM, ItemCategory.EDIBLE));
|
||||
_materials.put(Material.RABBIT_STEW, EnumSet.of(ItemCategory.ITEM, ItemCategory.EDIBLE));
|
||||
_materials.put(Material.RABBIT_FOOT, EnumSet.of(ItemCategory.ITEM));
|
||||
_materials.put(Material.RABBIT_HIDE, EnumSet.of(ItemCategory.ITEM));
|
||||
_materials.put(Material.ARMOR_STAND, EnumSet.of(ItemCategory.ITEM));
|
||||
_materials.put(Material.MUTTON, EnumSet.of(ItemCategory.ITEM, ItemCategory.RAW_FOOD, ItemCategory.EDIBLE));
|
||||
_materials.put(Material.COOKED_MUTTON, EnumSet.of(ItemCategory.ITEM, ItemCategory.EDIBLE));
|
||||
_materials.put(Material.BANNER, EnumSet.of(ItemCategory.ITEM));
|
||||
_materials.put(Material.SPRUCE_DOOR_ITEM, EnumSet.of(ItemCategory.ITEM, ItemCategory.WOOD));
|
||||
_materials.put(Material.BIRCH_DOOR_ITEM, EnumSet.of(ItemCategory.ITEM, ItemCategory.WOOD));
|
||||
_materials.put(Material.JUNGLE_DOOR_ITEM, EnumSet.of(ItemCategory.ITEM, ItemCategory.WOOD));
|
||||
_materials.put(Material.ACACIA_DOOR_ITEM, EnumSet.of(ItemCategory.ITEM, ItemCategory.WOOD));
|
||||
|
||||
|
||||
_materials.put(Material.IRON_SPADE, EnumSet.of(ItemCategory.ITEM, ItemCategory.IRON, ItemCategory.TOOL, ItemCategory.SHOVEL));
|
||||
_materials.put(Material.IRON_PICKAXE, EnumSet.of(ItemCategory.ITEM, ItemCategory.IRON, ItemCategory.TOOL, ItemCategory.PICKAXE));
|
||||
_materials.put(Material.IRON_AXE, EnumSet.of(ItemCategory.AXE, ItemCategory.ITEM, ItemCategory.IRON, ItemCategory.WEAPON, ItemCategory.TOOL));
|
||||
@ -1063,4 +1111,9 @@ public class UtilItem
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isIndexed(Material material)
|
||||
{
|
||||
return _materials.containsKey(material);
|
||||
}
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ public class PlayerScoreboard
|
||||
System.out.println("Scoreboard Error: Line Team Not Found!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//Set Line Prefix/Suffix
|
||||
team.setPrefix(newLine.substring(0, Math.min(newLine.length(), 16)));
|
||||
team.setSuffix(ChatColor.getLastColors(team.getPrefix()) + newLine.substring(team.getPrefix().length(), Math.min(newLine.length(), 32)));
|
||||
|
@ -459,6 +459,27 @@ public class ClansGame extends MiniPlugin
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void doorPlaced(BlockPlaceEvent event)
|
||||
{
|
||||
if (event.getBlockPlaced().getType().equals(Material.ACACIA_DOOR)
|
||||
|| event.getBlockPlaced().getType().equals(Material.WOODEN_DOOR)
|
||||
|| event.getBlockPlaced().getType().equals(Material.BIRCH_DOOR)
|
||||
|| event.getBlockPlaced().getType().equals(Material.DARK_OAK_DOOR)
|
||||
|| event.getBlockPlaced().getType().equals(Material.JUNGLE_DOOR)
|
||||
|| event.getBlockPlaced().getType().equals(Material.SPRUCE_DOOR)
|
||||
|| event.getBlockPlaced().getType().equals(Material.WOOD_DOOR)
|
||||
|| event.getBlockPlaced().getType().equals(Material.IRON_DOOR_BLOCK))
|
||||
{
|
||||
ClanTerritory claim = _clans.getClanUtility().getClaim(event.getBlockPlaced().getLocation());
|
||||
|
||||
if (claim != null && (claim.Owner.equals("Spawn") || claim.Owner.equals("Shops")))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void Piston(BlockPistonExtendEvent event)
|
||||
{
|
||||
@ -494,16 +515,6 @@ public class ClansGame extends MiniPlugin
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void TURTLEZ(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
if (event.getPlayer().getName().equals("SamitoD") && event.getMessage().equals("/gear"))
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), "UR SPECIAL!!!");
|
||||
_clans.getGearManager().openShop(event.getPlayer());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Quit(PlayerQuitEvent event)
|
||||
{
|
||||
|
@ -227,7 +227,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
|
||||
TaskManager taskManager = new TaskManager(plugin, _clientManager, webServerAddress);
|
||||
|
||||
_tutorialManager = new TutorialManager(plugin, _goldManager, taskManager, donationManager, preferencesManager, this);
|
||||
_tutorialManager = new TutorialManager(plugin, _goldManager, taskManager, donationManager, preferencesManager, this, packetHandler);
|
||||
|
||||
ClanTips = new ClanTips(plugin, this, preferencesManager);
|
||||
|
||||
@ -402,6 +402,11 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
return _disguiseManager;
|
||||
}
|
||||
|
||||
public TutorialManager getTutorials()
|
||||
{
|
||||
return _tutorialManager;
|
||||
}
|
||||
|
||||
public NpcManager getNPCManager()
|
||||
{
|
||||
return _npcManager;
|
||||
|
@ -19,9 +19,9 @@ import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.game.clans.clans.event.ClanDisbandedEvent;
|
||||
import mineplex.game.clans.clans.event.PlayerClaimTerritoryEvent;
|
||||
import mineplex.game.clans.clans.event.PlayerPreClaimTerritoryEvent;
|
||||
import mineplex.game.clans.clans.event.PlayerUnClaimTerritoryEvent;
|
||||
import mineplex.game.clans.core.repository.ClanTerritory;
|
||||
|
||||
@ -157,10 +157,10 @@ public class ClansUtility
|
||||
|
||||
if (inform)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clan Search", "" + C.mCount + (clanMatchList.size() + playerMatchList.size()) + C.mBody + " matches for [" + C.mElem + name + C.mBody + "]."), false);
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clan Search", "" + C.mCount + (clanMatchList.size() + playerMatchList.size()) + C.mBody + " matches for [" + C.mElem + name + C.mBody + "]."));
|
||||
|
||||
UtilPlayer.message(caller, F.desc("Matches via Clan", clanMatchString), false);
|
||||
UtilPlayer.message(caller, F.desc("Matches via Player", playerMatchString), false);;
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.desc("Matches via Clan", clanMatchString));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.desc("Matches via Player", playerMatchString));
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -183,7 +183,7 @@ public class ClansUtility
|
||||
if (!inform) return null;
|
||||
|
||||
// Inform
|
||||
UtilPlayer.message(caller, F.main("Clan Search", "" + C.mCount + matchList.size() + C.mBody + " matches for [" + C.mElem + name + C.mBody + "]."), false);
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clan Search", "" + C.mCount + matchList.size() + C.mBody + " matches for [" + C.mElem + name + C.mBody + "]."));
|
||||
|
||||
if (matchList.size() > 0)
|
||||
{
|
||||
@ -191,7 +191,7 @@ public class ClansUtility
|
||||
for (ClanInfo cur : matchList)
|
||||
matchString += cur.getName() + " ";
|
||||
|
||||
UtilPlayer.message(caller, F.main("Clan Search", "" + C.mBody + " Matches [" + C.mElem + matchString + C.mBody + "]."), false);
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clan Search", "" + C.mBody + " Matches [" + C.mElem + matchString + C.mBody + "]."));
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -554,31 +554,31 @@ public class ClansUtility
|
||||
{
|
||||
if (Clans.getClanMemberUuidMap().containsKey(caller.getUniqueId()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are already in a Clan."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are already in a Clan."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Clans.Get(caller).canJoin())
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You cannot join a Clan for " + C.mTime + UtilTime.convertString(System.currentTimeMillis() - Clans.Get(caller).getDelay(), 1, UtilTime.TimeUnit.FIT) + C.mBody + "."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot join a Clan for " + C.mTime + UtilTime.convertString(System.currentTimeMillis() - Clans.Get(caller).getDelay(), 1, UtilTime.TimeUnit.FIT) + C.mBody + "."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (clanInfo == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Error: Clan does not exist"));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Error: Clan does not exist"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!clanInfo.isInvited(caller.getName()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not invited to " + F.elem("Clan " + clanInfo.getName()) + "."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not invited to " + F.elem("Clan " + clanInfo.getName()) + "."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (clanInfo.getSize() >= clanInfo.getMaxSize())
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "The clan " + F.elem("Clan " + clanInfo.getName()) + " is full and cannot be joined!"));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "The clan " + F.elem("Clan " + clanInfo.getName()) + " is full and cannot be joined!"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -591,12 +591,12 @@ public class ClansUtility
|
||||
if (data)
|
||||
{
|
||||
// Inform
|
||||
UtilPlayer.message(caller, F.main("Clans", "You joined " + F.elem("Clan " + clanInfo.getName()) + "."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You joined " + F.elem("Clan " + clanInfo.getName()) + "."));
|
||||
clanInfo.inform(F.name(caller.getName()) + " has joined your Clan.", caller.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "There was an error processing your request"));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "There was an error processing your request"));
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -609,13 +609,13 @@ public class ClansUtility
|
||||
|
||||
if (clan == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (clan.getMembers().get(caller.getUniqueId()).getRole() == ClanRole.LEADER && clan.getMembers().size() > 1)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You must pass on " + F.elem("Leadership") + " before leaving."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must pass on " + F.elem("Leadership") + " before leaving."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -629,7 +629,7 @@ public class ClansUtility
|
||||
public void run(Boolean data)
|
||||
{
|
||||
// Inform
|
||||
UtilPlayer.message(caller, F.main("Clans", "You left " + F.elem("Clan " + clan.getName()) + "."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You left " + F.elem("Clan " + clan.getName()) + "."));
|
||||
clan.inform(F.name(caller.getName()) + " has left your Clan.", null);
|
||||
}
|
||||
});
|
||||
@ -646,13 +646,13 @@ public class ClansUtility
|
||||
|
||||
if (clan == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (getRole(caller) != ClanRole.LEADER)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader can disband the Clan."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader can disband the Clan."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -665,6 +665,8 @@ public class ClansUtility
|
||||
return;
|
||||
}
|
||||
|
||||
Clans.messageClan(clan, C.cYellow + caller.getName() + C.cGray + " has disbanded the Clan.");
|
||||
|
||||
// Task
|
||||
Clans.getClanDataAccess().delete(clan, new Callback<Boolean>()
|
||||
{
|
||||
@ -673,10 +675,11 @@ public class ClansUtility
|
||||
{
|
||||
if (!data)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "There was an error processing your request. Try again later"));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "There was an error processing your request. Try again later"));
|
||||
|
||||
}else
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You disbanded your Clan."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You disbanded your Clan."));
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -686,27 +689,37 @@ public class ClansUtility
|
||||
{
|
||||
ClanInfo clan = getClanByPlayer(caller);
|
||||
|
||||
// Pre Event
|
||||
PlayerPreClaimTerritoryEvent preEvent = new PlayerPreClaimTerritoryEvent(caller, caller.getLocation().getChunk(), clan);
|
||||
|
||||
UtilServer.getServer().getPluginManager().callEvent(preEvent);
|
||||
|
||||
if (preEvent.isCancelled())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (clan == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can claim Territory."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can claim Territory."));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ClansManager.isClaimable(caller.getLocation()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You cannot claim territory at this location!"));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot claim territory at this location!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
// if (clan.getEnergy() == 0)
|
||||
// {
|
||||
// UtilPlayer.message(caller, F.main("Clans", "You must purchase energy at a shop before you can claim land."));
|
||||
// Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must purchase energy at a shop before you can claim land."));
|
||||
// return false;
|
||||
// }
|
||||
|
||||
@ -722,14 +735,14 @@ public class ClansUtility
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "This Territory is owned by " + mRel(Clans.getClanUtility().relPC(caller, ownerClan), ownerClan.getName(), true) + "."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This Territory is owned by " + mRel(Clans.getClanUtility().relPC(caller, ownerClan), ownerClan.getName(), true) + "."));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// if (clan.getClaims() >= clan.getClaimsMax())
|
||||
// {
|
||||
// UtilPlayer.message(caller, F.main("Clans", "Your Clan cannot claim more Territory."));
|
||||
// Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Your Clan cannot claim more Territory."));
|
||||
// return false;
|
||||
// }
|
||||
|
||||
@ -755,8 +768,8 @@ public class ClansUtility
|
||||
|
||||
if (checkBox(caller.getWorld().getChunkAt(caller.getLocation().getChunk().getX() + x, caller.getLocation().getChunk().getZ() + z), 3))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You cannot claim this Territory, it causes a box."));
|
||||
UtilPlayer.message(caller, F.main("Clans", "This means a Territory has all sides claimed."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot claim this Territory, it causes a box."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This means a Territory has all sides claimed."));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -766,7 +779,7 @@ public class ClansUtility
|
||||
}
|
||||
else if (rel(clan, adjClan) != ClanRelation.SELF)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You cannot claim Territory next to " + mRel(rel(ownerClan, adjClan), adjClan.getName(), true) + "."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot claim Territory next to " + mRel(rel(ownerClan, adjClan), adjClan.getName(), true) + "."));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -775,21 +788,21 @@ public class ClansUtility
|
||||
// Boxed
|
||||
if (checkBox(caller.getLocation().getChunk(), 4))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You cannot claim this Territory, it causes a box."));
|
||||
UtilPlayer.message(caller, F.main("Clans", "This means a Territory has all sides claimed."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot claim this Territory, it causes a box."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This means a Territory has all sides claimed."));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isNearAdminClaim(caller.getLocation()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You cannot claim so close to administrative territory!"));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot claim so close to administrative territory!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Not Next to Self
|
||||
if (!selfAdj && !clan.getClaimSet().isEmpty())
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You must claim next to your other Territory."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must claim next to your other Territory."));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -798,7 +811,7 @@ public class ClansUtility
|
||||
{
|
||||
if (!UtilTime.elapsed(Clans.getUnclaimMap().get(chunk), Clans.getReclaimTime()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "This Territory cannot be claimed for " + F.time(UtilTime.convertString(Clans.getReclaimTime() - (System.currentTimeMillis() - Clans.getUnclaimMap().get(chunk)), 1, UtilTime.TimeUnit.FIT)) + "."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This Territory cannot be claimed for " + F.time(UtilTime.convertString(Clans.getReclaimTime() - (System.currentTimeMillis() - Clans.getUnclaimMap().get(chunk)), 1, UtilTime.TimeUnit.FIT)) + "."));
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -813,7 +826,7 @@ public class ClansUtility
|
||||
{
|
||||
if (UtilMath.offset(cur, caller) < 16) if (playerEnemy(caller, cur))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You cannot claim while enemies are nearby."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot claim while enemies are nearby."));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -835,7 +848,7 @@ public class ClansUtility
|
||||
Clans.getClanDataAccess().claim(clan.getName(), chunk, caller.getName(), false);
|
||||
|
||||
// Inform
|
||||
UtilPlayer.message(caller, F.main("Clans", "You claimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + "."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You claimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + "."));
|
||||
clan.inform(F.name(caller.getName()) + " claimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + ".", caller.getName());
|
||||
|
||||
return true;
|
||||
@ -872,7 +885,7 @@ public class ClansUtility
|
||||
}
|
||||
|
||||
// Change Inform
|
||||
UtilPlayer.message(caller, F.main("Clans", "You can no longer 'steal' territory. " + "You simply unclaim it and it can not be reclaimed by anyone for 30 mintes." + "This was done to improve gameplay. Enjoy!"));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You can no longer 'steal' territory. " + "You simply unclaim it and it can not be reclaimed by anyone for 30 mintes." + "This was done to improve gameplay. Enjoy!"));
|
||||
|
||||
// Inform
|
||||
UtilServer.broadcast(F.main("Clans", F.elem(clientClan.getName()) + " unclaimed from " + F.elem(ownerClan.getName()) + " at " + F.elem(UtilWorld.locToStrClean(caller.getLocation())) + "."));
|
||||
@ -889,7 +902,7 @@ public class ClansUtility
|
||||
|
||||
if (clan == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -900,13 +913,13 @@ public class ClansUtility
|
||||
|
||||
if (target.equals(caller.getName()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You cannot promote yourself."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot promote yourself."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.getRole().ordinal() <= target.getRole().ordinal())
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You do not outrank " + F.name(other) + "."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You do not outrank " + F.name(other) + "."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -941,7 +954,7 @@ public class ClansUtility
|
||||
|
||||
if (clan == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -952,19 +965,19 @@ public class ClansUtility
|
||||
|
||||
if (target.equals(caller.getName()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You cannot demote yourself."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot demote yourself."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.getRole().ordinal() <= target.getRole().ordinal())
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You do not outrank " + F.name(other) + "."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You do not outrank " + F.name(other) + "."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.getRole() == ClanRole.RECRUIT)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You cannot demote " + F.name(other) + " any further."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot demote " + F.name(other) + " any further."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -991,7 +1004,7 @@ public class ClansUtility
|
||||
|
||||
if (clan == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1002,20 +1015,20 @@ public class ClansUtility
|
||||
|
||||
if (self.getRole() != ClanRole.LEADER && self.getRole() != ClanRole.ADMIN)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can kick members."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can kick members."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (clansPlayer.getRole() == ClanRole.LEADER)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Clan leaders cannot be kicked."));
|
||||
UtilPlayer.message(caller, F.main("Clans", "To disband a clan, use /c disband"));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan leaders cannot be kicked."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "To disband a clan, use /c disband"));
|
||||
return;
|
||||
}
|
||||
|
||||
if ((clansPlayer.getRole() == ClanRole.LEADER && self.getRole() == ClanRole.ADMIN) || (clansPlayer.getRole() == ClanRole.ADMIN && self.getRole() == ClanRole.ADMIN))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You do not outrank " + F.name(other) + "."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You do not outrank " + F.name(other) + "."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1027,8 +1040,8 @@ public class ClansUtility
|
||||
public void run(Boolean data)
|
||||
{
|
||||
// Inform
|
||||
if (player != null) UtilPlayer.message(player, F.main("Clans", F.name(caller.getName()) + " kicked you from " + F.elem("Clan " + clan.getName()) + "."));
|
||||
UtilPlayer.message(caller, F.main("Clans", "You kicked " + F.name(other) + " from your Clan."));
|
||||
if (player != null) Clans.getTutorials().sendTutorialMsg(player, F.main("Clans", F.name(caller.getName()) + " kicked you from " + F.elem("Clan " + clan.getName()) + "."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You kicked " + F.name(other) + " from your Clan."));
|
||||
clan.inform(F.main("Clans", F.name(caller.getName()) + " kicked " + F.name(other) + " from your Clan."), caller.getName());
|
||||
}
|
||||
};
|
||||
@ -1046,7 +1059,7 @@ public class ClansUtility
|
||||
|
||||
if (clan == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1059,14 +1072,14 @@ public class ClansUtility
|
||||
// Role
|
||||
if (clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can unclaim Territory."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can unclaim Territory."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Not Claimed
|
||||
if (ownerClan == null || !ownerClan.equals(clan))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "This Territory is not owned by you."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This Territory is not owned by you."));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1084,7 +1097,7 @@ public class ClansUtility
|
||||
Clans.getClanDataAccess().unclaim(chunk, caller.getName(), true);
|
||||
|
||||
// Inform
|
||||
UtilPlayer.message(caller, F.main("Clans", "You unclaimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + "."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You unclaimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + "."));
|
||||
clan.inform(F.name(caller.getName()) + " unclaimed Territory " + F.elem(UtilWorld.chunkToStrClean(caller.getLocation().getChunk())) + ".", caller.getName());
|
||||
|
||||
return true;
|
||||
@ -1096,13 +1109,13 @@ public class ClansUtility
|
||||
|
||||
if (clan == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader can unclaim all Territory."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader can unclaim all Territory."));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1120,7 +1133,7 @@ public class ClansUtility
|
||||
}
|
||||
|
||||
// Inform
|
||||
UtilPlayer.message(caller, F.main("Clans", "You unclaimed all your Clans Territory."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You unclaimed all your Clans Territory."));
|
||||
clan.inform(F.name(caller.getName()) + " unclaimed all your Clans Territory.", caller.getName());
|
||||
|
||||
return true;
|
||||
@ -1130,21 +1143,21 @@ public class ClansUtility
|
||||
{
|
||||
if (clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can send invites."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can send invites."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.getName().equals(caller.getName()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You cannot invite yourself."));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot invite yourself."));
|
||||
return;
|
||||
}
|
||||
|
||||
// Inform
|
||||
clan.inform(F.name(caller.getName()) + " invited " + F.name(target.getName()) + " to join your Clan.", caller.getName());
|
||||
UtilPlayer.message(caller, F.main("Clans", "You invited " + F.name(target.getName()) + " to join your Clan."));
|
||||
UtilPlayer.message(target, F.main("Clans", F.name(caller.getName()) + " invited you to join " + F.elem("Clan " + clan.getName()) + "."));
|
||||
UtilPlayer.message(target, F.main("Clans", "Type " + F.elem("/c join " + clan.getName()) + " to accept!"));
|
||||
Clans.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You invited " + F.name(target.getName()) + " to join your Clan."));
|
||||
Clans.getTutorials().sendTutorialMsg(target, F.main("Clans", F.name(caller.getName()) + " invited you to join " + F.elem("Clan " + clan.getName()) + "."));
|
||||
Clans.getTutorials().sendTutorialMsg(target, F.main("Clans", "Type " + F.elem("/c join " + clan.getName()) + " to accept!"));
|
||||
|
||||
// Task
|
||||
Clans.getClanDataAccess().invite(clan, target.getName(), caller.getName());
|
||||
|
@ -25,6 +25,7 @@ import mineplex.game.clans.clans.ClansBlacklist;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.clans.ClientClan;
|
||||
import mineplex.game.clans.clans.event.ClansCommandExecutedEvent;
|
||||
import mineplex.game.clans.tutorials.Tutorial;
|
||||
import mineplex.game.clans.tutorials.TutorialManager;
|
||||
import net.minecraft.server.v1_8_R3.EnumDirection;
|
||||
|
||||
@ -65,7 +66,8 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
else if (args[0].equalsIgnoreCase("promote") || args[0].equalsIgnoreCase("+"))
|
||||
promote(caller, args);
|
||||
|
||||
else if (args[0].equalsIgnoreCase("forcejoin") || args[0].equalsIgnoreCase("fj"))
|
||||
forceJoin(caller, args);
|
||||
else if (args[0].equalsIgnoreCase("demote") || args[0].equalsIgnoreCase("-"))
|
||||
demote(caller, args);
|
||||
|
||||
@ -121,12 +123,41 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
infoClan(caller, args[0]);
|
||||
}
|
||||
|
||||
private void forceJoin(Player caller, String[] args)
|
||||
{
|
||||
if (!Plugin.getClientManager().hasRank(caller, Rank.ADMIN) && !caller.getName().equals("NewGarbo"))
|
||||
{
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This requires ADMIN+ permission."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.length > 1)
|
||||
{
|
||||
ClanInfo clan = Plugin.getClan(args[1]);
|
||||
|
||||
if (clan != null)
|
||||
{
|
||||
_manager.getClanUtility().join(caller, clan);
|
||||
_manager.getClanDataAccess().role(clan, caller.getUniqueId(), ClanRole.LEADER);
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You have successfully joined " + F.elem(clan.getName()) + " and are now Leader Role."));
|
||||
}
|
||||
else
|
||||
{
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan provided does not exist."));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "No clan provided."));
|
||||
}
|
||||
}
|
||||
|
||||
public void commandChat(Player caller, String[] args)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
Plugin.Get(caller).setClanChat(!Plugin.Get(caller).isClanChat());
|
||||
UtilPlayer.message(caller, F.main("Clans", "Clan Chat: " + F.oo(Plugin.Get(caller).isClanChat())));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan Chat: " + F.oo(Plugin.Get(caller).isClanChat())));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -135,7 +166,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
{
|
||||
ClanInfo clan = Plugin.getClanUtility().getClanByPlayer(caller);
|
||||
if (clan == null)
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
||||
else
|
||||
Plugin.chatClan(clan, caller, F.combine(args, 0, null, false));
|
||||
}
|
||||
@ -146,7 +177,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
if (args.length == 0)
|
||||
{
|
||||
Plugin.Get(caller).setAllyChat(!Plugin.Get(caller).isAllyChat());
|
||||
UtilPlayer.message(caller, F.main("Clans", "Ally Chat: " + F.oo(Plugin.Get(caller).isAllyChat())));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Ally Chat: " + F.oo(Plugin.Get(caller).isAllyChat())));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -155,7 +186,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
{
|
||||
ClanInfo clan = Plugin.getClanUtility().getClanByPlayer(caller);
|
||||
if (clan == null)
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
||||
else
|
||||
Plugin.chatAlly(clan, caller, F.combine(args, 0, null, false));
|
||||
}
|
||||
@ -171,30 +202,30 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
return;
|
||||
}
|
||||
|
||||
UtilPlayer.message(caller, F.main("Clans", "Commands List;"));
|
||||
UtilPlayer.message(caller, F.help("/c create <clan>", "Create new Clan", Rank.ALL));
|
||||
UtilPlayer.message(caller, F.help("/c join <clan>", "Join a Clan", Rank.ALL));
|
||||
UtilPlayer.message(caller, F.help("/c leave <clan>", "Leave your Clan", Rank.ALL));
|
||||
UtilPlayer.message(caller, F.help("/c map <toggle>", "View Clan Map", Rank.ALL));
|
||||
UtilPlayer.message(caller, F.help("/cc (Message)", "Clan Chat (Toggle)", Rank.ALL));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Commands List;"));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c create <clan>", "Create new Clan", Rank.ALL));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c join <clan>", "Join a Clan", Rank.ALL));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c leave <clan>", "Leave your Clan", Rank.ALL));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c map <toggle>", "View Clan Map", Rank.ALL));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.help("/cc (Message)", "Clan Chat (Toggle)", Rank.ALL));
|
||||
|
||||
UtilPlayer.message(caller, F.help("/c promote <player>", "Promote Player in Clan", Rank.MODERATOR));
|
||||
UtilPlayer.message(caller, F.help("/c demote <player>", "Demote Player in Clan", Rank.MODERATOR));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c promote <player>", "Promote Player in Clan", Rank.MODERATOR));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c demote <player>", "Demote Player in Clan", Rank.MODERATOR));
|
||||
|
||||
UtilPlayer.message(caller, F.help("/c home (set)", "Teleport to Clan Home", Rank.MODERATOR));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c home (set)", "Teleport to Clan Home", Rank.MODERATOR));
|
||||
|
||||
UtilPlayer.message(caller, F.help("/c invite <player>", "Invite Player to Clan", Rank.ADMIN));
|
||||
UtilPlayer.message(caller, F.help("/c kick <player>", "Kick Player from Clan", Rank.ADMIN));
|
||||
UtilPlayer.message(caller, F.help("/c neutral <clan>", "Request Neutrality with Clan", Rank.ADMIN));
|
||||
UtilPlayer.message(caller, F.help("/c enemy <clan>", "Declare ClanWar with Clan", Rank.ADMIN));
|
||||
UtilPlayer.message(caller, F.help("/c ally <clan>", "Send Alliance to Clan", Rank.ADMIN));
|
||||
UtilPlayer.message(caller, F.help("/c trust <clan>", "Give Trust to Clan", Rank.ADMIN));
|
||||
UtilPlayer.message(caller, F.help("/c claim", "Claim Territory", Rank.ADMIN));
|
||||
UtilPlayer.message(caller, F.help("/c unclaim (all)", "Unclaim Territory", Rank.ADMIN));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c invite <player>", "Invite Player to Clan", Rank.ADMIN));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c kick <player>", "Kick Player from Clan", Rank.ADMIN));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c neutral <clan>", "Request Neutrality with Clan", Rank.ADMIN));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c enemy <clan>", "Declare ClanWar with Clan", Rank.ADMIN));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c ally <clan>", "Send Alliance to Clan", Rank.ADMIN));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c trust <clan>", "Give Trust to Clan", Rank.ADMIN));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c claim", "Claim Territory", Rank.ADMIN));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c unclaim (all)", "Unclaim Territory", Rank.ADMIN));
|
||||
|
||||
UtilPlayer.message(caller, F.help("/c delete", "Delete your Clan", Rank.OWNER));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c delete", "Delete your Clan", Rank.OWNER));
|
||||
|
||||
UtilPlayer.message(caller, F.help("/c <clan>", "View Clan Information", Rank.ALL));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.help("/c <clan>", "View Clan Information", Rank.ALL));
|
||||
}
|
||||
|
||||
public void create(final Player caller, final String[] args)
|
||||
@ -205,12 +236,12 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
if (Plugin.getClanMemberUuidMap().containsKey(caller.getUniqueId()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are already in a Clan."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are already in a Clan."));
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO if (!client.canJoin()) { UtilPlayer.message(caller,
|
||||
* TODO if (!client.canJoin()) { _manager.getTutorials().sendTutorialMsg(caller,
|
||||
* F.main("Clans", "You cannot join a Clan for " + C.mTime +
|
||||
* UtilTime.convertString(System.currentTimeMillis() -
|
||||
* client.getDelay(), 1, TimeUnit.FIT) + C.mBody + ".")); return; }
|
||||
@ -218,37 +249,37 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
if (args.length < 2)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You did not input a Clan name."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a Clan name."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!UtilInput.valid(args[1]))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Invalid characters in Clan name."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Invalid characters in Clan name."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (args[1].length() < Plugin.getNameMin())
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Clan name too short. Minimum length is " + (Plugin.getNameMin()) + "."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan name too short. Minimum length is " + (Plugin.getNameMin()) + "."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (args[1].length() > Plugin.getNameMax())
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Clan name too long. Maximum length is " + (Plugin.getNameMax()) + "."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan name too long. Maximum length is " + (Plugin.getNameMax()) + "."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (Plugin.getChat().getFilteredMessage(caller, args[1]).contains("*"))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Clan name inappropriate. Please try a different name"));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan name inappropriate. Please try a different name"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ClansBlacklist.isValidClanName(args[1]))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Clan name is blacklisted! Please try a different name."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan name is blacklisted! Please try a different name."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -259,7 +290,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
{
|
||||
if (clanExists)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Clan name is already in use by another Clan."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan name is already in use by another Clan."));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -271,11 +302,11 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
if (data == null)
|
||||
{
|
||||
// Hopefully shouldn't happen!
|
||||
UtilPlayer.message(caller, F.main("Clans", "There was an error creating the clan. Please try again"));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "There was an error creating the clan. Please try again"));
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You created Clan " + C.cYellow + data.getName() + C.cGray + "."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You created Clan " + C.cYellow + data.getName() + C.cGray + "."));
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -295,13 +326,13 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
if (clan == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.length < 2)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You did not input an invitee."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input an invitee."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -315,25 +346,25 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
{
|
||||
if (Plugin.getClanMemberUuidMap().containsKey(caller.getUniqueId()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are already in a Clan."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are already in a Clan."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Plugin.Get(caller).canJoin())
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You cannot join a Clan for " + C.mTime + UtilTime.convertString(System.currentTimeMillis() - Plugin.Get(caller).getDelay(), 1, TimeUnit.FIT) + C.mBody + "."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot join a Clan for " + C.mTime + UtilTime.convertString(System.currentTimeMillis() - Plugin.Get(caller).getDelay(), 1, TimeUnit.FIT) + C.mBody + "."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.length < 2)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You did not input a Clan name."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a Clan name."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!UtilInput.valid(args[1]))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Invalid characters in Clan name."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Invalid characters in Clan name."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -342,13 +373,13 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
if (!clan.isInvited(caller.getName()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not invited to " + F.elem("Clan " + clan.getName()) + "."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not invited to " + F.elem("Clan " + clan.getName()) + "."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (clan.getSize() >= clan.getMaxSize())
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "The clan " + F.elem("Clan " + clan.getName()) + " is full and cannot be joined!"));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "The clan " + F.elem("Clan " + clan.getName()) + " is full and cannot be joined!"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -361,12 +392,12 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
if (data)
|
||||
{
|
||||
// Inform
|
||||
UtilPlayer.message(caller, F.main("Clans", "You joined " + F.elem("Clan " + clan.getName()) + "."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You joined " + F.elem("Clan " + clan.getName()) + "."));
|
||||
clan.inform(F.name(caller.getName()) + " has joined your Clan.", caller.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "There was an error processing your request"));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "There was an error processing your request"));
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -379,13 +410,13 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
if (clan == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (clan.getMembers().get(caller.getUniqueId()).getRole() == ClanRole.LEADER && clan.getMembers().size() > 1)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You must pass on " + F.elem("Leadership") + " before leaving."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must pass on " + F.elem("Leadership") + " before leaving."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -399,7 +430,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
public void run(Boolean data)
|
||||
{
|
||||
// Inform
|
||||
UtilPlayer.message(caller, F.main("Clans", "You left " + F.elem("Clan " + clan.getName()) + "."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You left " + F.elem("Clan " + clan.getName()) + "."));
|
||||
clan.inform(F.name(caller.getName()) + " has left your Clan.", null);
|
||||
}
|
||||
});
|
||||
@ -416,13 +447,13 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
if (clan == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.length < 2)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You did not input a Player to kick."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a Player to kick."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -437,13 +468,13 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
if (clan == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.length < 2)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You did not input player to promote."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input player to promote."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -458,13 +489,13 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
if (clan == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.length < 2)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You did not input player to demote."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input player to demote."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -479,19 +510,19 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
if (cA == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (cA.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && cA.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can manage Alliances."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can manage Alliances."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.length < 2)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You did not input a Clan to ally."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a Clan to ally."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -501,31 +532,31 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
if (cA.isSelf(cB.getName()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You cannot ally with yourself."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot ally with yourself."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (cA.isAlly(cB.getName()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are already allies with Clan" + F.elem(cB.getName())) + ".");
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are already allies with Clan" + F.elem(cB.getName())) + ".");
|
||||
return;
|
||||
}
|
||||
|
||||
if (cA.getAllies() >= cA.getAlliesMax())
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You cannot have any more allies."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You cannot have any more allies."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (cB.getAllies() >= cB.getAlliesMax())
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Clan " + F.elem(cB.getName()) + " cannot have any more allies."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Clan " + F.elem(cB.getName()) + " cannot have any more allies."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Recharge.Instance.usable(caller, "AllyReq" + cB.getName()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Please do not spam alliance requests."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Please do not spam alliance requests."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -535,7 +566,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
Plugin.getClanDataAccess().ally(cA, cB, caller.getName());
|
||||
|
||||
// Inform
|
||||
UtilPlayer.message(caller, F.main("Clans", "You accepted alliance with Clan " + F.elem(cB.getName()) + "."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You accepted alliance with Clan " + F.elem(cB.getName()) + "."));
|
||||
cA.inform(F.name(caller.getName()) + " accepted alliance with Clan " + F.elem(cB.getName()) + ".", caller.getName());
|
||||
cB.inform("Clan " + F.elem(cA.getName()) + " has accepted alliance with you.", null);
|
||||
}
|
||||
@ -545,7 +576,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
Plugin.getClanDataAccess().requestAlly(cA, cB, caller.getName());
|
||||
|
||||
// Inform
|
||||
UtilPlayer.message(caller, F.main("Clans", "You requested alliance with Clan " + F.elem(cB.getName()) + "."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You requested alliance with Clan " + F.elem(cB.getName()) + "."));
|
||||
cA.inform(F.name(caller.getName()) + " has requested alliance with Clan " + F.elem(cB.getName()) + ".", caller.getName());
|
||||
cB.inform("Clan " + F.elem(cA.getName()) + " has requested alliance with you.", null);
|
||||
|
||||
@ -559,19 +590,19 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
//
|
||||
// if (cA == null)
|
||||
// {
|
||||
// UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
// _manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (cA.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && cA.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN)
|
||||
// {
|
||||
// UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can manage Trust."));
|
||||
// _manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can manage Trust."));
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (args.length < 2)
|
||||
// {
|
||||
// UtilPlayer.message(caller, F.main("Clans", "You did not input a Clan to enemy."));
|
||||
// _manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a Clan to enemy."));
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
@ -581,7 +612,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
//
|
||||
// if (!cA.isAlly(cB.getName()))
|
||||
// {
|
||||
// UtilPlayer.message(caller, F.main("Clans", "You must be allied to trust a clan!"));
|
||||
// _manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must be allied to trust a clan!"));
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
@ -589,14 +620,14 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
// if (Plugin.getClanDataAccess().trust(cA, cB, caller.getName()))
|
||||
// {
|
||||
// // Inform
|
||||
// UtilPlayer.message(caller, F.main("Clans", "You gave trust to " + F.elem("Clan " + cB.getName()) + "."));
|
||||
// _manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You gave trust to " + F.elem("Clan " + cB.getName()) + "."));
|
||||
// cA.inform(F.name(caller.getName()) + " has given trust to " + F.elem("Clan " + cB.getName()) + ".", caller.getName());
|
||||
// cB.inform(F.elem("Clan " + cA.getName()) + " has given trust to you.", null);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // Inform
|
||||
// UtilPlayer.message(caller, F.main("Clans", "You revoked trust to " + F.elem("Clan " + cB.getName()) + "."));
|
||||
// _manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You revoked trust to " + F.elem("Clan " + cB.getName()) + "."));
|
||||
// cA.inform(F.name(caller.getName()) + " has revoked trust to " + F.elem("Clan " + cB.getName()) + ".", caller.getName());
|
||||
// cB.inform(F.elem("Clan " + cA.getName()) + " has revoked trust to you.", null);
|
||||
// }
|
||||
@ -608,19 +639,19 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
if (cA == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (cA.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && cA.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can manage relationships."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can manage relationships."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.length < 2)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You did not input a Clan to set neutrality with."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a Clan to set neutrality with."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -630,11 +661,11 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
if (cB.isSelf(cA.getName()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You prefer to think of yourself positively..."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You prefer to think of yourself positively..."));
|
||||
}
|
||||
else if (cB.isNeutral(cA.getName()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are already neutral with " + F.elem("Clan " + cB.getName()) + "."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are already neutral with " + F.elem("Clan " + cB.getName()) + "."));
|
||||
}
|
||||
else if (cB.isAlly(cA.getName()))
|
||||
{
|
||||
@ -642,7 +673,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
Plugin.getClanDataAccess().neutral(cA, cB, caller.getName(), true);
|
||||
|
||||
// Inform
|
||||
UtilPlayer.message(caller, F.main("Clans", "You revoked alliance with " + F.elem("Clan " + cB.getName()) + "."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You revoked alliance with " + F.elem("Clan " + cB.getName()) + "."));
|
||||
cA.inform(F.name(caller.getName()) + " revoked alliance with " + F.elem("Clan " + cB.getName()) + ".", caller.getName());
|
||||
cB.inform(F.elem("Clan " + cA.getName()) + " has revoked alliance with you.", null);
|
||||
}
|
||||
@ -683,7 +714,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
}
|
||||
|
||||
// Change Inform
|
||||
UtilPlayer.message(caller, F.main("Clans", "You can no longer 'steal' territory. " + "You simply unclaim it and it can not be reclaimed by anyone for 30 mintes." + "This was done to improve gameplay. Enjoy!"));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You can no longer 'steal' territory. " + "You simply unclaim it and it can not be reclaimed by anyone for 30 mintes." + "This was done to improve gameplay. Enjoy!"));
|
||||
|
||||
// Inform
|
||||
UtilServer.broadcast(F.main("Clans", F.elem(clientClan.getName()) + " unclaimed from " + F.elem(ownerClan.getName()) + " at " + F.elem(UtilWorld.locToStrClean(caller.getLocation())) + "."));
|
||||
@ -719,31 +750,31 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
if (clan == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (clan.getHome() == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Your Clan has not set a Home"));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Your Clan has not set a Home"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!clan.getClaimSet().contains(UtilWorld.chunkToStr(clan.getHome().getChunk())))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Your Clan has lost its Home Territory."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Your Clan has lost its Home Territory."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Plugin.getClanUtility().isSafe(caller.getLocation()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You can only use Clan Home from Spawn."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You can only use Clan Home from Spawn."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Plugin.getClanUtility().isSpecial(caller.getLocation(), "Spawn"))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You can only use Clan Home from Spawn."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You can only use Clan Home from Spawn."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -751,7 +782,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
if (!(home.getBlock().getType().equals(Material.BED_BLOCK) && home.add(0, 1, 0).getBlock().getType().equals(Material.AIR)) && home.add(0, 2, 0).getBlock().getType().equals(Material.AIR))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Your Clan's bed has been destroyed, or is obstructed."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Your Clan's bed has been destroyed, or is obstructed."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -760,7 +791,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
* (Player cur : clan.GetHome().getWorld().getPlayers()) if
|
||||
* (client.Clan().GetRelation(cur.getName()) == ClanRelation.NEUTRAL) if
|
||||
* (clan.GetClaimSet().contains(UtilWorld.chunkToStr(cur.getLocation().
|
||||
* getChunk()))) { UtilPlayer.message(caller, F.main("Clans",
|
||||
* getChunk()))) { _manager.getTutorials().sendTutorialMsg(caller, F.main("Clans",
|
||||
* "You cannot use Clan Home with enemies in your Territory.")); return;
|
||||
* }
|
||||
*/
|
||||
@ -772,7 +803,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
Plugin.getTeleport().TP(caller, clan.getHome().add(0, 1, 0));
|
||||
|
||||
// Inform
|
||||
UtilPlayer.message(caller, F.main("Clans", "You teleported to your Clan Home " + UtilWorld.locToStrClean(caller.getLocation()) + "."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You teleported to your Clan Home " + UtilWorld.locToStrClean(caller.getLocation()) + "."));
|
||||
}
|
||||
|
||||
public void homeSet(Player caller)
|
||||
@ -790,31 +821,31 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
if (clan == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can manage Clan Home."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "Only the Clan Leader and Admins can manage Clan Home."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (Plugin.getClanUtility().getOwner(caller.getLocation()) == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You must set your Clan Home in your own Territory."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must set your Clan Home in your own Territory."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Plugin.getClanUtility().getOwner(caller.getLocation()).isSelf(clan.getName()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You must set your Clan Home in your own Territory."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You must set your Clan Home in your own Territory."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(caller.getLocation().add(0, 1, 0).getBlock().getType().equals(Material.AIR) && caller.getLocation().add(0, 2, 0).getBlock().getType().equals(Material.AIR)))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "This is not a suitable place for a bed."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This is not a suitable place for a bed."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -823,7 +854,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
if (!bedPlaced)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "This is not a suitable place for a bed."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "This is not a suitable place for a bed."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -839,7 +870,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
Plugin.ClanTips.displayTip(TipType.SETHOME, caller);
|
||||
|
||||
// Inform
|
||||
UtilPlayer.message(caller, F.main("Clans", "You set Clan Home to " + F.elem(UtilWorld.locToStrClean(caller.getLocation())) + "."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You set Clan Home to " + F.elem(UtilWorld.locToStrClean(caller.getLocation())) + "."));
|
||||
clan.inform(caller.getName() + " set Clan Home to " + F.elem(UtilWorld.locToStrClean(caller.getLocation())) + ".", caller.getName());
|
||||
}
|
||||
|
||||
@ -847,7 +878,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
{System.out.println(search);
|
||||
if (search == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You did not input a search parameter."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a search parameter."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -869,13 +900,13 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
{
|
||||
if (_manager.getClientManager().hasRank(caller, Rank.ADMIN))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "No no no, this command is not for you ;-)"));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "No no no, this command is not for you ;-)"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (search == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You did not input a search parameter."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You did not input a search parameter."));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -904,7 +935,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
if (clan == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
_manager.getTutorials().sendTutorialMsg(caller, F.main("Clans", "You are not in a Clan."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -914,6 +945,6 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
|
||||
if (clan == null) return;
|
||||
|
||||
UtilPlayer.message(caller, clan.mTerritory());
|
||||
_manager.getTutorials().sendTutorialMsg(caller, clan.mTerritory());
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ public class RegionsCommand extends CommandBase<ClansManager>
|
||||
|
||||
public RegionsCommand(ClansManager plugin)
|
||||
{
|
||||
super(plugin, Rank.ADMIN, new Rank[]{Rank.JNR_DEV},"region-reset");
|
||||
super(plugin, Rank.ADMIN,"region-reset");
|
||||
|
||||
_manager = plugin;
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import org.bukkit.entity.Player;
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.task.TaskManager;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.tutorials.Tutorial;
|
||||
import mineplex.game.clans.tutorials.TutorialManager;
|
||||
import mineplex.game.clans.tutorials.gettingstarted.TutorialGettingStarted;
|
||||
@ -15,26 +16,34 @@ public class RestartTutCommand extends CommandBase<TutorialManager>
|
||||
{
|
||||
public RestartTutCommand(TutorialManager plugin)
|
||||
{
|
||||
super(plugin, Rank.ALL, "rst", "rstut");
|
||||
super(plugin, Rank.ALL, "rst", "rstut", "reset");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
String ignoreString = String.format(Tutorial.TUTORIAL_REWARD_TASK, "GettingStartedTutorial");
|
||||
Integer ignoreInt = TaskManager.Instance.getTaskId(ignoreString);
|
||||
|
||||
Iterator<Integer> it = TaskManager.Instance.Get(caller).TasksCompleted.iterator();
|
||||
while (it.hasNext())
|
||||
if (ClansManager.getInstance().getClanUtility().getClaim(caller.getLocation()) != null
|
||||
&& ClansManager.getInstance().getClanUtility().getClaim(caller.getLocation()).isSafe(caller.getLocation()))
|
||||
{
|
||||
Integer i = it.next();
|
||||
if (i != null && (ignoreInt == null || i.intValue() != ignoreInt.intValue()))
|
||||
String ignoreString = String.format(Tutorial.TUTORIAL_REWARD_TASK, "GettingStartedTutorial");
|
||||
Integer ignoreInt = TaskManager.Instance.getTaskId(ignoreString);
|
||||
|
||||
Iterator<Integer> it = TaskManager.Instance.Get(caller).TasksCompleted.iterator();
|
||||
while (it.hasNext())
|
||||
{
|
||||
it.remove();
|
||||
Integer i = it.next();
|
||||
if (i != null && (ignoreInt == null || i.intValue() != ignoreInt.intValue()))
|
||||
{
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
|
||||
TutorialManager.Instance.cancelTutorial(caller);
|
||||
TutorialManager.Instance.startTutorial(TutorialGettingStarted.class, caller);
|
||||
}
|
||||
else
|
||||
{
|
||||
TutorialManager.Instance.sendTutorialMsg(caller, "You must be in a safezone to restart the tutorial.");
|
||||
}
|
||||
|
||||
TutorialManager.Instance.cancelTutorial(caller);
|
||||
TutorialManager.Instance.startTutorial(TutorialGettingStarted.class, caller);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,63 @@
|
||||
package mineplex.game.clans.clans.event;
|
||||
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import mineplex.game.clans.clans.ClanInfo;
|
||||
|
||||
public class PlayerPreClaimTerritoryEvent extends Event
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private Player _claimer;
|
||||
private Chunk _claimedChunk;
|
||||
|
||||
private boolean _cancelled;
|
||||
|
||||
private ClanInfo _clan;
|
||||
|
||||
public PlayerPreClaimTerritoryEvent(Player claimer, Chunk claimedChunk, ClanInfo clan)
|
||||
{
|
||||
_claimer = claimer;
|
||||
_claimedChunk = claimedChunk;
|
||||
_clan = clan;
|
||||
}
|
||||
|
||||
public Player getClaimer()
|
||||
{
|
||||
return _claimer;
|
||||
}
|
||||
|
||||
public ClanInfo getClan()
|
||||
{
|
||||
return _clan;
|
||||
}
|
||||
|
||||
public Chunk getClaimedChunk()
|
||||
{
|
||||
return _claimedChunk;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancelled)
|
||||
{
|
||||
_cancelled = cancelled;
|
||||
}
|
||||
|
||||
public boolean isCancelled()
|
||||
{
|
||||
return _cancelled;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
}
|
@ -27,8 +27,9 @@ public class ScoreboardElementPlayerCount implements ScoreboardElement
|
||||
public List<String> getLines(ScoreboardManager manager, Player player, List<String> out)
|
||||
{
|
||||
List<String> output = new ArrayList<String>();
|
||||
output.add(C.cYellow + "Players Online: " + UtilServer.getPlayers().length + "/100");
|
||||
|
||||
output.add("");
|
||||
output.add(C.cYellow + "Players Online " + UtilServer.getPlayers().length + "/100");
|
||||
|
||||
return output;
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ import mineplex.minecraft.game.core.boss.WorldEvent;
|
||||
public enum WorldEventType
|
||||
{
|
||||
// SLIME_KING("Slime King", SlimeBoss.class, 30),
|
||||
KING_HILL("King of The Hill", KingHill.class, 30),
|
||||
// KING_HILL("King of The Hill", KingHill.class, 30),
|
||||
UNDEAD_CAMP("Undead Camp", UndeadCamp.class, 30);// ,
|
||||
// Golem("Iron Wizard", GolemBoss.class, 30);
|
||||
|
||||
|
@ -41,7 +41,7 @@ public class HillData
|
||||
|
||||
public boolean isOnHill(Location location, Location eventLocation)
|
||||
{
|
||||
return location.getWorld().equals(eventLocation.getWorld()) && UtilMath.offset(location, eventLocation) <= 36;
|
||||
return location.getWorld().equals(eventLocation.getWorld()) && UtilMath.offset(location, eventLocation.clone().add(0, 12, 0)) <= 7.5;
|
||||
}
|
||||
|
||||
public Location getHillCenter(Location eventLocation)
|
||||
|
@ -117,7 +117,7 @@ public class KingHill extends WorldEvent
|
||||
if (_hill.isOnHill(player.getLocation(), getCenterLocation()))
|
||||
{
|
||||
ClanInfo playerClan = _clansManager.getClan(player);
|
||||
if (playerClan != null)
|
||||
if (playerClan != null && !playerClan.equals(lastClan))
|
||||
{
|
||||
clanCount++;
|
||||
lastClan = playerClan;
|
||||
|
@ -55,6 +55,7 @@ import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilItem;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
@ -433,7 +434,7 @@ public class Gameplay extends MiniPlugin
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void replantTree(BlockBreakEvent event)
|
||||
{
|
||||
Block block = event.getBlock();
|
||||
final Block block = event.getBlock();
|
||||
|
||||
if (!UtilItem.isLog(block.getType()))
|
||||
{
|
||||
@ -455,22 +456,15 @@ public class Gameplay extends MiniPlugin
|
||||
return;
|
||||
}
|
||||
|
||||
Location saplingArea = null;
|
||||
final byte data = block.getData();
|
||||
|
||||
for (Block otherBlock : UtilBlock.getInRadius(event.getBlock().getLocation(), 4.5).keySet())
|
||||
{
|
||||
if (!otherBlock.equals(UtilBlock.getHighest(otherBlock.getLocation().getWorld(), otherBlock.getX(), otherBlock.getZ())))
|
||||
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable() {
|
||||
public void run()
|
||||
{
|
||||
saplingArea = otherBlock.getLocation();
|
||||
if (Math.random() > .75)
|
||||
{
|
||||
break;
|
||||
}
|
||||
block.setType(Material.SAPLING);
|
||||
block.setData(data);
|
||||
}
|
||||
}
|
||||
|
||||
saplingArea.add(0, 1, 0).getBlock().setType(Material.SAPLING);
|
||||
saplingArea.getBlock().setData(block.getData());
|
||||
}, 20 * 5);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -12,7 +12,7 @@ public class GearCommand extends CommandBase<GearManager>
|
||||
|
||||
public GearCommand(GearManager plugin)
|
||||
{
|
||||
super(plugin, Rank.ADMIN, new Rank[]{Rank.JNR_DEV}, "gear", "custom-gear");
|
||||
super(plugin, Rank.ADMIN, "gear", "custom-gear");
|
||||
_gearManager = plugin;
|
||||
}
|
||||
|
||||
|
@ -1,46 +0,0 @@
|
||||
package mineplex.game.clans.tutorials;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
public class DeployedTask implements Listener
|
||||
{
|
||||
protected Player _player;
|
||||
protected boolean _finished;
|
||||
|
||||
protected TutorialTask<?> _task;
|
||||
|
||||
protected boolean _dead;
|
||||
|
||||
public DeployedTask(Player player, TutorialTask<?> task)
|
||||
{
|
||||
_player = player;
|
||||
|
||||
_task = task;
|
||||
}
|
||||
|
||||
public void postDeploy()
|
||||
{
|
||||
}
|
||||
|
||||
public boolean checkForDeath()
|
||||
{
|
||||
return _dead || _player == null;
|
||||
}
|
||||
|
||||
public void finish()
|
||||
{
|
||||
onFinish();
|
||||
_task.finishFor(_player);
|
||||
}
|
||||
|
||||
public void kill()
|
||||
{
|
||||
_dead = true;
|
||||
_player = null;
|
||||
}
|
||||
|
||||
public void onFinish() {
|
||||
}
|
||||
|
||||
}
|
@ -29,7 +29,11 @@ import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.packethandler.IPacketHandler;
|
||||
import mineplex.core.packethandler.PacketHandler;
|
||||
import mineplex.core.packethandler.PacketInfo;
|
||||
import mineplex.core.scoreboard.ScoreboardManager;
|
||||
import mineplex.core.scoreboard.elements.ScoreboardElement;
|
||||
import mineplex.core.task.TaskManager;
|
||||
@ -38,6 +42,7 @@ import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.clans.event.ClanTipEvent;
|
||||
import mineplex.game.clans.economy.GoldManager;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutChat;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -53,6 +58,8 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
||||
public static String TUTORIAL_REWARD_TASK = "tatatatatat%sRewardGiven"; //do not change
|
||||
public static String SKIPPED_TASK = "tatatatata%sSkip";
|
||||
|
||||
public static String AllowedMessage = C.cGold + "TutorialAllowedMessage" + C.Reset;
|
||||
|
||||
protected final TutorialManager _manager;
|
||||
protected final GoldManager _goldManager;
|
||||
protected final ClansManager _clansManager;
|
||||
@ -75,7 +82,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
||||
protected int _gemReward = -1;
|
||||
protected int _coinReward = -1;
|
||||
|
||||
public Tutorial(final GoldManager goldManager, final TaskManager taskManager, final ClansManager clansManager, final DonationManager donationManager, final TutorialManager manager)
|
||||
public Tutorial(final GoldManager goldManager, final TaskManager taskManager, final ClansManager clansManager, final DonationManager donationManager, final TutorialManager manager, final PacketHandler packetHandler)
|
||||
{
|
||||
_clansManager = clansManager;
|
||||
_goldManager = goldManager;
|
||||
@ -144,40 +151,62 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
||||
|
||||
protected boolean hasFinishedTask(Player player, TutorialTask<?> task)
|
||||
{
|
||||
if (get(player).QueuedFinish)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return get(player).CurrentTask.getID() < task.getID();
|
||||
}
|
||||
|
||||
protected void finishTask(final Player player, final TutorialTask<?> task)
|
||||
{
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
get(player).LastDescriptionSentTime = 0;
|
||||
get(player).CurrentTask.visibleFinish(player);
|
||||
get(player).CurrentTask = task.equals(_tasks.get(_tasks.size())) ? null : _tasks.get(task.getID() + 1);
|
||||
|
||||
if (!_taskManager.hasCompletedTask(player, String.format(TASK_COMPLETE_TASK, _technicalName, task.getTechnicalName())))
|
||||
// 6 Seconds for player to read the finish message (sent by the line above)
|
||||
// (will be instant if get(player).CurrentTask.getFinishMessage() is null).
|
||||
_manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(_manager.getPlugin(), new Runnable()
|
||||
{
|
||||
_taskManager.completedTask(new Callback<Boolean>()
|
||||
public void run()
|
||||
{
|
||||
public void run(final Boolean completed)
|
||||
// Cycle to next task, or null if last task.
|
||||
get(player).CurrentTask = task.equals(_tasks.get(_tasks.size())) ? null : _tasks.get(task.getID() + 1);
|
||||
|
||||
if (!_taskManager.hasCompletedTask(player, String.format(TASK_COMPLETE_TASK, _technicalName, task.getTechnicalName())))
|
||||
{
|
||||
if (task.equals(_tasks.get(_tasks.size())))
|
||||
_taskManager.completedTask(new Callback<Boolean>()
|
||||
{
|
||||
finishFor(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
_manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(_manager.getPlugin(), new Runnable()
|
||||
public void run(final Boolean completed)
|
||||
{
|
||||
public void run()
|
||||
// If last task, end tutorial.
|
||||
if (task.equals(_tasks.get(_tasks.size())))
|
||||
{
|
||||
get(player).CurrentTask.deploy(player);
|
||||
finishFor(player);
|
||||
}
|
||||
}, 10L);
|
||||
}
|
||||
|
||||
player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1.5f);
|
||||
else
|
||||
{
|
||||
// Start next task in 1.5 Seconds (just to give a more smooth feel to the tutorial)
|
||||
_manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(_manager.getPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
get(player).CurrentTask.startFor(player);
|
||||
}
|
||||
}, 30L);
|
||||
}
|
||||
|
||||
player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1.5f);
|
||||
}
|
||||
}, player, String.format(TASK_COMPLETE_TASK, _technicalName, task.getTechnicalName()));
|
||||
}
|
||||
}, player, String.format(TASK_COMPLETE_TASK, _technicalName, task.getTechnicalName()));
|
||||
}
|
||||
}
|
||||
}, get(player).CurrentTask._finishMessage == null ? 1L : 6 * 20L);
|
||||
}
|
||||
|
||||
public TutorialTask<?> getTask(final String technicalName)
|
||||
@ -223,77 +252,95 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
||||
|
||||
private void finishFor(final Player player)
|
||||
{
|
||||
if (player.getOpenInventory() != null)
|
||||
{
|
||||
_inTutorial.get(player.getName()).QueuedFinish = true;
|
||||
return;
|
||||
}
|
||||
|
||||
_inTutorial.remove(player.getName());
|
||||
|
||||
UtilFirework.launchFirework(player.getLocation(), Type.BALL_LARGE, Color.LIME, false, false, new Vector(0, 0, 0), 1);
|
||||
onFinished(player);
|
||||
|
||||
if (!_taskManager.hasCompletedTask(player, String.format(TUTORIAL_REWARD_TASK, _technicalName)))
|
||||
UtilTextMiddle.display(C.cWhite + "Clans Tutorial", C.cGreen + "You have completed the Clans Tutorial!", 20, 20 * 3, 20);
|
||||
|
||||
_manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(_manager.getPlugin(), new Runnable()
|
||||
{
|
||||
_taskManager.completedTask(new Callback<Boolean>()
|
||||
public void run()
|
||||
{
|
||||
@Override
|
||||
public void run(Boolean data)
|
||||
// Custom Finish Method (usually messages)
|
||||
onFinished(player);
|
||||
|
||||
// Do Reward
|
||||
if (!_taskManager.hasCompletedTask(player, String.format(TUTORIAL_REWARD_TASK, _technicalName)))
|
||||
{
|
||||
if (_goldReward != -1)
|
||||
_taskManager.completedTask(new Callback<Boolean>()
|
||||
{
|
||||
_goldManager.addGold(player, _goldReward);
|
||||
UtilPlayer.message(player, F.main("Tutorials", "You have been awarded " + F.elem(_goldReward + " Gold") + "."));
|
||||
}
|
||||
|
||||
if (_gemReward != -1)
|
||||
{
|
||||
_donationManager.RewardGems(new Callback<Boolean>() {
|
||||
public void run(Boolean data)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Tutorials", "You have been awarded " + F.elem(_goldReward + " Gems") + "."));
|
||||
}
|
||||
}, "Clans", player.getName(), player.getUniqueId(), _gemReward);
|
||||
}
|
||||
|
||||
if (_coinReward != -1)
|
||||
{
|
||||
_donationManager.RewardCoins(new Callback<Boolean>() {
|
||||
public void run(Boolean data)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Tutorials", "You have been awarded " + F.elem(_coinReward + " Coins") + "."));
|
||||
}
|
||||
}, "Clans", player.getName(), _clansManager.getClientManager().getAccountId(player), _coinReward);
|
||||
}
|
||||
}
|
||||
}, player, String.format(TUTORIAL_REWARD_TASK, _technicalName));
|
||||
|
||||
}
|
||||
|
||||
if (!_taskManager.hasCompletedTask(player, String.format(TUTORIAL_COMPLETE_TASK, _technicalName)))
|
||||
{
|
||||
_taskManager.completedTask(new Callback<Boolean>()
|
||||
{
|
||||
public void run(final Boolean completed)
|
||||
{
|
||||
if (_ghostMode)
|
||||
{
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
@Override
|
||||
public void run(Boolean data)
|
||||
{
|
||||
other.showPlayer(player);
|
||||
player.showPlayer(other);
|
||||
if (_goldReward != -1)
|
||||
{
|
||||
_goldManager.addGold(player, _goldReward);
|
||||
_manager.sendTutorialMsg(player, F.main("Tutorials", "You have been awarded " + F.elem(_goldReward + " Gold") + "."));
|
||||
}
|
||||
|
||||
if (_gemReward != -1)
|
||||
{
|
||||
_donationManager.RewardGems(new Callback<Boolean>() {
|
||||
public void run(Boolean data)
|
||||
{
|
||||
_manager.sendTutorialMsg(player, F.main("Tutorials", "You have been awarded " + F.elem(_goldReward + " Gems") + "."));
|
||||
}
|
||||
}, "Clans", player.getName(), player.getUniqueId(), _gemReward);
|
||||
}
|
||||
|
||||
if (_coinReward != -1)
|
||||
{
|
||||
_donationManager.RewardCoins(new Callback<Boolean>() {
|
||||
public void run(Boolean data)
|
||||
{
|
||||
_manager.sendTutorialMsg(player, F.main("Tutorials", "You have been awarded " + F.elem(_coinReward + " Coins") + "."));
|
||||
}
|
||||
}, "Clans", player.getName(), _clansManager.getClientManager().getAccountId(player), _coinReward);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
final int index = i;
|
||||
_manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(_manager.getPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
UtilFirework.launchFirework(player.getLocation(), Type.BALL_LARGE, (index % 2 == 0) ? Color.RED : Color.LIME, false, false, new Vector(0, 0, 0), 0);
|
||||
}
|
||||
}, i * 10);
|
||||
}
|
||||
}, player, String.format(TUTORIAL_REWARD_TASK, _technicalName));
|
||||
}
|
||||
}, player, String.format(TUTORIAL_COMPLETE_TASK, _technicalName));
|
||||
}
|
||||
|
||||
_manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(_manager.getPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
// Sets the tutorial as complete in the TaskManager and effects.
|
||||
_taskManager.completedTask(new Callback<Boolean>()
|
||||
{
|
||||
public void run(final Boolean completed)
|
||||
{
|
||||
if (_ghostMode)
|
||||
{
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
{
|
||||
other.showPlayer(player);
|
||||
player.showPlayer(other);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
final int index = i;
|
||||
_manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(_manager.getPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
UtilFirework.launchFirework(player.getLocation(), Type.BALL_LARGE, (index % 2 == 0) ? Color.RED : Color.LIME, false, false, new Vector(0, 0, 0), 0);
|
||||
}
|
||||
}, i * 10);
|
||||
}
|
||||
}
|
||||
}, player, String.format(TUTORIAL_COMPLETE_TASK, _technicalName));
|
||||
}
|
||||
}, 20 * 2);
|
||||
}
|
||||
}, 20 * 4);
|
||||
}
|
||||
|
||||
// Implementation left to sub classes.
|
||||
@ -315,7 +362,7 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
||||
|
||||
_inTutorial.put(player.getName(), new TutorialClient(player, this));
|
||||
|
||||
get(player).CurrentTask.deploy(player);
|
||||
get(player).CurrentTask.startFor(player);
|
||||
|
||||
player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1.5f);
|
||||
|
||||
@ -373,6 +420,9 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
||||
public void skip(final Player player)
|
||||
{
|
||||
new JsonMessage(
|
||||
AllowedMessage
|
||||
)
|
||||
.extra(
|
||||
F.main(
|
||||
"Tutorial",
|
||||
"Are you sure you want to skip the tutorial? We "
|
||||
@ -443,6 +493,19 @@ public abstract class Tutorial implements ScoreboardElement, Listener
|
||||
{
|
||||
if (isInTutorial(player))
|
||||
{
|
||||
if (get(player).QueuedFinish)
|
||||
{
|
||||
if (player.getOpenInventory() == null)
|
||||
{
|
||||
get(player).QueuedFinish = false;
|
||||
finishFor(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
get(player).CurrentTask.trySendDescription(player);
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,8 @@ public class TutorialClient
|
||||
public Player Player;
|
||||
public TutorialTask<?> CurrentTask;
|
||||
public long LastDescriptionSentTime = System.currentTimeMillis() - 3000;
|
||||
public boolean InClanOnStart;
|
||||
public boolean QueuedFinish;
|
||||
|
||||
public TutorialClient(Player player, Tutorial tutorial)
|
||||
{
|
||||
@ -16,11 +18,15 @@ public class TutorialClient
|
||||
|
||||
CurrentTask = tutorial._tasks.get(1);
|
||||
|
||||
InClanOnStart = tutorial._clansManager.isInClan(player);
|
||||
|
||||
for (TutorialTask<?> task : tutorial._tasks.values())
|
||||
{
|
||||
if (TaskManager.Instance.hasCompletedTask(player, String.format(
|
||||
Tutorial.TASK_COMPLETE_TASK,
|
||||
task.getTutorial().getTechnicalName(), task.getTechnicalName())))
|
||||
task.getTutorial().getTechnicalName(),
|
||||
task.getTechnicalName()
|
||||
)))
|
||||
{
|
||||
if (CurrentTask.getID() <= task.getID())
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
package mineplex.game.clans.tutorials;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
@ -12,6 +13,9 @@ import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.packethandler.IPacketHandler;
|
||||
import mineplex.core.packethandler.PacketHandler;
|
||||
import mineplex.core.packethandler.PacketInfo;
|
||||
import mineplex.core.preferences.PreferencesManager;
|
||||
import mineplex.core.task.TaskManager;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
@ -20,6 +24,8 @@ import mineplex.game.clans.economy.GoldManager;
|
||||
import mineplex.game.clans.tutorials.commands.DoSkipTutorialCommand;
|
||||
import mineplex.game.clans.tutorials.commands.SkipTutorialCommand;
|
||||
import mineplex.game.clans.tutorials.gettingstarted.TutorialGettingStarted;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutChat;
|
||||
|
||||
public class TutorialManager extends MiniPlugin
|
||||
{
|
||||
@ -30,7 +36,7 @@ public class TutorialManager extends MiniPlugin
|
||||
|
||||
private final TaskManager _taskManager;
|
||||
|
||||
public TutorialManager(final JavaPlugin plugin, final GoldManager goldManager, final TaskManager taskManager, final DonationManager donationManager, final PreferencesManager preferencesManager, final ClansManager clansManager)
|
||||
public TutorialManager(final JavaPlugin plugin, final GoldManager goldManager, final TaskManager taskManager, final DonationManager donationManager, final PreferencesManager preferencesManager, final ClansManager clansManager, final PacketHandler packetHandler)
|
||||
{
|
||||
super("Tutorials", plugin);
|
||||
|
||||
@ -38,7 +44,37 @@ public class TutorialManager extends MiniPlugin
|
||||
|
||||
_taskManager = taskManager;
|
||||
|
||||
_tutorials.put(TutorialGettingStarted.class, new TutorialGettingStarted(this, clansManager, donationManager, goldManager,taskManager));
|
||||
_tutorials.put(TutorialGettingStarted.class, new TutorialGettingStarted(this, clansManager, donationManager, goldManager, taskManager, packetHandler));
|
||||
|
||||
packetHandler.addPacketHandler(new IPacketHandler() {
|
||||
public void handle(PacketInfo packet)
|
||||
{
|
||||
if (packet.getPacket() instanceof PacketPlayOutChat)
|
||||
{
|
||||
PacketPlayOutChat chat = (PacketPlayOutChat) packet.getPacket();
|
||||
|
||||
if (chat.b == 1)
|
||||
{
|
||||
if (chat.a.a().isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (chat.a.a().get(0).c().equals(ChatColor.stripColor(Tutorial.AllowedMessage)))
|
||||
{
|
||||
chat.a.a().remove(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isInTutorial(packet.getPlayer()))
|
||||
{
|
||||
packet.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}, PacketPlayOutChat.class);
|
||||
}
|
||||
|
||||
public void addCommands()
|
||||
@ -58,7 +94,6 @@ public class TutorialManager extends MiniPlugin
|
||||
if (_tutorials.containsKey(tutorial))
|
||||
{
|
||||
_tutorials.get(tutorial).startFor(player);
|
||||
_playerTutorials.put(player.getName(), _tutorials.get(tutorial));
|
||||
|
||||
return isInTutorial(player);
|
||||
}
|
||||
@ -78,7 +113,7 @@ public class TutorialManager extends MiniPlugin
|
||||
getTutorial(player).cancelFor(player);
|
||||
|
||||
|
||||
UtilPlayer.message(player, F.main("Tutorials", "You have cancelled the " + F.elem(getTutorial(player)._displayName + " Tutorial") + "."));
|
||||
sendTutorialMsg(player, F.main("Tutorials", "You have cancelled the " + F.elem(getTutorial(player)._displayName + " Tutorial") + "."));
|
||||
_playerTutorials.remove(player.getName());
|
||||
}
|
||||
}
|
||||
@ -95,7 +130,7 @@ public class TutorialManager extends MiniPlugin
|
||||
{
|
||||
if (isInTutorial(player))
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Tutorials", "You have skipped the " + F.elem(getTutorial(player)._displayName + " Tutorial") + "."));
|
||||
sendTutorialMsg(player, F.main("Tutorials", "You have skipped the " + F.elem(getTutorial(player)._displayName + " Tutorial") + "."));
|
||||
getTutorial(player).doSkip(player);
|
||||
}
|
||||
}
|
||||
@ -109,6 +144,19 @@ public class TutorialManager extends MiniPlugin
|
||||
getTutorial(event.getPlayer()).cleanup(event.getPlayer());
|
||||
}
|
||||
|
||||
public void sendTutorialMsg(Player player, String message)
|
||||
{
|
||||
player.sendMessage(Tutorial.AllowedMessage + message);
|
||||
}
|
||||
|
||||
public void sendTutorialMsg(Player player, LinkedList<String> messages)
|
||||
{
|
||||
for (String message : messages)
|
||||
{
|
||||
sendTutorialMsg(player, message);
|
||||
}
|
||||
}
|
||||
|
||||
public Tutorial getTutorial(final Player player)
|
||||
{
|
||||
return _playerTutorials.get(player.getName());
|
||||
|
@ -1,25 +1,18 @@
|
||||
package mineplex.game.clans.tutorials;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.NautArrayList;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
|
||||
public class TutorialTask<T extends Tutorial> implements Listener
|
||||
{
|
||||
private T _tutorial;
|
||||
protected T _tutorial;
|
||||
|
||||
protected long _autoCompleteTime = -1;
|
||||
|
||||
@ -29,13 +22,17 @@ public class TutorialTask<T extends Tutorial> implements Listener
|
||||
protected String _description;
|
||||
protected String _finishMessage;
|
||||
|
||||
protected Location _taskPos;
|
||||
|
||||
// How much time after the beginning the task/last teleport it should take to teleport back to _taskPos.
|
||||
protected int _taskTpDelay = 2 * 60 * 20;
|
||||
|
||||
protected long _descriptionWaitTime = 30000;
|
||||
|
||||
private List<String> _playersFinished = new ArrayList<>();
|
||||
|
||||
private Map<String, DeployedTask> _deployedInstances = new HashMap<>();
|
||||
private List<DeployedTask> _toCull = new ArrayList<>();
|
||||
protected NautArrayList<String> _playersFinished = new NautArrayList<>();
|
||||
protected NautArrayList<String> _inTask = new NautArrayList<>();
|
||||
|
||||
private long _lastTaskTp;
|
||||
private int _id;
|
||||
|
||||
public TutorialTask(T tutorial, int id)
|
||||
@ -46,32 +43,58 @@ public class TutorialTask<T extends Tutorial> implements Listener
|
||||
UtilServer.getServer().getPluginManager().registerEvents(this, _tutorial._manager.getPlugin());
|
||||
}
|
||||
|
||||
protected DeployedTask deploy(final Player player)
|
||||
protected void customStartFor(final Player player)
|
||||
{
|
||||
DeployedTask task = customDeploy(player);
|
||||
|
||||
_deployedInstances.put(player.getName(), task);
|
||||
|
||||
UtilServer.getServer().getPluginManager().registerEvents(task, _tutorial._manager.getPlugin());
|
||||
}
|
||||
|
||||
protected void customEndFor(final Player player)
|
||||
{
|
||||
}
|
||||
|
||||
protected final void startFor(final Player player)
|
||||
{
|
||||
_inTask.add(player.getName());
|
||||
|
||||
trySendDescription(player);
|
||||
|
||||
customStartFor(player);
|
||||
|
||||
if (_taskPos != null)
|
||||
{
|
||||
player.teleport(_taskPos);
|
||||
_lastTaskTp = System.currentTimeMillis();
|
||||
if (_taskTpDelay != -1)
|
||||
{
|
||||
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(_tutorial._manager.getPlugin(), new Runnable(){
|
||||
public void run()
|
||||
{
|
||||
if (isDoing(player))
|
||||
{
|
||||
player.teleport(_taskPos);
|
||||
_lastTaskTp = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
}, _taskTpDelay);
|
||||
}
|
||||
}
|
||||
|
||||
if (_autoCompleteTime != -1)
|
||||
{
|
||||
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(_tutorial._manager.getPlugin(), new Runnable(){
|
||||
public void run()
|
||||
{
|
||||
if (_deployedInstances.containsKey(player.getName()))
|
||||
if (isDoing(player))
|
||||
{
|
||||
finishFor(player);
|
||||
}
|
||||
}
|
||||
}, _autoCompleteTime);
|
||||
}
|
||||
|
||||
task.postDeploy();
|
||||
|
||||
return task;
|
||||
}
|
||||
|
||||
public boolean isDoing(Player player)
|
||||
{
|
||||
return _inTask != null && player != null && _inTask.contains(player.getName());
|
||||
}
|
||||
|
||||
public void trySendDescription(Player player)
|
||||
@ -83,34 +106,38 @@ public class TutorialTask<T extends Tutorial> implements Listener
|
||||
|
||||
TutorialClient client = _tutorial.get(player);
|
||||
|
||||
if (client.QueuedFinish)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (System.currentTimeMillis() - client.LastDescriptionSentTime > client.CurrentTask.getDescriptionWaitTime())
|
||||
{
|
||||
UtilPlayer.message(player, " ");
|
||||
UtilPlayer.message(player, " ");
|
||||
UtilPlayer.message(player, " ");
|
||||
UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||
UtilPlayer.message(player, " ");
|
||||
UtilPlayer.message(player, C.cYellowB + "Part " + _id + ": " + _displayName);
|
||||
UtilPlayer.message(player, C.cWhite + _description.replace("{", C.cAqua).replace("}", C.cWhite));
|
||||
UtilPlayer.message(player, " ");
|
||||
UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||
_tutorial._manager.sendTutorialMsg(player, " ");
|
||||
_tutorial._manager.sendTutorialMsg(player, " ");
|
||||
_tutorial._manager.sendTutorialMsg(player, " ");
|
||||
_tutorial._manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||
_tutorial._manager.sendTutorialMsg(player, " ");
|
||||
_tutorial._manager.sendTutorialMsg(player, C.cYellowB + "Part " + _id + ": " + _displayName);
|
||||
_tutorial._manager.sendTutorialMsg(player, C.cWhite + " " + _description.replace("{", C.cAqua).replace("}", C.cWhite));
|
||||
_tutorial._manager.sendTutorialMsg(player, " ");
|
||||
_tutorial._manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||
|
||||
UtilTextMiddle.display("", getDisplayName());
|
||||
|
||||
client.LastDescriptionSentTime = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
|
||||
protected DeployedTask customDeploy(final Player player)
|
||||
{
|
||||
return new DeployedTask(player, this);
|
||||
}
|
||||
|
||||
public final void startFor(Player player)
|
||||
{
|
||||
deploy(player);
|
||||
}
|
||||
|
||||
public final boolean hasFinished(final Player player)
|
||||
{
|
||||
return _playersFinished.contains(player.getName());
|
||||
if (_tutorial.get(player).QueuedFinish)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// CurrentTask will be null if player has finished tutorial
|
||||
return _tutorial.get(player).CurrentTask == null || _tutorial.get(player).CurrentTask.getID() < getID();
|
||||
}
|
||||
|
||||
public String getDisplayName()
|
||||
@ -133,6 +160,16 @@ public class TutorialTask<T extends Tutorial> implements Listener
|
||||
return _technicalName;
|
||||
}
|
||||
|
||||
public TutorialManager getManager()
|
||||
{
|
||||
return _tutorial._manager;
|
||||
}
|
||||
|
||||
public ClansManager getClans()
|
||||
{
|
||||
return _tutorial._clansManager;
|
||||
}
|
||||
|
||||
public int getID()
|
||||
{
|
||||
return _id;
|
||||
@ -140,52 +177,30 @@ public class TutorialTask<T extends Tutorial> implements Listener
|
||||
|
||||
public void finishFor(Player player)
|
||||
{
|
||||
customEndFor(player);
|
||||
_tutorial.finishTask(player, this);
|
||||
}
|
||||
|
||||
public void visibleFinish(Player player)
|
||||
{
|
||||
_deployedInstances.get(player.getName()).kill();
|
||||
_toCull.add(_deployedInstances.get(player.getName()));
|
||||
_deployedInstances.remove(player.getName());
|
||||
_inTask.remove(player.getName());
|
||||
|
||||
if (_finishMessage != null)
|
||||
{
|
||||
UtilPlayer.message(player, " ");
|
||||
UtilPlayer.message(player, " ");
|
||||
UtilPlayer.message(player, " ");
|
||||
UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||
UtilPlayer.message(player, " ");
|
||||
UtilPlayer.message(player, C.cWhite + _finishMessage.replace("{", C.cAqua).replace("}", C.cWhite));
|
||||
UtilPlayer.message(player, " ");
|
||||
UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void update(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Iterator<DeployedTask> iterator = _toCull.iterator();
|
||||
|
||||
while(iterator.hasNext())
|
||||
{
|
||||
DeployedTask task = iterator.next();
|
||||
|
||||
task.kill();
|
||||
HandlerList.unregisterAll(task);
|
||||
iterator.remove();
|
||||
_tutorial._manager.sendTutorialMsg(player, " ");
|
||||
_tutorial._manager.sendTutorialMsg(player, " ");
|
||||
_tutorial._manager.sendTutorialMsg(player, " ");
|
||||
_tutorial._manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||
_tutorial._manager.sendTutorialMsg(player, " ");
|
||||
_tutorial._manager.sendTutorialMsg(player, C.cWhite + _finishMessage.replace("{", C.cAqua).replace("}", C.cWhite));
|
||||
_tutorial._manager.sendTutorialMsg(player, " ");
|
||||
_tutorial._manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||
}
|
||||
}
|
||||
|
||||
public void cleanup(Player player)
|
||||
{
|
||||
_deployedInstances.get(player.getName()).kill();
|
||||
_toCull.add(_deployedInstances.get(player.getName()));
|
||||
_inTask.remove(player.getName());
|
||||
_playersFinished.remove(player.getName());
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ public class SkipTutorialCommand extends CommandBase<TutorialManager>
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Tutorials", "You are not currently in a tutorial."));
|
||||
Plugin.sendTutorialMsg(caller, F.main("Tutorials", "You are not currently in a tutorial."));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,11 @@
|
||||
package mineplex.game.clans.tutorials.gettingstarted;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.clans.event.ClansCommandExecutedEvent;
|
||||
import mineplex.game.clans.tutorials.DeployedTask;
|
||||
import mineplex.game.clans.clans.event.PlayerPreClaimTerritoryEvent;
|
||||
import mineplex.game.clans.tutorials.TutorialTask;
|
||||
|
||||
public class TaskClaim extends TutorialTask<TutorialGettingStarted>
|
||||
@ -21,42 +20,24 @@ public class TaskClaim extends TutorialTask<TutorialGettingStarted>
|
||||
_description = "Clans can claim 16x16 areas of Territory! "
|
||||
+ "Once claimed, only your Clan can break/place blocks here. "
|
||||
+ "This is the perfect place to build a base and stash your items! "
|
||||
+ "You can only claim in the Wilderness, and not next to other Clans Territory. "
|
||||
+ "Claim some Territory now, by typing {/c claim}!";
|
||||
+ "You can only claim in the Wilderness, and not next to other Clan's Territory. "
|
||||
+ "To claim some territory, go into the Clans GUI by typing {/c} and {Left-Clicking}";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeployedTask customDeploy(Player player)
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onClansCommand(PlayerPreClaimTerritoryEvent event)
|
||||
{
|
||||
return new Deployed(player, this);
|
||||
}
|
||||
|
||||
class Deployed extends DeployedTask
|
||||
{
|
||||
public Deployed(Player player, TutorialTask<?> task)
|
||||
if (!isDoing(event.getClaimer()))
|
||||
{
|
||||
super(player, task);
|
||||
return;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onClansCommand(ClansCommandExecutedEvent event)
|
||||
if (!ClansManager.getInstance().isInClan(event.getClaimer()))
|
||||
{
|
||||
if (!_player.equals(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ClansManager.getInstance().isInClan(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getCommand().equals("claim"))
|
||||
{
|
||||
_task.finishFor(_player);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
finishFor(event.getClaimer());
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4,8 +4,8 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.game.clans.clans.event.ClanCreatedEvent;
|
||||
import mineplex.game.clans.tutorials.DeployedTask;
|
||||
import mineplex.game.clans.tutorials.TutorialTask;
|
||||
|
||||
public class TaskCreateClan extends TutorialTask<TutorialGettingStarted>
|
||||
@ -17,32 +17,36 @@ public class TaskCreateClan extends TutorialTask<TutorialGettingStarted>
|
||||
_displayName = "Create a Clan";
|
||||
_technicalName = "ClanCreation";
|
||||
|
||||
_description = "Before beginning, use the {/c create <ClanName>} command to start up your own Clan! ";
|
||||
_description = "Before beginning, use the {/c create <ClanName>} command to start up your own Clan! "
|
||||
+ "If you are already in a Clan, don't worry, you will automatically skip this part.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeployedTask customDeploy(Player player)
|
||||
public void customStartFor(final Player player)
|
||||
{
|
||||
return new Deployed(player, this);
|
||||
if (_tutorial.get(player).InClanOnStart)
|
||||
{
|
||||
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(getManager().getPlugin(), new Runnable(){
|
||||
public void run()
|
||||
{
|
||||
if (isDoing(player))
|
||||
{
|
||||
finishFor(player);
|
||||
}
|
||||
}
|
||||
}, 6 * 20);
|
||||
}
|
||||
}
|
||||
|
||||
class Deployed extends DeployedTask
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onClanCreated(ClanCreatedEvent event)
|
||||
{
|
||||
public Deployed(Player player, TutorialTask<?> task)
|
||||
if (!isDoing(event.getFounder()))
|
||||
{
|
||||
super(player, task);
|
||||
return;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onClanCreated(ClanCreatedEvent event)
|
||||
{
|
||||
if (!_player.equals(event.getFounder()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_task.finishFor(_player);
|
||||
}
|
||||
finishFor(event.getFounder());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
package mineplex.game.clans.tutorials.gettingstarted;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -9,7 +12,6 @@ import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.spawn.Spawn;
|
||||
import mineplex.game.clans.tutorials.DeployedTask;
|
||||
import mineplex.game.clans.tutorials.TutorialTask;
|
||||
import mineplex.minecraft.game.classcombat.Class.ClientClass;
|
||||
|
||||
@ -23,46 +25,29 @@ public class TaskCustomizeClass extends TutorialTask<TutorialGettingStarted>
|
||||
_technicalName = "CustomizeKlass";
|
||||
|
||||
_description = "Now that you have equipped a class, use this enchantment table to customize your class builds. "
|
||||
+ "Click on the enchantment table, and click the edit build button.";
|
||||
+ "Click on the enchantment table, and click the edit build button. "
|
||||
+ "Make sure to select an axe ability to try out in the next task!";
|
||||
|
||||
_taskPos = new Location(Spawn.getSpawnWorld(), 6, 66, -300, -180f, 0f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeployedTask customDeploy(Player player)
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onUpdate(final UpdateEvent event)
|
||||
{
|
||||
return new Deployed(player, this);
|
||||
}
|
||||
|
||||
class Deployed extends DeployedTask
|
||||
{
|
||||
public Deployed(Player player, TutorialTask<?> task)
|
||||
if (!event.getType().equals(UpdateType.SEC))
|
||||
{
|
||||
super(player, task);
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postDeploy()
|
||||
Iterator<String> iterator = _inTask.iterator();
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
_player.teleport(new Location(Spawn.getSpawnWorld(), 6, 66, -300, -180f, 0f));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onUpdate(final UpdateEvent event)
|
||||
{
|
||||
if (!event.getType().equals(UpdateType.SEC))
|
||||
{
|
||||
return;
|
||||
}
|
||||
Player player = Bukkit.getPlayer(iterator.next());
|
||||
final ClientClass clientclass = ClansManager.getInstance().getClassManager().Get(player);
|
||||
|
||||
if (checkForDeath())
|
||||
if (clientclass != null && clientclass.GetSavingCustomBuild() != null && clientclass.GetSavingCustomBuild().AxeSkill != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final ClientClass clientclass = ClansManager.getInstance().getClassManager().Get(_player);
|
||||
|
||||
if (clientclass != null && clientclass.GetSavingCustomBuild() != null)
|
||||
{
|
||||
_task.finishFor(_player);
|
||||
finishFor(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,8 +3,8 @@ package mineplex.game.clans.tutorials.gettingstarted;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.game.clans.clans.event.ClanDisbandedEvent;
|
||||
import mineplex.game.clans.tutorials.DeployedTask;
|
||||
import mineplex.game.clans.tutorials.TutorialTask;
|
||||
|
||||
public class TaskDisbandClan extends TutorialTask<TutorialGettingStarted>
|
||||
@ -18,31 +18,35 @@ public class TaskDisbandClan extends TutorialTask<TutorialGettingStarted>
|
||||
|
||||
_description = "Finally, let's disband your Clan to end the Tutorial. "
|
||||
+ "Simply type {/c disband} to do this. "
|
||||
+ "This will delete your Clan, and you'll be able to create or join a new one!";
|
||||
+ "This will delete your Clan, and you'll be able to create or join a new one! "
|
||||
+ "If you were already in a Clan before you originally begun the Tutorial, you will automatically skip this part.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeployedTask customDeploy(Player player)
|
||||
public void customStartFor(final Player player)
|
||||
{
|
||||
return new Deployed(player, this);
|
||||
if (_tutorial.get(player).InClanOnStart)
|
||||
{
|
||||
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(getManager().getPlugin(), new Runnable(){
|
||||
public void run()
|
||||
{
|
||||
if (isDoing(player))
|
||||
{
|
||||
finishFor(player);
|
||||
}
|
||||
}
|
||||
}, 6 * 20);
|
||||
}
|
||||
}
|
||||
|
||||
class Deployed extends DeployedTask
|
||||
@EventHandler
|
||||
public void sell(ClanDisbandedEvent event)
|
||||
{
|
||||
public Deployed(Player player, TutorialTask<?> task)
|
||||
if (!isDoing(event.getDisbander()))
|
||||
{
|
||||
super(player, task);
|
||||
return;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void sell(ClanDisbandedEvent event)
|
||||
{
|
||||
if (!_player.equals(event.getDisbander()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_task.finishFor(_player);
|
||||
}
|
||||
finishFor(event.getDisbander());
|
||||
}
|
||||
}
|
||||
|
@ -1,21 +1,18 @@
|
||||
package mineplex.game.clans.tutorials.gettingstarted;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.NautArrayList;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilItem;
|
||||
import mineplex.core.task.TaskManager;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.clans.event.ClansPlayerBuyItemEvent;
|
||||
import mineplex.game.clans.clans.event.ClansShopAddButtonEvent;
|
||||
import mineplex.game.clans.spawn.Spawn;
|
||||
import mineplex.game.clans.tutorials.DeployedTask;
|
||||
import mineplex.game.clans.tutorials.TutorialTask;
|
||||
import mineplex.minecraft.game.classcombat.Class.event.ClassEquipEvent;
|
||||
|
||||
@ -30,87 +27,83 @@ public class TaskEquipClass extends TutorialTask<TutorialGettingStarted>
|
||||
|
||||
_description = "Use the PvP Gear shop, and right-click the Villager. "
|
||||
+ "Purchase Iron Armor from the PvP Shop. "
|
||||
+ "Then put on your armor to equip a Champion’s Class.";
|
||||
+ "Then put on your armor to equip the Knight Class.";
|
||||
|
||||
_taskPos = new Location(Spawn.getSpawnWorld(), 19, 66, -305.844, -100f, 0f);
|
||||
}
|
||||
|
||||
private NautHashMap<String, NautArrayList<Material>> _bought = new NautHashMap<>();
|
||||
|
||||
@EventHandler
|
||||
public void onClassEquipped(ClassEquipEvent event)
|
||||
{
|
||||
if (!isDoing(event.getUser()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
finishFor(event.getUser());
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeployedTask customDeploy(Player player)
|
||||
public void customEndFor(Player player)
|
||||
{
|
||||
return new Deployed(player, this);
|
||||
_bought.get(player.getName()).clear();
|
||||
_bought.remove(player.getName());
|
||||
}
|
||||
|
||||
class Deployed extends DeployedTask
|
||||
@Override
|
||||
public void customStartFor(Player player)
|
||||
{
|
||||
private List<Material> _bought = new ArrayList<>();
|
||||
|
||||
public Deployed(Player player, TutorialTask<?> task)
|
||||
_bought.put(player.getName(), new NautArrayList<Material>());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void button(ClansShopAddButtonEvent event)
|
||||
{
|
||||
if (!isDoing(event.getPlayer()))
|
||||
{
|
||||
super(player, task);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(UtilItem.isArmor(event.getMaterial()) && UtilItem.isIronProduct(event.getMaterial())))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postDeploy()
|
||||
if (!TaskManager.Instance.hasCompletedTask(event.getPlayer(), "tuttoooooe" + event.getMaterial().name()) && !_bought.get(event.getPlayer().getName()).contains(event.getMaterial()))
|
||||
{
|
||||
_player.teleport(new Location(Spawn.getSpawnWorld(), 19, 66, -305.844, -100f, 0f));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onClassEquipped(ClassEquipEvent event)
|
||||
{
|
||||
if (!ClansManager.getInstance().getClassManager().Get(_player).equals(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_task.finishFor(_player);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void button(ClansShopAddButtonEvent event)
|
||||
{
|
||||
if (!_player.equals(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(UtilItem.isArmor(event.getMaterial()) && UtilItem.isIronProduct(event.getMaterial())))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!TaskManager.Instance.hasCompletedTask(event.getPlayer(), "tuttoooooe" + event.getMaterial().name()) && !_bought.contains(event.getMaterial()))
|
||||
{
|
||||
event.setBuyPrice(0);
|
||||
event.setSellPrice(0);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void buy(final ClansPlayerBuyItemEvent event)
|
||||
{
|
||||
if (!_player.equals(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(UtilItem.isArmor(event.getItem().getType()) && UtilItem.isIronProduct(event.getItem().getType())))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getCost() == 0 && _bought.contains(event.getItem().getType()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
TaskManager.Instance.completedTask(new Callback<Boolean>() {
|
||||
@Override
|
||||
public void run(Boolean data)
|
||||
{
|
||||
}
|
||||
}, event.getPlayer(), "tuttoooooe" + event.getItem().getType().name());
|
||||
_bought.add(event.getItem().getType());
|
||||
event.setBuyPrice(0);
|
||||
event.setSellPrice(0);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void buy(final ClansPlayerBuyItemEvent event)
|
||||
{
|
||||
if (!isDoing(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(UtilItem.isArmor(event.getItem().getType()) && UtilItem.isIronProduct(event.getItem().getType())))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getCost() == 0 && _bought.get(event.getPlayer().getName()).contains(event.getItem().getType()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
TaskManager.Instance.completedTask(new Callback<Boolean>() {
|
||||
@Override
|
||||
public void run(Boolean data)
|
||||
{
|
||||
}
|
||||
}, event.getPlayer(), "tuttoooooe" + event.getItem().getType().name());
|
||||
|
||||
_bought.get(event.getPlayer().getName()).add(event.getItem().getType());
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
package mineplex.game.clans.tutorials.gettingstarted;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -9,7 +12,6 @@ import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.clans.event.EnergyPageBuildEvent;
|
||||
import mineplex.game.clans.spawn.Spawn;
|
||||
import mineplex.game.clans.tutorials.DeployedTask;
|
||||
import mineplex.game.clans.tutorials.TutorialTask;
|
||||
|
||||
public class TaskExploreShops extends TutorialTask<TutorialGettingStarted>
|
||||
@ -23,65 +25,60 @@ public class TaskExploreShops extends TutorialTask<TutorialGettingStarted>
|
||||
|
||||
_description = "Welcome to the Shops! Here you can buy all kinds of things that you may require during your adventure. "
|
||||
+ "You can also sell certain items to the Villagers to make a bit of extra Gold. "
|
||||
+ "Clan Energy is required to maintain the clan, without it, you will lose all claimed Territory! "
|
||||
+ "Go to the Energy Shop and buy {Max Energy}. (FREE)";
|
||||
|
||||
_finishMessage = "Great! "
|
||||
+ "Clans use energy to control Territory. "
|
||||
+ "More territory will cause your energy to drain faster, so make sure you remember to refill it regularly!";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeployedTask customDeploy(Player player)
|
||||
public void customStartFor(Player player)
|
||||
{
|
||||
return new Deployed(player, this);
|
||||
player.teleport(new Location(Spawn.getSpawnWorld(), 17, 66.5, -330, -180f, 0f));
|
||||
|
||||
ClansManager.getInstance().getClan(player).adjustEnergy(-(ClansManager.getInstance().getClan(player).getEnergyCostPerMinute() * 60));
|
||||
}
|
||||
|
||||
class Deployed extends DeployedTask
|
||||
@EventHandler
|
||||
public void onItemPut(EnergyPageBuildEvent event)
|
||||
{
|
||||
public Deployed(Player player, TutorialTask<?> task)
|
||||
if (!isDoing(event.getPlayer()))
|
||||
{
|
||||
super(player, task);
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postDeploy()
|
||||
if (!ClansManager.getInstance().isInClan(event.getPlayer()))
|
||||
{
|
||||
_player.teleport(new Location(Spawn.getSpawnWorld(), 17, 66.5, -330, -180f, 0f));
|
||||
|
||||
ClansManager.getInstance().getClan(_player).adjustEnergy(-(ClansManager.getInstance().getClan(_player).getEnergyCostPerMinute() * 60));
|
||||
return;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onItemPut(EnergyPageBuildEvent event)
|
||||
if (ClansManager.getInstance().getClan(event.getPlayer()).getEnergyPurchasable() == 0)
|
||||
{
|
||||
if (!_player.equals(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ClansManager.getInstance().isInClan(_player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (ClansManager.getInstance().getClan(_player).getEnergyPurchasable() == 0)
|
||||
{
|
||||
_task.finishFor(_player);
|
||||
return;
|
||||
}
|
||||
|
||||
event.setFree(true);
|
||||
finishFor(event.getPlayer());
|
||||
return;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onUpdate(UpdateEvent event)
|
||||
event.setFree(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TWOSEC)
|
||||
{
|
||||
if (event.getType() != UpdateType.TWOSEC)
|
||||
return;
|
||||
}
|
||||
|
||||
Iterator<String> iterator = _inTask.iterator();
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
Player player = Bukkit.getPlayer(iterator.next());
|
||||
if (ClansManager.getInstance().getClan(player).getEnergy() == ClansManager.getInstance().getClan(player).getEnergyMax())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (ClansManager.getInstance().getClan(_player).getEnergy() == ClansManager.getInstance().getClan(_player).getEnergyMax())
|
||||
{
|
||||
_task.finishFor(_player);
|
||||
finishFor(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,55 +0,0 @@
|
||||
package mineplex.game.clans.tutorials.gettingstarted;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.clans.event.PlayerEnterTerritoryEvent;
|
||||
import mineplex.game.clans.tutorials.DeployedTask;
|
||||
import mineplex.game.clans.tutorials.TutorialTask;
|
||||
|
||||
public class TaskGoToWilderness extends TutorialTask<TutorialGettingStarted>
|
||||
{
|
||||
public TaskGoToWilderness(TutorialGettingStarted tutorial, int id)
|
||||
{
|
||||
super(tutorial, id);
|
||||
|
||||
_displayName = "Go To The Wilderness";
|
||||
_technicalName = "GoToWildy";
|
||||
|
||||
_description = "Use your Map (Slot 9) to help find your way to the Wilderness. "
|
||||
+ "The Wilderness is anywhere that is not colored on the Map. "
|
||||
+ "If you don't have a map, you can get one at any time by typing {/map}. "
|
||||
+ "You can zoom in/out on our map by left and right clicking!";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeployedTask customDeploy(Player player)
|
||||
{
|
||||
return new Deployed(player, this);
|
||||
}
|
||||
|
||||
class Deployed extends DeployedTask
|
||||
{
|
||||
public Deployed(Player player, TutorialTask<?> task)
|
||||
{
|
||||
super(player, task);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onTerritory(final PlayerEnterTerritoryEvent event)
|
||||
{
|
||||
if (!_player.equals(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getNewTerritory().contains("Wilderness"))
|
||||
{
|
||||
_task.finishFor(_player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,14 +1,13 @@
|
||||
package mineplex.game.clans.tutorials.gettingstarted;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.clans.event.PlayerEnterTerritoryEvent;
|
||||
import mineplex.game.clans.tutorials.DeployedTask;
|
||||
import mineplex.game.clans.tutorials.TutorialTask;
|
||||
|
||||
public class TaskLeaveSpawn extends TutorialTask<TutorialGettingStarted>
|
||||
@ -22,48 +21,36 @@ public class TaskLeaveSpawn extends TutorialTask<TutorialGettingStarted>
|
||||
|
||||
_description = "Now you can leave the Spawn Island. "
|
||||
+ "Don't worry, you won't get hurt from the fall! "
|
||||
+ "Once you end the tutorial, PvP will be enabled down there, so be careful!";
|
||||
+ "Once you're down there, run out a couple of blocks to get to the Wilderness. "
|
||||
+ "When you finish the tutorial, you will be vulnerable to player attacks out there, so be careful!";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeployedTask customDeploy(Player player)
|
||||
public void customStartFor(Player player)
|
||||
{
|
||||
return new Deployed(player, this);
|
||||
}
|
||||
|
||||
class Deployed extends DeployedTask
|
||||
{
|
||||
public Deployed(Player player, TutorialTask<?> task)
|
||||
if (player.getLocation().getY() < 100)
|
||||
{
|
||||
super(player, task);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postDeploy()
|
||||
{
|
||||
if (_player.getLocation().getY() < 100)
|
||||
{
|
||||
_task.finishFor(_player);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void update(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (checkForDeath())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_player.getLocation().getY() < 100){
|
||||
_task.finishFor(_player);
|
||||
}
|
||||
finishFor(player);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void update(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Iterator<String> iterator = _inTask.iterator();
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
Player player = Bukkit.getPlayer(iterator.next());
|
||||
|
||||
if (player.getLocation().getY() < 100 && getClans().getClanUtility().getClaim(player.getLocation()) == null)
|
||||
{
|
||||
finishFor(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,12 +4,12 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerItemConsumeEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.clans.event.ClansPlayerSellItemEvent;
|
||||
import mineplex.game.clans.spawn.Spawn;
|
||||
import mineplex.game.clans.tutorials.DeployedTask;
|
||||
import mineplex.game.clans.tutorials.TutorialTask;
|
||||
|
||||
public class TaskMakingMoney extends TutorialTask<TutorialGettingStarted>
|
||||
@ -23,49 +23,54 @@ public class TaskMakingMoney extends TutorialTask<TutorialGettingStarted>
|
||||
|
||||
_description = "We have given you a carrot to sell in the Organic Produce Shop. "
|
||||
+ "Click on the Villager, and {Right-Click} the carrot to sell your carrots in exchange for Gold.";
|
||||
|
||||
_finishMessage = "Good job! "
|
||||
+ "Farming and selling foods like carrots and potatoes are great ways to make money. "
|
||||
+ "You can also sell blocks, ores, and many other items that a Shop may be interested in buying.";
|
||||
|
||||
_taskPos = new Location(Spawn.getSpawnWorld(), 25.536, 66, -316.844, -100f, 0f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeployedTask customDeploy(Player player)
|
||||
public void customStartFor(Player player)
|
||||
{
|
||||
return new Deployed(player, this);
|
||||
player.getInventory().addItem(new ItemStack(Material.CARROT, 1));
|
||||
}
|
||||
|
||||
class Deployed extends DeployedTask
|
||||
@EventHandler
|
||||
public void eat(PlayerItemConsumeEvent event)
|
||||
{
|
||||
private int _carrotsSold;
|
||||
|
||||
public Deployed(Player player, TutorialTask<?> task)
|
||||
if (!isDoing(event.getPlayer()))
|
||||
{
|
||||
super(player, task);
|
||||
player.getInventory().addItem(new ItemStack(Material.CARROT_ITEM, 1));
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postDeploy()
|
||||
if (!event.getItem().getType().equals(Material.CARROT))
|
||||
{
|
||||
_player.teleport(new Location(Spawn.getSpawnWorld(), 25.536, 66, -316.844, -100f, 0f));
|
||||
return;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void button(ClansPlayerSellItemEvent event)
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void button(ClansPlayerSellItemEvent event)
|
||||
{
|
||||
if (!isDoing(event.getPlayer()))
|
||||
{
|
||||
if (!_player.equals(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ClansManager.getInstance().isInClan(_player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!event.getItem().getType().equals(Material.CARROT_ITEM))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_task.finishFor(_player);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ClansManager.getInstance().isInClan(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!event.getItem().getType().equals(Material.CARROT_ITEM))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
finishFor(event.getPlayer());
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,10 @@
|
||||
package mineplex.game.clans.tutorials.gettingstarted;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.clans.event.ClansCommandExecutedEvent;
|
||||
import mineplex.game.clans.tutorials.DeployedTask;
|
||||
import mineplex.game.clans.tutorials.TutorialTask;
|
||||
|
||||
public class TaskSetHome extends TutorialTask<TutorialGettingStarted>
|
||||
@ -19,42 +17,28 @@ public class TaskSetHome extends TutorialTask<TutorialGettingStarted>
|
||||
_technicalName = "SetClanHome";
|
||||
|
||||
_description = "You are now ready to set a Clan Home. "
|
||||
+ "To do this, use the {/c sethome} command.";
|
||||
+ "To do this, use the {/c sethome} command. "
|
||||
+ "After you set a Clan Home, you or any of your Clan mates will be able to teleport back to the Clan Home by typing {/c home} whenever they are at Spawn.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeployedTask customDeploy(Player player)
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onSetHome(ClansCommandExecutedEvent event)
|
||||
{
|
||||
return new Deployed(player, this);
|
||||
}
|
||||
|
||||
class Deployed extends DeployedTask
|
||||
{
|
||||
public Deployed(Player player, TutorialTask<?> task)
|
||||
if (!isDoing(event.getPlayer()))
|
||||
{
|
||||
super(player, task);
|
||||
return;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onSetHome(ClansCommandExecutedEvent event)
|
||||
if (!ClansManager.getInstance().isInClan(event.getPlayer()))
|
||||
{
|
||||
if (!_player.equals(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ClansManager.getInstance().isInClan(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!event.getCommand().equals("homeset"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_task.finishFor(_player);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!event.getCommand().equals("homeset"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
finishFor(event.getPlayer());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,8 +1,10 @@
|
||||
package mineplex.game.clans.tutorials.gettingstarted;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -13,13 +15,14 @@ import org.bukkit.inventory.CraftingInventory;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.NautArrayList;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.task.TaskManager;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.game.clans.clans.event.ClansPlayerBuyItemEvent;
|
||||
import mineplex.game.clans.clans.event.ClansShopAddButtonEvent;
|
||||
import mineplex.game.clans.spawn.Spawn;
|
||||
import mineplex.game.clans.tutorials.DeployedTask;
|
||||
import mineplex.game.clans.tutorials.TutorialTask;
|
||||
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
|
||||
|
||||
@ -35,95 +38,103 @@ public class TaskUseAbility extends TutorialTask<TutorialGettingStarted>
|
||||
_description = "Now that you have equipped a class, you can start using abilities. "
|
||||
+ "Purchase an Iron Axe from the PvP Shop. "
|
||||
+ "Right-Click with your Iron Axe to use your Axe Ability!";
|
||||
|
||||
_taskPos = new Location(Spawn.getSpawnWorld(), 19, 66, -305.844, -100f, 0f);
|
||||
}
|
||||
|
||||
private NautHashMap<String, NautArrayList<Material>> _bought = new NautHashMap<>();
|
||||
private NautHashMap<String, Boolean> _teleported = new NautHashMap<>();
|
||||
|
||||
@Override
|
||||
public void customStartFor(Player player)
|
||||
{
|
||||
_bought.put(player.getName(), new NautArrayList<Material>());
|
||||
_teleported.put(player.getName(), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeployedTask customDeploy(Player player)
|
||||
public void customEndFor(Player player)
|
||||
{
|
||||
return new Deployed(player, this);
|
||||
_bought.get(player.getName()).clear();
|
||||
_bought.remove(player.getName());
|
||||
_teleported.remove(player.getName());
|
||||
}
|
||||
|
||||
class Deployed extends DeployedTask
|
||||
@EventHandler
|
||||
public void teleportPlayer(UpdateEvent event)
|
||||
{
|
||||
private List<Material> _bought = new ArrayList<>();
|
||||
private boolean _teleported = false;
|
||||
if (event.getType() != UpdateType.SEC) return;
|
||||
|
||||
public Deployed(Player player, TutorialTask<?> task)
|
||||
Iterator<String> iterator = _inTask.iterator();
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
super(player, task);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void teleportPlayer(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC) return;
|
||||
|
||||
if (!_teleported && _player != null && _player.isOnline() && _player.getOpenInventory().getType() == InventoryType.CRAFTING)
|
||||
Player _player = Bukkit.getPlayer(iterator.next());
|
||||
|
||||
if (!_teleported.get(_player.getName()) && _player != null && _player.isOnline() && _player.getOpenInventory().getType() == InventoryType.CRAFTING)
|
||||
{
|
||||
_player.teleport(new Location(Spawn.getSpawnWorld(), 19, 66, -305.844, -100f, 0f));
|
||||
_teleported = true;
|
||||
_teleported.put(_player.getName(), true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onAbilityUesd(SkillTriggerEvent event)
|
||||
{
|
||||
if (_player == null || !_player.equals(event.GetPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_task.finishFor(_player);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void button(ClansShopAddButtonEvent event)
|
||||
{
|
||||
if (!_player.equals(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
System.out.println(event.getDisplayName());
|
||||
|
||||
if (!event.getMaterial().equals(Material.IRON_AXE))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!TaskManager.Instance.hasCompletedTask(event.getPlayer(), "tuttoooooe" + event.getMaterial().name()) && !_bought.contains(event.getMaterial()))
|
||||
{
|
||||
event.setBuyPrice(0);
|
||||
event.setSellPrice(0);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void buy(final ClansPlayerBuyItemEvent event)
|
||||
{
|
||||
if (!_player.equals(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!event.getItem().getType().equals(Material.IRON_AXE))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getCost() == 0 && _bought.contains(event.getItem().getType()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
TaskManager.Instance.completedTask(new Callback<Boolean>() {
|
||||
@Override
|
||||
public void run(Boolean data)
|
||||
{
|
||||
}
|
||||
}, event.getPlayer(), "tuttoooooe" + event.getItem().getType().name());
|
||||
_bought.add(event.getItem().getType());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onAbilityUesd(SkillTriggerEvent event)
|
||||
{
|
||||
if (!isDoing(event.GetPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
finishFor(event.GetPlayer());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void button(ClansShopAddButtonEvent event)
|
||||
{
|
||||
if (!isDoing(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!event.getMaterial().equals(Material.IRON_AXE))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!TaskManager.Instance.hasCompletedTask(event.getPlayer(), "tuttoooooe" + event.getMaterial().name())
|
||||
&& !_bought.get(event.getPlayer().getName()).contains(event.getMaterial()))
|
||||
{
|
||||
event.setBuyPrice(0);
|
||||
event.setSellPrice(0);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void buy(final ClansPlayerBuyItemEvent event)
|
||||
{
|
||||
if (!isDoing(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!event.getItem().getType().equals(Material.IRON_AXE))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getCost() == 0 && _bought.get(event.getPlayer().getName()).contains(event.getItem().getType()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
TaskManager.Instance.completedTask(new Callback<Boolean>() {
|
||||
@Override
|
||||
public void run(Boolean data)
|
||||
{
|
||||
}
|
||||
}, event.getPlayer(), "tuttoooooe" + event.getItem().getType().name());
|
||||
_bought.get(event.getPlayer().getName()).add(event.getItem().getType());
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,9 @@
|
||||
package mineplex.game.clans.tutorials.gettingstarted;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
import mineplex.game.clans.clans.event.ClansCommandExecutedEvent;
|
||||
import mineplex.game.clans.tutorials.DeployedTask;
|
||||
import mineplex.game.clans.tutorials.TutorialTask;
|
||||
|
||||
public class TaskViewClanDetails extends TutorialTask<TutorialGettingStarted>
|
||||
@ -22,32 +20,19 @@ public class TaskViewClanDetails extends TutorialTask<TutorialGettingStarted>
|
||||
+ "You can also use any clan's name to get some information about them as well.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeployedTask customDeploy(Player player)
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onClansCommand(ClansCommandExecutedEvent event)
|
||||
{
|
||||
return new Deployed(player, this);
|
||||
}
|
||||
|
||||
class Deployed extends DeployedTask
|
||||
{
|
||||
public Deployed(Player player, TutorialTask<?> task)
|
||||
if (!isDoing(event.getPlayer()))
|
||||
{
|
||||
super(player, task);
|
||||
return;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onClansCommand(ClansCommandExecutedEvent event)
|
||||
System.out.println(event.getCommand());
|
||||
|
||||
if (event.getCommand().equals("info"))
|
||||
{
|
||||
if (!_player.equals(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getCommand().equals("info"))
|
||||
{
|
||||
_task.finishFor(_player);
|
||||
}
|
||||
finishFor(event.getPlayer());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -5,10 +5,9 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.packethandler.PacketHandler;
|
||||
import mineplex.core.task.TaskManager;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
@ -20,9 +19,9 @@ import mineplex.game.clans.tutorials.TutorialManager;
|
||||
|
||||
public class TutorialGettingStarted extends Tutorial
|
||||
{
|
||||
public TutorialGettingStarted(final TutorialManager manager, final ClansManager clansManager, final DonationManager donationManager, final GoldManager goldManager, final TaskManager taskManager)
|
||||
public TutorialGettingStarted(final TutorialManager manager, final ClansManager clansManager, final DonationManager donationManager, final GoldManager goldManager, final TaskManager taskManager, final PacketHandler packetHandler)
|
||||
{
|
||||
super(goldManager, taskManager, clansManager, donationManager, manager);
|
||||
super(goldManager, taskManager, clansManager, donationManager, manager, packetHandler);
|
||||
|
||||
// addTask(new TaskWelcome(this, 1));
|
||||
|
||||
@ -30,7 +29,6 @@ public class TutorialGettingStarted extends Tutorial
|
||||
addTask(new TaskCreateClan(this, ++id));
|
||||
addTask(new TaskViewClanDetails(this, ++id));
|
||||
addTask(new TaskLeaveSpawn(this, ++id));
|
||||
addTask(new TaskGoToWilderness(this, ++id));
|
||||
addTask(new TaskClaim(this, ++id));
|
||||
addTask(new TaskSetHome(this, ++id));
|
||||
addTask(new TaskExploreShops(this, ++id));
|
||||
@ -40,8 +38,6 @@ public class TutorialGettingStarted extends Tutorial
|
||||
addTask(new TaskMakingMoney(this, ++id));
|
||||
addTask(new TaskDisbandClan(this, ++id));
|
||||
|
||||
|
||||
|
||||
_doScoreboard = true;
|
||||
_ghostMode = true;
|
||||
_startOnJoin = true;
|
||||
@ -54,12 +50,12 @@ public class TutorialGettingStarted extends Tutorial
|
||||
@Override
|
||||
public void onFinished(final Player player)
|
||||
{
|
||||
UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||
UtilPlayer.message(player, C.cYellowB + "CONGRATULATIONS");
|
||||
UtilPlayer.message(player, " ");
|
||||
UtilPlayer.message(player, C.cWhite + "You have completed the Clans basic tutorial and have been awarded " + C.cAqua + "30,000 Gold");
|
||||
UtilPlayer.message(player, C.cWhite + "You can now begin your adventure, but do take a moment to read the signs around spawn for more information!");
|
||||
UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||
_manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||
_manager.sendTutorialMsg(player, C.cYellowB + "CONGRATULATIONS");
|
||||
_manager.sendTutorialMsg(player, " ");
|
||||
_manager.sendTutorialMsg(player, C.cWhite + "You have completed the Clans basic tutorial and have been awarded " + C.cAqua + "30,000 Gold");
|
||||
_manager.sendTutorialMsg(player, C.cWhite + "You can now begin your adventure, but do take a moment to read the signs around spawn for more information!");
|
||||
_manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||
|
||||
player.resetPlayerTime();
|
||||
player.teleport(Spawn.getEastSpawn());
|
||||
@ -68,17 +64,17 @@ public class TutorialGettingStarted extends Tutorial
|
||||
@Override
|
||||
public void onBegin(final Player player)
|
||||
{
|
||||
UtilPlayer.message(player, " ");
|
||||
UtilPlayer.message(player, " ");
|
||||
UtilPlayer.message(player, " ");
|
||||
UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||
UtilPlayer.message(player, " ");
|
||||
UtilPlayer.message(player, C.cYellowB + "Getting Started");
|
||||
UtilPlayer.message(player, C.cWhite + "Welcome to Clans! "
|
||||
_manager.sendTutorialMsg(player, " ");
|
||||
_manager.sendTutorialMsg(player, " ");
|
||||
_manager.sendTutorialMsg(player, " ");
|
||||
_manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||
_manager.sendTutorialMsg(player, " ");
|
||||
_manager.sendTutorialMsg(player, C.cYellowB + "Getting Started");
|
||||
_manager.sendTutorialMsg(player, C.cWhite + " Welcome to Clans! "
|
||||
+ "In this game mode you are able to create a clan, invite your friends to play with you, build a base, and wage war against others! "
|
||||
+ "When you finish the tutorial, you will be awarded " + C.cAqua + "30,000 Gold");
|
||||
UtilPlayer.message(player, " ");
|
||||
UtilPlayer.message(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||
_manager.sendTutorialMsg(player, " ");
|
||||
_manager.sendTutorialMsg(player, C.cDGreenB + C.Strike + "---------------------------------------------");
|
||||
}
|
||||
|
||||
|
||||
|
@ -347,7 +347,7 @@ public class ClientClass
|
||||
ResetToDefaults(!skillsOnly, !skillsOnly);
|
||||
|
||||
// Event
|
||||
ClassEquipEvent event = new ClassEquipEvent(this, customBuild);
|
||||
ClassEquipEvent event = new ClassEquipEvent(this, customBuild, _client.GetPlayer());
|
||||
UtilServer.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled())
|
||||
|
@ -5,7 +5,6 @@ import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import mineplex.minecraft.game.classcombat.Class.ClientClass;
|
||||
import mineplex.minecraft.game.classcombat.Class.PvpClass;
|
||||
import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken;
|
||||
|
||||
public class ClassEquipEvent extends Event
|
||||
@ -13,15 +12,16 @@ public class ClassEquipEvent extends Event
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private ClientClass _client;
|
||||
|
||||
private Player _user;
|
||||
private CustomBuildToken _build;
|
||||
|
||||
private boolean _cancelled;
|
||||
|
||||
public ClassEquipEvent(ClientClass client, CustomBuildToken build)
|
||||
public ClassEquipEvent(ClientClass client, CustomBuildToken build, Player user)
|
||||
{
|
||||
_client = client;
|
||||
_build = build;
|
||||
_user = user;
|
||||
}
|
||||
|
||||
public ClientClass getPlayer()
|
||||
@ -34,6 +34,11 @@ public class ClassEquipEvent extends Event
|
||||
return _build;
|
||||
}
|
||||
|
||||
public Player getUser()
|
||||
{
|
||||
return _user;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancelled)
|
||||
{
|
||||
_cancelled = cancelled;
|
||||
|
Loading…
Reference in New Issue
Block a user