Merge remote-tracking branch 'remotes/origin/master' into virizion_speed_builder

This commit is contained in:
Virizion 2015-11-25 22:53:06 -05:00
commit de82806fc0
56 changed files with 863 additions and 297 deletions

BIN
Art/MS SMoke.psd Normal file

Binary file not shown.

View File

@ -0,0 +1,47 @@
From c6e51ae8ffc31d0fc059d33ca159df31c2b7a83e Mon Sep 17 00:00:00 2001
From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Sun, 22 Nov 2015 14:37:11 +1300
Subject: [PATCH] EntityDismountEvent
diff --git a/src/main/java/org/spigotmc/event/entity/EntityDismountEvent.java b/src/main/java/org/spigotmc/event/entity/EntityDismountEvent.java
index 24d4942..02943d6 100644
--- a/src/main/java/org/spigotmc/event/entity/EntityDismountEvent.java
+++ b/src/main/java/org/spigotmc/event/entity/EntityDismountEvent.java
@@ -2,13 +2,14 @@ package org.spigotmc.event.entity;
import org.bukkit.entity.Entity;
import org.bukkit.event.HandlerList;
+import org.bukkit.event.Cancellable;
import org.bukkit.event.entity.EntityEvent;
/**
* Called when an entity stops riding another entity.
*
*/
-public class EntityDismountEvent extends EntityEvent
+public class EntityDismountEvent extends EntityEvent implements Cancellable
{
private static final HandlerList handlers = new HandlerList();
@@ -36,4 +37,17 @@ public class EntityDismountEvent extends EntityEvent
{
return handlers;
}
+
+ @Override
+ public boolean isCancelled()
+ {
+ return cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel)
+ {
+ this.cancelled = cancel;
+ }
+
}
--
1.9.5.msysgit.0

View File

@ -0,0 +1,159 @@
From bc86c3b02f2efa4c1194fc908e8d1ee8723f62c5 Mon Sep 17 00:00:00 2001
From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Sun, 22 Nov 2015 14:41:11 +1300
Subject: [PATCH] EntityDismountEvent & teleport crash fix
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 81ca499..7165579 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -23,6 +23,8 @@ import org.bukkit.event.painting.PaintingBreakByEntityEvent;
import org.bukkit.event.vehicle.VehicleBlockCollisionEvent;
import org.bukkit.event.vehicle.VehicleEnterEvent;
import org.bukkit.event.vehicle.VehicleExitEvent;
+import org.spigotmc.event.entity.EntityDismountEvent;
+import org.spigotmc.event.entity.EntityMountEvent;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.craftbukkit.entity.CraftPlayer;
@@ -1591,7 +1593,12 @@ public abstract class Entity implements ICommandListener {
}
}
// CraftBukkit end
- pluginManager.callEvent( new org.spigotmc.event.entity.EntityDismountEvent( this.getBukkitEntity(), this.vehicle.getBukkitEntity() ) ); // Spigot
+ EntityDismountEvent event = new org.spigotmc.event.entity.EntityDismountEvent(this.getBukkitEntity(), this.vehicle.getBukkitEntity());
+ pluginManager.callEvent(event); // Spigot
+
+ if (event.isCancelled() || vehicle != originalVehicle) {
+ return;
+ } // Spigot
this.setPositionRotation(this.vehicle.locX, this.vehicle.getBoundingBox().b + (double) this.vehicle.length, this.vehicle.locZ, this.yaw, this.pitch);
this.vehicle.passenger = null;
}
@@ -1599,44 +1606,45 @@ public abstract class Entity implements ICommandListener {
this.vehicle = null;
} else {
// CraftBukkit start
- if ((this.bukkitEntity instanceof LivingEntity) && (entity.getBukkitEntity() instanceof Vehicle) && entity.world.isChunkLoaded((int) entity.locX >> 4, (int) entity.locZ >> 4, true)) {
+ if (entity.world.isChunkLoaded((int) entity.locX >> 4, (int) entity.locZ >> 4, true)) {
// It's possible to move from one vehicle to another. We need to check if they're already in a vehicle, and fire an exit event if they are.
VehicleExitEvent exitEvent = null;
+ EntityDismountEvent exitEvent1 = null;
if (this.vehicle != null) {
- exitEvent = new VehicleExitEvent((Vehicle) this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity);
+ if ((this.bukkitEntity instanceof LivingEntity) && (entity.getBukkitEntity() instanceof Vehicle))
+ exitEvent = new VehicleExitEvent((Vehicle) this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity);
pluginManager.callEvent(exitEvent);
if (exitEvent.isCancelled() || this.vehicle != originalVehicle || (this.vehicle != null && this.vehicle.passenger != originalPassenger)) {
return;
}
+
+ exitEvent1 = new EntityDismountEvent(this.vehicle.getBukkitEntity(), this.bukkitEntity);
+
+ pluginManager.callEvent(exitEvent1);
+
+ if (exitEvent1.isCancelled() || this.vehicle != originalVehicle || (this.vehicle != null && this.vehicle.passenger != originalPassenger)) {
+ return;
+ }
}
- VehicleEnterEvent event = new VehicleEnterEvent((Vehicle) entity.getBukkitEntity(), this.bukkitEntity);
- pluginManager.callEvent(event);
+ if ((this.bukkitEntity instanceof LivingEntity) && (entity.getBukkitEntity() instanceof Vehicle)) {
+ VehicleEnterEvent event = new VehicleEnterEvent((Vehicle) entity.getBukkitEntity(), this.bukkitEntity);
+ pluginManager.callEvent(event);
- // If a plugin messes with the vehicle or the vehicle's passenger
- if (event.isCancelled() || this.vehicle != originalVehicle || (this.vehicle != null && this.vehicle.passenger != originalPassenger)) {
- // If we only cancelled the enterevent then we need to put the player in a decent position.
- if (exitEvent != null && this.vehicle == originalVehicle && this.vehicle != null && this.vehicle.passenger == originalPassenger) {
- this.setPositionRotation(this.vehicle.locX, this.vehicle.getBoundingBox().b + (double) this.vehicle.length, this.vehicle.locZ, this.yaw, this.pitch);
- this.vehicle.passenger = null;
- this.vehicle = null;
+ // If a plugin messes with the vehicle or the vehicle's passenger
+ if (event.isCancelled() || this.vehicle != originalVehicle || (this.vehicle != null && this.vehicle.passenger != originalPassenger)) {
+ // If we only cancelled the enterevent then we need to put the player in a decent position.
+ if (exitEvent != null && this.vehicle == originalVehicle && this.vehicle != null && this.vehicle.passenger == originalPassenger) {
+ this.setPositionRotation(this.vehicle.locX, this.vehicle.getBoundingBox().b + (double) this.vehicle.length, this.vehicle.locZ, this.yaw, this.pitch);
+ this.vehicle.passenger = null;
+ this.vehicle = null;
+ }
+ return;
}
- return;
}
}
// CraftBukkit end
- // Spigot Start
- if ( entity.world.isChunkLoaded( (int) entity.locX >> 4, (int) entity.locZ >> 4, true ) )
- {
- org.spigotmc.event.entity.EntityMountEvent event = new org.spigotmc.event.entity.EntityMountEvent( this.getBukkitEntity(), entity.getBukkitEntity() );
- pluginManager.callEvent( event );
- if ( event.isCancelled() )
- {
- return;
- }
- }
- // Spigot End
if (this.vehicle != null) {
this.vehicle.passenger = null;
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index b861dbe..96b3905 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -21,6 +21,7 @@ import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.event.vehicle.VehicleExitEvent;
+import org.spigotmc.event.entity.EntityDismountEvent;
// CraftBukkit end
import org.bukkit.craftbukkit.SpigotTimings; // Spigot
@@ -1725,8 +1726,15 @@ public abstract class EntityLiving extends Entity {
return;
}
}
+
+ EntityDismountEvent event = new EntityDismountEvent(this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity);
+ getBukkitEntity().getServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled() || vehicle != originalVehicle) {
+ return;
+ }
// CraftBukkit end
-
+
if (!this.world.isClientSide) {
this.q(this.vehicle);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index efbf1a8..dbc7b54 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1,6 +1,7 @@
package org.bukkit.craftbukkit.entity;
import com.google.common.base.Preconditions;
+import com.google.common.primitives.Doubles;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -234,6 +235,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
// If this entity is riding another entity, we must dismount before teleporting.
entity.mount(null);
+ if (!Doubles.isFinite(location.getX()) || !Doubles.isFinite(location.getY()) || !Doubles.isFinite(location.getZ()))
+ {
+ Thread.dumpStack();
+ return false;
+ }
+
// Spigot start
if (!location.getWorld().equals(getWorld())) {
entity.teleportTo(location, cause.equals(TeleportCause.NETHER_PORTAL));
--
1.9.5.msysgit.0

Binary file not shown.

View File

@ -624,4 +624,30 @@ public class UtilBlock
return block.getTypeId();
}
}
public 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

@ -277,7 +277,7 @@ public enum Achievement
//Champions
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 int[]{80},
AchievementCategory.CHAMPIONS),
@ -295,43 +295,43 @@ public enum Achievement
AchievementCategory.CHAMPIONS),
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 int[]{40},
AchievementCategory.CHAMPIONS),
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 int[]{1},
AchievementCategory.CHAMPIONS),
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 int[]{1},
AchievementCategory.CHAMPIONS),
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 int[]{1},
AchievementCategory.CHAMPIONS),
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 int[]{20},
AchievementCategory.CHAMPIONS),
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 int[]{1},
AchievementCategory.CHAMPIONS),
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 int[]{1},
AchievementCategory.CHAMPIONS),

View File

@ -78,7 +78,7 @@ public enum AchievementCategory
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED },
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") },
Material.BEACON, 0, GameCategory.CHAMPIONS, "Extra Class Skills"),

View File

@ -2,11 +2,8 @@ package mineplex.core.hologram;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map.Entry;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
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.
*/
private ArrayList<Entry<Integer, Integer>> _entityIds = new ArrayList<Entry<Integer, Integer>>();
private ArrayList<Integer> _entityIds = new ArrayList<Integer>();
private Entity _followEntity;
private HologramManager _hologramManager;
private String[] _hologramText = new String[0];
@ -53,6 +50,7 @@ public class Hologram
private int _viewDistance = 70;
protected Vector relativeToEntity;
private boolean _hideBoundingBox;
private HologramInteraction _interaction;
public Hologram(HologramManager hologramManager, Location location, String... text)
{
@ -61,6 +59,18 @@ public class Hologram
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
*/
@ -151,6 +161,7 @@ public class Hologram
nearbyPlayers.add(player);
}
}
return nearbyPlayers;
}
@ -229,9 +240,7 @@ public class Hologram
for (int i = 0; i < _entityIds.size(); i++)
{
Entry<Integer, Integer> entry = _entityIds.get(i);
entityIds1_8[i] = entry.getKey();
entityIds1_8[i] = _entityIds.get(i);
}
_destroy1_8 = new PacketPlayOutEntityDestroy(entityIds1_8);
@ -247,7 +256,7 @@ public class Hologram
for (int i = _entityIds.size(); i < _hologramText.length; i++)
{
_entityIds.add(new HashMap.SimpleEntry(UtilEnt.getNewEntityId(), UtilEnt.getNewEntityId()));
_entityIds.add(UtilEnt.getNewEntityId());
}
}
else
@ -261,9 +270,7 @@ public class Hologram
}
for (int textRow = 0; textRow < _hologramText.length; textRow++)
{
Entry<Integer, Integer> entityIds = this._entityIds.get(textRow);
Packet[] packets1_8 = makeSpawnPackets1_8(textRow, entityIds.getKey(), _hologramText[textRow]);
Packet[] packets1_8 = makeSpawnPackets1_8(textRow, _entityIds.get(textRow), _hologramText[textRow]);
for (int i = 0; i < packets1_8.length; i++)
{
@ -326,8 +333,7 @@ public class Hologram
public Hologram setFollowEntity(Entity entityToFollow)
{
_followEntity = entityToFollow;
relativeToEntity = entityToFollow == null ? null : this._location.clone().subtract(entityToFollow.getLocation())
.toVector();
relativeToEntity = entityToFollow == null ? null : _location.clone().subtract(entityToFollow.getLocation()).toVector();
return this;
}
@ -340,7 +346,7 @@ public class Hologram
*/
public Hologram setHologramTarget(HologramTarget newTarget)
{
this._target = newTarget;
_target = newTarget;
return this;
}
@ -405,11 +411,11 @@ public class Hologram
if (x >= -128 && x <= 127 && y >= -128 && y <= 127 && z >= -128 && z <= 127)
{
_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();
relMove.a = entityId.getKey();
relMove.a = entityId;
relMove.b = (byte) x;
relMove.c = (byte) y;
relMove.d = (byte) z;
@ -425,13 +431,12 @@ public class Hologram
_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();
teleportPacket.a = entityId.getKey();
teleportPacket.a = entityId;
teleportPacket.b = x;
teleportPacket.c = (int) Math
.floor((oldLocation.getY() + (-2.1) + ((double) i * 0.285)) * 32);
teleportPacket.c = (int) Math.floor((oldLocation.getY() + (-2.1) + ((double) i * 0.285)) * 32);
teleportPacket.d = z;
packets1_8[i] = teleportPacket;
@ -458,6 +463,11 @@ public class Hologram
return this;
}
public boolean isEntityId(int entityId)
{
return _entityIds.contains(entityId);
}
/**
* Set the hologram text
*/
@ -491,28 +501,28 @@ public class Hologram
{
// Add entity id and send spawn packets
// You add a entity id because the new hologram needs
Entry<Integer, Integer> entry = new HashMap.SimpleEntry(UtilEnt.getNewEntityId(), UtilEnt.getNewEntityId());
_entityIds.add(entry);
int entityId = UtilEnt.getNewEntityId();
_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
else if (i >= newText.length)
{
// 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[destroy1_8.length - 1] = entry.getKey();
destroy1_8[destroy1_8.length - 1] = entityId;
}
else if (!newText[i].equals(_hologramText[i]))
{
// Send update metadata packets
Entry<Integer, Integer> entry = _entityIds.get(i);
Integer entityId = _entityIds.get(i);
PacketPlayOutEntityMetadata metadata1_8 = new PacketPlayOutEntityMetadata();
metadata1_8.a = entry.getKey();
metadata1_8.a = entityId;
DataWatcher watcher1_8 = new DataWatcher(null);
@ -552,7 +562,7 @@ public class Hologram
*/
public Hologram setViewDistance(int newDistance)
{
this._viewDistance = newDistance;
_viewDistance = newDistance;
return setLocation(getLocation());
}
@ -593,6 +603,7 @@ public class Hologram
_playersTracking.clear();
_lastMovement = null;
}
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 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.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.World;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.plugin.java.JavaPlugin;
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)
{
Bukkit.getPluginManager().registerEvents(this, arcadeManager);
}
public HologramManager(JavaPlugin arcadeManager, PacketHandler packetHandler)
{
Bukkit.getPluginManager().registerEvents(this, arcadeManager);
packetHandler.addPacketHandler(this, true, PacketPlayInUseEntity.class);
}
void addHologram(Hologram hologram)
{
_activeHolograms.add(hologram);
}
void addHologram(Hologram hologram)
{
_activeHolograms.add(hologram);
}
void removeHologram(Hologram hologram)
{
_activeHolograms.remove(hologram);
}
void removeHologram(Hologram hologram)
{
_activeHolograms.remove(hologram);
}
@EventHandler(priority = EventPriority.LOWEST)
public void onTick(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK || _activeHolograms.isEmpty())
return;
List<World> worlds = Bukkit.getWorlds();
Iterator<Hologram> itel = _activeHolograms.iterator();
while (itel.hasNext())
{
Hologram hologram = itel.next();
if (!worlds.contains(hologram.getLocation().getWorld()))
{
itel.remove();
hologram.stop();
}
else
{
if (hologram.getEntityFollowing() != null)
{
Entity following = hologram.getEntityFollowing();
if (hologram.isRemoveOnEntityDeath() && !following.isValid())
{
itel.remove();
hologram.stop();
continue;
}
if (!hologram.relativeToEntity.equals(following.getLocation().subtract(hologram.getLocation()).toVector()))
{
// 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();
hologram.setLocation(following.getLocation().add(hologram.relativeToEntity));
hologram.relativeToEntity = vec;
continue; // No need to do the rest of the code as setLocation does it.
}
}
ArrayList<Player> canSee = hologram.getNearbyPlayers();
Iterator<Player> itel2 = hologram.getPlayersTracking().iterator();
while (itel2.hasNext())
{
Player player = itel2.next();
if (!canSee.contains(player))
{
itel2.remove();
if (player.getWorld() == hologram.getLocation().getWorld())
{
UtilPlayer.sendPacket(player, hologram.getDestroyPacket());
}
}
}
for (Player player : canSee)
@EventHandler(priority = EventPriority.LOWEST)
public void onTick(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK || _activeHolograms.isEmpty())
return;
List<World> worlds = Bukkit.getWorlds();
Iterator<Hologram> itel = _activeHolograms.iterator();
while (itel.hasNext())
{
Hologram hologram = itel.next();
if (!worlds.contains(hologram.getLocation().getWorld()))
{
itel.remove();
hologram.stop();
}
else
{
if (hologram.getEntityFollowing() != null)
{
Entity following = hologram.getEntityFollowing();
if (hologram.isRemoveOnEntityDeath() && !following.isValid())
{
itel.remove();
hologram.stop();
continue;
}
if (!hologram.relativeToEntity.equals(following.getLocation().subtract(hologram.getLocation()).toVector()))
{
// 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();
hologram.setLocation(following.getLocation().add(hologram.relativeToEntity));
hologram.relativeToEntity = vec;
continue; // No need to do the rest of the code as setLocation does it.
}
}
ArrayList<Player> canSee = hologram.getNearbyPlayers();
Iterator<Player> itel2 = hologram.getPlayersTracking().iterator();
while (itel2.hasNext())
{
Player player = itel2.next();
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))
{
@ -96,8 +112,28 @@ public class HologramManager implements Listener
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

@ -97,11 +97,11 @@ public class LagMeter extends MiniPlugin
_count++;
if (System.currentTimeMillis() - _start > 60000)
if (System.currentTimeMillis() - _start > 30000)
{
if (_timingsRunning)
{
if (_ticksPerSecond > 15 || System.currentTimeMillis() - _timingsStarted > 60000)
if (System.currentTimeMillis() - _timingsStarted > 30000)
{
getPlugin().getServer().dispatchCommand(Bukkit.getConsoleSender(), "timings paste");
_timingsRunning = false;

View File

@ -12,6 +12,7 @@ import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.event.GadgetBlockEvent;
import mineplex.core.hologram.Hologram;
import mineplex.core.hologram.HologramInteraction;
import mineplex.core.hologram.HologramManager;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.reward.Reward;
@ -32,6 +33,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.event.inventory.InventoryOpenEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerMoveEvent;
@ -63,7 +65,20 @@ public class TreasureLocation implements Listener
_hologramManager = hologramManager;
_statusManager = statusManager;
_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);
_shop = new TreasureShop(treasureManager, _inventoryManager, clientManager, donationManager, this);
}

View File

@ -130,8 +130,10 @@ public class Hub extends JavaPlugin implements IRelation
PartyManager partyManager = new PartyManager(this, portal, clientManager, preferenceManager);
SkillConditionManager conditionManager = new SkillConditionManager(this);
PersonalServerManager personalServerManager = new PersonalServerManager(this, clientManager);
HubManager hubManager = new HubManager(this, blockRestore, clientManager, donationManager, inventoryManager, new ConditionManager(this), 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);
@ -157,9 +159,11 @@ public class Hub extends JavaPlugin implements IRelation
CombatManager combatManager = new CombatManager(this);
ProjectileManager throwManager = new ProjectileManager(this);
SkillConditionManager conditionManager = new SkillConditionManager(this);
DamageManager damage = new DamageManager(this, combatManager, npcManager, disguiseManager, conditionManager);
conditionManager.setDamageManager(damage);
Fire fire = new Fire(this, conditionManager, damage);
Teleport teleport = new Teleport(this);
Energy energy = new Energy(this);

View File

@ -27,6 +27,7 @@ public enum GameType
Draw("Draw My Thing"),
Evolution("Evolution"),
FlappyBird("Flappy Bird"),
Gladiators("Gladiators"),
Gravity("Gravity"),
Halloween("Halloween Horror"),
HideSeek("Block Hunt"),

View File

@ -90,6 +90,13 @@ public class Assassin extends Skill
event.AddMod(null, GetName(), -1.5, false);
}
@EventHandler
public void CancelEnergy(EnergyEvent event)
{
if (getLevel(event.GetPlayer()) > 0)
event.setCancelled(true);
}
@Override
public void Reset(Player player)
{

View File

@ -1,6 +1,8 @@
package mineplex.minecraft.game.classcombat.Skill.Assassin;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import org.bukkit.Effect;
import org.bukkit.Location;
@ -24,6 +26,7 @@ import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
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.ViewDist;
import mineplex.minecraft.game.classcombat.Skill.SkillActive;
@ -31,7 +34,7 @@ import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
public class Evade extends SkillActive
{
private HashSet<Player> _active = new HashSet<Player>();
private HashMap<Player, Long> _active = new HashMap<Player, Long>();
public Evade(SkillFactory skills, String name, ClassType classType, SkillType skillType,
int cost, int levels,
@ -56,12 +59,6 @@ public class Evade extends SkillActive
});
}
@Override
public String GetEnergyString()
{
return "Energy: #26#-2 and #18#-2 per Second";
}
@Override
public boolean CustomCheck(Player player, int level)
{
@ -77,36 +74,12 @@ public class Evade extends SkillActive
@Override
public void Skill(Player player, int level)
{
_active.add(player);
_active.put(player, System.currentTimeMillis());
//Inform
UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared to " + F.skill(GetName()) + "."));
}
@EventHandler
public void Energy(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player cur : GetUsers())
{
if (!_active.contains(cur))
continue;
if (!cur.isBlocking())
{
_active.remove(cur);
continue;
}
if (!Factory.Energy().Use(cur, GetName(), 0.9 - (getLevel(cur) * 0.1), true, true))
{
_active.remove(cur);
}
}
}
@EventHandler(priority = EventPriority.NORMAL)
public void Damage(CustomDamageEvent event)
{
@ -125,7 +98,7 @@ public class Evade extends SkillActive
return;
//Active
if (!_active.contains(damagee))
if (!_active.containsKey(damagee))
return;
//Damager
@ -136,9 +109,6 @@ public class Evade extends SkillActive
int level = getLevel(damagee);
if (level == 0) return;
if (!mineplex.core.recharge.Recharge.Instance.use(damagee, GetName(), 500, false, false))
return;
//Cancel
event.SetCancelled(GetName());
@ -230,4 +200,24 @@ public class Evade extends SkillActive
{
_active.remove(player);
}
@EventHandler
public void clean(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
Iterator<Player> activeIter = _active.keySet().iterator();
while (activeIter.hasNext())
{
Player player = activeIter.next();
if (!player.isOnline() || !player.isBlocking() || UtilTime.elapsed(_active.get(player), 750))
{
activeIter.remove();
UtilPlayer.message(player, F.main(GetClassType().name(), "You failed to " + F.skill(GetName()) + "."));
}
}
}
}

View File

@ -77,12 +77,6 @@ public class Illusion extends SkillActive
setAchievementSkill(true);
}
@Override
public String GetEnergyString()
{
return "Energy: #40#-3 and #12.5#-0.5 per Second";
}
@Override
public boolean CustomCheck(Player player, int level)
{
@ -107,8 +101,8 @@ public class Illusion extends SkillActive
UtilEnt.Vegetate(skel);
UtilEnt.silence(skel, true);
skel.setMaxHealth(7);
skel.setHealth(7);
skel.setMaxHealth(14);
skel.setHealth(14);
ClassCombatCreatureAllowSpawnEvent disableEvent = new ClassCombatCreatureAllowSpawnEvent(false);
UtilServer.getServer().getPluginManager().callEvent(disableEvent);

View File

@ -39,8 +39,8 @@ public class Leap extends SkillActive
"Take a great leap forwards.",
"",
"Wall Kick by using Leap with your",
"back against a wall. This uses no",
"Energy or Recharge.",
"back against a wall. This doesn't",
"trigger Leaps Recharge.",
"",
"Cannot be used while Slowed."
});

View File

@ -41,8 +41,9 @@ public class Recall extends Skill
{
"Drop Axe/Sword to Use.",
"",
"Instantly teleport back to where",
"you were #2#2 seconds ago.",
"Go back in time #2#2 seconds,",
"restoring your location and",
"up to #3#1 health."
});
}
@ -85,7 +86,8 @@ public class Recall extends Skill
return;
//Heal
player.setHealth(health.getLast());
double newHealth = Math.min(health.getLast(), player.getHealth() + 3 + level);
player.setHealth(newHealth);
//Effect
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f);

View File

@ -22,7 +22,8 @@ public class ViperStrikes extends Skill
SetDesc(new String[]
{
"Your attacks give enemies",
"Poison 1 for #1#2 seconds."
"Shock, Slow 1 and Poison 1",
"for #0#1 seconds."
});
}
@ -48,10 +49,8 @@ public class ViperStrikes extends Skill
if (damagee == null) return;
//Confuse
Factory.Condition().Factory().Poison(GetName(), damagee, damager, 1 + 2*level, 0, false, false, false);
//Damage
//event.AddMod(damager.getName(), GetName(), -1 - level, true);
Factory.Condition().Factory().PoisonShock(GetName(), damagee, damager, level, false);
Factory.Condition().Factory().Slow(GetName(), damagee, damager, level, 0, false, false, true, false);
//Sound
damager.getWorld().playSound(damager.getLocation(), Sound.SPIDER_IDLE, 1f, 2f);

View File

@ -64,7 +64,7 @@ public class BlockToss extends SkillCharge implements IThrown
@Override
public String GetRechargeString()
{
return "Recharge: " + "#" + UtilMath.trim(1, 4000/1000d) + "#" + UtilMath.trim(1, -500/1000d) + " Seconds";
return "Recharge: " + "#4#-0.5 Seconds";
}
@EventHandler
@ -92,6 +92,10 @@ public class BlockToss extends SkillCharge implements IThrown
int level = getLevel(player);
if (level == 0) return;
//Recharge
if (!Recharge.Instance.usable(player, GetName()))
return;
//Water
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9)
{
@ -100,11 +104,7 @@ public class BlockToss extends SkillCharge implements IThrown
}
Block grab = event.getClickedBlock();
//Recharge
if (!Recharge.Instance.use(player, GetName(), 1000, false, false))
return;
//Door and Banner
if (grab.getRelative(BlockFace.UP).getTypeId() == 64 || grab.getRelative(BlockFace.UP).getTypeId() == 71 || grab.getRelative(BlockFace.UP).getType() == Material.STANDING_BANNER)
{
@ -202,6 +202,9 @@ public class BlockToss extends SkillCharge implements IThrown
for (Player cur : throwSet)
{
Recharge.Instance.recharge(cur, GetName());
Recharge.Instance.use(cur, GetName(), 4000 - (500 * getLevel(cur)), false, true);
FallingBlock block = _holding.remove(cur);
float charge = _charge.remove(cur);

View File

@ -36,7 +36,7 @@ public class Colossus extends Skill
//Damage
event.AddMod(damagee.getName(), GetName(), 0, false);
event.AddKnockback(GetName(), 0.35);
event.AddKnockback(GetName(), 0.65);
}
@Override

View File

@ -14,6 +14,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.vehicle.VehicleExitEvent;
import org.spigotmc.event.entity.EntityDismountEvent;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
@ -115,19 +116,23 @@ public class DwarfToss extends SkillActive
return true;
}
//getEntity is the vehicle
@EventHandler
public void PreventDismount(VehicleExitEvent event)
public void PreventDismount(EntityDismountEvent event)
{
if (event.isCancelled())
return;
if (!(event.getExited() instanceof Player))
System.out.println(UtilEnt.getName(event.getDismounted()));
System.out.println(UtilEnt.getName(event.getEntity()));
if (!(event.getDismounted() instanceof Player))
return;
if (!(event.getVehicle() instanceof Player))
if (!(event.getEntity() instanceof Player))
return;
if (_holding.containsKey((Player)event.getVehicle()) && _holding.get((Player)event.getVehicle()) == event.getExited())
if (_holding.containsKey((Player)event.getEntity()) && _holding.get((Player)event.getEntity()) == event.getDismounted())
event.setCancelled(true);
}

View File

@ -44,7 +44,7 @@ public class HoldPosition extends SkillActive
SetDesc(new String[]
{
"Hold your position, gaining",
"Protection 3, Slow 4 and no",
"Protection 3, Slow 3 and no",
"knockback for #3#1 seconds."
});
}
@ -69,7 +69,7 @@ public class HoldPosition extends SkillActive
//Action
Factory.Condition().Factory().Slow(GetName(), player, player, duration, 2, false, true, false, true);
Factory.Condition().Factory().Protection(GetName(), player, player, duration, 2, false, false, true);
Factory.Condition().Factory().Jump(GetName(), player, player, duration, 250, false, false, true);
Factory.Condition().Factory().ArcadeHungerDisable(GetName(), player, player, duration, false);
//Inform
UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + "."));
@ -119,6 +119,9 @@ public class HoldPosition extends SkillActive
UtilParticle.PlayParticle(ParticleType.MOB_SPELL, player.getLocation(),
(float)(Math.random() - 0.5), 0.2f + (float)(Math.random() * 1), (float)(Math.random() - 0.5), 0, 3 + getLevel(player),
ViewDist.NORMAL, UtilServer.getPlayers());
player.setFoodLevel(2);
player.setSprinting(false);
}
}

View File

@ -119,7 +119,7 @@ public class Riposte extends SkillActive
//Effect
damager.getWorld().playSound(damager.getLocation(), Sound.ZOMBIE_METAL, 0.5f, 1.6f);
Factory.Condition().Factory().Invulnerable(GetName(), damagee, damagee, 0.4, false, false);
Factory.Condition().Factory().Invulnerable(GetName(), damagee, damagee, 0.3, false, false);
//Inform
UtilPlayer.message(damagee, F.main(GetClassType().name(), "You parried with " + F.skill(GetName(level)) + "."));

View File

@ -128,7 +128,7 @@ public class Disengage extends SkillActive
//Condition
Factory.Condition().Factory().Slow(GetName(), damager, damagee, 2.5 + (0.5 * level), 3, false, true, true, true);
Factory.Condition().Factory().Invulnerable(GetName(), damagee, damagee, 1, false, false);
Factory.Condition().Factory().Invulnerable(GetName(), damagee, damagee, 0.3, false, false);
_fall.put(damagee, System.currentTimeMillis());

View File

@ -61,7 +61,9 @@ public class HealingShot extends SkillActive
"Regeneration 3 for #3#1 seconds,",
"and remove all negative effects.",
"",
"Gives Nausea to enemies for #5#1 seconds."
"Self hits give Regeneration 2.",
"",
"Gives Nausea to enemies for #5#1 seconds.",
});
}
@ -153,9 +155,9 @@ public class HealingShot extends SkillActive
projectile.remove();
//Regen
if (!Factory.Relation().canHurt(damager, damagee))
if (!Factory.Relation().canHurt(damager, damagee) || damager.equals(damagee))
{
Factory.Condition().Factory().Regen(GetName(), damagee, damager, 3 + level, 2, false, false, false);
Factory.Condition().Factory().Regen(GetName(), damagee, damager, 3 + level, damager.equals(damagee) ? 1 : 2, false, false, false);
//Remove Bad
damagee.setFireTicks(0);

View File

@ -40,8 +40,9 @@ public class HeavyArrows extends Skill
"an additional #10#10 % knockback",
"as well as #1#1 additional damage.",
"",
"You also receive #10#10 % knockback",
"when firing arrows if not sneaking.",
"You also receive #12#6 % reversed",
"velocity of your arrows while not",
"sneaking.",
});
}
@ -63,7 +64,7 @@ public class HeavyArrows extends Skill
//Backboost
if (!player.isSneaking() && Recharge.Instance.use(player, GetName(), 750, false, false))
{
double vel = (event.getProjectile().getVelocity().length() * (0.1 + 0.1 * level));
double vel = (event.getProjectile().getVelocity().length() * (0.12 + 0.06 * level));
UtilAction.velocity(player, player.getLocation().getDirection().multiply(-1), vel,
false, 0, 0.3, 0.6, true);
}

View File

@ -25,7 +25,7 @@ public class Longshot extends Skill
SetDesc(new String[]
{
"Arrows do an additional 1 damage",
"for every #4#-0.5 Blocks they travelled,",
"for every #4.5#-0.5 Blocks they travelled,",
"however, their base damage is",
"reduced by 5.",
"",
@ -74,7 +74,7 @@ public class Longshot extends Skill
double length = UtilMath.offset(loc, projectile.getLocation());
// Damage
double damage = Math.min(6 + 6 * level, (length / (4 - 0.5 * level)) - 5);
double damage = Math.min(6 + 6 * level, (length / (4.5 - 0.5 * level)) - 5);
if (damage < 0)
damage = 0;

View File

@ -49,7 +49,7 @@ public class Overcharge extends SkillChargeBow
@Override
public void DoSkillCustom(Player player, float charge, Arrow arrow)
{
double damage = charge * (getLevel(player));
double damage = charge * (1.5 + 1.5 * getLevel(player));
_arrows.put(arrow, damage);
}

View File

@ -9,6 +9,7 @@ import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
@ -78,25 +79,26 @@ public class Sharpshooter extends Skill
if (event.GetDamagerEntity(true) != null && event.GetDamagerEntity(true).equals(event.GetDamageeEntity()))
return;
int bonus = 1;
int bonus = 0;
if (_hitCount.containsKey(player))
bonus = _hitCount.get(player);
//Increase
bonus = Math.min(bonus + 1, 2 * level);
_hitCount.put(player, bonus);
//Damage
event.AddMod(player.getName(), GetName(), bonus, true);
//Increase
bonus = Math.min(bonus + 1, 2 * level);
_hitCount.put(player, bonus);
//Inform
UtilPlayer.message((Entity)projectile.getShooter(), F.main(GetClassType().name(), GetName() + ": " +
F.elem(bonus + " Consecutive Hits") + C.cGray + " (" + F.skill("+" + bonus + "Damage" ) + C.cGray + ")" ) );
UtilPlayer.message(event.GetDamagerPlayer(true), F.main(GetClassType().name(), GetName() + ": " +
F.elem(bonus + " Consecutive Hits") + C.cGray + " (" + F.skill("+" + bonus + " Damage" ) + C.cGray + ")" ) );
player.playSound(player.getLocation(), Sound.NOTE_PLING, 1f, 0.8f + (float)(bonus * 0.2));
projectile.remove();
Recharge.Instance.useForce(player, GetName() + " Timer", 5000);
}
@EventHandler

View File

@ -38,7 +38,7 @@ public class VitalitySpores extends Skill
@EventHandler
public void playerMove(PlayerMoveEvent event)
{
if (UtilMath.offset(event.getFrom(), event.getTo()) > 0)
if (doesUserHaveSkill(event.getPlayer()) && UtilMath.offset(event.getFrom(), event.getTo()) > 0)
_lastMove.put(event.getPlayer(), System.currentTimeMillis());
}
@ -71,6 +71,6 @@ public class VitalitySpores extends Skill
@Override
public void Reset(Player player)
{
_lastMove.remove(player);
}
}

View File

@ -45,7 +45,7 @@ public class WolfsPounce extends SkillChargeSword
"Taking damage cancels charge.",
"",
"Colliding with another player",
"mid-air deals up to 6 damage",
"mid-air deals up to #4#1 damage",
"and Slow 2 for 3 seconds."
});
@ -61,7 +61,7 @@ public class WolfsPounce extends SkillChargeSword
public void DoSkillCustom(Player player, float charge)
{
//Action
UtilAction.velocity(player, 0.4 + (1.4*charge), 0.2, 0.3 + (0.8*charge), true);
UtilAction.velocity(player, 0.4 + (1.4*charge), 0.2, 0.4 + (0.9*charge), true);
_live.put(player, System.currentTimeMillis());
//Inform
@ -128,7 +128,7 @@ public class WolfsPounce extends SkillChargeSword
if (_chargeStore.containsKey(damager))
charge = _chargeStore.remove(damager);
int damage = (int)(6 * charge);
int damage = (int)((4 + getLevel(damager)) * charge);
//Damage Event
Factory.Damage().NewDamageEvent(damagee, damager, null,

View File

@ -257,6 +257,11 @@ public abstract class Skill implements ISkill, Listener
return null;
}
protected boolean doesUserHaveSkill(Player player)
{
return _users.containsKey(player);
}
@Override
public Set<Player> GetUsers()
{

View File

@ -236,14 +236,14 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
//Sword
AddSkill(new Evade(this, "Evade", ClassType.Assassin, SkillType.Sword,
1, 4,
26, -2,
0, 0, true,
0, 0,
6500, -500, true,
new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD},
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
AddSkill(new Illusion(this, "Illusion", ClassType.Assassin, SkillType.Sword,
1, 4,
50, -4,
0, 0,
17000, -1000, true,
new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD},
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
@ -251,21 +251,21 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
//Axe
AddSkill(new Blink(this, "Blink", ClassType.Assassin, SkillType.Axe,
1, 4,
64, -4,
0, 0,
12000, 0, true,
new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE},
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
AddSkill(new Flash(this, "Flash", ClassType.Assassin, SkillType.Axe,
1, 4,
30, -2,
0, 0,
0, 0, true,
new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE},
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
AddSkill(new Leap(this, "Leap", ClassType.Assassin, SkillType.Axe,
1, 4,
36, -3,
0, 0,
10500, -1500, true,
new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE},
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
@ -273,21 +273,21 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
//Bow
AddSkill(new MarkedForDeath(this, "Marked for Death", ClassType.Assassin, SkillType.Bow,
1, 4,
40, 0,
0, 0,
20000, -2000, true,
new Material[] {Material.BOW},
new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK}));
AddSkill(new SmokeArrow(this, "Smoke Arrow", ClassType.Assassin, SkillType.Bow,
1, 4,
40, 0,
0, 0,
20000, -2000, true,
new Material[] {Material.BOW},
new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK}));
AddSkill(new SilencingArrow(this, "Silencing Arrow", ClassType.Assassin, SkillType.Bow,
1, 4,
40, 0,
0, 0,
20000, -2000, true,
new Material[] {Material.BOW},
new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK}));
@ -330,21 +330,21 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
AddSkill(new SeismicSlam(this, "Seismic Slam", ClassType.Brute, SkillType.Axe,
1, 5,
0, 0,
24000, -2000, true,
21000, -1000, true,
new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE},
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
AddSkill(new Takedown(this, "Takedown", ClassType.Brute, SkillType.Axe,
1, 5,
0, 0,
24000, -2000, true,
21000, -1000, true,
new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE},
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
AddSkill(new WhirlwindAxe(this, "Whirlwind Axe", ClassType.Brute, SkillType.Axe,
1, 5,
0, 0,
24000, -2000, true,
21000, -1000, true,
new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE},
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
@ -411,7 +411,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
AddSkill(new AxeThrow(this, "Roped Axe Throw", ClassType.Knight, SkillType.Axe,
1, 5,
0, 0,
2200, -200, true,
3300, -300, true,
new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE},
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));

View File

@ -12,6 +12,7 @@ public class Condition
{
CLOAK,
SHOCK,
POISON_SHOCK,
SILENCE,
BURNING,
FALLING,
@ -19,6 +20,7 @@ public class Condition
INVULNERABLE,
EXPLOSION,
FIRE_ITEM_IMMUNITY,
ARCADE_HUNGER_DISABLE,
CUSTOM,

View File

@ -346,16 +346,42 @@ public class ConditionEffect implements Listener
LivingEntity ent = event.GetDamageeEntity();
if (ent == null) return;
//Ignore Poison Shock
Condition poisonShock = Manager.GetActiveCondition(ent, ConditionType.POISON_SHOCK);
if (poisonShock != null)
{
event.SetCancelled("Poison Shock - Poison Cancel");
return;
}
Condition condition = Manager.GetActiveCondition(ent, ConditionType.POISON);
if (condition == null) return;
if (condition == null)
return;
//Damage
event.SetDamager(condition.GetSource());
event.AddMod(UtilEnt.getName(condition.GetSource()), condition.GetReason(), 0, true);
event.SetIgnoreArmor(true);
event.SetKnockback(false);
}
@EventHandler
public void PoisonShock(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (LivingEntity ent : Manager.GetActiveConditions().keySet())
{
Condition condition = Manager.GetActiveCondition(ent, ConditionType.POISON_SHOCK);
if (condition == null)
continue;
Manager.getDamagerManager().NewDamageEvent(ent, condition.GetSource(), null,
DamageCause.CUSTOM, 0.1, false, true, false,
condition.GetSource().getName(), "Poison");
}
}
@EventHandler
public void Fall(CustomDamageEvent event)

View File

@ -246,6 +246,14 @@ public class ConditionFactory
Material.SLIME_BALL, (byte)14, showIndicator, ambient));
}
public Condition PoisonShock(String reason, LivingEntity ent, LivingEntity source,
double duration, boolean extend)
{
return Manager.AddCondition(new Condition(Manager, reason, ent, source,
ConditionType.POISON_SHOCK, 0, (int)(20 * duration), extend,
Material.SLIME_BALL, (byte)14, false, false));
}
public Condition Confuse(String reason, LivingEntity ent, LivingEntity source,
double duration, int mult, boolean extend, boolean showIndicator, boolean ambient)
{
@ -277,4 +285,12 @@ public class ConditionFactory
ConditionType.HEALTH_BOOST, mult, (int)(20 * duration), extend,
Material.APPLE, (byte)0, showIndicator, ambient));
}
public Condition ArcadeHungerDisable(String reason, LivingEntity ent, LivingEntity source,
double duration, boolean extend)
{
return Manager.AddCondition(new Condition(Manager, reason, ent, source,
ConditionType.ARCADE_HUNGER_DISABLE, 0, (int)(20 * duration), extend,
Material.COAL, (byte)0, false, false));
}
}

View File

@ -18,6 +18,7 @@ import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilTime.TimeUnit;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.condition.events.ConditionApplyEvent;
import mineplex.minecraft.game.core.damage.DamageManager;
import org.bukkit.Material;
import org.bukkit.Sound;
@ -39,6 +40,8 @@ public class ConditionManager extends MiniPlugin
private ConditionFactory _factory;
private ConditionApplicator _applicator;
protected ConditionEffect Effect;
private DamageManager _damageManager;
private WeakHashMap<LivingEntity, LinkedList<Condition>> _conditions = new WeakHashMap<LivingEntity, LinkedList<Condition>>();
private WeakHashMap<LivingEntity, LinkedList<ConditionActive>> _activeConditions = new WeakHashMap<LivingEntity, LinkedList<ConditionActive>>();
@ -53,6 +56,16 @@ public class ConditionManager extends MiniPlugin
Applicator();
Effect();
}
public void setDamageManager(DamageManager damageManager)
{
_damageManager = damageManager;
}
public DamageManager getDamagerManager()
{
return _damageManager;
}
public ConditionFactory Factory()
{

View File

@ -136,7 +136,7 @@ public class Arcade extends JavaPlugin
BlockRestore blockRestore = new BlockRestore(this);
ProjectileManager projectileManager = new ProjectileManager(this);
HologramManager hologramManager = new HologramManager(this);
HologramManager hologramManager = new HologramManager(this, packetHandler);
//Inventory
InventoryManager inventoryManager = new InventoryManager(this, _clientManager);

View File

@ -253,6 +253,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
_damageManager = damageManager;
_damageManager.UseSimpleWeaponDamage = true;
_damageManager.setConditionManager(_conditionManager);
_conditionManager.setDamageManager(_damageManager);
_disguiseManager = disguiseManager;

View File

@ -91,7 +91,7 @@ public enum GameType
Lobbers(BombLobbers.class, GameDisplay.Lobbers),
Micro(Micro.class, GameDisplay.Micro),
MilkCow(MilkCow.class, GameDisplay.MilkCow),
MineStrike(MineStrike.class, GameDisplay.MineStrike, "http://chivebox.com/file/c/ResMinestrike.zip", true),
MineStrike(MineStrike.class, GameDisplay.MineStrike, "http://chivebox.com/mineplex/ResMinestrike.zip", true),
MineWare(MineWare.class, GameDisplay.MineWare),
OldMineWare(OldMineWare.class, GameDisplay.OldMineWare),
Paintball(Paintball.class, GameDisplay.Paintball),

View File

@ -211,6 +211,7 @@ public class MineStrike extends TeamGame
private HashSet<Entity> _defusalDropped = new HashSet<Entity>();
private HashMap<Location, Long> _incendiary = new HashMap<Location, Long>();
private HashMap<Block, Long> _smokeBlocks = new HashMap<Block, Long>();
private Bomb _bomb = null;
private Item _bombItem = null;
@ -363,7 +364,7 @@ public class MineStrike extends TeamGame
event.getPlayer().getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, "Knife"));
//Armor
giveTeamArmor(event.getPlayer(), Color.fromRGB(255, 0, 0));
giveTeamArmor(event.getPlayer(), Color.fromRGB(255, 75, 75));
}
}
else if (team.GetColor() == ChatColor.AQUA)
@ -379,7 +380,7 @@ public class MineStrike extends TeamGame
event.getPlayer().getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, "Knife"));
//Armor
giveTeamArmor(event.getPlayer(), Color.fromRGB(0, 0, 255));
giveTeamArmor(event.getPlayer(), Color.fromRGB(125, 200, 255));
}
}
@ -612,6 +613,17 @@ public class MineStrike extends TeamGame
{
_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)
{
@ -728,7 +740,7 @@ public class MineStrike extends TeamGame
if (grenade == null)
return;
if (!UtilTime.elapsed(GetStateTime(), 15000))
if (!UtilTime.elapsed(GetStateTime(), 10000))
{
UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot throw Grenades yet."));
return;
@ -1233,8 +1245,6 @@ public class MineStrike extends TeamGame
//Effect
damagee.getWorld().playSound(damagee.getLocation(), Sound.IRONGOLEM_DEATH, 1f, 1f);
event.SetKnockback(false);
}
//Standard
else
@ -1243,9 +1253,9 @@ public class MineStrike extends TeamGame
event.AddMod(damager.getName(), "Knife", 6 - event.GetDamage(), false);
event.GetDamageeEntity().getWorld().playSound(event.GetDamageeEntity().getLocation(), Sound.BAT_HURT, 1f, 1f);
event.AddKnockback("Knife", 1.2);
}
event.SetKnockback(false);
}
}
@ -1307,12 +1317,11 @@ public class MineStrike extends TeamGame
if (Armor.isArmor(event.GetDamageePlayer().getInventory().getHelmet()) ||
(_scoped.containsKey(event.GetDamageePlayer()) && UtilGear.isMat(_scoped.get(event.GetDamageePlayer()), Material.LEATHER_HELMET)))
{
event.AddMod(event.GetDamageePlayer().getName(), "Helmet", -damage*1, false);
event.AddMod(event.GetDamageePlayer().getName(), "Helmet", -damage*0.5, false);
event.GetDamageePlayer().getWorld().playSound(event.GetDamageePlayer().getEyeLocation(), Sound.SPIDER_DEATH, 1f, 1f);
}
else
{
event.GetDamageePlayer().getWorld().playSound(event.GetDamageePlayer().getEyeLocation(), Sound.SLIME_ATTACK, 1f, 1f);
}
}
@ -1384,16 +1393,16 @@ public class MineStrike extends TeamGame
public boolean hitBody(Player player, Location loc)
{
return UtilMath.offset2d(loc, player.getLocation()) < 0.6 && //0.6 is ideal
loc.getY() > player.getLocation().getY() &&
loc.getY() < player.getEyeLocation().getY() - 0.1;
return UtilMath.offset2d(loc, player.getLocation()) < 0.6 &&
loc.getY() >= player.getLocation().getY() &&
loc.getY() <= player.getEyeLocation().getY();
}
public boolean hitHead(Player player, Location loc)
{
return UtilMath.offset2d(loc, player.getLocation()) < 0.2 && //0.3 was old value, too large
loc.getY() >= player.getEyeLocation().getY() - 0.1 &&
loc.getY() < player.getEyeLocation().getY() + 0.1; //0.2 was old value, too large
return UtilMath.offset2d(loc, player.getLocation()) < 0.2 &&
loc.getY() >= player.getEyeLocation().getY() + 0.0 &&
loc.getY() < player.getEyeLocation().getY() + 0.2;
}
@ -1420,6 +1429,9 @@ public class MineStrike extends TeamGame
if (event.GetLog().GetLastDamager().GetReason().contains("AWP"))
amount = 100;
else if (event.GetLog().GetLastDamager().GetReason().contains("PP-Bizon"))
amount = 600;
else if (event.GetLog().GetLastDamager().GetReason().contains("Nova"))
amount = 900;
@ -1492,14 +1504,6 @@ public class MineStrike extends TeamGame
UtilParticle.PlayParticle(ParticleType.CRIT, grenadeItem.getLocation(), 0, 0, 0, 0, 1,
ViewDist.NORMAL, UtilServer.getPlayers());
//Expired
if (!grenadeItem.isValid() || grenadeItem.getTicksLived() > 400)
{
grenadeItem.remove();
grenadeIterator.remove();
continue;
}
//Completed
Grenade grenade = _grenadesThrown.get(grenadeItem);
if (grenade.update(this, grenadeItem))
@ -1671,11 +1675,15 @@ public class MineStrike extends TeamGame
{
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))
continue;
if (UtilMath.offset(player.getLocation(), block.getLocation().add(0.5, 0, 0.5)) > 3)
continue;
@ -1716,15 +1724,19 @@ public class MineStrike extends TeamGame
if (_bombDefuser == null)
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)
{
_bombDefuser.setExp(0f);
_bombDefuser = null;
_bombDefuser = null;
return;
}
//Kit or Not?
float defuseRate = 0.005f;
if (UtilGear.isMat(_bombDefuser.getInventory().getItem(8), Material.SHEARS))
@ -2163,6 +2175,11 @@ public class MineStrike extends TeamGame
//Incendiary
_incendiary.clear();
Manager.GetBlockRestore().RestoreAll();
//Smoke
for (Block block : _smokeBlocks.keySet())
block.setType(Material.AIR);
_smokeBlocks.clear();
//Restock Ammo
for (Gun gun : _gunsEquipped.keySet())
@ -2414,6 +2431,47 @@ public class MineStrike extends TeamGame
loc.getWorld().playSound(loc, Sound.PIG_DEATH, 1f, 1f);
}
}
@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
public void bombBurnUpdate(UpdateEvent event)
@ -2722,7 +2780,7 @@ public class MineStrike extends TeamGame
public void fireDamage(CustomDamageEvent event)
{
if (event.GetCause() == DamageCause.FIRE)
event.AddMod(this.GetName(), "Fire", 3, false);
event.AddMod(this.GetName(), "Fire", 1, false);
}
@EventHandler
@ -3043,4 +3101,23 @@ public class MineStrike extends TeamGame
return SpectatorSpawn;
}
@EventHandler
public void enableScpResPack(PlayerCommandPreprocessEvent event)
{
if (event.getMessage().equalsIgnoreCase("/rpoff"))
{
event.getPlayer().setResourcePack("http://file.mineplex.com/ResReset.zip");
UtilPlayer.message(event.getPlayer(), F.main("Resource Pack", "Resource Pack: " + C.cRed + "Disabled"));
UtilPlayer.message(event.getPlayer(), F.main("Resource Pack", "Type " + F.elem("/rpon") + " to enable."));
}
else if (event.getMessage().equalsIgnoreCase("/rpon"))
{
event.getPlayer().setResourcePack(GetType().getResourcePackUrl());
UtilPlayer.message(event.getPlayer(), F.main("Resource Pack", "Resource Pack: " + C.cGreen + "Enabled"));
UtilPlayer.message(event.getPlayer(), F.main("Resource Pack", "Type " + F.elem("/rpoff") + " to disable."));
}
}
}

View File

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

View File

@ -34,10 +34,18 @@ public class Bomb
Block = planter.getLocation().getBlock();
Type = Block.getType();
Data = Block.getData();
if (Block.getType() != Material.PORTAL)
{
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();
}
@ -45,7 +53,7 @@ public class Bomb
public boolean update()
{
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;

View File

@ -54,7 +54,7 @@ public class Armor extends StrikeItem
try
{
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)
{

View File

@ -74,6 +74,19 @@ public abstract class FireGrenadeBase extends Grenade
if (!UtilBlock.solid(block.getRelative(BlockFace.DOWN)))
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()
{
public void run()
@ -84,7 +97,7 @@ public abstract class FireGrenadeBase extends Grenade
game.Manager.GetBlockRestore().Add(block, 51, (byte)0, (long) time);
}
}
}, 60 - (int)(60d * blocks.get(block)));
}, 30 - (int)(30d * blocks.get(block)));
}
//Initial Burn Sound

View File

@ -7,6 +7,7 @@ import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.minestrike.MineStrike;
import nautilus.game.arcade.game.games.minestrike.Radio;
@ -34,7 +35,7 @@ public class FlashBang extends Grenade
@Override
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();
UtilFirework.playFirework(ent.getLocation().add(0, 0.5, 0), effect);
@ -46,7 +47,7 @@ public class FlashBang extends Grenade
continue;
//Line of Sight
Location loc = player.getEyeLocation();
Location loc = player.getEyeLocation();
boolean sight = true;
while (UtilMath.offset(loc, ent.getLocation()) > 0.5)
@ -68,8 +69,8 @@ public class FlashBang extends Grenade
double flashIntensity = 2 - UtilMath.offset(player.getEyeLocation().add(player.getLocation().getDirection()), eyeToGrenade);
//Duration
double duration = (2 + (3 * (players.get(player)))) * flashIntensity;
duration += 1;
double duration = (2 + (2 * (players.get(player)))) * flashIntensity;
duration = (Math.min(5, duration));
//Blind
game.Manager.GetCondition().Factory().Blind(getName(), player, _thrower, duration, 0, false, false, false);

View File

@ -19,6 +19,7 @@ import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilInv;
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.items.StrikeItem;
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
@ -75,6 +76,8 @@ public abstract class Grenade extends StrikeItem
protected int _limit;
protected long _throwTime = 0;
public Grenade(String name, String[] desc, int cost, int gemCost, Material skin, int limit)
{
super(StrikeItemType.GRENADE, name, desc, cost, gemCost, skin);
@ -87,7 +90,7 @@ public abstract class Grenade extends StrikeItem
int alreadyHas = 0;
int bestSlot = -1;
for (int i = 5 ; i >= 3 ; i--)
for (int i = 6 ; i >= 3 ; i--)
{
if (UtilInv.IsItem(player.getInventory().getItem(i), getSkin(), (byte) -1))
alreadyHas++;
@ -154,14 +157,19 @@ public abstract class Grenade extends StrikeItem
//Sound
playSound(game, player);
_throwTime = System.currentTimeMillis();
}
public boolean update(MineStrike game, Entity ent)
{
//Invalid
if (!ent.isValid())
if (UtilTime.elapsed(_throwTime, 20000))
return true;
//Invalid (Burned)
if (!ent.isValid())
return updateCustom(game, ent);
//Rebound Off Blocks
rebound(ent);
@ -174,9 +182,14 @@ public abstract class Grenade extends StrikeItem
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;
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.
* 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
if ((_vel.getX() > 0.05 && ent.getLocation().getX() - _lastLoc.getX() <= 0) ||
(_vel.getX() < 0.05 && ent.getLocation().getX() - _lastLoc.getX() >= 0))
if ((_vel.getX() > 0.1 && ent.getLocation().getX() - _lastLoc.getX() <= 0) ||
(_vel.getX() < 0.1 && ent.getLocation().getX() - _lastLoc.getX() >= 0))
{
_vel = _velHistory.get(0);
_vel.setX(-_vel.getX());
@ -197,8 +210,8 @@ public abstract class Grenade extends StrikeItem
}
//Z Rebound
else if ((_vel.getZ() > 0.05 && ent.getLocation().getZ() - _lastLoc.getZ() <= 0) ||
(_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.1 && ent.getLocation().getZ() - _lastLoc.getZ() >= 0))
{
_vel = _velHistory.get(0);
_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.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
@ -35,7 +36,7 @@ public class HighExplosive extends Grenade
@Override
public boolean updateCustom(MineStrike game, Entity ent)
{
if (ent.getTicksLived() > 40)
if (UtilTime.elapsed(_throwTime, 2000))
{
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION,
ent.getLocation(), 0, 0, 0, 0, 1,
@ -43,7 +44,7 @@ public class HighExplosive extends Grenade
ent.getWorld().playSound(ent.getLocation(),
Sound.EXPLODE, 3f, 0.8f);
HashMap<Player, Double> players = UtilPlayer.getInRadius(ent.getLocation(), 10);
HashMap<Player, Double> players = UtilPlayer.getInRadius(ent.getLocation(), 9);
List<Player> damagedPlayers = new ArrayList<>();
for (Player player : players.keySet())
{

View File

@ -1,7 +1,12 @@
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.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import nautilus.game.arcade.game.GameTeam;
@ -12,11 +17,15 @@ import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
public class Smoke extends Grenade
{
private boolean _createdBlocks = false;
public Smoke()
{
super("Smoke", new String[]
@ -27,24 +36,56 @@ public class Smoke extends Grenade
}
@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,
ViewDist.MAX, UtilServer.getPlayers());
ent.getWorld().playSound(ent.getLocation(), Sound.FIZZ, 0.1f, 0.1f);
// UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, ent.getLocation(), 0.3f, 0.3f, 0.3f, 0, 1,
// ViewDist.MAX, UtilServer.getPlayers());
//Remove Fire
for (Location loc : game.Manager.GetBlockRestore().RestoreBlockAround(Material.FIRE, ent.getLocation(), 5))
{
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 ent.getTicksLived() > 360;
//18 seconds
return UtilTime.elapsed(_throwTime, 18000);
}
@Override

View File

@ -47,6 +47,8 @@ public class Gun extends StrikeItem
protected long _lastMoveTime;
protected boolean _reloading = false;
protected boolean _reloadTick = false;
public Gun(GunStats gunStats)
{
@ -124,17 +126,25 @@ public class Gun extends StrikeItem
//Use Ammo
_loadedAmmo--;
updateWeaponName(player);
//updateWeaponName(player);
//Effect
soundFire(player.getLocation());
//Visual
//Smoke
Location loc = player.getEyeLocation().add(player.getLocation().getDirection().multiply(1.2));
loc.add(UtilAlg.getRight(player.getLocation().getDirection()).multiply(0.5));
loc.add(UtilAlg.getDown(player.getLocation().getDirection()).multiply(0.3));
UtilParticle.PlayParticle(ParticleType.EXPLODE, loc, 0, 0, 0, 0, 1,
loc.add(UtilAlg.getDown(player.getLocation().getDirection()).multiply(0.4));
UtilParticle.PlayParticle(Math.random() > 0.5 ? ParticleType.ANGRY_VILLAGER : ParticleType.HEART, loc, 0, 0, 0, 0, 1,
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));
@ -265,7 +275,7 @@ public class Gun extends StrikeItem
}
//Recharge
Recharge.Instance.use(player, getName() + " Reload", getReloadTime(), false, true, true);
Recharge.Instance.use(player, getName() + " Reload", getReloadTime(), false, true);
//Sound
soundReload(player.getLocation());
@ -284,17 +294,36 @@ public class Gun extends StrikeItem
{
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)
{
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().setAmount(Math.max(1, _loadedAmmo));
if (player != null)
{
player.getInventory().setItem(_slot, getStack());
_reloadTick = !_reloadTick;
}
}
public double getDropOff()
@ -349,7 +378,7 @@ public class Gun extends StrikeItem
_reserveAmmo = Math.max(0, ammo - _gunStats.getClipSize());
//Update
updateWeaponName(player);
//updateWeaponName(player);
//Sound
player.getWorld().playSound(player.getEyeLocation(), Sound.PISTON_EXTEND, 1f, 1.6f);
@ -417,7 +446,7 @@ public class Gun extends StrikeItem
_loadedAmmo = _gunStats.getClipSize();
_reserveAmmo = _gunStats.getClipReserve() * _gunStats.getClipSize();
updateWeaponName(player);
//updateWeaponName(player);
}
public double getDamage()

View File

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

View File

@ -273,8 +273,7 @@ public class WitherGame extends TeamGame implements IBlockRestorer
return;
}
_maxY = GetTeamList().get(1).GetSpawn().getBlockY() - 4;
if(event.getBlock().getLocation().getBlockY() < _maxY)
if(event.getBlock().getLocation().getBlockY() < _maxY - 4)
{
event.getPlayer().sendMessage(F.main("BlockChecker", "You may not build under this height!"));
event.setCancelled(true);
@ -298,7 +297,6 @@ public class WitherGame extends TeamGame implements IBlockRestorer
}
Location blockLocation = event.getBlock().getLocation();
_maxY = GetTeamList().get(1).GetSpawn().getBlockY() - 3;
if(blockLocation.add(0,1,0).getBlock().getType() == Material.AIR)
{
for(Player humans: _runners.GetPlayers(true))
@ -317,7 +315,7 @@ public class WitherGame extends TeamGame implements IBlockRestorer
}
}
if(blockLocation.getBlockY() < _maxY)
if(blockLocation.getBlockY() < _maxY - 3)
{
event.getPlayer().sendMessage(F.main("BlockChecker", "You may not build under this height!"));
event.setCancelled(true);
@ -435,6 +433,7 @@ public class WitherGame extends TeamGame implements IBlockRestorer
if (event.GetState() != GameState.Live)
return;
_maxY = GetTeamList().get(1).GetSpawn().getBlockY();
UtilTextMiddle.display(C.cGreen + "Humans Hiding",
"15 Seconds until Assault", 10, 80, 10);

View File

@ -60,7 +60,7 @@ public class PerkBlockRestorer extends Perk implements IThrown
org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.COMMAND));
UtilAction.velocity(ent, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 10, false);
Manager.GetProjectile().AddThrow(ent, player, this, -1, false, false, true, false, 0.5f);
Manager.GetProjectile().AddThrow(ent, player, this, -1, false, false, true, true, 0.5f);
}
@Override

View File

@ -20,6 +20,7 @@ import mineplex.core.recharge.Recharge;
import mineplex.core.teleport.event.MineplexTeleportEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
@ -854,6 +855,9 @@ public class GameFlagManager implements Listener
if (game.HungerSet != -1)
for (Player player : game.GetPlayers(true))
{
if (Manager.GetCondition().HasCondition(player, ConditionType.ARCADE_HUNGER_DISABLE, null))
continue;
player.setFoodLevel(game.HungerSet);
player.setSaturation(1F);
}