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

This commit is contained in:
Shaun Bennett 2016-04-02 15:13:16 +11:00
commit 5739b1b87b
2 changed files with 10 additions and 9 deletions

View File

@ -1,6 +1,5 @@
package mineplex.game.clans.tutorial.objective;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
@ -14,6 +13,7 @@ import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.common.util.C;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.game.clans.tutorial.Tutorial;
@ -34,7 +34,7 @@ public abstract class Objective<Plugin extends Tutorial, Data extends ObjectiveD
private boolean _displayFinishMessage;
private int _finishMessageDelay;
private HashMap<UUID, Data> _active;
private NautHashMap<UUID, Data> _active;
private List<ObjectiveListener> _listeners;
public Objective(Plugin plugin, JavaPlugin javaPlugin, String name, String description, String extraDescription)
@ -49,7 +49,7 @@ public abstract class Objective<Plugin extends Tutorial, Data extends ObjectiveD
_startMessageDelay = 60;
_finishMessageDelay = 1;
_active = new HashMap<>();
_active = new NautHashMap<>();
_listeners = new LinkedList<>();
javaPlugin.getServer().getPluginManager().registerEvents(this, javaPlugin);
@ -161,7 +161,7 @@ public abstract class Objective<Plugin extends Tutorial, Data extends ObjectiveD
* @param goal
* @param player
*/
protected abstract void completeGoal(ObjectiveGoal goal, Player player);
protected abstract void completeGoal(ObjectiveGoal<?> goal, Player player);
/**
* Called when a player is finished the tutorial
@ -170,9 +170,11 @@ public abstract class Objective<Plugin extends Tutorial, Data extends ObjectiveD
*/
public void clean(Player player, TutorialRegion region)
{
List<ObjectiveGoal> goals = getGoals();
List<ObjectiveGoal<?>> goals = getGoals();
if (goals != null)
goals.forEach(goal -> goal.clean(player, region));
_active.remove(player.getUniqueId());
}
/**
@ -182,7 +184,7 @@ public abstract class Objective<Plugin extends Tutorial, Data extends ObjectiveD
*/
public void setup(Player player, TutorialRegion region)
{
List<ObjectiveGoal> goals = getGoals();
List<ObjectiveGoal<?>> goals = getGoals();
if (goals != null)
goals.forEach(goal -> goal.setup(player, region));
}
@ -191,7 +193,7 @@ public abstract class Objective<Plugin extends Tutorial, Data extends ObjectiveD
* Returns a list of all the ObjectiveGoals used by this Objective
* Can return <code>null</code>
*/
protected abstract List<ObjectiveGoal> getGoals();
protected abstract List<ObjectiveGoal<?>> getGoals();
protected final void finish(Player player)
{
@ -259,7 +261,7 @@ public abstract class Objective<Plugin extends Tutorial, Data extends ObjectiveD
{
HandlerList.unregisterAll(this);
List<ObjectiveGoal> goals = getGoals();
List<ObjectiveGoal<?>> goals = getGoals();
if (goals != null) goals.forEach(HandlerList::unregisterAll);
}

View File

@ -7,7 +7,6 @@ import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;