Merge branch 'master' into monster-league

This commit is contained in:
Cheese 2015-11-20 11:51:07 +11:00
commit 3a5ab3f17c
112 changed files with 3357 additions and 792 deletions

View File

@ -0,0 +1,37 @@
From 896df3218cf190a29901619e762b5399517dbfbd Mon Sep 17 00:00:00 2001
From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Wed, 11 Nov 2015 11:43:17 +1300
Subject: [PATCH] Fix schedulers
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 1d29ae7..55e2afd 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -705,6 +705,11 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
}
public void B() {
+ SpigotTimings.schedulerTimer.startTiming(); // Spigot
+ // CraftBukkit start
+ this.server.getScheduler().mainThreadHeartbeat(this.ticks);
+ SpigotTimings.schedulerTimer.stopTiming(); // Spigot
+
this.methodProfiler.a("jobs");
Queue queue = this.j;
@@ -718,11 +723,6 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
this.methodProfiler.c("levels");
- SpigotTimings.schedulerTimer.startTiming(); // Spigot
- // CraftBukkit start
- this.server.getScheduler().mainThreadHeartbeat(this.ticks);
- SpigotTimings.schedulerTimer.stopTiming(); // Spigot
-
// Run tasks that are waiting on processing
SpigotTimings.processQueueTimer.startTiming(); // Spigot
while (!processQueue.isEmpty()) {
--
1.9.5.msysgit.0

View File

@ -6,8 +6,6 @@
<directory url="file://$PROJECT_DIR$/Nautilus.Game.PvP" includeSubdirectories="true" /> <directory url="file://$PROJECT_DIR$/Nautilus.Game.PvP" includeSubdirectories="true" />
<directory url="file://$PROJECT_DIR$/Mineplex.ServerMonitor" includeSubdirectories="true" /> <directory url="file://$PROJECT_DIR$/Mineplex.ServerMonitor" includeSubdirectories="true" />
<directory url="file://$PROJECT_DIR$/Mineplex.Game.Clans" includeSubdirectories="true" /> <directory url="file://$PROJECT_DIR$/Mineplex.Game.Clans" includeSubdirectories="true" />
<directory url="file://$PROJECT_DIR$/Nautilus.Game.Arcade" includeSubdirectories="true" />
<directory url="file://$PROJECT_DIR$/Mineplex.Hub" includeSubdirectories="true" />
</excludeFromCompile> </excludeFromCompile>
<resourceExtensions /> <resourceExtensions />
<wildcardResourcePatterns> <wildcardResourcePatterns>
@ -26,7 +24,7 @@
</profile> </profile>
<profile default="false" name="Annotation profile for bungee" enabled="true"> <profile default="false" name="Annotation profile for bungee" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" /> <sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target\generated-test-sources\test-annotations" /> <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" /> <outputRelativeToContentRoot value="true" />
<processorPath useClasspath="true" /> <processorPath useClasspath="true" />
</profile> </profile>

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◄ §c§lMaintenance§f§l ►";
//String motdLine = "§f§l◄ §a§lCarl the Creeper§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 = " §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 = " §f§l◄ §b§lNew Game§f§l ▬ §3§lChampions CTF§f§l ►";
//String motdLine = " §d§lRank Sale §a§l40% Off"); //String motdLine = " §d§lRank Sale §a§l40% Off");
//String motdLine = " §f§l◄§c§lMAINTENANCE§f§l►"); //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"); System.out.println("Updated Bungee MOTD");
} }
} }

View File

@ -78,10 +78,13 @@ public class UtilEnt
public static void Leash(LivingEntity leashed, Entity holder, boolean pull, boolean breakable) public static void Leash(LivingEntity leashed, Entity holder, boolean pull, boolean breakable)
{ {
leashed.setPullWhileLeashed(pull);
leashed.setShouldBreakLeash(breakable);
leashed.setLeashHolder(holder); leashed.setLeashHolder(holder);
if (!(((CraftLivingEntity)leashed).getHandle() instanceof EntityInsentient))
return;
((EntityInsentient)((CraftLivingEntity)leashed).getHandle()).setPullWhileLeashed(pull);
((EntityInsentient)((CraftLivingEntity)leashed).getHandle()).setShouldBreakLeash(breakable);
} }
public static void addLookAtPlayerAI(Entity entity, float dist) public static void addLookAtPlayerAI(Entity entity, float dist)

View File

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

View File

@ -22,6 +22,7 @@ import net.minecraft.server.v1_8_R3.DataWatcher.WatchableObject;
import net.minecraft.server.v1_8_R3.MathHelper; import net.minecraft.server.v1_8_R3.MathHelper;
import net.minecraft.server.v1_8_R3.Packet; import net.minecraft.server.v1_8_R3.Packet;
import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity; import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity;
import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity.EnumEntityUseAction;
import net.minecraft.server.v1_8_R3.PacketPlayOutAttachEntity; import net.minecraft.server.v1_8_R3.PacketPlayOutAttachEntity;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy; import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata; import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata;
@ -55,15 +56,12 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
private NautHashMap<UUID, Long> _exemptTimeMap = new NautHashMap<UUID, Long>(); private NautHashMap<UUID, Long> _exemptTimeMap = new NautHashMap<UUID, Long>();
private NautHashMap<UUID, NautHashMap<CheckType, Long>> _doubleStrike = new NautHashMap<UUID, NautHashMap<CheckType, Long>>(); private NautHashMap<UUID, NautHashMap<CheckType, Long>> _doubleStrike = new NautHashMap<UUID, NautHashMap<CheckType, Long>>();
private PacketHandler _packetHandler;
public CustomTagFix(JavaPlugin plugin, PacketHandler packetHandler) public CustomTagFix(JavaPlugin plugin, PacketHandler packetHandler)
{ {
super("Custom Tag Fix", plugin); super("Custom Tag Fix", plugin);
_packetHandler = packetHandler; packetHandler.addPacketHandler(this, true, PacketPlayOutAttachEntity.class, PacketPlayOutEntityDestroy.class,
packetHandler.addPacketHandler(this, PacketPlayOutAttachEntity.class, PacketPlayOutEntityDestroy.class,
PacketPlayOutEntityMetadata.class, PacketPlayOutSpawnEntity.class, PacketPlayOutSpawnEntityLiving.class, PacketPlayOutEntityMetadata.class, PacketPlayOutSpawnEntity.class, PacketPlayOutSpawnEntityLiving.class,
PacketPlayInUseEntity.class); PacketPlayInUseEntity.class);
@ -353,10 +351,9 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
{ {
PacketPlayInUseEntity newPacket = new PacketPlayInUseEntity(); PacketPlayInUseEntity newPacket = new PacketPlayInUseEntity();
newPacket.a = entry.getKey(); newPacket.a = entry.getKey();
newPacket.action = usePacket.action; newPacket.action = usePacket.action == EnumEntityUseAction.ATTACK ? EnumEntityUseAction.ATTACK
newPacket.c = usePacket.c; : EnumEntityUseAction.INTERACT;
if (_packetHandler.handlePacket(owner, newPacket))
{ {
((CraftPlayer) owner).getHandle().playerConnection.a(newPacket); ((CraftPlayer) owner).getHandle().playerConnection.a(newPacket);
} }

View File

@ -5,11 +5,15 @@ import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import net.minecraft.server.v1_8_R3.EntityPlayer;
import net.minecraft.server.v1_8_R3.MathHelper;
import net.minecraft.server.v1_8_R3.MovingObjectPosition;
import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity; import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity;
import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity.EnumEntityUseAction; import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity.EnumEntityUseAction;
import net.minecraft.server.v1_8_R3.MinecraftServer;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy; import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving; import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
import net.minecraft.server.v1_8_R3.Vec3D;
import net.minecraft.server.v1_8_R3.WorldSettings.EnumGamemode;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
@ -18,9 +22,6 @@ import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerAnimationEvent;
import org.bukkit.event.player.PlayerAnimationType;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
@ -33,8 +34,6 @@ import mineplex.core.updater.event.UpdateEvent;
public class PacketsInteractionFix extends MiniPlugin implements IPacketHandler public class PacketsInteractionFix extends MiniPlugin implements IPacketHandler
{ {
private HashMap<String, HashSet<Integer>> _armorStands = new HashMap<String, HashSet<Integer>>(); private HashMap<String, HashSet<Integer>> _armorStands = new HashMap<String, HashSet<Integer>>();
private HashSet<Player> _leftClicked = new HashSet<Player>();
private int _lastTick;
public PacketsInteractionFix(JavaPlugin plugin, PacketHandler packetHandler) public PacketsInteractionFix(JavaPlugin plugin, PacketHandler packetHandler)
{ {
@ -44,42 +43,9 @@ public class PacketsInteractionFix extends MiniPlugin implements IPacketHandler
PacketPlayInUseEntity.class); PacketPlayInUseEntity.class);
} }
private void checkLeftClicks()
{
if (MinecraftServer.currentTick == _lastTick)
{
return;
}
_lastTick = MinecraftServer.currentTick;
_leftClicked.clear();
}
@EventHandler
public void onArmAnimation(PlayerAnimationEvent event)
{
if (event.getAnimationType() != PlayerAnimationType.ARM_SWING)
{
return;
}
checkLeftClicks();
Player player = event.getPlayer();
if (_leftClicked.remove(player))
{
return;
}
CraftEventFactory.callPlayerInteractEvent(((CraftPlayer) player).getHandle(), Action.LEFT_CLICK_AIR,
((CraftPlayer) player).getHandle().inventory.getItemInHand());
}
@EventHandler @EventHandler
public void onQuit(PlayerQuitEvent event) public void onQuit(PlayerQuitEvent event)
{ {
_leftClicked.remove(event.getPlayer().getName());
_armorStands.remove(event.getPlayer().getName()); _armorStands.remove(event.getPlayer().getName());
} }
@ -91,8 +57,6 @@ public class PacketsInteractionFix extends MiniPlugin implements IPacketHandler
return; return;
} }
checkLeftClicks();
Iterator<String> itel = _armorStands.keySet().iterator(); Iterator<String> itel = _armorStands.keySet().iterator();
while (itel.hasNext()) while (itel.hasNext())
@ -110,19 +74,6 @@ public class PacketsInteractionFix extends MiniPlugin implements IPacketHandler
} }
} }
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event)
{
if (!event.getAction().name().contains("LEFT"))
{
return;
}
checkLeftClicks();
_leftClicked.add(event.getPlayer());
}
@Override @Override
public void handle(PacketInfo packetInfo) public void handle(PacketInfo packetInfo)
{ {
@ -166,12 +117,38 @@ public class PacketsInteractionFix extends MiniPlugin implements IPacketHandler
{ {
PacketPlayInUseEntity packet = (PacketPlayInUseEntity) packetInfo.getPacket(); PacketPlayInUseEntity packet = (PacketPlayInUseEntity) packetInfo.getPacket();
if (!list.contains(packet.a)) if (packet.action == EnumEntityUseAction.ATTACK)
{ {
EntityPlayer nmsPlayer = ((CraftPlayer) packetInfo.getPlayer()).getHandle();
float f1 = nmsPlayer.pitch;
float f2 = nmsPlayer.yaw;
double d0 = nmsPlayer.locX;
double d1 = nmsPlayer.locY + nmsPlayer.getHeadHeight();
double d2 = nmsPlayer.locZ;
Vec3D vec3d = new Vec3D(d0, d1, d2);
float f3 = MathHelper.cos(-f2 * 0.01745329F - 3.141593F);
float f4 = MathHelper.sin(-f2 * 0.01745329F - 3.141593F);
float f5 = -MathHelper.cos(-f1 * 0.01745329F);
float f6 = MathHelper.sin(-f1 * 0.01745329F);
float f7 = f4 * f5;
float f8 = f3 * f5;
nmsPlayer.playerInteractManager.getGameMode();
double d3 = nmsPlayer.playerInteractManager.getGameMode() == EnumGamemode.CREATIVE ? 5 : 4.5;
Vec3D vec3d1 = vec3d.add(f7 * d3, f6 * d3, f8 * d3);
MovingObjectPosition movingobjectposition = nmsPlayer.world.rayTrace(vec3d, vec3d1, false);
if (movingobjectposition != null && movingobjectposition.type == MovingObjectPosition.EnumMovingObjectType.BLOCK)
{
CraftEventFactory.callPlayerInteractEvent(nmsPlayer, Action.LEFT_CLICK_AIR,
nmsPlayer.inventory.getItemInHand());
}
return; return;
} }
if (packet.action == EnumEntityUseAction.ATTACK) if (!list.contains(packet.a))
{ {
return; return;
} }

View File

@ -277,8 +277,8 @@ public enum Achievement
//Champions //Champions
CHAMPIONS_WINS("Champion", 600, CHAMPIONS_WINS("Champion", 600,
new String[]{"Champions Domination.Wins", "Champions TDM.Wins"}, new String[]{"Champions Domination.Wins", "Champions TDM.Wins", "Champions Capture the Flag.Wins"},
new String[]{"Win 80 games of Dominate or TDM"}, new String[]{"Win 80 games of Dominate, TDM, or CTF"},
new int[]{80}, new int[]{80},
AchievementCategory.CHAMPIONS), AchievementCategory.CHAMPIONS),
@ -295,29 +295,41 @@ public enum Achievement
AchievementCategory.CHAMPIONS), AchievementCategory.CHAMPIONS),
CHAMPIONS_ASSASSINATION("Assassination", 1000, 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 String[]{"Kill 40 players with Backstab without", "taking any damage from them"},
new int[]{40}, new int[]{40},
AchievementCategory.CHAMPIONS), AchievementCategory.CHAMPIONS),
CHAMPIONS_MASS_ELECTROCUTION("Mass Electrocution", 1200, CHAMPIONS_MASS_ELECTROCUTION("Mass Electrocution", 1200,
new String[]{"Champions Domination.MassElectrocution", "Champions TDM.MassElectrocution"}, new String[]{"Champions Domination.MassElectrocution", "Champions TDM.MassElectrocution", "Champions Capture the Flag.MassElectrocution"},
new String[]{"Hit 4 enemies with a Lightning Orb"}, new String[]{"Hit 4 enemies with a Lightning Orb"},
new int[]{1}, new int[]{1},
AchievementCategory.CHAMPIONS), AchievementCategory.CHAMPIONS),
CHAMPIONS_THE_LONGEST_SHOT("The Longest Shot", 1200, CHAMPIONS_THE_LONGEST_SHOT("The Longest Shot", 1200,
new String[]{"Champions Domination.TheLongestShot", "Champions TDM.TheLongestShot"}, 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 String[]{"Kill someone using Longshot who", "is over 64 Blocks away from you"},
new int[]{1}, new int[]{1},
AchievementCategory.CHAMPIONS), AchievementCategory.CHAMPIONS),
CHAMPIONS_EARTHQUAKE("Earthquake", 1200, CHAMPIONS_EARTHQUAKE("Earthquake", 1200,
new String[]{"Champions Domination.Earthquake", "Champions TDM.Earthquake"}, new String[]{"Champions Domination.Earthquake", "Champions TDM.Earthquake", "Champions Capture the Flag.Earthquake"},
new String[]{"Launch 5 enemies using Seismic Slam"}, new String[]{"Launch 5 enemies using Seismic Slam"},
new int[]{1}, new int[]{1},
AchievementCategory.CHAMPIONS), AchievementCategory.CHAMPIONS),
CHAMPIONS_CAPTURES("Sticky Fingers", 2500,
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),
//Paintball //Paintball
SUPER_PAINTBALL_WINS("Paintball King", 600, SUPER_PAINTBALL_WINS("Paintball King", 600,
new String[]{"Super Paintball.Wins"}, new String[]{"Super Paintball.Wins"},

View File

@ -78,8 +78,8 @@ public enum AchievementCategory
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED }, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED },
Material.BOOK_AND_QUILL, 0, GameCategory.CLASSICS, "Extra Tools Kit"), Material.BOOK_AND_QUILL, 0, GameCategory.CLASSICS, "Extra Tools Kit"),
CHAMPIONS("Champions", new String[] {"Champions Domination", "Champions TDM"}, CHAMPIONS("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[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED, new StatDisplay("Flags Captured", "Captures") },
Material.BEACON, 0, GameCategory.CHAMPIONS, "Extra Class Skills"), Material.BEACON, 0, GameCategory.CHAMPIONS, "Extra Class Skills"),
MASTER_BUILDERS("Master Builders", null, MASTER_BUILDERS("Master Builders", null,

View File

@ -1,5 +1,9 @@
package mineplex.core.blockrestore; 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.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
@ -19,6 +23,8 @@ public class BlockRestoreData
protected long _meltDelay = 0; protected long _meltDelay = 0;
protected long _meltLast = 0; protected long _meltLast = 0;
protected HashMap<Location, Byte> _pad = new HashMap<Location, Byte>();
public BlockRestoreData(Block block, int toID, byte toData, int fromID, byte fromData, long expireDelay, long meltDelay) public BlockRestoreData(Block block, int toID, byte toData, int fromID, byte fromData, long expireDelay, long meltDelay)
{ {
_block = block; _block = block;
@ -136,6 +142,11 @@ public class BlockRestoreData
{ {
if (_toID == 78 && _toData == (byte)7) if (_toID == 78 && _toData == (byte)7)
_block.setTypeIdAndData(80, (byte)0, true); _block.setTypeIdAndData(80, (byte)0, true);
else if (_toID == 8 || _toID == 9 || _toID == 79)
{
handleLilypad(false);
_block.setTypeIdAndData(_toID, _toData, true);
}
else else
_block.setTypeIdAndData(_toID, _toData, true); _block.setTypeIdAndData(_toID, _toData, true);
} }
@ -143,6 +154,7 @@ public class BlockRestoreData
public void restore() public void restore()
{ {
_block.setTypeIdAndData(_fromID, _fromData, true); _block.setTypeIdAndData(_fromID, _fromData, true);
handleLilypad(true);
} }
public void setFromId(int i) public void setFromId(int i)
@ -154,4 +166,24 @@ public class BlockRestoreData
{ {
_fromData = i; _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

@ -134,9 +134,10 @@ public class Chat extends MiniPlugin
public void preventMe(PlayerCommandPreprocessEvent event) public void preventMe(PlayerCommandPreprocessEvent event)
{ {
if (event.getMessage().toLowerCase().startsWith("/me ") if (event.getMessage().toLowerCase().startsWith("/me ")
|| event.getMessage().toLowerCase().startsWith("/bukkit")) || event.getMessage().toLowerCase().startsWith("/bukkit")
|| event.getMessage().toLowerCase().startsWith("/minecraft"))
{ {
event.getPlayer().sendMessage(F.main(getName(), "No, you!")); event.getPlayer().sendMessage(F.main(getName(), "Nope, not allowed!"));
event.setCancelled(true); event.setCancelled(true);
} }
} }

View File

@ -112,7 +112,7 @@ public class MobCommand extends MultiCommandBase<Creature>
HashSet<Entity> entSet = new HashSet<Entity>(); HashSet<Entity> entSet = new HashSet<Entity>();
for (int i = 0 ; i < count ; i++) 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 //Search Vars

View File

@ -68,6 +68,8 @@ public enum GameDisplay
Lobbers("Bomb Lobbers", Material.FIREBALL, (byte) 0, GameCategory.ARCADE, 54), Lobbers("Bomb Lobbers", Material.FIREBALL, (byte) 0, GameCategory.ARCADE, 54),
ChampionsCTF("Champions CTF", "Champions", Material.REDSTONE_BLOCK, (byte)0, GameCategory.CHAMPIONS, 55),
Event("Mineplex Event", Material.CAKE, (byte)0, GameCategory.EVENT, 999); Event("Mineplex Event", Material.CAKE, (byte)0, GameCategory.EVENT, 999);
String _name; String _name;

View File

@ -11,9 +11,19 @@ import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.donation.DonationManager;
import mineplex.core.giveaway.GiveawayManager;
import mineplex.core.globalpacket.command.GlobalPacketCommand; 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.GlobalPacketHandler;
import mineplex.core.globalpacket.redis.GlobalPacketMessage; 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.core.status.ServerStatusManager;
import mineplex.serverdata.commands.ServerCommandManager; import mineplex.serverdata.commands.ServerCommandManager;
@ -21,15 +31,32 @@ public class GlobalPacketManager extends MiniPlugin
{ {
private CoreClientManager _clientManager; private CoreClientManager _clientManager;
private ServerStatusManager _statusManager; 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); super("Global Packet Manager", plugin);
_clientManager = clientManager; _clientManager = clientManager;
_statusManager = statusManager; _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)); 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) public void callGlobalCommand(Player caller, String[] args)

View File

@ -12,7 +12,7 @@ public class GlobalPacketCommand extends CommandBase<GlobalPacketManager>
{ {
public GlobalPacketCommand(GlobalPacketManager plugin) public GlobalPacketCommand(GlobalPacketManager plugin)
{ {
super(plugin, Rank.ADMIN, "globalpacket"); super(plugin, Rank.JNR_DEV, "global", "globalpacket");
} }
@Override @Override
@ -20,8 +20,8 @@ public class GlobalPacketCommand extends CommandBase<GlobalPacketManager>
{ {
if (args == null || args.length < 1) 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", "Please call the global 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", "For help please see /global google doc"));
return; 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 ResendAdminCommand(this));
addCommand(new AnnounceCommand(this)); addCommand(new AnnounceCommand(this));
addCommand(new GlobalCommand(this)); //addCommand(new GlobalCommand(this));
addCommand(new AdminCommand(this)); addCommand(new AdminCommand(this));
} }
@ -219,16 +219,16 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
Get(from).LastToTime = System.currentTimeMillis(); Get(from).LastToTime = System.currentTimeMillis();
// Chiss or defek7 // 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 + 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."); 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!"); 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 // Log
// Logger().logChat("Private Message", from, to.getName(), message); // 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

@ -10,6 +10,7 @@ import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import org.bukkit.Bukkit;
import org.bukkit.Effect; import org.bukkit.Effect;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;

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.MovingObjectPosition;
import net.minecraft.server.v1_8_R3.Vec3D; import net.minecraft.server.v1_8_R3.Vec3D;
import org.bukkit.Bukkit;
import org.bukkit.Effect; import org.bukkit.Effect;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Sound; import org.bukkit.Sound;

View File

@ -16,6 +16,8 @@ import mineplex.core.common.util.UtilTime.TimeUnit;
import mineplex.core.punish.Command.PunishCommand; import mineplex.core.punish.Command.PunishCommand;
import mineplex.core.punish.Tokens.PunishClientToken; import mineplex.core.punish.Tokens.PunishClientToken;
import mineplex.core.punish.Tokens.PunishmentToken; import mineplex.core.punish.Tokens.PunishmentToken;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.serverdata.commands.ServerCommandManager; import mineplex.serverdata.commands.ServerCommandManager;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -108,6 +110,33 @@ public class Punish extends MiniPlugin
} }
} }
@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) public void Help(Player caller)
{ {
UtilPlayer.message(caller, F.main(_moduleName, "Commands List:")); UtilPlayer.message(caller, F.main(_moduleName, "Commands List:"));

View File

@ -32,7 +32,7 @@ public class ResPackManager implements CommandCallback
{ {
if (_packUnloadCheck.canSendUnload(player)) 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)) 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)) else if (!canGiveMythical || _clientManager.Get(player).GetRank().has(Rank.LEGEND))
{ {
@ -415,7 +415,7 @@ public class RewardManager
} }
else 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! // Dang, I guess we failed!
if (!_clientManager.hasRank(player, Rank.TITAN)) 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); reward.giveReward(rewardType, player, rewardDataCallback);
} }
else else

View File

@ -2,31 +2,28 @@ package mineplex.core.reward.rewards;
import java.util.Random; 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.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; 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 public class RankReward extends Reward
{ {
private Random _random; private Random _random;
private CoreClientManager _clientManager; 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); super(rarity, weight);
_clientManager = clientManager; _clientManager = clientManager;
_statusManager = statusManager;
_random = new Random(); _random = new Random();
} }
@ -48,13 +45,7 @@ public class RankReward extends Reward
_clientManager.Get(player).SetRank(rank, false); _clientManager.Get(player).SetRank(rank, false);
_clientManager.getRepository().saveRank(null, player.getName(), player.getUniqueId(), rank, true); _clientManager.getRepository().saveRank(null, player.getName(), player.getUniqueId(), rank, true);
if (rank == Rank.TITAN) return new RankRewardData(getRarity().getColor() + rank.Name + " Rank", new ItemStack(Material.NETHER_STAR), getRarity(), rank);
{
TitanChestGiveawayMessage message = new TitanChestGiveawayMessage(player.getName(), _statusManager.getCurrentServerName());
message.publish();
}
return new RewardData(getRarity().getColor() + rank.Name + " Rank", new ItemStack(Material.NETHER_STAR), getRarity());
} }
@Override @Override
@ -68,7 +59,7 @@ public class RankReward extends Reward
if (rank == null) if (rank == null)
return new RewardData(getRarity().getColor() + "Rank Upgrade Error", new ItemStack(Material.PAPER), getRarity()); 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 @Override

View File

@ -6,30 +6,25 @@ import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import java.util.Set; 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.blockrestore.BlockRestore;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.Callback; import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.hologram.HologramManager; import mineplex.core.hologram.HologramManager;
import mineplex.core.reward.RankRewardData;
import mineplex.core.reward.Reward; import mineplex.core.reward.Reward;
import mineplex.core.reward.RewardData; import mineplex.core.reward.RewardData;
import mineplex.core.reward.RewardRarity; import mineplex.core.reward.RewardRarity;
import mineplex.core.reward.RewardType; 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.Animation;
import mineplex.core.treasure.animation.BlockChangeAnimation; import mineplex.core.treasure.animation.BlockChangeAnimation;
import mineplex.core.treasure.animation.ChestOpenAnimation; import mineplex.core.treasure.animation.ChestOpenAnimation;
@ -37,8 +32,17 @@ import mineplex.core.treasure.animation.ChestSpawnAnimation;
import mineplex.core.treasure.animation.LootLegendaryAnimation; import mineplex.core.treasure.animation.LootLegendaryAnimation;
import mineplex.core.treasure.animation.LootMythicalAnimation; import mineplex.core.treasure.animation.LootMythicalAnimation;
import mineplex.core.treasure.animation.LootRareAnimation; import mineplex.core.treasure.animation.LootRareAnimation;
import mineplex.core.treasure.animation.TreasureRemoveAnimation;
import mineplex.core.treasure.animation.LootUncommonAnimation; 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. * Created by Shaun on 8/27/2014.
@ -62,6 +66,7 @@ public class Treasure
private Reward[] _rewards; private Reward[] _rewards;
private RewardType _rewardType; private RewardType _rewardType;
private ConcurrentHashMap<Integer, RewardData> _rewardData = new ConcurrentHashMap<Integer, RewardData>();
private int _currentReward; private int _currentReward;
private boolean _finished; private boolean _finished;
@ -70,15 +75,16 @@ public class Treasure
private LinkedList<Animation> _animations; private LinkedList<Animation> _animations;
private HologramManager _hologramManager; 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; _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; _player = player;
_random = seed; _random = seed;
@ -88,6 +94,7 @@ public class Treasure
_centerBlock = centerBlock; _centerBlock = centerBlock;
_animations = new LinkedList<Animation>(); _animations = new LinkedList<Animation>();
_hologramManager = hologramManager; _hologramManager = hologramManager;
_statusManager = statusManager;
_currentChest = 0; _currentChest = 0;
_currentReward = 0; _currentReward = 0;
@ -101,6 +108,19 @@ public class Treasure
} }
_animations.add(new BlockChangeAnimation(this, _otherBlockInfo)); _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() public int getFinishedTickCount()
@ -203,14 +223,15 @@ public class Treasure
final ChestData data = getChestData(block); final ChestData data = getChestData(block);
if (data != null && !data.isOpened() && _currentReward < _rewards.length) if (data != null && !data.isOpened() && _currentReward < _rewards.length)
{ {
final Reward reward = _rewards[_currentReward]; //final Reward reward = _rewards[_currentReward];
final RewardData rewardData = _rewardData.get(_currentReward);
data.setOpened(true); data.setOpened(true);
_currentReward++; _currentReward++;
reward.giveReward(_rewardType, _player, new Callback<RewardData>() //reward.giveReward(_rewardType, _player, new Callback<RewardData>()
{ //{
@Override //@Override
public void run(RewardData rewardData) //public void run(RewardData rewardData)
{ //{
if (swapList) if (swapList)
{ {
BlockInfo info = getBlockInfo(block); BlockInfo info = getBlockInfo(block);
@ -222,22 +243,30 @@ public class Treasure
_animations.add(chestOpenTask); _animations.add(chestOpenTask);
// Extra effects based off the rarity of the treasure // Extra effects based off the rarity of the treasure
if (reward.getRarity() == RewardRarity.UNCOMMON) if (rewardData.getRarity() == RewardRarity.UNCOMMON)
{ {
_animations.add(new LootUncommonAnimation(Treasure.this, data.getBlock())); _animations.add(new LootUncommonAnimation(Treasure.this, data.getBlock()));
} }
else if (reward.getRarity() == RewardRarity.RARE) else if (rewardData.getRarity() == RewardRarity.RARE)
{ {
_animations.add(new LootRareAnimation(Treasure.this, data.getBlock().getLocation().add(0.5, 1.5, 0.5))); _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())); Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " found " + C.cPurple + "Rare " + rewardData.getFriendlyName()));
} }
else if (reward.getRarity() == RewardRarity.LEGENDARY) else if (rewardData.getRarity() == RewardRarity.LEGENDARY)
{ {
_animations.add(new LootLegendaryAnimation(Treasure.this, data.getBlock())); _animations.add(new LootLegendaryAnimation(Treasure.this, data.getBlock()));
Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " found " + C.cGreen + "Legendary " + rewardData.getFriendlyName())); Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " found " + C.cGreen + "Legendary " + rewardData.getFriendlyName()));
} }
else if (reward.getRarity() == RewardRarity.MYTHICAL) 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())); _animations.add(new LootMythicalAnimation(Treasure.this, data.getBlock()));
Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " found " + C.cRed + "Mythical " + rewardData.getFriendlyName())); Bukkit.broadcastMessage(F.main("Treasure", F.name(_player.getName()) + " found " + C.cRed + "Mythical " + rewardData.getFriendlyName()));
} }
@ -248,8 +277,8 @@ public class Treasure
_animations.add(animation); _animations.add(animation);
_finished = true; _finished = true;
} }
} //}
}); //});
} }
} }

View File

@ -2,6 +2,26 @@ package mineplex.core.treasure;
import java.util.List; 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.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; 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.PlayerQuitEvent;
import org.bukkit.event.player.PlayerVelocityEvent; 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 public class TreasureLocation implements Listener
{ {
private TreasureManager _treasureManager; private TreasureManager _treasureManager;
private InventoryManager _inventoryManager; private InventoryManager _inventoryManager;
private Hologram _hologram; private Hologram _hologram;
private HologramManager _hologramManager; private HologramManager _hologramManager;
private ServerStatusManager _statusManager;
private Treasure _currentTreasure; private Treasure _currentTreasure;
private Block _chestBlock; private Block _chestBlock;
private byte _chestBlockData; private byte _chestBlockData;
@ -50,7 +52,7 @@ public class TreasureLocation implements Listener
private TreasureShop _shop; private TreasureShop _shop;
private Location _resetLocation; 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; _treasureManager = treasureManager;
_resetLocation = resetLocation; _resetLocation = resetLocation;
@ -59,6 +61,7 @@ public class TreasureLocation implements Listener
_chestBlockData = _chestBlock.getData(); _chestBlockData = _chestBlock.getData();
_chestSpawns = chestSpawns; _chestSpawns = chestSpawns;
_hologramManager = hologramManager; _hologramManager = hologramManager;
_statusManager = statusManager;
_currentTreasure = null; _currentTreasure = null;
_hologram = new Hologram(_hologramManager, chestBlock.getLocation().add(0.5, 2.5, 0.5), C.cGreen + C.Bold + "Open Treasure"); _hologram = new Hologram(_hologramManager, chestBlock.getLocation().add(0.5, 2.5, 0.5), C.cGreen + C.Bold + "Open Treasure");
setHoloChestVisible(true); 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())); Bukkit.broadcastMessage(F.main("Treasure", F.name(player.getName()) + " is opening a " + treasureType.getName()));
Reward[] rewards = _treasureManager.getRewards(player, treasureType.getRewardType()); 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; _currentTreasure = treasure;
UtilTextMiddle.display(treasureType.getName(), "Choose 4 Chests To Open", 20, 180, 20, player); 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 chestLoc7 = world.getBlockAt(-18, 72, -16);
Block chestLoc8 = world.getBlockAt(-16, 72, -18); Block chestLoc8 = world.getBlockAt(-16, 72, -18);
Location resetLocation = new Location(world, -23.5, 72, -23.5); 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 chestLoc7 = world.getBlockAt(18, 72, 16);
Block chestLoc8 = world.getBlockAt(16, 72, 18); Block chestLoc8 = world.getBlockAt(16, 72, 18);
Location resetLocation = new Location(world, 23.5, 72, 23.5); 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 chestLoc7 = world.getBlockAt(18, 72, -16);
Block chestLoc8 = world.getBlockAt(16, 72, -18); Block chestLoc8 = world.getBlockAt(16, 72, -18);
Location resetLocation = new Location(world, 23.5, 72, -23.5); 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 chestLoc7 = world.getBlockAt(-18, 72, 16);
Block chestLoc8 = world.getBlockAt(-16, 72, 18); Block chestLoc8 = world.getBlockAt(-16, 72, 18);
Location resetLocation = new Location(world, -23.5, 72, 23.5); 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) for (TreasureLocation treasureLocation : _treasureLocations)

View File

@ -138,7 +138,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
StatsManager statsManager = new StatsManager(plugin, _clientManager); StatsManager statsManager = new StatsManager(plugin, _clientManager);
AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, donationManager); AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, donationManager);
ClassShopManager shopManager = new ClassShopManager(plugin, _classManager, skillManager, itemFactory, achievementManager, _clientManager); ClassShopManager shopManager = new ClassShopManager(plugin, _classManager, skillManager, itemFactory, achievementManager, _clientManager, false);
_classShop = new ClassCombatShop(shopManager, _clientManager, donationManager, true, "Class Shop"); _classShop = new ClassCombatShop(shopManager, _clientManager, donationManager, true, "Class Shop");
_warManager = new WarManager(plugin, this); _warManager = new WarManager(plugin, this);

View File

@ -149,7 +149,7 @@ public class Hub extends JavaPlugin implements IRelation
return true; return true;
} }
}); });
new GlobalPacketManager(this, clientManager, serverStatusManager); new GlobalPacketManager(this, clientManager, serverStatusManager, inventoryManager, donationManager, petManager, statsManager, giveawayManager);
//new Replay(this, packetHandler); //new Replay(this, packetHandler);
AprilFoolsManager.Initialize(this, clientManager, disguiseManager); AprilFoolsManager.Initialize(this, clientManager, disguiseManager);
@ -167,15 +167,15 @@ public class Hub extends JavaPlugin implements IRelation
ItemFactory itemFactory = new ItemFactory(this, blockRestore, conditionManager, damage, energy, fire, throwManager, webServerAddress); 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); 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); 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, "Brute", classManager.GetClass("Brute"), true);
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Mage", classManager.GetClass("Mage")); new ClassCombatShop(shopManager, clientManager, donationManager, false, "Mage", classManager.GetClass("Mage"), true);
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Ranger", classManager.GetClass("Ranger")); new ClassCombatShop(shopManager, clientManager, donationManager, false, "Ranger", classManager.GetClass("Ranger"), true);
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Knight", classManager.GetClass("Knight")); new ClassCombatShop(shopManager, clientManager, donationManager, false, "Knight", classManager.GetClass("Knight"), true);
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Assassin", classManager.GetClass("Assassin")); new ClassCombatShop(shopManager, clientManager, donationManager, false, "Assassin", classManager.GetClass("Assassin"), true);
//Updates //Updates
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1); getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1);

View File

@ -226,7 +226,7 @@ public class StackerManager extends MiniPlugin implements IThrown
UtilAction.velocity(throwee, thrower.getLocation().getDirection(), 1.8, false, 0, 0.3, 2, false); UtilAction.velocity(throwee, thrower.getLocation().getDirection(), 1.8, false, 0, 0.3, 2, false);
_projectileManager.AddThrow(throwee, thrower, this, -1, true, false, true, false, 0.5f); _projectileManager.AddThrow(throwee, thrower, this, 4000, true, false, true, false, 0.5f);
//Portal Delay //Portal Delay
Manager.SetPortalDelay(thrower); Manager.SetPortalDelay(thrower);

View File

@ -61,8 +61,11 @@ 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(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("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("CLANS", locComp.clone().add(15, 28, 0), faceComp, 159, (byte)14, TextAlign.CENTER); UtilBlockText.MakeText("CAPTURE THE FLAG", 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("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);
//Arcade //Arcade
UtilBlockText.MakeText("ARCADE", locArcade, faceArcade, 159, (byte)5, TextAlign.CENTER); UtilBlockText.MakeText("ARCADE", locArcade, faceArcade, 159, (byte)5, TextAlign.CENTER);

View File

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

View File

@ -2,7 +2,18 @@ package mineplex.minecraft.game.classcombat.Class;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; 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.IPvpClass.ClassType;
import mineplex.minecraft.game.classcombat.Class.repository.ClassRepository; import mineplex.minecraft.game.classcombat.Class.repository.ClassRepository;
import mineplex.minecraft.game.classcombat.Class.repository.token.ClientClassTokenWrapper; 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.ISkill;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.classcombat.item.ItemFactory; 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.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -34,6 +37,7 @@ public class ClassManager extends MiniClientPlugin<ClientClass> implements IClas
private SkillFactory _skillFactory; private SkillFactory _skillFactory;
private ItemFactory _itemFactory; private ItemFactory _itemFactory;
private ClassRepository _repository; private ClassRepository _repository;
private GadgetManager _gadgetManager;
private HashMap<String, IPvpClass> _classes; private HashMap<String, IPvpClass> _classes;
private HashMap<Integer, IPvpClass> _classSalesPackageIdMap; private HashMap<Integer, IPvpClass> _classSalesPackageIdMap;
@ -41,6 +45,8 @@ public class ClassManager extends MiniClientPlugin<ClientClass> implements IClas
private boolean _enabled = true; private boolean _enabled = true;
private ConcurrentHashMap<String, Callback<String>> _messageSuppressed;
public ClassManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, public ClassManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager,
SkillFactory skillFactory, ItemFactory itemFactory, String webAddress) SkillFactory skillFactory, ItemFactory itemFactory, String webAddress)
{ {
@ -54,6 +60,26 @@ public class ClassManager extends MiniClientPlugin<ClientClass> implements IClas
_repository = new ClassRepository(webAddress); _repository = new ClassRepository(webAddress);
_classes = new HashMap<String, IPvpClass>(); _classes = new HashMap<String, IPvpClass>();
_classSalesPackageIdMap = new HashMap<Integer, 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(); PopulateClasses();
} }
@ -301,6 +327,11 @@ public class ClassManager extends MiniClientPlugin<ClientClass> implements IClas
return _repository; return _repository;
} }
public GadgetManager getGadgetManager()
{
return _gadgetManager;
}
@EventHandler @EventHandler
public void SkillDisplay(PlayerCommandPreprocessEvent event) public void SkillDisplay(PlayerCommandPreprocessEvent event)
{ {
@ -344,4 +375,25 @@ public class ClassManager extends MiniClientPlugin<ClientClass> implements IClas
{ {
_enabled = var; _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

@ -563,13 +563,15 @@ public class ClientClass
public void DisplaySkills(Player player) public void DisplaySkills(Player player)
{ {
player.sendMessage("------------------------------------------"); String bar = "------------------------------------------";
player.sendMessage(bar);
for (SkillType type : _lastSkillMap.keySet()) for (SkillType type : _lastSkillMap.keySet())
{ {
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(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) //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; package mineplex.minecraft.game.classcombat.Class;
import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken; import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken;

View File

@ -1,10 +1,11 @@
package mineplex.minecraft.game.classcombat.Class; package mineplex.minecraft.game.classcombat.Class;
import java.util.HashSet; 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.UtilGear;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.gadget.types.GadgetType;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken; import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken;
import mineplex.minecraft.game.classcombat.Skill.ISkill; import mineplex.minecraft.game.classcombat.Skill.ISkill;
@ -195,12 +196,16 @@ public class PvpClass implements IPvpClass
continue; continue;
} }
Equip(cur); if (_classes.getGadgetManager().getActive(cur, GadgetType.Costume) != null)
continue;
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); ClientClass client = _classes.Get(player);
@ -208,12 +213,12 @@ public class PvpClass implements IPvpClass
if (customBuild != null) if (customBuild != null)
{ {
client.EquipCustomBuild(customBuild, true, true); client.EquipCustomBuild(customBuild, inform, true);
} }
else else
{ {
client.SetGameClass(this); client.SetGameClass(this);
client.EquipCustomBuild(client.GetCustomBuilds(this).get(0), true, true); client.EquipCustomBuild(client.GetCustomBuilds(this).get(0), inform, true);
} }
//Ensure Sneak Removed //Ensure Sneak Removed

View File

@ -55,7 +55,7 @@ public class Flash extends SkillActive
@Override @Override
public String GetRechargeString() public String GetRechargeString()
{ {
return "Recharge: #10#-1 Seconds per Charge"; return "Recharge: #8#-1 Seconds per Charge";
} }
@Override @Override
@ -84,7 +84,7 @@ public class Flash extends SkillActive
} }
@EventHandler @EventHandler
public void Recharge(UpdateEvent event) public void recharge(UpdateEvent event)
{ {
for (Player cur : GetUsers()) for (Player cur : GetUsers())
{ {
@ -100,7 +100,7 @@ public class Flash extends SkillActive
if (charges >= 1 + level) if (charges >= 1 + level)
continue; 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; continue;
_flash.put(cur, charges + 1); _flash.put(cur, charges + 1);

View File

@ -107,6 +107,9 @@ public class Illusion extends SkillActive
UtilEnt.Vegetate(skel); UtilEnt.Vegetate(skel);
UtilEnt.silence(skel, true); UtilEnt.silence(skel, true);
skel.setMaxHealth(7);
skel.setHealth(7);
ClassCombatCreatureAllowSpawnEvent disableEvent = new ClassCombatCreatureAllowSpawnEvent(false); ClassCombatCreatureAllowSpawnEvent disableEvent = new ClassCombatCreatureAllowSpawnEvent(false);
UtilServer.getServer().getPluginManager().callEvent(disableEvent); UtilServer.getServer().getPluginManager().callEvent(disableEvent);

View File

@ -31,6 +31,7 @@ import org.bukkit.event.player.PlayerDropItemEvent;
public class Recall extends Skill public class Recall extends Skill
{ {
private HashMap<Player, LinkedList<Location>> _locMap = new HashMap<Player, LinkedList<Location>>(); 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) public Recall(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels)
{ {
@ -52,7 +53,7 @@ public class Recall extends Skill
} }
@EventHandler @EventHandler
public void Use(PlayerDropItemEvent event) public void use(PlayerDropItemEvent event)
{ {
Player player = event.getPlayer(); Player player = event.getPlayer();
@ -79,9 +80,17 @@ public class Recall extends Skill
if (locs == null) if (locs == null)
return; return;
LinkedList<Double> health = _healthMap.remove(player);
if (health == null)
return;
//Heal
player.setHealth(health.getLast());
//Effect //Effect
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f); player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f);
//Teleport
Location current = player.getLocation(); Location current = player.getLocation();
Location target = locs.getLast(); Location target = locs.getLast();
@ -102,21 +111,32 @@ public class Recall extends Skill
} }
@EventHandler @EventHandler
public void StoreLocation(UpdateEvent event) public void storeLocation(UpdateEvent event)
{ {
if (event.getType() != UpdateType.TICK) if (event.getType() != UpdateType.TICK)
return; return;
for (Player cur : GetUsers()) for (Player cur : GetUsers())
{ {
//Create
if (!_locMap.containsKey(cur)) if (!_locMap.containsKey(cur))
_locMap.put(cur, new LinkedList<Location>()); _locMap.put(cur, new LinkedList<Location>());
if (!_healthMap.containsKey(cur))
_healthMap.put(cur, new LinkedList<Double>());
//Store
_locMap.get(cur).addFirst(cur.getLocation()); _locMap.get(cur).addFirst(cur.getLocation());
_healthMap.get(cur).addFirst(cur.getHealth());
int level = getLevel(cur); int level = getLevel(cur);
//Cull
if (_locMap.get(cur).size() > (2 + 2 * level) * 20) if (_locMap.get(cur).size() > (2 + 2 * level) * 20)
_locMap.get(cur).removeLast(); _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[] SetDesc(new String[]
{ {
"Your next arrow will Silence", "Your next arrow will Silence",
"target for #1#3 seconds.", "target for #2#2 seconds.",
"", "",
"Silence stops skills being used." "Silence stops skills being used."
}); });
@ -129,7 +129,7 @@ public class SilencingArrow extends SkillActive
if (level == 0) return; if (level == 0) return;
//Confuse //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 //Effect
damagee.getWorld().playSound(damagee.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f); damagee.getWorld().playSound(damagee.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f);

View File

@ -14,6 +14,7 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
@ -104,15 +105,15 @@ public class BlockToss extends SkillCharge implements IThrown
if (!Recharge.Instance.use(player, GetName(), 1000, false, false)) if (!Recharge.Instance.use(player, GetName(), 1000, false, false))
return; return;
//Door //Door and Banner
if (grab.getRelative(BlockFace.UP).getTypeId() == 64 || grab.getRelative(BlockFace.UP).getTypeId() == 71) 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.")); UtilPlayer.message(player, F.main(GetName(), "You cannot grab this block."));
return; return;
} }
// Ladder and beacon grabs // 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.")); UtilPlayer.message(player, F.main(GetName(), "You cannot grab this block."));
return; return;
@ -136,6 +137,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 //Block to Item
FallingBlock block = player.getWorld().spawnFallingBlock(player.getEyeLocation(), event.getClickedBlock().getType(), event.getClickedBlock().getData()); FallingBlock block = player.getWorld().spawnFallingBlock(player.getEyeLocation(), event.getClickedBlock().getType(), event.getClickedBlock().getData());
@ -266,6 +273,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 @EventHandler
public void CreateBlock(UpdateEvent event) public void CreateBlock(UpdateEvent event)
{ {
@ -283,21 +303,27 @@ public class BlockToss extends SkillCharge implements IThrown
fallIter.remove(); fallIter.remove();
Block block = fall.getLocation().getBlock(); createBlock(fall, fall.getLocation().getBlock());
if (block.getType() != fall.getMaterial())
continue;
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());
} }
} }
public void createBlock(FallingBlock fall, Block block)
{
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 @EventHandler
public void ItemSpawn(ItemSpawnEvent event) public void ItemSpawn(ItemSpawnEvent event)
{ {

View File

@ -18,7 +18,7 @@ public class Colossus extends Skill
SetDesc(new String[] SetDesc(new String[]
{ {
"You are so huge that you take", "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 //Damage
event.AddMod(damagee.getName(), GetName(), 0, false); event.AddMod(damagee.getName(), GetName(), 0, false);
event.AddKnockback(GetName(), 0.85 - 0.20*level); event.AddKnockback(GetName(), 0.35);
} }
@Override @Override

View File

@ -24,7 +24,7 @@ public class CripplingBlow extends Skill
{ {
"Your powerful axe attacks give", "Your powerful axe attacks give",
"targets Slow 2 for 1.5 second,", "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 //Damage
event.AddMod(damager.getName(), GetName(), 0, true); event.AddMod(damager.getName(), GetName(), 0, true);
event.SetKnockback(false); event.AddKnockback(GetName(), 0.5);
//Event //Event
UtilServer.getServer().getPluginManager().callEvent(new SkillEvent(damager, GetName(), ClassType.Brute, damagee)); UtilServer.getServer().getPluginManager().callEvent(new SkillEvent(damager, GetName(), ClassType.Brute, damagee));

View File

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

View File

@ -51,8 +51,8 @@ public class FleshHook extends SkillActiveCharge implements IThrown
GetChargeString(), GetChargeString(),
"", "",
"If Flesh Hook hits a player, it", "If Flesh Hook hits a player, it",
"deals up to #2#2 damage, and rips them", "deals up to #5#1 damage, and rips them",
"towards you with #1.2#0.2 velocity.", "towards you with #1.2#0.3 velocity.",
}); });
} }
@ -142,14 +142,14 @@ public class FleshHook extends SkillActiveCharge implements IThrown
//Pull //Pull
UtilAction.velocity(target, UtilAction.velocity(target,
UtilAlg.getTrajectory(target.getLocation(), player.getLocation()), 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 //Condition
Factory.Condition().Factory().Falling(GetName(), target, player, 10, false, true); Factory.Condition().Factory().Falling(GetName(), target, player, 10, false, true);
//Damage Event //Damage Event
Factory.Damage().NewDamageEvent(target, player, null, 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()); player.getName(), GetName());

View File

@ -81,7 +81,7 @@ public class SeismicSlam extends SkillActive
{ {
"Jump up and slam back into the ground.", "Jump up and slam back into the ground.",
"Players within #5.5#0.5 Blocks take up to", "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 //Velocity
UtilAction.velocity(cur, UtilAction.velocity(cur,
UtilAlg.getTrajectory2d(player.getLocation().toVector(), cur.getLocation().toVector()), 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 //Condition
Factory.Condition().Factory().Falling(GetName(), cur, player, 10, false, true); Factory.Condition().Factory().Falling(GetName(), cur, player, 10, false, true);

View File

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

View File

@ -67,8 +67,9 @@ public class HoldPosition extends SkillActive
double duration = 3 + (1 * level); double duration = 3 + (1 * level);
//Action //Action
Factory.Condition().Factory().Slow(GetName(), player, player, duration, 3, false, true, false, true); Factory.Condition().Factory().Slow(GetName(), player, player, duration, 2, false, true, false, true);
Factory.Condition().Factory().Protection(GetName(), player, player, duration, 2, false, true, true); Factory.Condition().Factory().Protection(GetName(), player, player, duration, 2, false, false, true);
Factory.Condition().Factory().Jump(GetName(), player, player, duration, 250, false, false, true);
//Inform //Inform
UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + ".")); UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + "."));

View File

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

View File

@ -46,10 +46,9 @@ public class ArcticArmor extends Skill
"", "",
"Create a freezing area around you", "Create a freezing area around you",
"in a #3#1 Block radius. Allies inside", "in a #3#1 Block radius. Allies inside",
"this area receive Protection 1.", "this area receive Protection 2.",
"", "",
"You are permanently immune to the", "You receive Protection 1."
"Slowing effect of snow."
}); });
} }
@ -154,6 +153,8 @@ public class ArcticArmor extends Skill
HashMap<Block, Double> blocks = UtilBlock.getInRadius(cur.getLocation().getBlock().getLocation(), 3d + level); HashMap<Block, Double> blocks = UtilBlock.getInRadius(cur.getLocation().getBlock().getLocation(), 3d + level);
for (Block block : blocks.keySet()) for (Block block : blocks.keySet())
{ {
if (block.getType().toString().contains("BANNER") || block.getRelative(BlockFace.UP).getType().toString().contains("BANNER"))
continue;
//Freeze //Freeze
if (!block.getRelative(BlockFace.UP).isLiquid()) if (!block.getRelative(BlockFace.UP).isLiquid())
if (block.getLocation().getY() <= cur.getLocation().getY()) if (block.getLocation().getY() <= cur.getLocation().getY())
@ -177,7 +178,7 @@ public class ArcticArmor extends Skill
//Protection //Protection
for (Player other : UtilPlayer.getNearby(cur.getLocation(), 3 + getLevel(cur))) for (Player other : UtilPlayer.getNearby(cur.getLocation(), 3 + getLevel(cur)))
if (!Factory.Relation().canHurt(cur, other) || other.equals(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);
} }
} }
@ -222,43 +223,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 @EventHandler
public void Particle(UpdateEvent event) public void Particle(UpdateEvent event)
{ {

View File

@ -149,44 +149,60 @@ public class Blizzard extends SkillActive
} }
//Target //Target
HashSet<Byte> ignore = new HashSet<Byte>(); // HashSet<Byte> ignore = new HashSet<Byte>();
ignore.add((byte) 0); // ignore.add((byte) 0);
ignore.add((byte) 78); // ignore.add((byte) 78);
ignore.add((byte) 80); // ignore.add((byte) 80);
Block target = cur.getTargetBlock(ignore, 7); // Block target = cur.getTargetBlock(ignore, 7);
//Snow //Snowballs
if (target == null || target.getType() == Material.AIR || UtilMath.offset(target.getLocation(), cur.getLocation()) > 5) // if (target == null || target.getType() == Material.AIR || UtilMath.offset(target.getLocation(), cur.getLocation()) > 5)
for (int i=0 ; i<1+level ; i++) // for (int i=0 ; i<1+level ; i++)
{ // {
Projectile snow = cur.launchProjectile(Snowball.class); // 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);
// }
double mult = 0.25 + 0.15 * level; //Snowballs
double x = (0.2 - (UtilMath.r(40)/100d)) * mult; for (int i=0 ; i<1+level ; i++)
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); 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 //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); cur.getWorld().playSound(cur.getLocation(), Sound.STEP_SNOW, 0.1f, 0.5f);
} }
} }
@ -213,30 +229,33 @@ public class Blizzard extends SkillActive
UtilAction.velocity(damagee, proj.getVelocity().multiply(0.1).add(new Vector(0, 0.15, 0))); UtilAction.velocity(damagee, proj.getVelocity().multiply(0.1).add(new Vector(0, 0.15, 0)));
} }
@EventHandler // @EventHandler
public void SnowballForm(ProjectileHitEvent event) // public void SnowballForm(ProjectileHitEvent event)
{ // {
if (!(event.getEntity() instanceof Snowball)) // if (!(event.getEntity() instanceof Snowball))
return; // return;
//
if (_snowball.remove(event.getEntity()) == null) // if (_snowball.remove(event.getEntity()) == null)
return; // return;
//
Factory.BlockRestore().Snow(event.getEntity().getLocation().getBlock(), (byte)1, (byte)7, 2000, 250, 0); // Factory.BlockRestore().Snow(event.getEntity().getLocation().getBlock(), (byte)1, (byte)7, 2000, 250, 0);
} // }
@EventHandler @EventHandler
public void clearInvalidSnowballedPlayers(UpdateEvent event) public void clearInvalidSnowballedPlayers(UpdateEvent event)
{ {
if (event.getType() != UpdateType.SEC) if (event.getType() != UpdateType.FASTER)
return; return;
for (Iterator<Entry<Projectile, Player>> snowBallIterator = _snowball.entrySet().iterator(); snowBallIterator.hasNext();) for (Iterator<Entry<Projectile, Player>> snowBallIterator = _snowball.entrySet().iterator(); snowBallIterator.hasNext();)
{ {
Entry<Projectile, Player> entry = snowBallIterator.next(); 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(); snowBallIterator.remove();
entry.getKey().remove();
}
} }
} }

View File

@ -114,6 +114,10 @@ public class FissureData
//Cannot raise //Cannot raise
if (block.getTypeId() == 46) if (block.getTypeId() == 46)
return false; 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); Block up = block.getRelative(0, _height + 1, 0);

View File

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

View File

@ -282,7 +282,7 @@ public class LifeBonds extends Skill
HashSet<Item> remove = new HashSet<Item>(); HashSet<Item> remove = new HashSet<Item>();
for (Item cur : _items) 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); remove.add(cur);
for (Item cur : remove) for (Item cur : remove)

View File

@ -11,12 +11,14 @@ import org.bukkit.event.*;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockIgniteEvent; import org.bukkit.event.block.BlockIgniteEvent;
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause; import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.projectile.IThrown; import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser; import mineplex.core.projectile.ProjectileUser;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
@ -24,6 +26,9 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.minecraft.game.classcombat.Skill.SkillActive; import mineplex.minecraft.game.classcombat.Skill.SkillActive;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.core.condition.Condition;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import org.bukkit.event.player.*; import org.bukkit.event.player.*;
@ -78,8 +83,8 @@ public class LightningOrb extends SkillActive implements IThrown
"Launch a lightning orb. Upon a direct", "Launch a lightning orb. Upon a direct",
"hit with player, or #5#-0.4 seconds, it will", "hit with player, or #5#-0.4 seconds, it will",
"strike all enemies within #3#0.5 Blocks ", "strike all enemies within #3#0.5 Blocks ",
"with lightning, giving them Slow 2", "with lightning, dealing #4#1 damage and",
"for 4 seconds." "giving Slow 2 for 4 seconds."
}); });
} }
@ -101,7 +106,7 @@ public class LightningOrb extends SkillActive implements IThrown
//Action //Action
Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(57)); Item item = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), ItemStackFactory.Instance.CreateStack(57));
item.setVelocity(player.getLocation().getDirection()); 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); Sound.FIZZ, 0.6f, 1.6f, ParticleType.FIREWORKS_SPARK, UpdateType.TICK, 0.4f);
//Inform //Inform
@ -147,12 +152,6 @@ public class LightningOrb extends SkillActive implements IThrown
HashMap<LivingEntity, Double> hit = UtilEnt.getInRadius(data.GetThrown().getLocation(), 3 + 0.5 * level); 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<>(); List<LivingEntity> struck = new ArrayList<>();
//Lightning //Lightning
@ -161,14 +160,16 @@ public class LightningOrb extends SkillActive implements IThrown
if (cur.equals(player)) if (cur.equals(player))
continue; 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 //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); struck.add(cur);
} }
@ -180,6 +181,7 @@ public class LightningOrb extends SkillActive implements IThrown
continue; continue;
Factory.Condition().Factory().Slow(GetName(), cur, player, 4, 1, false, true, true, true); 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)); Bukkit.getPluginManager().callEvent(new LightningOrbEvent(player, struck));

View File

@ -167,7 +167,7 @@ public class Rupture extends SkillActiveCharge
public void MoveRupture(Player cur) 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; if (targetBlock == null) return;
//Aiming at sky //Aiming at sky

View File

@ -106,6 +106,26 @@ public class Void extends Skill
} }
} }
@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 @EventHandler
public void Audio(UpdateEvent event) public void Audio(UpdateEvent event)
{ {

View File

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

View File

@ -67,6 +67,12 @@ public class Disengage extends SkillActive
return false; 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; return true;
} }

View File

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

View File

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

View File

@ -9,12 +9,15 @@ import org.bukkit.Sound;
import org.bukkit.entity.Arrow; import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Item; import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile; import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityShootBowEvent; import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; 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.core.common.util.UtilParticle.ViewDist;
import mineplex.minecraft.game.classcombat.Skill.SkillActive; import mineplex.minecraft.game.classcombat.Skill.SkillActive;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
public class NapalmShot extends SkillActive public class NapalmShot extends SkillActive
{ {
@ -53,9 +57,13 @@ public class NapalmShot extends SkillActive
SetDesc(new String[] SetDesc(new String[]
{ {
"Prepare a napalm shot;", "Prepare a Napalm Shot;",
"",
"Your next arrow will burst into", "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 @EventHandler
public void BowShoot(EntityShootBowEvent event) public void bowShoot(EntityShootBowEvent event)
{ {
if (!(event.getEntity() instanceof Player)) if (!(event.getEntity() instanceof Player))
return; return;
@ -105,8 +113,46 @@ public class NapalmShot extends SkillActive
event.getProjectile().setFireTicks(120); event.getProjectile().setFireTicks(120);
} }
@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 @EventHandler
public void ProjectileHit(ProjectileHitEvent event) public void projectileHit(ProjectileHitEvent event)
{ {
Projectile proj = event.getEntity(); Projectile proj = event.getEntity();
@ -142,20 +188,20 @@ public class NapalmShot extends SkillActive
} }
@EventHandler @EventHandler
public void Particle(UpdateEvent event) public void particle(UpdateEvent event)
{ {
if (event.getType() != UpdateType.TICK) if (event.getType() != UpdateType.TICK)
return; return;
for (Entity ent : _arrows) 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()); ViewDist.MAX, UtilServer.getPlayers());
} }
} }
@EventHandler @EventHandler
public void Clean(UpdateEvent event) public void clean(UpdateEvent event)
{ {
if (event.getType() != UpdateType.SEC) if (event.getType() != UpdateType.SEC)
return; return;

View File

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

View File

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

View File

@ -1,12 +1,16 @@
package mineplex.minecraft.game.classcombat.Skill.Ranger; package mineplex.minecraft.game.classcombat.Skill.Ranger;
import java.util.HashMap;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerMoveEvent;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
@ -18,24 +22,30 @@ import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
public class VitalitySpores extends Skill 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) public VitalitySpores(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels)
{ {
super(skills, name, classType, skillType, cost, levels); super(skills, name, classType, skillType, cost, levels);
SetDesc(new String[] SetDesc(new String[]
{ {
"After #5#-1 seconds of not taking damage,", "While standing still, forest spores",
"forest spores surround you, restoring", "heal you for #0#0.5 health per 2 seconds."
"1 health per second.",
"",
"This remains until you take damage."
}); });
} }
@EventHandler @EventHandler
public void Update(UpdateEvent event) public void playerMove(PlayerMoveEvent event)
{ {
if (event.getType() != UpdateType.SEC) if (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; return;
for (Player cur : GetUsers()) for (Player cur : GetUsers())
@ -43,13 +53,17 @@ public class VitalitySpores extends Skill
int level = getLevel(cur); int level = getLevel(cur);
if (level == 0) continue; 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, 0.5 * level);
UtilPlayer.health(cur, 1);
UtilParticle.PlayParticle(ParticleType.HEART, cur.getEyeLocation().add(UtilAlg.getBehind(cur.getLocation().getDirection().multiply(0.5))), 0, 0.2f, 0, 0, 1, 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()); ViewDist.LONG, UtilServer.getPlayers());
_lastMove.put(cur, System.currentTimeMillis());
} }
} }
} }

View File

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

View File

@ -201,21 +201,21 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
AddSkill(new MarkedForDeath(this, "Marked for Death", ClassType.Assassin, SkillType.Bow, AddSkill(new MarkedForDeath(this, "Marked for Death", ClassType.Assassin, SkillType.Bow,
1, 4, 1, 4,
40, 0, 40, 0,
20000, 0, true, 20000, -2000, true,
new Material[] {Material.BOW}, new Material[] {Material.BOW},
new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK})); new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK}));
AddSkill(new SmokeArrow(this, "Smoke Arrow", ClassType.Assassin, SkillType.Bow, AddSkill(new SmokeArrow(this, "Smoke Arrow", ClassType.Assassin, SkillType.Bow,
1, 4, 1, 4,
40, 0, 40, 0,
20000, 0, true, 20000, -2000, true,
new Material[] {Material.BOW}, new Material[] {Material.BOW},
new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK})); new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK}));
AddSkill(new SilencingArrow(this, "Silencing Arrow", ClassType.Assassin, SkillType.Bow, AddSkill(new SilencingArrow(this, "Silencing Arrow", ClassType.Assassin, SkillType.Bow,
1, 4, 1, 4,
40, 0, 40, 0,
20000, 0, true, 20000, -2000, true,
new Material[] {Material.BOW}, new Material[] {Material.BOW},
new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK})); new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK}));
@ -238,9 +238,9 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
//Sword //Sword
AddSkill(new DwarfToss(this, "Dwarf Toss", ClassType.Brute, SkillType.Sword, AddSkill(new DwarfToss(this, "Dwarf Toss", ClassType.Brute, SkillType.Sword,
1, 5, 2, 1,
0, 0, 0, 0,
20000, -2000, true, 16000, 0, true,
new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD}, new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD},
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
@ -257,21 +257,21 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
AddSkill(new SeismicSlam(this, "Seismic Slam", ClassType.Brute, SkillType.Axe, AddSkill(new SeismicSlam(this, "Seismic Slam", ClassType.Brute, SkillType.Axe,
1, 5, 1, 5,
0, 0, 0, 0,
30000, -2000, true, 24000, -2000, true,
new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE}, new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE},
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
AddSkill(new Takedown(this, "Takedown", ClassType.Brute, SkillType.Axe, AddSkill(new Takedown(this, "Takedown", ClassType.Brute, SkillType.Axe,
1, 5, 1, 5,
0, 0, 0, 0,
30000, -3000, true, 24000, -2000, true,
new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE}, new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE},
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
AddSkill(new WhirlwindAxe(this, "Whirlwind Axe", ClassType.Brute, SkillType.Axe, AddSkill(new WhirlwindAxe(this, "Whirlwind Axe", ClassType.Brute, SkillType.Axe,
1, 5, 1, 5,
0, 0, 0, 0,
30000, -3000, true, 24000, -2000, true,
new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE}, new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE},
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
@ -282,7 +282,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
//Passive B //Passive B
AddSkill(new CripplingBlow(this, "Crippling Blow", ClassType.Brute, SkillType.PassiveB, 2, 1)); 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)); AddSkill(new Overwhelm(this, "Overwhelm", ClassType.Brute, SkillType.PassiveB, 1, 3));
} }
@ -331,7 +331,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
AddSkill(new ShieldSmash(this, "Shield Smash", ClassType.Knight, SkillType.Axe, AddSkill(new ShieldSmash(this, "Shield Smash", ClassType.Knight, SkillType.Axe,
1, 5, 1, 5,
0, 0, 0, 0,
10000, -1000, true, 15000, -1000, true,
new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE}, new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE},
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
@ -400,7 +400,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
AddSkill(new LightningOrb(this, "Lightning Orb", ClassType.Mage, SkillType.Axe, AddSkill(new LightningOrb(this, "Lightning Orb", ClassType.Mage, SkillType.Axe,
1, 5, 1, 5,
60, -2, 60, -2,
11000, -1000, true, 13000, -1000, true,
new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE}, new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE},
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
@ -408,7 +408,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
AddSkill(new Fissure(this, "Fissure", ClassType.Mage, SkillType.Axe, AddSkill(new Fissure(this, "Fissure", ClassType.Mage, SkillType.Axe,
1, 5, 1, 5,
60, -3, 60, -3,
11000, -1000, true, 13000, -1000, true,
new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE}, new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE},
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
@ -434,13 +434,12 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
AddSkill(new GlacialBlade(this, "Glacial Blade", ClassType.Mage, SkillType.PassiveB, AddSkill(new GlacialBlade(this, "Glacial Blade", ClassType.Mage, SkillType.PassiveB,
1, 3, 1, 3,
16, -2, 16, -2,
1200, -200, false, 1200, -250, false,
new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD}, new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD},
new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK})); new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK}));
AddSkill(new MagmaBlade(this, "Magma Blade", ClassType.Mage, SkillType.PassiveB, 1, 3)); 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 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() public void AddRanger()
@ -451,7 +450,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
AddSkill(new Disengage(this, "Disengage", ClassType.Ranger, SkillType.Sword, AddSkill(new Disengage(this, "Disengage", ClassType.Ranger, SkillType.Sword,
1, 4, 1, 4,
0, 0, 0, 0,
18000, -2000, true, 16000, -1000, true,
new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD}, new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD},
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
@ -480,12 +479,12 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
new Material[] {Material.BOW}, new Material[] {Material.BOW},
new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK})); new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK}));
AddSkill(new IncendiaryShot(this, "Incendiary Shot", ClassType.Ranger, SkillType.Bow, // AddSkill(new IncendiaryShot(this, "Incendiary Shot", ClassType.Ranger, SkillType.Bow,
1, 4, // 1, 4,
0, 0, // 0, 0,
20000, -2000, true, // 20000, -2000, true,
new Material[] {Material.BOW}, // new Material[] {Material.BOW},
new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK})); // new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK}));
AddSkill(new NapalmShot(this, "Napalm Shot", ClassType.Ranger, SkillType.Bow, AddSkill(new NapalmShot(this, "Napalm Shot", ClassType.Ranger, SkillType.Bow,
1, 4, 1, 4,
@ -523,9 +522,9 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
//Passive B //Passive B
AddSkill(new BarbedArrows(this, "Barbed Arrows", ClassType.Ranger, SkillType.PassiveB, 1, 3)); 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 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 Longshot(this, "Longshot", ClassType.Ranger, SkillType.PassiveB, 1, 3));
AddSkill(new Sharpshooter(this, "Sharpshooter", 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)); //AddSkill(new Fletcher(this, "Fletcher", ClassType.Ranger, SkillType.PassiveB, 5, 3));
} }

View File

@ -156,11 +156,11 @@ public abstract class ItemUsable extends Item implements IThrown
//Throw //Throw
long expire = -1; long expire = -1;
if (_throwExpire >= 0) if (_throwExpire >= 0)
expire = System.currentTimeMillis() + _throwExpire; expire = _throwExpire;
org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(GetType())); 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); 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); ThrowCustom(event, ent);
} }

View File

@ -69,13 +69,23 @@ public class ProximityExplosive extends ItemUsable
@Override @Override
public void Collide(LivingEntity target, Block block, ProjectileUser data) 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 @Override
public void Idle(ProjectileUser data) 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 @Override

View File

@ -66,13 +66,23 @@ public class ProximityZapper extends ItemUsable
@Override @Override
public void Collide(LivingEntity target, Block block, ProjectileUser data) 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 @Override
public void Idle(ProjectileUser data) 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 @Override

View File

@ -28,6 +28,7 @@ public class ClassCombatShop extends ShopBase<ClassShopManager>
private IPvpClass _gameClass; private IPvpClass _gameClass;
private boolean _takeAwayStuff; private boolean _takeAwayStuff;
private boolean _skillsOnly; private boolean _skillsOnly;
private boolean _hub;
public ClassCombatShop(ClassShopManager plugin, CoreClientManager clientManager, DonationManager donationManager, boolean skillsOnly, String name) public ClassCombatShop(ClassShopManager plugin, CoreClientManager clientManager, DonationManager donationManager, boolean skillsOnly, String name)
{ {
@ -36,12 +37,13 @@ public class ClassCombatShop extends ShopBase<ClassShopManager>
_skillsOnly = skillsOnly; _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); super(plugin, clientManager, donationManager, name, CurrencyType.Gems);
_gameClass = iPvpClass; _gameClass = iPvpClass;
_takeAwayStuff = true; _takeAwayStuff = true;
_skillsOnly = skillsOnly; _skillsOnly = skillsOnly;
_hub = hub;
} }
protected void openShopForPlayer(Player player) protected void openShopForPlayer(Player player)
@ -65,15 +67,22 @@ public class ClassCombatShop extends ShopBase<ClassShopManager>
ShopPageBase<ClassShopManager, ClassCombatShop> page = null; ShopPageBase<ClassShopManager, ClassCombatShop> page = null;
if (getPlugin().GetClassManager().Get(player).GetGameClass() == null) if (!_hub)
{ {
// page = new ArmorPage(_plugin, this, _clientManager, _donationManager, player); if (getPlugin().GetClassManager().Get(player).GetGameClass() == null)
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); // page = new ArmorPage(_plugin, this, _clientManager, _donationManager, player);
return false; 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);
else return false;
page = new CustomBuildPage(getPlugin(), this, getClientManager(), getDonationManager(), player); }
else
page = new CustomBuildPage(getPlugin(), this, getClientManager(), getDonationManager(), player);
}
else
{
page = new CustomBuildPage(getPlugin(), this, getClientManager(), getDonationManager(), player, _gameClass);
}
getOpenedShop().add(player.getName()); getOpenedShop().add(player.getName());
openShopForPlayer(player); openShopForPlayer(player);

View File

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

View File

@ -1,9 +1,10 @@
package mineplex.minecraft.game.classcombat.shop.page; package mineplex.minecraft.game.classcombat.shop.page;
import org.bukkit.ChatColor; import mineplex.core.account.CoreClientManager;
import org.bukkit.Material; import mineplex.core.common.util.C;
import org.bukkit.entity.Player; 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.ClientClass;
import mineplex.minecraft.game.classcombat.Class.IPvpClass; import mineplex.minecraft.game.classcombat.Class.IPvpClass;
import mineplex.minecraft.game.classcombat.Class.event.ClassSetupEvent; 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.DeleteCustomBuildButton;
import mineplex.minecraft.game.classcombat.shop.button.EditAndSaveCustomBuildButton; import mineplex.minecraft.game.classcombat.shop.button.EditAndSaveCustomBuildButton;
import mineplex.minecraft.game.classcombat.shop.button.SelectCustomBuildButton; import mineplex.minecraft.game.classcombat.shop.button.SelectCustomBuildButton;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C; import org.bukkit.ChatColor;
import mineplex.core.donation.DonationManager; import org.bukkit.Material;
import mineplex.core.shop.item.ShopItem; import org.bukkit.entity.Player;
import mineplex.core.shop.page.ShopPageBase;
public class CustomBuildPage extends ShopPageBase<ClassShopManager, ClassCombatShop> public class CustomBuildPage extends ShopPageBase<ClassShopManager, ClassCombatShop>
{ {
@ -32,6 +32,14 @@ public class CustomBuildPage extends ShopPageBase<ClassShopManager, ClassCombatS
buildPage(); 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 @Override
protected void buildPage() protected void buildPage()
{ {

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.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.visibility.VisibilityManager; import mineplex.core.visibility.VisibilityManager;
@ -254,6 +255,15 @@ public class ConditionEffect implements Listener
Condition condition = Manager.GetActiveCondition(ent, ConditionType.LIGHTNING); Condition condition = Manager.GetActiveCondition(ent, ConditionType.LIGHTNING);
if (condition == null) return; 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 //Damage
event.SetDamager(condition.GetSource()); event.SetDamager(condition.GetSource());
event.AddMod(UtilEnt.getName(condition.GetSource()), condition.GetReason(), 0, true); event.AddMod(UtilEnt.getName(condition.GetSource()), condition.GetReason(), 0, true);

View File

@ -187,8 +187,7 @@ public class DamageManager extends MiniPlugin
public void NewDamageEvent(LivingEntity damagee, LivingEntity damager, Projectile proj, Location knockbackOrigin, public void NewDamageEvent(LivingEntity damagee, LivingEntity damager, Projectile proj, Location knockbackOrigin,
DamageCause cause, double damage, boolean knockback, boolean ignoreRate, boolean ignoreArmor, DamageCause cause, double damage, boolean knockback, boolean ignoreRate, boolean ignoreArmor,
String source, String source, String reason)
String reason)
{ {
NewDamageEvent(damagee, damager, proj, knockbackOrigin, cause, damage, knockback, ignoreRate, ignoreArmor, source, NewDamageEvent(damagee, damager, proj, knockbackOrigin, cause, damage, knockback, ignoreRate, ignoreArmor, source,
reason, false); reason, false);

View File

@ -111,6 +111,9 @@ public class Fire extends MiniPlugin
if (!_fire.containsKey(fire)) if (!_fire.containsKey(fire))
return; return;
if (_fire.get(fire).GetOwner().equals(player))
return;
event.setCancelled(true); event.setCancelled(true);
if (((CraftPlayer)player).getHandle().spectating) if (((CraftPlayer)player).getHandle().spectating)

View File

@ -147,10 +147,10 @@ public class Arcade extends JavaPlugin
cosmeticManager.setInterfaceSlot(7); cosmeticManager.setInterfaceSlot(7);
cosmeticManager.disableTeamArmor(); cosmeticManager.disableTeamArmor();
new GlobalPacketManager(this, _clientManager, serverStatusManager);
GiveawayManager giveawayManager = new GiveawayManager(this, _clientManager, serverStatusManager); GiveawayManager giveawayManager = new GiveawayManager(this, _clientManager, serverStatusManager);
new GlobalPacketManager(this, _clientManager, serverStatusManager, inventoryManager, _donationManager, petManager, statsManager, giveawayManager);
//Arcade Manager //Arcade Manager
PollManager pollManager = new PollManager(this, _clientManager, _donationManager); PollManager pollManager = new PollManager(this, _clientManager, _donationManager);
_gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, statsManager, achievementManager, disguiseManager, creature, teleport, new Blood(this), chat, portal, preferenceManager, inventoryManager, packetHandler, cosmeticManager, projectileManager, petManager, hologramManager, webServerAddress, pollManager, npcmanager, giveawayManager); _gameManager = new ArcadeManager(this, serverStatusManager, ReadServerConfig(), _clientManager, _donationManager, _damageManager, statsManager, achievementManager, disguiseManager, creature, teleport, new Blood(this), chat, portal, preferenceManager, inventoryManager, packetHandler, cosmeticManager, projectileManager, petManager, hologramManager, webServerAddress, pollManager, npcmanager, giveawayManager);

View File

@ -236,7 +236,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation
_explosionManager.SetDebris(false); _explosionManager.SetDebris(false);
if (serverConfig.GameList.contains(GameType.ChampionsDominate) if (serverConfig.GameList.contains(GameType.ChampionsDominate)
|| serverConfig.GameList.contains(GameType.ChampionsTDM)) || serverConfig.GameList.contains(GameType.ChampionsTDM)
|| serverConfig.GameList.contains(GameType.ChampionsCTF))
{ {
_conditionManager = new SkillConditionManager(plugin); _conditionManager = new SkillConditionManager(plugin);
} }
@ -318,7 +319,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
_conditionManager, _projectileManager, _disguiseManager, _blockRestore, _fire, new Movement(plugin), teleport, _conditionManager, _projectileManager, _disguiseManager, _blockRestore, _fire, new Movement(plugin), teleport,
_energy, webAddress); _energy, webAddress);
_classManager = new ClassManager(plugin, clientManager, donationManager, _skillFactory, _itemFactory, _classManager = new ClassManager(plugin, clientManager, donationManager, _cosmeticManager.getGadgetManager(), _skillFactory, _itemFactory,
webAddress); webAddress);
_classShopManager = new ClassShopManager(_plugin, _classManager, _skillFactory, _itemFactory, _achievementManager, clientManager); _classShopManager = new ClassShopManager(_plugin, _classManager, _skillFactory, _itemFactory, _achievementManager, clientManager);
@ -1334,7 +1335,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
public void toggleChampionsModules(GameType gameType) public void toggleChampionsModules(GameType gameType)
{ {
boolean isChamps = gameType == GameType.ChampionsDominate || gameType == GameType.ChampionsTDM; boolean isChamps = gameType == GameType.ChampionsDominate || gameType == GameType.ChampionsTDM || gameType == GameType.ChampionsCTF;
if (_enabled == isChamps) if (_enabled == isChamps)
{ {
@ -1495,7 +1496,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
for (Player player : Bukkit.getOnlinePlayers()) for (Player player : Bukkit.getOnlinePlayers())
{ {
player.setResourcePack("http://www.chivebox.com/file/c/empty.zip"); player.setResourcePack("http://file.mineplex.com/ResReset.zip");
} }
} }
else else

View File

@ -11,6 +11,7 @@ import nautilus.game.arcade.game.games.bridge.Bridge;
import nautilus.game.arcade.game.games.build.Build; import nautilus.game.arcade.game.games.build.Build;
import nautilus.game.arcade.game.games.cards.Cards; import nautilus.game.arcade.game.games.cards.Cards;
import nautilus.game.arcade.game.games.castlesiege.CastleSiege; import nautilus.game.arcade.game.games.castlesiege.CastleSiege;
import nautilus.game.arcade.game.games.champions.ChampionsCTF;
import nautilus.game.arcade.game.games.champions.ChampionsDominate; import nautilus.game.arcade.game.games.champions.ChampionsDominate;
import nautilus.game.arcade.game.games.champions.ChampionsTDM; import nautilus.game.arcade.game.games.champions.ChampionsTDM;
import nautilus.game.arcade.game.games.christmas.Christmas; import nautilus.game.arcade.game.games.christmas.Christmas;
@ -70,10 +71,11 @@ public enum GameType
Barbarians(Barbarians.class, GameDisplay.Barbarians), Barbarians(Barbarians.class, GameDisplay.Barbarians),
Bridge(Bridge.class, GameDisplay.Bridge), Bridge(Bridge.class, GameDisplay.Bridge),
CastleSiege(CastleSiege.class, GameDisplay.CastleSiege), CastleSiege(CastleSiege.class, GameDisplay.CastleSiege),
ChampionsCTF(ChampionsCTF.class, GameDisplay.ChampionsCTF),
ChampionsDominate(ChampionsDominate.class, GameDisplay.ChampionsDominate), ChampionsDominate(ChampionsDominate.class, GameDisplay.ChampionsDominate),
//ChampionsMOBA(ChampionsMOBA.class, "Champions MOBA", "Champions", Material.SKULL_ITEM, (byte)0, GameCategory.CHAMPIONS, 7), //ChampionsMOBA(ChampionsMOBA.class, "Champions MOBA", "Champions", Material.SKULL_ITEM, (byte)0, GameCategory.CHAMPIONS, 7),
ChampionsTDM(ChampionsTDM.class, GameDisplay.ChampionsTDM), ChampionsTDM(ChampionsTDM.class, GameDisplay.ChampionsTDM),
Christmas(Christmas.class, GameDisplay.Christmas, "http://chivebox.com/file/c/xmas.zip", true), Christmas(Christmas.class, GameDisplay.Christmas, "http://file.mineplex.com/ResChristmas.zip", true),
DeathTag(DeathTag.class, GameDisplay.DeathTag), DeathTag(DeathTag.class, GameDisplay.DeathTag),
DragonEscape(DragonEscape.class, GameDisplay.DragonEscape), DragonEscape(DragonEscape.class, GameDisplay.DragonEscape),
DragonEscapeTeams(DragonEscapeTeams.class, GameDisplay.DragonEscapeTeams), DragonEscapeTeams(DragonEscapeTeams.class, GameDisplay.DragonEscapeTeams),
@ -84,14 +86,14 @@ public enum GameType
Evolution(Evolution.class, GameDisplay.Evolution), Evolution(Evolution.class, GameDisplay.Evolution),
//FlappyBird(FlappyBird.class, "Flappy Bird", Material.FEATHER, (byte)0, GameCategory.ARCADE, 17), //FlappyBird(FlappyBird.class, "Flappy Bird", Material.FEATHER, (byte)0, GameCategory.ARCADE, 17),
Gravity(Gravity.class, GameDisplay.Gravity), Gravity(Gravity.class, GameDisplay.Gravity),
Halloween(Halloween.class, GameDisplay.Halloween, "http://chivebox.com/file/c/hh.zip", true), Halloween(Halloween.class, GameDisplay.Halloween, "http://file.mineplex.com/ResHalloween.zip", true),
HideSeek(HideSeek.class, GameDisplay.HideSeek), HideSeek(HideSeek.class, GameDisplay.HideSeek),
HoleInTheWall(HoleInTheWall.class, GameDisplay.HoleInTheWall), HoleInTheWall(HoleInTheWall.class, GameDisplay.HoleInTheWall),
Horse(Horse.class, GameDisplay.Horse), Horse(Horse.class, GameDisplay.Horse),
Lobbers(BombLobbers.class, GameDisplay.Lobbers), Lobbers(BombLobbers.class, GameDisplay.Lobbers),
Micro(Micro.class, GameDisplay.Micro), Micro(Micro.class, GameDisplay.Micro),
MilkCow(MilkCow.class, GameDisplay.MilkCow), MilkCow(MilkCow.class, GameDisplay.MilkCow),
MineStrike(MineStrike.class, GameDisplay.MineStrike, "http://chivebox.com/file/c/assets.zip", true),// Temp set to CHAMPIONS to fix UI bug MineStrike(MineStrike.class, GameDisplay.MineStrike, "http://file.mineplex.com/ResMinestrike.zip", true),// Temp set to CHAMPIONS to fix UI bug
MineWare(MineWare.class, GameDisplay.MineWare), MineWare(MineWare.class, GameDisplay.MineWare),
OldMineWare(OldMineWare.class, GameDisplay.OldMineWare), OldMineWare(OldMineWare.class, GameDisplay.OldMineWare),
Paintball(Paintball.class, GameDisplay.Paintball), Paintball(Paintball.class, GameDisplay.Paintball),
@ -117,7 +119,7 @@ public enum GameType
TurfWars(TurfForts.class, GameDisplay.TurfWars), TurfWars(TurfForts.class, GameDisplay.TurfWars),
UHC(UHC.class, GameDisplay.UHC), UHC(UHC.class, GameDisplay.UHC),
WitherAssault(WitherGame.class, GameDisplay.WitherAssault), WitherAssault(WitherGame.class, GameDisplay.WitherAssault),
Wizards(Wizards.class, GameDisplay.Wizards, "http://chivebox.com/file/c/ResWizards.zip", true), Wizards(Wizards.class, GameDisplay.Wizards, "http://file.mineplex.com/ResWizards.zip", true),
ZombieSurvival(ZombieSurvival.class, GameDisplay.ZombieSurvival), ZombieSurvival(ZombieSurvival.class, GameDisplay.ZombieSurvival),
Build(Build.class, GameDisplay.Build), Build(Build.class, GameDisplay.Build),
Cards(Cards.class, GameDisplay.Cards), Cards(Cards.class, GameDisplay.Cards),

View File

@ -28,9 +28,9 @@ public class TeamArmorAddon extends MiniPlugin
@EventHandler @EventHandler
public void GiveArmor(PlayerKitGiveEvent event) public void GiveArmor(PlayerKitGiveEvent event)
{ {
Player player = event.GetPlayer(); Player player = event.getPlayer();
if (event.GetGame().TeamArmor) if (event.getGame().TeamArmor)
{ {
ItemStack helm = new ItemStack(Material.LEATHER_HELMET); ItemStack helm = new ItemStack(Material.LEATHER_HELMET);
LeatherArmorMeta metaHelm = (LeatherArmorMeta)helm.getItemMeta(); LeatherArmorMeta metaHelm = (LeatherArmorMeta)helm.getItemMeta();
@ -57,7 +57,7 @@ public class TeamArmorAddon extends MiniPlugin
player.getInventory().setBoots(boots); player.getInventory().setBoots(boots);
} }
if (event.GetGame().TeamArmorHotbar && event.GetGame().InProgress()) if (event.getGame().TeamArmorHotbar && event.getGame().InProgress())
{ {
ItemStack armor = new ItemStack(Material.LEATHER_CHESTPLATE); ItemStack armor = new ItemStack(Material.LEATHER_CHESTPLATE);
LeatherArmorMeta meta = (LeatherArmorMeta)armor.getItemMeta(); LeatherArmorMeta meta = (LeatherArmorMeta)armor.getItemMeta();

View File

@ -0,0 +1,73 @@
package nautilus.game.arcade.events;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.kit.Kit;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class PlayerKitApplyEvent extends Event implements Cancellable
{
private static final HandlerList handlers = new HandlerList();
private Game _game;
private Kit _kit;
private Player _player;
private boolean _cancelled = false;
private String _cancelMessage = "";
public PlayerKitApplyEvent(Game game, Kit kit, Player player)
{
_game = game;
_kit = kit;
_player = player;
}
public HandlerList getHandlers()
{
return handlers;
}
public static HandlerList getHandlerList()
{
return handlers;
}
public Game getGame()
{
return _game;
}
public Kit getKit()
{
return _kit;
}
public Player getPlayer()
{
return _player;
}
public String getCancelMessage()
{
return _cancelMessage;
}
public void setCancelMessage(String message)
{
_cancelMessage = message;
}
@Override
public boolean isCancelled()
{
return _cancelled;
}
@Override
public void setCancelled(boolean cancelled)
{
_cancelled = cancelled;
}
}

View File

@ -32,17 +32,17 @@ public class PlayerKitGiveEvent extends Event
return handlers; return handlers;
} }
public Game GetGame() public Game getGame()
{ {
return _game; return _game;
} }
public Kit GetKit() public Kit getKit()
{ {
return _kit; return _kit;
} }
public Player GetPlayer() public Player getPlayer()
{ {
return _player; return _player;
} }

View File

@ -0,0 +1,143 @@
package nautilus.game.arcade.game.games.champions;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.DeathMessageType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.champions.kits.KitAssassin;
import nautilus.game.arcade.game.games.champions.kits.KitBrute;
import nautilus.game.arcade.game.games.champions.kits.KitKnight;
import nautilus.game.arcade.game.games.champions.kits.KitMage;
import nautilus.game.arcade.game.games.champions.kits.KitRanger;
import nautilus.game.arcade.game.games.common.CaptureTheFlag;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.CapturesStatTracker;
import nautilus.game.arcade.stats.ClutchStatTracker;
import nautilus.game.arcade.stats.ElectrocutionStatTracker;
import nautilus.game.arcade.stats.KillReasonStatTracker;
import nautilus.game.arcade.stats.SeismicSlamStatTracker;
import nautilus.game.arcade.stats.TheLongestShotStatTracker;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.inventory.InventoryType;
public class ChampionsCTF extends CaptureTheFlag
{
public ChampionsCTF(ArcadeManager manager)
{
super(manager, GameType.ChampionsCTF,
new Kit[]
{
new KitBrute(manager),
new KitRanger(manager),
new KitKnight(manager),
new KitMage(manager),
new KitAssassin(manager),
});
_help = new String[]
{
"Make sure you use all of your Skill/Item Tokens",
"Collect Resupply Chests to restock your inventory",
"Customize your Class to suit your play style",
"Gold Sword boosts Sword Skill by 1 Level",
"Gold Axe boosts Axe Skill by 1 Level",
"Gold/Iron Weapons deal 6 damage",
"Diamond Weapons deal 7 damage",
};
Manager.GetDamage().UseSimpleWeaponDamage = false;
Manager.getCosmeticManager().setHideParticles(true);
this.StrictAntiHack = true;
InventoryOpenChest = true;
EloRanking = false;
EloStart = 1000;
this.DontAllowOverfill = true;
this.DisableKillCommand = false;
registerStatTrackers(
new KillReasonStatTracker(this, "Backstab", "Assassination", false),
new ElectrocutionStatTracker(this),
new TheLongestShotStatTracker(this),
new SeismicSlamStatTracker(this),
new CapturesStatTracker(this, "Captures"),
new ClutchStatTracker(this, "Clutch")
);
new ChampsFixer(this);
}
@Override
public void ValidateKit(Player player, GameTeam team)
{
//Set to Default Knight
if (GetKit(player) == null)
{
SetKit(player, GetKits()[2], true);
player.closeInventory();
}
}
@Override
public DeathMessageType GetDeathMessageType()
{
return DeathMessageType.Detailed;
}
@EventHandler
public void WaterArrowCancel(EntityShootBowEvent event)
{
if (event.getEntity().getLocation().getBlock().isLiquid())
{
UtilPlayer.message(event.getEntity(), F.main("Game", "You cannot use your Bow while swimming."));
event.setCancelled(true);
}
}
@EventHandler(priority = EventPriority.HIGHEST)
public void InventoryDamageCancel(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
Player player = event.GetDamageePlayer();
if (player == null)
return;
if (!IsAlive(player))
return;
if (player.getOpenInventory() == null || player.getOpenInventory().getTopInventory() == null)
return;
if (player.getOpenInventory().getTopInventory().getType() == InventoryType.CHEST)
player.closeInventory();
}
@EventHandler
public void validateSkills(UpdateEvent event)
{
if (event.getType() == UpdateType.SEC)
{
for (Player player : GetPlayers(true))
{
Manager.getClassManager().Get(player).validateClassSkills(player);
}
}
}
}

View File

@ -16,8 +16,8 @@ import nautilus.game.arcade.game.games.champions.kits.KitMage;
import nautilus.game.arcade.game.games.champions.kits.KitRanger; import nautilus.game.arcade.game.games.champions.kits.KitRanger;
import nautilus.game.arcade.game.games.common.Domination; import nautilus.game.arcade.game.games.common.Domination;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.KillReasonStatTracker;
import nautilus.game.arcade.stats.ElectrocutionStatTracker; import nautilus.game.arcade.stats.ElectrocutionStatTracker;
import nautilus.game.arcade.stats.KillReasonStatTracker;
import nautilus.game.arcade.stats.SeismicSlamStatTracker; import nautilus.game.arcade.stats.SeismicSlamStatTracker;
import nautilus.game.arcade.stats.TheLongestShotStatTracker; import nautilus.game.arcade.stats.TheLongestShotStatTracker;
@ -76,6 +76,8 @@ public class ChampionsDominate extends Domination
new TheLongestShotStatTracker(this), new TheLongestShotStatTracker(this),
new SeismicSlamStatTracker(this) new SeismicSlamStatTracker(this)
); );
new ChampsFixer(this);
} }
@Override @Override

View File

@ -1,11 +1,5 @@
package nautilus.game.arcade.game.games.champions; package nautilus.game.arcade.game.games.champions;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.inventory.InventoryType;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
@ -22,13 +16,19 @@ import nautilus.game.arcade.game.games.champions.kits.KitMage;
import nautilus.game.arcade.game.games.champions.kits.KitRanger; import nautilus.game.arcade.game.games.champions.kits.KitRanger;
import nautilus.game.arcade.game.games.common.TeamDeathmatch; import nautilus.game.arcade.game.games.common.TeamDeathmatch;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.stats.KillReasonStatTracker;
import nautilus.game.arcade.stats.ElectrocutionStatTracker; import nautilus.game.arcade.stats.ElectrocutionStatTracker;
import nautilus.game.arcade.stats.KillAllOpposingStatTracker; import nautilus.game.arcade.stats.KillAllOpposingStatTracker;
import nautilus.game.arcade.stats.KillReasonStatTracker;
import nautilus.game.arcade.stats.SeismicSlamStatTracker; import nautilus.game.arcade.stats.SeismicSlamStatTracker;
import nautilus.game.arcade.stats.TheLongestShotStatTracker; import nautilus.game.arcade.stats.TheLongestShotStatTracker;
import nautilus.game.arcade.stats.WinWithoutLosingTeammateStatTracker; import nautilus.game.arcade.stats.WinWithoutLosingTeammateStatTracker;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.inventory.InventoryType;
public class ChampionsTDM extends TeamDeathmatch public class ChampionsTDM extends TeamDeathmatch
{ {
public ChampionsTDM(ArcadeManager manager) public ChampionsTDM(ArcadeManager manager)
@ -76,6 +76,8 @@ public class ChampionsTDM extends TeamDeathmatch
new TheLongestShotStatTracker(this), new TheLongestShotStatTracker(this),
new SeismicSlamStatTracker(this) new SeismicSlamStatTracker(this)
); );
new ChampsFixer(this);
} }
@Override @Override

View File

@ -0,0 +1,101 @@
package nautilus.game.arcade.game.games.champions;
import mineplex.core.common.util.UtilServer;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.classcombat.Skill.Skill;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerKitApplyEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.Game.GameState;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryType;
public class ChampsFixer implements Listener
{
private Game _host;
public ChampsFixer(Game game)
{
_host = game;
Bukkit.getPluginManager().registerEvents(this, _host.getArcadeManager().getPlugin());
}
@EventHandler
public void disable(GameStateChangeEvent event)
{
if (event.GetGame() != _host)
return;
if (event.GetState() == GameState.Dead)
HandlerList.unregisterAll(this);
}
@EventHandler(priority = EventPriority.HIGHEST)
public void fixDwarf(PlayerKitApplyEvent event)
{
if (!_host.IsLive())
return;
if (event.isCancelled())
return;
if (event.getPlayer().getPassenger() == null)
return;
event.setCancelled(true);
event.setCancelMessage("You cannot change kits while holding someone in Dwarf Toss!");
}
@EventHandler(priority = EventPriority.HIGHEST)
public void fixBlizzard(PlayerKitApplyEvent event)
{
if (!_host.IsLive())
return;
if (event.isCancelled())
return;
_host.getArcadeManager().getClassManager().GetSkillFactory().GetSkill("Blizzard").Reset(event.getPlayer());
}
@EventHandler
public void onUpdate(UpdateEvent event)
{
if (!_host.IsLive())
return;
for (Player player : UtilServer.getPlayers())
{
if (player.getOpenInventory() == null || player.getOpenInventory().getTopInventory() == null)
continue;
if (player.getOpenInventory().getTopInventory().getType() == InventoryType.CHEST)
for (Skill skill : _host.getArcadeManager().getClassManager().GetSkillFactory().GetAllSkills())
skill.Reset(player);
}
}
@EventHandler
public void fixAxe(BlockDamageEvent event)
{
if (!_host.IsLive())
return;
event.setCancelled(true);
}
@EventHandler
public void fixArmor(InventoryClickEvent event)
{
event.setCancelled(true);
}
}

View File

@ -0,0 +1,845 @@
package nautilus.game.arcade.game.games.common;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.RadarData;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilRadar;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTime;
import mineplex.core.elo.EloPlayer;
import mineplex.core.elo.EloTeam;
import mineplex.core.elo.GameResult;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.CombatComponent;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerGameRespawnEvent;
import nautilus.game.arcade.events.PlayerKitApplyEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.games.champions.ChampionsCTF;
import nautilus.game.arcade.game.games.common.ctf_data.CarrierCombatDeathEvent;
import nautilus.game.arcade.game.games.common.ctf_data.Flag;
import nautilus.game.arcade.game.games.common.dominate_data.PlayerData;
import nautilus.game.arcade.game.games.common.dominate_data.Resupply;
import nautilus.game.arcade.kit.Kit;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.BlockPhysicsEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.ItemDespawnEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffectType;
public class CaptureTheFlag extends TeamGame
{
//Map Data
private Location _redFlag;
private Location _blueFlag;
private ArrayList<Flag> _flags = new ArrayList<Flag>();
private ArrayList<Resupply> _resupply = new ArrayList<Resupply>();
//Stats
private HashMap<String, PlayerData> _stats = new HashMap<String, PlayerData>();
//Captures
private static int _victoryCaps = 5;
private int _redScore = 0;
private int _blueScore = 0;
//Times
private long _gameTime = 420000;
//protected String[] _blockedItems = new String[] {"SWORD", "AXE", "BOW"};
private boolean _suddenDeath = false;
private HashMap<Player, List<ItemStack>> _hotbars = new HashMap<Player, List<ItemStack>>();
private HashMap<Player, ItemStack> _helmets = new HashMap<Player, ItemStack>();
private boolean _redFlickerStage = false;
private boolean _blueFlickerStage = false;
public CaptureTheFlag(ArcadeManager manager, GameType type, Kit[] kits)
{
super(manager, type, kits,
new String[]
{
"Capture The Opponent's Flag",
"First team to " + _victoryCaps + " Captures",
"Or with the most Captures after 7 minutes wins"
});
this.DeathOut = false;
this.PrepareFreeze = true;
this.HungerSet = 20;
this.WorldTimeSet = 2000;
this.DeathSpectateSecs = 10;
}
@Override
public void ParseData()
{
_redFlag = WorldData.GetDataLocs("RED").get(0);
_blueFlag = WorldData.GetDataLocs("BLUE").get(0);
for (GameTeam team : GetTeamList())
{
if (team.GetColor() == ChatColor.RED || team.GetColor() == ChatColor.BLUE || team.GetColor() == ChatColor.AQUA)
{
_flags.add(new Flag(this, team.GetColor() == ChatColor.RED ? _redFlag : _blueFlag, team));
}
}
for (Location loc : WorldData.GetDataLocs("YELLOW"))
{
_resupply.add(new Resupply(this, loc));
}
//Kit spawning
if (this instanceof ChampionsCTF)
{
CreatureAllowOverride = true;
for (int i = 0; i < GetKits().length && i < WorldData.GetDataLocs("LIGHT_BLUE").size() && i < WorldData.GetDataLocs("PINK").size(); i++)
{
Entity ent = GetKits()[i].SpawnEntity(WorldData.GetDataLocs("PINK").get(i));
Manager.GetLobby().AddKitLocation(ent, GetKits()[i], WorldData.GetDataLocs("PINK").get(i));
ent = GetKits()[i].SpawnEntity(WorldData.GetDataLocs("LIGHT_BLUE").get(i));
Manager.GetLobby().AddKitLocation(ent, GetKits()[i], WorldData.GetDataLocs("LIGHT_BLUE").get(i));
}
CreatureAllowOverride = false;
}
//End kit spawning
}
@EventHandler
public void customTeamGeneration(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Recruit)
return;
for (GameTeam team : GetTeamList())
if (team.GetColor() == ChatColor.AQUA)
team.SetColor(ChatColor.BLUE);
}
@EventHandler(priority = EventPriority.HIGHEST)
public void blockLiquidFlow(BlockPhysicsEvent event)
{
Material matOfBlock = event.getBlock().getType();
if (matOfBlock == Material.STATIONARY_WATER || matOfBlock == Material.SAND || matOfBlock == Material.GRAVEL || matOfBlock == Material.STATIONARY_LAVA)
{
event.setCancelled(true);
}
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onTNTExplode(EntityExplodeEvent event)
{
if (!IsLive())
return;
if (event.getEntityType() == EntityType.PRIMED_TNT)
{
event.setCancelled(true);
}
}
@EventHandler
public void updates(UpdateEvent event)
{
if (!IsLive())
return;
if (event.getType() == UpdateType.FASTEST)
{
for (Flag flag : _flags)
flag.update();
Iterator<Player> hotbarIter = _hotbars.keySet().iterator();
while (hotbarIter.hasNext())
{
Player player = hotbarIter.next();
if (!player.isOnline() || UtilPlayer.isSpectator(player) || !IsAlive(player))
hotbarIter.remove();
}
Iterator<Player> helmetIter = _helmets.keySet().iterator();
while (helmetIter.hasNext())
{
Player player = helmetIter.next();
if (!player.isOnline() || UtilPlayer.isSpectator(player) || !IsAlive(player))
helmetIter.remove();
}
}
else if (event.getType() == UpdateType.TICK)
{
for (Flag flag : _flags)
{
if (flag.getCarrier() == null)
for (Player player : GetPlayers(true))
if (UtilMath.offset2d(player.getLocation(), flag.getPlacedLocation()) < .5 && player.getLocation().getY() > flag.getPlacedLocation().getY() - 2 && player.getLocation().getY() < flag.getPlacedLocation().getY() + 3)
flag.pickup(player);
}
}
else if (event.getType() == UpdateType.FAST)
{
for (Resupply resupply : _resupply)
resupply.Update();
getFlag(true).handleBottomInfo(_redFlickerStage, ChatColor.RED);
getFlag(false).handleBottomInfo(_blueFlickerStage, ChatColor.AQUA);
}
else if (event.getType() == UpdateType.SEC)
for (Flag flag : _flags)
flag.handleRespawn();
else
progressTime();
}
public void progressTime()
{
if (_suddenDeath) return;
long remain = _gameTime - (System.currentTimeMillis() - GetStateTime());
if (remain <= 0)
{
if (_redScore > _blueScore)
endCheckScore(_redScore);
else if(_redScore < _blueScore)
endCheckScore(_blueScore);
else
{
_suddenDeath = true;
this.DeathOut = true;
UtilTextMiddle.display(C.cYellow + "Sudden Death", "Next Capture Wins! No Respawns!");
return;
}
}
}
public void addCapture(GameTeam team)
{
if (_suddenDeath)
{
if (team.GetColor() == ChatColor.RED)
{
_redScore = _redScore + 1;
endCheckScore(_redScore);
}
else
{
_blueScore = _blueScore + 1;
endCheckScore(_blueScore);
}
}
else
{
if (team.GetColor() == ChatColor.RED)
{
_redScore = Math.min(_victoryCaps, _redScore + 1);
}
else
{
_blueScore = Math.min(_victoryCaps, _blueScore + 1);
}
endCheckScore(_victoryCaps);
}
}
public void saveInventory(Player player)
{
List<ItemStack> items = new ArrayList<ItemStack>();
for (int i = 0; i < 9; i++)
{
if (player.getInventory().getItem(i) != null)
items.add(i, player.getInventory().getItem(i));
else
items.add(i, new ItemStack(Material.AIR));
}
_hotbars.put(player, items);
_helmets.put(player, player.getInventory().getHelmet());
}
public void resetInventory(Player player)
{
if (_hotbars.containsKey(player))
{
List<ItemStack> items = _hotbars.get(player);
for (int i = 0; i < items.size(); i++)
{
if (items.get(i).getType() != Material.AIR)
player.getInventory().setItem(i, items.get(i));
else
player.getInventory().setItem(i, new ItemStack(Material.AIR));
}
getArcadeManager().getClassManager().hideNextEquipMessage(player.getName());
player.getInventory().setHelmet(_helmets.get(player));
//getArcadeManager().getClassManager().toggleMessage(player.getName(), false);
player.updateInventory();
player.removePotionEffect(PotionEffectType.SLOW);
_hotbars.remove(player);
_helmets.remove(player);
}
}
public boolean isAtHome(ChatColor team)
{
for (Flag flag : _flags)
{
if (flag.getTeam().GetColor() == team)
return flag.isAtHome();
}
return false;
}
public Location getRedFlag()
{
return _redFlag;
}
public Location getBlueFlag()
{
return _blueFlag;
}
public boolean isInZone(Location location, boolean red)
{
if (red)
{
if (UtilMath.offset(location, _redFlag) < 4)
return true;
}
else
{
if (UtilMath.offset(location, _blueFlag) < 4)
return true;
}
return false;
}
public boolean isSuddenDeath()
{
return _suddenDeath;
}
private boolean isEnemyCarrier(Player check, Player stat)
{
if (GetTeam(check).GetColor() == GetTeam(stat).GetColor()) return false;
for (Flag f : _flags)
{
if (f.getCarrier() == null) continue;
if (f.getCarrier().getName().equalsIgnoreCase(check.getName())) return true;
}
return false;
}
private String getVisualResult(ChatColor base)
{
String newc = base.toString();
if (base == ChatColor.BLUE)
newc = C.cDBlue;
if (base == ChatColor.RED)
newc = C.cDRed;
return newc;
}
private Flag getFlag(boolean red)
{
if (red)
{
for (Flag f : _flags)
if (f.getTeam().GetColor() == ChatColor.RED)
return f;
}
else
{
for (Flag f : _flags)
if (f.getTeam().GetColor() == ChatColor.BLUE)
return f;
}
return null;
}
@Override
@EventHandler
public void ScoreboardUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
scoreboardWrite();
}
private void scoreboardWrite()
{
if (!InProgress())
return;
//Wipe Last
Scoreboard.Reset();
//Scores
Scoreboard.WriteBlank();
Scoreboard.Write(C.cRedB + "Red Team");
Scoreboard.Write(_redScore + " Captures");
String redMessage = "Flag Dropped";
if (getFlag(true).isAtHome())
{
redMessage = "Flag Safe";
_redFlickerStage = false;
}
if (getFlag(true).getCarrier() != null)
redMessage = "Flag Taken";
if (_redFlickerStage)
{
Scoreboard.Write(C.cRed + redMessage);
_redFlickerStage = false;
}
else
{
Scoreboard.Write(redMessage);
_redFlickerStage = true;
}
//Flag in play stuff
Scoreboard.WriteBlank();
Scoreboard.Write(C.cAquaB + "Blue Team");
Scoreboard.Write(_blueScore + " Captures");
String blueMessage = "Flag Dropped";
if (getFlag(false).isAtHome())
{
blueMessage = "Flag Safe";
_blueFlickerStage = false;
}
if (getFlag(false).getCarrier() != null)
blueMessage = "Flag Taken";
if (_blueFlickerStage)
{
Scoreboard.Write(C.cAqua + blueMessage);
_blueFlickerStage = false;
}
else
{
Scoreboard.Write(blueMessage);
_blueFlickerStage = true;
}
//Flag in play stuff
Scoreboard.WriteBlank();
Scoreboard.Write(C.cYellowB + "Score to Win");
Scoreboard.Write(_victoryCaps + " Captures");
Scoreboard.WriteBlank();
if (_suddenDeath)
{
Scoreboard.Write(C.cYellowB + "Sudden Death");
Scoreboard.Write("Next Cap Wins");
Scoreboard.Write("No Respawns");
}
else
{
Scoreboard.Write(C.cYellowB + "Time Left");
Scoreboard.Write(UtilTime.MakeStr(Math.max(_gameTime - (System.currentTimeMillis() - GetStateTime()), 0)) + C.cWhite);
}
Scoreboard.Draw();
}
public void endCheckScore(int needed)
{
if (!IsLive())
return;
GameTeam winner = null;
if (_redScore >= needed)
winner = GetTeam(ChatColor.RED);
else if (_blueScore >= needed)
winner = GetTeam(ChatColor.BLUE);
if (winner == null)
return;
scoreboardWrite();
//Announce
AnnounceEnd(winner);
for (GameTeam team : GetTeamList())
{
if (WinnerTeam != null && team.equals(WinnerTeam))
{
for (Player player : team.GetPlayers(false))
AddGems(player, 10, "Winning Team", false, false);
}
for (Player player : team.GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false, false);
}
if (EloRanking)
{
EloTeam teamWinner = new EloTeam();
EloTeam teamLoser = new EloTeam();
for (GameTeam team : GetTeamList())
{
if (WinnerTeam != null && team.equals(WinnerTeam))
{
for (Player player : WinnerTeam.GetPlayers(false))
{
EloPlayer eloPlayer = new EloPlayer();
eloPlayer.UniqueId = player.getUniqueId().toString();
eloPlayer.Rating = Manager.getEloManager().getElo(player.getUniqueId(), GetName());
teamWinner.addPlayer(eloPlayer);
}
}
else
{
for (Player player : team.GetPlayers(false))
{
EloPlayer eloPlayer = new EloPlayer();
eloPlayer.UniqueId = player.getUniqueId().toString();
eloPlayer.Rating = Manager.getEloManager().getElo(player.getUniqueId(), GetName());
teamLoser.addPlayer(eloPlayer);
}
}
}
for (EloPlayer eloPlayer : Manager.getEloManager().getNewRatings(teamWinner, teamLoser, GameResult.Win).getPlayers())
{
Manager.getEloManager().saveElo(eloPlayer.UniqueId, GetName(), eloPlayer.Rating);
}
for (EloPlayer eloPlayer : Manager.getEloManager().getNewRatings(teamLoser, teamWinner, GameResult.Loss).getPlayers())
{
Manager.getEloManager().saveElo(eloPlayer.UniqueId, GetName(), eloPlayer.Rating);
}
}
//End
SetState(GameState.End);
}
@Override
public double GetKillsGems(Player killer, Player killed, boolean assist)
{
if (assist)
return .5;
if (_suddenDeath)
return 2;
return 1;
}
@Override
public String GetMode()
{
return "Capture the Flag";
}
@EventHandler
public void respawnRegen(PlayerGameRespawnEvent event)
{
Manager.GetCondition().Factory().Regen("Respawn", event.GetPlayer(), event.GetPlayer(), 8, 3, false, false, false);
Manager.GetCondition().Factory().Protection("Respawn", event.GetPlayer(), event.GetPlayer(), 8, 3, false, false, false);
}
public PlayerData getStats(Player player)
{
if (!_stats.containsKey(player.getName()))
_stats.put(player.getName(), new PlayerData(player.getName()));
return _stats.get(player.getName());
}
@EventHandler
public void statsKillAssistDeath(CombatDeathEvent event)
{
Game game = Manager.GetGame();
if (game == null) return;
if (!(event.GetEvent().getEntity() instanceof Player))
return;
Player killed = (Player)event.GetEvent().getEntity();
getStats(killed).Deaths++;
if (event.GetLog().GetKiller() != null)
{
Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
if (killer != null && !killer.equals(killed))
getStats(killer).Kills++;
}
for (CombatComponent log : event.GetLog().GetAttackers())
{
if (event.GetLog().GetKiller() != null && log.equals(event.GetLog().GetKiller()))
continue;
Player assist = UtilPlayer.searchExact(log.GetName());
//Assist
if (assist != null)
getStats(assist).Assists++;
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void statsKillAssistDeath(CustomDamageEvent event)
{
Player damager = event.GetDamagerPlayer(true);
if (damager != null)
{
getStats(damager).DamageDealt += event.GetDamage();
}
Player damagee = event.GetDamageePlayer();
if (damagee != null)
{
getStats(damagee).DamageTaken += event.GetDamage();
}
}
@EventHandler(priority = EventPriority.HIGHEST)
public void usableInteract(PlayerInteractEvent event)
{
if (UtilBlock.usable(event.getClickedBlock()))
event.setCancelled(true);
}
@EventHandler
public void selectKit(PlayerKitApplyEvent event)
{
if (this instanceof ChampionsCTF)
{
for (Flag flag : _flags)
if (!flag.isAtHome())
if (flag.getCarrier() != null)
if (flag.getCarrier().getName().equals(event.getPlayer().getName()))
{
event.setCancelled(true);
event.setCancelMessage("You cannot change kits while holding a flag!");
}
if (_suddenDeath)
{
event.setCancelled(true);
event.setCancelMessage("You cannot change kits during Sudden Death!");
}
}
}
@EventHandler
public void dropFlag(PlayerDropItemEvent event)
{
for (Flag flag : _flags)
if ((flag.getRepresentation().getType() == event.getItemDrop().getItemStack().getType()) || (event.getItemDrop().getItemStack().getType() == Material.COMPASS))
if (flag.getCarrier() != null)
if (flag.getCarrier().getName().equals(event.getPlayer().getName()))
{
event.setCancelled(false);
event.getItemDrop().remove();
flag.drop(event.getPlayer());
resetInventory(event.getPlayer());
}
}
@EventHandler
public void radarUpdate(UpdateEvent event)
{
if (!InProgress())
return;
if (event.getType() != UpdateType.TICK)
return;
ArrayList<RadarData> data = new ArrayList<RadarData>();
for (Flag f : _flags)
{
if (f.getCarrier() == null)
data.add(new RadarData(f.getPlacedLocation(), f.getTeam().GetColor() + ""));
else
data.add(new RadarData(f.getCarrier().getLocation(), getVisualResult(f.getTeam().GetColor()) + ""));
}
data.add(new RadarData(_redFlag, C.cRed + ""));
data.add(new RadarData(_blueFlag, C.cBlue + ""));
for (Player player : UtilServer.getPlayers())
UtilRadar.displayRadar(player, data);
}
@EventHandler
public void useCmd(PlayerCommandPreprocessEvent event)
{
if (!InProgress())
return;
if (event.getMessage().contains("/suddendeath"))
{
boolean authorized = Manager.GetClients().Get(event.getPlayer()).GetRank().has(Rank.JNR_DEV);
if (Manager.getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing"))
if (Manager.GetClients().Get(event.getPlayer()).GetRank().has(Rank.SNR_MODERATOR))
authorized = true;
if (Manager.GetGameHostManager().isPrivateServer())
if (Manager.GetGameHostManager().isAdmin(event.getPlayer(), false))
authorized = true;
if (Manager.GetGameHostManager().isEventServer())
if (Manager.GetClients().Get(event.getPlayer()).GetRank().has(Rank.SNR_MODERATOR))
authorized = true;
if (authorized)
{
if (_redScore < _blueScore)
_redScore = _blueScore;
else
_blueScore = _redScore;
_gameTime = (System.currentTimeMillis() - GetStateTime()) + 11;
for (Player pl : UtilServer.getPlayers())
UtilPlayer.message(pl, C.cYellowB + event.getPlayer().getName() + " has equalized both teams and enabled Sudden Death!");
}
else
UtilPlayer.message(event.getPlayer(), F.main("Game", "You do not have permission to use this game modifier!"));
event.setCancelled(true);
}
}
@EventHandler
public void powerupPickup(PlayerPickupItemEvent event)
{
if (!IsLive())
return;
for (Flag f : _flags)
if (f.getCarrier() == event.getPlayer())
return;
if (_suddenDeath)
return;
for (Resupply resupply : _resupply)
resupply.Pickup(event.getPlayer(), event.getItem());
}
//Dont allow powerups to despawn
@EventHandler
public void itemDespawn(ItemDespawnEvent event)
{
event.setCancelled(true);
}
@EventHandler
public void onDie(CombatDeathEvent event)
{
Player player = UtilPlayer.searchExact(event.GetLog().GetPlayer().GetName());
if (event.GetLog().GetKiller() != null)
{
if (event.GetLog().GetKiller().IsPlayer())
{
Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
if (isEnemyCarrier(player, killer))
{
CarrierCombatDeathEvent e = new CarrierCombatDeathEvent(player, killer);
Bukkit.getPluginManager().callEvent(e);
}
}
}
for (Flag flag : _flags)
flag.drop(player);
getArcadeManager().getClassManager().forceRemoveFromSuppressed(player.getName());
}
@EventHandler
public void onQuit(PlayerQuitEvent event)
{
for (Flag flag : _flags)
flag.drop(event.getPlayer());
getArcadeManager().getClassManager().forceRemoveFromSuppressed(event.getPlayer().getName());
}
@EventHandler
public void equalizeBrute(CustomDamageEvent event)
{
if (event.GetDamageePlayer() == null)
return;
boolean carrier = false;
for (Flag flag : _flags)
if (flag.getCarrier() != null)
if (flag.getCarrier().getName().equals(event.GetDamageePlayer().getName()))
carrier = true;
if (carrier)
{
if (event.GetDamageePlayer().getInventory().getChestplate() != null)
if (event.GetDamageePlayer().getInventory().getChestplate().getType() == Material.DIAMOND_CHESTPLATE)
event.SetBrute();
}
}
}

View File

@ -7,6 +7,9 @@ import java.util.HashMap;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
@ -24,8 +27,12 @@ import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerPickupItemEvent;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.RadarData;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilRadar;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextTop;
import mineplex.core.elo.EloPlayer; import mineplex.core.elo.EloPlayer;
import mineplex.core.elo.EloTeam; import mineplex.core.elo.EloTeam;
import mineplex.core.elo.GameResult; import mineplex.core.elo.GameResult;
@ -435,4 +442,22 @@ public class Domination extends TeamGame
if (UtilBlock.usable(event.getClickedBlock())) if (UtilBlock.usable(event.getClickedBlock()))
event.setCancelled(true); event.setCancelled(true);
} }
@EventHandler
public void radarUpdate(UpdateEvent event)
{
if (!InProgress())
return;
if (event.getType() != UpdateType.TICK)
return;
ArrayList<RadarData> data = new ArrayList<RadarData>();
for (CapturePoint point : _points)
data.add(new RadarData(point.getLocation(), point.getRadarTag()));
for (Player player : UtilServer.getPlayers())
UtilRadar.displayRadar(player, data);
}
} }

View File

@ -0,0 +1,36 @@
package nautilus.game.arcade.game.games.common.ctf_data;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class CarrierCombatDeathEvent extends Event
{
private static final HandlerList handlers = new HandlerList();
private Player _killed;
private Player _killer;
public CarrierCombatDeathEvent(Player killed, Player killer)
{
_killed = killed;
_killer = killer;
}
public HandlerList getHandlers()
{
return handlers;
}
public static HandlerList getHandlerList()
{
return handlers;
}
public Player GetPlayer(boolean killer)
{
if (killer)
return _killer;
else
return _killed;
}
}

View File

@ -0,0 +1,436 @@
package nautilus.game.arcade.game.games.common.ctf_data;
import java.util.ArrayList;
import java.util.List;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextBottom;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTime;
import mineplex.core.hologram.Hologram;
import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.common.CaptureTheFlag;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.DyeColor;
import org.bukkit.FireworkEffect;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Banner;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.banner.Pattern;
import org.bukkit.block.banner.PatternType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BannerMeta;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
public class Flag
{
private CaptureTheFlag _host;
private Location _spawn;
private Location _particleLoc;
private Location _beacon;
private Block _flagBlock;
private Material _priorBlock;
private Byte _priorData;
private GameTeam _team;
private ChatColor _enemy;
private ItemStack _representation;
private DyeColor _dyeData;
private List<Pattern> _patterns;
private Player _holding = null;
private boolean _moved = false;
private boolean _dropped = false;
private long _dropTime = 0;
private int _respawnTimer;
private Hologram _name, _time;
private String _displayName;
public Flag(CaptureTheFlag host, Location spawn, GameTeam team)
{
_host = host;
_spawn = spawn;
_beacon = _spawn.clone().add(0, -2, 0);
_team = team;
_displayName = team.GetColor() + team.GetName() + "'s Flag".replace("s's", "s'");
_patterns = new ArrayList<Pattern>();
ItemStack i;
if (team.GetColor() == ChatColor.RED)
{
i = new ItemStack(Material.BANNER);
_dyeData = DyeColor.RED;
_enemy = ChatColor.BLUE;
_patterns.add(new Pattern(DyeColor.WHITE, PatternType.CROSS));
}
else
{
i = new ItemStack(Material.BANNER);
_dyeData = DyeColor.BLUE;
_enemy = ChatColor.RED;
_patterns.add(new Pattern(DyeColor.WHITE, PatternType.CIRCLE_MIDDLE));
}
BannerMeta im = (BannerMeta) i.getItemMeta();
im.setBaseColor(_dyeData);
im.setPatterns(_patterns);
im.setDisplayName(_displayName);
i.setItemMeta(im);
_representation = i;
_name = new Hologram(_host.getArcadeManager().getHologramManager(), spawn, team.GetColor() + team.GetName() + "'s Flag".replace("s's", "s'"));
_time = new Hologram(_host.getArcadeManager().getHologramManager(), spawn, "");
spawnFlag(spawn);
}
public GameTeam getTeam()
{
return _team;
}
public boolean isAtHome()
{
return !_moved;
}
public Player getCarrier()
{
return _holding;
}
public Location getPlacedLocation()
{
return _flagBlock.getLocation().clone().add(0.5, 0, 0.5);
}
public ItemStack getRepresentation()
{
return _representation;
}
public String getDisplayName()
{
return _displayName;
}
private void announceSteal(Player cap, boolean steal)
{
if (steal)
UtilTextMiddle.display("", _host.GetTeam(cap).GetColor() + cap.getName() + C.cWhite + " stole " + _team.GetColor() + _team.GetName() + " Flag!", 0, 60, 10);
else
UtilTextMiddle.display("", _host.GetTeam(cap).GetColor() + cap.getName() + C.cWhite + " picked up " + _team.GetColor() + _team.GetName() + " Flag!", 0, 60, 10);
}
private void announceDrop(Player player)
{
UtilTextMiddle.display("", _enemy + player.getName() + C.cWhite + " dropped " + _team.GetColor() + _team.GetName() + " Flag!", 0, 60, 10);
}
private void announceCapture(Player player)
{
UtilTextMiddle.display("", _host.GetTeam(player).GetColor() + player.getName() + C.cWhite + " scored for " + _host.GetTeam(player).GetColor() + _host.GetTeam(player).GetName(), 0, 60, 10);
}
private void announceReturn()
{
UtilTextMiddle.display("", _team.GetColor() + _team.GetName() + " Flag " + C.cWhite + " has returned to base", 0, 60, 10);
}
public void update()
{
if (!_moved || _dropped)
{
_flagBlock.setType(Material.STANDING_BANNER);
Banner banner = (Banner) _flagBlock.getState();
banner.setBaseColor(_dyeData);
banner.setPatterns(_patterns);
banner.update();
}
if (_moved)
{
if (_dropped)
{
Integer r = Math.max(0, _respawnTimer);
_time.setText(remainColor(r) + r.toString());
if (_respawnTimer > -1)
return;
deleteFlag();
_moved = false;
_dropped = false;
spawnFlag(_spawn);
announceReturn();
UtilFirework.playFirework(_spawn.clone().add(0, 1, 0), FireworkEffect.builder().flicker(false).withColor(_team.GetColorBase()).with(Type.BURST).trail(true).build());
return;
}
if (_holding == null)
return;
while (UtilMath.offset(_particleLoc, _holding.getEyeLocation().clone().add(0.0, 0.5, 0.0)) > .2)
{
if (_team.GetColor() == ChatColor.RED)
{
for (int i = 0 ; i < 2 ; i++)
UtilParticle.PlayParticle(ParticleType.RED_DUST, _particleLoc, 0, 0, 0, 0, 1,
ViewDist.MAX, UtilServer.getPlayers());
}
else
{
for (int i = 0 ; i < 2 ; i++)
UtilParticle.PlayParticle(ParticleType.RED_DUST, _particleLoc, -1, 1, 1, 1, 0,
ViewDist.MAX, UtilServer.getPlayers());
}
_particleLoc.add(UtilAlg.getTrajectory(_particleLoc, _holding.getEyeLocation().clone().add(0.0, 0.5, 0.0)).multiply(.2));
}
if (_host.GetTeam(_holding).GetColor() == ChatColor.RED)
_holding.setCompassTarget(_host.getRedFlag());
else
_holding.setCompassTarget(_host.getBlueFlag());
if (!_holding.hasPotionEffect(PotionEffectType.SLOW))
_holding.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 1000000, 1));
//_holding.getWorld().playSound(_holding.getLocation(), Sound.NOTE_STICKS, 2f, 1f);
score(_holding);
}
}
public void handleRespawn()
{
if (_moved)
{
if (_dropped)
{
_respawnTimer = _respawnTimer - 1;
}
else
{
if (_respawnTimer < 15)
_respawnTimer = _respawnTimer + 1;
}
}
}
public void handleBottomInfo(boolean flicker, ChatColor color)
{
if (_holding != null)
{
if (flicker)
UtilTextBottom.display(color + "Return the Flag to your Capture Zone!", _holding);
else
UtilTextBottom.display("Return the Flag to your Capture Zone!", _holding);
}
}
private ChatColor remainColor(int remain)
{
if (remain >= 9) return ChatColor.GREEN;
if ((remain < 9) && (remain >= 6)) return ChatColor.YELLOW;
return ChatColor.RED;
}
@SuppressWarnings("deprecation")
public void spawnFlag(Location loc)
{
while (!UtilBlock.airFoliage(loc.getBlock().getRelative(BlockFace.DOWN)))
loc.add(0, -1, 0);
while (!UtilBlock.airFoliage(loc.getBlock()))
loc.add(0, 1, 0);
_flagBlock = loc.getBlock();
_host.getArcadeManager().getClassManager().GetSkillFactory().BlockRestore().Restore(_flagBlock);
_priorBlock = loc.getBlock().getType();
_priorData = loc.getBlock().getData();
_flagBlock.setType(Material.STANDING_BANNER);
Banner banner = (Banner) _flagBlock.getState();
banner.setBaseColor(_dyeData);
banner.setPatterns(_patterns);
banner.update();
if (!_moved)
{
_name.setLocation(loc.getBlock().getLocation().clone().add(0.5, 3, 0.5));
_name.start();
_beacon.getBlock().setType(Material.BEACON);
_respawnTimer = 15;
}
else
{
_name.setLocation(loc.getBlock().getLocation().clone().add(0.5, 3, 0.5));
_name.start();
Integer re = Math.max(0, _respawnTimer);
_time.setText(remainColor(re) + re.toString());
_time.setLocation(loc.getBlock().getLocation().clone().add(0.5, 2.5, 0.5));
_time.start();
}
}
@SuppressWarnings("deprecation")
private void deleteFlag()
{
_flagBlock.setType(_priorBlock);
_flagBlock.setData(_priorData);
_beacon.getBlock().setType(Material.WOOL);
_beacon.getBlock().setData(_dyeData.getWoolData());
_name.stop();
_time.stop();
}
public boolean pickup(Player player)
{
if (_holding == null)
{
if (!UtilPlayer.isSpectator(player))
{
if (_host.IsAlive(player))
{
if (_host.GetTeam(player) != _team)
{
if (_dropped)
{
if (!UtilTime.elapsed(_dropTime, 3000))
return false;
}
deleteFlag();
_host.saveInventory(player);
for (int i = 0; i < 9; i++)
player.getInventory().setItem(i, _representation);
ItemStack compass = new ItemStack(Material.COMPASS);
ItemMeta im = compass.getItemMeta();
im.setDisplayName(C.cDAqua + "Your Base");
compass.setItemMeta(im);
player.getInventory().setItem(4, compass);
player.getInventory().setHelmet(_representation);
player.updateInventory();
player.getInventory().setHeldItemSlot(4);
for (PotionEffect effect : player.getActivePotionEffects())
player.removePotionEffect(effect.getType());
player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 1000000, 1));
player.setPassenger(null);
if (_moved)
announceSteal(player, false);
else
announceSteal(player, true);
_particleLoc = player.getEyeLocation().clone().add(0.0, 0.5, 0.0);
_holding = player;
_dropped = false;
_dropTime = 0;
_moved = true;
return true;
}
}
}
}
return false;
}
public void drop(Player player)
{
if (_moved)
{
if (_holding != null)
{
if (_holding.getUniqueId() == player.getUniqueId())
{
spawnFlag(player.getLocation());
announceDrop(player);
_holding = null;
_dropped = true;
_dropTime = System.currentTimeMillis();
}
}
}
}
public void score(Player player)
{
if (_moved)
{
if (_holding != null)
{
if (_holding.getUniqueId() == player.getUniqueId())
{
if (_team.GetColor() == ChatColor.RED)
if (!_host.isInZone(player.getLocation(), false)) return;
if (_team.GetColor() == ChatColor.BLUE)
if (!_host.isInZone(player.getLocation(), true)) return;
if (!_host.isAtHome(_team.GetColor() == ChatColor.RED ? ChatColor.BLUE : ChatColor.RED))
{
if (Recharge.Instance.use(player, "No Cap Message", 1000, false, false))
UtilTextMiddle.display("", C.cRed + "Your flag must be at home to capture!", player);
return;
}
_host.resetInventory(player);
announceCapture(player);
_host.AddGems(player, 10, "Enemy Flag Captured", true, true);
PlayerCaptureFlagEvent event = new PlayerCaptureFlagEvent(player);
Bukkit.getPluginManager().callEvent(event);
_host.addCapture(_host.GetTeam(player));
_moved = false;
_dropped = false;
_dropTime = 0;
spawnFlag(_spawn);
_holding = null;
}
}
}
}
}

View File

@ -0,0 +1,31 @@
package nautilus.game.arcade.game.games.common.ctf_data;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class PlayerCaptureFlagEvent extends Event
{
private static final HandlerList handlers = new HandlerList();
private Player _player;
public PlayerCaptureFlagEvent(Player player)
{
_player = player;
}
public HandlerList getHandlers()
{
return handlers;
}
public static HandlerList getHandlerList()
{
return handlers;
}
public Player GetPlayer()
{
return _player;
}
}

View File

@ -452,4 +452,25 @@ public class CapturePoint
Host.AddGems(player, amount / 25d, "Control Point Score", true, true); Host.AddGems(player, amount / 25d, "Control Point Score", true, true);
Host.GetStats(player).CaptureScore += amount; Host.GetStats(player).CaptureScore += amount;
} }
public Location getLocation()
{
return _loc.clone();
}
public String getRadarTag()
{
String out = "";
if (_owner != null)
{
if (_owner.GetColor() == ChatColor.BLUE)
out += ChatColor.AQUA;
else
out += _owner.GetColor();
}
return out + _name.substring(0, Math.min(1, _name.length()));
}
} }

View File

@ -68,12 +68,18 @@ public class Emerald
public void Pickup(Player player, Item item) public void Pickup(Player player, Item item)
{ {
if (!Host.IsLive())
return;
if (_ent == null) if (_ent == null)
return; return;
if (!_ent.equals(item)) if (!_ent.equals(item))
return; return;
if (_ent.getTicksLived() <= 40)
return;
if (!Host.IsAlive(player)) if (!Host.IsAlive(player))
return; return;

View File

@ -68,12 +68,18 @@ public class Resupply
public void Pickup(Player player, Item item) public void Pickup(Player player, Item item)
{ {
if (!Host.IsLive())
return;
if (_ent == null) if (_ent == null)
return; return;
if (!_ent.equals(item)) if (!_ent.equals(item))
return; return;
if (_ent.getTicksLived() <= 40)
return;
if (!Host.IsAlive(player)) if (!Host.IsAlive(player))
return; return;

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