Fixes for clans tutorial
This commit is contained in:
parent
b4cfbebf3f
commit
664d8b1a4e
@ -88,7 +88,8 @@ public abstract class SiegeWeapon implements Listener
|
||||
protected int _health;
|
||||
protected String _currentState;
|
||||
protected boolean _alive = true;
|
||||
|
||||
protected boolean _invincible = false;
|
||||
|
||||
// Mechanics
|
||||
protected final NautArrayList<Entity> _comprisedOf;
|
||||
|
||||
@ -568,12 +569,13 @@ public abstract class SiegeWeapon implements Listener
|
||||
|
||||
_infoHologram.setText(_name + " Health", getDisplayHealth());
|
||||
|
||||
if (_health == 0)
|
||||
if (_health == 0 && !_invincible)
|
||||
kill();
|
||||
}
|
||||
|
||||
public final void removeHealth(int health)
|
||||
{
|
||||
if (_invincible) return;
|
||||
setHealth(_health - health);
|
||||
}
|
||||
|
||||
@ -932,5 +934,15 @@ public abstract class SiegeWeapon implements Listener
|
||||
|
||||
return _loadedToken.Entities.values().contains(uniqueId.toString());
|
||||
}
|
||||
|
||||
public void setInvincible(boolean invincible)
|
||||
{
|
||||
_invincible = invincible;
|
||||
}
|
||||
|
||||
public boolean isInvincible()
|
||||
{
|
||||
return _invincible;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -251,6 +251,7 @@ public abstract class Tutorial implements Listener, ObjectiveListener
|
||||
|
||||
public TutorialRegion getRegion(Player player)
|
||||
{
|
||||
if(player == null || _playerSessionMap == null || _playerSessionMap.get(player) == null) return null;
|
||||
return _playerSessionMap.get(player).getRegion();
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,8 @@ import java.util.UUID;
|
||||
|
||||
import mineplex.core.common.util.*;
|
||||
import mineplex.game.clans.clans.ClanInfo;
|
||||
import mineplex.game.clans.clans.event.ClansPlayerBuyItemEvent;
|
||||
import mineplex.game.clans.clans.event.ClansPlayerSellItemEvent;
|
||||
import mineplex.game.clans.clans.gui.events.ClansButtonClickEvent;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.Block;
|
||||
@ -179,6 +181,7 @@ public class ClansMainTutorial extends Tutorial
|
||||
|
||||
public boolean isIn(Player player, Bounds bounds)
|
||||
{
|
||||
if(player == null) return false;
|
||||
TutorialRegion region = getRegion(player);
|
||||
|
||||
if (region != null)
|
||||
@ -414,7 +417,9 @@ public class ClansMainTutorial extends Tutorial
|
||||
|
||||
public void performGateCheck(Player player, DyeColor key)
|
||||
{
|
||||
if(player == null) return;
|
||||
Location exact = getRegion(player).getLocationMap().getIronLocations(key).get(0);
|
||||
if(exact == null) return;
|
||||
Location fence = UtilAlg.getAverageLocation(getRegion(player).getLocationMap().getIronLocations(key));
|
||||
|
||||
if (exact.getBlock().getType() == Material.AIR)
|
||||
@ -440,4 +445,11 @@ public class ClansMainTutorial extends Tutorial
|
||||
if(isInTutorial(event.getPlayer()))
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler (priority = EventPriority.LOWEST)
|
||||
public void onShop(ClansPlayerBuyItemEvent event)
|
||||
{
|
||||
if(isInTutorial(event.getPlayer()))
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ public class MountCannonGoal extends ObjectiveGoal<AttackEnemyObjective>
|
||||
{
|
||||
getObjective().getCannons().put(player.getName(), SiegeManager.Instance.spawnCannon(player, getObjective().getPlugin().getPoint(getObjective().getPlugin().getRegion(player), Point.CANNON), false));
|
||||
getObjective().getCannons().get(player.getName()).SetForcedVelocity(0.4, 2.45);
|
||||
getObjective().getCannons().get(player.getName()).setInvincible(true);
|
||||
|
||||
TutorialSession session = getObjective().getPlugin().getTutorialSession(player);
|
||||
session.setMapTargetLocation(getObjective().getPlugin().getPoint(session.getRegion(), ClansMainTutorial.Point.CANNON));
|
||||
|
@ -60,7 +60,7 @@ public class ClanInfoGoal extends ObjectiveGoal<AttackEnemyObjective>
|
||||
|
||||
ClanToken token = new ClanToken();
|
||||
token.Name = "EnemyClan";
|
||||
token.Description = "The meanest clan in the world!";
|
||||
token.Description = "Chiss";
|
||||
token.Home = "";
|
||||
token.Admin = false;
|
||||
token.Energy = 4320;
|
||||
|
@ -3,6 +3,7 @@ package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.clan;
|
||||
import java.util.HashSet;
|
||||
import java.util.UUID;
|
||||
|
||||
import mineplex.game.clans.clans.event.ClansCommandPreExecutedEvent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -53,6 +54,12 @@ public class LeaveSpawnGoal extends ObjectiveGoal<ClanObjective>
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onCommand(ClansCommandPreExecutedEvent event)
|
||||
{
|
||||
if(contains(event.getPlayer())) event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void checkRegion(UpdateEvent event)
|
||||
{
|
||||
@ -62,7 +69,8 @@ public class LeaveSpawnGoal extends ObjectiveGoal<ClanObjective>
|
||||
for (UUID uuid : getActivePlayers())
|
||||
{
|
||||
Player player = Bukkit.getPlayer(uuid);
|
||||
if (!getObjective().getPlugin().isIn(player, ClansMainTutorial.Bounds.SPAWN))
|
||||
if(player == null) continue;
|
||||
if (!getObjective().getPlugin().isIn(player, ClansMainTutorial.Bounds.SPAWN))
|
||||
{
|
||||
finish(Bukkit.getPlayer(uuid));
|
||||
}
|
||||
|
@ -93,6 +93,7 @@ public class MineDiamondsGoal extends ObjectiveGoal<FieldsObjective>
|
||||
|
||||
if (event.getItem().getItemStack().getType() == Material.DIAMOND)
|
||||
{
|
||||
if(_playersMap.get(event.getPlayer().getUniqueId()) == null) return;
|
||||
int count = _playersMap.get(event.getPlayer().getUniqueId()).incrementAndGet();
|
||||
if (count == 10)
|
||||
finish(event.getPlayer());
|
||||
|
@ -13,6 +13,7 @@ import mineplex.game.clans.tutorial.TutorialSession;
|
||||
import mineplex.game.clans.tutorial.objective.ObjectiveGoal;
|
||||
import mineplex.game.clans.tutorial.tutorials.clans.ClansMainTutorial;
|
||||
import mineplex.game.clans.tutorial.tutorials.clans.objective.FieldsObjective;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
public class SellDiamondsGoal extends ObjectiveGoal<FieldsObjective>
|
||||
{
|
||||
@ -23,7 +24,7 @@ public class SellDiamondsGoal extends ObjectiveGoal<FieldsObjective>
|
||||
"Sell Diamonds",
|
||||
"Sell your Diamonds to the Mining Shop",
|
||||
"Go back to the Shops and sell your precious diamonds!",
|
||||
DyeColor.GRAY
|
||||
DyeColor.SILVER
|
||||
);
|
||||
}
|
||||
|
||||
@ -44,21 +45,17 @@ public class SellDiamondsGoal extends ObjectiveGoal<FieldsObjective>
|
||||
getObjective().getPlugin().destroyFences(getObjective().getPlugin().getRegion(player), DyeColor.BLACK);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@EventHandler (priority = EventPriority.HIGH)
|
||||
public void onSell(ClansPlayerSellItemEvent event)
|
||||
{
|
||||
if (contains(event.getPlayer()))
|
||||
{
|
||||
if (event.getItem().getType() == Material.DIAMOND)
|
||||
{
|
||||
event.setCancelled(false);
|
||||
UtilInv.removeAll(event.getPlayer(), Material.DIAMOND, (byte) 0);
|
||||
finish(event.getPlayer());
|
||||
}
|
||||
else
|
||||
{
|
||||
event.setCancelled(true);
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Tutorial", "You need to sell your diamonds to the Mining Shop NPC!"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -8,6 +8,7 @@ import mineplex.game.clans.clans.event.ClansPlayerBuyItemEvent;
|
||||
import mineplex.game.clans.clans.event.ClansShopAddButtonEvent;
|
||||
import mineplex.game.clans.tutorial.objective.Objective;
|
||||
import mineplex.game.clans.tutorial.objective.ObjectiveGoal;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
public class PurchaseGoal extends ObjectiveGoal
|
||||
{
|
||||
@ -54,11 +55,12 @@ public class PurchaseGoal extends ObjectiveGoal
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@EventHandler (priority = EventPriority.HIGH)
|
||||
public void buy(final ClansPlayerBuyItemEvent event)
|
||||
{
|
||||
if (contains(event.getPlayer()) && event.getItem().getType() == _material)
|
||||
{
|
||||
event.setCancelled(false);
|
||||
finish(event.getPlayer());
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import mineplex.game.clans.tutorial.TutorialSession;
|
||||
import mineplex.game.clans.tutorial.objective.ObjectiveGoal;
|
||||
import mineplex.game.clans.tutorial.tutorials.clans.ClansMainTutorial;
|
||||
import mineplex.game.clans.tutorial.tutorials.clans.objective.ShopsObjective;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
public class SellPotatoesGoal extends ObjectiveGoal<ShopsObjective>
|
||||
{
|
||||
@ -46,15 +47,13 @@ public class SellPotatoesGoal extends ObjectiveGoal<ShopsObjective>
|
||||
UtilInv.removeAll(player, Material.POTATO_ITEM, (byte) 0);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@EventHandler (priority = EventPriority.HIGH)
|
||||
public void onSell(ClansPlayerSellItemEvent event)
|
||||
{
|
||||
if (contains(event.getPlayer())) {
|
||||
if (event.getItem().getType() == Material.POTATO_ITEM) {
|
||||
event.setCancelled(false);
|
||||
finish(event.getPlayer());
|
||||
} else {
|
||||
event.setCancelled(true);
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Tutorial", "You need to sell your potatoes to the Organic Produce NPC!"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user