Merge branch 'clans-beta' of ssh://184.154.0.242:7999/min/Mineplex into clans-beta

This commit is contained in:
NewGarbo 2015-11-27 13:15:46 +00:00
commit 4423baca96
49 changed files with 1062 additions and 237 deletions

BIN
Art/MS SMoke.psd Normal file

Binary file not shown.

View File

@ -12,6 +12,7 @@ import org.bukkit.block.Block;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.util.EulerAngle;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import net.minecraft.server.v1_8_R3.EnumDirection; import net.minecraft.server.v1_8_R3.EnumDirection;
@ -499,4 +500,9 @@ public class UtilAlg
return value; return value;
} }
public static EulerAngle vectorToEuler(Vector vector)
{
return new EulerAngle(Math.toRadians(GetPitch(vector)), Math.toRadians(GetYaw(vector)), 0);
}
} }

View File

@ -817,4 +817,30 @@ public class UtilBlock
return getBedHead(bed.getBlock()) != null && getBedFoot(bed.getBlock()) != null; return getBedHead(bed.getBlock()) != null && getBedFoot(bed.getBlock()) != null;
} }
public static HashSet<Block> findConnectedBlocks(Block block, HashSet<Block> blocks, int limit)
{
if (blocks == null)
blocks = new HashSet<Block>();
//This is incase you recursively check an entire MC world
if (blocks.size() >= limit)
return blocks;
//Mark current node as searched
blocks.add(block);
//Search the node
for (Block neighbour : UtilBlock.getSurrounding(block, false))
{
if (neighbour.getType() == Material.AIR)
continue;
//If neighbour hasn't been searched, recursively search it!
if (!blocks.contains(neighbour))
findConnectedBlocks(neighbour, blocks, limit);
}
return blocks;
}
} }

View File

@ -373,13 +373,12 @@ public class CoreClientManager extends MiniPlugin
// Reserved Slot Check // Reserved Slot Check
if (Bukkit.getOnlinePlayers().size() >= Bukkit.getServer().getMaxPlayers()) if (Bukkit.getOnlinePlayers().size() >= Bukkit.getServer().getMaxPlayers())
{ {
// TODO: REMOVE THIS RESTRICTION FROM CLANS-BRANCH, USED TO PREVENT ULTRA FROM JOINING CLANS if (client.GetRank().has(event.getPlayer(), Rank.ULTRA, false))
// if (client.GetRank().Has(event.getPlayer(), Rank.ULTRA, false)) {
// { event.allow();
// event.allow(); event.setResult(PlayerLoginEvent.Result.ALLOWED);
// event.setResult(PlayerLoginEvent.Result.ALLOWED); return;
// return; }
// }
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "This server is full and no longer accepts players."); event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "This server is full and no longer accepts players.");
} }

View File

@ -277,7 +277,7 @@ public enum Achievement
//Champions //Champions
CHAMPIONS_WINS("Champion", 600, CHAMPIONS_WINS("Champion", 600,
new String[]{"Champions Domination.Wins", "Champions TDM.Wins", "Champions Capture the Flag.Wins"}, new String[]{"Champions Domination.Wins", "Champions TDM.Wins", "Champions CTF.Wins"},
new String[]{"Win 80 games of Dominate, TDM, or CTF"}, new String[]{"Win 80 games of Dominate, TDM, or CTF"},
new int[]{80}, new int[]{80},
AchievementCategory.CHAMPIONS), AchievementCategory.CHAMPIONS),
@ -295,43 +295,43 @@ public enum Achievement
AchievementCategory.CHAMPIONS), AchievementCategory.CHAMPIONS),
CHAMPIONS_ASSASSINATION("Assassination", 1000, CHAMPIONS_ASSASSINATION("Assassination", 1000,
new String[]{"Champions Domination.Assassination", "Champions TDM.Assassination", "Champions Capture the Flag.Assassination"}, new String[]{"Champions Domination.Assassination", "Champions TDM.Assassination", "Champions CTF.Assassination"},
new String[]{"Kill 40 players with Backstab without", "taking any damage from them"}, new String[]{"Kill 40 players with Backstab without", "taking any damage from them"},
new int[]{40}, new int[]{40},
AchievementCategory.CHAMPIONS), AchievementCategory.CHAMPIONS),
CHAMPIONS_MASS_ELECTROCUTION("Mass Electrocution", 1200, CHAMPIONS_MASS_ELECTROCUTION("Mass Electrocution", 1200,
new String[]{"Champions Domination.MassElectrocution", "Champions TDM.MassElectrocution", "Champions Capture the Flag.MassElectrocution"}, new String[]{"Champions Domination.MassElectrocution", "Champions TDM.MassElectrocution", "Champions CTF.MassElectrocution"},
new String[]{"Hit 4 enemies with a Lightning Orb"}, new String[]{"Hit 4 enemies with a Lightning Orb"},
new int[]{1}, new int[]{1},
AchievementCategory.CHAMPIONS), AchievementCategory.CHAMPIONS),
CHAMPIONS_THE_LONGEST_SHOT("The Longest Shot", 1200, CHAMPIONS_THE_LONGEST_SHOT("The Longest Shot", 1200,
new String[]{"Champions Domination.TheLongestShot", "Champions TDM.TheLongestShot", "Champions Capture the Flag.TheLongestShot"}, new String[]{"Champions Domination.TheLongestShot", "Champions TDM.TheLongestShot", "Champions CTF.TheLongestShot"},
new String[]{"Kill someone using Longshot who", "is over 64 Blocks away from you"}, new String[]{"Kill someone using Longshot who", "is over 64 Blocks away from you"},
new int[]{1}, new int[]{1},
AchievementCategory.CHAMPIONS), AchievementCategory.CHAMPIONS),
CHAMPIONS_EARTHQUAKE("Earthquake", 1200, CHAMPIONS_EARTHQUAKE("Earthquake", 1200,
new String[]{"Champions Domination.Earthquake", "Champions TDM.Earthquake", "Champions Capture the Flag.Earthquake"}, new String[]{"Champions Domination.Earthquake", "Champions TDM.Earthquake", "Champions CTF.Earthquake"},
new String[]{"Launch 5 enemies using Seismic Slam"}, new String[]{"Launch 5 enemies using Seismic Slam"},
new int[]{1}, new int[]{1},
AchievementCategory.CHAMPIONS), AchievementCategory.CHAMPIONS),
CHAMPIONS_CAPTURES("Sticky Fingers", 2500, CHAMPIONS_CAPTURES("Sticky Fingers", 2500,
new String[]{"Champions Capture the Flag.Captures"}, new String[]{"Champions CTF.Captures"},
new String[]{"Capture the Enemy Flag 20 times"}, new String[]{"Capture the Enemy Flag 20 times"},
new int[]{20}, new int[]{20},
AchievementCategory.CHAMPIONS), AchievementCategory.CHAMPIONS),
CHAMPIONS_CLUTCH("Clutch", 600, CHAMPIONS_CLUTCH("Clutch", 600,
new String[]{"Champions Capture the Flag.Clutch"}, new String[]{"Champions CTF.Clutch"},
new String[]{"Kill the Enemy Flag Carrier in Sudden Death"}, new String[]{"Kill the Enemy Flag Carrier in Sudden Death"},
new int[]{1}, new int[]{1},
AchievementCategory.CHAMPIONS), AchievementCategory.CHAMPIONS),
CHAMPIONS_SPECIAL_WIN("Champion of Champions", 3000, CHAMPIONS_SPECIAL_WIN("Champion of Champions", 3000,
new String[]{"Champions Capture the Flag.SpecialWin"}, new String[]{"Champions CTF.SpecialWin"},
new String[]{"Win the game with 5 more captures than the other team"}, new String[]{"Win the game with 5 more captures than the other team"},
new int[]{1}, new int[]{1},
AchievementCategory.CHAMPIONS), AchievementCategory.CHAMPIONS),

View File

@ -78,7 +78,7 @@ public enum AchievementCategory
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED }, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED },
Material.BOOK_AND_QUILL, 0, GameCategory.CLASSICS, "Extra Tools Kit"), Material.BOOK_AND_QUILL, 0, GameCategory.CLASSICS, "Extra Tools Kit"),
CHAMPIONS("Champions", new String[] {"Champions Domination", "Champions TDM", "Champions Capture the Flag"}, CHAMPIONS("Champions", new String[] {"Champions Domination", "Champions TDM", "Champions CTF"},
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED, new StatDisplay("Flags Captured", "Captures") }, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED, new StatDisplay("Flags Captured", "Captures") },
Material.BEACON, 0, GameCategory.CHAMPIONS, "Extra Class Skills"), Material.BEACON, 0, GameCategory.CHAMPIONS, "Extra Class Skills"),

View File

@ -0,0 +1,38 @@
package mineplex.core.disguise.disguises;
import org.bukkit.entity.*;
public class DisguiseGuardian extends DisguiseCreature
{
public DisguiseGuardian(org.bukkit.entity.Entity entity)
{
super(EntityType.GUARDIAN, entity);
DataWatcher.a(16, 0);
DataWatcher.a(17, 0);
}
public void setTarget(int target)
{
DataWatcher.watch(17, target);
}
public void setElder(boolean elder)
{
DataWatcher.watch(16, Integer.valueOf(DataWatcher.getInt(16) | 4));
}
public boolean isElder()
{
return (this.DataWatcher.getInt(16) & 4) != 0;
}
protected String getHurtSound()
{
if (isElder())
{
return "mob.guardian.elder.hit";
}
return "mob.guardian.hit";
}
}

View File

@ -61,7 +61,7 @@ public class ItemTNT extends ItemGadget
if (!_tnt.remove(event.getEntity())) if (!_tnt.remove(event.getEntity()))
return; return;
HashMap<Player, Double> players = UtilPlayer.getInRadius(event.getLocation(), 10); HashMap<Player, Double> players = UtilPlayer.getInRadius(event.getLocation(), 8);
for (Player player : players.keySet()) for (Player player : players.keySet())
{ {
if (Manager.collideEvent(this, player)) if (Manager.collideEvent(this, player))

View File

@ -1,35 +1,216 @@
package mineplex.core.gadget.gadgets; package mineplex.core.gadget.gadgets;
import org.bukkit.Material; import java.util.HashMap;
import org.bukkit.entity.Player; 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.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.GadgetManager;
import mineplex.core.gadget.types.MorphGadget; 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 public class MorphTitan extends MorphGadget
{ {
private HashMap<Player, ArmorStand> _targets = new HashMap<Player, ArmorStand>();
public MorphTitan(GadgetManager manager) public MorphTitan(GadgetManager manager)
{ {
super(manager, "Titanic Morph", new String[] super(manager, "Elder Guardian Morph", new String[]
{ {
C.cWhite + "Coming Soon...", C.cWhite + "From deep withinsdngsg",
" ", " ",
C.cRed + "Unlocked with Titan Rank", C.cRed + "Unlocked with Titan Rank",
}, },
-1, -1,
Material.INK_SACK, (byte)8); Material.PRISMARINE_SHARD, (byte)0);
} }
@Override @Override
public void EnableCustom(Player player) public void EnableCustom(Player player)
{ {
this.ApplyArmor(player);
DisguiseGuardian disguise = new DisguiseGuardian(player);
disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank());
disguise.setCustomNameVisible(true);
disguise.setElder(true);
Manager.getDisguiseManager().disguise(disguise);
} }
@Override @Override
public void DisableCustom(Player player) public void DisableCustom(Player player)
{ {
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 lazer(PlayerInteractEvent event)
{
Player player = event.getPlayer();
if (!IsActive(player))
return;
if (!UtilEvent.isAction(event, ActionType.L))
return;
if (!Recharge.Instance.use(player, "Guardians Laser", 4000, true, false))
return;
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());
// }
} }
} }

View File

@ -2,11 +2,8 @@ package mineplex.core.hologram;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map.Entry;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -34,7 +31,7 @@ public class Hologram
/** /**
* 1.7 packets uses both EntityIDs while 1.8 uses only the first. * 1.7 packets uses both EntityIDs while 1.8 uses only the first.
*/ */
private ArrayList<Entry<Integer, Integer>> _entityIds = new ArrayList<Entry<Integer, Integer>>(); private ArrayList<Integer> _entityIds = new ArrayList<Integer>();
private Entity _followEntity; private Entity _followEntity;
private HologramManager _hologramManager; private HologramManager _hologramManager;
private String[] _hologramText = new String[0]; private String[] _hologramText = new String[0];
@ -53,6 +50,7 @@ public class Hologram
private int _viewDistance = 70; private int _viewDistance = 70;
protected Vector relativeToEntity; protected Vector relativeToEntity;
private boolean _hideBoundingBox; private boolean _hideBoundingBox;
private HologramInteraction _interaction;
public Hologram(HologramManager hologramManager, Location location, String... text) public Hologram(HologramManager hologramManager, Location location, String... text)
{ {
@ -61,6 +59,18 @@ public class Hologram
setText(text); setText(text);
} }
public Hologram setInteraction(HologramInteraction interact)
{
_interaction = interact;
return this;
}
public HologramInteraction getInteraction()
{
return _interaction;
}
/** /**
* Adds the player to the Hologram to be effected by Whitelist or Blacklist * Adds the player to the Hologram to be effected by Whitelist or Blacklist
*/ */
@ -151,6 +161,7 @@ public class Hologram
nearbyPlayers.add(player); nearbyPlayers.add(player);
} }
} }
return nearbyPlayers; return nearbyPlayers;
} }
@ -229,9 +240,7 @@ public class Hologram
for (int i = 0; i < _entityIds.size(); i++) for (int i = 0; i < _entityIds.size(); i++)
{ {
Entry<Integer, Integer> entry = _entityIds.get(i); entityIds1_8[i] = _entityIds.get(i);
entityIds1_8[i] = entry.getKey();
} }
_destroy1_8 = new PacketPlayOutEntityDestroy(entityIds1_8); _destroy1_8 = new PacketPlayOutEntityDestroy(entityIds1_8);
@ -247,7 +256,7 @@ public class Hologram
for (int i = _entityIds.size(); i < _hologramText.length; i++) for (int i = _entityIds.size(); i < _hologramText.length; i++)
{ {
_entityIds.add(new HashMap.SimpleEntry(UtilEnt.getNewEntityId(), UtilEnt.getNewEntityId())); _entityIds.add(UtilEnt.getNewEntityId());
} }
} }
else else
@ -261,9 +270,7 @@ public class Hologram
} }
for (int textRow = 0; textRow < _hologramText.length; textRow++) for (int textRow = 0; textRow < _hologramText.length; textRow++)
{ {
Entry<Integer, Integer> entityIds = this._entityIds.get(textRow); Packet[] packets1_8 = makeSpawnPackets1_8(textRow, _entityIds.get(textRow), _hologramText[textRow]);
Packet[] packets1_8 = makeSpawnPackets1_8(textRow, entityIds.getKey(), _hologramText[textRow]);
for (int i = 0; i < packets1_8.length; i++) for (int i = 0; i < packets1_8.length; i++)
{ {
@ -326,8 +333,7 @@ public class Hologram
public Hologram setFollowEntity(Entity entityToFollow) public Hologram setFollowEntity(Entity entityToFollow)
{ {
_followEntity = entityToFollow; _followEntity = entityToFollow;
relativeToEntity = entityToFollow == null ? null : this._location.clone().subtract(entityToFollow.getLocation()) relativeToEntity = entityToFollow == null ? null : _location.clone().subtract(entityToFollow.getLocation()).toVector();
.toVector();
return this; return this;
} }
@ -340,7 +346,7 @@ public class Hologram
*/ */
public Hologram setHologramTarget(HologramTarget newTarget) public Hologram setHologramTarget(HologramTarget newTarget)
{ {
this._target = newTarget; _target = newTarget;
return this; return this;
} }
@ -405,11 +411,11 @@ public class Hologram
if (x >= -128 && x <= 127 && y >= -128 && y <= 127 && z >= -128 && z <= 127) if (x >= -128 && x <= 127 && y >= -128 && y <= 127 && z >= -128 && z <= 127)
{ {
_lastMovement.subtract(new Vector(x / 32D, y / 32D, z / 32D)); _lastMovement.subtract(new Vector(x / 32D, y / 32D, z / 32D));
for (Entry<Integer, Integer> entityId : this._entityIds) for (Integer entityId : _entityIds)
{ {
PacketPlayOutEntity.PacketPlayOutRelEntityMove relMove = new PacketPlayOutEntity.PacketPlayOutRelEntityMove(); PacketPlayOutEntity.PacketPlayOutRelEntityMove relMove = new PacketPlayOutEntity.PacketPlayOutRelEntityMove();
relMove.a = entityId.getKey(); relMove.a = entityId;
relMove.b = (byte) x; relMove.b = (byte) x;
relMove.c = (byte) y; relMove.c = (byte) y;
relMove.d = (byte) z; relMove.d = (byte) z;
@ -425,13 +431,12 @@ public class Hologram
_lastMovement = new Vector(newLocation.getX() - (x / 32D), 0, newLocation.getZ() - (z / 32D)); _lastMovement = new Vector(newLocation.getX() - (x / 32D), 0, newLocation.getZ() - (z / 32D));
for (Entry<Integer, Integer> entityId : this._entityIds) for (Integer entityId : _entityIds)
{ {
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(); PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport();
teleportPacket.a = entityId.getKey(); teleportPacket.a = entityId;
teleportPacket.b = x; teleportPacket.b = x;
teleportPacket.c = (int) Math teleportPacket.c = (int) Math.floor((oldLocation.getY() + (-2.1) + ((double) i * 0.285)) * 32);
.floor((oldLocation.getY() + (-2.1) + ((double) i * 0.285)) * 32);
teleportPacket.d = z; teleportPacket.d = z;
packets1_8[i] = teleportPacket; packets1_8[i] = teleportPacket;
@ -458,6 +463,11 @@ public class Hologram
return this; return this;
} }
public boolean isEntityId(int entityId)
{
return _entityIds.contains(entityId);
}
/** /**
* Set the hologram text * Set the hologram text
*/ */
@ -491,28 +501,28 @@ public class Hologram
{ {
// Add entity id and send spawn packets // Add entity id and send spawn packets
// You add a entity id because the new hologram needs // You add a entity id because the new hologram needs
Entry<Integer, Integer> entry = new HashMap.SimpleEntry(UtilEnt.getNewEntityId(), UtilEnt.getNewEntityId()); int entityId = UtilEnt.getNewEntityId();
_entityIds.add(entry); _entityIds.add(entityId);
packets1_8.addAll(Arrays.asList(makeSpawnPackets1_8(i, entry.getKey(), newText[i]))); packets1_8.addAll(Arrays.asList(makeSpawnPackets1_8(i, entityId, newText[i])));
} }
// If less lines than previously // If less lines than previously
else if (i >= newText.length) else if (i >= newText.length)
{ {
// Remove entity id and send destroy packets // Remove entity id and send destroy packets
Entry<Integer, Integer> entry = _entityIds.remove(newText.length); Integer entityId = _entityIds.remove(newText.length);
destroy1_8 = Arrays.copyOf(destroy1_8, destroy1_8.length + 1); destroy1_8 = Arrays.copyOf(destroy1_8, destroy1_8.length + 1);
destroy1_8[destroy1_8.length - 1] = entry.getKey(); destroy1_8[destroy1_8.length - 1] = entityId;
} }
else if (!newText[i].equals(_hologramText[i])) else if (!newText[i].equals(_hologramText[i]))
{ {
// Send update metadata packets // Send update metadata packets
Entry<Integer, Integer> entry = _entityIds.get(i); Integer entityId = _entityIds.get(i);
PacketPlayOutEntityMetadata metadata1_8 = new PacketPlayOutEntityMetadata(); PacketPlayOutEntityMetadata metadata1_8 = new PacketPlayOutEntityMetadata();
metadata1_8.a = entry.getKey(); metadata1_8.a = entityId;
DataWatcher watcher1_8 = new DataWatcher(null); DataWatcher watcher1_8 = new DataWatcher(null);
@ -552,7 +562,7 @@ public class Hologram
*/ */
public Hologram setViewDistance(int newDistance) public Hologram setViewDistance(int newDistance)
{ {
this._viewDistance = newDistance; _viewDistance = newDistance;
return setLocation(getLocation()); return setLocation(getLocation());
} }
@ -593,6 +603,7 @@ public class Hologram
_playersTracking.clear(); _playersTracking.clear();
_lastMovement = null; _lastMovement = null;
} }
return this; return this;
} }

View File

@ -0,0 +1,9 @@
package mineplex.core.hologram;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
public interface HologramInteraction
{
public void onClick(Player player, ClickType clickType);
}

View File

@ -5,90 +5,106 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.packethandler.IPacketHandler;
import mineplex.core.packethandler.PacketHandler;
import mineplex.core.packethandler.PacketInfo;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import net.minecraft.server.v1_8_R3.Packet; import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity;
import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity.EnumEntityUseAction;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
public class HologramManager implements Listener public class HologramManager implements Listener, IPacketHandler
{ {
private ArrayList<Hologram> _activeHolograms = new ArrayList<Hologram>(); private ArrayList<Hologram> _activeHolograms = new ArrayList<Hologram>();
public HologramManager(JavaPlugin arcadeManager) public HologramManager(JavaPlugin arcadeManager, PacketHandler packetHandler)
{ {
Bukkit.getPluginManager().registerEvents(this, arcadeManager); Bukkit.getPluginManager().registerEvents(this, arcadeManager);
} packetHandler.addPacketHandler(this, true, PacketPlayInUseEntity.class);
}
void addHologram(Hologram hologram) void addHologram(Hologram hologram)
{ {
_activeHolograms.add(hologram); _activeHolograms.add(hologram);
} }
void removeHologram(Hologram hologram) void removeHologram(Hologram hologram)
{ {
_activeHolograms.remove(hologram); _activeHolograms.remove(hologram);
} }
@EventHandler(priority = EventPriority.LOWEST) @EventHandler(priority = EventPriority.LOWEST)
public void onTick(UpdateEvent event) public void onTick(UpdateEvent event)
{ {
if (event.getType() != UpdateType.TICK || _activeHolograms.isEmpty()) if (event.getType() != UpdateType.TICK || _activeHolograms.isEmpty())
return; return;
List<World> worlds = Bukkit.getWorlds();
Iterator<Hologram> itel = _activeHolograms.iterator(); List<World> worlds = Bukkit.getWorlds();
while (itel.hasNext())
{ Iterator<Hologram> itel = _activeHolograms.iterator();
Hologram hologram = itel.next();
if (!worlds.contains(hologram.getLocation().getWorld())) while (itel.hasNext())
{ {
itel.remove(); Hologram hologram = itel.next();
hologram.stop();
} if (!worlds.contains(hologram.getLocation().getWorld()))
else {
{ itel.remove();
if (hologram.getEntityFollowing() != null) hologram.stop();
{ }
Entity following = hologram.getEntityFollowing(); else
if (hologram.isRemoveOnEntityDeath() && !following.isValid()) {
{ if (hologram.getEntityFollowing() != null)
itel.remove(); {
hologram.stop(); Entity following = hologram.getEntityFollowing();
continue;
} if (hologram.isRemoveOnEntityDeath() && !following.isValid())
if (!hologram.relativeToEntity.equals(following.getLocation().subtract(hologram.getLocation()).toVector())) {
{ itel.remove();
// And we do this so in the rare offchance it changes by a decimal. It doesn't start turning wonky. hologram.stop();
Vector vec = hologram.relativeToEntity.clone(); continue;
hologram.setLocation(following.getLocation().add(hologram.relativeToEntity)); }
hologram.relativeToEntity = vec; if (!hologram.relativeToEntity.equals(following.getLocation().subtract(hologram.getLocation()).toVector()))
continue; // No need to do the rest of the code as setLocation does it. {
} // And we do this so in the rare offchance it changes by a decimal. It doesn't start turning wonky.
} Vector vec = hologram.relativeToEntity.clone();
ArrayList<Player> canSee = hologram.getNearbyPlayers(); hologram.setLocation(following.getLocation().add(hologram.relativeToEntity));
Iterator<Player> itel2 = hologram.getPlayersTracking().iterator(); hologram.relativeToEntity = vec;
while (itel2.hasNext())
{ continue; // No need to do the rest of the code as setLocation does it.
Player player = itel2.next(); }
if (!canSee.contains(player)) }
{
itel2.remove(); ArrayList<Player> canSee = hologram.getNearbyPlayers();
if (player.getWorld() == hologram.getLocation().getWorld())
{ Iterator<Player> itel2 = hologram.getPlayersTracking().iterator();
UtilPlayer.sendPacket(player, hologram.getDestroyPacket());
} while (itel2.hasNext())
} {
} Player player = itel2.next();
for (Player player : canSee)
if (!canSee.contains(player))
{
itel2.remove();
if (player.getWorld() == hologram.getLocation().getWorld())
{
UtilPlayer.sendPacket(player, hologram.getDestroyPacket());
}
}
}
for (Player player : canSee)
{ {
if (!hologram.getPlayersTracking().contains(player)) if (!hologram.getPlayersTracking().contains(player))
{ {
@ -96,8 +112,28 @@ public class HologramManager implements Listener
UtilPlayer.sendPacket(player, hologram.getSpawnPackets()); UtilPlayer.sendPacket(player, hologram.getSpawnPackets());
} }
} }
} }
} }
} }
@Override
public void handle(PacketInfo packetInfo)
{
PacketPlayInUseEntity packetPlayIn = (PacketPlayInUseEntity) packetInfo.getPacket();
for (Hologram hologram : _activeHolograms)
{
if (!hologram.isEntityId(packetPlayIn.a))
continue;
if (hologram.getInteraction() != null)
{
hologram.getInteraction().onClick(packetInfo.getPlayer(),
packetPlayIn.action == EnumEntityUseAction.ATTACK ? ClickType.LEFT : ClickType.RIGHT);
}
break;
}
}
} }

View File

@ -54,6 +54,7 @@ public abstract class Mount<T> extends SalesPackageBase implements Listener
Manager.setActive(player, this); Manager.setActive(player, this);
EnableCustom(player); EnableCustom(player);
} }
public abstract void EnableCustom(Player player); public abstract void EnableCustom(Player player);
public abstract void Disable(Player player); public abstract void Disable(Player player);

View File

@ -1,27 +1,126 @@
package mineplex.core.mount.types; package mineplex.core.mount.types;
import java.util.HashMap;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Slime;
import org.bukkit.entity.Horse.Color; import org.bukkit.entity.Horse.Color;
import org.bukkit.entity.Horse.Style; import org.bukkit.entity.Horse.Style;
import org.bukkit.entity.Horse.Variant; import org.bukkit.entity.Horse.Variant;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.mount.HorseMount; import mineplex.core.mount.HorseMount;
import mineplex.core.mount.Mount;
import mineplex.core.mount.MountManager; import mineplex.core.mount.MountManager;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class MountTitan extends HorseMount public class MountTitan extends Mount<MountTitanData>
{ {
public MountTitan(MountManager manager) public MountTitan(MountManager manager)
{ {
super(manager, "Titanic Mount", new String[] super(manager, "Molten Snake", Material.REDSTONE_BLOCK, (byte)0, new String[]
{ {
C.cWhite + "Coming Soon...", 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", C.cRed + "Unlocked with Titan Rank",
}, }, -1);
Material.INK_SACK, }
(byte)8,
-1, @Override
Color.BLACK, Style.BLACK_DOTS, Variant.UNDEAD_HORSE, 0.8, null); public void EnableCustom(Player player)
{
player.leaveVehicle();
player.eject();
//Remove other mounts
Manager.DeregisterAll(player);
//Inform
UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + "."));
//Store
_active.put(player, new MountTitanData(player, GetName()));
}
@Override
public void Disable(Player player)
{
MountTitanData data = _active.remove(player);
if (data != null)
{
data.clean();
//Inform
UtilPlayer.message(player, F.main("Mount", "You despawned " + F.elem(GetName()) + "."));
Manager.removeActive(player);
}
}
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (MountTitanData data : _active.values())
{
data.update();
}
}
@EventHandler
public void interactMount(PlayerInteractEntityEvent event)
{
if (event.getRightClicked() == null)
return;
if (!GetActive().containsKey(event.getPlayer()))
return;
if (!GetActive().get(event.getPlayer()).ownsMount(event.getPlayer()))
{
UtilPlayer.message(event.getPlayer(), F.main("Mount", "This is not your Mount!"));
return;
}
event.getPlayer().leaveVehicle();
event.getPlayer().eject();
GetActive().get(event.getPlayer()).mount(event.getPlayer(), event.getRightClicked());
}
@EventHandler
public void target(EntityTargetEvent event)
{
if (!(event.getEntity() instanceof Player))
return;
if (!GetActive().containsKey(event.getTarget()))
return;
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());
// }
} }
} }

View File

@ -0,0 +1,117 @@
package mineplex.core.mount.types;
import java.util.ArrayList;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilMath;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Entity;
import org.bukkit.entity.MagmaCube;
import org.bukkit.entity.Player;
import org.bukkit.entity.Slime;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
public class MountTitanData
{
private String _owner;
private Slime _head;
private ArrayList<ArmorStand> _nodes;
public MountTitanData(Player player, String name)
{
_owner = player.getName();
//Nodes
_nodes = new ArrayList<ArmorStand>();
for (int i=0 ; i<30 ; i++)
{
ArmorStand node = player.getWorld().spawn(player.getLocation(), ArmorStand.class);
node.setVisible(false);
node.setGravity(false);
node.setHelmet(new ItemStack(Material.REDSTONE_BLOCK));
_nodes.add(node);
}
//Head
_head = player.getWorld().spawn(player.getLocation(), MagmaCube.class);
_head.setSize(2);
_head.setCustomName(player.getName() + "'s " + name);
}
public void mount(Player player, Entity entity)
{
if (_head.equals(entity) || _nodes.contains(entity))
_head.setPassenger(player);
}
public void update()
{
//Head
if (_head.getPassenger() != null)
_head.setVelocity(_head.getPassenger().getLocation().getDirection().add(new Vector(0,0.2,0)));
Location infront = _head.getLocation().add(0, -1.5, 0);
//Move
for (int i=0 ; i<30 ; i++)
{
ArmorStand node = _nodes.get(i);
//Move
if (i == 0)
node.teleport(infront);
else if (UtilMath.offset(node.getLocation(), infront) > 0.5)
node.teleport(infront.add(UtilAlg.getTrajectory(infront, node.getLocation()).multiply(0.5)));
infront = node.getLocation();
//Rotation
node.setHeadPose(UtilAlg.vectorToEuler(UtilAlg.getTrajectory(infront, node.getLocation())));
}
//Shuffle In
if (_head.getPassenger() == null)
{
for (int i=_nodes.size()-1 ; i>=0 ; i--)
{
ArmorStand node = _nodes.get(i);
if (i>0)
infront = _nodes.get(i-1).getLocation();
else
infront = _head.getLocation().add(0, -1.5, 0);
node.teleport(infront);
}
}
}
public void clean()
{
_head.remove();
for (ArmorStand stand : _nodes)
stand.remove();
}
public boolean ownsMount(Player player)
{
return _owner.equals(player.getName());
}
}

View File

@ -42,6 +42,7 @@ public class PetFactory
_pets.put(EntityType.OCELOT, new Pet("Cat", EntityType.OCELOT, 6000)); _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.MUSHROOM_COW, new Pet("Mooshroom", EntityType.MUSHROOM_COW, 5000));
_pets.put(EntityType.WITHER, new Pet("Widder", EntityType.WITHER, -1)); _pets.put(EntityType.WITHER, new Pet("Widder", EntityType.WITHER, -1));
_pets.put(EntityType.SKELETON, new Pet("Guardian", EntityType.SKELETON, -1));
} }
private void CreatePetExtras() private void CreatePetExtras()

View File

@ -14,9 +14,12 @@ import mineplex.core.account.event.ClientWebResponseEvent;
import mineplex.core.blockrestore.BlockRestore; import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.util.NautHashMap; 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.UtilEnt;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.disguise.DisguiseManager; import mineplex.core.disguise.DisguiseManager;
import mineplex.core.disguise.disguises.DisguiseGuardian;
import mineplex.core.disguise.disguises.DisguiseWither; import mineplex.core.disguise.disguises.DisguiseWither;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.inventory.InventoryManager; import mineplex.core.inventory.InventoryManager;
@ -38,8 +41,10 @@ import org.bukkit.entity.Ageable;
import org.bukkit.entity.Creature; import org.bukkit.entity.Creature;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Guardian;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Villager; import org.bukkit.entity.Villager;
import org.bukkit.entity.Zombie; import org.bukkit.entity.Zombie;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -159,6 +164,12 @@ public class PetManager extends MiniClientPlugin<PetClient>
if (!Get(p).GetPets().containsKey(EntityType.WITHER)) if (!Get(p).GetPets().containsKey(EntityType.WITHER))
Get(p).GetPets().put(EntityType.WITHER, "Widder"); Get(p).GetPets().put(EntityType.WITHER, "Widder");
} }
if (rank.has(Rank.TITAN))
{
// if (!Get(p).GetPets().containsKey(EntityType.SKELETON))
// Get(p).GetPets().put(EntityType.SKELETON, "Guardian");
}
} }
public void AddPetOwner(Player player, EntityType entityType, Location location) public void AddPetOwner(Player player, EntityType entityType, Location location)
@ -175,6 +186,7 @@ public class PetManager extends MiniClientPlugin<PetClient>
Creature pet; Creature pet;
//Wither Spawn
if (entityType == EntityType.WITHER) if (entityType == EntityType.WITHER)
{ {
_creatureModule.SetForce(true); _creatureModule.SetForce(true);
@ -196,6 +208,7 @@ public class PetManager extends MiniClientPlugin<PetClient>
_creatureModule.SetForce(false); _creatureModule.SetForce(false);
} }
//Default Spawn
else else
{ {
pet = (Creature)_creatureModule.SpawnEntity(location, entityType); pet = (Creature)_creatureModule.SpawnEntity(location, entityType);
@ -220,6 +233,20 @@ public class PetManager extends MiniClientPlugin<PetClient>
((Villager) pet).setBaby(); ((Villager) pet).setBaby();
((Villager) pet).setAgeLock(true); ((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); _activePetOwners.put(player.getName(), pet);
_failedAttempts.put(player.getName(), 0); _failedAttempts.put(player.getName(), 0);
@ -336,6 +363,12 @@ public class PetManager extends MiniClientPlugin<PetClient>
yDiff = Math.abs(petSpot.getBlockY() - ownerSpot.getBlockY()); yDiff = Math.abs(petSpot.getBlockY() - ownerSpot.getBlockY());
zDiff = Math.abs(petSpot.getBlockZ() - ownerSpot.getBlockZ()); 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) if ((xDiff + yDiff + zDiff) > 4)
{ {
EntityCreature ec = ((CraftCreature) pet).getHandle(); EntityCreature ec = ((CraftCreature) pet).getHandle();

View File

@ -37,7 +37,6 @@ public class ServerConfiguration extends MiniPlugin
if (_serverGroup == null) if (_serverGroup == null)
return; return;
/*
try try
{ {
_playerListMaxPlayers = PlayerList.class.getDeclaredField("maxPlayers"); _playerListMaxPlayers = PlayerList.class.getDeclaredField("maxPlayers");
@ -50,9 +49,8 @@ public class ServerConfiguration extends MiniPlugin
} }
_plugin.getServer().setWhitelist(_serverGroup.getWhitelist()); _plugin.getServer().setWhitelist(_serverGroup.getWhitelist());
*/
((CraftServer)_plugin.getServer()).getServer().setPVP(_serverGroup.getPvp()); ((CraftServer)_plugin.getServer()).getServer().setPVP(_serverGroup.getPvp());
//((CraftServer)_plugin.getServer()).getServer().setTexturePack(_serverGroup.getResourcePack()); // ((CraftServer)_plugin.getServer()).getServer().setResourcePack(_serverGroup.getResourcePack());
} }
@EventHandler @EventHandler

View File

@ -4,6 +4,7 @@ import java.util.LinkedList;
import java.util.UUID; import java.util.UUID;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.teleport.command.LocateCommand; import mineplex.core.teleport.command.LocateCommand;
import mineplex.core.teleport.command.TeleportCommand; import mineplex.core.teleport.command.TeleportCommand;
import mineplex.core.teleport.event.MineplexTeleportEvent; import mineplex.core.teleport.event.MineplexTeleportEvent;
@ -40,12 +41,14 @@ public class Teleport extends MiniPlugin
private NautHashMap<String, LinkedList<Location>> _tpHistory = new NautHashMap<String, LinkedList<Location>>(); private NautHashMap<String, LinkedList<Location>> _tpHistory = new NautHashMap<String, LinkedList<Location>>();
private NautHashMap<UUID, BukkitRunnable> _failedRedisLocates = new NautHashMap<UUID, BukkitRunnable>(); private NautHashMap<UUID, BukkitRunnable> _failedRedisLocates = new NautHashMap<UUID, BukkitRunnable>();
private String _serverName; private String _serverName;
private CoreClientManager _clientManager;
public Teleport(JavaPlugin plugin) public Teleport(JavaPlugin plugin, CoreClientManager clientManager)
{ {
super("Teleport", plugin); super("Teleport", plugin);
_serverName = getPlugin().getConfig().getString("serverstatus.name"); _serverName = getPlugin().getConfig().getString("serverstatus.name");
_clientManager = clientManager;
RedisLocateHandler locateHandler = new RedisLocateHandler(this); RedisLocateHandler locateHandler = new RedisLocateHandler(this);
@ -295,4 +298,14 @@ public class Teleport extends MiniPlugin
{ {
return _tpHistory.get(player.getName()); return _tpHistory.get(player.getName());
} }
public String getServerName()
{
return _serverName;
}
public CoreClientManager getClientManager()
{
return _clientManager;
}
} }

View File

@ -6,13 +6,14 @@ import mineplex.core.command.MultiCommandBase;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.status.ServerStatusManager;
import mineplex.core.teleport.Teleport; import mineplex.core.teleport.Teleport;
public class TeleportCommand extends MultiCommandBase<Teleport> public class TeleportCommand extends MultiCommandBase<Teleport>
{ {
public TeleportCommand(Teleport plugin) public TeleportCommand(Teleport plugin)
{ {
super(plugin, Rank.ADMIN, "tp", "teleport"); super(plugin, Rank.MODERATOR, "tp", "teleport");
AddCommand(new AllCommand(plugin)); AddCommand(new AllCommand(plugin));
AddCommand(new BackCommand(plugin)); AddCommand(new BackCommand(plugin));
@ -22,6 +23,12 @@ public class TeleportCommand extends MultiCommandBase<Teleport>
@Override @Override
protected void Help(Player caller, String[] args) protected void Help(Player caller, String[] args)
{ {
if (Plugin.getServerName().contains("Clans") && !Plugin.getClientManager().hasRank(caller, Rank.ADMIN) && !caller.isOp())
{
caller.sendMessage(F.main("Clans", "You cannot use /tp in clans!"));
return;
}
//Caller to Player //Caller to Player
if (args.length == 1 && CommandCenter.GetClientManager().Get(caller).GetRank().has(caller, Rank.MODERATOR, true)) if (args.length == 1 && CommandCenter.GetClientManager().Get(caller).GetRank().has(caller, Rank.MODERATOR, true))
Plugin.playerToPlayer(caller, caller.getName(), args[0]); Plugin.playerToPlayer(caller, caller.getName(), args[0]);

View File

@ -12,6 +12,7 @@ import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.event.GadgetBlockEvent; import mineplex.core.gadget.event.GadgetBlockEvent;
import mineplex.core.hologram.Hologram; import mineplex.core.hologram.Hologram;
import mineplex.core.hologram.HologramInteraction;
import mineplex.core.hologram.HologramManager; import mineplex.core.hologram.HologramManager;
import mineplex.core.inventory.InventoryManager; import mineplex.core.inventory.InventoryManager;
import mineplex.core.reward.Reward; import mineplex.core.reward.Reward;
@ -32,6 +33,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.event.inventory.InventoryOpenEvent; import org.bukkit.event.inventory.InventoryOpenEvent;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerMoveEvent;
@ -63,7 +65,20 @@ public class TreasureLocation implements Listener
_hologramManager = hologramManager; _hologramManager = hologramManager;
_statusManager = statusManager; _statusManager = statusManager;
_currentTreasure = null; _currentTreasure = null;
_hologram = new Hologram(_hologramManager, chestBlock.getLocation().add(0.5, 2.5, 0.5), C.cGreen + C.Bold + "Open Treasure"); _hologram = new Hologram(_hologramManager, chestBlock.getLocation().add(0.5, 2.5, 0.5), C.cGreen + C.Bold
+ "Open Treasure");
_hologram.setInteraction(new HologramInteraction()
{
@Override
public void onClick(Player player, ClickType clickType)
{
if (clickType == ClickType.LEFT)
return;
openShop(player);
}
});
setHoloChestVisible(true); setHoloChestVisible(true);
_shop = new TreasureShop(treasureManager, _inventoryManager, clientManager, donationManager, this); _shop = new TreasureShop(treasureManager, _inventoryManager, clientManager, donationManager, this);
} }

View File

@ -48,7 +48,7 @@ import net.minecraft.server.v1_8_R3.MinecraftServer;
public class Clans extends JavaPlugin public class Clans extends JavaPlugin
{ {
public static final String VERSION = "0.13"; public static final String VERSION = "0.14";
private String WEB_CONFIG = "webServer"; private String WEB_CONFIG = "webServer";
// Modules // Modules
@ -91,7 +91,7 @@ public class Clans extends JavaPlugin
new Spawn(this, serverStatusManager.getCurrentServerName()); new Spawn(this, serverStatusManager.getCurrentServerName());
Give.Initialize(this); Give.Initialize(this);
Teleport teleport = new Teleport(this); Teleport teleport = new Teleport(this, _clientManager);
Portal portal = new Portal(this, _clientManager, serverStatusManager.getCurrentServerName()); Portal portal = new Portal(this, _clientManager, serverStatusManager.getCurrentServerName());
new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion()); new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion());
@ -119,7 +119,7 @@ public class Clans extends JavaPlugin
new CustomTagFix(this, packetHandler); new CustomTagFix(this, packetHandler);
GearManager customGear = new GearManager(this, packetHandler, _clientManager, _donationManager); GearManager customGear = new GearManager(this, packetHandler, _clientManager, _donationManager);
HologramManager hologram = new HologramManager(this); HologramManager hologram = new HologramManager(this, packetHandler);
_clansManager = new ClansManager(this, serverStatusManager.getCurrentServerName(), packetHandler, _clientManager, _donationManager, preferenceManager, blockRestore, teleport, chat, customGear, hologram, webServerAddress); _clansManager = new ClansManager(this, serverStatusManager.getCurrentServerName(), packetHandler, _clientManager, _donationManager, preferenceManager, blockRestore, teleport, chat, customGear, hologram, webServerAddress);
new Recipes(this); new Recipes(this);
new Farming(this); new Farming(this);

View File

@ -65,6 +65,7 @@ import mineplex.game.clans.clans.commands.ClanManagementCommand;
import mineplex.game.clans.clans.commands.ClansAllyChatCommand; import mineplex.game.clans.clans.commands.ClansAllyChatCommand;
import mineplex.game.clans.clans.commands.ClansChatCommand; import mineplex.game.clans.clans.commands.ClansChatCommand;
import mineplex.game.clans.clans.commands.ClansCommand; import mineplex.game.clans.clans.commands.ClansCommand;
import mineplex.game.clans.clans.commands.ClansLoginManager;
import mineplex.game.clans.clans.commands.KillCommand; import mineplex.game.clans.clans.commands.KillCommand;
import mineplex.game.clans.clans.commands.MapCommand; import mineplex.game.clans.clans.commands.MapCommand;
import mineplex.game.clans.clans.commands.RegionsCommand; import mineplex.game.clans.clans.commands.RegionsCommand;
@ -244,7 +245,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
_explosion = new Explosion(plugin, blockRestore); _explosion = new Explosion(plugin, blockRestore);
// new ClansLoginManager(getPlugin(), clientManager, _serverName); new ClansLoginManager(getPlugin(), clientManager, _serverName);
_clanShop = new ClanShop(this, clientManager, donationManager); _clanShop = new ClanShop(this, clientManager, donationManager);
@ -950,16 +951,16 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
public void onJoin(PlayerLoginEvent event) public void onJoin(PlayerLoginEvent event)
{ {
Rank rank = _clientManager.Get(event.getPlayer()).GetRank(); Rank rank = _clientManager.Get(event.getPlayer()).GetRank();
if (!event.getPlayer().isWhitelisted() || !rank.has(Rank.EVENT)) if (!event.getPlayer().isWhitelisted() && !rank.has(Rank.LEGEND))
{ {
event.setResult(PlayerLoginEvent.Result.KICK_OTHER); event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "Clans is currently in Legend+ only Alpha!");
// event.setKickMessage("This server is whitelisted!"); // event.setKickMessage("This server is whitelisted!");
event.setKickMessage("Clans is currently in staff only Pre-Alpha!"); event.setKickMessage("Clans is currently in Legend+ only Alpha!");
} }
else if (UtilServer.getPlayers().length >= UtilServer.getServer().getMaxPlayers() && !rank.has(Rank.ADMIN) && !event.getPlayer().isWhitelisted()) else if (UtilServer.getPlayers().length >= UtilServer.getServer().getMaxPlayers() && !rank.has(Rank.ADMIN) && !event.getPlayer().isWhitelisted() && !event.getPlayer().isOp())
{ {
event.setResult(PlayerLoginEvent.Result.KICK_OTHER); event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "Clans Alpha is full! Try again soon");
event.setKickMessage("Clans Pre-Alpha is full! Try again soon"); event.setKickMessage("Clans Alpha is full! Try again soon");
} }
} }

View File

@ -763,7 +763,7 @@ public class ClansCommand extends CommandBase<ClansManager>
// Teleport", 300000, true, false, false, false)) return; // Teleport", 300000, true, false, false, false)) return;
// Do // Do
Plugin.getTeleport().TP(caller, clan.getHome().add(0, 0.6, 0)); Plugin.getTeleport().TP(caller, clan.getHome().add(0, 1, 0));
// Inform // Inform
UtilPlayer.message(caller, F.main("Clans", "You teleported to your Clan Home " + UtilWorld.locToStrClean(caller.getLocation()) + ".")); UtilPlayer.message(caller, F.main("Clans", "You teleported to your Clan Home " + UtilWorld.locToStrClean(caller.getLocation()) + "."));

View File

@ -39,12 +39,13 @@ public class ClansLoginManager extends MiniPlugin implements ILoginProcessor
@EventHandler @EventHandler
public void onPlayerJoin(PlayerLoginEvent event) public void onPlayerJoin(PlayerLoginEvent event)
{ {
if (_queue.contains(event.getPlayer().getName())) if (_queue.contains(event.getPlayer().getName()) && !event.getPlayer().isOp())
{ {
// event.setKickMessage("This is not your Clans home server"); event.setKickMessage("This is not your Clans home server");
// event.setResult(PlayerLoginEvent.Result.KICK_OTHER); event.setResult(PlayerLoginEvent.Result.KICK_OTHER);
_queue.remove(event.getPlayer().getName());
} }
_queue.remove(event.getPlayer().getName());
} }
private void kickPlayer(final String playerName, final String homeServer) private void kickPlayer(final String playerName, final String homeServer)
@ -54,11 +55,11 @@ public class ClansLoginManager extends MiniPlugin implements ILoginProcessor
@Override @Override
public void run() public void run()
{ {
// Player player = UtilPlayer.searchExact(playerName); Player player = UtilPlayer.searchExact(playerName);
// if (player != null && player.isOnline()) if (player != null && player.isOnline() && !player.isOp())
// { {
// player.kickPlayer("This is not your home server. To play clans, connect to " + homeServer); player.kickPlayer("This is not your home server. To play clans, connect to " + homeServer);
// } }
} }
}, 20); }, 20);
} }
@ -74,7 +75,6 @@ public class ClansLoginManager extends MiniPlugin implements ILoginProcessor
if (serverName != null) if (serverName != null)
{ {
System.out.println("Player " + playerName + " is from server: " + serverName);
if (!serverName.equals(_serverName)) if (!serverName.equals(_serverName))
{ {
_queue.add(playerName); _queue.add(playerName);

View File

@ -176,9 +176,12 @@ public class ClanMainPage extends ClanPageBase
byte commandsData = USE_RESOURCE_ICONS ? ClanIcon.COMMANDS.getData() : 0; byte commandsData = USE_RESOURCE_ICONS ? ClanIcon.COMMANDS.getData() : 0;
ArrayList<String> commandsLore = new ArrayList<String>(); ArrayList<String> commandsLore = new ArrayList<String>();
commandsLore.add(" "); commandsLore.add(" ");
commandsLore.add(ChatColor.RESET + C.cYellow + "/c help " + C.cWhite + "Lists Clans Commands");
commandsLore.add(ChatColor.RESET + C.cYellow + "/c ally <clan> " + C.cWhite + "Request Ally"); commandsLore.add(ChatColor.RESET + C.cYellow + "/c ally <clan> " + C.cWhite + "Request Ally");
commandsLore.add(ChatColor.RESET + C.cYellow + "/c neutral <clan> " + C.cWhite + "Revoke Ally"); commandsLore.add(ChatColor.RESET + C.cYellow + "/c neutral <clan> " + C.cWhite + "Revoke Ally");
commandsLore.add(ChatColor.RESET + C.cYellow + "/c sethome " + C.cWhite + "Set Home"); commandsLore.add(ChatColor.RESET + C.cYellow + "/c sethome " + C.cWhite + "Set Home Bed");
commandsLore.add(ChatColor.RESET + C.cYellow + "/c home " + C.cWhite + "Teleport to Home Bed");
commandsLore.add(ChatColor.RESET + C.cYellow + "/map " + C.cWhite + "Give yourself a World Map");
ShopItem commandsItem = new ShopItem(commandsMaterial, commandsData, commandsName, commandsLore.toArray(new String[0]), 1, false, false); ShopItem commandsItem = new ShopItem(commandsMaterial, commandsData, commandsName, commandsLore.toArray(new String[0]), 1, false, false);
setItem(8, commandsItem); setItem(8, commandsItem);

View File

@ -40,7 +40,7 @@ public class ClansRegions extends MiniPlugin
{ {
public final static String DEFAULT_WORLD_NAME = "world"; public final static String DEFAULT_WORLD_NAME = "world";
public final static int SPAWN_RADIUS = 3; // Radius of spawn claim area (measured in chunks) public final static int SPAWN_RADIUS = 3; // Radius of spawn claim area (measured in chunks)
public final static int SHOP_RADIUS = 4; // Radius of shop claim area (measured in chunks) public final static int SHOP_RADIUS = 7; // Radius of shop claim area (measured in chunks)
public final static int FIELDS_RADIUS = 7; // Radius of fields claim area (measured in chunks) public final static int FIELDS_RADIUS = 7; // Radius of fields claim area (measured in chunks)
public final static int BORDERLANDS_RADIUS = 50; // Radius of borderlands claim area (measured in chunks) public final static int BORDERLANDS_RADIUS = 50; // Radius of borderlands claim area (measured in chunks)
public static final int BORDER_RADIUS = 768; public static final int BORDER_RADIUS = 768;

View File

@ -45,7 +45,7 @@ public class ClansScoreboardManager extends ScoreboardManager
ScoreboardData data = getData("default", true); ScoreboardData data = getData("default", true);
data.write(C.cGreen + "Clans Pre-Alpha " + Clans.VERSION); data.write(C.cGreen + "Clans Alpha " + Clans.VERSION);
data.writeEmpty(); data.writeEmpty();
data.writeElement(new ScoreboardElementClan(_clansManager)); data.writeElement(new ScoreboardElementClan(_clansManager));
data.writeElement(new ScoreboardElementPlayer(_clansManager)); data.writeElement(new ScoreboardElementPlayer(_clansManager));

View File

@ -33,9 +33,10 @@ public class StuckCommand extends CommandBase<StuckManager>
return; return;
} }
if(ClansManager.getInstance().getClanUtility().getClaim(caller.getLocation()) != null && !ClansManager.getInstance().getClanUtility().getClaim(caller.getLocation()).Owner.equals("Borderlands")) if(ClansManager.getInstance().getClanUtility().getClaim(caller.getLocation()) != null && !ClansManager.getInstance().getClanUtility().getClaim(caller.getLocation()).Owner.equals("Borderlands") &&
!ClansManager.getInstance().getClanUtility().getClaim(caller.getLocation()).Owner.equals("Shops") && !ClansManager.getInstance().getClanUtility().getClaim(caller.getLocation()).Owner.equals("Spawn"))
{ {
UtilPlayer.message(caller, F.main("Clans", "You must be in the Wilderness/Borderlands to use this command.")); UtilPlayer.message(caller, F.main("Clans", "You must be in the Wilderness/Borderlands/Shops/Spawn to use this command."));
return; return;
} }

View File

@ -75,7 +75,7 @@ public enum ClansShopItem
NETHER_BRICK(50, 10, Material.NETHER_BRICK, 1), NETHER_BRICK(50, 10, Material.NETHER_BRICK, 1),
QUARTZ_BLOCK(75, 15, Material.QUARTZ_BLOCK, 1), QUARTZ_BLOCK(75, 15, Material.QUARTZ_BLOCK, 1),
CLAY(30, 6, Material.CLAY, 1), CLAY(30, 6, Material.CLAY, 1),
GOLD_TOKEN(5000, 5000, Material.GOLD_RECORD, 1, (byte) 0, "Gold Token"); GOLD_TOKEN(50000, 50000, Material.GOLD_RECORD, 1, (byte) 0, "Gold Token");
private int _buyPrice; private int _buyPrice;
private int _sellPrice; private int _sellPrice;

View File

@ -4,6 +4,7 @@ import java.util.Set;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Effect;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
@ -22,6 +23,7 @@ import org.bukkit.event.block.BlockIgniteEvent;
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause; import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntitySpawnEvent; import org.bukkit.event.entity.EntitySpawnEvent;
import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.entity.EntityTargetEvent;
@ -62,6 +64,12 @@ public class Spawn extends MiniPlugin
private WeightSet<Location> _shops; private WeightSet<Location> _shops;
private ClansManager _clansManager; private ClansManager _clansManager;
private long _songEastLast = 0;
private long _songWestLast = 0;
private long _songEastLength = 345000; //Blocks
private long _songWestLength = 185000; //Chirp
public Spawn(JavaPlugin plugin, ClansManager clansManager) public Spawn(JavaPlugin plugin, ClansManager clansManager)
{ {
super("Clan Spawn Zones", plugin); super("Clan Spawn Zones", plugin);
@ -152,6 +160,30 @@ public class Spawn extends MiniPlugin
} }
} }
@EventHandler
public void onItemFrameDamage(CustomDamageEvent event)
{
if (event.GetDamageeEntity() instanceof ItemFrame)
{
if (isInSpawn(event.GetDamageeEntity().getLocation()))
{
event.SetCancelled("Item Frame Cancel");
}
}
}
@EventHandler
public void onItemFrameDamage(EntityDamageEvent event)
{
if (event.getEntity() instanceof ItemFrame)
{
if (isInSpawn(event.getEntity().getLocation()))
{
event.setCancelled(true);
}
}
}
@EventHandler @EventHandler
public void Update(UpdateEvent event) public void Update(UpdateEvent event)
{ {
@ -450,4 +482,25 @@ public class Spawn extends MiniPlugin
UtilPlayer.message(player, F.main("Clans", message)); UtilPlayer.message(player, F.main("Clans", message));
} }
} }
@EventHandler
public void playDatMusicALLDAYLONG(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
if (UtilTime.elapsed(_songEastLast, _songEastLength))
{
getEastSpawn().getWorld().playEffect(getEastSpawn(), Effect.RECORD_PLAY, 2258); //Blocks
_songEastLast = System.currentTimeMillis();
}
if (UtilTime.elapsed(_songWestLast, _songWestLength))
{
getWestSpawn().getWorld().playEffect(getWestSpawn(), Effect.RECORD_PLAY, 2259); //Chirp
_songWestLast = System.currentTimeMillis();
}
}
} }

View File

@ -97,7 +97,7 @@ public class TravelPage extends ShopPageBase<ClansManager, TravelShop>
} }
else else
{ {
if (UtilBlock.isValidBed(clan.getHome()) && clan.getHome().clone().add(0, 0.6, 0).getBlock().getType().equals(Material.AIR) && clan.getHome().clone().add(0, 2, 0).getBlock().getType().equals(Material.AIR)) if (UtilBlock.isValidBed(clan.getHome()) && clan.getHome().clone().add(0, 1, 0).getBlock().getType().equals(Material.AIR) && clan.getHome().clone().add(0, 2, 0).getBlock().getType().equals(Material.AIR))
{ {
meta.setDisplayName(C.cGreenB + "Clan Home"); meta.setDisplayName(C.cGreenB + "Clan Home");
meta.setLore(Arrays.asList(" ", C.cWhite + "Teleport to your Clan Home.")); meta.setLore(Arrays.asList(" ", C.cWhite + "Teleport to your Clan Home."));
@ -119,7 +119,7 @@ public class TravelPage extends ShopPageBase<ClansManager, TravelShop>
if (item.getItemMeta().getDisplayName().startsWith(C.cGreen)) if (item.getItemMeta().getDisplayName().startsWith(C.cGreen))
{ {
player.closeInventory(); player.closeInventory();
player.teleport(clan.getHome().clone().add(0, 0.6, 0)); player.teleport(clan.getHome().clone().add(0, 1, 0));
} }
} }
}); });

View File

@ -42,7 +42,7 @@ public class TutorialGettingStarted extends Tutorial
_doScoreboard = true; _doScoreboard = true;
_ghostMode = true; _ghostMode = true;
_startOnJoin = false; _startOnJoin = true;
_goldReward = 5000; _goldReward = 5000;
_uniqueId = "GettingStartedTutorial"; _uniqueId = "GettingStartedTutorial";

View File

@ -134,7 +134,7 @@ public class Hub extends JavaPlugin implements IRelation
SkillConditionManager conditionManager = new SkillConditionManager(this); SkillConditionManager conditionManager = new SkillConditionManager(this);
PersonalServerManager personalServerManager = new PersonalServerManager(this, clientManager); PersonalServerManager personalServerManager = new PersonalServerManager(this, clientManager);
HubManager hubManager = new HubManager(this, blockRestore, clientManager, donationManager, inventoryManager, conditionManager, disguiseManager, new TaskManager(this, clientManager, webServerAddress), portal, partyManager, preferenceManager, petManager, pollManager, statsManager, achievementManager, new HologramManager(this), npcManager, personalServerManager, packetHandler, punish, serverStatusManager, giveawayManager); HubManager hubManager = new HubManager(this, blockRestore, clientManager, donationManager, inventoryManager, conditionManager, disguiseManager, new TaskManager(this, clientManager, webServerAddress), portal, partyManager, preferenceManager, petManager, pollManager, statsManager, achievementManager, new HologramManager(this, packetHandler), npcManager, personalServerManager, packetHandler, punish, serverStatusManager, giveawayManager);
QueueManager queueManager = new QueueManager(this, clientManager, donationManager, new EloManager(this, clientManager), partyManager); QueueManager queueManager = new QueueManager(this, clientManager, donationManager, new EloManager(this, clientManager), partyManager);
@ -166,7 +166,7 @@ public class Hub extends JavaPlugin implements IRelation
conditionManager.setDamageManager(damage); conditionManager.setDamageManager(damage);
Fire fire = new Fire(this, conditionManager, damage); Fire fire = new Fire(this, conditionManager, damage);
Teleport teleport = new Teleport(this); Teleport teleport = new Teleport(this, clientManager);
Energy energy = new Energy(this); Energy energy = new Energy(this);
energy.setEnabled(false); energy.setEnabled(false);

View File

@ -32,7 +32,7 @@ public class ClansServerPage extends ShopPageBase<ServerManager, ClansServerShop
public ClansServerPage(ServerManager plugin, ClansServerShop shop, CoreClientManager clientManager, public ClansServerPage(ServerManager plugin, ClansServerShop shop, CoreClientManager clientManager,
DonationManager donationManager, Player player, ClanRepository repository) DonationManager donationManager, Player player, ClanRepository repository)
{ {
super(plugin, shop, clientManager, donationManager, "Clans", player, 27); super(plugin, shop, clientManager, donationManager, "Clans Alpha", player, 27);
_repository = repository; _repository = repository;
_accountId = clientManager.getAccountId(player); _accountId = clientManager.getAccountId(player);
@ -64,10 +64,10 @@ public class ClansServerPage extends ShopPageBase<ServerManager, ClansServerShop
{ {
buildJoinHomeServer(clan); buildJoinHomeServer(clan);
if (isLeader(clan)) // if (isLeader(clan))
{ // {
buildMoveClan(clan); // buildMoveClan(clan);
} // }
} }
private void buildNoClanPage() private void buildNoClanPage()
@ -93,25 +93,30 @@ public class ClansServerPage extends ShopPageBase<ServerManager, ClansServerShop
boolean serverOnline = (serverInfo != null); boolean serverOnline = (serverInfo != null);
String serverStatus = serverOnline ? C.cGreen + "Online" : C.cRed + "Offline"; String serverStatus = serverOnline ? C.cGreen + "Online" : C.cRed + "Offline";
String title = C.cRed + C.Bold + "Join Home Server!"; String title = (serverOnline ? C.cGreen : C.cRed) + C.Bold + "Join Home Server!";
String description = C.cGold + "Join your home server, " + C.cAqua + clan.getHomeServer() + C.cGold + "!"; // String description = C.cGold + "Join your home server, " + C.cAqua + clan.getHomeServer() + C.cGold + "!";
String serverDesc = C.cGold + "Server Status: " + serverStatus + C.cGold + "!"; String serverName = C.cYellow + "Server Name: " + C.cWhite + clan.getHomeServer();
ShopItem shopItem = new ShopItem(Material.EMERALD_BLOCK, title, new String[] {" ", description, serverDesc, " "}, 0, true, true); String serverDesc = C.cYellow + "Server Status: " + C.cWhite + serverStatus;
String players = (serverOnline ? C.cYellow + "Players: " + C.cWhite + serverInfo.CurrentPlayers + "/" + serverInfo.MaxPlayers : "" );
String change = C.cRed + "Note: " + C.cWhite + "You must leave your Clan to ";
String change2 = C.cWhite + "play on a different Clans Server!";
ShopItem shopItem = new ShopItem(Material.EMERALD_BLOCK, title, new String[] {" ", serverName, serverDesc, players, " ", change, change2, " "}, 0, true, true);
addButton(13, shopItem, new JoinServerButton(this, getPlugin(), getServerInfo(clan.getHomeServer()), getPlayer())); addButton(13, shopItem, new JoinServerButton(this, getPlugin(), getServerInfo(clan.getHomeServer()), getPlayer()));
} }
private void buildJoinServer(int slot, ServerInfo server) private void buildJoinServer(int slot, ServerInfo server)
{ {
String title = C.cRed + C.Bold + "Join Clans Server!"; String title = C.cGreen + C.Bold + "Join Clans Server!";
String desc1 = C.cGold + "Name: " + C.cAqua + server.Name; String desc1 = C.cYellow + "Server Name " + C.cWhite + server.Name;
String desc2 = C.cGold + "Players: " + C.cAqua + server.CurrentPlayers + "/" + server.MaxPlayers; String desc2 = C.cYellow + "Players " + C.cWhite + server.CurrentPlayers + "/" + server.MaxPlayers;
String desc3 = C.Bold + C.cRed + "Note: " + ChatColor.RESET + C.cGray + "Creating a clan on this"; String desc3 = C.cRed + "Note: " + C.cWhite + "Creating or Joining a clan on this";
String desc4 = C.cGray + "server will set your home server!"; String desc4 = C.cWhite + "server will set your Home Server!";
ShopItem shopItem = new ShopItem(Material.GOLD_BLOCK, title, new String[] {" ", desc1, desc2, " ", desc3, desc4}, 0, true, true); ShopItem shopItem = new ShopItem(Material.GOLD_BLOCK, title, new String[] {" ", desc1, desc2, " ", desc3, desc4}, 0, true, true);
addButton(slot, shopItem, new JoinServerButton(this, getPlugin(), server, getPlayer())); addButton(slot, shopItem, new JoinServerButton(this, getPlugin(), server, getPlayer()));
} }
/*
private void buildMoveClan(final SimpleClanToken clan) private void buildMoveClan(final SimpleClanToken clan)
{ {
// Build button for moving clan to another server // Build button for moving clan to another server
@ -139,6 +144,7 @@ public class ClansServerPage extends ShopPageBase<ServerManager, ClansServerShop
addButton(26, shopItem, button); addButton(26, shopItem, button);
} }
*/
private ServerInfo getServerInfo(String serverName) private ServerInfo getServerInfo(String serverName)
{ {

View File

@ -24,7 +24,7 @@ public class ClansServerShop extends ShopBase<ServerManager>
public ClansServerShop(ServerManager plugin, CoreClientManager clientManager, DonationManager donationManager) public ClansServerShop(ServerManager plugin, CoreClientManager clientManager, DonationManager donationManager)
{ {
super(plugin, clientManager, donationManager, "Clans"); super(plugin, clientManager, donationManager, "Clans Alpha");
_repository = new ClanRepository(plugin.getPlugin(), plugin.getStatusManager().getCurrentServerName()); _repository = new ClanRepository(plugin.getPlugin(), plugin.getStatusManager().getCurrentServerName());
} }

View File

@ -160,6 +160,7 @@ public class MapParser extends JavaPlugin implements Listener
player.addAttachment(plugin, "worldedit.*", hasPermission); player.addAttachment(plugin, "worldedit.*", hasPermission);
player.addAttachment(plugin, "voxelsniper.sniper", hasPermission); player.addAttachment(plugin, "voxelsniper.sniper", hasPermission);
player.addAttachment(plugin, "voxelsniper.brush.*", hasPermission); player.addAttachment(plugin, "voxelsniper.brush.*", hasPermission);
player.addAttachment(plugin, "coloredsigns.format", hasPermission);
} }
_permissionMap.put(player, hasPermission); _permissionMap.put(player, hasPermission);

View File

@ -112,7 +112,7 @@ public class Arcade extends JavaPlugin
Creature creature = new Creature(this); Creature creature = new Creature(this);
ServerStatusManager serverStatusManager = new ServerStatusManager(this, _clientManager, new LagMeter(this, _clientManager)); ServerStatusManager serverStatusManager = new ServerStatusManager(this, _clientManager, new LagMeter(this, _clientManager));
LeaderboardManager leaderboardManager = new LeaderboardManager(this, _clientManager); LeaderboardManager leaderboardManager = new LeaderboardManager(this, _clientManager);
Teleport teleport = new Teleport(this); Teleport teleport = new Teleport(this, _clientManager);
Portal portal = new Portal(this, _clientManager, serverStatusManager.getCurrentServerName()); Portal portal = new Portal(this, _clientManager, serverStatusManager.getCurrentServerName());
new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion()); new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion());
PacketHandler packetHandler = new PacketHandler(this); PacketHandler packetHandler = new PacketHandler(this);
@ -136,7 +136,7 @@ public class Arcade extends JavaPlugin
BlockRestore blockRestore = new BlockRestore(this); BlockRestore blockRestore = new BlockRestore(this);
ProjectileManager projectileManager = new ProjectileManager(this); ProjectileManager projectileManager = new ProjectileManager(this);
HologramManager hologramManager = new HologramManager(this); HologramManager hologramManager = new HologramManager(this, packetHandler);
//Inventory //Inventory
InventoryManager inventoryManager = new InventoryManager(this, _clientManager); InventoryManager inventoryManager = new InventoryManager(this, _clientManager);

View File

@ -211,6 +211,7 @@ public class MineStrike extends TeamGame
private HashSet<Entity> _defusalDropped = new HashSet<Entity>(); private HashSet<Entity> _defusalDropped = new HashSet<Entity>();
private HashMap<Location, Long> _incendiary = new HashMap<Location, Long>(); private HashMap<Location, Long> _incendiary = new HashMap<Location, Long>();
private HashMap<Block, Long> _smokeBlocks = new HashMap<Block, Long>();
private Bomb _bomb = null; private Bomb _bomb = null;
private Item _bombItem = null; private Item _bombItem = null;
@ -613,6 +614,17 @@ public class MineStrike extends TeamGame
_incendiary.put(loc, endTime); _incendiary.put(loc, endTime);
} }
@SuppressWarnings("deprecation")
public void registerSmokeBlock(Block block, long endTime)
{
if (block.getType() == Material.AIR || block.getType() == Material.PORTAL || block.getType() == Material.FIRE)
{
block.setTypeIdAndData(90, (byte)UtilMath.r(2), false);
_smokeBlocks.put(block, endTime);
}
}
public Gun getGunInHand(Player player, ItemStack overrideStack) public Gun getGunInHand(Player player, ItemStack overrideStack)
{ {
ItemStack stack = player.getItemInHand(); ItemStack stack = player.getItemInHand();
@ -728,7 +740,7 @@ public class MineStrike extends TeamGame
if (grenade == null) if (grenade == null)
return; return;
if (!UtilTime.elapsed(GetStateTime(), 15000)) if (!UtilTime.elapsed(GetStateTime(), 10000))
{ {
UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot throw Grenades yet.")); UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot throw Grenades yet."));
return; return;
@ -1417,6 +1429,9 @@ public class MineStrike extends TeamGame
if (event.GetLog().GetLastDamager().GetReason().contains("AWP")) if (event.GetLog().GetLastDamager().GetReason().contains("AWP"))
amount = 100; amount = 100;
else if (event.GetLog().GetLastDamager().GetReason().contains("PP-Bizon"))
amount = 600;
else if (event.GetLog().GetLastDamager().GetReason().contains("Nova")) else if (event.GetLog().GetLastDamager().GetReason().contains("Nova"))
amount = 900; amount = 900;
@ -1489,14 +1504,6 @@ public class MineStrike extends TeamGame
UtilParticle.PlayParticle(ParticleType.CRIT, grenadeItem.getLocation(), 0, 0, 0, 0, 1, UtilParticle.PlayParticle(ParticleType.CRIT, grenadeItem.getLocation(), 0, 0, 0, 0, 1,
ViewDist.NORMAL, UtilServer.getPlayers()); ViewDist.NORMAL, UtilServer.getPlayers());
//Expired
if (!grenadeItem.isValid() || grenadeItem.getTicksLived() > 400)
{
grenadeItem.remove();
grenadeIterator.remove();
continue;
}
//Completed //Completed
Grenade grenade = _grenadesThrown.get(grenadeItem); Grenade grenade = _grenadesThrown.get(grenadeItem);
if (grenade.update(this, grenadeItem)) if (grenade.update(this, grenadeItem))
@ -1668,7 +1675,11 @@ public class MineStrike extends TeamGame
{ {
for (Player player : GetTeam(ChatColor.AQUA).GetPlayers(true)) for (Player player : GetTeam(ChatColor.AQUA).GetPlayers(true))
{ {
Block block = player.getTargetBlock((HashSet<Byte>) null, 5); HashSet<Material> ignoreBlocks = new HashSet<Material>();
ignoreBlocks.add(Material.AIR);
ignoreBlocks.add(Material.PORTAL);
Block block = player.getTargetBlock(ignoreBlocks, 5);
if (block == null || !_bomb.isBlock(block)) if (block == null || !_bomb.isBlock(block))
continue; continue;
@ -1713,7 +1724,11 @@ public class MineStrike extends TeamGame
if (_bombDefuser == null) if (_bombDefuser == null)
return; return;
Block block = _bombDefuser.getTargetBlock((HashSet<Byte>) null, 5); HashSet<Material> ignoreBlocks = new HashSet<Material>();
ignoreBlocks.add(Material.AIR);
ignoreBlocks.add(Material.PORTAL);
Block block = _bombDefuser.getTargetBlock(ignoreBlocks, 5);
if (!IsAlive(_bombDefuser) || block == null || !_bomb.isBlock(block) || !_bombDefuser.isOnline() || UtilMath.offset(_bombDefuser.getLocation(), block.getLocation().add(0.5, 0, 0.5)) > 3) if (!IsAlive(_bombDefuser) || block == null || !_bomb.isBlock(block) || !_bombDefuser.isOnline() || UtilMath.offset(_bombDefuser.getLocation(), block.getLocation().add(0.5, 0, 0.5)) > 3)
{ {
@ -2161,6 +2176,11 @@ public class MineStrike extends TeamGame
_incendiary.clear(); _incendiary.clear();
Manager.GetBlockRestore().restoreAll(); Manager.GetBlockRestore().restoreAll();
//Smoke
for (Block block : _smokeBlocks.keySet())
block.setType(Material.AIR);
_smokeBlocks.clear();
//Restock Ammo //Restock Ammo
for (Gun gun : _gunsEquipped.keySet()) for (Gun gun : _gunsEquipped.keySet())
gun.restockAmmo(_gunsEquipped.get(gun)); gun.restockAmmo(_gunsEquipped.get(gun));
@ -2412,6 +2432,47 @@ public class MineStrike extends TeamGame
} }
} }
@EventHandler
public void gunUpdate(UpdateEvent event)
{
if (!IsLive())
return;
if (event.getType() != UpdateType.TICK)
return;
for (Gun gun : _gunsEquipped.keySet())
{
gun.displayAmmo(_gunsEquipped.get(gun));
}
}
@EventHandler
public void smokeUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
Iterator<Block> smokeIterator = _smokeBlocks.keySet().iterator();
while (smokeIterator.hasNext())
{
Block block = smokeIterator.next();
if (System.currentTimeMillis() > _smokeBlocks.get(block))
{
if (block.getType() == Material.PORTAL)
block.setTypeIdAndData(0, (byte)0, false);
smokeIterator.remove();
}
else if (block.getType() == Material.AIR)
{
block.setTypeIdAndData(90, (byte)UtilMath.r(2), false);
}
}
}
@EventHandler @EventHandler
public void bombBurnUpdate(UpdateEvent event) public void bombBurnUpdate(UpdateEvent event)
{ {

View File

@ -236,14 +236,15 @@ public class ShopManager
Host.registerGrenade(grenade, player); Host.registerGrenade(grenade, player);
} }
//Use 250 instead of 255, to show that its kevlar/helmet
else if (item instanceof Helmet) else if (item instanceof Helmet)
{ {
((Helmet)item).giveToPlayer(player, (team.GetColor() == ChatColor.RED) ? Color.fromRGB(255, 75, 75) : Color.fromRGB(125, 200, 255)); ((Helmet)item).giveToPlayer(player, (team.GetColor() == ChatColor.RED) ? Color.fromRGB(250, 75, 75) : Color.fromRGB(125, 200, 250));
} }
else if (item instanceof Kevlar) else if (item instanceof Kevlar)
{ {
((Kevlar)item).giveToPlayer(player, (team.GetColor() == ChatColor.RED) ? Color.fromRGB(255, 75, 75) : Color.fromRGB(125, 200, 255)); ((Kevlar)item).giveToPlayer(player, (team.GetColor() == ChatColor.RED) ? Color.fromRGB(250, 75, 75) : Color.fromRGB(125, 200, 250));
} }
else if (item instanceof DefusalKit) else if (item instanceof DefusalKit)

View File

@ -34,10 +34,18 @@ public class Bomb
Block = planter.getLocation().getBlock(); Block = planter.getLocation().getBlock();
Type = Block.getType(); if (Block.getType() != Material.PORTAL)
Data = Block.getData(); {
Type = Block.getType();
Data = Block.getData();
}
else
{
Type = Material.AIR;
Data = 0;
}
Block.setType(Material.DAYLIGHT_DETECTOR); Block.setTypeIdAndData(Material.DAYLIGHT_DETECTOR.getId(), (byte)0, false);
StartTime = System.currentTimeMillis(); StartTime = System.currentTimeMillis();
} }
@ -45,7 +53,7 @@ public class Bomb
public boolean update() public boolean update()
{ {
if (Block.getType() != Material.DAYLIGHT_DETECTOR) if (Block.getType() != Material.DAYLIGHT_DETECTOR)
Block.setType(Material.DAYLIGHT_DETECTOR); Block.setTypeIdAndData(Material.DAYLIGHT_DETECTOR.getId(), (byte)0, false);
double scale = (double)(System.currentTimeMillis() - StartTime)/(double)BombTime; double scale = (double)(System.currentTimeMillis() - StartTime)/(double)BombTime;

View File

@ -54,7 +54,7 @@ public class Armor extends StrikeItem
try try
{ {
LeatherArmorMeta meta = (LeatherArmorMeta)stack.getItemMeta(); LeatherArmorMeta meta = (LeatherArmorMeta)stack.getItemMeta();
return (meta.getColor().getBlue() == 100 || meta.getColor().getRed() == 100); return (meta.getColor().getBlue() == 250 || meta.getColor().getRed() == 250);
} }
catch (Exception e) catch (Exception e)
{ {

View File

@ -74,6 +74,19 @@ public abstract class FireGrenadeBase extends Grenade
if (!UtilBlock.solid(block.getRelative(BlockFace.DOWN))) if (!UtilBlock.solid(block.getRelative(BlockFace.DOWN)))
continue; continue;
//Smoke
boolean nearSmoke = false;
for (Block other : UtilBlock.getSurrounding(block, false))
{
if (other.getType() == Material.PORTAL)
{
nearSmoke = true;
break;
}
}
if (nearSmoke)
continue;
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(game.Manager.getPlugin(), new Runnable() UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(game.Manager.getPlugin(), new Runnable()
{ {
public void run() public void run()

View File

@ -7,6 +7,7 @@ import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.minestrike.MineStrike; import nautilus.game.arcade.game.games.minestrike.MineStrike;
import nautilus.game.arcade.game.games.minestrike.Radio; import nautilus.game.arcade.game.games.minestrike.Radio;
@ -34,7 +35,7 @@ public class FlashBang extends Grenade
@Override @Override
public boolean updateCustom(MineStrike game, Entity ent) public boolean updateCustom(MineStrike game, Entity ent)
{ {
if (ent.getTicksLived() > 40) if (UtilTime.elapsed(_throwTime, 2000))
{ {
FireworkEffect effect = FireworkEffect.builder().flicker(true).withColor(Color.WHITE).with(Type.BALL_LARGE).trail(false).build(); FireworkEffect effect = FireworkEffect.builder().flicker(true).withColor(Color.WHITE).with(Type.BALL_LARGE).trail(false).build();
UtilFirework.playFirework(ent.getLocation().add(0, 0.5, 0), effect); UtilFirework.playFirework(ent.getLocation().add(0, 0.5, 0), effect);

View File

@ -19,6 +19,7 @@ import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import nautilus.game.arcade.game.games.minestrike.MineStrike; import nautilus.game.arcade.game.games.minestrike.MineStrike;
import nautilus.game.arcade.game.games.minestrike.items.StrikeItem; import nautilus.game.arcade.game.games.minestrike.items.StrikeItem;
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType; import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
@ -75,6 +76,8 @@ public abstract class Grenade extends StrikeItem
protected int _limit; protected int _limit;
protected long _throwTime = 0;
public Grenade(String name, String[] desc, int cost, int gemCost, Material skin, int limit) public Grenade(String name, String[] desc, int cost, int gemCost, Material skin, int limit)
{ {
super(StrikeItemType.GRENADE, name, desc, cost, gemCost, skin); super(StrikeItemType.GRENADE, name, desc, cost, gemCost, skin);
@ -154,14 +157,19 @@ public abstract class Grenade extends StrikeItem
//Sound //Sound
playSound(game, player); playSound(game, player);
_throwTime = System.currentTimeMillis();
} }
public boolean update(MineStrike game, Entity ent) public boolean update(MineStrike game, Entity ent)
{ {
//Invalid if (UtilTime.elapsed(_throwTime, 20000))
if (!ent.isValid())
return true; return true;
//Invalid (Burned)
if (!ent.isValid())
return updateCustom(game, ent);
//Rebound Off Blocks //Rebound Off Blocks
rebound(ent); rebound(ent);
@ -174,9 +182,14 @@ public abstract class Grenade extends StrikeItem
public void rebound(Entity ent) public void rebound(Entity ent)
{ {
if (UtilEnt.isGrounded(ent) || ent.getVelocity().length() < 0.1 || ent.getTicksLived() < 4) if (UtilEnt.isGrounded(ent) || ent.getVelocity().length() < 0.1 || !UtilTime.elapsed(_throwTime, 200))
return; return;
if (Math.abs(_vel.getX()) < 0.1 && Math.abs(_vel.getX()) < 0.1)
{
return;
}
/* /*
* What we must do here, is record the velocity every tick. * What we must do here, is record the velocity every tick.
* Then when it collides, we get the velocity from a few ticks before and apply it, reversing the direction of collision. * Then when it collides, we get the velocity from a few ticks before and apply it, reversing the direction of collision.
@ -184,8 +197,8 @@ public abstract class Grenade extends StrikeItem
*/ */
//X Rebound //X Rebound
if ((_vel.getX() > 0.05 && ent.getLocation().getX() - _lastLoc.getX() <= 0) || if ((_vel.getX() > 0.1 && ent.getLocation().getX() - _lastLoc.getX() <= 0) ||
(_vel.getX() < 0.05 && ent.getLocation().getX() - _lastLoc.getX() >= 0)) (_vel.getX() < 0.1 && ent.getLocation().getX() - _lastLoc.getX() >= 0))
{ {
_vel = _velHistory.get(0); _vel = _velHistory.get(0);
_vel.setX(-_vel.getX()); _vel.setX(-_vel.getX());
@ -197,8 +210,8 @@ public abstract class Grenade extends StrikeItem
} }
//Z Rebound //Z Rebound
else if ((_vel.getZ() > 0.05 && ent.getLocation().getZ() - _lastLoc.getZ() <= 0) || else if ((_vel.getZ() > 0.1 && ent.getLocation().getZ() - _lastLoc.getZ() <= 0) ||
(_vel.getZ() < 0.05 && ent.getLocation().getZ() - _lastLoc.getZ() >= 0)) (_vel.getZ() < 0.1 && ent.getLocation().getZ() - _lastLoc.getZ() >= 0))
{ {
_vel = _velHistory.get(0); _vel = _velHistory.get(0);
_vel.setZ(-_vel.getZ()); _vel.setZ(-_vel.getZ());

View File

@ -6,6 +6,7 @@ import java.util.List;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
@ -35,7 +36,7 @@ public class HighExplosive extends Grenade
@Override @Override
public boolean updateCustom(MineStrike game, Entity ent) public boolean updateCustom(MineStrike game, Entity ent)
{ {
if (ent.getTicksLived() > 40) if (UtilTime.elapsed(_throwTime, 2000))
{ {
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION,
ent.getLocation(), 0, 0, 0, 0, 1, ent.getLocation(), 0, 0, 0, 0, 1,

View File

@ -1,7 +1,12 @@
package nautilus.game.arcade.game.games.minestrike.items.grenades; package nautilus.game.arcade.game.games.minestrike.items.grenades;
import java.util.HashMap;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilParticle.ViewDist;
import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam;
@ -12,11 +17,15 @@ import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public class Smoke extends Grenade public class Smoke extends Grenade
{ {
private boolean _createdBlocks = false;
public Smoke() public Smoke()
{ {
super("Smoke", new String[] super("Smoke", new String[]
@ -27,9 +36,9 @@ public class Smoke extends Grenade
} }
@Override @Override
public boolean updateCustom(MineStrike game, Entity ent) public boolean updateCustom(final MineStrike game, Entity ent)
{ {
if (ent.getTicksLived() > 60) if (UtilTime.elapsed(_throwTime, 2000) && (UtilEnt.isGrounded(ent) || !ent.isValid()))
{ {
// UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, ent.getLocation(), 0.3f, 0.3f, 0.3f, 0, 1, // UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, ent.getLocation(), 0.3f, 0.3f, 0.3f, 0, 1,
// ViewDist.MAX, UtilServer.getPlayers()); // ViewDist.MAX, UtilServer.getPlayers());
@ -40,15 +49,49 @@ public class Smoke extends Grenade
ent.getWorld().playSound(ent.getLocation(), Sound.FIZZ, 0.1f, 0.1f); ent.getWorld().playSound(ent.getLocation(), Sound.FIZZ, 0.1f, 0.1f);
//Remove Fire
for (Location loc : game.Manager.GetBlockRestore().restoreBlockAround(Material.FIRE, ent.getLocation(), 5)) for (Location loc : game.Manager.GetBlockRestore().restoreBlockAround(Material.FIRE, ent.getLocation(), 5))
{ {
loc.getWorld().playSound(loc, Sound.FIZZ, 1f, 1f); loc.getWorld().playSound(loc, Sound.FIZZ, 1f, 1f);
} }
//Smoke Blocks
if (!_createdBlocks)
{
final HashMap<Block, Double> blocks = UtilBlock.getInRadius(ent.getLocation().add(0, 1, 0), 4d);
final int round = game.getRound();
for (final Block block : blocks.keySet())
{
if (block.getType() != Material.AIR && block.getType() != Material.PORTAL && block.getType() != Material.FIRE)
continue;
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(game.Manager.getPlugin(), new Runnable()
{
public void run()
{
if (round == game.getRound() && !game.isFreezeTime())
{
//18 seconds
long duration = (long) (15000 + blocks.get(block) * 3000);
game.registerSmokeBlock(block, System.currentTimeMillis() + duration);
}
}
}, 10 - (int)(10d * blocks.get(block)));
}
_createdBlocks = true;
}
ent.getWorld().playSound(ent.getLocation(), Sound.FIZZ, 0.1f, 0.1f);
return false; return false;
} }
return ent.getTicksLived() > 360; //18 seconds
return UtilTime.elapsed(_throwTime, 18000);
} }
@Override @Override

View File

@ -48,6 +48,8 @@ public class Gun extends StrikeItem
protected boolean _reloading = false; protected boolean _reloading = false;
protected boolean _reloadTick = false;
public Gun(GunStats gunStats) public Gun(GunStats gunStats)
{ {
super(gunStats.getItemType(), gunStats.getName(), gunStats.getDesc(), gunStats.getCost(), gunStats.getGemCost(), gunStats.getSkin()); super(gunStats.getItemType(), gunStats.getName(), gunStats.getDesc(), gunStats.getCost(), gunStats.getGemCost(), gunStats.getSkin());
@ -124,18 +126,26 @@ public class Gun extends StrikeItem
//Use Ammo //Use Ammo
_loadedAmmo--; _loadedAmmo--;
updateWeaponName(player); //updateWeaponName(player);
//Effect //Effect
soundFire(player.getLocation()); soundFire(player.getLocation());
//Visual //Smoke
Location loc = player.getEyeLocation().add(player.getLocation().getDirection().multiply(1.2)); Location loc = player.getEyeLocation().add(player.getLocation().getDirection().multiply(1.2));
loc.add(UtilAlg.getRight(player.getLocation().getDirection()).multiply(0.5)); loc.add(UtilAlg.getRight(player.getLocation().getDirection()).multiply(0.5));
loc.add(UtilAlg.getDown(player.getLocation().getDirection()).multiply(0.3)); loc.add(UtilAlg.getDown(player.getLocation().getDirection()).multiply(0.4));
UtilParticle.PlayParticle(ParticleType.EXPLODE, loc, 0, 0, 0, 0, 1, UtilParticle.PlayParticle(Math.random() > 0.5 ? ParticleType.ANGRY_VILLAGER : ParticleType.HEART, loc, 0, 0, 0, 0, 1,
ViewDist.LONG, UtilServer.getPlayers()); ViewDist.LONG, UtilServer.getPlayers());
//Shell
loc = player.getEyeLocation().add(player.getLocation().getDirection().multiply(0.6));
loc.add(UtilAlg.getRight(player.getLocation().getDirection()).multiply(0.7));
loc.add(UtilAlg.getDown(player.getLocation().getDirection()).multiply(0.5));
UtilParticle.PlayParticle(ParticleType.SPLASH, loc, 0, 0, 0, 0, 1,
ViewDist.LONG, UtilServer.getPlayers());
game.registerBullet(fireBullet(player, game)); game.registerBullet(fireBullet(player, game));
//Unscope //Unscope
@ -265,7 +275,7 @@ public class Gun extends StrikeItem
} }
//Recharge //Recharge
Recharge.Instance.use(player, getName() + " Reload", getReloadTime(), false, true, true); Recharge.Instance.use(player, getName() + " Reload", getReloadTime(), false, true);
//Sound //Sound
soundReload(player.getLocation()); soundReload(player.getLocation());
@ -285,16 +295,35 @@ public class Gun extends StrikeItem
updateWeaponName(null); updateWeaponName(null);
} }
public void displayAmmo(Player player)
{
if (!UtilGear.isMat(player.getItemInHand(), getStack().getType()))
return;
//Weapon Bob during reload
if (_reloading)
updateWeaponName(player);
if (!Recharge.Instance.usable(player, getName() + " Reload"))
return;
if (_loadedAmmo > 0 || _reserveAmmo > 0)
UtilTextBottom.display(C.cGreen + _loadedAmmo + ChatColor.RESET + " / " + C.cYellow + _reserveAmmo, player);
else
UtilTextBottom.display(C.cRed + "No Ammo", player);
}
public void updateWeaponName(Player player) public void updateWeaponName(Player player)
{ {
ItemMeta meta = getStack().getItemMeta(); ItemMeta meta = getStack().getItemMeta();
meta.setDisplayName(ChatColor.RESET + (getOwnerName() == null ? "" : getOwnerName() + "'s ") + C.Bold + getName() + ChatColor.RESET + " " + C.cGreen + _loadedAmmo + ChatColor.RESET + " / " + C.cYellow + _reserveAmmo); meta.setDisplayName(ChatColor.RESET + (getOwnerName() == null ? "" : getOwnerName() + "'s ") + C.Bold + getName() + (_reloadTick ? ChatColor.RED : ChatColor.WHITE));
getStack().setItemMeta(meta); getStack().setItemMeta(meta);
getStack().setAmount(Math.max(1, _loadedAmmo));
if (player != null) if (player != null)
{
player.getInventory().setItem(_slot, getStack()); player.getInventory().setItem(_slot, getStack());
_reloadTick = !_reloadTick;
}
} }
public double getDropOff() public double getDropOff()
@ -349,7 +378,7 @@ public class Gun extends StrikeItem
_reserveAmmo = Math.max(0, ammo - _gunStats.getClipSize()); _reserveAmmo = Math.max(0, ammo - _gunStats.getClipSize());
//Update //Update
updateWeaponName(player); //updateWeaponName(player);
//Sound //Sound
player.getWorld().playSound(player.getEyeLocation(), Sound.PISTON_EXTEND, 1f, 1.6f); player.getWorld().playSound(player.getEyeLocation(), Sound.PISTON_EXTEND, 1f, 1.6f);
@ -417,7 +446,7 @@ public class Gun extends StrikeItem
_loadedAmmo = _gunStats.getClipSize(); _loadedAmmo = _gunStats.getClipSize();
_reserveAmmo = _gunStats.getClipReserve() * _gunStats.getClipSize(); _reserveAmmo = _gunStats.getClipReserve() * _gunStats.getClipSize();
updateWeaponName(player); //updateWeaponName(player);
} }
public double getDamage() public double getDamage()

View File

@ -43,7 +43,7 @@ public class Shotgun extends Gun
//Use Ammo //Use Ammo
_loadedAmmo--; _loadedAmmo--;
updateWeaponName(player); //updateWeaponName(false);
//Effect //Effect
soundFire(player.getLocation()); soundFire(player.getLocation());