Merge branch 'master' of ssh://184.154.0.242:7999/min/mineplex
Conflicts: Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountTitan.java
This commit is contained in:
commit
636dcdf9f7
@ -13,7 +13,7 @@ public class DisguiseGuardian extends DisguiseCreature
|
||||
|
||||
public void setTarget(int target)
|
||||
{
|
||||
DataWatcher.watch(17, 0);
|
||||
DataWatcher.watch(17, target);
|
||||
}
|
||||
|
||||
public void setElder(boolean elder)
|
||||
|
@ -61,7 +61,7 @@ public class ItemTNT extends ItemGadget
|
||||
if (!_tnt.remove(event.getEntity()))
|
||||
return;
|
||||
|
||||
HashMap<Player, Double> players = UtilPlayer.getInRadius(event.getLocation(), 10);
|
||||
HashMap<Player, Double> players = UtilPlayer.getInRadius(event.getLocation(), 8);
|
||||
for (Player player : players.keySet())
|
||||
{
|
||||
if (Manager.collideEvent(this, player))
|
||||
|
@ -1,23 +1,47 @@
|
||||
package mineplex.core.gadget.gadgets;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Zombie;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.MapUtil;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.disguise.disguises.DisguiseBase;
|
||||
import mineplex.core.disguise.disguises.DisguiseGuardian;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.types.MorphGadget;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.recharge.RechargedEvent;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
public class MorphTitan extends MorphGadget
|
||||
{
|
||||
private HashMap<Player, ArmorStand> _targets = new HashMap<Player, ArmorStand>();
|
||||
|
||||
public MorphTitan(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Elder Guardian Morph", new String[]
|
||||
@ -38,6 +62,7 @@ public class MorphTitan extends MorphGadget
|
||||
DisguiseGuardian disguise = new DisguiseGuardian(player);
|
||||
disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank());
|
||||
disguise.setCustomNameVisible(true);
|
||||
disguise.setElder(true);
|
||||
Manager.getDisguiseManager().disguise(disguise);
|
||||
}
|
||||
|
||||
@ -46,10 +71,17 @@ public class MorphTitan extends MorphGadget
|
||||
{
|
||||
this.RemoveArmor(player);
|
||||
Manager.getDisguiseManager().undisguise(player);
|
||||
|
||||
player.setAllowFlight(false);
|
||||
player.setFlying(false);
|
||||
|
||||
Entity ent = _targets.remove(player);
|
||||
if (ent != null)
|
||||
ent.remove();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Snort(PlayerInteractEvent event)
|
||||
public void lazer(PlayerInteractEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
@ -59,18 +91,126 @@ public class MorphTitan extends MorphGadget
|
||||
if (!UtilEvent.isAction(event, ActionType.L))
|
||||
return;
|
||||
|
||||
if (!Recharge.Instance.use(player, GetName(), 2000, false, false))
|
||||
if (!Recharge.Instance.use(player, "Guardians Laser", 4000, true, false))
|
||||
return;
|
||||
|
||||
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 1f, 0.25f);
|
||||
DisguiseBase base = Manager.getDisguiseManager().getDisguise(player);
|
||||
if (base == null || !(base instanceof DisguiseGuardian))
|
||||
return;
|
||||
|
||||
DisguiseGuardian disguise = (DisguiseGuardian)base;
|
||||
|
||||
HashSet<Material> ignore = new HashSet<Material>();
|
||||
ignore.add(Material.AIR);
|
||||
|
||||
Location loc = player.getTargetBlock(ignore, 64).getLocation().add(0.5, 0.5, 0.5);
|
||||
|
||||
ArmorStand stand = loc.getWorld().spawn(loc, ArmorStand.class);
|
||||
|
||||
stand.setVisible(false);
|
||||
stand.setGhost(true);
|
||||
stand.setGravity(false);
|
||||
|
||||
_targets.put(player, stand);
|
||||
|
||||
disguise.setTarget(stand.getEntityId());
|
||||
|
||||
Manager.getDisguiseManager().updateDisguise(disguise);
|
||||
|
||||
//Fake Head
|
||||
UtilEnt.setFakeHead(player, true);
|
||||
Recharge.Instance.useForce(player, GetName() + " FakeHead", 2000);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void lazerEnd(RechargedEvent event)
|
||||
{
|
||||
if (event.GetAbility().equals(GetName() + " FakeHead"))
|
||||
{
|
||||
UtilEnt.setFakeHead(event.GetPlayer(), false);
|
||||
|
||||
//Explode
|
||||
ArmorStand stand = _targets.remove(event.GetPlayer());
|
||||
if (stand != null)
|
||||
{
|
||||
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, stand.getLocation(), 3f, 3f, 3f, 0, 32, ViewDist.MAX, UtilServer.getPlayers());
|
||||
|
||||
HashMap<LivingEntity, Double> players = UtilEnt.getInRadius(stand.getLocation(), 12);
|
||||
for (Entity ent : players.keySet())
|
||||
{
|
||||
if (ent instanceof Player)
|
||||
if (Manager.collideEvent(this, (Player)ent))
|
||||
continue;
|
||||
|
||||
double mult = players.get(ent);
|
||||
|
||||
//Knockback
|
||||
UtilAction.velocity(ent, UtilAlg.getTrajectory(stand.getLocation(), ent.getLocation()), 4 * mult, false, 0, 1 + 3 * mult, 10, true);
|
||||
}
|
||||
|
||||
//Sound
|
||||
stand.getWorld().playSound(stand.getLocation(), Sound.ZOMBIE_REMEDY, 6f, 0.75f);
|
||||
}
|
||||
|
||||
//Disguise
|
||||
DisguiseBase base = Manager.getDisguiseManager().getDisguise(event.GetPlayer());
|
||||
if (base == null || !(base instanceof DisguiseGuardian))
|
||||
return;
|
||||
|
||||
DisguiseGuardian disguise = (DisguiseGuardian)base;
|
||||
disguise.setTarget(0);
|
||||
|
||||
Manager.getDisguiseManager().updateDisguise(disguise);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void selfParticles(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
for (Player player : _targets.keySet())
|
||||
{
|
||||
Vector dir = UtilAlg.getTrajectory( player.getLocation().add(0, 1.5, 0), _targets.get(player).getLocation());
|
||||
dir.multiply(8);
|
||||
|
||||
UtilParticle.PlayParticle(ParticleType.MAGIC_CRIT,
|
||||
player.getLocation().add(0, 1.5, 0),
|
||||
(float)dir.getX(),
|
||||
(float)dir.getY(),
|
||||
(float)dir.getZ(),
|
||||
1, 0, ViewDist.LONG, UtilServer.getPlayers());
|
||||
|
||||
player.playSound(player.getLocation(), Sound.FIREWORK_TWINKLE2, 2f, 2f);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void flight(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
for (Player player : GetActive())
|
||||
{
|
||||
if (UtilPlayer.isSpectator(player))
|
||||
continue;
|
||||
|
||||
player.setAllowFlight(true);
|
||||
player.setFlying(true);
|
||||
|
||||
if (UtilEnt.isGrounded(player))
|
||||
UtilAction.velocity(player, new Vector(0,1,0));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void titanOwner(PlayerJoinEvent event)
|
||||
{
|
||||
if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.TITAN))
|
||||
{
|
||||
Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName());
|
||||
}
|
||||
// if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.TITAN))
|
||||
// {
|
||||
// Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName());
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
@ -28,14 +28,14 @@ public class MountTitan extends Mount<MountTitanData>
|
||||
{
|
||||
public MountTitan(MountManager manager)
|
||||
{
|
||||
super(manager, "Molten Snake", Material.REDSTONE_BLOCK, (byte) 0, new String[]
|
||||
{
|
||||
C.cWhite + "From the distant ether realm,",
|
||||
C.cWhite + "this prized dragon is said to",
|
||||
C.cWhite + "obey only true Heroes!",
|
||||
" ",
|
||||
C.cRed + "Unlocked with Titan Rank",
|
||||
}, -1);
|
||||
super(manager, "Molten Snake", Material.REDSTONE_BLOCK, (byte)0, new String[]
|
||||
{
|
||||
C.cWhite + "From the distant ether realm,",
|
||||
C.cWhite + "this prized dragon is said to",
|
||||
C.cWhite + "obey only true Heroes!",
|
||||
" ",
|
||||
C.cRed + "Unlocked with Titan Rank",
|
||||
}, -1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -44,14 +44,14 @@ public class MountTitan extends Mount<MountTitanData>
|
||||
player.leaveVehicle();
|
||||
player.eject();
|
||||
|
||||
// Remove other mounts
|
||||
//Remove other mounts
|
||||
Manager.DeregisterAll(player);
|
||||
|
||||
// Inform
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + "."));
|
||||
|
||||
// Store
|
||||
_active.put(player, new MountTitanData(Manager.getDisguiseManager(), player, GetName()));
|
||||
//Store
|
||||
_active.put(player, new MountTitanData(player, GetName()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -62,7 +62,7 @@ public class MountTitan extends Mount<MountTitanData>
|
||||
{
|
||||
data.clean();
|
||||
|
||||
// Inform
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main("Mount", "You despawned " + F.elem(GetName()) + "."));
|
||||
|
||||
Manager.removeActive(player);
|
||||
@ -111,16 +111,16 @@ public class MountTitan extends Mount<MountTitanData>
|
||||
if (!GetActive().containsKey(event.getTarget()))
|
||||
return;
|
||||
|
||||
if (!GetActive().get(event.getTarget()).ownsMount((Player) event.getEntity()))
|
||||
if (!GetActive().get(event.getTarget()).ownsMount((Player)event.getEntity()))
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void titanOwner(PlayerJoinEvent event)
|
||||
{
|
||||
if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.TITAN))
|
||||
{
|
||||
Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName());
|
||||
}
|
||||
// if (Manager.getClientManager().Get(event.getPlayer()).GetRank().has(Rank.TITAN))
|
||||
// {
|
||||
// Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName());
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ public class PetFactory
|
||||
_pets.put(EntityType.OCELOT, new Pet("Cat", EntityType.OCELOT, 6000));
|
||||
_pets.put(EntityType.MUSHROOM_COW, new Pet("Mooshroom", EntityType.MUSHROOM_COW, 5000));
|
||||
_pets.put(EntityType.WITHER, new Pet("Widder", EntityType.WITHER, -1));
|
||||
_pets.put(EntityType.GUARDIAN, new Pet("Guardian", EntityType.GUARDIAN, -1));
|
||||
_pets.put(EntityType.SKELETON, new Pet("Guardian", EntityType.SKELETON, -1));
|
||||
}
|
||||
|
||||
private void CreatePetExtras()
|
||||
|
@ -14,9 +14,12 @@ import mineplex.core.account.event.ClientWebResponseEvent;
|
||||
import mineplex.core.blockrestore.BlockRestore;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.disguise.DisguiseManager;
|
||||
import mineplex.core.disguise.disguises.DisguiseGuardian;
|
||||
import mineplex.core.disguise.disguises.DisguiseWither;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
@ -164,8 +167,8 @@ public class PetManager extends MiniClientPlugin<PetClient>
|
||||
|
||||
if (rank.has(Rank.TITAN))
|
||||
{
|
||||
if (!Get(p).GetPets().containsKey(EntityType.GUARDIAN))
|
||||
Get(p).GetPets().put(EntityType.GUARDIAN, "Guardian");
|
||||
// if (!Get(p).GetPets().containsKey(EntityType.SKELETON))
|
||||
// Get(p).GetPets().put(EntityType.SKELETON, "Guardian");
|
||||
}
|
||||
}
|
||||
|
||||
@ -183,6 +186,7 @@ public class PetManager extends MiniClientPlugin<PetClient>
|
||||
|
||||
Creature pet;
|
||||
|
||||
//Wither Spawn
|
||||
if (entityType == EntityType.WITHER)
|
||||
{
|
||||
_creatureModule.SetForce(true);
|
||||
@ -204,6 +208,7 @@ public class PetManager extends MiniClientPlugin<PetClient>
|
||||
|
||||
_creatureModule.SetForce(false);
|
||||
}
|
||||
//Default Spawn
|
||||
else
|
||||
{
|
||||
pet = (Creature)_creatureModule.SpawnEntity(location, entityType);
|
||||
@ -228,6 +233,20 @@ public class PetManager extends MiniClientPlugin<PetClient>
|
||||
((Villager) pet).setBaby();
|
||||
((Villager) pet).setAgeLock(true);
|
||||
}
|
||||
else if (pet instanceof Skeleton)
|
||||
{
|
||||
pet.getEquipment().setHelmet(new ItemStack(Material.PUMPKIN)); //stop burning
|
||||
UtilEnt.silence(pet, true);
|
||||
|
||||
DisguiseGuardian disguise = new DisguiseGuardian(pet);
|
||||
|
||||
if (Get(player).GetPets().get(entityType) != null && Get(player).GetPets().get(entityType).length() > 0)
|
||||
{
|
||||
disguise.setName(Get(player).GetPets().get(entityType));
|
||||
}
|
||||
|
||||
_disguiseManager.disguise(disguise);
|
||||
}
|
||||
|
||||
_activePetOwners.put(player.getName(), pet);
|
||||
_failedAttempts.put(player.getName(), 0);
|
||||
@ -344,6 +363,12 @@ public class PetManager extends MiniClientPlugin<PetClient>
|
||||
yDiff = Math.abs(petSpot.getBlockY() - ownerSpot.getBlockY());
|
||||
zDiff = Math.abs(petSpot.getBlockZ() - ownerSpot.getBlockZ());
|
||||
|
||||
//Guardian
|
||||
if (pet instanceof Skeleton && Math.random() > 0.66 && UtilEnt.isGrounded(pet))
|
||||
{
|
||||
UtilAction.velocity(pet, UtilAlg.getTrajectory(pet, owner), Math.random() * 0.3 + 0.3, false, 0, 0.3, 1, true);
|
||||
}
|
||||
|
||||
if ((xDiff + yDiff + zDiff) > 4)
|
||||
{
|
||||
EntityCreature ec = ((CraftCreature) pet).getHandle();
|
||||
|
Loading…
Reference in New Issue
Block a user