Merge branch 'clans/beta' of github.com:Mineplex-LLC/Minecraft-PC into clans/beta
This commit is contained in:
commit
0bbfbff0b8
@ -55,14 +55,14 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (UtilServer.CallEvent(new ClansCommandPreExecutedEvent(caller, args)).isCancelled())
|
||||
return;
|
||||
|
||||
if (args == null || args.length == 0)
|
||||
{
|
||||
_clansManager.getClanShop().attemptShopOpen(caller);
|
||||
return;
|
||||
}
|
||||
|
||||
if (UtilServer.CallEvent(new ClansCommandPreExecutedEvent(caller, args)).isCancelled())
|
||||
return;
|
||||
|
||||
if (args[0].equalsIgnoreCase("help") || args[0].equalsIgnoreCase("h"))
|
||||
help(caller);
|
||||
|
@ -1,5 +1,6 @@
|
||||
package mineplex.game.clans.tutorial.tutorials.clans.objective;
|
||||
|
||||
import mineplex.game.clans.clans.siege.weapon.Cannon;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
@ -13,11 +14,18 @@ import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.attackenemy.
|
||||
import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.attackenemy.MountCannonGoal;
|
||||
import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.attackenemy.StealEnemyPotatoesGoal;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class AttackEnemyObjective extends OrderedObjective<ClansMainTutorial>
|
||||
{
|
||||
|
||||
private Map<String, Cannon> _cannon;
|
||||
|
||||
public AttackEnemyObjective(ClansMainTutorial clansMainTutorial, JavaPlugin javaPlugin)
|
||||
{
|
||||
super(clansMainTutorial, javaPlugin, "Attack Enemy", "Attack and raid this enemy!");
|
||||
_cannon = new HashMap<>();
|
||||
|
||||
addGoal(new GetMapGoal(this));
|
||||
addGoal(new HoldItemGoal(this, Material.MAP, "Identify Enemy Clan", "By looking at your map, identify your new enemy"));
|
||||
@ -36,4 +44,6 @@ public class AttackEnemyObjective extends OrderedObjective<ClansMainTutorial>
|
||||
protected void customFinish(Player player)
|
||||
{
|
||||
}
|
||||
|
||||
public Map<String, Cannon> getCannons() {return _cannon; }
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package mineplex.game.clans.tutorial.tutorials.clans.objective;
|
||||
|
||||
import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan.*;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
@ -7,12 +8,6 @@ import mineplex.game.clans.tutorial.objective.OrderedObjective;
|
||||
import mineplex.game.clans.tutorial.tutorials.clans.ClansMainTutorial;
|
||||
import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.attackenemy.BlowUpWallGoal;
|
||||
import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.attackenemy.StealEnemyPotatoesGoal;
|
||||
import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan.BuildHouseGoal;
|
||||
import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan.ClaimLandGoal;
|
||||
import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan.ClanDetailsGoal;
|
||||
import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan.CreateClanGoal;
|
||||
import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan.LeaveSpawnGoal;
|
||||
import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan.SetHomeGoal;
|
||||
|
||||
public class ClanObjective extends OrderedObjective<ClansMainTutorial>
|
||||
{
|
||||
@ -22,7 +17,9 @@ public class ClanObjective extends OrderedObjective<ClansMainTutorial>
|
||||
|
||||
addGoal(new LeaveSpawnGoal(this));
|
||||
addGoal(new CreateClanGoal(this));
|
||||
addGoal(new ClanManagementGoal(this));
|
||||
addGoal(new ClanDetailsGoal(this));
|
||||
addGoal(new ClanInfoGoal(this));
|
||||
addGoal(new ClaimLandGoal(this));
|
||||
addGoal(new BuildHouseGoal(this));
|
||||
addGoal(new SetHomeGoal(this));
|
||||
|
@ -107,5 +107,6 @@ public class BlowUpWallGoal extends ObjectiveGoal<AttackEnemyObjective>
|
||||
@Override
|
||||
protected void customFinish(Player player)
|
||||
{
|
||||
getObjective().getCannons().remove(player.getName()).kill(); //Kill cannon after goal complete
|
||||
}
|
||||
}
|
||||
|
@ -18,8 +18,6 @@ import mineplex.game.clans.tutorial.tutorials.clans.objective.AttackEnemyObjecti
|
||||
|
||||
public class MountCannonGoal extends ObjectiveGoal<AttackEnemyObjective>
|
||||
{
|
||||
private Map<String, Cannon> _cannon = new HashMap<>();
|
||||
|
||||
public MountCannonGoal(AttackEnemyObjective objective)
|
||||
{
|
||||
super(objective, "Get on Cannon", "Right click on the Cannon to hop on!");
|
||||
@ -28,14 +26,14 @@ public class MountCannonGoal extends ObjectiveGoal<AttackEnemyObjective>
|
||||
@Override
|
||||
protected void customStart(Player player)
|
||||
{
|
||||
_cannon.put(player.getName(), SiegeManager.Instance.spawnCannon(player, getObjective().getPlugin().getPoint(getObjective().getPlugin().getRegion(player), Point.CANNON), false));
|
||||
_cannon.get(player.getName()).SetForcedVelocity(0.4, 2.45);
|
||||
getObjective().getCannons().put(player.getName(), SiegeManager.Instance.spawnCannon(player, getObjective().getPlugin().getPoint(getObjective().getPlugin().getRegion(player), Point.CANNON), false));
|
||||
getObjective().getCannons().get(player.getName()).SetForcedVelocity(0.4, 2.45);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void clean(Player player, TutorialRegion region)
|
||||
{
|
||||
_cannon.remove(player.getName()).kill();
|
||||
getObjective().getCannons().remove(player.getName()).kill();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -0,0 +1,75 @@
|
||||
package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan;
|
||||
|
||||
/**
|
||||
* Created by Adam on 29/03/2016.
|
||||
*/
|
||||
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.game.clans.Clans;
|
||||
import mineplex.game.clans.clans.ClanInfo;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.clans.ClientClan;
|
||||
import mineplex.game.clans.clans.event.ClansCommandExecutedEvent;
|
||||
import mineplex.game.clans.clans.event.ClansCommandPreExecutedEvent;
|
||||
import mineplex.game.clans.tutorial.objective.ObjectiveGoal;
|
||||
import mineplex.game.clans.tutorial.tutorials.clans.objective.ClanObjective;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
/**
|
||||
* Created by Adam on 29/03/2016.
|
||||
*/
|
||||
public class ClanInfoGoal extends ObjectiveGoal<ClanObjective>
|
||||
{
|
||||
public ClanInfoGoal(ClanObjective objective)
|
||||
{
|
||||
super(objective, "Info on other clan", "Get info on other clans by using the command /c <ClanName>");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void customStart(Player player)
|
||||
{
|
||||
player.sendMessage(F.main("Clans", "You can use the command /c <ClanName> to get information about other clans. Try typing /c randomClan"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void customFinish(Player player)
|
||||
{
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onClanInfo(ClansCommandPreExecutedEvent event)
|
||||
{
|
||||
if (contains(event.getPlayer()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
if(event.getArguments().length < 1) return;
|
||||
|
||||
event.setCancelled(true);
|
||||
ClanInfo clan = ClansManager.getInstance().getClan(event.getArguments()[0]);
|
||||
if(clan == null)
|
||||
{
|
||||
ClansManager.getInstance().getClanDataAccess().create("Chiss", event.getArguments()[0], false, new Callback<ClanInfo>() {
|
||||
@Override
|
||||
public void run(ClanInfo data) {
|
||||
ClansManager.getInstance().getClanShop().openClanWho(event.getPlayer(), clan);
|
||||
finish(event.getPlayer());
|
||||
ClansManager.getInstance().runSyncLater(() -> {
|
||||
ClansManager.getInstance().getClanDataAccess().delete(ClansManager.getInstance().getClan(event.getArguments()[0]), null);
|
||||
}, 100L);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ClansManager.getInstance().getClanShop().openClanWho(event.getPlayer(), clan);
|
||||
finish(event.getPlayer());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//TODO finish
|
||||
finish(event.getPlayer());
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.game.clans.clans.ClanInfo;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.clans.event.ClansCommandExecutedEvent;
|
||||
import mineplex.game.clans.clans.event.ClansCommandPreExecutedEvent;
|
||||
import mineplex.game.clans.tutorial.objective.ObjectiveGoal;
|
||||
import mineplex.game.clans.tutorial.tutorials.clans.objective.ClanObjective;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
/**
|
||||
* Created by Adam on 29/03/2016.
|
||||
*/
|
||||
public class ClanManagementGoal extends ObjectiveGoal<ClanObjective>
|
||||
{
|
||||
public ClanManagementGoal(ClanObjective objective)
|
||||
{
|
||||
super(objective, "Manage your clan", "Manage your clan by using the command /c");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void customStart(Player player)
|
||||
{
|
||||
player.sendMessage(F.main("Clans", "You can use the command /c to manage your clan."));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void customFinish(Player player)
|
||||
{
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onClanInfo(ClansCommandPreExecutedEvent event)
|
||||
{
|
||||
if (contains(event.getPlayer()))
|
||||
{
|
||||
if (event.getArguments() == null || event.getArguments().length == 0)
|
||||
{
|
||||
finish(event.getPlayer());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -12,7 +12,7 @@ public class CreateClanGoal extends ObjectiveGoal<ClanObjective>
|
||||
{
|
||||
public CreateClanGoal(ClanObjective objective)
|
||||
{
|
||||
super(objective, "Create a Clan", "Create a Clan");
|
||||
super(objective, "Create a Clan", "Create a Clan using /c create");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -14,7 +14,7 @@ public class ExplainEnergyGoal extends ObjectiveGoal<EnergyObjective>
|
||||
{
|
||||
public ExplainEnergyGoal(EnergyObjective objective)
|
||||
{
|
||||
super(objective, "Check your Energy", "Check your Energy");
|
||||
super(objective, "About Energy", "Check your Energy");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,5 +1,6 @@
|
||||
package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.finalobj;
|
||||
|
||||
import mineplex.game.clans.clans.event.ClanDisbandedEvent;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -17,7 +18,7 @@ public class DisbandClanGoal extends ObjectiveGoal<FinalObjective>
|
||||
{
|
||||
public DisbandClanGoal(FinalObjective objective)
|
||||
{
|
||||
super(objective, "Disband Clan", "Use the /c command to disband your Tutorial Clan");
|
||||
super(objective, "Disband Clan", "Use the /c command to disband your Tutorial Clan");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -31,21 +32,16 @@ public class DisbandClanGoal extends ObjectiveGoal<FinalObjective>
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void teleport(ClansCommandPreExecutedEvent event)
|
||||
public void teleport(ClanDisbandedEvent event)
|
||||
{
|
||||
if (event.getArguments().length != 1 || !event.getArguments()[0].equalsIgnoreCase("disband"))
|
||||
if (!contains(event.getDisbander()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!contains(event.getPlayer()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Clans", "You have disbanded your Tutorial Clan."));
|
||||
ClansManager.getInstance().getClanDataAccess().delete(ClansManager.getInstance().getClan(event.getPlayer()), null);
|
||||
finish(event.getPlayer());
|
||||
event.setCancelled(true);
|
||||
|
||||
UtilPlayer.message(event.getDisbander(), F.main("Clans", "You have disbanded your Tutorial Clan."));
|
||||
ClansManager.getInstance().getClanDataAccess().delete(ClansManager.getInstance().getClan(event.getDisbander()), null);
|
||||
finish(event.getDisbander());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user