Merge with master, lots of clans fixes/work

This commit is contained in:
Shaun Bennett 2015-11-25 14:50:49 -05:00
commit ff5d828dd7
147 changed files with 4545 additions and 1172 deletions

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

@ -55,12 +55,12 @@ public class MotdManager implements Listener, Runnable
//String motdLine = "§f§l◄ §c§lMaintenance§f§l ►";
//String motdLine = "§f§l◄ §a§lCarl the Creeper§f§l ►";
String motdLine = " §2§l§n M O N S T E R M A Z E B E T A §f";
//String motdLine = " §f§l◄ §a§lCarl the Creeper§f§l ▬ §c§l75% OFF SALE§f§l ►";
// String motdLine = " §2§l§n M O N S T E R M A Z E B E T A §f";
String motdLine = " §f§l◄ §b§lNew Game§f§l ▬ §3§lChampions CTF§f§l ►";
//String motdLine = " §d§lRank Sale §a§l40% Off");
//String motdLine = " §f§l◄§c§lMAINTENANCE§f§l►");
updateMainMotd(" §4§l§m §f§l§m §8§l§m[ §r §4§lMineplex§r §f§lGames§r §8§l§m ]§f§l§m §4§l§m §r", motdLine);
updateMainMotd(" §f§l§m §8§l§m[ §r §6§lMineplex§r §f§lGames§r §8§l§m ]§f§l§m §r", motdLine);
System.out.println("Updated Bungee MOTD");
}
}

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

@ -35,4 +35,4 @@ public class RadarData
{
return _bearing;
}
}
}

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

View File

@ -84,6 +84,8 @@ public class UtilRadar
text += C.cPurple + C.Bold + "] Radar";
UtilTextTop.display(text, player);
if(bossBar)
{
UtilTextTop.display(text, player);
@ -109,4 +111,4 @@ public class UtilRadar
}
}
}
}
}

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,8 +277,8 @@ public enum Achievement
//Champions
CHAMPIONS_WINS("Champion", 600,
new String[]{"Champions Domination.Wins", "Champions TDM.Wins"},
new String[]{"Win 80 games of Dominate or TDM"},
new String[]{"Champions Domination.Wins", "Champions TDM.Wins", "Champions Capture the Flag.Wins"},
new String[]{"Win 80 games of Dominate, TDM, or CTF"},
new int[]{80},
AchievementCategory.CHAMPIONS),
@ -295,28 +295,46 @@ public enum Achievement
AchievementCategory.CHAMPIONS),
CHAMPIONS_ASSASSINATION("Assassination", 1000,
new String[]{"Champions Domination.Assassination", "Champions TDM.Assassination"},
new String[]{"Champions Domination.Assassination", "Champions TDM.Assassination", "Champions Capture the Flag.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"},
new String[]{"Champions Domination.MassElectrocution", "Champions TDM.MassElectrocution", "Champions Capture the Flag.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"},
new String[]{"Champions Domination.TheLongestShot", "Champions TDM.TheLongestShot", "Champions Capture the Flag.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"},
new String[]{"Champions Domination.Earthquake", "Champions TDM.Earthquake", "Champions Capture the Flag.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[]{"Capture the Enemy Flag 20 times"},
new int[]{20},
AchievementCategory.CHAMPIONS),
CHAMPIONS_CLUTCH("Clutch", 600,
new String[]{"Champions Capture the Flag.Clutch"},
new String[]{"Kill the Enemy Flag Carrier in Sudden Death"},
new int[]{1},
AchievementCategory.CHAMPIONS),
CHAMPIONS_SPECIAL_WIN("Champion of Champions", 3000,
new String[]{"Champions Capture the Flag.SpecialWin"},
new String[]{"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,8 +78,8 @@ 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"},
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
CHAMPIONS("Champions", new String[] {"Champions Domination", "Champions TDM", "Champions Capture the Flag"},
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"),
MASTER_BUILDERS("Master Builders", null,

View File

@ -1,5 +1,9 @@
package mineplex.core.blockrestore;
import java.util.HashMap;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
@ -18,6 +22,8 @@ public class BlockRestoreData
protected long _meltDelay = 0;
protected long _meltLast = 0;
protected HashMap<Location, Byte> _pad = new HashMap<Location, Byte>();
protected boolean _restoreOnBreak;
@ -140,6 +146,11 @@ public class BlockRestoreData
{
if (_toID == 78 && _toData == (byte)7)
_block.setTypeIdAndData(80, (byte)0, true);
else if (_toID == 8 || _toID == 9 || _toID == 79)
{
handleLilypad(false);
_block.setTypeIdAndData(_toID, _toData, true);
}
else
_block.setTypeIdAndData(_toID, _toData, true);
}
@ -152,6 +163,7 @@ public class BlockRestoreData
public void restore()
{
_block.setTypeIdAndData(_fromID, _fromData, true);
handleLilypad(true);
}
public void setFromId(int i)
@ -163,4 +175,24 @@ public class BlockRestoreData
{
_fromData = i;
}
private void handleLilypad(boolean restore)
{
if (restore)
{
for (Location l : _pad.keySet())
{
l.getBlock().setType(Material.WATER_LILY);
l.getBlock().setData(_pad.get(l));
}
}
else
{
if (_block.getRelative(BlockFace.UP, 1).getType() == Material.WATER_LILY)
{
_pad.put(_block.getRelative(BlockFace.UP, 1).getLocation(), _block.getRelative(BlockFace.UP, 1).getData());
_block.getRelative(BlockFace.UP, 1).setType(Material.AIR);
}
}
}
}

View File

@ -112,7 +112,7 @@ public class MobCommand extends MultiCommandBase<Creature>
HashSet<Entity> entSet = new HashSet<Entity>();
for (int i = 0 ; i < count ; i++)
{
entSet.add(Plugin.SpawnEntity(caller.getTargetBlock((Set<Material>) null, 0).getLocation().add(0.5, 1, 0.5), type));
entSet.add(Plugin.SpawnEntity(caller.getTargetBlock((Set<Material>) null, 150).getLocation().add(0.5, 1, 0.5), type));
}
//Search Vars

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
@ -11,7 +12,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),
@ -22,8 +22,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,6 +66,8 @@ public enum GameDisplay
MonsterMaze("Monster Maze", Material.ROTTEN_FLESH, (byte)0, GameCategory.ARCADE, 55),
Lobbers("Bomb Lobbers", Material.FIREBALL, (byte) 0, GameCategory.ARCADE, 54),
ChampionsCTF("Champions CTF", "Champions", Material.BANNER, DyeColor.RED.getDyeData(), GameCategory.CHAMPIONS, 56),
Event("Mineplex Event", Material.CAKE, (byte)0, GameCategory.EVENT, 999);

View File

@ -11,9 +11,19 @@ import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Rank;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.donation.DonationManager;
import mineplex.core.giveaway.GiveawayManager;
import mineplex.core.globalpacket.command.GlobalPacketCommand;
import mineplex.core.globalpacket.listeners.GlobalGiveCoins;
import mineplex.core.globalpacket.listeners.GlobalGiveGems;
import mineplex.core.globalpacket.listeners.GlobalGiveItem;
import mineplex.core.globalpacket.listeners.GlobalRawr;
import mineplex.core.globalpacket.redis.GlobalPacketHandler;
import mineplex.core.globalpacket.redis.GlobalPacketMessage;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.pet.PetManager;
import mineplex.core.reward.RewardManager;
import mineplex.core.stats.StatsManager;
import mineplex.core.status.ServerStatusManager;
import mineplex.serverdata.commands.ServerCommandManager;
@ -21,15 +31,32 @@ public class GlobalPacketManager extends MiniPlugin
{
private CoreClientManager _clientManager;
private ServerStatusManager _statusManager;
private InventoryManager _inventoryManager;
private DonationManager _donationManager;
private RewardManager _rewardManager;
public GlobalPacketManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager)
public GlobalPacketManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, InventoryManager inventoryManager, DonationManager donationManager, PetManager petManager, StatsManager statsManager, GiveawayManager giveawayManager)
{
super("Global Packet Manager", plugin);
_clientManager = clientManager;
_statusManager = statusManager;
_inventoryManager = inventoryManager;
_donationManager = donationManager;
_rewardManager = new RewardManager(clientManager, statusManager, donationManager, inventoryManager, petManager, statsManager, giveawayManager,
100, 250,
500, 1000,
1500, 2500,
6000, 12000,
false, false);
ServerCommandManager.getInstance().registerCommandType("GlobalPacketMessage", GlobalPacketMessage.class, new GlobalPacketHandler(statusManager));
getPluginManager().registerEvents(new GlobalGiveItem(inventoryManager, _rewardManager), getPlugin());
getPluginManager().registerEvents(new GlobalGiveGems(donationManager), getPlugin());
getPluginManager().registerEvents(new GlobalGiveCoins(donationManager, clientManager), getPlugin());
getPluginManager().registerEvents(new GlobalRawr(), getPlugin());
}
public void callGlobalCommand(Player caller, String[] args)

View File

@ -12,7 +12,7 @@ public class GlobalPacketCommand extends CommandBase<GlobalPacketManager>
{
public GlobalPacketCommand(GlobalPacketManager plugin)
{
super(plugin, Rank.ADMIN, "globalpacket");
super(plugin, Rank.JNR_DEV, "global", "globalpacket");
}
@Override
@ -20,8 +20,8 @@ public class GlobalPacketCommand extends CommandBase<GlobalPacketManager>
{
if (args == null || args.length < 1)
{
UtilPlayer.message(caller, F.main("Global", "Please call the globalpacket command with at least 1 argument"));
UtilPlayer.message(caller, F.main("Global", "For help please see /globalpacket google doc"));
UtilPlayer.message(caller, F.main("Global", "Please call the global command with at least 1 argument"));
UtilPlayer.message(caller, F.main("Global", "For help please see /global google doc"));
return;
}

View File

@ -0,0 +1,82 @@
package mineplex.core.globalpacket.listeners;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.donation.DonationManager;
import mineplex.core.globalpacket.event.GlobalPacketEvent;
/**
* Created by William (WilliamTiger).
* 17/11/15
*/
public class GlobalGiveCoins implements Listener
{
private DonationManager _donationManager;
private CoreClientManager _clientManager;
public GlobalGiveCoins(DonationManager donationManager, CoreClientManager coreClientManager)
{
_donationManager = donationManager;
_clientManager = coreClientManager;
}
@EventHandler
public void giveCoins(final GlobalPacketEvent e)
{
if (!e.getCallerRank().has(Rank.ADMIN))
return;
if (e.getParts() == null || e.getParts().length < 1)
return;
if (!e.getParts()[0].equalsIgnoreCase("givecoins"))
return;
if (e.getParts().length != 2)
{
if (e.getCaller() != null)
UtilPlayer.message(e.getCaller(), F.main("Global", "/global givecoins <amount>"));
return;
}
int amount = 1;
try
{
amount = Integer.parseInt(e.getParts()[1]);
}
catch (Exception ex)
{
// No number
if (e.getCaller() != null)
UtilPlayer.message(e.getCaller(), F.main("Global", "[" + F.elem(amount + "") + "] is not a valid amount."));
return;
}
final int fAmount = amount;
for (final Player p : UtilServer.getPlayers())
{
_donationManager.RewardCoins(new Callback<Boolean>()
{
@Override
public void run(Boolean data)
{
UtilPlayer.message(p, F.main("Global", "You received " + F.elem(fAmount + " Coins") + "."));
UtilTextMiddle.display(C.cYellow + fAmount + " Coins", C.cGold + "received from " + e.getCallerName() + "!", p);
}
}, "Global Coins", p.getName(), _clientManager.getAccountId(p), amount);
}
}
}

View File

@ -0,0 +1,79 @@
package mineplex.core.globalpacket.listeners;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.donation.DonationManager;
import mineplex.core.globalpacket.event.GlobalPacketEvent;
/**
* Created by William (WilliamTiger).
* 17/11/15
*/
public class GlobalGiveGems implements Listener
{
private DonationManager _donationManager;
public GlobalGiveGems(DonationManager donationManager)
{
_donationManager = donationManager;
}
@EventHandler
public void giveGems(final GlobalPacketEvent e)
{
if (!e.getCallerRank().has(Rank.ADMIN))
return;
if (e.getParts() == null || e.getParts().length < 1)
return;
if (!e.getParts()[0].equalsIgnoreCase("givegems"))
return;
if (e.getParts().length != 2)
{
if (e.getCaller() != null)
UtilPlayer.message(e.getCaller(), F.main("Global", "/global givegems <amount>"));
return;
}
int amount = 1;
try
{
amount = Integer.parseInt(e.getParts()[1]);
}
catch (Exception ex)
{
// No number
if (e.getCaller() != null)
UtilPlayer.message(e.getCaller(), F.main("Global", "[" + F.elem(amount + "") + "] is not a valid amount."));
return;
}
final int fAmount = amount;
for (final Player p : UtilServer.getPlayers())
{
_donationManager.RewardGems(new Callback<Boolean>()
{
@Override
public void run(Boolean data)
{
UtilPlayer.message(p, F.main("Global", "You received " + F.elem(fAmount + " Gems") + "."));
UtilTextMiddle.display(C.cYellow + fAmount + " Gems", C.cGold + "received from " + e.getCallerName() + "!", p);
}
}, "Global Gems", p.getName(), p.getUniqueId(), amount);
}
}
}

View File

@ -0,0 +1,156 @@
package mineplex.core.globalpacket.listeners;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.globalpacket.event.GlobalPacketEvent;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.reward.Reward;
import mineplex.core.reward.RewardData;
import mineplex.core.reward.RewardManager;
import mineplex.core.reward.RewardType;
/**
* Created by William (WilliamTiger).
* 17/11/15
*/
public class GlobalGiveItem implements Listener
{
private InventoryManager _inventoryManager;
private RewardManager _rewardManager;
public GlobalGiveItem(InventoryManager inventoryManager, RewardManager rewardManager)
{
_inventoryManager = inventoryManager;
_rewardManager = rewardManager;
}
public enum GlobalItem
{
OLD_CHEST("Old Chest"),
ANCIENT_CHEST("Ancient Chest"),
MYTHICAL_CHEST("Mythical Chest"),
GAME_LOOT("Game Loot");
private String _invName;
GlobalItem(String invName)
{
_invName = invName;
}
public String getInvName()
{
return _invName;
}
}
@EventHandler
public void giveItem(final GlobalPacketEvent e)
{
if (!e.getCallerRank().has(Rank.ADMIN))
return;
if (e.getParts() == null || e.getParts().length < 1)
return;
if (!e.getParts()[0].equalsIgnoreCase("giveitem"))
return;
if (e.getParts().length != 3)
{
if (e.getCaller() != null)
UtilPlayer.message(e.getCaller(), F.main("Global", "/global giveitem <item> <amount>"));
return;
}
GlobalItem item = null;
try
{
item = GlobalItem.valueOf(e.getParts()[1]);
}
catch (Exception ex)
{
// Wrong item
if (e.getCaller() != null)
{
UtilPlayer.message(e.getCaller(), F.main("Global", "That GlobalItem type can't be found. Types:"));
String list = "";
for (GlobalItem i : GlobalItem.values())
list += i.toString() + " ";
UtilPlayer.message(e.getCaller(), C.cYellow + list);
}
return;
}
int amount = 1; // Default, shouldn't happen anyway.
try
{
amount = Integer.parseInt(e.getParts()[2]);
}
catch (Exception ex)
{
// Not a number
if (e.getCaller() != null)
UtilPlayer.message(e.getCaller(), F.main("Global", "[" + F.elem(e.getParts()[2]) + "] is not a valid number."));
return;
}
if (item.toString().contains("CHEST"))
{
for (final Player p : UtilServer.getPlayers())
{
final int fAmount = amount;
final GlobalItem fItem = item;
_inventoryManager.addItemToInventory(new Callback<Boolean>()
{
@Override
public void run(Boolean data)
{
UtilPlayer.message(p, F.main("Global", "You received " + F.elem(fAmount + " " + fItem.getInvName() + "(s)") + " from " + F.name(e.getCallerName()) + "."));
UtilTextMiddle.display(C.cYellow + fAmount + " " + fItem.getInvName() + "(s)", C.cGold + "received from " + e.getCallerName() + "!", p);
}
}, p, item.getInvName(), amount);
}
return;
}
else if (item.toString().equalsIgnoreCase("GAME_LOOT"))
{
for (final Player p : UtilServer.getPlayers())
{
Reward reward = _rewardManager.nextReward(p, null, false, RewardType.GameLoot, true);
reward.giveReward(RewardType.GameLoot, p, new Callback<RewardData>()
{
@Override
public void run(RewardData data)
{
UtilPlayer.message(p, F.main("Global", "You received " + F.elem("Game Loot") + " from " + F.name(e.getCallerName()) + "."));
UtilPlayer.message(p, F.main("Global", "You won " + F.elem(data.getFriendlyName()) + "!"));
UtilTextMiddle.display(C.cYellow + data.getFriendlyName(), C.cGold + "received from " + e.getCallerName() + "!", p);
}
});
}
}
}
}

View File

@ -0,0 +1,50 @@
package mineplex.core.globalpacket.listeners;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.globalpacket.event.GlobalPacketEvent;
/**
* Created by William (WilliamTiger).
* 18/11/15
*/
public class GlobalRawr implements Listener
{
@EventHandler
public void globalRawr(GlobalPacketEvent e)
{
if (e.getParts() == null || e.getParts().length < 1)
return;
if (!e.getParts()[0].equalsIgnoreCase("rawr"))
return;
if (e.getParts().length < 2)
{
if (e.getCaller() != null)
UtilPlayer.message(e.getCaller(), F.main("Global", "/global rawr <msg>"));
return;
}
String msg = "";
for (int i = 1; i < e.getParts().length; i++)
{
msg += e.getParts()[i] + " ";
}
msg = msg.trim();
for (Player p : UtilServer.getPlayers())
{
UtilTextMiddle.display("§6§lRAWR!", "§e" + msg, p);
}
}
}

View File

@ -83,7 +83,7 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
addCommand(new ResendAdminCommand(this));
addCommand(new AnnounceCommand(this));
addCommand(new GlobalCommand(this));
//addCommand(new GlobalCommand(this));
addCommand(new AdminCommand(this));
}
@ -219,16 +219,16 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
Get(from).LastToTime = System.currentTimeMillis();
// Chiss or defek7
if (to.getName().equals("Chiss") || to.getName().equals("defek7") || to.getName().equals("Phinary") || to.getName().equals("fooify"))
if (to.getName().equals("Chiss") || to.getName().equals("defek7") || to.getName().equals("Phinary") || to.getName().equals("fooify") || to.getName().equals("sampepere"))
{
UtilPlayer.message(from, C.cPurple + to.getName() + " is often AFK or minimized, due to plugin development.");
UtilPlayer.message(from, C.cPurple + "Please be patient if he does not reply instantly.");
}
if(to.getName().equals("ishh"))
/*if(to.getName().equals("ishh"))
{
UtilPlayer.message(from, C.cPurple + "Hi, my name is ishh. If I don't respond to your message, please be patient and try again later!");
}
}*/
// Log
// Logger().logChat("Private Message", from, to.getName(), message);

View File

@ -1,32 +0,0 @@
package mineplex.core.message.commands;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.message.MessageManager;
import mineplex.serverdata.commands.AnnouncementCommand;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
public class GlobalCommand extends CommandBase<MessageManager>
{
public GlobalCommand(MessageManager plugin)
{
super(plugin, Rank.ADMIN, "global");
}
@Override
public void Execute(Player caller, String[] args)
{
if (args == null || args.length == 0)
{
Plugin.Help(caller);
}
else
{
new AnnouncementCommand(false, F.combine(args, 0, null, false)).publish();
}
}
}

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

@ -10,6 +10,7 @@ import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.Sound;
import org.bukkit.entity.Entity;
@ -149,6 +150,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

@ -16,6 +16,7 @@ import net.minecraft.server.v1_8_R3.MathHelper;
import net.minecraft.server.v1_8_R3.MovingObjectPosition;
import net.minecraft.server.v1_8_R3.Vec3D;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.GameMode;
import org.bukkit.Sound;
@ -268,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

@ -16,6 +16,8 @@ import mineplex.core.common.util.UtilTime.TimeUnit;
import mineplex.core.punish.Command.PunishCommand;
import mineplex.core.punish.Tokens.PunishClientToken;
import mineplex.core.punish.Tokens.PunishmentToken;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.serverdata.commands.ServerCommandManager;
import org.bukkit.Bukkit;
@ -107,6 +109,33 @@ public class Punish extends MiniPlugin
event.setCancelled(true);
}
}
@EventHandler
public void banRefresh(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
return;
for (Player check : UtilServer.getPlayers())
{
PunishClient client = GetClient(check.getName());
if (client != null && client.IsBanned())
{
Punishment punishment = client.GetPunishment(PunishmentSentence.Ban);
String time = UtilTime.convertString(punishment.GetRemaining(), 0, TimeUnit.FIT);
if (punishment.GetHours() == -1)
time = "Permanent";
String reason = C.cRed + C.Bold + "You are banned for " + time +
"\n" + C.cWhite + punishment.GetReason() +
"\n" + C.cDGreen + "Unfairly banned? Appeal at " + C.cGreen + "www.mineplex.com/appeals"
;
check.kickPlayer(reason);
}
}
}
public void Help(Player caller)
{

View File

@ -32,7 +32,7 @@ public class ResPackManager implements CommandCallback
{
if (_packUnloadCheck.canSendUnload(player))
{
player.setResourcePack("http://www.chivebox.com/file/c/empty.zip");
player.setResourcePack("http://file.mineplex.com/ResReset.zip");
}
}
}

View File

@ -0,0 +1,22 @@
package mineplex.core.reward;
import mineplex.core.common.Rank;
import org.bukkit.inventory.ItemStack;
public class RankRewardData extends RewardData
{
private Rank _rank;
public RankRewardData(String friendlyName, ItemStack displayItem, RewardRarity rarity, Rank rank)
{
super(friendlyName, displayItem, rarity);
_rank = rank;
}
public Rank getWonRank()
{
return _rank;
}
}

View File

@ -407,7 +407,7 @@ public class RewardManager
}
if (canGiveMythical && type == RewardType.MythicalChest && !_clientManager.Get(player).GetRank().has(Rank.TITAN))
{
return new RankReward(_clientManager, _statusManager, 0, rarity);
return new RankReward(_clientManager, 0, rarity);
}
else if (!canGiveMythical || _clientManager.Get(player).GetRank().has(Rank.LEGEND))
{
@ -415,7 +415,7 @@ public class RewardManager
}
else
{
return new RankReward(_clientManager, _statusManager, 0, rarity);
return new RankReward(_clientManager, 0, rarity);
}
}

View File

@ -62,7 +62,7 @@ public class GiveawayReward extends Reward
// Dang, I guess we failed!
if (!_clientManager.hasRank(player, Rank.TITAN))
{
Reward reward = new RankReward(_clientManager, _serverStatusManager, 0, getRarity());
Reward reward = new RankReward(_clientManager, 0, getRarity());
reward.giveReward(rewardType, player, rewardDataCallback);
}
else

View File

@ -2,31 +2,28 @@ package mineplex.core.reward.rewards;
import java.util.Random;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Rank;
import mineplex.core.reward.RankRewardData;
import mineplex.core.reward.Reward;
import mineplex.core.reward.RewardData;
import mineplex.core.reward.RewardRarity;
import mineplex.core.reward.RewardType;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Rank;
import mineplex.core.reward.Reward;
import mineplex.core.reward.RewardData;
import mineplex.core.reward.RewardRarity;
import mineplex.core.reward.RewardType;
import mineplex.core.status.ServerStatusManager;
import mineplex.core.titangiveaway.redis.TitanChestGiveawayMessage;
public class RankReward extends Reward
{
private Random _random;
private CoreClientManager _clientManager;
private ServerStatusManager _statusManager;
public RankReward(CoreClientManager clientManager, ServerStatusManager statusManager, int weight, RewardRarity rarity)
public RankReward(CoreClientManager clientManager, int weight, RewardRarity rarity)
{
super(rarity, weight);
_clientManager = clientManager;
_statusManager = statusManager;
_random = new Random();
}
@ -47,14 +44,8 @@ public class RankReward extends Reward
_clientManager.Get(player).SetRank(rank, false);
_clientManager.getRepository().saveRank(null, player.getName(), player.getUniqueId(), rank, true);
if (rank == Rank.TITAN)
{
TitanChestGiveawayMessage message = new TitanChestGiveawayMessage(player.getName(), _statusManager.getCurrentServerName());
message.publish();
}
return new RewardData(getRarity().getColor() + rank.Name + " Rank", new ItemStack(Material.NETHER_STAR), getRarity());
return new RankRewardData(getRarity().getColor() + rank.Name + " Rank", new ItemStack(Material.NETHER_STAR), getRarity(), rank);
}
@Override
@ -68,7 +59,7 @@ public class RankReward extends Reward
if (rank == null)
return new RewardData(getRarity().getColor() + "Rank Upgrade Error", new ItemStack(Material.PAPER), getRarity());
return new RewardData(getRarity().getColor() + rank.Name + " Rank", new ItemStack(Material.NETHER_STAR), getRarity());
return new RankRewardData(getRarity().getColor() + rank.Name + " Rank", new ItemStack(Material.NETHER_STAR), getRarity(), rank);
}
@Override

View File

@ -6,30 +6,25 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Random;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers;
import org.bukkit.entity.Player;
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.PacketPlayOutBlockAction;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.hologram.HologramManager;
import mineplex.core.reward.RankRewardData;
import mineplex.core.reward.Reward;
import mineplex.core.reward.RewardData;
import mineplex.core.reward.RewardRarity;
import mineplex.core.reward.RewardType;
import mineplex.core.status.ServerStatusManager;
import mineplex.core.titangiveaway.redis.TitanChestGiveawayMessage;
import mineplex.core.treasure.animation.Animation;
import mineplex.core.treasure.animation.BlockChangeAnimation;
import mineplex.core.treasure.animation.ChestOpenAnimation;
@ -37,16 +32,25 @@ import mineplex.core.treasure.animation.ChestSpawnAnimation;
import mineplex.core.treasure.animation.LootLegendaryAnimation;
import mineplex.core.treasure.animation.LootMythicalAnimation;
import mineplex.core.treasure.animation.LootRareAnimation;
import mineplex.core.treasure.animation.TreasureRemoveAnimation;
import mineplex.core.treasure.animation.LootUncommonAnimation;
import mineplex.core.treasure.animation.TreasureRemoveAnimation;
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.PacketPlayOutBlockAction;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers;
import org.bukkit.entity.Player;
/**
* Created by Shaun on 8/27/2014.
*/
public class Treasure
{
private BlockRestore _blockRestore;
private BlockRestore _blockRestore;
private List<BlockInfo> _chestBlockInfo = new ArrayList<BlockInfo>();
private List<BlockInfo> _openedChestBlockInfo = new ArrayList<BlockInfo>();
private List<BlockInfo> _otherBlockInfo = new ArrayList<BlockInfo>();
@ -60,8 +64,9 @@ public class Treasure
private ChestData[] _chestData;
private int _currentChest;
private RewardData[] _rewardDatas;
private Reward[] _rewards;
private RewardType _rewardType;
private ConcurrentHashMap<Integer, RewardData> _rewardData = new ConcurrentHashMap<Integer, RewardData>();
private int _currentReward;
private boolean _finished;
@ -70,15 +75,16 @@ public class Treasure
private LinkedList<Animation> _animations;
private HologramManager _hologramManager;
private ServerStatusManager _statusManager;
public Treasure(Player player, Reward[] rewards, RewardType rewardType, Block centerBlock, Block[] chestBlocks, TreasureType treasureType, BlockRestore blockRestore, HologramManager hologramManager)
public Treasure(Player player, Reward[] rewards, RewardType rewardType, Block centerBlock, Block[] chestBlocks, TreasureType treasureType, BlockRestore blockRestore, HologramManager hologramManager, ServerStatusManager statusManager)
{
this(player, new Random(), rewards, rewardType, centerBlock, chestBlocks, treasureType, hologramManager);
this(player, new Random(), rewards, rewardType, centerBlock, chestBlocks, treasureType, hologramManager, statusManager);
_blockRestore = blockRestore;
}
public Treasure(Player player, Random seed, Reward[] rewards, RewardType rewardType, Block centerBlock, Block[] chestBlocks, TreasureType treasureType, HologramManager hologramManager)
public Treasure(Player player, Random seed, Reward[] rewards, RewardType rewardType, Block centerBlock, Block[] chestBlocks, TreasureType treasureType, HologramManager hologramManager, ServerStatusManager statusManager)
{
_player = player;
_random = seed;
@ -88,23 +94,12 @@ public class Treasure
_centerBlock = centerBlock;
_animations = new LinkedList<Animation>();
_hologramManager = hologramManager;
_statusManager = statusManager;
_currentChest = 0;
_currentReward = 0;
_rewardType = rewardType;
for (int i = 0; i < _rewardDatas.length; i++)
{
final int index = i;
rewards[i].giveReward(rewardType, player, new Callback<RewardData>()
{
@Override
public void run(RewardData data)
{
_rewardDatas[index] = data;
}
});
}
_rewards = rewards;
_chestData = new ChestData[chestBlocks.length];
for (int i = 0; i < _chestData.length; i++)
@ -113,6 +108,19 @@ public class Treasure
}
_animations.add(new BlockChangeAnimation(this, _otherBlockInfo));
for (int i = 0; i < _rewards.length; i++)
{
Reward reward = _rewards[i];
final int count = i;
reward.giveReward(_rewardType, player, new Callback<RewardData>()
{
@Override
public void run(RewardData data) {
_rewardData.put(count, data);
}
});
}
}
public int getFinishedTickCount()
@ -213,48 +221,64 @@ public class Treasure
{
// This is very experimental! Pray to god that this works
final ChestData data = getChestData(block);
if (data != null && !data.isOpened() && _currentReward < _rewardDatas.length)
if (data != null && !data.isOpened() && _currentReward < _rewards.length)
{
RewardData rewardData = _rewardDatas[_currentReward];
//final Reward reward = _rewards[_currentReward];
final RewardData rewardData = _rewardData.get(_currentReward);
data.setOpened(true);
_currentReward++;
if (swapList)
{
BlockInfo info = getBlockInfo(block);
_chestBlockInfo.remove(info);
_openedChestBlockInfo.add(info);
}
//reward.giveReward(_rewardType, _player, new Callback<RewardData>()
//{
//@Override
//public void run(RewardData rewardData)
//{
if (swapList)
{
BlockInfo info = getBlockInfo(block);
_chestBlockInfo.remove(info);
_openedChestBlockInfo.add(info);
}
ChestOpenAnimation chestOpenTask = new ChestOpenAnimation(Treasure.this, data, rewardData, _hologramManager);
_animations.add(chestOpenTask);
ChestOpenAnimation chestOpenTask = new ChestOpenAnimation(Treasure.this, data, rewardData, _hologramManager);
_animations.add(chestOpenTask);
// Extra effects based off the rarity of the treasure
if (rewardData.getRarity() == RewardRarity.UNCOMMON)
{
_animations.add(new LootUncommonAnimation(Treasure.this, data.getBlock()));
}
else if (rewardData.getRarity() == RewardRarity.RARE)
{
_animations.add(new LootRareAnimation(Treasure.this, data.getBlock().getLocation().add(0.5, 1.5, 0.5)));
Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " found " + C.cPurple + "Rare " + rewardData.getFriendlyName()));
}
else if (rewardData.getRarity() == RewardRarity.LEGENDARY)
{
_animations.add(new LootLegendaryAnimation(Treasure.this, data.getBlock()));
Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " found " + C.cGreen + "Legendary " + rewardData.getFriendlyName()));
}
else if (rewardData.getRarity() == RewardRarity.MYTHICAL)
{
_animations.add(new LootMythicalAnimation(Treasure.this, data.getBlock()));
Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " found " + C.cRed + "Mythical " + rewardData.getFriendlyName()));
}
// Extra effects based off the rarity of the treasure
if (rewardData.getRarity() == RewardRarity.UNCOMMON)
{
_animations.add(new LootUncommonAnimation(Treasure.this, data.getBlock()));
}
else if (rewardData.getRarity() == RewardRarity.RARE)
{
_animations.add(new LootRareAnimation(Treasure.this, data.getBlock().getLocation().add(0.5, 1.5, 0.5)));
Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " found " + C.cPurple + "Rare " + rewardData.getFriendlyName()));
}
else if (rewardData.getRarity() == RewardRarity.LEGENDARY)
{
_animations.add(new LootLegendaryAnimation(Treasure.this, data.getBlock()));
Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " found " + C.cGreen + "Legendary " + rewardData.getFriendlyName()));
}
else if (rewardData.getRarity() == RewardRarity.MYTHICAL)
{
if (rewardData instanceof RankRewardData)
{
if (((RankRewardData)rewardData).getWonRank() == Rank.TITAN)
{
TitanChestGiveawayMessage message = new TitanChestGiveawayMessage(_player.getName(), _statusManager.getCurrentServerName());
message.publish();
}
}
_animations.add(new LootMythicalAnimation(Treasure.this, data.getBlock()));
Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " found " + C.cRed + "Mythical " + rewardData.getFriendlyName()));
}
if (isFinished())
{
TreasureRemoveAnimation animation = new TreasureRemoveAnimation(Treasure.this, _openedChestBlockInfo, _chestBlockInfo);
_animations.add(animation);
_finished = true;
}
if (isFinished())
{
TreasureRemoveAnimation animation = new TreasureRemoveAnimation(Treasure.this, _openedChestBlockInfo, _chestBlockInfo);
_animations.add(animation);
_finished = true;
}
//}
//});
}
}
@ -306,12 +330,25 @@ public class Treasure
public boolean isFinished()
{
return _currentReward == _rewardDatas.length;
return _currentReward == _rewards.length;
}
public void cleanup()
{
_currentReward = _rewardDatas.length;
for (int i = _currentReward; i < _rewards.length; i++)
{
_rewards[_currentReward].giveReward(_rewardType, _player, new Callback<RewardData>()
{
@Override
public void run(RewardData data)
{
// Do nothing
}
});
}
_currentReward = _rewards.length;
// Remove any extra blocks
resetBlockInfo(_chestBlockInfo);

View File

@ -2,6 +2,26 @@ package mineplex.core.treasure;
import java.util.List;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilPlayer;
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.HologramManager;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.reward.Reward;
import mineplex.core.status.ServerStatusManager;
import mineplex.core.treasure.event.TreasureFinishEvent;
import mineplex.core.treasure.event.TreasureStartEvent;
import mineplex.core.treasure.gui.TreasureShop;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@ -18,31 +38,13 @@ import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerVelocityEvent;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilPlayer;
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.HologramManager;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.reward.Reward;
import mineplex.core.treasure.event.TreasureFinishEvent;
import mineplex.core.treasure.event.TreasureStartEvent;
import mineplex.core.treasure.gui.TreasureShop;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class TreasureLocation implements Listener
{
private TreasureManager _treasureManager;
private InventoryManager _inventoryManager;
private Hologram _hologram;
private HologramManager _hologramManager;
private ServerStatusManager _statusManager;
private Treasure _currentTreasure;
private Block _chestBlock;
private byte _chestBlockData;
@ -50,7 +52,7 @@ public class TreasureLocation implements Listener
private TreasureShop _shop;
private Location _resetLocation;
public TreasureLocation(TreasureManager treasureManager, InventoryManager inventoryManager, CoreClientManager clientManager, DonationManager donationManager, Block chestBlock, Block[] chestSpawns, Location resetLocation, HologramManager hologramManager)
public TreasureLocation(TreasureManager treasureManager, InventoryManager inventoryManager, CoreClientManager clientManager, DonationManager donationManager, Block chestBlock, Block[] chestSpawns, Location resetLocation, HologramManager hologramManager, ServerStatusManager statusManager)
{
_treasureManager = treasureManager;
_resetLocation = resetLocation;
@ -59,6 +61,7 @@ public class TreasureLocation implements Listener
_chestBlockData = _chestBlock.getData();
_chestSpawns = chestSpawns;
_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");
setHoloChestVisible(true);
@ -107,7 +110,7 @@ public class TreasureLocation implements Listener
Bukkit.broadcastMessage(F.main("Treasure", F.name(player.getName()) + " is opening a " + treasureType.getName()));
Reward[] rewards = _treasureManager.getRewards(player, treasureType.getRewardType());
Treasure treasure = new Treasure(player, rewards, treasureType.getRewardType(), _chestBlock, _chestSpawns, treasureType, _treasureManager.getBlockRestore(), _hologramManager);
Treasure treasure = new Treasure(player, rewards, treasureType.getRewardType(), _chestBlock, _chestSpawns, treasureType, _treasureManager.getBlockRestore(), _hologramManager, _statusManager);
_currentTreasure = treasure;
UtilTextMiddle.display(treasureType.getName(), "Choose 4 Chests To Open", 20, 180, 20, player);

View File

@ -65,7 +65,7 @@ public class TreasureManager extends MiniPlugin
Block chestLoc7 = world.getBlockAt(-18, 72, -16);
Block chestLoc8 = world.getBlockAt(-16, 72, -18);
Location resetLocation = new Location(world, -23.5, 72, -23.5);
_treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager));
_treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager, statusManager));
}
{
@ -79,7 +79,7 @@ public class TreasureManager extends MiniPlugin
Block chestLoc7 = world.getBlockAt(18, 72, 16);
Block chestLoc8 = world.getBlockAt(16, 72, 18);
Location resetLocation = new Location(world, 23.5, 72, 23.5);
_treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager));
_treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager, statusManager));
}
{
@ -93,7 +93,7 @@ public class TreasureManager extends MiniPlugin
Block chestLoc7 = world.getBlockAt(18, 72, -16);
Block chestLoc8 = world.getBlockAt(16, 72, -18);
Location resetLocation = new Location(world, 23.5, 72, -23.5);
_treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager));
_treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager, statusManager));
}
{
@ -107,7 +107,7 @@ public class TreasureManager extends MiniPlugin
Block chestLoc7 = world.getBlockAt(-18, 72, 16);
Block chestLoc8 = world.getBlockAt(-16, 72, 18);
Location resetLocation = new Location(world, -23.5, 72, 23.5);
_treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager));
_treasureLocations.add(new TreasureLocation(this, _inventoryManager, clientManager, donationManager, chestBlock, new Block[]{chestLoc1, chestLoc2, chestLoc3, chestLoc4, chestLoc5, chestLoc6, chestLoc7, chestLoc8}, resetLocation, _hologramManager, statusManager));
}
for (TreasureLocation treasureLocation : _treasureLocations)

View File

@ -131,8 +131,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), npcManager, personalServerManager, packetHandler, punish, serverStatusManager, giveawayManager);
QueueManager queueManager = new QueueManager(this, clientManager, donationManager, new EloManager(this, clientManager), partyManager);
@ -150,7 +152,7 @@ public class Hub extends JavaPlugin implements IRelation
return true;
}
});
new GlobalPacketManager(this, clientManager, serverStatusManager);
new GlobalPacketManager(this, clientManager, serverStatusManager, inventoryManager, donationManager, petManager, statsManager, giveawayManager);
//new Replay(this, packetHandler);
AprilFoolsManager.Initialize(this, clientManager, disguiseManager);
@ -158,9 +160,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);
@ -168,15 +172,15 @@ public class Hub extends JavaPlugin implements IRelation
ItemFactory itemFactory = new ItemFactory(this, blockRestore, conditionManager, damage, energy, fire, throwManager, webServerAddress);
SkillFactory skillManager = new SkillFactory(this, damage, this, combatManager, conditionManager, throwManager, disguiseManager, blockRestore, fire, new Movement(this), teleport, energy, webServerAddress);
ClassManager classManager = new ClassManager(this, clientManager, donationManager, skillManager, itemFactory, webServerAddress);
ClassManager classManager = new ClassManager(this, clientManager, donationManager, hubManager.GetGadget(), skillManager, itemFactory, webServerAddress);
ClassShopManager shopManager = new ClassShopManager(this, classManager, skillManager, itemFactory, achievementManager, clientManager);
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Brute", classManager.GetClass("Brute"));
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Mage", classManager.GetClass("Mage"));
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Ranger", classManager.GetClass("Ranger"));
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Knight", classManager.GetClass("Knight"));
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Assassin", classManager.GetClass("Assassin"));
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Brute", classManager.GetClass("Brute"), true);
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Mage", classManager.GetClass("Mage"), true);
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Ranger", classManager.GetClass("Ranger"), true);
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Knight", classManager.GetClass("Knight"), true);
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Assassin", classManager.GetClass("Assassin"), true);
//Updates
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1);

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

@ -60,9 +60,12 @@ public class TextManager extends MiniPlugin
UtilBlockText.MakeText("TEAM DEATHMATCH", locComp.clone().add(15, 21, 0), faceComp, 159, (byte)1, TextAlign.CENTER);
UtilBlockText.MakeText("TEAM DEATHMATCH", locComp.clone().add(16, 21, 0), faceComp, (Manager.Type == HubType.Halloween) ? 89 : 159, (Manager.Type == HubType.Halloween) ? (byte)0 : (byte)15, TextAlign.CENTER);
UtilBlockText.MakeText("CAPTURE THE FLAG", locComp.clone().add(15, 28, 0), faceComp, 159, (byte)14, TextAlign.CENTER);
UtilBlockText.MakeText("CAPTURE THE FLAG", locComp.clone().add(16, 28, 0), faceComp, (Manager.Type == HubType.Halloween) ? 89 : 159, (Manager.Type == HubType.Halloween) ? (byte)0 : (byte)15, TextAlign.CENTER);
UtilBlockText.MakeText("CLANS", locComp.clone().add(15, 28, 0), faceComp, 159, (byte)14, TextAlign.CENTER);
UtilBlockText.MakeText("CLANS", locComp.clone().add(16, 28, 0), faceComp, (Manager.Type == HubType.Halloween) ? 89 : 159, (Manager.Type == HubType.Halloween) ? (byte)0 : (byte)15, TextAlign.CENTER);
// UtilBlockText.MakeText("CLANS", locComp.clone().add(15, 28, 0), faceComp, 159, (byte)14, TextAlign.CENTER);
// UtilBlockText.MakeText("CLANS", locComp.clone().add(16, 28, 0), faceComp, (Manager.Type == HubType.Halloween) ? 89 : 159, (Manager.Type == HubType.Halloween) ? (byte)0 : (byte)15, TextAlign.CENTER);
//Arcade
UtilBlockText.MakeText("ARCADE", locArcade, faceArcade, 159, (byte)5, TextAlign.CENTER);

View File

@ -15,6 +15,7 @@ public enum GameType
CastleSiege("Castle Siege"),
ChampionsTDM("Champions TDM", "Champions"),
ChampionsDominate("Champions Domination", "Champions"),
ChampionsCTF("Champions CTF", "Champions"),
ChampionsMOBA("Champions MOBA", "Champions"),
Christmas("Christmas Chaos"),
DeathTag("Death Tag"),
@ -26,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

@ -2,7 +2,18 @@ package mineplex.minecraft.game.classcombat.Class;
import java.util.Collection;
import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap;
import mineplex.core.MiniClientPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.account.event.ClientWebResponseEvent;
import mineplex.core.common.Rank;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.classcombat.Class.repository.ClassRepository;
import mineplex.minecraft.game.classcombat.Class.repository.token.ClientClassTokenWrapper;
@ -10,14 +21,6 @@ import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildTok
import mineplex.minecraft.game.classcombat.Skill.ISkill;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.classcombat.item.ItemFactory;
import mineplex.core.MiniClientPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.account.event.ClientWebResponseEvent;
import mineplex.core.common.Rank;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.donation.DonationManager;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import org.bukkit.Material;
import org.bukkit.entity.Player;
@ -34,12 +37,15 @@ public class ClassManager extends MiniClientPlugin<ClientClass> implements IClas
private SkillFactory _skillFactory;
private ItemFactory _itemFactory;
private ClassRepository _repository;
private GadgetManager _gadgetManager;
private HashMap<String, IPvpClass> _classes;
private HashMap<Integer, IPvpClass> _classSalesPackageIdMap;
private Object _clientLock = new Object();
private boolean _enabled = true;
private ConcurrentHashMap<String, Callback<String>> _messageSuppressed;
public ClassManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager,
SkillFactory skillFactory, ItemFactory itemFactory, String webAddress)
@ -54,6 +60,26 @@ public class ClassManager extends MiniClientPlugin<ClientClass> implements IClas
_repository = new ClassRepository(webAddress);
_classes = new HashMap<String, IPvpClass>();
_classSalesPackageIdMap = new HashMap<Integer, IPvpClass>();
_messageSuppressed = new ConcurrentHashMap<String, Callback<String>>();
PopulateClasses();
}
public ClassManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, GadgetManager gadgetManager,
SkillFactory skillFactory, ItemFactory itemFactory, String webAddress)
{
super("Class Manager", plugin);
_plugin = plugin;
_clientManager = clientManager;
_donationManager = donationManager;
_gadgetManager = gadgetManager;
_skillFactory = skillFactory;
_itemFactory = itemFactory;
_repository = new ClassRepository(webAddress);
_classes = new HashMap<String, IPvpClass>();
_classSalesPackageIdMap = new HashMap<Integer, IPvpClass>();
_messageSuppressed = new ConcurrentHashMap<String, Callback<String>>();
PopulateClasses();
}
@ -289,6 +315,11 @@ public class ClassManager extends MiniClientPlugin<ClientClass> implements IClas
{
return _skillFactory;
}
public ItemFactory GetItemFactory()
{
return _itemFactory;
}
@Override
protected ClientClass AddPlayer(String player)
@ -300,6 +331,11 @@ public class ClassManager extends MiniClientPlugin<ClientClass> implements IClas
{
return _repository;
}
public GadgetManager getGadgetManager()
{
return _gadgetManager;
}
@EventHandler
public void SkillDisplay(PlayerCommandPreprocessEvent event)
@ -344,4 +380,25 @@ public class ClassManager extends MiniClientPlugin<ClientClass> implements IClas
{
_enabled = var;
}
public void hideNextEquipMessage(String name)
{
_messageSuppressed.put(name, new Callback<String>()
{
public void run(String name)
{
_messageSuppressed.remove(name);
}
});
}
public void forceRemoveFromSuppressed(String name)
{
_messageSuppressed.remove(name);
}
public Callback<String> getMessageSuppressedCallback(String name)
{
return _messageSuppressed.get(name);
}
}

View File

@ -27,7 +27,6 @@ import mineplex.minecraft.game.classcombat.Skill.ISkill;
import mineplex.minecraft.game.classcombat.Skill.ISkill.SkillType;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.classcombat.Skill.Knight.AxeThrow;
import mineplex.minecraft.game.classcombat.item.IItem;
import mineplex.minecraft.game.classcombat.item.ItemFactory;
public class ClientClass
@ -149,19 +148,7 @@ public class ClientClass
if (slotToken.Material.isEmpty())
continue;
IItem item = _itemFactory.GetItem(slotToken.Name.equalsIgnoreCase("Cobweb") ? "Web" : slotToken.Name);
if (item == null)
{
System.out.println("================");
System.out.println("======ClientClass.Load======");
System.out.println("Huh? " + slotToken.Name);
System.out.println("================");
System.out.println("================");
continue;
}
itemTokenUsage += item.getTokenCost();
itemTokenUsage += _itemFactory.GetItem(slotToken.Name.equalsIgnoreCase("Cobweb") ? "Web" : slotToken.Name).getTokenCost();
}
itemTokenUsage += buildToken.ItemTokens;
@ -474,21 +461,13 @@ public class ClientClass
{
return _gameClass;
}
public boolean IsGameClass(ClassType... types)
public boolean IsGameClass(ClassType type)
{
if (GetGameClass() == null)
return false;
for (ClassType type : types)
{
if (type == GetGameClass().GetType())
{
return true;
}
}
return false;
return GetGameClass().GetType() == type;
}
public Collection<ISkill> GetSkills()
@ -584,22 +563,15 @@ public class ClientClass
public void DisplaySkills(Player player)
{
player.sendMessage("------------------------------------------");
String bar = "------------------------------------------";
player.sendMessage(bar);
for (SkillType type : _lastSkillMap.keySet())
{
if (_lastSkillMap.get(type).getKey() != null)
player.sendMessage(C.cGreen + type + ": " + C.cWhite + _lastSkillMap.get(type).getKey().GetName() + " " + _lastSkillMap.get(type).getValue());
else
{
System.out.println("================");
System.out.println("======ClientClass.DisplaySkills======");
System.out.println("Huh? " + type + " " + _lastSkillMap.get(type).getKey());
System.out.println("================");
System.out.println("================");
}
if (_lastSkillMap.get(type).getKey() == null)
continue;
player.sendMessage(C.cGreen + type + ": " + C.cWhite + _lastSkillMap.get(type).getKey().GetName() + " " + _lastSkillMap.get(type).getValue());
}
player.sendMessage(bar);
}
//This is used to fix a dual class bug using Twitch broadcasting GUI (F6)

View File

@ -1,6 +1,5 @@
package mineplex.minecraft.game.classcombat.Class;
import java.util.HashMap;
import java.util.HashSet;
import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken;

View File

@ -1,10 +1,11 @@
package mineplex.minecraft.game.classcombat.Class;
import java.util.HashSet;
import java.util.concurrent.ConcurrentHashMap;
import mineplex.core.common.util.F;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken;
import mineplex.minecraft.game.classcombat.Skill.ISkill;
@ -194,13 +195,17 @@ public class PvpClass implements IPvpClass
!((LeatherArmorMeta)inv.getBoots().getItemMeta()).getColor().equals(_leatherColor))
continue;
}
if (_classes.getGadgetManager().getActive(cur, GadgetType.Costume) != null)
continue;
Equip(cur);
Equip(cur, _classes.getMessageSuppressedCallback(cur.getName()) == null);
_classes.getMessageSuppressedCallback(cur.getName()).run(cur.getName());
}
}
}
public void Equip(Player player)
public void Equip(Player player, boolean inform)
{
ClientClass client = _classes.Get(player);
@ -208,12 +213,12 @@ public class PvpClass implements IPvpClass
if (customBuild != null)
{
client.EquipCustomBuild(customBuild, true, true);
client.EquipCustomBuild(customBuild, inform, true);
}
else
{
client.SetGameClass(this);
client.EquipCustomBuild(client.GetCustomBuilds(this).get(0), true, true);
client.EquipCustomBuild(client.GetCustomBuilds(this).get(0), inform, true);
}
//Ensure Sneak Removed

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 (!UtilPlayer.isBlocking(cur))
{
_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

@ -57,7 +57,7 @@ public class Flash extends SkillActive
@Override
public String GetRechargeString()
{
return "Recharge: #10#-1 Seconds per Charge";
return "Recharge: #8#-1 Seconds per Charge";
}
@Override
@ -93,7 +93,7 @@ public class Flash extends SkillActive
}
@EventHandler
public void Recharge(UpdateEvent event)
public void recharge(UpdateEvent event)
{
for (Player cur : GetUsers())
{
@ -109,7 +109,7 @@ public class Flash extends SkillActive
if (charges >= 1 + level)
continue;
if (!mineplex.core.recharge.Recharge.Instance.use(cur, "Flash Recharge", 10000 - (1000 * level), false, false))
if (!mineplex.core.recharge.Recharge.Instance.use(cur, "Flash Recharge", 8000 - (1000 * level), false, false))
continue;
_flash.put(cur, charges + 1);

View File

@ -73,12 +73,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)
{
@ -103,6 +97,9 @@ public class Illusion extends SkillActive
UtilEnt.Vegetate(skel);
UtilEnt.silence(skel, true);
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

@ -31,6 +31,7 @@ import org.bukkit.event.player.PlayerDropItemEvent;
public class Recall extends Skill
{
private HashMap<Player, LinkedList<Location>> _locMap = new HashMap<Player, LinkedList<Location>>();
private HashMap<Player, LinkedList<Double>> _healthMap = new HashMap<Player, LinkedList<Double>>();
public Recall(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels)
{
@ -40,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."
});
}
@ -52,7 +54,7 @@ public class Recall extends Skill
}
@EventHandler
public void Use(PlayerDropItemEvent event)
public void use(PlayerDropItemEvent event)
{
Player player = event.getPlayer();
@ -79,14 +81,23 @@ public class Recall extends Skill
if (locs == null)
return;
LinkedList<Double> health = _healthMap.remove(player);
if (health == null)
return;
//Heal
double newHealth = Math.min(health.getLast(), player.getHealth() + 3 + level);
player.setHealth(newHealth);
//Effect
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f);
//Teleport
Location current = player.getLocation();
Location target = locs.getLast();
player.teleport(target);
//Inform
UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + "."));
@ -102,21 +113,32 @@ public class Recall extends Skill
}
@EventHandler
public void StoreLocation(UpdateEvent event)
public void storeLocation(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player cur : GetUsers())
{
//Create
if (!_locMap.containsKey(cur))
_locMap.put(cur, new LinkedList<Location>());
if (!_healthMap.containsKey(cur))
_healthMap.put(cur, new LinkedList<Double>());
//Store
_locMap.get(cur).addFirst(cur.getLocation());
_healthMap.get(cur).addFirst(cur.getHealth());
int level = getLevel(cur);
//Cull
if (_locMap.get(cur).size() > (2 + 2 * level) * 20)
_locMap.get(cur).removeLast();
if (_healthMap.get(cur).size() > (2 + 2 * level) * 20)
_healthMap.get(cur).removeLast();
}
}

View File

@ -52,7 +52,7 @@ public class SilencingArrow extends SkillActive
SetDesc(new String[]
{
"Your next arrow will Silence",
"target for #1#3 seconds.",
"target for #2#2 seconds.",
"",
"Silence stops skills being used."
});
@ -129,7 +129,7 @@ public class SilencingArrow extends SkillActive
if (level == 0) return;
//Confuse
Factory.Condition().Factory().Silence(GetName(), damagee, damager, 3 + 3*level, true, true);
Factory.Condition().Factory().Silence(GetName(), damagee, damager, 2 + 2*level, true, true);
//Effect
damagee.getWorld().playSound(damagee.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f);

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

@ -37,8 +37,6 @@ import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.classcombat.Skill.SkillCharge;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.classcombat.Skill.event.BlockTossExpireEvent;
import mineplex.minecraft.game.classcombat.Skill.event.BlockTossLandEvent;
import mineplex.minecraft.game.classcombat.Skill.event.SkillEvent;
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
@ -47,23 +45,7 @@ public class BlockToss extends SkillCharge implements IThrown
{
private HashMap<Player, FallingBlock> _holding = new HashMap<Player, FallingBlock>();
private HashMap<FallingBlock, Player> _falling = new HashMap<FallingBlock, Player>();
private Material[] _blacklist = new Material[]
{
Material.TNT,
Material.IRON_DOOR,
Material.IRON_DOOR_BLOCK,
Material.WOOD_DOOR,
Material.WOODEN_DOOR,
Material.ENCHANTMENT_TABLE,
Material.CHEST,
Material.FURNACE,
Material.BURNING_FURNACE,
Material.WORKBENCH,
Material.WATER,
Material.LAVA
};
public BlockToss(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels)
{
super(skills, name, classType, skillType, cost, levels,
@ -82,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
@ -95,10 +77,6 @@ public class BlockToss extends SkillCharge implements IThrown
if (!UtilGear.isSword(player.getItemInHand()))
return;
//Level
int level = getLevel(player);
if (level == 0) return;
//Check Allowed
SkillTriggerEvent trigger = new SkillTriggerEvent(player, GetName(), GetClassType());
@ -109,6 +87,14 @@ public class BlockToss extends SkillCharge implements IThrown
if (_holding.containsKey(player))
return;
//Level
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)
@ -118,23 +104,16 @@ public class BlockToss extends SkillCharge implements IThrown
}
Block grab = event.getClickedBlock();
//Recharge
if (!Recharge.Instance.use(player, GetName(), 1000, false, false))
return;
//Blacklist
for (Material mat : _blacklist)
if (mat == grab.getType())
return;
//Usable
if (UtilBlock.usable(grab))
//Door and Banner
if (grab.getRelative(BlockFace.UP).getTypeId() == 64 || grab.getRelative(BlockFace.UP).getTypeId() == 71 || grab.getRelative(BlockFace.UP).getType() == Material.STANDING_BANNER)
{
UtilPlayer.message(player, F.main(GetName(), "You cannot grab this block."));
return;
}
// Ladder and beacon grabs
if (grab.getType() == Material.LADDER || grab.getType() == Material.BEACON)
if (grab.getType() == Material.LADDER || grab.getType() == Material.BEACON || grab.getType() == Material.WEB || grab.getType() == Material.STANDING_BANNER || grab.getType() == Material.WALL_BANNER)
{
UtilPlayer.message(player, F.main(GetName(), "You cannot grab this block."));
return;
@ -157,6 +136,12 @@ public class BlockToss extends SkillCharge implements IThrown
}
}
}
if (Factory.BlockRestore().Contains(grab))
{
UtilPlayer.message(player, F.main(GetName(), "You cannot grab this block."));
return;
}
//Block to Item
FallingBlock block = player.getWorld().spawnFallingBlock(player.getEyeLocation(), event.getClickedBlock().getType(), event.getClickedBlock().getData());
@ -201,7 +186,7 @@ public class BlockToss extends SkillCharge implements IThrown
}
//Throw
if (!UtilPlayer.isBlocking(cur))
if (!cur.isBlocking())
throwSet.add(cur);
//Charged Tick
@ -217,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);
@ -288,6 +276,19 @@ public class BlockToss extends SkillCharge implements IThrown
}
@EventHandler
public void blockSolidify(EntityChangeBlockEvent event)
{
if (_falling.containsKey(event.getEntity()))
{
event.setCancelled(true);
createBlock((FallingBlock)event.getEntity(), event.getBlock());
_falling.remove(event.getEntity());
}
}
@EventHandler
public void CreateBlock(UpdateEvent event)
{
@ -304,57 +305,46 @@ public class BlockToss extends SkillCharge implements IThrown
continue;
fallIter.remove();
Block block = fall.getLocation().getBlock();
if (block.getType() != fall.getMaterial())
continue;
// Call and trigger block expiry event
BlockTossExpireEvent expireEvent = new BlockTossExpireEvent(block);
Bukkit.getServer().getPluginManager().callEvent(expireEvent);
if (!expireEvent.isCancelled())
{
block.setTypeIdAndData(0, (byte)0, false);
//Block Replace
Factory.BlockRestore().add(block, fall.getBlockId(), (byte) 0, 10000);
//Effect
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId());
}
createBlock(fall, fall.getLocation().getBlock());
}
}
@EventHandler
public void onBlockLand(EntityChangeBlockEvent event)
public void createBlock(FallingBlock fall, Block block)
{
if (event.getEntity() instanceof FallingBlock)
{
if (!event.getBlock().getType().isSolid()) // Falling block is landing and turning block from air to type
{
BlockTossLandEvent landEvent = new BlockTossLandEvent(event.getBlock());
Bukkit.getServer().getPluginManager().callEvent(landEvent);
if (landEvent.isCancelled())
{
event.setCancelled(true);
}
}
}
if (!UtilBlock.airFoliage(block))
return;
int id = fall.getBlockId();
if (id == 12) id = Material.SANDSTONE.getId();
if (id == 13) id = Material.STONE.getId();
//Block Replace
Factory.BlockRestore().Add(block, id, (byte)0, 10000);
//Effect
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId());
}
@EventHandler
public void ItemSpawn(ItemSpawnEvent event)
{
int id = event.getEntity().getItemStack().getTypeId();
if (
id != 1 &&
id != 2 &&
id != 3 &&
id != 4 &&
id != 12 &&
id != 13 &&
id != 80)
return;
for (FallingBlock block : _falling.keySet())
{
if (UtilMath.offset(event.getEntity().getLocation(), block.getLocation()) < 1)
{
event.setCancelled(true);
}
}
}
@Override

View File

@ -18,7 +18,7 @@ public class Colossus extends Skill
SetDesc(new String[]
{
"You are so huge that you take",
"#15#20 % less knockback from attacks."
"35% less knockback from attacks."
});
}
@ -36,7 +36,7 @@ public class Colossus extends Skill
//Damage
event.AddMod(damagee.getName(), GetName(), 0, false);
event.AddKnockback(GetName(), 0.85 - 0.20*level);
event.AddKnockback(GetName(), 0.65);
}
@Override

View File

@ -24,7 +24,7 @@ public class CripplingBlow extends Skill
{
"Your powerful axe attacks give",
"targets Slow 2 for 1.5 second,",
"as well as no knockback."
"as well as 50% less knockback."
});
}
@ -57,7 +57,7 @@ public class CripplingBlow extends Skill
//Damage
event.AddMod(damager.getName(), GetName(), 0, true);
event.SetKnockback(false);
event.AddKnockback(GetName(), 0.5);
//Event
UtilServer.getServer().getPluginManager().callEvent(new SkillEvent(damager, GetName(), ClassType.Brute, damagee));

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;
@ -58,7 +59,7 @@ public class DwarfToss extends SkillActive
SetDesc(new String[]
{
"Hold Block to pick up target player.",
"Release Block to throw with #1.2#0.2 velocity.",
"Release Block to throw target player.",
"",
"Players you are holding cannot harm",
"you, or be harmed by others.",
@ -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);
}
@ -209,8 +214,8 @@ public class DwarfToss extends SkillActive
_time.put(player, System.currentTimeMillis());
//Inform
UtilPlayer.message(player, F.main(GetClassType().name(), "You picked up " + F.name(UtilEnt.getName(target)) + " with " + F.skill(GetName(level)) + "."));
UtilPlayer.message(target, F.main(GetClassType().name(), F.name(player.getName()) + " grabbed you with " + F.skill(GetName(level)) + "."));
UtilPlayer.message(player, F.main(GetClassType().name(), "You picked up " + F.name(UtilEnt.getName(target)) + " with " + F.skill(GetName()) + "."));
UtilPlayer.message(target, F.main(GetClassType().name(), F.name(player.getName()) + " grabbed you with " + F.skill(GetName()) + "."));
//Hide!
if (target instanceof Player)
@ -303,9 +308,8 @@ public class DwarfToss extends SkillActive
{
LivingEntity target = _holding.remove(cur);
_time.remove(cur);
int level = getLevel(cur);
UtilPlayer.message(cur, F.main(GetClassType().name(), F.name(UtilEnt.getName(target)) + " escaped your " + F.skill(GetName(level)) + "."));
UtilPlayer.message(cur, F.main(GetClassType().name(), F.name(UtilEnt.getName(target)) + " escaped your " + F.skill(GetName()) + "."));
//Show!
if (target instanceof Player)
@ -316,7 +320,6 @@ public class DwarfToss extends SkillActive
{
final LivingEntity target = _holding.remove(cur);
long time = _time.remove(cur);
int level = getLevel(cur);
//Time Reduce
double timeScale = 1;
@ -332,7 +335,7 @@ public class DwarfToss extends SkillActive
//Throw
cur.eject();
target.leaveVehicle();
final double mult = (1.2 + (0.2 * level)) * timeScale;
final double mult = (1.8) * timeScale;
//Delay
Bukkit.getScheduler().scheduleSyncDelayedTask(Factory.getPlugin(), new Runnable()
@ -351,8 +354,8 @@ public class DwarfToss extends SkillActive
}, 5);
//Inform
UtilPlayer.message(cur, F.main(GetClassType().name(), "You threw " + F.name(UtilEnt.getName(target)) + " with " + F.skill(GetName(level)) + "."));
UtilPlayer.message(target, F.main(GetClassType().name(), F.name(cur.getName()) + " threw you with " + F.skill(GetName(level)) + "."));
UtilPlayer.message(cur, F.main(GetClassType().name(), "You threw " + F.name(UtilEnt.getName(target)) + " with " + F.skill(GetName()) + "."));
UtilPlayer.message(target, F.main(GetClassType().name(), F.name(cur.getName()) + " threw you with " + F.skill(GetName()) + "."));
}
}

View File

@ -53,8 +53,8 @@ public class FleshHook extends SkillActiveCharge implements IThrown
GetChargeString(),
"",
"If Flesh Hook hits a player, it",
"deals up to #2#2 damage, and rips them",
"towards you with #1.2#0.2 velocity.",
"deals up to #5#1 damage, and rips them",
"towards you with #1.2#0.3 velocity.",
});
}
@ -149,14 +149,14 @@ public class FleshHook extends SkillActiveCharge implements IThrown
//Pull
UtilAction.velocity(target,
UtilAlg.getTrajectory(target.getLocation(), player.getLocation()),
1.2 + (0.2 * level), false, 0, 0.8, 1.5, true);
1.2 + (0.3 * level), false, 0, 0.7, 1.2, true);
//Condition
Factory.Condition().Factory().Falling(GetName(), target, player, 10, false, true);
//Damage Event
Factory.Damage().NewDamageEvent(target, player, null,
DamageCause.CUSTOM, velocity * (1 + (1*level)), false, true, false,
DamageCause.CUSTOM, 5 + level, false, true, false,
player.getName(), GetName());

View File

@ -81,7 +81,7 @@ public class SeismicSlam extends SkillActive
{
"Jump up and slam back into the ground.",
"Players within #5.5#0.5 Blocks take up to",
"#1#1 damage and are thrown into the air.",
"#1#1 damage and are smashed away from you.",
});
}
@ -151,7 +151,7 @@ public class SeismicSlam extends SkillActive
//Velocity
UtilAction.velocity(cur,
UtilAlg.getTrajectory2d(player.getLocation().toVector(), cur.getLocation().toVector()),
0.4 + 2 * targets.get(cur), true, 0, 0.2 + 1.2 * targets.get(cur), 1.6, true);
0.6 + 2 * targets.get(cur), true, 0, 0.2 + 1.0 * targets.get(cur), 1.4, true);
//Condition
Factory.Condition().Factory().Falling(GetName(), cur, player, 10, false, true);

View File

@ -95,9 +95,6 @@ public class AxeThrow extends SkillActive implements IThrown
//Store
_thrown.put(item, player);
//Inform
UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + "."));
}
@Override

View File

@ -42,7 +42,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."
});
}
@ -65,8 +65,9 @@ public class HoldPosition extends SkillActive
double duration = 3 + (1 * level);
//Action
Factory.Condition().Factory().Slow(GetName(), player, player, duration, 3, false, true, false, true);
Factory.Condition().Factory().Protection(GetName(), player, player, duration, 2, false, true, true);
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().ArcadeHungerDisable(GetName(), player, player, duration, false);
//Inform
UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + "."));
@ -116,6 +117,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

@ -49,7 +49,7 @@ public class Riposte extends SkillActive
"to riposte.",
"",
"If successful, you deal an additional",
"#0.5#0.5 bonus damage.",
"#0#0.5 bonus damage.",
"",
"You must block, parry, then riposte",
"all within 1 second of each other."
@ -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)) + "."));
@ -155,15 +155,13 @@ public class Riposte extends SkillActive
_prepare.remove(damager);
//Damage
event.AddMod(damager.getName(), GetName(), 0.5 + 0.5 * level, true);
event.AddMod(damager.getName(), GetName(), 0.5 * level, true);
//Effect
damager.getWorld().playSound(damager.getLocation(), Sound.ZOMBIE_METAL, 1f, 1.2f);
//UtilPlayer.health(damager, 1);
//UtilParticle.PlayParticle(ParticleType.HEART, damager.getEyeLocation(), 0, 0.3f, 0, 0, 1);
//Inform
UtilPlayer.message(damager, F.main(GetClassType().name(), "You countered with " + F.skill(GetName(level)) + "."));

View File

@ -43,10 +43,9 @@ public class ArcticArmor extends Skill
"",
"Create a freezing area around you",
"in a #3#1 Block radius. Allies inside",
"this area receive Protection 1.",
"this area receive Protection 2.",
"",
"You are permanently immune to the",
"Slowing effect of snow."
"You receive Protection 1."
});
}
@ -151,6 +150,8 @@ public class ArcticArmor extends Skill
HashMap<Block, Double> blocks = UtilBlock.getInRadius(cur.getLocation().getBlock().getLocation(), 3d + level);
for (Block block : blocks.keySet())
{
if (block.getType().toString().contains("BANNER") || block.getRelative(BlockFace.UP).getType().toString().contains("BANNER"))
continue;
//Freeze
if (!block.getRelative(BlockFace.UP).isLiquid())
if (block.getLocation().getY() <= cur.getLocation().getY())
@ -174,7 +175,7 @@ public class ArcticArmor extends Skill
//Protection
for (Player other : UtilPlayer.getNearby(cur.getLocation(), 3 + getLevel(cur)))
if (!Factory.Relation().canHurt(cur, other) || other.equals(cur))
Factory.Condition().Factory().Protection(GetName(), other, cur, 1.9, 0, false, true, true);
Factory.Condition().Factory().Protection(GetName(), other, cur, 1.9, cur.equals(other) ? 0 : 1, false, true, true);
}
}
@ -218,43 +219,6 @@ public class ArcticArmor extends Skill
}
}
}
// @EventHandler
// public void Slow(UpdateEvent event)
// {
// if (event.getType() != UpdateType.TICK)
// return;
//
// for (Player cur : UtilServer.getPlayers())
// {
// if (cur.getLocation().getChunk() == null)
// continue;
//
// Block block = cur.getLocation().getBlock();
//
// if (block.getTypeId() != 78)
// continue;
//
// if (block.getData() == 0)
// continue;
//
// if (getLevel(cur) > 0)
// continue;
//
// int level = 0;
// if (block.getData() == 2 || block.getData() == 3)
// level = 1;
// else if (block.getData() == 4 || block.getData() == 5)
// level = 2;
// else if (block.getData() == 6 || block.getData() == 7)
// level = 3;
//
// //Slow
// Factory.Condition().Factory().Custom("Thick Snow", cur, cur,
// ConditionType.SLOW, 1.9, level, false,
// Material.SNOW_BALL, (byte)0, true);
// }
// }
@EventHandler
public void Particle(UpdateEvent event)

View File

@ -19,7 +19,6 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerItemHeldEvent;
import org.bukkit.util.Vector;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
@ -88,7 +87,7 @@ public class Blizzard extends SkillActive
{
_active.add(player);
}
@EventHandler
public void Energy(UpdateEvent event)
{
@ -100,7 +99,7 @@ public class Blizzard extends SkillActive
if (!_active.contains(cur))
continue;
if (!UtilPlayer.isBlocking(cur))
if (!cur.isBlocking())
{
_active.remove(cur);
continue;
@ -135,7 +134,7 @@ public class Blizzard extends SkillActive
if (!_active.contains(cur))
continue;
if (!UtilPlayer.isBlocking(cur))
if (!cur.isBlocking())
{
_active.remove(cur);
continue;
@ -150,44 +149,60 @@ public class Blizzard extends SkillActive
}
//Target
HashSet<Byte> ignore = new HashSet<Byte>();
ignore.add((byte) 0);
ignore.add((byte) 78);
ignore.add((byte) 80);
// HashSet<Byte> ignore = new HashSet<Byte>();
// ignore.add((byte) 0);
// ignore.add((byte) 78);
// ignore.add((byte) 80);
Block target = cur.getTargetBlock(ignore, 7);
// Block target = cur.getTargetBlock(ignore, 7);
//Snow
if (target == null || target.getType() == Material.AIR || UtilMath.offset(target.getLocation(), cur.getLocation()) > 5)
for (int i=0 ; i<1+level ; i++)
{
Projectile snow = cur.launchProjectile(Snowball.class);
double mult = 0.25 + 0.15 * level;
double x = (0.2 - (UtilMath.r(40)/100d)) * mult;
double y = (UtilMath.r(20)/100d) * mult;
double z = (0.2 - (UtilMath.r(40)/100d)) * mult;
snow.setVelocity(cur.getLocation().getDirection().add(new Vector(x,y,z)).multiply(2));
_snowball.put(snow, cur);
}
if (target == null || target.getType() == Material.AIR)
continue;
if (UtilMath.offset(target.getLocation(), cur.getLocation()) > 7)
continue;
HashMap<Block, Double> blocks = UtilBlock.getInRadius(target.getLocation(), 2d, 1);
for (Block block : blocks.keySet())
//Snowballs
// if (target == null || target.getType() == Material.AIR || UtilMath.offset(target.getLocation(), cur.getLocation()) > 5)
// for (int i=0 ; i<1+level ; i++)
// {
// Projectile snow = cur.launchProjectile(Snowball.class);
//
// double mult = 0.25 + 0.15 * level;
// double x = (0.2 - (UtilMath.r(40)/100d)) * mult;
// double y = (UtilMath.r(20)/100d) * mult;
// double z = (0.2 - (UtilMath.r(40)/100d)) * mult;
//
//
//
// snow.setVelocity(cur.getLocation().getDirection().add(new Vector(x,y,z)).multiply(2));
// _snowball.put(snow, cur);
// }
//
// if (target == null || target.getType() == Material.AIR)
// continue;
//
// if (UtilMath.offset(target.getLocation(), cur.getLocation()) > 7)
// continue;
//
// HashMap<Block, Double> blocks = UtilBlock.getInRadius(target.getLocation(), 2d, 1);
// for (Block block : blocks.keySet())
// {
// Factory.BlockRestore().Snow(block, (byte)(1 + (int)(2*blocks.get(block))), (byte)(7*level), 2500, 250, 3);
// }
//Snowballs
for (int i=0 ; i<1+level ; i++)
{
Factory.BlockRestore().snow(block, (byte) (1 + (int) (2 * blocks.get(block))), (byte) (7 * level), 2500, 250, 3);
Projectile snow = cur.launchProjectile(Snowball.class);
double mult = 0.25 + 0.15 * level;
double x = (0.2 - (UtilMath.r(40)/100d)) * mult;
double y = (UtilMath.r(20)/100d) * mult;
double z = (0.2 - (UtilMath.r(40)/100d)) * mult;
snow.setVelocity(cur.getLocation().getDirection().add(new Vector(x,y,z)).multiply(2));
_snowball.put(snow, cur);
}
//Effect
target.getWorld().playEffect(target.getLocation(), Effect.STEP_SOUND, 80);
// target.getWorld().playEffect(target.getLocation(), Effect.STEP_SOUND, 80);
cur.getWorld().playSound(cur.getLocation(), Sound.STEP_SNOW, 0.1f, 0.5f);
}
}
@ -214,30 +229,33 @@ public class Blizzard extends SkillActive
UtilAction.velocity(damagee, proj.getVelocity().multiply(0.1).add(new Vector(0, 0.15, 0)));
}
@EventHandler
public void SnowballForm(ProjectileHitEvent event)
{
if (!(event.getEntity() instanceof Snowball))
return;
if (_snowball.remove(event.getEntity()) == null)
return;
Factory.BlockRestore().snow(event.getEntity().getLocation().getBlock(), (byte) 1, (byte) 7, 2000, 250, 0);
}
// @EventHandler
// public void SnowballForm(ProjectileHitEvent event)
// {
// if (!(event.getEntity() instanceof Snowball))
// return;
//
// if (_snowball.remove(event.getEntity()) == null)
// return;
//
// Factory.BlockRestore().Snow(event.getEntity().getLocation().getBlock(), (byte)1, (byte)7, 2000, 250, 0);
// }
@EventHandler
public void clearInvalidSnowballedPlayers(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
if (event.getType() != UpdateType.FASTER)
return;
for (Iterator<Entry<Projectile, Player>> snowBallIterator = _snowball.entrySet().iterator(); snowBallIterator.hasNext();)
{
Entry<Projectile, Player> entry = snowBallIterator.next();
if (!entry.getKey().isValid() || entry.getKey().getTicksLived() > 60 || !entry.getValue().isOnline())
if (!entry.getKey().isValid() || entry.getKey().getTicksLived() > 25 || !entry.getValue().isOnline())
{
snowBallIterator.remove();
entry.getKey().remove();
}
}
}

View File

@ -112,14 +112,18 @@ public class FissureData
Block block = _path.get(_handled);
//Cannot raise TNT/ICE/WATER
if (block.getTypeId() == 46
if (block.getTypeId() == 46
|| block.getTypeId() == 79
|| block.getTypeId() == 8
|| block.getTypeId() == 9)
{
return false;
}
if (block.getType().toString().contains("BANNER"))
return false;
if (block.getRelative(BlockFace.UP).getType().toString().contains("BANNER"))
return false;
Block up = block.getRelative(0, _height + 1, 0);
//Done Column

View File

@ -46,7 +46,7 @@ public class IcePrison extends SkillActive implements IThrown
{
"Launch an icy orb. When it collides,",
"it creates a hollow sphere of ice",
"thats lasts for #2#1 seconds.",
"thats lasts for #3#1.5 seconds.",
});
}
@ -146,7 +146,7 @@ public class IcePrison extends SkillActive implements IThrown
if (!UtilBlock.airFoliage(freeze))
return;
long time = 2500 + (1000 * level);
long time = 3500 + (1500 * level);
int yDiff = freeze.getY() - mid.getY();

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

@ -275,7 +275,7 @@ public class LifeBonds extends Skill
HashSet<Item> remove = new HashSet<Item>();
for (Item cur : _items)
if (UtilEnt.isGrounded(cur) || cur.getTicksLived() > 400 || cur.isDead() || !cur.isValid())
if (UtilEnt.isGrounded(cur) || cur.getTicksLived() > 40 || cur.isDead() || !cur.isValid())
remove.add(cur);
for (Item cur : remove)

View File

@ -11,6 +11,7 @@ import org.bukkit.event.*;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockIgniteEvent;
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.core.common.util.F;
@ -18,7 +19,6 @@ import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
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;
@ -78,8 +78,8 @@ public class LightningOrb extends SkillActive implements IThrown
"Launch a lightning orb. Upon a direct",
"hit with player, or #5#-0.4 seconds, it will",
"strike all enemies within #3#0.5 Blocks ",
"with lightning, giving them Slow 2",
"for 4 seconds."
"with lightning, dealing #4#1 damage and",
"giving Slow 2 for 4 seconds."
});
}
@ -101,7 +101,7 @@ public class LightningOrb extends SkillActive implements IThrown
//Action
Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(57));
item.setVelocity(player.getLocation().getDirection());
Factory.Projectile().AddThrow(item, player, this, System.currentTimeMillis() + 5000 - (400 * level), true, true, false, false,
Factory.Projectile().AddThrow(item, player, this, 5000 - (400 * level), true, true, false, false,
Sound.FIZZ, 0.6f, 1.6f, ParticleType.FIREWORKS_SPARK, UpdateType.TICK, 0.4f);
//Inform
@ -147,12 +147,6 @@ public class LightningOrb extends SkillActive implements IThrown
HashMap<LivingEntity, Double> hit = UtilEnt.getInRadius(data.GetThrown().getLocation(), 3 + 0.5 * level);
//Lightning Condition
for (LivingEntity cur : hit.keySet())
{
Factory.Condition().Factory().Lightning(GetName(), cur, player, 0, 0.5, false, true);
}
List<LivingEntity> struck = new ArrayList<>();
//Lightning
@ -161,14 +155,16 @@ public class LightningOrb extends SkillActive implements IThrown
if (cur.equals(player))
continue;
if (cur instanceof Player)
{
//Inform
UtilPlayer.message(cur, F.main(GetClassType().name(), F.name(player.getName()) + " hit you with " + F.skill(GetName(level)) + "."));
}
//Inform
UtilPlayer.message(cur, F.main(GetClassType().name(), F.name(player.getName()) + " hit you with " + F.skill(GetName(level)) + "."));
//Lightning
cur.getWorld().strikeLightning(cur.getLocation());
cur.getWorld().strikeLightningEffect(cur.getLocation());
//Damage Event
Factory.Damage().NewDamageEvent(cur, player, null,
DamageCause.LIGHTNING, 4 + level, false, true, false,
player.getName(), GetName());
struck.add(cur);
}
@ -180,18 +176,19 @@ public class LightningOrb extends SkillActive implements IThrown
continue;
Factory.Condition().Factory().Slow(GetName(), cur, player, 4, 1, false, true, true, true);
Factory.Condition().Factory().Shock(GetName(), cur, player, 1, false, true);
}
Bukkit.getPluginManager().callEvent(new LightningOrbEvent(player, struck));
}
@EventHandler
public void CancelFire(BlockIgniteEvent event)
{
if (event.getCause() == IgniteCause.LIGHTNING)
event.setCancelled(true);
}
@Override
public void Reset(Player player)
{

View File

@ -167,7 +167,7 @@ public class Rupture extends SkillActiveCharge
public void MoveRupture(Player cur)
{
Block targetBlock = cur.getTargetBlock((HashSet<Byte>)null, 0);
Block targetBlock = cur.getTargetBlock((HashSet<Byte>)null, 150);
if (targetBlock == null) return;
//Aiming at sky

View File

@ -105,6 +105,26 @@ public class Void extends Skill
_active.remove(cur);
}
}
@EventHandler
public void inWater(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player cur : GetUsers())
{
if (!_active.contains(cur))
continue;
if (cur.getLocation().getBlock().getTypeId() == 8 || cur.getLocation().getBlock().getTypeId() == 9)
{
UtilPlayer.message(cur, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
_active.remove(cur);
Factory.Condition().EndCondition(cur, null, GetName());
}
}
}
@EventHandler
public void Audio(UpdateEvent event)

View File

@ -32,7 +32,7 @@ public class Barrage extends SkillChargeBow
SkillType skillType, int cost, int maxLevel)
{
super(skills, name, classType, skillType, cost, maxLevel,
0.012f, 0.006f, false, true);
0.016f, 0.008f, false, true);
SetDesc(new String[]
{

View File

@ -67,6 +67,12 @@ public class Disengage extends SkillActive
return false;
}
if (player.getLocation().getBlock().getType() == Material.WEB)
{
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " while trapped in a cobweb!"));
return false;
}
return true;
}
@ -122,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

@ -55,10 +55,15 @@ public class HealingShot extends SkillActive
SetDesc(new String[]
{
"Prepare a healing shot;",
"Prepare a Healing Shot;",
"",
"Your next arrow will give its target",
"Regeneration 2 for #5#1 seconds,",
"and remove all negative effects."
"Regeneration 3 for #3#1 seconds,",
"and remove all negative effects.",
"",
"Self hits give Regeneration 2.",
"",
"Gives Nausea to enemies for #5#1 seconds.",
});
}
@ -109,7 +114,7 @@ public class HealingShot extends SkillActive
@SuppressWarnings("deprecation")
@EventHandler(priority = EventPriority.NORMAL)
public void ArrowHit(EntityDamageEvent event)
public void arrowHit(EntityDamageEvent event)
{
if (event.getCause() != DamageCause.PROJECTILE)
return;
@ -128,10 +133,10 @@ public class HealingShot extends SkillActive
if (!_arrows.contains((Entity)projectile))
return;
if (!(event.getEntity() instanceof LivingEntity))
if (!(event.getEntity() instanceof Player))
return;
LivingEntity damagee = (LivingEntity)event.getEntity();
Player damagee = (Player)event.getEntity();
if (projectile.getShooter() == null)
return;
@ -150,14 +155,21 @@ public class HealingShot extends SkillActive
projectile.remove();
//Regen
Factory.Condition().Factory().Regen(GetName(), damagee, damager, 3 + 2 * level, 1, false, true, true);
//Remove Bad
damagee.setFireTicks(0);
damagee.removePotionEffect(PotionEffectType.SLOW);
damagee.removePotionEffect(PotionEffectType.POISON);
damagee.removePotionEffect(PotionEffectType.CONFUSION);
damagee.removePotionEffect(PotionEffectType.WEAKNESS);
if (!Factory.Relation().canHurt(damager, damagee) || damager.equals(damagee))
{
Factory.Condition().Factory().Regen(GetName(), damagee, damager, 3 + level, damager.equals(damagee) ? 1 : 2, false, false, false);
//Remove Bad
damagee.setFireTicks(0);
damagee.removePotionEffect(PotionEffectType.SLOW);
damagee.removePotionEffect(PotionEffectType.POISON);
damagee.removePotionEffect(PotionEffectType.CONFUSION);
damagee.removePotionEffect(PotionEffectType.WEAKNESS);
}
else
{
Factory.Condition().Factory().Confuse(GetName(), damagee, damager, 5 + level, 2, false, false, false);
}
//Effect
damagee.getWorld().playSound(damagee.getLocation(), Sound.LEVEL_UP, 1f, 1.5f);
@ -181,7 +193,7 @@ public class HealingShot extends SkillActive
}
@EventHandler
public void Particle(UpdateEvent event)
public void particle(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
@ -194,7 +206,7 @@ public class HealingShot extends SkillActive
}
@EventHandler
public void Clean(UpdateEvent event)
public void clean(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
return;

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

@ -1,178 +1,178 @@
package mineplex.minecraft.game.classcombat.Skill.Ranger;
import java.util.HashSet;
import java.util.Iterator;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilServer;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.minecraft.game.classcombat.Skill.SkillActive;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
public class IncendiaryShot extends SkillActive
{
private HashSet<Entity> _arrows = new HashSet<Entity>();
private HashSet<Player> _active = new HashSet<Player>();
public IncendiaryShot(SkillFactory skills, String name, ClassType classType, SkillType skillType,
int cost, int levels,
int energy, int energyMod,
long recharge, long rechargeMod, boolean rechargeInform,
Material[] itemArray,
Action[] actionArray)
{
super(skills, name, classType, skillType,
cost, levels,
energy, energyMod,
recharge, rechargeMod, rechargeInform,
itemArray,
actionArray);
SetDesc(new String[]
{
"Prepare an incendiary shot;",
"Your next arrow will ignite",
"its target for #2#1 seconds."
});
}
@Override
public boolean CustomCheck(Player player, int level)
{
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9)
{
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
return false;
}
return true;
}
@Override
public void Skill(Player player, int level)
{
//Action
_active.add(player);
//Inform
UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + "."));
//Effect
player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f);
}
@EventHandler
public void ShootBow(EntityShootBowEvent event)
{
if (!(event.getEntity() instanceof Player))
return;
if (!(event.getProjectile() instanceof Arrow))
return;
Player player = (Player)event.getEntity();
if (!_active.remove(player))
return;
//Inform
UtilPlayer.message(player, F.main(GetClassType().name(), "You fired " + F.skill(GetName(getLevel(player))) + "."));
_arrows.add(event.getProjectile());
event.getProjectile().setFireTicks(200);
}
@EventHandler(priority = EventPriority.HIGH)
public void ArrowHit(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
if (event.GetCause() != DamageCause.PROJECTILE)
return;
Projectile projectile = event.GetProjectile();
if (projectile == null) return;
if (!_arrows.contains((Entity)projectile))
return;
LivingEntity damagee = event.GetDamageeEntity();
if (damagee == null) return;
Player damager = event.GetDamagerPlayer(true);
if (damager == null) return;
//Level
int level = getLevel(damager);
if (level == 0) return;
//Ignite
Factory.Condition().Factory().Ignite(GetName(), damagee, damager, 2 + level, true, true);
//Damage
event.AddMod(damager.getName(), GetName(), 0, true);
//Effect
damagee.getWorld().playSound(damagee.getLocation(), Sound.FIZZ, 2f, 1.5f);
//Remove
projectile.remove();
}
@EventHandler
public void Particle(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Entity ent : _arrows)
{
UtilParticle.PlayParticle(ParticleType.FLAME, ent.getLocation(), 0, 0, 0, 0, 1,
ViewDist.MAX, UtilServer.getPlayers());
}
}
@EventHandler
public void Clean(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
return;
for (Iterator<Entity> arrowIterator = _arrows.iterator(); arrowIterator.hasNext();)
{
Entity arrow = arrowIterator.next();
if (arrow.isDead() || !arrow.isValid() || arrow.isOnGround())
{
arrowIterator.remove();
}
}
}
@Override
public void Reset(Player player)
{
_active.remove(player);
}
}
//package mineplex.minecraft.game.classcombat.Skill.Ranger;
//
//import java.util.HashSet;
//import java.util.Iterator;
//
//import org.bukkit.Material;
//import org.bukkit.Sound;
//import org.bukkit.entity.Arrow;
//import org.bukkit.entity.Entity;
//import org.bukkit.entity.LivingEntity;
//import org.bukkit.entity.Player;
//import org.bukkit.entity.Projectile;
//import org.bukkit.event.EventHandler;
//import org.bukkit.event.EventPriority;
//import org.bukkit.event.block.Action;
//import org.bukkit.event.entity.EntityShootBowEvent;
//import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
//
//import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
//import mineplex.minecraft.game.core.damage.CustomDamageEvent;
//import mineplex.core.common.util.F;
//import mineplex.core.common.util.UtilParticle;
//import mineplex.core.common.util.UtilServer;
//import mineplex.core.updater.event.UpdateEvent;
//import mineplex.core.updater.UpdateType;
//import mineplex.core.common.util.UtilPlayer;
//import mineplex.core.common.util.UtilParticle.ParticleType;
//import mineplex.core.common.util.UtilParticle.ViewDist;
//import mineplex.minecraft.game.classcombat.Skill.SkillActive;
//import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
//
//public class IncendiaryShot extends SkillActive
//{
// private HashSet<Entity> _arrows = new HashSet<Entity>();
// private HashSet<Player> _active = new HashSet<Player>();
//
// public IncendiaryShot(SkillFactory skills, String name, ClassType classType, SkillType skillType,
// int cost, int levels,
// int energy, int energyMod,
// long recharge, long rechargeMod, boolean rechargeInform,
// Material[] itemArray,
// Action[] actionArray)
// {
// super(skills, name, classType, skillType,
// cost, levels,
// energy, energyMod,
// recharge, rechargeMod, rechargeInform,
// itemArray,
// actionArray);
//
// SetDesc(new String[]
// {
// "Prepare an incendiary shot;",
// "Your next arrow will ignite",
// "its target for #2#1 seconds."
// });
// }
//
// @Override
// public boolean CustomCheck(Player player, int level)
// {
// if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9)
// {
// UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
// return false;
// }
//
// return true;
// }
//
// @Override
// public void Skill(Player player, int level)
// {
// //Action
// _active.add(player);
//
// //Inform
// UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + "."));
//
// //Effect
// player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f);
// }
//
// @EventHandler
// public void ShootBow(EntityShootBowEvent event)
// {
// if (!(event.getEntity() instanceof Player))
// return;
//
// if (!(event.getProjectile() instanceof Arrow))
// return;
//
// Player player = (Player)event.getEntity();
//
// if (!_active.remove(player))
// return;
//
// //Inform
// UtilPlayer.message(player, F.main(GetClassType().name(), "You fired " + F.skill(GetName(getLevel(player))) + "."));
//
// _arrows.add(event.getProjectile());
// event.getProjectile().setFireTicks(200);
// }
//
// @EventHandler(priority = EventPriority.HIGH)
// public void ArrowHit(CustomDamageEvent event)
// {
// if (event.IsCancelled())
// return;
//
// if (event.GetCause() != DamageCause.PROJECTILE)
// return;
//
// Projectile projectile = event.GetProjectile();
// if (projectile == null) return;
//
// if (!_arrows.contains((Entity)projectile))
// return;
//
// LivingEntity damagee = event.GetDamageeEntity();
// if (damagee == null) return;
//
// Player damager = event.GetDamagerPlayer(true);
// if (damager == null) return;
//
// //Level
// int level = getLevel(damager);
// if (level == 0) return;
//
// //Ignite
// Factory.Condition().Factory().Ignite(GetName(), damagee, damager, 2 + level, true, true);
//
// //Damage
// event.AddMod(damager.getName(), GetName(), 0, true);
//
// //Effect
// damagee.getWorld().playSound(damagee.getLocation(), Sound.FIZZ, 2f, 1.5f);
//
// //Remove
// projectile.remove();
// }
//
// @EventHandler
// public void Particle(UpdateEvent event)
// {
// if (event.getType() != UpdateType.TICK)
// return;
//
// for (Entity ent : _arrows)
// {
// UtilParticle.PlayParticle(ParticleType.FLAME, ent.getLocation(), 0, 0, 0, 0, 1,
// ViewDist.MAX, UtilServer.getPlayers());
// }
// }
//
// @EventHandler
// public void Clean(UpdateEvent event)
// {
// if (event.getType() != UpdateType.SEC)
// return;
//
// for (Iterator<Entity> arrowIterator = _arrows.iterator(); arrowIterator.hasNext();)
// {
// Entity arrow = arrowIterator.next();
//
// if (arrow.isDead() || !arrow.isValid() || arrow.isOnGround())
// {
// arrowIterator.remove();
// }
// }
// }
//
// @Override
// public void Reset(Player player)
// {
// _active.remove(player);
// }
//}

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

@ -9,12 +9,15 @@ import org.bukkit.Sound;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
@ -31,6 +34,7 @@ import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.minecraft.game.classcombat.Skill.SkillActive;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
public class NapalmShot extends SkillActive
{
@ -53,9 +57,13 @@ public class NapalmShot extends SkillActive
SetDesc(new String[]
{
"Prepare a napalm shot;",
"Prepare a Napalm Shot;",
"",
"Your next arrow will burst into",
"#8#8 flames on impact."
"#8#8 flames on impact.",
"",
"If your arrow hit an enemy, it",
"will ignite them for #2#1 seconds."
});
}
@ -85,7 +93,7 @@ public class NapalmShot extends SkillActive
}
@EventHandler
public void BowShoot(EntityShootBowEvent event)
public void bowShoot(EntityShootBowEvent event)
{
if (!(event.getEntity() instanceof Player))
return;
@ -105,12 +113,50 @@ public class NapalmShot extends SkillActive
event.getProjectile().setFireTicks(120);
}
@EventHandler
public void ProjectileHit(ProjectileHitEvent event)
@EventHandler(priority = EventPriority.HIGH)
public void arrowDamage(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
if (event.GetCause() != DamageCause.PROJECTILE)
return;
Projectile projectile = event.GetProjectile();
if (projectile == null) return;
if (!_arrows.contains((Entity)projectile))
return;
LivingEntity damagee = event.GetDamageeEntity();
if (damagee == null) return;
Player damager = event.GetDamagerPlayer(true);
if (damager == null) return;
//Level
int level = getLevel(damager);
if (level == 0) return;
//Ignite
Factory.Condition().Factory().Ignite(GetName(), damagee, damager, 2 + level, true, true);
//Damage
event.AddMod(damager.getName(), GetName(), 0, true);
//Effect
damagee.getWorld().playSound(damagee.getLocation(), Sound.FIZZ, 2f, 1.5f);
//Remove
projectile.remove();
}
@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)
@ -133,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)));
}
@ -142,20 +188,20 @@ public class NapalmShot extends SkillActive
}
@EventHandler
public void Particle(UpdateEvent event)
public void particle(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Entity ent : _arrows)
{
UtilParticle.PlayParticle(ParticleType.LAVA, ent.getLocation(), 0, 0, 0, 0, 1,
UtilParticle.PlayParticle(ParticleType.FLAME, ent.getLocation(), 0, 0, 0, 0, 1,
ViewDist.MAX, UtilServer.getPlayers());
}
}
@EventHandler
public void Clean(UpdateEvent event)
public void clean(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
return;

View File

@ -34,7 +34,7 @@ public class Overcharge extends SkillChargeBow
SkillType skillType, int cost, int maxLevel)
{
super(skills, name, classType, skillType, cost, maxLevel,
0.012f, 0.006f, false, true);
0.016f, 0.008f, false, true);
SetDesc(new String[]
{
@ -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

@ -2,18 +2,22 @@ package mineplex.minecraft.game.classcombat.Skill.Ranger;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.WeakHashMap;
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;
import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.classcombat.Skill.Skill;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import org.bukkit.Sound;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
@ -33,17 +37,16 @@ public class Sharpshooter extends Skill
SetDesc(new String[]
{
"Consecutive arrow hits deal an",
"additional #1#0.5 damage.",
"Hitting with arrows increases",
"arrow damage by 1 for 5 seconds.",
"",
"Stacks up to #1#1 times",
"",
"Missing an arrow resets the bonus.",
"Stacks up to #0#2 times, and each",
"hit sets duration to 5 seconds."
});
}
@EventHandler
public void ShootBow(EntityShootBowEvent event)
public void shootBow(EntityShootBowEvent event)
{
if (!(event.getEntity() instanceof Player))
return;
@ -56,7 +59,7 @@ public class Sharpshooter extends Skill
}
@EventHandler(priority = EventPriority.HIGH)
public void Damage(CustomDamageEvent event)
public void damage(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
@ -76,48 +79,70 @@ public class Sharpshooter extends Skill
if (event.GetDamagerEntity(true) != null && event.GetDamagerEntity(true).equals(event.GetDamageeEntity()))
return;
int bonus = 0;
if (_hitCount.containsKey(player))
{
//Damage
event.AddMod(player.getName(), GetName(), _hitCount.get(player) * (1 + 0.5 * level), true);
int limit = Math.min(1 + level, _hitCount.get(player) + 1);
_hitCount.put(player, limit);
//Inform
UtilPlayer.message((Entity)projectile.getShooter(), F.main(GetClassType().name(), GetName() + ": " +
F.elem(_hitCount.get(player) + " Consecutive Hits") + C.cGray + " (" + F.skill("+"+ (1 + 0.5 * limit) + "Damage" ) + C.cGray + ")" ) );
}
else
{
_hitCount.put(player, 1);
}
bonus = _hitCount.get(player);
//Increase
bonus = Math.min(bonus + 1, 2 * level);
_hitCount.put(player, bonus);
//Damage
event.AddMod(player.getName(), GetName(), bonus, true);
//Inform
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
public void Clean(UpdateEvent event)
public void resetViaTime(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
if (event.getType() != UpdateType.TICK)
return;
HashSet<Entity> remove = new HashSet<Entity>();
for (Entity cur : _arrows.keySet())
if (cur.isDead() || !cur.isValid() || cur.isOnGround())
remove.add(cur);
for (Entity cur : remove)
Iterator<Player> playerIter = _hitCount.keySet().iterator();
while (playerIter.hasNext())
{
Player player = _arrows.remove(cur);
if (player != null)
if (_hitCount.remove(player) != null)
UtilPlayer.message(player, F.main(GetClassType().name(), GetName() + ": " + F.elem("0 Consecutive Hits")));
}
Player player = playerIter.next();
if (Recharge.Instance.usable(player, GetName() + " Timer"))
{
playerIter.remove();
UtilPlayer.message(player, F.main(GetClassType().name(), GetName() + ": " + F.elem("Damage Bonus Reset")));
player.playSound(player.getLocation(), Sound.NOTE_PLING, 1f, 0.75f);
}
}
}
// @EventHandler
// public void resetViaMiss(UpdateEvent event)
// {
// if (event.getType() != UpdateType.FAST)
// return;
//
// HashSet<Entity> remove = new HashSet<Entity>();
//
// for (Entity cur : _arrows.keySet())
// if (cur.isDead() || !cur.isValid() || cur.isOnGround())
// remove.add(cur);
//
// for (Entity cur : remove)
// {
// Player player = _arrows.remove(cur);
//
// if (player != null)
// if (_hitCount.remove(player) != null)
// UtilPlayer.message(player, F.main(GetClassType().name(), GetName() + ": " + F.elem("0 Consecutive Hits")));
// }
// }
@Override
public void Reset(Player player)

View File

@ -1,12 +1,16 @@
package mineplex.minecraft.game.classcombat.Skill.Ranger;
import java.util.HashMap;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerMoveEvent;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
@ -18,24 +22,30 @@ import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
public class VitalitySpores extends Skill
{
private HashMap<Player, Long> _lastMove = new HashMap<Player, Long>();
public VitalitySpores(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels)
{
super(skills, name, classType, skillType, cost, levels);
SetDesc(new String[]
{
"After #5#-1 seconds of not taking damage,",
"forest spores surround you, restoring",
"1 health per second.",
"",
"This remains until you take damage."
"While standing still, forest spores",
"heal you for #0#0.5 health per 2 seconds."
});
}
@EventHandler
public void Update(UpdateEvent event)
public void playerMove(PlayerMoveEvent event)
{
if (event.getType() != UpdateType.SEC)
if (doesUserHaveSkill(event.getPlayer()) && UtilMath.offset(event.getFrom(), event.getTo()) > 0)
_lastMove.put(event.getPlayer(), System.currentTimeMillis());
}
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player cur : GetUsers())
@ -43,13 +53,17 @@ public class VitalitySpores extends Skill
int level = getLevel(cur);
if (level == 0) continue;
if (UtilTime.elapsed(Factory.Combat().Get(cur).GetLastDamaged(), 5000 - 1000*level))
if (!_lastMove.containsKey(cur))
continue;
if (UtilTime.elapsed(_lastMove.get(cur), 2000))
{
//Factory.Condition().Factory().Regen(GetName(), cur, cur, 3.9 + 2*level, 0, false, true, true);
UtilPlayer.health(cur, 1);
UtilPlayer.health(cur, 0.5 * level);
UtilParticle.PlayParticle(ParticleType.HEART, cur.getEyeLocation().add(UtilAlg.getBehind(cur.getLocation().getDirection().multiply(0.5))), 0, 0.2f, 0, 0, 1,
ViewDist.LONG, UtilServer.getPlayers());
_lastMove.put(cur, System.currentTimeMillis());
}
}
}
@ -57,6 +71,6 @@ public class VitalitySpores extends Skill
@Override
public void Reset(Player player)
{
_lastMove.remove(player);
}
}

View File

@ -44,8 +44,8 @@ public class WolfsPounce extends SkillChargeSword
GetChargeString(),
"Taking damage cancels charge.",
"",
"Colliding with another monster",
"mid-air deals up to 6 damage",
"Colliding with another player",
"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
@ -100,7 +100,7 @@ public class WolfsPounce extends SkillChargeSword
if (!_live.containsKey(player))
continue;
for (LivingEntity other : player.getWorld().getLivingEntities())
for (Player other : player.getWorld().getPlayers())
{
if (UtilPlayer.isSpectator(other))
continue;
@ -108,7 +108,7 @@ public class WolfsPounce extends SkillChargeSword
if (other.equals(player))
continue;
if (other instanceof Player && !Factory.Relation().canHurt(player, (Player)other))
if (!Factory.Relation().canHurt(player, other))
continue;
if (UtilMath.offset(player, other) > 2)
@ -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

@ -258,6 +258,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

@ -118,7 +118,7 @@ public abstract class SkillChargeBow extends SkillCharge implements Listener
continue;
//Delay
if (!UtilTime.elapsed(_chargeStart.get(cur), 1200))
if (!UtilTime.elapsed(_chargeStart.get(cur), 1000))
continue;
float charge = _charge.get(cur);

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;
@ -40,7 +113,6 @@ import org.bukkit.plugin.java.JavaPlugin;
public class SkillFactory extends MiniPlugin implements ISkillFactory
{
private DamageManager _damageManager;
private IRelation _relation;
private CombatManager _combatManager;
@ -164,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}));
@ -179,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}));
@ -201,22 +273,22 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
//Bow
AddSkill(new MarkedForDeath(this, "Marked for Death", ClassType.Assassin, SkillType.Bow,
1, 4,
40, 0,
20000, 0, true,
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,
20000, 0, true,
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,
20000, 0, true,
0, 0,
20000, -2000, true,
new Material[] {Material.BOW},
new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK}));
@ -239,9 +311,9 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
//Sword
AddSkill(new DwarfToss(this, "Dwarf Toss", ClassType.Brute, SkillType.Sword,
1, 5,
2, 1,
0, 0,
20000, -2000, true,
16000, 0, true,
new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD},
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
@ -258,21 +330,21 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
AddSkill(new SeismicSlam(this, "Seismic Slam", ClassType.Brute, SkillType.Axe,
1, 5,
0, 0,
30000, -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,
30000, -3000, 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,
30000, -3000, 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}));
@ -283,7 +355,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
//Passive B
AddSkill(new CripplingBlow(this, "Crippling Blow", ClassType.Brute, SkillType.PassiveB, 2, 1));
AddSkill(new Colossus(this, "Colossus", ClassType.Brute, SkillType.PassiveB, 1, 3));
AddSkill(new Colossus(this, "Colossus", ClassType.Brute, SkillType.PassiveB, 2, 1));
AddSkill(new Overwhelm(this, "Overwhelm", ClassType.Brute, SkillType.PassiveB, 1, 3));
}
@ -332,14 +404,14 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
AddSkill(new ShieldSmash(this, "Shield Smash", ClassType.Knight, SkillType.Axe,
1, 5,
0, 0,
10000, -1000, true,
15000, -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 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}));
@ -401,7 +473,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
AddSkill(new LightningOrb(this, "Lightning Orb", ClassType.Mage, SkillType.Axe,
1, 5,
60, -2,
11000, -1000, true,
13000, -1000, true,
new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE},
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
@ -409,7 +481,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
AddSkill(new Fissure(this, "Fissure", ClassType.Mage, SkillType.Axe,
1, 5,
60, -3,
14000, -1000, true,
13000, -1000, true,
new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE},
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
@ -435,13 +507,12 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
AddSkill(new GlacialBlade(this, "Glacial Blade", ClassType.Mage, SkillType.PassiveB,
1, 3,
16, -2,
1200, -200, false,
1200, -250, false,
new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD},
new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK}));
AddSkill(new MagmaBlade(this, "Magma Blade", ClassType.Mage, SkillType.PassiveB, 1, 3));
AddSkill(new NullBlade(this, "Null Blade", ClassType.Mage, SkillType.PassiveB, 1, 3));
//AddSkill(new RootingAxe(this, "Rooting Axe", ClassType.Mage, SkillType.PassiveB, 5, 3));
}
public void AddRanger()
@ -452,7 +523,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
AddSkill(new Disengage(this, "Disengage", ClassType.Ranger, SkillType.Sword,
1, 4,
0, 0,
18000, -2000, true,
16000, -1000, true,
new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD},
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
@ -481,12 +552,12 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
new Material[] {Material.BOW},
new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK}));
AddSkill(new IncendiaryShot(this, "Incendiary Shot", ClassType.Ranger, SkillType.Bow,
1, 4,
0, 0,
20000, -2000, true,
new Material[] {Material.BOW},
new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK}));
// AddSkill(new IncendiaryShot(this, "Incendiary Shot", ClassType.Ranger, SkillType.Bow,
// 1, 4,
// 0, 0,
// 20000, -2000, true,
// new Material[] {Material.BOW},
// new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK}));
AddSkill(new NapalmShot(this, "Napalm Shot", ClassType.Ranger, SkillType.Bow,
1, 4,
@ -524,9 +595,9 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
//Passive B
AddSkill(new BarbedArrows(this, "Barbed Arrows", ClassType.Ranger, SkillType.PassiveB, 1, 3));
AddSkill(new HeavyArrows(this, "Heavy Arrows", ClassType.Ranger, SkillType.PassiveB, 1, 3));
//AddSkill(new Shadowmeld(this, "Shadowmeld", ClassType.Ranger, SkillType.PassiveB, 5, 3));
AddSkill(new Longshot(this, "Longshot", ClassType.Ranger, SkillType.PassiveB, 1, 3));
AddSkill(new Sharpshooter(this, "Sharpshooter", ClassType.Ranger, SkillType.PassiveB, 1, 3));
//AddSkill(new Shadowmeld(this, "Shadowmeld", ClassType.Ranger, SkillType.PassiveB, 5, 3));
//AddSkill(new Fletcher(this, "Fletcher", ClassType.Ranger, SkillType.PassiveB, 5, 3));
}
@ -582,11 +653,6 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
System.out.println("Skill Factory: Removed " + remove.GetName() + " from SkillMap.");
}
public void removeSkill(String skillName)
{
RemoveSkill(skillName, null);
}
@Override
public List<ISkill> GetGlobalSkillsFor(IPvpClass gameClass)

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;
@ -156,12 +153,12 @@ public abstract class ItemUsable extends Item implements IThrown
//Throw
long expire = -1;
if (_throwExpire >= 0)
expire = System.currentTimeMillis() + _throwExpire;
expire = _throwExpire;
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, _throwBlock, _throwIdle, _throwPickup, 0.5f);
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,19 +65,36 @@ 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
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
//Arm
_armed.put(data.GetThrown(), data.GetThrower());
//Effect
data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 7);
data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.NOTE_PLING, 0.5f, 2f);
}
@Override
public void Idle(ProjectileUser data)
{
//Arm
_armed.put(data.GetThrown(), data.GetThrower());
//Effect
data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 7);
data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.NOTE_PLING, 0.5f, 2f);
}
@Override
@ -150,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,17 +65,34 @@ 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)
{
//Arm
_armed.put(data.GetThrown(), data.GetThrower());
//Effect
data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 7);
data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.NOTE_PLING, 0.5f, 2f);
}
@Override
public void Idle(ProjectileUser data)
{
//Arm
_armed.put(data.GetThrown(), data.GetThrower());
//Effect
data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, 7);
data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.NOTE_PLING, 0.5f, 2f);
}
@Override
@ -144,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

@ -28,6 +28,7 @@ public class ClassCombatShop extends ShopBase<ClassShopManager>
private IPvpClass _gameClass;
private boolean _takeAwayStuff;
private boolean _skillsOnly;
private boolean _hub;
public ClassCombatShop(ClassShopManager plugin, CoreClientManager clientManager, DonationManager donationManager, boolean skillsOnly, String name)
{
@ -36,12 +37,13 @@ public class ClassCombatShop extends ShopBase<ClassShopManager>
_skillsOnly = skillsOnly;
}
public ClassCombatShop(ClassShopManager plugin, CoreClientManager clientManager, DonationManager donationManager, boolean skillsOnly, String name, IPvpClass iPvpClass)
public ClassCombatShop(ClassShopManager plugin, CoreClientManager clientManager, DonationManager donationManager, boolean skillsOnly, String name, IPvpClass iPvpClass, boolean hub)
{
super(plugin, clientManager, donationManager, name, CurrencyType.Gems);
_gameClass = iPvpClass;
_takeAwayStuff = true;
_skillsOnly = skillsOnly;
_hub = hub;
}
protected void openShopForPlayer(Player player)
@ -65,15 +67,22 @@ public class ClassCombatShop extends ShopBase<ClassShopManager>
ShopPageBase<ClassShopManager, ClassCombatShop> page = null;
if (getPlugin().GetClassManager().Get(player).GetGameClass() == null)
{
// page = new ArmorPage(_plugin, this, _clientManager, _donationManager, player);
UtilPlayer.message(player, F.main(getPlugin().getName(), ChatColor.RED + "You need to have an armor set on to modify class builds."));
player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, .6f);
return false;
}
else
page = new CustomBuildPage(getPlugin(), this, getClientManager(), getDonationManager(), player);
if (!_hub)
{
if (getPlugin().GetClassManager().Get(player).GetGameClass() == null)
{
// page = new ArmorPage(_plugin, this, _clientManager, _donationManager, player);
UtilPlayer.message(player, F.main(getPlugin().getName(), ChatColor.RED + "You need to have an armor set on to modify class builds."));
player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, .6f);
return false;
}
else
page = new CustomBuildPage(getPlugin(), this, getClientManager(), getDonationManager(), player);
}
else
{
page = new CustomBuildPage(getPlugin(), this, getClientManager(), getDonationManager(), player, _gameClass);
}
getOpenedShop().add(player.getName());
openShopForPlayer(player);

View File

@ -60,6 +60,9 @@ public class ClassShopManager extends MiniPlugin
Achievement.CHAMPIONS_MASS_ELECTROCUTION,
Achievement.CHAMPIONS_THE_LONGEST_SHOT,
Achievement.CHAMPIONS_WINS,
Achievement.CHAMPIONS_CAPTURES,
Achievement.CHAMPIONS_CLUTCH,
Achievement.CHAMPIONS_SPECIAL_WIN
});
}
}

View File

@ -1,9 +1,10 @@
package mineplex.minecraft.game.classcombat.shop.page;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.donation.DonationManager;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.minecraft.game.classcombat.Class.ClientClass;
import mineplex.minecraft.game.classcombat.Class.IPvpClass;
import mineplex.minecraft.game.classcombat.Class.event.ClassSetupEvent;
@ -14,11 +15,10 @@ import mineplex.minecraft.game.classcombat.shop.ClassShopManager;
import mineplex.minecraft.game.classcombat.shop.button.DeleteCustomBuildButton;
import mineplex.minecraft.game.classcombat.shop.button.EditAndSaveCustomBuildButton;
import mineplex.minecraft.game.classcombat.shop.button.SelectCustomBuildButton;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.donation.DonationManager;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.page.ShopPageBase;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
public class CustomBuildPage extends ShopPageBase<ClassShopManager, ClassCombatShop>
{
@ -31,6 +31,14 @@ public class CustomBuildPage extends ShopPageBase<ClassShopManager, ClassCombatS
buildPage();
}
public CustomBuildPage(ClassShopManager shopManager, ClassCombatShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player, IPvpClass kit)
{
super(shopManager, shop, clientManager, donationManager, " Custom Build", player);
_pvpClass = kit;
buildPage();
}
@Override
protected void buildPage()

View File

@ -14,6 +14,7 @@ public class Condition
{
CLOAK,
SHOCK,
POISON_SHOCK,
SILENCE,
BURNING,
FALLING,
@ -21,6 +22,7 @@ public class Condition
INVULNERABLE,
EXPLOSION,
FIRE_ITEM_IMMUNITY,
ARCADE_HUNGER_DISABLE,
CUSTOM,

View File

@ -2,6 +2,7 @@ package mineplex.minecraft.game.core.condition;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.visibility.VisibilityManager;
@ -253,6 +254,15 @@ public class ConditionEffect implements Listener
Condition condition = Manager.GetActiveCondition(ent, ConditionType.LIGHTNING);
if (condition == null) return;
if (event.GetDamageePlayer() != null)
{
if (!Recharge.Instance.use(event.GetDamageePlayer(), "Lightning by " + UtilEnt.getName(condition.GetSource()), 1000, false, false))
{
event.SetCancelled("Lightning Rate");
return;
}
}
//Damage
event.SetDamager(condition.GetSource());
@ -336,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

@ -245,6 +245,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)
{
@ -276,4 +284,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

@ -173,15 +173,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)
@ -190,6 +182,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)
{

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