PC-29 + fixes
This commit is contained in:
parent
eab7cbe385
commit
e75c7a3c91
@ -55,14 +55,14 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
@Override
|
@Override
|
||||||
public void Execute(Player caller, String[] args)
|
public void Execute(Player caller, String[] args)
|
||||||
{
|
{
|
||||||
|
if (UtilServer.CallEvent(new ClansCommandPreExecutedEvent(caller, args)).isCancelled())
|
||||||
|
return;
|
||||||
|
|
||||||
if (args == null || args.length == 0)
|
if (args == null || args.length == 0)
|
||||||
{
|
{
|
||||||
_clansManager.getClanShop().attemptShopOpen(caller);
|
_clansManager.getClanShop().attemptShopOpen(caller);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UtilServer.CallEvent(new ClansCommandPreExecutedEvent(caller, args)).isCancelled())
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("help") || args[0].equalsIgnoreCase("h"))
|
if (args[0].equalsIgnoreCase("help") || args[0].equalsIgnoreCase("h"))
|
||||||
help(caller);
|
help(caller);
|
||||||
|
@ -20,11 +20,12 @@ import java.util.Map;
|
|||||||
public class AttackEnemyObjective extends OrderedObjective<ClansMainTutorial>
|
public class AttackEnemyObjective extends OrderedObjective<ClansMainTutorial>
|
||||||
{
|
{
|
||||||
|
|
||||||
private Map<String, Cannon> _cannon = new HashMap<>();
|
private Map<String, Cannon> _cannon;
|
||||||
|
|
||||||
public AttackEnemyObjective(ClansMainTutorial clansMainTutorial, JavaPlugin javaPlugin)
|
public AttackEnemyObjective(ClansMainTutorial clansMainTutorial, JavaPlugin javaPlugin)
|
||||||
{
|
{
|
||||||
super(clansMainTutorial, javaPlugin, "Attack Enemy", "Attack and raid this enemy!");
|
super(clansMainTutorial, javaPlugin, "Attack Enemy", "Attack and raid this enemy!");
|
||||||
|
_cannon = new HashMap<>();
|
||||||
|
|
||||||
addGoal(new GetMapGoal(this));
|
addGoal(new GetMapGoal(this));
|
||||||
addGoal(new HoldItemGoal(this, Material.MAP, "Identify Enemy Clan", "By looking at your map, identify your new enemy"));
|
addGoal(new HoldItemGoal(this, Material.MAP, "Identify Enemy Clan", "By looking at your map, identify your new enemy"));
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package mineplex.game.clans.tutorial.tutorials.clans.objective;
|
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.entity.Player;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
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.ClansMainTutorial;
|
||||||
import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.attackenemy.BlowUpWallGoal;
|
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.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>
|
public class ClanObjective extends OrderedObjective<ClansMainTutorial>
|
||||||
{
|
{
|
||||||
@ -22,7 +17,9 @@ public class ClanObjective extends OrderedObjective<ClansMainTutorial>
|
|||||||
|
|
||||||
addGoal(new LeaveSpawnGoal(this));
|
addGoal(new LeaveSpawnGoal(this));
|
||||||
addGoal(new CreateClanGoal(this));
|
addGoal(new CreateClanGoal(this));
|
||||||
|
addGoal(new ClanManagementGoal(this));
|
||||||
addGoal(new ClanDetailsGoal(this));
|
addGoal(new ClanDetailsGoal(this));
|
||||||
|
addGoal(new ClanInfoGoal(this));
|
||||||
addGoal(new ClaimLandGoal(this));
|
addGoal(new ClaimLandGoal(this));
|
||||||
addGoal(new BuildHouseGoal(this));
|
addGoal(new BuildHouseGoal(this));
|
||||||
addGoal(new SetHomeGoal(this));
|
addGoal(new SetHomeGoal(this));
|
||||||
|
@ -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)
|
public CreateClanGoal(ClanObjective objective)
|
||||||
{
|
{
|
||||||
super(objective, "Create a Clan", "Create a Clan");
|
super(objective, "Create a Clan", "Create a Clan using /c create");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -14,7 +14,7 @@ public class ExplainEnergyGoal extends ObjectiveGoal<EnergyObjective>
|
|||||||
{
|
{
|
||||||
public ExplainEnergyGoal(EnergyObjective objective)
|
public ExplainEnergyGoal(EnergyObjective objective)
|
||||||
{
|
{
|
||||||
super(objective, "Check your Energy", "Check your Energy");
|
super(objective, "About Energy", "Check your Energy");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.finalobj;
|
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.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@ -17,7 +18,7 @@ public class DisbandClanGoal extends ObjectiveGoal<FinalObjective>
|
|||||||
{
|
{
|
||||||
public DisbandClanGoal(FinalObjective objective)
|
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
|
@Override
|
||||||
@ -31,21 +32,16 @@ public class DisbandClanGoal extends ObjectiveGoal<FinalObjective>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@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;
|
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);
|
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