Fixes of current and new missions
This commit is contained in:
parent
1d046ff119
commit
8e0bb18076
@ -55,6 +55,10 @@ public class GetQuestCommand extends CommandBase<QuestManager>
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
players.add(caller);
|
||||
}
|
||||
|
||||
Quest quest = Plugin.getQuestByID(Integer.parseInt(args[0]));
|
||||
|
||||
@ -64,16 +68,16 @@ public class GetQuestCommand extends CommandBase<QuestManager>
|
||||
UtilPlayer.message(player, F.main(QuestManager.QUEST_NAME, "Added " + QuestManager.QUEST_NAME + ": " + ChatColor.YELLOW + quest.getName()));
|
||||
|
||||
|
||||
if (!args[1].equalsIgnoreCase("all"))
|
||||
{
|
||||
if (caller != players.get(0))
|
||||
UtilPlayer.message(caller, F.main(QuestManager.QUEST_NAME, "You gave the " + QuestManager.QUEST_NAME + ": " + ChatColor.YELLOW + quest.getName() + ChatColor.GRAY + " to " + ChatColor.YELLOW + player.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
if (args[1].equalsIgnoreCase("all"))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(QuestManager.QUEST_NAME, "You gave the " + QuestManager.QUEST_NAME + ": " + ChatColor.YELLOW + quest.getName() + ChatColor.GRAY + " to " + ChatColor.YELLOW + "everyone"));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (caller != players.get(0))
|
||||
UtilPlayer.message(caller, F.main(QuestManager.QUEST_NAME, "You gave the " + QuestManager.QUEST_NAME + ": " + ChatColor.YELLOW + quest.getName() + ChatColor.GRAY + " to " + ChatColor.YELLOW + player.getName()));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package nautilus.game.arcade.game;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import mineplex.core.Managers;
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.antihack.AntiHack;
|
||||
import mineplex.core.arcadeevents.CoreGameStartEvent;
|
||||
import mineplex.core.arcadeevents.CoreGameStopEvent;
|
||||
@ -1779,6 +1780,16 @@ public abstract class Game extends ListenerComponent implements Lifetimed
|
||||
return _questTrackers;
|
||||
}
|
||||
|
||||
public <T extends QuestTracker<? extends Game>> T getQuestTracker(Class<T> clazz)
|
||||
{
|
||||
for (QuestTracker<? extends Game> tracker : _questTrackers)
|
||||
{
|
||||
if (tracker.getClass().equals(clazz))
|
||||
return clazz.cast(tracker);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onHangingBreak(HangingBreakEvent event)
|
||||
{
|
||||
@ -2057,7 +2068,7 @@ public abstract class Game extends ListenerComponent implements Lifetimed
|
||||
public void onQuestBuy(QuestInteractEvent event)
|
||||
{
|
||||
if (GetState() == GameState.Live || GetState() == GameState.Prepare || GetState() == GameState.End)
|
||||
event.setCancelled("You cant interact with " + QuestManager.QUEST_NAME + "s while you are ingame!");
|
||||
event.setCancelled("You can't interact with " + QuestManager.QUEST_NAME + "s while you are ingame!");
|
||||
}
|
||||
|
||||
public NautHashMap<String, Entity> getDeadBodies()
|
||||
|
@ -62,6 +62,7 @@ import nautilus.game.arcade.game.games.dragonescape.kits.KitDigger;
|
||||
import nautilus.game.arcade.game.games.dragonescape.kits.KitDisruptor;
|
||||
import nautilus.game.arcade.game.games.dragonescape.kits.KitLeaper;
|
||||
import nautilus.game.arcade.game.games.dragonescape.kits.KitWarper;
|
||||
import nautilus.game.arcade.game.games.dragonescape.quests.DragonEscapeWinQuestTracker;
|
||||
import nautilus.game.arcade.game.modules.compass.CompassModule;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.managers.chat.ChatStatData;
|
||||
@ -145,6 +146,8 @@ public class DragonEscape extends SoloGame
|
||||
new ChatStatData("kit", "Kit", true)
|
||||
);
|
||||
|
||||
registerQuestTrackers(new DragonEscapeWinQuestTracker(this));
|
||||
|
||||
new CompassModule()
|
||||
.setGiveCompass(true)
|
||||
.setGiveCompassToSpecs(true)
|
||||
@ -487,7 +490,10 @@ public class DragonEscape extends SoloGame
|
||||
AddGems(_winner, 10, "Course Complete", false, false);
|
||||
|
||||
if (places.size() >= 1)
|
||||
{
|
||||
AddGems(places.get(0), 20, "1st Place", false, false);
|
||||
getQuestTracker(DragonEscapeWinQuestTracker.class).increment(places.get(0));
|
||||
}
|
||||
|
||||
if (places.size() >= 2)
|
||||
AddGems(places.get(1), 15, "2nd Place", false, false);
|
||||
|
@ -0,0 +1,30 @@
|
||||
package nautilus.game.arcade.game.games.dragonescape.quests;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.quests.TriggerType;
|
||||
|
||||
import nautilus.game.arcade.Arcade;
|
||||
import nautilus.game.arcade.game.games.dragonescape.DragonEscape;
|
||||
import nautilus.game.arcade.quest.QuestTracker;
|
||||
|
||||
/**
|
||||
* DragonEscapeWinQuestTracker
|
||||
*
|
||||
* @author xXVevzZXx
|
||||
*/
|
||||
public class DragonEscapeWinQuestTracker extends QuestTracker<DragonEscape>
|
||||
{
|
||||
|
||||
public DragonEscapeWinQuestTracker(DragonEscape game)
|
||||
{
|
||||
super(game, TriggerType.COMPLETE);
|
||||
}
|
||||
|
||||
public void increment(Player player)
|
||||
{
|
||||
incrementQuests(player, 1, ((Arcade) UtilServer.getPlugin()).getServerConfig().getServerGroup().getPrefix(), getGame().GetKit(player).GetName() + "Kit", "Parkour");
|
||||
}
|
||||
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package nautilus.game.arcade.quest;
|
||||
|
||||
import java.awt.dnd.DragSourceDropEvent;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
@ -15,6 +16,7 @@ import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -33,6 +35,7 @@ import nautilus.game.arcade.game.Game;
|
||||
public class CollectQuestTracker extends QuestTracker<Game>
|
||||
{
|
||||
private ArrayList<ItemStack> _itemsAvailable = new ArrayList<>();
|
||||
private ArrayList<ItemStack> _badItems = new ArrayList<>();
|
||||
private ArrayList<Location> _usedChests = new ArrayList<>();
|
||||
private ArrayList<Location> _usedBlocks = new ArrayList<>();
|
||||
|
||||
@ -67,6 +70,12 @@ public class CollectQuestTracker extends QuestTracker<Game>
|
||||
|
||||
}
|
||||
|
||||
@EventHandler(priority=EventPriority.HIGHEST)
|
||||
public void itemRegister(PlayerDropItemEvent event)
|
||||
{
|
||||
_badItems.add(event.getItemDrop().getItemStack());
|
||||
}
|
||||
|
||||
@EventHandler(priority=EventPriority.HIGHEST)
|
||||
public void itemRegister(BlockBreakEvent event)
|
||||
{
|
||||
@ -76,12 +85,12 @@ public class CollectQuestTracker extends QuestTracker<Game>
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
if (_usedBlocks.contains(event.getBlock().getLocation()))
|
||||
if (!_usedBlocks.contains(event.getBlock().getLocation()))
|
||||
return;
|
||||
|
||||
for (ItemStack item : event.getBlock().getDrops())
|
||||
{
|
||||
_itemsAvailable.add(item);
|
||||
_badItems.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,19 +104,12 @@ public class CollectQuestTracker extends QuestTracker<Game>
|
||||
return;
|
||||
|
||||
ItemStack item = event.getItem().getItemStack();
|
||||
ItemStack fromList = null;
|
||||
|
||||
for (ItemStack available : _itemsAvailable)
|
||||
if (_badItems.contains(item))
|
||||
{
|
||||
if (available.getType() == item.getType())
|
||||
fromList = available;
|
||||
}
|
||||
|
||||
if (fromList == null)
|
||||
_badItems.remove(item);
|
||||
return;
|
||||
|
||||
_itemsAvailable.remove(fromList);
|
||||
|
||||
}
|
||||
String itemName = item.getType().toString();
|
||||
|
||||
if (item.hasItemMeta())
|
||||
|
@ -9,6 +9,7 @@ import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
|
||||
import mineplex.core.common.util.UtilItem;
|
||||
import mineplex.core.quests.TriggerType;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
|
||||
import nautilus.game.arcade.game.Game;
|
||||
|
||||
@ -34,30 +35,27 @@ public class HitQuestTracker extends QuestTracker<Game>
|
||||
if (!(event.getEntity() instanceof Player))
|
||||
return;
|
||||
|
||||
incrementQuests((Player) event.getDamager(), 1, "Player", getGame().GetKit((Player) event.getDamager()).GetName() + "Kit");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onProjectileHit(ProjectileHitEvent event)
|
||||
{
|
||||
if (!getGame().IsLive())
|
||||
return;
|
||||
|
||||
if (!(event.getEntity().getShooter() instanceof Player))
|
||||
return;
|
||||
|
||||
Item itemEntity = (Item) event.getEntity();
|
||||
String item = itemEntity.getItemStack().getType().toString();
|
||||
|
||||
if (UtilItem.isAxe(itemEntity.getItemStack().getType()))
|
||||
{
|
||||
item = "Axe";
|
||||
incrementQuests((Player) event.getDamager(), 1, "Player", item, getGame().GetKit((Player) event.getDamager()).GetName() + "Kit");
|
||||
}
|
||||
|
||||
Entity ent = event.getEntity().getLastDamageCause().getEntity();
|
||||
if (ent instanceof Player)
|
||||
@EventHandler
|
||||
public void onProjectileHit(CustomDamageEvent event)
|
||||
{
|
||||
incrementQuests((Player) event.getEntity().getShooter(), 1, "Player", item, getGame().GetKit((Player) event.getEntity().getShooter()).GetName() + "Kit");
|
||||
}
|
||||
if (!getGame().IsLive())
|
||||
return;
|
||||
|
||||
if (event.GetReason() == null)
|
||||
return;
|
||||
|
||||
if (!event.GetReason().contains("Axe Thrower"))
|
||||
return;
|
||||
|
||||
System.out.println("Test2");
|
||||
|
||||
incrementQuests(event.GetDamagerPlayer(true), 1, "Player", "Axe", getGame().GetKit(event.GetDamagerPlayer(true)).GetName() + "Kit");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user