Push for shaun Fireworks

This commit is contained in:
phobia 2016-04-02 20:29:56 +11:00
parent 90e336b18e
commit 673dd327ff
31 changed files with 188 additions and 35 deletions

View File

@ -12,11 +12,13 @@ public class DataLocationMap
{ {
private EnumMap<DyeColor, List<Location>> _goldDataMap; private EnumMap<DyeColor, List<Location>> _goldDataMap;
private EnumMap<DyeColor, List<Location>> _ironDataMap; private EnumMap<DyeColor, List<Location>> _ironDataMap;
private EnumMap<DyeColor, List<Location>> _spongeDataMap;
public DataLocationMap() public DataLocationMap()
{ {
_goldDataMap = new EnumMap<>(DyeColor.class); _goldDataMap = new EnumMap<>(DyeColor.class);
_ironDataMap = new EnumMap<>(DyeColor.class); _ironDataMap = new EnumMap<>(DyeColor.class);
_spongeDataMap = new EnumMap<>(DyeColor.class);
} }
public List<Location> getGoldLocations(DyeColor color) public List<Location> getGoldLocations(DyeColor color)
@ -59,5 +61,23 @@ public class DataLocationMap
} }
} }
public void addSpongeLocation(DyeColor color, Location location) {
if (_spongeDataMap.containsKey(color))
{
_spongeDataMap.get(color).add(location);
}
else
{
List<Location> list = new ArrayList<>();
list.add(location);
_spongeDataMap.put(color, list);
}
}
public List<Location> getSpongeLocations(DyeColor color)
{
List<Location> list = _spongeDataMap.get(color);
return list == null ? Collections.emptyList() : list;
}
} }

View File

@ -59,6 +59,11 @@ public class Schematic
if (addDataWool(locationMap, false, originLocation, x, y - 1, z)) if (addDataWool(locationMap, false, originLocation, x, y - 1, z))
continue; continue;
} }
else if (materialId == Material.SPONGE.getId())
{
if (addSpongeLocation(locationMap, originLocation, x, y + 1, z))
continue;
}
else if (materialId == 35) else if (materialId == 35)
{ {
// Check if this is a dataloc so we can skip setting the block // Check if this is a dataloc so we can skip setting the block
@ -68,7 +73,14 @@ public class Schematic
if (Math.abs(_blocks[aboveIndex]) == Material.GOLD_PLATE.getId() || Math.abs(_blocks[aboveIndex]) == Material.IRON_PLATE.getId()) if (Math.abs(_blocks[aboveIndex]) == Material.GOLD_PLATE.getId() || Math.abs(_blocks[aboveIndex]) == Material.IRON_PLATE.getId())
continue; continue;
} }
int belowIndex = getIndex(x, y - 1, z);
if (hasIndex(belowIndex))
{
if(Math.abs(_blocks[belowIndex]) == Material.SPONGE.getId())
continue;
}
} }
UtilBlock.setQuick(originLocation.getWorld(), startX + x, startY + y, startZ + z, materialId, _blockData[index]); UtilBlock.setQuick(originLocation.getWorld(), startX + x, startY + y, startZ + z, materialId, _blockData[index]);
} }
@ -110,6 +122,26 @@ public class Schematic
return false; return false;
} }
private boolean addSpongeLocation(DataLocationMap map, Location origin, int x, int y, int z)
{
int index = getIndex(x, y, z);
if (hasIndex(index))
{
int materialId = Math.abs(_blocks[index]);
if (materialId == 35) // WOOL
{
byte data = _blockData[index];
DyeColor color = DyeColor.getByWoolData(data);
if (color != null)
{
map.addSpongeLocation(color, origin.clone().add(x, y - 1, z));
return true;
}
}
}
return false;
}
public int getSize() public int getSize()
{ {
return _blocks.length; return _blocks.length;

View File

@ -98,4 +98,14 @@ public class UtilFirework
UtilPlayer.sendPacket(viewing, packet); UtilPlayer.sendPacket(viewing, packet);
} }
} }
public void spawnRandomFirework(Location location)
{
playFirework(location,
Type.values()[UtilMath.r(Type.values().length)],
Color.fromRGB(UtilMath.r(256), UtilMath.r(256), UtilMath.r(256)),
UtilMath.random.nextBoolean(),
UtilMath.random.nextBoolean()
);
}
} }

View File

@ -1,11 +1,13 @@
package mineplex.game.clans.tutorial.objective; package mineplex.game.clans.tutorial.objective;
import java.util.HashSet; import java.util.*;
import java.util.Set;
import java.util.UUID;
import org.bukkit.Bukkit; import mineplex.core.common.util.UtilFirework;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import org.bukkit.*;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
@ -25,13 +27,14 @@ public abstract class ObjectiveGoal <T extends Objective> implements Listener
private int _startMessageDelay; private int _startMessageDelay;
private boolean _displayFinishMessage; private boolean _displayFinishMessage;
private int _finishMessageDelay; private int _finishMessageDelay;
private DyeColor _fireworkLocations;
public ObjectiveGoal(T objective, String name, String description) public ObjectiveGoal(T objective, String name, String description)
{ {
this(objective, name, description, null); this(objective, name, description, null, null);
} }
public ObjectiveGoal(T objective, String name, String description, String extraDescription) public ObjectiveGoal(T objective, String name, String description, String extraDescription, DyeColor fireworkLocs)
{ {
_objective = objective; _objective = objective;
@ -43,6 +46,7 @@ public abstract class ObjectiveGoal <T extends Objective> implements Listener
_startMessageDelay = 40; _startMessageDelay = 40;
_displayFinishMessage = true; _displayFinishMessage = true;
_finishMessageDelay = 1; _finishMessageDelay = 1;
_fireworkLocations = fireworkLocs;
} }
public String getName(Player player) public String getName(Player player)
@ -192,4 +196,21 @@ public abstract class ObjectiveGoal <T extends Objective> implements Listener
{ {
_finishMessageDelay = finishMessageDelay; _finishMessageDelay = finishMessageDelay;
} }
@EventHandler
public void update(UpdateEvent event) {
if(!event.getType().equals(UpdateType.SEC_05)) return;
if (_fireworkLocations == null) return;
for (UUID id : getActivePlayers())
{
if (Bukkit.getPlayer(id) == null) continue;
List<Location> locations = getObjective().getPlugin().getRegion(Bukkit.getPlayer(id)).getLocationMap().getSpongeLocations(_fireworkLocations);
if (locations == null) continue;
for(Location loc : locations)
{
UtilFirework.playFirework(loc, FireworkEffect.Type.BURST, Color.AQUA, true, true);
}
}
}
} }

View File

@ -1,13 +1,20 @@
package mineplex.game.clans.tutorial.tutorials.clans.objective; package mineplex.game.clans.tutorial.tutorials.clans.objective;
import org.bukkit.Material; import mineplex.core.common.util.UtilFirework;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import org.bukkit.*;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import mineplex.game.clans.tutorial.objective.UnorderedObjective; import mineplex.game.clans.tutorial.objective.UnorderedObjective;
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.shops.PurchaseGoal; import mineplex.game.clans.tutorial.tutorials.clans.objective.goals.shops.PurchaseGoal;
import java.util.List;
import java.util.UUID;
public class PurchaseItemsObjective extends UnorderedObjective<ClansMainTutorial> public class PurchaseItemsObjective extends UnorderedObjective<ClansMainTutorial>
{ {
public PurchaseItemsObjective(ClansMainTutorial clansMainTutorial, JavaPlugin javaPlugin) public PurchaseItemsObjective(ClansMainTutorial clansMainTutorial, JavaPlugin javaPlugin)
@ -38,4 +45,20 @@ public class PurchaseItemsObjective extends UnorderedObjective<ClansMainTutorial
protected void customFinish(Player player) protected void customFinish(Player player)
{ {
} }
@EventHandler
public void update(UpdateEvent event) {
if(!event.getType().equals(UpdateType.SEC_05)) return;
for (Player player : getActivePlayers())
{
if (player == null) continue;
List<Location> locations = getPlugin().getRegion(player).getLocationMap().getSpongeLocations(DyeColor.BROWN);
if (locations == null) continue;
for(Location loc : locations)
{
UtilFirework.playFirework(loc, FireworkEffect.Type.BURST, Color.AQUA, true, true);
}
}
}
} }

View File

@ -19,7 +19,7 @@ public class HoldItemGoal extends ObjectiveGoal<Objective>
public HoldItemGoal(Objective objective, Material material, String name, String description, String helpText, int startDelay) public HoldItemGoal(Objective objective, Material material, String name, String description, String helpText, int startDelay)
{ {
super(objective, name, description, helpText); super(objective, name, description, helpText, null);
_material = material; _material = material;

View File

@ -2,6 +2,7 @@ package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.attackenemy
import java.util.HashMap; import java.util.HashMap;
import org.bukkit.DyeColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
@ -28,7 +29,8 @@ public class BlowUpWallGoal extends ObjectiveGoal<AttackEnemyObjective>
objective, objective,
"Blow up the Enemy Base", "Blow up the Enemy Base",
"Left-Click whilst sitting on the cannon to fire", "Left-Click whilst sitting on the cannon to fire",
"This is the fun part. Use the Cannon to smash a hole in your enemys wall KA-BOOM!" "This is the fun part. Use the Cannon to smash a hole in your enemys wall KA-BOOM!",
DyeColor.MAGENTA
); );
} }

View File

@ -23,7 +23,8 @@ public class GetMapGoal extends ObjectiveGoal<AttackEnemyObjective>
"You can get a Map any time you need one. The map will show you who " + "You can get a Map any time you need one. The map will show you who " +
"owns the land around the map. Your clan is " + C.cAqua + "aqua" + "owns the land around the map. Your clan is " + C.cAqua + "aqua" +
C.mBody + ", your allies are " + C.cGreen + "green" + C.mBody + ", " + C.mBody + ", your allies are " + C.cGreen + "green" + C.mBody + ", " +
"and your enemies are " + C.cRed + "red" + C.mBody + "." "and your enemies are " + C.cRed + "red" + C.mBody + ".",
null
); );
setStartMessageDelay(120); setStartMessageDelay(120);

View File

@ -18,7 +18,8 @@ public class LoadCannonGoal extends ObjectiveGoal<AttackEnemyObjective>
"Load the Cannon", "Load the Cannon",
"Right click whilst sitting on the Cannon, and load it with TNT!", "Right click whilst sitting on the Cannon, and load it with TNT!",
"First youll need to load this baby up with some TNT. Right click whilst sitting " + "First youll need to load this baby up with some TNT. Right click whilst sitting " +
"on the Cannon, and load it with TNT!" "on the Cannon, and load it with TNT!",
null
); );
} }

View File

@ -3,6 +3,7 @@ package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.attackenemy
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.bukkit.DyeColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -25,7 +26,8 @@ public class MountCannonGoal extends ObjectiveGoal<AttackEnemyObjective>
"Get on the Cannon", "Get on the Cannon",
"Right click on the Cannon to hop on!", "Right click on the Cannon to hop on!",
"To break through an enemy Clans fortress youll need some serious " + "To break through an enemy Clans fortress youll need some serious " +
"firepower. Try using this TNT Cannon to get the job done!" "firepower. Try using this TNT Cannon to get the job done!",
DyeColor.BLACK
); );
} }

View File

@ -4,6 +4,7 @@ import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.DyeColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Creature; import org.bukkit.entity.Creature;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -32,7 +33,8 @@ public class StealEnemyPotatoesGoal extends ObjectiveGoal<AttackEnemyObjective>
"Steal Potatoes", "Steal Potatoes",
"Retrieve the potatoes from the Enemy Clans base", "Retrieve the potatoes from the Enemy Clans base",
"Now that their walls are down, its time to get rich! Go steal their " + "Now that their walls are down, its time to get rich! Go steal their " +
"potatoes for your Clan!" "potatoes for your Clan!",
DyeColor.PURPLE
); );
} }

View File

@ -2,6 +2,7 @@ package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan;
import java.util.List; import java.util.List;
import org.bukkit.DyeColor;
import org.bukkit.Effect; import org.bukkit.Effect;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
@ -40,7 +41,8 @@ public class BuildHouseGoal extends ObjectiveGoal<ClanObjective>
"Build a House", "Build a House",
"Build a House (place all your blocks)", "Build a House (place all your blocks)",
"The first thing you should do on your land is build a house, even " + "The first thing you should do on your land is build a house, even " +
"if its made of dirt! This will give you a safe place to store your loot!" "if its made of dirt! This will give you a safe place to store your loot!",
DyeColor.ORANGE
); );
} }

View File

@ -3,6 +3,7 @@ package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan;
import java.util.List; import java.util.List;
import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent;
import org.bukkit.DyeColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -27,7 +28,8 @@ public class ClaimLandGoal extends ObjectiveGoal<ClanObjective>
"Claim Land", "Claim Land",
"Claim Land using the Clan Menu ( Type /c )", "Claim Land using the Clan Menu ( Type /c )",
"The first thing your Clan needs to do before you can start to " + "The first thing your Clan needs to do before you can start to " +
"build your fortress is claim the land in an area for your Clan." "build your fortress is claim the land in an area for your Clan.",
DyeColor.ORANGE
); );
} }

View File

@ -28,7 +28,8 @@ public class ClanInfoGoal extends ObjectiveGoal<AttackEnemyObjective>
"View info about the enemy clan by typing /c EnemyClan", "View info about the enemy clan by typing /c EnemyClan",
"You can lookup details about your enemy before going for an " + "You can lookup details about your enemy before going for an " +
"attack! This can give you a crucial advantage before " + "attack! This can give you a crucial advantage before " +
"you begin." "you begin.",
null
); );
} }

View File

@ -24,7 +24,8 @@ public class ClanManagementGoal extends ObjectiveGoal<ClanObjective>
"Open the Clan Menu", "Open the Clan Menu",
"Open the Clan Menu ( Type /c )", "Open the Clan Menu ( Type /c )",
"Clan Menu lets you view all clan information and perform actions: " + "Clan Menu lets you view all clan information and perform actions: " +
"who is online, Claiming Land, Inviting Players and much more." "who is online, Claiming Land, Inviting Players and much more.",
null
); );
} }

View File

@ -21,7 +21,8 @@ public class CreateClanGoal extends ObjectiveGoal<ClanObjective>
"Type /c create <name> to create a new Clan", "Type /c create <name> to create a new Clan",
F.elem("Clans") + " are groups of players that can claim land, build fortresses, " + F.elem("Clans") + " are groups of players that can claim land, build fortresses, " +
"and fight epic battles. Together they will challenge other clans for " + "and fight epic battles. Together they will challenge other clans for " +
"control of the land." "control of the land.",
null
); );
} }

View File

@ -4,6 +4,7 @@ import java.util.HashSet;
import java.util.UUID; import java.util.UUID;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.DyeColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -29,7 +30,8 @@ public class LeaveSpawnGoal extends ObjectiveGoal<ClanObjective>
F.elem("Spawn Island") + " is where you will respawn when you die. This area is " + F.elem("Spawn Island") + " is where you will respawn when you die. This area is " +
"a " + F.elem("Safe Zone") + ", meaning that players cannot hurt each other. " + "a " + F.elem("Safe Zone") + ", meaning that players cannot hurt each other. " +
"From here, you can teleport to various places, as well as read some helpful " + "From here, you can teleport to various places, as well as read some helpful " +
"hints. To leave " + F.elem("Spawn Island") + ", simply jump off!" "hints. To leave " + F.elem("Spawn Island") + ", simply jump off!",
DyeColor.WHITE
); );
// 2 seconds after start message // 2 seconds after start message
@ -45,7 +47,7 @@ public class LeaveSpawnGoal extends ObjectiveGoal<ClanObjective>
@Override @Override
protected void customStart(Player player) protected void customStart(Player player)
{ {
player.getInventory().clear();
} }
@Override @Override

View File

@ -2,6 +2,7 @@ package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import net.minecraft.server.v1_8_R3.EnumDirection; import net.minecraft.server.v1_8_R3.EnumDirection;
import org.bukkit.DyeColor;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -24,7 +25,8 @@ public class SetHomeGoal extends ObjectiveGoal<ClanObjective>
"Set your Clan's Home ( Type /c sethome )", "Set your Clan's Home ( Type /c sethome )",
"Your Clan Home is a special place in your base that you can teleport " + "Your Clan Home is a special place in your base that you can teleport " +
"to from " + F.elem("Spawn Island") + ". You can teleport to it " + "to from " + F.elem("Spawn Island") + ". You can teleport to it " +
"at any time by typing " + F.elem("/c home") + "." "at any time by typing " + F.elem("/c home") + ".",
DyeColor.ORANGE
); );
setDisplayFinishMessage(false); setDisplayFinishMessage(false);

View File

@ -16,7 +16,8 @@ public class EquipDefaultBuildGoal extends ObjectiveGoal<ClassesObjective>
"Equip Armor", "Equip Armor",
"Put on your Iron Armor", "Put on your Iron Armor",
"When you wear a full set of armor, it will equip a class! The Iron set makes you " + "When you wear a full set of armor, it will equip a class! The Iron set makes you " +
"into a Knight. Each class has different skills and is strong in its own way." "into a Knight. Each class has different skills and is strong in its own way.",
null
); );
setStartMessageDelay(120); setStartMessageDelay(120);

View File

@ -1,5 +1,6 @@
package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.classes; package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.classes;
import org.bukkit.DyeColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -20,7 +21,8 @@ public class OpenClassManagerGoal extends ObjectiveGoal<ClassesObjective>
"Right-Click on the Enchantment Table", "Right-Click on the Enchantment Table",
"Each class has lots of different skills, and you can pick which ones you want to " + "Each class has lots of different skills, and you can pick which ones you want to " +
"equip! Click on an " + F.elem("Enchanting Table") + " to have a look at " + "equip! Click on an " + F.elem("Enchanting Table") + " to have a look at " +
"this menu." "this menu.",
DyeColor.CYAN
); );
} }

View File

@ -23,7 +23,8 @@ public class UseBullsChargeGoal extends ObjectiveGoal<ClassesObjective> {
"Use Bulls Charge", "Use Bulls Charge",
"Right-Click with Axe to use Bull's Charge", "Right-Click with Axe to use Bull's Charge",
"One of your default abilities as Knight is Bulls Charge. This ability will make " + "One of your default abilities as Knight is Bulls Charge. This ability will make " +
"you run faster for a short time, and deal extra damage to enemies." "you run faster for a short time, and deal extra damage to enemies.",
null
); );
} }

View File

@ -1,5 +1,6 @@
package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.energy; package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.energy;
import org.bukkit.DyeColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -16,7 +17,8 @@ public class BuyEnergyGoal extends ObjectiveGoal<EnergyObjective>
objective, objective,
"Buy Energy", "Buy Energy",
"Buy Clan Energy from the Energy Shop", "Buy Clan Energy from the Energy Shop",
"You can buy Clan Energy at the Shops." "You can buy Clan Energy at the Shops.",
DyeColor.RED
); );
} }

View File

@ -23,7 +23,8 @@ public class ExplainEnergyGoal extends ObjectiveGoal<EnergyObjective>
"Look at your energy in your Clans Menu ( Type /c )", "Look at your energy in your Clans Menu ( Type /c )",
"Owning land isnt free! You will need to buy Energy from the Shops to retain " + "Owning land isnt free! You will need to buy Energy from the Shops to retain " +
"ownership of it. If your Clan Energy ever reaches 0, you will lose your " + "ownership of it. If your Clan Energy ever reaches 0, you will lose your " +
"land claims!" "land claims!",
null
); );
} }

View File

@ -25,7 +25,8 @@ public class GoToFieldsGoal extends ObjectiveGoal<FieldsObjective>
"Go to the Fields", "Go to the Fields",
"Go to the Fields", "Go to the Fields",
"The Fields are a very dangerous place where players come to fight and harvest " + "The Fields are a very dangerous place where players come to fight and harvest " +
"resources!" "resources!",
DyeColor.YELLOW
); );
} }

View File

@ -5,6 +5,7 @@ import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.DyeColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -30,7 +31,8 @@ public class MineDiamondsGoal extends ObjectiveGoal<FieldsObjective>
"Mine Diamonds", "Mine Diamonds",
"Search for some diamonds in the Fields and mine them", "Search for some diamonds in the Fields and mine them",
"Mining in the Fields is a great way to make lots of money! The ores will " + "Mining in the Fields is a great way to make lots of money! The ores will " +
"regenerate over time. Be careful of enemies though!" "regenerate over time. Be careful of enemies though!",
DyeColor.LIME
); );
_playersMap = new HashMap<>(); _playersMap = new HashMap<>();

View File

@ -20,7 +20,8 @@ public class SellDiamondsGoal extends ObjectiveGoal<FieldsObjective>
objective, objective,
"Sell Diamonds", "Sell Diamonds",
"Sell your Diamonds to the Mining Shop", "Sell your Diamonds to the Mining Shop",
"Go back to the Shops and sell your precious diamonds!" "Go back to the Shops and sell your precious diamonds!",
DyeColor.GRAY
); );
} }

View File

@ -1,7 +1,9 @@
package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.finalobj; package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.finalobj;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.game.clans.clans.event.ClanDisbandedEvent; import mineplex.game.clans.clans.event.ClanDisbandedEvent;
import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent; import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent;
import org.bukkit.Bukkit;
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;
@ -14,6 +16,7 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.game.clans.clans.ClansManager; import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.event.ClansCommandExecutedEvent; 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;
import org.jooq.Update;
public class DisbandClanGoal extends ObjectiveGoal<FinalObjective> public class DisbandClanGoal extends ObjectiveGoal<FinalObjective>
{ {
@ -25,7 +28,8 @@ public class DisbandClanGoal extends ObjectiveGoal<FinalObjective>
"Disband your Clan ( Type /c )", "Disband your Clan ( Type /c )",
"Now that the tutorial is almost finished, lets delete your Clan. Disbanding a " + "Now that the tutorial is almost finished, lets delete your Clan. Disbanding a " +
"Clan will delete it, and unclaim all of your land. Open the Clans Menu " + "Clan will delete it, and unclaim all of your land. Open the Clans Menu " +
"and do this now." "and do this now.",
null
); );
} }
@ -37,7 +41,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)
@ -52,9 +56,19 @@ 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()); ClansManager.getInstance().resetLeftTimer(event.getDisbander().getUniqueId());
Bukkit.getScheduler().runTaskLater(getObjective().getJavaPlugin(), () -> {
}, 500L);
finish(event.getDisbander()); finish(event.getDisbander());
} }
@EventHandler
public void update(UpdateEvent event)
{
//TODO FINISH fireworks boom boom - chiss
}
@EventHandler (priority = EventPriority.HIGHEST) @EventHandler (priority = EventPriority.HIGHEST)
public void onClick(ClansButtonClickEvent event) { public void onClick(ClansButtonClickEvent event) {

View File

@ -23,7 +23,8 @@ public class TpClanHomeGoal extends ObjectiveGoal<FinalObjective>
objective, objective,
"Teleport to Clan Home", "Teleport to Clan Home",
"Teleport back to your Clan Home ( Type /c home )", "Teleport back to your Clan Home ( Type /c home )",
"You can teleport back to your Clan Home at any time, as long as it's set!" "You can teleport back to your Clan Home at any time, as long as it's set!",
null
); );
setStartMessageDelay(120); setStartMessageDelay(120);

View File

@ -24,7 +24,8 @@ public class GoToShopsGoal extends ObjectiveGoal<ShopsObjective>
objective, objective,
"Go to the Shops", "Go to the Shops",
"Head over to the Shops (use your map)", "Head over to the Shops (use your map)",
"The shops are the place where you can buy and sell all sorts of items!" "The shops are the place where you can buy and sell all sorts of items!",
DyeColor.LIGHT_BLUE
); );
} }

View File

@ -25,7 +25,7 @@ public class PurchaseGoal extends ObjectiveGoal
public PurchaseGoal(Objective objective, Material material, String name, String description, public PurchaseGoal(Objective objective, Material material, String name, String description,
String helpText) String helpText)
{ {
super(objective, name, description, helpText); super(objective, name, description, helpText, null);
_material = material; _material = material;
setDisplayStartMessage(false); setDisplayStartMessage(false);

View File

@ -22,7 +22,8 @@ public class SellPotatoesGoal extends ObjectiveGoal<ShopsObjective>
"Sell your Potatoes to the " + F.elem("Organic Produce Shop NPC") + ".", "Sell your Potatoes to the " + F.elem("Organic Produce Shop NPC") + ".",
"Farming is a great way to make money in Clans. Build a farm in your land, " + "Farming is a great way to make money in Clans. Build a farm in your land, " +
"harvest " + "harvest " +
"the crops and sell it to the shops for profit!" "the crops and sell it to the shops for profit!",
DyeColor.PINK
); );
} }