Merge remote-tracking branch 'origin/clans/beta' into clans/beta

This commit is contained in:
Shaun Bennett 2016-04-02 10:53:28 +11:00
commit 0abcd0044b
12 changed files with 75 additions and 55 deletions

View File

@ -785,8 +785,14 @@ public class ClansDataAccessLayer
// Memory // Memory
claim.Safe = !claim.Safe; claim.Safe = !claim.Safe;
// Save runAsync(new Runnable()
_repository.updateTerritoryClaim(claim.Chunk, claim.Safe); {
@Override
public void run()
{
_repository.updateTerritoryClaim(claim.Chunk, claim.Safe);
}
});
// Log // Log
_manager.log("Safe Zone at [" + claim.Chunk + "] set to [" + claim.Safe + "] by [" + player + "]."); _manager.log("Safe Zone at [" + claim.Chunk + "] set to [" + claim.Safe + "] by [" + player + "].");
@ -807,7 +813,14 @@ public class ClansDataAccessLayer
public void clanExists(String clanName, Callback<Boolean> callback) public void clanExists(String clanName, Callback<Boolean> callback)
{ {
_repository.clanExists(clanName, callback); runAsync(new Runnable()
{
@Override
public void run()
{
_repository.clanExists(clanName, callback);
}
});
} }
public ClanRepository getRepository() public ClanRepository getRepository()

View File

@ -267,12 +267,12 @@ public abstract class Objective<Plugin extends Tutorial, Data extends ObjectiveD
private void showStartMessage(Player player) private void showStartMessage(Player player)
{ {
UtilTextMiddle.display(C.cAqua + "Tutorial", getName(player), player); UtilTextMiddle.display(C.cAqua + "Tutorial", getName(player), 20, 60, 20, player);
} }
private void showFinishMessage(Player player) private void showFinishMessage(Player player)
{ {
UtilTextMiddle.display(C.cGreen + "Tutorial Completed", getName(player), player); UtilTextMiddle.display(C.cGreen + "Tutorial Completed", getName(player), 20, 60, 20, player);
} }
public void setDisplayStartMessage(boolean displayStartMessage) public void setDisplayStartMessage(boolean displayStartMessage)

View File

@ -15,13 +15,12 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.player.PlayerDropItemEvent; import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.common.util.C;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilInv;
@ -30,7 +29,6 @@ import mineplex.core.hologram.HologramManager;
import mineplex.core.npc.NpcManager; import mineplex.core.npc.NpcManager;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.game.clans.clans.ClanInfo;
import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.event.ClansCommandPreExecutedEvent; import mineplex.game.clans.clans.event.ClansCommandPreExecutedEvent;
import mineplex.game.clans.economy.GoldManager; import mineplex.game.clans.economy.GoldManager;
@ -93,6 +91,7 @@ public class ClansMainTutorial extends Tutorial
player.teleport(Spawn.getNorthSpawn()); player.teleport(Spawn.getNorthSpawn());
ClansManager.getInstance().getItemMapManager().setMap(player);
ClansManager.getInstance().getPvpTimer().unpause(player); ClansManager.getInstance().getPvpTimer().unpause(player);
/* /*
@ -131,27 +130,6 @@ public class ClansMainTutorial extends Tutorial
player.getInventory().clear(); player.getInventory().clear();
ClansManager.getInstance().getPvpTimer().pause(player); ClansManager.getInstance().getPvpTimer().pause(player);
// Spawn Holograms
addHologram(player,
getPoint(region, ClansMainTutorial.Point.SPAWN).add(0, 1.5, -6),
C.cGoldB + "Welcome to the Clans Tutorial!",
" ",
"This will teach you the basics of Clans.",
"It will take about 5 minutes to complete.",
"You must complete it before playing Clans.",
" ",
"Walk forward to begin!");
addHologram(player,
getPoint(region, ClansMainTutorial.Point.SPAWN).add(0, 1.5, -23),
"Jump Off!");
ClanInfo clan = ClansManager.getInstance().getClan(player);
if (clan != null)
{
ClansManager.getInstance().getClanDataAccess().delete(clan, null);
}
} }
@Override @Override
@ -255,10 +233,16 @@ public class ClansMainTutorial extends Tutorial
@EventHandler @EventHandler
public void breakBlock(BlockBreakEvent event) public void breakBlock(BlockBreakEvent event)
{ {
System.out.println("main break");
if (isInTutorial(event.getPlayer())) if (isInTutorial(event.getPlayer()))
{ {
System.out.println("cencelled"); event.setCancelled(true);
}
}
@EventHandler
public void placeBlock(BlockPlaceEvent event) {
if (isInTutorial(event.getPlayer()))
{
event.setCancelled(true); event.setCancelled(true);
} }
} }

View File

@ -42,8 +42,6 @@ public class BlowUpWallGoal extends ObjectiveGoal<AttackEnemyObjective>
{ {
Player shooter = event.getProjectile().getShooter(); Player shooter = event.getProjectile().getShooter();
System.out.println(shooter.getName());
if (!contains(shooter)) if (!contains(shooter))
{ {
if (getObjective().getPlugin().isInTutorial(shooter)) if (getObjective().getPlugin().isInTutorial(shooter))

View File

@ -70,6 +70,8 @@ public class BuildHouseGoal extends ObjectiveGoal<ClanObjective>
return; return;
} }
for (ItemStack stack : _items) for (ItemStack stack : _items)
{ {
if (event.getBlock().getType().equals(stack.getType()) || event.getBlock().getType().equals(Material.IRON_DOOR_BLOCK)) if (event.getBlock().getType().equals(stack.getType()) || event.getBlock().getType().equals(Material.IRON_DOOR_BLOCK))
@ -84,7 +86,7 @@ public class BuildHouseGoal extends ObjectiveGoal<ClanObjective>
} }
} }
@EventHandler @EventHandler (priority = EventPriority.HIGHEST)
public void blockPlace(BlockPlaceEvent event) public void blockPlace(BlockPlaceEvent event)
{ {
if (!contains(event.getPlayer())) if (!contains(event.getPlayer()))
@ -92,6 +94,9 @@ public class BuildHouseGoal extends ObjectiveGoal<ClanObjective>
return; return;
} }
event.setCancelled(false);
if (isInBuildArea(event.getPlayer(), event.getBlock())) if (isInBuildArea(event.getPlayer(), event.getBlock()))
{ {
// Run 1 tick later because inventory doesn't get updated instantly // Run 1 tick later because inventory doesn't get updated instantly

View File

@ -47,6 +47,7 @@ public class CreateClanGoal extends ObjectiveGoal<ClanObjective>
if (contains(event.getFounder())) if (contains(event.getFounder()))
{ {
finish(event.getFounder()); finish(event.getFounder());
ClansManager.getInstance().resetLeftTimer(event.getFounder().getUniqueId());
} }
} }

View File

@ -1,5 +1,6 @@
package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan; package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan;
import java.util.HashSet;
import java.util.UUID; import java.util.UUID;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -17,6 +18,8 @@ import mineplex.game.clans.tutorial.tutorials.clans.objective.ClanObjective;
public class LeaveSpawnGoal extends ObjectiveGoal<ClanObjective> public class LeaveSpawnGoal extends ObjectiveGoal<ClanObjective>
{ {
private HashSet<UUID> _removeList = new HashSet<UUID>();
public LeaveSpawnGoal(ClanObjective objective) public LeaveSpawnGoal(ClanObjective objective)
{ {
super( super(
@ -62,8 +65,15 @@ public class LeaveSpawnGoal extends ObjectiveGoal<ClanObjective>
Player player = Bukkit.getPlayer(uuid); Player player = Bukkit.getPlayer(uuid);
if (!getObjective().getPlugin().isIn(player, ClansMainTutorial.Bounds.SPAWN)) if (!getObjective().getPlugin().isIn(player, ClansMainTutorial.Bounds.SPAWN))
{ {
finish(player); _removeList.add(uuid);
} }
} }
for (UUID uuid : _removeList)
{
finish(Bukkit.getPlayer(uuid));
}
_removeList.clear();
} }
} }

View File

@ -1,16 +1,23 @@
package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.classes; package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.classes;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilEvent;
import mineplex.game.clans.clans.ClansManager;
import mineplex.minecraft.game.classcombat.Class.ClassManager;
import mineplex.minecraft.game.classcombat.Class.ClientClass;
import mineplex.minecraft.game.classcombat.Class.IPvpClass;
import mineplex.minecraft.game.classcombat.Class.event.ClassEquipEvent;
import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import mineplex.game.clans.tutorial.objective.ObjectiveGoal; import mineplex.game.clans.tutorial.objective.ObjectiveGoal;
import mineplex.game.clans.tutorial.tutorials.clans.objective.ClassesObjective; import mineplex.game.clans.tutorial.tutorials.clans.objective.ClassesObjective;
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent; import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
import org.bukkit.event.player.PlayerInteractEvent;
public class UseBullsChargeGoal extends ObjectiveGoal<ClassesObjective> public class UseBullsChargeGoal extends ObjectiveGoal<ClassesObjective> {
{ public UseBullsChargeGoal(ClassesObjective objective) {
public UseBullsChargeGoal(ClassesObjective objective)
{
super( super(
objective, objective,
"Use Bulls Charge", "Use Bulls Charge",
@ -21,22 +28,23 @@ public class UseBullsChargeGoal extends ObjectiveGoal<ClassesObjective>
} }
@Override @Override
protected void customStart(Player player) protected void customStart(Player player) {
{ ClientClass client = ClansManager.getInstance().getClassManager().Get(player);
client.ResetSkills(player);
client.SetActiveCustomBuild(client.GetGameClass(), client.GetGameClass().getDefaultBuild());
} }
@Override @Override
protected void customFinish(Player player) protected void customFinish(Player player) {
{
} }
@EventHandler @EventHandler
public void checkSkill(SkillTriggerEvent event) public void checkSkill(SkillTriggerEvent event) {
{ if (contains(event.GetPlayer())) {
if (contains(event.GetPlayer()))
{
if (event.GetSkillName().toLowerCase().contains("bulls charge")) if (event.GetSkillName().toLowerCase().contains("bulls charge"))
finish(event.GetPlayer()); finish(event.GetPlayer());
} }
} }
} }

View File

@ -59,15 +59,12 @@ public class MineDiamondsGoal extends ObjectiveGoal<FieldsObjective>
@EventHandler(priority = EventPriority.HIGHEST) @EventHandler(priority = EventPriority.HIGHEST)
public void onBlockBreak(BlockBreakEvent event) public void onBlockBreak(BlockBreakEvent event)
{ {
System.out.println("a");
if (!contains(event.getPlayer()) || event.getBlock().getType() != Material.DIAMOND_ORE) if (!contains(event.getPlayer()) || event.getBlock().getType() != Material.DIAMOND_ORE)
return; return;
System.out.println("b");
TutorialRegion region = getObjective().getPlugin().getRegion(event.getPlayer()); TutorialRegion region = getObjective().getPlugin().getRegion(event.getPlayer());
if (getObjective().getPlugin().isIn(event.getBlock().getLocation(), region, ClansMainTutorial.Bounds.FIELDS)) if (getObjective().getPlugin().isIn(event.getBlock().getLocation(), region, ClansMainTutorial.Bounds.FIELDS))
{ {
System.out.println("c");
event.setCancelled(true); event.setCancelled(true);
event.getBlock().getWorld().dropItemNaturally(event.getBlock().getLocation().add(0.5, 1.5, 0.5), new ItemStack(Material.DIAMOND)); event.getBlock().getWorld().dropItemNaturally(event.getBlock().getLocation().add(0.5, 1.5, 0.5), new ItemStack(Material.DIAMOND));
event.getBlock().setType(Material.COBBLESTONE); event.getBlock().setType(Material.COBBLESTONE);

View File

@ -6,6 +6,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.game.clans.clans.event.ClansPlayerSellItemEvent; import mineplex.game.clans.clans.event.ClansPlayerSellItemEvent;
import mineplex.game.clans.tutorial.objective.ObjectiveGoal; import mineplex.game.clans.tutorial.objective.ObjectiveGoal;
@ -34,6 +35,7 @@ public class SellDiamondsGoal extends ObjectiveGoal<FieldsObjective>
{ {
// Close Middle Gate // Close Middle Gate
getObjective().getPlugin().destroyFences(getObjective().getPlugin().getRegion(player), DyeColor.RED); getObjective().getPlugin().destroyFences(getObjective().getPlugin().getRegion(player), DyeColor.RED);
// Close Fields Gate // Close Fields Gate
getObjective().getPlugin().destroyFences(getObjective().getPlugin().getRegion(player), DyeColor.BLACK); getObjective().getPlugin().destroyFences(getObjective().getPlugin().getRegion(player), DyeColor.BLACK);
} }
@ -45,6 +47,7 @@ public class SellDiamondsGoal extends ObjectiveGoal<FieldsObjective>
{ {
if (event.getItem().getType() == Material.DIAMOND) if (event.getItem().getType() == Material.DIAMOND)
{ {
UtilInv.removeAll(event.getPlayer(), Material.DIAMOND, (byte) 0);
finish(event.getPlayer()); finish(event.getPlayer());
} }
else else

View File

@ -37,6 +37,7 @@ public class DisbandClanGoal extends ObjectiveGoal<FinalObjective>
@Override @Override
protected void customFinish(Player player) protected void customFinish(Player player)
{ {
ClansManager.getInstance().resetLeftTimer(player.getUniqueId());
} }
@EventHandler(priority = EventPriority.HIGHEST) @EventHandler(priority = EventPriority.HIGHEST)
@ -50,6 +51,7 @@ public class DisbandClanGoal extends ObjectiveGoal<FinalObjective>
UtilPlayer.message(event.getDisbander(), F.main("Clans", "You have disbanded your Tutorial Clan.")); UtilPlayer.message(event.getDisbander(), F.main("Clans", "You have disbanded your Tutorial Clan."));
ClansManager.getInstance().getClanDataAccess().delete(ClansManager.getInstance().getClan(event.getDisbander()), null); ClansManager.getInstance().getClanDataAccess().delete(ClansManager.getInstance().getClan(event.getDisbander()), null);
ClansManager.getInstance().resetLeftTimer(event.getDisbander().getUniqueId());
finish(event.getDisbander()); finish(event.getDisbander());
} }

View File

@ -13,7 +13,6 @@ import mineplex.game.clans.tutorial.objective.Objective;
import mineplex.game.clans.tutorial.objective.ObjectiveGoal; import mineplex.game.clans.tutorial.objective.ObjectiveGoal;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.game.clans.clans.event.ClansCommandExecutedEvent;
import mineplex.game.clans.tutorial.tutorials.clans.objective.FinalObjective; import mineplex.game.clans.tutorial.tutorials.clans.objective.FinalObjective;
public class TpClanHomeGoal extends ObjectiveGoal<FinalObjective> public class TpClanHomeGoal extends ObjectiveGoal<FinalObjective>