This commit is contained in:
Sarah 2015-11-27 20:33:18 +01:00
commit e81aa72c7e
106 changed files with 2242 additions and 548 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

@ -38,9 +38,8 @@ public class PlayerTracker implements Listener, Runnable
_plugin.getProxy().getPluginManager().registerListener(_plugin, this);
_plugin.getProxy().getScheduler().schedule(_plugin, this, 1L, 1L, TimeUnit.MINUTES);
Region region = !new File("eu.dat").exists() ? Region.US : Region.EU;
_repository = new RedisDataRepository<PlayerStatus>(ServerManager.getMasterConnection(), ServerManager.getSlaveConnection(),
region, PlayerStatus.class, "playerStatus");
Region.currentRegion(), PlayerStatus.class, "playerStatus");
ServerCommandManager.getInstance().registerCommandType("PlayerJoinCommand", mineplex.serverdata.commands.PlayerJoinCommand.class, new PlayerJoinHandler(this));

View File

@ -9,6 +9,7 @@ import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.util.EulerAngle;
import org.bukkit.util.Vector;
public class UtilAlg
@ -439,4 +440,9 @@ public class UtilAlg
return value;
}
public static EulerAngle vectorToEuler(Vector vector)
{
return new EulerAngle(Math.toRadians(GetPitch(vector)), Math.toRadians(GetYaw(vector)), 0);
}
}

View File

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

@ -29,7 +29,6 @@ import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
@ -291,6 +290,8 @@ public class UtilEnt
creatureMap.put("WitherSkull", EntityType.WITHER_SKULL);
creatureMap.put("Wolf", EntityType.WOLF);
creatureMap.put("Zombie", EntityType.ZOMBIE);
creatureMap.put("Guardian", EntityType.GUARDIAN);
creatureMap.put("Rabbit", EntityType.RABBIT);
creatureMap.put("Item", EntityType.DROPPED_ITEM);
}
@ -457,6 +458,28 @@ public class UtilEnt
return ents;
}
public static HashMap<Entity, Double> getAllInRadius(Location loc, double dR)
{
HashMap<Entity, Double> ents = new HashMap<Entity, Double>();
for (Entity cur : loc.getWorld().getEntities())
{
if (UtilPlayer.isSpectator(cur))
continue;
//Loc
double offset = UtilMath.offset(loc, cur.getLocation());
if (offset < dR)
{
ents.put(cur, 1 - (offset/dR));
continue;
}
}
return ents;
}
public static boolean hitBox(Location loc, LivingEntity ent, double mult, EntityType disguise)
{
if (disguise != null)
@ -480,7 +503,7 @@ public class UtilEnt
}
else if (UtilMath.offset2d(loc, player.getLocation()) < 0.6 * mult)
{
if (loc.getY() > player.getLocation().getY() && loc.getY() < player.getEyeLocation().getY())
if (loc.getY() >= player.getLocation().getY() - 0.2*mult && loc.getY() <= player.getEyeLocation().getY() + 0.2*mult)
{
return true;
}
@ -616,6 +639,11 @@ public class UtilEnt
return CreatureLook(ent, UtilAlg.GetPitch(vec), UtilAlg.GetYaw(vec));
}
public static boolean CreatureLook(Entity ent, Vector target)
{
return CreatureLook(ent, UtilAlg.GetPitch(target), UtilAlg.GetYaw(target));
}
public static void setFakeHead(Entity ent, boolean fakeHead)
{
net.minecraft.server.v1_8_R3.Entity ec = ((CraftEntity) ent).getHandle();

View File

@ -27,14 +27,7 @@ public class UpdateRank extends CommandBase<CoreClientManager>
@Override
public void Execute(final Player caller, String[] args)
{
if (!Plugin.Get(caller).GetRank(true).has(caller, Rank.ADMIN, true))
{
return;
}
boolean testServer = Plugin.getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing");
{
if (args == null)
{
UtilPlayer.message(caller, F.main(Plugin.getName(), "/" + AliasUsed + " joeschmo MODERATOR"));
@ -62,79 +55,70 @@ public class UpdateRank extends CommandBase<CoreClientManager>
final Rank rank = tempRank;
if (rank == Rank.ADMIN || rank == Rank.YOUTUBE || rank == Rank.TWITCH || rank == Rank.MODERATOR || rank == Rank.JNR_DEV || rank == Rank.HELPER || rank == Rank.ALL || rank == Rank.MAPDEV || rank == Rank.SNR_MODERATOR || rank == Rank.SUPPORT)
Plugin.getRepository().matchPlayerName(new Callback<List<String>>()
{
if (!testServer && rank.has(Rank.ADMIN) && !Plugin.hasRank(caller, Rank.LT))
public void run(List<String> matches)
{
UtilPlayer.message(caller, F.main(Plugin.getName(), ChatColor.RED + "" + ChatColor.BOLD + "Insufficient privileges!"));
return;
}
Plugin.getRepository().matchPlayerName(new Callback<List<String>>()
{
public void run(List<String> matches)
boolean matchedExact = false;
for (String match : matches)
{
boolean matchedExact = false;
for (String match : matches)
if (match.equalsIgnoreCase(playerName))
{
if (match.equalsIgnoreCase(playerName))
{
matchedExact = true;
}
matchedExact = true;
}
if (matchedExact)
{
for (Iterator<String> matchIterator = matches.iterator(); matchIterator.hasNext();)
{
if (!matchIterator.next().equalsIgnoreCase(playerName))
{
matchIterator.remove();
}
}
}
if (UtilPlayer.isOnline(playerName))
{
Player p = UtilServer.getServer().getPlayer(playerName);
if (Plugin.Get(p).GetRank() != Plugin.Get(p).GetRank(true))
Plugin.Get(p).resetTemp();
OnlineRankUpdateEvent event = new OnlineRankUpdateEvent(caller, Plugin.Get(caller).GetRank(), rank, true);
Plugin.Get(p).SetRank(rank, false);
Bukkit.getPluginManager().callEvent(event);
UtilPlayer.message(p, F.main(Plugin.getName(), "Your rank has been updated to " + rank.Name + "!"));
}
UtilPlayer.searchOffline(matches, new Callback<String>()
{
public void run(final String target)
{
if (target == null)
{
return;
}
UUID uuid = Plugin.loadUUIDFromDB(playerName);
if (uuid == null)
uuid = UUIDFetcher.getUUIDOf(playerName);
Plugin.getRepository().saveRank(new Callback<Rank>()
{
public void run(Rank rank)
{
caller.sendMessage(F.main(Plugin.getName(), target + "'s rank has been updated to " + rank.Name + "!"));
}
}, target, uuid, rank, true);
}
}, caller, playerName, true);
}
}, playerName);
}
if (matchedExact)
{
for (Iterator<String> matchIterator = matches.iterator(); matchIterator.hasNext();)
{
if (!matchIterator.next().equalsIgnoreCase(playerName))
{
matchIterator.remove();
}
}
}
if (UtilPlayer.isOnline(playerName))
{
Player p = UtilServer.getServer().getPlayer(playerName);
if (Plugin.Get(p).GetRank() != Plugin.Get(p).GetRank(true))
Plugin.Get(p).resetTemp();
OnlineRankUpdateEvent event = new OnlineRankUpdateEvent(caller, Plugin.Get(caller).GetRank(), rank, true);
Plugin.Get(p).SetRank(rank, false);
Bukkit.getPluginManager().callEvent(event);
UtilPlayer.message(p, F.main(Plugin.getName(), "Your rank has been updated to " + rank.Name + "!"));
}
UtilPlayer.searchOffline(matches, new Callback<String>()
{
public void run(final String target)
{
if (target == null)
{
return;
}
UUID uuid = Plugin.loadUUIDFromDB(playerName);
if (uuid == null)
uuid = UUIDFetcher.getUUIDOf(playerName);
Plugin.getRepository().saveRank(new Callback<Rank>()
{
public void run(Rank rank)
{
caller.sendMessage(F.main(Plugin.getName(), target + "'s rank has been updated to " + rank.Name + "!"));
}
}, target, uuid, rank, true);
}
}, caller, playerName, true);
}
}, playerName);
}
}
}

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,40 +295,46 @@ 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 CTF.SpecialWin"},
new String[]{"Win the game with 5 more captures than the other team"},
new int[]{1},
AchievementCategory.CHAMPIONS),
//Paintball
SUPER_PAINTBALL_WINS("Paintball King", 600,

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

@ -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()))
return;
HashMap<Player, Double> players = UtilPlayer.getInRadius(event.getLocation(), 10);
HashMap<Player, Double> players = UtilPlayer.getInRadius(event.getLocation(), 8);
for (Player player : players.keySet())
{
if (Manager.collideEvent(this, player))

View File

@ -1,35 +1,216 @@
package mineplex.core.gadget.gadgets;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import java.util.HashMap;
import java.util.HashSet;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Zombie;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.util.Vector;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.MapUtil;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.disguise.disguises.DisguiseGuardian;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.MorphGadget;
import mineplex.core.recharge.Recharge;
import mineplex.core.recharge.RechargedEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class MorphTitan extends MorphGadget
{
private HashMap<Player, ArmorStand> _targets = new HashMap<Player, ArmorStand>();
public MorphTitan(GadgetManager manager)
{
super(manager, "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",
},
-1,
Material.INK_SACK, (byte)8);
Material.PRISMARINE_SHARD, (byte)0);
}
@Override
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
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

@ -74,6 +74,8 @@ public abstract class Gadget extends SalesPackageBase implements Listener
return;
}
System.out.println(player.getName() + " has activated " + Name);
EnableCustom(player);
Manager.setActive(player, this);
}

View File

@ -1,5 +1,6 @@
package mineplex.core.game;
import org.bukkit.DyeColor;
import org.bukkit.Material;
public enum GameDisplay
@ -10,7 +11,6 @@ public enum GameDisplay
Bridge("The Bridges", Material.IRON_PICKAXE, (byte)0, GameCategory.SURVIVAL, 3),
CastleSiege("Castle Siege", Material.DIAMOND_CHESTPLATE, (byte)0, GameCategory.CLASSICS, 4),
ChampionsDominate("Champions Domination", "Champions", Material.BEACON, (byte)0, GameCategory.CHAMPIONS, 6),
//ChampionsMOBA(ChampionsMOBA.class, "Champions MOBA", "Champions", Material.SKULL_ITEM, (byte)0, GameCategory.CHAMPIONS, 7),
ChampionsTDM("Champions TDM", "Champions", Material.GOLD_SWORD, (byte)0, GameCategory.CHAMPIONS, 5),
Christmas("Christmas Chaos", Material.SNOW_BALL, (byte)0, GameCategory.CLASSICS, 8),
DeathTag("Death Tag", Material.SKULL_ITEM, (byte)0, GameCategory.ARCADE, 9),
@ -21,8 +21,7 @@ public enum GameDisplay
DragonsTeams("Dragons Teams", Material.ENDER_STONE, (byte)0, GameCategory.TEAM_VARIANT, 14),
Draw("Draw My Thing", Material.BOOK_AND_QUILL, (byte)0, GameCategory.CLASSICS, 15),
Evolution("Evolution", Material.EMERALD, (byte)0, GameCategory.ARCADE, 16),
//FlappyBird(FlappyBird.class, "Flappy Bird", Material.FEATHER, (byte)0, GameCategory.ARCADE, 17),
Gravity("Gravity", Material.SEA_LANTERN, (byte)0, GameCategory.EXTRA, 18),
Gravity("Gravity", Material.ENDER_PORTAL, (byte)0, GameCategory.EXTRA, 18),
Halloween("Halloween Horror", Material.PUMPKIN, (byte)0, GameCategory.CLASSICS, 19),
HideSeek("Block Hunt", Material.GRASS, (byte)0, GameCategory.CLASSICS, 20),
HoleInTheWall("Hole in the Wall", Material.STAINED_GLASS, (byte) 2, GameCategory.ARCADE, 52),
@ -67,7 +66,7 @@ public enum GameDisplay
Lobbers("Bomb Lobbers", Material.FIREBALL, (byte) 0, GameCategory.ARCADE, 54),
ChampionsCTF("Champions CTF", "Champions", Material.REDSTONE_BLOCK, (byte)0, GameCategory.CHAMPIONS, 55),
ChampionsCTF("Champions CTF", "Champions", Material.BANNER, DyeColor.RED.getDyeData(), GameCategory.CHAMPIONS, 56),
Event("Mineplex Event", Material.CAKE, (byte)0, GameCategory.EVENT, 999);

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

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

View File

@ -1,27 +1,126 @@
package mineplex.core.mount.types;
import java.util.HashMap;
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.Style;
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.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.mount.HorseMount;
import mineplex.core.mount.Mount;
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",
},
Material.INK_SACK,
(byte)8,
-1,
Color.BLACK, Style.BLACK_DOTS, Variant.UNDEAD_HORSE, 0.8, null);
}, -1);
}
@Override
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,179 @@
package mineplex.core.mount.types;
import java.util.ArrayList;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.disguise.DisguiseManager;
import mineplex.core.disguise.disguises.DisguiseGuardian;
import mineplex.core.disguise.disguises.DisguiseMagmaCube;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.EulerAngle;
import org.bukkit.util.Vector;
public class MountTitanData
{
private String _owner;
private LivingEntity _head;
private ArrayList<ArmorStand> _nodes;
public MountTitanData(DisguiseManager disguiseManager, Player player, String name)
{
_owner = player.getName();
// Nodes
_nodes = new ArrayList<ArmorStand>();
Location loc = player.getLocation();
loc.setYaw(0);
loc.setPitch(0);
for (int i = 0; i < 30; i++)
{
ArmorStand node = player.getWorld().spawn(loc, ArmorStand.class);
node.setVisible(false);
node.setGravity(false);
node.setHelmet(new ItemStack(Material.REDSTONE_BLOCK));
_nodes.add(node);
}
// Head
_head = (LivingEntity) player.getWorld().spawnEntity(loc, EntityType.BAT);
UtilEnt.Vegetate(_head, true);
UtilEnt.silence(_head, true);
UtilEnt.setFakeHead(_head, true);
_head.setCustomName(player.getName() + "'s " + name);
((CraftLivingEntity) _head).getHandle().setMineplexInvisible(true);
DisguiseMagmaCube disguise = new DisguiseMagmaCube(_head);
disguise.SetSize(2);
disguiseManager.disguise(disguise);
}
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)));
UtilEnt.CreatureLook(_head, _head.getPassenger().getLocation().getDirection());
}
else
{
Player player = Bukkit.getPlayerExact(_owner);
if (player != null)
{
Vector moving = null;
if (UtilMath.offset(player, _head) > 12)
{
moving = _head.getLocation().getDirection().normalize();
Vector vec = moving.clone().subtract(UtilAlg.getTrajectory(player, _head)).normalize();
vec.setY(-vec.getY());
moving.add(vec.multiply(0.15));
}
else
{
moving = _head.getLocation().getDirection();
moving.setX(moving.getX() + UtilMath.rr(0.1, true));
moving.setY(moving.getY() + UtilMath.rr(0.3, true));
moving.setZ(moving.getZ() + UtilMath.rr(0.1, true));
}
moving.normalize().multiply(0.5);
UtilEnt.CreatureLook(_head, moving);
_head.setVelocity(moving);
}
}
Location infront = _head.getLocation().add(0, -1.3, 0);
infront.setYaw(0);
infront.setPitch(0);
// Move
for (int i = 0; i < 30; i++)
{
ArmorStand node = _nodes.get(i);
Location loc = node.getLocation();
// 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)));
// Rotation
node.setHeadPose(UtilAlg.vectorToEuler(UtilAlg.getTrajectory(node.getLocation(), loc)));
infront = node.getLocation();
}
// Shuffle In
if (_head.getPassenger() == null)
{
for (int i = _nodes.size() - 1; i >= 0; i--)
{
ArmorStand node = _nodes.get(i);
Location loc = node.getLocation();
if (i > 0)
infront = _nodes.get(i - 1).getLocation();
else
infront = _head.getLocation().add(0, -1.3, 0);
node.teleport(infront);
node.setHeadPose(new EulerAngle(0, -UtilAlg.GetYaw(UtilAlg.getTrajectory(node.getLocation(), loc)), 0));
// node.setHeadPose(UtilAlg.vectorToEuler(UtilAlg.getTrajectory(node.getLocation(), loc)));
}
}
}
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.MUSHROOM_COW, new Pet("Mooshroom", EntityType.MUSHROOM_COW, 5000));
_pets.put(EntityType.WITHER, new Pet("Widder", EntityType.WITHER, -1));
_pets.put(EntityType.SKELETON, new Pet("Guardian", EntityType.SKELETON, -1));
}
private void CreatePetExtras()

View File

@ -14,9 +14,12 @@ import mineplex.core.account.event.ClientWebResponseEvent;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.common.Rank;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilServer;
import mineplex.core.disguise.DisguiseManager;
import mineplex.core.disguise.disguises.DisguiseGuardian;
import mineplex.core.disguise.disguises.DisguiseWither;
import mineplex.core.donation.DonationManager;
import mineplex.core.inventory.InventoryManager;
@ -38,8 +41,10 @@ import org.bukkit.entity.Ageable;
import org.bukkit.entity.Creature;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Guardian;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Villager;
import org.bukkit.entity.Zombie;
import org.bukkit.event.EventHandler;
@ -159,6 +164,12 @@ public class PetManager extends MiniClientPlugin<PetClient>
if (!Get(p).GetPets().containsKey(EntityType.WITHER))
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)
@ -175,6 +186,7 @@ public class PetManager extends MiniClientPlugin<PetClient>
Creature pet;
//Wither Spawn
if (entityType == EntityType.WITHER)
{
_creatureModule.SetForce(true);
@ -196,6 +208,7 @@ public class PetManager extends MiniClientPlugin<PetClient>
_creatureModule.SetForce(false);
}
//Default Spawn
else
{
pet = (Creature)_creatureModule.SpawnEntity(location, entityType);
@ -220,6 +233,20 @@ public class PetManager extends MiniClientPlugin<PetClient>
((Villager) pet).setBaby();
((Villager) pet).setAgeLock(true);
}
else if (pet instanceof Skeleton)
{
pet.getEquipment().setHelmet(new ItemStack(Material.PUMPKIN)); //stop burning
UtilEnt.silence(pet, true);
DisguiseGuardian disguise = new DisguiseGuardian(pet);
if (Get(player).GetPets().get(entityType) != null && Get(player).GetPets().get(entityType).length() > 0)
{
disguise.setName(Get(player).GetPets().get(entityType));
}
_disguiseManager.disguise(disguise);
}
_activePetOwners.put(player.getName(), pet);
_failedAttempts.put(player.getName(), 0);
@ -335,6 +362,12 @@ public class PetManager extends MiniClientPlugin<PetClient>
xDiff = Math.abs(petSpot.getBlockX() - ownerSpot.getBlockX());
yDiff = Math.abs(petSpot.getBlockY() - ownerSpot.getBlockY());
zDiff = Math.abs(petSpot.getBlockZ() - ownerSpot.getBlockZ());
//Guardian
if (pet instanceof Skeleton && Math.random() > 0.66 && UtilEnt.isGrounded(pet))
{
UtilAction.velocity(pet, UtilAlg.getTrajectory(pet, owner), Math.random() * 0.3 + 0.3, false, 0, 0.3, 1, true);
}
if ((xDiff + yDiff + zDiff) > 4)
{

View File

@ -135,6 +135,12 @@ public class ProjectileManager extends MiniPlugin
expireTime, hitPlayer, hitNonPlayerEntity, hitBlock, idle, false,
sound, soundVolume, soundPitch, null, 0, effectRate, particle, pX, pY, pZ, pS, pC, hitboxMult, canHit));
}
public void deleteThrown(Entity thrown)
{
_thrown.remove(thrown);
thrown.remove();
}
@EventHandler
public void Update(UpdateEvent event)

View File

@ -269,6 +269,13 @@ public class ProjectileUser
nmsEntity.locY -= nmsEntity.motY / f2 * 0.0500000007450581D;
nmsEntity.locZ -= nmsEntity.motZ / f2 * 0.0500000007450581D;
if (nmsEntity.locX == Double.NaN)
System.out.println(_thrown + " has made " + nmsEntity + "'s locX NaN.");
if (nmsEntity.locY == Double.NaN)
System.out.println(_thrown + " has made " + nmsEntity + "'s locY NaN.");
if (nmsEntity.locZ == Double.NaN)
System.out.println(_thrown + " has made " + nmsEntity + "'s locZ NaN.");
_callback.Collide(null, block, this);
return true;
}

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

@ -132,7 +132,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
itemIgnore.add("Proximity Zapper");
ItemFactory itemFactory = new ItemFactory(plugin, blockRestore, _condition, damageManager, energy, fire, throwManager, webServerAddress, itemIgnore);
SkillFactory skillManager = new SkillFactory(plugin, damageManager, this, _combatManager, _condition, throwManager, disguiseManager, blockRestore, fire, new Movement(plugin), teleport, energy, webServerAddress);
SkillFactory skillManager = new SkillFactory(plugin, damageManager, this, _combatManager, _condition, throwManager, disguiseManager, blockRestore, itemFactory.ThrownManager, fire, new Movement(plugin), teleport, energy, webServerAddress);
skillManager.RemoveSkill("Dwarf Toss", "Block Toss");
_classManager = new ClassManager(plugin, _clientManager, donationManager, skillManager, itemFactory, webServerAddress);

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

@ -67,7 +67,6 @@ import mineplex.hub.modules.NewsManager;
import mineplex.hub.modules.ParkourManager;
import mineplex.hub.modules.SoccerManager;
import mineplex.hub.modules.TextManager;
import mineplex.hub.modules.TrickOrTreatManager;
import mineplex.hub.modules.WorldManager;
import mineplex.hub.profile.gui.GUIProfile;
import mineplex.hub.tutorial.TutorialManager;

View File

@ -224,6 +224,8 @@ public class StackerManager extends MiniPlugin implements IThrown
UtilPlayer.message(thrower, F.main("Stacker", "You threw " + F.name(UtilEnt.getName(throwee))));
UtilPlayer.message(throwee, F.main("Stacker", "You were thrown by " + F.name(thrower.getName())));
System.out.println("Stacker throw.");
UtilAction.velocity(throwee, thrower.getLocation().getDirection(), 1.8, false, 0, 0.3, 2, false);
_projectileManager.AddThrow(throwee, thrower, this, 4000, true, false, true, false, 0.5f);
@ -244,7 +246,9 @@ public class StackerManager extends MiniPlugin implements IThrown
if (!Manager.hasPlayerStackingEnabled(target))
return;
System.out.println("Stacker collide.");
//Velocity
UtilAction.velocity(target, UtilAlg.getTrajectory2d(data.GetThrown(), target), 1, true, 0.8, 0, 10, true);

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

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

View File

@ -315,6 +315,11 @@ public class ClassManager extends MiniClientPlugin<ClientClass> implements IClas
{
return _skillFactory;
}
public ItemFactory GetItemFactory()
{
return _itemFactory;
}
@Override
protected ClientClass AddPlayer(String player)

View File

@ -1,8 +1,11 @@
package mineplex.minecraft.game.classcombat.Condition;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import mineplex.core.common.util.UtilServer;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.condition.ConditionEffect;
import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;

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

@ -214,7 +214,7 @@ public class Immolate extends Skill
Item fire = cur.getWorld().dropItem(cur.getLocation().add(0, 0.5, 0), itemStack);
fire.setVelocity(new Vector((Math.random() - 0.5)/3,Math.random()/3,(Math.random() - 0.5)/3));
Factory.Fire().Add(fire, cur, 2, 0, 0.25 + (level * 0.25), 0, GetName());
Factory.Fire().Add(fire, cur, 2, 0, 0.25 + (level * 0.25), 0, GetName(), false);
//Sound
cur.getWorld().playSound(cur.getLocation(), Sound.FIZZ, 0.2f, 1f);

View File

@ -113,7 +113,7 @@ public class Inferno extends SkillActive
itemStack.setItemMeta(meta);
Item fire = cur.getWorld().dropItem(cur.getEyeLocation().add(cur.getLocation().getDirection()), itemStack);
Factory.Fire().Add(fire, cur, 0.7, 0, 0.3 + (0.1 * level), 1, GetName());
Factory.Fire().Add(fire, cur, 0.7, 0, 0.3 + (0.1 * level), 1, GetName(), false);
fire.teleport(cur.getEyeLocation());
double x = 0.07 - (UtilMath.r(14)/100d);

View File

@ -18,17 +18,12 @@ import mineplex.core.common.util.F;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.minecraft.game.classcombat.Skill.SkillActive;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.core.condition.Condition;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import org.bukkit.event.player.*;

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

@ -144,19 +144,19 @@ public class NapalmShot extends SkillActive
//Damage
event.AddMod(damager.getName(), GetName(), 0, true);
//Effect
//Effect
damagee.getWorld().playSound(damagee.getLocation(), Sound.FIZZ, 2f, 1.5f);
//Remove
projectile.remove();
}
@EventHandler
@EventHandler(priority=EventPriority.MONITOR) //make it happen after the damage event ^
public void projectileHit(ProjectileHitEvent event)
{
Projectile proj = event.getEntity();
if (!_arrows.remove(proj))
if (!_arrows.contains(proj))
return;
if (proj.getShooter() == null)
@ -179,7 +179,7 @@ public class NapalmShot extends SkillActive
itemStack.setItemMeta(meta);
Item fire = proj.getWorld().dropItemNaturally(proj.getLocation(), itemStack);
Factory.Fire().Add(fire, damager, 16, 0.25, 2, 0, GetName());
Factory.Fire().Add(fire, damager, 16, 0.25, 2, 0.25, GetName(), true);
fire.setVelocity(fire.getVelocity().multiply(1 + (0.15 * level)));
}

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

@ -8,7 +8,6 @@ import java.util.List;
import mineplex.core.MiniPlugin;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.core.disguise.DisguiseManager;
import mineplex.core.donation.repository.GameSalesPackageToken;
import mineplex.core.energy.Energy;
@ -18,17 +17,91 @@ import mineplex.core.teleport.Teleport;
import mineplex.minecraft.game.classcombat.Class.IPvpClass;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.classcombat.Skill.ISkill.SkillType;
import mineplex.minecraft.game.classcombat.Skill.Brute.*;
import mineplex.minecraft.game.classcombat.Skill.Assassin.*;
import mineplex.minecraft.game.classcombat.Skill.Global.*;
import mineplex.minecraft.game.classcombat.Skill.Knight.*;
import mineplex.minecraft.game.classcombat.Skill.Mage.*;
import mineplex.minecraft.game.classcombat.Skill.Assassin.Assassin;
import mineplex.minecraft.game.classcombat.Skill.Assassin.BackStab;
import mineplex.minecraft.game.classcombat.Skill.Assassin.Blink;
import mineplex.minecraft.game.classcombat.Skill.Assassin.ComboAttack;
import mineplex.minecraft.game.classcombat.Skill.Assassin.Evade;
import mineplex.minecraft.game.classcombat.Skill.Assassin.Flash;
import mineplex.minecraft.game.classcombat.Skill.Assassin.Illusion;
import mineplex.minecraft.game.classcombat.Skill.Assassin.Leap;
import mineplex.minecraft.game.classcombat.Skill.Assassin.MarkedForDeath;
import mineplex.minecraft.game.classcombat.Skill.Assassin.Recall;
import mineplex.minecraft.game.classcombat.Skill.Assassin.ShockingStrikes;
import mineplex.minecraft.game.classcombat.Skill.Assassin.SilencingArrow;
import mineplex.minecraft.game.classcombat.Skill.Assassin.SmokeArrow;
import mineplex.minecraft.game.classcombat.Skill.Assassin.SmokeBomb;
import mineplex.minecraft.game.classcombat.Skill.Assassin.ViperStrikes;
import mineplex.minecraft.game.classcombat.Skill.Brute.BlockToss;
import mineplex.minecraft.game.classcombat.Skill.Brute.Bloodlust;
import mineplex.minecraft.game.classcombat.Skill.Brute.Brute;
import mineplex.minecraft.game.classcombat.Skill.Brute.Colossus;
import mineplex.minecraft.game.classcombat.Skill.Brute.CripplingBlow;
import mineplex.minecraft.game.classcombat.Skill.Brute.DwarfToss;
import mineplex.minecraft.game.classcombat.Skill.Brute.FleshHook;
import mineplex.minecraft.game.classcombat.Skill.Brute.Intimidation;
import mineplex.minecraft.game.classcombat.Skill.Brute.Overwhelm;
import mineplex.minecraft.game.classcombat.Skill.Brute.SeismicSlam;
import mineplex.minecraft.game.classcombat.Skill.Brute.Stampede;
import mineplex.minecraft.game.classcombat.Skill.Brute.Takedown;
import mineplex.minecraft.game.classcombat.Skill.Brute.WhirlwindAxe;
import mineplex.minecraft.game.classcombat.Skill.Global.BreakFall;
import mineplex.minecraft.game.classcombat.Skill.Global.Fitness;
import mineplex.minecraft.game.classcombat.Skill.Global.Recharge;
import mineplex.minecraft.game.classcombat.Skill.Global.Resistance;
import mineplex.minecraft.game.classcombat.Skill.Knight.AxeThrow;
import mineplex.minecraft.game.classcombat.Skill.Knight.BullsCharge;
import mineplex.minecraft.game.classcombat.Skill.Knight.Cleave;
import mineplex.minecraft.game.classcombat.Skill.Knight.DefensiveStance;
import mineplex.minecraft.game.classcombat.Skill.Knight.Deflection;
import mineplex.minecraft.game.classcombat.Skill.Knight.Fortitude;
import mineplex.minecraft.game.classcombat.Skill.Knight.HiltSmash;
import mineplex.minecraft.game.classcombat.Skill.Knight.HoldPosition;
import mineplex.minecraft.game.classcombat.Skill.Knight.Knight;
import mineplex.minecraft.game.classcombat.Skill.Knight.LevelField;
import mineplex.minecraft.game.classcombat.Skill.Knight.Riposte;
import mineplex.minecraft.game.classcombat.Skill.Knight.ShieldSmash;
import mineplex.minecraft.game.classcombat.Skill.Knight.Swordsmanship;
import mineplex.minecraft.game.classcombat.Skill.Knight.Vengeance;
import mineplex.minecraft.game.classcombat.Skill.Mage.ArcticArmor;
import mineplex.minecraft.game.classcombat.Skill.Mage.Blizzard;
import mineplex.minecraft.game.classcombat.Skill.Mage.FireBlast;
import mineplex.minecraft.game.classcombat.Skill.Mage.Fissure;
import mineplex.minecraft.game.classcombat.Skill.Mage.GlacialBlade;
import mineplex.minecraft.game.classcombat.Skill.Mage.IcePrison;
import mineplex.minecraft.game.classcombat.Skill.Mage.Immolate;
import mineplex.minecraft.game.classcombat.Skill.Mage.Inferno;
import mineplex.minecraft.game.classcombat.Skill.Mage.LifeBonds;
import mineplex.minecraft.game.classcombat.Skill.Mage.LightningOrb;
import mineplex.minecraft.game.classcombat.Skill.Mage.Mage;
import mineplex.minecraft.game.classcombat.Skill.Mage.MagmaBlade;
import mineplex.minecraft.game.classcombat.Skill.Mage.NullBlade;
import mineplex.minecraft.game.classcombat.Skill.Mage.Rupture;
import mineplex.minecraft.game.classcombat.Skill.Mage.StaticLazer;
import mineplex.minecraft.game.classcombat.Skill.Mage.Void;
import mineplex.minecraft.game.classcombat.Skill.Ranger.*;
import mineplex.minecraft.game.classcombat.Skill.Ranger.Agility;
import mineplex.minecraft.game.classcombat.Skill.Ranger.BarbedArrows;
import mineplex.minecraft.game.classcombat.Skill.Ranger.Barrage;
import mineplex.minecraft.game.classcombat.Skill.Ranger.Disengage;
import mineplex.minecraft.game.classcombat.Skill.Ranger.ExplosiveShot;
import mineplex.minecraft.game.classcombat.Skill.Ranger.HealingShot;
import mineplex.minecraft.game.classcombat.Skill.Ranger.HeavyArrows;
import mineplex.minecraft.game.classcombat.Skill.Ranger.Longshot;
import mineplex.minecraft.game.classcombat.Skill.Ranger.NapalmShot;
import mineplex.minecraft.game.classcombat.Skill.Ranger.Overcharge;
import mineplex.minecraft.game.classcombat.Skill.Ranger.PinDown;
import mineplex.minecraft.game.classcombat.Skill.Ranger.Ranger;
import mineplex.minecraft.game.classcombat.Skill.Ranger.RopedArrow;
import mineplex.minecraft.game.classcombat.Skill.Ranger.Sharpshooter;
import mineplex.minecraft.game.classcombat.Skill.Ranger.VitalitySpores;
import mineplex.minecraft.game.classcombat.Skill.Ranger.WolfsFury;
import mineplex.minecraft.game.classcombat.Skill.Ranger.WolfsPounce;
import mineplex.minecraft.game.classcombat.Skill.repository.SkillRepository;
import mineplex.minecraft.game.classcombat.Skill.repository.token.SkillToken;
import mineplex.minecraft.game.classcombat.item.Throwable.ProximityManager;
import mineplex.minecraft.game.core.IRelation;
import mineplex.minecraft.game.core.combat.CombatManager;
import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.minecraft.game.core.damage.DamageManager;
import mineplex.minecraft.game.core.fire.Fire;
@ -163,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}));
@ -178,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}));
@ -200,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}));
@ -257,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}));
@ -338,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

@ -28,6 +28,7 @@ public class ItemFactory extends MiniPlugin implements IItemFactory
private Energy _energy;
private Fire _fire;
private ProjectileManager _projectileManager;
private ProximityManager _proxyManager;
private java.lang.reflect.Field _itemMaxDurability;
private HashMap<String, Item> _items;
private HashSet<String> _ignore;
@ -47,6 +48,7 @@ public class ItemFactory extends MiniPlugin implements IItemFactory
_energy = energy;
_fire = fire;
_projectileManager = projectileManager;
_proxyManager = new ProximityManager();
_items = new HashMap<String, Item>();
_ignore = ignore;
@ -240,6 +242,8 @@ public class ItemFactory extends MiniPlugin implements IItemFactory
for (Item item : _items.values())
registerEvents(item);
registerEvents(_proxyManager);
}
@Override
@ -249,5 +253,12 @@ public class ItemFactory extends MiniPlugin implements IItemFactory
for (Item item : _items.values())
HandlerList.unregisterAll(item);
HandlerList.unregisterAll(_proxyManager);
}
public ProximityManager getProximityManager()
{
return _proxyManager;
}
}

View File

@ -1,5 +1,17 @@
package mineplex.minecraft.game.classcombat.item;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.core.recharge.Recharge;
import mineplex.minecraft.game.classcombat.item.event.ItemTriggerEvent;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.block.Block;
@ -9,21 +21,6 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.core.recharge.Recharge;
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
import mineplex.minecraft.game.classcombat.item.Item;
import mineplex.minecraft.game.classcombat.item.ItemFactory;
import mineplex.minecraft.game.classcombat.item.event.ItemTriggerEvent;
public abstract class ItemUsable extends Item implements IThrown
{
private ActionType _useAction;
@ -161,7 +158,7 @@ public abstract class ItemUsable extends Item implements IThrown
org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(GetType()));
UtilAction.velocity(ent, player.getLocation().getDirection(), _throwPower, false, 0, 0.2, 10, false);
Factory.Throw().AddThrow(ent, player, this, expire, _throwPlayer, _throwPlayer, _throwBlock, _throwIdle, _throwPickup, 0.5f);
ThrowCustom(event, ent);
}

View File

@ -2,9 +2,10 @@ package mineplex.minecraft.game.classcombat.item.Throwable;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
@ -34,6 +35,7 @@ import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.minecraft.game.classcombat.item.ItemFactory;
import mineplex.minecraft.game.classcombat.item.ItemUsable;
import mineplex.minecraft.game.classcombat.item.event.ProximityUseEvent;
public class ProximityExplosive extends ItemUsable
{
@ -63,7 +65,14 @@ public class ProximityExplosive extends ItemUsable
@Override
public void UseAction(PlayerInteractEvent event)
{
}
@Override
public void ThrowCustom(PlayerInteractEvent event, org.bukkit.entity.Item ent)
{
ProximityUseEvent useEvent = new ProximityUseEvent(event.getPlayer(), this, ent);
Bukkit.getServer().getPluginManager().callEvent(useEvent);
}
@Override
@ -160,19 +169,22 @@ public class ProximityExplosive extends ItemUsable
{
if (event.getType() != UpdateType.FAST)
return;
Iterator<Entity> armedIter = _armed.keySet().iterator();
HashSet<Entity> expired = new HashSet<Entity>();
for (Entity ent : _armed.keySet())
while (armedIter.hasNext())
{
Entity ent = armedIter.next();
if (ent.isDead() || !ent.isValid() || ent.getTicksLived() >= 3600)
expired.add(ent);
}
for (Entity ent : expired)
{
Detonate(ent);
}
{
UtilParticle.PlayParticle(ParticleType.EXPLODE, ent.getLocation(), 0.1f, 0.1f, 0.1f, 0, 10,
ViewDist.MAX, UtilServer.getPlayers());
ent.remove();
armedIter.remove();
}
}
}
}

View File

@ -0,0 +1,104 @@
package mineplex.minecraft.game.classcombat.item.Throwable;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.classcombat.item.event.ProximityUseEvent;
import org.bukkit.Location;
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;
public class ProximityManager implements Listener
{
private int _proxyLimit = 6;
private HashMap<Player, ArrayList<Entry<String, Entity>>> _proxyMap = new HashMap<Player, ArrayList<Entry<String, Entity>>>();
public void setProxyLimit(int limit)
{
_proxyLimit = limit;
}
@EventHandler(priority = EventPriority.HIGHEST)
public void proximityThrownEvent(ProximityUseEvent event)
{
//Don't bother if the proxy has been disallowed
if (!event.getEntity().isValid())
return;
if (!_proxyMap.containsKey(event.getPlayer()))
_proxyMap.put(event.getPlayer(), new ArrayList<Entry<String,Entity>>());
ArrayList<Entry<String, Entity>> proxies = _proxyMap.get(event.getPlayer());
//Store New
proxies.add(new AbstractMap.SimpleEntry<String, Entity>(event.getItemType().GetName(), event.getEntity()));
//Clean Excess
while (proxies.size() > _proxyLimit)
{
Entry<String, Entity> entry = proxies.remove(0);
UtilPlayer.message(event.getPlayer(), F.main("Game", "Your old " + entry.getKey() + " was removed. Limit of " + _proxyLimit + "."));
entry.getValue().remove();
}
}
@EventHandler
public void clean(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
clean(null, 0);
}
public void clean(Location loc, int radius)
{
Iterator<Player> playerIter = _proxyMap.keySet().iterator();
while (playerIter.hasNext())
{
Player player = playerIter.next();
//Clean Offline Players
if (!player.isOnline())
{
playerIter.remove();
continue;
}
ArrayList<Entry<String,Entity>> proxies = _proxyMap.get(player);
Iterator<Entry<String,Entity>> proxyIter = proxies.iterator();
//Clean Dead Proxies
while (proxyIter.hasNext())
{
Entry<String,Entity> proxy = proxyIter.next();
if (!proxy.getValue().isValid() || //Dead
(loc != null && UtilMath.offset(proxy.getValue().getLocation(), loc) < radius)) //Around Radius
{
proxy.getValue().remove();
proxyIter.remove();
}
}
//Clean Empty Entries
if (proxies.isEmpty())
playerIter.remove();
}
}
}

View File

@ -2,7 +2,9 @@ package mineplex.minecraft.game.classcombat.item.Throwable;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.GameMode;
import org.bukkit.Material;
@ -31,6 +33,7 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.minecraft.game.classcombat.item.ItemFactory;
import mineplex.minecraft.game.classcombat.item.ItemUsable;
import mineplex.minecraft.game.classcombat.item.event.ProximityUseEvent;
public class ProximityZapper extends ItemUsable
{
@ -62,6 +65,13 @@ public class ProximityZapper extends ItemUsable
{
}
@Override
public void ThrowCustom(PlayerInteractEvent event, org.bukkit.entity.Item ent)
{
ProximityUseEvent useEvent = new ProximityUseEvent(event.getPlayer(), this, ent);
Bukkit.getServer().getPluginManager().callEvent(useEvent);
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
@ -154,18 +164,21 @@ public class ProximityZapper extends ItemUsable
if (event.getType() != UpdateType.FAST)
return;
HashSet<Entity> expired = new HashSet<Entity>();
for (Entity ent : _armed.keySet())
Iterator<Entity> armedIter = _armed.keySet().iterator();
while (armedIter.hasNext())
{
Entity ent = armedIter.next();
if (ent.isDead() || !ent.isValid() || ent.getTicksLived() >= 3600)
expired.add(ent);
}
for (Entity ent : expired)
{
Detonate(ent, null);
}
{
UtilParticle.PlayParticle(ParticleType.EXPLODE, ent.getLocation(), 0.1f, 0.1f, 0.1f, 0, 10,
ViewDist.MAX, UtilServer.getPlayers());
ent.remove();
armedIter.remove();
}
}
}
}

View File

@ -0,0 +1,48 @@
package mineplex.minecraft.game.classcombat.item.event;
import mineplex.minecraft.game.classcombat.item.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class ProximityUseEvent extends Event
{
private static final HandlerList handlers = new HandlerList();
private Player _player;
private Item _item;
private org.bukkit.entity.Item _entity;
public ProximityUseEvent(Player player, Item item, org.bukkit.entity.Item ent)
{
_player = player;
_item = item;
_entity = ent;
}
public HandlerList getHandlers()
{
return handlers;
}
public static HandlerList getHandlerList()
{
return handlers;
}
public Player getPlayer()
{
return _player;
}
public Item getItemType()
{
return _item;
}
public org.bukkit.entity.Item getEntity()
{
return _entity;
}
}

View File

@ -61,7 +61,8 @@ public class ClassShopManager extends MiniPlugin
Achievement.CHAMPIONS_THE_LONGEST_SHOT,
Achievement.CHAMPIONS_WINS,
Achievement.CHAMPIONS_CAPTURES,
Achievement.CHAMPIONS_CLUTCH
Achievement.CHAMPIONS_CLUTCH,
Achievement.CHAMPIONS_SPECIAL_WIN
});
}
}

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

@ -176,15 +176,7 @@ public class DamageManager extends MiniPlugin
{
NewDamageEvent(damagee, damager, proj, null, cause, damage, knockback, ignoreRate, ignoreArmor, source, reason, cancelled);
}
public void NewDamageEvent(LivingEntity damagee, LivingEntity damager, Projectile proj, Location knockbackOrigin,
DamageCause cause, double damage, boolean knockback, boolean ignoreRate, boolean ignoreArmor,
String source, String reason, boolean cancelled)
{
_plugin.getServer().getPluginManager().callEvent(new CustomDamageEvent(damagee, damager, proj, knockbackOrigin, cause,
damage, knockback, ignoreRate, ignoreArmor, source, reason, cancelled));
}
public void NewDamageEvent(LivingEntity damagee, LivingEntity damager, Projectile proj, Location knockbackOrigin,
DamageCause cause, double damage, boolean knockback, boolean ignoreRate, boolean ignoreArmor,
String source, String reason)
@ -193,6 +185,14 @@ public class DamageManager extends MiniPlugin
reason, false);
}
public void NewDamageEvent(LivingEntity damagee, LivingEntity damager, Projectile proj, Location knockbackOrigin,
DamageCause cause, double damage, boolean knockback, boolean ignoreRate, boolean ignoreArmor,
String source, String reason, boolean cancelled)
{
_plugin.getServer().getPluginManager().callEvent(new CustomDamageEvent(damagee, damager, proj, knockbackOrigin, cause,
damage, knockback, ignoreRate, ignoreArmor, source, reason, cancelled));
}
@EventHandler(priority = EventPriority.LOW)
public void CancelDamageEvent(CustomDamageEvent event)
{

View File

@ -42,9 +42,9 @@ public class Fire extends MiniPlugin
_damageManager = damageManager;
}
public void Add(Item item, LivingEntity owner, double expireTime, double delayTime, double burnTime, double damage, String skillName)
public void Add(Item item, LivingEntity owner, double expireTime, double delayTime, double burnTime, double damage, String skillName, boolean hitSelf)
{
_fire.put(item, new FireData(owner, expireTime, delayTime, burnTime, damage, skillName));
_fire.put(item, new FireData(owner, expireTime, delayTime, burnTime, damage, skillName, hitSelf));
item.setPickupDelay(0);
}
@ -60,13 +60,13 @@ public class Fire extends MiniPlugin
{
if (!_fire.get(fire).IsPrimed())
continue;
if (fire.getLocation().getBlock().isLiquid())
{
collided.put(fire, null);
continue;
}
for (LivingEntity ent : fire.getWorld().getEntitiesByClass(LivingEntity.class))
{
if (ent instanceof Player)
@ -75,13 +75,13 @@ public class Fire extends MiniPlugin
if (ent.hasPotionEffect(PotionEffectType.FIRE_RESISTANCE))
continue;
if (ent.getLocation().getBlock().getTypeId() == 8 || ent.getLocation().getBlock().getTypeId() == 9)
continue;
if (ent.equals(_fire.get(fire).GetOwner()))
if (!_fire.get(fire).canHitOwner() && ent.equals(_fire.get(fire).GetOwner()))
continue;
if (_conditionManager.HasCondition(ent, ConditionType.FIRE_ITEM_IMMUNITY, null))
{
continue;
@ -111,23 +111,23 @@ public class Fire extends MiniPlugin
if (!_fire.containsKey(fire))
return;
if (_fire.get(fire).GetOwner().equals(player))
if (!_fire.get(fire).canHitOwner() && _fire.get(fire).GetOwner().equals(player))
return;
event.setCancelled(true);
if (((CraftPlayer)player).getHandle().spectating)
return;
if (player.hasPotionEffect(PotionEffectType.FIRE_RESISTANCE))
return;
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9)
return;
if (!_fire.get(fire).IsPrimed())
return;
if (_conditionManager.HasCondition(player, ConditionType.FIRE_ITEM_IMMUNITY, null))
{
return;

View File

@ -10,8 +10,9 @@ public class FireData
private double _burnTime;
private double _damage;
private String _skillName;
private boolean _hitOwner;
public FireData(LivingEntity owner, double expireTime, double delayTime, double burnTime, double damage, String skillName)
public FireData(LivingEntity owner, double expireTime, double delayTime, double burnTime, double damage, String skillName, boolean hitSelf)
{
_owner = owner;
_expireTime = System.currentTimeMillis() + (long)(1000 * expireTime);
@ -19,6 +20,7 @@ public class FireData
_burnTime = burnTime;
_damage = damage;
_skillName = skillName;
_hitOwner = hitSelf;
}
public LivingEntity GetOwner()
@ -50,4 +52,9 @@ public class FireData
{
return System.currentTimeMillis() > _expireTime;
}
public boolean canHitOwner()
{
return _hitOwner;
}
}

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

@ -24,7 +24,6 @@ import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.creature.Creature;
@ -41,9 +40,7 @@ import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.movement.Movement;
import mineplex.core.notifier.NotificationManager;
import mineplex.core.npc.NpcManager;
import mineplex.core.packethandler.IPacketHandler;
import mineplex.core.packethandler.PacketHandler;
import mineplex.core.packethandler.PacketInfo;
import mineplex.core.party.PartyManager;
import mineplex.core.pet.PetManager;
import mineplex.core.poll.PollManager;
@ -61,7 +58,6 @@ import mineplex.core.status.ServerStatusManager;
import mineplex.core.task.TaskManager;
import mineplex.core.teleport.Teleport;
import mineplex.core.timing.TimingManager;
import mineplex.core.titangiveaway.TitanGiveawayManager;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.classcombat.Class.ClassManager;
import mineplex.minecraft.game.classcombat.Condition.SkillConditionManager;
@ -104,10 +100,10 @@ import nautilus.game.arcade.managers.GameSpectatorManager;
import nautilus.game.arcade.managers.GameStatManager;
import nautilus.game.arcade.managers.GameTournamentManager;
import nautilus.game.arcade.managers.GameWorldManager;
import nautilus.game.arcade.managers.HolidayManager;
import nautilus.game.arcade.managers.IdleManager;
import nautilus.game.arcade.managers.MiscManager;
import nautilus.game.arcade.shop.ArcadeShop;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
@ -235,16 +231,19 @@ public class ArcadeManager extends MiniPlugin implements IRelation
_explosionManager = new Explosion(plugin, _blockRestore);
_explosionManager.SetDebris(false);
if (serverConfig.GameList.contains(GameType.ChampionsDominate)
|| serverConfig.GameList.contains(GameType.ChampionsTDM)
|| serverConfig.GameList.contains(GameType.ChampionsCTF))
{
_conditionManager = new SkillConditionManager(plugin);
}
else
{
_conditionManager = new ConditionManager(plugin);
}
_conditionManager = new SkillConditionManager(plugin);
//Dont see a reason to ever just use the normal one
// if (serverConfig.GameList.contains(GameType.ChampionsDominate)
// || serverConfig.GameList.contains(GameType.ChampionsTDM)
// || serverConfig.GameList.contains(GameType.ChampionsCTF))
// {
// _conditionManager = new SkillConditionManager(plugin);
// }
// else
// {
// _conditionManager = new ConditionManager(plugin);
// }
_clientManager = clientManager;
_serverStatusManager = serverStatusManager;
@ -254,6 +253,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
_damageManager = damageManager;
_damageManager.UseSimpleWeaponDamage = true;
_damageManager.setConditionManager(_conditionManager);
_conditionManager.setDamageManager(_damageManager);
_disguiseManager = disguiseManager;
@ -713,6 +713,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation
{
event.setMotd(ChatColor.YELLOW + "In Progress" + extrainformation);
}
if (this.getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing"))
event.setMotd(ChatColor.GOLD + "Private Mineplex Test Server");
}
@EventHandler

View File

@ -72,7 +72,6 @@ public enum GameType
CastleSiege(CastleSiege.class, GameDisplay.CastleSiege),
ChampionsCTF(ChampionsCTF.class, GameDisplay.ChampionsCTF),
ChampionsDominate(ChampionsDominate.class, GameDisplay.ChampionsDominate),
//ChampionsMOBA(ChampionsMOBA.class, "Champions MOBA", "Champions", Material.SKULL_ITEM, (byte)0, GameCategory.CHAMPIONS, 7),
ChampionsTDM(ChampionsTDM.class, GameDisplay.ChampionsTDM),
Christmas(Christmas.class, GameDisplay.Christmas, "http://file.mineplex.com/ResChristmas.zip", true),
DeathTag(DeathTag.class, GameDisplay.DeathTag),
@ -83,7 +82,6 @@ public enum GameType
DragonsTeams(DragonsTeams.class, GameDisplay.DragonsTeams),
Draw(Draw.class, GameDisplay.Draw),
Evolution(Evolution.class, GameDisplay.Evolution),
//FlappyBird(FlappyBird.class, "Flappy Bird", Material.FEATHER, (byte)0, GameCategory.ARCADE, 17),
Gravity(Gravity.class, GameDisplay.Gravity),
Halloween(Halloween.class, GameDisplay.Halloween, "http://file.mineplex.com/ResHalloween.zip", true),
HideSeek(HideSeek.class, GameDisplay.HideSeek),
@ -92,7 +90,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://file.mineplex.com/ResMinestrike.zip", true),// Temp set to CHAMPIONS to fix UI bug
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

@ -195,7 +195,8 @@ public abstract class Game implements Listener
public boolean AutomaticRespawn = true;
public double DeathSpectateSecs = 0;
public boolean DeathTeleport = true;
public boolean QuitOut = true;
public boolean QuitDropItems = false;
@ -209,6 +210,7 @@ public abstract class Game implements Listener
public int WorldWaterDamage = 0;
public boolean WorldBoundaryKill = true;
public boolean WorldBlockBurn = false;
public boolean WorldBlockGrow = false;
public boolean WorldFireSpread = false;
public boolean WorldLeavesDecay = false;
public boolean WorldSoilTrample = false;

View File

@ -1,7 +1,9 @@
package nautilus.game.arcade.game.games.champions;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.inventory.data.Item;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.DeathMessageType;
@ -21,8 +23,11 @@ import nautilus.game.arcade.stats.ClutchStatTracker;
import nautilus.game.arcade.stats.ElectrocutionStatTracker;
import nautilus.game.arcade.stats.KillReasonStatTracker;
import nautilus.game.arcade.stats.SeismicSlamStatTracker;
import nautilus.game.arcade.stats.SpecialWinStatTracker;
import nautilus.game.arcade.stats.TheLongestShotStatTracker;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@ -59,6 +64,8 @@ public class ChampionsCTF extends CaptureTheFlag
Manager.GetDamage().UseSimpleWeaponDamage = false;
Manager.getCosmeticManager().setHideParticles(true);
Manager.getClassManager().GetItemFactory().getProximityManager().setProxyLimit(6);
this.StrictAntiHack = true;
InventoryOpenChest = true;
@ -76,10 +83,11 @@ public class ChampionsCTF extends CaptureTheFlag
new TheLongestShotStatTracker(this),
new SeismicSlamStatTracker(this),
new CapturesStatTracker(this, "Captures"),
new ClutchStatTracker(this, "Clutch")
new ClutchStatTracker(this, "Clutch"),
new SpecialWinStatTracker(this, "SpecialWin")
);
new ChampsFixer(this);
new ChampionsFixes(this);
}
@Override
@ -140,4 +148,19 @@ public class ChampionsCTF extends CaptureTheFlag
}
}
}
@EventHandler
public void cleanProximities(UpdateEvent event)
{
if (!IsLive())
return;
if (event.getType() != UpdateType.FAST)
return;
for (Location loc : getLocations(true))
{
Manager.getClassManager().GetItemFactory().getProximityManager().clean(loc, 12);
}
}
}

View File

@ -59,6 +59,8 @@ public class ChampionsDominate extends Domination
Manager.GetDamage().UseSimpleWeaponDamage = false;
Manager.getCosmeticManager().setHideParticles(true);
Manager.getClassManager().GetItemFactory().getProximityManager().setProxyLimit(6);
this.StrictAntiHack = true;
InventoryOpenChest = true;
@ -77,7 +79,7 @@ public class ChampionsDominate extends Domination
new SeismicSlamStatTracker(this)
);
new ChampsFixer(this);
new ChampionsFixes(this);
}
@Override

View File

@ -1,6 +1,9 @@
package nautilus.game.arcade.game.games.champions;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilServer;
import mineplex.core.inventory.data.Item;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.classcombat.Skill.Skill;
import nautilus.game.arcade.events.GameStateChangeEvent;
@ -9,6 +12,8 @@ import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.Game.GameState;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@ -18,11 +23,11 @@ import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryType;
public class ChampsFixer implements Listener
public class ChampionsFixes implements Listener
{
private Game _host;
public ChampsFixer(Game game)
public ChampionsFixes(Game game)
{
_host = game;
Bukkit.getPluginManager().registerEvents(this, _host.getArcadeManager().getPlugin());
@ -34,7 +39,7 @@ public class ChampsFixer implements Listener
if (event.GetGame() != _host)
return;
if (event.GetState() == GameState.Dead)
if (event.GetState() == GameState.End || event.GetState() == GameState.Dead)
HandlerList.unregisterAll(this);
}
@ -51,7 +56,7 @@ public class ChampsFixer implements Listener
return;
event.setCancelled(true);
event.setCancelMessage("You cannot change kits while holding someone in Dwarf Toss!");
event.setCancelMessage("You cannot change kits while using Dwarf Toss!");
}
@EventHandler(priority = EventPriority.HIGHEST)
@ -67,11 +72,14 @@ public class ChampsFixer implements Listener
}
@EventHandler
public void onUpdate(UpdateEvent event)
public void resetSkillsWhileInInventory(UpdateEvent event)
{
if (!_host.IsLive())
return;
if (event.getType() != UpdateType.FAST)
return;
for (Player player : UtilServer.getPlayers())
{
if (player.getOpenInventory() == null || player.getOpenInventory().getTopInventory() == null)
@ -97,5 +105,4 @@ public class ChampsFixer implements Listener
{
event.setCancelled(true);
}
}

View File

@ -59,6 +59,8 @@ public class ChampionsTDM extends TeamDeathmatch
this.Manager.GetDamage().UseSimpleWeaponDamage = false;
Manager.getCosmeticManager().setHideParticles(true);
Manager.getClassManager().GetItemFactory().getProximityManager().setProxyLimit(6);
this.StrictAntiHack = true;
@ -77,7 +79,7 @@ public class ChampionsTDM extends TeamDeathmatch
new SeismicSlamStatTracker(this)
);
new ChampsFixer(this);
new ChampionsFixes(this);
}
@Override

View File

@ -4,7 +4,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
@ -85,8 +84,7 @@ public class CaptureTheFlag extends TeamGame
private HashMap<Player, List<ItemStack>> _hotbars = new HashMap<Player, List<ItemStack>>();
private HashMap<Player, ItemStack> _helmets = new HashMap<Player, ItemStack>();
private boolean _redFlickerStage = false;
private boolean _blueFlickerStage = false;
private boolean _flickerStage = false;
public CaptureTheFlag(ArcadeManager manager, GameType type, Kit[] kits)
{
@ -224,8 +222,8 @@ public class CaptureTheFlag extends TeamGame
for (Resupply resupply : _resupply)
resupply.Update();
getFlag(true).handleBottomInfo(_redFlickerStage, ChatColor.RED);
getFlag(false).handleBottomInfo(_blueFlickerStage, ChatColor.AQUA);
getFlag(true).handleBottomInfo(_flickerStage, ChatColor.RED);
getFlag(false).handleBottomInfo(_flickerStage, ChatColor.AQUA);
}
else if (event.getType() == UpdateType.SEC)
for (Flag flag : _flags)
@ -407,6 +405,28 @@ public class CaptureTheFlag extends TeamGame
return null;
}
public List<Location> getLocations(boolean base)
{
List<Location> locs = new ArrayList<Location>();
if (base)
{
locs.add(_blueFlag);
locs.add(_redFlag);
}
else
{
locs.add(getFlag(true).getPlacedLocation());
locs.add(getFlag(false).getPlacedLocation());
}
return locs;
}
public int getScoreDifference()
{
return Math.abs(_blueScore - _redScore);
}
@Override
@EventHandler
public void ScoreboardUpdate(UpdateEvent event)
@ -432,22 +452,21 @@ public class CaptureTheFlag extends TeamGame
String redMessage = "Flag Dropped";
if (getFlag(true).isAtHome())
{
redMessage = "Flag Safe";
_redFlickerStage = false;
}
if (getFlag(true).getCarrier() != null)
redMessage = "Flag Taken";
if (_redFlickerStage)
if (_flickerStage)
{
Scoreboard.Write(C.cRed + redMessage);
_redFlickerStage = false;
if (!getFlag(true).isAtHome())
Scoreboard.Write(C.cRed + redMessage);
else
Scoreboard.Write(redMessage);
}
else
{
Scoreboard.Write(redMessage);
_redFlickerStage = true;
}
//Flag in play stuff
@ -457,23 +476,27 @@ public class CaptureTheFlag extends TeamGame
String blueMessage = "Flag Dropped";
if (getFlag(false).isAtHome())
{
blueMessage = "Flag Safe";
_blueFlickerStage = false;
}
if (getFlag(false).getCarrier() != null)
blueMessage = "Flag Taken";
if (_blueFlickerStage)
if (getFlag(false).getCarrier() != null)
{
Scoreboard.Write(C.cAqua + blueMessage);
_blueFlickerStage = false;
blueMessage = "Flag Taken";
}
if (_flickerStage)
{
if (!getFlag(false).isAtHome())
Scoreboard.Write(C.cAqua + blueMessage);
else
Scoreboard.Write(blueMessage);
}
else
{
Scoreboard.Write(blueMessage);
_blueFlickerStage = true;
}
_flickerStage = !_flickerStage;
//Flag in play stuff
Scoreboard.WriteBlank();

View File

@ -410,10 +410,13 @@ public class Flag
if (!_host.isAtHome(_team.GetColor() == ChatColor.RED ? ChatColor.BLUE : ChatColor.RED))
{
if (Recharge.Instance.use(player, "No Cap Message", 1000, false, false))
UtilTextMiddle.display("", C.cRed + "Your flag must be at home to capture!", player);
return;
if (_host.getArcadeManager().IsTournamentServer())
{
if (Recharge.Instance.use(player, "No Cap Message", 1000, false, false))
UtilTextMiddle.display("", C.cRed + "Your flag must be at home to capture!", player);
return;
}
}
_host.resetInventory(player);

View File

@ -129,7 +129,7 @@ public class PerkFlamingSwordEVO extends Perk
{
//Fire
Item fire = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER));
Manager.GetFire().Add(fire, player, 0.7, 0, 0.5, 1, "Inferno");
Manager.GetFire().Add(fire, player, 0.7, 0, 0.5, 1, "Inferno", false);
fire.teleport(player.getEyeLocation());
double x = 0.07 - (UtilMath.r(14)/100d);

View File

@ -116,6 +116,10 @@ import net.minecraft.server.v1_8_R3.EntityArrow;
public class MineStrike extends TeamGame
{
public static float RECOIL = 0.8f;
public static float CONE = 0.7f;
public static float MOVE_PENALTY = 0.8f;
public static class PlayerHeadshotEvent extends PlayerEvent
{
private static final HandlerList handlers = new HandlerList();
@ -207,10 +211,12 @@ 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;
private Player _bombHolder = null;
private long _bombHolderLastMove = 0;
private Player _bombPlanter;
private Player _bombDefuser;
@ -261,6 +267,8 @@ public class MineStrike extends TeamGame
this.ItemDrop = true;
this.DeathTeleport = false;
this.InventoryClick = true;
this.JoinInProgress = true;
@ -280,7 +288,7 @@ public class MineStrike extends TeamGame
"Sprinting heavily decreases accuracy",
"Jumping massively decreases accuracy",
"Crouching increases accuracy",
"Left-Click to roll Grenades",
"Left-Click to drop Grenades",
"Right-Click to throw Grenades",
"Burst Fire for greater accuracy",
"Sniper Rifles are only accurate while scoped",
@ -356,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)
@ -369,10 +377,10 @@ public class MineStrike extends TeamGame
gun.giveToPlayer(event.getPlayer(), true);
//Knife
event.getPlayer().getInventory().setItem(2, ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, "Knife"));
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));
}
}
@ -385,6 +393,8 @@ public class MineStrike extends TeamGame
{
//Dont Get Hit By Bullets
((CraftPlayer) event.getEntity()).getHandle().spectating = true;
Manager.GetCondition().Factory().Blind("Ghost", event.getEntity(), event.getEntity(), 2.5, 0, false, false, false);
}
// public void disguiseSneak(Player player, GameTeam team)
@ -530,6 +540,7 @@ public class MineStrike extends TeamGame
player.playSound(player.getLocation(), Sound.NOTE_PLING, 1f, 2f);
_bombHolder = player;
_bombHolderLastMove = System.currentTimeMillis();
if (_bombItem != null)
{
@ -602,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)
{
@ -717,6 +739,12 @@ public class MineStrike extends TeamGame
if (grenade == null)
return;
if (!UtilTime.elapsed(GetStateTime(), 10000))
{
UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot throw Grenades yet."));
return;
}
grenade.throwGrenade(event.getPlayer(), UtilEvent.isAction(event, ActionType.L), this);
event.setCancelled(true);
@ -1217,8 +1245,6 @@ public class MineStrike extends TeamGame
//Effect
damagee.getWorld().playSound(damagee.getLocation(), Sound.IRONGOLEM_DEATH, 1f, 1f);
event.SetKnockback(false);
}
//Standard
else
@ -1227,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);
}
}
@ -1291,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);
}
}
@ -1368,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;
}
@ -1404,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;
@ -1476,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))
@ -1601,7 +1621,7 @@ public class MineStrike extends TeamGame
_bombPlanter.setExp(Math.min(_bombPlanter.getExp() + 0.017f, 0.99999f));
if (Math.random() > 0.90)
_bombPlanter.getWorld().playSound(_bombPlanter.getLocation(), Sound.NOTE_PLING, 1f, 3f);
_bombPlanter.getWorld().playSound(_bombPlanter.getLocation(), Sound.NOTE_PLING, 2f, 3f);
UtilTextMiddle.display(C.cRed + C.Bold + "Planting Bomb", UtilTextMiddle.progress(_bombPlanter.getExp()), 0, 10, 0, _bombPlanter);
@ -1655,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;
@ -1700,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))
@ -2147,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())
@ -2398,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)
@ -2706,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
@ -2758,6 +2832,48 @@ public class MineStrike extends TeamGame
_shopManager.addMoney(event.getPlayer(), 16000, "Debug");
event.setCancelled(true);
}
if (event.getMessage().contains("recoil"))
{
try
{
MineStrike.RECOIL = Float.parseFloat(event.getMessage().split(" ")[1]);
this.Announce(C.cPurple + C.Bold + "Recoil Bloom: " + ChatColor.RESET + (int)(MineStrike.RECOIL * 100) + "%");
}
catch (Exception e)
{
}
event.setCancelled(true);
}
if (event.getMessage().contains("cone"))
{
try
{
MineStrike.CONE = Float.parseFloat(event.getMessage().split(" ")[1]);
this.Announce(C.cPurple + C.Bold + "Cone of Fire: " + ChatColor.RESET + (int)(MineStrike.CONE * 100) + "%");
}
catch (Exception e)
{
}
event.setCancelled(true);
}
if (event.getMessage().contains("move"))
{
try
{
MineStrike.MOVE_PENALTY = Float.parseFloat(event.getMessage().split(" ")[1]);
this.Announce(C.cPurple + C.Bold + "Move/Sprint/Jump Penalties: " + ChatColor.RESET + (int)(MineStrike.MOVE_PENALTY * 100) + "%");
}
catch (Exception e)
{
}
event.setCancelled(true);
}
if (event.getMessage().contains("instant"))
{
@ -2882,4 +2998,126 @@ public class MineStrike extends TeamGame
}
}
}
@EventHandler
public void bombMove(PlayerMoveEvent event)
{
if (_bombHolder == null || !event.getPlayer().equals(_bombHolder))
return;
_bombHolderLastMove = System.currentTimeMillis();
}
@EventHandler
public void bombTimeDrop(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
if (_freezeTime > 0)
_bombHolderLastMove = System.currentTimeMillis();
if (_bombHolder != null && UtilTime.elapsed(_bombHolderLastMove, 10000))
{
_bombHolder.getInventory().remove(Material.GOLD_SWORD);
Vector vel = new Vector(Math.random() - 0.5, 0, Math.random() - 0.5);
vel.normalize();
vel.multiply(0.3);
vel.setY(0.2);
_bombItem = _bombHolder.getWorld().dropItem(_bombHolder.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.GOLD_SWORD, (byte)0, 1, C.cGold + C.Bold + "C4 Explosive"));
_bombItem.setVelocity(vel);
_bombItem.setPickupDelay(60);
//Radio
playSound(Radio.T_BOMB_DROP, null, GetTeam(_bombHolder));
_bombHolder = null;
}
}
@Override
public Location GetSpectatorLocation()
{
if (SpectatorSpawn != null)
return SpectatorSpawn;
Vector vec = new Vector(0, 0, 0);
double count = 0;
for (GameTeam team : this.GetTeamList())
{
for (Location spawn : team.GetSpawns())
{
count++;
vec.add(spawn.toVector());
}
}
SpectatorSpawn = new Location(this.WorldData.World, 0, 0, 0);
vec.multiply(1d / count);
SpectatorSpawn.setX(vec.getX());
SpectatorSpawn.setY(vec.getY() + 50); //ADD 50
SpectatorSpawn.setZ(vec.getZ());
// Move Up - Out Of Blocks
while (!UtilBlock.airFoliage(SpectatorSpawn.getBlock())
|| !UtilBlock.airFoliage(SpectatorSpawn.getBlock().getRelative(BlockFace.UP)))
{
SpectatorSpawn.add(0, 1, 0);
}
int Up = 0;
// Move Up - Through Air
for (int i = 0; i < 15; i++)
{
if (UtilBlock.airFoliage(SpectatorSpawn.getBlock().getRelative(BlockFace.UP)))
{
SpectatorSpawn.add(0, 1, 0);
Up++;
}
else
{
break;
}
}
// Move Down - Out Of Blocks
while (Up > 0 && !UtilBlock.airFoliage(SpectatorSpawn.getBlock())
|| !UtilBlock.airFoliage(SpectatorSpawn.getBlock().getRelative(BlockFace.UP)))
{
SpectatorSpawn.subtract(0, 1, 0);
Up--;
}
SpectatorSpawn = SpectatorSpawn.getBlock().getLocation().add(0.5, 0.1, 0.5);
while (SpectatorSpawn.getBlock().getTypeId() != 0 || SpectatorSpawn.getBlock().getRelative(BlockFace.UP).getTypeId() != 0)
SpectatorSpawn.add(0, 1, 0);
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 = 3 ; i < 7 ; 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())
{
@ -51,7 +52,7 @@ public class HighExplosive extends Grenade
continue;
// Damage Event
game.Manager.GetDamage().NewDamageEvent(player, _thrower, null,
game.Manager.GetDamage().NewDamageEvent(player, _thrower, null, ent.getLocation(),
DamageCause.CUSTOM, 1 + (players.get(player) * 18),
true, true, false, _thrower.getName(), getName());

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)
{
@ -118,21 +120,31 @@ public class Gun extends StrikeItem
}
if (!Recharge.Instance.use(player, getName() + " Shoot", _gunStats.getFireRate(), false, false))
{
return;
}
//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));
@ -164,6 +176,7 @@ public class Gun extends StrikeItem
Vector cof = new Vector(Math.random() - 0.5, (Math.random() - 0.2) * (5d/8d), Math.random() - 0.5);
cof.normalize();
cof.multiply(cone);
cof.multiply(MineStrike.CONE);
cof.add(player.getLocation().getDirection());
cof.normalize();
@ -262,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());
@ -281,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()
@ -346,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);
@ -414,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

@ -1,5 +1,6 @@
package nautilus.game.arcade.game.games.minestrike.items.guns;
import nautilus.game.arcade.game.games.minestrike.MineStrike;
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
import org.bukkit.Material;
@ -241,7 +242,6 @@ public enum GunStats
private double _coneMin;
private double _coneMax;
private double _coneReduceRate;
private double _coneIncreaseRate;
private boolean _scope = false;
@ -375,7 +375,7 @@ public enum GunStats
public double getConeIncreaseRate()
{
return _coneIncreaseRate;
return _coneIncreaseRate * MineStrike.RECOIL;
}
public boolean getScope()

View File

@ -1,5 +1,7 @@
package nautilus.game.arcade.game.games.minestrike.items.guns;
import nautilus.game.arcade.game.games.minestrike.MineStrike;
public enum GunType
{
PISTOL("Pistol", 0.01, 0.02, 0.02, 3f, 0.1),
@ -38,17 +40,17 @@ public enum GunType
public double getMovePenalty()
{
return _movePenalty;
return _movePenalty * MineStrike.MOVE_PENALTY;
}
public double getSprintPenalty()
{
return _sprintPentalty;
return _sprintPentalty * MineStrike.MOVE_PENALTY;
}
public double getJumpPenalty()
{
return _jumpPenalty;
return _jumpPenalty * MineStrike.MOVE_PENALTY;
}
public float getVolume()

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);

Some files were not shown because too many files have changed in this diff Show More