Mount base

This commit is contained in:
Sam 2017-08-16 15:00:08 +01:00
parent 7667bf47c4
commit 849fa93c7c
8 changed files with 118 additions and 22 deletions

View File

@ -90,7 +90,11 @@ public class HeroKit extends Kit
public boolean ownsKit(Player player) public boolean ownsKit(Player player)
{ {
MobaProgression progression = ((Moba) Manager.GetGame()).getProgression(); MobaProgression progression = ((Moba) Manager.GetGame()).getProgression();
return _unlockLevel == 0 || Manager.GetDonation().Get(player).ownsUnknownSalesPackage(progression.getPackageName(this)) || Manager.GetClients().hasRank(player, Rank.MODERATOR); return _unlockLevel == 0 ||
Manager.GetDonation().Get(player).ownsUnknownSalesPackage(progression.getPackageName(this)) ||
Manager.GetClients().hasRank(player, Rank.MODERATOR) ||
Manager.hasKitsUnlocked(player)
;
} }
public void setAmmo(ItemStack ammo, long giveTime) public void setAmmo(ItemStack ammo, long giveTime)

View File

@ -269,7 +269,6 @@ public class HeroSkill extends Perk
return; return;
} }
Moba moba = (Moba) Manager.GetGame();
long current = System.currentTimeMillis(); long current = System.currentTimeMillis();
for (Player player : Manager.GetGame().GetPlayers(true)) for (Player player : Manager.GetGame().GetPlayers(true))

View File

@ -211,12 +211,12 @@ public class MobaUtil
public static void setTeamEntity(LivingEntity entity, GameTeam team) public static void setTeamEntity(LivingEntity entity, GameTeam team)
{ {
entity.setMetadata(MobaConstants.TEAM_METADATA, new FixedMetadataValue(UtilServer.getPlugin(), team.GetName())); UtilEnt.addFlag(entity, MobaConstants.TEAM_METADATA + team.GetName());
} }
public static boolean isTeamEntity(LivingEntity entity, GameTeam team) public static boolean isTeamEntity(LivingEntity entity, GameTeam team)
{ {
return entity.hasMetadata(MobaConstants.TEAM_METADATA) && entity.getMetadata(MobaConstants.TEAM_METADATA).get(0).asString().equals(team.GetName()); return UtilEnt.hasFlag(entity, MobaConstants.TEAM_METADATA + team.GetName());
} }
public static void heal(LivingEntity entity, Player source, double health) public static void heal(LivingEntity entity, Player source, double health)

View File

@ -693,16 +693,6 @@ public class ItemMapModule extends MiniPlugin
_mapInfo.remove(event.getPlayer().getName()); _mapInfo.remove(event.getPlayer().getName());
} }
//@EventHandler
public void onServerTransfer(ServerTransferEvent event)
{
Player p = event.getPlayer();
p.sendMessage(C.cDRed + C.Bold + "WARNING!");
p.sendMessage(C.cYellow + "There's a bug where switching servers will freeze the Clans Map!");
p.sendMessage(C.cYellow + "If you want to play on Clans again, rejoin the Mineplex server!");
}
private void rebuildScan() private void rebuildScan()
{ {
for (int x = -HALF_WORLD_SIZE; x < HALF_WORLD_SIZE; x += BLOCK_SCAN_INTERVAL) for (int x = -HALF_WORLD_SIZE; x < HALF_WORLD_SIZE; x += BLOCK_SCAN_INTERVAL)

View File

@ -0,0 +1,23 @@
package mineplex.gemhunters.mount;
import org.bukkit.entity.LivingEntity;
import mineplex.core.disguise.disguises.DisguiseLiving;
public class GHMount
{
private final LivingEntity _entity;
private final DisguiseLiving _disguise;
public GHMount(LivingEntity entity, DisguiseLiving disguise)
{
_entity = entity;
_disguise = disguise;
}
public LivingEntity getEntity()
{
return _entity;
}
}

View File

@ -0,0 +1,11 @@
package mineplex.gemhunters.mount;
import org.bukkit.entity.LivingEntity;
public class MountData
{
private LivingEntity _entity;
}

View File

@ -0,0 +1,72 @@
package mineplex.gemhunters.mount;
import java.util.UUID;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.MiniClientPlugin;
import mineplex.core.ReflectivelyCreateMiniPlugin;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.gadget.GadgetManager;
import mineplex.gemhunters.loot.LootItem;
import mineplex.gemhunters.loot.LootModule;
@ReflectivelyCreateMiniPlugin
public class MountModule extends MiniClientPlugin<MountData>
{
private final LootModule _loot;
private final GadgetManager _gadget;
private MountModule()
{
super("Mount");
_loot = require(LootModule.class);
_gadget = require(GadgetManager.class);
}
@Override
protected MountData addPlayer(UUID uuid)
{
return new MountData();
}
@EventHandler
public void playerInteract(PlayerInteractEvent event)
{
if (event.isCancelled() || !UtilEvent.isAction(event, ActionType.R))
{
return;
}
Player player = event.getPlayer();
LootItem lootItem = _loot.fromItemStack(player.getItemInHand());
if (lootItem == null || lootItem.getMetadata() == null)
{
return;
}
String metadata = lootItem.getMetadata();
if (!metadata.startsWith("MOUNT"))
{
return;
}
String[] split = metadata.split(" ");
if (split.length < 2)
{
return;
}
int cooldown = Integer.parseInt(split[1]) * 1000;
}
}

View File

@ -46,9 +46,9 @@ public class SupplyDrop
private Location _current; private Location _current;
private Location _blade; private Location _blade;
private final Set<Block> _lastHelicopter;
private final Set<Block> _bladeBlocks;
private Schematic _schematic; private Schematic _schematic;
private Set<Block> _lastHelicopter;
private Set<Block> _bladeBlocks;
private boolean _diagonal; private boolean _diagonal;
public SupplyDrop(String name, Location spawn, Location destination, Location despawn) public SupplyDrop(String name, Location spawn, Location destination, Location despawn)
@ -57,6 +57,8 @@ public class SupplyDrop
_destination = destination.clone(); _destination = destination.clone();
_despawn = despawn.clone(); _despawn = despawn.clone();
_current = spawn.clone().add(-2, 0, 0); _current = spawn.clone().add(-2, 0, 0);
_lastHelicopter = new HashSet<>(100);
_bladeBlocks = new HashSet<>(20);
try try
{ {
@ -65,12 +67,7 @@ public class SupplyDrop
catch (IOException e) catch (IOException e)
{ {
e.printStackTrace(); e.printStackTrace();
return;
} }
_lastHelicopter = new HashSet<>(100);
_bladeBlocks = new HashSet<>(20);
_diagonal = false;
} }
public boolean advancePath() public boolean advancePath()
@ -100,7 +97,7 @@ public class SupplyDrop
if (_blade != null) if (_blade != null)
{ {
if (UtilMath.offset2d(_blade, _despawn) < 1) if (UtilMath.offset2dSquared(_blade, _despawn) < 4)
{ {
for (Block block : _bladeBlocks) for (Block block : _bladeBlocks)
{ {